libMesh
Public Member Functions | Protected Attributes | Private Attributes | List of all members
libMesh::ConstFunction< Output > Class Template Reference

Function that returns a single value that never changes. More...

#include <const_function.h>

Inheritance diagram for libMesh::ConstFunction< Output >:
[legend]

Public Member Functions

 ConstFunction (const Output &c)
 
virtual Output operator() (const Point &, const Real=0) libmesh_override
 
virtual void operator() (const Point &, const Real, DenseVector< Output > &output) libmesh_override
 Evaluation function for time-dependent vector-valued functions. More...
 
virtual UniquePtr< FunctionBase< Output > > clone () const libmesh_override
 
virtual void init ()
 The actual initialization process. More...
 
virtual void clear ()
 Clears the function. More...
 
void operator() (const Point &p, DenseVector< Output > &output)
 Evaluation function for time-independent vector-valued functions. More...
 
virtual Output 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 NULL. 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

Output _c
 

Detailed Description

template<typename Output = Number>
class libMesh::ConstFunction< Output >

Function that returns a single value that never changes.

All overridden virtual functions are documented in function_base.h.

Author
Roy Stogner
Date
2012 Function that returns a single value that never changes.

Definition at line 42 of file const_function.h.

Constructor & Destructor Documentation

template<typename Output = Number>
libMesh::ConstFunction< Output >::ConstFunction ( const Output &  c)
explicit

Definition at line 46 of file const_function.h.

References libMesh::FunctionBase< Output >::_initialized, and libMesh::FunctionBase< Output >::_is_time_dependent.

46  : _c(c)
47  {
48  this->_initialized = true;
49  this->_is_time_dependent = false;
50  }
bool _initialized
When init() was called so that everything is ready for calls to operator() (...), then this bool is t...
bool _is_time_dependent
Cache whether or not this function is actually time-dependent.

Member Function Documentation

template<typename Output = Number>
virtual void libMesh::FunctionBase< Output >::clear ( )
virtualinherited
template<typename Output = Number>
virtual UniquePtr<FunctionBase<Output> > libMesh::ConstFunction< Output >::clone ( ) const
virtual
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< Output >.

Reimplemented in libMesh::ZeroFunction< Output >.

Definition at line 65 of file const_function.h.

References libMesh::ConstFunction< Output >::_c.

66  {
67  return UniquePtr<FunctionBase<Output>>
68  (new ConstFunction<Output>(_c));
69  }
template<typename Output >
Output libMesh::FunctionBase< Output >::component ( unsigned int  i,
const Point p,
Real  time = 0. 
)
virtualinherited
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 libMesh::CompositeFunction< Output >, SolutionGradient, SolutionGradient, SolutionGradient, libMesh::ParsedFunction< Output, OutputGradient >, libMesh::ParsedFunction< T >, libMesh::WrappedFunction< Output >, SolutionFunction, SolutionFunction, and SolutionFunction.

Definition at line 230 of file function_base.h.

Referenced by libMesh::FunctionBase< Real >::clear().

233 {
234  DenseVector<Output> outvec(i+1);
235  (*this)(p, time, outvec);
236  return outvec(i);
237 }
template<typename Output = Number>
virtual void libMesh::FunctionBase< Output >::init ( )
virtualinherited
template<typename Output >
bool libMesh::FunctionBase< Output >::initialized ( ) const
inherited
Returns
true when this object is properly initialized and ready for use, false otherwise.

Definition at line 208 of file function_base.h.

References libMesh::FunctionBase< Output >::_initialized.

Referenced by libMesh::FunctionBase< Real >::clear(), and libMesh::AnalyticFunction< Output >::operator()().

209 {
210  return (this->_initialized);
211 }
bool _initialized
When init() was called so that everything is ready for calls to operator() (...), then this bool is t...
template<typename Output >
bool libMesh::FunctionBase< Output >::is_time_dependent ( ) const
inherited
template<typename Output = Number>
virtual Output libMesh::ConstFunction< Output >::operator() ( const Point p,
const Real  time = 0 
)
virtual
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< Output >.

Definition at line 52 of file const_function.h.

References libMesh::ConstFunction< Output >::_c.

54  { return _c; }
template<typename Output = Number>
virtual void libMesh::ConstFunction< Output >::operator() ( const Point p,
const Real  time,
DenseVector< Output > &  output 
)
virtual

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< Output >.

Definition at line 56 of file const_function.h.

References libMesh::ConstFunction< Output >::_c.

59  {
60  unsigned int size = output.size();
61  for (unsigned int i=0; i != size; ++i)
62  output(i) = _c;
63  }
template<typename Output>
void libMesh::FunctionBase< Output >::operator() ( const Point p,
DenseVector< Output > &  output 
)
inherited

Evaluation function for time-independent vector-valued functions.

Sets output values in the passed-in output DenseVector.

Definition at line 243 of file function_base.h.

References libMesh::FunctionBase< Output >::operator()().

245 {
246  // Call the time-dependent function with t=0.
247  this->operator()(p, 0., output);
248 }
virtual Output operator()(const Point &p, const Real time=0.)=0
template<typename Output >
void libMesh::FunctionBase< Output >::set_is_time_dependent ( bool  is_time_dependent)
inherited

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

References libMesh::FunctionBase< Output >::_is_time_dependent, and libMesh::FunctionBase< Output >::is_time_dependent().

Referenced by libMesh::FunctionBase< Real >::clear().

216 {
218 }
bool is_time_dependent() const
bool _is_time_dependent
Cache whether or not this function is actually time-dependent.

Member Data Documentation

template<typename Output = Number>
Output libMesh::ConstFunction< Output >::_c
private
template<typename Output = Number>
bool libMesh::FunctionBase< Output >::_initialized
protectedinherited
template<typename Output = Number>
bool libMesh::FunctionBase< Output >::_is_time_dependent
protectedinherited
template<typename Output = Number>
const FunctionBase* libMesh::FunctionBase< Output >::_master
protectedinherited

Const pointer to our master, initialized to NULL.

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

Definition at line 168 of file function_base.h.


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