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

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

#include <const_fem_function.h>

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

Public Member Functions

 ConstFEMFunction (const Output c)
 
 ConstFEMFunction (ConstFEMFunction &&)=default
 The 5 special functions can be defaulted for this class. More...
 
 ConstFEMFunction (const ConstFEMFunction &)=default
 
ConstFEMFunctionoperator= (const ConstFEMFunction &)=default
 
ConstFEMFunctionoperator= (ConstFEMFunction &&)=default
 
virtual ~ConstFEMFunction ()=default
 
virtual std::unique_ptr< FEMFunctionBase< Output > > clone () const override
 
virtual Output operator() (const FEMContext &, const Point &, const Real=0.) override
 
virtual void operator() (const FEMContext &, const Point &, const Real, DenseVector< Output > &output) override
 Evaluation function for time-dependent vector-valued functions. More...
 
virtual void init_context (const FEMContext &)
 Prepares a context object for use. More...
 
void operator() (const FEMContext &, const Point &p, DenseVector< Output > &output)
 Evaluation function for time-independent vector-valued functions. More...
 
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, regardless of the time and location inputs.

Author
Roy Stogner
Date
2012 FEMFunction that returns a single value.

Definition at line 45 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 48 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
inlineoverridevirtual
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 59 of file const_fem_function.h.

60  {return std::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 132 of file fem_function_base.h.

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

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

◆ 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 >, libMesh::ParsedFEMFunction< T >, and SlitFunc.

Definition at line 72 of file fem_function_base.h.

72 {}

◆ operator()() [1/3]

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

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

65  { 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 
)
inlineoverridevirtual

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 67 of file const_fem_function.h.

References libMesh::ConstFEMFunction< Output >::_c, and libMesh::index_range().

71  {
72  for (auto i : index_range(output))
73  output(i) = _c;
74  }
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:111

◆ 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 144 of file fem_function_base.h.

147 {
148  // Call the time-dependent function with t=0.
149  this->operator()(context, p, 0., output);
150 }
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: