www.mooseframework.org
Marker.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 /****************************************************************/
14 
15 #include "Marker.h"
16 
17 #include "Assembly.h"
18 #include "FEProblem.h"
19 #include "MooseMesh.h"
20 #include "MooseVariable.h"
21 #include "SystemBase.h"
22 
23 template <>
26 {
29  params += validParams<OutputInterface>();
30 
31  params.addParam<bool>("use_displaced_mesh",
32  false,
33  "Whether or not this object should use the "
34  "displaced mesh for computation. Note that "
35  "in the case this is true but no "
36  "displacements are provided in the Mesh block "
37  "the undisplaced mesh will still be used.");
38  params.addParamNamesToGroup("use_displaced_mesh", "Advanced");
39 
40  params.registerBase("Marker");
41 
42  return params;
43 }
44 
45 Marker::Marker(const InputParameters & parameters)
46  : MooseObject(parameters),
47  BlockRestrictable(this),
48  SetupInterface(this),
50  UserObjectInterface(this),
51  Restartable(parameters, "Markers"),
53  MeshChangedInterface(parameters),
54  OutputInterface(parameters),
55  _subproblem(*parameters.get<SubProblem *>("_subproblem")),
56  _fe_problem(*parameters.get<FEProblemBase *>("_fe_problem_base")),
57  _adaptivity(_fe_problem.adaptivity()),
58  _sys(*parameters.get<SystemBase *>("_sys")),
59  _tid(parameters.get<THREAD_ID>("_tid")),
60  _assembly(_subproblem.assembly(_tid)),
61  _field_var(_sys.getVariable(_tid, name())),
62  _current_elem(_field_var.currentElem()),
63 
64  _mesh(_subproblem.mesh())
65 {
66  _supplied.insert(name());
67 
69 }
70 
73 {
74  MooseEnum marker_states("DONT_MARK=-1 COARSEN DO_NOTHING REFINE");
75 
76  return marker_states;
77 }
78 
79 void
81 {
82  int mark = computeElementMarker();
84 }
85 
86 ErrorVector &
87 Marker::getErrorVector(std::string indicator)
88 {
89  return _adaptivity.getErrorVector(indicator);
90 }
91 
92 const VariableValue &
94 {
95  _depend.insert(name);
96  return _sys.getVariable(_tid, name).nodalSln();
97 }
98 
99 bool
101 {
102  return true;
103 }
104 
105 void
107 {
108 }
109 
110 const std::set<std::string> &
112 {
113  return _depend;
114 }
115 
116 const std::set<std::string> &
118 {
119  return _supplied;
120 }
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:47
virtual const std::set< std::string > & getRequestedItems() override
Return a set containing the names of items requested by the object.
Definition: Marker.C:111
SystemBase & _sys
Definition: Marker.h:111
THREAD_ID _tid
Definition: Marker.h:113
A class for creating restricted objects.
Definition: Restartable.h:31
InputParameters validParams< BlockRestrictable >()
InputParameters validParams< OutputInterface >()
A class to provide an common interface to objects requiring "outputs" option.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addMooseVariableDependency(MooseVariable *var)
Call this function to add the passed in MooseVariable as a variable that this object depends on...
virtual void markerSetup()
Is called before any element looping is started so any "global" computation can be done...
Definition: Marker.C:106
bool isActive() const
Definition: Marker.C:100
std::set< std::string > _supplied
Definition: Marker.h:124
Base class for a system (of equations)
Definition: SystemBase.h:91
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Adaptivity & _adaptivity
Definition: Marker.h:110
virtual const std::set< std::string > & getSuppliedItems() override
Return a set containing the names of items owned by the object.
Definition: Marker.C:117
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
Interface for notifications that the mesh has changed.
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:36
ErrorVector & getErrorVector(std::string indicator)
Get an ErrorVector that will be filled up with values corresponding to the indicator passed in...
Definition: Marker.C:87
void setNodalValue(Number value, unsigned int idx=0)
Set the nodal value for this variable to keep everything up to date.
static MooseEnum markerStates()
Helper function for getting the valid refinement flag states a marker can use as a MooseEnum...
Definition: Marker.C:72
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:37
InputParameters validParams< Marker >()
Definition: Marker.C:25
Interface for objects that need to use UserObjects.
std::set< std::string > _depend
Depend Markers.
Definition: Marker.h:123
virtual MarkerValue computeElementMarker()=0
InputParameters validParams< MooseObject >()
Definition: MooseObject.C:22
MooseVariable & _field_var
Definition: Marker.h:117
Marker(const InputParameters &parameters)
Definition: Marker.C:45
const VariableValue & nodalSln()
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:53
ErrorVector & getErrorVector(const std::string &indicator_field)
Get an ErrorVector that will be filled up with values corresponding to the indicator field name passe...
Definition: Adaptivity.C:276
An interface that restricts an object to subdomains via the &#39;blocks&#39; input parameter.
Interface for sorting dependent vectors of objects.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
virtual void computeMarker()
Definition: Marker.C:80
Interface class for classes which interact with Postprocessors.
const VariableValue & getMarkerValue(std::string name)
This is used to get the values of other Markers.
Definition: Marker.C:93
unsigned int THREAD_ID
Definition: MooseTypes.h:79