libMesh
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
libMesh::InverseDistanceInterpolation< KDDim > Class Template Reference

Inverse distance interpolation. More...

#include <meshfree_interpolation.h>

Inheritance diagram for libMesh::InverseDistanceInterpolation< KDDim >:
[legend]

Classes

class  PointListAdaptor
 This class adapts list of libMesh Point types for use in a nanoflann KD-Tree. More...
 

Public Types

enum  ParallelizationStrategy { SYNC_SOURCES = 0, INVALID_STRATEGY }
 "ParallelizationStrategy" to employ. More...
 

Public Member Functions

 InverseDistanceInterpolation (const libMesh::Parallel::Communicator &comm_in, const unsigned int n_interp_pts=8, const Real power=2)
 Constructor. More...
 
virtual void clear () override
 Clears all internal data structures and restores to a pristine state. More...
 
virtual void interpolate_field_data (const std::vector< std::string > &field_names, const std::vector< Point > &tgt_pts, std::vector< Number > &tgt_vals) const override
 Interpolate source data at target points. More...
 
void print_info (std::ostream &os=libMesh::out) const
 Prints information about this object, by default to libMesh::out. More...
 
unsigned int n_field_variables () const
 The number of field variables. More...
 
void set_field_variables (const std::vector< std::string > &names)
 Defines the field variable(s) we are responsible for, and importantly their assumed ordering. More...
 
const std::vector< std::string > & field_variables () const
 
std::vector< Point > & get_source_points ()
 
std::vector< Number > & get_source_vals ()
 
virtual void add_field_data (const std::vector< std::string > &field_names, const std::vector< Point > &pts, const std::vector< Number > &vals)
 Sets source data at specified points. More...
 
virtual void prepare_for_use ()
 Prepares data structures for use. More...
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Protected Types

typedef nanoflann::KDTreeSingleIndexAdaptor< nanoflann::L2_Simple_Adaptor< Real, PointListAdaptor< KDDim > >, PointListAdaptor< KDDim >, KDDim > kd_tree_t
 

Protected Member Functions

virtual void construct_kd_tree ()
 Build & initialize the KD tree, if needed. More...
 
virtual void interpolate (const Point &pt, const std::vector< size_t > &src_indices, const std::vector< Real > &src_dist_sqr, std::vector< Number >::iterator &out_it) const
 Performs inverse distance interpolation at the input point from the specified points. More...
 
virtual void gather_remote_data ()
 Gathers source points and values that have been added on other processors. More...
 

Protected Attributes

PointListAdaptor< KDDim > _point_list_adaptor
 
std::unique_ptr< kd_tree_t_kd_tree
 
const Real _half_power
 
const unsigned int _n_interp_pts
 
std::vector< Number_vals
 Temporary work array. More...
 
ParallelizationStrategy _parallelization_strategy
 
std::vector< std::string > _names
 
std::vector< Point_src_pts
 
std::vector< Number_src_vals
 
const Parallel::Communicator_communicator
 

Detailed Description

template<unsigned int KDDim>
class libMesh::InverseDistanceInterpolation< KDDim >

Inverse distance interpolation.

Definition at line 180 of file meshfree_interpolation.h.

Member Typedef Documentation

◆ kd_tree_t

template<unsigned int KDDim>
typedef nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Simple_Adaptor<Real, PointListAdaptor<KDDim> >, PointListAdaptor<KDDim>, KDDim> libMesh::InverseDistanceInterpolation< KDDim >::kd_tree_t
protected

Definition at line 298 of file meshfree_interpolation.h.

Member Enumeration Documentation

◆ ParallelizationStrategy

"ParallelizationStrategy" to employ.

SYNC_SOURCES assumes that the data added on each processor are independent and relatively small. Calling the prepare_for_use() method with this ParallelizationStrategy will copy remote data from other processors, so all interpolation can be performed locally.

Other ParallelizationStrategy techniques will be implemented as needed.

Enumerator
SYNC_SOURCES 
INVALID_STRATEGY 

