Medusa  1.1
Coordinate Free Mehless Method implementation
NURBSShape_fwd.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_DOMAINS_NURBSSHAPE_FWD_HPP_
2 #define MEDUSA_BITS_DOMAINS_NURBSSHAPE_FWD_HPP_
3 
11 #include <medusa/Config.hpp>
17 
18 namespace mm {
19 
23 namespace nurbs_shape_internal {
34 template <typename vec_t, typename param_vec_t>
35 struct NURBSShapeHelper {};
36 } // namespace nurbs_shape_internal
37 
51 template <typename vec_t, typename param_vec_t>
52 class NURBSShape : public DomainShape<vec_t> {
53  friend struct nurbs_shape_internal::NURBSShapeHelper<vec_t, param_vec_t>;
54 
55  public:
56  typedef typename vec_t::scalar_t scalar_t;
62 
63  private:
65  int max_points = 5000000;
66  int seed_;
67  int n_samples = 15;
68  scalar_t zeta = 1 - 1e-10;
70 
71  public:
74 
77 
78  bool contains(const vec_t& /* point */) const override { return true; }
79 
80  bool hasContains() const override { return false; }
81 
82  std::pair<vec_t, vec_t> bbox() const override {
83  assert_msg(false, "This function is not available for this shape. A"
84  "bounding box of its DomainDiscretization should be taken.");
85  return {};
86  }
87 
89  const std::function<scalar_t(vec_t)>&, int) const override;
90 
91  std::ostream& print(std::ostream& ostream) const override {
92  return ostream << "NURBS shape made of " << patches.size() << " patches.";
93  }
94 
95  NURBSShape* clone() const override {
96  return new NURBSShape<vec_t, param_vec_t>(*this);
97  }
98 
103  NURBSShape& maxPoints(int max_points) { this->max_points = max_points; return *this; }
104 
106  NURBSShape& seed(int seed) { seed_ = seed; return *this; }
107 
112 
119  NURBSShape& numSamples(int n_samples) { this->n_samples = n_samples; return *this; }
120 
127 };
128 
129 
130 } // namespace mm
131 
132 #endif // MEDUSA_BITS_DOMAINS_NURBSSHAPE_FWD_HPP_
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
mm::NURBSShape::numSamples
NURBSShape & numSamples(int n_samples)
Controls the number of generated candidates from each point in surface fill.
Definition: NURBSShape_fwd.hpp:119
mm::NURBSShape::patches
Range< NURBSPatch< vec_t, param_vec_t > > patches
Range of NURBS patches.
Definition: NURBSShape_fwd.hpp:64
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::Vec
Eigen::Matrix< scalar_t, dim, 1, Eigen::ColMajor|Eigen::AutoAlign, dim, 1 > Vec
Fixed size vector type, representing a mathematical 1d/2d/3d vector.
Definition: Vec_fwd.hpp:31
mm::NURBSShape::proximityTolerance
NURBSShape & proximityTolerance(scalar_t zeta)
Set proximity tolerance in surface fill.
Definition: NURBSShape.hpp:51
mm::nurbs_shape_internal::NURBSShapeHelper
Internal structure of NURBSShape that helps with partial class specialization.
Definition: NURBSShape_fwd.hpp:35
dim
@ dim
Number of elements of this matrix.
Definition: MatrixBaseAddons.hpp:14
mm::NURBSShape::param_dim
@ param_dim
Dimensionality of parametric space.
Definition: NURBSShape_fwd.hpp:60
randutils.hpp
mm::NURBSShape::print
std::ostream & print(std::ostream &ostream) const override
Output information about this shape to given output stream os.
Definition: NURBSShape_fwd.hpp:91
mm::NURBSShape::discretizeBoundaryWithDensity
DomainDiscretization< vec_t > discretizeBoundaryWithDensity(const std::function< scalar_t(vec_t)> &, int) const override
Discretizes boundary with given density and fill engine.
Definition: NURBSShape.hpp:44
assert_msg
#define assert_msg(cond,...)
Assert with better error reporting.
Definition: assert.hpp:75
mm::NURBSShape::bbox
std::pair< vec_t, vec_t > bbox() const override
Return the bounding box of the domain.
Definition: NURBSShape_fwd.hpp:82
mm::DomainShape
Base class for geometric shapes of domains.
Definition: DomainShape_fwd.hpp:52
mm::NURBSShape::clone
NURBSShape * clone() const override
Polymorphic clone pattern.
Definition: NURBSShape_fwd.hpp:95
mm::NURBSPatch
Class representing a single NURBS patch in an arbitrary dimensional space, defined on an arbitrary di...
Definition: NURBSPatch_fwd.hpp:72
Config.hpp
mm::NURBSShape::seed
NURBSShape & seed(int seed)
Set custom seed for the random number generator.
Definition: NURBSShape_fwd.hpp:106
mm::NURBSShape::scalar_t
vec_t::scalar_t scalar_t
Scalar type.
Definition: NURBSShape_fwd.hpp:56
NURBSPatch_fwd.hpp
mm::NURBSShape::hasContains
bool hasContains() const override
Return true if shape has contains() method implemented.
Definition: NURBSShape_fwd.hpp:80
mm::NURBSShape
Class representing a shape made out of NURBS patches in an arbitrary dimensional space.
Definition: NURBSShape_fwd.hpp:52
mm::NURBSShape::NURBSShape
NURBSShape(const Range< NURBSPatch< vec_t, param_vec_t >> &patches_in)
Construct NURBSShape from a Range of patches.
Definition: NURBSShape.hpp:22
mm::NURBSShape::maxPoints
NURBSShape & maxPoints(int max_points)
Maximal number of points generated in surface fill.
Definition: NURBSShape_fwd.hpp:103
mm::NURBSShape::seed_
int seed_
Seed for the random number generator.
Definition: NURBSShape_fwd.hpp:66
mm::NURBSShape::epsilon
scalar_t epsilon
Evaluate normals slightly away from the boundary.
Definition: NURBSShape_fwd.hpp:69
mm::NURBSShape::max_points
int max_points
Maximal number of points generated in surface fill.
Definition: NURBSShape_fwd.hpp:65
Vec.hpp
mm::NURBSShape::boundaryProximity
NURBSShape & boundaryProximity(scalar_t epsilon)
Calculate boundary normals epsilon times the size of domain away from the boundary.
Definition: NURBSShape.hpp:59
mm::NURBSShape::dim
@ dim
Dimensionality of space after projection.
Definition: NURBSShape_fwd.hpp:58
mm::NURBSShape::zeta
scalar_t zeta
Proximity tolerance in surface fill.
Definition: NURBSShape_fwd.hpp:68
mm::NURBSShape::proj_dim
@ proj_dim
Dimensionality of space before projection.
Definition: NURBSShape_fwd.hpp:59
mm::NURBSShape::proj_vec_t
Vec< scalar_t, proj_dim > proj_vec_t
Vector type before projection.
Definition: NURBSShape_fwd.hpp:61
mm::Range
An extension of std::vector<T> to support additional useful operations.
Definition: Range_fwd.hpp:30
mm::NURBSShape::n_samples
int n_samples
Number of samples in surface fill.
Definition: NURBSShape_fwd.hpp:67
Range.hpp
mm::DomainShape::scalar_t
vec_t::Scalar scalar_t
Scalar data type used in computation.
Definition: DomainShape_fwd.hpp:55
DomainShape_fwd.hpp
mm::NURBSShape::contains
bool contains(const vec_t &) const override
Return true if point is not more than margin() outside the domain.
Definition: NURBSShape_fwd.hpp:78