Bembel
MixedEFIE.hpp
1 // This file is part of Bembel, the higher order C++ boundary element library.
2 //
3 // Copyright (C) 2024 see <http://www.bembel.eu>
4 //
5 // It was written as part of a cooperation of J. Doelz, H. Harbrecht, S. Kurz,
6 // M. Multerer, S. Schoeps, and F. Wolf at Technische Universitaet Darmstadt,
7 // Universitaet Basel, and Universita della Svizzera italiana, Lugano. This
8 // source code is subject to the GNU General Public License version 3 and
9 // provided WITHOUT ANY WARRANTY, see <http://www.bembel.eu> for further
10 // information.
11 
12 #ifndef BEMBEL_SRC_AUGMENTEDEFIE_MIXEDEFIE_HPP_
13 #define BEMBEL_SRC_AUGMENTEDEFIE_MIXEDEFIE_HPP_
14 
15 namespace Bembel {
16 // forward declaration of class MixedEFIE in order to define
17 // traits
18 
22 template <typename LinOpVector, typename LinOpScalar>
23 class MixedEFIE {
24  // implementation of the kernel evaluation, which may be based on the
25  // information available from the superSpace
26  public:
27  MixedEFIE() {}
28  MixedEFIE(AnsatzSpace<LinOpVector> ansatz_space_vector,
29  AnsatzSpace<LinOpScalar> ansatz_space_scalar) {
30  init_MixedEFIE(ansatz_space_vector, ansatz_space_scalar);
31  }
32 
33  void init_MixedEFIE(AnsatzSpace<LinOpVector> ansatz_space_vector,
34  AnsatzSpace<LinOpScalar> ansatz_space_scalar) {
35  ansatz_space_vector_ = ansatz_space_vector;
36  ansatz_space_scalar_ = ansatz_space_scalar;
37  }
38 
39  Eigen::Matrix<std::complex<double>, -1, 3> evaluate(
40  const Eigen::Matrix<double, Eigen::Dynamic, 3> &points) {
41  // Define the two parts of the EFIE each as Potential -> new classes
43  ansatz_space_vector_);
45  ansatz_space_scalar_);
46 
47  // Set wave number
48  A.get_potential().set_wavenumber(wavenumber_);
49  grad_phi.get_potential().set_wavenumber(wavenumber_);
50 
51  // Set cauchy data
52  A.set_cauchy_data(current_);
53  grad_phi.set_cauchy_data(charges_);
54 
55  // Compute each contribution to the potential
56  Eigen::Matrix<std::complex<double>, -1, 3> potential(points.rows(), 3);
57  potential.setZero();
58  potential = -std::complex<double>(0., 1.) * omega_ * Constants::mu0 *
59  A.evaluate(points);
60  potential -= grad_phi.evaluate(points) / Constants::eps0;
61 
62  return potential;
63  }
65  // setters
67  void set_omega(double omega) { omega_ = omega; }
68  void set_wavenumber(std::complex<double> wavenumber) {
69  wavenumber_ = wavenumber;
70  }
71  void set_current(Eigen::VectorXcd current) { current_ = current; }
72  void set_charges(Eigen::VectorXcd charges) { charges_ = charges; }
74  // getters
76  double get_omega() { return omega_; }
77  std::complex<double> get_wavenumber() { return wavenumber_; }
78  Eigen::VectorXcd get_current() { return current_; }
79  Eigen::VectorXcd get_charges() { return charges_; }
80 
81  private:
82  AnsatzSpace<LinOpVector> ansatz_space_vector_;
83  AnsatzSpace<LinOpScalar> ansatz_space_scalar_;
84  Eigen::VectorXcd current_;
85  Eigen::VectorXcd charges_;
86  double omega_;
87  std::complex<double> wavenumber_;
88 };
89 
90 } // namespace Bembel
91 #endif // BEMBEL_SRC_AUGMENTEDEFIE_MIXEDEFIE_HPP_
Routines for the evalutation of pointwise errors.
Definition: AnsatzSpace.hpp:14