mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-15 01:30:34 +05:00
correct SMESH_ElementFactory
This commit is contained in:
parent
0f2942f29e
commit
fed3f44553
@ -92,11 +92,11 @@ SMDS_ElementFactory::~SMDS_ElementFactory()
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return a number of elements in a chunk
|
||||
* \return int - chunk size
|
||||
* \return smIdType - chunk size
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
int SMDS_ElementFactory::ChunkSize()
|
||||
smIdType SMDS_ElementFactory::ChunkSize()
|
||||
{
|
||||
return theChunkSize;
|
||||
}
|
||||
@ -108,7 +108,7 @@ int SMDS_ElementFactory::ChunkSize()
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
int SMDS_ElementFactory::GetFreeID()
|
||||
smIdType SMDS_ElementFactory::GetFreeID()
|
||||
{
|
||||
if ( myChunksWithUnused.empty() )
|
||||
{
|
||||
@ -122,11 +122,11 @@ int SMDS_ElementFactory::GetFreeID()
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return maximal ID of an used element
|
||||
* \return int - element ID
|
||||
* \return smIdType - element ID
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
int SMDS_ElementFactory::GetMaxID()
|
||||
smIdType SMDS_ElementFactory::GetMaxID()
|
||||
{
|
||||
int id = 0;
|
||||
TIndexRanges usedRanges;
|
||||
@ -143,11 +143,11 @@ int SMDS_ElementFactory::GetMaxID()
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return minimal ID of an used element
|
||||
* \return int - element ID
|
||||
* \return smIdType - element ID
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
int SMDS_ElementFactory::GetMinID()
|
||||
smIdType SMDS_ElementFactory::GetMinID()
|
||||
{
|
||||
int id = 0;
|
||||
TIndexRanges usedRanges;
|
||||
@ -169,7 +169,7 @@ int SMDS_ElementFactory::GetMinID()
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
SMDS_MeshElement* SMDS_ElementFactory::NewElement( const int id )
|
||||
SMDS_MeshElement* SMDS_ElementFactory::NewElement( const smIdType id )
|
||||
{
|
||||
int iChunk = ( id - 1 ) / theChunkSize;
|
||||
int index = ( id - 1 ) % theChunkSize;
|
||||
@ -200,7 +200,7 @@ SMDS_MeshElement* SMDS_ElementFactory::NewElement( const int id )
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
const SMDS_MeshElement* SMDS_ElementFactory::FindElement( const int id ) const
|
||||
const SMDS_MeshElement* SMDS_ElementFactory::FindElement( const smIdType id ) const
|
||||
{
|
||||
if ( id > 0 )
|
||||
{
|
||||
@ -488,7 +488,7 @@ void SMDS_NodeFactory::SetNbShapes( size_t nbShapes )
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
int SMDS_NodeFactory::GetShapeDim( int shapeID ) const
|
||||
int SMDS_NodeFactory::GetShapeDim( smIdType shapeID ) const
|
||||
{
|
||||
return shapeID < (int)myShapeDim.size() ? myShapeDim[ shapeID ] : theDefaultShapeDim;
|
||||
}
|
||||
@ -499,9 +499,9 @@ int SMDS_NodeFactory::GetShapeDim( int shapeID ) const
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void SMDS_NodeFactory::SetShapeDim( int shapeID, int dim )
|
||||
void SMDS_NodeFactory::SetShapeDim( smIdType shapeID, int dim )
|
||||
{
|
||||
if ( shapeID >= (int)myShapeDim.size() )
|
||||
if ( shapeID >= (smIdType)myShapeDim.size() )
|
||||
myShapeDim.resize( shapeID + 10, theDefaultShapeDim );
|
||||
myShapeDim[ shapeID ] = dim;
|
||||
}
|
||||
|
@ -40,6 +40,8 @@
|
||||
|
||||
#include <vtkType.h>
|
||||
|
||||
#include <smIdType.hxx>
|
||||
|
||||
class SMDS_ElementChunk;
|
||||
class SMDS_Mesh;
|
||||
class SMDS_MeshCell;
|
||||
@ -78,25 +80,25 @@ public:
|
||||
virtual ~SMDS_ElementFactory();
|
||||
|
||||
//! Return minimal ID of a non-used element
|
||||
int GetFreeID();
|
||||
smIdType GetFreeID();
|
||||
|
||||
//! Return maximal ID of an used element
|
||||
int GetMaxID();
|
||||
smIdType GetMaxID();
|
||||
|
||||
//! Return minimal ID of an used element
|
||||
int GetMinID();
|
||||
smIdType GetMinID();
|
||||
|
||||
//! Return an element by ID. NULL if the element with the given ID is already used
|
||||
SMDS_MeshElement* NewElement( const int id );
|
||||
SMDS_MeshElement* NewElement( const smIdType id );
|
||||
|
||||
//! Return a SMDS_MeshCell by ID. NULL if the cell with the given ID is already used
|
||||
SMDS_MeshCell* NewCell( const int id ) { return static_cast<SMDS_MeshCell*>( NewElement( id )); }
|
||||
SMDS_MeshCell* NewCell( const smIdType id ) { return static_cast<SMDS_MeshCell*>( NewElement( id )); }
|
||||
|
||||
//! Return an used element by ID. NULL if the element with the given ID is not yet used
|
||||
const SMDS_MeshElement* FindElement( const int id ) const;
|
||||
const SMDS_MeshElement* FindElement( const smIdType id ) const;
|
||||
|
||||
//! Return a number of used elements
|
||||
int NbUsedElements() const { return myNbUsedElements; }
|
||||
smIdType NbUsedElements() const { return myNbUsedElements; }
|
||||
|
||||
//! Return an iterator on all element filtered using a given filter.
|
||||
// nbElemsToReturn is used to optimize by stopping the iteration as soon as
|
||||
@ -132,7 +134,7 @@ public:
|
||||
virtual bool CompactChangePointers();
|
||||
|
||||
//! Return a number of elements in a chunk
|
||||
static int ChunkSize();
|
||||
static smIdType ChunkSize();
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------------
|
||||
@ -149,19 +151,19 @@ public:
|
||||
~SMDS_NodeFactory();
|
||||
|
||||
//! Return a SMDS_MeshNode by ID. NULL if the node with the given ID is already used
|
||||
SMDS_MeshNode* NewNode( int id ) { return (SMDS_MeshNode*) NewElement(id); }
|
||||
SMDS_MeshNode* NewNode( smIdType id ) { return (SMDS_MeshNode*) NewElement(id); }
|
||||
|
||||
//! Return an used node by ID. NULL if the node with the given ID is not yet used
|
||||
const SMDS_MeshNode* FindNode( int id ) { return (const SMDS_MeshNode*) FindElement(id); }
|
||||
const SMDS_MeshNode* FindNode( smIdType id ) { return (const SMDS_MeshNode*) FindElement(id); }
|
||||
|
||||
//! Set a total number of sub-shapes in the main shape
|
||||
void SetNbShapes( size_t nbShapes );
|
||||
|
||||
//! Return a dimension of a shape
|
||||
int GetShapeDim( int shapeID ) const;
|
||||
int GetShapeDim( smIdType shapeID ) const;
|
||||
|
||||
//! Set a dimension of a shape
|
||||
void SetShapeDim( int shapeID, int dim );
|
||||
void SetShapeDim( smIdType shapeID, int dim );
|
||||
|
||||
//! De-allocate all nodes
|
||||
virtual void Clear();
|
||||
@ -403,7 +405,7 @@ public:
|
||||
static bool IsUsed( const _UsedRange& r ) { return r.myValue; }
|
||||
|
||||
//! Return index of an element in the chunk
|
||||
int Index( const SMDS_MeshElement* e ) const { return e - myElements; }
|
||||
smIdType Index( const SMDS_MeshElement* e ) const { return e - myElements; }
|
||||
|
||||
//! Return ID of the 1st element in the chunk
|
||||
int Get1stID() const { return my1stID; }
|
||||
|
Loading…
Reference in New Issue
Block a user