www.mooseframework.org
Marker.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #include "Marker.h"
11 
12 #include "Assembly.h"
13 #include "FEProblem.h"
14 #include "MooseMesh.h"
15 #include "MooseVariableFE.h"
16 #include "SystemBase.h"
17 
18 template <>
21 {
24  params += validParams<OutputInterface>();
25 
26  // use of displaced meshes with markers is not supported
27  params.set<bool>("use_displaced_mesh") = false;
28  params.suppressParameter<bool>("use_displaced_mesh");
29 
30  params.registerBase("Marker");
31 
32  return params;
33 }
34 
35 Marker::Marker(const InputParameters & parameters)
36  : MooseObject(parameters),
37  BlockRestrictable(this),
38  SetupInterface(this),
40  UserObjectInterface(this),
41  Restartable(this, "Markers"),
43  MeshChangedInterface(parameters),
44  OutputInterface(parameters),
45  _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
46  _fe_problem(*getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")),
47  _adaptivity(_fe_problem.adaptivity()),
48  _sys(*getCheckedPointerParam<SystemBase *>("_sys")),
49  _tid(parameters.get<THREAD_ID>("_tid")),
50  _assembly(_subproblem.assembly(_tid)),
51  _field_var(_subproblem.getStandardVariable(_tid, name())),
52  _current_elem(_field_var.currentElem()),
53 
54  _mesh(_subproblem.mesh())
55 {
56  _supplied.insert(name());
57 
59 }
60 
63 {
64  MooseEnum marker_states("DONT_MARK=-1 COARSEN DO_NOTHING REFINE");
65 
66  return marker_states;
67 }
68 
69 void
71 {
72  int mark = computeElementMarker();
74 }
75 
76 ErrorVector &
77 Marker::getErrorVector(std::string indicator)
78 {
79  return _adaptivity.getErrorVector(indicator);
80 }
81 
82 const MooseArray<Real> &
83 Marker::getMarkerValue(std::string name)
84 {
85  _depend.insert(name);
86  return _sys.getVariable(_tid, name).dofValues();
87 }
88 
89 bool
91 {
92  return true;
93 }
94 
95 void
97 {
98 }
99 
100 const std::set<std::string> &
102 {
103  return _depend;
104 }
105 
106 const std::set<std::string> &
108 {
109  return _supplied;
110 }
virtual const std::set< std::string > & getRequestedItems() override
Return a set containing the names of items requested by the object.
Definition: Marker.C:101
SystemBase & _sys
Definition: Marker.h:108
THREAD_ID _tid
Definition: Marker.h:110
A class for creating restricted objects.
Definition: Restartable.h:29
InputParameters validParams< BlockRestrictable >()
InputParameters validParams< OutputInterface >()
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
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...
virtual void markerSetup()
Is called before any element looping is started so any "global" computation can be done...
Definition: Marker.C:96
std::set< std::string > _supplied
Definition: Marker.h:121
Base class for a system (of equations)
Definition: SystemBase.h:92
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Adaptivity & _adaptivity
Definition: Marker.h:107
void addMooseVariableDependency(MooseVariableFEBase *var)
Call this function to add the passed in MooseVariableFEBase as a variable that this object depends on...
virtual const std::set< std::string > & getSuppliedItems() override
Return a set containing the names of items owned by the object.
Definition: Marker.C:107
MooseVariableFEBase & getVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:105
Interface for notifications that the mesh has changed.
virtual const MooseArray< Number > & dofValues()=0
Returns dof solution on element.
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:42
ErrorVector & getErrorVector(std::string indicator)
Get an ErrorVector that will be filled up with values corresponding to the indicator passed in...
Definition: Marker.C:77
static MooseEnum markerStates()
Helper function for getting the valid refinement flag states a marker can use as a MooseEnum...
Definition: Marker.C:62
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
InputParameters validParams< Marker >()
Definition: Marker.C:20
Interface for objects that need to use UserObjects.
std::set< std::string > _depend
Depend Markers.
Definition: Marker.h:120
virtual MarkerValue computeElementMarker()=0
InputParameters validParams< MooseObject >()
Definition: MooseObject.C:25
MooseVariable & _field_var
Definition: Marker.h:114
Marker(const InputParameters &parameters)
Definition: Marker.C:35
bool isActive() const
Definition: Marker.C:90
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:59
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:279
const MooseArray< Real > & getMarkerValue(std::string name)
This is used to get the values of other Markers.
Definition: Marker.C:83
void setNodalValue(OutputType value, unsigned int idx=0)
An interface that restricts an object to subdomains via the &#39;blocks&#39; input parameter.
Interface for sorting dependent vectors of objects.
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:59
virtual void computeMarker()
Definition: Marker.C:70
Interface class for classes which interact with Postprocessors.
unsigned int THREAD_ID
Definition: MooseTypes.h:161