Merge branch 'yan/parallel_mesh2'

This commit is contained in:
Yoann Audouin 2022-10-21 15:03:58 +02:00
commit 92cbce71d3
22 changed files with 2075 additions and 261 deletions

View File

@ -44,6 +44,13 @@ module NETGENPlugin
{ {
}; };
/*!
* NETGENPlugin_NETGEN_3D: interface of "Remote Tetrahedron (Netgen)" algorithm
*/
interface NETGENPlugin_NETGEN_3D_Remote : NETGENPlugin::NETGENPlugin_NETGEN_3D
{
};
/*! /*!
* NETGENPlugin_NETGEN_2D: interface of "Netgen 1D-2D" algorithm * NETGENPlugin_NETGEN_2D: interface of "Netgen 1D-2D" algorithm
*/ */
@ -140,6 +147,9 @@ module NETGENPlugin
void SetWorstElemMeasure(in short val ); void SetWorstElemMeasure(in short val );
short GetWorstElemMeasure(); short GetWorstElemMeasure();
void SetNbThreads(in short val );
short GetNbThreads();
void SetUseDelauney(in boolean toUse); void SetUseDelauney(in boolean toUse);
boolean GetUseDelauney(); boolean GetUseDelauney();

View File

@ -17,9 +17,12 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
# #
INCLUDE(UseQtExt)
# --- options --- # --- options ---
# additional include directories # additional include directories
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
${QT_INCLUDES}
${KERNEL_INCLUDE_DIRS} ${KERNEL_INCLUDE_DIRS}
${GUI_INCLUDE_DIRS} ${GUI_INCLUDE_DIRS}
${GEOM_INCLUDE_DIRS} ${GEOM_INCLUDE_DIRS}
@ -35,6 +38,7 @@ INCLUDE_DIRECTORIES(
# additional preprocessor / compiler flags # additional preprocessor / compiler flags
ADD_DEFINITIONS( ADD_DEFINITIONS(
${QT_DEFINITIONS}
${OMNIORB_DEFINITIONS} ${OMNIORB_DEFINITIONS}
${OpenCASCADE_DEFINITIONS} ${OpenCASCADE_DEFINITIONS}
${BOOST_DEFINITIONS} ${BOOST_DEFINITIONS}
@ -63,7 +67,10 @@ SET(_link_LIBRARIES
${KERNEL_SalomeNS} ${KERNEL_SalomeNS}
${KERNEL_SALOMELocalTrace} ${KERNEL_SALOMELocalTrace}
${KERNEL_OpUtil} ${KERNEL_OpUtil}
VTK::CommonCore
VTK::CommonDataModel
SalomeIDLNETGENPLUGIN SalomeIDLNETGENPLUGIN
Qt5::Core
) )
# --- headers --- # --- headers ---
@ -91,6 +98,10 @@ SET(NETGENEngine_HEADERS
NETGENPlugin_Mesher.hxx NETGENPlugin_Mesher.hxx
NETGENPlugin_Remesher_2D.hxx NETGENPlugin_Remesher_2D.hxx
NETGENPlugin_Defs.hxx NETGENPlugin_Defs.hxx
NETGENPlugin_DriverParam.hxx
NETGENPlugin_NETGEN_3D_SA.hxx
NETGENPlugin_NETGEN_3D_Remote.hxx
NETGENPlugin_NETGEN_3D_Remote_i.hxx
) )
# --- sources --- # --- sources ---
@ -118,6 +129,14 @@ SET(NETGENEngine_SOURCES
NETGENPlugin_SimpleHypothesis_3D_i.cxx NETGENPlugin_SimpleHypothesis_3D_i.cxx
NETGENPlugin_Remesher_2D.cxx NETGENPlugin_Remesher_2D.cxx
NETGENPlugin_i.cxx NETGENPlugin_i.cxx
NETGENPlugin_DriverParam.cxx
NETGENPlugin_NETGEN_3D_SA.cxx
NETGENPlugin_NETGEN_3D_Remote.cxx
NETGENPlugin_NETGEN_3D_Remote_i.cxx
)
SET(NetgenRunner_SOURCES
NETGENPlugin_Runner_main.cxx
) )
# --- scripts --- # --- scripts ---
@ -134,6 +153,10 @@ ADD_LIBRARY(NETGENEngine ${NETGENEngine_SOURCES})
TARGET_LINK_LIBRARIES(NETGENEngine ${_link_LIBRARIES} ) TARGET_LINK_LIBRARIES(NETGENEngine ${_link_LIBRARIES} )
INSTALL(TARGETS NETGENEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) INSTALL(TARGETS NETGENEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
ADD_EXECUTABLE(NETGENPlugin_Runner ${NetgenRunner_SOURCES})
TARGET_LINK_LIBRARIES(NETGENPlugin_Runner ${_link_LIBRARIES} NETGENEngine )
INSTALL(TARGETS NETGENPlugin_Runner EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
INSTALL(FILES ${NETGENEngine_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) INSTALL(FILES ${NETGENEngine_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/NETGENPlugin) SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/NETGENPlugin)

View File

@ -42,6 +42,7 @@ NETGEN_VERSION_MAJOR = NETGENPlugin.NETGEN_VERSION_MAJOR
## Algorithm type: Netgen tetrahedron 3D algorithm, see NETGEN_3D_Algorithm ## Algorithm type: Netgen tetrahedron 3D algorithm, see NETGEN_3D_Algorithm
NETGEN_3D = "NETGEN_3D" NETGEN_3D = "NETGEN_3D"
NETGEN_3D_Remote = "NETGEN_3D_Remote"
## Algorithm type: Netgen tetrahedron 1D-2D-3D algorithm, see NETGEN_1D2D3D_Algorithm ## Algorithm type: Netgen tetrahedron 1D-2D-3D algorithm, see NETGEN_1D2D3D_Algorithm
NETGEN_1D2D3D = "NETGEN_2D3D" NETGEN_1D2D3D = "NETGEN_2D3D"
## Algorithm type: Netgen triangle 1D-2D algorithm, see NETGEN_1D2D_Algorithm ## Algorithm type: Netgen triangle 1D-2D algorithm, see NETGEN_1D2D_Algorithm
@ -147,6 +148,12 @@ class NETGEN_Algorithm(Mesh_Algorithm):
if self.Parameters(): self.params.SetGrowthRate(theRate) if self.Parameters(): self.params.SetGrowthRate(theRate)
pass pass
## Sets @c NbThreads parameter
# @param theRate new value of the @c NbThreads parameter
def SetNbThreads(self, theNumber):
if self.Parameters(): self.params.SetNbThreads(theNumber)
pass
## Creates meshing hypothesis according to the chosen algorithm type ## Creates meshing hypothesis according to the chosen algorithm type
# and initializes it with default parameters # and initializes it with default parameters
# @param which hypothesis type; can be either @ref SOLE (default) or @ref SIMPLE # @param which hypothesis type; can be either @ref SOLE (default) or @ref SIMPLE
@ -328,6 +335,7 @@ class NETGEN_1D2D_Algorithm(NETGEN_1D2D3D_Algorithm):
# @internal # @internal
docHelper = "Creates triangle 2D algorithm for faces" docHelper = "Creates triangle 2D algorithm for faces"
## Private constructor. ## Private constructor.
# @param mesh parent mesh object algorithm is assigned to # @param mesh parent mesh object algorithm is assigned to
# @param geom geometry (shape/sub-shape) algorithm is assigned to; # @param geom geometry (shape/sub-shape) algorithm is assigned to;
@ -361,6 +369,8 @@ class NETGEN_2D_Only_Algorithm(NETGEN_Algorithm):
# @internal # @internal
docHelper = "Creates triangle 2D algorithm for faces" docHelper = "Creates triangle 2D algorithm for faces"
isDefault = True
## Private constructor. ## Private constructor.
# @param mesh parent mesh object algorithm is assigned to # @param mesh parent mesh object algorithm is assigned to
# @param geom geometry (shape/sub-shape) algorithm is assigned to; # @param geom geometry (shape/sub-shape) algorithm is assigned to;
@ -470,6 +480,37 @@ class NETGEN_3D_Algorithm(NETGEN_Algorithm):
pass # end of NETGEN_3D_Algorithm class pass # end of NETGEN_3D_Algorithm class
## Tetrahedron 3D algorithm
#
# It can be created by calling smeshBuilder.Mesh.Tetrahedron() or smeshBuilder.Mesh.Tetrahedron( smeshBuilder.NETGEN, geom=0 )
#
# This algorithm generates only 3D (volumes) elements for given geometrical shape
# and, in contrast to NETGEN_1D2D3D_Algorithm class, should be used in conjunction
# with other 1D and 2D meshing algorithms.
class NETGEN_3D_Remote_Algorithm(NETGEN_3D_Algorithm):
## type of algorithm used with helper function in smeshBuilder.Mesh class
# @internal
algoType = NETGEN_3D_Remote
## flag pointing either this algorithm should be used by default in dynamic method
# of smeshBuilder.Mesh class
# @internal
isDefault = False
## doc string of the method
# @internal
docHelper = "Remotely Creates tetrahedron 3D algorithm for solids"
## Private constructor.
# @param mesh parent mesh object algorithm is assigned to
# @param geom geometry (shape/sub-shape) algorithm is assigned to;
# if it is @c 0 (default), the algorithm is assigned to the main shape
def __init__(self, mesh, geom=0):
NETGEN_3D_Algorithm.__init__(self, mesh, geom)
pass
pass # end of NETGEN_3D_Remote_Algorithm class
## Triangle (helper) 1D-2D algorithm ## Triangle (helper) 1D-2D algorithm
# #

View File

@ -0,0 +1,172 @@
// Copyright (C) 2007-2022 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
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : NETGENPlugin_DriverParam.hxx
// Author : Yoann AUDOUIN, EDF
// Module : NETGEN
//
#include "NETGENPlugin_DriverParam.hxx"
#include <iostream>
#include <fstream>
#include <string>
#include <cassert>
/**
* @brief Print content of a netgen_params
*
* @param aParams The object to display
*/
void printNetgenParams(netgen_params& aParams){
std::cout << "has_netgen_param: " << aParams.has_netgen_param << std::endl;
std::cout << "maxh: " << aParams.maxh << std::endl;
std::cout << "minh: " << aParams.minh << std::endl;
std::cout << "segmentsperedge: " << aParams.segmentsperedge << std::endl;
std::cout << "grading: " << aParams.grading << std::endl;
std::cout << "curvaturesafety: " << aParams.curvaturesafety << std::endl;
std::cout << "secondorder: " << aParams.secondorder << std::endl;
std::cout << "quad: " << aParams.quad << std::endl;
std::cout << "optimize: " << aParams.optimize << std::endl;
std::cout << "fineness: " << aParams.fineness << std::endl;
std::cout << "uselocalh: " << aParams.uselocalh << std::endl;
std::cout << "merge_solids: " << aParams.merge_solids << std::endl;
std::cout << "chordalError: " << aParams.chordalError << std::endl;
std::cout << "optsteps2d: " << aParams.optsteps2d << std::endl;
std::cout << "optsteps3d: " << aParams.optsteps3d << std::endl;
std::cout << "elsizeweight: " << aParams.elsizeweight << std::endl;
std::cout << "opterrpow: " << aParams.opterrpow << std::endl;
std::cout << "delaunay: " << aParams.delaunay << std::endl;
std::cout << "checkoverlap: " << aParams.checkoverlap << std::endl;
std::cout << "checkchartboundary: " << aParams.checkchartboundary << std::endl;
std::cout << "closeedgefac: " << aParams.closeedgefac << std::endl;
std::cout << "nbThreadMesher: " << aParams.nbThreads << std::endl;
std::cout << "has_local_size: " << aParams.has_local_size << std::endl;
std::cout << "meshsizefilename: " << aParams.meshsizefilename << std::endl;
std::cout << "has_maxelementvolume_hyp: " << aParams.has_maxelementvolume_hyp << std::endl;
std::cout << "maxElementVolume: " << aParams.maxElementVolume << std::endl;
std::cout << "has_LengthFromEdges_hyp: " << aParams.has_LengthFromEdges_hyp << std::endl;
}
/**
* @brief Import a param_file into a netgen_params structure
*
* @param param_file Name of the file
* @param aParams Structure to fill
*/
void importNetgenParams(const std::string param_file, netgen_params& aParams){
std::ifstream myfile(param_file);
std::string line;
std::getline(myfile, line);
aParams.has_netgen_param = std::stoi(line);
std::getline(myfile, line);
aParams.maxh = std::stod(line);
std::getline(myfile, line);
aParams.minh = std::stod(line);
std::getline(myfile, line);
aParams.segmentsperedge = std::stod(line);
std::getline(myfile, line);
aParams.grading = std::stod(line);
std::getline(myfile, line);
aParams.curvaturesafety = std::stod(line);
std::getline(myfile, line);
aParams.secondorder = std::stoi(line);
std::getline(myfile, line);
aParams.quad = std::stoi(line);
std::getline(myfile, line);
aParams.optimize = std::stoi(line);
std::getline(myfile, line);
aParams.fineness = std::stoi(line);
std::getline(myfile, line);
aParams.uselocalh = std::stoi(line);
std::getline(myfile, line);
aParams.merge_solids = std::stoi(line);
std::getline(myfile, line);
aParams.chordalError = std::stod(line);
std::getline(myfile, line);
aParams.optsteps2d = std::stoi(line);
std::getline(myfile, line);
aParams.optsteps3d = std::stoi(line);
std::getline(myfile, line);
aParams.elsizeweight = std::stod(line);
std::getline(myfile, line);
aParams.opterrpow = std::stoi(line);
std::getline(myfile, line);
aParams.delaunay = std::stoi(line);
std::getline(myfile, line);
aParams.checkoverlap = std::stoi(line);
std::getline(myfile, line);
aParams.checkchartboundary = std::stoi(line);
std::getline(myfile, line);
aParams.closeedgefac = std::stoi(line);
std::getline(myfile, line);
aParams.nbThreads = std::stoi(line);
std::getline(myfile, line);
aParams.has_local_size = std::stoi(line);
std::getline(myfile, line);
aParams.meshsizefilename = line;
std::getline(myfile, line);
aParams.has_maxelementvolume_hyp = std::stoi(line);
std::getline(myfile, line);
aParams.maxElementVolume = std::stod(line);
std::getline(myfile, line);
aParams.maxElementVolume = std::stoi(line);
};
/**
* @brief Writes the content of a netgen_param into a file
*
* @param param_file the file
* @param aParams the object
*/
void exportNetgenParams(const std::string param_file, netgen_params& aParams){
std::ofstream myfile(param_file);
myfile << aParams.has_netgen_param << std::endl;
myfile << aParams.maxh << std::endl;
myfile << aParams.minh << std::endl;
myfile << aParams.segmentsperedge << std::endl;
myfile << aParams.grading << std::endl;
myfile << aParams.curvaturesafety << std::endl;
myfile << aParams.secondorder << std::endl;
myfile << aParams.quad << std::endl;
myfile << aParams.optimize << std::endl;
myfile << aParams.fineness << std::endl;
myfile << aParams.uselocalh << std::endl;
myfile << aParams.merge_solids << std::endl;
myfile << aParams.chordalError << std::endl;
myfile << aParams.optsteps2d << std::endl;
myfile << aParams.optsteps3d << std::endl;
myfile << aParams.elsizeweight << std::endl;
myfile << aParams.opterrpow << std::endl;
myfile << aParams.delaunay << std::endl;
myfile << aParams.checkoverlap << std::endl;
myfile << aParams.checkchartboundary << std::endl;
myfile << aParams.closeedgefac << std::endl;
myfile << aParams.nbThreads << std::endl;
myfile << aParams.has_local_size << std::endl;
myfile << aParams.meshsizefilename << std::endl;
myfile << aParams.has_maxelementvolume_hyp << std::endl;
myfile << aParams.maxElementVolume << std::endl;
myfile << aParams.has_LengthFromEdges_hyp << std::endl;
};

View File

@ -0,0 +1,80 @@
// Copyright (C) 2007-2021 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
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : NETGENPlugin_DriverParam.hxx
// Author : Yoann AUDOUIN, EDF
// Module : NETGEN
//
#ifndef _NETGENPLUGIN_DRIVERPARAM_HXX_
#define _NETGENPLUGIN_DRIVERPARAM_HXX_
#include <string>
struct netgen_params{
// Params from NETGENPlugin_Mesher
// True if _hypParameters is not null
bool has_netgen_param=true;
double maxh;
double minh;
double segmentsperedge;
double grading;
double curvaturesafety;
int secondorder;
int quad;
bool optimize;
int fineness;
bool uselocalh;
bool merge_solids;
double chordalError;
int optsteps2d;
int optsteps3d;
double elsizeweight;
int opterrpow;
bool delaunay;
bool checkoverlap;
bool checkchartboundary;
int closeedgefac;
// Number of threads for the mesher
int nbThreads;
// True if we have a mesh size file or local size info
bool has_local_size = false;
std::string meshsizefilename;
// Params from NETGEN3D
// True if _hypMaxElementVolume is not null
bool has_maxelementvolume_hyp=false;
double maxElementVolume=0.0;
// Params from NETGEN2D
bool has_LengthFromEdges_hyp=false;
};
void printNetgenParams(netgen_params& aParams);
void importNetgenParams(const std::string param_file, netgen_params& aParams);
void exportNetgenParams(const std::string param_file, netgen_params& aParams);
#endif

View File

@ -58,6 +58,7 @@ NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId, SMESH_Gen * gen)
_nbVolOptSteps (GetDefaultNbVolOptSteps()), _nbVolOptSteps (GetDefaultNbVolOptSteps()),
_elemSizeWeight (GetDefaultElemSizeWeight()), _elemSizeWeight (GetDefaultElemSizeWeight()),
_worstElemMeasure (GetDefaultWorstElemMeasure()), _worstElemMeasure (GetDefaultWorstElemMeasure()),
_nbThreads (GetDefaultNbThreads()),
_surfaceCurvature (GetDefaultSurfaceCurvature()), _surfaceCurvature (GetDefaultSurfaceCurvature()),
_useDelauney (GetDefaultUseDelauney()), _useDelauney (GetDefaultUseDelauney()),
_checkOverlapping (GetDefaultCheckOverlapping()), _checkOverlapping (GetDefaultCheckOverlapping()),
@ -436,6 +437,20 @@ void NETGENPlugin_Hypothesis::SetCheckChartBoundary( bool theVal )
} }
} }
//=======================================================================
//function : SetNbThreads
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis::SetNbThreads( int theVal )
{
if (theVal != _nbThreads)
{
_nbThreads = theVal;
NotifySubMeshesHypothesisModification();
}
}
//============================================================================= //=============================================================================
/*! /*!
* *

View File

@ -35,6 +35,7 @@
#include "Utils_SALOME_Exception.hxx" #include "Utils_SALOME_Exception.hxx"
#include <map> #include <map>
#include <thread>
// Parameters for work of NETGEN // Parameters for work of NETGEN
// //
@ -125,6 +126,9 @@ public:
void SetCheckChartBoundary( bool toCheck ); void SetCheckChartBoundary( bool toCheck );
bool GetCheckChartBoundary() const { return _checkChartBoundary; } bool GetCheckChartBoundary() const { return _checkChartBoundary; }
void SetNbThreads( int val );
int GetNbThreads() const { return _nbThreads; }
// the default values (taken from NETGEN 4.5 sources) // the default values (taken from NETGEN 4.5 sources)
static Fineness GetDefaultFineness() { return Moderate; } static Fineness GetDefaultFineness() { return Moderate; }
@ -145,6 +149,7 @@ public:
static bool GetDefaultCheckOverlapping() { return true; } static bool GetDefaultCheckOverlapping() { return true; }
static bool GetDefaultCheckChartBoundary(){ return true; } static bool GetDefaultCheckChartBoundary(){ return true; }
static bool GetDefaultFuseEdges() { return true; } static bool GetDefaultFuseEdges() { return true; }
static int GetDefaultNbThreads() { return std::thread::hardware_concurrency(); }
// Persistence // Persistence
virtual std::ostream & SaveTo (std::ostream & save); virtual std::ostream & SaveTo (std::ostream & save);
@ -197,6 +202,9 @@ private:
//bool _blockFilling; -- not used by netgen //bool _blockFilling; -- not used by netgen
// (SALOME additions) // (SALOME additions)
bool _fuseEdges; bool _fuseEdges;
// Parallelism parameters
int _nbThreads;
}; };
#endif #endif

View File

@ -566,6 +566,30 @@ CORBA::Short NETGENPlugin_Hypothesis_i::GetWorstElemMeasure()
return (CORBA::Short) GetImpl()->GetWorstElemMeasure(); return (CORBA::Short) GetImpl()->GetWorstElemMeasure();
} }
//=======================================================================
//function : SetNbThreads
//purpose :
//=======================================================================
void NETGENPlugin_Hypothesis_i::SetNbThreads(CORBA::Short val )
{
if ( GetNbThreads() != val )
{
this->GetImpl()->SetNbThreads( val );
SMESH::TPythonDump() << _this() << ".SetNbThreads( " << SMESH::TVar(val) << " )";
}
}
//=======================================================================
//function : GetNbThreads
//purpose :
//=======================================================================
CORBA::Short NETGENPlugin_Hypothesis_i::GetNbThreads()
{
return (CORBA::Short) GetImpl()->GetNbThreads();
}
//======================================================================= //=======================================================================
//function : SetUseDelauney //function : SetUseDelauney
//purpose : //purpose :

View File

@ -113,6 +113,9 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i:
void SetWorstElemMeasure(CORBA::Short val ); void SetWorstElemMeasure(CORBA::Short val );
CORBA::Short GetWorstElemMeasure(); CORBA::Short GetWorstElemMeasure();
void SetNbThreads(CORBA::Short val );
CORBA::Short GetNbThreads();
void SetUseDelauney(CORBA::Boolean toUse); void SetUseDelauney(CORBA::Boolean toUse);
CORBA::Boolean GetUseDelauney(); CORBA::Boolean GetUseDelauney();

View File

@ -602,14 +602,13 @@ void NETGENPlugin_Mesher::SetDefaultParameters()
#ifdef NETGEN_V6 #ifdef NETGEN_V6
mparams.nthreads = std::thread::hardware_concurrency(); mparams.nthreads = NETGENPlugin_Hypothesis::GetDefaultNbThreads();
if ( getenv( "SALOME_NETGEN_DISABLE_MULTITHREADING" )) if ( getenv( "SALOME_NETGEN_DISABLE_MULTITHREADING" ))
{ {
mparams.nthreads = 1; mparams.nthreads = 1;
mparams.parallel_meshing = false; mparams.parallel_meshing = false;
} }
#endif #endif
} }
@ -655,6 +654,7 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
#ifdef NETGEN_V6 #ifdef NETGEN_V6
// std::string // std::string
mparams.meshsizefilename = hyp->GetMeshSizeFile(); mparams.meshsizefilename = hyp->GetMeshSizeFile();
mparams.nthreads = hyp->GetNbThreads();
#else #else
// const char* // const char*
mparams.meshsizefilename= hyp->GetMeshSizeFile().empty() ? 0 : hyp->GetMeshSizeFile().c_str(); mparams.meshsizefilename= hyp->GetMeshSizeFile().empty() ? 0 : hyp->GetMeshSizeFile().c_str();
@ -4437,18 +4437,7 @@ NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper():
_ngcerr = NULL; _ngcerr = NULL;
if ( !getenv( "KEEP_NETGEN_OUTPUT" )) if ( !getenv( "KEEP_NETGEN_OUTPUT" ))
{ {
// redirect all netgen output (mycout,myerr,cout) to _outputFileName setOutputFile(getOutputFileName());
_outputFileName = getOutputFileName();
_ngcout = netgen::mycout;
_ngcerr = netgen::myerr;
netgen::mycout = new ofstream ( _outputFileName.c_str() );
netgen::myerr = netgen::mycout;
_coutBuffer = std::cout.rdbuf();
#ifdef _DEBUG_
std::cout << "NOTE: netgen output is redirected to file " << _outputFileName << std::endl;
#else
std::cout.rdbuf( netgen::mycout->rdbuf() );
#endif
} }
setMesh( Ng_NewMesh() ); setMesh( Ng_NewMesh() );
@ -4569,6 +4558,27 @@ std::string NETGENPlugin_NetgenLibWrapper::getOutputFileName()
return aGenericName.ToCString(); return aGenericName.ToCString();
} }
//================================================================================
/*!
* \brief Set output file name for netgen log
*/
//================================================================================
void NETGENPlugin_NetgenLibWrapper::setOutputFile(std::string outputfile)
{
// redirect all netgen output (mycout,myerr,cout) to _outputFileName
_outputFileName = outputfile;
_ngcout = netgen::mycout;
_ngcerr = netgen::myerr;
netgen::mycout = new ofstream ( _outputFileName.c_str() );
netgen::myerr = netgen::mycout;
_coutBuffer = std::cout.rdbuf();
#ifdef _DEBUG_
std::cout << "NOTE: netgen output is redirected to file " << _outputFileName << std::endl;
#else
std::cout.rdbuf( netgen::mycout->rdbuf() );
#endif
}
//================================================================================ //================================================================================
/*! /*!

View File

@ -92,16 +92,20 @@ struct NETGENPLUGIN_EXPORT NETGENPlugin_NetgenLibWrapper
void setMesh( nglib::Ng_Mesh* mesh ); void setMesh( nglib::Ng_Mesh* mesh );
nglib::Ng_Mesh* ngMesh() { return (nglib::Ng_Mesh*)(void*)_ngMesh; } nglib::Ng_Mesh* ngMesh() { return (nglib::Ng_Mesh*)(void*)_ngMesh; }
static int GenerateMesh(netgen::OCCGeometry& occgeo, int startWith, int endWith, static int GenerateMesh(netgen::OCCGeometry& occgeo, int startWith, int endWith,
netgen::Mesh* & ngMesh); netgen::Mesh* & ngMesh);
int GenerateMesh(netgen::OCCGeometry& occgeo, int startWith, int endWith ) int GenerateMesh(netgen::OCCGeometry& occgeo, int startWith, int endWith )
{ {
return GenerateMesh( occgeo, startWith, endWith, _ngMesh ); return GenerateMesh( occgeo, startWith, endWith, _ngMesh );
} }
static void CalcLocalH( netgen::Mesh * ngMesh ); static void CalcLocalH( netgen::Mesh * ngMesh );
static void RemoveTmpFiles(); static void RemoveTmpFiles();
static int& instanceCounter(); static int& instanceCounter();
void setOutputFile(std::string);
private: private:
std::string getOutputFileName(); std::string getOutputFileName();

View File

@ -45,6 +45,8 @@
#include <StdMeshers_MaxElementVolume.hxx> #include <StdMeshers_MaxElementVolume.hxx>
#include <StdMeshers_QuadToTriaAdaptor.hxx> #include <StdMeshers_QuadToTriaAdaptor.hxx>
#include <StdMeshers_ViscousLayers.hxx> #include <StdMeshers_ViscousLayers.hxx>
#include <SMESH_subMesh.hxx>
#include <BRepGProp.hxx> #include <BRepGProp.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
@ -63,6 +65,8 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <cstdlib>
/* /*
Netgen include files Netgen include files
*/ */
@ -143,8 +147,8 @@ bool NETGENPlugin_NETGEN_3D::CheckHypothesis (SMESH_Mesh& aMesh,
_maxElementVolume = DBL_MAX; _maxElementVolume = DBL_MAX;
// for correct work of GetProgress(): // for correct work of GetProgress():
netgen::multithread.percent = 0.; //netgen::multithread.percent = 0.;
netgen::multithread.task = "Volume meshing"; //netgen::multithread.task = "Volume meshing";
_progressByTic = -1.; _progressByTic = -1.;
list<const SMESHDS_Hypothesis*>::const_iterator itl; list<const SMESHDS_Hypothesis*>::const_iterator itl;
@ -186,71 +190,41 @@ bool NETGENPlugin_NETGEN_3D::CheckHypothesis (SMESH_Mesh& aMesh,
return aStatus == HYP_OK; return aStatus == HYP_OK;
} }
//============================================================================= //=============================================================================
/*! /*!
*Here we are going to use the NETGEN mesher *Here we are going to use the NETGEN mesher
*/ */
//============================================================================= //=============================================================================
bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape) /**
* @brief Compute the list of already meshed Surface elements and info
* on their orientation and if they are internal
*
* @param aMesh Global Mesh
* @param aShape Shape associated to the mesh
* @param proxyMesh pointer to mesh used fo find the elements
* @param internals information on internal sub shapes
* @param helper helper associated to the mesh
* @param listElements map of surface element associated with
* their orientation and internal status
* @return true if their was some error
*/
bool NETGENPlugin_NETGEN_3D::getSurfaceElements(
SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
SMESH_ProxyMesh::Ptr proxyMesh,
NETGENPlugin_Internals &internals,
SMESH_MesherHelper &helper,
std::map<const SMDS_MeshElement*, tuple<bool, bool>>& listElements
)
{ {
netgen::multithread.terminate = 0;
netgen::multithread.task = "Volume meshing";
_progressByTic = -1.;
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
SMESH_MesherHelper helper(aMesh);
_quadraticMesh = helper.IsQuadraticSubMesh(aShape);
helper.SetElementsOnShape( true );
int Netgen_NbOfNodes = 0;
double Netgen_point[3];
int Netgen_triangle[3];
NETGENPlugin_NetgenLibWrapper ngLib;
Ng_Mesh * Netgen_mesh = (Ng_Mesh*)ngLib._ngMesh;
// vector of nodes in which node index == netgen ID
vector< const SMDS_MeshNode* > nodeVec;
{
const int invalid_ID = -1;
SMESH::Controls::Area areaControl;
SMESH::Controls::TSequenceOfXYZ nodesCoords;
// maps nodes to ng ID
typedef map< const SMDS_MeshNode*, int, TIDCompare > TNodeToIDMap;
typedef TNodeToIDMap::value_type TN2ID;
TNodeToIDMap nodeToNetgenID;
// find internal shapes
NETGENPlugin_Internals internals( aMesh, aShape, /*is3D=*/true );
// ---------------------------------
// Feed the Netgen with surface mesh
// ---------------------------------
TopAbs_ShapeEnum mainType = aMesh.GetShapeToMesh().ShapeType(); TopAbs_ShapeEnum mainType = aMesh.GetShapeToMesh().ShapeType();
bool checkReverse = ( mainType == TopAbs_COMPOUND || mainType == TopAbs_COMPSOLID ); bool checkReverse = ( mainType == TopAbs_COMPOUND || mainType == TopAbs_COMPSOLID );
SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( aMesh ));
if ( _viscousLayersHyp )
{
netgen::multithread.percent = 3;
proxyMesh = _viscousLayersHyp->Compute( aMesh, aShape );
if ( !proxyMesh )
return false;
}
if ( aMesh.NbQuadrangles() > 0 )
{
netgen::multithread.percent = 6;
StdMeshers_QuadToTriaAdaptor* Adaptor = new StdMeshers_QuadToTriaAdaptor;
Adaptor->Compute(aMesh,aShape,proxyMesh.get());
proxyMesh.reset( Adaptor );
}
for ( TopExp_Explorer exFa( aShape, TopAbs_FACE ); exFa.More(); exFa.Next()) for ( TopExp_Explorer exFa( aShape, TopAbs_FACE ); exFa.More(); exFa.Next())
{ {
const TopoDS_Shape& aShapeFace = exFa.Current(); const TopoDS_Shape& aShapeFace = exFa.Current();
@ -276,15 +250,103 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
iteratorElem = aSubMeshDSFace->GetElements(); iteratorElem = aSubMeshDSFace->GetElements();
} }
while ( iteratorElem->more() ) // loop on elements on a geom face while(iteratorElem->more()){
{
// check mesh face
const SMDS_MeshElement* elem = iteratorElem->next(); const SMDS_MeshElement* elem = iteratorElem->next();
if ( !elem ) // check mesh face
if ( !elem ){
return error( COMPERR_BAD_INPUT_MESH, "Null element encounters"); return error( COMPERR_BAD_INPUT_MESH, "Null element encounters");
if ( elem->NbCornerNodes() != 3 ) }
if ( elem->NbCornerNodes() != 3 ){
return error( COMPERR_BAD_INPUT_MESH, "Not triangle element encounters"); return error( COMPERR_BAD_INPUT_MESH, "Not triangle element encounters");
}
listElements[elem] = tuple(isRev, isInternalFace);
}
}
return false;
}
/**
* @brief Part of Compute: adding already meshed elements
* into netgen structure
*
* @param aMesh Global mesh
* @param aShape Shape associated with the mesh
* @param nodeVec Mapping between nodes mesh id and netgen structure id
* @param ngLib Wrapper on netgen lib
* @param helper helper assocaited to the mesh
* @param Netgen_NbOfNodes Number of nodes in netge structure
* @return true if there was some error
*/
bool NETGENPlugin_NETGEN_3D::computeFillNgMesh(
SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
vector< const SMDS_MeshNode* > &nodeVec,
NETGENPlugin_NetgenLibWrapper &ngLib,
SMESH_MesherHelper &helper,
int &Netgen_NbOfNodes)
{
netgen::multithread.terminate = 0;
netgen::multithread.task = "Volume meshing";
_progressByTic = -1.;
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
_quadraticMesh = helper.IsQuadraticSubMesh(aShape);
helper.SetElementsOnShape( true );
Netgen_NbOfNodes = 0;
double Netgen_point[3];
int Netgen_triangle[3];
Ng_Mesh * Netgen_mesh = (Ng_Mesh*)ngLib._ngMesh;
{
const int invalid_ID = -1;
SMESH::Controls::Area areaControl;
SMESH::Controls::TSequenceOfXYZ nodesCoords;
// maps nodes to ng ID
typedef map< const SMDS_MeshNode*, int, TIDCompare > TNodeToIDMap;
typedef TNodeToIDMap::value_type TN2ID;
TNodeToIDMap nodeToNetgenID;
// find internal shapes
NETGENPlugin_Internals internals( aMesh, aShape, /*is3D=*/true );
// ---------------------------------
// Feed the Netgen with surface mesh
// ---------------------------------
bool isRev=false;
bool isInternalFace=false;
SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( aMesh ));
if ( _viscousLayersHyp )
{
netgen::multithread.percent = 3;
proxyMesh = _viscousLayersHyp->Compute( aMesh, aShape );
if ( !proxyMesh )
return false;
}
if ( aMesh.NbQuadrangles() > 0 )
{
netgen::multithread.percent = 6;
StdMeshers_QuadToTriaAdaptor* Adaptor = new StdMeshers_QuadToTriaAdaptor;
Adaptor->Compute(aMesh,aShape,proxyMesh.get());
proxyMesh.reset( Adaptor );
}
std::map<const SMDS_MeshElement*, tuple<bool, bool>> listElements;
bool ret = getSurfaceElements(aMesh, aShape, proxyMesh, internals, helper, listElements);
if(ret)
return ret;
for ( auto const& [elem, info] : listElements ) // loop on elements on a geom face
{
isRev = get<0>(info);
isInternalFace = get<1>(info);
// Add nodes of triangles and triangles them-selves to netgen mesh // Add nodes of triangles and triangles them-selves to netgen mesh
// add three nodes of triangle // add three nodes of triangle
@ -326,7 +388,6 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
Ng_AddSurfaceElement(Netgen_mesh, NG_TRIG, Netgen_triangle); Ng_AddSurfaceElement(Netgen_mesh, NG_TRIG, Netgen_triangle);
} }
} // loop on elements on a face } // loop on elements on a face
} // loop on faces of a SOLID or SHELL
// insert old nodes into nodeVec // insert old nodes into nodeVec
nodeVec.resize( nodeToNetgenID.size() + 1, 0 ); nodeVec.resize( nodeToNetgenID.size() + 1, 0 );
@ -344,85 +405,238 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh,
internals); internals);
} }
} }
Netgen_NbOfNodes = Ng_GetNP( Netgen_mesh );
// ------------------------- return false;
// Generate the volume mesh
// -------------------------
return ( ngLib._isComputeOk = compute( aMesh, helper, nodeVec, ngLib ));
} }
// namespace /**
// { * @brief Part of Compute: Setting the netgen parameters from the Hypothesis
// void limitVolumeSize( netgen::Mesh* ngMesh, *
// double maxh ) * @param aMesh Global mesh
// { * @param ngLib Wrapper on netgen lib
// // get average h of faces * @param occgeo Mapping between nodes mesh id and netgen structure id
// double faceh = 0; * @param helper helper assocaited to the mesh
// int nbh = 0; * @param endWith end step of netgen
// for (int i = 1; i <= ngMesh->GetNSE(); i++) * @return true if there was some error
// { */
// const netgen::Element2d& face = ngMesh->SurfaceElement(i); bool NETGENPlugin_NETGEN_3D::computePrepareParam(
// for (int j=1; j <= face.GetNP(); ++j) SMESH_Mesh& aMesh,
// { NETGENPlugin_NetgenLibWrapper &ngLib,
// const netgen::PointIndex & i1 = face.PNumMod(j); netgen::OCCGeometry &occgeo,
// const netgen::PointIndex & i2 = face.PNumMod(j+1); SMESH_MesherHelper &helper,
// if ( i1 < i2 ) int &endWith)
// {
// const netgen::Point3d & p1 = ngMesh->Point( i1 );
// const netgen::Point3d & p2 = ngMesh->Point( i2 );
// faceh += netgen::Dist2( p1, p2 );
// nbh++;
// }
// }
// }
// faceh = Sqrt( faceh / nbh );
// double compareh; {
// if ( faceh < 0.5 * maxh ) compareh = -1; netgen::multithread.terminate = 0;
// else if ( faceh > 1.5 * maxh ) compareh = 1;
// else compareh = 0;
// // cerr << "faceh " << faceh << endl;
// // cerr << "init maxh " << maxh << endl;
// // cerr << "compareh " << compareh << endl;
// if ( compareh > 0 ) netgen::Mesh* ngMesh = ngLib._ngMesh;
// maxh *= 1.2;
// else
// maxh *= 0.8;
// // cerr << "maxh " << maxh << endl;
// // get bnd box NETGENPlugin_Mesher aMesher( &aMesh, helper.GetSubShape(), /*isVolume=*/true );
// netgen::Point3d pmin, pmax;
// ngMesh->GetBox( pmin, pmax, 0 );
// const double dx = pmax.X() - pmin.X();
// const double dy = pmax.Y() - pmin.Y();
// const double dz = pmax.Z() - pmin.Z();
// if ( ! & ngMesh->LocalHFunction() )
// ngMesh->SetLocalH( pmin, pmax, compareh <= 0 ? 0.1 : 0.5 );
// // adjusted by SALOME_TESTS/Grids/smesh/bugs_08/I8 if ( _hypParameters )
// const int nbX = Max( 2, int( dx / maxh * 2 )); {
// const int nbY = Max( 2, int( dy / maxh * 2 )); aMesher.SetParameters( _hypParameters );
// const int nbZ = Max( 2, int( dz / maxh * 2 ));
// netgen::Point3d p; if ( !_hypParameters->GetLocalSizesAndEntries().empty() ||
// for ( int i = 0; i <= nbX; ++i ) !_hypParameters->GetMeshSizeFile().empty() )
// { {
// p.X() = pmin.X() + i * dx / nbX; if ( ! &ngMesh->LocalHFunction() )
// for ( int j = 0; j <= nbY; ++j ) {
// { netgen::Point3d pmin, pmax;
// p.Y() = pmin.Y() + j * dy / nbY; ngMesh->GetBox( pmin, pmax, 0 );
// for ( int k = 0; k <= nbZ; ++k ) ngMesh->SetLocalH( pmin, pmax, _hypParameters->GetGrowthRate() );
// { }
// p.Z() = pmin.Z() + k * dz / nbZ; aMesher.SetLocalSize( occgeo, *ngMesh );
// ngMesh->RestrictLocalH( p, maxh );
// } try {
// } ngMesh->LoadLocalMeshSize( netgen::mparam.meshsizefilename );
// } } catch (netgen::NgException & ex) {
// } return error( COMPERR_BAD_PARMETERS, ex.What() );
// } }
}
if ( !_hypParameters->GetOptimize() )
endWith = netgen::MESHCONST_MESHVOLUME;
}
else if ( _hypMaxElementVolume )
{
netgen::mparam.maxh = pow( 72, 1/6. ) * pow( _maxElementVolume, 1/3. );
// limitVolumeSize( ngMesh, mparam.maxh ); // result is unpredictable
}
else if ( aMesh.HasShapeToMesh() )
{
aMesher.PrepareOCCgeometry( occgeo, helper.GetSubShape(), aMesh );
netgen::mparam.maxh = occgeo.GetBoundingBox().Diam()/2;
}
else
{
netgen::Point3d pmin, pmax;
ngMesh->GetBox (pmin, pmax);
netgen::mparam.maxh = Dist(pmin, pmax)/2;
}
if ( !_hypParameters && aMesh.HasShapeToMesh() )
{
netgen::mparam.minh = aMesher.GetDefaultMinSize( helper.GetSubShape(), netgen::mparam.maxh );
}
return false;
}
/**
* @brief Part of Compute: call to the netgen mesher
*
* @param occgeo netgen geometry structure
* @param nodeVec Mapping between nodes mesh id and netgen structure id
* @param ngMesh netgen mesh structure
* @param ngLib Wrapper on netgen lib
* @param startWith starting step of netgen
* @param endWith end step of netgen
* @return true if there was some error
*/
bool NETGENPlugin_NETGEN_3D::computeRunMesher(
netgen::OCCGeometry &occgeo,
vector< const SMDS_MeshNode* > &nodeVec,
netgen::Mesh* ngMesh,
NETGENPlugin_NetgenLibWrapper &ngLib,
int &startWith, int &endWith)
{
int err = 1;
try
{
OCC_CATCH_SIGNALS;
ngLib.CalcLocalH(ngMesh);
err = ngLib.GenerateMesh(occgeo, startWith, endWith);
if(netgen::multithread.terminate)
return false;
if ( err ){
error(SMESH_Comment("Error in netgen::OCCGenerateMesh() at ") << netgen::multithread.task);
}
}
catch (Standard_Failure& ex)
{
SMESH_Comment str("Exception in netgen::OCCGenerateMesh()");
str << " at " << netgen::multithread.task
<< ": " << ex.DynamicType()->Name();
if ( ex.GetMessageString() && strlen( ex.GetMessageString() ))
str << ": " << ex.GetMessageString();
error(str);
}
catch (netgen::NgException& exc)
{
SMESH_Comment str("NgException");
if ( strlen( netgen::multithread.task ) > 0 )
str << " at " << netgen::multithread.task;
str << ": " << exc.What();
error(str);
}
catch (...)
{
SMESH_Comment str("Exception in netgen::OCCGenerateMesh()");
if ( strlen( netgen::multithread.task ) > 0 )
str << " at " << netgen::multithread.task;
error(str);
}
if ( err )
{
SMESH_ComputeErrorPtr ce = NETGENPlugin_Mesher::ReadErrors(nodeVec);
if ( ce && ce->HasBadElems() ){
error( ce );
}
}
return false;
}
/**
* @brief Part of Compute: Adding new element created by mesher to SMESH_Mesh
*
* @param nodeVec Mapping between nodes mesh id and netgen structure id
* @param ngLib Wrapper on netgen lib
* @param helper tool associated to the mesh to add element
* @param Netgen_NbOfNodes Number of nodes in netgen structure
* @return true if there was some error
*/
bool NETGENPlugin_NETGEN_3D::computeFillMesh(
vector< const SMDS_MeshNode* > &nodeVec,
NETGENPlugin_NetgenLibWrapper &ngLib,
SMESH_MesherHelper &helper,
int &Netgen_NbOfNodes
)
{
Ng_Mesh* Netgen_mesh = ngLib.ngMesh();
int Netgen_NbOfNodesNew = Ng_GetNP(Netgen_mesh);
int Netgen_NbOfTetra = Ng_GetNE(Netgen_mesh);
bool isOK = ( /*status == NG_OK &&*/ Netgen_NbOfTetra > 0 );// get whatever built
if ( isOK )
{
double Netgen_point[3];
int Netgen_tetrahedron[4];
// create and insert new nodes into nodeVec
nodeVec.resize( Netgen_NbOfNodesNew + 1, 0 );
int nodeIndex = Netgen_NbOfNodes + 1;
for ( ; nodeIndex <= Netgen_NbOfNodesNew; ++nodeIndex )
{
Ng_GetPoint( Netgen_mesh, nodeIndex, Netgen_point );
nodeVec.at(nodeIndex) = helper.AddNode(Netgen_point[0], Netgen_point[1], Netgen_point[2]);
}
// create tetrahedrons
for ( int elemIndex = 1; elemIndex <= Netgen_NbOfTetra; ++elemIndex )
{
Ng_GetVolumeElement(Netgen_mesh, elemIndex, Netgen_tetrahedron);
try
{
helper.AddVolume (nodeVec.at( Netgen_tetrahedron[0] ),
nodeVec.at( Netgen_tetrahedron[1] ),
nodeVec.at( Netgen_tetrahedron[2] ),
nodeVec.at( Netgen_tetrahedron[3] ));
}
catch (...)
{
}
}
}
return false;
}
/**
* @brief Compute mesh associate to shape
*
* @param aMesh The mesh
* @param aShape The shape
* @return true fi there are some error
*/
bool NETGENPlugin_NETGEN_3D::Compute(
SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape)
{
// vector of nodes in which node index == netgen ID
vector< const SMDS_MeshNode* > nodeVec;
NETGENPlugin_NetgenLibWrapper ngLib;
SMESH_MesherHelper helper(aMesh);
int startWith = netgen::MESHCONST_MESHVOLUME;
int endWith = netgen::MESHCONST_OPTVOLUME;
int Netgen_NbOfNodes;
computeFillNgMesh(aMesh, aShape, nodeVec, ngLib, helper, Netgen_NbOfNodes);
netgen::OCCGeometry occgeo;
computePrepareParam(aMesh, ngLib, occgeo, helper, endWith);
computeRunMesher(occgeo, nodeVec, ngLib._ngMesh, ngLib, startWith, endWith);
computeFillMesh(nodeVec, ngLib, helper, Netgen_NbOfNodes);
return false;
}
//================================================================================ //================================================================================
/*! /*!
@ -475,7 +689,7 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh& aMesh,
else if ( _hypMaxElementVolume ) else if ( _hypMaxElementVolume )
{ {
netgen::mparam.maxh = pow( 72, 1/6. ) * pow( _maxElementVolume, 1/3. ); netgen::mparam.maxh = pow( 72, 1/6. ) * pow( _maxElementVolume, 1/3. );
// limitVolumeSize( ngMesh, netgen::mparam.maxh ); // result is unpredictable // limitVolumeSize( ngMesh, mparam.maxh ); // result is unpredictable
} }
else if ( aMesh.HasShapeToMesh() ) else if ( aMesh.HasShapeToMesh() )
{ {
@ -701,14 +915,12 @@ double NETGENPlugin_NETGEN_3D::GetProgress() const
strncmp( netgen::multithread.task, volMeshing, 3 ) == 0 )) strncmp( netgen::multithread.task, volMeshing, 3 ) == 0 ))
{ {
res = 0.001 + meshingRatio * netgen::multithread.percent / 100.; res = 0.001 + meshingRatio * netgen::multithread.percent / 100.;
//cout << netgen::multithread.task << " " <<_progressTic << "-" << netgen::multithread.percent << endl;
} }
else // different otimizations else // different otimizations
{ {
if ( _progressByTic < 0. ) if ( _progressByTic < 0. )
((NETGENPlugin_NETGEN_3D*)this)->_progressByTic = meshingRatio / _progressTic; ((NETGENPlugin_NETGEN_3D*)this)->_progressByTic = meshingRatio / _progressTic;
res = _progressByTic * _progressTic; res = _progressByTic * _progressTic;
//cout << netgen::multithread.task << " " << _progressTic << " " << res << endl;
} }
return Min ( res, 0.98 ); return Min ( res, 0.98 );
} }

View File

@ -37,10 +37,15 @@
#include "SMESH_Algo.hxx" #include "SMESH_Algo.hxx"
#include "Utils_SALOME_Exception.hxx" #include "Utils_SALOME_Exception.hxx"
#include <vector>
#include <tuple>
class StdMeshers_ViscousLayers; class StdMeshers_ViscousLayers;
class StdMeshers_MaxElementVolume; class StdMeshers_MaxElementVolume;
class NETGENPlugin_Hypothesis; class NETGENPlugin_Hypothesis;
class NETGENPlugin_NetgenLibWrapper; class NETGENPlugin_NetgenLibWrapper;
class netgen_params;
class SMDS_MeshNode;
class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D: public SMESH_3D_Algo class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D: public SMESH_3D_Algo
{ {
@ -66,8 +71,44 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D: public SMESH_3D_Algo
const TopoDS_Shape& aShape, const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap); MapShapeNbElems& aResMap);
bool computeFillNgMesh(
SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
std::vector< const SMDS_MeshNode* > &nodeVec,
NETGENPlugin_NetgenLibWrapper &ngLib,
SMESH_MesherHelper &helper,
int &Netgen_NbOfNodes);
bool computePrepareParam(
SMESH_Mesh& aMesh,
NETGENPlugin_NetgenLibWrapper &ngLib,
netgen::OCCGeometry &occgeo,
SMESH_MesherHelper &helper,
int &endWith);
bool computeRunMesher(
netgen::OCCGeometry &occgeo,
std::vector< const SMDS_MeshNode* > &nodeVec,
netgen::Mesh* ngMesh,
NETGENPlugin_NetgenLibWrapper &ngLib,
int &startWith, int &endWith);
bool computeFillMesh(
std::vector< const SMDS_MeshNode* > &nodeVec,
NETGENPlugin_NetgenLibWrapper &ngLib,
SMESH_MesherHelper &helper,
int &Netgen_NbOfNodes);
protected: protected:
virtual bool getSurfaceElements(
SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
SMESH_ProxyMesh::Ptr proxyMesh,
NETGENPlugin_Internals &internals,
SMESH_MesherHelper &helper,
std::map<const SMDS_MeshElement*, std::tuple<bool, bool>>& listElements);
bool compute(SMESH_Mesh& mesh, bool compute(SMESH_Mesh& mesh,
SMESH_MesherHelper& helper, SMESH_MesherHelper& helper,
std::vector< const SMDS_MeshNode* >& nodeVec, std::vector< const SMDS_MeshNode* >& nodeVec,

View File

@ -0,0 +1,384 @@
// Copyright (C) 2007-2022 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
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//=============================================================================
// File : NETGENPlugin_NETGEN_3D_Remote.cxx
// Created : lundi 19 Septembre 2022
// Author : Yoann AUDOUIN (CEA)
// Project : SALOME
//=============================================================================
//
//
#include "NETGENPlugin_NETGEN_3D_Remote.hxx"
#include "NETGENPlugin_NETGEN_3D.hxx"
#include "NETGENPlugin_DriverParam.hxx"
#include "NETGENPlugin_Hypothesis.hxx"
#include "Utils_SALOME_Exception.hxx"
#include <SMESH_Gen.hxx>
#include <SMESH_Mesh.hxx>
#include <SMESH_MesherHelper.hxx>
#include <SMESH_DriverShape.hxx>
#include <SMESH_DriverMesh.hxx>
#include <SMESHDS_Mesh.hxx>
#include <SMESH_MeshLocker.hxx>
#include <QString>
#include <QProcess>
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
/*
Netgen include files
*/
#ifndef OCCGEOMETRY
#define OCCGEOMETRY
#endif
#include <occgeom.hpp>
#ifdef NETGEN_V5
#include <ngexception.hpp>
#endif
#ifdef NETGEN_V6
#include <core/exception.hpp>
#endif
namespace nglib {
#include <nglib.h>
}
namespace netgen {
NETGENPLUGIN_DLL_HEADER
extern MeshingParameters mparam;
NETGENPLUGIN_DLL_HEADER
extern volatile multithreadt multithread;
}
using namespace nglib;
//=============================================================================
/*!
* Constructor
*/
//=============================================================================
NETGENPlugin_NETGEN_3D_Remote::NETGENPlugin_NETGEN_3D_Remote(int hypId, SMESH_Gen * gen)
: NETGENPlugin_NETGEN_3D(hypId, gen)
{
_name = "NETGEN_3D_Remote";
}
//=============================================================================
/*!
* Destructor
*/
//=============================================================================
NETGENPlugin_NETGEN_3D_Remote::~NETGENPlugin_NETGEN_3D_Remote()
{
}
/**
* @brief Fill the structure netgen_param with the information from the hypothesis
*
* @param hyp the hypothesis
* @param aParams the netgen_param structure
*/
void NETGENPlugin_NETGEN_3D_Remote::fillParameters(const NETGENPlugin_Hypothesis* hyp, netgen_params &aParams)
{
aParams.maxh = hyp->GetMaxSize();
aParams.minh = hyp->GetMinSize();
aParams.segmentsperedge = hyp->GetNbSegPerEdge();
aParams.grading = hyp->GetGrowthRate();
aParams.curvaturesafety = hyp->GetNbSegPerRadius();
aParams.secondorder = hyp->GetSecondOrder() ? 1 : 0;
aParams.quad = hyp->GetQuadAllowed() ? 1 : 0;
aParams.optimize = hyp->GetOptimize();
aParams.fineness = hyp->GetFineness();
aParams.uselocalh = hyp->GetSurfaceCurvature();
aParams.merge_solids = hyp->GetFuseEdges();
aParams.chordalError = hyp->GetChordalErrorEnabled() ? hyp->GetChordalError() : -1.;
aParams.optsteps2d = aParams.optimize ? hyp->GetNbSurfOptSteps() : 0;
aParams.optsteps3d = aParams.optimize ? hyp->GetNbVolOptSteps() : 0;
aParams.elsizeweight = hyp->GetElemSizeWeight();
aParams.opterrpow = hyp->GetWorstElemMeasure();
aParams.delaunay = hyp->GetUseDelauney();
aParams.checkoverlap = hyp->GetCheckOverlapping();
aParams.checkchartboundary = hyp->GetCheckChartBoundary();
#ifdef NETGEN_V6
// std::string
aParams.meshsizefilename = hyp->GetMeshSizeFile();
aParams.closeedgefac = 2;
aParams.nbThreads = hyp->GetNbThreads();
#else
// const char*
aParams.meshsizefilename = hyp->GetMeshSizeFile();
aParams.closeedgefac = 0;
#endif
}
//
/**
* @brief write in a binary file the orientation for each surface element of the mesh
*
* @param aMesh The mesh
* @param aShape the shape associated to the mesh
* @param output_file name of the binary file
*/
void NETGENPlugin_NETGEN_3D_Remote::exportElementOrientation(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
const std::string output_file)
{
SMESH_MesherHelper helper(aMesh);
NETGENPlugin_Internals internals( aMesh, aShape, /*is3D=*/true );
SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( aMesh ));
std::map<vtkIdType, bool> elemOrientation;
for ( TopExp_Explorer exFa( aShape, TopAbs_FACE ); exFa.More(); exFa.Next())
{
const TopoDS_Shape& aShapeFace = exFa.Current();
int faceID = aMesh.GetMeshDS()->ShapeToIndex( aShapeFace );
bool isInternalFace = internals.isInternalShape( faceID );
bool isRev = false;
if ( !isInternalFace &&
helper.NbAncestors(aShapeFace, aMesh, aShape.ShapeType()) > 1 )
// IsReversedSubMesh() can work wrong on strongly curved faces,
// so we use it as less as possible
isRev = helper.IsReversedSubMesh( TopoDS::Face( aShapeFace ));
const SMESHDS_SubMesh * aSubMeshDSFace = proxyMesh->GetSubMesh( aShapeFace );
if ( !aSubMeshDSFace ) continue;
SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements();
if ( _quadraticMesh &&
dynamic_cast< const SMESH_ProxyMesh::SubMesh*>( aSubMeshDSFace ))
{
// add medium nodes of proxy triangles to helper (#16843)
while ( iteratorElem->more() )
helper.AddTLinks( static_cast< const SMDS_MeshFace* >( iteratorElem->next() ));
iteratorElem = aSubMeshDSFace->GetElements();
}
while ( iteratorElem->more() ) // loop on elements on a geom face
{
// check mesh face
const SMDS_MeshElement* elem = iteratorElem->next();
if ( !elem )
error( COMPERR_BAD_INPUT_MESH, "Null element encounters");
if ( elem->NbCornerNodes() != 3 )
error( COMPERR_BAD_INPUT_MESH, "Not triangle element encounters");
elemOrientation[elem->GetID()] = isRev;
} // loop on elements on a face
} // loop on faces of a SOLID or SHELL
{
std::ofstream df(output_file, ios::out|ios::binary);
int size=elemOrientation.size();
df.write((char*)&size, sizeof(int));
for(auto const& [id, orient]:elemOrientation){
df.write((char*)&id, sizeof(vtkIdType));
df.write((char*)&orient, sizeof(bool));
}
}
}
/**
* @brief Compute mesh associate to shape
*
* @param aMesh The mesh
* @param aShape The shape
* @return true fi there are some error
*/
bool NETGENPlugin_NETGEN_3D_Remote::Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape)
{
{
SMESH_MeshLocker myLocker(&aMesh);
SMESH_Hypothesis::Hypothesis_Status hypStatus;
NETGENPlugin_NETGEN_3D::CheckHypothesis(aMesh, aShape, hypStatus);
}
// Temporary folder for run
fs::path tmp_folder = aMesh.tmp_folder / fs::unique_path(fs::path("Volume-%%%%-%%%%"));
fs::create_directories(tmp_folder);
// Using MESH2D generated after all triangles where created.
fs::path mesh_file=aMesh.tmp_folder / fs::path("Mesh2D.med");
fs::path element_orientation_file=tmp_folder / fs::path("element_orientation.dat");
fs::path new_element_file=tmp_folder / fs::path("new_elements.dat");
fs::path tmp_mesh_file=tmp_folder / fs::path("tmp_mesh.med");
// Not used kept for debug
//fs::path output_mesh_file=tmp_folder / fs::path("output_mesh.med");
fs::path shape_file=tmp_folder / fs::path("shape.brep");
fs::path param_file=tmp_folder / fs::path("netgen3d_param.txt");
fs::path log_file=tmp_folder / fs::path("run.log");
fs::path cmd_file=tmp_folder / fs::path("cmd.log");
std::string mesh_name = "MESH";
{
SMESH_MeshLocker myLocker(&aMesh);
//Writing Shape
exportShape(shape_file.string(), aShape);
//Writing hypo
netgen_params aParams;
fillParameters(_hypParameters, aParams);
exportNetgenParams(param_file.string(), aParams);
// Exporting element orientation
exportElementOrientation(aMesh, aShape, element_orientation_file.string());
}
// Calling run_mesher
std::string cmd;
fs::path run_mesher_exe =
fs::path(std::getenv("NETGENPLUGIN_ROOT_DIR"))/
fs::path("bin")/
fs::path("salome")/
#ifdef WIN32
fs::path("NETGENPlugin_Runner.exe");
#else
fs::path("NETGENPlugin_Runner");
#endif
cmd = run_mesher_exe.string() +
" NETGEN3D " + mesh_file.string() + " "
+ shape_file.string() + " "
+ param_file.string() + " "
+ element_orientation_file.string() + " "
+ new_element_file.string() + " "
+ "NONE";
// Writing command in log
{
std::ofstream flog(cmd_file.string());
flog << cmd << endl;
flog << endl;
}
MESSAGE("Running command: ");
MESSAGE(cmd);
// Building arguments for QProcess
QString program = run_mesher_exe.c_str();
QStringList arguments;
arguments << "NETGEN3D";
arguments << mesh_file.c_str();
arguments << shape_file.c_str();
arguments << param_file.c_str();
arguments << element_orientation_file.c_str();
arguments << new_element_file.c_str();
arguments << "NONE";
QString out_file = log_file.c_str();
QProcess myProcess;
myProcess.setStandardOutputFile(out_file);
myProcess.start(program, arguments);
// Waiting for process to finish (argument -1 make it wait until the end of
// the process otherwise it just waits 30 seconds)
myProcess.waitForFinished(-1);
int ret = myProcess.exitStatus();
if(ret != 0){
// Run crahed
std::string msg = "Issue with command: \n";
msg += "See log for more details: " + log_file.string() + "\n";
msg += cmd + "\n";
throw SALOME_Exception(msg);
}
{
SMESH_MeshLocker myLocker(&aMesh);
std::ifstream df(new_element_file.string(), ios::binary);
int Netgen_NbOfNodes;
int Netgen_NbOfNodesNew;
int Netgen_NbOfTetra;
double Netgen_point[3];
int Netgen_tetrahedron[4];
int nodeID;
SMESH_MesherHelper helper(aMesh);
// This function is mandatory for setElementsOnShape to work
helper.IsQuadraticSubMesh(aShape);
helper.SetElementsOnShape( true );
// Number of nodes in intial mesh
df.read((char*) &Netgen_NbOfNodes, sizeof(int));
// Number of nodes added by netgen
df.read((char*) &Netgen_NbOfNodesNew, sizeof(int));
// Filling nodevec (correspondence netgen numbering mesh numbering)
vector< const SMDS_MeshNode* > nodeVec ( Netgen_NbOfNodesNew + 1 );
//vector<int> nodeTmpVec ( Netgen_NbOfNodesNew + 1 );
SMESHDS_Mesh * meshDS = helper.GetMeshDS();
for (int nodeIndex = 1 ; nodeIndex <= Netgen_NbOfNodes; ++nodeIndex )
{
//Id of the point
df.read((char*) &nodeID, sizeof(int));
nodeVec.at(nodeIndex) = meshDS->FindNode(nodeID);
}
// Add new points and update nodeVec
for (int nodeIndex = Netgen_NbOfNodes +1 ; nodeIndex <= Netgen_NbOfNodesNew; ++nodeIndex )
{
df.read((char *) &Netgen_point, sizeof(double)*3);
nodeVec.at(nodeIndex) = helper.AddNode(Netgen_point[0],
Netgen_point[1],
Netgen_point[2]);
}
// Add tetrahedrons
df.read((char*) &Netgen_NbOfTetra, sizeof(int));
for ( int elemIndex = 1; elemIndex <= Netgen_NbOfTetra; ++elemIndex )
{
df.read((char*) &Netgen_tetrahedron, sizeof(int)*4);
helper.AddVolume(
nodeVec.at( Netgen_tetrahedron[0] ),
nodeVec.at( Netgen_tetrahedron[1] ),
nodeVec.at( Netgen_tetrahedron[2] ),
nodeVec.at( Netgen_tetrahedron[3] ));
}
}
return true;
}
/**
* @brief Assign submeshes to compute
*
* @param aSubMesh submesh to add
*/
void NETGENPlugin_NETGEN_3D_Remote::setSubMeshesToCompute(SMESH_subMesh * aSubMesh)
{
SMESH_MeshLocker myLocker(aSubMesh->GetFather());
SMESH_Algo::setSubMeshesToCompute(aSubMesh);
}

