flippy
a c++20 package for dynamically triangulated membrane simulations.
Loading...
Searching...
No Matches
fp::Node Struct Reference

A data structure containing all geometric and topological information associated with a node. More...

#include <Nodes.hpp>

Collaboration diagram for fp::Node:

Public Member Functions

auto find_nns_loc_pointer (Index nn_id)
 
void pop_nn (Index to_pop_nn_id)
 Find and deletes the element with the id to_pop_nn_id in the nn_id vector.
 
void emplace_nn_id (Index to_emplace_nn_id, vec3< Real > const &to_emplace_nn_pos, Index loc_idx)
 
vec3< Real > const & get_distance_vector_to (Index nn_id) const
 This function can provide the stored distance vector to the next neighbor.
 
bool operator== (Node const &other_node) const =default
 Default equality operator.
 

Public Attributes

Index id
 Global id of the Node, which is a number between 0 and max_number_of_nodes - 1.
 
Real area
 Voronoi area associated with the node.
 
Real volume
 If the node is part of a closed surface triangulation, then the volume contains the volume of the tetrahedron connected to each voronoi cell sub-triangle and the center of the lab coordinate system as defined in Gueguen et al. 2017.
 
vec3< Real > pos
 Position of the node in the lab frame.
 
vec3< Real > curvature_vec
 Curvature vector of the node.
 
std::vector< Index > nn_ids
 A vector containing the global ids of the current node's next neighbors.
 
std::vector< vec3< Real > > nn_distances
 Distance vectors pointing from the node to its next neighbors.
 
std::vector< Index > verlet_list
 The Verlet list contains the ids of nodes that are close to this node.
 

Friends

std::ostream & operator<< (std::ostream &os, Node const &node)
 Streaming operator that can print formatted output to standard out with all Node data fields.
 

Detailed Description

A data structure containing all geometric and topological information associated with a node.

This is a DUMB DATA STRUCTURE, meaning that it is not responsible for the coherence of the data it contains. For performance reasons, methods associated with Node struct will never check if the Node::curvature is the norm of the Node::curvature_vector or if the Node::nn_ids and Node::nn_distances are in the correct order. It is the responsibility of higher-order structures like Nodes and Triangulation to check that correct data is stored and updated correctly. However, it does check the data for consistency. It will match the length of Node::nn_ids and Node::nn_distances and pop and add both of them together.

Template Parameters
Realtype that will be used for all floating point numbers inside this class/struct. Any data type that satisfies the floating_point_number concept is allowed, for example, float.
Indextype that will be used for all integer numbers inside this class/struct. Any data type that satisfies the indexing_number concept is allowed, for example, unsigned int.

Member Function Documentation

◆ find_nns_loc_pointer()

auto fp::Node::find_nns_loc_pointer ( Index nn_id)
inline

Given the global id of the next neighbor, this function can be used to locate it in the Node::nn_ids vector.

This function is just a convenient wrapper around the std::find function.

std::find(nn_ids.begin(), nn_ids.end(), to_pop_nn_id);
std::vector< Index > nn_ids
A vector containing the global ids of the current node's next neighbors.
Definition Nodes.hpp:81
Parameters
nn_idGlobal id of the next neighbor Node, which is a number between 0 and max_number_of_nodes - 1.
Returns
if nn_id is contained in Node::nn_ids then the pointer to the position of that id in the nn_ids vector will be returned. Otherwise nn_ids.end().
Warning
This function is not responsible for graceful handling of nn_id's that are not found in the Node::nn_ids vector. If the nn_id is not contained in Node::nn_ids then the nn_ids.end() iterator will be returned. It is up to the user to perform the necessary checks to avoid undefined behavior that might result from trying to delete uninitiated memory.
Here is the caller graph for this function:

◆ pop_nn()

void fp::Node::pop_nn ( Index to_pop_nn_id)
inline

Find and deletes the element with the id to_pop_nn_id in the nn_id vector.

Parameters
to_pop_nn_idGlobal id of the next neighbor Node, which is a number between 0 and max_number_of_nodes - 1. This id is supposed to be removed from the next neighbor id vector.
See also
Node::nn_ids
Note
this will lead to resizing of the vector, which can be expensive!
Warning
If the provided next neighbor id is not part of the Node::nn_ids, this function will fail silently. It will not delete anything and won't throw any errors or warnings;
Here is the call graph for this function:

◆ emplace_nn_id()

void fp::Node::emplace_nn_id ( Index to_emplace_nn_id,
vec3< Real > const & to_emplace_nn_pos,
Index loc_idx )
inline

