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

The vertices of a mesh. More...

#include <geogram/mesh/mesh.h>

Inheritance diagram for GEO::MeshVertices:
GEO::MeshSubElementsStore GEO::MeshElements

Public Member Functions

 MeshVertices (Mesh &mesh)
 
void remove_isolated ()
 Removes the vertices that have no mesh element incident to them.
 
void delete_elements (vector< index_t > &to_delete, bool remove_isolated_vertices=true) override
 Deletes a set of elements. More...
 
void permute_elements (vector< index_t > &permutation) override
 Applies a permutation to the elements and their attributes. More...
 
index_t create_vertex ()
 Creates a new vertex. More...
 
index_t create_vertex (const double *coords)
 Creates a new vertex. More...
 
index_t create_vertices (index_t nb)
 Creates a contiguous chunk of vertices. More...
 
void clear (bool keep_attributes=true, bool keep_memory=false) override
 Removes all the elements and attributes. More...
 
void set_single_precision ()
 Sets single precision mode. More...
 
void set_double_precision ()
 Sets double precision mode. More...
 
bool single_precision () const
 Tests whether vertices are stored in single-precision mode. More...
 
bool double_precision () const
 Tests whether vertices are stored in double-precision mode. More...
 
index_t dimension () const
 Gets the dimension of the vertices. More...
 
void set_dimension (index_t dim)
 Sets the dimension of the vertices. More...
 
const double * point_ptr (index_t v) const
 Gets a point. More...
 
double * point_ptr (index_t v)
 Gets a point. More...
 
vec3point (index_t v)
 Gets a point. More...
 
const vec3point (index_t v) const
 Gets a point. More...
 
const float * single_precision_point_ptr (index_t v) const
 Gets a (single-precision) point. More...
 
float * single_precision_point_ptr (index_t v)
 Gets a (single-precision) point. More...
 
void assign_points (vector< double > &points, index_t dim, bool steal_arg)
 Assigns all the points. More...
 
void assign_points (const double *points, index_t dim, index_t nb_pts)
 Assigns all the points. More...
 
void pop () override
 Removes the last element.
 
- Public Member Functions inherited from GEO::MeshSubElementsStore
 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

void clear_store (bool keep_attributes, bool keep_memory=false) override
 Removes all the elements and attributes. More...
 
void resize_store (index_t new_size) override
 Resizes this MeshSubElementsStore. More...
 
void bind_point_attribute (index_t dim, bool single_precision=false)
 
void copy (const MeshVertices &rhs, bool copy_attributes=true)
 
- Protected Member Functions inherited from GEO::MeshSubElementsStore
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

MeshEdgesedges_
 
MeshFacetCornersStorefacet_corners_
 
MeshCellCornersStorecell_corners_
 
Attribute< double > point_
 
Attribute< float > point_fp32_
 
- Protected Attributes inherited from GEO::MeshSubElementsStore
Meshmesh_
 
AttributesManager attributes_
 
index_t nb_
 

Friends

class Mesh
 
class GeogramIOHandler
 

Additional Inherited Members

- Static Protected Member Functions inherited from GEO::MeshElements
static bool has_non_zero (const GEO::vector< index_t > &I)
 Tests whether a vector contains a non-zero value. More...
 

Detailed Description

The vertices of a mesh.

Definition at line 322 of file mesh.h.

Member Function Documentation

◆ assign_points() [1/2]

void GEO::MeshVertices::assign_points ( const double *  points,
index_t  dim,
index_t  nb_pts 
)

Assigns all the points.

Parameters
[in]pointsa const pointer to the (dim * nb_pts) coordinates of al the points
[in]dimthe dimension of the points, i.e. number of coordinates per point
[in]nb_ptsnumber of points

◆ assign_points() [2/2]

void GEO::MeshVertices::assign_points ( vector< double > &  points,
index_t  dim,
bool  steal_arg 
)

Assigns all the points.

Parameters
[in]pointsa vector that contains all the coordinates of the points
[in]dimthe dimension of the points, i.e. number of coordinates per point
[in]steal_argif true, memory is stolen from points, using std::vector::swap (no memory copy).

◆ clear()

void GEO::MeshVertices::clear ( bool  keep_attributes = true,
bool  keep_memory = false 
)
overridevirtual

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.

Implements GEO::MeshElements.

◆ clear_store()

void GEO::MeshVertices::clear_store ( bool  keep_attributes,
bool  keep_memory = false 
)
overrideprotectedvirtual

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 from GEO::MeshSubElementsStore.

◆ create_vertex() [1/2]

index_t GEO::MeshVertices::create_vertex ( )
inline

Creates a new vertex.

Returns
the index of the created vertex

Definition at line 344 of file mesh.h.

◆ create_vertex() [2/2]

index_t GEO::MeshVertices::create_vertex ( const double *  coords)
inline

Creates a new vertex.

Parameters
[in]coordsa pointer to dimension() coordinates
Returns
the index of the created vertex

Definition at line 353 of file mesh.h.

