aNodeIds.assign( aBallInfo->myConn->begin(), aBallInfo->myConn->end());
// allocate array of diameters
- vtkIdType maxID = myMesh->MaxElementID() + aNbBalls;
+ vtkIdType maxID = FromIdType<vtkIdType>(myMesh->MaxElementID() + aNbBalls);
if ( anIsElemNum && !aBallInfo->myElemNum->empty() )
maxID = *std::max_element( aBallInfo->myElemNum->begin(),
aBallInfo->myElemNum->end() );
smIdType id0 = myChunks.size() * theChunkSize + 1;
myChunks.push_back( new SMDS_ElementChunk( this, id0 ));
}
- SMDS_MeshElement* e = myChunks[iChunk].Element( index );
+ SMDS_MeshElement* e = myChunks[iChunk].Element( FromIdType<int>(index) );
if ( !e->IsNull() )
return 0; // element with given ID already exists
- myChunks[iChunk].UseElement( index );
+ myChunks[iChunk].UseElement( FromIdType<int>(index) );
++myNbUsedElements;
e->myHolder = & myChunks[iChunk];
smIdType index = ( id - 1 ) % theChunkSize;
if ( iChunk < (smIdType) myChunks.size() )
{
- const SMDS_MeshElement* e = myChunks[iChunk].Element( index );
+ const SMDS_MeshElement* e = myChunks[iChunk].Element( FromIdType<int>(index) );
return e->IsNull() ? 0 : e;
}
}
const SMDS_MeshElement* newElem = FindElement( newVtkID );
if ( !newElem )
newElem = NewElement( newVtkID );
- if ( smIdType shapeID = oldElem->GetShapeID() )
+ if ( int shapeID = oldElem->GetShapeID() )
const_cast< SMDS_MeshElement* >( newElem )->setShapeID( shapeID );
if ( oldID > newNbCells )
Free( oldElem );
void SMDS_ElementChunk::Free( const SMDS_MeshElement* e )
{
bool hasHoles = ( myUsedRanges.Size() > 1 );
- myUsedRanges.SetValue( Index( e ), false );
+ myUsedRanges.SetValue( FromIdType<int>(Index( e )), false );
SetShapeID( e, 0 ); // sub-mesh must do it?
SetIsMarked( e, false );
if ( !hasHoles )
vtkIdType SMDS_ElementChunk::GetVtkID( const SMDS_MeshElement* e ) const
{
- vtkIdType dfltVtkID = e->GetID() - 1;
+ vtkIdType dfltVtkID = FromIdType<vtkIdType>(e->GetID() - 1);
return ( dfltVtkID < (vtkIdType)myFactory->myVtkIDs.size() ) ? myFactory->myVtkIDs[ dfltVtkID ] : dfltVtkID;
}
int SMDS_ElementChunk::GetShapeID( const SMDS_MeshElement* e ) const
{
- return mySubIDRanges.GetValue( Index( e ));
+ return mySubIDRanges.GetValue( FromIdType<int>(Index( e )));
}
//================================================================================
//const size_t nbRanges = mySubIDRanges.Size();
SMDS_ElementChunk* me = const_cast<SMDS_ElementChunk*>( this );
- int oldShapeID = me->mySubIDRanges.SetValue( Index( e ), shapeID );
+ int oldShapeID = me->mySubIDRanges.SetValue( FromIdType<int>(Index( e )), shapeID );
if ( oldShapeID == shapeID ) return;
if ( const SMDS_MeshNode* n = dynamic_cast< const SMDS_MeshNode* >( e ))
SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID (const std::vector<smIdType> & nodes_ids,
const smIdType ID)
{
- int nbNodes = nodes_ids.size();
+ smIdType nbNodes = nodes_ids.size();
std::vector<const SMDS_MeshNode*> nodes (nbNodes);
- for (int i = 0; i < nbNodes; i++) {
+ for (smIdType i = 0; i < nbNodes; i++) {
nodes[i] = myNodeFactory->FindNode( nodes_ids[i] );
if (!nodes[i]) return NULL;
}
const std::vector<int> & quantities,
const smIdType ID)
{
- int nbNodes = nodes_ids.size();
+ smIdType nbNodes = nodes_ids.size();
std::vector<const SMDS_MeshNode*> nodes (nbNodes);
- for (int i = 0; i < nbNodes; i++) {
+ for (smIdType i = 0; i < nbNodes; i++) {
nodes[i] = myNodeFactory->FindNode(nodes_ids[i]);
if (!nodes[i]) return NULL;
}
{
smIdType oldCellId = idCellsNewToOld[ newCellID ];
newFaceLocations->InsertNextValue( newFaces->GetMaxId()+1 );
- smIdType oldFaceLoc = this->FaceLocations->GetValue( oldCellId );
- smIdType nCellFaces = this->Faces->GetValue( oldFaceLoc++ );
- newFaces->InsertNextValue( nCellFaces );
+ smIdType oldFaceLoc = this->FaceLocations->GetValue( FromIdType<int>(oldCellId) );
+ smIdType nCellFaces = this->Faces->GetValue( FromIdType<int>(oldFaceLoc++) );
+ newFaces->InsertNextValue( FromIdType<int>(nCellFaces) );
for ( int n = 0; n < nCellFaces; n++ )
{
- int nptsInFace = this->Faces->GetValue( oldFaceLoc++ );
+ int nptsInFace = this->Faces->GetValue( FromIdType<int>(oldFaceLoc++) );
newFaces->InsertNextValue( nptsInFace );
for ( int k = 0; k < nptsInFace; k++ )
{
- vtkIdType oldpt = this->Faces->GetValue( oldFaceLoc++ );
+ vtkIdType oldpt = this->Faces->GetValue( FromIdType<int>(oldFaceLoc++) );
newFaces->InsertNextValue( idNodesOldToNew[ oldpt ]);
}
}
}
while (myCurIndex < theIndex && myIterator->more()) {
myCurIndex++;
- myCurID = myIterator->next()->GetID();
+ myCurID = FromIdType<int>(myIterator->next()->GetID());
}
return myCurIndex == theIndex ? myCurID : -1;
}
bool SMESHDS_GroupBase::Contains (const SMDS_MeshElement* elem)
{
if ( elem )
- return Contains( elem->GetID() );
+ return Contains( FromIdType<int>(elem->GetID()) );
return false;
}
if ( IsUpToDate() )
{
for ( ; elIt->more(); curID += idSize )
- (*(int*) curID) = elIt->next()->GetID();
+ (*(int*) curID) = FromIdType<int>(elIt->next()->GetID());
}
else
{
me->myMeshInfo.assign( SMDSEntity_Last, 0 );
me->myMeshInfo[ firstOkElem->GetEntityType() ]++;
- (*(int*) curID) = firstOkElem->GetID();
+ (*(int*) curID) = FromIdType<int>(firstOkElem->GetID());
for ( curID += idSize; elIt->more(); curID += idSize )
{
const SMDS_MeshElement* e = elIt->next();
- (*(int*) curID) = e->GetID();
+ (*(int*) curID) = FromIdType<int>(e->GetID());
me->myMeshInfo[ e->GetEntityType() ]++;
}
}
return false; // no sense in parallel work
SMDS_ElemIteratorPtr elemIt = GetMesh()->elementsIterator( GetType() );
- const int minID = elemIt->next()->GetID();
+ const smIdType minID = elemIt->next()->GetID();
myPredicate->IsSatisfy( minID ); // make myPredicate fully initialized for clone()
SMESH_PredicatePtr clone( myPredicate->clone() );
if ( !clone )
TLocalPredicat threadPredicates;
threadPredicates.local() = clone;
- int maxID = ( GetType() == SMDSAbs_Node ) ? GetMesh()->MaxNodeID() : GetMesh()->MaxElementID();
+ smIdType maxID = ( GetType() == SMDSAbs_Node ) ? GetMesh()->MaxNodeID() : GetMesh()->MaxElementID();
vector< char > isElemOK( 1 + maxID );
tbb::parallel_for ( tbb::blocked_range<size_t>( 0, isElemOK.size() ),
double tolerance)
:SMESH_Octree( new LimitAndPool() )
{
- int nbElems = mesh.GetMeshInfo().NbElements( elemType );
+ smIdType nbElems = mesh.GetMeshInfo().NbElements( elemType );
_elements.reserve( nbElems );
TElementBoxPool& elBoPool = getLimitAndPool()->_elBoPool;
typedef std::pair< bool, const SMDS_MeshNode* > TIsSharpAndMedium;
typedef NCollection_DataMap< SMESH_TLink, TIsSharpAndMedium, SMESH_TLink > TLinkSharpMap;
- TLinkSharpMap linkIsSharp( theMesh->NbFaces() );
+ TLinkSharpMap linkIsSharp( FromIdType<int>(theMesh->NbFaces()) );
TIsSharpAndMedium sharpMedium( true, 0 );
bool & isSharp = sharpMedium.first;
const SMDS_MeshNode* & nMedium = sharpMedium.second;
typedef std::vector< const SMDS_MeshElement* > TFaceVec;
typedef NCollection_DataMap< SMESH_TLink, TFaceVec, SMESH_TLink > TFacesByLinks;
- TFacesByLinks facesByLink( theMesh->NbFaces() );
+ TFacesByLinks facesByLink( FromIdType<int>(theMesh->NbFaces()) );
std::vector< const SMDS_MeshNode* > faceNodes;
for ( SMDS_FaceIteratorPtr faceIt = theMesh->facesIterator(); faceIt->more(); )
for ( ; cutFacesIt != myCutFaces.cend(); ++cutFacesIt )
{
const CutFace& cf = *cutFacesIt;
- int index = cf.myInitFace->GetID(); // index in theNew2OldFaces
+ smIdType index = cf.myInitFace->GetID(); // index in theNew2OldFaces
if ((int) theNew2OldFaces.size() <= index )
theNew2OldFaces.resize( index + 1 );
theNew2OldFaces[ index ] = std::make_pair( cf.myInitFace, index );
// erase loops that are cut off by face intersections
cf.CutOffLoops( loopSet, theSign, myNormals, cutOffLinks, cutOffCoplanarLinks );
- int index = cf.myInitFace->GetID(); // index in theNew2OldFaces
+ smIdType index = cf.myInitFace->GetID(); // index in theNew2OldFaces
const SMDS_MeshElement* tria;
for ( size_t iL = 0; iL < loopSet.myNbLoops; ++iL )
continue;
for ( size_t iF = 0; iF < faces.size(); ++iF )
{
- int index = faces[iF]->GetID();
+ smIdType index = faces[iF]->GetID();
// if ( //faces[iF]->isMarked() || // kept part of cutFace
// !theNew2OldFaces[ index ].first ) // already removed
// continue;
if ( cf.myInitFace->IsNull() )
continue;
- int index = cf.myInitFace->GetID(); // index in theNew2OldFaces
+ smIdType index = cf.myInitFace->GetID(); // index in theNew2OldFaces
if ( !theNew2OldFaces[ index ].first )
continue; // already cut off
for ( SMDS_ElemIteratorPtr fIt = newNode->GetInverseElementIterator(); fIt->more(); )
{
const SMDS_MeshElement* newFace = fIt->next();
- const int faceIndex = newFace->GetID();
+ const int faceIndex = FromIdType<int>(newFace->GetID());
const gp_XYZ& oldNorm = normals[ faceIndex ];
const gp_XYZ newXYZ = oldXYZ + oldNorm * theOffset;
if ( multiPos.empty() )
for ( SMDS_ElemIteratorPtr fIt = newNode->GetInverseElementIterator(); fIt->more(); )
{
const SMDS_MeshElement* newFace = fIt->next();
- const int faceIndex = newFace->GetID();
+ const int faceIndex = FromIdType<int>(newFace->GetID());
const gp_XYZ& oldNorm = normals[ faceIndex ];
if ( !SMESH_MeshAlgos::FaceNormal( newFace, faceNorm, /*normalize=*/false ) ||
//faceNorm * moveVec < 0 )
theWorkGroups.push_back( theGroupsToUpdate[i] );
if ( !theWorkGroups.empty() )
- theFaceID2Groups.Bind( theFace->GetID(), theWorkGroups );
+ theFaceID2Groups.Bind( FromIdType<int>(theFace->GetID()), theWorkGroups );
}
//================================================================================