#include "SMDS_VolumeOfNodes.hxx"
#include <StdMeshers_QuadToTriaAdaptor.hxx>
+#include <StdMeshers_ViscousLayers.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepBndLib.hxx>
_iShape=0;
_nbShape=0;
_compatibleHypothesis.push_back("GHS3D_Parameters");
+ _compatibleHypothesis.push_back( StdMeshers_ViscousLayers::GetHypType() );
_requireShape = false; // can work without shape
}
{
aStatus = SMESH_Hypothesis::HYP_OK;
- // there is only one compatible Hypothesis so far
_hyp = 0;
+ _viscousLayersHyp = 0;
_keepFiles = false;
- const list <const SMESHDS_Hypothesis * >& hyps = GetUsedHypothesis(aMesh, aShape);
- if ( !hyps.empty() )
- _hyp = static_cast<const GHS3DPlugin_Hypothesis*> ( hyps.front() );
+
+ const list <const SMESHDS_Hypothesis * >& hyps =
+ GetUsedHypothesis(aMesh, aShape, /*ignoreAuxiliary=*/false);
+ list <const SMESHDS_Hypothesis* >::const_iterator h = hyps.begin();
+ for ( ; h != hyps.end(); ++h )
+ {
+ if ( !_hyp )
+ _hyp = dynamic_cast< const GHS3DPlugin_Hypothesis*> ( *h );
+ if ( !_viscousLayersHyp )
+ _viscousLayersHyp = dynamic_cast< const StdMeshers_ViscousLayers*> ( *h );
+ }
if ( _hyp )
_keepFiles = _hyp->GetKeepFiles();
//purpose :
//=======================================================================
-template < class Mesh, class Shape >
-static int countShape( Mesh* mesh, Shape shape ) {
- TopExp_Explorer expShape ( mesh->ShapeToMesh(), shape );
- int nbShape = 0;
- for ( ; expShape.More(); expShape.Next() ) {
- nbShape++;
- }
- return nbShape;
-}
+// template < class Mesh, class Shape >
+// static int countShape( Mesh* mesh, Shape shape ) {
+// TopExp_Explorer expShape ( mesh->ShapeToMesh(), shape );
+// int nbShape = 0;
+// for ( ; expShape.More(); expShape.Next() ) {
+// nbShape++;
+// }
+// return nbShape;
+// }
//=======================================================================
//function : writeFaces
SMESHDS_Mesh* theMesh,
const TopoDS_Shape& theShape,
vector<StdMeshers_QuadToTriaAdaptor>& theQuad2Trias,
+ StdMeshers_ProxyMesh::Ptr& theCdfMesh,
const map <int,int> & theSmdsToGhs3dIdMap)
{
// record structure:
// NB_NODES NODE_NB_1 NODE_NB_2 ... (NB_NODES + 1) times: DUMMY_INT
TopoDS_Shape aShape;
- SMESHDS_SubMesh* theSubMesh;
+ const SMESHDS_SubMesh* theSubMesh;
const SMDS_MeshElement* aFace;
const char* space = " ";
const int dummyint = 0;
// 2 adaptors for each face in facesMap, as a face can belong to 2 solids
typedef vector< StdMeshers_QuadToTriaAdaptor* > TwoAdaptors;
vector< TwoAdaptors > qttaByFace;
- if ( theQuad2Trias.empty() )
+ if ( theCdfMesh )
+ {
+ for ( int i = 1; i <= facesMap.Extent(); ++i )
+ if (( theSubMesh = theCdfMesh->GetSubMesh( facesMap(i))))
+ nbTriangles += theSubMesh->NbElements();
+ }
+ else if ( theQuad2Trias.empty() )
{
// case w/o quadrangles
for ( int i = 1; i <= facesMap.Extent(); ++i )
for ( int i = 1; i <= facesMap.Extent(); i++ )
{
aShape = facesMap(i);
- theSubMesh = theMesh->MeshElements( aShape );
+ theSubMesh = theCdfMesh ? theCdfMesh->GetSubMesh( aShape ) : theMesh->MeshElements( aShape );
if ( !theSubMesh ) continue;
TwoAdaptors& aTwoAdaptors = qttaByFace[ i-1 ];
itOnSubMesh = theSubMesh->GetElements();
for (_iShape = 0, expBox.ReInit(); expBox.More(); expBox.Next())
aQuad2Trias[ _iShape++ ].Compute( theMesh, expBox.Current() );
}
+ // viscous layers
+ StdMeshers_ProxyMesh::Ptr cdfMesh;
+ if ( _viscousLayersHyp && aQuad2Trias.empty() )
+ {
+ cdfMesh = _viscousLayersHyp->Compute( theMesh, theShape );
+ if ( !cdfMesh )
+ return false;
+ }
Ok = (writePoints( aPointsFile, helper, aSmdsToGhs3dIdMap, aGhs3dIdToNodeMap, enforcedVertices) &&
- writeFaces ( aFacesFile, meshDS, theShape, aQuad2Trias, aSmdsToGhs3dIdMap ));
+ writeFaces ( aFacesFile, meshDS, theShape, aQuad2Trias, cdfMesh, aSmdsToGhs3dIdMap ));
// Write aSmdsToGhs3dIdMap to temp file
TCollection_AsciiString aSmdsToGhs3dIdMapFileName;