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 UniquePtr< 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 UniquePtr< 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 UniquePtr< 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 NULL. 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 26 of file solution_function.h.

Constructor & Destructor Documentation

SolutionFunction::SolutionFunction ( const unsigned int  u_var)

Definition at line 30 of file solution_function.h.

30  :
31  _u_var(u_var) {}
const unsigned int _u_var
SolutionFunction::~SolutionFunction ( )

Definition at line 33 of file solution_function.h.

33 {}
SolutionFunction::SolutionFunction ( const unsigned int  u_var)

Definition at line 30 of file solution_function.h.

31  : _u_var(u_var) {}
const unsigned int _u_var
SolutionFunction::~SolutionFunction ( )

Definition at line 33 of file solution_function.h.

33 {}
SolutionFunction::SolutionFunction ( const unsigned int  u_var)

Definition at line 30 of file solution_function.h.

31  : _u_var(u_var) {}
const unsigned int _u_var
SolutionFunction::~SolutionFunction ( )

Definition at line 33 of file solution_function.h.

33 {}

Member Function Documentation

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

Clears the function.

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

Definition at line 86 of file function_base.h.

86 {}
virtual UniquePtr<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 59 of file solution_function.h.

const unsigned int _u_var
SolutionFunction(const unsigned int u_var)
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
virtual UniquePtr<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 59 of file solution_function.h.

const unsigned int _u_var
SolutionFunction(const unsigned int u_var)
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
virtual UniquePtr<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 60 of file solution_function.h.

const unsigned int _u_var
SolutionFunction(const unsigned int u_var)
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
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 51 of file solution_function.h.

References libMesh::Real, and libMesh::x.

54  {
55  const Real x=p(0), y=p(1), z=p(2);
56  return soln(x, y, z)(component_in);
57  }
PetscErrorCode Vec x
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LaplaceExactSolution soln
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 51 of file solution_function.h.

References libMesh::Real, and libMesh::x.

54  {
55  const Real x=p(0), y=p(1);
56  return soln(x, y)(component_in);
57  }
PetscErrorCode Vec x
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LaplaceExactSolution soln
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 52 of file solution_function.h.

References libMesh::Real, and libMesh::x.

55  {
56  const Real x=p(0), y=p(1), z=p(2);
57  return soln(component_in, x, y, z);
58  }
PetscErrorCode Vec x
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LaplaceExactSolution soln
virtual void libMesh::FunctionBase< Number >::init ( )
virtualinherited

The actual initialization process.

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

Definition at line 81 of file function_base.h.

81 {}
bool libMesh::FunctionBase< Number >::initialized ( ) const
inherited
bool libMesh::FunctionBase< Number >::is_time_dependent ( ) const
inherited
Returns
true when the function this object represents is actually time-dependent, false otherwise.
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 35 of file solution_function.h.

37  { libmesh_not_implemented(); }
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 35 of file solution_function.h.

37  { libmesh_not_implemented(); }
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 35 of file solution_function.h.

36  { libmesh_not_implemented(); }
virtual void SolutionFunction::operator() ( const Point p,
const Real  ,
DenseVector< Number > &  output 
)
virtual

Definition at line 38 of file solution_function.h.

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

41  {
42  output.zero();
43  const Real x=p(0), y=p(1), z=p(2);
44  // libMesh assumes each component of the vector-valued variable is stored
45  // contiguously.
46  output(_u_var) = soln(x, y, z)(0);
47  output(_u_var+1) = soln(x, y, z)(1);
48  output(_u_var+2) = soln(x, y, z)(2);
49  }
virtual void zero() libmesh_override
Set every element in the vector to 0.
Definition: dense_vector.h:374
const unsigned int _u_var
PetscErrorCode Vec x
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LaplaceExactSolution soln
virtual void SolutionFunction::operator() ( const Point p,
const Real  ,
DenseVector< Number > &  output 
)
virtual

Definition at line 39 of file solution_function.h.

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

42  {
43  output.zero();
44  const Real x=p(0), y=p(1), z=p(2);
45  // libMesh assumes each component of the vector-valued variable is stored
46  // contiguously.
47  output(_u_var) = soln(0, x, y, z);
48  output(_u_var+1) = soln(1, x, y, z);
49  output(_u_var+2) = soln(2, x, y, z);
50  }
virtual void zero() libmesh_override
Set every element in the vector to 0.
Definition: dense_vector.h:374
const unsigned int _u_var
PetscErrorCode Vec x
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LaplaceExactSolution soln
virtual void SolutionFunction::operator() ( const Point p,
const Real  ,
DenseVector< Number > &  output 
)
virtual

Definition at line 39 of file solution_function.h.

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

42  {
43  output.zero();
44  const Real x=p(0), y=p(1);
45  // libMesh assumes each component of the vector-valued variable is stored
46  // contiguously.
47  output(_u_var) = soln(x, y)(0);
48  output(_u_var+1) = soln(x, y)(1);
49  }
virtual void zero() libmesh_override
Set every element in the vector to 0.
Definition: dense_vector.h:374
const unsigned int _u_var
PetscErrorCode Vec x
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LaplaceExactSolution soln
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.

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.

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.

Member Data Documentation

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

Referenced by libMesh::MeshFunction::clear(), and libMesh::MeshFunction::init().

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

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

Definition at line 179 of file function_base.h.

const FunctionBase* libMesh::FunctionBase< Number >::_master
protectedinherited

Const pointer to our master, initialized to NULL.

There may be cases where multiple functions are required, but to save memory, one master handles some centralized data.

Definition at line 168 of file function_base.h.

Referenced by libMesh::MeshFunction::clear(), libMesh::MeshFunction::find_element(), libMesh::MeshFunction::find_elements(), libMesh::MeshFunction::init(), and libMesh::MeshFunction::~MeshFunction().

const unsigned int SolutionFunction::_u_var
private

Definition at line 65 of file solution_function.h.

CurlCurlExactSolution SolutionFunction::soln
private

Definition at line 65 of file solution_function.h.

CurlCurlExactSolution SolutionFunction::soln
private

Definition at line 66 of file solution_function.h.


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