https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Attributes | Friends | List of all members
JvarMapInterfaceBase< T > Class Template Reference

Base class ("Veneer") that implements the actual mapping from 'jvar' in into the _coupled_moose_vars array. More...

#include <JvarMapInterface.h>

Inheritance diagram for JvarMapInterfaceBase< T >:
[legend]

Public Types

typedef std::vector< intJvarMap
 

Public Member Functions

 JvarMapInterfaceBase (const InputParameters &parameters)
 
unsigned int mapJvarToCvar (unsigned int jvar)
 Return index into the _coupled_moose_vars array for a given jvar.
 
int mapJvarToCvar (unsigned int jvar, const JvarMap &jvar_map)
 Return an index into a specific coupled variable vector for a given jvar.
 
const JvarMapgetJvarMap ()
 Obtain the map connecting libmesh variable ID number to its position in the _coupled_moose_vars vector.
 
const JvarMapgetParameterJvarMap (std::string parameter_name)
 Make a specific map for a given parameter name representing a couple variable (vector)
 
bool mapJvarToCvar (unsigned int jvar, unsigned int &cvar)
 Set the cvar value to the mapped jvar value and return true if the mapping exists.
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Attributes

const unsigned int _n_args
 number of coupled moose variables
 

Private Attributes

const std::size_t _jvar_max_size
 number of nonlinear variables in the system
 
JvarMap _jvar_map
 look-up table to determine the _coupled_moose_vars index for the jvar parameter
 
std::map< std::string, JvarMap_jvar_local_map
 map of local look-up tables for specific parameters
 

Friends

class JvarMapKernelInterface< T >
 
class JvarMapIntegratedBCInterface< T >
 

Detailed Description

template<class T>
class JvarMapInterfaceBase< T >

Base class ("Veneer") that implements the actual mapping from 'jvar' in into the _coupled_moose_vars array.

Definition at line 60 of file JvarMapInterface.h.

Member Typedef Documentation

◆ JvarMap

template<class T >
typedef std::vector<int> JvarMapInterfaceBase< T >::JvarMap

Definition at line 63 of file JvarMapInterface.h.

Constructor & Destructor Documentation

◆ JvarMapInterfaceBase()

template<class T >
JvarMapInterfaceBase< T >::JvarMapInterfaceBase ( const InputParameters parameters)

Definition at line 125 of file JvarMapInterface.h.

126 : T(parameters),
127 _n_args(this->_coupled_standard_moose_vars.size()),
128 _jvar_max_size(this->_sys.nVariables()),
130{
131 // populate map
132 for (auto it : Moose::enumerate(this->_coupled_moose_vars))
133 {
134 auto number = it.value()->number();
135
136 // skip AuxVars as off-diagonal jacobian entries are not calculated for them
137 if (number < _jvar_max_size)
138 _jvar_map[number] = it.index();
139 }
140
141 // mark the kernel variable for the check in computeOffDiagJacobian
142 _jvar_map[this->_var.number()] = 0;
143}
const unsigned int _n_args
number of coupled moose variables
JvarMap _jvar_map
look-up table to determine the _coupled_moose_vars index for the jvar parameter
const std::size_t _jvar_max_size
number of nonlinear variables in the system
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
_enumerate_range< Iterator > enumerate(Iterator first, Iterator last, typename std::iterator_traits< Iterator >::difference_type initial)
Enumerate function for iterating over a range and obtaining both a reference to the underlying type a...
Definition Enumerate.h:52

Member Function Documentation

◆ getJvarMap()

template<class T >
const JvarMap & JvarMapInterfaceBase< T >::getJvarMap ( )
inline

Obtain the map connecting libmesh variable ID number to its position in the _coupled_moose_vars vector.

Definition at line 80 of file JvarMapInterface.h.

80{ return _jvar_map; }

◆ getParameterJvarMap()

template<class T >
const JvarMapInterfaceBase< T >::JvarMap & JvarMapInterfaceBase< T >::getParameterJvarMap ( std::string  parameter_name)

Make a specific map for a given parameter name representing a couple variable (vector)

Definition at line 168 of file JvarMapInterface.h.

