Cleanup of NETGEN_2D_Only
This commit is contained in:
parent
4264181864
commit
3a6a1c7888
@ -572,7 +572,7 @@ void NETGENPlugin_Mesher::SetSelfPointer( NETGENPlugin_Mesher ** ptr )
|
|||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Initialize given NETGEN parameters with default values
|
* \brief Initialize global NETGEN parameters with default values
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
@ -613,14 +613,15 @@ void NETGENPlugin_Mesher::SetDefaultParameters()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//================================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Initialize global NETGEN parameters with default values
|
* Pass parameters to NETGEN
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//=============================================================================
|
||||||
|
|
||||||
void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
|
void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
|
||||||
{
|
{
|
||||||
|
if (hyp)
|
||||||
|
{
|
||||||
netgen::MeshingParameters& mparams = netgen::mparam;
|
netgen::MeshingParameters& mparams = netgen::mparam;
|
||||||
// Initialize global NETGEN parameters:
|
// Initialize global NETGEN parameters:
|
||||||
// maximal mesh segment size
|
// maximal mesh segment size
|
||||||
@ -679,6 +680,8 @@ void NETGENPlugin_Mesher::SetParameters(const NETGENPlugin_Hypothesis* hyp)
|
|||||||
setLocalSize(S, val);
|
setLocalSize(S, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef NETGEN_V6
|
#ifdef NETGEN_V6
|
||||||
|
|
||||||
netgen::mparam.closeedgefac = 2;
|
netgen::mparam.closeedgefac = 2;
|
||||||
@ -4498,7 +4501,7 @@ void NETGENPlugin_NetgenLibWrapper::setMesh( Ng_Mesh* mesh )
|
|||||||
|
|
||||||
int NETGENPlugin_NetgenLibWrapper::GenerateMesh( netgen::OCCGeometry& occgeo,
|
int NETGENPlugin_NetgenLibWrapper::GenerateMesh( netgen::OCCGeometry& occgeo,
|
||||||
int startWith, int endWith,
|
int startWith, int endWith,
|
||||||
netgen::Mesh* & ngMesh)
|
netgen::Mesh* & ngMesh )
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
if ( !ngMesh )
|
if ( !ngMesh )
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
//
|
//
|
||||||
// This library is free software; you can redistribute it and/or
|
// This library is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU Lesser General Public
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
@ -24,7 +25,6 @@
|
|||||||
|
|
||||||
#include "NETGENPlugin_Mesher.hxx"
|
#include "NETGENPlugin_Mesher.hxx"
|
||||||
#include "NETGENPlugin_Hypothesis_2D.hxx"
|
#include "NETGENPlugin_Hypothesis_2D.hxx"
|
||||||
#include "NETGENPlugin_DriverParam.hxx"
|
|
||||||
|
|
||||||
#include <SMDS_MeshElement.hxx>
|
#include <SMDS_MeshElement.hxx>
|
||||||
#include <SMDS_MeshNode.hxx>
|
#include <SMDS_MeshNode.hxx>
|
||||||
@ -39,9 +39,6 @@
|
|||||||
#include <StdMeshers_MaxElementArea.hxx>
|
#include <StdMeshers_MaxElementArea.hxx>
|
||||||
#include <StdMeshers_QuadranglePreference.hxx>
|
#include <StdMeshers_QuadranglePreference.hxx>
|
||||||
#include <StdMeshers_ViscousLayers2D.hxx>
|
#include <StdMeshers_ViscousLayers2D.hxx>
|
||||||
#include "SMESH_DriverShape.hxx"
|
|
||||||
#include "SMESH_DriverMesh.hxx"
|
|
||||||
|
|
||||||
|
|
||||||
#include <Precision.hxx>
|
#include <Precision.hxx>
|
||||||
#include <Standard_ErrorHandler.hxx>
|
#include <Standard_ErrorHandler.hxx>
|
||||||
@ -53,9 +50,6 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <boost/filesystem.hpp>
|
|
||||||
namespace fs = boost::filesystem;
|
|
||||||
/*
|
/*
|
||||||
Netgen include files
|
Netgen include files
|
||||||
*/
|
*/
|
||||||
@ -80,7 +74,6 @@ using namespace std;
|
|||||||
using namespace netgen;
|
using namespace netgen;
|
||||||
using namespace nglib;
|
using namespace nglib;
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
@ -135,7 +128,6 @@ bool NETGENPlugin_NETGEN_2D_ONLY::CheckHypothesis (SMESH_Mesh& aMesh,
|
|||||||
_hypParameters = 0;
|
_hypParameters = 0;
|
||||||
_progressByTic = -1;
|
_progressByTic = -1;
|
||||||
|
|
||||||
|
|
||||||
const list<const SMESHDS_Hypothesis*>& hyps = GetUsedHypothesis(aMesh, aShape, false);
|
const list<const SMESHDS_Hypothesis*>& hyps = GetUsedHypothesis(aMesh, aShape, false);
|
||||||
|
|
||||||
if (hyps.empty())
|
if (hyps.empty())
|
||||||
@ -225,221 +217,6 @@ bool NETGENPlugin_NETGEN_2D_ONLY::CheckHypothesis (SMESH_Mesh& aMesh,
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// write in a binary file the orientation for each 2D element of the mesh
|
|
||||||
void NETGENPlugin_NETGEN_2D_ONLY::exportElementOrientation(SMESH_Mesh& aMesh,
|
|
||||||
const TopoDS_Shape& aShape,
|
|
||||||
netgen_params& aParams,
|
|
||||||
const std::string output_file)
|
|
||||||
{
|
|
||||||
std::map<vtkIdType, bool> elemOrientation;
|
|
||||||
|
|
||||||
SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( aMesh ));
|
|
||||||
for ( TopExp_Explorer exEd( aShape, TopAbs_EDGE ); exEd.More(); exEd.Next())
|
|
||||||
{
|
|
||||||
const TopoDS_Shape& aShapeEdge = exEd.Current();
|
|
||||||
const SMESHDS_SubMesh * aSubMeshDSEdge = proxyMesh->GetSubMesh( aShapeEdge );
|
|
||||||
if ( !aSubMeshDSEdge ) continue;
|
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSEdge->GetElements();
|
|
||||||
while ( iteratorElem->more() ) // loop on elements on a geom face
|
|
||||||
{
|
|
||||||
const SMDS_MeshElement* elem = iteratorElem->next();
|
|
||||||
elemOrientation[elem->GetID()] = aShapeEdge.Orientation() == TopAbs_INTERNAL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
df.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void NETGENPlugin_NETGEN_2D_ONLY::FillParameters(const NETGENPlugin_Hypothesis* hyp, netgen_params &aParams)
|
|
||||||
{
|
|
||||||
//TODO: factorize code with the one from NETGEN3D
|
|
||||||
// Move in netgen_param ?
|
|
||||||
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();
|
|
||||||
#else
|
|
||||||
// const char*
|
|
||||||
aParams.meshsizefilename = hyp->GetMeshSizeFile().empty() ? 0 : hyp->GetMeshSizeFile().c_str();
|
|
||||||
#endif
|
|
||||||
#ifdef NETGEN_V6
|
|
||||||
aParams.closeedgefac = 2;
|
|
||||||
#else
|
|
||||||
aParams.closeedgefac = 0;
|
|
||||||
#endif
|
|
||||||
aParams.has_LengthFromEdges_hyp = _hypLengthFromEdges;
|
|
||||||
}
|
|
||||||
//=============================================================================
|
|
||||||
/*!
|
|
||||||
*Here we are going to use the NETGEN mesher remotely
|
|
||||||
*/
|
|
||||||
//=============================================================================
|
|
||||||
|
|
||||||
bool NETGENPlugin_NETGEN_2D_ONLY::RemoteCompute(SMESH_Mesh& aMesh,
|
|
||||||
const TopoDS_Shape& aShape)
|
|
||||||
{
|
|
||||||
aMesh.Lock();
|
|
||||||
SMESH_Hypothesis::Hypothesis_Status hypStatus;
|
|
||||||
CheckHypothesis(aMesh, aShape, hypStatus);
|
|
||||||
|
|
||||||
// Temporary folder for run
|
|
||||||
fs::path tmp_folder = aMesh.tmp_folder / fs::unique_path(fs::path("Face-%%%%-%%%%"));
|
|
||||||
fs::create_directories(tmp_folder);
|
|
||||||
// Using MESH2D generated after all triangles where created.
|
|
||||||
fs::path mesh_file=aMesh.tmp_folder / fs::path("Mesh1D.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");
|
|
||||||
// TODO: Remove that file we do not use it
|
|
||||||
fs::path output_mesh_file=tmp_folder / fs::path("output_mesh.med");
|
|
||||||
fs::path shape_file=tmp_folder / fs::path("shape.step");
|
|
||||||
fs::path param_file=tmp_folder / fs::path("netgen2d_param.txt");
|
|
||||||
fs::path log_file=tmp_folder / fs::path("run.log");
|
|
||||||
|
|
||||||
//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, aParams, element_orientation_file.string());
|
|
||||||
|
|
||||||
aMesh.Unlock();
|
|
||||||
// Calling run_mesher
|
|
||||||
// TODO: check if we need to handle the .exe for windows
|
|
||||||
std::string cmd;
|
|
||||||
fs::path run_mesher_exe =
|
|
||||||
fs::path(std::getenv("NETGENPLUGIN_ROOT_DIR"))/
|
|
||||||
fs::path("bin")/
|
|
||||||
fs::path("salome")/
|
|
||||||
fs::path("NETGENPlugin_Runner");
|
|
||||||
cmd = run_mesher_exe.string() +
|
|
||||||
" NETGEN2D " + mesh_file.string() + " "
|
|
||||||
+ shape_file.string() + " "
|
|
||||||
+ param_file.string() + " "
|
|
||||||
+ element_orientation_file.string() + " "
|
|
||||||
+ new_element_file.string() + " "
|
|
||||||
+ std::to_string(0) + " "
|
|
||||||
+ output_mesh_file.string() +
|
|
||||||
" >> " + log_file.string();
|
|
||||||
|
|
||||||
MESSAGE("Running command: ");
|
|
||||||
MESSAGE(cmd);
|
|
||||||
|
|
||||||
// Writing command in log
|
|
||||||
std::ofstream flog(log_file.string());
|
|
||||||
flog << cmd << endl;
|
|
||||||
flog.close();
|
|
||||||
|
|
||||||
// TODO: Replace system by something else to handle redirection for windows
|
|
||||||
int ret = system(cmd.c_str());
|
|
||||||
|
|
||||||
// TODO: better error handling (display log ?)
|
|
||||||
if(ret != 0){
|
|
||||||
// Run crahed
|
|
||||||
//throw Exception("Meshing failed");
|
|
||||||
std::cerr << "Issue with command: " << std::endl;
|
|
||||||
std::cerr << cmd << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
aMesh.Lock();
|
|
||||||
std::ifstream df(new_element_file.string(), ios::binary);
|
|
||||||
|
|
||||||
int Netgen_NbOfNodes;
|
|
||||||
int Netgen_NbOfNodesNew;
|
|
||||||
int Netgen_NbOfTria;
|
|
||||||
double Netgen_point[3];
|
|
||||||
int Netgen_triangle[3];
|
|
||||||
int nodeID;
|
|
||||||
|
|
||||||
SMESH_MesherHelper helper(aMesh);
|
|
||||||
// This function is necessary so that SetElementOnShape works
|
|
||||||
int _quadraticMesh = 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 );
|
|
||||||
for (int nodeIndex = 1 ; nodeIndex <= Netgen_NbOfNodes; ++nodeIndex )
|
|
||||||
{
|
|
||||||
//Id of the point
|
|
||||||
df.read((char*) &nodeID, sizeof(int));
|
|
||||||
nodeVec.at(nodeIndex) = nullptr;
|
|
||||||
SMDS_NodeIteratorPtr iteratorNode = aMesh.GetMeshDS()->nodesIterator();
|
|
||||||
while(iteratorNode->more()){
|
|
||||||
const SMDS_MeshNode* node = iteratorNode->next();
|
|
||||||
if(node->GetID() == nodeID){
|
|
||||||
nodeVec.at(nodeIndex) = node;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(nodeVec.at(nodeIndex) == nullptr){
|
|
||||||
std::cerr << "Error could not identify id";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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_NbOfTria, sizeof(int));
|
|
||||||
for ( int elemIndex = 1; elemIndex <= Netgen_NbOfTria; ++elemIndex )
|
|
||||||
{
|
|
||||||
df.read((char*) &Netgen_triangle, sizeof(int)*3);
|
|
||||||
helper.AddFace (nodeVec.at( Netgen_triangle[0] ),
|
|
||||||
nodeVec.at( Netgen_triangle[1] ),
|
|
||||||
nodeVec.at( Netgen_triangle[2] ));
|
|
||||||
}
|
|
||||||
df.close();
|
|
||||||
|
|
||||||
aMesh.Unlock();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
*Here we are going to use the NETGEN mesher
|
*Here we are going to use the NETGEN mesher
|
||||||
@ -449,12 +226,8 @@ bool NETGENPlugin_NETGEN_2D_ONLY::RemoteCompute(SMESH_Mesh& aMesh,
|
|||||||
bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
||||||
const TopoDS_Shape& aShape)
|
const TopoDS_Shape& aShape)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(aMesh.IsParallel())
|
|
||||||
return RemoteCompute(aMesh, aShape);
|
|
||||||
|
|
||||||
netgen::multithread.terminate = 0;
|
netgen::multithread.terminate = 0;
|
||||||
netgen::multithread.task = "Surface meshing";
|
//netgen::multithread.task = "Surface meshing";
|
||||||
|
|
||||||
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
|
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
|
||||||
SMESH_MesherHelper helper(aMesh);
|
SMESH_MesherHelper helper(aMesh);
|
||||||
@ -479,6 +252,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
|||||||
// else
|
// else
|
||||||
// min = aMesher.GetDefaultMinSize()
|
// min = aMesher.GetDefaultMinSize()
|
||||||
// max = max segment len of a FACE
|
// max = max segment len of a FACE
|
||||||
|
|
||||||
NETGENPlugin_Mesher aMesher( &aMesh, aShape, /*isVolume=*/false);
|
NETGENPlugin_Mesher aMesher( &aMesh, aShape, /*isVolume=*/false);
|
||||||
aMesher.SetParameters( _hypParameters ); // _hypParameters -> netgen::mparam
|
aMesher.SetParameters( _hypParameters ); // _hypParameters -> netgen::mparam
|
||||||
const bool toOptimize = _hypParameters ? _hypParameters->GetOptimize() : true;
|
const bool toOptimize = _hypParameters ? _hypParameters->GetOptimize() : true;
|
||||||
@ -492,8 +266,6 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
|||||||
// local size is common for all FACEs in aShape?
|
// local size is common for all FACEs in aShape?
|
||||||
const bool isCommonLocalSize = ( !_hypLengthFromEdges && !_hypMaxElementArea && netgen::mparam.uselocalh );
|
const bool isCommonLocalSize = ( !_hypLengthFromEdges && !_hypMaxElementArea && netgen::mparam.uselocalh );
|
||||||
const bool isDefaultHyp = ( !_hypLengthFromEdges && !_hypMaxElementArea && !_hypParameters );
|
const bool isDefaultHyp = ( !_hypLengthFromEdges && !_hypMaxElementArea && !_hypParameters );
|
||||||
aMesh.Unlock();
|
|
||||||
|
|
||||||
|
|
||||||
if ( isCommonLocalSize ) // compute common local size in ngMeshes[0]
|
if ( isCommonLocalSize ) // compute common local size in ngMeshes[0]
|
||||||
{
|
{
|
||||||
@ -521,9 +293,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
|||||||
netgen::OCCParameters occparam;
|
netgen::OCCParameters occparam;
|
||||||
netgen::OCCSetLocalMeshSize( occgeoComm, *ngMeshes[0], netgen::mparam, occparam );
|
netgen::OCCSetLocalMeshSize( occgeoComm, *ngMeshes[0], netgen::mparam, occparam );
|
||||||
#else
|
#else
|
||||||
aMesh.Lock();
|
|
||||||
netgen::OCCSetLocalMeshSize( occgeoComm, *ngMeshes[0] );
|
netgen::OCCSetLocalMeshSize( occgeoComm, *ngMeshes[0] );
|
||||||
aMesh.Unlock();
|
|
||||||
#endif
|
#endif
|
||||||
occgeoComm.emap.Clear();
|
occgeoComm.emap.Clear();
|
||||||
occgeoComm.vmap.Clear();
|
occgeoComm.vmap.Clear();
|
||||||
@ -554,12 +324,13 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
|||||||
aMesher.SetLocalSize( occgeoComm, *ngMeshes[0] );
|
aMesher.SetLocalSize( occgeoComm, *ngMeshes[0] );
|
||||||
aMesher.SetLocalSizeForChordalError( occgeoComm, *ngMeshes[0] );
|
aMesher.SetLocalSizeForChordalError( occgeoComm, *ngMeshes[0] );
|
||||||
try {
|
try {
|
||||||
ngMeshes[0]->LoadLocalMeshSize( netgen::mparam.meshsizefilename );
|
ngMeshes[0]->LoadLocalMeshSize( mparam.meshsizefilename );
|
||||||
} catch (NgException & ex) {
|
} catch (NgException & ex) {
|
||||||
return error( COMPERR_BAD_PARMETERS, ex.What() );
|
return error( COMPERR_BAD_PARMETERS, ex.What() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
netgen::mparam.uselocalh = toOptimize; // restore as it is used at surface optimization
|
netgen::mparam.uselocalh = toOptimize; // restore as it is used at surface optimization
|
||||||
|
|
||||||
// ==================
|
// ==================
|
||||||
// Loop on all FACEs
|
// Loop on all FACEs
|
||||||
// ==================
|
// ==================
|
||||||
@ -687,15 +458,15 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
|||||||
|
|
||||||
if ( iLoop == NO_LOC_SIZE )
|
if ( iLoop == NO_LOC_SIZE )
|
||||||
{
|
{
|
||||||
ngMesh->SetGlobalH ( netgen::mparam.maxh );
|
ngMesh->SetGlobalH ( mparam.maxh );
|
||||||
ngMesh->SetMinimalH( netgen::mparam.minh );
|
ngMesh->SetMinimalH( mparam.minh );
|
||||||
Box<3> bb = occgeom.GetBoundingBox();
|
Box<3> bb = occgeom.GetBoundingBox();
|
||||||
bb.Increase (bb.Diam()/10);
|
bb.Increase (bb.Diam()/10);
|
||||||
ngMesh->SetLocalH (bb.PMin(), bb.PMax(), netgen::mparam.grading);
|
ngMesh->SetLocalH (bb.PMin(), bb.PMax(), mparam.grading);
|
||||||
aMesher.SetLocalSize( occgeom, *ngMesh );
|
aMesher.SetLocalSize( occgeom, *ngMesh );
|
||||||
aMesher.SetLocalSizeForChordalError( occgeoComm, *ngMesh );
|
aMesher.SetLocalSizeForChordalError( occgeoComm, *ngMesh );
|
||||||
try {
|
try {
|
||||||
ngMesh->LoadLocalMeshSize( netgen::mparam.meshsizefilename );
|
ngMesh->LoadLocalMeshSize( mparam.meshsizefilename );
|
||||||
} catch (NgException & ex) {
|
} catch (NgException & ex) {
|
||||||
return error( COMPERR_BAD_PARMETERS, ex.What() );
|
return error( COMPERR_BAD_PARMETERS, ex.What() );
|
||||||
}
|
}
|
||||||
@ -708,7 +479,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
//if ( !isCommonLocalSize )
|
//if ( !isCommonLocalSize )
|
||||||
//limitSize( ngMesh, netgen::mparam.maxh * 0.8);
|
//limitSize( ngMesh, mparam.maxh * 0.8);
|
||||||
|
|
||||||
// -------------------------
|
// -------------------------
|
||||||
// Generate surface mesh
|
// Generate surface mesh
|
||||||
@ -720,7 +491,9 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
|||||||
SMESH_Comment str;
|
SMESH_Comment str;
|
||||||
try {
|
try {
|
||||||
OCC_CATCH_SIGNALS;
|
OCC_CATCH_SIGNALS;
|
||||||
|
|
||||||
err = ngLib.GenerateMesh(occgeom, startWith, endWith, ngMesh);
|
err = ngLib.GenerateMesh(occgeom, startWith, endWith, ngMesh);
|
||||||
|
|
||||||
if ( netgen::multithread.terminate )
|
if ( netgen::multithread.terminate )
|
||||||
return false;
|
return false;
|
||||||
if ( err )
|
if ( err )
|
||||||
@ -759,10 +532,10 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
|||||||
double segLen = p.Distance( uvPtVec[ iP-1 ].node );
|
double segLen = p.Distance( uvPtVec[ iP-1 ].node );
|
||||||
double size = ngMesh->GetH( np );
|
double size = ngMesh->GetH( np );
|
||||||
netgen::mparam.minh = Min( netgen::mparam.minh, size );
|
netgen::mparam.minh = Min( netgen::mparam.minh, size );
|
||||||
netgen:: mparam.maxh = Max( netgen::mparam.maxh, segLen );
|
netgen::mparam.maxh = Max( netgen::mparam.maxh, segLen );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//cerr << "min " << mparam.minh << " max " << mparam.maxh << endl;
|
//cerr << "min " << netgen::mparam.minh << " max " << netgen::mparam.maxh << endl;
|
||||||
netgen::mparam.minh *= 0.9;
|
netgen::mparam.minh *= 0.9;
|
||||||
netgen::mparam.maxh *= 1.1;
|
netgen::mparam.maxh *= 1.1;
|
||||||
continue;
|
continue;
|
||||||
@ -773,6 +546,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
// Fill the SMESHDS with the generated nodes and faces
|
// Fill the SMESHDS with the generated nodes and faces
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
class StdMeshers_MaxElementArea;
|
class StdMeshers_MaxElementArea;
|
||||||
class StdMeshers_LengthFromEdges;
|
class StdMeshers_LengthFromEdges;
|
||||||
class NETGENPlugin_Hypothesis_2D;
|
class NETGENPlugin_Hypothesis_2D;
|
||||||
class NETGENPlugin_Hypothesis;
|
|
||||||
class netgen_params;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Mesher generating 2D elements on a geometrical face taking
|
* \brief Mesher generating 2D elements on a geometrical face taking
|
||||||
@ -51,16 +49,6 @@ public:
|
|||||||
const TopoDS_Shape& aShape,
|
const TopoDS_Shape& aShape,
|
||||||
Hypothesis_Status& aStatus);
|
Hypothesis_Status& aStatus);
|
||||||
|
|
||||||
void exportElementOrientation(SMESH_Mesh& aMesh,
|
|
||||||
const TopoDS_Shape& aShape,
|
|
||||||
netgen_params& aParams,
|
|
||||||
const std::string output_file);
|
|
||||||
|
|
||||||
void FillParameters(const NETGENPlugin_Hypothesis* hyp,
|
|
||||||
netgen_params &aParams);
|
|
||||||
|
|
||||||
virtual bool RemoteCompute(SMESH_Mesh& aMesh,
|
|
||||||
const TopoDS_Shape& aShape);
|
|
||||||
virtual bool Compute(SMESH_Mesh& aMesh,
|
virtual bool Compute(SMESH_Mesh& aMesh,
|
||||||
const TopoDS_Shape& aShape);
|
const TopoDS_Shape& aShape);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user