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

#include <fe_test.h>

Inheritance diagram for SkewFunc:
[legend]

Public Member Functions

virtual void init ()
 The actual initialization process. More...
 
virtual void clear ()
 Clears the function. More...
 
void operator() (const Point &p, DenseVector< Real > &output)
 Evaluation function for time-independent vector-valued functions. More...
 
virtual Real 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 Member Functions

std::unique_ptr< FunctionBase< Real > > clone () const override
 
Real operator() (const Point &, const Real=0.) override
 
void operator() (const Point &p, const Real, DenseVector< Real > &output)
 Evaluation function for time-dependent vector-valued functions. More...
 

Detailed Description

Definition at line 40 of file fe_test.h.

Member Function Documentation

◆ clear()

virtual void libMesh::FunctionBase< Real >::clear ( )
inlinevirtualinherited

Clears the function.

Definition at line 92 of file function_base.h.

92 {}

◆ clone()

std::unique_ptr<FunctionBase<Real> > SkewFunc::clone ( ) const
inlineoverrideprivatevirtual
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< Real >.

Definition at line 42 of file fe_test.h.

43  { return std::make_unique<SkewFunc>(); }

◆ component()

Real libMesh::FunctionBase< Real >::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.

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()

virtual void libMesh::FunctionBase< Real >::init ( )
inlinevirtualinherited

The actual initialization process.

Definition at line 87 of file function_base.h.

87 {}

◆ initialized()

bool libMesh::FunctionBase< Real >::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.

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< Real >::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]

Real SkewFunc::operator() ( const Point p,
const Real  time = 0. 
)
inlineoverrideprivatevirtual
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< Real >.

Definition at line 45 of file fe_test.h.

47  { libmesh_not_implemented(); } // scalar-only API

◆ operator()() [2/3]

void SkewFunc::operator() ( const Point p,
const Real  time,
DenseVector< Real > &  output 
)
inlineprivatevirtual

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

Definition at line 50 of file fe_test.h.

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

53  {
54  output.resize(3);
55  output(0) = p(0);
56 #if LIBMESH_DIM > 0
57  output(0) += .1*p(1);
58  output(1) = p(1);
59 #endif
60 #if LIBMESH_DIM > 1
61  output(1) += .2*p(2);
62  output(2) = p(2);
63 #endif
64  }
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:396

◆ operator()() [3/3]

void libMesh::FunctionBase< Real >::operator() ( const Point p,
DenseVector< Real > &  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 Real operator()(const Point &p, const Real time=0.)=0

◆ set_is_time_dependent()

void libMesh::FunctionBase< Real >::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< Real >::_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::AutoAreaFunction::AutoAreaFunction(), libMesh::AutoAreaFunction::init_mfi(), and libMesh::AutoAreaFunction::operator()().

◆ _is_time_dependent

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

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

Definition at line 189 of file function_base.h.

Referenced by libMesh::AutoAreaFunction::AutoAreaFunction().

◆ _master

const FunctionBase* libMesh::FunctionBase< Real >::_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.


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