libMesh
Public Member Functions | Protected Attributes | Private Attributes | List of all members
libMesh::MeshlessInterpolationFunction Class Reference

#include <meshless_interpolation_function.h>

Inheritance diagram for libMesh::MeshlessInterpolationFunction:
[legend]

Public Member Functions

 MeshlessInterpolationFunction (const MeshfreeInterpolation &mfi, Threads::spin_mutex &mutex)
 Constructor. More...
 
void init ()
 The actual initialization process. More...
 
void clear ()
 Clears the function. More...
 
virtual std::unique_ptr< FunctionBase< Number > > clone () const
 Returns a new deep copy of the function. More...
 
Number operator() (const Point &p, const Real time=0.)
 
void operator() (const Point &p, const Real time, DenseVector< Number > &output)
 Like before, but returns the values in a writable reference. More...
 
 MeshlessInterpolationFunction (const MeshfreeInterpolation &mfi, Threads::spin_mutex &mutex)
 
 MeshlessInterpolationFunction (MeshlessInterpolationFunction &&)=default
 The move/copy ctor and destructor are defaulted for this class. More...
 
 MeshlessInterpolationFunction (const MeshlessInterpolationFunction &)=default
 
virtual ~MeshlessInterpolationFunction ()=default
 
MeshlessInterpolationFunctionoperator= (const MeshlessInterpolationFunction &)=delete
 This class contains const references so it can't be assigned. More...
 
MeshlessInterpolationFunctionoperator= (MeshlessInterpolationFunction &&)=delete
 
void init ()
 The actual initialization process. More...
 
void clear ()
 Clears the function. More...
 
virtual std::unique_ptr< FunctionBase< Number > > clone () const
 
Number operator() (const Point &p, const Real)
 
void operator() (const Point &p, const Real time, DenseVector< Number > &output)
 Evaluation function for time-dependent vector-valued functions. More...
 
void operator() (const Point &p, DenseVector< Number > &output)
 Evaluation function for time-independent vector-valued functions. More...
 
virtual Number component (unsigned int i, const Point &p, Real time=0.)
 
bool initialized () const
 
void set_is_time_dependent (bool is_time_dependent)
 Function to set whether this is a time-dependent function or not. More...
 
bool is_time_dependent () const
 

Protected Attributes

const FunctionBase_master
 Const pointer to our master, initialized to nullptr. More...
 
bool _initialized
 When init() was called so that everything is ready for calls to operator() (...), then this bool is true. More...
 
bool _is_time_dependent
 Cache whether or not this function is actually time-dependent. More...
 

Private Attributes

const MeshfreeInterpolation_mfi
 
std::vector< Point_pts
 
std::vector< Number_vals
 
Threads::spin_mutex_mutex
 

Detailed Description

Definition at line 44 of file meshless_interpolation_function.h.

Constructor & Destructor Documentation

◆ MeshlessInterpolationFunction() [1/4]

libMesh::MeshlessInterpolationFunction::MeshlessInterpolationFunction ( const MeshfreeInterpolation mfi,
Threads::spin_mutex mutex 
)
inline

Constructor.

Requires a MeshlessInterpolation object.

Definition at line 57 of file meshless_interpolation_function.h.

58  :
59  _mfi (mfi),
60  _mutex(mutex)
61  {}

◆ MeshlessInterpolationFunction() [2/4]

libMesh::MeshlessInterpolationFunction::MeshlessInterpolationFunction ( const MeshfreeInterpolation mfi,
Threads::spin_mutex mutex 
)
inline

Definition at line 44 of file meshfree_solution_transfer.C.

45  :
46  _mfi(mfi),
47  _mutex(mutex)
48  {}

◆ MeshlessInterpolationFunction() [3/4]

libMesh::MeshlessInterpolationFunction::MeshlessInterpolationFunction ( MeshlessInterpolationFunction &&  )
default

The move/copy ctor and destructor are defaulted for this class.

◆ MeshlessInterpolationFunction() [4/4]

libMesh::MeshlessInterpolationFunction::MeshlessInterpolationFunction ( const MeshlessInterpolationFunction )
default

◆ ~MeshlessInterpolationFunction()

virtual libMesh::MeshlessInterpolationFunction::~MeshlessInterpolationFunction ( )
virtualdefault

Member Function Documentation

◆ clear() [1/2]

void libMesh::MeshlessInterpolationFunction::clear ( )
inlinevirtual

Clears the function.

Reimplemented from libMesh::FunctionBase< Number >.

Definition at line 64 of file meshfree_solution_transfer.C.

64 {}

◆ clear() [2/2]

void libMesh::MeshlessInterpolationFunction::clear ( )
inlinevirtual

Clears the function.

Reimplemented from libMesh::FunctionBase< Number >.

Definition at line 137 of file meshless_interpolation_function.h.

138 {
139 }

◆ clone() [1/2]

