PFASST++
wrapper_interface.hpp
Go to the documentation of this file.
1 
7 #ifndef _EXAMPLES__BORIS__BINDINGS__WRAPPER_INTERFACE_HPP_
8 #define _EXAMPLES__BORIS__BINDINGS__WRAPPER_INTERFACE_HPP_
9 
10 #include <cstdlib>
11 #include <memory>
12 #include <utility>
13 using namespace std;
14 
15 #include <pfasst/logging.hpp>
16 
17 #include "../particle_cloud.hpp"
18 
19 #define UNUSED(expr) (void)(expr)
20 
21 
22 namespace pfasst
23 {
24  namespace examples
25  {
26  namespace boris
27  {
31  namespace bindings
32  {
36  template<
37  typename scalar,
38  typename time
39  >
41  : public el::Loggable
42  {
43  public:
44  typedef shared_ptr<ParticleCloud<scalar>> particle_cloud_type;
45 
46  protected:
47  virtual size_t pack_positions(const particle_cloud_type& particles, scalar* packed) = 0;
48  virtual size_t pack_velocities(const particle_cloud_type& particles, scalar* packed) = 0;
49  virtual size_t pack_charges(const particle_cloud_type& particles, scalar* packed) = 0;
50  virtual size_t pack_masses(const particle_cloud_type& particles, scalar* packed) = 0;
51  virtual size_t pack_all(const particle_cloud_type& particles,
52  scalar* packed_positions, scalar* packed_velocities,
53  scalar* packed_charges, scalar* packed_masses) = 0;
54 
55  public:
56  virtual ~WrapperInterface() {}
57 
59  external_e_field_evaluate(const particle_cloud_type& particles, const time t) = 0;
60 
62  e_field_evaluate(const particle_cloud_type& particles, const time t) = 0;
63 
65  b_field_evaluate(const particle_cloud_type& particles, const time t) = 0;
66 
68  force_evaluate(const particle_cloud_type& particles, const time t) = 0;
69 
71  virtual ParticleCloudComponent<scalar> b_field_vecs(const particle_cloud_type& particles, const time t) = 0;
72 
73  virtual scalar energy(const particle_cloud_type& particles, const time t) = 0;
74 
75  virtual scalar omega_b() const = 0;
76  virtual scalar omega_e() const = 0;
77  virtual scalar epsilon() const = 0;
78 
79  virtual void log(el::base::type::ostream_t& os) const = 0;
80  };
81 
83  template<typename scalar, typename time>
84  void setup(shared_ptr<WrapperInterface<scalar, time>> wrapper)
85  {
86  UNUSED(wrapper);
87  }
88 
90  template<typename scalar, typename time, typename ArgT>
91  void setup(shared_ptr<WrapperInterface<scalar, time>> wrapper, ArgT arg)
92  {
93  UNUSED(wrapper); UNUSED(arg);
94  }
95 
97  template<typename scalar, typename time, typename ArgT, typename... ArgsT>
98  void setup(shared_ptr<WrapperInterface<scalar, time>> wrapper, ArgT arg, ArgsT... args)
99  {
100  setup(wrapper, arg);
101  setup(wrapper, args...);
102  }
103  } // ::pfasst::examples::boris::bindings
104  } // ::pfasst::examples::boris
105  } // ::pfasst::examples
106 } // ::pfasst
107 
108 #endif // _EXAMPLES__BORIS__BINDINGS__WRAPPER_INTERFACE_HPP_
void setup(shared_ptr< WrapperInterface< scalar, time >> wrapper, ArgT arg, ArgsT...args)
STL namespace.
#define UNUSED(expr)
vector< precision > ParticleCloudComponent
void get_b_field_vector(const SimplePhysicsSolverConfig *config, double *b_field_vector)
vector< precision > ParticleComponent
Definition: particle.hpp:27
shared_ptr< ParticleCloud< scalar > > particle_cloud_type
tuple t
Definition: plot.py:12