View File

@ -0,0 +1,75 @@
// Copyright (C) 2007-2021 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
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//=============================================================================
// File : NETGENPlugin_NETGEN_3D_Remote.hxx
// Created : lundi 19 Septembre 2022
// Author : Yoann AUDOUIN (EDF)
// Project : SALOME
//=============================================================================
//
#ifndef _NETGENPlugin_NETGEN_3D_REMOTE_HXX_
#define _NETGENPlugin_NETGEN_3D_REMOTE_HXX_
#include "NETGENPlugin_NETGEN_3D.hxx"
#include <vector>
#include <map>
class StdMeshers_ViscousLayers;
class StdMeshers_MaxElementVolume;
class NETGENPlugin_Hypothesis;
class NETGENPlugin_NetgenLibWrapper;
class netgen_params;
class SMDS_MeshNode;
using namespace std;
class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D_Remote: public NETGENPlugin_NETGEN_3D
{
public:
NETGENPlugin_NETGEN_3D_Remote(int hypId, SMESH_Gen* gen);
virtual ~NETGENPlugin_NETGEN_3D_Remote();
// Function whould not be used with remote Computing
bool CheckHypothesis (SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
Hypothesis_Status& aStatus) override {(void)aMesh;(void)aShape;aStatus = HYP_OK;return true;};
bool Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape) override;
void setSubMeshesToCompute(SMESH_subMesh * aSubMesh) override;
protected:
void exportElementOrientation(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
const std::string output_file);
void fillParameters(const NETGENPlugin_Hypothesis* hyp,
netgen_params &aParams);
};
#endif

