|
| | Triangulation (Json const &nodes_input, Real verlet_radius_inp) |
| | Constructor that can re-initiate a triangulation from the stored data.
|
| |
| | Triangulation (Index n_nodes_iter, Real R_initial_input, Real verlet_radius_inp) |
| | Constructor that can initiate a spherical triangulation from scratch.
|
| |
| void | make_verlet_list () |
| | Create a Verlet list.
|
| |
| void | translate_all_nodes (vec3< Real > const &translation_vector) |
| | Adds the same 3D vector to the positions of each node of the triangulation.
|
| |
| vec3< Real > | calculate_mass_center () const |
| | Calculate the area-weighted average of node positions.
|
| |
| void | move_node (Index node_id, vec3< Real > const &displacement_vector) |
| | Move an individual node of the triangulation and update all the geometric quantities of the triangulation that changed.
|
| |
| void | emplace_before (Index center_node_id, Index anchor_id, Index new_value) |
| | Adds a new node to the next neighbor list of a given node and calculates their mutual distance.
|
| |
| BondFlipData | flip_bond (Index node_id, Index nn_id, Real min_bond_length_square, Real max_bond_length_square) |
| | Securely flip the bond inside a quadrilateral formed by the nodes given by node_id, nn_id and their two common next neighbors, if all topological requirements are satisfied.
|
| |
| void | unflip_bond (Index node_id, Index nn_id, BondFlipData const &common_nns) |
| | Un-flip a bond that was just flipped.
|
| |
| BondFlipData | flip_bond_unchecked (Index node_id, Index nn_id, Index common_nn_j_m_1, Index common_nn_j_p_1) |
| |
| void | update_bulk_node_geometry (Index node_id) |
| | Update the geometric quantities associated with the given node.
|
| |
| Geometry | get_two_ring_geometry (Index node_id) const |
| | Aggregates and Returns the geometric quantities of the center node and its next neighbor nodes.
|
| |
| void | update_two_ring_geometry (Index node_id) |
| | Updates the geometric quantities of the center node and its next neighbor nodes.
|
| |
| void | scale_node_coordinates (Real x_stretch, Real y_stretch=1, Real z_stretch=1) |
| | Method for stretching or squeezing the initial triangulation shape.
|
| |
| Geometry | calculate_diamond_geometry (Index node_id, Index nn_id, Index cnn_0, Index cnn_1) const |
| | Aggregates the geometric quantities of the diamond configuration of nodes associated with a bond flip.
|
| |
| void | update_diamond_geometry (Index node_id, Index nn_id, Index cnn_0, Index cnn_1) |
| | Calculates and updates the geometric quantities of the diamond configuration of nodes associated with a bond flip.
|
| |
| Index | size () const |
| | Returns the number of nodes in the triangulation.
|
| |
| const Node & | operator[] (Index idx) const |
| | Returns a constant reference to the node with the given id.
|
| |
| const Nodes & | nodes () const |
| | Returns a constant reference to the underlying Nodes container.
|
| |
| Json | make_egg_data () const |
| | Creates a JSON object with the data of the triangulation.
|
| |
| const Geometry & | global_geometry () const |
| | Information about the global geometric quantities of the triangulation, like global area, volume, and total unit bending energy.
|
| |
| void | make_global_geometry () |
| | Initiates the global geometry of the triangulation.
|
| |
| Neighbors | previous_and_next_neighbour_global_ids (Index node_id, Index nn_id) const |
| |
Implementation of Triangulation of two-dimensional surfaces in 3D.
*/
/**
Figure tr 1. Visualization of the triangulation.
Visualization of the triangulation. A: Triangulated sphere with \(N_{\mathrm{nodes}}=2252\). Black edges highlight the local neighborhood of a node. Circular arrows show the counterclockwise orientation of the nodes. This choice guarantees that all normal vectors point to the outside of the sphere. B: An arbitrary node \(i\), with its curvature vector \(\vec{K}_{i}\) and a highlighted angle \(\alpha^j_{i,j+1}\) at neighbour \(j\) opposite to the edge \(i, j+1\). Superscript \(j\) denotes the neighboring node to which the angle belongs and subscript \(i,j+1\) denotes the edge opposite of the angle. C: Node \(i\) with its associated Voronoi area \(A_i\) highlighted in red. The node has an associated area inside each triangle it is part of. We also highlight the triangle \(i,j,j+1\) (light red with stripes) with the face normal \(\vec{n}_{i,j,j+1}\) and the area \(A_{i,j,j+1}\). The part of this triangle that is associated with node \(i\) is highlighted in dark red and has the area \(A_{ij}\). The convention is to use the central and rightmost nodes in the subscript. Since the nodes are ordered counterclockwise, this convention is unambiguous. D: Volume associated with node \(i\) is made up of tetrahedrons that have as their base the triangles that make up the Voronoi cell of the node. The head of the tetrahedron points to some lab frame origin \(\cal{O}\). \(V_{ij}\) is the part of the volume associated to node \(i\) that has its base in the triangle \(i,j,j+1\).
| BondFlipData fp::Triangulation::flip_bond |
( |
Index | node_id, |
|
|
Index | nn_id, |
|
|
Real | min_bond_length_square, |
|
|
Real | max_bond_length_square ) |
|
inline |
Securely flip the bond inside a quadrilateral formed by the nodes given by node_id, nn_id and their two common next neighbors, if all topological requirements are satisfied.
flip_bond function takes a lot of care to keep the triangulation intact, i.e., not introduce holes or additional bonds in it. To this end, the function performs a lot of checks to determine if the proposed bond fip is allowed by the topology. The information if the flip was allowed and succeeded or not will be encoded in the BondFlipData struct, which this function will return. The struct also contains information on the new end nodes of the bond, which is useful if one wishes to undo the flip. A bond flip can fail if:
- if the provided nodes id's do not correspond to neighboring nodes.
- one of the donor nodes have already too few bonds (bonds less than BOND_DONATION_CUTOFF).
- if a new bond that would be created, would be
- too long (length squared is larger than max_bond_length_square)
- too short (length squared is smaller than min_bond_length_square)
- Parameters
-
| node_id | Global id of the Node, which is a number between 0 and max_number_of_nodes - 1. |
| nn_id | Global id of the next neighbor Node, which is a number between 0 and max_number_of_nodes - 1. |
| min_bond_length_square | Square of the minimal allowed bond length, in the triangulation. |
| max_bond_length_square | Square of the maximal allowed bond length, in the triangulation. |
- Returns
- If the flip was successful, the returned BondFlipData struct will contain a boolean state variable BondFlipData::flipped = true. The members BondFlipData::common_nn_0 and BondFlipData::common_nn_1 will contain global ids of new end nodes of the flipped bond. If the flip was not successful, then a default initialized BondFlipData struct will be returned with BondFlipData::flipped = false.
- Note
- Regardless of the return values, the primary purpose of the function, that of flipping a bond, is accomplished as a side-effect.
| void fp::Triangulation::unflip_bond |
( |
Index | node_id, |
|
|
Index | nn_id, |
|
|
BondFlipData const & | common_nns ) |
|
inline |
Un-flip a bond that was just flipped.
This method reverses a flip between two nodes that used to be connected and had their node just flipped away, provided their id's and the BondFlipData that holds the information on the current bond holders.
This means that node_id and nn_id are (pre-flip) owners of the bond. And common_nns contains the id's of the current bond owners (to which the bond was flipped to). The edge will be taken away from the current two neighbors and added to the previous owners. All geometric information of the triangulation will be updated.
- Warning
- This method only works correctly if there were no bond flips after that flip which is being reversed. I.e., this method can only reverse the last flip. Furthermore, the method assumes that the arguments are provided correctly and will result in an illegal triangulation if this is not the case.
- Note
- This method does not check the validity of its input to provide a fast way of flip reversal. It relies on the fact that the user usually has the exact knowledge of all four node id's that participated in a flip and can provide those id's in the correct order. For a safer way of un-fliping, the Triangulation::flip_bond method can be used twice, with interchanged order of arguments.
The following example implementation of a Monte Carlo flip update method shows the proper way to use the Triangulation.flip_bond and Triangulation.unflip_bond methods.
++
void mc_flipp_update(
fp::Node const& node)
{
e_old = energy_function(node, triangulation, parameters);
Index number_nn_ids = node.
nn_ids.size();
Index nn_id = node.
nn_ids[std::uniform_int_distribution<Index>(0, number_nn_ids-1)(rng)];
auto bond_flip_data = triangulation.flip_bond(node.
id, nn_id, min_bond_length_square, max_bond_length_square);
if (bond_flip_data.flipped) {
e_new = energy_function(node, triangulation, parameters);
if (move_needs_undoing()) { triangulation.unflip_bond(node.
id, nn_id, bond_flip_data); }
}
}
A data structure containing all geometric and topological information associated with a node.
Definition Nodes.hpp:30
Index id
Global id of the Node, which is a number between 0 and max_number_of_nodes - 1.
Definition Nodes.hpp:32
std::vector< Index > nn_ids
A vector containing the global ids of the current node's next neighbors.
Definition Nodes.hpp:81
- See also
- Triangulation.flip_bond BondFlipData
- Parameters
-
| node_id | Global id of the Node, which is a number between 0 and max_number_of_nodes - 1. |
| nn_id | Global id of the next neighbor Node, which is a number between 0 and max_number_of_nodes - 1. |
| common_nns | BondFlipData containing information on the common next neighbor ids. |
| BondFlipData fp::Triangulation::flip_bond_unchecked |
( |
Index | node_id, |
|
|
Index | nn_id, |
|
|
Index | common_nn_j_m_1, |
|
|
Index | common_nn_j_p_1 ) |
|
inline |
Exchange the next neighborhood between four nodes in a manner that will correspond to a bond flip if the provided information was correct.
- Warning
- This method may lead to an unphysical state (broken lattice that no longer represents a triangulation) if the provided arguments are not correct.
- Note
- For most use-cases the high level methods Triangulation::flip_bond and Triangulation::unflilp_bond are recommended. They guarantee that the performed flips result in a legal triangulation and reject the flip otherwise. This method should only be used by advanced users that have very specific needs for a flip updater.
The correct functioning of this method requires that, node_id and nn_id need to be next neighbours, and common_nn_j_m_1 and common_nn_j_p_1 need to be common next neighbors of both node_id and nn_id. Moreover, the nodes need to be ordered in the Node::nn_ids vector of the Node represented by node_id as follows: ... common_nn_j_m_1, node_id, common_nn_j_p_1 ..., or a cyclic permutation thereof.
- Parameters
-
| node_id | Global id of the Node, which is a number between 0 and max_number_of_nodes - 1. |
| nn_id | Global id of the next neighbor Node, which is a number between 0 and max_number_of_nodes - 1. |
| common_nn_j_m_1 | |
| common_nn_j_p_1 | |
- Returns
- BondFlipData, where the flipped field is always set to
True.
| static Real fp::Triangulation::mixed_area |
( |
vec3< Real > const & | lij, |
|
|
vec3< Real > const & | lij_p_1, |
|
|
Real | triangle_area, |
|
|
Real | cot_at_j, |
|
|
Real | cot_at_j_p_1 ) |
|
inlinestatic |
The node-associated area inside a triangle.
This function is calculating the area associated with a node inside a triangle. As depicted in Figure tr1. A. This can be found in the description of the Triangulation class.
Every node of the triangulation has its own associated area. In the simplest case, the area associated with a node is the area of the Voronoi cell of that node. Where the Voronoi tessellation of the surface is the dual lattice of the triangulation. This function returns the area associated with a node inside a triangle. If that triangle is not obtuse, then this area is simply the area of the Voronoi cell of the node that is inside the triangle. This Voronoi area becomes negative for obtuse triangles, and thus an exception has to be made. If the triangle has an obtuse angle at the node, then the area associated with the node inside the triangle is half of the triangle area, otherwise, it is the quarter of the triangle area. This procedure is described in detail by Meyer et al. 2003
- Parameters
-
| lij | Distance vector between the node and its next neighbor. (Next neighbors are ordered according to the right-hand rule. See Figure tr1. A and C) |
| lij_p_1 | Distance vector between the node and its next neighbor. (Next neighbors are ordered according to the right-hand rule) |
| triangle_area | area of the triangle i,j,j+1. See Area \(A_{i,j,j+1}\) in Figure tr1. C. |
| cot_at_j | Cotangent of the angle at the node j, opposite to the edge i,j+1. See Figure tr1. B. |
| cot_at_j_p_1 | Cotangent of the angle at the node j+1, opposite to the edge i,j. See Figure tr1. B. |
- Returns
- Area associated with the node inside the triangle. See Area \(A_{ij}\) in Figure tr1. C.