libMesh
Public Member Functions | Protected Attributes | Private Attributes | List of all members
SolutionFunction Class Referenceabstract

#include <solution_function.h>

Inheritance diagram for SolutionFunction:
[legend]

Public Member Functions

 SolutionFunction (const unsigned int u_var)
 
 ~SolutionFunction ()
 
virtual Number operator() (const Point &, const Real=0)
 
virtual void operator() (const Point &p, const Real, DenseVector< Number > &output)
 
virtual Number component (unsigned int component_in, const Point &p, const Real)
 
virtual std::unique_ptr< FunctionBase< Number > > clone () const
 
 SolutionFunction (const unsigned int u_var)
 
 ~SolutionFunction ()
 
virtual Number operator() (const Point &, const Real=0)
 
virtual void operator() (const Point &p, const Real, DenseVector< Number > &output)
 
virtual Number component (unsigned int component_in, const Point &p, const Real)
 
virtual std::unique_ptr< FunctionBase< Number > > clone () const
 
 SolutionFunction (const unsigned int u_var)
 
 ~SolutionFunction ()
 
virtual Number operator() (const Point &, const Real=0)
 
virtual void operator() (const Point &p, const Real, DenseVector< Number > &output)
 
virtual Number component (unsigned int component_in, const Point &p, const Real)
 
virtual std::unique_ptr< FunctionBase< Number > > clone () const
 
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
 

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 Attributes

const unsigned int _u_var
 
LaplaceExactSolution soln
 
CurlCurlExactSolution soln
 

Detailed Description

Definition at line 30 of file solution_function.h.

Constructor & Destructor Documentation

◆ SolutionFunction() [1/3]

SolutionFunction::SolutionFunction ( const unsigned int  u_var)

Definition at line 34 of file solution_function.h.

34  :
35  _u_var(u_var) {}
const unsigned int _u_var

◆ ~SolutionFunction() [1/3]

SolutionFunction::~SolutionFunction ( )

Definition at line 37 of file solution_function.h.

37 {}

◆ SolutionFunction() [2/3]

SolutionFunction::SolutionFunction ( const unsigned int  u_var)

Definition at line 34 of file solution_function.h.

35  : _u_var(u_var) {}
const unsigned int _u_var

◆ ~SolutionFunction() [2/3]

SolutionFunction::~SolutionFunction ( )

Definition at line 37 of file solution_function.h.

37 {}

◆ SolutionFunction() [3/3]

SolutionFunction::SolutionFunction ( const unsigned int  u_var)

Definition at line 34 of file solution_function.h.

35  : _u_var(u_var) {}
const unsigned int _u_var

◆ ~SolutionFunction() [3/3]

SolutionFunction::~SolutionFunction ( )

Definition at line 37 of file solution_function.h.

37 {}

Member Function Documentation

◆ clear()

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

Clears the function.

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

Definition at line 91 of file function_base.h.

91 {}

◆ clone() [1/3]

virtual std::unique_ptr<FunctionBase<Number> > SolutionFunction::clone ( ) const
virtual
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 63 of file solution_function.h.

64  { return libmesh_make_unique<SolutionFunction>(_u_var); }
const unsigned int _u_var

◆ clone() [2/3]

virtual std::unique_ptr<FunctionBase<Number> > SolutionFunction::clone ( ) const
virtual
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 63 of file solution_function.h.

64  { return libmesh_make_unique<SolutionFunction>(_u_var); }
const unsigned int _u_var

◆ clone() [3/3]

virtual std::unique_ptr<FunctionBase<Number> > SolutionFunction::clone ( ) const
virtual
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 64 of file solution_function.h.

65  { return libmesh_make_unique<SolutionFunction>(_u_var); }
const unsigned int _u_var

◆ component() [1/3]

virtual Number SolutionFunction::component ( unsigned int  i,
const Point p,
const Real  time 
)
virtual
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 55 of file solution_function.h.

References libMesh::Real.

58  {
59  const Real x=p(0), y=p(1), z=p(2);
60  return soln(x, y, z)(component_in);
61  }
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LaplaceExactSolution soln

◆ component() [2/3]

virtual Number SolutionFunction::component ( unsigned int  i,
const Point p,
const Real  time 
)
virtual
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 55 of file solution_function.h.

References libMesh::Real.

