Medusa  1.1
Coordinate Free Mehless Method implementation
BasicRelax_fwd.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_DOMAINS_BASICRELAX_FWD_HPP_
2 #define MEDUSA_BITS_DOMAINS_BASICRELAX_FWD_HPP_
3 
4 #include <medusa/Config.hpp>
6 
14 namespace mm {
15 
16 
43 class BasicRelax {
44  public:
64  };
65 
66  private:
67  int num_neighbours = 1;
68  int num_iterations = 50;
69  double initial_heat = 1;
70  double final_heat = 0;
71  int potential_order = 2;
76 
77  public:
78  BasicRelax() = default;
79 
82 
89  BasicRelax& initialHeat(double in);
90 
92  BasicRelax& finalHeat(double in);
93 
95  BasicRelax& numNeighbours(int neighbours);
96 
98  BasicRelax& potentialOrder(int order);
99 
102 
109 
112 
120 
126  template<class domain_t>
127  void operator()(domain_t& domain) const {
128  typedef typename domain_t::vector_t vec_t;
129  operator()(domain, [](const vec_t& /* p */) { return -1.0; });
130  }
131 
137  template<class domain_t>
138  void operator()(domain_t& domain, double r) const {
139  typedef typename domain_t::vector_t vec_t;
140  operator()(domain, [r](const vec_t& /* p */) { return r; });
141  }
142 
144  template<class domain_t, class radius_func_type>
145  void operator()(domain_t& domain, const radius_func_type& r_func) const;
146 }; // class BasicRelax
147 
148 } // namespace mm
149 
150 #endif // MEDUSA_BITS_DOMAINS_BASICRELAX_FWD_HPP_
mm::BasicRelax::nodes_
Range< int > nodes_
List of nodes to process.
Definition: BasicRelax_fwd.hpp:73
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
mm::BasicRelax::projection_type
ProjectionType projection_type
On boundary projection method.
Definition: BasicRelax_fwd.hpp:74
mm::BasicRelax::initialHeat
BasicRelax & initialHeat(double in)
Sets initial heat.
Definition: BasicRelax.cpp:14
mm::BasicRelax::boundaryProjectionThreshold
BasicRelax & boundaryProjectionThreshold(double in)
Sets threshold for adding nodes on boundary, i.e. if node and are distances to closest boundary nod...
Definition: BasicRelax.cpp:26
mm::BasicRelax::finalHeat
BasicRelax & finalHeat(double in)
Sets final heat.
Definition: BasicRelax.cpp:18
mm::BasicRelax::DO_NOT_PROJECT
@ DO_NOT_PROJECT
Escaped nodes are frozen outside the domain till the end of relax and then removed.
Definition: BasicRelax_fwd.hpp:51
mm::BasicRelax::rebuildTreeAfter
BasicRelax & rebuildTreeAfter(int iterations)
Sets rebuild tree frequency.
Definition: BasicRelax.cpp:45
mm::BasicRelax::PROJECT_IN_DIRECTION
@ PROJECT_IN_DIRECTION
Project on boundary in relax movement direction.
Definition: BasicRelax_fwd.hpp:56
mm::BasicRelax::operator()
void operator()(domain_t &domain) const
Runs the relax on the selected domain with constant distribution equals to domain characteristic dist...
Definition: BasicRelax_fwd.hpp:127
mm::BasicRelax::potentialOrder
BasicRelax & potentialOrder(int order)
Sets order of repulsing potential.
Definition: BasicRelax.cpp:41
Config.hpp
mm::BasicRelax::onlyNodes
BasicRelax & onlyNodes(Range< int > nodes)
Move only given nodes.
Definition: BasicRelax.cpp:10
mm::BasicRelax::boundary_projection_threshold
double boundary_projection_threshold
Threshold for projecting nodes on boundary.
Definition: BasicRelax_fwd.hpp:75
Range_fwd.hpp
mm::BasicRelax::ProjectionType
ProjectionType
Indicating type of projection used when a relax node goes out of the domain.
Definition: BasicRelax_fwd.hpp:46
mm::BasicRelax::operator()
void operator()(domain_t &domain, double r) const
Runs the relax on the selected domain with constant density.
Definition: BasicRelax_fwd.hpp:138
mm::BasicRelax::num_neighbours
int num_neighbours
Number of nodes to consider when calculating the potential.
Definition: BasicRelax_fwd.hpp:67
mm::BasicRelax::iterations
BasicRelax & iterations(int iterations)
Sets number of iterations.
Definition: BasicRelax.cpp:37
mm::BasicRelax::final_heat
double final_heat
Heat at the end of the relax, usually around 0.
Definition: BasicRelax_fwd.hpp:70
mm::BasicRelax::initial_heat
double initial_heat
Initial heat, usually between 0 and 5.
Definition: BasicRelax_fwd.hpp:69
mm::BasicRelax::num_iterations
int num_iterations
Number of iterations performed.
Definition: BasicRelax_fwd.hpp:68
mm::BasicRelax::projectionType
BasicRelax & projectionType(ProjectionType in)
Determines how to handle nodes that escape during relaxation.
Definition: BasicRelax.cpp:22
mm::BasicRelax::rebuild_tree_after
int rebuild_tree_after
How often engine rebuild search tree, 1 is perfect but slow.
Definition: BasicRelax_fwd.hpp:72
mm::BasicRelax::potential_order
int potential_order
Order of repulsing potential.
Definition: BasicRelax_fwd.hpp:71
mm::BasicRelax::PROJECT_BETWEEN_CLOSEST
@ PROJECT_BETWEEN_CLOSEST
Project between two closest boundary nodes – this one might result in divergent behaviour,...
Definition: BasicRelax_fwd.hpp:63
mm::BasicRelax::numNeighbours
BasicRelax & numNeighbours(int neighbours)
Sets num neighbours.
Definition: BasicRelax.cpp:33
mm::Range< int >
mm::BasicRelax
Redistributes nodes towards more uniform distribution by minimizing potential between nodes.
Definition: BasicRelax_fwd.hpp:43