NLMech  0.1.0
geometry::Neighbor Class Reference

A class to store neighbor list and provide access to the list. More...

#include <neighbor.h>

Collaboration diagram for geometry::Neighbor:
Collaboration graph

Public Member Functions

size_t getNeighbor (const size_t &i, const size_t &j) const
 Get global id of neighboring node given its local id in the neighbor list. More...
 
const std::vector< size_t > & getNeighbors (const size_t &i)
 Get neighbor list of node i (element i in case of weak_finite_element) More...
 
std::vector< std::vector< size_t > > & getNeighborsList ()
 Get the pointer to full neighbor list. More...
 
const std::vector< std::vector< size_t > > & getNeighborsList () const
 Get the pointer to full neighbor list. More...
 
std::vector< std::vector< size_t > > * getNeighborsListP ()
 Get the pointer to full neighbor list. More...
 
const std::vector< std::vector< size_t > > * getNeighborsListP () const
 Get the pointer to full neighbor list. More...
 
 Neighbor (const double &horizon, inp::NeighborDeck *deck, const std::vector< util::Point3 > *nodes)
 Constructor. More...
 
void print (int nt=0, int lvl=0) const
 Prints the information about the instance of the object. More...
 
std::string printStr (int nt=0, int lvl=0) const
 Returns the string containing information about the instance of the object. More...
 

Private Attributes

inp::NeighborDeckd_neighborDeck_p
 Interior flags deck.
 
std::vector< std::vector< size_t > > d_neighbors
 Vector of list of neighbors for each node.
 

Detailed Description

A class to store neighbor list and provide access to the list.

Currently, nested vector is used for list. However, this is not memory efficient, as the vectors have small memory overhead and the total overhead is N times the overhead of vector, where N is the number of nodes. When N is large, the total overhead becomes very large.

Todo:
Require further memory optimization.

Constructor & Destructor Documentation

◆ Neighbor()

geometry::Neighbor::Neighbor ( const double &  horizon,
inp::NeighborDeck deck,
const std::vector< util::Point3 > *  nodes 
)

Constructor.

Parameters
horizonHorizon
deckInput deck which contains user-specified information
nodesPointer to nodal positions

Member Function Documentation

◆ getNeighbor()

size_t geometry::Neighbor::getNeighbor ( const size_t &  i,
const size_t &  j 
) const

Get global id of neighboring node given its local id in the neighbor list.

Parameters
iId of node
jLocal id of node
Returns
id Global id of neighboring node of i

◆ getNeighbors()

const std::vector< size_t > & geometry::Neighbor::getNeighbors ( const size_t &  i)

Get neighbor list of node i (element i in case of weak_finite_element)

Parameters
iId of node
Returns
vector Vector of neighboring nodes

Referenced by model::Output::Output().

Here is the caller graph for this function:

◆ getNeighborsList() [1/2]

std::vector< std::vector< size_t > > & geometry::Neighbor::getNeighborsList ( )

Get the pointer to full neighbor list.

Returns
pointer Pointer of neighbor list data

◆ getNeighborsList() [2/2]

const std::vector< std::vector< size_t > > & geometry::Neighbor::getNeighborsList ( ) const

Get the pointer to full neighbor list.

Returns
pointer Pointer of neighbor list data

◆ getNeighborsListP() [1/2]

std::vector< std::vector< size_t > > * geometry::Neighbor::getNeighborsListP ( )

Get the pointer to full neighbor list.

Returns
pointer Pointer of neighbor list data

◆ getNeighborsListP() [2/2]

const std::vector< std::vector< size_t > > * geometry::Neighbor::getNeighborsListP ( ) const

Get the pointer to full neighbor list.

Returns
pointer Pointer of neighbor list data

◆ print()

void geometry::Neighbor::print ( int  nt = 0,
int  lvl = 0 
) const
inline

Prints the information about the instance of the object.

Parameters
ntNumber of tabs to append before each line of string
lvlLevel of information sought (higher level means more information)
Here is the call graph for this function:

◆ printStr()

std::string geometry::Neighbor::printStr ( int  nt = 0,
int  lvl = 0 
) const

Returns the string containing information about the instance of the object.

Parameters
ntNumber of tabs to append before each line of string
lvlLevel of information sought (higher level means more information)
Returns
string String containing information about this object

Referenced by print().

Here is the call graph for this function:
Here is the caller graph for this function:

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