libMesh
Public Member Functions | Public Attributes | Protected Attributes | List of all members
TripleFunction Struct Referenceabstract
Inheritance diagram for TripleFunction:
[legend]

Public Member Functions

 TripleFunction (Number _offset=0)
 
virtual std::unique_ptr< FunctionBase< Number > > clone () const
 
virtual Number operator() (const Point &, const Real=0.) override
 
virtual void operator() (const Point &p, const Real time, DenseVector< Number > &output) override
 
Number component (unsigned int i, const Point &p, Real) override
 
virtual void init ()
 The actual initialization process. More...
 
virtual void clear ()
 Clears the function. More...
 
void operator() (const Point &p, DenseVector< Number > &output)
 Evaluation function for time-independent vector-valued functions. More...
 
virtual void operator() (const Point &p, const Real time, DenseVector< Number > &output)=0
 Evaluation function for time-dependent vector-valued functions. More...
 
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
 

Public Attributes

Number offset
 

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

Detailed Description

Definition at line 369 of file systems_test.C.

Constructor & Destructor Documentation

◆ TripleFunction()

TripleFunction::TripleFunction ( Number  _offset = 0)
inline

Definition at line 371 of file systems_test.C.

371 : offset(_offset) {}

Member Function Documentation

◆ clear()

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

Clears the function.

Reimplemented in libMesh::MeshFunction, libMesh::MeshlessInterpolationFunction, libMesh::MeshlessInterpolationFunction, and ExampleOneFunction.

Definition at line 91 of file function_base.h.

91 {}

◆ clone()

virtual std::unique_ptr<FunctionBase<Number> > TripleFunction::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::FunctionBase< Number >.

Definition at line 373 of file systems_test.C.

374  { return libmesh_make_unique<TripleFunction>(offset); }

◆ component()

Number TripleFunction::component ( unsigned int  i,
const Point p,
Real  time 
)
inlineoverridevirtual
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 from libMesh::FunctionBase< Number >.

Definition at line 394 of file systems_test.C.

397  {
398  Parameters params;
399  switch (i) {
400  case 0:
401  return cubic_test(p, params, "", "") + offset;
402  case 1:
403  return new_linear_test(p, params, "", "") + offset;
404  case 2:
405  return disc_thirds_test(p, params, "", "") + offset;
406  default:
407  libmesh_error();
408  }
409  return 0;
410  }

References cubic_test(), disc_thirds_test(), and new_linear_test().

◆ init()

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

The actual initialization process.

Reimplemented in libMesh::MeshFunction, libMesh::MeshlessInterpolationFunction, libMesh::MeshlessInterpolationFunction, and ExampleOneFunction.

Definition at line 86 of file function_base.h.

86 {}

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

206 {
207  return (this->_initialized);
208 }

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

220 {
221  return (this->_is_time_dependent);
222 }

◆ operator()() [1/4]

virtual Number TripleFunction::operator() ( const Point p,
const  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::FunctionBase< Number >.

Definition at line 377 of file systems_test.C.

379  { libmesh_error(); }

◆ operator()() [2/4]

virtual void TripleFunction::operator() ( const Point p,
const Real  time,
DenseVector< Number > &  output 
)
inlineoverridevirtual

Definition at line 381 of file systems_test.C.

384  {
385  libmesh_assert_greater(output.size(), 0);
386  Parameters params;
387  output(0) = cubic_test(p, params, "", "") + offset;
388  if (output.size() > 0)
389  output(1) = new_linear_test(p, params, "", "") + offset;
390  if (output.size() > 1)
391  output(2) = disc_thirds_test(p, params, "", "") + offset;
392  }

References cubic_test(), disc_thirds_test(), new_linear_test(), and libMesh::DenseVector< T >::size().

◆ operator()() [3/4]

virtual void libMesh::FunctionBase< Number >::operator() ( const Point p,
const Real  time,
DenseVector< Number > &  output 
)
pure virtualinherited

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.

Implemented in libMesh::MeshFunction, libMesh::MeshlessInterpolationFunction, and libMesh::MeshlessInterpolationFunction.

◆ operator()() [4/4]

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

242 {
243  // Call the time-dependent function with t=0.
244  this->operator()(p, 0., output);
245 }

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

213 {
215 }

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 179 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 184 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 173 of file function_base.h.

◆ offset

Number TripleFunction::offset

The documentation for this struct was generated from the following file:
cubic_test
Number cubic_test(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: systems_test.C:330
libMesh::FunctionBase< Number >::is_time_dependent
bool is_time_dependent() const
Definition: function_base.h:219
libMesh::FunctionBase< Number >::_is_time_dependent
bool _is_time_dependent
Cache whether or not this function is actually time-dependent.
Definition: function_base.h:184
disc_thirds_test
Number disc_thirds_test(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: systems_test.C:356
TripleFunction::offset
Number offset
Definition: systems_test.C:412
new_linear_test
Number new_linear_test(const Point &p, const Parameters &, const std::string &, const std::string &)
Definition: systems_test.C:343
libMesh::FunctionBase< Number >::_initialized
bool _initialized
When init() was called so that everything is ready for calls to operator() (...), then this bool is t...
Definition: function_base.h:179
libMesh::DenseVector::size
virtual unsigned int size() const override
Definition: dense_vector.h:92
libMesh::FunctionBase< Number >::operator()
virtual Number operator()(const Point &p, const Real time=0.)=0
libMesh::Parameters
This class provides the ability to map between arbitrary, user-defined strings and several data types...
Definition: parameters.h:59