https://mooseframework.inl.gov
Marker.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
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 
20 {
23  params += OutputInterface::validParams();
24 
25  // use of displaced meshes with markers is not supported
26  params.set<bool>("use_displaced_mesh") = false;
27  params.suppressParameter<bool>("use_displaced_mesh");
28 
29  params.registerBase("Marker");
30 
31  return params;
32 }
33 
34 Marker::Marker(const InputParameters & parameters)
35  : MooseObject(parameters),
36  BlockRestrictable(this),
37  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, 0)),
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.getFieldVariable<Real>(_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 }
std::string name(const ElemQuality q)
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:113
THREAD_ID _tid
Definition: Marker.h:115
A class for creating restricted objects.
Definition: Restartable.h:28
static InputParameters validParams()
virtual void setNodalValue(const OutputType &value, unsigned int idx=0) override
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
Definition: MooseUtils.h:1155
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.
MeshBase & mesh
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:129
Base class for a system (of equations)
Definition: SystemBase.h:84
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Adaptivity & _adaptivity
Definition: Marker.h:112
virtual const std::set< std::string > & getSuppliedItems() override
Return a set containing the names of items owned by the object.
Definition: Marker.C:107
static InputParameters validParams()
void suppressParameter(const std::string &name)
This method suppresses an inherited parameter so that it isn&#39;t required or valid in the derived class...
void registerBase(const std::string &value)
This method must be called from every base "Moose System" to create linkage with the Action System...
const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:99
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:27
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:33
Interface for objects that need to use UserObjects.
std::set< std::string > _depend
Depend Markers.
Definition: Marker.h:128
virtual MarkerValue computeElementMarker()=0
MooseVariable & _field_var
Reference to this marker as a variable.
Definition: Marker.h:120
Marker(const InputParameters &parameters)
Definition: Marker.C:34
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool isActive() const
Definition: Marker.C:90
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
libMesh::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:363
MooseVariableFE< T > & getFieldVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
Definition: SystemBase.C:111
const MooseArray< Real > & getMarkerValue(std::string name)
This is used to get the values of other Markers.
Definition: Marker.C:83
An interface that restricts an object to subdomains via the &#39;blocks&#39; input parameter.
Interface for sorting dependent vectors of objects.
static InputParameters validParams()
Definition: Marker.C:19
static InputParameters validParams()
Definition: MooseObject.C:25
virtual void computeMarker()
Computes and sets the value of the refinement flag.
Definition: Marker.C:70
Interface class for classes which interact with Postprocessors.
unsigned int THREAD_ID
Definition: MooseTypes.h:209