Medusa  1.1
Coordinate Free Mehless Method implementation
ShapeDifference.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_DOMAINS_SHAPEDIFFERENCE_HPP_
2 #define MEDUSA_BITS_DOMAINS_SHAPEDIFFERENCE_HPP_
3 
6 #include <ostream>
8 
14 namespace mm {
15 
16 template <typename vec_t>
18  int type) const {
19  auto d1 = sh1->discretizeBoundaryWithStep(step, type);
20  sh2->toggleMargin();
21  auto d2 = sh2->discretizeBoundaryWithStep(step, type);
22  sh2->toggleMargin();
23  return d1.subtract(d2);
24 }
25 
26 template <typename vec_t>
28  scalar_t step, int internal_type, int boundary_type) const {
29  auto d1 = sh1->discretizeWithStep(step, internal_type, boundary_type);
30  sh2->toggleMargin();
31  auto d2 = sh2->discretizeBoundaryWithStep(step, boundary_type);
32  sh2->toggleMargin();
33  return d1.subtract(d2);
34 }
35 
36 template <typename vec_t>
38  const std::function<scalar_t(vec_t)>& dr, int type) const {
39  auto d1 = sh1->discretizeBoundaryWithDensity(dr, type);
40  sh2->toggleMargin();
41  auto d2 = sh2->discretizeBoundaryWithDensity(dr, type);
42  sh2->toggleMargin();
43  return d1.subtract(d2);
44 }
45 
46 template <typename vec_t>
48  const std::function<scalar_t(vec_t)>& dr, int internal_type, int boundary_type) const {
49  auto d1 = sh1->discretizeWithDensity(dr, internal_type, boundary_type);
50  sh2->toggleMargin();
51  auto d2 = sh2->discretizeBoundaryWithDensity(dr, boundary_type);
52  sh2->toggleMargin();
53  return d1.subtract(d2);
54 }
55 
56 template <typename vec_t>
57 std::ostream& ShapeDifference<vec_t>::print(std::ostream& os) const {
58  return os << "ShapeDifference(" << *sh1 << ", " << *sh2 << ")";
59 }
60 
61 } // namespace mm
62 
63 #endif // MEDUSA_BITS_DOMAINS_SHAPEDIFFERENCE_HPP_
mm::sh::d1
static const shape_flags d1
Indicates to calculate d1 shapes.
Definition: shape_flags.hpp:23
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
ShapeDifference_fwd.hpp
mm::sh::d2
static const shape_flags d2
Indicates to calculate d2 shapes.
Definition: shape_flags.hpp:25
mm::ShapeDifference::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: ShapeDifference.hpp:27
mm::ShapeDifference::print
std::ostream & print(std::ostream &os) const override
Output information about this shape to given output stream os.
Definition: ShapeDifference.hpp:57
mm::ShapeDifference::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: ShapeDifference.hpp:37
Vec.hpp
mm::ShapeDifference::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: ShapeDifference.hpp:47
mm::ShapeDifference::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: ShapeDifference.hpp:17
mm::DomainShape::scalar_t
vec_t::Scalar scalar_t
Scalar data type used in computation.
Definition: DomainShape_fwd.hpp:55