This function can be used to add new next neighbors to this node.

This function constructs to_emplace_nn_id right before to_emplace_pos, i.e. if to_emplace_nn_id is 3, to_emplace_nn_id will be constructed right before the 3rd element and will become the new 3rd element.

Parameters
to_emplace_nn_idGlobal id of the next neighbor Node, which is a number between 0 and max_number_of_nodes - 1. This id is supposed to be added to the Node::nn_ids vector of this node.
to_emplace_nn_posconst reference to the 3 dimensional position vector (type vec3<Real>) containing the position of the new next neighbour. This input is used to calculate the correct distance between this node and the new next neighbor, which will then be added to the Node::nn_distances vector.
loc_idxLocal index in the Node::nn_ids vector, a number between 0 and Node::nn_ids.size() - 1.
Note
This function causes the resizing of two vectors, which can be costly.
Warning
Making next neighbors is a symmetric operation. I.e., if node one becomes the next neighbor of node two, node two also has to become the next neighbor of node one. However, this function is not responsible for this relationship. It only adds a new next neighbor to this node, and the higher-order structures, like Triangulation, are responsible for guaranteeing the reciprocal relationship.
See also
Triangulation::emplace_before(Index, Index, Index)

◆ get_distance_vector_to()

vec3< Real > const & fp::Node::get_distance_vector_to ( Index nn_id) const
inline

This function can provide the stored distance vector to the next neighbor.

Parameters
nn_idGlobal id of the next neighbor Node, which is a number between 0 and max_number_of_nodes - 1. .
Returns
returns the distance currently stored in the Node::nn_distances vector for the requested next neighbor. If the provided nn_id can not be found in the Node::nn_ids vector, then the function writes an error message to standard error output and terminates the program with exit code 12.
Note
Calling this function with a wrong argument will cause the termination of the program.

◆ operator==()

bool fp::Node::operator== ( Node const & other_node) const
default

Default equality operator.

Parameters
other_nodeconstant reference to the other Node.
Returns
True if both nodes are equal.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
Node const & node )
friend

Streaming operator that can print formatted output to standard out with all Node data fields.

Parameters
osThis is intended to be std::cout or any other std::ofstream reference.
nodeThe streamed node.
Returns
Updated stream.

Member Data Documentation

◆ area

Real fp::Node::area

Voronoi area associated with the node.

The Voronoi area is the sum of (mixed) Voronoi areas inside the triangles, incident to the node. Definition follows Gueguen et al. 2017.

\[ A_{i} = \sum_{j} A'_{ij}. \]

See also
Triangulation::mixed_area See Figure tr1. C in Triangulation.
Node::curvature_vec Triangulation::update_bulk_node_geometry(Index)

◆ volume

Real fp::Node::volume

If the node is part of a closed surface triangulation, then the volume contains the volume of the tetrahedron connected to each voronoi cell sub-triangle and the center of the lab coordinate system as defined in Gueguen et al. 2017.

This means that the volume of an individual node does not have a proper physical interpretation. Only the sum of all node volumes, which is given by the triangulation is interpretable as a physical volume of an object. The definition follows Gueguen et al. 2017.

\[ V_{ij} = A_{ij} \vec{x}_{i}\cdot \frac{\vec{n}_{ij,j+1}}{\| \vec{n}_{ij,j+1} \|}. \]

See Figure tr1. D in Triangulation.

See also
Node::curvature_vec Triangulation::update_bulk_node_geometry(Index)

◆ curvature_vec

vec3<Real> fp::Node::curvature_vec

Curvature vector of the node.

The definition of the curvature vector follows Meyer et al. 2003.

\[ \vec{K}_i = \frac{1}{2A_i}\sum_{j(i)} \left( \cot\left(\alpha_{ij}^{j+1}\right) + \cot\left(\alpha_{ij}^{j-1}\right) \right)\vec{\ell}_{ij} \]

See Figure tr1. B in Triangulation.

See also
Node::curvature_vec Triangulation::update_bulk_node_geometry(Index)

◆ nn_ids

std::vector<Index> fp::Node::nn_ids

A vector containing the global ids of the current node's next neighbors.

nn_ids contains the ids of nodes that are connected to this node in the triangulation. The next neighbors that are also mutual neighbors in the triangulation are stored sequentially in the vector. The last and the first elements are also neighbors, i.e., the nn_ids vector wraps around. During the calculation, this is facilitated through the use of fp::Neighbors.

Note
The order of the next neighbors matters for the proper function of fp::Triangulation but is not guaranteed by this data structure. See Figure tr1. A, in Triangulation.

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