]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0022098: EDF 2036 SMESH: Create groups from none conected parts of a mesh
authoreap <eap@opencascade.com>
Thu, 16 May 2013 16:58:08 +0000 (16:58 +0000)
committereap <eap@opencascade.com>
Thu, 16 May 2013 16:58:08 +0000 (16:58 +0000)
+#include "SMESH_MeshAlgos.hxx"

src/StdMeshers/StdMeshers_CompositeHexa_3D.cxx
src/StdMeshers/StdMeshers_HexaFromSkin_3D.cxx
src/StdMeshers/StdMeshers_Penta_3D.cxx
src/StdMeshers/StdMeshers_ProjectionUtils.cxx
src/StdMeshers/StdMeshers_QuadToTriaAdaptor.cxx
src/StdMeshers/StdMeshers_ViscousLayers.cxx

index 0fac6d13120d684dc19757f7683424def91ab8f6..30b645a622793de22e636862ba28688f23e51168 100644 (file)
@@ -32,6 +32,7 @@
 #include "SMESH_Comment.hxx"
 #include "SMESH_ComputeError.hxx"
 #include "SMESH_Mesh.hxx"
+#include "SMESH_MeshAlgos.hxx"
 #include "SMESH_MesherHelper.hxx"
 #include "SMESH_subMesh.hxx"
 
@@ -962,10 +963,10 @@ bool _QuadFaceGrid::LoadGrid( SMESH_Mesh& mesh )
     //
     TIDSortedElemSet emptySet, avoidSet;
     avoidSet.insert( firstQuad );
-    firstQuad = SMESH_MeshEditor::FindFaceInSet( n1down, n2down, emptySet, avoidSet);
+    firstQuad = SMESH_MeshAlgos::FindFaceInSet( n1down, n2down, emptySet, avoidSet);
     while ( firstQuad && !faceSubMesh->Contains( firstQuad )) {
       avoidSet.insert( firstQuad );
-      firstQuad = SMESH_MeshEditor::FindFaceInSet( n1down, n2down, emptySet, avoidSet);
+      firstQuad = SMESH_MeshAlgos::FindFaceInSet( n1down, n2down, emptySet, avoidSet);
     }
     if ( !firstQuad || !faceSubMesh->Contains( firstQuad ))
       return error(ERR_LI("Error in _QuadFaceGrid::LoadGrid()"));
