0020526: [CEA] Disk meshing fails

1) in PrepareOCCgeometry(), map all subshapes in meshedSM is not provided
2) untabify
This commit is contained in:
eap 2009-10-08 13:57:20 +00:00
parent 61581f8b17
commit d5f1f4ce3a

View File

@ -47,9 +47,11 @@
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <NCollection_Map.hxx> #include <NCollection_Map.hxx>
#include <OSD_Path.hxx>
#include <OSD_File.hxx> #include <OSD_File.hxx>
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx> #include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_DataMapOfShapeInteger.hxx>
#include <Standard_ErrorHandler.hxx> #include <Standard_ErrorHandler.hxx>
#include <Standard_ProgramError.hxx> #include <Standard_ProgramError.hxx>
@ -254,7 +256,7 @@ void NETGENPlugin_Mesher::PrepareOCCgeometry(netgen::OCCGeometry& occgeo,
TopExp::MapShapes(root->GetSubShape(), subShapes); TopExp::MapShapes(root->GetSubShape(), subShapes);
while ( smIt->more() ) { while ( smIt->more() ) {
SMESH_subMesh* sm = smIt->next(); SMESH_subMesh* sm = smIt->next();
if ( sm->IsEmpty() ) { if ( !meshedSM || sm->IsEmpty() ) {
TopoDS_Shape shape = sm->GetSubShape(); TopoDS_Shape shape = sm->GetSubShape();
if ( shape.ShapeType() != TopAbs_VERTEX ) if ( shape.ShapeType() != TopAbs_VERTEX )
shape = subShapes( subShapes.FindIndex( shape ));// - shape->index->oriented shape shape = subShapes( subShapes.FindIndex( shape ));// - shape->index->oriented shape
@ -619,18 +621,25 @@ bool NETGENPlugin_Mesher::Compute()
else { else {
// length from edges // length from edges
double length = 0; double length = 0;
TopTools_MapOfShape tmpMap;
for ( TopExp_Explorer exp( _shape, TopAbs_EDGE ); exp.More(); exp.Next() ) for ( TopExp_Explorer exp( _shape, TopAbs_EDGE ); exp.More(); exp.Next() )
length += SMESH_Algo::EdgeLength( TopoDS::Edge( exp.Current() )); if( tmpMap.Add(exp.Current()) )
if ( ngMesh->GetNSeg() ) length += SMESH_Algo::EdgeLength( TopoDS::Edge( exp.Current() ));
mparams.maxh = length / ngMesh->GetNSeg();
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 else
mparams.maxh = 1000; mparams.maxh = 1000;
mparams.grading = 0.2; // slow size growth mparams.grading = 0.2; // slow size growth
} }
mparams.maxh = min( mparams.maxh, occgeo.boundingbox.Diam()/2 ); mparams.maxh = min( mparams.maxh, occgeo.boundingbox.Diam()/2 );
ngMesh->SetGlobalH (mparams.maxh); ngMesh->SetGlobalH (mparams.maxh);
netgen::Box<3> bb = occgeo.GetBoundingBox(); netgen::Box<3> bb = occgeo.GetBoundingBox();
bb.Increase (bb.Diam()/20); bb.Increase (bb.Diam()/20);
ngMesh->SetLocalH (bb.PMin(), bb.PMax(), mparams.grading); ngMesh->SetLocalH (bb.PMin(), bb.PMax(), mparams.grading);
} }
// let netgen compute 2D mesh // let netgen compute 2D mesh
@ -665,10 +674,10 @@ bool NETGENPlugin_Mesher::Compute()
// length from faces // length from faces
mparams.maxh = ngMesh->AverageH(); mparams.maxh = ngMesh->AverageH();
} }
// netgen::ARRAY<double> maxhdom; // netgen::ARRAY<double> maxhdom;
// maxhdom.SetSize (occgeo.NrSolids()); // maxhdom.SetSize (occgeo.NrSolids());
// maxhdom = mparams.maxh; // maxhdom = mparams.maxh;
// ngMesh->SetMaxHDomain (maxhdom); // ngMesh->SetMaxHDomain (maxhdom);
ngMesh->SetGlobalH (mparams.maxh); ngMesh->SetGlobalH (mparams.maxh);
mparams.grading = 0.4; mparams.grading = 0.4;
ngMesh->CalcLocalH(); ngMesh->CalcLocalH();