ExaTN
spaces.hpp
1 
18 #ifndef EXATN_NUMERICS_SPACES_HPP_
19 #define EXATN_NUMERICS_SPACES_HPP_
20 
21 #include "tensor_basic.hpp"
22 #include "space_basis.hpp"
23 
24 #include <utility>
25 #include <string>
26 #include <vector>
27 
28 namespace exatn{
29 
30 namespace numerics{
31 
33 public:
34 
36  VectorSpace(DimExtent space_dim);
38  VectorSpace(DimExtent space_dim,
39  const std::string & space_name);
41  VectorSpace(DimExtent space_dim,
42  const std::string & space_name,
43  const std::vector<SymmetryRange> & symmetry_subranges);
44 
45  VectorSpace(const VectorSpace & vector_space) = default;
46  VectorSpace & operator=(const VectorSpace & vector_space) = default;
47  VectorSpace(VectorSpace && vector_space) noexcept = default;
48  VectorSpace & operator=(VectorSpace && vector_space) noexcept = default;
49  virtual ~VectorSpace() = default;
50 
52  void printIt() const;
53 
55  DimExtent getDimension() const;
56 
58  const std::string & getName() const;
59 
61  const std::vector<SymmetryRange> & getSymmetrySubranges() const;
62 
65  void registerSymmetrySubrange(const SymmetryRange subrange);
66 
68  SpaceId getRegisteredId() const;
69 
70  friend class SpaceRegister;
71 
72 private:
73 
75  void resetRegisteredId(SpaceId id);
76 
77  SpaceBasis basis_; //basis defining the vector space
78  std::string space_name_; //optional space name
79  SpaceId id_; //registered space id (defaults to SOME_SPACE)
80 
81 };
82 
83 
84 class Subspace{
85 public:
86 
88  Subspace(const VectorSpace * vector_space,
89  DimOffset lower_bound,
90  DimOffset upper_bound);
91  Subspace(const VectorSpace * vector_space,
92  std::pair<DimOffset,DimOffset> bounds);
94  Subspace(const VectorSpace * vector_space,
95  DimOffset lower_bound,
96  DimOffset upper_bound,
97  const std::string & subspace_name);
98  Subspace(const VectorSpace * vector_space,
99  std::pair<DimOffset,DimOffset> bounds,
100  const std::string & subspace_name);
101 
102  Subspace(const Subspace & subspace) = default;
103  Subspace & operator=(const Subspace & subspace) = default;
104  Subspace(Subspace && subspace) noexcept = default;
105  Subspace & operator=(Subspace && subspace) noexcept = default;
106  virtual ~Subspace() = default;
107 
109  void printIt() const;
110 
112  DimExtent getDimension() const;
113 
115  DimOffset getLowerBound() const;
116 
118  DimOffset getUpperBound() const;
119 
121  std::pair<DimOffset,DimOffset> getBounds() const;
122 
124  const VectorSpace * getVectorSpace() const;
125 
127  const std::string & getName() const;
128 
130  SubspaceId getRegisteredId() const;
131 
132  friend class SubspaceRegister;
133 
134 private:
135 
137  void resetRegisteredId(SubspaceId id);
138 
139  const VectorSpace * vector_space_; //non-owning pointer to the vector space
140  DimOffset lower_bound_; //lower bound defining the subspace of the vector space
141  DimOffset upper_bound_; //upper bound defining the subspace of the vector space
142  std::string subspace_name_; //optional subspace name
143  SubspaceId id_; //registered subspace id (defaults to UNREG_SUBSPACE)
144 
145 };
146 
147 } //namespace numerics
148 
149 } //namespace exatn
150 
151 #endif //EXATN_NUMERICS_SPACES_HPP_
exatn::numerics::Subspace::getVectorSpace
const VectorSpace * getVectorSpace() const
Definition: spaces.cpp:142
exatn::numerics::VectorSpace::getRegisteredId
SpaceId getRegisteredId() const
Definition: spaces.cpp:64
exatn::numerics::Subspace
Definition: spaces.hpp:84
exatn::numerics::VectorSpace::getDimension
DimExtent getDimension() const
Definition: spaces.cpp:44
exatn::numerics::Subspace::getBounds
std::pair< DimOffset, DimOffset > getBounds() const
Definition: spaces.cpp:137
exatn::numerics::Subspace::getLowerBound
DimOffset getLowerBound() const
Definition: spaces.cpp:127
exatn
Definition: DriverClient.hpp:10
exatn::numerics::SpaceBasis
Definition: space_basis.hpp:38
exatn::numerics::Subspace::getDimension
DimExtent getDimension() const
Definition: spaces.cpp:122
exatn::numerics::SpaceRegister
Definition: space_register.hpp:101
exatn::numerics::VectorSpace::printIt
void printIt() const
Definition: spaces.cpp:34
exatn::numerics::Subspace::Subspace
Subspace(const VectorSpace *vector_space, DimOffset lower_bound, DimOffset upper_bound)
Definition: spaces.cpp:76
exatn::numerics::Subspace::printIt
void printIt() const
Definition: spaces.cpp:108
exatn::numerics::Subspace::getName
const std::string & getName() const
Definition: spaces.cpp:147
exatn::numerics::VectorSpace::VectorSpace
VectorSpace(DimExtent space_dim)
Definition: spaces.cpp:16
exatn::numerics::SymmetryRange
Definition: space_basis.hpp:30
exatn::numerics::Subspace::getRegisteredId
SubspaceId getRegisteredId() const
Definition: spaces.cpp:152
exatn::numerics::VectorSpace::getSymmetrySubranges
const std::vector< SymmetryRange > & getSymmetrySubranges() const
Definition: spaces.cpp:54
exatn::numerics::VectorSpace
Definition: spaces.hpp:32
exatn::numerics::SubspaceRegister
Definition: space_register.hpp:52
exatn::numerics::VectorSpace::registerSymmetrySubrange
void registerSymmetrySubrange(const SymmetryRange subrange)
Definition: spaces.cpp:59
exatn::numerics::Subspace::getUpperBound
DimOffset getUpperBound() const
Definition: spaces.cpp:132
exatn::numerics::VectorSpace::getName
const std::string & getName() const
Definition: spaces.cpp:49