From 3a21bf22a85421a420e633a2f16d0929953b54d5 Mon Sep 17 00:00:00 2001 From: Viktor UZLOV Date: Wed, 27 Jan 2021 11:00:38 +0300 Subject: [PATCH] correct ElementFactory, CellOfNode --- src/SMDS/SMDS_CellOfNodes.cxx | 10 +++++----- src/SMDS/SMDS_CellOfNodes.hxx | 16 +++++++++------- src/SMDS/SMDS_ElementFactory.cxx | 10 +++++----- src/SMDS/SMDS_ElementFactory.hxx | 6 +++--- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/SMDS/SMDS_CellOfNodes.cxx b/src/SMDS/SMDS_CellOfNodes.cxx index 0aed491f4..41c993088 100644 --- a/src/SMDS/SMDS_CellOfNodes.cxx +++ b/src/SMDS/SMDS_CellOfNodes.cxx @@ -25,28 +25,28 @@ #include "SMDS_CellOfNodes.hxx" -SMDS_CellOfNodes::SMDS_CellOfNodes( int id, int shapeID ) +SMDS_CellOfNodes::SMDS_CellOfNodes( smIdType id, smIdType shapeID ) : myID( id ) { setShapeID( shapeID ); } -void SMDS_CellOfNodes::setID(const int id) +void SMDS_CellOfNodes::setID(const smIdType id) { myID = id; } -int SMDS_CellOfNodes::GetID() const +smIdType SMDS_CellOfNodes::GetID() const { return myID; } -void SMDS_CellOfNodes::setShapeID( const int shapeID ) +void SMDS_CellOfNodes::setShapeID( const smIdType shapeID ) { myShapeID = ( shapeID << BITS_SHIFT ) | ( myShapeID & BIT_IS_MARKED ); } -int SMDS_CellOfNodes::GetShapeID() const +smIdType SMDS_CellOfNodes::GetShapeID() const { return myShapeID >> BITS_SHIFT; } diff --git a/src/SMDS/SMDS_CellOfNodes.hxx b/src/SMDS/SMDS_CellOfNodes.hxx index acedefeb8..6f52fa732 100644 --- a/src/SMDS/SMDS_CellOfNodes.hxx +++ b/src/SMDS/SMDS_CellOfNodes.hxx @@ -31,6 +31,8 @@ #include "SMDS_MeshElement.hxx" +#include + // ============================================================ /*! * \brief Base class for elements not contained in the mesh @@ -42,8 +44,8 @@ class SMDS_EXPORT SMDS_CellOfNodes : public SMDS_MeshElement { public: - virtual int GetID() const; - virtual int GetShapeID() const; + virtual smIdType GetID() const; + virtual smIdType GetShapeID() const; virtual void setIsMarked( bool is ) const; virtual bool isMarked() const; @@ -52,13 +54,13 @@ public: 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 setShapeID( const int shapeID ); + virtual void setID( const smIdType id); + virtual void setShapeID( const smIdType shapeID ); - int myID; - int myShapeID; + smIdType myID; + smIdType myShapeID; enum Bits { // use the 1st right bit of myShapeId to set/unset a mark BIT_IS_MARKED = 1, diff --git a/src/SMDS/SMDS_ElementFactory.cxx b/src/SMDS/SMDS_ElementFactory.cxx index ed07ccdf8..a90965fe5 100644 --- a/src/SMDS/SMDS_ElementFactory.cxx +++ b/src/SMDS/SMDS_ElementFactory.cxx @@ -92,11 +92,11 @@ SMDS_ElementFactory::~SMDS_ElementFactory() //================================================================================ /*! * \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; } @@ -295,7 +295,7 @@ void SMDS_ElementFactory::Compact( std::vector& theVtkIDsNewToOld ) } 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 ) theVtkIDsNewToOld[ newID ] = myVtkIDs[ 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(); 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 ); } diff --git a/src/SMDS/SMDS_ElementFactory.hxx b/src/SMDS/SMDS_ElementFactory.hxx index 1521067ed..01bae378a 100644 --- a/src/SMDS/SMDS_ElementFactory.hxx +++ b/src/SMDS/SMDS_ElementFactory.hxx @@ -134,7 +134,7 @@ public: virtual bool CompactChangePointers(); //! 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]; } //! Return ID of the first non-used element - int GetUnusedID() const; + smIdType GetUnusedID() const; //! Mark an element as used void UseElement( const int index ); @@ -431,7 +431,7 @@ public: // 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; void SetVTKID( const SMDS_MeshElement* e, const vtkIdType id ); -- 2.39.2