-
Notifications
You must be signed in to change notification settings - Fork 239
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
Move BC meshes; preparations #2140
Conversation
Before the id was (by default) set to std::size_t(-1).
The cloneElements is needed outside of MeshGeoToolsLib.
2788815
to
1f3d270
Compare
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.
Essentially only a performance-related comment.
// Special treatment of the non-line elements because the identifyFace | ||
// implementation expects three valid node pointers in the call. We can | ||
// guarantee only one valid node, and calling the identifyFace would | ||
// most likely lead to a SEGV. |
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.
Maybe I don't understand it right, but isn't that necessary only for points then?
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.
It is for points only (see function name: boundaryElementsAtPoint), but maybe I missed you point ;)
Note to myself: a similar case happens when searching for lines (having two points) in an element's face... but the case didn't happen yet.
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.
if there is something more to discuss, I'll prepare another PR, but for now we have to move on...
MeshLib/MeshSubset.h
Outdated
// testing if the given nodes belong to the mesh. | ||
auto node_is_part_of_mesh = | ||
[mesh_nodes = _msh.getNodes()](MeshLib::Node* const& n) { | ||
auto it = std::find(begin(mesh_nodes), end(mesh_nodes), n); |
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.
This is a pointer comparison. Is that correct?
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.
Yes. Just a logical check (not geometrical) if the subset of nodes is indeed a part of the mesh nodes vector.
MeshLib/MeshSubset.h
Outdated
} | ||
return true; | ||
}; | ||
if (!std::all_of(begin(_nodes), end(_nodes), node_is_part_of_mesh)) |
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.
The runtime complexity of that is length(mesh_nodes) * length(mesh_subset)
isn't that terribly slow?
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.
You are right, although it is not that slow that it would have drawn my attention to it.
I'll update for more optimized version in this PR. The special case (also very fast to check) is the whole mesh subset, where the nodes are the same as the mesh's nodes.
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.
Improving it, tested with GWF/square_1e5_neumann.prj
ufz/master time is 2.88s
the unsorted vector naive implementation runs in 4.95s
the sorted vector with binary search runs in 2.90s
and checking for the vector addresses before expensive search is indistinguishable from the ufz/master.
Taking the last one :)
MeshLib/MeshSubset.h
Outdated
auto it = std::find(begin(mesh_nodes), end(mesh_nodes), n); | ||
if (it == end(mesh_nodes)) | ||
{ | ||
ERR("A node %d in mesh subset is not a part of the mesh.", |
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.
Maybe outputting the coordinates too will help to find faster a possible reason for the error?
✅
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.
⏩
The identifyFace call with only one valid point in the nodes list is only valid for lines. Calling this function on other elements will most likely end in a SEGV. The problem didn't appear before, because this function was only called for line elements.
e48471e
to
060afc8
Compare
OpenGeoSys development has been moved to GitLab. |
A set of basic changes required for the actual "Move BC meshes #2141" PR.