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

#include <solution_function.h>

Inheritance diagram for SolutionGradient:
[legend]

Public Member Functions

 SolutionGradient (const unsigned int u_var)
 
 ~SolutionGradient ()
 
virtual Gradient operator() (const Point &, const Real=0)
 
virtual void operator() (const Point &p, const Real, DenseVector< Gradient > &output)
 Evaluation function for time-dependent vector-valued functions. More...
 
virtual Gradient component (unsigned int component_in, const Point &p, const Real)
 
virtual std::unique_ptr< FunctionBase< Gradient > > clone () const
 
 SolutionGradient (const unsigned int u_var)
 
 ~SolutionGradient ()
 
virtual Gradient operator() (const Point &, const Real=0)
 
virtual void operator() (const Point &p, const Real, DenseVector< Gradient > &output)
 Evaluation function for time-dependent vector-valued functions. More...
 
virtual Gradient component (unsigned int component_in, const Point &p, const Real)
 
virtual std::unique_ptr< FunctionBase< Gradient > > clone () const
 
 SolutionGradient (const unsigned int u_var)
 
 ~SolutionGradient ()
 
virtual Gradient operator() (const Point &, const Real=0)
 
virtual void operator() (const Point &p, const Real, DenseVector< Gradient > &output)
 Evaluation function for time-dependent vector-valued functions. More...
 
virtual Gradient component (unsigned int component_in, const Point &p, const Real)
 
virtual std::unique_ptr< FunctionBase< Gradient > > clone () const
 
virtual void init ()
 The actual initialization process. More...
 
virtual void clear ()
 Clears the function. More...
 
void operator() (const Point &p, DenseVector< Gradient > &output)
 Evaluation function for time-independent 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
 
LaplaceExactGradient soln
 
CurlCurlExactSolution soln
 

Detailed Description

Definition at line 75 of file solution_function.h.

Constructor & Destructor Documentation

◆ SolutionGradient() [1/3]

SolutionGradient::SolutionGradient ( const unsigned int  u_var)

Definition at line 79 of file solution_function.h.

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

◆ ~SolutionGradient() [1/3]

SolutionGradient::~SolutionGradient ( )

Definition at line 81 of file solution_function.h.

81 {}

◆ SolutionGradient() [2/3]

SolutionGradient::SolutionGradient ( const unsigned int  u_var)

Definition at line 76 of file solution_function.h.

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

◆ ~SolutionGradient() [2/3]

SolutionGradient::~SolutionGradient ( )

Definition at line 79 of file solution_function.h.

79 {}

◆ SolutionGradient() [3/3]

SolutionGradient::SolutionGradient ( const unsigned int  u_var)

Definition at line 76 of file solution_function.h.

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

◆ ~SolutionGradient() [3/3]

SolutionGradient::~SolutionGradient ( )

Definition at line 78 of file solution_function.h.

78 {}

Member Function Documentation

◆ clear()

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

Clears the function.

Definition at line 91 of file function_base.h.

91 {}

◆ clone() [1/3]

virtual std::unique_ptr<FunctionBase<Gradient> > SolutionGradient::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< Gradient >.

Definition at line 101 of file solution_function.h.

102  { return libmesh_make_unique<SolutionGradient>(_u_var); }
const unsigned int _u_var

◆ clone() [2/3]

virtual std::unique_ptr<FunctionBase<Gradient> > SolutionGradient::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< Gradient >.

Definition at line 103 of file solution_function.h.

104  { return libmesh_make_unique<SolutionGradient>(_u_var); }
const unsigned int _u_var

◆ clone() [3/3]

virtual std::unique_ptr<FunctionBase<Gradient> > SolutionGradient::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< Gradient >.

Definition at line 105 of file solution_function.h.

106  { return libmesh_make_unique<SolutionGradient>(_u_var); }
const unsigned int _u_var

◆ component() [1/3]

virtual Gradient SolutionGradient::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< Gradient >.

Definition at line 94 of file solution_function.h.

