Salome HOME
Adding parallel meshing (NETGEN only, Linux Only)
[modules/smesh.git] / src / SMESH_I / SMESH_2smeshpy.cxx
index bd0ec817e67b633a229bd79562f797d118b7cec0..def823814c7a5d1d431c76a383b5f003bbe53f28 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -458,7 +458,7 @@ namespace {
       initialized = true;
       filteredArgs.push_back( "SMESH.MED_V2_1" );
       filteredArgs.push_back( "SMESH.MED_V2_2" );
-    }  
+    }
     return std::find( filteredArgs.begin(), filteredArgs.end(), theArg ) != filteredArgs.end();
   }
 }
@@ -932,11 +932,13 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
           "Geom_POLYHEDRA", "Geom_BALL" };
         if ( -1 < iGeom && iGeom < nbTypes )
           Threshold = SMESH + types[ iGeom ];
-#ifdef _DEBUG_
-        // is types complete? (compilation failure means that enum GeometryType changed)
-        static_assert( sizeof(types) / sizeof(const char*) == nbTypes,
-                       "Update names of GeometryType's!!!" );
-#endif
+
+        if (SALOME::VerbosityActivated())
+        {
+          // is types complete? (compilation failure means that enum GeometryType changed)
+          static_assert( sizeof(types) / sizeof(const char*) == nbTypes,
+                        "Update names of GeometryType's!!!" );
+        }
       }
       if (Type == "SMESH.FT_EntityType")
       {
@@ -953,11 +955,13 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
           "Entity_Polyhedra", "Entity_Quad_Polyhedra", "Entity_Ball" };
         if ( -1 < iGeom && iGeom < nbTypes )
           Threshold = SMESH + types[ iGeom ];
-#ifdef _DEBUG_
-        // is 'types' complete? (compilation failure means that enum EntityType changed)
-        static_assert( sizeof(types) / sizeof(const char*) == nbTypes,
-                       "Update names of EntityType's!!!" );
-#endif
+
+        if (SALOME::VerbosityActivated())
+        {
+          // is 'types' complete? (compilation failure means that enum EntityType changed)
+          static_assert( sizeof(types) / sizeof(const char*) == nbTypes,
+                        "Update names of EntityType's!!!" );
+        }
       }
     }
     if ( ThresholdID.Length() != 2 ) // neither '' nor ""
@@ -1013,10 +1017,16 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
   {
     Handle(_pyMesh) mesh = new _pyMesh( theCommand );
     AddObject( mesh );
+    // set mesh name
+    _pyID id = mesh->GetID(), comma("'");
+    if ( myObjectNames.IsBound( id ))
+      theCommand->SetArg( theCommand->GetNbArgs() + 1,
+                          comma + myObjectNames( id ) + comma);
     return;
   }
   if ( method == "CreateMeshesFromUNV" ||
        method == "CreateMeshesFromSTL" ||
+       method == "CreateDualMesh" ||
        method == "CopyMesh" ) // command result is a mesh
   {
     Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue() );
@@ -1024,7 +1034,6 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
     return;
   }
   if ( method == "CreateMeshesFromMED" ||
-       method == "CreateMeshesFromSAUV"||
        method == "CreateMeshesFromCGNS" ||
        method == "CreateMeshesFromGMF" ) // command result is ( [mesh1,mesh2], status )
   {
@@ -1823,7 +1832,7 @@ _pyMesh::_pyMesh(const Handle(_pyCommand) theCreationCmd, const _pyID& meshId):
     const _pyID& meshID = theCreationCmd->GetObject();
     addFatherMesh( meshID );
   }
-    
+
   // convert my creation command
   Handle(_pyCommand) creationCmd = GetCreationCmd();
   creationCmd->SetObject( SMESH_2smeshpy::SmeshpyName() );
