Salome HOME
Adding comments + removing SMESH_Gen argument
authorYoann Audouin <yoann.audouin@edf.fr>
Tue, 4 Oct 2022 12:32:49 +0000 (14:32 +0200)
committerYoann Audouin <yoann.audouin@edf.fr>
Tue, 4 Oct 2022 12:32:49 +0000 (14:32 +0200)
src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx
src/NETGENPlugin/NETGENPlugin_NETGEN_3D_Remote.cxx
src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.cxx
src/NETGENPlugin/NETGENPlugin_NETGEN_3D_SA.hxx

index dd209162f745eef046fd04f3c2b42874ea017977..d4712aaa56a84c209657f44d1069958ae0a8b56d 100644 (file)
@@ -198,11 +198,20 @@ bool NETGENPlugin_NETGEN_3D::CheckHypothesis (SMESH_Mesh&         aMesh,
  */
 //=============================================================================
 
+
 /**
- * @brief Get an iterator on the Surface element with their orientation
+ * @brief Compute the list of already meshed Surface elements and info
+ *        on their orientation and if they are internal
  *
+ * @param aMesh Global Mesh
+ * @param aShape Shape associated to the mesh
+ * @param proxyMesh pointer to mesh used fo find the elements
+ * @param internals information on internal sub shapes
+ * @param helper helper associated to the mesh
+ * @param listElements map of surface element associated with
+ *                     their orientation and internal status
+ * @return true if their was some error
  */
-
 bool NETGENPlugin_NETGEN_3D::getSurfaceElements(
     SMESH_Mesh&         aMesh,
     const TopoDS_Shape& aShape,
@@ -257,6 +266,18 @@ bool NETGENPlugin_NETGEN_3D::getSurfaceElements(
   return false;
 }
 
+/**
+ * @brief Part of Compute: adding already meshed elements
+ *        into netgen structure
+ *
+ * @param aMesh Global mesh
+ * @param aShape Shape associated with the mesh
+ * @param nodeVec Mapping between nodes mesh id and netgen structure id
+ * @param ngLib Wrapper on netgen lib
+ * @param helper helper assocaited to the mesh
+ * @param Netgen_NbOfNodes Number of nodes in netge structure
+ * @return true if there was some error
+ */
 
 bool NETGENPlugin_NETGEN_3D::computeFillNgMesh(
   SMESH_Mesh&         aMesh,
@@ -388,6 +409,16 @@ bool NETGENPlugin_NETGEN_3D::computeFillNgMesh(
   return false;
 }
 
+/**
+ * @brief Part of Compute: Setting the netgen parameters from the Hypothesis
+ *
+ * @param aMesh Global mesh
+ * @param ngLib Wrapper on netgen lib
+ * @param occgeo Mapping between nodes mesh id and netgen structure id
+ * @param helper helper assocaited to the mesh
+ * @param endWith end step of netgen
+ * @return true if there was some error
+ */
 bool NETGENPlugin_NETGEN_3D::computePrepareParam(
   SMESH_Mesh&         aMesh,
   NETGENPlugin_NetgenLibWrapper &ngLib,
@@ -451,6 +482,17 @@ bool NETGENPlugin_NETGEN_3D::computePrepareParam(
   return false;
 }
 
+/**
+ * @brief Part of Compute: call to the netgen mesher
+ *
+ * @param occgeo netgen geometry structure
+ * @param nodeVec Mapping between nodes mesh id and netgen structure id
+ * @param ngMesh netgen mesh structure
+ * @param ngLib Wrapper on netgen lib
+ * @param startWith starting step of netgen
+ * @param endWith end step of netgen
+ * @return true if there was some error
+ */
 bool NETGENPlugin_NETGEN_3D::computeRunMesher(
   netgen::OCCGeometry &occgeo,
   vector< const SMDS_MeshNode* > &nodeVec,
@@ -509,6 +551,15 @@ bool NETGENPlugin_NETGEN_3D::computeRunMesher(
   return false;
 }
 
+/**
+ * @brief Part of Compute: Adding new element created by mesher to SMESH_Mesh
+ *
+ * @param nodeVec Mapping between nodes mesh id and netgen structure id
+ * @param ngLib Wrapper on netgen lib
+ * @param helper tool associated to the mesh to add element
+ * @param Netgen_NbOfNodes Number of nodes in netgen structure
+ * @return true if there was some error
+ */
 bool NETGENPlugin_NETGEN_3D::computeFillMesh(
   vector< const SMDS_MeshNode* > &nodeVec,
   NETGENPlugin_NetgenLibWrapper &ngLib,
@@ -555,6 +606,14 @@ bool NETGENPlugin_NETGEN_3D::computeFillMesh(
   return false;
 }
 
+
+/**
+ * @brief Compute mesh associate to shape
+ *
+ * @param aMesh The mesh
+ * @param aShape The shape
+ * @return true fi there are some error
+ */
 bool NETGENPlugin_NETGEN_3D::Compute(
   SMESH_Mesh&         aMesh,
   const TopoDS_Shape& aShape)
index a50073cb4f8fe9ead8a98f95a42cdd3e7b5bb7e4..f66cf7561a27553150e8614a5a2884738b18529a 100644 (file)
@@ -82,7 +82,7 @@ using namespace nglib;
 
 //=============================================================================
 /*!
- *
+ * Constructor
  */
 //=============================================================================
 
@@ -94,7 +94,7 @@ NETGENPlugin_NETGEN_3D_Remote::NETGENPlugin_NETGEN_3D_Remote(int hypId, SMESH_Ge
 
 //=============================================================================
 /*!
- *
+ * Destructor
  */
 //=============================================================================
 
@@ -102,7 +102,12 @@ NETGENPlugin_NETGEN_3D_Remote::~NETGENPlugin_NETGEN_3D_Remote()
 {
 }
 
-
+/**
+ * @brief Fill the structure netgen_param with the information from the hypothesis
+ *
+ * @param hyp the hypothesis
+ * @param aParams the netgen_param structure
+ */
 void NETGENPlugin_NETGEN_3D_Remote::fillParameters(const NETGENPlugin_Hypothesis* hyp, netgen_params &aParams)
 {
   aParams.maxh               = hyp->GetMaxSize();
@@ -136,7 +141,15 @@ void NETGENPlugin_NETGEN_3D_Remote::fillParameters(const NETGENPlugin_Hypothesis
 #endif
 }
 
-// write in a binary file the orientation for each 2D element of the mesh
+//
+
+/**
+ * @brief write in a binary file the orientation for each surface element of the mesh
+ *
+ * @param aMesh The mesh
+ * @param aShape the shape associated to the mesh
+ * @param output_file name of the binary file
+ */
 void NETGENPlugin_NETGEN_3D_Remote::exportElementOrientation(SMESH_Mesh& aMesh,
                                                       const TopoDS_Shape& aShape,
                                                       const std::string output_file)
@@ -195,7 +208,13 @@ void NETGENPlugin_NETGEN_3D_Remote::exportElementOrientation(SMESH_Mesh& aMesh,
   }
 }
 
-
+/**
+ * @brief Compute mesh associate to shape
+ *
+ * @param aMesh The mesh
+ * @param aShape The shape
+ * @return true fi there are some error
+ */
 bool NETGENPlugin_NETGEN_3D_Remote::Compute(SMESH_Mesh&         aMesh,
                                            const TopoDS_Shape& aShape)
 {
@@ -351,7 +370,11 @@ bool NETGENPlugin_NETGEN_3D_Remote::Compute(SMESH_Mesh&         aMesh,
   return true;
 }
 
-
+/**
+ * @brief Assign submeshes to compute
+ *
+ * @param aSubMesh submesh to add
+ */
 void NETGENPlugin_NETGEN_3D_Remote::setSubMeshesToCompute(SMESH_subMesh * aSubMesh)
 {
   SMESH_MeshLocker myLocker(aSubMesh->GetFather());
index 9d2bf43166a41ac010ccce3c3bd0ffb40d82e37a..1ea0ad7048af72e95083c846d23d2255739ef4e1 100644 (file)
@@ -76,19 +76,19 @@ using namespace nglib;
 
 //=============================================================================
 /*!
- *
+ * Constructor
  */
 //=============================================================================
 
 NETGENPlugin_NETGEN_3D_SA::NETGENPlugin_NETGEN_3D_SA()
-  : NETGENPlugin_NETGEN_3D(0, _gen=new SMESH_Gen())
+  :  NETGENPlugin_NETGEN_3D(0, new SMESH_Gen())
 {
   _name = "NETGEN_3D_SA";
 }
 
 //=============================================================================
 /*!
- *
+ * Destructor
  */
 //=============================================================================
 
@@ -98,15 +98,18 @@ NETGENPlugin_NETGEN_3D_SA::~NETGENPlugin_NETGEN_3D_SA()
     delete _gen;
 }
 
-
-/*
+/**
+ * @brief fill plugin hypothesis from the netgen_params structure
  *
+ * @param aParams the structure
+ * @param gen SMESH_Gen associate with the SA
  */
-
-void NETGENPlugin_NETGEN_3D_SA::fillHyp(netgen_params aParams, SMESH_Gen* gen)
+void NETGENPlugin_NETGEN_3D_SA::fillHyp(netgen_params aParams)
 {
+  if(_gen)
+    std::cout << "_gen is set"  << std::endl;
   if(aParams.has_netgen_param){
-    NETGENPlugin_Hypothesis * hypParameters = new NETGENPlugin_Hypothesis(0, gen);
+    NETGENPlugin_Hypothesis * hypParameters = new NETGENPlugin_Hypothesis(0, GetGen());
 
     hypParameters->SetMaxSize(aParams.maxh);
     hypParameters->SetMinSize(aParams.minh);
@@ -134,12 +137,22 @@ void NETGENPlugin_NETGEN_3D_SA::fillHyp(netgen_params aParams, SMESH_Gen* gen)
     _hypParameters = dynamic_cast< const NETGENPlugin_Hypothesis *> (hypParameters);
   }
   if(aParams.has_maxelementvolume_hyp){
-    _hypMaxElementVolume = new StdMeshers_MaxElementVolume(1, gen);
+    _hypMaxElementVolume = new StdMeshers_MaxElementVolume(1, GetGen());
     _maxElementVolume = aParams.maxElementVolume;
   }
   // TODO: Handle viscous layer
 }
 
+/**
+ * @brief Write a binary file containing information on the elements/nodes
+ *        created by the mesher
+ *
+ * @param nodeVec mapping between the mesh id and the netgen structure id
+ * @param ngLib Wrapper on netgen library
+ * @param new_element_file Name of the output file
+ * @param Netgen_NbOfNodes Number of nodes in the netgen structure
+ * @return true if there are some error
+ */
 bool NETGENPlugin_NETGEN_3D_SA::computeFillNewElementFile(
     std::vector< const SMDS_MeshNode* > &nodeVec,
     NETGENPlugin_NetgenLibWrapper &ngLib,
@@ -190,9 +203,22 @@ bool NETGENPlugin_NETGEN_3D_SA::computeFillNewElementFile(
   return false;
 }
 
-
-bool NETGENPlugin_NETGEN_3D_SA::Compute(TopoDS_Shape &aShape, SMESH_Mesh& aMesh, netgen_params& aParams,
-                     std::string new_element_file, bool output_mesh)
+/**
+ * @brief Compute mesh associated to shape
+ *
+ * @param aShape the shape
+ * @param aMesh the mesh
+ * @param aParams netgen_params structure
+ * @param new_element_file Name of the file containing new element
+ * @param output_mesh Name of the output mesh (if empty it will not be written)
+ * @return true if there are some error
+ */
+bool NETGENPlugin_NETGEN_3D_SA::Compute(
+        TopoDS_Shape &aShape,
+        SMESH_Mesh& aMesh,
+        netgen_params& aParams,
+        std::string new_element_file,
+        bool output_mesh)
 {
   // vector of nodes in which node index == netgen ID
   vector< const SMDS_MeshNode* > nodeVec;
@@ -222,6 +248,18 @@ bool NETGENPlugin_NETGEN_3D_SA::Compute(TopoDS_Shape &aShape, SMESH_Mesh& aMesh,
   return false;
 }
 
+
+/**
+ * @brief Running the mesher on the given files
+ *
+ * @param input_mesh_file Mesh file (containing 2D elements)
+ * @param shape_file Shape file (BREP or STEP format)
+ * @param hypo_file Ascii file containing the netgen parameters
+ * @param element_orientation_file Binary file containing the orientation of surface elemnts
+ * @param new_element_file output file containing info the elements created by the mesher
+ * @param output_mesh_file output mesh file (if empty it will not be created)
+ * @return int
+ */
 int NETGENPlugin_NETGEN_3D_SA::run(const std::string input_mesh_file,
           const std::string shape_file,
           const std::string hypo_file,
@@ -231,10 +269,8 @@ int NETGENPlugin_NETGEN_3D_SA::run(const std::string input_mesh_file,
 {
 
   _element_orientation_file = element_orientation_file;
-  // Importing mesh
-  SMESH_Gen gen;
 
-  std::unique_ptr<SMESH_Mesh> myMesh(gen.CreateMesh(false));
+  std::unique_ptr<SMESH_Mesh> myMesh(_gen->CreateMesh(false));
 
   importMesh(input_mesh_file, *myMesh);
 
@@ -246,7 +282,7 @@ int NETGENPlugin_NETGEN_3D_SA::run(const std::string input_mesh_file,
   netgen_params myParams;
 
   importNetgenParams(hypo_file, myParams);
-  fillHyp(myParams, &gen);
+  fillHyp(myParams);
 
   MESSAGE("Meshing with netgen3d");
   int ret = Compute(myShape, *myMesh, myParams,
@@ -267,7 +303,19 @@ int NETGENPlugin_NETGEN_3D_SA::run(const std::string input_mesh_file,
   return ret;
 }
 
-
+/**
+ * @brief Compute the list of already meshed Surface elements and info
+ *        on their orientation and if they are internal
+ *
+ * @param aMesh Global Mesh
+ * @param aShape Shape associated to the mesh
+ * @param proxyMesh pointer to mesh used fo find the elements
+ * @param internals information on internal sub shapes
+ * @param helper helper associated to the mesh
+ * @param listElements map of surface element associated with
+ *                     their orientation and internal status
+ * @return true if their was some error
+ */
 bool NETGENPlugin_NETGEN_3D_SA::getSurfaceElements(
     SMESH_Mesh&         aMesh,
     const TopoDS_Shape& aShape,
index 62e9059228af7032d1351785609e8910b29c9bd9..0a6a6fc7b342af180e2f695a9ed46b24e0dc84cf 100644 (file)
@@ -38,7 +38,6 @@
 class NETGENPlugin_NetgenLibWrapper;
 class netgen_params;
 class SMDS_MeshNode;
-class SMESH_Gen;
 
 using namespace std;
 
@@ -48,7 +47,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D_SA: public NETGENPlugin_NETGEN_
   NETGENPlugin_NETGEN_3D_SA();
   virtual ~NETGENPlugin_NETGEN_3D_SA();
 
-  void fillHyp(netgen_params aParams, SMESH_Gen* gen);
+  void fillHyp(netgen_params aParams);
   bool Compute(TopoDS_Shape &aShape, SMESH_Mesh& aMesh, netgen_params& aParams,
                        std::string new_element_file, bool output_mesh);
 
@@ -77,8 +76,6 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D_SA: public NETGENPlugin_NETGEN_
     ) override;
 
    std::string _element_orientation_file="";
-   SMESH_Gen *_gen=nullptr;
-
 };
 
 #endif