BRepBndLib::Add (shape, bb);
double 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> p2 = netgen::Point<3> (x2,y2,z2);
occgeo.boundingbox = netgen::Box<3> (p1,p2);
int edgeID = 1, posID = -2;
bool isInternalWire = false;
double vertexNormPar = 0;
- //const int prevNbNGSeg = ngMesh.GetNSeg();
+ const int prevNbNGSeg = ngMesh.GetNSeg();
for ( int i = 0; i < nbSegments; ++i ) // loop on segments
{
// Add the first point of a segment
<< "\tp1 edge: " << seg.epgeominfo[ 1 ].edgenr << endl;
}
cout << "--END WIRE " << iW << endl;
+#else
+ SMESH_Comment __not_unused_variable( prevNbNGSeg );
#endif
} // loop on WIREs of a FACE
}
// Build viscous layers
- if ( _isViscousLayers2D )
+ if ( _isViscousLayers2D ||
+ StdMeshers_ViscousLayers2D::HasProxyMesh( TopoDS::Face( occgeo.fmap(1) ), *_mesh ))
{
if ( !internals.hasInternalVertexInFace() ) {
FillSMesh( occgeo, *_ngMesh, initState, *_mesh, nodeVec, comment );
viscousMesh = StdMeshers_ViscousLayers2D::Compute( *_mesh, F );
if ( !viscousMesh )
return false;
+ if ( viscousMesh->NbProxySubMeshes() == 0 )
+ continue;
// exclude from computation ng segments built on EDGEs of F
for (int i = 1; i <= _ngMesh->GetNSeg(); i++)
{
int nbVol = _ngMesh->GetNE();
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
if ( true /*isOK*/ ) // get whatever built
{
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
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
NETGENPlugin_NetgenLibWrapper::NETGENPlugin_NetgenLibWrapper()
{
- Ng_Init();
+ if ( instanceCounter() == 0 )
+ Ng_Init();
+
+ ++instanceCounter();
_isComputeOk = false;
_coutBuffer = NULL;
+ _ngcout = NULL;
+ _ngcerr = NULL;
if ( !getenv( "KEEP_NETGEN_OUTPUT" ))
{
// redirect all netgen output (mycout,myerr,cout) to _outputFileName
_outputFileName = getOutputFileName();
+ _ngcout = netgen::mycout;
+ _ngcerr = netgen::myerr;
netgen::mycout = new ofstream ( _outputFileName.c_str() );
netgen::myerr = netgen::mycout;
_coutBuffer = std::cout.rdbuf();
NETGENPlugin_NetgenLibWrapper::~NETGENPlugin_NetgenLibWrapper()
{
+ --instanceCounter();
+
Ng_DeleteMesh( _ngMesh );
Ng_Exit();
- NETGENPlugin_Mesher::RemoveTmpFiles();
+ RemoveTmpFiles();
if ( _coutBuffer )
std::cout.rdbuf( _coutBuffer );
#ifdef _DEBUG_
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
{
if ( !_outputFileName.empty() )
{
- if ( netgen::mycout )
+ if ( _ngcout )
{
delete netgen::mycout;
- netgen::mycout = 0;
- netgen::myerr = 0;
+ netgen::mycout = _ngcout;
+ netgen::myerr = _ngcerr;
+ _ngcout = 0;
}
string tmpDir = SALOMEDS_Tool::GetDirFromPath ( _outputFileName );
string aFileName = SALOMEDS_Tool::GetNameFromPath( _outputFileName ) + ".out";