NLMech  0.1.0
neighbor.h
1 // Copyright (c) 2019 Prashant K. Jha
3 // Copyright (c) 2019 Patrick Diehl
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See accompanying
6 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 
9 #ifndef GEOM_NEIGHBOR_H
10 #define GEOM_NEIGHBOR_H
11 
12 #include "util/point.h" // definition of Point3
13 #include <string>
14 #include <vector>
15 
16 // forward declaration of neighbor deck
17 namespace inp {
18 struct NeighborDeck;
19 }
20 
21 namespace geometry {
22 
32 class Neighbor {
33 
34 public:
41  Neighbor(const double &horizon, inp::NeighborDeck *deck,
42  const std::vector<util::Point3> *nodes);
43 
51  const std::vector<size_t> &getNeighbors(const size_t &i);
52 
57  std::vector<std::vector<size_t>> *getNeighborsListP();
58 
59 
64  const std::vector<std::vector<size_t>> *getNeighborsListP() const;
65 
70  std::vector<std::vector<size_t>> &getNeighborsList();
71 
76  const std::vector<std::vector<size_t>> &getNeighborsList() const;
77 
86  size_t getNeighbor(const size_t &i, const size_t &j) const;
87 
97  std::string printStr(int nt = 0, int lvl = 0) const;
98 
106  void print(int nt = 0, int lvl = 0) const { std::cout << printStr(nt, lvl); };
107 
108 private:
111 
113  std::vector<std::vector<size_t>> d_neighbors;
114 };
115 
116 } // namespace geometry
117 
118 #endif // GEOM_NEIGHBOR_H
A class to store neighbor list and provide access to the list.
Definition: neighbor.h:32
Neighbor(const double &horizon, inp::NeighborDeck *deck, const std::vector< util::Point3 > *nodes)
Constructor.
Definition: neighbor.cpp:24
inp::NeighborDeck * d_neighborDeck_p
Interior flags deck.
Definition: neighbor.h:106
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing information about the instance of the object.
Definition: neighbor.cpp:118
std::vector< std::vector< size_t > > * getNeighborsListP()
Get the pointer to full neighbor list.
Definition: neighbor.cpp:98
std::vector< std::vector< size_t > > d_neighbors
Vector of list of neighbors for each node.
Definition: neighbor.h:113
void print(int nt=0, int lvl=0) const
Prints the information about the instance of the object.
Definition: neighbor.h:106
const std::vector< size_t > & getNeighbors(const size_t &i)
Get neighbor list of node i (element i in case of weak_finite_element)
Definition: neighbor.cpp:94
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.
Definition: neighbor.cpp:114
std::vector< std::vector< size_t > > & getNeighborsList()
Get the pointer to full neighbor list.
Definition: neighbor.cpp:106
Collection of methods and data related to geometry.
Definition: DataManager.h:23
Collection of methods and database related to input.
Definition: main.cpp:21
Structure to read and store neighbor list related input data.
Definition: neighborDeck.h:22