www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
TaggingInterface Class Reference

#include <TaggingInterface.h>

Inheritance diagram for TaggingInterface:
[legend]

Public Member Functions

 TaggingInterface (const MooseObject *moose_object)
 
virtual ~TaggingInterface ()
 
void useVectorTag (const TagName &tag_name)
 
void useMatrixTag (const TagName &tag_name)
 
void useVectorTag (TagID tag_id)
 
void useMatrixTag (TagID tag_id)
 
bool isVectorTagged ()
 
bool isMatrixTagged ()
 
const std::set< TagID > & getVectorTags () const
 
const std::set< TagID > & getMatrixTags () const
 
void prepareVectorTag (Assembly &assembly, unsigned int ivar)
 Prepare data for computing element residual the according to active tags. More...
 
void prepareVectorTagNeighbor (Assembly &assembly, unsigned int ivar)
 Prepare data for computing element residual the according to active tags for DG and interface kernels. More...
 
void prepareMatrixTag (Assembly &assembly, unsigned int ivar, unsigned int jvar)
 Prepare data for computing element jacobian according to the ative tags. More...
 
void prepareMatrixTagNeighbor (Assembly &assembly, unsigned int ivar, unsigned int jvar, Moose::DGJacobianType type)
 Prepare data for computing element jacobian according to the ative tags for DG and interface kernels. More...
 
void accumulateTaggedLocalResidual ()
 Local residual blocks will be appended by adding the current local kernel residual. More...
 
void assignTaggedLocalResidual ()
 Local residual blocks will assigned as the current local kernel residual. More...
 
void accumulateTaggedLocalMatrix ()
 Local Jacobian blocks will be appended by adding the current local kernel Jacobian. More...
 
void assignTaggedLocalMatrix ()
 Local Jacobian blocks will assigned as the current local kernel Jacobian. More...
 

Protected Attributes

std::set< TagID_vector_tags
 The vectors this Kernel will contribute to. More...
 
std::set< TagID_matrix_tags
 The matrices this Kernel will contribute to. More...
 
const MooseObject_moose_object
 Moose objct this tag works on. More...
 
const InputParameters_tag_params
 Parameters from moose object. More...
 
SubProblem_subproblem
 SubProblem that contains tag info. More...
 
std::vector< DenseVector< Number > * > _re_blocks
 Residual blocks Vectors For each Tag. More...
 
std::vector< DenseMatrix< Number > * > _ke_blocks
 Kernel blocks Vectors For each Tag. More...
 
DenseVector< Number > _local_re
 Holds residual entries as they are accumulated by this Kernel. More...
 
DenseMatrix< Number > _local_ke
 Holds residual entries as they are accumulated by this Kernel. More...
 

Detailed Description

Definition at line 37 of file TaggingInterface.h.

Constructor & Destructor Documentation

◆ TaggingInterface()

TaggingInterface::TaggingInterface ( const MooseObject moose_object)

Definition at line 50 of file TaggingInterface.C.