@@ -2194,7 +2203,7 @@ bool _pyMesh::NeedMeshAccess( const Handle(_pyCommand)& theCommand )
   static TStringSet sameMethods;
   if ( sameMethods.empty() ) {
     const char * names[] =
-      { "ExportDAT","ExportUNV","ExportSTL","ExportSAUV", "RemoveGroup","RemoveGroupWithContents",
+      { "ExportDAT","ExportUNV","ExportSTL", "RemoveGroup","RemoveGroupWithContents",
         "GetGroups","UnionGroups","IntersectGroups","CutGroups","CreateDimGroup","GetLog","GetId",
         "ClearLog","HasDuplicatedGroupNamesMED","GetMEDMesh","NbNodes","NbElements",
         "NbEdges","NbEdgesOfOrder","NbFaces","NbFacesOfOrder","NbTriangles",
@@ -2207,7 +2216,8 @@ bool _pyMesh::NeedMeshAccess( const Handle(_pyCommand)& theCommand )
         "GetElemNode","IsMediumNode","IsMediumNodeOfAnyElem","ElemNbEdges","ElemNbFaces",
         "GetElemFaceNodes", "GetFaceNormal", "FindElementByNodes",
         "IsPoly","IsQuadratic","BaryCenter","GetHypothesisList", "SetAutoColor", "GetAutoColor",
-        "Clear", "ConvertToStandalone", "GetMeshOrder", "SetMeshOrder"
+        "Clear", "ConvertToStandalone", "GetMeshOrder", "SetMeshOrder",
+        "SetNbThreads"
         ,"" }; // <- mark of end
     sameMethods.Insert( names );
   }
@@ -2415,7 +2425,7 @@ void _pyMesh::ClearCommands()
   list< Handle(_pySubMesh) >::iterator sm = mySubmeshes.begin();
   for ( ; sm != mySubmeshes.end(); ++sm )
     (*sm)->ClearCommands();
-  
+
   list< Handle(_pyGroup) >::iterator gr = myGroups.begin();
   for ( ; gr != myGroups.end(); ++gr )
     (*gr)->ClearCommands();
@@ -2487,11 +2497,11 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
   static TStringSet sameMethods;
   if ( sameMethods.empty() ) {
     const char * names[] = {
-      "RemoveElements","RemoveNodes","RemoveOrphanNodes",
+      "RemoveElements","RemoveNodes","RemoveOrphanNodes","RemoveNodeWithReconnection",
       "AddNode","Add0DElement","AddEdge","AddFace","AddPolygonalFace","AddBall",
-      "AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces",
-      "MoveNode", "MoveClosestNodeToPoint",
-      "InverseDiag","DeleteDiag","Reorient","ReorientObject","Reorient2DBy3D",
+      "AddVolume","AddPolyhedralVolume","AddPolyhedralVolumeByFaces","AddNodeOnSegment",
+      "MoveNode", "MoveClosestNodeToPoint","InverseDiag","DeleteDiag","AddNodeOnFace",
+      "Reorient","ReorientObject","Reorient2DBy3D","Reorient2DByNeighbours",
       "TriToQuad","TriToQuadObject", "QuadTo4Tri", "SplitQuad","SplitQuadObject",
       "BestSplit","Smooth","SmoothObject","SmoothParametric","SmoothParametricObject",
       "ConvertToQuadratic","ConvertFromQuadratic","RenumberNodes","RenumberElements",
@@ -2575,7 +2585,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
       // 1. Remove "MakeGroups" from the Command
       TCollection_AsciiString aMethod = theCommand->GetMethod();
       int nbArgsToAdd = diffLastTwoArgsMethods.Contains(aMethod) ? 2 : 1;
-      
+
       if(is0DmethObj)
         pos = pos-2;  //Remove "0D" from the Command too
       aMethod.Trunc(pos-1);
@@ -3406,7 +3416,7 @@ void _pyLayerDistributionHypo::Flush()
   list< Handle(_pyCommand) >::iterator cmd = myArgCommands.begin();
   _pyID prevNewName;
   for ( cmd = myArgCommands.begin(); cmd != myArgCommands.end(); ++cmd )
-  {    
+  {
     const _pyID& hyp1dID = (*cmd)->GetArg( 1 );
     if ( hyp1dID.IsEmpty() ) continue;
 
@@ -3430,7 +3440,7 @@ void _pyLayerDistributionHypo::Flush()
       }
       newName += "_Distribution";
       prevNewName = newName;
-    
+
       hyp1d->GetCreationCmd()->SetResultValue( newName );
     }
     list< Handle(_pyCommand) >& cmds = theGen->GetCommands();
@@ -4627,7 +4637,7 @@ _pyGroup::_pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id)
 
 //================================================================================
 /*!
- * \brief Check if "[ group1, group2 ] = mesh.GetGroups()" creation command 
+ * \brief Check if "[ group1, group2 ] = mesh.GetGroups()" creation command
  *        can be cleared
  */
 //================================================================================
@@ -4798,7 +4808,7 @@ void _pyFilter::Process( const Handle(_pyCommand)& theCommand)
 
   if ( !myNewID.IsEmpty() )
     theCommand->SetObject( myNewID );
-    
+
   // Convert the following set of commands into smesh.GetFilterFromCriteria(criteria)
   // aFilter0x2aaab0487080 = aFilterManager.CreateFilter()
   // aFilter0x2aaab0487080.SetCriteria(aCriteria)
@@ -4841,7 +4851,7 @@ void _pyFilter::Process( const Handle(_pyCommand)& theCommand)
 void _pyFilter::Flush()
 {
   if ( myNewID.IsEmpty() ) return;
-  
+
   list< Handle(_pyCommand) >::iterator cmd = myArgCmds.begin();
   for ( ; cmd != myArgCmds.end(); ++cmd )
     if ( !(*cmd)->IsEmpty() )
@@ -4978,7 +4988,7 @@ _pyHypothesisReader::_pyHypothesisReader()
     //          ...
     //          dim="2">
     //   <python-wrap>
-    //     <accumulative-methods> 
+    //     <accumulative-methods>
     //       SetEnforcedVertex,
     //       SetEnforcedVertexNamed
     //     </accumulative-methods>