Medusa  1.1
Coordinate Free Mehless Method implementation
RaggedShapeStorage_fwd.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_OPERATORS_RAGGEDSHAPESTORAGE_FWD_HPP_
2 #define MEDUSA_BITS_OPERATORS_RAGGEDSHAPESTORAGE_FWD_HPP_
3 
11 #include <medusa/Config.hpp>
14 #include <Eigen/Core>
15 
16 namespace mm {
17 
50 template <typename vec_t, typename OpFamilies =
51  std::tuple<Lap<vec_t::dim>, Der1s<vec_t::dim>, Der2s<vec_t::dim>>>
52 class RaggedShapeStorage :
53  public ShapeStorage<RaggedShapeStorage<vec_t, OpFamilies>, vec_t, OpFamilies> {
54  public:
55  typedef vec_t vector_t;
56  typedef typename vec_t::scalar_t scalar_t;
57  enum { dim = vec_t::dim };
59 
60  private:
67 
70  friend base_t;
72  using base_t::support_;
73  using base_t::shapes_;
74 
75  public:
76  using base_t::num_operators;
77  using base_t::size;
78 
81 
83  int supportSize(int node) const { return support_sizes_[node]; }
84 
85  private:
91  void resize_(const std::vector<int>& support_sizes);
92 
94  template <typename T> T* access(std::vector<T>& v, int i, int j) const {
95  return v.data() + i*total_size_ + support_starts_[j]; }
97  template <typename T> T* access(std::vector<T>& v, int i) const {
98  return v.data() + support_starts_[i]; }
100  template <typename T> const T* access(const std::vector<T>& v, int i, int j) const {
101  return v.data() + i*total_size_ + support_starts_[j]; }
103  template <typename T> const T* access(const std::vector<T>& v, int i) const {
104  return v.data() + support_starts_[i]; }
105 };
106 
107 } // namespace mm
108 
109 #endif // MEDUSA_BITS_OPERATORS_RAGGEDSHAPESTORAGE_FWD_HPP_
mm::RaggedShapeStorage::support_starts_
Range< int > support_starts_
Indexes of starts of supports. Cumulative sums of support_sizes_.
Definition: RaggedShapeStorage_fwd.hpp:64
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
shape_flags.hpp
scalar_t
Scalar scalar_t
Type of the elements, alias of Scalar.
Definition: MatrixBaseAddons.hpp:16
mm::ShapeStorage::domain_size_
int domain_size_
Total number of nodes.
Definition: ShapeStorage_fwd.hpp:56
mm::RaggedShapeStorage::base_t
ShapeStorage< RaggedShapeStorage< vec_t, OpFamilies >, vec_t, OpFamilies > base_t
Parent class.
Definition: RaggedShapeStorage_fwd.hpp:69
ShapeStorage_fwd.hpp
mm::RaggedShapeStorage::vector_t
vec_t vector_t
Vector type used.
Definition: RaggedShapeStorage_fwd.hpp:55
dim
@ dim
Number of elements of this matrix.
Definition: MatrixBaseAddons.hpp:14
mm::ShapeStorage::num_operators
constexpr static int num_operators
Number of operator families in this storage.
Definition: ShapeStorage_fwd.hpp:50
mm::RaggedShapeStorage::scalar_t
vec_t::scalar_t scalar_t
Scalar type used.
Definition: RaggedShapeStorage_fwd.hpp:56
mm::ShapeStorage
Shape storage base class.
Definition: ShapeStorage_fwd.hpp:41
mm::ShapeStorage::shapes_
std::array< Range< scalar_t >, num_operators > shapes_
Tuple of shape containers for given operators.
Definition: ShapeStorage_fwd.hpp:61
mm::RaggedShapeStorage::support_sizes_
Range< int > support_sizes_
Support sizes.
Definition: RaggedShapeStorage_fwd.hpp:62
mm::ShapeStorage::support_
Range< int > support_
Local copy of support domains.
Definition: ShapeStorage_fwd.hpp:58
Config.hpp
mm::RaggedShapeStorage::access
T * access(std::vector< T > &v, int i, int j) const
Returns pointer to the start of values for node-th node for op-th operator.
Definition: RaggedShapeStorage_fwd.hpp:94
mm::RaggedShapeStorage::supportSize
int supportSize(int node) const
Returns support size of node-th node.
Definition: RaggedShapeStorage_fwd.hpp:83
mm::RaggedShapeStorage::resize_
void resize_(const std::vector< int > &support_sizes)
Resizes the storage to accommodate shapes of given sizes.
Definition: RaggedShapeStorage.hpp:19
mm::RaggedShapeStorage::RaggedShapeStorage
RaggedShapeStorage()
< Number of nodes that shapes can be stored for.
Definition: RaggedShapeStorage_fwd.hpp:80
mm::RaggedShapeStorage::base_t
friend base_t
Be friends with derived class.
Definition: RaggedShapeStorage_fwd.hpp:70
mm::ShapeStorage::size
int size() const
Returns number of nodes.
Definition: ShapeStorage_fwd.hpp:87
mm::RaggedShapeStorage::access
const T * access(const std::vector< T > &v, int i) const
Returns const pointer to the start of values for node-th node.
Definition: RaggedShapeStorage_fwd.hpp:103
mm::RaggedShapeStorage::access
const T * access(const std::vector< T > &v, int i, int j) const
Returns const pointer to the start of values for node-th node for op-th operator.
Definition: RaggedShapeStorage_fwd.hpp:100
mm::Range< int >
mm::RaggedShapeStorage::total_size_
int total_size_
Sum of all support sizes.
Definition: RaggedShapeStorage_fwd.hpp:66
mm::RaggedShapeStorage::access
T * access(std::vector< T > &v, int i) const
Returns pointer to the start of values for node-th node for.
Definition: RaggedShapeStorage_fwd.hpp:97
mm::RaggedShapeStorage::dim
@ dim
Dimensionality of the domain.
Definition: RaggedShapeStorage_fwd.hpp:58