https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
SolutionHandle Class Reference

Provide a simple RAII interface for linear lagrange solution variables. More...

#include <SolutionHandle.h>

Public Member Functions

 SolutionHandle (const MooseVariableFieldBase &variable)
 
Number operator() (const Node *node) const
 Get a value from the solution vector.
 
Number old (const Node *node) const
 Get a value from the old solution vector.
 
void set (const Node *node, Number val)
 Set a value in the solution vector.
 
Real L2norm () const
 
void close ()
 

Private Attributes

MooseVariableFieldBase_var
 
NumericVector< Number > & _soln
 
const NumericVector< Number > & _soln_old
 

Detailed Description

Provide a simple RAII interface for linear lagrange solution variables.

Definition at line 21 of file SolutionHandle.h.

Constructor & Destructor Documentation

◆ SolutionHandle()

SolutionHandle::SolutionHandle ( const MooseVariableFieldBase variable)
inline

Definition at line 24 of file SolutionHandle.h.

25 : _var(const_cast<MooseVariableFieldBase &>(variable)),
28 {
29 }
SystemBase & sys()
MooseVariableFieldBase & _var
NumericVector< Number > & _soln
const NumericVector< Number > & _soln_old
NumericVector< Number > & solutionOld()
NumericVector< Number > & solution()

Member Function Documentation

◆ close()

void SolutionHandle::close ( )
inline

Definition at line 63 of file SolutionHandle.h.

63{ _soln.close(); }
virtual void close()=0

◆ L2norm()

Real SolutionHandle::L2norm ( ) const
inline

Definition at line 58 of file SolutionHandle.h.

59 {
60 return _var.sys().system().calculate_norm(_soln, _var.number(), DISCRETE_L2);
61 }
unsigned int number() const
virtual libMesh::System & system()=0
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const

◆ old()

Number SolutionHandle::old ( const Node *  node) const
inline

Get a value from the old solution vector.

Definition at line 43 of file SolutionHandle.h.

44 {
45 // The 0 assumes linear Lagrange (I think)
46 dof_id_type dof = node->dof_number(_var.sys().number(), _var.number(), 0);
47 return _soln_old(dof);
48 }
unsigned int number() const
uint8_t dof_id_type

◆ operator()()

Number SolutionHandle::operator() ( const Node *  node) const
inline

Get a value from the solution vector.

Definition at line 34 of file SolutionHandle.h.

35 {
36 // The 0 assumes linear Lagrange (I think)
37 dof_id_type dof = node->dof_number(_var.sys().number(), _var.number(), 0);
38 return _soln(dof);
39 }

◆ set()

void SolutionHandle::set ( const Node *  node,
Number  val 
)
inline

Set a value in the solution vector.

Definition at line 52 of file SolutionHandle.h.

53 {
54 dof_id_type dof = node->dof_number(_var.sys().number(), _var.number(), 0);
55 _soln.set(dof, val);
56 }
virtual void set(const numeric_index_type i, const T value)=0

Member Data Documentation

◆ _soln

NumericVector<Number>& SolutionHandle::_soln
private

Definition at line 67 of file SolutionHandle.h.

Referenced by close(), L2norm(), operator()(), and set().

◆ _soln_old

const NumericVector<Number>& SolutionHandle::_soln_old
private

Definition at line 68 of file SolutionHandle.h.

Referenced by old().

◆ _var

MooseVariableFieldBase& SolutionHandle::_var
private

Definition at line 66 of file SolutionHandle.h.

Referenced by L2norm(), old(), operator()(), and set().


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