DGtal  0.9.2
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"
50 
51 namespace DGtal
52 {
53 
55  // template class VectorField
65 template <typename TCalculus, Duality duality>
67  {
68  // ----------------------- Standard services ------------------------------
69  public:
70  typedef TCalculus Calculus;
71 
72  typedef typename Calculus::Scalar Scalar;
73  typedef typename Calculus::SCell SCell;
74  typedef typename Calculus::Index Index;
76 
77  typedef typename Calculus::DenseMatrix Coordinates;
78  typedef Coordinates Container;
79 
85 
91  VectorField(ConstAlias<Calculus> calculus, const Container& container);
92 
98  VectorField& operator=(const VectorField& other);
99 
105  SCell getSCell(const Index& index) const;
106 
111  Index length() const;
112 
117  Vector getVector(const Index& index) const;
118 
124  void setVector(const Index& index, const Vector& vector);
125 
126  // ----------------------- Interface --------------------------------------
127  public:
128 
132  Coordinates myCoordinates;
133 
137  const Calculus* myCalculus;
138 
143  void selfDisplay(std::ostream& out) const;
144 
148  std::string className() const;
149 
155 
160  KForm<Calculus, 0, duality> intensity(const typename Vector::NormType norm_type = Vector::L_2) const;
161 
165  void clear();
166 
172  VectorField<TCalculus, duality> normalized(const Scalar& epsilon = 0) const;
173 
178  bool isValid() const;
179 
180 
181  // ------------------------- Private Datas --------------------------------
182  private:
183 
184  // ------------------------- Hidden services ------------------------------
185  protected:
186 
191  VectorField();
192 
193  // ------------------------- Internals ------------------------------------
194  private:
195 
196  }; // end of class VectorField
197 
198 
205  template <typename Calculus, Duality duality>
206  std::ostream&
207  operator<<(std::ostream& out, const VectorField<Calculus, duality>& object);
208 
215  template <typename Calculus, Duality duality>
217  operator+(const VectorField<Calculus, duality>& vector_field_a, const VectorField<Calculus, duality>& vector_field_b);
218 
225  template <typename Calculus, Duality duality>
227  operator-(const VectorField<Calculus, duality>& vector_field_a, const VectorField<Calculus, duality>& vector_field_b);
228 
235  template <typename Calculus, Duality duality>
237  operator*(const typename Calculus::Scalar& scalar, const VectorField<Calculus, duality>& vector_field);
238 
244  template <typename Calculus, Duality duality>
246  operator-(const VectorField<Calculus, duality>& vector_field);
247 
248 } // namespace DGtal
249 
250 
252 // Includes inline functions.
253 #include "DGtal/dec/VectorField.ih"
254 
255 // //
257 
258 #endif // !defined VectorField_h
259 
260 #undef VectorField_RECURSES
261 #endif // else defined(VectorField_RECURSES)
Coordinates myCoordinates
Definition: VectorField.h:132
void selfDisplay(std::ostream &out) const
VectorField & operator=(const VectorField &other)
Calculus::Index Index
Definition: VectorField.h:74
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:113
Aim: KForm represents discrete kforms in the dec package.
Definition: KForm.h:65
DGtal::PointVector< Calculus::dimensionAmbient, Scalar > Vector
Definition: VectorField.h:75
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:141
SCell getSCell(const Index &index) const
Index length() const
std::string className() const
VectorField< TCalculus, duality > normalized(const Scalar &epsilon=0) const
KForm< Calculus, order, duality > operator-(const KForm< Calculus, order, duality > &form_a, const KForm< Calculus, order, duality > &form_b)
TCalculus Calculus
Definition: VectorField.h:70
bool isValid() const
Calculus::Scalar Scalar
Definition: VectorField.h:72
void setVector(const Index &index, const Vector &vector)
Circulator< TIterator > operator+(typename IteratorCirculatorTraits< TIterator >::Difference d, Circulator< TIterator > &object)
Definition: Circulator.h:453
KForm< Calculus, 0, duality > coordAlongDirection(const Dimension &dir) const
KForm< Calculus, 0, duality > intensity(const typename Vector::NormType norm_type=Vector::L_2) const
DGtal is the top-level namespace which contains all DGtal functions and types.
Calculus::DenseMatrix Coordinates
Definition: VectorField.h:77
Coordinates Container
Definition: VectorField.h:78
const Calculus * myCalculus
Definition: VectorField.h:137
KForm< Calculus, order, duality > operator*(const typename Calculus::Scalar &scalar, const KForm< Calculus, order, duality > &form)
Aim: VectorField represents a discrete vector field in the dec package. Vector field values are attac...
Definition: VectorField.h:66
Calculus::SCell SCell
Definition: VectorField.h:73