Medusa  1.1
Coordinate Free Mehless Method implementation
mm::HalfLinksRefine Class Reference

#include <HalfLinksRefine_fwd.hpp>

Detailed Description

Refine a region of nodes region by connecting every node in region to its support domain and generating new nodes at half distances.

The new nodes are filtered to meet a minimum distance criterion to prevent points that would be too close.

Usage example:

BoxShape<Vec2d> box(0, 1);
auto domain = box.discretizeWithStep(0.2);
domain.findSupport(FindClosest(9));
int N = domain.size();
auto region = domain.positions().filter(
[](const Vec2d &v) { return v[0] < 0.35 && v[1] < 0.35; });
HalfLinksRefine refine; refine.region(region);
auto new_points = refine(domain);

Definition at line 29 of file HalfLinksRefine_fwd.hpp.

+ Collaboration diagram for mm::HalfLinksRefine:

Public Member Functions

HalfLinksRefineregion (Range< int > region)
 Set region to refine. More...
 
HalfLinksRefinemin_dist (double fraction)
 Minimal distance criterion around point p is that nodes generated at p must be at least fraction * closest_support_node away from all nodes. More...
 
template<typename vec_t >
Range< int > operator() (DomainDiscretization< vec_t > &domain) const
 Refines given domain. More...
 
template<typename vec_t >
Range< int > operator() (DomainDiscretization< vec_t > &domain, KDTreeMutable< vec_t > &tree) const
 Refine the domain with already given tree. More...
 

Static Private Member Functions

template<class vec_t >
static Range< int > refine_impl (DomainDiscretization< vec_t > &domain, const Range< int > &region, double fraction, KDTreeMutable< vec_t > &domain_tree)
 Refine implementation with more control over fine grained details. More...
 

Private Attributes

Range< int > region_ = {}
 Node indexes around which to refine. More...
 
double fraction_ = 0.4
 Minimal distance fraction. More...
 

Member Function Documentation

◆ min_dist()

HalfLinksRefine& mm::HalfLinksRefine::min_dist ( double  fraction)
inline

Minimal distance criterion around point p is that nodes generated at p must be at least fraction * closest_support_node away from all nodes.

Fraction must be less than 1/2. Default value is HalfLinksRefine::fraction_;

Definition at line 44 of file HalfLinksRefine_fwd.hpp.

◆ operator()() [1/2]

template<typename vec_t >
Range< int > mm::HalfLinksRefine::operator() ( DomainDiscretization< vec_t > &  domain) const

Refines given domain.

Returns
The indexes of the added nodes in positions.

Definition at line 19 of file HalfLinksRefine.hpp.

◆ operator()() [2/2]

template<typename vec_t >
Range< int > mm::HalfLinksRefine::operator() ( DomainDiscretization< vec_t > &  domain,
KDTreeMutable< vec_t > &  tree 
) const

Refine the domain with already given tree.

Parameters
domainDomain discretization object, which will be refined.
treeA mutable KDTree, which contains all domain nodes. New nodes will be inserted.
Returns
The indexes of the added nodes in positions.

Definition at line 25 of file HalfLinksRefine.hpp.

◆ refine_impl()

template<class vec_t >
Range< int > mm::HalfLinksRefine::refine_impl ( DomainDiscretization< vec_t > &  domain,
const Range< int > &  region,
double  fraction,
KDTreeMutable< vec_t > &  domain_tree 
)
staticprivate

Refine implementation with more control over fine grained details.

Parameters
domainDomain to refine.
regionA list of indices to refine.
fractionMinimal distance fraction.
domain_treeTree containing all domain points.
Returns
List of indices of added nodes.

Definition at line 38 of file HalfLinksRefine.hpp.

◆ region()

HalfLinksRefine& mm::HalfLinksRefine::region ( Range< int >  region)
inline

Set region to refine.

The region is a set of indices of the nodes to be refined. All nodes are refined by default.

Definition at line 38 of file HalfLinksRefine_fwd.hpp.

Member Data Documentation

◆ fraction_

double mm::HalfLinksRefine::fraction_ = 0.4
private

Minimal distance fraction.

Definition at line 31 of file HalfLinksRefine_fwd.hpp.

◆ region_

Range<int> mm::HalfLinksRefine::region_ = {}
private

Node indexes around which to refine.

Definition at line 30 of file HalfLinksRefine_fwd.hpp.


The documentation for this class was generated from the following files:
mm::HalfLinksRefine::region
HalfLinksRefine & region(Range< int > region)
Set region to refine.
Definition: HalfLinksRefine_fwd.hpp:38
mm::Vec2d
Vec< double, 2 > Vec2d
Convenience typedef for 2d vector of doubles.
Definition: Vec_fwd.hpp:34