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

#include <Triangulation.hpp>

Collaboration diagram for fp::Neighbors:

Static Public Member Functions

static Index plus_one (Index j, Index ring_size)
 
static Index minus_one (Index j, Index ring_size)
 

Public Attributes

Index j_m_1 {VERY_LARGE_NUMBER_}
 neighbor j+1
 
Index j_p_1 {VERY_LARGE_NUMBER_}
 neighbor j-1
 

Detailed Description

A helper struct; makes addition and subtraction on a ring easier. Each fp::Node stores its next neighbors in a vector Node.nn_ids, where the adjacent members in a vector are also next neighbors of each other. This struct provides a safe way to always access the next or previous member of the nn_ids vector, even if a wraparound is necessary.

See also
fp::Node.
Template Parameters
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

◆ plus_one()

static Index fp::Neighbors::plus_one ( Index j,
Index ring_size )
inlinestatic
Parameters
jindex of the j-th next neighbor
ring_sizecorresponds to the number of elements of Node.nn_ids
Returns
j+1 if j < ring_size - 1 and 0 otherwise. I.e., if j is the index of Node.nn_ids, its next neighbor will be stored in j+1 element, unless j is the last element, then its next neighbor will be stored in the 0th element.
Here is the caller graph for this function:

◆ minus_one()

static Index fp::Neighbors::minus_one ( Index j,
Index ring_size )
inlinestatic
Parameters
jindex of the j-th next neighbor
ring_sizecorresponds to the number of elements of Node.nn_ids
Returns
j-1 if j > 0 and ring_size - 1 otherwise. I.e., if j is the index of Node.nn_ids, its previous next neighbor will be stored in j-1 element, unless j is the 0th element, then its previous next neighbor will be stored in the last element.

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