View File

@ -0,0 +1,80 @@
// Copyright (C) 2007-2022 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
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
// File : NETGENPlugin_NETGEN_3D_Remote_i.cxx
// Author : Yoann AUDOUIN (EDF)
// Module : NETGENPlugin
// $Header$
//
#include "NETGENPlugin_NETGEN_3D_Remote_i.hxx"
#include "SMESH_Gen.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
using namespace std;
//=============================================================================
/*!
* NETGENPlugin_NETGEN_3D_Remote_i::NETGENPlugin_NETGEN_3D_Remote_i
*
* Constructor
*/
//=============================================================================
NETGENPlugin_NETGEN_3D_Remote_i::NETGENPlugin_NETGEN_3D_Remote_i( PortableServer::POA_ptr thePOA,
::SMESH_Gen* theGenImpl )
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
SMESH_Algo_i( thePOA ),
SMESH_3D_Algo_i( thePOA )
{
myBaseImpl = new ::NETGENPlugin_NETGEN_3D_Remote( theGenImpl->GetANewId(),
theGenImpl );
}
//=============================================================================
/*!
* NETGENPlugin_NETGEN_3D_Remote_i::~NETGENPlugin_NETGEN_3D_Remote_i
*
* Destructor
*/
//=============================================================================
NETGENPlugin_NETGEN_3D_Remote_i::~NETGENPlugin_NETGEN_3D_Remote_i()
{
}
//=============================================================================
/*!
* NETGENPlugin_NETGEN_3D_Remote_i::GetImpl
*
* Get implementation
*/
//=============================================================================
::NETGENPlugin_NETGEN_3D_Remote* NETGENPlugin_NETGEN_3D_Remote_i::GetImpl()
{
return ( ::NETGENPlugin_NETGEN_3D_Remote* )myBaseImpl;
}

