Medusa  1.1
Coordinate Free Mehless Method implementation
ExplicitOperators_fwd.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_OPERATORS_EXPLICITOPERATORS_FWD_HPP_
2 #define MEDUSA_BITS_OPERATORS_EXPLICITOPERATORS_FWD_HPP_
3 
11 #include <medusa/Config.hpp>
12 #include <Eigen/Core>
16 
17 namespace mm {
18 
34 template <class shape_storage_type>
36  public:
37  typedef shape_storage_type shape_storage_t;
38  typedef typename shape_storage_t::vector_t vector_t;
40  enum { dim = shape_storage_t::dim };
42 
43  private:
46 
47  public:
49  ExplicitOperators() : ss(nullptr) {}
58  explicit ExplicitOperators(const shape_storage_t& ss) : ss(&ss) {}
59 
66  void setShapes(const shape_storage_t& shape_storage_) { ss = &shape_storage_; }
67 
69  bool hasShapes() const { return ss != nullptr; }
70 
80  template <typename scalar_field_t>
81  typename scalar_type<scalar_field_t>::type lap(const scalar_field_t& u, int node) const {
82  return apply<Lap<dim>, scalar_field_t>(u, node);
83  }
84 
94  template <typename scalar_field_t>
96  grad(const scalar_field_t& u, int node) const;
97 
138  template <typename scalar_field_t>
140  const scalar_field_t& u, int node, const vector_t& normal,
141  typename scalar_type<scalar_field_t>::type val) const;
142 
149  template <typename scalar_field_t>
151  const scalar_field_t& u, int var, int node) const {
152  return apply<Der1s<dim>, scalar_field_t>(u, node, Der1<dim>(var));
153  }
154 
162  template <typename scalar_field_t>
163  typename scalar_type<scalar_field_t>::type d2(const scalar_field_t& u, int varmin,
164  int varmax, int node) const {
165  return apply<Der2s<dim>, scalar_field_t>(u, node, Der2<dim>(varmin, varmax));
166  }
167 
179  template <typename op_family_t, typename scalar_field_t>
181  const scalar_field_t& u, int node, typename op_family_t::operator_t o) const;
182 
183 
185  template <typename op_family_t, typename scalar_field_t>
186  typename scalar_type<scalar_field_t>::type apply(const scalar_field_t& u, int node) const {
187  return apply<op_family_t, scalar_field_t>(u, node, {});
188  }
189 
191  template <typename S>
192  friend std::ostream& operator<<(std::ostream& os, const ExplicitOperators<S>& op);
193 };
194 
195 } // namespace mm
196 
197 #endif // MEDUSA_BITS_OPERATORS_EXPLICITOPERATORS_FWD_HPP_
mm::ExplicitOperators::ss
const shape_storage_t * ss
Pointer to shape storage, but name is shortened for readability.
Definition: ExplicitOperators_fwd.hpp:45
mm::ExplicitOperators::vector_t
shape_storage_t::vector_t vector_t
Vector type.
Definition: ExplicitOperators_fwd.hpp:38
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
mm::ExplicitOperators::lap
scalar_type< scalar_field_t >::type lap(const scalar_field_t &u, int node) const
Returns an approximation of Laplacian of field u in node-th node.
Definition: ExplicitOperators_fwd.hpp:81
scalar_t
Scalar scalar_t
Type of the elements, alias of Scalar.
Definition: MatrixBaseAddons.hpp:16
mm::Vec
Eigen::Matrix< scalar_t, dim, 1, Eigen::ColMajor|Eigen::AutoAlign, dim, 1 > Vec
Fixed size vector type, representing a mathematical 1d/2d/3d vector.
Definition: Vec_fwd.hpp:31
mm::ExplicitOperators::operator<<
friend std::ostream & operator<<(std::ostream &os, const ExplicitOperators< S > &op)
Output basic information about given operators.
Definition: ExplicitOperators.hpp:80
mm::ExplicitOperators::neumann
scalar_type< scalar_field_t >::type neumann(const scalar_field_t &u, int node, const vector_t &normal, typename scalar_type< scalar_field_t >::type val) const
Calculates a new field value a for u at node, such that the Neumann boundary condition du/dn(node) = ...
mm::ExplicitOperators::setShapes
void setShapes(const shape_storage_t &shape_storage_)
Sets a new shape storage from which this operators are generated.
Definition: ExplicitOperators_fwd.hpp:66
mm::ExplicitOperators::apply
scalar_type< scalar_field_t >::type apply(const scalar_field_t &u, int node) const
Overload for default constructible operator.
Definition: ExplicitOperators_fwd.hpp:186
dim
@ dim
Number of elements of this matrix.
Definition: MatrixBaseAddons.hpp:14
mm::ExplicitOperators::ExplicitOperators
ExplicitOperators()
Construct empty explicit operators.
Definition: ExplicitOperators_fwd.hpp:49
Config.hpp
mm::ExplicitOperators
A class for evaluating typical operators needed in spatial discretization.
Definition: ExplicitOperators_fwd.hpp:35
mm::ExplicitOperators::apply
scalar_type< scalar_field_t >::type apply(const scalar_field_t &u, int node, typename op_family_t::operator_t o) const
Returns an approximation of applying the requested operator to field u at node node.
mm::Der2
Represents a second derivative wrt. var1 and var2.
Definition: Monomials_fwd.hpp:24
mm::ExplicitOperators::scalar_t
shape_storage_t::scalar_t scalar_t
Scalar type.
Definition: ExplicitOperators_fwd.hpp:39
mm::ExplicitOperators::ExplicitOperators
ExplicitOperators(const shape_storage_t &ss)
Construct explicit operators over given shape storage.
Definition: ExplicitOperators_fwd.hpp:58
UniformShapeStorage_fwd.hpp
mm::ExplicitOperators::shape_storage_t
shape_storage_type shape_storage_t
Type of shape storage.
Definition: ExplicitOperators_fwd.hpp:37
mm::ExplicitOperators::d2
scalar_type< scalar_field_t >::type d2(const scalar_field_t &u, int varmin, int varmax, int node) const
Returns an approximation of requested second derivative of field u in node-th node.
Definition: ExplicitOperators_fwd.hpp:163
mm::ExplicitOperators::grad
Vec< typename scalar_type< scalar_field_t >::type, ExplicitOperators< shape_storage_type >::dim > grad(const scalar_field_t &u, int node) const
Returns an approximation of gradient of field u in node-th node.
RaggedShapeStorage_fwd.hpp
mm::Der1
Represents a first derivative wrt. var.
Definition: Monomials_fwd.hpp:22
Vec.hpp
mm::ExplicitOperators::d1
scalar_type< scalar_field_t >::type d1(const scalar_field_t &u, int var, int node) const
Returns an approximation of requested derivative of field u in node-th node.
Definition: ExplicitOperators_fwd.hpp:150
mm::ExplicitOperators::hasShapes
bool hasShapes() const
Returns true if operators have a non-null pointer to storage and false otherwise.
Definition: ExplicitOperators_fwd.hpp:69
mm::scalar_type::type
scalar_field_t::Scalar type
Default scalar type.
Definition: traits.hpp:19
mm::ExplicitOperators::dim
@ dim
Dimensionality of the function domain.
Definition: ExplicitOperators_fwd.hpp:41