virtual std::unique_ptr<FunctionBase<Number> > libMesh::MeshlessInterpolationFunction::clone ( ) const
inlinevirtual
Returns
A new copy of the function.

The new copy should be as "deep" as necessary to allow independent destruction and simultaneous evaluations of the copies in different threads.

Implements libMesh::FunctionBase< Number >.

Definition at line 66 of file meshfree_solution_transfer.C.

67  {
68  return libmesh_make_unique<MeshlessInterpolationFunction>(_mfi, _mutex);
69  }

References _mfi, and _mutex.

◆ clone() [2/2]

std::unique_ptr< FunctionBase< Number > > libMesh::MeshlessInterpolationFunction::clone ( ) const
inlinevirtual

Returns a new deep copy of the function.

Implements libMesh::FunctionBase< Number >.

Definition at line 145 of file meshless_interpolation_function.h.

146 {
147  return libmesh_make_unique<MeshlessInterpolationFunction>(_mfi, _mutex);
148 }

References _mfi, and _mutex.

◆ component()

Number libMesh::FunctionBase< Number >::component ( unsigned int  i,
const Point p,
Real  time = 0. 
)
inlinevirtualinherited
Returns
The vector component i at coordinate p and time time.
Note
Subclasses aren't required to override this, since the default implementation is based on the full vector evaluation, which is often correct.
Subclasses are recommended to override this, since the default implementation is based on a vector evaluation, which is usually unnecessarily inefficient.

Reimplemented in TripleFunction, SolutionFunction, SolutionFunction, and SolutionFunction.

Definition at line 227 of file function_base.h.

230 {
231  DenseVector<Output> outvec(i+1);
232  (*this)(p, time, outvec);
233  return outvec(i);
234 }

◆ init() [1/2]

void libMesh::MeshlessInterpolationFunction::init ( )
inlinevirtual

The actual initialization process.

Reimplemented from libMesh::FunctionBase< Number >.

Definition at line 63 of file meshfree_solution_transfer.C.

63 {}

◆ init() [2/2]

void libMesh::MeshlessInterpolationFunction::init ( )
inlinevirtual

The actual initialization process.

Reimplemented from libMesh::FunctionBase< Number >.

Definition at line 130 of file meshless_interpolation_function.h.

131 {
132 }

◆ initialized()

bool libMesh::FunctionBase< Number >::initialized ( ) const
inlineinherited
Returns
true when this object is properly initialized and ready for use, false otherwise.

Definition at line 205 of file function_base.h.

206 {
207  return (this->_initialized);
208 }

◆ is_time_dependent()

bool libMesh::FunctionBase< Number >::is_time_dependent ( ) const
inlineinherited
Returns
true when the function this object represents is actually time-dependent, false otherwise.

Definition at line 219 of file function_base.h.

220 {
221  return (this->_is_time_dependent);
222 }

◆ operator()() [1/5]

void libMesh::MeshlessInterpolationFunction::operator() ( const Point p,
const Real  time,
DenseVector< Number > &  output 
)
inlinevirtual

Evaluation function for time-dependent vector-valued functions.

Sets output values in the passed-in output DenseVector.

Pure virtual, so you have to override it.

Implements libMesh::FunctionBase< Number >.

Definition at line 86 of file meshfree_solution_transfer.C.

89  {
90  output.resize(1);
91  output(0) = (*this)(p,time);
92  return;
93  }

References libMesh::DenseVector< T >::resize().

◆ operator()() [2/5]

void libMesh::MeshlessInterpolationFunction::operator() ( const Point p,
const Real  time,
DenseVector< Number > &  output 
)
inlinevirtual

Like before, but returns the values in a writable reference.

Implements libMesh::FunctionBase< Number >.

Definition at line 119 of file meshless_interpolation_function.h.

122 {
123  output.resize(1);
124  output(0) = (*this)(p, time);
125 }

References libMesh::DenseVector< T >::resize().

◆ operator()() [3/5]

Number libMesh::MeshlessInterpolationFunction::operator() ( const Point p,
const Real  time = 0. 
)
inlinevirtual
Returns
the value at point p and time time, which defaults to zero.

Implements libMesh::FunctionBase< Number >.

Definition at line 101 of file meshless_interpolation_function.h.

103 {
104  _pts.clear();
105  _pts.push_back(p);
106  _vals.resize(1);
107 
108  Threads::spin_mutex::scoped_lock lock(_mutex);
109 
111  _pts, _vals);
112 
113  return _vals.front();
114 }

References _mfi, _mutex, _pts, _vals, libMesh::MeshfreeInterpolation::field_variables(), and libMesh::MeshfreeInterpolation::interpolate_field_data().

◆ operator()() [4/5]

Number libMesh::MeshlessInterpolationFunction::operator() ( const Point p,
const  time 
)
inlinevirtual
Returns
The scalar function value at coordinate p and time time, which defaults to zero.

Pure virtual, so you have to override it.