View File

@ -0,0 +1,58 @@
// Copyright (C) 2007-2021 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
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
// File : NETGENPlugin_NETGEN_3D_Remote_i.hxx
// Author : Yoann AUDOUIN (EDF)
// Module : NETGENPlugin
// $Header$
//
#ifndef _NETGENPlugin_NETGEN_3D_REMOTE_I_HXX_
#define _NETGENPlugin_NETGEN_3D_REMOTE_I_HXX_
#include "NETGENPlugin_Defs.hxx"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(NETGENPlugin_Algorithm)
#include "SMESH_3D_Algo_i.hxx"
#include "NETGENPlugin_NETGEN_3D_Remote.hxx"
// ======================================================
// NETGEN 3d algorithm
// ======================================================
class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D_Remote_i:
public virtual POA_NETGENPlugin::NETGENPlugin_NETGEN_3D_Remote,
public virtual SMESH_3D_Algo_i
{
public:
// Constructor
NETGENPlugin_NETGEN_3D_Remote_i( PortableServer::POA_ptr thePOA,
::SMESH_Gen* theGenImpl );
// Destructor
virtual ~NETGENPlugin_NETGEN_3D_Remote_i();
// Get implementation
::NETGENPlugin_NETGEN_3D_Remote* GetImpl();
};
#endif