◆ create_vertices()

index_t GEO::MeshVertices::create_vertices ( index_t  nb)
inline

Creates a contiguous chunk of vertices.

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

Definition at line 375 of file mesh.h.

◆ delete_elements()

void GEO::MeshVertices::delete_elements ( vector< index_t > &  to_delete,
bool  remove_isolated_vertices = true 
)
overridevirtual

Deletes a set of elements.

Parameters
[in]to_deletea vector of size nb(). If to_delete[e] is different from 0, then element e will be destroyed, else it will be kept. On exit, to_delete is modified (it is used for internal bookkeeping).
[in]remove_isolated_verticesif true, then the vertices that are no longer incident to any element are deleted.

Implements GEO::MeshElements.

◆ dimension()

index_t GEO::MeshVertices::dimension ( ) const
inline

Gets the dimension of the vertices.

Returns
the number of coordinates in each vertex

Definition at line 427 of file mesh.h.

◆ double_precision()

bool GEO::MeshVertices::double_precision ( ) const
inline

Tests whether vertices are stored in double-precision mode.

Double precision mode is the default. Single-precision mode is used for instance by Vorpaview, to make it more memory efficient.

Definition at line 419 of file mesh.h.

◆ permute_elements()

void GEO::MeshVertices::permute_elements ( vector< index_t > &  permutation)
overridevirtual

Applies a permutation to the elements and their attributes.

On exit, permutation is modified (used for internal bookkeeping). Applying a permutation permutation is equivalent to:

for(i=0; i<permutation.size(); i++) {
data2[i] = data[permutation[i]]
}
data = data2 ;

Implements GEO::MeshElements.

◆ point() [1/2]

vec3& GEO::MeshVertices::point ( index_t  v)
inline

Gets a point.

Parameters
[in]vthe vertex, in 0..nb()-1
Returns
a modifiable reference to the point that corresponds to the vertex
Precondition
!single_precision()

Definition at line 482 of file mesh.h.

◆ point() [2/2]

const vec3& GEO::MeshVertices::point ( index_t  v) const
inline

Gets a point.

Parameters
[in]vthe vertex, in 0..nb()-1
Returns
a const reference to the point that corresponds to the vertex
Precondition
!single_precision()

Definition at line 496 of file mesh.h.

◆ point_ptr() [1/2]

double* GEO::MeshVertices::point_ptr ( index_t  v)
inline

Gets a point.

Parameters
[in]vthe vertex, in 0..nb()-1
Returns
a pointer to the coordinates of the point that correspond to the vertex
Precondition
!single_precision()

Definition at line 468 of file mesh.h.

◆ point_ptr() [2/2]

const double* GEO::MeshVertices::point_ptr ( index_t  v) const
inline

Gets a point.

Parameters
[in]vthe index of the vertex
Returns
a const pointer to the coordinates of the point that correspond to the vertex
Precondition
!single_precision()

Definition at line 455 of file mesh.h.

◆ resize_store()

void GEO::MeshVertices::resize_store ( index_t  new_size)
overrideprotectedvirtual

Resizes this MeshSubElementsStore.

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

Parameters
[in]new_sizethe desired size

Reimplemented from GEO::MeshSubElementsStore.

◆ set_dimension()

void GEO::MeshVertices::set_dimension ( index_t  dim)
inline

Sets the dimension of the vertices.

Existing coordinates are kept, newly created coordinates are initialized to zero.

Parameters
[in]dimnew dimension

Definition at line 440 of file mesh.h.

◆ set_double_precision()

void GEO::MeshVertices::set_double_precision ( )

Sets double precision mode.

Double precision mode is the default. Single-precision mode is used for instance by Vorpaview, to make it more memory efficient. Existing point coordinates are copied and converted to double precision.

◆ set_single_precision()

void GEO::MeshVertices::set_single_precision ( )

Sets single precision mode.

Single-precision mode is used for instance by Vorpaview, to make it more memory efficient. Existing point coordinates are copied and converted to single precision.

◆ single_precision()

bool GEO::MeshVertices::single_precision ( ) const
inline

Tests whether vertices are stored in single-precision mode.

Single-precision mode is used for instance by Vorpaview, to make it more memory efficient.

Definition at line 408 of file mesh.h.

◆ single_precision_point_ptr() [1/2]

float* GEO::MeshVertices::single_precision_point_ptr ( index_t  v)
inline

Gets a (single-precision) point.

Parameters
[in]vthe index of the vertex
Returns
a pointer to the coordinates of the point that corresponds to the vertex
Precondition
single_precision()

Definition at line 523 of file mesh.h.

◆ single_precision_point_ptr() [2/2]

const float* GEO::MeshVertices::single_precision_point_ptr ( index_t  v) const
inline

Gets a (single-precision) point.

Parameters
[in]vthe index of the vertex
Returns
a const pointer to the coordinates of the point that corresponds to the vertex
Precondition
single_precision()

Definition at line 510 of file mesh.h.


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