Implements libMesh::FunctionBase< Number >.

Definition at line 71 of file meshfree_solution_transfer.C.

73  {
74  _pts.clear();
75  _pts.push_back(p);
76  _vals.resize(1);
77 
78  Threads::spin_mutex::scoped_lock lock(_mutex);
79 
81 
82  return _vals.front();
83  }

References _mfi, _mutex, _pts, _vals, libMesh::MeshfreeInterpolation::field_variables(), and libMesh::MeshfreeInterpolation::interpolate_field_data().

◆ operator()() [5/5]

void libMesh::FunctionBase< Number >::operator() ( const Point p,
DenseVector< Number > &  output 
)
inlineinherited

Evaluation function for time-independent vector-valued functions.

Sets output values in the passed-in output DenseVector.

Definition at line 240 of file function_base.h.

242 {
243  // Call the time-dependent function with t=0.
244  this->operator()(p, 0., output);
245 }

◆ operator=() [1/2]

MeshlessInterpolationFunction& libMesh::MeshlessInterpolationFunction::operator= ( const MeshlessInterpolationFunction )
delete

This class contains const references so it can't be assigned.

◆ operator=() [2/2]

MeshlessInterpolationFunction& libMesh::MeshlessInterpolationFunction::operator= ( MeshlessInterpolationFunction &&  )
delete

◆ set_is_time_dependent()

void libMesh::FunctionBase< Number >::set_is_time_dependent ( bool  is_time_dependent)
inlineinherited

Function to set whether this is a time-dependent function or not.

This is intended to be only used by subclasses who cannot natively determine time-dependence. In such a case, this function should be used immediately following construction.

Definition at line 212 of file function_base.h.

213 {
215 }

Member Data Documentation

◆ _initialized

bool libMesh::FunctionBase< Number >::_initialized
protectedinherited

When init() was called so that everything is ready for calls to operator() (...), then this bool is true.

Definition at line 179 of file function_base.h.

◆ _is_time_dependent

bool libMesh::FunctionBase< Number >::_is_time_dependent
protectedinherited

Cache whether or not this function is actually time-dependent.

Definition at line 184 of file function_base.h.

◆ _master

const FunctionBase* libMesh::FunctionBase< Number >::_master
protectedinherited

Const pointer to our master, initialized to nullptr.

There may be cases where multiple functions are required, but to save memory, one master handles some centralized data.

Definition at line 173 of file function_base.h.

◆ _mfi

const MeshfreeInterpolation & libMesh::MeshlessInterpolationFunction::_mfi
private

Definition at line 47 of file meshless_interpolation_function.h.

Referenced by clone(), and operator()().

◆ _mutex

Threads::spin_mutex & libMesh::MeshlessInterpolationFunction::_mutex
private

Definition at line 50 of file meshless_interpolation_function.h.

Referenced by clone(), and operator()().

◆ _pts

std::vector< Point > libMesh::MeshlessInterpolationFunction::_pts
mutableprivate

Definition at line 48 of file meshless_interpolation_function.h.

Referenced by operator()().

◆ _vals

std::vector< Number > libMesh::MeshlessInterpolationFunction::_vals
mutableprivate

Definition at line 49 of file meshless_interpolation_function.h.

Referenced by operator()().


The documentation for this class was generated from the following files:
libMesh::FunctionBase< Number >::is_time_dependent
bool is_time_dependent() const
Definition: function_base.h:219
libMesh::FunctionBase< Number >::_is_time_dependent
bool _is_time_dependent
Cache whether or not this function is actually time-dependent.
Definition: function_base.h:184
libMesh::MeshfreeInterpolation::field_variables
const std::vector< std::string > & field_variables() const
Definition: meshfree_interpolation.h:116
libMesh::MeshlessInterpolationFunction::_mfi
const MeshfreeInterpolation & _mfi
Definition: meshless_interpolation_function.h:47
libMesh::MeshlessInterpolationFunction::_pts
std::vector< Point > _pts
Definition: meshless_interpolation_function.h:48
libMesh::FunctionBase< Number >::_initialized
bool _initialized
When init() was called so that everything is ready for calls to operator() (...), then this bool is t...
Definition: function_base.h:179
libMesh::DenseVector::resize
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:355
libMesh::FunctionBase< Number >::operator()
virtual Number operator()(const Point &p, const Real time=0.)=0
libMesh::MeshlessInterpolationFunction::_mutex
Threads::spin_mutex & _mutex
Definition: meshless_interpolation_function.h:50
libMesh::MeshfreeInterpolation::interpolate_field_data
virtual void interpolate_field_data(const std::vector< std::string > &field_names, const std::vector< Point > &tgt_pts, std::vector< Number > &tgt_vals) const =0
Interpolate source data at target points.
libMesh::MeshlessInterpolationFunction::_vals
std::vector< Number > _vals
Definition: meshless_interpolation_function.h:49