58  {
59  const Real x=p(0), y=p(1);
60  return soln(x, y)(component_in);
61  }
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LaplaceExactSolution soln

◆ component() [3/3]

virtual Number SolutionFunction::component ( unsigned int  i,
const Point p,
const Real  time 
)
virtual
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 56 of file solution_function.h.

References libMesh::Real.

59  {
60  const Real x=p(0), y=p(1), z=p(2);
61  return soln(component_in, x, y, z);
62  }
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LaplaceExactSolution soln

◆ init()

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

The actual initialization process.

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

Definition at line 86 of file function_base.h.

86 {}

◆ initialized()

bool libMesh::FunctionBase< Number >::initialized ( ) const
inherited
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 }
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< Number >::is_time_dependent ( ) const
inherited
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 }
bool _is_time_dependent
Cache whether or not this function is actually time-dependent.

◆ operator()() [1/8]

virtual Number SolutionFunction::operator() ( const Point p,
const Real  time = 0 
)
virtual
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 39 of file solution_function.h.

41  { libmesh_not_implemented(); }

◆ operator()() [2/8]

virtual Number SolutionFunction::operator() ( const Point p,
const Real  time = 0 
)
virtual
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 39 of file solution_function.h.

41  { libmesh_not_implemented(); }

◆ operator()() [3/8]

virtual Number SolutionFunction::operator() ( const Point p,
const Real  time = 0 
)
virtual
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 39 of file solution_function.h.

40  { libmesh_not_implemented(); }

◆ operator()() [4/8]

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

Definition at line 42 of file solution_function.h.

References libMesh::Real, and libMesh::DenseVector< T >::zero().

45  {
46  output.zero();
47  const Real x=p(0), y=p(1), z=p(2);
48  // libMesh assumes each component of the vector-valued variable is stored
49  // contiguously.
50  output(_u_var) = soln(x, y, z)(0);
51  output(_u_var+1) = soln(x, y, z)(1);
52  output(_u_var+2) = soln(x, y, z)(2);
53  }
const unsigned int _u_var
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LaplaceExactSolution soln
virtual void zero() override
Set every element in the vector to 0.
Definition: dense_vector.h:379

◆ operator()() [5/8]

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

Definition at line 43 of file solution_function.h.

References libMesh::Real, and libMesh::DenseVector< T >::zero().

46  {
47  output.zero();
48  const Real x=p(0), y=p(1), z=p(2);
49  // libMesh assumes each component of the vector-valued variable is stored
50  // contiguously.
51  output(_u_var) = soln(0, x, y, z);
52  output(_u_var+1) = soln(1, x, y, z);
53  output(_u_var+2) = soln(2, x, y, z);
54  }
const unsigned int _u_var
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LaplaceExactSolution soln
virtual void zero() override
Set every element in the vector to 0.
Definition: dense_vector.h:379

◆ operator()() [6/8]

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

Definition at line 43 of file solution_function.h.

References libMesh::Real, and libMesh::DenseVector< T >::zero().

46  {
47  output.zero();
48  const Real x=p(0), y=p(1);
49  // libMesh assumes each component of the vector-valued variable is stored
50  // contiguously.
51  output(_u_var) = soln(x, y)(0);
52  output(_u_var+1) = soln(x, y)(1);
53  }
const unsigned int _u_var
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LaplaceExactSolution soln
virtual void zero() override
Set every element in the vector to 0.
Definition: dense_vector.h:379

◆ operator()() [7/8]

void libMesh::FunctionBase< Number >::operator() ( const Point p,
DenseVector< Number > &  output 
)
inherited

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 }
virtual Number operator()(const Point &p, const Real time=0.)=0

◆ operator()() [8/8]

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, and libMesh::MeshlessInterpolationFunction.

◆ set_is_time_dependent()

void libMesh::FunctionBase< Number >::set_is_time_dependent ( bool  is_time_dependent)
inherited

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

◆ _u_var

const unsigned int SolutionFunction::_u_var
private

Definition at line 69 of file solution_function.h.

◆ soln [1/2]

CurlCurlExactSolution SolutionFunction::soln
private

Definition at line 69 of file solution_function.h.

◆ soln [2/2]

CurlCurlExactSolution SolutionFunction::soln
private

Definition at line 70 of file solution_function.h.


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