Corrections for parallel smesh

Was crashing one of the testbase NRT_GRIDS_SMESH_BUGS_08_I1.
Issue was that input info must be sorted to ensure the same number of
volumes in one process.
Also ensure that netgen::mparam parameters are all initialised.
This commit is contained in:
Yoann Audouin 2022-10-24 16:26:57 +02:00
parent 92cbce71d3
commit 1aecb09c15
5 changed files with 15 additions and 5 deletions

View File

@ -599,6 +599,8 @@ void NETGENPlugin_Mesher::SetDefaultParameters()
_fineness = NETGENPlugin_Hypothesis::GetDefaultFineness(); _fineness = NETGENPlugin_Hypothesis::GetDefaultFineness();
mparams.uselocalh = NETGENPlugin_Hypothesis::GetDefaultSurfaceCurvature(); mparams.uselocalh = NETGENPlugin_Hypothesis::GetDefaultSurfaceCurvature();
netgen::merge_solids = NETGENPlugin_Hypothesis::GetDefaultFuseEdges(); netgen::merge_solids = NETGENPlugin_Hypothesis::GetDefaultFuseEdges();
// Unused argument but set 0 to initialise it
mparams.elementorder = 0;
#ifdef NETGEN_V6 #ifdef NETGEN_V6
@ -612,6 +614,7 @@ void NETGENPlugin_Mesher::SetDefaultParameters()
#endif #endif
} }
//============================================================================= //=============================================================================
/*! /*!
* Pass parameters to NETGEN * Pass parameters to NETGEN
@ -4496,6 +4499,9 @@ int NETGENPlugin_NetgenLibWrapper::GenerateMesh( netgen::OCCGeometry& occgeo,
if ( !ngMesh ) if ( !ngMesh )
ngMesh = new netgen::Mesh; ngMesh = new netgen::Mesh;
// To dump mparam
// netgen::mparam.Print(std::cerr);
#ifdef NETGEN_V6 #ifdef NETGEN_V6
ngMesh->SetGeometry( shared_ptr<netgen::NetgenGeometry>( &occgeo, &NOOP_Deleter )); ngMesh->SetGeometry( shared_ptr<netgen::NetgenGeometry>( &occgeo, &NOOP_Deleter ));

View File

@ -218,7 +218,7 @@ bool NETGENPlugin_NETGEN_3D::getSurfaceElements(
SMESH_ProxyMesh::Ptr proxyMesh, SMESH_ProxyMesh::Ptr proxyMesh,
NETGENPlugin_Internals &internals, NETGENPlugin_Internals &internals,
SMESH_MesherHelper &helper, SMESH_MesherHelper &helper,
std::map<const SMDS_MeshElement*, tuple<bool, bool>>& listElements std::map<const SMDS_MeshElement*, tuple<bool, bool>, TIDCompare>& listElements
) )
{ {
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
@ -309,6 +309,8 @@ bool NETGENPlugin_NETGEN_3D::computeFillNgMesh(
SMESH::Controls::TSequenceOfXYZ nodesCoords; SMESH::Controls::TSequenceOfXYZ nodesCoords;
// maps nodes to ng ID // maps nodes to ng ID
// map must be sorted by ID to ensure that we will have the same number of
// 3D element if we recompute
typedef map< const SMDS_MeshNode*, int, TIDCompare > TNodeToIDMap; typedef map< const SMDS_MeshNode*, int, TIDCompare > TNodeToIDMap;
typedef TNodeToIDMap::value_type TN2ID; typedef TNodeToIDMap::value_type TN2ID;
TNodeToIDMap nodeToNetgenID; TNodeToIDMap nodeToNetgenID;
@ -338,7 +340,9 @@ bool NETGENPlugin_NETGEN_3D::computeFillNgMesh(
proxyMesh.reset( Adaptor ); proxyMesh.reset( Adaptor );
} }
std::map<const SMDS_MeshElement*, tuple<bool, bool>> listElements; // map must be sorted by ID to ensure that we will have the same number of
// 3D element if we recompute
std::map<const SMDS_MeshElement*, tuple<bool, bool>, TIDCompare> listElements;
bool ret = getSurfaceElements(aMesh, aShape, proxyMesh, internals, helper, listElements); bool ret = getSurfaceElements(aMesh, aShape, proxyMesh, internals, helper, listElements);
if(ret) if(ret)
return ret; return ret;

View File

@ -107,7 +107,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D: public SMESH_3D_Algo
SMESH_ProxyMesh::Ptr proxyMesh, SMESH_ProxyMesh::Ptr proxyMesh,
NETGENPlugin_Internals &internals, NETGENPlugin_Internals &internals,
SMESH_MesherHelper &helper, SMESH_MesherHelper &helper,
std::map<const SMDS_MeshElement*, std::tuple<bool, bool>>& listElements); std::map<const SMDS_MeshElement*, std::tuple<bool, bool>, TIDCompare>& listElements);
bool compute(SMESH_Mesh& mesh, bool compute(SMESH_Mesh& mesh,
SMESH_MesherHelper& helper, SMESH_MesherHelper& helper,

View File

@ -322,7 +322,7 @@ bool NETGENPlugin_NETGEN_3D_SA::getSurfaceElements(
SMESH_ProxyMesh::Ptr proxyMesh, SMESH_ProxyMesh::Ptr proxyMesh,
NETGENPlugin_Internals &internals, NETGENPlugin_Internals &internals,
SMESH_MesherHelper &helper, SMESH_MesherHelper &helper,
std::map<const SMDS_MeshElement*, tuple<bool, bool>>& listElements std::map<const SMDS_MeshElement*, tuple<bool, bool>, TIDCompare>& listElements
) )
{ {
// To remove compilation warnings // To remove compilation warnings

View File

@ -72,7 +72,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D_SA: public NETGENPlugin_NETGEN_
SMESH_ProxyMesh::Ptr proxyMesh, SMESH_ProxyMesh::Ptr proxyMesh,
NETGENPlugin_Internals &internals, NETGENPlugin_Internals &internals,
SMESH_MesherHelper &helper, SMESH_MesherHelper &helper,
std::map<const SMDS_MeshElement*, tuple<bool, bool>>& listElements std::map<const SMDS_MeshElement*, tuple<bool, bool>, TIDCompare>& listElements
) override; ) override;
std::string _element_orientation_file=""; std::string _element_orientation_file="";