*/
//=======================================================================
-SMDS_MeshElement* SMESH_MeshEditor::AddElement(const vector<int> & nodeIDs,
- const ElemFeatures& features)
+SMDS_MeshElement* SMESH_MeshEditor::AddElement(const vector<smIdType> & nodeIDs,
+ const ElemFeatures& features)
{
vector<const SMDS_MeshNode*> nodes;
nodes.reserve( nodeIDs.size() );
- vector<int>::const_iterator id = nodeIDs.begin();
+ vector<smIdType>::const_iterator id = nodeIDs.begin();
while ( id != nodeIDs.end() ) {
if ( const SMDS_MeshNode* node = GetMeshDS()->FindNode( *id++ ))
nodes.push_back( node );
// Modify a compute state of sub-meshes which become empty
//=======================================================================
-int SMESH_MeshEditor::Remove (const list< int >& theIDs,
+smIdType SMESH_MeshEditor::Remove (const list< smIdType >& theIDs,
const bool isNodes )
{
ClearLastCreated();
SMESHDS_Mesh* aMesh = GetMeshDS();
set< SMESH_subMesh *> smmap;
- int removed = 0;
- list<int>::const_iterator it = theIDs.begin();
+ smIdType removed = 0;
+ list<smIdType>::const_iterator it = theIDs.begin();
for ( ; it != theIDs.end(); it++ ) {
const SMDS_MeshElement * elem;
if ( isNodes )
*/
//=======================================================================
- struct TVolumeFaceKey: pair< pair< int, int>, pair< int, int> >
+ struct TVolumeFaceKey: pair< pair< smIdType, smIdType>, pair< smIdType, smIdType> >
{
TVolumeFaceKey( SMDS_VolumeTool& vol, int iF )
{
// copy offsetMesh to theTgtMesh
- int idShift = meshDS->MaxNodeID();
+ smIdType idShift = meshDS->MaxNodeID();
for ( size_t i = 0; i < new2OldNodes.size(); ++i )
if ( const SMDS_MeshNode* n = new2OldNodes[ i ].first )
{
TNodeNodeMap nodeNodeMap; // node to replace - new node
set<const SMDS_MeshElement*> elems; // all elements with changed nodes
- list< int > rmElemIds, rmNodeIds;
+ list< smIdType > rmElemIds, rmNodeIds;
vector< ElemFeatures > newElemDefs;
// Fill nodeNodeMap and elems
// purpose : allow comparing elements basing on their nodes
// ========================================================
-class ComparableElement : public boost::container::flat_set< int >
+class ComparableElement : public boost::container::flat_set< smIdType >
{
- typedef boost::container::flat_set< int > int_set;
+ typedef boost::container::flat_set< smIdType > int_set;
const SMDS_MeshElement* myElem;
- int mySumID;
+ smIdType mySumID;
mutable int myGroupID;
public:
this->reserve( theElem->NbNodes() );
for ( SMDS_ElemIteratorPtr nodeIt = theElem->nodesIterator(); nodeIt->more(); )
{
- int id = nodeIt->next()->GetID();
+ smIdType id = nodeIt->next()->GetID();
mySumID += id;
this->insert( id );
}
static int HashCode(const ComparableElement& se, int limit )
{
- return ::HashCode( se.mySumID, limit );
+ return ::HashCode( FromIdType<int>(se.mySumID), limit );
}
static Standard_Boolean IsEqual(const ComparableElement& se1, const ComparableElement& se2 )
{
else elemIt = SMESHUtils::elemSetIterator( theElements );
typedef NCollection_Map< ComparableElement, ComparableElement > TMapOfElements;
- typedef std::list<int> TGroupOfElems;
+ typedef std::list<smIdType> TGroupOfElems;
TMapOfElements mapOfElements;
std::vector< TGroupOfElems > arrayOfGroups;
TGroupOfElems groupOfElems;
{
ClearLastCreated();
- typedef list<int> TListOfIDs;
+ typedef list<smIdType> TListOfIDs;
TListOfIDs rmElemIds; // IDs of elems to remove
SMESHDS_Mesh* aMesh = GetMeshDS();
TListOfListOfElementsID::iterator itGroups = equalGroups.begin();
for ( ; itGroups != equalGroups.end(); ++itGroups )
{
- list< int >& group = *itGroups;
- list< int >::iterator id = group.begin();
+ list< smIdType >& group = *itGroups;
+ list< smIdType >::iterator id = group.begin();
for ( ++id; id != group.end(); ++id )
if ( const SMDS_MeshElement* seg = GetMeshDS()->FindElement( *id ))
segments.erase( seg );
*/
//=======================================================================
-int SMESH_MeshEditor::convertElemToQuadratic(SMESHDS_SubMesh * theSm,
- SMESH_MesherHelper& theHelper,
- const bool theForce3d)
+smIdType SMESH_MeshEditor::convertElemToQuadratic(SMESHDS_SubMesh * theSm,
+ SMESH_MesherHelper& theHelper,
+ const bool theForce3d)
{
//MESSAGE("convertElemToQuadratic");
- int nbElem = 0;
+ smIdType nbElem = 0;
if( !theSm ) return nbElem;
vector<int> nbNodeInFaces;
aHelper.ToFixNodeParameters( true );
// convert elements assigned to sub-meshes
- int nbCheckedElems = 0;
+ smIdType nbCheckedElems = 0;
if ( myMesh->HasShapeToMesh() )
{
if ( SMESH_subMesh *aSubMesh = myMesh->GetSubMeshContaining(myMesh->GetShapeToMesh()))
}
// convert elements NOT assigned to sub-meshes
- int totalNbElems = meshDS->NbEdges() + meshDS->NbFaces() + meshDS->NbVolumes();
+ smIdType totalNbElems = meshDS->NbEdges() + meshDS->NbFaces() + meshDS->NbVolumes();
if ( nbCheckedElems < totalNbElems ) // not all elements are in sub-meshes
{
aHelper.SetElementsOnShape(false);
const SMDS_MeshEdge* edge = aEdgeItr->next();
if ( !edge->IsQuadratic() )
{
- int id = edge->GetID();
+ smIdType id = edge->GetID();
const SMDS_MeshNode* n1 = edge->GetNode(0);
const SMDS_MeshNode* n2 = edge->GetNode(1);
if ( alreadyOK )
continue;
- const int id = face->GetID();
+ const smIdType id = face->GetID();
vector<const SMDS_MeshNode *> nodes ( face->begin_nodes(), face->end_nodes());
meshDS->RemoveFreeElement(face, smDS, /*fromGroups=*/false);
continue;
}
}
- const int id = volume->GetID();
+ const smIdType id = volume->GetID();
vector<const SMDS_MeshNode *> nodes (volume->begin_nodes(), volume->end_nodes());
if ( type == SMDSEntity_Polyhedra )
nbNodeInFaces = static_cast<const SMDS_MeshVolume* >(volume)->GetQuantities();
if ( alreadyOK ) continue;
const SMDSAbs_ElementType type = elem->GetType();
- const int id = elem->GetID();
+ const smIdType id = elem->GetID();
const int nbNodes = elem->NbCornerNodes();
vector<const SMDS_MeshNode *> nodes ( elem->begin_nodes(), elem->end_nodes());
//=======================================================================
/*!
* \brief Convert quadratic elements to linear ones and remove quadratic nodes
- * \return int - nb of checked elements
+ * \return smIdType - nb of checked elements
*/
//=======================================================================
-int SMESH_MeshEditor::removeQuadElem(SMESHDS_SubMesh * theSm,
- SMDS_ElemIteratorPtr theItr,
- const int /*theShapeID*/)
+smIdType SMESH_MeshEditor::removeQuadElem(SMESHDS_SubMesh * theSm,
+ SMDS_ElemIteratorPtr theItr,
+ const int /*theShapeID*/)
{
- int nbElem = 0;
+ smIdType nbElem = 0;
SMESHDS_Mesh* meshDS = GetMeshDS();
ElemFeatures elemType;
vector<const SMDS_MeshNode *> nodes;
bool SMESH_MeshEditor::ConvertFromQuadratic()
{
- int nbCheckedElems = 0;
+ smIdType nbCheckedElems = 0;
if ( myMesh->HasShapeToMesh() )
{
if ( SMESH_subMesh *aSubMesh = myMesh->GetSubMeshContaining(myMesh->GetShapeToMesh()))
}
}
- int totalNbElems =
+ smIdType totalNbElems =
GetMeshDS()->NbEdges() + GetMeshDS()->NbFaces() + GetMeshDS()->NbVolumes();
if ( nbCheckedElems < totalNbElems ) // not all elements are in submeshes
{
if ( theElements.empty() ) return;
// collect IDs of medium nodes of theElements; some of these nodes will be removed
- set<int> mediumNodeIDs;
+ set<smIdType> mediumNodeIDs;
TIDSortedElemSet::iterator eIt = theElements.begin();
for ( ; eIt != theElements.end(); ++eIt )
{
// get remaining medium nodes
TIDSortedNodeSet mediumNodes;
- set<int>::iterator nIdsIt = mediumNodeIDs.begin();
+ set<smIdType>::iterator nIdsIt = mediumNodeIDs.begin();
for ( ; nIdsIt != mediumNodeIDs.end(); ++nIdsIt )
if ( const SMDS_MeshNode* n = GetMeshDS()->FindNode( *nIdsIt ))
mediumNodes.insert( mediumNodes.end(), n );
if ( aResult != SEW_OK)
return aResult;
- list< int > nodeIDsToRemove;
+ list< smIdType > nodeIDsToRemove;
vector< const SMDS_MeshNode*> nodes;
ElemFeatures elemType;
const SMDS_MeshElement* anElem = *elemItr;
if (!anElem)
continue;
- int vtkId = anElem->GetVtkID();
+ vtkIdType vtkId = anElem->GetVtkID();
//MESSAGE(" vtkId " << vtkId << " smdsId " << anElem->GetID());
int neighborsVtkIds[NBMAXNEIGHBORS];
int downIds[NBMAXNEIGHBORS];
int nbNeighbors = grid->GetNeighbors(neighborsVtkIds, downIds, downTypes, vtkId);
for (int n = 0; n < nbNeighbors; n++)
{
- int smdsId = meshDS->FromVtkToSmds(neighborsVtkIds[n]);
+ smIdType smdsId = meshDS->FromVtkToSmds(neighborsVtkIds[n]);
const SMDS_MeshElement* elem = meshDS->FindElement(smdsId);
if (elem && ! domain.count(elem)) // neighbor is in another domain : face is shared
{
const TIDSortedElemSet& domain = (idom == iRestDom) ? theRestDomElems : theElems[idom];
for ( int ivol = 0; ivol < nbvol; ivol++ )
{
- int smdsId = meshDS->FromVtkToSmds(vtkVolIds[ivol]);
+ smIdType smdsId = meshDS->FromVtkToSmds(vtkVolIds[ivol]);
const SMDS_MeshElement* elem = meshDS->FindElement(smdsId);
if (domain.count(elem))
{
{
if (neighborsVtkIds[n]<0) // only smds faces are considered as neighbors here
continue;
- int smdsId = meshDS->FromVtkToSmds(neighborsVtkIds[n]);
+ smIdType smdsId = meshDS->FromVtkToSmds(neighborsVtkIds[n]);
const SMDS_MeshElement* elem = meshDS->FindElement(smdsId);
if ( shapeIds.count(elem->getshapeId()) && !sgrps->Contains(elem)) // edge : neighbor in the set of shape, not in the group
{
{
SMDSAbs_ElementType myType;
bool myIsPoly, myIsQuad;
- int myID;
+ smIdType myID;
double myBallDiameter;
std::vector<int> myPolyhedQuantities;
std::vector<const SMDS_MeshNode*> myNodes; // not managed by ElemFeatures
SMESH_EXPORT ElemFeatures& SetPoly(bool isPoly) { myIsPoly = isPoly; return *this; }
SMESH_EXPORT ElemFeatures& SetQuad(bool isQuad) { myIsQuad = isQuad; return *this; }
- SMESH_EXPORT ElemFeatures& SetID (int ID) { myID = ID; return *this; }
+ SMESH_EXPORT ElemFeatures& SetID (smIdType ID) { myID = ID; return *this; }
};
/*!
/*!
* \brief Add element
*/
- SMDS_MeshElement* AddElement(const std::vector<int> & nodeIDs,
- const ElemFeatures& features);
+ SMDS_MeshElement* AddElement(const std::vector<smIdType> & nodeIDs,
+ const ElemFeatures& features);
- int Remove (const std::list< int >& theElemIDs, const bool isNodes);
+ smIdType Remove (const std::list< smIdType >& theElemIDs, const bool isNodes);
// Remove a node or an element.
// Modify a compute state of sub-meshes which become empty
// In each group, the cdr of nodes are substituted by the first one
// in all elements.
- typedef std::list< std::list< int > > TListOfListOfElementsID;
+ typedef std::list< std::list< smIdType > > TListOfListOfElementsID;
void FindEqualElements(TIDSortedElemSet & theElements,
TListOfListOfElementsID & theGroupsOfElementsID);
/*!
* \brief Convert elements contained in a submesh to quadratic
- * \return int - nb of checked elements
+ * \return smIdType - nb of checked elements
*/
- int convertElemToQuadratic(SMESHDS_SubMesh * theSm,
- SMESH_MesherHelper& theHelper,
- const bool theForce3d);
+ smIdType convertElemToQuadratic(SMESHDS_SubMesh * theSm,
+ SMESH_MesherHelper& theHelper,
+ const bool theForce3d);
/*!
* \brief Convert quadratic elements to linear ones and remove quadratic nodes
* \return nb of checked elements
*/
- int removeQuadElem( SMESHDS_SubMesh * theSm,
- SMDS_ElemIteratorPtr theItr,
- const int theShapeID);
+ smIdType removeQuadElem( SMESHDS_SubMesh * theSm,
+ SMDS_ElemIteratorPtr theItr,
+ const int theShapeID);
/*!
* \brief Create groups of elements made during transformation
* \param nodeGens - nodes making corresponding myLastCreatedNodes
{
// copy element nodes
int anElemNbNodes = anElem->NbNodes();
- vector< int > anElemNodesID( anElemNbNodes ) ;
+ vector< smIdType > anElemNodesID( anElemNbNodes ) ;
SMDS_ElemIteratorPtr itElemNodes = anElem->nodesIterator();
- for ( int i = 0; itElemNodes->more(); i++)
+ for ( smIdType i = 0; itElemNodes->more(); i++)
{
const SMDS_MeshNode* anElemNode = cast2Node( itElemNodes->next() );
Copy( anElemNode );
SMESH_TRY;
initData();
- list< int > IdList;
+ list< smIdType > IdList;
- for ( CORBA::ULong i = 0; i < IDsOfElements.length(); i++ )
+ for ( SMESH::smIdType i = 0; i < IDsOfElements.length(); i++ )
IdList.push_back( IDsOfElements[i] );
// Update Python script
SMESH_TRY;
initData();
- list< int > IdList;
- for ( CORBA::ULong i = 0; i < IDsOfNodes.length(); i++)
+ list< smIdType > IdList;
+ for ( SMESH::smIdType i = 0; i < IDsOfNodes.length(); i++)
IdList.push_back( IDsOfNodes[i] );
// Update Python script
SMESH::Controls::Filter::GetElementsId( getMeshDS(), predicate, seq );
// remove orphan nodes (if there are any)
- list< int > IdList( seq.begin(), seq.end() );
+ list< smIdType > IdList( seq.begin(), seq.end() );
int nbNodesBefore = myMesh->NbNodes();
getEditor().Remove( IdList, true );
for (CORBA::Long j = 0; arraysIt != aListOfListOfElementsID.end(); ++arraysIt, ++j)
{
SMESH::long_array& aGroup = (*theGroupsOfElementsID)[ j ];
- list<int>& listOfIDs = *arraysIt;
+ list<smIdType>& listOfIDs = *arraysIt;
aGroup.length( listOfIDs.size() );
- list<int>::iterator idIt = listOfIDs.begin();
- for (int k = 0; idIt != listOfIDs.end(); ++idIt, ++k )
+ list<smIdType>::iterator idIt = listOfIDs.begin();
+ for (smIdType k = 0; idIt != listOfIDs.end(); ++idIt, ++k )
aGroup[ k ] = *idIt;
}
for ( CORBA::ULong i = 0; i < theGroupsOfElementsID.length(); i++ )
{
const SMESH::long_array& anElemsIDGroup = theGroupsOfElementsID[ i ];
- aListOfListOfElementsID.push_back( list< int >() );
- list< int >& aListOfElemsID = aListOfListOfElementsID.back();
- for ( CORBA::ULong j = 0; j < anElemsIDGroup.length(); j++ )
+ aListOfListOfElementsID.push_back( list< smIdType >() );
+ list< smIdType >& aListOfElemsID = aListOfListOfElementsID.back();
+ for ( SMESH::smIdType j = 0; j < anElemsIDGroup.length(); j++ )
{
- CORBA::Long id = anElemsIDGroup[ j ];
+ SMESH::smIdType id = anElemsIDGroup[ j ];
if ( idsToKeep.Contains( id )) aListOfElemsID.push_front( id );
else aListOfElemsID.push_back( id );
}