Version: 9.12.0
SMDS_ElementChunk Class Reference

Allocate SMDS_MeshElement's (SMDS_MeshCell's or SMDS_MeshNode's ) and bind some attributes to elements: element ID, sub-shape ID, isMarked flag, parameters on shape. More...

#include <SMDS_ElementFactory.hxx>

Public Member Functions

 SMDS_ElementChunk (SMDS_ElementFactory *factory=0, smIdType id0=0)
 SMDS_ElementChunk constructor. More...
 
 ~SMDS_ElementChunk ()
 SMDS_ElementChunk destructor. More...
 
SMDS_MeshElementElement (int index)
 Return an element by an index [0,ChunkSize()]. More...
 
const SMDS_MeshElementElement (int index) const
 Return an element by an index [0,ChunkSize()]. More...
 
smIdType GetUnusedID () const
 Return ID of the first non-used element. More...
 
void UseElement (const int index)
 Mark an element as used. More...
 
void Free (const SMDS_MeshElement *e)
 Mark an element as non-used. More...
 
int Index (const SMDS_MeshElement *e) const
 Return index of an element in the chunk. More...
 
smIdType Get1stID () const
 Return ID of the 1st element in the chunk. More...
 
TParamGetPositionPtr (const SMDS_MeshElement *node, bool allocate=false)
 Return pointer to on-shape-parameters of a node. More...
 
const TUsedRangeSetGetUsedRanges () const
 Return ranges of used/non-used elements. More...
 
const TUsedRangeSetGetUsedRangesMinMax (bool &min, bool &max) const
 
const TSubIDRangeSetGetSubIDRangesMinMax (int &, int &) const
 Return ranges of elements assigned to sub-shapes and min/max of sub-shape IDs. More...
 
void Compact ()
 Minimize allocated memory. More...
 
void Dump () const
 Print some data. More...
 
smIdType GetID (const SMDS_MeshElement *e) const
 Return an SMDS ID of an element. More...
 
vtkIdType GetVtkID (const SMDS_MeshElement *e) const
 Return a Vtk ID of an element. More...
 
void SetVTKID (const SMDS_MeshElement *e, const vtkIdType id)
 Set a Vtk ID of an element. More...
 
int GetShapeID (const SMDS_MeshElement *e) const
 Return ID of a shape an element is assigned to. More...
 
void SetShapeID (const SMDS_MeshElement *e, int shapeID) const
 Set ID of a shape an element is assigned to. More...
 
bool IsMarked (const SMDS_MeshElement *e) const
 Set isMarked flag of an element. More...
 
void SetIsMarked (const SMDS_MeshElement *e, bool is)
 Return isMarked flag of an element. More...
 
void SetAllNotMarked ()
 Clear marked flag of all elements. More...
 
SMDS_PositionPtr GetPosition (const SMDS_MeshNode *n) const
 Return SMDS_Position of a node on a shape. More...
 
void SetPosition (const SMDS_MeshNode *n, const SMDS_PositionPtr &pos, int shapeID)
 Set SMDS_Position of a node on a shape. More...
 
SMDS_MeshGetMesh ()
 

Static Public Member Functions

static bool IsUsed (const _UsedRange &r)
 Check if a given range holds used or non-used elements. More...
 

Private Attributes

SMDS_ElementFactorymyFactory
 
SMDS_MeshElementmyElements
 
smIdType my1stID
 
TBitSet myMarkedSet
 
TUsedRangeSet myUsedRanges
 
TSubIDRangeSet mySubIDRanges
 
std::vector< TParammyPositions
 

Detailed Description

Allocate SMDS_MeshElement's (SMDS_MeshCell's or SMDS_MeshNode's ) and bind some attributes to elements: element ID, sub-shape ID, isMarked flag, parameters on shape.

Constructor & Destructor Documentation

◆ SMDS_ElementChunk()

SMDS_ElementChunk::SMDS_ElementChunk ( SMDS_ElementFactory factory = 0,
smIdType  id0 = 0 
)

SMDS_ElementChunk constructor.

Parameters
[in]factory- the factory
[in]id0- ID of the 1st element

References SMDS_ElementFactory::myChunksWithUnused, myElements, myFactory, SMDS_ElementFactory::myIsNodal, _RangeSet< RANGE >::mySet, mySubIDRanges, and myUsedRanges.

◆ ~SMDS_ElementChunk()

SMDS_ElementChunk::~SMDS_ElementChunk ( )

Member Function Documentation

◆ Compact()

void SMDS_ElementChunk::Compact ( )

Minimize allocated memory.

References myFactory, myMarkedSet, myPositions, _RangeSet< RANGE >::mySet, mySubIDRanges, and myUsedRanges.

◆ Dump()

void SMDS_ElementChunk::Dump ( ) const

Print some data.

Print some data for debug purposes.

References my1stID, _RangeSet< RANGE >::mySet, mySubIDRanges, myUsedRanges, and _RangeSet< RANGE >::Size().

◆ Element() [1/2]

SMDS_MeshElement* SMDS_ElementChunk::Element ( int  index)

Return an element by an index [0,ChunkSize()].

References myElements.

◆ Element() [2/2]

const SMDS_MeshElement* SMDS_ElementChunk::Element ( int  index) const

Return an element by an index [0,ChunkSize()].

References myElements.

◆ Free()

◆ Get1stID()

smIdType SMDS_ElementChunk::Get1stID ( ) const

