correct ElementFactory, CellOfNode

This commit is contained in:
Viktor UZLOV 2021-01-27 11:00:38 +03:00
parent fed3f44553
commit 3a21bf22a8
4 changed files with 22 additions and 20 deletions

View File

@ -25,28 +25,28 @@
#include "SMDS_CellOfNodes.hxx" #include "SMDS_CellOfNodes.hxx"
SMDS_CellOfNodes::SMDS_CellOfNodes( int id, int shapeID ) SMDS_CellOfNodes::SMDS_CellOfNodes( smIdType id, smIdType shapeID )
: myID( id ) : myID( id )
{ {
setShapeID( shapeID ); setShapeID( shapeID );
} }
void SMDS_CellOfNodes::setID(const int id) void SMDS_CellOfNodes::setID(const smIdType id)
{ {
myID = id; myID = id;
} }
int SMDS_CellOfNodes::GetID() const smIdType SMDS_CellOfNodes::GetID() const
{ {
return myID; return myID;
} }
void SMDS_CellOfNodes::setShapeID( const int shapeID ) void SMDS_CellOfNodes::setShapeID( const smIdType shapeID )
{ {
myShapeID = ( shapeID << BITS_SHIFT ) | ( myShapeID & BIT_IS_MARKED ); myShapeID = ( shapeID << BITS_SHIFT ) | ( myShapeID & BIT_IS_MARKED );
} }
int SMDS_CellOfNodes::GetShapeID() const smIdType SMDS_CellOfNodes::GetShapeID() const
{ {
return myShapeID >> BITS_SHIFT; return myShapeID >> BITS_SHIFT;
} }

View File

@ -31,6 +31,8 @@
#include "SMDS_MeshElement.hxx" #include "SMDS_MeshElement.hxx"
#include <smIdType.hxx>
// ============================================================ // ============================================================
/*! /*!
* \brief Base class for elements not contained in the mesh * \brief Base class for elements not contained in the mesh
@ -42,8 +44,8 @@ class SMDS_EXPORT SMDS_CellOfNodes : public SMDS_MeshElement
{ {
public: public:
virtual int GetID() const; virtual smIdType GetID() const;
virtual int GetShapeID() const; virtual smIdType GetShapeID() const;
virtual void setIsMarked( bool is ) const; virtual void setIsMarked( bool is ) const;
virtual bool isMarked() const; virtual bool isMarked() const;
@ -52,13 +54,13 @@ public:
protected: protected:
SMDS_CellOfNodes( int id = -1, int shapeID = 0); SMDS_CellOfNodes( smIdType id = -1, smIdType shapeID = 0);
virtual void setID( const int id); virtual void setID( const smIdType id);
virtual void setShapeID( const int shapeID ); virtual void setShapeID( const smIdType shapeID );
int myID; smIdType myID;
int myShapeID; smIdType myShapeID;
enum Bits { // use the 1st right bit of myShapeId to set/unset a mark enum Bits { // use the 1st right bit of myShapeId to set/unset a mark
BIT_IS_MARKED = 1, BIT_IS_MARKED = 1,

View File

@ -92,11 +92,11 @@ SMDS_ElementFactory::~SMDS_ElementFactory()
//================================================================================ //================================================================================
/*! /*!
* \brief Return a number of elements in a chunk * \brief Return a number of elements in a chunk
* \return smIdType - chunk size * \return int - chunk size
*/ */
//================================================================================ //================================================================================
smIdType SMDS_ElementFactory::ChunkSize() int SMDS_ElementFactory::ChunkSize()
{ {
return theChunkSize; return theChunkSize;
} }
@ -295,7 +295,7 @@ void SMDS_ElementFactory::Compact( std::vector<int>& theVtkIDsNewToOld )
} }
else if ( newNbCells == maxCellID ) // no holes else if ( newNbCells == maxCellID ) // no holes
{ {
int newID, minLastID = std::min( myVtkIDs.size(), theVtkIDsNewToOld.size() ); smIdType newID, minLastID = std::min( myVtkIDs.size(), theVtkIDsNewToOld.size() );
for ( newID = 0; newID < minLastID; ++newID ) for ( newID = 0; newID < minLastID; ++newID )
theVtkIDsNewToOld[ newID ] = myVtkIDs[ newID ]; theVtkIDsNewToOld[ newID ] = myVtkIDs[ newID ];
for ( ; newID < newNbCells; ++newID ) for ( ; newID < newNbCells; ++newID )
@ -565,7 +565,7 @@ void SMDS_ElementChunk::UseElement( const int index )
*/ */
//================================================================================ //================================================================================
int SMDS_ElementChunk::GetUnusedID() const smIdType SMDS_ElementChunk::GetUnusedID() const
{ {
TUsedRangeSet::set_iterator r = myUsedRanges.mySet.begin(); TUsedRangeSet::set_iterator r = myUsedRanges.mySet.begin();
for ( ; r != myUsedRanges.mySet.end(); ++r ) for ( ; r != myUsedRanges.mySet.end(); ++r )
@ -603,7 +603,7 @@ void SMDS_ElementChunk::Free( const SMDS_MeshElement* e )
*/ */
//================================================================================ //================================================================================
int SMDS_ElementChunk::GetID( const SMDS_MeshElement* e ) const smIdType SMDS_ElementChunk::GetID( const SMDS_MeshElement* e ) const
{ {
return my1stID + Index( e ); return my1stID + Index( e );
} }

View File

@ -134,7 +134,7 @@ public:
virtual bool CompactChangePointers(); virtual bool CompactChangePointers();
//! Return a number of elements in a chunk //! Return a number of elements in a chunk
static smIdType ChunkSize(); static int ChunkSize();
}; };
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@ -393,7 +393,7 @@ public:
const SMDS_MeshElement* Element(int index) const { return & myElements[index]; } const SMDS_MeshElement* Element(int index) const { return & myElements[index]; }
//! Return ID of the first non-used element //! Return ID of the first non-used element
int GetUnusedID() const; smIdType GetUnusedID() const;
//! Mark an element as used //! Mark an element as used
void UseElement( const int index ); void UseElement( const int index );
@ -431,7 +431,7 @@ public:
// Methods called by SMDS_MeshElement // Methods called by SMDS_MeshElement
int GetID( const SMDS_MeshElement* e ) const; smIdType GetID( const SMDS_MeshElement* e ) const;
int GetVtkID( const SMDS_MeshElement* e ) const; int GetVtkID( const SMDS_MeshElement* e ) const;
void SetVTKID( const SMDS_MeshElement* e, const vtkIdType id ); void SetVTKID( const SMDS_MeshElement* e, const vtkIdType id );