Geogram  Version 1.9.1
A programming library of geometric algorithms
GEO::MeshSubElementsStore Class Reference

Base class for mesh sub-element storage. More...

#include <geogram/mesh/mesh.h>

Inheritance diagram for GEO::MeshSubElementsStore:
GEO::MeshCellCornersStore GEO::MeshCellFacetsStore GEO::MeshCellsStore GEO::MeshEdges GEO::MeshFacetCornersStore GEO::MeshFacetsStore GEO::MeshVertices GEO::MeshCells GEO::MeshFacets

Public Member Functions

 MeshSubElementsStore (Mesh &mesh)
 Constructs a new MeshSubElementStore. More...
 
virtual ~MeshSubElementsStore ()
 MeshElementStore destructor.
 
index_t nb () const
 Gets the number of (sub-)elements. More...
 
AttributesManagerattributes () const
 Gets the attributes manager. More...
 
index_as_iterator begin () const
 Used by range-based for. More...
 
index_as_iterator end () const
 Used by range-based for. More...
 

Protected Member Functions

virtual void clear_store (bool keep_attributes, bool keep_memory=false)
 Removes all the elements and attributes. More...
 
virtual void resize_store (index_t new_size)
 Resizes this MeshSubElementsStore. More...
 
void reserve_store (index_t nb_to_reserve)
 Reserves space for new elements. More...
 
index_t create_sub_elements (index_t nb)
 Creates a contiguous chunk of attributes for sub-elements. More...
 
index_t create_sub_element ()
 Creates attributes for a sub-element. More...
 
void adjust_store ()
 Makes the size of the store tightly match the number of the elements. More...
 
void copy (const MeshSubElementsStore &rhs, bool copy_attributes=true)
 Copies a MeshSubElementsStore into this one. More...
 

Protected Attributes

Meshmesh_
 
AttributesManager attributes_
 
index_t nb_
 

Detailed Description

Base class for mesh sub-element storage.

Sub-elements are those that cannot exist independently (such as MeshFacetCorner, MeshCellCorner and MeshCellFacet).

Definition at line 70 of file mesh.h.

Constructor & Destructor Documentation

◆ MeshSubElementsStore()

GEO::MeshSubElementsStore::MeshSubElementsStore ( Mesh mesh)

Constructs a new MeshSubElementStore.

Parameters
[in]mesha reference to the mesh this MeshElementStore belongs to.

Member Function Documentation

◆ adjust_store()

void GEO::MeshSubElementsStore::adjust_store ( )
inlineprotected

Makes the size of the store tightly match the number of the elements.

When elements are created one by one, the system may allocate more memory than necessary, to amortize the cost of container reallocation. Once the object is constructed, this function may be called to release the memory that was not used.

Definition at line 201 of file mesh.h.

◆ attributes()

AttributesManager& GEO::MeshSubElementsStore::attributes ( ) const
inline

Gets the attributes manager.

The returned reference is not a const one, so that attributes can be bound / unbound / accessed even if the mesh is const.

Returns
a modifiable reference to the attributes manager.

Definition at line 100 of file mesh.h.

◆ begin()

index_as_iterator GEO::MeshSubElementsStore::begin ( ) const
inline

Used by range-based for.

Returns
The index of the first position.

Definition at line 108 of file mesh.h.

◆ clear_store()

virtual void GEO::MeshSubElementsStore::clear_store ( bool  keep_attributes,
bool  keep_memory = false 
)
protectedvirtual

Removes all the elements and attributes.

Parameters
[in]keep_attributesif true, then all the existing attribute names / bindings are kept (but they are cleared). If false, they are destroyed.
[in]keep_memoryif true, then memory is kept and can be reused by subsequent mesh element creations.

Reimplemented in GEO::MeshCellFacetsStore, GEO::MeshCellCornersStore, GEO::MeshCellsStore, GEO::MeshFacetCornersStore, GEO::MeshFacetsStore, GEO::MeshEdges, and GEO::MeshVertices.

◆ copy()

void GEO::MeshSubElementsStore::copy ( const MeshSubElementsStore rhs,
bool  copy_attributes = true 
)
inlineprotected

Copies a MeshSubElementsStore into this one.

Parameters
[in]rhsa const reference to the MeshSubElementsStore to be copied.
[in]copy_attributesif true, copies also the attributes, else attributes are cleared.

Definition at line 214 of file mesh.h.

◆ create_sub_element()

index_t GEO::MeshSubElementsStore::create_sub_element ( )
inlineprotected

Creates attributes for a sub-element.

Returns
the index of the created element

Definition at line 180 of file mesh.h.

◆ create_sub_elements()

index_t GEO::MeshSubElementsStore::create_sub_elements ( index_t  nb)
inlineprotected

Creates a contiguous chunk of attributes for sub-elements.

Parameters
[in]nbnumber of sub-elements to create
Returns
the index of the first created sub-element

Definition at line 159 of file mesh.h.

◆ end()

index_as_iterator GEO::MeshSubElementsStore::end ( ) const
inline

Used by range-based for.

Returns
The index of one position past the last position.

Definition at line 116 of file mesh.h.

◆ nb()

index_t GEO::MeshSubElementsStore::nb ( ) const
inline

Gets the number of (sub-)elements.

Returns
the number of (sub-)elements in this store

Definition at line 89 of file mesh.h.

◆ reserve_store()

void GEO::MeshSubElementsStore::reserve_store ( index_t  nb_to_reserve)
inlineprotected

Reserves space for new elements.

Parameters
[in]nb_to_reservethe number of subelements to reserve

Definition at line 148 of file mesh.h.

◆ resize_store()

virtual void GEO::MeshSubElementsStore::resize_store ( index_t  new_size)
protectedvirtual

Resizes this MeshSubElementsStore.

On exit, nb() == new_size, elements are created or destroyed if needed.

Parameters
[in]new_sizethe desired size

Reimplemented in GEO::MeshCellFacetsStore, GEO::MeshCellCornersStore, GEO::MeshCellsStore, GEO::MeshFacetCornersStore, GEO::MeshFacetsStore, GEO::MeshEdges, and GEO::MeshVertices.


The documentation for this class was generated from the following file: