-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0 indexed meshes(#114) #120
Conversation
…ed into load_msh.cpp
…ndexed-meshes(#114)
Okay, trying this again but hopefully with working integration tests this time. @ktbolt and @mrp089 mostly what I want to make sure is that any of these changes are how we would like to address this issue. Specifically I assume that we conserve the counter-clockwise ordering of nodes within elements of the imported meshes (the same conventions used by VTK) thus the following elements have the following node orders:
These ordering schemes for the boundaries are reflected in as a |
@zasexton svFSIplus will reorder element connectivity to whatever node ordering it needs. |
@ktbolt yes and to avoid checking all combinations of nodes for matching (which seemed to cause hanging on the |
Code/Source/svFSI/load_msh.cpp
Outdated
for (int i = 0; i<mesh.gnNo; i++){ | ||
std::string key = ""; | ||
for (int j = 0; j<com_mod.nsd; j++){ | ||
key += std::to_string(mesh.x(j,i)) + ","; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::to_string()
only converts to six significant digits. If you want to use strings then you will need to use std::stringstream
and std::setprecision()
.
It would be faster (?) and use less memory but a bit more complicated to map the coordinates into an integer index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I can include this. Is there a certain precision that we should set by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming a precision that will convert a double exactly is the problem with using strings, would need to set it to 16 maybe but then the strings would be 18 bytes, larger using std::scientific
.
I think a better solution is to map the coordinates to an integer index into a map of some sort.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed the unsorted_map keys for the global nodes to be constructed as strings from 16 precision scientific format of the coordinates using std::scientific
and std::set_precision
. Maybe we can change this to an integer map later on...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zasexton Good, we can refine the code later if needed.
@zasexton You mixing in code from two different Issues. |
Yes I was trying to merge the other way around so I could continue on the perfusion problem (oops). I reverted those changes |
@zasexton Add a check if the unsorted_map key already exists when mapping the global nodes. This will uncover any problems with the specified precision. Also encapsulate all of these functions into a class, separating each portion of the computation into its own method. |
encapsulation of functions creating the hash maps for the global node and element IDs have been added the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Be sure to remove commented out code, it is always confusing.
…ndexed-meshes(#114)
* adding darcy equation * darcy equation can be built but generates a trivially zero solution * commenting files to find mesh indexing error * correcting gN, gE, and IEN after reading meshes * removing IEN resetting in vtk_xml.cpp since this functionality is moved into load_msh.cpp * adding general parameters for unsteady darcy problem * added final version of the hash map for gN, gE, and IEN setting for face meshes * adding binary mask permutation for non-tet elements (#114) * adding boundary node counter-clockwise ordering to element matching (#114) * completed 2D darcy general model formulation for (#71) * adding scientific notation and 16 precision to global node matching (#114) * Revert "Merge branch 'Tissue-perfusion-model-#71' into 0-indexed-meshes(#114)" This reverts commit 7cbf43a0b21cdb5706b5292f8c5f62cd8b0d4070, reversing changes made to 7a97ef62e0b7b2e1d380230b081f62e508dce471. * encapsulating hash map generation (#114) * remove commented lines performing un-encapsulated hash map generation * adding error checking for duplicate nodes during hash map generation (#114) --------- Co-authored-by: Dave Parker <[email protected]>
* adding darcy equation * darcy equation can be built but generates a trivially zero solution * commenting files to find mesh indexing error * correcting gN, gE, and IEN after reading meshes * removing IEN resetting in vtk_xml.cpp since this functionality is moved into load_msh.cpp * adding general parameters for unsteady darcy problem * added final version of the hash map for gN, gE, and IEN setting for face meshes * adding binary mask permutation for non-tet elements (#114) * adding boundary node counter-clockwise ordering to element matching (#114) * completed 2D darcy general model formulation for (#71) * adding scientific notation and 16 precision to global node matching (#114) * Revert "Merge branch 'Tissue-perfusion-model-#71' into 0-indexed-meshes(#114)" This reverts commit 7cbf43a0b21cdb5706b5292f8c5f62cd8b0d4070, reversing changes made to 7a97ef62e0b7b2e1d380230b081f62e508dce471. * encapsulating hash map generation (#114) * remove commented lines performing un-encapsulated hash map generation * adding error checking for duplicate nodes during hash map generation (#114) --------- Co-authored-by: Dave Parker <[email protected]>
* adding darcy equation * darcy equation can be built but generates a trivially zero solution * commenting files to find mesh indexing error * correcting gN, gE, and IEN after reading meshes * removing IEN resetting in vtk_xml.cpp since this functionality is moved into load_msh.cpp * adding general parameters for unsteady darcy problem * added final version of the hash map for gN, gE, and IEN setting for face meshes * adding binary mask permutation for non-tet elements (#114) * adding boundary node counter-clockwise ordering to element matching (#114) * completed 2D darcy general model formulation for (#71) * adding scientific notation and 16 precision to global node matching (#114) * Revert "Merge branch 'Tissue-perfusion-model-#71' into 0-indexed-meshes(#114)" This reverts commit 7cbf43a0b21cdb5706b5292f8c5f62cd8b0d4070, reversing changes made to 7a97ef62e0b7b2e1d380230b081f62e508dce471. * encapsulating hash map generation (#114) * remove commented lines performing un-encapsulated hash map generation * adding error checking for duplicate nodes during hash map generation (#114) --------- Co-authored-by: Dave Parker <[email protected]>
*Arbitrary Mesh Indexing for Problem Initialization *
Current situation & Problem
In response to issue #114. Face mesh data for
svFSIplus
assumes thatGlobalNodeID
andGlobalElementID
are indexed at 1. This scheme is inconsistent with how VTK tools external to SimVascular construct connectivity data on meshes. The different scheme thus makes it difficult to build models in a scripted fashion either though SimVascular's Python VTK functions or external VTK functions. Further changes were made to avoid hanging that occurred during previous integration testing.Release Notes
Documentation
No new functions are added through this pull. Instead changes are introduced to existing functions for importing and handling mesh initialization.
Testing
Further testing will be needed for different element types for VTK_WEDGE. In addition, changes introduced to the code should be checked for clarity and minimal code needed for fast implementation. I've included my thoughts as I wrote these changes in #114.
Code of Conduct & Contributing Guidelines