DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ImplicitFunctionDiff1LinearCellEmbedder.h
1 
17 #pragma once
18 
31 #if defined(ImplicitFunctionDiff1LinearCellEmbedder_RECURSES)
32 #error Recursive header files inclusion detected in ImplicitFunctionDiff1LinearCellEmbedder.h
33 #else // defined(ImplicitFunctionDiff1LinearCellEmbedder_RECURSES)
34 
35 #define ImplicitFunctionDiff1LinearCellEmbedder_RECURSES
36 
37 #if !defined ImplicitFunctionDiff1LinearCellEmbedder_h
38 
39 #define ImplicitFunctionDiff1LinearCellEmbedder_h
40 
42 // Inclusions
43 #include <iostream>
44 #include "DGtal/base/Common.h"
45 #include "DGtal/kernel/NumberTraits.h"
46 #include "DGtal/kernel/CPointEmbedder.h"
47 #include "DGtal/topology/CCellularGridSpaceND.h"
48 #include "DGtal/shapes/implicit/CImplicitFunction.h"
49 #include "DGtal/shapes/implicit/CImplicitFunctionDiff1.h"
51 
52 namespace DGtal
53 {
54 
56  template < typename TKSpace,
57  typename TImplicitFunctionDiff1,
58  typename TEmbedder >
60 
62 
75  template < typename TKSpace,
76  typename TImplicitFunctionDiff1,
77  typename TEmbedder >
79  {
83 
84  public:
85  typedef TKSpace KSpace;
86  typedef TImplicitFunctionDiff1 ImplicitFunctionDiff1;
87  typedef TEmbedder Embedder;
88  typedef typename KSpace::Cell Cell;
89  typedef typename KSpace::SCell SCell;
90  typedef typename KSpace::Space Space;
91  typedef typename Space::Point Point;
92  typedef typename Space::RealPoint RealPoint;
93  typedef typename Space::RealVector RealVector;
94  typedef typename ImplicitFunctionDiff1::Value ImplicitFctValue;
95  typedef Cell Argument;
96  typedef RealPoint Value;
99 
104 
109 
115 
123 
132  void init( const KSpace & K, const ImplicitFunctionDiff1 & f,
133  const Embedder & e );
134 
135  // ----------------------- Interface --------------------------------------
136  public:
137 
141  GradientMap gradientMap() const;
142 
150  RealPoint embed( const Point & p ) const;
151 
159  RealPoint embedCell( const Cell & cell ) const;
160 
169  RealPoint embedSCell( const SCell & scell ) const;
170 
178  RealPoint operator()( const Cell & cell ) const;
179 
189  void embed( const Point & p, RealPoint & x, RealVector & grad ) const;
190 
200  void embedCell( const Cell & cell,
201  RealPoint & x, RealVector & grad ) const;
202 
213  void embedSCell( const SCell & scell,
214  RealPoint & x, RealVector & grad ) const;
215 
216  // ----------------------- Interface --------------------------------------
217  public:
218 
223  void selfDisplay ( std::ostream & out ) const;
224 
229  bool isValid() const;
230 
231  // ------------------------- Protected Datas ------------------------------
232  protected:
233 
235  const KSpace* myPtrK;
240 
241  }; // end of class ImplicitFunctionDiff1LinearCellEmbedder
242 
247  template < typename TKSpace,
248  typename TImplicitFunctionDiff1,
249  typename TEmbedder >
251  : public ImplicitFunctionDiff1LinearCellEmbedder< TKSpace,
252  TImplicitFunctionDiff1,
253  TEmbedder>
254  {
256  < TKSpace, TImplicitFunctionDiff1, TEmbedder> Self;
258  < TKSpace, TImplicitFunctionDiff1, TEmbedder> Base;
259  typedef typename Base::Cell Cell;
260  typedef typename Base::RealPoint RealPoint;
261  typedef typename Base::RealVector RealVector;
262  typedef Cell Argument;
263  typedef RealVector Value;
264  using Base::myPtrFct;
265 
266  inline
268  ( const Base & other )
269  : Base( other )
270  {}
271 
272  inline
273  Self & operator=( const Base & other )
274  {
275  Base::operator=( other );
276  return *this;
277  }
278 
279  inline
280  Value operator()( const Argument & arg ) const
281  {
282  RealPoint x = Base::operator()( arg );
283  return myPtrFct->gradient( x );
284  }
285  };
286 
293  template < typename TKSpace, typename TImplicitFunctionDiff1, typename TEmbedder >
294  std::ostream&
295  operator<< ( std::ostream & out,
297 
298 } // namespace DGtal
299 
300 
302 // Includes inline functions.
303 #include "DGtal/shapes/implicit/ImplicitFunctionDiff1LinearCellEmbedder.ih"
304 
305 // //
307 
308 #endif // !defined ImplicitFunctionDiff1LinearCellEmbedder_h
309 
310 #undef ImplicitFunctionDiff1LinearCellEmbedder_RECURSES
311 #endif // else defined(ImplicitFunctionDiff1LinearCellEmbedder_RECURSES)