libMesh
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
ExampleOneFunction Class Reference
Inheritance diagram for ExampleOneFunction:
[legend]

Public Member Functions

void operator() (const Point &p, DenseVector< Number > &output)
 Evaluation function for time-independent vector-valued functions.
 
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.
 
bool is_time_dependent () const
 

Protected Attributes

const FunctionBase_master
 Const pointer to our master, initialized to nullptr.
 
bool _initialized
 When init() was called so that everything is ready for calls to operator() (...), then this bool is true.
 
bool _is_time_dependent
 Cache whether or not this function is actually time-dependent.
 

Private Member Functions

virtual Number operator() (const Point &, const Real)
 
virtual void operator() (const Point &, const Real, DenseVector< Number > &output)
 Evaluation function for time-dependent vector-valued functions.
 
virtual void init ()
 The actual initialization process.
 
virtual void clear ()
 Clears the function.
 
virtual std::unique_ptr< FunctionBase< Number > > clone () const
 
virtual Number operator() (const Point &, const Real)
 
virtual void operator() (const Point &, const Real, DenseVector< Number > &output)
 Evaluation function for time-dependent vector-valued functions.
 
virtual void init ()
 The actual initialization process.
 
virtual void clear ()
 Clears the function.
 
virtual std::unique_ptr< FunctionBase< Number > > clone () const
 

Detailed Description

Definition at line 31 of file factoryfunction.C.

Member Function Documentation

◆ clear() [1/2]

virtual void ExampleOneFunction::clear ( )
inlineprivatevirtual

Clears the function.

Reimplemented from libMesh::FunctionBase< Number >.

Definition at line 48 of file factoryfunction.C.

48{}

◆ clear() [2/2]

virtual void ExampleOneFunction::clear ( )
inlineprivatevirtual

Clears the function.

Reimplemented from libMesh::FunctionBase< Number >.

Definition at line 48 of file factoryfunction.C.

48{}

◆ clone() [1/2]

virtual std::unique_ptr< FunctionBase< Number > > ExampleOneFunction::clone ( ) const
inlineprivatevirtual
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< Number >.

Definition at line 49 of file factoryfunction.C.

50 {
51 return std::make_unique<ExampleOneFunction>();
52 }

◆ clone() [2/2]

virtual std::unique_ptr< FunctionBase< Number > > ExampleOneFunction::clone ( ) const
inlineprivatevirtual
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< Number >.

Definition at line 49 of file factoryfunction.C.

50 {
51 return std::make_unique<ExampleOneFunction>();
52 }

◆ 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 SolutionFunction< dim >, SolutionFunction< dim >, SolutionFunction< dim >, SolutionFunction< dim >, SolutionFunction< dim >, SolutionFunction< dim >, SolutionFunction< dim >, PeriodicQuadFunction, and TripleFunction.

Definition at line 145 of file function_base.h.

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

◆ init() [1/2]

virtual void ExampleOneFunction::init ( )
inlineprivatevirtual

The actual initialization process.

Reimplemented from libMesh::FunctionBase< Number >.

Definition at line 47 of file factoryfunction.C.

47{}

◆ init() [2/2]

virtual void ExampleOneFunction::init ( )
inlineprivatevirtual

The actual initialization process.

Reimplemented from libMesh::FunctionBase< Number >.

Definition at line 47 of file factoryfunction.C.

47{}

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

211{
212 return (this->_initialized);
213}

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

225{
226 return (this->_is_time_dependent);
227}

◆ operator()() [1/5]

virtual Number ExampleOneFunction::operator() ( const Point p,
const Real  time 
)
inlineprivatevirtual
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< Number >.

Definition at line 33 of file factoryfunction.C.

35 {
36 return 1;
37 }

◆ operator()() [2/5]

virtual Number ExampleOneFunction::operator() ( const Point p,
const Real  time 
)
inlineprivatevirtual
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< Number >.

Definition at line 33 of file factoryfunction.C.

35 {
36 return 1;
37 }

◆ operator()() [3/5]

virtual void ExampleOneFunction::operator() ( const Point p,
const Real  time,
DenseVector< Number > &  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< Number >.

Definition at line 39 of file factoryfunction.C.

42 {
43 for (unsigned int i=0; i != output.size(); ++i)
44 output(i) = 1;
45 }
virtual unsigned int size() const override final

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

◆ operator()() [4/5]

virtual void ExampleOneFunction::operator() ( const Point p,
const Real  time,
DenseVector< Number > &  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< Number >.

Definition at line 39 of file factoryfunction.C.

42 {
43 for (unsigned int i=0; i != output.size(); ++i)
44 output(i) = 1;
45 }

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

◆ operator()() [5/5]

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 116 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

◆ 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 162 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.

◆ _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.


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