mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-15 01:20:35 +05:00
Check types in SMDS and SMESHDS
This commit is contained in:
parent
dd3be60637
commit
81147ab62f
@ -25,7 +25,7 @@
|
||||
|
||||
#include "SMDS_CellOfNodes.hxx"
|
||||
|
||||
SMDS_CellOfNodes::SMDS_CellOfNodes( smIdType id, smIdType shapeID )
|
||||
SMDS_CellOfNodes::SMDS_CellOfNodes( smIdType id, int shapeID )
|
||||
: myID( id )
|
||||
{
|
||||
setShapeID( shapeID );
|
||||
@ -41,12 +41,12 @@ smIdType SMDS_CellOfNodes::GetID() const
|
||||
return myID;
|
||||
}
|
||||
|
||||
void SMDS_CellOfNodes::setShapeID( const smIdType shapeID )
|
||||
void SMDS_CellOfNodes::setShapeID( const int shapeID )
|
||||
{
|
||||
myShapeID = ( shapeID << BITS_SHIFT ) | ( myShapeID & BIT_IS_MARKED );
|
||||
}
|
||||
|
||||
smIdType SMDS_CellOfNodes::GetShapeID() const
|
||||
int SMDS_CellOfNodes::GetShapeID() const
|
||||
{
|
||||
return myShapeID >> BITS_SHIFT;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class SMDS_EXPORT SMDS_CellOfNodes : public SMDS_MeshElement
|
||||
public:
|
||||
|
||||
virtual smIdType GetID() const;
|
||||
virtual smIdType GetShapeID() const;
|
||||
virtual int GetShapeID() const;
|
||||
|
||||
virtual void setIsMarked( bool is ) const;
|
||||
virtual bool isMarked() const;
|
||||
@ -54,13 +54,13 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
SMDS_CellOfNodes( smIdType id = -1, smIdType shapeID = 0);
|
||||
SMDS_CellOfNodes( smIdType id = -1, int shapeID = 0);
|
||||
|
||||
virtual void setID( const smIdType id);
|
||||
virtual void setShapeID( const smIdType shapeID );
|
||||
virtual void setShapeID( const int shapeID );
|
||||
|
||||
smIdType myID;
|
||||
smIdType myShapeID;
|
||||
int myShapeID;
|
||||
|
||||
enum Bits { // use the 1st right bit of myShapeId to set/unset a mark
|
||||
BIT_IS_MARKED = 1,
|
||||
|
@ -104,7 +104,7 @@ int SMDS_ElementFactory::ChunkSize()
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return minimal ID of a non-used element
|
||||
* \return int - minimal element ID
|
||||
* \return smIdType - minimal element ID
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
@ -133,7 +133,7 @@ smIdType SMDS_ElementFactory::GetMaxID()
|
||||
for ( smIdType i = myChunks.size() - 1; i >= 0; --i )
|
||||
if ( myChunks[i].GetUsedRanges().GetIndices( true, usedRanges ))
|
||||
{
|
||||
smIdType index = usedRanges.back().second-1;
|
||||
int index = usedRanges.back().second-1;
|
||||
id = myChunks[i].Get1stID() + index;
|
||||
break;
|
||||
}
|
||||
@ -149,7 +149,7 @@ smIdType SMDS_ElementFactory::GetMaxID()
|
||||
|
||||
smIdType SMDS_ElementFactory::GetMinID()
|
||||
{
|
||||
int id = 0;
|
||||
smIdType id = 0;
|
||||
TIndexRanges usedRanges;
|
||||
for ( size_t i = 0; i < myChunks.size(); ++i )
|
||||
if ( myChunks[i].GetUsedRanges().GetIndices( true, usedRanges ))
|
||||
@ -173,7 +173,7 @@ SMDS_MeshElement* SMDS_ElementFactory::NewElement( const smIdType id )
|
||||
{
|
||||
smIdType iChunk = ( id - 1 ) / theChunkSize;
|
||||
smIdType index = ( id - 1 ) % theChunkSize;
|
||||
while ((int) myChunks.size() <= iChunk )
|
||||
while ((smIdType) myChunks.size() <= iChunk )
|
||||
{
|
||||
smIdType id0 = myChunks.size() * theChunkSize + 1;
|
||||
myChunks.push_back( new SMDS_ElementChunk( this, id0 ));
|
||||
@ -206,7 +206,7 @@ const SMDS_MeshElement* SMDS_ElementFactory::FindElement( const smIdType id ) co
|
||||
{
|
||||
smIdType iChunk = ( id - 1 ) / theChunkSize;
|
||||
smIdType index = ( id - 1 ) % theChunkSize;
|
||||
if ( iChunk < (int) myChunks.size() )
|
||||
if ( iChunk < (smIdType) myChunks.size() )
|
||||
{
|
||||
const SMDS_MeshElement* e = myChunks[iChunk].Element( index );
|
||||
return e->IsNull() ? 0 : e;
|
||||
@ -303,8 +303,8 @@ void SMDS_ElementFactory::Compact( std::vector<smIdType>& theVtkIDsNewToOld )
|
||||
}
|
||||
else // there are holes in SMDS IDs
|
||||
{
|
||||
int newVtkID = 0; // same as new smds ID (-1)
|
||||
for ( int oldID = 1; oldID <= maxCellID; ++oldID ) // smds IDs
|
||||
smIdType newVtkID = 0; // same as new smds ID (-1)
|
||||
for ( smIdType oldID = 1; oldID <= maxCellID; ++oldID ) // smds IDs
|
||||
{
|
||||
const SMDS_MeshElement* oldElem = FindElement( oldID );
|
||||
if ( !oldElem ) continue;
|
||||
@ -408,9 +408,9 @@ void SMDS_NodeFactory::Compact( std::vector<smIdType>& theVtkIDsOldToNew )
|
||||
const SMDS_MeshElement* newNode = FindElement( newID+1 );
|
||||
if ( !newNode )
|
||||
newNode = NewElement( newID+1 );
|
||||
smIdType shapeID = oldNode->GetShapeID();
|
||||
int shapeDim = GetShapeDim( shapeID );
|
||||
smIdType iChunk = newID / theChunkSize;
|
||||
int shapeID = oldNode->GetShapeID();
|
||||
int shapeDim = GetShapeDim( shapeID );
|
||||
smIdType iChunk = newID / theChunkSize;
|
||||
myChunks[ iChunk ].SetShapeID( newNode, shapeID );
|
||||
if ( shapeDim == 2 || shapeDim == 1 )
|
||||
{
|
||||
@ -431,7 +431,7 @@ void SMDS_NodeFactory::Compact( std::vector<smIdType>& theVtkIDsOldToNew )
|
||||
}
|
||||
else // no holes
|
||||
{
|
||||
for ( int i = 0; i < newNbNodes; ++i )
|
||||
for ( smIdType i = 0; i < newNbNodes; ++i )
|
||||
theVtkIDsOldToNew[ i ] = i;
|
||||
}
|
||||
myChunks.resize( newNbChunks );
|
||||
@ -618,12 +618,12 @@ void SMDS_ElementChunk::SetVTKID( const SMDS_MeshElement* e, const vtkIdType vtk
|
||||
{
|
||||
if ( e->GetID() - 1 != vtkID )
|
||||
{
|
||||
if ((int) myFactory->myVtkIDs.size() <= e->GetID() - 1 )
|
||||
if ((smIdType) myFactory->myVtkIDs.size() <= e->GetID() - 1 )
|
||||
{
|
||||
size_t i = myFactory->myVtkIDs.size();
|
||||
myFactory->myVtkIDs.resize( e->GetID() + 100 );
|
||||
for ( ; i < myFactory->myVtkIDs.size(); ++i )
|
||||
myFactory->myVtkIDs[i] = FromIdType<int>(i);
|
||||
myFactory->myVtkIDs[i] = FromIdType<vtkIdType>(i);
|
||||
}
|
||||
myFactory->myVtkIDs[ e->GetID() - 1 ] = vtkID;
|
||||
|
||||
@ -644,10 +644,10 @@ void SMDS_ElementChunk::SetVTKID( const SMDS_MeshElement* e, const vtkIdType vtk
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
int SMDS_ElementChunk::GetVtkID( const SMDS_MeshElement* e ) const
|
||||
vtkIdType SMDS_ElementChunk::GetVtkID( const SMDS_MeshElement* e ) const
|
||||
{
|
||||
size_t dfltVtkID = e->GetID() - 1;
|
||||
return ( dfltVtkID < myFactory->myVtkIDs.size() ) ? FromIdType<int>(myFactory->myVtkIDs[ dfltVtkID ]) : FromIdType<int>(dfltVtkID);
|
||||
vtkIdType dfltVtkID = e->GetID() - 1;
|
||||
return ( dfltVtkID < (vtkIdType)myFactory->myVtkIDs.size() ) ? myFactory->myVtkIDs[ dfltVtkID ] : dfltVtkID;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
|
@ -70,7 +70,7 @@ protected:
|
||||
TChunkPtrSet myChunksWithUnused; // sorted chunks having unused elements
|
||||
std::vector< vtkIdType > myVtkIDs; // myVtkIDs[ smdsID-1 ] == vtkID
|
||||
std::vector< smIdType > mySmdsIDs; // mySmdsIDs[ vtkID ] == smdsID - 1
|
||||
int myNbUsedElements; // counter of elements
|
||||
smIdType myNbUsedElements; // counter of elements
|
||||
|
||||
friend class SMDS_ElementChunk;
|
||||
|
||||
@ -279,7 +279,7 @@ struct _RangeSet
|
||||
rNext = mySet.upper_bound( theIndex );
|
||||
r = rNext - 1;
|
||||
}
|
||||
smIdType rSize = Size( r ); // range size
|
||||
int rSize = Size( r ); // range size
|
||||
attr_t rValue = r->myValue;
|
||||
if ( rValue == theValue )
|
||||
return rValue; // it happens while compacting
|
||||
@ -433,7 +433,7 @@ public:
|
||||
|
||||
smIdType GetID( const SMDS_MeshElement* e ) const;
|
||||
|
||||
int GetVtkID( const SMDS_MeshElement* e ) const;
|
||||
vtkIdType GetVtkID( const SMDS_MeshElement* e ) const;
|
||||
void SetVTKID( const SMDS_MeshElement* e, const vtkIdType id );
|
||||
|
||||
int GetShapeID( const SMDS_MeshElement* e ) const;
|
||||
|
@ -59,8 +59,7 @@ SMDS_ElementHolder::~SMDS_ElementHolder()
|
||||
|
||||
void SMDS_ElementHolder::beforeCompacting()
|
||||
{
|
||||
int i = 0;
|
||||
for ( SMDS_ElemIteratorPtr it = getElements(); it->more(); ++i )
|
||||
for ( SMDS_ElemIteratorPtr it = getElements(); it->more() )
|
||||
{
|
||||
const SMDS_MeshElement* e = it->next();
|
||||
if ( !e ) continue;
|
||||
@ -94,21 +93,21 @@ void SMDS_ElementHolder::restoreElements( const std::vector<smIdType>& idNodesOl
|
||||
std::vector< bool >::iterator isNode = myIsNode.begin();
|
||||
for ( size_t i = 0; i < myVtkIDs.size(); ++i, ++isNode )
|
||||
{
|
||||
int vtkID = myVtkIDs[i];
|
||||
vtkIdType vtkID = myVtkIDs[i];
|
||||
if ( vtkID < 0 )
|
||||
{
|
||||
elem = myExternalElems[ (-vtkID)-1 ];
|
||||
}
|
||||
else if ( *isNode )
|
||||
{
|
||||
if ( vtkID < (int)idNodesOldToNew.size() )
|
||||
if ( vtkID < (vtkIdType)idNodesOldToNew.size() )
|
||||
elem = myMesh->FindNodeVtk( idNodesOldToNew[ vtkID ]);
|
||||
else
|
||||
elem = myMesh->FindNodeVtk( vtkID );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( vtkID < (int)idCellsOldToNew.size() )
|
||||
if ( vtkID < (vtkIdType)idCellsOldToNew.size() )
|
||||
elem = myMesh->FindElementVtk( idCellsOldToNew[ vtkID ]);
|
||||
else
|
||||
elem = myMesh->FindElementVtk( vtkID );
|
||||
|
@ -87,7 +87,7 @@ class SMDS_EXPORT SMDS_ElementHolder
|
||||
|
||||
|
||||
std::vector<const SMDS_MeshElement*> myExternalElems; //!< elements not contained in the mesh
|
||||
std::vector< int > myVtkIDs; //!< vtk IDs of elements
|
||||
std::vector< vtkIdType > myVtkIDs; //!< vtk IDs of elements
|
||||
std::vector< bool > myIsNode;
|
||||
std::set< SMDS_ElementHolder* >::iterator myPtrInMesh;
|
||||
};
|
||||
|
@ -998,12 +998,12 @@ const SMDS_MeshNode * SMDS_Mesh::FindNode(smIdType ID) const
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Return the node whose VTK ID is 'vtkId'.
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
const SMDS_MeshNode * SMDS_Mesh::FindNodeVtk(int vtkId) const
|
||||
const SMDS_MeshNode * SMDS_Mesh::FindNodeVtk(vtkIdType vtkId) const
|
||||
{
|
||||
return myNodeFactory->FindNode( vtkId + 1 );
|
||||
}
|
||||
|
||||
const SMDS_MeshElement * SMDS_Mesh::FindElementVtk(int IDelem) const
|
||||
const SMDS_MeshElement * SMDS_Mesh::FindElementVtk(vtkIdType IDelem) const
|
||||
{
|
||||
return myCellFactory->FindElement( FromVtkToSmds( IDelem ));
|
||||
}
|
||||
@ -1874,7 +1874,7 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
||||
n->RemoveInverseElement((*it));
|
||||
}
|
||||
|
||||
int vtkid = (*it)->GetVtkID();
|
||||
vtkIdType vtkid = (*it)->GetVtkID();
|
||||
|
||||
switch ((*it)->GetType()) {
|
||||
case SMDSAbs_Node:
|
||||
@ -1919,7 +1919,7 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
|
||||
{
|
||||
const int vtkId = elem->GetVtkID();
|
||||
const vtkIdType vtkId = elem->GetVtkID();
|
||||
SMDSAbs_ElementType aType = elem->GetType();
|
||||
if ( aType == SMDSAbs_Node )
|
||||
{
|
||||
@ -2991,7 +2991,7 @@ void SMDS_Mesh::CompactMesh()
|
||||
idCellsOldToNew.resize( oldCellSize, oldCellSize );
|
||||
for ( size_t iNew = 0; iNew < idCellsNewToOld.size(); ++iNew )
|
||||
{
|
||||
if ( idCellsNewToOld[ iNew ] >= (int) idCellsOldToNew.size() )
|
||||
if ( idCellsNewToOld[ iNew ] >= (smIdType) idCellsOldToNew.size() )
|
||||
idCellsOldToNew.resize( ( 1 + idCellsNewToOld[ iNew ]) * 1.5, oldCellSize );
|
||||
idCellsOldToNew[ idCellsNewToOld[ iNew ]] = iNew;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ void SMDS_MeshElement::setShapeID( const int shapeID ) const
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
smIdType SMDS_MeshElement::GetShapeID() const
|
||||
int SMDS_MeshElement::GetShapeID() const
|
||||
{
|
||||
return myHolder->GetShapeID( this );
|
||||
}
|
||||
@ -138,7 +138,7 @@ smIdType SMDS_MeshElement::GetShapeID() const
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
int SMDS_MeshElement::GetVtkID() const
|
||||
vtkIdType SMDS_MeshElement::GetVtkID() const
|
||||
{
|
||||
return myHolder->GetVtkID( this );
|
||||
}
|
||||
@ -171,7 +171,7 @@ bool SMDS_MeshElement::isMarked() const
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void SMDS_MeshElement::setVtkID( const int vtkID )
|
||||
void SMDS_MeshElement::setVtkID( const vtkIdType vtkID )
|
||||
{
|
||||
myHolder->SetVTKID( this, vtkID );
|
||||
}
|
||||
|
@ -128,10 +128,10 @@ public:
|
||||
virtual int GetNodeIndex( const SMDS_MeshNode* node ) const;
|
||||
|
||||
|
||||
virtual smIdType GetID() const;
|
||||
virtual int GetVtkID() const;
|
||||
virtual smIdType getshapeId() const { return GetShapeID(); }
|
||||
virtual smIdType GetShapeID() const;
|
||||
virtual smIdType GetID() const;
|
||||
virtual vtkIdType GetVtkID() const;
|
||||
virtual smIdType getshapeId() const { return GetShapeID(); }
|
||||
virtual smIdType GetShapeID() const;
|
||||
|
||||
// mark this element; to be used in algos
|
||||
virtual void setIsMarked( bool is ) const;
|
||||
@ -183,7 +183,7 @@ public:
|
||||
|
||||
SMDS_MeshElement();
|
||||
|
||||
void setVtkID(const int vtkID );
|
||||
void setVtkID(const vtkIdType vtkID );
|
||||
virtual void setShapeID( const int shapeID ) const;
|
||||
|
||||
SMDS_UnstructuredGrid* getGrid() const;
|
||||
|
@ -80,7 +80,7 @@ private:
|
||||
// methods to count NOT POLY elements
|
||||
inline void remove(const SMDS_MeshElement* el);
|
||||
inline void add (const SMDS_MeshElement* el);
|
||||
inline smIdType index(SMDSAbs_ElementType type, smIdType nbNodes) const;
|
||||
inline smIdType index(SMDSAbs_ElementType type, int nbNodes) const;
|
||||
// methods to remove elements of ANY kind
|
||||
inline void RemoveEdge(const SMDS_MeshElement* el);
|
||||
inline void RemoveFace(const SMDS_MeshElement* el);
|
||||
@ -214,7 +214,7 @@ SMDS_MeshInfo::Clear()
|
||||
}
|
||||
|
||||
inline smIdType // index
|
||||
SMDS_MeshInfo::index(SMDSAbs_ElementType type, smIdType nbNodes) const
|
||||
SMDS_MeshInfo::index(SMDSAbs_ElementType type, int nbNodes) const
|
||||
{ return nbNodes + myShift[ type ]; }
|
||||
|
||||
inline void // remove
|
||||
|
@ -123,7 +123,7 @@ namespace
|
||||
{
|
||||
for (int i = 0; i < ncells; i++)
|
||||
{
|
||||
int vtkId = cells[i];
|
||||
vtkIdType vtkId = cells[i];
|
||||
smIdType smdsId = myMesh->FromVtkToSmds( vtkId );
|
||||
const SMDS_MeshElement* elem = myMesh->FindElement( smdsId );
|
||||
if ( elem->GetType() == type )
|
||||
@ -142,7 +142,7 @@ namespace
|
||||
|
||||
const SMDS_MeshElement* next()
|
||||
{
|
||||
int vtkId = myCellList[ myIter++ ];
|
||||
vtkIdType vtkId = myCellList[ myIter++ ];
|
||||
smIdType smdsId = myMesh->FromVtkToSmds( vtkId );
|
||||
const SMDS_MeshElement* elem = myMesh->FindElement(smdsId);
|
||||
if (!elem)
|
||||
|
@ -135,7 +135,7 @@ vtkPoints* SMDS_UnstructuredGrid::GetPoints()
|
||||
return this->Points;
|
||||
}
|
||||
|
||||
int SMDS_UnstructuredGrid::InsertNextLinkedCell(int type, int npts, vtkIdType *pts)
|
||||
vtkIdType SMDS_UnstructuredGrid::InsertNextLinkedCell(int type, int npts, vtkIdType *pts)
|
||||
{
|
||||
if ( !this->Links ) // don't create Links until they are needed
|
||||
{
|
||||
@ -146,7 +146,7 @@ int SMDS_UnstructuredGrid::InsertNextLinkedCell(int type, int npts, vtkIdType *p
|
||||
return vtkUnstructuredGrid::InsertNextLinkedCell(type, npts, pts);
|
||||
|
||||
// --- type = VTK_POLYHEDRON
|
||||
int cellid = this->InsertNextCell(type, npts, pts);
|
||||
vtkIdType cellid = this->InsertNextCell(type, npts, pts);
|
||||
|
||||
std::set<vtkIdType> setOfNodes;
|
||||
setOfNodes.clear();
|
||||
@ -183,7 +183,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<smIdType>& idNodesOldToNew,
|
||||
// IDs of VTK nodes always correspond to SMDS IDs but there can be "holes" in SMDS numeration.
|
||||
// We compact only if there were holes
|
||||
|
||||
int oldNodeSize = this->GetNumberOfPoints();
|
||||
vtkIdType oldNodeSize = this->GetNumberOfPoints();
|
||||
bool updateNodes = ( oldNodeSize > newNodeSize );
|
||||
if ( true /*updateNodes*/ )
|
||||
{
|
||||
@ -193,17 +193,17 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<smIdType>& idNodesOldToNew,
|
||||
newPoints->SetDataType( VTK_DOUBLE );
|
||||
newPoints->SetNumberOfPoints( FromIdType<int>(newNodeSize) );
|
||||
|
||||
int i = 0, alreadyCopied = 0;
|
||||
int vtkIdType = 0, alreadyCopied = 0;
|
||||
while ( i < oldNodeSize )
|
||||
{
|
||||
// skip a hole if any
|
||||
while ( i < oldNodeSize && idNodesOldToNew[i] < 0 )
|
||||
++i;
|
||||
int startBloc = i;
|
||||
vtkIdType startBloc = i;
|
||||
// look for a block end
|
||||
while ( i < oldNodeSize && idNodesOldToNew[i] >= 0 )
|
||||
++i;
|
||||
int endBloc = i;
|
||||
vtkIdType endBloc = i;
|
||||
copyNodes(newPoints, idNodesOldToNew, alreadyCopied, startBloc, endBloc);
|
||||
}
|
||||
this->SetPoints(newPoints);
|
||||
@ -217,9 +217,9 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<smIdType>& idNodesOldToNew,
|
||||
|
||||
// Compact cells if VTK IDs do not correspond to SMDS IDs or nodes compacted
|
||||
|
||||
int oldCellSize = this->Types->GetNumberOfTuples();
|
||||
bool updateCells = ( updateNodes || newCellSize != oldCellSize );
|
||||
for ( int newID = 0, nbIDs = idCellsNewToOld.size(); newID < nbIDs && !updateCells; ++newID )
|
||||
vtkIdType oldCellSize = this->Types->GetNumberOfTuples();
|
||||
bool updateCells = ( updateNodes || newCellSize != oldCellSize );
|
||||
for ( vtkIdType newID = 0, nbIDs = idCellsNewToOld.size(); newID < nbIDs && !updateCells; ++newID )
|
||||
updateCells = ( idCellsNewToOld[ newID ] != newID );
|
||||
|
||||
if ( false /*!updateCells*/ ) // no holes in elements
|
||||
@ -236,18 +236,18 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<smIdType>& idNodesOldToNew,
|
||||
return;
|
||||
}
|
||||
|
||||
if ((int) idNodesOldToNew.size() < oldNodeSize )
|
||||
if ((vtkIdType) idNodesOldToNew.size() < oldNodeSize )
|
||||
{
|
||||
idNodesOldToNew.reserve( oldNodeSize );
|
||||
for ( int i = idNodesOldToNew.size(); i < oldNodeSize; ++i )
|
||||
for ( vvtkIdType i = idNodesOldToNew.size(); i < oldNodeSize; ++i )
|
||||
idNodesOldToNew.push_back( i );
|
||||
}
|
||||
|
||||
// --- create new compacted Connectivity, Locations and Types
|
||||
|
||||
int newConnectivitySize = this->Connectivity->GetNumberOfConnectivityEntries();
|
||||
vvtkIdType newConnectivitySize = this->Connectivity->GetNumberOfConnectivityEntries();
|
||||
if ( newCellSize != oldCellSize )
|
||||
for ( int i = 0; i < oldCellSize - 1; ++i )
|
||||
for ( vvtkIdType i = 0; i < oldCellSize - 1; ++i )
|
||||
if ( this->Types->GetValue( i ) == VTK_EMPTY_CELL )
|
||||
newConnectivitySize -= this->Connectivity->GetCellSize( i );
|
||||
|
||||
@ -257,11 +257,11 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<smIdType>& idNodesOldToNew,
|
||||
|
||||
vtkUnsignedCharArray *newTypes = vtkUnsignedCharArray::New();
|
||||
newTypes->Initialize();
|
||||
newTypes->SetNumberOfValues(FromIdType<int>(newCellSize));
|
||||
newTypes->SetNumberOfValues(FromIdType<vtkIdType>(newCellSize));
|
||||
|
||||
vtkIdTypeArray *newLocations = vtkIdTypeArray::New();
|
||||
newLocations->Initialize();
|
||||
newLocations->SetNumberOfValues(FromIdType<int>(newCellSize));
|
||||
newLocations->SetNumberOfValues(FromIdType<vtkIdType>(newCellSize));
|
||||
|
||||
std::vector< vtkIdType > pointsCell(1024); // --- points id to fill a new cell
|
||||
|
||||
@ -273,11 +273,11 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<smIdType>& idNodesOldToNew,
|
||||
{
|
||||
vtkDoubleArray* newDiameters = vtkDoubleArray::New();
|
||||
newDiameters->SetNumberOfComponents(1);
|
||||
for ( int newCellID = 0; newCellID < newCellSize; newCellID++ )
|
||||
for ( vvtkIdType newCellID = 0; newCellID < newCellSize; newCellID++ )
|
||||
{
|
||||
if ( newTypes->GetValue( newCellID ) == VTK_POLY_VERTEX )
|
||||
{
|
||||
int oldCellID = idCellsNewToOld[ newCellID ];
|
||||
vvtkIdType oldCellID = idCellsNewToOld[ newCellID ];
|
||||
newDiameters->InsertValue( newCellID, diameters->GetValue( oldCellID ));
|
||||
}
|
||||
vtkDataSet::CellData->SetScalars( newDiameters );
|
||||
@ -292,14 +292,14 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<smIdType>& idNodesOldToNew,
|
||||
vtkIdTypeArray *newFaces = vtkIdTypeArray::New();
|
||||
newFaces->Initialize();
|
||||
newFaces->Allocate(this->Faces->GetSize());
|
||||
for ( int newCellID = 0; newCellID < newCellSize; newCellID++ )
|
||||
for ( vvtkIdType newCellID = 0; newCellID < newCellSize; newCellID++ )
|
||||
{
|
||||
if ( newTypes->GetValue( newCellID ) == VTK_POLYHEDRON )
|
||||
{
|
||||
int oldCellId = idCellsNewToOld[ newCellID ];
|
||||
smIdType oldCellId = idCellsNewToOld[ newCellID ];
|
||||
newFaceLocations->InsertNextValue( newFaces->GetMaxId()+1 );
|
||||
int oldFaceLoc = this->FaceLocations->GetValue( oldCellId );
|
||||
int nCellFaces = this->Faces->GetValue( oldFaceLoc++ );
|
||||
smIdType oldFaceLoc = this->FaceLocations->GetValue( oldCellId );
|
||||
smIdType nCellFaces = this->Faces->GetValue( oldFaceLoc++ );
|
||||
newFaces->InsertNextValue( nCellFaces );
|
||||
for ( int n = 0; n < nCellFaces; n++ )
|
||||
{
|
||||
@ -307,7 +307,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<smIdType>& idNodesOldToNew,
|
||||
newFaces->InsertNextValue( nptsInFace );
|
||||
for ( int k = 0; k < nptsInFace; k++ )
|
||||
{
|
||||
int oldpt = this->Faces->GetValue( oldFaceLoc++ );
|
||||
vtkIdType oldpt = this->Faces->GetValue( oldFaceLoc++ );
|
||||
newFaces->InsertNextValue( idNodesOldToNew[ oldpt ]);
|
||||
}
|
||||
}
|
||||
@ -337,13 +337,13 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<smIdType>& idNodesOldToNew,
|
||||
|
||||
void SMDS_UnstructuredGrid::copyNodes(vtkPoints * newPoints,
|
||||
std::vector<smIdType>& /*idNodesOldToNew*/,
|
||||
int& alreadyCopied,
|
||||
int start,
|
||||
int end)
|
||||
vvtkIdType& alreadyCopied,
|
||||
vvtkIdType start,
|
||||
vvtkIdType end)
|
||||
{
|
||||
void *target = newPoints->GetVoidPointer(3 * alreadyCopied);
|
||||
void *source = this->Points->GetVoidPointer(3 * start);
|
||||
int nbPoints = end - start;
|
||||
vvtkIdType nbPoints = end - start;
|
||||
if (nbPoints > 0)
|
||||
{
|
||||
memcpy(target, source, 3 * sizeof(double) * nbPoints);
|
||||
@ -360,7 +360,7 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray * newTypes,
|
||||
{
|
||||
for ( size_t iNew = 0; iNew < idCellsNewToOld.size(); iNew++ )
|
||||
{
|
||||
int iOld = idCellsNewToOld[ iNew ];
|
||||
vvtkIdType iOld = idCellsNewToOld[ iNew ];
|
||||
newTypes->SetValue( iNew, this->Types->GetValue( iOld ));
|
||||
|
||||
vtkIdType oldLoc = ((vtkIdTypeArray *)(this->Connectivity->GetOffsetsArray()))->GetValue( iOld );
|
||||
@ -371,25 +371,25 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray * newTypes,
|
||||
pointsCell.resize( nbpts );
|
||||
for ( int l = 0; l < nbpts; l++ )
|
||||
{
|
||||
int oldval = oldPtsCell[l];
|
||||
vvtkIdType oldval = oldPtsCell[l];
|
||||
pointsCell[l] = idNodesOldToNew[oldval];
|
||||
}
|
||||
/*int newcnt = */newConnectivity->InsertNextCell( nbpts, pointsCell.data() );
|
||||
int newLoc = newConnectivity->GetInsertLocation( nbpts );
|
||||
/*vvtkIdType newcnt = */newConnectivity->InsertNextCell( nbpts, pointsCell.data() );
|
||||
vvtkIdType newLoc = newConnectivity->GetInsertLocation( nbpts );
|
||||
newLocations->SetValue( iNew, newLoc );
|
||||
}
|
||||
}
|
||||
|
||||
int SMDS_UnstructuredGrid::CellIdToDownId(int vtkCellId)
|
||||
int SMDS_UnstructuredGrid::CellIdToDownId(vtkIdType vtkCellId)
|
||||
{
|
||||
if ((vtkCellId < 0) || (vtkCellId >= (int)_cellIdToDownId.size()))
|
||||
if ((vtkCellId < 0) || (vtkCellId >= (vvtkIdType)_cellIdToDownId.size()))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return _cellIdToDownId[vtkCellId];
|
||||
}
|
||||
|
||||
void SMDS_UnstructuredGrid::setCellIdToDownId(int vtkCellId, int downId)
|
||||
void SMDS_UnstructuredGrid::setCellIdToDownId(vvtkIdType vtkCellId, int downId)
|
||||
{
|
||||
// ASSERT((vtkCellId >= 0) && (vtkCellId < _cellIdToDownId.size()));
|
||||
_cellIdToDownId[vtkCellId] = downId;
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
virtual vtkMTimeType GetMTime();
|
||||
virtual vtkPoints *GetPoints();
|
||||
|
||||
int InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
|
||||
vtkIdType InsertNextLinkedCell(int type, int npts, vtkIdType *pts);
|
||||
|
||||
int CellIdToDownId(int vtkCellId);
|
||||
void setCellIdToDownId(int vtkCellId, int downId);
|
||||
|
@ -30,7 +30,6 @@
|
||||
#define SMDS_VolumeTool_HeaderFile
|
||||
|
||||
#include "SMESH_SMDS.hxx"
|
||||
#include <smIdType.hxx>
|
||||
|
||||
class SMDS_MeshElement;
|
||||
class SMDS_MeshNode;
|
||||
|
@ -218,9 +218,9 @@ void SMESHDS_Mesh::MoveNode(const SMDS_MeshNode *n, double x, double y, double z
|
||||
|
||||
bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
|
||||
const SMDS_MeshNode * nodes[],
|
||||
const smIdType nbnodes)
|
||||
const int nbnodes)
|
||||
{
|
||||
if ( ! SMDS_Mesh::ChangeElementNodes( elem, nodes, FromIdType<int>(nbnodes) ))
|
||||
if ( ! SMDS_Mesh::ChangeElementNodes( elem, nodes, nbnodes ))
|
||||
return false;
|
||||
|
||||
std::vector<smIdType> IDs( nbnodes );
|
||||
@ -2262,7 +2262,7 @@ void SMESHDS_Mesh::BuildDownWardConnectivity(bool withEdges)
|
||||
* @param localClonedNodeIds map old node id to new node id.
|
||||
* @return ok if success.
|
||||
*/
|
||||
bool SMESHDS_Mesh::ModifyCellNodes(int vtkVolId, std::map<int,int> localClonedNodeIds)
|
||||
bool SMESHDS_Mesh::ModifyCellNodes(vtkIdType vtkVolId, std::map<int,int> localClonedNodeIds)
|
||||
{
|
||||
myGrid->ModifyCellNodes(vtkVolId, localClonedNodeIds);
|
||||
return true;
|
||||
|
@ -594,14 +594,14 @@ class SMESHDS_EXPORT SMESHDS_Mesh : public SMDS_Mesh
|
||||
|
||||
bool ChangeElementNodes(const SMDS_MeshElement * elem,
|
||||
const SMDS_MeshNode * nodes[],
|
||||
const smIdType nbnodes);
|
||||
const int nbnodes);
|
||||
bool ChangePolygonNodes(const SMDS_MeshElement * elem,
|
||||
std::vector<const SMDS_MeshNode*> nodes);
|
||||
bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
|
||||
const std::vector<const SMDS_MeshNode*>& nodes,
|
||||
const std::vector<int>& quantities);
|
||||
bool ModifyCellNodes(int smdsVolId, std::map<int,int> localClonedNodeIds);
|
||||
void Renumber (const bool isNodes, const int startID=1, const int deltaID=1);
|
||||
bool ModifyCellNodes(vtkIdType smdsVolId, std::map<int,int> localClonedNodeIds);
|
||||
void Renumber (const bool isNodes, const smIdType startID=1, const smIdType deltaID=1);
|
||||
|
||||
void SetNodeInVolume(const SMDS_MeshNode * aNode, const TopoDS_Shell & S);
|
||||
void SetNodeInVolume(const SMDS_MeshNode * aNode, const TopoDS_Solid & S);
|
||||
|
@ -106,7 +106,7 @@ void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * elem)
|
||||
AddNode( static_cast< const SMDS_MeshNode* >( elem ));
|
||||
return;
|
||||
}
|
||||
smIdType oldShapeId = elem->GetShapeID();
|
||||
int oldShapeId = elem->GetShapeID();
|
||||
if ( oldShapeId > 0 )
|
||||
{
|
||||
if (oldShapeId != myIndex)
|
||||
@ -235,12 +235,12 @@ bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
int SMESHDS_SubMesh::NbElements() const
|
||||
smIdType SMESHDS_SubMesh::NbElements() const
|
||||
{
|
||||
if ( !IsComplexSubmesh() )
|
||||
return myNbElements;
|
||||
|
||||
int nbElems = 0;
|
||||
smIdType nbElems = 0;
|
||||
TSubMeshSet::const_iterator it = mySubMeshes.begin();
|
||||
for ( ; it != mySubMeshes.end(); it++ )
|
||||
nbElems += (*it)->NbElements();
|
||||
@ -253,12 +253,12 @@ int SMESHDS_SubMesh::NbElements() const
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
int SMESHDS_SubMesh::NbNodes() const
|
||||
smIdType SMESHDS_SubMesh::NbNodes() const
|
||||
{
|
||||
if ( !IsComplexSubmesh() )
|
||||
return myNbNodes;
|
||||
|
||||
int nbElems = 0;
|
||||
smIdType nbElems = 0;
|
||||
TSubMeshSet::const_iterator it = mySubMeshes.begin();
|
||||
for ( ; it != mySubMeshes.end(); it++ )
|
||||
nbElems += (*it)->NbNodes();
|
||||
|
@ -67,8 +67,8 @@ class SMESHDS_EXPORT SMESHDS_SubMesh : public SMDS_ElementHolder
|
||||
SMESHDS_SubMeshIteratorPtr GetSubMeshIterator() const;
|
||||
|
||||
// for both types
|
||||
virtual int NbElements() const;
|
||||
virtual int NbNodes() const;
|
||||
virtual smIdType NbElements() const;
|
||||
virtual smIdType NbNodes() const;
|
||||
virtual SMDS_ElemIteratorPtr GetElements() const;
|
||||
virtual SMDS_NodeIteratorPtr GetNodes() const;
|
||||
virtual bool Contains(const SMDS_MeshElement * ME) const; // check if elem or node is in
|
||||
@ -90,8 +90,8 @@ class SMESHDS_EXPORT SMESHDS_SubMesh : public SMDS_ElementHolder
|
||||
private:
|
||||
|
||||
int myIndex;
|
||||
int myNbElements;
|
||||
int myNbNodes;
|
||||
smIdType myNbElements;
|
||||
smIdType myNbNodes;
|
||||
const SMDS_MeshElement* my1stElemNode[2]; // elem and node with least ID, to optimize iteration
|
||||
const SMESHDS_Mesh * myParent;
|
||||
TSubMeshSet mySubMeshes;
|
||||
|
Loading…
Reference in New Issue
Block a user