From d34c188fb124c604faa6c3fcbbbbb73fdc597833 Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 30 Dec 2010 07:55:06 +0000 Subject: [PATCH] 0020832: EDF 1359 SMESH : Automatic meshing of boundary layers FIX for StdMeshers_QuadToTriaAdaptor to work after StdMeshers_ViscousLayers --- .../StdMeshers_QuadToTriaAdaptor.cxx | 63 ++++++++++--------- src/StdMeshers/StdMeshers_ViscousLayers.cxx | 26 +++++--- 2 files changed, 50 insertions(+), 39 deletions(-) diff --git a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx index c87f83b57..48f656e40 100644 --- a/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx +++ b/src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx @@ -638,10 +638,12 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh, StdMeshers_ProxyMesh* aProxyMesh) { StdMeshers_ProxyMesh::setMesh( aMesh ); - //myResMap.clear(); + + if ( aShape.ShapeType() != TopAbs_SOLID && + aShape.ShapeType() != TopAbs_SHELL ) + return false; + vector myPyramids; - //myNbTriangles = 0; - //myShape = aShape; SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); SMESH_MesherHelper helper(aMesh); @@ -655,6 +657,11 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh, myElemSearcher = SMESH_MeshEditor(&aMesh).GetElementSearcher(); const SMESHDS_SubMesh * aSubMeshDSFace; + Handle(TColgp_HArray1OfPnt) PN = new TColgp_HArray1OfPnt(1,5); + Handle(TColgp_HArray1OfVec) VN = new TColgp_HArray1OfVec(1,4); + vector FNodes(5); + gp_Pnt PC; + gp_Vec VNorm; for (TopExp_Explorer exp(aShape,TopAbs_FACE);exp.More();exp.Next()) { @@ -663,23 +670,21 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh, aSubMeshDSFace = aProxyMesh->GetSubMesh( aShapeFace ); else aSubMeshDSFace = meshDS->MeshElements( aShapeFace ); + vector trias, quads; bool hasNewTrias = false; + if ( aSubMeshDSFace ) { - bool isRev = SMESH_Algo::IsReversedSubMesh( TopoDS::Face(aShapeFace), meshDS ); + bool isRev = false; + if ( helper.NbAncestors( aShapeFace, aMesh, aShape.ShapeType() ) > 1 ) + isRev = SMESH_Algo::IsReversedSubMesh( TopoDS::Face(aShapeFace), meshDS ); SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements(); while ( iteratorElem->more() ) // loop on elements on a geometrical face { const SMDS_MeshElement* face = iteratorElem->next(); - //cout<GetID() = "<GetID()< FNodes(5); - gp_Pnt PC; - gp_Vec VNorm; + // preparation step to get face info int stat = Preparation(face, PN, VN, FNodes, PC, VNorm); switch ( stat ) { @@ -773,26 +778,26 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh, } // case QUAD: } // switch ( stat ) + } // end loop on elements on a face submesh - bool sourceSubMeshIsProxy = false; - if ( aProxyMesh ) - { - // move proxy sub-mesh from other proxy mesh to this - sourceSubMeshIsProxy = takeProxySubMesh( aShapeFace, aProxyMesh ); - // move tmp elements added in mesh - takeTmpElemsInMesh( aProxyMesh ); - } - if ( hasNewTrias ) - { - StdMeshers_ProxyMesh::SubMesh* prxSubMesh = getProxySubMesh( aShapeFace ); - prxSubMesh->ChangeElements( trias.begin(), trias.end() ); + bool sourceSubMeshIsProxy = false; + if ( aProxyMesh ) + { + // move proxy sub-mesh from other proxy mesh to this + sourceSubMeshIsProxy = takeProxySubMesh( aShapeFace, aProxyMesh ); + // move tmp elements added in mesh + takeTmpElemsInMesh( aProxyMesh ); + } + if ( hasNewTrias ) + { + StdMeshers_ProxyMesh::SubMesh* prxSubMesh = getProxySubMesh( aShapeFace ); + prxSubMesh->ChangeElements( trias.begin(), trias.end() ); - // delete tmp quadrangles removed from aProxyMesh - if ( sourceSubMeshIsProxy ) - for ( unsigned i = 0; i < quads.size(); ++i ) - removeTmpElement( quads[i] ); - } - } // end loop on elements on a face submesh + // delete tmp quadrangles removed from aProxyMesh + if ( sourceSubMeshIsProxy ) + for ( unsigned i = 0; i < quads.size(); ++i ) + removeTmpElement( quads[i] ); + } } } // end for(TopExp_Explorer exp(aShape,TopAbs_FACE);exp.More();exp.Next()) { diff --git a/src/StdMeshers/StdMeshers_ViscousLayers.cxx b/src/StdMeshers/StdMeshers_ViscousLayers.cxx index 0a0da267a..91d86b794 100644 --- a/src/StdMeshers/StdMeshers_ViscousLayers.cxx +++ b/src/StdMeshers/StdMeshers_ViscousLayers.cxx @@ -2933,10 +2933,26 @@ bool _ViscousBuilder::shrink() for ( unsigned i = 0 ; i < _sdVec.size(); ++i ) { _SolidData& data = _sdVec[i]; + TopTools_MapOfShape FFMap; map< TGeomID, TopoDS_Shape >::iterator s2s = data._shrinkShape2Shape.begin(); for (; s2s != data._shrinkShape2Shape.end(); ++s2s ) if ( s2s->second.ShapeType() == TopAbs_FACE ) + { f2sdMap.insert( make_pair( getMeshDS()->ShapeToIndex( s2s->second ), &data )); + + if ( FFMap.Add( (*s2s).second )) + // Put mesh faces on the shrinked FACE to the proxy sub-mesh to avoid + // usage of mesh faces made in addBoundaryElements() by the 3D algo or + // by StdMeshers_QuadToTriaAdaptor + if ( SMESHDS_SubMesh* smDS = getMeshDS()->MeshElements( s2s->second )) + { + StdMeshers_ProxyMesh::SubMesh* proxySub = + data._proxyMesh->getFaceSubM( TopoDS::Face( s2s->second ), /*create=*/true); + SMDS_ElemIteratorPtr fIt = smDS->GetElements(); + while ( fIt->more() ) + proxySub->AddElement( fIt->next() ); + } + } } SMESH_MesherHelper helper( *_mesh ); @@ -2960,16 +2976,6 @@ bool _ViscousBuilder::shrink() helper.SetSubShape(F); - // Put mesh faces on the shrinked FACE to the proxy sub-mesh to avoid - // usage of mesh faces made in addBoundaryElements() by the 3D algo or - // by StdMeshers_QuadToTriaAdaptor - { - StdMeshers_ProxyMesh::SubMesh* proxySub = - data._proxyMesh->getFaceSubM( F, /*create=*/true); - SMDS_ElemIteratorPtr fIt = smDS->GetElements(); - while ( fIt->more() ) - proxySub->AddElement( fIt->next() ); - } // =========================== // Prepare data for shrinking // =========================== -- 2.39.2