[bos #38045][EDF] (2023-T3) suppress compilation warnings of new and refactored classes.

Allow compilation in windows.
This commit is contained in:
cconopoima 2024-01-03 12:47:10 +00:00 committed by cesarconopoima
parent add7adb355
commit c56027a4a2
9 changed files with 92 additions and 39 deletions

View File

@ -3185,7 +3185,7 @@ int NETGENPlugin_Mesher::CallNetgenMeshVolumens( NETGENPlugin_NetgenLibWrapper&
return err;
}
void NETGENPlugin_Mesher::MakeSecondOrder( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::MeshingParameters &mparams, netgen::OCCGeometry& occgeo,
void NETGENPlugin_Mesher::MakeSecondOrder( netgen::MeshingParameters &mparams, netgen::OCCGeometry& occgeo,
list< SMESH_subMesh* >* meshedSM, NETGENPlugin_ngMeshInfo& initState, SMESH_Comment& comment )
{
if ( mparams.secondorder > 0 )
@ -3386,7 +3386,6 @@ void NETGENPlugin_Mesher::InitialSetup( NETGENPlugin_NetgenLibWrapper& ngLib, ne
SMESH_MesherHelper &quadHelper, NETGENPlugin_ngMeshInfo& initState,
netgen::MeshingParameters &mparams )
{
int err = 0;
// Init occ geometry maps for non meshed object and fill meshedSM with premeshed objects
PrepareOCCgeometry( occgeo, _shape, *_mesh, meshedSM, internals );
_occgeom = &occgeo;
@ -3557,7 +3556,7 @@ bool NETGENPlugin_Mesher::Compute2D( NETGENPlugin_NetgenLibWrapper& ngLib, netge
int err = CallNetgenMeshFaces( ngLib, occgeo, comment );
if ( !err && dim == DIM::D2 /* if mesh is 3D then second order is defined after volumens are computed*/ )
MakeSecondOrder( ngLib, mparams, occgeo, meshedSM, initState, comment );
MakeSecondOrder( mparams, occgeo, meshedSM, initState, comment );
return err;
}
@ -3579,7 +3578,7 @@ bool NETGENPlugin_Mesher::Compute3D( NETGENPlugin_NetgenLibWrapper& ngLib, netge
}
if ( !err )
MakeSecondOrder( ngLib, mparams, occgeo, meshedSM, initState, comment );
MakeSecondOrder( mparams, occgeo, meshedSM, initState, comment );
return err;
}
@ -3657,7 +3656,7 @@ bool NETGENPlugin_Mesher::Compute()
}
if (!err )
MakeSecondOrder( ngLib, mparams, occgeo, meshedSM, initState, comment );
MakeSecondOrder( mparams, occgeo, meshedSM, initState, comment );
}
_ticTime = 0.98 / _progressTic;

View File

@ -208,7 +208,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher
int CallNetgenMeshEdges( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::OCCGeometry& occgeo );
int CallNetgenMeshFaces( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::OCCGeometry& occgeo, SMESH_Comment& comment );
int CallNetgenMeshVolumens( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::OCCGeometry& occgeo, SMESH_Comment& comment );
void MakeSecondOrder( NETGENPlugin_NetgenLibWrapper& ngLib, netgen::MeshingParameters &mparams, netgen::OCCGeometry& occgeo,
void MakeSecondOrder( netgen::MeshingParameters &mparams, netgen::OCCGeometry& occgeo,
list< SMESH_subMesh* >* meshedSM, NETGENPlugin_ngMeshInfo& initState, SMESH_Comment& comment );
int FillInternalElements( NETGENPlugin_NetgenLibWrapper& ngLib, NETGENPlugin_Internals& internals, netgen::OCCGeometry& occgeo,
NETGENPlugin_ngMeshInfo& initState, SMESH_MesherHelper &quadHelper, list< SMESH_subMesh* >* meshedSM );

View File

@ -72,6 +72,28 @@ NETGENPlugin_NETGEN_1D2D3D_SA::~NETGENPlugin_NETGEN_1D2D3D_SA()
{
}
/**
* @brief Check presence and content of orientation file. Implemented for completness and future reference.
*
* @param element_orientation_file Binary file containing the orientation of surface elemnts
* @return true, false
*/
bool NETGENPlugin_NETGEN_1D2D3D_SA::checkOrientationFile( const std::string element_orientation_file )
{
if(element_orientation_file.empty()){
MESSAGE("No element orientation file");
return true;
} else {
MESSAGE("Reading from elements from file: " << element_orientation_file);
// By construction the orientation file written by Remote version has a zero written to mark no need of orientation in 2D meshing
int nbElement;
std::ifstream df(element_orientation_file, ios::binary|ios::in);
df.read((char*)&nbElement, sizeof(int));
df.close();
return (nbElement == 0);
}
}
/**
* @brief fill plugin hypothesis from the netgen_params structure
*
@ -341,17 +363,24 @@ int NETGENPlugin_NETGEN_1D2D3D_SA::run(const std::string input_mesh_file,
netgen_params myParams;
importNetgenParams(hypo_file, myParams);
fillHyp(myParams);
int ret = 1;
int ret = Compute( *myMesh, myShape, new_element_file, !output_mesh_file.empty(), dim );
if(ret){
std::cerr << "Meshing failed" << std::endl;
return ret;
}
if ( checkOrientationFile(element_orientation_file) )
{
ret = Compute( *myMesh, myShape, new_element_file, !output_mesh_file.empty(), dim );
if(ret){
std::cerr << "Meshing failed" << std::endl;
return ret;
}
if(!output_mesh_file.empty()){
std::string meshName = "MESH";
SMESH_DriverMesh::exportMesh(output_mesh_file, *myMesh, meshName);
if(!output_mesh_file.empty()){
std::string meshName = "MESH";
SMESH_DriverMesh::exportMesh(output_mesh_file, *myMesh, meshName);
}
}
else
std::cerr << "For NETGENPlugin_NETGEN_1D2D3D_SA, orientation file should be market with 0 or be empty!" << std::endl;
return ret;
}

View File

@ -51,8 +51,9 @@ public:
const std::string output_mesh_file,
const NETGENPlugin_Mesher::DIM dim );
protected:
private:
bool checkOrientationFile( const std::string element_orientation_file );
void fillHyp(netgen_params aParams);
bool FillNewElementFile( std::vector< const SMDS_MeshNode* > &nodeVec, NETGENPlugin_NetgenLibWrapper &ngLib,
std::string new_element_file, const NETGENPlugin_Mesher::DIM dim );

View File

@ -149,7 +149,7 @@ namespace // copied class from StdMesher_Importe_1D
div.Parameter( i ), div.Parameter( i+1 ),
enlarge, curve );
}
catch ( Standard_Failure ) {
catch ( Standard_Failure& ) {
_segments.resize( _segments.size() - 1 );
--i;
}
@ -523,7 +523,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::MapSegmentsToEdges(SMESH_Mesh& aMesh, const To
const int numberOfPremeshedNodes = aMesh.NbNodes();
TopTools_IndexedMapOfShape faces;
TopExp::MapShapes( aShape, TopAbs_FACE, faces );
int err = 0;
for ( int i = 1; i <= faces.Size(); ++i )
{
int numOfEdges = 0;
@ -676,7 +676,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::MapSegmentsToEdges(SMESH_Mesh& aMesh, const To
ngMesh->CalcSurfacesOfNode();
const int startWith = MESHCONST_MESHSURFACE;
const int endWith = MESHCONST_OPTSURFACE;
int err = ngLib.GenerateMesh(occgeom, startWith, endWith, ngMesh);
err = ngLib.GenerateMesh(occgeom, startWith, endWith, ngMesh);
// Ng_Mesh * ngMeshptr = (Ng_Mesh*) ngLib._ngMesh;
// int NetgenNodes = Ng_GetNP(ngMeshptr);
@ -693,7 +693,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::MapSegmentsToEdges(SMESH_Mesh& aMesh, const To
FillNodesAndElements( aMesh, helper, ngMesh, nodeVec, ng2smesh, newNetgenCoordinates, newNetgenElements, numberOfPremeshedNodes );
} // Face iteration
return false;
return (bool) err;
}
std::tuple<bool,bool> NETGENPlugin_NETGEN_2D_ONLY::SetParameteres( SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
@ -703,7 +703,6 @@ std::tuple<bool,bool> NETGENPlugin_NETGEN_2D_ONLY::SetParameteres( SMESH_Mesh& a
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
aMesher.SetParameters( _hypParameters ); // _hypParameters -> netgen::mparam
const bool toOptimize = _hypParameters ? _hypParameters->GetOptimize() : true;
if ( _hypMaxElementArea )
{
netgen::mparam.maxh = sqrt( 2. * _hypMaxElementArea->GetMaxArea() / sqrt(3.0) );

View File

@ -148,9 +148,7 @@ void NETGENPlugin_NETGEN_2D_Remote::fillParameters(const NETGENPlugin_Hypothesis
* @param aShape the shape associated to the mesh
* @param output_file name of the binary file
*/
void NETGENPlugin_NETGEN_2D_Remote::exportElementOrientation(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
const std::string output_file)
void NETGENPlugin_NETGEN_2D_Remote::exportElementOrientation(const std::string output_file)
{
std::ofstream df(output_file, ios::out|ios::binary);
int size=0;
@ -205,13 +203,13 @@ bool NETGENPlugin_NETGEN_2D_Remote::Compute(SMESH_Mesh& aMesh,
// exportNetgenParams(param_file.string(), aParams);
{
// Simply write the file with the proper name
std::ofstream myfile(param_file);
std::ofstream myfile(param_file.string());
myfile << 1 << std::endl;
myfile.close();
}
// Exporting element orientation
exportElementOrientation(aMesh, aShape, element_orientation_file.string());
exportElementOrientation(element_orientation_file.string());
}
// Calling run_mesher

View File

@ -61,10 +61,8 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_NETGEN_2D_Remote: public NETGENPlugin_NET
void setSubMeshesToCompute(SMESH_subMesh * aSubMesh) override;
protected:
void exportElementOrientation(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
const std::string output_file);
private:
void exportElementOrientation(const std::string output_file);
void fillParameters(const NETGENPlugin_Hypothesis* hyp,
netgen_params &aParams);

View File

@ -77,6 +77,28 @@ NETGENPlugin_NETGEN_2D_SA::~NETGENPlugin_NETGEN_2D_SA()
{
}
/**
* @brief Check presence and content of orientation file. Implemented for completness and future reference.
*
* @param element_orientation_file Binary file containing the orientation of surface elemnts
* @return true, false
*/
bool NETGENPlugin_NETGEN_2D_SA::checkOrientationFile( const std::string element_orientation_file )
{
if(element_orientation_file.empty()){
MESSAGE("No element orientation file");
return true;
} else {
MESSAGE("Reading from elements from file: " << element_orientation_file);
// By construction the orientation file written by Remote version has a zero written to mark no need of orientation in 2D meshing
int nbElement;
std::ifstream df(element_orientation_file, ios::binary|ios::in);
df.read((char*)&nbElement, sizeof(int));
df.close();
return (nbElement == 0);
}
}
/**
* @brief fill plugin hypothesis from the netgen_params structure
*
@ -244,7 +266,7 @@ int NETGENPlugin_NETGEN_2D_SA::run(const std::string input_mesh_file,
{
std::unique_ptr<SMESH_Mesh> myMesh(_gen->CreateMesh(false));
SMESH_DriverMesh::importMesh(input_mesh_file, *myMesh);
// Importing shape
TopoDS_Shape myShape;
@ -254,17 +276,23 @@ int NETGENPlugin_NETGEN_2D_SA::run(const std::string input_mesh_file,
importNetgenParams(hypo_file, myParams);
fillHyp(hypo_file,myParams);
MESSAGE("Meshing with netgen2d");
int ret = (int) Compute( *myMesh, myShape, new_element_file );
int ret = 1;
if ( checkOrientationFile(element_orientation_file) )
{
ret = (int) Compute( *myMesh, myShape, new_element_file );
if(ret){
std::cerr << "Meshing failed" << std::endl;
return ret;
}
if(ret){
std::cerr << "Meshing failed" << std::endl;
return ret;
}
if(!output_mesh_file.empty()){
std::string meshName = "MESH";
SMESH_DriverMesh::exportMesh(output_mesh_file, *myMesh, meshName);
if(!output_mesh_file.empty()){
std::string meshName = "MESH";
SMESH_DriverMesh::exportMesh(output_mesh_file, *myMesh, meshName);
}
}
else
std::cerr << "For NETGENPlugin_NETGEN_2D_SA orientation file should be market with 0 or be empty!" << std::endl;
return ret;
}

View File

@ -55,8 +55,9 @@ public:
std::map<int,const SMDS_MeshNode*>& premeshedNodes,
std::map<int,std::vector<double>>& newNetgenCoordinates,
std::map<int,std::vector<smIdType>>& newNetgenElements );
protected:
private:
bool checkOrientationFile( const std::string element_orientation_file );
void fillHyp(const std::string param_file, netgen_params aParams);
};