#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <NCollection_Map.hxx>
+#include <OSD_Path.hxx>
#include <OSD_File.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_DataMapOfShapeInteger.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_ProgramError.hxx>
TopExp::MapShapes(root->GetSubShape(), subShapes);
while ( smIt->more() ) {
SMESH_subMesh* sm = smIt->next();
- if ( sm->IsEmpty() ) {
+ if ( !meshedSM || sm->IsEmpty() ) {
TopoDS_Shape shape = sm->GetSubShape();
if ( shape.ShapeType() != TopAbs_VERTEX )
shape = subShapes( subShapes.FindIndex( shape ));// - shape->index->oriented shape
else {
// length from edges
double length = 0;
+ TopTools_MapOfShape tmpMap;
for ( TopExp_Explorer exp( _shape, TopAbs_EDGE ); exp.More(); exp.Next() )
- length += SMESH_Algo::EdgeLength( TopoDS::Edge( exp.Current() ));
- if ( ngMesh->GetNSeg() )
- mparams.maxh = length / ngMesh->GetNSeg();
+ if( tmpMap.Add(exp.Current()) )
+ length += SMESH_Algo::EdgeLength( TopoDS::Edge( exp.Current() ));
+
+ if ( ngMesh->GetNSeg() ) {
+ // we have to multiply length by 2 since for each TopoDS_Edge there
+ // are double set of NETGEN edges or, in other words, we have to
+ // divide ngMesh->GetNSeg() on 2.
+ mparams.maxh = 2*length / ngMesh->GetNSeg();
+ }
else
mparams.maxh = 1000;
mparams.grading = 0.2; // slow size growth
}
mparams.maxh = min( mparams.maxh, occgeo.boundingbox.Diam()/2 );
ngMesh->SetGlobalH (mparams.maxh);
- netgen::Box<3> bb = occgeo.GetBoundingBox();
- bb.Increase (bb.Diam()/20);
+ netgen::Box<3> bb = occgeo.GetBoundingBox();
+ bb.Increase (bb.Diam()/20);
ngMesh->SetLocalH (bb.PMin(), bb.PMax(), mparams.grading);
}
// let netgen compute 2D mesh
// length from faces
mparams.maxh = ngMesh->AverageH();
}
-// netgen::ARRAY<double> maxhdom;
-// maxhdom.SetSize (occgeo.NrSolids());
-// maxhdom = mparams.maxh;
-// ngMesh->SetMaxHDomain (maxhdom);
+// netgen::ARRAY<double> maxhdom;
+// maxhdom.SetSize (occgeo.NrSolids());
+// maxhdom = mparams.maxh;
+// ngMesh->SetMaxHDomain (maxhdom);
ngMesh->SetGlobalH (mparams.maxh);
mparams.grading = 0.4;
ngMesh->CalcLocalH();