Medusa  1.1
Coordinate Free Mehless Method implementation
ShapeDifference_fwd.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_DOMAINS_SHAPEDIFFERENCE_FWD_HPP_
2 #define MEDUSA_BITS_DOMAINS_SHAPEDIFFERENCE_FWD_HPP_
3 
4 #include <medusa/Config.hpp>
5 #include "DomainShape_fwd.hpp"
6 
14 namespace mm {
25 template <typename vec_t>
26 class ShapeDifference : public DomainShape<vec_t> {
28  sh1,
29  sh2;
30  public:
31  using typename DomainShape<vec_t>::scalar_t;
37 
39  ShapeDifference(const DomainShape<vec_t>& shape1, const DomainShape<vec_t>& shape2) :
40  sh1(shape1), sh2(shape2) {
41  sh2->setMargin(-sh2->margin());
42  }
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 
59  scalar_t step, int internal_type, int boundary_type) const override;
61  const std::function<scalar_t(vec_t)>& dr, int type) const override;
63  const std::function<scalar_t(vec_t)>& dr, int internal_type,
64  int boundary_type) const override;
65 
66  std::pair<vec_t, vec_t> bbox() const override { return sh1->bbox(); }
67  ShapeDifference<vec_t>* clone() const override { return new ShapeDifference<vec_t>(*this); }
68  std::ostream& print(std::ostream& os) const override;
69 };
70 
71 } // namespace mm
72 
73 #endif // MEDUSA_BITS_DOMAINS_SHAPEDIFFERENCE_FWD_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
mm::DomainShape
Base class for geometric shapes of domains.
Definition: DomainShape_fwd.hpp:52
mm::ShapeDifference::second
const DomainShape< vec_t > & second() const
Access the second shape.
Definition: ShapeDifference_fwd.hpp:47
mm::ShapeDifference::hasContains
bool hasContains() const override
Return true if shape has contains() method implemented.
Definition: ShapeDifference_fwd.hpp:53
Config.hpp
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::ShapeDifference
ShapeDifference(const DomainShape< vec_t > &shape1, const DomainShape< vec_t > &shape2)
Constructs a shape representing shape1 - shape2.
Definition: ShapeDifference_fwd.hpp:39
mm::ShapeDifference::clone
ShapeDifference< vec_t > * clone() const override
Polymorphic clone pattern.
Definition: ShapeDifference_fwd.hpp:67
mm::ShapeDifference::sh2
deep_copy_unique_ptr< DomainShape< vec_t > > sh2
Second shape.
Definition: ShapeDifference_fwd.hpp:29
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::bbox
std::pair< vec_t, vec_t > bbox() const override
Return the bounding box of the domain.
Definition: ShapeDifference_fwd.hpp:66
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
mm::ShapeDifference
A class representing a set-difference of two shapes.
Definition: ShapeDifference_fwd.hpp:26
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::contains
bool contains(const vec_t &point) const override
Return true if point is not more than margin() outside the domain.
Definition: ShapeDifference_fwd.hpp:49
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::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::ShapeDifference::first
const DomainShape< vec_t > & first() const
Access the first shape.
Definition: ShapeDifference_fwd.hpp:45
mm::ShapeDifference::sh1
deep_copy_unique_ptr< DomainShape< vec_t > > sh1
First shape.
Definition: ShapeDifference_fwd.hpp:28