Merge remote branch 'origin/V7_dev'

This commit is contained in:
vsr 2016-05-24 18:33:55 +03:00
commit ee38aeb99f
8 changed files with 59 additions and 54 deletions

View File

@ -65,7 +65,6 @@ NETGENPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
SMESH_Hypothesis_i( thePOA ), SMESH_Hypothesis_i( thePOA ),
mySetMethodFlags(0) mySetMethodFlags(0)
{ {
MESSAGE( "NETGENPlugin_Hypothesis_i::NETGENPlugin_Hypothesis_i" );
myBaseImpl = new ::NETGENPlugin_Hypothesis (theGenImpl->GetANewId(), myBaseImpl = new ::NETGENPlugin_Hypothesis (theGenImpl->GetANewId(),
theStudyId, theStudyId,
theGenImpl); theGenImpl);
@ -80,7 +79,6 @@ NETGENPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
//============================================================================= //=============================================================================
NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i() NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i()
{ {
MESSAGE( "NETGENPlugin_Hypothesis_i::~NETGENPlugin_Hypothesis_i" );
} }
//============================================================================= //=============================================================================

View File

@ -572,9 +572,6 @@ void NETGENPlugin_Mesher::PrepareOCCgeometry(netgen::OCCGeometry& occgeo,
BRepBndLib::Add (shape, bb); BRepBndLib::Add (shape, bb);
double x1,y1,z1,x2,y2,z2; double x1,y1,z1,x2,y2,z2;
bb.Get (x1,y1,z1,x2,y2,z2); bb.Get (x1,y1,z1,x2,y2,z2);
MESSAGE("shape bounding box:\n" <<
"(" << x1 << " " << y1 << " " << z1 << ") " <<
"(" << x2 << " " << y2 << " " << z2 << ")");
netgen::Point<3> p1 = netgen::Point<3> (x1,y1,z1); netgen::Point<3> p1 = netgen::Point<3> (x1,y1,z1);
netgen::Point<3> p2 = netgen::Point<3> (x2,y2,z2); netgen::Point<3> p2 = netgen::Point<3> (x2,y2,z2);
occgeo.boundingbox = netgen::Box<3> (p1,p2); occgeo.boundingbox = netgen::Box<3> (p1,p2);
@ -1824,7 +1821,7 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh,
int edgeID = 1, posID = -2; int edgeID = 1, posID = -2;
bool isInternalWire = false; bool isInternalWire = false;
double vertexNormPar = 0; double vertexNormPar = 0;
//const int prevNbNGSeg = ngMesh.GetNSeg(); const int prevNbNGSeg = ngMesh.GetNSeg();
for ( int i = 0; i < nbSegments; ++i ) // loop on segments for ( int i = 0; i < nbSegments; ++i ) // loop on segments
{ {
// Add the first point of a segment // Add the first point of a segment
@ -1962,6 +1959,8 @@ NETGENPlugin_Mesher::AddSegmentsToMesh(netgen::Mesh& ngMesh,
<< "\tp1 edge: " << seg.epgeominfo[ 1 ].edgenr << endl; << "\tp1 edge: " << seg.epgeominfo[ 1 ].edgenr << endl;
} }
cout << "--END WIRE " << iW << endl; cout << "--END WIRE " << iW << endl;
#else
SMESH_Comment __not_unused_variable( prevNbNGSeg );
#endif #endif
} // loop on WIREs of a FACE } // loop on WIREs of a FACE
@ -2708,7 +2707,8 @@ bool NETGENPlugin_Mesher::Compute()
} }
// Build viscous layers // Build viscous layers
if ( _isViscousLayers2D ) if ( _isViscousLayers2D ||
StdMeshers_ViscousLayers2D::HasProxyMesh( TopoDS::Face( occgeo.fmap(1) ), *_mesh ))
{ {
if ( !internals.hasInternalVertexInFace() ) { if ( !internals.hasInternalVertexInFace() ) {
FillSMesh( occgeo, *_ngMesh, initState, *_mesh, nodeVec, comment ); FillSMesh( occgeo, *_ngMesh, initState, *_mesh, nodeVec, comment );
@ -2722,6 +2722,8 @@ bool NETGENPlugin_Mesher::Compute()
viscousMesh = StdMeshers_ViscousLayers2D::Compute( *_mesh, F ); viscousMesh = StdMeshers_ViscousLayers2D::Compute( *_mesh, F );
if ( !viscousMesh ) if ( !viscousMesh )
return false; return false;
if ( viscousMesh->NbProxySubMeshes() == 0 )
continue;
// exclude from computation ng segments built on EDGEs of F // exclude from computation ng segments built on EDGEs of F
for (int i = 1; i <= _ngMesh->GetNSeg(); i++) for (int i = 1; i <= _ngMesh->GetNSeg(); i++)
{ {
@ -2951,12 +2953,6 @@ bool NETGENPlugin_Mesher::Compute()
int nbVol = _ngMesh->GetNE(); int nbVol = _ngMesh->GetNE();
bool isOK = ( !err && (_isVolume ? (nbVol > 0) : (nbFac > 0)) ); bool isOK = ( !err && (_isVolume ? (nbVol > 0) : (nbFac > 0)) );
MESSAGE((err ? "Mesh Generation failure" : "End of Mesh Generation") <<
", nb nodes: " << nbNod <<
", nb segments: " << nbSeg <<
", nb faces: " << nbFac <<
", nb volumes: " << nbVol);
// Feed back the SMESHDS with the generated Nodes and Elements // Feed back the SMESHDS with the generated Nodes and Elements
if ( true /*isOK*/ ) // get whatever built if ( true /*isOK*/ ) // get whatever built
{ {
@ -3372,26 +3368,6 @@ double NETGENPlugin_Mesher::GetProgress(const SMESH_Algo* holder,
return Min( progress, 0.99 ); return Min( progress, 0.99 );
} }
//================================================================================
/*!
* \brief Remove "test.out" and "problemfaces" files in current directory
*/
//================================================================================
void NETGENPlugin_Mesher::RemoveTmpFiles()
{
bool rm = SMESH_File("test.out").remove() ;
#ifndef WIN32
if (rm && netgen::testout)
{
delete netgen::testout;
netgen::testout = 0;
}
#endif
SMESH_File("problemfaces").remove();
SMESH_File("occmesh.rep").remove();
}
//================================================================================ //================================================================================
/*! /*!
* \brief Read mesh entities preventing successful computation from "test.out" file * \brief Read mesh entities preventing successful computation from "test.out" file
@ -3942,6 +3918,18 @@ SMESH_Mesh& NETGENPlugin_Internals::getMesh() const
return const_cast<SMESH_Mesh&>( _mesh ); return const_cast<SMESH_Mesh&>( _mesh );
} }
//================================================================================
/*!
* \brief Access to a counter of NETGENPlugin_NetgenLibWrapper instances
*/
//================================================================================
int& NETGENPlugin_NetgenLibWrapper::instanceCounter()
{
static int theCouner = 0;
return theCouner;
}
//================================================================================ //================================================================================
/*! /*!
* \brief Initialize netgen library * \brief Initialize netgen library
@ -3950,14 +3938,21 @@ SMESH_Mesh& NETGENPlugin_Internals::getMesh() const
NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper() NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper()
{ {
if ( instanceCounter() == 0 )
Ng_Init(); Ng_Init();
++instanceCounter();
_isComputeOk = false; _isComputeOk = false;
_coutBuffer = NULL; _coutBuffer = NULL;
_ngcout = NULL;
_ngcerr = NULL;
if ( !getenv( "KEEP_NETGEN_OUTPUT" )) if ( !getenv( "KEEP_NETGEN_OUTPUT" ))
{ {
// redirect all netgen output (mycout,myerr,cout) to _outputFileName // redirect all netgen output (mycout,myerr,cout) to _outputFileName
_outputFileName = getOutputFileName(); _outputFileName = getOutputFileName();
_ngcout = netgen::mycout;
_ngcerr = netgen::myerr;
netgen::mycout = new ofstream ( _outputFileName.c_str() ); netgen::mycout = new ofstream ( _outputFileName.c_str() );
netgen::myerr = netgen::mycout; netgen::myerr = netgen::mycout;
_coutBuffer = std::cout.rdbuf(); _coutBuffer = std::cout.rdbuf();
@ -3979,9 +3974,11 @@ NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper()
NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper() NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper()
{ {
--instanceCounter();
Ng_DeleteMesh( _ngMesh ); Ng_DeleteMesh( _ngMesh );
Ng_Exit(); Ng_Exit();
NETGENPlugin_Mesher::RemoveTmpFiles(); RemoveTmpFiles();
if ( _coutBuffer ) if ( _coutBuffer )
std::cout.rdbuf( _coutBuffer ); std::cout.rdbuf( _coutBuffer );
#ifdef _DEBUG_ #ifdef _DEBUG_
@ -4027,6 +4024,26 @@ std::string NETGENPlugin_NetgenLibWrapper::getOutputFileName()
return aGenericName.ToCString(); return aGenericName.ToCString();
} }
//================================================================================
/*!
* \brief Remove "test.out" and "problemfaces" files in current directory
*/
//================================================================================
void NETGENPlugin_NetgenLibWrapper::RemoveTmpFiles()
{
bool rm = SMESH_File("test.out").remove() ;
#ifndef WIN32
if ( rm && netgen::testout && instanceCounter() == 0 )
{
delete netgen::testout;
netgen::testout = 0;
}
#endif
SMESH_File("problemfaces").remove();
SMESH_File("occmesh.rep").remove();
}
//================================================================================ //================================================================================
/*! /*!
* \brief Remove file with netgen output * \brief Remove file with netgen output
@ -4037,11 +4054,12 @@ void NETGENPlugin_NetgenLibWrapper::removeOutputFile()
{ {
if ( !_outputFileName.empty() ) if ( !_outputFileName.empty() )
{ {
if ( netgen::mycout ) if ( _ngcout )
{ {
delete netgen::mycout; delete netgen::mycout;
netgen::mycout = 0; netgen::mycout = _ngcout;
netgen::myerr = 0; netgen::myerr = _ngcerr;
_ngcout = 0;
} }
string tmpDir = SALOMEDS_Tool::GetDirFromPath ( _outputFileName ); string tmpDir = SALOMEDS_Tool::GetDirFromPath ( _outputFileName );
string aFileName = SALOMEDS_Tool::GetNameFromPath( _outputFileName ) + ".out"; string aFileName = SALOMEDS_Tool::GetNameFromPath( _outputFileName ) + ".out";

View File

@ -88,11 +88,16 @@ struct NETGENPLUGIN_EXPORT NETGENPlugin_NetgenLibWrapper
~NETGENPlugin_NetgenLibWrapper(); ~NETGENPlugin_NetgenLibWrapper();
void setMesh( nglib::Ng_Mesh* mesh ); void setMesh( nglib::Ng_Mesh* mesh );
static void RemoveTmpFiles();
static int& instanceCounter();
private: private:
std::string getOutputFileName(); std::string getOutputFileName();
void removeOutputFile(); void removeOutputFile();
std::string _outputFileName; std::string _outputFileName;
ostream * _ngcout;
ostream * _ngcerr;
std::streambuf* _coutBuffer; // to re-/store cout.rdbuf() std::streambuf* _coutBuffer; // to re-/store cout.rdbuf()
}; };
@ -181,8 +186,6 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Mesher
void SetDefaultParameters(); void SetDefaultParameters();
static void RemoveTmpFiles();
static SMESH_ComputeErrorPtr ReadErrors(const std::vector< const SMDS_MeshNode* >& nodeVec); static SMESH_ComputeErrorPtr ReadErrors(const std::vector< const SMDS_MeshNode* >& nodeVec);

View File

@ -58,7 +58,6 @@ NETGENPlugin_NETGEN_2D::NETGENPlugin_NETGEN_2D(int hypId, int studyId,
SMESH_Gen* gen) SMESH_Gen* gen)
: SMESH_2D_Algo(hypId, studyId, gen) : SMESH_2D_Algo(hypId, studyId, gen)
{ {
MESSAGE("NETGENPlugin_NETGEN_2D::NETGENPlugin_NETGEN_2D");
_name = "NETGEN_2D"; _name = "NETGEN_2D";
_shapeType = (1 << TopAbs_FACE); // 1 bit /shape type _shapeType = (1 << TopAbs_FACE); // 1 bit /shape type
_compatibleHypothesis.push_back("NETGEN_Parameters_2D"); _compatibleHypothesis.push_back("NETGEN_Parameters_2D");
@ -78,7 +77,6 @@ NETGENPlugin_NETGEN_2D::NETGENPlugin_NETGEN_2D(int hypId, int studyId,
NETGENPlugin_NETGEN_2D::~NETGENPlugin_NETGEN_2D() NETGENPlugin_NETGEN_2D::~NETGENPlugin_NETGEN_2D()
{ {
MESSAGE("NETGENPlugin_NETGEN_2D::~NETGENPlugin_NETGEN_2D");
} }
//============================================================================= //=============================================================================

View File

@ -50,7 +50,6 @@ NETGENPlugin_NETGEN_2D_i::NETGENPlugin_NETGEN_2D_i( PortableServer::POA_ptr theP
SMESH_Algo_i( thePOA ), SMESH_Algo_i( thePOA ),
SMESH_2D_Algo_i( thePOA ) SMESH_2D_Algo_i( thePOA )
{ {
MESSAGE( "NETGENPlugin_NETGEN_2D_i::NETGENPlugin_NETGEN_2D_i" );
myBaseImpl = new ::NETGENPlugin_NETGEN_2D( theGenImpl->GetANewId(), myBaseImpl = new ::NETGENPlugin_NETGEN_2D( theGenImpl->GetANewId(),
theStudyId, theStudyId,
theGenImpl ); theGenImpl );
@ -66,7 +65,6 @@ NETGENPlugin_NETGEN_2D_i::NETGENPlugin_NETGEN_2D_i( PortableServer::POA_ptr theP
NETGENPlugin_NETGEN_2D_i::~NETGENPlugin_NETGEN_2D_i() NETGENPlugin_NETGEN_2D_i::~NETGENPlugin_NETGEN_2D_i()
{ {
MESSAGE( "NETGENPlugin_NETGEN_2D_i::~NETGENPlugin_NETGEN_2D_i" );
} }
//============================================================================= //=============================================================================
@ -79,6 +77,5 @@ NETGENPlugin_NETGEN_2D_i::~NETGENPlugin_NETGEN_2D_i()
::NETGENPlugin_NETGEN_2D* NETGENPlugin_NETGEN_2D_i::GetImpl() ::NETGENPlugin_NETGEN_2D* NETGENPlugin_NETGEN_2D_i::GetImpl()
{ {
MESSAGE( "NETGENPlugin_NETGEN_2D_i::GetImpl" );
return ( ::NETGENPlugin_NETGEN_2D* )myBaseImpl; return ( ::NETGENPlugin_NETGEN_2D* )myBaseImpl;
} }

View File

@ -96,7 +96,6 @@ NETGENPlugin_NETGEN_3D::NETGENPlugin_NETGEN_3D(int hypId, int studyId,
SMESH_Gen* gen) SMESH_Gen* gen)
: SMESH_3D_Algo(hypId, studyId, gen) : SMESH_3D_Algo(hypId, studyId, gen)
{ {
MESSAGE("NETGENPlugin_NETGEN_3D::NETGENPlugin_NETGEN_3D");
_name = "NETGEN_3D"; _name = "NETGEN_3D";
_shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type
_compatibleHypothesis.push_back("MaxElementVolume"); _compatibleHypothesis.push_back("MaxElementVolume");
@ -120,7 +119,6 @@ NETGENPlugin_NETGEN_3D::NETGENPlugin_NETGEN_3D(int hypId, int studyId,
NETGENPlugin_NETGEN_3D::~NETGENPlugin_NETGEN_3D() NETGENPlugin_NETGEN_3D::~NETGENPlugin_NETGEN_3D()
{ {
MESSAGE("NETGENPlugin_NETGEN_3D::~NETGENPlugin_NETGEN_3D");
} }
//============================================================================= //=============================================================================
@ -133,8 +131,6 @@ bool NETGENPlugin_NETGEN_3D::CheckHypothesis (SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape, const TopoDS_Shape& aShape,
Hypothesis_Status& aStatus) Hypothesis_Status& aStatus)
{ {
MESSAGE("NETGENPlugin_NETGEN_3D::CheckHypothesis");
_hypMaxElementVolume = NULL; _hypMaxElementVolume = NULL;
_hypParameters = NULL; _hypParameters = NULL;
_viscousLayersHyp = NULL; _viscousLayersHyp = NULL;

View File

@ -51,7 +51,6 @@ NETGENPlugin_NETGEN_3D_i::NETGENPlugin_NETGEN_3D_i( PortableServer::POA_ptr theP
SMESH_Algo_i( thePOA ), SMESH_Algo_i( thePOA ),
SMESH_3D_Algo_i( thePOA ) SMESH_3D_Algo_i( thePOA )
{ {
MESSAGE( "NETGENPlugin_NETGEN_3D_i::NETGENPlugin_NETGEN_3D_i" );
myBaseImpl = new ::NETGENPlugin_NETGEN_3D( theGenImpl->GetANewId(), myBaseImpl = new ::NETGENPlugin_NETGEN_3D( theGenImpl->GetANewId(),
theStudyId, theStudyId,
theGenImpl ); theGenImpl );
@ -67,7 +66,6 @@ NETGENPlugin_NETGEN_3D_i::NETGENPlugin_NETGEN_3D_i( PortableServer::POA_ptr theP
NETGENPlugin_NETGEN_3D_i::~NETGENPlugin_NETGEN_3D_i() NETGENPlugin_NETGEN_3D_i::~NETGENPlugin_NETGEN_3D_i()
{ {
MESSAGE( "NETGENPlugin_NETGEN_3D_i::~NETGENPlugin_NETGEN_3D_i" );
} }
//============================================================================= //=============================================================================
@ -80,7 +78,6 @@ NETGENPlugin_NETGEN_3D_i::~NETGENPlugin_NETGEN_3D_i()
::NETGENPlugin_NETGEN_3D* NETGENPlugin_NETGEN_3D_i::GetImpl() ::NETGENPlugin_NETGEN_3D* NETGENPlugin_NETGEN_3D_i::GetImpl()
{ {
MESSAGE( "NETGENPlugin_NETGEN_3D_i::GetImpl" );
return ( ::NETGENPlugin_NETGEN_3D* )myBaseImpl; return ( ::NETGENPlugin_NETGEN_3D* )myBaseImpl;
} }

View File

@ -56,8 +56,6 @@ extern "C"
NETGENPLUGIN_EXPORT NETGENPLUGIN_EXPORT
GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName) GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName)
{ {
MESSAGE("GetHypothesisCreator " << aHypName);
GenericHypothesisCreator_i* aCreator = 0; GenericHypothesisCreator_i* aCreator = 0;
// Hypotheses // Hypotheses