Merge from V5_1_3_BR branch (07/12/09)
This commit is contained in:
parent
ab2d564ff9
commit
10fc3eb3e0
@ -41,6 +41,7 @@
|
|||||||
#include <utilities.h>
|
#include <utilities.h>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
#include <TopExp.hxx>
|
#include <TopExp.hxx>
|
||||||
@ -1016,6 +1017,9 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
|
|||||||
list< SMESH_subMesh* > meshedSM;
|
list< SMESH_subMesh* > meshedSM;
|
||||||
PrepareOCCgeometry( occgeo, _shape, *_mesh, &meshedSM );
|
PrepareOCCgeometry( occgeo, _shape, *_mesh, &meshedSM );
|
||||||
|
|
||||||
|
bool tooManyElems = false;
|
||||||
|
const int hugeNb = std::numeric_limits<int>::max() / 100;
|
||||||
|
|
||||||
// ----------------
|
// ----------------
|
||||||
// evaluate 1D
|
// evaluate 1D
|
||||||
// ----------------
|
// ----------------
|
||||||
@ -1043,22 +1047,30 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
|
|||||||
if( EdgesMap.IsBound(E) )
|
if( EdgesMap.IsBound(E) )
|
||||||
continue;
|
continue;
|
||||||
SMESH_subMesh *sm = _mesh->GetSubMesh(E);
|
SMESH_subMesh *sm = _mesh->GetSubMesh(E);
|
||||||
|
std::vector<int> aVec(SMDSEntity_Last, 0);
|
||||||
double aLen = SMESH_Algo::EdgeLength(E);
|
double aLen = SMESH_Algo::EdgeLength(E);
|
||||||
fullLen += aLen;
|
fullLen += aLen;
|
||||||
int nb1d = nbs;
|
int nb1d = nbs;
|
||||||
if(nb1d==0) {
|
tooManyElems = ( aLen/hugeNb > mparams.maxh );
|
||||||
nb1d = (int)( aLen/mparams.maxh + 1 );
|
if(nb1d==0 && !tooManyElems) {
|
||||||
|
nb1d = (int)( aLen/mparams.maxh + 1 );
|
||||||
}
|
}
|
||||||
fullNbSeg += nb1d;
|
if ( tooManyElems ) // avoid FPE
|
||||||
std::vector<int> aVec(SMDSEntity_Last);
|
{
|
||||||
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
|
aVec[SMDSEntity_Node] = hugeNb;
|
||||||
if( mparams.secondorder > 0 ) {
|
aVec[ mparams.secondorder > 0 ? SMDSEntity_Quad_Edge : SMDSEntity_Edge] = hugeNb;
|
||||||
aVec[SMDSEntity_Node] = 2*nb1d - 1;
|
|
||||||
aVec[SMDSEntity_Quad_Edge] = nb1d;
|
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
aVec[SMDSEntity_Node] = nb1d - 1;
|
{
|
||||||
aVec[SMDSEntity_Edge] = nb1d;
|
fullNbSeg += nb1d;
|
||||||
|
if( mparams.secondorder > 0 ) {
|
||||||
|
aVec[SMDSEntity_Node] = 2*nb1d - 1;
|
||||||
|
aVec[SMDSEntity_Quad_Edge] = nb1d;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aVec[SMDSEntity_Node] = nb1d - 1;
|
||||||
|
aVec[SMDSEntity_Edge] = nb1d;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
aResMap.insert(std::make_pair(sm,aVec));
|
aResMap.insert(std::make_pair(sm,aVec));
|
||||||
EdgesMap.Bind(E,nb1d);
|
EdgesMap.Bind(E,nb1d);
|
||||||
@ -1080,20 +1092,24 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
|
|||||||
}
|
}
|
||||||
mparams.maxh = min( mparams.maxh, occgeo.boundingbox.Diam()/2 );
|
mparams.maxh = min( mparams.maxh, occgeo.boundingbox.Diam()/2 );
|
||||||
}
|
}
|
||||||
for (TopExp_Explorer exp(_shape, TopAbs_FACE); exp.More(); exp.Next()) {
|
|
||||||
|
for (TopExp_Explorer exp(_shape, TopAbs_FACE); exp.More(); exp.Next())
|
||||||
|
{
|
||||||
TopoDS_Face F = TopoDS::Face( exp.Current() );
|
TopoDS_Face F = TopoDS::Face( exp.Current() );
|
||||||
SMESH_subMesh *sm = _mesh->GetSubMesh(F);
|
SMESH_subMesh *sm = _mesh->GetSubMesh(F);
|
||||||
GProp_GProps G;
|
GProp_GProps G;
|
||||||
BRepGProp::SurfaceProperties(F,G);
|
BRepGProp::SurfaceProperties(F,G);
|
||||||
double anArea = G.Mass();
|
double anArea = G.Mass();
|
||||||
|
tooManyElems = tooManyElems || ( anArea/hugeNb > mparams.maxh*mparams.maxh );
|
||||||
int nb1d = 0;
|
int nb1d = 0;
|
||||||
for (TopExp_Explorer exp1(F,TopAbs_EDGE); exp1.More(); exp1.Next()) {
|
if ( !tooManyElems )
|
||||||
nb1d += EdgesMap.Find(exp1.Current());
|
for (TopExp_Explorer exp1(F,TopAbs_EDGE); exp1.More(); exp1.Next())
|
||||||
}
|
nb1d += EdgesMap.Find(exp1.Current());
|
||||||
int nbFaces = (int) ( anArea / ( mparams.maxh*mparams.maxh*sqrt(3.) / 4 ) );
|
|
||||||
int nbNodes = (int) ( ( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 );
|
int nbFaces = tooManyElems ? hugeNb : int( 4*anArea / mparams.maxh*mparams.maxh*sqrt(3.));
|
||||||
std::vector<int> aVec(SMDSEntity_Last);
|
int nbNodes = tooManyElems ? hugeNb : (( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 );
|
||||||
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
|
|
||||||
|
std::vector<int> aVec(SMDSEntity_Last, 0);
|
||||||
if( mparams.secondorder > 0 ) {
|
if( mparams.secondorder > 0 ) {
|
||||||
int nb1d_in = (nbFaces*3 - nb1d) / 2;
|
int nb1d_in = (nbFaces*3 - nb1d) / 2;
|
||||||
aVec[SMDSEntity_Node] = nbNodes + nb1d_in;
|
aVec[SMDSEntity_Node] = nbNodes + nb1d_in;
|
||||||
@ -1128,17 +1144,25 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
|
|||||||
BRepGProp::VolumeProperties(_shape,G);
|
BRepGProp::VolumeProperties(_shape,G);
|
||||||
double aVolume = G.Mass();
|
double aVolume = G.Mass();
|
||||||
double tetrVol = 0.1179*mparams.maxh*mparams.maxh*mparams.maxh;
|
double tetrVol = 0.1179*mparams.maxh*mparams.maxh*mparams.maxh;
|
||||||
int nbVols = int(aVolume/tetrVol);
|
tooManyElems = tooManyElems || ( aVolume/hugeNb > tetrVol );
|
||||||
|
int nbVols = tooManyElems ? hugeNb : int(aVolume/tetrVol);
|
||||||
int nb1d_in = int(( nbVols*6 - fullNbSeg ) / 6 );
|
int nb1d_in = int(( nbVols*6 - fullNbSeg ) / 6 );
|
||||||
std::vector<int> aVec(SMDSEntity_Last);
|
std::vector<int> aVec(SMDSEntity_Last, 0 );
|
||||||
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
|
if ( tooManyElems ) // avoid FPE
|
||||||
if( mparams.secondorder > 0 ) {
|
{
|
||||||
aVec[SMDSEntity_Node] = nb1d_in/3 + 1 + nb1d_in;
|
aVec[SMDSEntity_Node] = hugeNb;
|
||||||
aVec[SMDSEntity_Quad_Tetra] = nbVols;
|
aVec[ mparams.secondorder > 0 ? SMDSEntity_Quad_Tetra : SMDSEntity_Tetra] = hugeNb;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
aVec[SMDSEntity_Node] = nb1d_in/3 + 1;
|
{
|
||||||
aVec[SMDSEntity_Tetra] = nbVols;
|
if( mparams.secondorder > 0 ) {
|
||||||
|
aVec[SMDSEntity_Node] = nb1d_in/3 + 1 + nb1d_in;
|
||||||
|
aVec[SMDSEntity_Quad_Tetra] = nbVols;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aVec[SMDSEntity_Node] = nb1d_in/3 + 1;
|
||||||
|
aVec[SMDSEntity_Tetra] = nbVols;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SMESH_subMesh *sm = _mesh->GetSubMesh(_shape);
|
SMESH_subMesh *sm = _mesh->GetSubMesh(_shape);
|
||||||
aResMap.insert(std::make_pair(sm,aVec));
|
aResMap.insert(std::make_pair(sm,aVec));
|
||||||
|
@ -138,8 +138,8 @@ bool NETGENPlugin_NETGEN_2D::Compute(SMESH_Mesh& aMesh,
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
|
||||||
bool NETGENPlugin_NETGEN_2D::Evaluate(SMESH_Mesh& aMesh,
|
bool NETGENPlugin_NETGEN_2D::Evaluate(SMESH_Mesh& aMesh,
|
||||||
const TopoDS_Shape& aShape,
|
const TopoDS_Shape& aShape,
|
||||||
MapShapeNbElems& aResMap)
|
MapShapeNbElems& aResMap)
|
||||||
{
|
{
|
||||||
|
|
||||||
NETGENPlugin_Mesher mesher(&aMesh, aShape, false);
|
NETGENPlugin_Mesher mesher(&aMesh, aShape, false);
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Netgen include files
|
Netgen include files
|
||||||
@ -206,10 +207,6 @@ static TError AddSegmentsToMesh(netgen::Mesh& ngMesh,
|
|||||||
StdMeshers_FaceSidePtr wire = wires[ iW ];
|
StdMeshers_FaceSidePtr wire = wires[ iW ];
|
||||||
const vector<UVPtStruct>& uvPtVec = wire->GetUVPtStruct();
|
const vector<UVPtStruct>& uvPtVec = wire->GetUVPtStruct();
|
||||||
|
|
||||||
bool reverse = // 20526: [CEA] Disk meshing fails
|
|
||||||
( wire->NbEdges() == 1 &&
|
|
||||||
geom.emap(geom.emap.FindIndex(wire->Edge(0))).Orientation() == TopAbs_REVERSED );
|
|
||||||
|
|
||||||
int firstPointID = ngMesh.GetNP() + 1;
|
int firstPointID = ngMesh.GetNP() + 1;
|
||||||
int edgeID = 1, posID = -2;
|
int edgeID = 1, posID = -2;
|
||||||
for ( int i = 0; i < wire->NbSegments(); ++i ) // loop on segments
|
for ( int i = 0; i < wire->NbSegments(); ++i ) // loop on segments
|
||||||
@ -265,18 +262,6 @@ static TError AddSegmentsToMesh(netgen::Mesh& ngMesh,
|
|||||||
}
|
}
|
||||||
seg.epgeominfo[ iEnd ].edgenr = edgeID; // = geom.emap.FindIndex(edge);
|
seg.epgeominfo[ iEnd ].edgenr = edgeID; // = geom.emap.FindIndex(edge);
|
||||||
}
|
}
|
||||||
// 20526: [CEA] Disk meshing fails
|
|
||||||
if (reverse)
|
|
||||||
{
|
|
||||||
#ifdef NETGEN_NEW
|
|
||||||
swap (seg.pnums[0], seg.pnums[1]);
|
|
||||||
#else
|
|
||||||
swap (seg.p1, seg.p2);
|
|
||||||
#endif
|
|
||||||
swap (seg.epgeominfo[0].dist, seg.epgeominfo[1].dist);
|
|
||||||
swap (seg.epgeominfo[0].u, seg.epgeominfo[1].u);
|
|
||||||
swap (seg.epgeominfo[0].v, seg.epgeominfo[1].v);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngMesh.AddSegment (seg);
|
ngMesh.AddSegment (seg);
|
||||||
|
|
||||||
@ -529,21 +514,19 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh,
|
|||||||
double maxArea = _hypMaxElementArea->GetMaxArea();
|
double maxArea = _hypMaxElementArea->GetMaxArea();
|
||||||
ELen = sqrt(2. * maxArea/sqrt(3.0));
|
ELen = sqrt(2. * maxArea/sqrt(3.0));
|
||||||
}
|
}
|
||||||
if ( ELen < Precision::Confusion() ) {
|
|
||||||
SMESH_subMesh *sm = aMesh.GetSubMesh(F);
|
|
||||||
if ( sm ) {
|
|
||||||
SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
|
|
||||||
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated.\nToo small element length",this));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GProp_GProps G;
|
GProp_GProps G;
|
||||||
BRepGProp::SurfaceProperties(F,G);
|
BRepGProp::SurfaceProperties(F,G);
|
||||||
double anArea = G.Mass();
|
double anArea = G.Mass();
|
||||||
int nbFaces = 0;
|
|
||||||
if ( ELen > Precision::Confusion() )
|
const int hugeNb = numeric_limits<int>::max()/10;
|
||||||
nbFaces = (int) ( anArea / ( ELen*ELen*sqrt(3.) / 4 ) );
|
if ( anArea / hugeNb > ELen*ELen )
|
||||||
|
{
|
||||||
|
SMESH_subMesh *sm = aMesh.GetSubMesh(F);
|
||||||
|
SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
|
||||||
|
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 );
|
int nbNodes = (int) ( ( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 );
|
||||||
std::vector<int> aVec(SMDSEntity_Last);
|
std::vector<int> aVec(SMDSEntity_Last);
|
||||||
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
|
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
|
||||||
|
Loading…
Reference in New Issue
Block a user