View File

@ -0,0 +1,396 @@
// Copyright (C) 2007-2022 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
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//=============================================================================
// File : NETGENPlugin_NETGEN_3D_SA.cxx
// Created : lundi 19 Septembre 2022
// Author : Yoann AUDOUIN (CEA)
// Project : SALOME
//=============================================================================
//
//
#include "NETGENPlugin_NETGEN_3D_SA.hxx"
#include "NETGENPlugin_DriverParam.hxx"
#include "NETGENPlugin_Hypothesis.hxx"
#include "StdMeshers_MaxElementVolume.hxx"
#include <SMESH_Gen.hxx>
#include <SMESH_Mesh.hxx>
#include <SMESH_MesherHelper.hxx>
#include <SMESH_DriverShape.hxx>
#include <SMESH_DriverMesh.hxx>
#include <SMESHDS_Mesh.hxx>
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;
/*
Netgen include files
*/
#ifndef OCCGEOMETRY
#define OCCGEOMETRY
#endif
#include <occgeom.hpp>
#ifdef NETGEN_V5
#include <ngexception.hpp>
#endif
#ifdef NETGEN_V6
#include <core/exception.hpp>
#endif
namespace nglib {
#include <nglib.h>
}
namespace netgen {
NETGENPLUGIN_DLL_HEADER
extern MeshingParameters mparam;
NETGENPLUGIN_DLL_HEADER
extern volatile multithreadt multithread;
}
using namespace nglib;
//=============================================================================
/*!
* Constructor
*/
//=============================================================================
NETGENPlugin_NETGEN_3D_SA::NETGENPlugin_NETGEN_3D_SA()
: NETGENPlugin_NETGEN_3D(0, new SMESH_Gen())
{
_name = "NETGEN_3D_SA";
}
//=============================================================================
/*!
* Destructor
*/
//=============================================================================
NETGENPlugin_NETGEN_3D_SA::~NETGENPlugin_NETGEN_3D_SA()
{
if(_gen)
delete _gen;
}
/**
* @brief fill plugin hypothesis from the netgen_params structure
*
* @param aParams the structure
* @param gen SMESH_Gen associate with the SA
*/
void NETGENPlugin_NETGEN_3D_SA::fillHyp(netgen_params aParams)
{
if(_gen)
std::cout << "_gen is set" << std::endl;
if(aParams.has_netgen_param){
NETGENPlugin_Hypothesis * hypParameters = new NETGENPlugin_Hypothesis(0, GetGen());
hypParameters->SetMaxSize(aParams.maxh);
hypParameters->SetMinSize(aParams.minh);
hypParameters->SetNbSegPerEdge(aParams.segmentsperedge);
hypParameters->SetGrowthRate(aParams.grading);
hypParameters->SetNbSegPerRadius(aParams.curvaturesafety);
hypParameters->SetSecondOrder(aParams.secondorder);
hypParameters->SetQuadAllowed(aParams.quad);
hypParameters->SetOptimize(aParams.optimize);
hypParameters->SetFineness((NETGENPlugin_Hypothesis::Fineness)aParams.fineness);
hypParameters->SetSurfaceCurvature(aParams.uselocalh);
hypParameters->SetFuseEdges(aParams.merge_solids);
hypParameters->SetChordalErrorEnabled(aParams.chordalError);
if(aParams.optimize){
hypParameters->SetNbSurfOptSteps(aParams.optsteps2d);
hypParameters->SetNbVolOptSteps(aParams.optsteps3d);
}
hypParameters->SetElemSizeWeight(aParams.elsizeweight);
hypParameters->SetWorstElemMeasure(aParams.opterrpow);
hypParameters->SetUseDelauney(aParams.delaunay);
hypParameters->SetCheckOverlapping(aParams.checkoverlap);
hypParameters->SetCheckChartBoundary(aParams.checkchartboundary);
hypParameters->SetMeshSizeFile(aParams.meshsizefilename);
_hypParameters = dynamic_cast< const NETGENPlugin_Hypothesis *> (hypParameters);
}
if(aParams.has_maxelementvolume_hyp){
_hypMaxElementVolume = new StdMeshers_MaxElementVolume(1, GetGen());
_maxElementVolume = aParams.maxElementVolume;
}
// TODO: Handle viscous layer
}
/**
* @brief Write a binary file containing information on the elements/nodes
* created by the mesher
*
* @param nodeVec mapping between the mesh id and the netgen structure id
* @param ngLib Wrapper on netgen library
* @param new_element_file Name of the output file
* @param Netgen_NbOfNodes Number of nodes in the netgen structure
* @return true if there are some error
*/
bool NETGENPlugin_NETGEN_3D_SA::computeFillNewElementFile(
std::vector< const SMDS_MeshNode* > &nodeVec,
NETGENPlugin_NetgenLibWrapper &ngLib,
std::string new_element_file,
int &Netgen_NbOfNodes
)
{
Ng_Mesh* Netgen_mesh = ngLib.ngMesh();
int Netgen_NbOfNodesNew = Ng_GetNP(Netgen_mesh);
int Netgen_NbOfTetra = Ng_GetNE(Netgen_mesh);
bool isOK = ( Netgen_NbOfTetra > 0 );
if ( isOK && !new_element_file.empty() )
{
std::ofstream df(new_element_file, ios::out|ios::binary);
double Netgen_point[3];
int Netgen_tetrahedron[4];
// Writing nodevec (correspondence netgen numbering mesh numbering)
// Number of nodes
df.write((char*) &Netgen_NbOfNodes, sizeof(int));
df.write((char*) &Netgen_NbOfNodesNew, sizeof(int));
for (int nodeIndex = 1 ; nodeIndex <= Netgen_NbOfNodes; ++nodeIndex )
{
//Id of the point
int id = nodeVec.at(nodeIndex)->GetID();
df.write((char*) &id, sizeof(int));
}
// Writing info on new points
for (int nodeIndex = Netgen_NbOfNodes +1 ; nodeIndex <= Netgen_NbOfNodesNew; ++nodeIndex )
{
Ng_GetPoint(Netgen_mesh, nodeIndex, Netgen_point );
// Coordinates of the point
df.write((char *) &Netgen_point, sizeof(double)*3);
}
// create tetrahedrons
df.write((char*) &Netgen_NbOfTetra, sizeof(int));
for ( int elemIndex = 1; elemIndex <= Netgen_NbOfTetra; ++elemIndex )
{
Ng_GetVolumeElement(Netgen_mesh, elemIndex, Netgen_tetrahedron);
df.write((char*) &Netgen_tetrahedron, sizeof(int)*4);
}
}
return false;
}
/**
* @brief Compute mesh associated to shape
*
* @param aShape the shape
* @param aMesh the mesh
* @param aParams netgen_params structure
* @param new_element_file Name of the file containing new element
* @param output_mesh Name of the output mesh (if empty it will not be written)
* @return true if there are some error
*/
bool NETGENPlugin_NETGEN_3D_SA::Compute(
TopoDS_Shape &aShape,
SMESH_Mesh& aMesh,
netgen_params& aParams,
std::string new_element_file,
bool output_mesh)
{
// vector of nodes in which node index == netgen ID
vector< const SMDS_MeshNode* > nodeVec;
NETGENPlugin_NetgenLibWrapper ngLib;
SMESH_MesherHelper helper(aMesh);
int startWith = netgen::MESHCONST_MESHVOLUME;
int endWith = netgen::MESHCONST_OPTVOLUME;
int Netgen_NbOfNodes=0;
// Changing netgen log_file putting it next to new_element_file
fs::path netgen_log_file = fs::path(new_element_file).remove_filename() / fs::path("NETGEN.out");
ngLib.setOutputFile(netgen_log_file.string());
NETGENPlugin_NETGEN_3D::computeFillNgMesh(aMesh, aShape, nodeVec, ngLib, helper, Netgen_NbOfNodes);
netgen::OCCGeometry occgeo;
NETGENPlugin_NETGEN_3D::computePrepareParam(aMesh, ngLib, occgeo, helper, endWith);
NETGENPlugin_NETGEN_3D::computeRunMesher(occgeo, nodeVec, ngLib._ngMesh, ngLib, startWith, endWith);
computeFillNewElementFile(nodeVec, ngLib, new_element_file, Netgen_NbOfNodes);
if(output_mesh)
NETGENPlugin_NETGEN_3D::computeFillMesh(nodeVec, ngLib, helper, Netgen_NbOfNodes);
return false;
}
/**
* @brief Running the mesher on the given files
*
* @param input_mesh_file Mesh file (containing 2D elements)
* @param shape_file Shape file (BREP or STEP format)
* @param hypo_file Ascii file containing the netgen parameters
* @param element_orientation_file Binary file containing the orientation of surface elemnts
* @param new_element_file output file containing info the elements created by the mesher
* @param output_mesh_file output mesh file (if empty it will not be created)
* @return int
*/
int NETGENPlugin_NETGEN_3D_SA::run(const std::string input_mesh_file,
const std::string shape_file,
const std::string hypo_file,
const std::string element_orientation_file,
const std::string new_element_file,
const std::string output_mesh_file)
{
_element_orientation_file = element_orientation_file;
std::unique_ptr<SMESH_Mesh> myMesh(_gen->CreateMesh(false));
importMesh(input_mesh_file, *myMesh);
// Importing shape
TopoDS_Shape myShape;
importShape(shape_file, myShape);
// Importing hypothesis
netgen_params myParams;
importNetgenParams(hypo_file, myParams);
fillHyp(myParams);
MESSAGE("Meshing with netgen3d");
int ret = Compute(myShape, *myMesh, myParams,
new_element_file,
!output_mesh_file.empty());
if(ret){
std::cerr << "Meshing failed" << std::endl;
return ret;
}
if(!output_mesh_file.empty()){
std::string meshName = "MESH";
exportMesh(output_mesh_file, *myMesh, meshName);
}
return ret;
}
/**
* @brief Compute the list of already meshed Surface elements and info
* on their orientation and if they are internal
*
* @param aMesh Global Mesh
* @param aShape Shape associated to the mesh
* @param proxyMesh pointer to mesh used fo find the elements
* @param internals information on internal sub shapes
* @param helper helper associated to the mesh
* @param listElements map of surface element associated with
* their orientation and internal status
* @return true if their was some error
*/
bool NETGENPlugin_NETGEN_3D_SA::getSurfaceElements(
SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
SMESH_ProxyMesh::Ptr proxyMesh,
NETGENPlugin_Internals &internals,
SMESH_MesherHelper &helper,
std::map<const SMDS_MeshElement*, tuple<bool, bool>>& listElements
)
{
// To remove compilation warnings
(void) aShape;
(void) proxyMesh;
(void) internals;
(void) helper;
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
// Get list of elements + their orientation from element_orientation file
std::map<vtkIdType, bool> elemOrientation;
{
// Setting all element orientation to false if there no element orientation file
if(_element_orientation_file.empty()){
MESSAGE("No element orientation file");
SMDS_ElemIteratorPtr iteratorElem = meshDS->elementsIterator(SMDSAbs_Face);
while ( iteratorElem->more() ) // loop on elements on a geom face
{
// check mesh face
const SMDS_MeshElement* elem = iteratorElem->next();
elemOrientation[elem->GetID()] = false;
}
} else {
MESSAGE("Reading from elements from file: " << _element_orientation_file);
std::ifstream df(_element_orientation_file, ios::binary|ios::in);
int nbElement;
bool orient;
// Warning of the use of vtkIdType (I had issue when run_mesher was compiled with internal vtk) and salome not
// Sizeof was the same but how he othered the type was different
// Maybe using another type (uint64_t) instead would be better
vtkIdType id;
df.read((char*)&nbElement, sizeof(int));
for(int ielem=0;ielem<nbElement;++ielem){
df.read((char*) &id, sizeof(vtkIdType));
df.read((char*) &orient, sizeof(bool));
elemOrientation[id] = orient;
}
}
}
// Adding elements from Mesh
SMDS_ElemIteratorPtr iteratorElem = meshDS->elementsIterator(SMDSAbs_Face);
bool isRev;
bool isIn;
while ( iteratorElem->more() ) // loop on elements on a geom face
{
// check mesh face
const SMDS_MeshElement* elem = iteratorElem->next();
if ( !elem ){
return error( COMPERR_BAD_INPUT_MESH, "Null element encounters");
}
if ( elem->NbCornerNodes() != 3 ){
return error( COMPERR_BAD_INPUT_MESH, "Not triangle element encounters");
}
// Keeping only element that are in the element orientation file
isIn = elemOrientation.count(elem->GetID())==1;
if(!isIn)
continue;
// Get orientation
// Netgen requires that all the triangle point outside
isRev = elemOrientation[elem->GetID()];
listElements[elem] = tuple(isRev, false);
}
return false;
}