References libMesh::Real.

96  {
97  const Real x=p(0), y=p(1);
98  return soln.grad(x, y).row(component_in);
99  }
LaplaceExactGradient soln
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ component() [2/3]

virtual Gradient SolutionGradient::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< Gradient >.

Definition at line 95 of file solution_function.h.

References libMesh::Real.

98  {
99  const Real x=p(0), y=p(1), z=p(2);
100  return soln.grad(x, y, z).row(component_in);
101  }
LaplaceExactGradient soln
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ component() [3/3]

virtual Gradient SolutionGradient::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< Gradient >.

Definition at line 97 of file solution_function.h.

References libMesh::Real.

100  {
101  const Real x=p(0), y=p(1), z=p(2);
102  return soln(component_in, x, y, z);
103  }
LaplaceExactGradient soln
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ init()

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

The actual initialization process.

Definition at line 86 of file function_base.h.

86 {}

◆ initialized()

bool libMesh::FunctionBase< Gradient >::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< Gradient >::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/7]

virtual Gradient SolutionGradient::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< Gradient >.

Definition at line 80 of file solution_function.h.

82  { libmesh_not_implemented(); }

◆ operator()() [2/7]

virtual Gradient SolutionGradient::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< Gradient >.

Definition at line 81 of file solution_function.h.

82  { libmesh_not_implemented(); }

◆ operator()() [3/7]

virtual Gradient SolutionGradient::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< Gradient >.

Definition at line 83 of file solution_function.h.

84  { libmesh_not_implemented(); }

◆ operator()() [4/7]

virtual void SolutionGradient::operator() ( const Point p,
const Real  time,
DenseVector< Gradient > &  output 
)
virtual

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

Definition at line 84 of file solution_function.h.

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

87  {
88  output.zero();
89  const Real x=p(0), y=p(1), z=p(2);
90  output(_u_var) = soln.grad(x, y, z).row(0);
91  output(_u_var+1) = soln.grad(x, y, z).row(1);
92  output(_u_var+2) = soln.grad(x, y, z).row(2);
93  }
const unsigned int _u_var
LaplaceExactGradient soln
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void zero() override
Set every element in the vector to 0.
Definition: dense_vector.h:379

◆ operator()() [5/7]

virtual void SolutionGradient::operator() ( const Point p,
const Real  time,
DenseVector< Gradient > &  output 
)
virtual

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

Definition at line 84 of file solution_function.h.

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

87  {
88  output.zero();
89  const Real x=p(0), y=p(1);
90  output(_u_var) = soln.grad(x, y).row(0);
91  output(_u_var+1) = soln.grad(x, y).row(1);
92  }
const unsigned int _u_var
LaplaceExactGradient soln
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void zero() override
Set every element in the vector to 0.
Definition: dense_vector.h:379

◆ operator()() [6/7]

virtual void SolutionGradient::operator() ( const Point p,
const Real  time,
DenseVector< Gradient > &  output 
)
virtual

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

Definition at line 86 of file solution_function.h.

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

89  {
90  output.zero();
91  const Real x=p(0), y=p(1), z=p(2);
92  output(_u_var) = soln(0, x, y, z);
93  output(_u_var+1) = soln(1, x, y, z);
94  output(_u_var+2) = soln(2, x, y, z);
95  }
const unsigned int _u_var
LaplaceExactGradient soln
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void zero() override
Set every element in the vector to 0.
Definition: dense_vector.h:379

◆ operator()() [7/7]

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

◆ set_is_time_dependent()

void libMesh::FunctionBase< Gradient >::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< Gradient >::_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< Gradient >::_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< Gradient >::_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 SolutionGradient::_u_var
private

Definition at line 110 of file solution_function.h.

◆ soln [1/2]

CurlCurlExactSolution SolutionGradient::soln
private

Definition at line 107 of file solution_function.h.

◆ soln [2/2]

CurlCurlExactSolution SolutionGradient::soln
private

Definition at line 111 of file solution_function.h.


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