DGtal  1.0.0
VectorField.h
1 
17 #pragma once
18 
31 #if defined(VectorField_RECURSES)
32 #error Recursive header files inclusion detected in VectorField.h
33 #else // defined(VectorField_RECURSES)
34 
35 #define VectorField_RECURSES
36 
37 #if !defined VectorField_h
38 
39 #define VectorField_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/base/ConstAlias.h"
46 #include "DGtal/base/ConstAlias.h"
47 #include "DGtal/dec/Duality.h"
48 #include "DGtal/dec/KForm.h"
49 #include "DGtal/kernel/PointVector.h"
51 
52 namespace DGtal
53 {
54 
56  // template class VectorField
66 template <typename TCalculus, Duality duality>
68  {
69  // ----------------------- Standard services ------------------------------
70  public:
71  typedef TCalculus Calculus;
72 
73  typedef typename Calculus::Scalar Scalar;
74  typedef typename Calculus::SCell SCell;
75  typedef typename Calculus::Index Index;
77 
80 
86 
92  VectorField(ConstAlias<Calculus> calculus, const Container& container);
93 
99  VectorField& operator=(const VectorField& other);
100 
106  SCell getSCell(const Index& index) const;
107 
112  Index length() const;
113 
118  Vector getVector(const Index& index) const;
119 
125  void setVector(const Index& index, const Vector& vector);
126 
127  // ----------------------- Interface --------------------------------------
128  public:
129 
134 
139 
144  void selfDisplay(std::ostream& out) const;
145 
149  std::string className() const;
150 
156 
161  KForm<Calculus, 0, duality> intensity(const typename Vector::NormType norm_type = Vector::L_2) const;
162 
166  void clear();
167 
173  VectorField<TCalculus, duality> normalized(const Scalar& epsilon = 0) const;
174 
179  bool isValid() const;
180 
181 
182  // ------------------------- Private Datas --------------------------------
183  private:
184 
185  // ------------------------- Hidden services ------------------------------
186  protected:
187 
192  VectorField();
193 
194  // ------------------------- Internals ------------------------------------
195  private:
196 
197  }; // end of class VectorField
198 
199 
206  template <typename Calculus, Duality duality>
207  std::ostream&
208  operator<<(std::ostream& out, const VectorField<Calculus, duality>& object);
209 
216  template <typename Calculus, Duality duality>
218  operator+(const VectorField<Calculus, duality>& vector_field_a, const VectorField<Calculus, duality>& vector_field_b);
219 
226  template <typename Calculus, Duality duality>
228  operator-(const VectorField<Calculus, duality>& vector_field_a, const VectorField<Calculus, duality>& vector_field_b);
229 
236  template <typename Calculus, Duality duality>
238  operator*(const typename Calculus::Scalar& scalar, const VectorField<Calculus, duality>& vector_field);
239 
245  template <typename Calculus, Duality duality>
247  operator-(const VectorField<Calculus, duality>& vector_field);
248 
249 } // namespace DGtal
250 
251 
253 // Includes inline functions.
254 #include "DGtal/dec/VectorField.ih"
255 
256 // //
258 
259 #endif // !defined VectorField_h
260 
261 #undef VectorField_RECURSES
262 #endif // else defined(VectorField_RECURSES)
Coordinates myCoordinates
Definition: VectorField.h:133
VectorField & operator=(const VectorField &other)
Calculus::Index Index
Definition: VectorField.h:75
VectorField< TCalculus, duality > normalized(const Scalar &epsilon=0) const
bool isValid() const
Vector getVector(const Index &index) const
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Definition: ConstAlias.h:186
DGtal::uint32_t Dimension
Definition: Common.h:127
Aim: KForm represents discrete kforms in the dec package.
Definition: KForm.h:65
KForm< Calculus, 0, duality > coordAlongDirection(const Dimension &dir) const
DGtal::PointVector< Calculus::dimensionAmbient, Scalar > Vector
Definition: VectorField.h:76
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:165
EigenLinearAlgebraBackend::DenseMatrix DenseMatrix
KForm< Calculus, order, duality > operator-(const KForm< Calculus, order, duality > &form_a, const KForm< Calculus, order, duality > &form_b)
TCalculus Calculus
Definition: VectorField.h:71
Calculus::Scalar Scalar
Definition: VectorField.h:73
void setVector(const Index &index, const Vector &vector)
std::string className() const
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
Circulator< TIterator > operator+(typename IteratorCirculatorTraits< TIterator >::Difference d, Circulator< TIterator > &object)
Definition: Circulator.h:453
DGtal is the top-level namespace which contains all DGtal functions and types.
Calculus::DenseMatrix Coordinates
Definition: VectorField.h:78
Coordinates Container
Definition: VectorField.h:79
KForm< Calculus, order, duality > operator *(const typename Calculus::Scalar &scalar, const KForm< Calculus, order, duality > &form)
const Calculus * myCalculus
Definition: VectorField.h:138
Index length() const
void selfDisplay(std::ostream &out) const
Aim: VectorField represents a discrete vector field in the dec package. Vector field values are attac...
Definition: VectorField.h:67
Calculus::SCell SCell
Definition: VectorField.h:74
SCell getSCell(const Index &index) const
KForm< Calculus, 0, duality > intensity(const typename Vector::NormType norm_type=Vector::L_2) const