mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-03-01 14:05:37 +05:00
PAL13639 (EDF PAL 317 : SMESH : Create "0D Hypothesis")
add Compute(SMESH_subMesh) and a map of 0D algos
This commit is contained in:
parent
f3fa084ed2
commit
e05bacd4fa
@ -122,6 +122,30 @@ SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode)
|
|||||||
return aMesh;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
@ -158,8 +182,8 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
|
|||||||
|
|
||||||
SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
|
SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
|
||||||
|
|
||||||
if ( sm->GetComputeState() == SMESH_subMesh::COMPUTE_OK )
|
// if ( sm->GetComputeState() == SMESH_subMesh::COMPUTE_OK )
|
||||||
return true; // already computed
|
// return true; // already computed
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
// apply algos that do not require descretized boundaries, starting
|
// apply algos that do not require descretized boundaries, starting
|
||||||
@ -211,28 +235,14 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
|
|||||||
smToCompute = sm;
|
smToCompute = sm;
|
||||||
else
|
else
|
||||||
smToCompute = (itSub++)->second;
|
smToCompute = (itSub++)->second;
|
||||||
|
|
||||||
if (smToCompute->GetComputeState() != SMESH_subMesh::READY_TO_COMPUTE) {
|
if (smToCompute->GetComputeState() != SMESH_subMesh::READY_TO_COMPUTE) {
|
||||||
if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
|
if (smToCompute->GetComputeState() == SMESH_subMesh::FAILED_TO_COMPUTE)
|
||||||
ret = false;
|
ret = false;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
TopoDS_Shape subShape = smToCompute->GetSubShape();
|
else if ( !Compute( *smToCompute )) {
|
||||||
if ( subShape.ShapeType() != TopAbs_VERTEX )
|
|
||||||
{
|
|
||||||
if ( !smToCompute->ComputeStateEngine(SMESH_subMesh::COMPUTE) )
|
|
||||||
ret = false;
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MESSAGE( "VSR - SMESH_Gen::Compute() finished, OK = " << ret);
|
MESSAGE( "VSR - SMESH_Gen::Compute() finished, OK = " << ret);
|
||||||
@ -496,7 +506,7 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh,
|
|||||||
// --------------------------------------------------------
|
// --------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
// find a global algo possibly hidding sub-algos
|
// find a global algo possibly hiding sub-algos
|
||||||
int dim;
|
int dim;
|
||||||
const SMESH_Algo* aGlobIgnoAlgo = 0;
|
const SMESH_Algo* aGlobIgnoAlgo = 0;
|
||||||
for (dim = 3; dim > 0; dim--)
|
for (dim = 3; dim > 0; dim--)
|
||||||
@ -564,7 +574,7 @@ bool SMESH_Gen::GetAlgoState(SMESH_Mesh& theMesh,
|
|||||||
aCheckedMap.clear();
|
aCheckedMap.clear();
|
||||||
smToCheck = sm;
|
smToCheck = sm;
|
||||||
revItSub = smMap.rbegin();
|
revItSub = smMap.rbegin();
|
||||||
bool checkNoAlgo = (bool) aTopAlgoDim;
|
bool checkNoAlgo = theMesh.HasShapeToMesh() ? bool( aTopAlgoDim ) : false;
|
||||||
bool globalChecked[] = { false, false, false, false };
|
bool globalChecked[] = { false, false, false, false };
|
||||||
|
|
||||||
// loop on theShape and its sub-shapes
|
// loop on theShape and its sub-shapes
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include "SMESH_Hypothesis.hxx"
|
#include "SMESH_Hypothesis.hxx"
|
||||||
#include "SMESH_Algo.hxx"
|
#include "SMESH_Algo.hxx"
|
||||||
|
#include "SMESH_0D_Algo.hxx"
|
||||||
#include "SMESH_1D_Algo.hxx"
|
#include "SMESH_1D_Algo.hxx"
|
||||||
#include "SMESH_2D_Algo.hxx"
|
#include "SMESH_2D_Algo.hxx"
|
||||||
#include "SMESH_3D_Algo.hxx"
|
#include "SMESH_3D_Algo.hxx"
|
||||||
@ -63,6 +64,7 @@ class SMESH_Gen
|
|||||||
SMESH_Mesh* CreateMesh(int theStudyId, bool theIsEmbeddedMode)
|
SMESH_Mesh* CreateMesh(int theStudyId, bool theIsEmbeddedMode)
|
||||||
throw(SALOME_Exception);
|
throw(SALOME_Exception);
|
||||||
bool Compute(::SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
|
bool Compute(::SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
|
||||||
|
bool Compute(::SMESH_subMesh& aSubMesh);
|
||||||
|
|
||||||
bool CheckAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
|
bool CheckAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
|
||||||
// notify on bad state of attached algos, return false
|
// notify on bad state of attached algos, return false
|
||||||
@ -116,6 +118,7 @@ class SMESH_Gen
|
|||||||
int GetANewId();
|
int GetANewId();
|
||||||
|
|
||||||
std::map < int, SMESH_Algo * >_mapAlgo;
|
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_1D_Algo * >_map1D_Algo;
|
||||||
std::map < int, SMESH_2D_Algo * >_map2D_Algo;
|
std::map < int, SMESH_2D_Algo * >_map2D_Algo;
|
||||||
std::map < int, SMESH_3D_Algo * >_map3D_Algo;
|
std::map < int, SMESH_3D_Algo * >_map3D_Algo;
|
||||||
|
Loading…
Reference in New Issue
Block a user