www.mooseframework.org
UpdateErrorVectorsThread.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
15 
16 // MOOSE includes
17 #include "AuxiliarySystem.h"
18 #include "FEProblem.h"
19 #include "Marker.h"
20 #include "MooseVariable.h"
21 #include "Problem.h"
22 
23 #include "libmesh/threads.h"
24 #include "libmesh/error_vector.h"
25 
27  FEProblemBase & fe_problem,
28  const std::map<std::string, std::unique_ptr<ErrorVector>> & indicator_field_to_error_vector)
29  : ThreadedElementLoop<ConstElemRange>(fe_problem),
30  _indicator_field_to_error_vector(indicator_field_to_error_vector),
31  _aux_sys(fe_problem.getAuxiliarySystem()),
32  _system_number(_aux_sys.number()),
33  _adaptivity(fe_problem.adaptivity()),
34  _solution(_aux_sys.solution())
35 {
36  // Build up this map once so we don't have to do these lookups over and over again
37  for (const auto & it : _indicator_field_to_error_vector)
38  {
39  unsigned int var_num = _aux_sys.getVariable(0, it.first).number();
40  _indicator_field_number_to_error_vector.emplace(var_num, it.second.get());
41  }
42 }
43 
44 // Splitting Constructor
46  Threads::split split)
47  : ThreadedElementLoop<ConstElemRange>(x, split),
49  _aux_sys(x._aux_sys),
54 {
55 }
56 
57 void
59 {
60  for (const auto & it : _indicator_field_number_to_error_vector)
61  {
62  unsigned int var_num = it.first;
63  ErrorVector & ev = *(it.second);
64 
65  dof_id_type dof_number = elem->dof_number(_system_number, var_num, 0);
66  Real value = _solution(dof_number);
67  ev[elem->id()] = value;
68  }
69 }
70 
71 void
73 {
74 }
Base class for assembly-like calculations.
NumericVector< Number > & _solution
void join(const UpdateErrorVectorsThread &)
static PetscErrorCode Vec x
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual MooseVariable & getVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:103
virtual void onElement(const Elem *elem) override
Assembly of the element (not including surface assembly)
UpdateErrorVectorsThread(FEProblemBase &fe_problem, const std::map< std::string, std::unique_ptr< ErrorVector >> &indicator_field_to_error_vector)
unsigned int number() const
Get variable number coming from libMesh.
const std::map< std::string, std::unique_ptr< ErrorVector > > & _indicator_field_to_error_vector
std::map< unsigned int, ErrorVector * > _indicator_field_number_to_error_vector