Salome HOME
typo-fix by Kunda
[plugins/netgenplugin.git] / src / NETGENPlugin / NETGENPlugin_NETGEN_2D_ONLY.cxx
index 3a513a896a840a6b206d967d9fd3c0e04de238ec..5f2b88fc9a0c5b8804e5c248a086b72f48b37cca 100644 (file)
@@ -67,6 +67,9 @@ namespace netgen {
   extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
 #else
   extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
+#endif
+#if defined(NETGEN_V5) && defined(WIN32)
+  DLL_HEADER 
 #endif
   extern MeshingParameters mparam;
   extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh);
@@ -112,7 +115,7 @@ NETGENPlugin_NETGEN_2D_ONLY::NETGENPlugin_NETGEN_2D_ONLY(int        hypId,
 
 NETGENPlugin_NETGEN_2D_ONLY::~NETGENPlugin_NETGEN_2D_ONLY()
 {
-  MESSAGE("NETGENPlugin_NETGEN_2D_ONLY::~NETGENPlugin_NETGEN_2D_ONLY");
+  //MESSAGE("NETGENPlugin_NETGEN_2D_ONLY::~NETGENPlugin_NETGEN_2D_ONLY");
 }
 
 //=============================================================================
@@ -167,7 +170,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::CheckHypothesis (SMESH_Mesh&         aMesh,
 
   int nbHyps = bool(_hypMaxElementArea) + bool(_hypLengthFromEdges) + bool(_hypParameters );
   if ( nbHyps > 1 )
-    aStatus = HYP_CONCURENT;
+    aStatus = HYP_CONCURRENT;
   else if ( hasVL )
     error( StdMeshers_ViscousLayers2D::CheckHypothesis( aMesh, aShape, aStatus ));
   else
@@ -298,8 +301,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh&         aMesh,
     for ( int iE = 1; iE <= edgeMap.Extent(); ++iE )
     {
       const TopoDS_Shape& edge = edgeMap( iE );
-      if ( SMESH_Algo::isDegenerated( TopoDS::Edge( edge ))/* ||
-           helper.IsSubShape( edge, aShape )*/)
+      if ( SMESH_Algo::isDegenerated( TopoDS::Edge( edge )))
         continue;
       SMESHDS_SubMesh* smDS = meshDS->MeshElements( edge );
       if ( !smDS ) continue;
@@ -314,6 +316,15 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh&         aMesh,
         ngMeshes[0]->RestrictLocalH( pi, factor * ( n1 - n2 ).Modulus() );
       }
     }
+
+    // set local size defined on shapes
+    aMesher.SetLocalSize( occgeoComm, *ngMeshes[0] );
+    aMesher.SetLocalSizeForChordalError( occgeoComm, *ngMeshes[0] );
+    try {
+      ngMeshes[0]->LoadLocalMeshSize( mparam.meshsizefilename );
+    } catch (NgException & ex) {
+      return error( COMPERR_BAD_PARMETERS, ex.What() );
+    }
   }
   netgen::mparam.uselocalh = toOptimize; // restore as it is used at surface optimization
 
@@ -345,7 +356,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh&         aMesh,
     // get all EDGEs of a FACE
     // ------------------------
     TSideVector wires =
-      StdMeshers_FaceSide::GetFaceWires( F, aMesh, ignoreMediumNodes, faceErr, proxyMesh );
+      StdMeshers_FaceSide::GetFaceWires( F, aMesh, ignoreMediumNodes, faceErr, &helper, proxyMesh );
     if ( faceErr && !faceErr->IsOK() )
       continue;
     int nbWires = wires.size();
@@ -449,6 +460,13 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh&         aMesh,
         Box<3> bb = occgeom.GetBoundingBox();
         bb.Increase (bb.Diam()/10);
         ngMesh->SetLocalH (bb.PMin(), bb.PMax(), mparam.grading);
+        aMesher.SetLocalSize( occgeom, *ngMesh );
+        aMesher.SetLocalSizeForChordalError( occgeoComm, *ngMesh );
+        try {
+          ngMesh->LoadLocalMeshSize( mparam.meshsizefilename );
+        } catch (NgException & ex) {
+          return error( COMPERR_BAD_PARMETERS, ex.What() );
+        }
       }
 
       nodeVec.clear();