bool NETGENPlugin_Mesher::Compute()
{
- NETGENPlugin_NetgenLibWrapper aNgLib;
-
-// Internal method is needed to get result of computation
- return aNgLib.isComputeOk = _compute( &aNgLib );
-}
+ NETGENPlugin_NetgenLibWrapper ngLib;
-bool NETGENPlugin_Mesher::_compute( NETGENPlugin_NetgenLibWrapper* ngLib )
-{
netgen::MeshingParameters& mparams = netgen::mparam;
MESSAGE("Compute with:\n"
" max size = " << mparams.maxh << "\n"
err = 0; //- MESHCONST_ANALYSE isn't so important step
if ( !ngMesh )
return false;
- ngLib->setMesh(( Ng_Mesh*) ngMesh );
+ ngLib.setMesh(( Ng_Mesh*) ngMesh );
ngMesh->ClearFaceDescriptors(); // we make descriptors our-self
err = 0; // no fatal errors, only warnings
}
+ ngLib._isComputeOk = !err;
+
return !err;
}
NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper()
{
Ng_Init();
- myOutputFile = getOutputFileName();
- netgen::mycout = new ofstream ( myOutputFile.c_str() );
- cout << "NOTE: netgen output was redirected to file " << myOutputFile << endl;
+
+ _isComputeOk = false;
+ _outputFileName = getOutputFileName();
+ netgen::mycout = new ofstream ( _outputFileName.c_str() );
+ cout << "NOTE: netgen output was redirected to file " << _outputFileName << endl;
+
_ngMesh = Ng_NewMesh();
}
Ng_DeleteMesh( _ngMesh );
Ng_Exit();
NETGENPlugin_Mesher::RemoveTmpFiles();
- if( isComputeOk )
- RemoveOutputFile();
+ if( _isComputeOk )
+ removeOutputFile();
}
//================================================================================
*/
//================================================================================
-void NETGENPlugin_NetgenLibWrapper::RemoveOutputFile()
+void NETGENPlugin_NetgenLibWrapper::removeOutputFile()
{
- string tmpDir = SALOMEDS_Tool::GetDirFromPath( myOutputFile );
+ string tmpDir = SALOMEDS_Tool::GetDirFromPath( _outputFileName );
SALOMEDS::ListOfFileNames_var aFiles = new SALOMEDS::ListOfFileNames;
aFiles->length(1);
- std::string aFileName = SALOMEDS_Tool::GetNameFromPath( myOutputFile ) + ".out";
+ std::string aFileName = SALOMEDS_Tool::GetNameFromPath( _outputFileName ) + ".out";
aFiles[0] = aFileName.c_str();
if ( netgen::mycout)
{
class SMESH_Comment;
class SMESHDS_Mesh;
class TopoDS_Shape;
-class TopTools_DataMapOfShapeShape;
class TopTools_IndexedMapOfShape;
class NETGENPlugin_Hypothesis;
class NETGENPlugin_SimpleHypothesis_2D;
struct NETGENPLUGIN_EXPORT NETGENPlugin_NetgenLibWrapper
{
- std::string myOutputFile;
- bool isComputeOk;
+ bool _isComputeOk;
nglib::Ng_Mesh * _ngMesh;
+
NETGENPlugin_NetgenLibWrapper();
~NETGENPlugin_NetgenLibWrapper();
void setMesh( nglib::Ng_Mesh* mesh );
+
+ private:
std::string getOutputFileName();
- void RemoveOutputFile();
+ void removeOutputFile();
+ std::string _outputFileName;
};
//=============================================================================
const std::string& pyFile); // debug
private:
- bool _compute( NETGENPlugin_NetgenLibWrapper* ngLib );
SMESH_Mesh* _mesh;
const TopoDS_Shape& _shape;
bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape)
{
-#ifdef WITH_SMESH_CANCEL_COMPUTE
netgen::multithread.terminate = 0;
-#endif
- MESSAGE("NETGENPlugin_NETGEN_2D_ONLY::Compute()");
SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
int faceID = meshDS->ShapeToIndex( aShape );
#else
err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
#endif
-#ifdef WITH_SMESH_CANCEL_COMPUTE
if(netgen::multithread.terminate)
return false;
-#endif
if ( err )
error(SMESH_Comment("Error in netgen::OCCGenerateMesh() at ") << netgen::multithread.task);
}
}
}
+ ngLib._isComputeOk = !err;
return !err;
}
-#ifdef WITH_SMESH_CANCEL_COMPUTE
void NETGENPlugin_NETGEN_2D_ONLY::CancelCompute()
{
SMESH_Algo::CancelCompute();
netgen::multithread.terminate = 1;
}
-#endif
//=============================================================================
/*!
// Generate the volume mesh
// -------------------------
- return compute( aMesh, helper, nodeVec, Netgen_mesh);
+ return ( ngLib._isComputeOk = compute( aMesh, helper, nodeVec, Netgen_mesh));
}
//================================================================================
// Generate the volume mesh
// -------------------------
- return compute( aMesh, *aHelper, nodeVec, Netgen_mesh);
+ return ( ngLib._isComputeOk = compute( aMesh, *aHelper, nodeVec, Netgen_mesh));
}
void NETGENPlugin_NETGEN_3D::CancelCompute()