Salome HOME
projects
/
plugins
/
netgenplugin.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
0022232: [CEA 837] Memory corruption in GEOM/SMESH that leads to segfault on debian64
[plugins/netgenplugin.git]
/
src
/
NETGENPlugin
/
NETGENPlugin_NETGEN_3D.cxx
diff --git
a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx
b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx
index 0e5a87f5f3346c8ab16942160817b51ede7fffc2..cc05f2a40cf37cba476693654e6fb7363794122f 100644
(file)
--- a/
src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx
+++ b/
src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-201
2
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-201
3
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
//
// 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 <nglib.h>
}
namespace netgen {
#include <nglib.h>
}
namespace netgen {
+#ifdef NETGEN_V5
+ extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
+#else
extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
+#endif
extern MeshingParameters mparam;
extern volatile multithreadt multithread;
}
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)
{
bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape)
{
-#ifdef WITH_SMESH_CANCEL_COMPUTE
netgen::multithread.terminate = 0;
netgen::multithread.terminate = 0;
-#endif
- MESSAGE("NETGENPlugin_NETGEN_3D::Compute with maxElmentsize = " << _maxElementVolume);
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
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 );
bool _quadraticMesh = helper.IsQuadraticSubMesh(aShape);
helper.SetElementsOnShape( true );
- int Netgen_NbOfNodes = 0;
-
+ int Netgen_NbOfNodes = 0;
double Netgen_point[3];
int Netgen_triangle[3];
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
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;
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
// -------------------------
// 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)
{
vector< const SMDS_MeshNode* >& nodeVec,
Ng_Mesh * Netgen_mesh)
{
-#ifdef WITH_SMESH_CANCEL_COMPUTE
netgen::multithread.terminate = 0;
netgen::multithread.terminate = 0;
-#endif
+
netgen::Mesh* ngMesh = (netgen::Mesh*)Netgen_mesh;
int Netgen_NbOfNodes = Ng_GetNP(Netgen_mesh);
netgen::Mesh* ngMesh = (netgen::Mesh*)Netgen_mesh;
int Netgen_NbOfNodes = Ng_GetNP(Netgen_mesh);
+#ifndef NETGEN_V5
char *optstr = 0;
char *optstr = 0;
+#endif
int startWith = netgen::MESHCONST_MESHVOLUME;
int endWith = netgen::MESHCONST_OPTVOLUME;
int err = 1;
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
#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);
ngMesh->CalcLocalH();
err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
-#
ifdef WITH_SMESH_CANCEL_COMPUTE
+#
endif
if(netgen::multithread.terminate)
return false;
if(netgen::multithread.terminate)
return false;
-#endif
if ( err )
error(SMESH_Comment("Error in netgen::OCCGenerateMesh() at ") << netgen::multithread.task);
}
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)
{
bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
SMESH_MesherHelper* aHelper)
{
- MESSAGE("NETGENPlugin_NETGEN_3D::Compute with maxElmentsize = " << _maxElementVolume);
const int invalid_ID = -1;
const int invalid_ID = -1;
- bool _quadraticMesh = false;
SMESH_MesherHelper::MType MeshType = aHelper->IsQuadraticMesh();
SMESH_MesherHelper::MType MeshType = aHelper->IsQuadraticMesh();
-
- if(MeshType == SMESH_MesherHelper::COMP)
+ if ( MeshType == SMESH_MesherHelper::COMP )
return error( COMPERR_BAD_INPUT_MESH,
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
// ---------------------------------
// 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. );
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];
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
// -------------------------
// 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;
}
void NETGENPlugin_NETGEN_3D::CancelCompute()
{
SMESH_Algo::CancelCompute();
netgen::multithread.terminate = 1;
}
-#endif
//=============================================================================
/*!
//=============================================================================
/*!