169{
170 auto & jvar_map = _jvar_local_map[parameter_name];
171 jvar_map.assign(_jvar_max_size, -1);
172
173 // populate local map
174 const auto num = this->coupledComponents(parameter_name);
175 for (std::size_t i = 0; i < num; ++i)
176 {
177 const auto number = this->getVar(parameter_name, i)->number();
178
179 // skip AuxVars as off-diagonal jacobian entries are not calculated for them
180 if (number < _jvar_max_size)
181 jvar_map[number] = i;
182 }
183
184 return jvar_map;
185}
std::map< std::string, JvarMap > _jvar_local_map
map of local look-up tables for specific parameters

◆ mapJvarToCvar() [1/3]

template<class T >
unsigned int JvarMapInterfaceBase< T >::mapJvarToCvar ( unsigned int  jvar)

Return index into the _coupled_moose_vars array for a given jvar.

Definition at line 147 of file JvarMapInterface.h.

148{
149 mooseAssert(jvar < _jvar_max_size,
150 "Calling mapJvarToCvar for an invalid Moose variable number. Maybe an AuxVariable?");
151 int cit = _jvar_map[jvar];
152
153 mooseAssert(cit >= 0, "Calling mapJvarToCvar for a variable not coupled to this kernel.");
154 return cit;
155}

Referenced by MatReaction::computeQpOffDiagJacobian(), MaterialDerivativeRankFourTestKernel::computeQpOffDiagJacobian(), MaterialDerivativeRankTwoTestKernel::computeQpOffDiagJacobian(), and MaterialDerivativeTestKernel::computeQpOffDiagJacobian().

◆ mapJvarToCvar() [2/3]

template<class T >
int JvarMapInterfaceBase< T >::mapJvarToCvar ( unsigned int  jvar,
const JvarMap jvar_map 
)

Return an index into a specific coupled variable vector for a given jvar.

A negative return value indicates that the jvar value does not point to a variable in the couple variable vector corresponding to the mapped parameter.

Definition at line 159 of file JvarMapInterface.h.

160{
161 mooseAssert(jvar < _jvar_max_size,
162 "Calling mapJvarToCvar for an invalid Moose variable number. Maybe an AuxVariable?");
163 return jvar_map[jvar];
164}

◆ mapJvarToCvar() [3/3]

template<class T >
bool JvarMapInterfaceBase< T >::mapJvarToCvar ( unsigned int  jvar,
unsigned int cvar 
)

Set the cvar value to the mapped jvar value and return true if the mapping exists.

Otherwise return false.

Parameters
[in]jvarVariable number passed as argument to computeQpOffDiagJacobian
[out]cvarCorresponding index into the _coupled_moose_vars array
Returns
true if the requested variable is coupled, false otherwise

◆ validParams()

template<class T >
InputParameters JvarMapInterfaceBase< T >::validParams ( )
static

Definition at line 115 of file JvarMapInterface.h.

116{
117 auto params = T::validParams();
118 params.addCoupledVar("coupled_variables",
119 "Vector of nonlinear variable arguments this object depends on");
120
121 return params;
122}

Friends And Related Symbol Documentation

◆ JvarMapIntegratedBCInterface< T >

template<class T >
friend class JvarMapIntegratedBCInterface< T >
friend

Definition at line 107 of file JvarMapInterface.h.

◆ JvarMapKernelInterface< T >

template<class T >
friend class JvarMapKernelInterface< T >
friend

Definition at line 107 of file JvarMapInterface.h.

Member Data Documentation

◆ _jvar_local_map

template<class T >
std::map<std::string, JvarMap> JvarMapInterfaceBase< T >::_jvar_local_map
private

map of local look-up tables for specific parameters

Definition at line 107 of file JvarMapInterface.h.

Referenced by JvarMapInterfaceBase< T >::getParameterJvarMap().

◆ _jvar_map

template<class T >
JvarMap JvarMapInterfaceBase< T >::_jvar_map
private

◆ _jvar_max_size

template<class T >
const std::size_t JvarMapInterfaceBase< T >::_jvar_max_size
private

◆ _n_args

template<class T >
const unsigned int JvarMapInterfaceBase< T >::_n_args
protected

number of coupled moose variables

Definition at line 97 of file JvarMapInterface.h.

Referenced by MatReaction::MatReaction().


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