Some fixes

This commit is contained in:
jfa 2024-07-26 13:46:11 +01:00
parent 2a2216e5d2
commit 02ad02e211
5 changed files with 84 additions and 71 deletions

View File

@ -119,6 +119,9 @@ bool testShape (const TopoDS_Shape theShape,
GridInitAndIntersectWithShape( grid, theGridSpacing, theSizeThreshold,
theShape, edge2faceIDsMap, 1 );
SMESH_subMesh * aSubMesh = aMesh->GetSubMesh(theShape);
aSubMesh->DependsOn(); // init sub-meshes
Hexahedron hex( &grid );
int nbAdded = hex.MakeElements( helper, edge2faceIDsMap, 1 );
if (nbAdded != theNbCreatedExpected) {
@ -155,10 +158,9 @@ bool testPrimitives()
/*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/6))
isOK = false;
// TODO: debug this case
//if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/true,
// /*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/8))
// isOK = false;
if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/true,
/*gridSpacing*/10, /*theSizeThreshold*/4, /*theNbCreatedExpected*/6))
isOK = false;
if (!testShape (aShape, /*toAddEdges*/false, /*toCreateFaces*/false,
/*gridSpacing*/5, /*theSizeThreshold*/4, /*theNbCreatedExpected*/48))

View File

@ -134,6 +134,9 @@ bool testNRTM1()
TEdge2faceIDsMap edge2faceIDsMap;
GridInitAndIntersectWithShape( grid, 1.0, 4.0, aShape, edge2faceIDsMap, nThreads );
SMESH_subMesh * aSubMesh = aMesh->GetSubMesh(aShape);
aSubMesh->DependsOn(); // init sub-meshes
Hexahedron hex( &grid );
int nbAdded = hex.MakeElements( helper, edge2faceIDsMap, nThreads );
CPPUNIT_ASSERT_MESSAGE( "Number of computed elements does not match", nbAdded == 1024 );
@ -175,7 +178,12 @@ bool testNRTJ4()
grid._sizeThreshold = testThreshold;
TEdge2faceIDsMap edge2faceIDsMap;
GridInitAndIntersectWithShape( grid, 2.0, testThreshold, aShape, edge2faceIDsMap, nThreads );
GridInitAndIntersectWithShape( grid, 2.0, testThreshold,
aShape, edge2faceIDsMap, nThreads );
SMESH_subMesh * aSubMesh = aMesh->GetSubMesh(aShape);
aSubMesh->DependsOn(); // init sub-meshes
Hexahedron hex( &grid );
int nbAdded = hex.MakeElements( helper, edge2faceIDsMap, nThreads );
CPPUNIT_ASSERT_MESSAGE( "Number of computed elements does not match", nbAdded == 35150 );

View File

@ -361,9 +361,13 @@ void StdMeshers_CartesianParameters3D::ComputeCoordinates(const double x0,
++iCell;
}
}
const double lastCellLen = coords.back() - coords[ coords.size() - 2 ];
if ( fabs( coords.back() - p1 ) > 0.5 * lastCellLen )
if (coords.size() < 2)
coords.push_back ( p1 );
else {
const double lastCellLen = coords.back() - coords[ coords.size() - 2 ];
if ( fabs( coords.back() - p1 ) > 0.5 * lastCellLen )
coords.push_back ( p1 );
}
}
// correct coords if a forced point is too close to a neighbor node

View File

@ -1100,7 +1100,7 @@ size_t Hexahedron::findCoplanarPolygon
const size_t nbQuadPolygons,
std::vector< _OrientedLink* >& freeLinks,
int& nbFreeLinks,
const E_IntersectPoint ipTmp,
const E_IntersectPoint& ipTmp,
std::set< StdMeshers::Cartesian3D::TGeomID >& usedFaceIDs,
std::map< StdMeshers::Cartesian3D::TGeomID, std::vector< const B_IntersectPoint* > >& tmpAddedFace,
const StdMeshers::Cartesian3D::TGeomID& curFace)
@ -1553,8 +1553,8 @@ void computeHexa(Type& hex)
* \brief Create elements in the mesh
*/
int Hexahedron::MakeElements(SMESH_MesherHelper& helper,
const map< TGeomID, vector< TGeomID > >& edge2faceIDsMap,
const int numOfThreads )
const map< TGeomID, vector< TGeomID > >& edge2faceIDsMap,
const int numOfThreads )
{
SMESHDS_Mesh* mesh = helper.GetMeshDS();
@ -2840,7 +2840,6 @@ int Hexahedron::addVolumes( SMESH_MesherHelper& helper )
_hexNodes[3].BoundaryNode(), _hexNodes[1].BoundaryNode(),
_hexNodes[4].BoundaryNode(), _hexNodes[6].BoundaryNode(),
_hexNodes[7].BoundaryNode(), _hexNodes[5].BoundaryNode() );
}
}
else

View File

@ -107,7 +107,7 @@ namespace Cartesian3D
char _isInternalFlags;
_Node(const SMDS_MeshNode* n=0, const StdMeshers::Cartesian3D::B_IntersectPoint* ip=0)
:_node(n), _intPoint(ip), _usedInFace(0), _isInternalFlags(0) {}
:_node(n), _boundaryCornerNode(0), _intPoint(ip), _usedInFace(0), _isInternalFlags(0) {}
const SMDS_MeshNode* Node() const
{ return ( _intPoint && _intPoint->_node ) ? _intPoint->_node : _node; }
const SMDS_MeshNode* BoundaryNode() const
@ -166,7 +166,7 @@ namespace Cartesian3D
std::vector< const StdMeshers::Cartesian3D::F_IntersectPoint* > _fIntPoints; // GridLine intersections with FACEs
std::vector< _Node* > _fIntNodes; // _Node's at _fIntPoints
std::vector< _Link > _splits;
_Link(): _faces{ 0, 0 } {}
_Link(): _nodes{ 0, 0 }, _faces{ 0, 0 } {}
};
// --------------------------------------------------------------------------------
@ -460,7 +460,7 @@ namespace Cartesian3D
const size_t nbQuadPolygons,
std::vector< _OrientedLink* >& freeLinks,
int& nbFreeLinks,
const E_IntersectPoint ipTmp,
const E_IntersectPoint& ipTmp,
std::set< StdMeshers::Cartesian3D::TGeomID >& usedFaceIDs,
std::map< StdMeshers::Cartesian3D::TGeomID, std::vector< const B_IntersectPoint* > >& tmpAddedFace,
const StdMeshers::Cartesian3D::TGeomID& curFace);