WaveBlocksND
jacobian.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../../types.hpp"
4 #include "../../utilities/evaluations.hpp"
5 
6 #include "../bases.hpp"
7 
8 
9 namespace waveblocks
10 {
11  namespace potentials
12  {
13  namespace modules
14  {
15  namespace jacobian
16  {
29  template <class Subtype, class Basis>
30  struct Abstract {
32  IMPORT_TYPES_FROM( Basis)
33 
34 
35  jacobian_evaluation_type evaluate_jacobian_at( const argument_type &arg ) const {
36  return static_cast<const Subtype*>(this)->evaluate_jacobian_at_implementation( arg );
37  }
38 
39  template < template <typename...> class grid_in = std::vector,
40  template <typename...> class grid_out = grid_in >
41  grid_out<jacobian_evaluation_type> evaluate_jacobian(
42  const grid_in<argument_type > &args ) const {
43  return utilities::evaluate_function_in_grid < argument_type,
44  jacobian_evaluation_type,
45  grid_in,
46  grid_out,
47  function_t > (
48  std::bind( &Self::evaluate_jacobian_at, this, std::placeholders::_1 ),
49  args );
50  }
51  };
52 
61  template <class Basis>
62  struct Standard : Abstract<Standard<Basis>, Basis> {
63 
64  IMPORT_TYPES_FROM(Basis )
65 
66  private:
67  jacobian_type jacobian;
68 
69  public:
70  Standard(jacobian_type jacobian)
71  : jacobian( jacobian ) {}
72 
73  public:
74  jacobian_evaluation_type evaluate_jacobian_at_implementation(
75  const argument_type &arg ) const {
76  return utilities::FunctionMatrixEvaluator < Basis::number_of_levels,
77  Basis::number_of_columns,
78  GMatrix,
79  argument_type,
80  jacobian_return_type,
81  function_t >::apply( jacobian, arg );
82  }
83  };
84 
85  }
86 
87  template <class Basis>
89  }
90  }
91 }
Definition: coefficients_file_parser.cpp:10
jacobian_type jacobian
Definition: jacobian.hpp:67
Abstract class for potential evaluation.
Definition: jacobian.hpp:30
G_out< R > evaluate_function_in_grid(const F< R(A)> &f, const G_in< A > &g)
Evaluate a function in multiple points at once.
Definition: evaluations.hpp:130
Eigen::Matrix< I, R, C > GMatrix
Definition: types.hpp:37
jacobian_evaluation_type evaluate_jacobian_at_implementation(const argument_type &arg) const
Definition: jacobian.hpp:74
Helper class for easier template specialization.
Definition: jacobian.hpp:62
std::function< P > function_t
Definition: types.hpp:57
grid_out< jacobian_evaluation_type > evaluate_jacobian(const grid_in< argument_type > &args) const
Definition: jacobian.hpp:41
#define IMPORT_TYPES_FROM(B)
Definition: bases.hpp:3
Standard(jacobian_type jacobian)
Definition: jacobian.hpp:70
jacobian_evaluation_type evaluate_jacobian_at(const argument_type &arg) const
Definition: jacobian.hpp:35