Medusa  1.1
Coordinate Free Mehless Method implementation
TranslatedShape_fwd.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_DOMAINS_TRANSLATEDSHAPE_FWD_HPP_
2 #define MEDUSA_BITS_DOMAINS_TRANSLATEDSHAPE_FWD_HPP_
3 
4 #include <medusa/Config.hpp>
6 #include "DomainShape_fwd.hpp"
7 
15 namespace mm {
16 
26 template <typename vec_t>
27 class TranslatedShape : public DomainShape<vec_t> {
29  vec_t a;
30 
31  public:
36  TranslatedShape(const DomainShape<vec_t>& sh, const vec_t& a);
37 
38  using typename DomainShape<vec_t>::scalar_t;
44 
45  bool contains(const vec_t& point) const override {
46  return sh->contains(point-a);
47  }
48 
49  bool hasContains() const override { return sh->hasContains(); }
50 
51  std::pair<vec_t, vec_t> bbox() const override {
52  auto bb = sh->bbox();
53  return {bb.first+a, bb.second+a};
54  }
55 
56  TranslatedShape<vec_t>* clone() const override { return new TranslatedShape(*this); }
57 
58  std::ostream& print(std::ostream& os) const override {
59  return os << "Shape " << *sh << " translated by " << a;
60  }
61 
63 
65  int boundary_type) const override;
66 
68  const std::function<scalar_t(vec_t)>& dr, int internal_type,
69  int boundary_type) const override;
70 
72  const std::function<scalar_t(vec_t)>& dr, int type) const override;
73 
75  const DomainShape<vec_t>& shape() const { return *sh; }
76 
78  vec_t translation() const { return a; }
79 };
80 
81 } // namespace mm
82 
83 #endif // MEDUSA_BITS_DOMAINS_TRANSLATEDSHAPE_FWD_HPP_
mm::TranslatedShape::bbox
std::pair< vec_t, vec_t > bbox() const override
Return the bounding box of the domain.
Definition: TranslatedShape_fwd.hpp:51
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
mm::TranslatedShape::contains
bool contains(const vec_t &point) const override
Return true if point is not more than margin() outside the domain.
Definition: TranslatedShape_fwd.hpp:45
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::TranslatedShape::discretizeWithDensity
DomainDiscretization< vec_t > discretizeWithDensity(const std::function< scalar_t(vec_t)> &dr, int internal_type, int boundary_type) const override
Returns a discretization of the domain with spatially variable step.
Definition: TranslatedShape.hpp:45
mm::TranslatedShape::sh
deep_copy_unique_ptr< DomainShape< vec_t > > sh
Shape to be translated.
Definition: TranslatedShape_fwd.hpp:28
mm::TranslatedShape
Class for working with translated domain shapes.
Definition: TranslatedShape_fwd.hpp:27
mm::TranslatedShape::a
vec_t a
Translation vector.
Definition: TranslatedShape_fwd.hpp:29
mm::TranslatedShape::shape
const DomainShape< vec_t > & shape() const
Returns the underlying shape.
Definition: TranslatedShape_fwd.hpp:75
mm::DomainShape
Base class for geometric shapes of domains.
Definition: DomainShape_fwd.hpp:52
mm::TranslatedShape::translation
vec_t translation() const
Returns the translation vector.
Definition: TranslatedShape_fwd.hpp:78
mm::TranslatedShape::discretizeBoundaryWithDensity
DomainDiscretization< vec_t > discretizeBoundaryWithDensity(const std::function< scalar_t(vec_t)> &dr, int type) const override
Discretizes boundary with given density and fill engine.
Definition: TranslatedShape.hpp:54
Config.hpp
Vec_fwd.hpp
mm::TranslatedShape::hasContains
bool hasContains() const override
Return true if shape has contains() method implemented.
Definition: TranslatedShape_fwd.hpp:49
mm::TranslatedShape::TranslatedShape
TranslatedShape(const DomainShape< vec_t > &sh, const vec_t &a)
Construct a translated shape by specifying a shape and a translation vector.
Definition: TranslatedShape.hpp:17
mm::TranslatedShape::print
std::ostream & print(std::ostream &os) const override
Output information about this shape to given output stream os.
Definition: TranslatedShape_fwd.hpp:58
mm::TranslatedShape::discretizeBoundaryWithStep
DomainDiscretization< vec_t > discretizeBoundaryWithStep(scalar_t step, int type) const override
Returns a discretization of the boundary of this shape with approximately uniform distance step betwe...
Definition: TranslatedShape.hpp:28
mm::TranslatedShape::discretizeWithStep
DomainDiscretization< vec_t > discretizeWithStep(scalar_t step, int internal_type, int boundary_type) const override
Returns a discretization of this shape with approximately uniform distance step between nodes.
Definition: TranslatedShape.hpp:36
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
DomainShape_fwd.hpp
mm::TranslatedShape::clone
TranslatedShape< vec_t > * clone() const override
Polymorphic clone pattern.
Definition: TranslatedShape_fwd.hpp:56