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_MeshElement * | Element (int index) |
Return an element by an index [0,ChunkSize()]. More... | |
const SMDS_MeshElement * | Element (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... | |
TParam * | GetPositionPtr (const SMDS_MeshElement *node, bool allocate=false) |
Return pointer to on-shape-parameters of a node. More... | |
const TUsedRangeSet & | GetUsedRanges () const |
Return ranges of used/non-used elements. More... | |
const TUsedRangeSet & | GetUsedRangesMinMax (bool &min, bool &max) const |
const TSubIDRangeSet & | GetSubIDRangesMinMax (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_Mesh * | GetMesh () |
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_ElementFactory * | myFactory |
SMDS_MeshElement * | myElements |
smIdType | my1stID |
TBitSet | myMarkedSet |
TUsedRangeSet | myUsedRanges |
TSubIDRangeSet | mySubIDRanges |
std::vector< TParam > | myPositions |
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.
SMDS_ElementChunk::SMDS_ElementChunk | ( | SMDS_ElementFactory * | factory = 0 , |
smIdType | id0 = 0 |
||
) |
SMDS_ElementChunk constructor.
[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 destructor.
References SMDS_ElementFactory::myChunksWithUnused, myElements, and myFactory.
void SMDS_ElementChunk::Compact | ( | ) |
Minimize allocated memory.
References myFactory, myMarkedSet, myPositions, _RangeSet< RANGE >::mySet, mySubIDRanges, and myUsedRanges.
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().
SMDS_MeshElement* SMDS_ElementChunk::Element | ( | int | index | ) |
Return an element by an index [0,ChunkSize()].
References myElements.
const SMDS_MeshElement* SMDS_ElementChunk::Element | ( | int | index | ) | const |
Return an element by an index [0,ChunkSize()].
References myElements.
void SMDS_ElementChunk::Free | ( | const SMDS_MeshElement * | e | ) |
Mark an element as non-used.
References Index(), SMDS_ElementFactory::myChunksWithUnused, myFactory, myMarkedSet, myPositions, myUsedRanges, SetIsMarked(), SetShapeID(), _RangeSet< RANGE >::SetValue(), and _RangeSet< RANGE >::Size().
Referenced by SMDS_ElementFactory::Free().
smIdType SMDS_ElementChunk::Get1stID | ( | ) | const |
Return ID of the 1st element in the chunk.
References my1stID.
Referenced by _ChunkCompare::operator()().
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().
SMDS_Mesh* SMDS_ElementChunk::GetMesh | ( | ) |
References myFactory, and SMDS_ElementFactory::myMesh.
SMDS_PositionPtr SMDS_ElementChunk::GetPosition | ( | const SMDS_MeshNode * | n | ) | const |
Return SMDS_Position of a node on a shape.
References GetPositionPtr(), GetShapeID(), myFactory, SMDS_SpacePosition::originSpacePosition(), and SMDS_VertexPosition::StaticPosition().
Referenced by SMDS_MeshNode::GetPosition().
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().
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().
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().
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().
const TUsedRangeSet& SMDS_ElementChunk::GetUsedRanges | ( | ) | const |
Return ranges of used/non-used elements.
References myUsedRanges.
const TUsedRangeSet& SMDS_ElementChunk::GetUsedRangesMinMax | ( | bool & | min, |
bool & | max | ||
) | const |
References myUsedRanges.
Referenced by SMDS_ElementFactory::GetIterator().
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().
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().
bool SMDS_ElementChunk::IsMarked | ( | const SMDS_MeshElement * | e | ) | const |
Set isMarked flag of an element.
References Index(), and myMarkedSet.
Referenced by SMDS_MeshElement::isMarked().
|
static |
Check if a given range holds used or non-used elements.
References _Range< ATTR >::myValue.
Referenced by GetUnusedID().
void SMDS_ElementChunk::SetAllNotMarked | ( | ) |
Clear marked flag of all elements.
References myMarkedSet.
void SMDS_ElementChunk::SetIsMarked | ( | const SMDS_MeshElement * | e, |
bool | is | ||
) |
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().
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().
void SMDS_ElementChunk::SetVTKID | ( | const SMDS_MeshElement * | e, |
const vtkIdType | id | ||
) |
Set a Vtk ID of an element.
References SMDS_MeshElement::GetID(), myFactory, SMDS_ElementFactory::mySmdsIDs, and SMDS_ElementFactory::myVtkIDs.
Referenced by SMDS_MeshElement::setVtkID().
void SMDS_ElementChunk::UseElement | ( | const int | index | ) |
Mark an element as used.
References SMDS_ElementFactory::myChunksWithUnused, myFactory, myUsedRanges, _RangeSet< RANGE >::SetValue(), and _RangeSet< RANGE >::Size().
|
private |
Referenced by Dump(), Get1stID(), GetID(), and GetUnusedID().
|
private |
Referenced by Element(), Index(), SMDS_ElementChunk(), and ~SMDS_ElementChunk().
|
private |
Referenced by Compact(), Free(), GetMesh(), GetPosition(), GetVtkID(), SetPosition(), SetVTKID(), SMDS_ElementChunk(), UseElement(), and ~SMDS_ElementChunk().
|
private |
Referenced by Compact(), Free(), IsMarked(), SetAllNotMarked(), and SetIsMarked().
|
private |
Referenced by Compact(), Free(), and GetPositionPtr().
|
private |
Referenced by Compact(), Dump(), GetShapeID(), GetSubIDRangesMinMax(), SetShapeID(), and SMDS_ElementChunk().
|
private |
Referenced by Compact(), Dump(), Free(), GetUnusedID(), GetUsedRanges(), GetUsedRangesMinMax(), SMDS_ElementChunk(), and UseElement().