View File

@ -0,0 +1,81 @@
// Copyright (C) 2007-2021 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
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//=============================================================================
// File : NETGENPlugin_NETGEN_3D_SA.hxx
// Created : lundi 19 Septembre 2022
// Author : Yoann AUDOUIN (EDF)
// Project : SALOME
//=============================================================================
//
#ifndef _NETGENPlugin_NETGEN_3D_SA_HXX_
#define _NETGENPlugin_NETGEN_3D_SA_HXX_
#include "NETGENPlugin_NETGEN_3D.hxx"
#include <vector>
#include <map>
class NETGENPlugin_NetgenLibWrapper;
class netgen_params;
class SMDS_MeshNode;
using namespace std;
class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_3D_SA: public NETGENPlugin_NETGEN_3D
{
public:
NETGENPlugin_NETGEN_3D_SA();
virtual ~NETGENPlugin_NETGEN_3D_SA();
void fillHyp(netgen_params aParams);
bool Compute(TopoDS_Shape &aShape, SMESH_Mesh& aMesh, netgen_params& aParams,
std::string new_element_file, bool output_mesh);
int run(const std::string input_mesh_file,
const std::string shape_file,
const std::string hypo_file,
const std::string element_orientation_file,
const std::string new_element_file,
const std::string output_mesh_file);
protected:
bool computeFillNewElementFile(
std::vector< const SMDS_MeshNode* > &nodeVec,
NETGENPlugin_NetgenLibWrapper &ngLib,
std::string new_element_file,
int &Netgen_NbOfNodes);
bool getSurfaceElements(
SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
SMESH_ProxyMesh::Ptr proxyMesh,
NETGENPlugin_Internals &internals,
SMESH_MesherHelper &helper,
std::map<const SMDS_MeshElement*, tuple<bool, bool>>& listElements
) override;
std::string _element_orientation_file="";
};
#endif

