Medusa  1.1
Coordinate Free Mehless Method implementation
ShapeUnion_fwd.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_DOMAINS_SHAPEUNION_FWD_HPP_
2 #define MEDUSA_BITS_DOMAINS_SHAPEUNION_FWD_HPP_
3 
4 #include <medusa/Config.hpp>
5 #include "DomainShape_fwd.hpp"
7 
15 namespace mm {
16 
27 template <typename vec_t>
28 class ShapeUnion : public DomainShape<vec_t> {
30  sh1,
31  sh2;
32 
33  public:
34  using typename DomainShape<vec_t>::scalar_t;
40 
43 
45  const DomainShape<vec_t>& first() const { return *sh1; }
47  const DomainShape<vec_t>& second() const { return *sh2; }
48 
49  bool contains(const vec_t& point) const override {
50  return sh1->contains(point) || sh2->contains(point);
51  }
52 
53  bool hasContains() const override {
54  return sh1->hasContains() && sh2->hasContains();
55  }
56 
57  std::pair<vec_t, vec_t> bbox() const override;
58 
61  scalar_t step, int internal_type, int boundary_type) const override;
63  const std::function<scalar_t(vec_t)>& dr, int type) const override;
65  const std::function<scalar_t(vec_t)>& dr, int internal_type,
66  int boundary_type) const override;
67 
68  ShapeUnion<vec_t>* clone() const override { return new ShapeUnion<vec_t>(*this); }
69  std::ostream& print(std::ostream& os) const override;
70 };
71 
72 } // namespace mm
73 
74 #endif // MEDUSA_BITS_DOMAINS_SHAPEUNION_FWD_HPP_
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
mm::ShapeUnion::sh1
deep_copy_unique_ptr< DomainShape< vec_t > > sh1
First shape in the union.
Definition: ShapeUnion_fwd.hpp:30
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::ShapeUnion
Class representing a union of two shapes.
Definition: ShapeUnion_fwd.hpp:28
mm::ShapeUnion::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: ShapeUnion.hpp:41
mm::ShapeUnion::sh2
deep_copy_unique_ptr< DomainShape< vec_t > > sh2
Second shape in the union.
Definition: ShapeUnion_fwd.hpp:31
mm::ShapeUnion::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: ShapeUnion.hpp:25
mm::ShapeUnion::ShapeUnion
ShapeUnion(const DomainShape< vec_t > &sh1, const DomainShape< vec_t > &sh2)
Construct a union of two shapes.
Definition: ShapeUnion_fwd.hpp:42
mm::ShapeUnion::first
const DomainShape< vec_t > & first() const
Access the first shape.
Definition: ShapeUnion_fwd.hpp:45
mm::ShapeUnion::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: ShapeUnion.hpp:17
mm::DomainShape
Base class for geometric shapes of domains.
Definition: DomainShape_fwd.hpp:52
Config.hpp
mm::ShapeUnion::hasContains
bool hasContains() const override
Return true if shape has contains() method implemented.
Definition: ShapeUnion_fwd.hpp:53
mm::ShapeUnion::second
const DomainShape< vec_t > & second() const
Access the second shape.
Definition: ShapeUnion_fwd.hpp:47
Vec_fwd.hpp
mm::ShapeUnion::bbox
std::pair< vec_t, vec_t > bbox() const override
Return the bounding box of the domain.
Definition: ShapeUnion.hpp:50
mm::ShapeUnion::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: ShapeUnion.hpp:33
mm::ShapeUnion::clone
ShapeUnion< vec_t > * clone() const override
Polymorphic clone pattern.
Definition: ShapeUnion_fwd.hpp:68
mm::ShapeUnion::contains
bool contains(const vec_t &point) const override
Return true if point is not more than margin() outside the domain.
Definition: ShapeUnion_fwd.hpp:49
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::ShapeUnion::print
std::ostream & print(std::ostream &os) const override
Output information about this shape to given output stream os.
Definition: ShapeUnion.hpp:62