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

#include <meshfree_interpolation_function.h>

Inheritance diagram for libMesh::MeshfreeInterpolationFunction:
[legend]

Public Member Functions

 MeshfreeInterpolationFunction (const MeshfreeInterpolation &mfi, Threads::spin_mutex &mutex)
 Constructor. More...
 
 MeshfreeInterpolationFunction (MeshfreeInterpolationFunction &&)=default
 Move and copy constructors. More...
 
 MeshfreeInterpolationFunction (const MeshfreeInterpolationFunction &)=default
 
virtual ~MeshfreeInterpolationFunction ()=default
 Destructor. More...
 
MeshfreeInterpolationFunctionoperator= (const MeshfreeInterpolationFunction &)=delete
 Delete assignment operators. More...
 
MeshfreeInterpolationFunctionoperator= (MeshfreeInterpolationFunction &&)=delete
 
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...
 
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 39 of file meshfree_interpolation_function.h.

Constructor & Destructor Documentation

◆ MeshfreeInterpolationFunction() [1/3]

libMesh::MeshfreeInterpolationFunction::MeshfreeInterpolationFunction ( const MeshfreeInterpolation mfi,
Threads::spin_mutex mutex 
)

Constructor.

Requires a MeshfreeInterpolation object.

Definition at line 29 of file meshfree_interpolation_function.C.

◆ MeshfreeInterpolationFunction() [2/3]

libMesh::MeshfreeInterpolationFunction::MeshfreeInterpolationFunction ( MeshfreeInterpolationFunction &&  )
default

Move and copy constructors.

◆ MeshfreeInterpolationFunction() [3/3]

libMesh::MeshfreeInterpolationFunction::MeshfreeInterpolationFunction ( const MeshfreeInterpolationFunction )
default

◆ ~MeshfreeInterpolationFunction()

virtual libMesh::MeshfreeInterpolationFunction::~MeshfreeInterpolationFunction ( )
virtualdefault

Destructor.

Member Function Documentation

◆ clear()

void libMesh::MeshfreeInterpolationFunction::clear ( )
virtual

Clears the function.

Reimplemented from libMesh::FunctionBase< Number >.

Definition at line 56 of file meshfree_interpolation_function.C.

References _pts, and _vals.

57 {
58  _pts.clear();
59  _vals.clear();
60 }

◆ clone()

std::unique_ptr< FunctionBase< Number > > libMesh::MeshfreeInterpolationFunction::clone ( ) const
virtual

Returns a new deep copy of the function.

Implements libMesh::FunctionBase< Number >.

Definition at line 62 of file meshfree_interpolation_function.C.

References _mfi, and _mutex.

63 {
64  return std::make_unique<MeshfreeInterpolationFunction>(_mfi, _mutex);
65 }

◆ 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.
The default implementation calls operator() with a DenseVector of size i+1 which will result in unexpected behaviour if operator() makes any access beyond that limit.

Reimplemented in TripleFunction, SolutionFunction< dim >, PeriodicQuadFunction, SolutionFunction< dim >, SolutionFunction< dim >, SolutionFunction< dim >, SolutionFunction< dim >, SolutionFunction< dim >, and SolutionFunction< dim >.

Definition at line 232 of file function_base.h.

235 {
236  DenseVector<Output> outvec(i+1);
237  (*this)(p, time, outvec);
238  return outvec(i);
239 }

◆ init()

void libMesh::MeshfreeInterpolationFunction::init ( )
virtual

The actual initialization process.

Reimplemented from libMesh::FunctionBase< Number >.

Definition at line 51 of file meshfree_interpolation_function.C.

52 {
53  // Initialization logic if any
54 }

◆ 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 210 of file function_base.h.

Referenced by libMesh::MeshFunction::disable_out_of_mesh_mode(), libMesh::MeshFunction::discontinuous_gradient(), libMesh::MeshFunction::discontinuous_value(), libMesh::MeshFunction::enable_out_of_mesh_mode(), libMesh::MeshFunction::get_point_locator(), libMesh::MeshFunction::gradient(), libMesh::MeshFunction::hessian(), and libMesh::MeshFunction::operator()().

211 {
212  return (this->_initialized);
213 }
bool _initialized
When init() was called so that everything is ready for calls to operator() (...), then this bool is t...

◆ 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 224 of file function_base.h.

225 {
226  return (this->_is_time_dependent);
227 }
bool _is_time_dependent
Cache whether or not this function is actually time-dependent.

◆ operator()() [1/3]

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

Implements libMesh::FunctionBase< Number >.

Definition at line 32 of file meshfree_interpolation_function.C.

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

33 {
34  _pts.clear();
35  _pts.push_back(p);
36  _vals.resize(1);
37 
38  Threads::spin_mutex::scoped_lock lock(_mutex);
39 
41 
42  return _vals.front();
43 }
const std::vector< std::string > & field_variables() const
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.

◆ operator()() [2/3]

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

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

Implements libMesh::FunctionBase< Number >.

Definition at line 45 of file meshfree_interpolation_function.C.

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

46 {
47  output.resize(1);
48  output(0) = (*this)(p, time);
49 }
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:396

◆ operator()() [3/3]

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 245 of file function_base.h.

247 {
248  // Call the time-dependent function with t=0.
249  this->operator()(p, 0., output);
250 }
virtual Number operator()(const Point &p, const Real time=0.)=0

◆ operator=() [1/2]

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

Delete assignment operators.

◆ operator=() [2/2]

MeshfreeInterpolationFunction& libMesh::MeshfreeInterpolationFunction::operator= ( MeshfreeInterpolationFunction &&  )
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 217 of file function_base.h.

218 {
220 }
bool _is_time_dependent
Cache whether or not this function is actually time-dependent.

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 184 of file function_base.h.

Referenced by libMesh::MeshFunction::clear(), and libMesh::MeshFunction::init().

◆ _is_time_dependent

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

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

Definition at line 189 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 178 of file function_base.h.

Referenced by libMesh::MeshFunction::clear(), libMesh::MeshFunction::find_element(), and libMesh::MeshFunction::find_elements().

◆ _mfi

const MeshfreeInterpolation& libMesh::MeshfreeInterpolationFunction::_mfi
private

Definition at line 93 of file meshfree_interpolation_function.h.

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

◆ _mutex

Threads::spin_mutex& libMesh::MeshfreeInterpolationFunction::_mutex
private

Definition at line 96 of file meshfree_interpolation_function.h.

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

◆ _pts

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

Definition at line 94 of file meshfree_interpolation_function.h.

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

◆ _vals

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

Definition at line 95 of file meshfree_interpolation_function.h.

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


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