51  : _moose_object(*moose_object),
54 {
55  auto & vector_tag_names = _tag_params.get<MultiMooseEnum>("vector_tags");
56 
57  if (!vector_tag_names.isValid())
58  mooseError("MUST provide at least one vector_tag for Kernel: ", _moose_object.name());
59 
60  for (auto & vector_tag_name : vector_tag_names)
61  _vector_tags.insert(_subproblem.getVectorTagID(vector_tag_name.name()));
62 
63  // Add extra vector tags. These tags should be created in the System already, otherwise
64  // we can not add the extra tags
65  auto & extra_vector_tags = _tag_params.get<std::vector<TagName>>("extra_vector_tags");
66 
67  for (auto & vector_tag_name : extra_vector_tags)
68  _vector_tags.insert(_subproblem.getVectorTagID(vector_tag_name));
69 
70  auto & matrix_tag_names = _tag_params.get<MultiMooseEnum>("matrix_tags");
71 
72  if (!matrix_tag_names.isValid())
73  mooseError("MUST provide at least one matrix_tag for Kernel: ", _moose_object.name());
74 
75  for (auto & matrix_tag_name : matrix_tag_names)
76  _matrix_tags.insert(_subproblem.getMatrixTagID(matrix_tag_name.name()));
77 
78  auto & extra_matrix_tags = _tag_params.get<std::vector<TagName>>("extra_matrix_tags");
79 
80  for (auto & matrix_tag_name : extra_matrix_tags)
81  _matrix_tags.insert(_subproblem.getMatrixTagID(matrix_tag_name));
82 
83  _re_blocks.resize(_vector_tags.size());
84  _ke_blocks.resize(_matrix_tags.size());
85 }
virtual TagID getVectorTagID(const TagName &tag_name)
Get a TagID from a TagName.
Definition: SubProblem.C:81
SubProblem & _subproblem
SubProblem that contains tag info.
const InputParameters & _tag_params
Parameters from moose object.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller...
std::vector< DenseVector< Number > * > _re_blocks
Residual blocks Vectors For each Tag.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseObject.h:62
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
std::set< TagID > _vector_tags
The vectors this Kernel will contribute to.
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:60
virtual TagID getMatrixTagID(const TagName &tag_name)
Get a TagID from a TagName.
Definition: SubProblem.C:133
const MooseObject & _moose_object
Moose objct this tag works on.
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:56
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
std::vector< DenseMatrix< Number > * > _ke_blocks
Kernel blocks Vectors For each Tag.

◆ ~TaggingInterface()

TaggingInterface::~TaggingInterface ( )
virtual

Definition at line 206 of file TaggingInterface.C.

206 {}

Member Function Documentation

◆ accumulateTaggedLocalMatrix()

void TaggingInterface::accumulateTaggedLocalMatrix ( )

◆ accumulateTaggedLocalResidual()

void TaggingInterface::accumulateTaggedLocalResidual ( )

Local residual blocks will be appended by adding the current local kernel residual.

It should be called after the local element vector has been computed.

Definition at line 179 of file TaggingInterface.C.

Referenced by InterfaceKernel::computeElemNeighResidual(), DGKernel::computeElemNeighResidual(), Kernel::computeResidual(), ODEKernel::computeResidual(), ODETimeKernel::computeResidual(), TimeKernel::computeResidual(), IntegratedBC::computeResidual(), VectorIntegratedBC::computeResidual(), DiracKernel::computeResidual(), and ConservativeAdvection::fullUpwind().

180 {
181  for (auto & re : _re_blocks)
182  *re += _local_re;
183 }
std::vector< DenseVector< Number > * > _re_blocks
Residual blocks Vectors For each Tag.
DenseVector< Number > _local_re
Holds residual entries as they are accumulated by this Kernel.

◆ assignTaggedLocalMatrix()

void TaggingInterface::assignTaggedLocalMatrix ( )

Local Jacobian blocks will assigned as the current local kernel Jacobian.

It should be called after the local element matrix has been computed.

Definition at line 200 of file TaggingInterface.C.

Referenced by NodalEqualValueConstraint::computeJacobian().

201 {
202  for (auto & ke : _ke_blocks)
203  *ke = _local_ke;
204 }
DenseMatrix< Number > _local_ke
Holds residual entries as they are accumulated by this Kernel.
std::vector< DenseMatrix< Number > * > _ke_blocks
Kernel blocks Vectors For each Tag.

◆ assignTaggedLocalResidual()

void TaggingInterface::assignTaggedLocalResidual ( )

Local residual blocks will assigned as the current local kernel residual.

It should be called after the local element vector has been computed.

Definition at line 186 of file TaggingInterface.C.

Referenced by NodalEqualValueConstraint::computeResidual().

187 {
188  for (auto & re : _re_blocks)
189  *re = _local_re;
190 }
std::vector< DenseVector< Number > * > _re_blocks
Residual blocks Vectors For each Tag.
DenseVector< Number > _local_re
Holds residual entries as they are accumulated by this Kernel.

◆ getMatrixTags()

const std::set<TagID>& TaggingInterface::getMatrixTags ( ) const
inline

Definition at line 57 of file TaggingInterface.h.

57 { return _matrix_tags; }
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.

