SynAPSE  0.6.0
Synergistic Analysis of Phase Space Evolution
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
Vertex.hh
1 #ifndef VERTEX_HH
2 #define VERTEX_HH
3 
4 // C++ includes
5 #include <stdlib.h>
6 #include <vector>
7 #include <cmath>
8 
13 class Vertex {
14  public:
16  Vertex();
17 
23  Vertex(const std::vector<double>& coords,
24  const double& value=1.,
25  const std::vector<size_t>& indices=std::vector<size_t>());
26 
28  Vertex(const size_t n);
29 
31  Vertex(const Vertex& vertex);
32 
34  Vertex& operator=(const Vertex& vertex);
35 
37  double& operator[](const size_t id) { return _coords[id]; }
38 
40  const double& operator[](const size_t id) const { return _coords[id]; }
41 
43  ~Vertex();
44 
46  const size_t size() const { return _coords.size(); }
47 
49  const std::vector<double>& GetCoordinates() const { return _coords; }
50 
52  void SetCoordinates(const std::vector<double>& coords) { _coords = coords; }
53 
55  const double& GetValue() const { return _value; }
56 
58  void SetValue(const double& value) { _value = value; }
59 
61  const size_t GetDimension() const { return _coords.size(); }
62 
64  const std::vector<size_t>& GetIndices() const { return _indices; }
65 
67  void SetIndices(const std::vector<size_t>& indices) { _indices = indices; }
68 
70  double GetNorm() const;
71 
72  private:
73  std::vector<double> _coords;
74  double _value;
75  std::vector<size_t> _indices;
76 };
77 
78 #endif
const size_t GetDimension() const
Returns the dimension of space in which the vertex lives.
Definition: Vertex.hh:61
std::vector< size_t > _indices
n-vector, indices of the point within a grid
Definition: Vertex.hh:75
const std::vector< double > & GetCoordinates() const
Returns the coordinates of the vertex.
Definition: Vertex.hh:49
double _value
Value of the scalar field in the vertex.
Definition: Vertex.hh:74
Vertex()
Default constructor, initilizes everything to 0.
Definition: Vertex.cc:3
const double & GetValue() const
Returns the value of the field at the vertex.
Definition: Vertex.hh:55
std::vector< double > _coords
n-vector, position of the vertex
Definition: Vertex.hh:73
~Vertex()
Destructor.
Definition: Vertex.cc:33
void SetIndices(const std::vector< size_t > &indices)
Returns the value of the field at the vertex.
Definition: Vertex.hh:67
void SetValue(const double &value)
Returns the value of the field at the vertex.
Definition: Vertex.hh:58
void SetCoordinates(const std::vector< double > &coords)
Returns the coordinates of the vertex.
Definition: Vertex.hh:52
const double & operator[](const size_t id) const
Returns the id^th component of the vector field at which the vertex is defined.
Definition: Vertex.hh:40
double & operator[](const size_t id)
Returns the id^th component of the vector field at which the vertex is defined.
Definition: Vertex.hh:37
const size_t size() const
Returns the dimension of the vector field in which the vertex is defined.
Definition: Vertex.hh:46
const std::vector< size_t > & GetIndices() const
Returns the value of the field at the vertex.
Definition: Vertex.hh:64
double GetNorm() const
Returns the L2 vector norm of the position vector.
Definition: Vertex.cc:35
Defines an n-dimensional vertex and its mapping onto a sclar field.
Definition: Vertex.hh:13
Vertex & operator=(const Vertex &vertex)
Equality operator.
Definition: Vertex.cc:22