https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
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
35 : MooseObject(parameters),
37 SetupInterface(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
69void
75
76ErrorVector &
77Marker::getErrorVector(std::string indicator)
78{
79 return _adaptivity.getErrorVector(indicator);
80}
81
82const MooseArray<Real> &
83Marker::getMarkerValue(std::string name)
84{
85 _depend.insert(name);
86 return _sys.getFieldVariable<Real>(_tid, name).dofValues();
87}
88
89bool
91{
92 return true;
93}
94
95void
99
100const std::set<std::string> &
102{
103 return _depend;
104}
105
106const std::set<std::string> &
108{
109 return _supplied;
110}
unsigned int THREAD_ID
Definition MooseTypes.h:237
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:390
An interface that restricts an object to subdomains via the 'blocks' input parameter.
static InputParameters validParams()
Interface for sorting dependent vectors of objects.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void suppressParameter(const std::string &name)
This method suppresses an inherited parameter so that it isn'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.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
bool isActive() const
Definition Marker.C:90
virtual MarkerValue computeElementMarker()=0
SystemBase & _sys
Definition Marker.h:113
static InputParameters validParams()
Definition Marker.C:19
std::set< std::string > _supplied
Definition Marker.h:129
virtual const std::set< std::string > & getRequestedItems() override
Return a set containing the names of items requested by the object.
Definition Marker.C:101
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
MooseVariable & _field_var
Reference to this marker as a variable.
Definition Marker.h:120
THREAD_ID _tid
Definition Marker.h:115
std::set< std::string > _depend
Depend Markers.
Definition Marker.h:128
const MooseArray< Real > & getMarkerValue(std::string name)
This is used to get the values of other Markers.
Definition Marker.C:83
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 MooseEnum markerStates()
Helper function for getting the valid refinement flag states a marker can use as a MooseEnum.
Definition Marker.C:62
virtual void computeMarker()
Computes and sets the value of the refinement flag.
Definition Marker.C:70
Marker(const InputParameters &parameters)
Definition Marker.C:34
virtual void markerSetup()
Is called before any element looping is started so any "global" computation can be done.
Definition Marker.C:96
Adaptivity & _adaptivity
Definition Marker.h:112
Interface for notifications that the mesh has changed.
forward declarations
Definition MooseArray.h:18
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
static InputParameters validParams()
Definition MooseObject.C:25
void addMooseVariableDependency(MooseVariableFieldBase *var)
Call this function to add the passed in MooseVariableFieldBase as a variable that this object depends...
virtual void setNodalValue(const OutputType &value, unsigned int idx=0) override
A class to provide an common interface to objects requiring "outputs" option.
static InputParameters validParams()
Interface class for classes which interact with Postprocessors.
A class for creating restricted objects.
Definition Restartable.h:29
Generic class for solving transient nonlinear problems.
Definition SubProblem.h:79
Base class for a system (of equations)
Definition SystemBase.h:87
MooseVariableFE< T > & getFieldVariable(THREAD_ID tid, const std::string &var_name)
Gets a reference to a variable of with specified name.
Definition SystemBase.C:112
Interface for objects that need to use UserObjects.
MeshBase & mesh