◆ getVectorTags()

const std::set<TagID>& TaggingInterface::getVectorTags ( ) const
inline

Definition at line 55 of file TaggingInterface.h.

55 { return _vector_tags; }
std::set< TagID > _vector_tags
The vectors this Kernel will contribute to.

◆ isMatrixTagged()

bool TaggingInterface::isMatrixTagged ( )
inline

Definition at line 53 of file TaggingInterface.h.

53 { return _matrix_tags.size() > 0; }
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.

◆ isVectorTagged()

bool TaggingInterface::isVectorTagged ( )
inline

Definition at line 51 of file TaggingInterface.h.

51 { return _vector_tags.size() > 0; }
std::set< TagID > _vector_tags
The vectors this Kernel will contribute to.

◆ prepareMatrixTag()

void TaggingInterface::prepareMatrixTag ( Assembly assembly,
unsigned int  ivar,
unsigned int  jvar 
)

Prepare data for computing element jacobian according to the ative tags.

Jacobian blocks for different tags will be extracted from Assembly. A local Jacobian will be zeroed. It should be called right before the local element matrix is computed.

Definition at line 150 of file TaggingInterface.C.

Referenced by InterfaceKernel::computeElemNeighJacobian(), DGKernel::computeElemNeighJacobian(), TimeDerivative::computeJacobian(), Kernel::computeJacobian(), ODEKernel::computeJacobian(), IntegratedBC::computeJacobian(), NodalEqualValueConstraint::computeJacobian(), VectorIntegratedBC::computeJacobian(), DiracKernel::computeJacobian(), IntegratedBC::computeJacobianBlock(), VectorIntegratedBC::computeJacobianBlock(), IntegratedBC::computeJacobianBlockScalar(), VectorIntegratedBC::computeJacobianBlockScalar(), InterfaceKernel::computeOffDiagElemNeighJacobian(), DGKernel::computeOffDiagElemNeighJacobian(), ODEKernel::computeOffDiagJacobian(), Kernel::computeOffDiagJacobian(), DiracKernel::computeOffDiagJacobian(), Kernel::computeOffDiagJacobianScalar(), and ConservativeAdvection::fullUpwind().

151 {
152  _ke_blocks.resize(_matrix_tags.size());
153  mooseAssert(_matrix_tags.size() >= 1, "we need at least one active tag");
154  auto mat_vector = _matrix_tags.begin();
155  for (auto i = beginIndex(_matrix_tags); i < _matrix_tags.size(); i++, ++mat_vector)
156  _ke_blocks[i] = &assembly.jacobianBlock(ivar, jvar, *mat_vector);
157 
158  _local_ke.resize(_ke_blocks[0]->m(), _ke_blocks[0]->n());
159  _local_ke.zero();
160 }
DenseMatrix< Number > & jacobianBlock(unsigned int ivar, unsigned int jvar, TagID tag=0)
Definition: Assembly.C:1714
DenseMatrix< Number > _local_ke
Holds residual entries as they are accumulated by this Kernel.
PetscInt m
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
PetscInt n
std::vector< DenseMatrix< Number > * > _ke_blocks
Kernel blocks Vectors For each Tag.

◆ prepareMatrixTagNeighbor()

void TaggingInterface::prepareMatrixTagNeighbor ( Assembly assembly,
unsigned int  ivar,
unsigned int  jvar,
Moose::DGJacobianType  type 
)

Prepare data for computing element jacobian according to the ative tags for DG and interface kernels.

Jacobian blocks for different tags will be extracted from Assembly. A local Jacobian will be zeroed. It should be called right before the local element matrix is computed.

Definition at line 163 of file TaggingInterface.C.

Referenced by InterfaceKernel::computeElemNeighJacobian(), DGKernel::computeElemNeighJacobian(), InterfaceKernel::computeOffDiagElemNeighJacobian(), and DGKernel::computeOffDiagElemNeighJacobian().