Definition at line 73 of file meshfree_interpolation.h.

Constructor & Destructor Documentation

◆ InverseDistanceInterpolation()

template<unsigned int KDDim>
libMesh::InverseDistanceInterpolation< KDDim >::InverseDistanceInterpolation ( const libMesh::Parallel::Communicator comm_in,
const unsigned int  n_interp_pts = 8,
const Real  power = 2 
)

Constructor.

Takes the inverse distance power, which defaults to 2.

Definition at line 332 of file meshfree_interpolation.h.

334  :
335  MeshfreeInterpolation(comm_in),
336 #if LIBMESH_HAVE_NANOFLANN
338 #endif
339  _half_power(power/2.0),
340  _n_interp_pts(n_interp_pts)
341  {}
MeshfreeInterpolation(const libMesh::Parallel::Communicator &comm_in)
Constructor.

Member Function Documentation

◆ add_field_data()

virtual void libMesh::MeshfreeInterpolation::add_field_data ( const std::vector< std::string > &  field_names,
const std::vector< Point > &  pts,
const std::vector< Number > &  vals 
)
virtualinherited

Sets source data at specified points.

◆ clear()

template<unsigned int KDDim>
virtual void libMesh::InverseDistanceInterpolation< KDDim >::clear ( )
overridevirtual

Clears all internal data structures and restores to a pristine state.

Reimplemented from libMesh::MeshfreeInterpolation.

Reimplemented in libMesh::RadialBasisInterpolation< KDDim, RBF >.

◆ comm()

const Parallel::Communicator& libMesh::ParallelObject::comm ( ) const
inherited

◆ construct_kd_tree()

template<unsigned int KDDim>
virtual void libMesh::InverseDistanceInterpolation< KDDim >::construct_kd_tree ( )
protectedvirtual

Build & initialize the KD tree, if needed.

◆ field_variables()

const std::vector<std::string>& libMesh::MeshfreeInterpolation::field_variables ( ) const
inherited
Returns
The field variables as a read-only reference.

Definition at line 117 of file meshfree_interpolation.h.

References libMesh::MeshfreeInterpolation::_names.

Referenced by libMesh::MeshlessInterpolationFunction::operator()().

118  { return _names; }
std::vector< std::string > _names

◆ gather_remote_data()

virtual void libMesh::MeshfreeInterpolation::gather_remote_data ( )
protectedvirtualinherited

Gathers source points and values that have been added on other processors.

Note
The user is responsible for adding points only once per processor if this method is called. No attempt is made to identify duplicate points.

This method is virtual so that it can be overwritten or extended as required in derived classes.

◆ get_source_points()

std::vector<Point>& libMesh::MeshfreeInterpolation::get_source_points ( )
inherited
Returns
A writable reference to the point list.

Definition at line 123 of file meshfree_interpolation.h.

References libMesh::MeshfreeInterpolation::_src_pts.

124  { return _src_pts; }

◆ get_source_vals()

std::vector<Number>& libMesh::MeshfreeInterpolation::get_source_vals ( )
inherited
Returns
A writable reference to the point list.

Definition at line 129 of file meshfree_interpolation.h.

References libMesh::MeshfreeInterpolation::_src_vals.

130  { return _src_vals; }

◆ interpolate()

template<unsigned int KDDim>
virtual void libMesh::InverseDistanceInterpolation< KDDim >::interpolate ( const Point pt,
const std::vector< size_t > &  src_indices,
const std::vector< Real > &  src_dist_sqr,
std::vector< Number >::iterator &  out_it 
) const
protectedvirtual

Performs inverse distance interpolation at the input point from the specified points.

◆ interpolate_field_data()

template<unsigned int KDDim>
virtual void libMesh::InverseDistanceInterpolation< KDDim >::interpolate_field_data ( const std::vector< std::string > &  field_names,
const std::vector< Point > &  tgt_pts,
std::vector< Number > &  tgt_vals 
) const
overridevirtual

