DGtal  0.9.2
KForm.h
1 
17 #pragma once
18 
31 #if defined(KForm_RECURSES)
32 #error Recursive header files inclusion detected in KForm.h
33 #else // defined(KForm_RECURSES)
34 
35 #define KForm_RECURSES
36 
37 #if !defined KForm_h
38 
39 #define KForm_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/base/ConstAlias.h"
46 #include "DGtal/base/Clone.h"
47 #include "DGtal/dec/Duality.h"
49 
50 namespace DGtal
51 {
52 
54  // template class KForm
64  template <typename TCalculus, Order order, Duality duality>
65  class KForm
66  {
67  // ----------------------- Standard services ------------------------------
68  public:
69  typedef TCalculus Calculus;
70 
71  BOOST_STATIC_ASSERT(( order >= 0 ));
72  BOOST_STATIC_ASSERT(( order <= Calculus::dimensionEmbedded ));
73 
74  typedef typename Calculus::DenseVector Container;
75  typedef typename Calculus::Scalar Scalar;
76  typedef typename Calculus::SCell SCell;
77  typedef typename Calculus::Index Index;
78 
83  static
85  ones(ConstAlias<Calculus> calculus);
86 
92  static
94  zeros(ConstAlias<Calculus> calculus);
95 
101  static
103  dirac(ConstAlias<Calculus> calculus, const typename Calculus::Cell& cell);
104 
109  KForm(ConstAlias<Calculus> calculus);
110 
116  KForm(ConstAlias<Calculus> calculus, const Container& container);
117 
123  KForm& operator=(const KForm& other);
124 
125  // ----------------------- Interface --------------------------------------
126  public:
127 
131  Container myContainer;
132 
136  const Calculus* myCalculus;
137 
142  void selfDisplay(std::ostream& out) const;
143 
147  std::string className() const;
148 
152  void clear();
153 
159  SCell getSCell(const Index& index) const;
160 
165  Index length() const;
166 
171  bool isValid() const;
172 
173  // ------------------------- Private Datas --------------------------------
174  private:
175 
176  // ------------------------- Hidden services ------------------------------
177  protected:
178 
183  KForm();
184 
185  // ------------------------- Internals ------------------------------------
186  private:
187 
188  }; // end of class KForm
189 
196  template <typename Calculus, Order order, Duality duality>
197  std::ostream&
198  operator<<(std::ostream& out, const KForm<Calculus, order, duality>& object);
199 
206  template <typename Calculus, Order order, Duality duality>
209 
216  template <typename Calculus, Order order, Duality duality>
219 
226  template <typename Calculus, Order order, Duality duality>
228  operator*(const typename Calculus::Scalar& scalar, const KForm<Calculus, order, duality>& form);
229 
235  template <typename Calculus, Order order, Duality duality>
238 
239 } // namespace DGtal
240 
241 
243 // Includes inline functions.
244 #include "DGtal/dec/KForm.ih"
245 
246 // //
248 
249 #endif // !defined KForm_h
250 
251 #undef KForm_RECURSES
252 #endif // else defined(KForm_RECURSES)
bool isValid() const
Calculus::SCell SCell
Definition: KForm.h:76
TCalculus Calculus
Definition: KForm.h:69
KForm & operator=(const KForm &other)
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
SCell getSCell(const Index &index) const
Aim: KForm represents discrete kforms in the dec package.
Definition: KForm.h:65
Container myContainer
Definition: KForm.h:131
KForm< Calculus, order, duality > operator-(const KForm< Calculus, order, duality > &form_a, const KForm< Calculus, order, duality > &form_b)
static KForm< TCalculus, order, duality > zeros(ConstAlias< Calculus > calculus)
std::string className() const
Circulator< TIterator > operator+(typename IteratorCirculatorTraits< TIterator >::Difference d, Circulator< TIterator > &object)
Definition: Circulator.h:453
static KForm< TCalculus, order, duality > dirac(ConstAlias< Calculus > calculus, const typename Calculus::Cell &cell)
DGtal is the top-level namespace which contains all DGtal functions and types.
Calculus::DenseVector Container
Definition: KForm.h:74
static KForm< TCalculus, order, duality > ones(ConstAlias< Calculus > calculus)
Calculus::Index Index
Definition: KForm.h:77
BOOST_STATIC_ASSERT((order >=0))
Index length() const
KForm< Calculus, order, duality > operator*(const typename Calculus::Scalar &scalar, const KForm< Calculus, order, duality > &form)
Calculus::Scalar Scalar
Definition: KForm.h:75
const Calculus * myCalculus
Definition: KForm.h:136
void selfDisplay(std::ostream &out) const