Go to the documentation of this file.
21 #ifndef THUNDEREGG_COMPONENTARRAY_H
22 #define THUNDEREGG_COMPONENTARRAY_H
39 std::vector<double> vector;
51 std::array<int, D> strides;
53 for (
int i = 1; i < D; i++) {
54 strides[i] = strides[i - 1] * (lengths[i - 1] + 2 * num_ghost_cells);
56 int size = strides[D - 1] * (lengths[D - 1] + 2 * num_ghost_cells);
67 : vector(other.vector)
85 vector = other.vector;
106 return view.template getSliceOn<M>(f, offset);
135 const std::array<size_t, D - M>& offset)
const
137 return view.template getGhostSliceOn<M>(f, offset);
140 inline const double& operator[](
const std::array<int, D>& coord)
const {
return view[coord]; }
141 template<
class... Types>
142 inline const double& operator()(Types... args)
const
144 return view(args...);
146 inline void set(
const std::array<int, D>& coord,
double value)
const { view.
set(coord, value); }
147 inline double& operator[](
const std::array<int, D>& coord) {
return view[coord]; }
148 template<
class... Types>
149 inline double& operator()(Types... args)
151 return view(args...);
153 inline void set(
const std::array<int, D>& coord,
double value) { view.
set(coord, value); }
166 inline const std::array<int, D>&
getEnd()
const {
return view.
getEnd(); }
176 extern template class ComponentArray<1>;
177 extern template class ComponentArray<2>;
178 extern template class ComponentArray<3>;
Array for acessing data of a patch. It supports variable striding.
Definition: View.h:40
ComponentArray(const ComponentArray< D > &other)
Copy constructor.
Definition: ComponentArray.h:66
const std::array< int, D > & getStrides() const
Get the strides of the patch in each direction.
Definition: View.h:203
View< double, M > getSliceOn(Face< D, M > f, const std::array< int, D - M > &offset)
Get the slice on a given face.
Definition: ComponentArray.h:104
ComponentArray< D > & operator=(const ComponentArray< D > &other)
Copy assignment.
Definition: ComponentArray.h:83
View< double, M > getGhostSliceOn(Face< D, M > f, const std::array< size_t, D - M > &offset) const
Get the gosts slice on a given face.
Definition: ComponentArray.h:134
const std::array< int, D > & getStart() const
Get the coordinate of the first element.
Definition: ComponentArray.h:162
const std::array< int, D > & getGhostStart() const
Get the coordinate of the first ghost cell element.
Definition: View.h:215
ComponentArray(const std::array< int, D > &lengths, int num_ghost_cells)
Construct a new View object.
Definition: ComponentArray.h:49
The ThunderEgg namespace.
Definition: BiLinearGhostFiller.h:31
Array for acessing data of a patch. It supports variable striding.
Definition: ComponentArray.h:36
const std::array< int, D > & getEnd() const
Get the coordinate of the last element.
Definition: View.h:211
const std::array< int, D > & getEnd() const
Get the coordinate of the last element.
Definition: ComponentArray.h:166
const std::array< int, D > & getGhostStart() const
Get the coordinate of the first ghost cell element.
Definition: ComponentArray.h:170
void set(const std::array< int, D > &coord, T value) const
Set the value at a coordinate to the specified value.
Definition: View.h:174
const std::array< int, D > & getGhostEnd() const
Get the coordinate of the last ghost cell element.
Definition: ComponentArray.h:174
View< const double, M > getSliceOn(Face< D, M > f, const std::array< int, D - M > &offset) const
Get the slice on a given face.
Definition: ComponentArray.h:119
Enum-style class for the faces of an n-dimensional cube.
Definition: Face.h:41
const std::array< int, D > & getStrides() const
Get the strides of the patch in each direction.
Definition: ComponentArray.h:158
const std::array< int, D > & getGhostEnd() const
Get the coordinate of the last ghost cell element.
Definition: View.h:219
const std::array< int, D > & getStart() const
Get the coordinate of the first element.
Definition: View.h:207