WaveBlocksND
evaluation.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 evaluation
16  {
29  template <class Subtype, class Basis>
30  struct Abstract {
32  IMPORT_TYPES_FROM( Basis)
33 
34  potential_evaluation_type evaluate_at( const argument_type &arg ) const
35  {
36  return static_cast<const Subtype*>(this)->evaluate_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<potential_evaluation_type> evaluate(
42  const grid_in<argument_type > &args ) const {
43  return utilities::evaluate_function_in_grid < argument_type,
44  potential_evaluation_type,
45  grid_in,
46  grid_out,
47  function_t > (std::bind( &Self::evaluate_at, this, std::placeholders::_1 ), args );
48  }
49  };
50 
59  template <class Basis>
60  struct Standard : Abstract<Standard<Basis>, Basis> {
61  IMPORT_TYPES_FROM( Basis)
62 
63  private:
64  potential_type potential;
65 
66  public:
67  Standard( potential_type potential)
68  : potential( potential ){}
69 
70  public:
71  potential_evaluation_type evaluate_at_implementation( const argument_type &arg ) const {
72  return utilities::FunctionMatrixEvaluator < Basis::number_of_levels, Basis::number_of_columns,
73  GMatrix,
74  argument_type,
75  potential_return_type,
76  function_t >::apply( potential, arg );
77  }
78  };
79  }
80 
81  template <class Basis>
83  }
84  }
85 }
Definition: coefficients_file_parser.cpp:10
grid_out< potential_evaluation_type > evaluate(const grid_in< argument_type > &args) const
Definition: evaluation.hpp:41
potential_evaluation_type evaluate_at_implementation(const argument_type &arg) const
Definition: evaluation.hpp:71
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
Standard(potential_type potential)
Definition: evaluation.hpp:67
potential_evaluation_type evaluate_at(const argument_type &arg) const
Definition: evaluation.hpp:34
std::function< P > function_t
Definition: types.hpp:57
Abstract class for potential evaluation.
Definition: evaluation.hpp:30
#define IMPORT_TYPES_FROM(B)
Definition: bases.hpp:3
potential_type potential
Definition: evaluation.hpp:64
Helper class for easier template specialization.
Definition: evaluation.hpp:60