167 {
168  _ke_blocks.resize(_matrix_tags.size());
169  mooseAssert(_matrix_tags.size() >= 1, "we need at least one active tag");
170  auto mat_vector = _matrix_tags.begin();
171  for (auto i = beginIndex(_matrix_tags); i < _matrix_tags.size(); i++, ++mat_vector)
172  _ke_blocks[i] = &assembly.jacobianBlockNeighbor(type, ivar, jvar, *mat_vector);
173 
174  _local_ke.resize(_ke_blocks[0]->m(), _ke_blocks[0]->n());
175  _local_ke.zero();
176 }
DenseMatrix< Number > _local_ke
Holds residual entries as they are accumulated by this Kernel.
PetscInt m
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
MatType type
PetscInt n
DenseMatrix< Number > & jacobianBlockNeighbor(Moose::DGJacobianType type, unsigned int ivar, unsigned int jvar, TagID tag=0)
Definition: Assembly.C:1728
std::vector< DenseMatrix< Number > * > _ke_blocks
Kernel blocks Vectors For each Tag.

◆ prepareVectorTag()

void TaggingInterface::prepareVectorTag ( Assembly assembly,
unsigned int  ivar 
)

Prepare data for computing element residual the according to active tags.

Residual blocks for different tags will be extracted from Assembly. A local residual will be zeroed. It should be called right before the local element vector is computed.

Definition at line 124 of file TaggingInterface.C.

Referenced by InterfaceKernel::computeElemNeighResidual(), DGKernel::computeElemNeighResidual(), Kernel::computeResidual(), TimeKernel::computeResidual(), ODEKernel::computeResidual(), ODETimeKernel::computeResidual(), IntegratedBC::computeResidual(), NodalEqualValueConstraint::computeResidual(), VectorIntegratedBC::computeResidual(), DiracKernel::computeResidual(), and ConservativeAdvection::fullUpwind().

125 {
126  _re_blocks.resize(_vector_tags.size());
127  mooseAssert(_vector_tags.size() >= 1, "we need at least one active tag");
128  auto vector_tag = _vector_tags.begin();
129  for (auto i = beginIndex(_vector_tags); i < _vector_tags.size(); i++, ++vector_tag)
130  _re_blocks[i] = &assembly.residualBlock(ivar, *vector_tag);
131 
132  _local_re.resize(_re_blocks[0]->size());
133  _local_re.zero();
134 }
std::vector< DenseVector< Number > * > _re_blocks
Residual blocks Vectors For each Tag.
std::set< TagID > _vector_tags
The vectors this Kernel will contribute to.
DenseVector< Number > _local_re
Holds residual entries as they are accumulated by this Kernel.
DenseVector< Number > & residualBlock(unsigned int var_num, TagID tag_id=0)
Definition: Assembly.h:660

◆ prepareVectorTagNeighbor()

void TaggingInterface::prepareVectorTagNeighbor ( Assembly assembly,
unsigned int  ivar 
)

Prepare data for computing element residual the according to active tags for DG and interface kernels.

Residual blocks for different tags will be extracted from Assembly. A local residual will be zeroed. It should be called right before the local element vector is computed.

Definition at line 137 of file TaggingInterface.C.

Referenced by InterfaceKernel::computeElemNeighResidual(), and DGKernel::computeElemNeighResidual().

138 {
139  _re_blocks.resize(_vector_tags.size());
140  mooseAssert(_vector_tags.size() >= 1, "we need at least one active tag");
141  auto vector_tag = _vector_tags.begin();
142  for (auto i = beginIndex(_vector_tags); i < _vector_tags.size(); i++, ++vector_tag)
143  _re_blocks[i] = &assembly.residualBlockNeighbor(ivar, *vector_tag);
144 
145  _local_re.resize(_re_blocks[0]->size());
146  _local_re.zero();
147 }
DenseVector< Number > & residualBlockNeighbor(unsigned int var_num, TagID tag_id=0)
Definition: Assembly.h:665
std::vector< DenseVector< Number > * > _re_blocks
Residual blocks Vectors For each Tag.
std::set< TagID > _vector_tags
The vectors this Kernel will contribute to.
DenseVector< Number > _local_re
Holds residual entries as they are accumulated by this Kernel.

◆ useMatrixTag() [1/2]

