X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FNETGENPlugin%2FNETGENPlugin_NETGEN_3D.cxx;h=cc05f2a40cf37cba476693654e6fb7363794122f;hb=aabb991fa6459f71e1d069aaf77dc34a3b2c5e00;hp=0e5a87f5f3346c8ab16942160817b51ede7fffc2;hpb=2b9909cbae6ce6a3f1abf26e170c8ff1a3ee2b7c;p=plugins%2Fnetgenplugin.git diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx index 0e5a87f..cc05f2a 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2013 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 @@ -75,7 +75,11 @@ namespace nglib { #include } namespace netgen { +#ifdef NETGEN_V5 + extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int); +#else extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*); +#endif extern MeshingParameters mparam; extern volatile multithreadt multithread; } @@ -181,10 +185,7 @@ bool NETGENPlugin_NETGEN_3D::CheckHypothesis (SMESH_Mesh& aMesh, bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) { -#ifdef WITH_SMESH_CANCEL_COMPUTE netgen::multithread.terminate = 0; -#endif - MESSAGE("NETGENPlugin_NETGEN_3D::Compute with maxElmentsize = " << _maxElementVolume); SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); @@ -192,8 +193,7 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, bool _quadraticMesh = helper.IsQuadraticSubMesh(aShape); helper.SetElementsOnShape( true ); - int Netgen_NbOfNodes = 0; - + int Netgen_NbOfNodes = 0; double Netgen_point[3]; int Netgen_triangle[3]; @@ -247,7 +247,7 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, helper.NbAncestors(aShapeFace, aMesh, aShape.ShapeType()) > 1 ) // IsReversedSubMesh() can work wrong on strongly curved faces, // so we use it as less as possible - isRev = SMESH_Algo::IsReversedSubMesh( TopoDS::Face(aShapeFace), meshDS ); + isRev = helper.IsReversedSubMesh( TopoDS::Face( aShapeFace )); const SMESHDS_SubMesh * aSubMeshDSFace = proxyMesh->GetSubMesh( aShapeFace ); if ( !aSubMeshDSFace ) continue; @@ -325,7 +325,7 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, // Generate the volume mesh // ------------------------- - return compute( aMesh, helper, nodeVec, Netgen_mesh); + return ( ngLib._isComputeOk = compute( aMesh, helper, nodeVec, Netgen_mesh)); } //================================================================================ @@ -339,13 +339,14 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh, vector< const SMDS_MeshNode* >& nodeVec, Ng_Mesh * Netgen_mesh) { -#ifdef WITH_SMESH_CANCEL_COMPUTE netgen::multithread.terminate = 0; -#endif + netgen::Mesh* ngMesh = (netgen::Mesh*)Netgen_mesh; int Netgen_NbOfNodes = Ng_GetNP(Netgen_mesh); +#ifndef NETGEN_V5 char *optstr = 0; +#endif int startWith = netgen::MESHCONST_MESHVOLUME; int endWith = netgen::MESHCONST_OPTVOLUME; int err = 1; @@ -385,12 +386,15 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh, #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; #endif +#ifdef NETGEN_V5 + ngMesh->CalcLocalH(netgen::mparam.grading); + err = netgen::OCCGenerateMesh(occgeo, ngMesh, netgen::mparam, startWith, endWith); +#else ngMesh->CalcLocalH(); err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr); -#ifdef WITH_SMESH_CANCEL_COMPUTE +#endif if(netgen::multithread.terminate) return false; -#endif if ( err ) error(SMESH_Comment("Error in netgen::OCCGenerateMesh() at ") << netgen::multithread.task); } @@ -481,17 +485,14 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh, bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, SMESH_MesherHelper* aHelper) { - MESSAGE("NETGENPlugin_NETGEN_3D::Compute with maxElmentsize = " << _maxElementVolume); const int invalid_ID = -1; - bool _quadraticMesh = false; SMESH_MesherHelper::MType MeshType = aHelper->IsQuadraticMesh(); - - if(MeshType == SMESH_MesherHelper::COMP) + if ( MeshType == SMESH_MesherHelper::COMP ) return error( COMPERR_BAD_INPUT_MESH, - SMESH_Comment("Mesh with linear and quadratic elements given.")); - else if (MeshType == SMESH_MesherHelper::QUADRATIC) - _quadraticMesh = true; + SMESH_Comment("Mesh with linear and quadratic elements given")); + + aHelper->SetIsQuadratic( MeshType == SMESH_MesherHelper::QUADRATIC ); // --------------------------------- // Feed the Netgen with surface mesh @@ -501,7 +502,7 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, int Netgen_param2ndOrder = 0; double Netgen_paramFine = 1.; double Netgen_paramSize = pow( 72, 1/6. ) * pow( _maxElementVolume, 1/3. ); - + double Netgen_point[3]; int Netgen_triangle[3]; int Netgen_tetrahedron[4]; @@ -563,16 +564,14 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, // Generate the volume mesh // ------------------------- - return compute( aMesh, *aHelper, nodeVec, Netgen_mesh); + return ( ngLib._isComputeOk = compute( aMesh, *aHelper, nodeVec, Netgen_mesh)); } -#ifdef WITH_SMESH_CANCEL_COMPUTE void NETGENPlugin_NETGEN_3D::CancelCompute() { SMESH_Algo::CancelCompute(); netgen::multithread.terminate = 1; } -#endif //============================================================================= /*!