@@ -995,7 +996,7 @@ bool _QuadFaceGrid::LoadGrid( SMESH_Mesh& mesh )
     {
       // next face
       avoidSet.clear(); avoidSet.insert( quad );
-      quad = SMESH_MeshEditor::FindFaceInSet( n1down, n1up, emptySet, avoidSet );
+      quad = SMESH_MeshAlgos::FindFaceInSet( n1down, n1up, emptySet, avoidSet );
       if ( !quad || quad->NbNodes() % 4 > 0)
         return error(ERR_LI("Error in _QuadFaceGrid::LoadGrid()"));
 
index a80c2debdcc6a3623d29ce4c782705337e8ee1a8..e316d297125ae2baf96200f137781cb6d8aa9c06 100644 (file)
 #include "SMDS_VolumeOfNodes.hxx"
 #include "SMDS_VolumeTool.hxx"
 #include "SMESH_Block.hxx"
+#include "SMESH_MeshAlgos.hxx"
 #include "SMESH_MesherHelper.hxx"
 
 #include <gp_Ax2.hxx>
 
-//#include "utilities.h"
 #include <limits>
 
 // Define error message and _MYDEBUG_ if needed
@@ -635,7 +635,7 @@ namespace
       const SMDS_MeshNode* n1down = side.getNode( 0, y-1 );
       const SMDS_MeshNode* n2down = side.getNode( 1, y-1 );
       avoidSet.clear(); avoidSet.insert( firstQuad );
-      firstQuad = SMESH_MeshEditor::FindFaceInSet( n1down, n2down, emptySet, avoidSet,
+      firstQuad = SMESH_MeshAlgos::FindFaceInSet( n1down, n2down, emptySet, avoidSet,
                                                    &i1down, &i2down);
       if ( !isQuadrangle( firstQuad ))
         return BAD_MESH_ERR;
@@ -648,7 +648,7 @@ namespace
       x = 1; 
       while ( ++x < nbX )
       {
-        const SMDS_MeshElement* quad = SMESH_MeshEditor::FindFaceInSet( n2up, n2down, emptySet,
+        const SMDS_MeshElement* quad = SMESH_MeshAlgos::FindFaceInSet( n2up, n2down, emptySet,
                                                                         avoidSet, &i2up, &i2down);
         if ( !isQuadrangle( quad ))
           return BAD_MESH_ERR;
@@ -942,7 +942,7 @@ namespace
     while ( !isCornerNode( n2 ) )
     {
       avoidSet.clear(); avoidSet.insert( quad );
-      quad = SMESH_MeshEditor::FindFaceInSet( n1, n2, emptySet, avoidSet, &i1, &i2 );
+      quad = SMESH_MeshAlgos::FindFaceInSet( n1, n2, emptySet, avoidSet, &i1, &i2 );
       if ( !isQuadrangle( quad ))
         return BAD_MESH_ERR;
 
index 85697faaf97a6e79dd6e4615efb9a57473a4b024..3db3f2dd9e9a53ce62d9d9aece172c3c958a6957 100644 (file)
 #include "SMDS_VolumeOfNodes.hxx"
 #include "SMDS_VolumeTool.hxx"
 #include "SMESHDS_SubMesh.hxx"
+#include "SMESH_Comment.hxx"
 #include "SMESH_Mesh.hxx"
+#include "SMESH_MeshAlgos.hxx"
 #include "SMESH_MesherHelper.hxx"
 #include "SMESH_subMesh.hxx"
 #include "SMESH_subMeshEventListener.hxx"
-#include "SMESH_Comment.hxx"
 
 #include <BRep_Tool.hxx>
 #include <TopExp.hxx>
@@ -1533,7 +1534,7 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
     const SMDS_MeshElement* face = 0;
     do {
       // look for a face by 2 nodes
-      face = SMESH_MeshEditor::FindFaceInSet( n1, n2, allFaces, foundFaces );
+      face = SMESH_MeshAlgos::FindFaceInSet( n1, n2, allFaces, foundFaces );
       if ( face ) {
         int nbFaceNodes = face->NbNodes();
         if ( (!myCreateQuadratic && nbFaceNodes>4) ||
index 25bc38a4a08b9f16f1c3e434ffa18f74980eced6..129e8ae48966bdde67a091a77a5f7311a2b20f92 100644 (file)
@@ -41,6 +41,7 @@
 #include "SMESH_MesherHelper.hxx"
 #include "SMESH_subMesh.hxx"
 #include "SMESH_subMeshEventListener.hxx"
+#include "SMESH_MeshAlgos.hxx"
 
 #include "utilities.h"
 
@@ -1876,12 +1877,12 @@ FindMatchingNodesOnFaces( const TopoDS_Face&     face1,
       TIDSortedElemSet inSet, notInSet;
 
       const SMDS_MeshElement* f1 =
-        SMESH_MeshEditor::FindFaceInSet( vNode, eNode, inSet, notInSet );
+        SMESH_MeshAlgos::FindFaceInSet( vNode, eNode, inSet, notInSet );
       if ( !f1 ) RETURN_BAD_RESULT("The first face on seam not found");
       notInSet.insert( f1 );
 
       const SMDS_MeshElement* f2 =
-        SMESH_MeshEditor::FindFaceInSet( vNode, eNode, inSet, notInSet );
+        SMESH_MeshAlgos::FindFaceInSet( vNode, eNode, inSet, notInSet );
       if ( !f2 ) RETURN_BAD_RESULT("The second face on seam not found");
 
       // select a face with less UV of vNode
@@ -1924,7 +1925,7 @@ FindMatchingNodesOnFaces( const TopoDS_Face&     face1,
       for ( int i = 0; i < nbNodes; ++i ) {
         const SMDS_MeshNode* n1 = faceToKeep->GetNode( i );
         const SMDS_MeshNode* n2 = faceToKeep->GetNode(( i+1 ) % nbNodes );
-        f1 = SMESH_MeshEditor::FindFaceInSet( n1, n2, inSet, notInSet );
+        f1 = SMESH_MeshAlgos::FindFaceInSet( n1, n2, inSet, notInSet );
         if ( f1 )
           elems.insert( f1 );
       }
index 959c85263046007f30a0e4d594ef3ae0396f11a9..c69fa9e7a5bea43830f733f4a71cf4c917550b1b 100644 (file)
 
 #include "SMDS_SetIterator.hxx"
 
+#include "SMESHDS_GroupBase.hxx"
 #include "SMESH_Algo.hxx"
-#include "SMESH_MesherHelper.hxx"
 #include "SMESH_Group.hxx"
-#include "SMESHDS_GroupBase.hxx"
+#include "SMESH_MeshAlgos.hxx"
+#include "SMESH_MesherHelper.hxx"
 
 #include <IntAna_IntConicQuad.hxx>
 #include <IntAna_Quadric.hxx>
@@ -149,8 +150,8 @@ namespace
       TIDSortedElemSet emptySet, avoidSet;
       int i1, i2;
       while ( const SMDS_MeshElement* f =
-              SMESH_MeshEditor::FindFaceInSet( baseNodes[0], baseNodes[1],
-                                               emptySet, avoidSet, &i1, &i2 ))
+              SMESH_MeshAlgos::FindFaceInSet( baseNodes[0], baseNodes[1],
+                                              emptySet, avoidSet, &i1, &i2 ))
       {
         avoidSet.insert( f );
 
@@ -542,7 +543,7 @@ bool StdMeshers_QuadToTriaAdaptor::CheckIntersection (const gp_Pnt&       P,
                                                       const SMDS_MeshElement* NotCheckedFace)
 {
   if ( !myElemSearcher )
-    myElemSearcher = SMESH_MeshEditor(&aMesh).GetElementSearcher();
+    myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *aMesh.GetMeshDS() );
   SMESH_ElementSearcher* searcher = const_cast<SMESH_ElementSearcher*>(myElemSearcher);
 
   //SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
@@ -730,9 +731,9 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh&         aMesh,
 
   if ( myElemSearcher ) delete myElemSearcher;
   if ( aProxyMesh )
-    myElemSearcher = SMESH_MeshEditor(&aMesh).GetElementSearcher( aProxyMesh->GetFaces(aShape));
+    myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS, aProxyMesh->GetFaces(aShape));
   else
-    myElemSearcher = SMESH_MeshEditor(&aMesh).GetElementSearcher();
+    myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS );
 
   const SMESHDS_SubMesh * aSubMeshDSFace;
   Handle(TColgp_HArray1OfPnt) PN = new TColgp_HArray1OfPnt(1,5);
@@ -879,7 +880,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh&         aMesh,
 
           delete myElemSearcher;
           myElemSearcher =
-            SMESH_MeshEditor(&aMesh).GetElementSearcher( aProxyMesh->GetFaces(aShape));
+            SMESH_MeshAlgos::GetElementSearcher( *meshDS, aProxyMesh->GetFaces(aShape));
         }
       }
     }
@@ -937,13 +938,13 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh)
   helper.IsQuadraticSubMesh(aMesh.GetShapeToMesh());
   helper.SetElementsOnShape( true );
 
-  if ( !myElemSearcher )
-    myElemSearcher = SMESH_MeshEditor(&aMesh).GetElementSearcher();
-  SMESH_ElementSearcher* searcher = const_cast<SMESH_ElementSearcher*>(myElemSearcher);
-
   SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
   SMESH_ProxyMesh::SubMesh* prxSubMesh = getProxySubMesh();
 
+  if ( !myElemSearcher )
+    myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS );
+  SMESH_ElementSearcher* searcher = const_cast<SMESH_ElementSearcher*>(myElemSearcher);
+
   SMDS_FaceIteratorPtr fIt = meshDS->facesIterator(/*idInceasingOrder=*/true);
   while( fIt->more())
   {
@@ -1098,7 +1099,21 @@ bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh)
 
     // if the face belong to the group of skinFaces, do not build a pyramid outside
     if (groupDS && groupDS->Contains(face))
+    {
       intersected[0] = false;
+    }
+    else if ( intersected[0] && intersected[1] ) // check if one of pyramids is in a hole
+    {
+      gp_Pnt P ( PC.XYZ() + tmpDir.XYZ() * 0.5 * PC.Distance( intPnt[0] ));
+      if ( searcher->GetPointState( P ) == TopAbs_OUT )
+        intersected[0] = false;
+      else
+      {
+        P = ( PC.XYZ() - tmpDir.XYZ() * 0.5 * PC.Distance( intPnt[1] ));
+        if ( searcher->GetPointState( P ) == TopAbs_OUT )
+          intersected[1] = false;
+      }
+    }
 
     // Create one or two pyramids
 
@@ -1150,7 +1165,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh&
   int i, j, k, myShapeID = myPyramids[0]->GetNode(4)->getshapeId();
 
   if ( myElemSearcher ) delete myElemSearcher;
-  myElemSearcher = SMESH_MeshEditor(&aMesh).GetElementSearcher();
+  myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS );
   SMESH_ElementSearcher* searcher = const_cast<SMESH_ElementSearcher*>(myElemSearcher);
 
   set<const SMDS_MeshNode*> nodesToMove;
@@ -1181,7 +1196,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh&
       while ( vIt->more() )
       {
         const SMDS_MeshElement* PrmJ = vIt->next();
-        if ( SMESH_Algo::GetCommonNodes( PrmI, PrmJ ).size() > 1 )
+        if ( SMESH_MeshAlgos::GetCommonNodes( PrmI, PrmJ ).size() > 1 )
           checkedPyrams.insert( PrmJ );
       }
     }
index cacab8913bc95201a450854a5653ccd8415caeb6..61365b4d60b65a48368d621ea86c54826c0a9839 100644 (file)
@@ -36,6 +36,7 @@
 #include "SMESH_Gen.hxx"
 #include "SMESH_Group.hxx"
 #include "SMESH_Mesh.hxx"
+#include "SMESH_MeshAlgos.hxx"
 #include "SMESH_MesherHelper.hxx"
 #include "SMESH_ProxyMesh.hxx"
 #include "SMESH_subMesh.hxx"
@@ -2067,9 +2068,9 @@ bool _ViscousBuilder::inflate(_SolidData& data)
   // Limit inflation step size by geometry size found by itersecting
   // normals of _LayerEdge's with mesh faces
   double geomSize = Precision::Infinite(), intersecDist;
-  SMESH_MeshEditor editor( _mesh );
   auto_ptr<SMESH_ElementSearcher> searcher
-    ( editor.GetElementSearcher( data._proxyMesh->GetFaces( data._solid )) );
+    ( SMESH_MeshAlgos::GetElementSearcher( *getMeshDS(),
+                                           data._proxyMesh->GetFaces( data._solid )) );
   for ( unsigned i = 0; i < data._edges.size(); ++i )
   {
     if ( data._edges[i]->IsOnEdge() ) continue;
@@ -2265,9 +2266,9 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data,
   // Check if the last segments of _LayerEdge intersects 2D elements;
   // checked elements are either temporary faces or faces on surfaces w/o the layers
 
-  SMESH_MeshEditor editor( _mesh );
   auto_ptr<SMESH_ElementSearcher> searcher
-    ( editor.GetElementSearcher( data._proxyMesh->GetFaces( data._solid )) );
+    ( SMESH_MeshAlgos::GetElementSearcher( *getMeshDS(),
+                                           data._proxyMesh->GetFaces( data._solid )) );
 
   distToIntersection = Precision::Infinite();
   double dist;
@@ -2627,10 +2628,10 @@ bool _ViscousBuilder::updateNormals( _SolidData&         data,
   // 1) to find and fix intersection
   // 2) to check that no new intersection appears as result of 1)
 
-  SMESH_MeshEditor editor( _mesh );
   SMDS_ElemIteratorPtr fIt( new SMDS_ElementVectorIterator( tmpFaces.begin(),
                                                             tmpFaces.end()));
-  auto_ptr<SMESH_ElementSearcher> searcher ( editor.GetElementSearcher( fIt ));
+  auto_ptr<SMESH_ElementSearcher> searcher
+    ( SMESH_MeshAlgos::GetElementSearcher( *getMeshDS(), fIt ));
 
   // 1) Find intersections
   double dist;
@@ -3958,8 +3959,8 @@ void _ViscousBuilder::fixBadFaces(const TopoDS_Face& F, SMESH_MesherHelper& help
       const SMDS_MeshNode* n1 = badTrias[iTia]->GetNode( iSide );
       const SMDS_MeshNode* n2 = badTrias[iTia]->GetNode(( iSide+1 ) % 3 );
       trias [iSide].first  = badTrias[iTia];
-      trias [iSide].second = SMESH_MeshEditor::FindFaceInSet( n1, n2, emptySet, involvedFaces,
-                                                              & i1, & i2 );
+      trias [iSide].second = SMESH_MeshAlgos::FindFaceInSet( n1, n2, emptySet, involvedFaces,
+                                                             & i1, & i2 );
       if ( ! trias[iSide].second || trias[iSide].second->NbCornerNodes() != 3 )
         continue;