void TaggingInterface::useMatrixTag ( const TagName &  tag_name)

Definition at line 97 of file TaggingInterface.C.

98 {
99  if (!_subproblem.matrixTagExists(tag_name))
100  mooseError("Matrix tag ", tag_name, " does not exsit in system");
101 
102  _matrix_tags.insert(_subproblem.getMatrixTagID(tag_name));
103 }
SubProblem & _subproblem
SubProblem that contains tag info.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
virtual bool matrixTagExists(const TagName &tag_name)
Check to see if a particular Tag exists.
Definition: SubProblem.C:119
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.
virtual TagID getMatrixTagID(const TagName &tag_name)
Get a TagID from a TagName.
Definition: SubProblem.C:133

◆ useMatrixTag() [2/2]

void TaggingInterface::useMatrixTag ( TagID  tag_id)

Definition at line 115 of file TaggingInterface.C.

116 {
117  if (!_subproblem.matrixTagExists(tag_id))
118  mooseError("Matrix tag ", tag_id, " does not exsit in system");
119 
120  _matrix_tags.insert(tag_id);
121 }
SubProblem & _subproblem
SubProblem that contains tag info.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
virtual bool matrixTagExists(const TagName &tag_name)
Check to see if a particular Tag exists.
Definition: SubProblem.C:119
std::set< TagID > _matrix_tags
The matrices this Kernel will contribute to.

◆ useVectorTag() [1/2]

void TaggingInterface::useVectorTag ( const TagName &  tag_name)

Definition at line 88 of file TaggingInterface.C.

89 {
90  if (!_subproblem.vectorTagExists(tag_name))
91  mooseError("Vector tag ", tag_name, " does not exsit in system");
92 
93  _vector_tags.insert(_subproblem.getVectorTagID(tag_name));
94 }
virtual TagID getVectorTagID(const TagName &tag_name)
Get a TagID from a TagName.
Definition: SubProblem.C:81
SubProblem & _subproblem
SubProblem that contains tag info.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
std::set< TagID > _vector_tags
The vectors this Kernel will contribute to.
virtual bool vectorTagExists(TagID tag)
Check to see if a particular Tag exists.
Definition: SubProblem.h:107

◆ useVectorTag() [2/2]

void TaggingInterface::useVectorTag ( TagID  tag_id)

Definition at line 106 of file TaggingInterface.C.

107 {
108  if (!_subproblem.vectorTagExists(tag_id))
109  mooseError("Vector tag ", tag_id, " does not exsit in system");
110 
111  _vector_tags.insert(tag_id);
112 }
SubProblem & _subproblem
SubProblem that contains tag info.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:208
std::set< TagID > _vector_tags
The vectors this Kernel will contribute to.
virtual bool vectorTagExists(TagID tag)
Check to see if a particular Tag exists.
Definition: SubProblem.h:107

Member Data Documentation

◆ _ke_blocks

std::vector<DenseMatrix<Number> *> TaggingInterface::_ke_blocks
protected

◆ _local_ke

DenseMatrix<Number> TaggingInterface::_local_ke
protected

◆ _local_re

DenseVector<Number> TaggingInterface::_local_re
protected

◆ _matrix_tags

std::set<TagID> TaggingInterface::_matrix_tags
protected

◆ _moose_object

const MooseObject& TaggingInterface::_moose_object
protected

Moose objct this tag works on.

Definition at line 128 of file TaggingInterface.h.

Referenced by TaggingInterface().

◆ _re_blocks

std::vector<DenseVector<Number> *> TaggingInterface::_re_blocks
protected

◆ _subproblem

SubProblem& TaggingInterface::_subproblem
protected

SubProblem that contains tag info.

Definition at line 134 of file TaggingInterface.h.

Referenced by TaggingInterface(), useMatrixTag(), and useVectorTag().

◆ _tag_params

const InputParameters& TaggingInterface::_tag_params
protected

Parameters from moose object.

Definition at line 131 of file TaggingInterface.h.

Referenced by TaggingInterface().

◆ _vector_tags

std::set<TagID> TaggingInterface::_vector_tags
protected

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