return aMesh;
}
+//================================================================================
+/*!
+ * \brief Compute submesh
+ * \param sm - submesh
+ * \retval bool - is a success
+ */
+//================================================================================
+
+bool SMESH_Gen::Compute(::SMESH_subMesh& sm)
+{
+ if ( sm.GetSubShape().ShapeType() == TopAbs_VERTEX )
+ {
+ SMESHDS_SubMesh* smDS = sm.GetSubMeshDS();
+ if ( !smDS || !smDS->NbNodes() ) {
+ TopoDS_Vertex V = TopoDS::Vertex(sm.GetSubShape());
+ gp_Pnt P = BRep_Tool::Pnt(V);
+ SMESHDS_Mesh * meshDS = sm.GetFather()->GetMeshDS();
+ if ( SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z()) )
+ meshDS->SetNodeOnVertex(node, V);
+ }
+ }
+ return sm.ComputeStateEngine(SMESH_subMesh::COMPUTE);
+}
+
//=============================================================================
/*!
*
SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
- if ( sm->GetComputeState() == SMESH_subMesh::COMPUTE_OK )
- return true; // already computed
+// if ( sm->GetComputeState() == SMESH_subMesh::COMPUTE_OK )
+// return true; // already computed
// -----------------------------------------------------------------
// apply algos that do not require descretized boundaries, starting
smToCompute = sm;
else
smToCompute = (itSub++)->second;
+
if (smToCompute->GetComputeState() != SMESH_subMesh::READY_TO_COMPUTE) {
if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
ret = false;
- continue;
- }
- TopoDS_Shape subShape = smToCompute->GetSubShape();
- if ( subShape.ShapeType() != TopAbs_VERTEX )
- {
- if ( !smToCompute->ComputeStateEngine(SMESH_subMesh::COMPUTE) )
- ret = false;
}
- else
- {
- TopoDS_Vertex V1 = TopoDS::Vertex(subShape);
- gp_Pnt P1 = BRep_Tool::Pnt(V1);
- SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
- SMDS_MeshNode * node = meshDS->AddNode(P1.X(), P1.Y(), P1.Z());
- if ( node ) { // san - increase robustness
- meshDS->SetNodeOnVertex(node, V1);
- smToCompute->ComputeStateEngine(SMESH_subMesh::COMPUTE);
- }
+ else if ( !Compute( *smToCompute )) {
+ ret = false;
}
}
// --------------------------------------------------------
- // find a global algo possibly hidding sub-algos
+ // find a global algo possibly hiding sub-algos
int dim;
const SMESH_Algo* aGlobIgnoAlgo = 0;
for (dim = 3; dim > 0; dim--)
aCheckedMap.clear();
smToCheck = sm;
revItSub = smMap.rbegin();
- bool checkNoAlgo = (bool) aTopAlgoDim;
+ bool checkNoAlgo = theMesh.HasShapeToMesh() ? bool( aTopAlgoDim ) : false;
bool globalChecked[] = { false, false, false, false };
// loop on theShape and its sub-shapes
#include "SMESH_Hypothesis.hxx"
#include "SMESH_Algo.hxx"
+#include "SMESH_0D_Algo.hxx"
#include "SMESH_1D_Algo.hxx"
#include "SMESH_2D_Algo.hxx"
#include "SMESH_3D_Algo.hxx"
typedef struct studyContextStruct
{
- std::map < int, SMESH_Hypothesis * >mapHypothesis;
- std::map < int, SMESH_Mesh * >mapMesh;
- SMESHDS_Document * myDocument;
+ std::map < int, SMESH_Hypothesis * >mapHypothesis;
+ std::map < int, SMESH_Mesh * >mapMesh;
+ SMESHDS_Document * myDocument;
} StudyContextStruct;
class SMESH_Gen
SMESH_Mesh* CreateMesh(int theStudyId, bool theIsEmbeddedMode)
throw(SALOME_Exception);
bool Compute(::SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
+ bool Compute(::SMESH_subMesh& aSubMesh);
bool CheckAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
// notify on bad state of attached algos, return false
int GetANewId();
std::map < int, SMESH_Algo * >_mapAlgo;
+ std::map < int, SMESH_0D_Algo * >_map0D_Algo;
std::map < int, SMESH_1D_Algo * >_map1D_Algo;
std::map < int, SMESH_2D_Algo * >_map2D_Algo;
std::map < int, SMESH_3D_Algo * >_map3D_Algo;