libMesh::ConstFEMFunction< Output > Class Template Reference

FEMFunction that returns a single value. More...

#include <const_fem_function.h>

Inheritance diagram for libMesh::ConstFEMFunction< Output >:

Public Member Functions

 ConstFEMFunction (const Output c)
 
 ConstFEMFunction (ConstFEMFunction &&)=default
 
 ConstFEMFunction (const ConstFEMFunction &)=default
 
ConstFEMFunctionoperator= (const ConstFEMFunction &)=default
 
ConstFEMFunctionoperator= (ConstFEMFunction &&)=default
 
virtual ~ConstFEMFunction ()=default
 
virtual std::unique_ptr< FEMFunctionBase< Output > > clone () const
 
virtual Output operator() (const FEMContext &, const Point &, const Real=0.)
 
virtual void operator() (const FEMContext &, const Point &, const Real, DenseVector< Output > &output)
 
virtual void init_context (const FEMContext &)
 
void operator() (const FEMContext &, const Point &p, DenseVector< Output > &output)
 
virtual Output component (const FEMContext &, unsigned int i, const Point &p, Real time=0.)
 

Private Attributes

Output _c
 

Detailed Description

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

FEMFunction that returns a single value.

FEMFunction that returns a single value, regardless of the time and location inputs.

Author
Roy Stogner
Date
2012

Definition at line 44 of file const_fem_function.h.

Constructor & Destructor Documentation

◆ ConstFEMFunction() [1/3]

template<typename Output = Number>
libMesh::ConstFEMFunction< Output >::ConstFEMFunction ( const Output  c)
inline

Definition at line 47 of file const_fem_function.h.

◆ ConstFEMFunction() [2/3]

template<typename Output = Number>
libMesh::ConstFEMFunction< Output >::ConstFEMFunction ( ConstFEMFunction< Output > &&  )
default

The 5 special functions can be defaulted for this class.

◆ ConstFEMFunction() [3/3]

template<typename Output = Number>
libMesh::ConstFEMFunction< Output >::ConstFEMFunction ( const ConstFEMFunction< Output > &  )
default

◆ ~ConstFEMFunction()

template<typename Output = Number>
virtual libMesh::ConstFEMFunction< Output >::~ConstFEMFunction ( )
virtualdefault

Member Function Documentation

◆ clone()

template<typename Output = Number>
virtual std::unique_ptr<FEMFunctionBase<Output> > libMesh::ConstFEMFunction< Output >::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::FEMFunctionBase< Output >.

Definition at line 58 of file const_fem_function.h.

59  {return libmesh_make_unique<ConstFEMFunction>(*this); }

◆ component()

template<typename Output >
Output libMesh::FEMFunctionBase< Output >::component ( const FEMContext context,
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 libMesh::CompositeFEMFunction< Output >, libMesh::ParsedFEMFunction< Output >, libMesh::ParsedFEMFunction< T >, and libMesh::WrappedFunctor< Output >.

Definition at line 133 of file fem_function_base.h.

Referenced by libMesh::System::project_vector().

137 {
138  DenseVector<Output> outvec(i+1);
139  (*this)(context, p, time, outvec);
140  return outvec(i);
141 }

◆ init_context()

template<typename Output = Number>
virtual void libMesh::FEMFunctionBase< Output >::init_context ( const FEMContext )
inlinevirtualinherited

Prepares a context object for use.

Most problems will want to reimplement this for efficiency, in order to call FE::get_*() as their particular function requires.

Reimplemented in libMesh::ParsedFEMFunction< Output >, and libMesh::ParsedFEMFunction< T >.

Definition at line 73 of file fem_function_base.h.

73 {}

◆ operator()() [1/3]

template<typename Output = Number>
virtual Output libMesh::ConstFEMFunction< Output >::operator() ( const FEMContext ,
const Point p,
const Real  time = 0. 
)
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::FEMFunctionBase< Output >.

Definition at line 61 of file const_fem_function.h.

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

64  { return _c; }

◆ operator()() [2/3]

template<typename Output = Number>
virtual void libMesh::ConstFEMFunction< Output >::operator() ( const FEMContext ,
const Point p,
const Real  time,
DenseVector< Output > &  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::FEMFunctionBase< Output >.

Definition at line 66 of file const_fem_function.h.

References libMesh::ConstFEMFunction< Output >::_c, and libMesh::DenseVector< T >::size().

70  {
71  for (unsigned int i = 0; i < output.size(); i++)
72  output(i) = _c;
73  }
virtual unsigned int size() const override
Definition: dense_vector.h:92

◆ operator()() [3/3]

template<typename Output >
void libMesh::FEMFunctionBase< Output >::operator() ( const FEMContext context,
const Point p,
DenseVector< Output > &  output 
)
inlineinherited

Evaluation function for time-independent vector-valued functions. Sets output values in the passed-in output DenseVector.

Definition at line 145 of file fem_function_base.h.

148 {
149  // Call the time-dependent function with t=0.
150  this->operator()(context, p, 0., output);
151 }
virtual Output operator()(const FEMContext &, const Point &p, const Real time=0.)=0

◆ operator=() [1/2]

template<typename Output = Number>
ConstFEMFunction& libMesh::ConstFEMFunction< Output >::operator= ( const ConstFEMFunction< Output > &  )
default

◆ operator=() [2/2]

template<typename Output = Number>
ConstFEMFunction& libMesh::ConstFEMFunction< Output >::operator= ( ConstFEMFunction< Output > &&  )
default

Member Data Documentation

◆ _c

template<typename Output = Number>
Output libMesh::ConstFEMFunction< Output >::_c
private

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