Return ID of the 1st element in the chunk.

References my1stID.

Referenced by _ChunkCompare::operator()().

◆ GetID()

smIdType SMDS_ElementChunk::GetID ( const SMDS_MeshElement e) const

Return an SMDS ID of an element.

References Index(), and my1stID.

Referenced by SMDS_MeshElement::GetID().

◆ GetMesh()

SMDS_Mesh* SMDS_ElementChunk::GetMesh ( )

◆ GetPosition()

SMDS_PositionPtr SMDS_ElementChunk::GetPosition ( const SMDS_MeshNode n) const

◆ GetPositionPtr()

TParam * SMDS_ElementChunk::GetPositionPtr ( const SMDS_MeshElement node,
bool  allocate = false 
)

Return pointer to on-shape-parameters of a node.

References Index(), and myPositions.

Referenced by GetPosition(), SetPosition(), and SetShapeID().

◆ GetShapeID()

int SMDS_ElementChunk::GetShapeID ( const SMDS_MeshElement e) const

Return ID of a shape an element is assigned to.

References _RangeSet< RANGE >::GetValue(), Index(), and mySubIDRanges.

Referenced by GetPosition(), SMDS_MeshElement::GetShapeID(), and SetPosition().

◆ GetSubIDRangesMinMax()

const TSubIDRangeSet& SMDS_ElementChunk::GetSubIDRangesMinMax ( int &  ,
int &   
) const

Return ranges of elements assigned to sub-shapes and min/max of sub-shape IDs.

References mySubIDRanges.

Referenced by SMDS_ElementFactory::GetShapeIterator().

◆ GetUnusedID()

smIdType SMDS_ElementChunk::GetUnusedID ( ) const

Return ID of the first non-used element.

References IsUsed(), my1stID, _RangeSet< RANGE >::mySet, and myUsedRanges.

Referenced by SMDS_ElementFactory::GetFreeID().

◆ GetUsedRanges()

const TUsedRangeSet& SMDS_ElementChunk::GetUsedRanges ( ) const

Return ranges of used/non-used elements.

References myUsedRanges.

◆ GetUsedRangesMinMax()

const TUsedRangeSet& SMDS_ElementChunk::GetUsedRangesMinMax ( bool &  min,
bool &  max 
) const

◆ GetVtkID()

vtkIdType SMDS_ElementChunk::GetVtkID ( const SMDS_MeshElement e) const

Return a Vtk ID of an element.

References SMDS_MeshElement::GetID(), myFactory, and SMDS_ElementFactory::myVtkIDs.

Referenced by SMDS_MeshElement::GetVtkID().

◆ Index()

int SMDS_ElementChunk::Index ( const SMDS_MeshElement e) const

Return index of an element in the chunk.

References myElements.

Referenced by Free(), GetID(), GetPositionPtr(), GetShapeID(), IsMarked(), SetIsMarked(), and SetShapeID().

◆ IsMarked()

bool SMDS_ElementChunk::IsMarked ( const SMDS_MeshElement e) const

Set isMarked flag of an element.

References Index(), and myMarkedSet.

Referenced by SMDS_MeshElement::isMarked().

◆ IsUsed()

static bool SMDS_ElementChunk::IsUsed ( const _UsedRange r)
static

Check if a given range holds used or non-used elements.

References _Range< ATTR >::myValue.

Referenced by GetUnusedID().

◆ SetAllNotMarked()

void SMDS_ElementChunk::SetAllNotMarked ( )

Clear marked flag of all elements.

References myMarkedSet.

◆ SetIsMarked()

void SMDS_ElementChunk::SetIsMarked ( const SMDS_MeshElement e,
bool  is 
)

Return isMarked flag of an element.

References Index(), and myMarkedSet.

Referenced by Free().

◆ SetPosition()

void SMDS_ElementChunk::SetPosition ( const SMDS_MeshNode n,
const SMDS_PositionPtr pos,
int  shapeID 
)

Set SMDS_Position of a node on a shape.

References GetPositionPtr(), GetShapeID(), and myFactory.

Referenced by SMDS_MeshNode::SetPosition().

◆ SetShapeID()

void SMDS_ElementChunk::SetShapeID ( const SMDS_MeshElement e,
int  shapeID 
) const

Set ID of a shape an element is assigned to.

References GetPositionPtr(), Index(), mySubIDRanges, and _RangeSet< RANGE >::SetValue().

Referenced by Free().

◆ SetVTKID()

void SMDS_ElementChunk::SetVTKID ( const SMDS_MeshElement e,
const vtkIdType  id 
)

◆ UseElement()

void SMDS_ElementChunk::UseElement ( const int  index)

Field Documentation

◆ my1stID

smIdType SMDS_ElementChunk::my1stID
private

Referenced by Dump(), Get1stID(), GetID(), and GetUnusedID().

◆ myElements

SMDS_MeshElement* SMDS_ElementChunk::myElements
private

◆ myFactory

◆ myMarkedSet

TBitSet SMDS_ElementChunk::myMarkedSet
private

◆ myPositions

std::vector<TParam> SMDS_ElementChunk::myPositions
private

Referenced by Compact(), Free(), and GetPositionPtr().

◆ mySubIDRanges

TSubIDRangeSet SMDS_ElementChunk::mySubIDRanges
private

◆ myUsedRanges

TUsedRangeSet SMDS_ElementChunk::myUsedRanges
private