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

Data structure containing all nodes of the Triangulation. More...

#include <Nodes.hpp>

Collaboration diagram for fp::Nodes:

Public Member Functions

 Nodes ()=default
 Default constructor.
 
 Nodes (std::vector< Node > data_inp)
 Constructor from a vector.
 
 Nodes (Json const &node_dict)
 Constructor from JSON.
 
std::vector< Node >::iterator begin ()
 Returns an iterator to the beginning of the underlying data member that contains the collection of the nodes.
 
std::vector< Node >::const_iterator begin () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
std::vector< Node >::iterator end ()
 Returns an iterator to the end of the underlying data member that contains the collection of the nodes.
 
std::vector< Node >::const_iterator end () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void emplace_nn_id (Index node_id, Index to_emplace_nn_id, Index loc_nn_index)
 Emplace a the id of a new node in the Node::nn_ids vector, in front of the loc_idx position.
 
void set_nn_distance (Index node_id, Index loc_nn_index, vec3< Real > &&dist)
 Overwrite the next neighbor distance with a new 3d vector.
 
void set_nn_distance (Index node_id, Index loc_nn_index, vec3< Real > const &dist)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
Index size () const
 Size of the Nodes data member.
 
Nodeoperator[] (Index node_id)
 Square bracket operator overload for convenient indexing of the Nodes struct.
 
const Nodeoperator[] (Index node_id) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
Json make_data () const
 Serialize the Nodes struct to a JSON object.
 

Public Attributes

std::vector< Nodedata
 Data member that contains the individual nodes.
 

Detailed Description

Data structure containing all nodes of the Triangulation.

The Nodes struct is capable of reinitializing nodes from a well-formed JSON object or from a simple std::vector that contains all nodes of a triangulation. The nodes class is basically a wrapper around a vector of nodes, i.e., std::vector<Node>, and provides additional functionality to manipulate and query this data structure. Nodes class is also meant to be the interface with which the end user is manipulating individual nodes.

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.

Constructor & Destructor Documentation

◆ Nodes() [1/2]

fp::Nodes::Nodes ( std::vector< Node > data_inp)
inlineexplicit

Constructor from a vector.

Copies the data from a vector of nodes and creates a new Nodes struct.

Parameters
data_inpA standard vector containing all the nodes that are supposed to create a new Nodes class.

◆ Nodes() [2/2]

fp::Nodes::Nodes ( Json const & node_dict)
inlineexplicit

Constructor from JSON.

Initiating nodes from a JSON object of a node collection. The nodes in the JSON file must be sequentially numbered from 0 to Number_of_nodes - 1.

Parameters
node_dictJSON object that contains a collection of nodes.
Warning
If the JSON object is malformed, then the constructor will fail and propagate a runtime error from the JSON parser.

Member Function Documentation

◆ begin() [1/2]

std::vector< Node >::iterator fp::Nodes::begin ( )
inline

Returns an iterator to the beginning of the underlying data member that contains the collection of the nodes.

This function allows the Nodes struct to be used in range-based for loops.

Returns
data.begin()
Here is the caller graph for this function:

◆ begin() [2/2]

std::vector< Node >::const_iterator fp::Nodes::begin ( ) const
inlinenodiscard

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This function allows the Nodes struct to be used in range-based for loops in constant environments.

Returns
a constant iterator data.begin().

◆ end() [1/2]

std::vector< Node >::iterator fp::Nodes::end ( )
inline

Returns an iterator to the end of the underlying data member that contains the collection of the nodes.

This function allows the Nodes struct to be used in range-based for loops.

Returns
data.end().
Here is the caller graph for this function:

◆ end() [2/2]

std::vector< Node >::const_iterator fp::Nodes::end ( ) const
inlinenodiscard

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This function allows the Nodes struct to be used in range-based for loops in constant environments.

Returns
a constant iterator data.end().

◆ emplace_nn_id()

void fp::Nodes::emplace_nn_id ( Index node_id,
Index to_emplace_nn_id,
Index loc_nn_index )
inline

Emplace a the id of a new node in the Node::nn_ids vector, in front of the loc_idx position.

This function is a wrapper around Node::emplace_nn_id(Index , vec3<Real> const& , Index).

Parameters
node_idGlobal id of the Node, which is a number between 0 and max_number_of_nodes - 1.
to_emplace_nn_idGlobal id of the next neighbor Node, which is a number between 0 and max_number_of_nodes - 1.
loc_nn_indexLocal index in the Node::nn_ids vector, a number between 0 and Node::nn_ids.size() - 1.
Here is the caller graph for this function:

◆ set_nn_distance() [1/2]

void fp::Nodes::set_nn_distance ( Index node_id,
Index loc_nn_index,
vec3< Real > && dist )
inline

Overwrite the next neighbor distance with a new 3d vector.

Parameters
node_idGlobal id of the next neighbor Node, which is a number between 0 and max_number_of_nodes - 1.
loc_nn_indexLocal index in the Node::nn_ids vector, a number between 0 and Node::nn_ids.size() - 1.
distrvalue reference to a 3D distance vector (that points from node_id to its next neighbour).

◆ set_nn_distance() [2/2]

void fp::Nodes::set_nn_distance ( Index node_id,
Index loc_nn_index,
vec3< Real > const & dist )
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
node_idGlobal id of the next neighbor Node, which is a number between 0 and max_number_of_nodes - 1.
loc_nn_indexLocal index in the Node::nn_ids vector, a number between 0 and Node::nn_ids.size() - 1.
distlvalue constant reference to a 3D distance vector (that points from node_id to its next neighbour).

◆ size()

Index fp::Nodes::size ( ) const
inlinenodiscard

Size of the Nodes data member.

Returns
Size of the data vector, same as the number of nodes.
Here is the caller graph for this function:

◆ operator[]() [1/2]

Node & fp::Nodes::operator[] ( Index node_id)
inline

Square bracket operator overload for convenient indexing of the Nodes struct.

Nodes[node_id] is the same as Nodes.data[node_id].

Parameters
node_idGlobal id of the Node, which is a number between 0 and max_number_of_nodes - 1.
Returns
Reference to the Node struct with the id corresponding to node_id.

◆ operator[]() [2/2]

const Node & fp::Nodes::operator[] ( Index node_id) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Nodes[node_id] in the constant environment is the same as Nodes.data.at(node_id).

Parameters
node_idGlobal id of the Node, which is a number between 0 and max_number_of_nodes - 1.
Returns
Constant reference to the Node struct with the id corresponding to node_id.

◆ make_data()

Json fp::Nodes::make_data ( ) const
inlinenodiscard

Serialize the Nodes struct to a JSON object.

Returns
JSON object that represents a serialization of the data contained in Nodes. This JSON object can later be used to reconstruct the Nodes object.
Here is the caller graph for this function:

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