https://mooseframework.inl.gov
SolutionHandle.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 #include "SystemBase.h"
13 #include "MooseVariableFieldBase.h"
14 #include "libmesh/system.h"
15 #include "libmesh/enum_norm_type.h"
16 #include "libmesh/petsc_vector.h"
17 
22 {
23 public:
25  : _var(const_cast<MooseVariableFieldBase &>(variable)),
26  _soln(_var.sys().solution()),
27  _soln_old(_var.sys().solutionOld())
28  {
29  }
30 
34  Number operator()(const Node * node) const
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  }
43  Number old(const Node * node) const
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  }
52  void set(const Node * node, Number val)
53  {
54  dof_id_type dof = node->dof_number(_var.sys().number(), _var.number(), 0);
55  _soln.set(dof, val);
56  }
57 
58  Real L2norm() const
59  {
61  }
62 
63  void close() { _soln.close(); }
64 
65 private:
69 };
MooseVariableFieldBase & _var
unsigned int number() const
DISCRETE_L2
virtual libMesh::System & system()=0
Provide a simple RAII interface for linear lagrange solution variables.
NumericVector< Number > & _soln
Real L2norm() const
Real calculate_norm(const NumericVector< Number > &v, unsigned int var, FEMNormType norm_type, std::set< unsigned int > *skip_dimensions=nullptr) const
unsigned int number() const
Number operator()(const Node *node) const
Get a value from the solution vector.
virtual void close()=0
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const NumericVector< Number > & _soln_old
virtual void set(const numeric_index_type i, const Number value)=0
Real Number
SystemBase & sys()
Number old(const Node *node) const
Get a value from the old solution vector.
uint8_t dof_id_type
SolutionHandle(const MooseVariableFieldBase &variable)