Skip to content

Commit

Permalink
Update kratos/containers/geometry_container.h
Browse files Browse the repository at this point in the history
Co-authored-by: Vicente Mataix Ferrándiz <[email protected]>
  • Loading branch information
rubenzorrilla and loumalouomega authored Sep 30, 2024
1 parent 978123e commit 37e75f1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions kratos/containers/geometry_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,12 @@ class GeometryContainer
return mGeometries.insert(pNewGeometry);
} else if (&(*i) == pNewGeometry.get()) { // check if the pointee coincides
return i;
} else { // check if the connectivities coincide
// first check for the geometry type
} else { // Check if the connectivities coincide
// First check for the geometry type
KRATOS_ERROR_IF_NOT(TGeometryType::HasSameGeometryType(*i, *pNewGeometry)) << "Attempting to add geometry with Id: " << pNewGeometry->Id() << ". A different geometry with the same Id already exists." << std::endl;
// check that the connectivities are the same
// Check that the connectivities are the same
// note that we deliberately check the node ids and not the pointer adresses as there might be very rare situations

// (e.g., creating nodes bypassing the model part interface) with same connectivities but different pointer addresses
for (IndexType i_node = 0; i_node < i->PointsNumber(); ++i_node) {
KRATOS_ERROR_IF((*i)[i_node].Id() != (*pNewGeometry)[i_node].Id()) << "Attempting to add a new geometry with Id: " << pNewGeometry->Id() << ". A same type geometry with same Id but different connectivities already exists." << std::endl;
Expand Down

0 comments on commit 37e75f1

Please sign in to comment.