Interpolate source data at target points.

Pure virtual, must be overridden in derived classes.

Implements libMesh::MeshfreeInterpolation.

Reimplemented in libMesh::RadialBasisInterpolation< KDDim, RBF >.

◆ n_field_variables()

unsigned int libMesh::MeshfreeInterpolation::n_field_variables ( ) const
inherited

The number of field variables.

Definition at line 104 of file meshfree_interpolation.h.

References libMesh::MeshfreeInterpolation::_names.

105  { return cast_int<unsigned int>(_names.size()); }
std::vector< std::string > _names

◆ n_processors()

processor_id_type libMesh::ParallelObject::n_processors ( ) const
inherited
Returns
The number of processors in the group.

Definition at line 93 of file parallel_object.h.

References libMesh::ParallelObject::_communicator, and libMesh::Parallel::Communicator::size().

Referenced by libMesh::MeshBase::partition().

94  { return cast_int<processor_id_type>(_communicator.size()); }
processor_id_type size() const
Definition: communicator.h:175
const Parallel::Communicator & _communicator

◆ prepare_for_use()

virtual void libMesh::MeshfreeInterpolation::prepare_for_use ( )
virtualinherited

Prepares data structures for use.

This method is virtual so that it can be overwritten or extended as required in derived classes.

Reimplemented in libMesh::RadialBasisInterpolation< KDDim, RBF >.

◆ print_info()

void libMesh::MeshfreeInterpolation::print_info ( std::ostream &  os = libMesh::out) const
inherited

Prints information about this object, by default to libMesh::out.

◆ processor_id()

processor_id_type libMesh::ParallelObject::processor_id ( ) const
inherited

◆ set_field_variables()

void libMesh::MeshfreeInterpolation::set_field_variables ( const std::vector< std::string > &  names)
inherited

Defines the field variable(s) we are responsible for, and importantly their assumed ordering.

Definition at line 111 of file meshfree_interpolation.h.

References libMesh::MeshfreeInterpolation::_names.

112  { _names = names; }
std::vector< std::string > _names

Member Data Documentation

◆ _communicator

const Parallel::Communicator& libMesh::ParallelObject::_communicator
protectedinherited

◆ _half_power

template<unsigned int KDDim>
const Real libMesh::InverseDistanceInterpolation< KDDim >::_half_power
protected

Definition at line 318 of file meshfree_interpolation.h.

◆ _kd_tree

template<unsigned int KDDim>
std::unique_ptr<kd_tree_t> libMesh::InverseDistanceInterpolation< KDDim >::_kd_tree
mutableprotected

Definition at line 300 of file meshfree_interpolation.h.

◆ _n_interp_pts

template<unsigned int KDDim>
const unsigned int libMesh::InverseDistanceInterpolation< KDDim >::_n_interp_pts
protected

Definition at line 319 of file meshfree_interpolation.h.

◆ _names

std::vector<std::string> libMesh::MeshfreeInterpolation::_names
protectedinherited

◆ _parallelization_strategy

ParallelizationStrategy libMesh::MeshfreeInterpolation::_parallelization_strategy
protectedinherited

Definition at line 168 of file meshfree_interpolation.h.

◆ _point_list_adaptor

template<unsigned int KDDim>
PointListAdaptor<KDDim> libMesh::InverseDistanceInterpolation< KDDim >::_point_list_adaptor
protected

Definition at line 288 of file meshfree_interpolation.h.

◆ _src_pts

std::vector<Point> libMesh::MeshfreeInterpolation::_src_pts
protectedinherited

◆ _src_vals

std::vector<Number> libMesh::MeshfreeInterpolation::_src_vals
protectedinherited

◆ _vals

template<unsigned int KDDim>
std::vector<Number> libMesh::InverseDistanceInterpolation< KDDim >::_vals
mutableprotected

Temporary work array.

Object level scope to avoid cache thrashing.

Definition at line 324 of file meshfree_interpolation.h.


The documentation for this class was generated from the following file: