0021893: EDF 2133 SMESH : Improvement of 3D extrusion algorithm

1) fix GetLayersTransformation(): use EDGEs in a right order
   2) Find source FACE by a local 1D hyps
This commit is contained in:
eap 2013-02-04 14:25:07 +00:00
parent 5b40fe7dff
commit 6e5ef9a043

View File

@ -502,26 +502,29 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
{ {
TopoDS_Face face = meshedFaces.front(); TopoDS_Face face = meshedFaces.front();
meshedFaces.pop_front(); meshedFaces.pop_front();
solidIt.Initialize( faceToSolids.FindFromKey( face )); TopTools_ListOfShape& solidList = faceToSolids.ChangeFromKey( face );
for ( ; solidIt.More(); solidIt.Next() ) while ( !solidList.IsEmpty() )
{ {
const TopoDS_Shape& solid = solidIt.Value(); TopoDS_Shape solid = solidList.First();
if ( !meshedSolids.Add( solid )) solidList.RemoveFirst();
continue; // already computed prism if ( meshedSolids.Add( solid ))
{
prism.Clear();
prism.myBottom = face;
if ( !initPrism( prism, solid ) ||
!compute( prism ))
return false;
prism.Clear(); meshedFaces.push_front( prism.myTop );
prism.myBottom = face; meshedPrism.push_back( prism );
if ( !initPrism( prism, solid ) || }
!compute( prism ))
return false;
meshedFaces.push_front( prism.myTop );
meshedPrism.push_back( prism );
} }
} }
if ( meshedSolids.Extent() == nbSolids ) if ( meshedSolids.Extent() == nbSolids )
break; break;
// below in the loop we try to find source FACEs somehow
// project mesh from source FACEs of computed prisms to // project mesh from source FACEs of computed prisms to
// prisms sharing wall FACEs // prisms sharing wall FACEs
list< Prism_3D::TPrismTopo >::iterator prismIt = meshedPrism.begin(); list< Prism_3D::TPrismTopo >::iterator prismIt = meshedPrism.begin();
@ -533,13 +536,15 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
for ( ; wQuad != prismIt->myWallQuads[iW].end(); ++ wQuad ) for ( ; wQuad != prismIt->myWallQuads[iW].end(); ++ wQuad )
{ {
const TopoDS_Face& wFace = (*wQuad)->face; const TopoDS_Face& wFace = (*wQuad)->face;
solidIt.Initialize( faceToSolids.FindFromKey( wFace )); TopTools_ListOfShape& solidList = faceToSolids.ChangeFromKey( wFace );
for ( ; solidIt.More(); solidIt.Next() ) solidIt.Initialize( solidList );
while ( solidIt.More() )
{ {
const TopoDS_Shape& solid = solidIt.Value(); const TopoDS_Shape& solid = solidIt.Value();
if ( meshedSolids.Contains( solid )) if ( meshedSolids.Contains( solid )) {
solidList.Remove( solidIt );
continue; // already computed prism continue; // already computed prism
}
// find a source FACE of the SOLID: it's a FACE sharing a bottom EDGE with wFace // find a source FACE of the SOLID: it's a FACE sharing a bottom EDGE with wFace
const TopoDS_Edge& wEdge = (*wQuad)->side[ QUAD_TOP_SIDE ]->Edge(0); const TopoDS_Edge& wEdge = (*wQuad)->side[ QUAD_TOP_SIDE ]->Edge(0);
PShapeIteratorPtr faceIt = myHelper->GetAncestors( wEdge, *myHelper->GetMesh(), PShapeIteratorPtr faceIt = myHelper->GetAncestors( wEdge, *myHelper->GetMesh(),
@ -567,6 +572,10 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
} }
mySetErrorToSM = true; mySetErrorToSM = true;
InitComputeError(); InitComputeError();
if ( meshedSolids.Contains( solid ))
solidList.Remove( solidIt );
else
solidIt.Next();
} }
} }
} }
@ -574,34 +583,34 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
break; // to compute prisms with avident sources break; // to compute prisms with avident sources
} }
// find FACEs with local 1D hyps, which has to be computed by now, // find FACEs with local 1D hyps, which has to be computed by now,
// or at least any computed FACEs // or at least any computed FACEs
for ( int iF = 1; iF < faceToSolids.Extent(); ++iF ) for ( int iF = 1; ( meshedFaces.empty() && iF < faceToSolids.Extent() ); ++iF )
{
const TopoDS_Face& face = TopoDS::Face( faceToSolids.FindKey( iF ));
const TopTools_ListOfShape& solidList = faceToSolids.FindFromKey( face );
if ( solidList.IsEmpty() ) continue;
SMESH_subMesh* faceSM = theMesh.GetSubMesh( face );
if ( !faceSM->IsEmpty() )
{ {
const TopoDS_Face& face = TopoDS::Face( faceToSolids.FindKey( iF )); meshedFaces.push_back( face ); // lower priority
SMESH_subMesh* faceSM = theMesh.GetSubMesh( face );
if ( !faceSM->IsEmpty() )
{
meshedFaces.push_back( face ); // lower priority
}
else
{
bool allSubMeComputed = true;
SMESH_subMeshIteratorPtr smIt = faceSM->getDependsOnIterator(false,true);
while ( smIt->more() && allSubMeComputed )
allSubMeComputed = smIt->next()->IsMeshComputed();
if ( allSubMeComputed )
{
faceSM->ComputeStateEngine( SMESH_subMesh::COMPUTE );
if ( !faceSM->IsEmpty() )
meshedFaces.push_front( face ); // higher priority
else
faceSM->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
}
}
if ( !meshedFaces.empty() )
break;
} }
else
{
bool allSubMeComputed = true;
SMESH_subMeshIteratorPtr smIt = faceSM->getDependsOnIterator(false,true);
while ( smIt->more() && allSubMeComputed )
allSubMeComputed = smIt->next()->IsMeshComputed();
if ( allSubMeComputed )
{
faceSM->ComputeStateEngine( SMESH_subMesh::COMPUTE );
if ( !faceSM->IsEmpty() )
meshedFaces.push_front( face ); // higher priority
else
faceSM->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
}
}
}
// TODO. there are other ways to find out the source FACE: // TODO. there are other ways to find out the source FACE:
@ -847,7 +856,7 @@ bool StdMeshers_Prism_3D::compute(const Prism_3D::TPrismTopo& thePrism)
// try to use transformation (issue 0020680) // try to use transformation (issue 0020680)
vector<gp_Trsf> trsf; vector<gp_Trsf> trsf;
if ( myBlock.GetLayersTransformation(trsf)) if ( myBlock.GetLayersTransformation( trsf, thePrism ))
{ {
// loop on nodes inside the bottom face // loop on nodes inside the bottom face
TNode2ColumnMap::iterator bot_column = myBotToColumnMap.begin(); TNode2ColumnMap::iterator bot_column = myBotToColumnMap.begin();
@ -2371,7 +2380,8 @@ const TNodeColumn* StdMeshers_PrismAsBlock::GetNodeColumn(const SMDS_MeshNode* n
// from bottom to top. // from bottom to top.
//======================================================================= //=======================================================================
bool StdMeshers_PrismAsBlock::GetLayersTransformation(vector<gp_Trsf> & trsf) const bool StdMeshers_PrismAsBlock::GetLayersTransformation(vector<gp_Trsf> & trsf,
const Prism_3D::TPrismTopo& prism) const
{ {
const int zSize = VerticalSize(); const int zSize = VerticalSize();
if ( zSize < 3 ) return true; if ( zSize < 3 ) return true;
@ -2381,13 +2391,9 @@ bool StdMeshers_PrismAsBlock::GetLayersTransformation(vector<gp_Trsf> & trsf) co
vector< const TNodeColumn* > columns; vector< const TNodeColumn* > columns;
{ {
const TopoDS_Shape& baseFace = Shape(ID_BOT_FACE);
list< TopoDS_Edge > orderedEdges;
list< int > nbEdgesInWires;
GetOrderedEdges( TopoDS::Face( baseFace ), orderedEdges, nbEdgesInWires );
bool isReverse; bool isReverse;
list< TopoDS_Edge >::iterator edgeIt = orderedEdges.begin(); list< TopoDS_Edge >::const_iterator edgeIt = prism.myBottomEdges.begin();
for ( int iE = 0; iE < nbEdgesInWires.front(); ++iE, ++edgeIt ) for ( int iE = 0; iE < prism.myNbEdgesInWires.front(); ++iE, ++edgeIt )
{ {
if ( BRep_Tool::Degenerated( *edgeIt )) continue; if ( BRep_Tool::Degenerated( *edgeIt )) continue;
const TParam2ColumnMap* u2colMap = const TParam2ColumnMap* u2colMap =