View File

@ -0,0 +1,94 @@
// Copyright (C) 2007-2022 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
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : NETGENplugin_Runnner_main.cxx
// Author : Yoann AUDOUIN, EDF
// Module : NETGEN
//
#include "NETGENPlugin_NETGEN_3D_SA.hxx"
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <chrono>
/**
* @brief Main function
*
* @param argc Number of arguments
* @param argv Arguments
*
* @return error code
*/
int main(int argc, char *argv[]){
if(argc!=8||(argc==2 && (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help")==0))){
std::cout << "Error in number of arguments "<< argc-1<<" given expected 7" <<std::endl;
std::cout << "Syntax:"<<std::endl;
std::cout << "run_mesher MESHER INPUT_MESH_FILE SHAPE_FILE HYPO_FILE" << std::endl;
std::cout << " ELEM_ORIENT_FILE " << std::endl;
std::cout << " NEW_ELEMENT_FILE OUTPUT_MESH_FILE" << std::endl;
std::cout << std::endl;
std::cout << " Set argument to NONE to ignore them " << std::endl;
std::cout << std::endl;
std::cout << "Args:" << std::endl;
std::cout << " MESHER: mesher to use from (NETGEN3D, NETGEN2D)" << std::endl;
std::cout << " INPUT_MESH_FILE: MED File containing lower-dimension-elements already meshed" << std::endl;
std::cout << " SHAPE_FILE: STEP file containing the shape to mesh" << std::endl;
std::cout << " HYPO_FILE: Ascii file containint the list of parameters" << std::endl;
std::cout << " (optional) ELEM_ORIENT_FILE: binary file containing the list of element from INPUT_MESH_FILE associated to the shape and their orientation" << std::endl;
std::cout << " (optional) NEW_ELEMENT_FILE: (out) contains elements and nodes added by the meshing" << std::endl;
std::cout << " (optional) OUTPUT_MESH_FILE: (out) MED File containing the mesh after the run of the mesher" << std::endl;
return 0;
}
std::string mesher=argv[1];
std::string input_mesh_file=argv[2];
std::string shape_file=argv[3];
std::string hypo_file=argv[4];
std::string element_orientation_file=argv[5];
std::string new_element_file=argv[6];
std::string output_mesh_file=argv[7];
//std::string thing;
//std::cin >> thing;
if (output_mesh_file == "NONE")
output_mesh_file = "";
if (element_orientation_file == "NONE")
element_orientation_file = "";
if (new_element_file == "NONE")
new_element_file = "";
if (mesher=="NETGEN3D"){
NETGENPlugin_NETGEN_3D_SA myplugin;
myplugin.run(input_mesh_file,
shape_file,
hypo_file,
element_orientation_file,
new_element_file,
output_mesh_file);
} else {
std::cerr << "Unknown mesher:" << mesher << std::endl;
}
return 0;
}

View File

@ -36,6 +36,7 @@
#include "NETGENPlugin_NETGEN_2D_ONLY_i.hxx" #include "NETGENPlugin_NETGEN_2D_ONLY_i.hxx"
#include "NETGENPlugin_NETGEN_2D_i.hxx" #include "NETGENPlugin_NETGEN_2D_i.hxx"
#include "NETGENPlugin_NETGEN_3D_i.hxx" #include "NETGENPlugin_NETGEN_3D_i.hxx"
#include "NETGENPlugin_NETGEN_3D_Remote_i.hxx"
#include "NETGENPlugin_SimpleHypothesis_2D_i.hxx" #include "NETGENPlugin_SimpleHypothesis_2D_i.hxx"
#include "NETGENPlugin_SimpleHypothesis_3D_i.hxx" #include "NETGENPlugin_SimpleHypothesis_3D_i.hxx"
@ -63,6 +64,8 @@ extern "C"
// Algorithms // Algorithms
if (strcmp(aHypName, "NETGEN_3D") == 0) if (strcmp(aHypName, "NETGEN_3D") == 0)
aCreator = new NETGENPlugin_Creator_i<NETGENPlugin_NETGEN_3D_i>; aCreator = new NETGENPlugin_Creator_i<NETGENPlugin_NETGEN_3D_i>;
else if (strcmp(aHypName, "NETGEN_3D_Remote") == 0)
aCreator = new NETGENPlugin_Creator_i<NETGENPlugin_NETGEN_3D_Remote_i>;
else if (strcmp(aHypName, "NETGEN_2D") == 0) else if (strcmp(aHypName, "NETGEN_2D") == 0)
aCreator = new NETGENPlugin_Creator_i<NETGENPlugin_NETGEN_2D_i>; aCreator = new NETGENPlugin_Creator_i<NETGENPlugin_NETGEN_2D_i>;
else if (strcmp(aHypName, "NETGEN_2D_ONLY") == 0) else if (strcmp(aHypName, "NETGEN_2D_ONLY") == 0)