Medusa  1.1
Coordinate Free Mehless Method implementation
TranslatedShape.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_DOMAINS_TRANSLATEDSHAPE_HPP_
2 #define MEDUSA_BITS_DOMAINS_TRANSLATEDSHAPE_HPP_
3 
10 #include "DomainShape.hpp"
11 #include "DomainDiscretization.hpp"
13 
14 namespace mm {
15 
16 template <typename vec_t>
18  sh(sh), a(a) {
19  auto* tsh = dynamic_cast<const TranslatedShape<vec_t>*>(&sh);
20  if (tsh != nullptr) { // collapse double translations
21  this->sh = tsh->sh;
22  this->a += tsh->a;
23  }
24 }
25 
26 template <typename vec_t>
29  auto d = sh->discretizeBoundaryWithStep(step, type);
30  d.translate(a);
31  return d;
32 }
33 
34 template <typename vec_t>
37  int boundary_type) const {
38  auto d = sh->discretizeWithStep(step, internal_type, boundary_type);
39  d.translate(a);
40  return d;
41 }
42 
43 template <typename vec_t>
46  int internal_type, int boundary_type) const {
47  auto d = sh->discretizeWithDensity(dr, internal_type, boundary_type);
48  d.translate(a);
49  return d;
50 }
51 
52 template <typename vec_t>
55  int type) const {
56  auto d = sh->discretizeBoundaryWithDensity(dr, type);
57  d.translate(a);
58  return d;
59 }
60 
61 } // namespace mm
62 
63 #endif // MEDUSA_BITS_DOMAINS_TRANSLATEDSHAPE_HPP_
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
DomainDiscretization.hpp
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
TranslatedShape_fwd.hpp
mm::DomainShape
Base class for geometric shapes of domains.
Definition: DomainShape_fwd.hpp:52
DomainShape.hpp
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
assert.hpp
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::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::DomainShape::scalar_t
vec_t::Scalar scalar_t
Scalar data type used in computation.
Definition: DomainShape_fwd.hpp:55