Meshing in Salome 7.3.0 (partly) worse than in Salome 7.2.0

http://www.salome-platform.org/forum/forum_12/177188362

Speed-up a bit and fix a bug that _hypParameters in not nullified in CheckHypothesis()
This commit is contained in:
eap 2014-04-23 15:31:14 +04:00
parent fabcced208
commit 67c76bbea8

View File

@ -128,6 +128,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::CheckHypothesis (SMESH_Mesh& aMesh,
_hypMaxElementArea = 0; _hypMaxElementArea = 0;
_hypLengthFromEdges = 0; _hypLengthFromEdges = 0;
_hypQuadranglePreference = 0; _hypQuadranglePreference = 0;
_hypParameters = 0;
_progressByTic = -1; _progressByTic = -1;
const list<const SMESHDS_Hypothesis*>& hyps = GetUsedHypothesis(aMesh, aShape, false); const list<const SMESHDS_Hypothesis*>& hyps = GetUsedHypothesis(aMesh, aShape, false);
@ -324,26 +325,34 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
if ( problem && !problem->IsOK() ) if ( problem && !problem->IsOK() )
return error( problem ); return error( problem );
// limit element size near existing segments if ( iLoop == 0 )
TopTools_IndexedMapOfShape edgeMap, faceMap;
TopExp::MapShapes( aMesh.GetShapeToMesh(), TopAbs_EDGE, edgeMap );
for ( int iE = 1; iE <= edgeMap.Extent(); ++iE )
{ {
const TopoDS_Shape& edge = edgeMap( iE ); // limit element size near existing segments
if ( SMESH_Algo::isDegenerated( TopoDS::Edge( edge )) || TopTools_IndexedMapOfShape edgeMap;
helper.IsSubShape( edge, aShape )) PShapeIteratorPtr solidIt = helper.GetAncestors( F, aMesh, TopAbs_SOLID );
continue; while ( const TopoDS_Shape* solid = solidIt->next() )
SMESHDS_SubMesh* smDS = aMesh.GetMeshDS()->MeshElements( edge );
if ( !smDS ) continue;
SMDS_ElemIteratorPtr segIt = smDS->GetElements();
while ( segIt->more() )
{ {
const SMDS_MeshElement* seg = segIt->next(); TopExp_Explorer eExp( *solid, TopAbs_EDGE );
SMESH_TNodeXYZ n1 = seg->GetNode(0); for ( ; eExp.More(); eExp.Next() )
SMESH_TNodeXYZ n2 = seg->GetNode(1); {
gp_XYZ p = 0.5 * ( n1 + n2 ); const TopoDS_Shape& edge = eExp.Current();
netgen::Point3d pi(p.X(), p.Y(), p.Z()); if (( SMESH_Algo::isDegenerated( TopoDS::Edge( edge ))) ||
ngMesh->RestrictLocalH( pi, Max(( n1 - n2 ).Modulus(), netgen::mparam.minh )); ( helper.IsSubShape( edge, aShape )) ||
( !edgeMap.Add( edge )))
continue;
SMESHDS_SubMesh* smDS = aMesh.GetMeshDS()->MeshElements( edge );
if ( !smDS ) continue;
SMDS_ElemIteratorPtr segIt = smDS->GetElements();
while ( segIt->more() )
{
const SMDS_MeshElement* seg = segIt->next();
SMESH_TNodeXYZ n1 = seg->GetNode(0);
SMESH_TNodeXYZ n2 = seg->GetNode(1);
gp_XYZ p = 0.5 * ( n1 + n2 );
netgen::Point3d pi(p.X(), p.Y(), p.Z());
ngMesh->RestrictLocalH( pi, Max(( n1 - n2 ).Modulus(), netgen::mparam.minh ));
}
}
} }
} }
@ -383,7 +392,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
error(str); error(str);
err = 1; err = 1;
} }
if ( err /*&& isMESHCONST_ANALYSE*/ && iLoop == 0 ) if ( err /*&& !isMESHCONST_ANALYSE*/ && iLoop == 0 )
{ {
netgen::mparam.minh = netgen::mparam.maxh; netgen::mparam.minh = netgen::mparam.maxh;
netgen::mparam.maxh = 0; netgen::mparam.maxh = 0;
@ -391,14 +400,14 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
{ {
StdMeshers_FaceSidePtr wire = wires[ iW ]; StdMeshers_FaceSidePtr wire = wires[ iW ];
const vector<UVPtStruct>& uvPtVec = wire->GetUVPtStruct(); const vector<UVPtStruct>& uvPtVec = wire->GetUVPtStruct();
for ( size_t iP = 0; iP < uvPtVec.size(); ++iP ) for ( size_t iP = 1; iP < uvPtVec.size(); ++iP )
{ {
netgen::Point3d p( uvPtVec[iP].node->X(), SMESH_TNodeXYZ p( uvPtVec[ iP ].node );
uvPtVec[iP].node->Y(), netgen::Point3d np( p.X(),p.Y(),p.Z());
uvPtVec[iP].node->Z()); double segLen = p.Distance( uvPtVec[ iP-1 ].node );
double size = ngMesh->GetH( p ); double size = ngMesh->GetH( np );
netgen::mparam.minh = Min( netgen::mparam.minh, size ); netgen::mparam.minh = Min( netgen::mparam.minh, size );
netgen::mparam.maxh = Max( netgen::mparam.maxh, size ); netgen::mparam.maxh = Max( netgen::mparam.maxh, segLen );
} }
} }
//cerr << "min " << netgen::mparam.minh << " max " << netgen::mparam.maxh << endl; //cerr << "min " << netgen::mparam.minh << " max " << netgen::mparam.maxh << endl;