ADD_EDGE,
ADD_TRIANGLE,
ADD_QUADRANGLE,
+ ADD_POLYGON,
ADD_TETRAHEDRON,
ADD_PYRAMID,
ADD_PRISM,
ADD_HEXAHEDRON,
+ ADD_POLYHEDRON,
REMOVE_NODE,
REMOVE_ELEMENT,
MOVE_NODE,
CHANGE_ELEMENT_NODES,
+ CHANGE_POLYHEDRON_NODES,
RENUMBER
};
long NbQuadrangles()
raises (SALOME::SALOME_Exception);
+ long NbPolygones()
+ raises (SALOME::SALOME_Exception);
+
long NbVolumes()
raises (SALOME::SALOME_Exception);
long NbPrisms()
raises (SALOME::SALOME_Exception);
+ long NbPolyhedrones()
+ raises (SALOME::SALOME_Exception);
+
long NbSubMesh()
raises (SALOME::SALOME_Exception);
raises (SALOME::SALOME_Exception);
};
- /*
+ /*!
* This interface makes modifications on the Mesh - removing elements and nodes etc.
*/
interface NumericalFunctor;
boolean AddVolume(in long_array IDsOfNodes);
+ //boolean AddPolygonalFace (in long_array IdsOfNodes);
+
+ /*!
+ * Create volume of many faces, giving nodes for each face.
+ * \param IdsOfNodes List of node IDs for volume creation face by face.
+ * \param Quantities List of integer values, Quantities[i]
+ * gives quantity of nodes in face number i.
+ */
+ boolean AddPolyhedralVolume (in long_array IdsOfNodes,
+ in long_array Quantities);
+
+ /*!
+ * Create volume of many faces, giving IDs of existing faces.
+ * \param IdsOfFaces List of face IDs for volume creation.
+ * \note The created volume will refer only to nodes
+ * of the given faces, not to the faces itself.
+ */
+ boolean AddPolyhedralVolumeByFaces (in long_array IdsOfFaces);
+
boolean MoveNode(in long NodeID, in double x, in double y, in double z);
boolean InverseDiag(in long NodeID1, in long NodeID2);
return Nb;
}
+///////////////////////////////////////////////////////////////////////////////
+/// Return the number of polygone faces in the mesh. This method run in O(n)
+///////////////////////////////////////////////////////////////////////////////
+int SMESH_Mesh::NbPolygones() throw(SALOME_Exception)
+{
+ Unexpect aCatch(SalomeException);
+ int Nb = 0;
+
+ SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
+ while(itFaces->more()) if(itFaces->next()->IsPoly()) Nb++;
+ return Nb;
+}
+
//=============================================================================
/*!
*
return Nb;
}
+int SMESH_Mesh::NbPolyhedrones() throw(SALOME_Exception)
+{
+ Unexpect aCatch(SalomeException);
+ int Nb = 0;
+ SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
+ while(itVolumes->more()) if(itVolumes->next()->IsPoly()) Nb++;
+ return Nb;
+}
+
//=============================================================================
/*!
*
int NbTriangles() throw(SALOME_Exception);
int NbQuadrangles() throw(SALOME_Exception);
+
+ int NbPolygones() throw(SALOME_Exception);
int NbVolumes() throw(SALOME_Exception);
int NbHexas() throw(SALOME_Exception);
int NbPyramids() throw(SALOME_Exception);
+
+ int NbPolyhedrones() throw(SALOME_Exception);
int NbPrisms() throw(SALOME_Exception);
ASSERT(algo);
if (!algo->CheckHypothesis((*_father),_subShape, ret ))
{
+ //two applying algo on the same shape not allowed
+ _meshDS->RemoveHypothesis(_subShape, anHyp);
if ( !SMESH_Hypothesis::IsStatusFatal( ret ))
// ret should be fatal: anHyp was not added
ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
}
+ else if (SMESH_Hypothesis::IsStatusFatal( ret ))
+ {
+ _meshDS->RemoveHypothesis(_subShape, anHyp);
+ }
else if (!_father->IsUsedHypothesis( anHyp, _subShape ))
- ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
-
- if (SMESH_Hypothesis::IsStatusFatal( ret ))
{
- MESSAGE("do not add extra hypothesis");
_meshDS->RemoveHypothesis(_subShape, anHyp);
+ ret = SMESH_Hypothesis::HYP_INCOMPATIBLE;
}
else
{
}
case ADD_ALGO: { //already existing algo : on father ?
SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
- if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
- // check if algo changes
- SMESH_HypoFilter f;
- f.Init( SMESH_HypoFilter::IsAlgo() );
- f.And( SMESH_HypoFilter::IsApplicableTo( _subShape ));
- f.AndNot( SMESH_HypoFilter::Is( algo ));
- const SMESH_Hypothesis * prevAlgo = _father->GetHypothesis( _subShape, f, true );
- if (prevAlgo &&
- string(algo->GetName()) != string(prevAlgo->GetName()) )
- modifiedHyp = true;
- }
+ if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
+ SetAlgoState(HYP_OK);
else
SetAlgoState(MISSING_HYP);
+ modifiedHyp = true;
break;
}
case REMOVE_HYP: {
}
else
{
- if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
- // check if algo remains
- if ( anHyp != algo && strcmp( anHyp->GetName(), algo->GetName()) )
- modifiedHyp = true;
- }
+ if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
+ SetAlgoState(HYP_OK);
else
SetAlgoState(MISSING_HYP);
+ // check if same algo remains
+ if ( anHyp != algo && strcmp( anHyp->GetName(), algo->GetName()) )
+ modifiedHyp = true;
}
break;
}
ASSERT(algo);
if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
{
+ SetAlgoState(HYP_OK);
if (_father->IsUsedHypothesis( anHyp, _subShape )) // new Hyp
modifiedHyp = true;
}
SetAlgoState(MISSING_HYP);
break;
}
- case ADD_FATHER_ALGO: {
+ case ADD_FATHER_ALGO: { // a new algo on father
SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
- if ( algo == anHyp ) { // a new algo on father
- if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
- // check if algo changes
- SMESH_HypoFilter f;
- f.Init( SMESH_HypoFilter::IsAlgo() );
- f.And( SMESH_HypoFilter::IsApplicableTo( _subShape ));
- f.AndNot( SMESH_HypoFilter::Is( algo ));
- const SMESH_Hypothesis* prevAlgo = _father->GetHypothesis( _subShape, f, true );
- if (prevAlgo &&
- string(algo->GetName()) != string(prevAlgo->GetName()) )
- modifiedHyp = true;
- }
+ if ( algo == anHyp ) {
+ if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
+ SetAlgoState(HYP_OK);
else
SetAlgoState(MISSING_HYP);
+ modifiedHyp = true;
}
break;
}
case REMOVE_FATHER_HYP: {
SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape);
ASSERT(algo);
- if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
- // is there the same local hyp or maybe a new father algo applied?
- if ( !GetSimilarAttached( _subShape, anHyp ) )
- modifiedHyp = true;
- }
+ if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
+ SetAlgoState(HYP_OK);
else
SetAlgoState(MISSING_HYP);
+ // is there the same local hyp or maybe a new father algo applied?
+ if ( !GetSimilarAttached( _subShape, anHyp ) )
+ modifiedHyp = true;
break;
}
case REMOVE_FATHER_ALGO: {
}
else
{
- if ( algo->CheckHypothesis((*_father),_subShape, aux_ret )) {
- // check if algo changes
- if ( string(algo->GetName()) != string( anHyp->GetName()) )
- modifiedHyp = true;
- }
+ if ( algo->CheckHypothesis((*_father),_subShape, aux_ret ))
+ SetAlgoState(HYP_OK);
else
SetAlgoState(MISSING_HYP);
+ // is there the same local algo or maybe a new father algo applied?
+ if ( !GetSimilarAttached( _subShape, anHyp ))
+ modifiedHyp = true;
}
break;
}
void SMESH_subMesh::CleanDependants()
{
+ //MESSAGE("SMESH_subMesh::CleanDependants: shape type " << _subShape.ShapeType() );
+
TopTools_ListIteratorOfListOfShape it( _father->GetAncestors( _subShape ));
for (; it.More(); it.Next())
{
const TopoDS_Shape& ancestor = it.Value();
- // PAL8021. do not go upper than SOLID, else ComputeStateEngine(CLEANDEP)
- // will erase mesh on other shapes in a compound
- if ( ancestor.ShapeType() >= TopAbs_SOLID ) {
- SMESH_subMesh *aSubMesh = _father->GetSubMeshContaining(ancestor);
- if (aSubMesh)
- aSubMesh->ComputeStateEngine(CLEANDEP);
- }
+ //MESSAGE("ancestor shape type " << ancestor.ShapeType() );
+ SMESH_subMesh *aSubMesh = _father->GetSubMeshContaining(ancestor);
+ if (aSubMesh)
+ aSubMesh->ComputeStateEngine(CLEANDEP);
}
ComputeStateEngine(CLEAN);
}
+
//=============================================================================
/*!
*
//=============================================================================
/*!
- *
+ * AddFace
*/
//=============================================================================
CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array & IDsOfNodes)
{
- int NbNodes = IDsOfNodes.length();
- const SMDS_MeshNode* nodes[4];
- for(int i=0;i<NbNodes;i++) nodes[i]=GetMeshDS()->FindNode(IDsOfNodes[i]);
- if (NbNodes == 3)
- {
- GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2]);
- }
- else if (NbNodes == 4)
- {
- GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3]);
- }
- return true;
+ int NbNodes = IDsOfNodes.length();
+ if (NbNodes < 3)
+ {
+ return false;
+ }
+
+ std::vector<const SMDS_MeshNode*> nodes (NbNodes);
+ //const SMDS_MeshNode* nodes [NbNodes];
+ for (int i = 0; i < NbNodes; i++)
+ nodes[i] = GetMeshDS()->FindNode(IDsOfNodes[i]);
+
+ if (NbNodes == 3)
+ {
+ GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2]);
+ }
+ else if (NbNodes == 4)
+ {
+ GetMeshDS()->AddFace(nodes[0], nodes[1], nodes[2], nodes[3]);
+ }
+ else
+ {
+ GetMeshDS()->AddPolygonalFace(nodes);
+ }
+ return true;
};
//=============================================================================
return true;
};
+//=============================================================================
+/*!
+ * AddPolyhedralVolume
+ */
+//=============================================================================
+CORBA::Boolean SMESH_MeshEditor_i::AddPolyhedralVolume
+ (const SMESH::long_array & IDsOfNodes,
+ const SMESH::long_array & Quantities)
+{
+ int NbNodes = IDsOfNodes.length();
+ std::vector<const SMDS_MeshNode*> n (NbNodes);
+ //const SMDS_MeshNode* n [NbNodes];
+ for (int i = 0; i < NbNodes; i++)
+ n[i] = GetMeshDS()->FindNode(IDsOfNodes[i]);
+
+ int NbFaces = Quantities.length();
+ std::vector<int> q (NbFaces);
+ //int q [NbFaces];
+ for (int j = 0; j < NbFaces; j++)
+ q[j] = Quantities[j];
+
+ GetMeshDS()->AddPolyhedralVolume(n, q);
+ return true;
+};
+
+//=============================================================================
+/*!
+ * AddPolyhedralVolumeByFaces
+ */
+//=============================================================================
+CORBA::Boolean SMESH_MeshEditor_i::AddPolyhedralVolumeByFaces
+ (const SMESH::long_array & IdsOfFaces)
+{
+ int NbFaces = IdsOfFaces.length();
+ std::vector<const SMDS_MeshFace*> faces (NbFaces);
+ for (int i = 0; i < NbFaces; i++)
+ faces[i] = (SMDS_MeshFace *)GetMeshDS()->FindElement(IdsOfFaces[i]);
+
+ //GetMeshDS()->AddPolyhedralVolumeByFaces(faces);
+ //return true;
+ return false;
+};
+
//=============================================================================
/*!
*
CORBA::Boolean AddEdge(const SMESH::long_array & IDsOfNodes);
CORBA::Boolean AddFace(const SMESH::long_array & IDsOfNodes);
CORBA::Boolean AddVolume(const SMESH::long_array & IDsOfNodes);
+
+ CORBA::Boolean AddPolyhedralVolume(const SMESH::long_array & IDsOfNodes,
+ const SMESH::long_array & Quantities);
+ CORBA::Boolean AddPolyhedralVolumeByFaces(const SMESH::long_array & IdsOfFaces);
+
CORBA::Boolean MoveNode(CORBA::Long NodeID,
CORBA::Double x, CORBA::Double y, CORBA::Double z);
return _impl->NbQuadrangles();
}
+CORBA::Long SMESH_Mesh_i::NbPolygones()throw(SALOME::SALOME_Exception)
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ return _impl->NbPolygones();
+}
+
//=============================================================================
/*!
*
return _impl->NbPrisms();
}
+CORBA::Long SMESH_Mesh_i::NbPolyhedrones()throw(SALOME::SALOME_Exception)
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ return _impl->NbPolyhedrones();
+}
+
//=============================================================================
/*!
*
CORBA::Long NbQuadrangles()
throw (SALOME::SALOME_Exception);
+
+ CORBA::Long NbPolygones()
+ throw (SALOME::SALOME_Exception);
CORBA::Long NbVolumes()
throw (SALOME::SALOME_Exception);
CORBA::Long NbPrisms()
throw (SALOME::SALOME_Exception);
+
+ CORBA::Long NbPolyhedrones()
+ throw (SALOME::SALOME_Exception);
CORBA::Long NbSubMesh()
throw (SALOME::SALOME_Exception);