Skip to content

Commit

Permalink
[Netgen] add headers to support recent Netgen
Browse files Browse the repository at this point in the history
- as reported here: https://forum.freecadweb.org/viewtopic.php?p=618174#p618174
- also fix compiler warnings about unsafe bool handling
  • Loading branch information
donovaly committed Aug 17, 2022
1 parent ee68391 commit 8b056f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Expand Up @@ -50,7 +50,9 @@

#include <utilities.h>

#include <BRepBndLib.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepMesh_IncrementalMesh.hxx>
#include <BRep_Tool.hxx>
#include <Bnd_B3d.hxx>
#include <NCollection_Map.hxx>
Expand All @@ -66,6 +68,7 @@
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Solid.hxx>

#ifdef _MSC_VER
#pragma warning(disable : 4067)
Expand Down Expand Up @@ -3027,7 +3030,7 @@ bool NETGENPlugin_Mesher::Compute()
}
}
}
if (!err && mparams.secondorder > 0)
if (!err && mparams.secondorder)
{
try
{
Expand Down Expand Up @@ -3302,7 +3305,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
// calculate total nb of segments and length of edges
double fullLen = 0.0;
int fullNbSeg = 0;
int entity = mparams.secondorder > 0 ? SMDSEntity_Quad_Edge : SMDSEntity_Edge;
int entity = mparams.secondorder ? SMDSEntity_Quad_Edge : SMDSEntity_Edge;
TopTools_DataMapOfShapeInteger Edge2NbSeg;
for (TopExp_Explorer exp(_shape, TopAbs_EDGE); exp.More(); exp.Next())
{
Expand Down Expand Up @@ -3340,7 +3343,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
{
vector<int>& aVec = aResMap[_mesh->GetSubMesh(Edge2NbSegIt.Key())];
if ( aVec[ entity ] > 1 && aVec[ SMDSEntity_Node ] == 0 )
aVec[SMDSEntity_Node] = mparams.secondorder > 0 ? 2*aVec[ entity ]-1 : aVec[ entity ]-1;
aVec[SMDSEntity_Node] = mparams.secondorder ? 2*aVec[ entity ]-1 : aVec[ entity ]-1;

fullNbSeg += aVec[ entity ];
Edge2NbSeg( Edge2NbSegIt.Key() ) = aVec[ entity ];
Expand Down Expand Up @@ -3386,7 +3389,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
int nbNodes = tooManyElems ? hugeNb : (( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 );

vector<int> aVec(SMDSEntity_Last, 0);
if( mparams.secondorder > 0 ) {
if (mparams.secondorder) {
int nb1d_in = (nbFaces*3 - nb1d) / 2;
aVec[SMDSEntity_Node] = nbNodes + nb1d_in;
aVec[SMDSEntity_Quad_Triangle] = nbFaces;
Expand Down Expand Up @@ -3428,11 +3431,11 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
if ( tooManyElems ) // avoid FPE
{
aVec[SMDSEntity_Node] = hugeNb;
aVec[ mparams.secondorder > 0 ? SMDSEntity_Quad_Tetra : SMDSEntity_Tetra] = hugeNb;
aVec[ mparams.secondorder ? SMDSEntity_Quad_Tetra : SMDSEntity_Tetra] = hugeNb;
}
else
{
if( mparams.secondorder > 0 ) {
if (mparams.secondorder) {
aVec[SMDSEntity_Node] = nb1d_in/3 + 1 + nb1d_in;
aVec[SMDSEntity_Quad_Tetra] = nbVols;
}
Expand Down
Expand Up @@ -39,6 +39,8 @@
#include <StdMeshers_MaxElementArea.hxx>
#include <StdMeshers_QuadranglePreference.hxx>
#include <StdMeshers_ViscousLayers2D.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>

#include <Precision.hxx>
#include <Standard_ErrorHandler.hxx>
Expand Down

0 comments on commit 8b056f1

Please sign in to comment.