Medusa  1.1
Coordinate Free Mehless Method implementation
RotatedShape_fwd.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_DOMAINS_ROTATEDSHAPE_FWD_HPP_
2 #define MEDUSA_BITS_DOMAINS_ROTATEDSHAPE_FWD_HPP_
3 
11 #include <medusa/Config.hpp>
13 #include "DomainShape_fwd.hpp"
14 
15 namespace mm {
16 
26 template <typename vec_t>
27 class RotatedShape : public DomainShape<vec_t> {
28  public:
29  using typename DomainShape<vec_t>::scalar_t;
31 
32  private:
34  Eigen::Matrix<scalar_t, dim, dim> Q;
35 
36  public:
41  RotatedShape(const DomainShape<vec_t>& sh, const Eigen::Matrix<scalar_t, dim, dim>& Q);
42 
47 
49  const DomainShape<vec_t>& shape() const { return *sh; }
50 
52  Eigen::Matrix<scalar_t, dim, dim> rotation() const { return Q; }
53 
54  bool contains(const vec_t& point) const override {
55  return sh->contains(Q.transpose()*point);
56  }
57 
58  bool hasContains() const override { return sh->hasContains(); }
59 
60  std::pair<vec_t, vec_t> bbox() const override;
61 
62  RotatedShape<vec_t>* clone() const override { return new RotatedShape(*this); }
63 
64  std::ostream& print(std::ostream& os) const override {
65  return os << "Shape " << *sh << " rotated by " << Q;
66  }
67 
70 
72  int boundary_type) const override;
73 
75  const std::function<scalar_t(vec_t)>& dr, int internal_type,
76  int boundary_type) const override;
77 
79  const std::function<scalar_t(vec_t)>& dr, int type) const override;
81 };
82 
83 } // namespace mm
84 
85 #endif // MEDUSA_BITS_DOMAINS_ROTATEDSHAPE_FWD_HPP_
mm::RotatedShape::rotation
Eigen::Matrix< scalar_t, dim, dim > rotation() const
Returns the transformation used in this shape.
Definition: RotatedShape_fwd.hpp:52
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
scalar_t
Scalar scalar_t
Type of the elements, alias of Scalar.
Definition: MatrixBaseAddons.hpp:16
mm::DomainDiscretization
Class representing domain discretization along with an associated shape.
Definition: DomainDiscretization_fwd.hpp:46
mm::RotatedShape
Class for working with rotated (or mirrored) domain shapes.
Definition: RotatedShape_fwd.hpp:27
mm::RotatedShape::hasContains
bool hasContains() const override
Return true if shape has contains() method implemented.
Definition: RotatedShape_fwd.hpp:58
mm::RotatedShape::clone
RotatedShape< vec_t > * clone() const override
Polymorphic clone pattern.
Definition: RotatedShape_fwd.hpp:62
mm::RotatedShape::sh
deep_copy_unique_ptr< DomainShape< vec_t > > sh
Shape to be transformed.
Definition: RotatedShape_fwd.hpp:33
mm::DomainShape::discretizeWithStep
virtual DomainDiscretization< vec_t > discretizeWithStep(scalar_t step, int internal_type, int boundary_type) const
Returns a discretization of this shape with approximately uniform distance step between nodes.
Definition: DomainShape_fwd.hpp:137
mm::DomainShape
Base class for geometric shapes of domains.
Definition: DomainShape_fwd.hpp:52
Config.hpp
mm::DomainShape::discretizeBoundaryWithDensity
virtual DomainDiscretization< vec_t > discretizeBoundaryWithDensity(const std::function< scalar_t(vec_t)> &dr, int type) const =0
Discretizes boundary with given density and fill engine.
Vec_fwd.hpp
mm::DomainShape::discretizeWithDensity
virtual DomainDiscretization< vec_t > discretizeWithDensity(const std::function< scalar_t(vec_t)> &dr, int internal_type, int boundary_type) const
Returns a discretization of the domain with spatially variable step.
Definition: DomainShape.hpp:77
mm::RotatedShape::Q
Eigen::Matrix< scalar_t, dim, dim > Q
Orthogonal transformation matrix.
Definition: RotatedShape_fwd.hpp:34
mm::DomainShape::discretizeBoundaryWithStep
virtual DomainDiscretization< vec_t > discretizeBoundaryWithStep(scalar_t step, int type) const
Returns a discretization of the boundary of this shape with approximately uniform distance step betwe...
Definition: DomainShape_fwd.hpp:118
mm::RotatedShape::print
std::ostream & print(std::ostream &os) const override
Output information about this shape to given output stream os.
Definition: RotatedShape_fwd.hpp:64
mm::RotatedShape::contains
bool contains(const vec_t &point) const override
Return true if point is not more than margin() outside the domain.
Definition: RotatedShape_fwd.hpp:54
mm::RotatedShape::RotatedShape
RotatedShape(const DomainShape< vec_t > &sh, const Eigen::Matrix< scalar_t, dim, dim > &Q)
Construct a transformed shape by specifying a shape and an orthogonal transformation matrix.
Definition: RotatedShape.hpp:17
mm::deep_copy_unique_ptr
Unique pointer with polymorphic deep copy semantics.
Definition: DomainShape_fwd.hpp:22
mm::DomainShape::scalar_t
vec_t::Scalar scalar_t
Scalar data type used in computation.
Definition: DomainShape_fwd.hpp:55
mm::RotatedShape::bbox
std::pair< vec_t, vec_t > bbox() const override
Return the bounding box of the domain.
Definition: RotatedShape.hpp:29
DomainShape_fwd.hpp
mm::RotatedShape::shape
const DomainShape< vec_t > & shape() const
Returns the underlying shape.
Definition: RotatedShape_fwd.hpp:49