Medusa  1.1
Coordinate Free Mehless Method implementation
GrainDropFill_fwd.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_DOMAINS_GRAINDROPFILL_FWD_HPP_
2 #define MEDUSA_BITS_DOMAINS_GRAINDROPFILL_FWD_HPP_
3 
11 #include <medusa/Config.hpp>
13 
19 namespace mm {
20 
21 template <typename vec_t>
22 class DomainDiscretization;
23 
36 template <typename vec_t>
38  public:
39  typedef typename vec_t::scalar_t scalar_t;
40  typedef vec_t vector_t;
41  enum { dim = vec_t::dim };
43 
44  private:
45  int max_points = 5000000;
46  vec_t bot;
47  vec_t top;
48  scalar_t dx = -1.0;
49  int seed_;
51 
52  public:
54  GrainDropFill(const vec_t& bot, const vec_t& top);
55 
57  GrainDropFill& maxPoints(int max_points) { this->max_points = max_points; return *this; }
59  GrainDropFill& seed(int seed) { seed_ = seed; return *this; }
65  GrainDropFill& initialSpacing(scalar_t dx) { this->dx = dx; return *this; }
67  GrainDropFill& excessFactor(scalar_t factor) { excess_factor = factor; return *this; }
68 
78  template <typename func_t>
79  void operator()(DomainDiscretization<vec_t>& domain, const func_t& h, int type = 0) const;
80 
82  void operator()(DomainDiscretization<vec_t>& domain, const scalar_t& h, int type = 0) const {
83  this->operator()(domain, [=] (const vector_t&) { return h; }, type);
84  }
85 
87  template <typename func_t>
88  std::vector<vec_t> fillBox(const func_t& h) const;
89 };
90 
91 } // namespace mm
92 
93 #endif // MEDUSA_BITS_DOMAINS_GRAINDROPFILL_FWD_HPP_
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
mm::GrainDropFill
Implements general n-d node placing algorithm, as described in https://arxiv.org/abs/1906....
Definition: GrainDropFill_fwd.hpp:37
scalar_t
Scalar scalar_t
Type of the elements, alias of Scalar.
Definition: MatrixBaseAddons.hpp:16
mm::GrainDropFill::max_points
int max_points
Maximal number of points generated.
Definition: GrainDropFill_fwd.hpp:45
mm::DomainDiscretization
Class representing domain discretization along with an associated shape.
Definition: DomainDiscretization_fwd.hpp:46
mm::GrainDropFill::vector_t
vec_t vector_t
Vector type.
Definition: GrainDropFill_fwd.hpp:40
mm::GrainDropFill::bot
vec_t bot
Bottom left corner of the box to fill.
Definition: GrainDropFill_fwd.hpp:46
mm::GrainDropFill::initialSpacing
GrainDropFill & initialSpacing(scalar_t dx)
Set initial discretization density by specifying number of dots along each dimension.
Definition: GrainDropFill_fwd.hpp:65
dim
@ dim
Number of elements of this matrix.
Definition: MatrixBaseAddons.hpp:14
mm::GrainDropFill::excessFactor
GrainDropFill & excessFactor(scalar_t factor)
Set percentage of allowed generation over the top.
Definition: GrainDropFill_fwd.hpp:67
mm::GrainDropFill::seed
GrainDropFill & seed(int seed)
Set custom seed for the random number generator.
Definition: GrainDropFill_fwd.hpp:59
mm::GrainDropFill::fillBox
std::vector< vec_t > fillBox(const func_t &h) const
Actual fill algorithm which fills [bot, top] box with spacing h.
Definition: GrainDropFill.hpp:45
mm::GrainDropFill::excess_factor
scalar_t excess_factor
Fill excess_factor*dx over the top of the domain.
Definition: GrainDropFill_fwd.hpp:50
mm::GrainDropFill::seed_
int seed_
Seed for the random number generator.
Definition: GrainDropFill_fwd.hpp:49
mm::GrainDropFill::dim
@ dim
Dimensionality of the domain.
Definition: GrainDropFill_fwd.hpp:42
mm::GrainDropFill::operator()
void operator()(DomainDiscretization< vec_t > &domain, const scalar_t &h, int type=0) const
Overload for constant function.
Definition: GrainDropFill_fwd.hpp:82
Config.hpp
mm::GrainDropFill::scalar_t
vec_t::scalar_t scalar_t
Scalar type;.
Definition: GrainDropFill_fwd.hpp:39
mm::GrainDropFill::operator()
void operator()(DomainDiscretization< vec_t > &domain, const func_t &h, int type=0) const
Fills domain with a quality node distribution.
Definition: GrainDropFill.hpp:28
Vec_fwd.hpp
mm::GrainDropFill::maxPoints
GrainDropFill & maxPoints(int max_points)
Maximal number of points generated.
Definition: GrainDropFill_fwd.hpp:57
mm::GrainDropFill::top
vec_t top
Top right corner of the box to fill.
Definition: GrainDropFill_fwd.hpp:47
mm::GrainDropFill::GrainDropFill
GrainDropFill(const vec_t &bot, const vec_t &top)
Prepare to fill domain within [bot, top] bounding box.
Definition: GrainDropFill.hpp:18
mm::GrainDropFill::dx
scalar_t dx
Initial discretization spacing.
Definition: GrainDropFill_fwd.hpp:48