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
Adding new algo for parallel meshing
[plugins/netgenplugin.git]
/
src
/
NETGENPlugin
/
NETGENPlugin_NETGEN_2D_ONLY.cxx
diff --git
a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx
b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx
index 5f2b88fc9a0c5b8804e5c248a086b72f48b37cca..9c122c3f236351ad432cb26abcc3e745d1419b2b 100644
(file)
--- a/
src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx
+++ b/
src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-20
16
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-20
22
CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
@@
-63,16
+63,11
@@
namespace nglib {
#include <meshing.hpp>
//#include <meshtype.hpp>
namespace netgen {
#include <meshing.hpp>
//#include <meshtype.hpp>
namespace netgen {
-#ifdef NETGEN_V5
- 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
+ NETGENPLUGIN_DLL_HEADER
extern MeshingParameters mparam;
extern MeshingParameters mparam;
+#ifdef NETGEN_V5
extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh);
extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh);
+#endif
}
using namespace std;
}
using namespace std;
@@
-81,17
+76,16
@@
using namespace nglib;
//=============================================================================
/*!
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
NETGENPlugin_NETGEN_2D_ONLY::NETGENPlugin_NETGEN_2D_ONLY(int hypId,
*/
//=============================================================================
NETGENPlugin_NETGEN_2D_ONLY::NETGENPlugin_NETGEN_2D_ONLY(int hypId,
- int studyId,
SMESH_Gen* gen)
SMESH_Gen* gen)
- : SMESH_2D_Algo(hypId,
studyId,
gen)
+ : SMESH_2D_Algo(hypId, gen)
{
_name = "NETGEN_2D_ONLY";
{
_name = "NETGEN_2D_ONLY";
-
+
_shapeType = (1 << TopAbs_FACE);// 1 bit /shape type
_onlyUnaryInput = false; // treat all FACEs at once
_shapeType = (1 << TopAbs_FACE);// 1 bit /shape type
_onlyUnaryInput = false; // treat all FACEs at once
@@
-109,7
+103,7
@@
NETGENPlugin_NETGEN_2D_ONLY::NETGENPlugin_NETGEN_2D_ONLY(int hypId,
//=============================================================================
/*!
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
*/
//=============================================================================
@@
-120,7
+114,7
@@
NETGENPlugin_NETGEN_2D_ONLY::~NETGENPlugin_NETGEN_2D_ONLY()
//=============================================================================
/*!
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
*/
//=============================================================================
@@
-287,15
+281,24
@@
bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
netgen::mparam.minh = aMesher.GetDefaultMinSize( aShape, netgen::mparam.maxh );
}
// set local size depending on curvature and NOT closeness of EDGEs
netgen::mparam.minh = aMesher.GetDefaultMinSize( aShape, netgen::mparam.maxh );
}
// set local size depending on curvature and NOT closeness of EDGEs
+#ifdef NETGEN_V6
+ const double factor = 2; //netgen::occparam.resthcloseedgefac;
+#else
+ const double factor = netgen::occparam.resthcloseedgefac;
netgen::occparam.resthcloseedgeenable = false;
netgen::occparam.resthcloseedgeenable = false;
- //netgen::occparam.resthcloseedgefac = 1.0 + netgen::mparam.grading;
+ netgen::occparam.resthcloseedgefac = 1.0 + netgen::mparam.grading;
+#endif
occgeoComm.face_maxh = netgen::mparam.maxh;
occgeoComm.face_maxh = netgen::mparam.maxh;
+#ifdef NETGEN_V6
+ netgen::OCCParameters occparam;
+ netgen::OCCSetLocalMeshSize( occgeoComm, *ngMeshes[0], netgen::mparam, occparam );
+#else
netgen::OCCSetLocalMeshSize( occgeoComm, *ngMeshes[0] );
netgen::OCCSetLocalMeshSize( occgeoComm, *ngMeshes[0] );
+#endif
occgeoComm.emap.Clear();
occgeoComm.vmap.Clear();
// set local size according to size of existing segments
occgeoComm.emap.Clear();
occgeoComm.vmap.Clear();
// set local size according to size of existing segments
- const double factor = netgen::occparam.resthcloseedgefac;
TopTools_IndexedMapOfShape edgeMap;
TopExp::MapShapes( aMesh.GetShapeToMesh(), TopAbs_EDGE, edgeMap );
for ( int iE = 1; iE <= edgeMap.Extent(); ++iE )
TopTools_IndexedMapOfShape edgeMap;
TopExp::MapShapes( aMesh.GetShapeToMesh(), TopAbs_EDGE, edgeMap );
for ( int iE = 1; iE <= edgeMap.Extent(); ++iE )
@@
-359,7
+362,7
@@
bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
StdMeshers_FaceSide::GetFaceWires( F, aMesh, ignoreMediumNodes, faceErr, &helper, proxyMesh );
if ( faceErr && !faceErr->IsOK() )
continue;
StdMeshers_FaceSide::GetFaceWires( F, aMesh, ignoreMediumNodes, faceErr, &helper, proxyMesh );
if ( faceErr && !faceErr->IsOK() )
continue;
-
in
t nbWires = wires.size();
+
size_
t nbWires = wires.size();
if ( nbWires == 0 )
{
faceErr.reset
if ( nbWires == 0 )
{
faceErr.reset
@@
-385,21
+388,21
@@
bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
if (_hypLengthFromEdges )
{
// compute edgeLength as an average segment length
if (_hypLengthFromEdges )
{
// compute edgeLength as an average segment length
-
int
nbSegments = 0;
- for (
in
t iW = 0; iW < nbWires; ++iW )
+
smIdType
nbSegments = 0;
+ for (
size_
t iW = 0; iW < nbWires; ++iW )
{
edgeLength += wires[ iW ]->Length();
nbSegments += wires[ iW ]->NbSegments();
}
if ( nbSegments )
{
edgeLength += wires[ iW ]->Length();
nbSegments += wires[ iW ]->NbSegments();
}
if ( nbSegments )
- edgeLength /=
nbSegments
;
+ edgeLength /=
double( nbSegments )
;
netgen::mparam.maxh = edgeLength;
}
else if ( isDefaultHyp )
{
// set edgeLength by a longest segment
double maxSeg2 = 0;
netgen::mparam.maxh = edgeLength;
}
else if ( isDefaultHyp )
{
// set edgeLength by a longest segment
double maxSeg2 = 0;
- for (
in
t iW = 0; iW < nbWires; ++iW )
+ for (
size_
t iW = 0; iW < nbWires; ++iW )
{
const UVPtStructVec& points = wires[ iW ]->GetUVPtStruct();
if ( points.empty() )
{
const UVPtStructVec& points = wires[ iW ]->GetUVPtStruct();
if ( points.empty() )
@@
-489,12
+492,8
@@
bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
try {
OCC_CATCH_SIGNALS;
try {
OCC_CATCH_SIGNALS;
-#ifdef NETGEN_V5
- err = netgen::OCCGenerateMesh(occgeom, ngMesh, netgen::mparam, startWith, endWith);
-#else
- char *optstr = 0;
- err = netgen::OCCGenerateMesh(occgeom, ngMesh, startWith, endWith, optstr);
-#endif
+ err = ngLib.GenerateMesh(occgeom, startWith, endWith, ngMesh);
+
if ( netgen::multithread.terminate )
return false;
if ( err )
if ( netgen::multithread.terminate )
return false;
if ( err )
@@
-555,7
+554,7
@@
bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
int nbNodes = ngMesh->GetNP();
int nbFaces = ngMesh->GetNSE();
int nbNodes = ngMesh->GetNP();
int nbFaces = ngMesh->GetNSE();
- int nbInputNodes = nodeVec.size()-1;
+ int nbInputNodes =
(int)
nodeVec.size()-1;
nodeVec.resize( nbNodes+1, 0 );
// add nodes
nodeVec.resize( nbNodes+1, 0 );
// add nodes
@@
-653,7
+652,7
@@
bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh,
return false;
// collect info from edges
return false;
// collect info from edges
-
int
nb0d = 0, nb1d = 0;
+
smIdType
nb0d = 0, nb1d = 0;
bool IsQuadratic = false;
bool IsFirst = true;
double fullLen = 0.0;
bool IsQuadratic = false;
bool IsFirst = true;
double fullLen = 0.0;
@@
-671,9
+670,9
@@
bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh,
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
return false;
}
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
return false;
}
- std::vector<
int
> aVec = (*anIt).second;
+ std::vector<
smIdType
> aVec = (*anIt).second;
nb0d += aVec[SMDSEntity_Node];
nb0d += aVec[SMDSEntity_Node];
- nb1d +=
M
ax(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
+ nb1d +=
std::m
ax(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
double aLen = SMESH_Algo::EdgeLength(E);
fullLen += aLen;
if(IsFirst) {
double aLen = SMESH_Algo::EdgeLength(E);
fullLen += aLen;
if(IsFirst) {
@@
-687,7
+686,7
@@
bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh,
double ELen = 0;
if (( _hypLengthFromEdges ) || ( !_hypLengthFromEdges && !_hypMaxElementArea )) {
if ( nb1d > 0 )
double ELen = 0;
if (( _hypLengthFromEdges ) || ( !_hypLengthFromEdges && !_hypMaxElementArea )) {
if ( nb1d > 0 )
- ELen = fullLen /
nb1d
;
+ ELen = fullLen /
double( nb1d )
;
}
if ( _hypMaxElementArea ) {
double maxArea = _hypMaxElementArea->GetMaxArea();
}
if ( _hypMaxElementArea ) {
double maxArea = _hypMaxElementArea->GetMaxArea();
@@
-705,10
+704,10
@@
bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh,
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated.\nToo small element length",this));
return false;
}
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated.\nToo small element length",this));
return false;
}
-
int nbFaces = (int
) ( anArea / ( ELen*ELen*sqrt(3.) / 4 ) );
-
int nbNodes = (int
) ( ( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 );
- std::vector<
int
> aVec(SMDSEntity_Last);
- for(
int
i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
+
smIdType nbFaces = (smIdType
) ( anArea / ( ELen*ELen*sqrt(3.) / 4 ) );
+
smIdType nbNodes = (smIdType
) ( ( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 );
+ std::vector<
smIdType
> aVec(SMDSEntity_Last);
+ for(
smIdType
i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
if( IsQuadratic ) {
aVec[SMDSEntity_Node] = nbNodes;
aVec[SMDSEntity_Quad_Triangle] = nbFaces;
if( IsQuadratic ) {
aVec[SMDSEntity_Node] = nbNodes;
aVec[SMDSEntity_Quad_Triangle] = nbFaces;