www.mooseframework.org
ComboMarker.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 "ComboMarker.h"
11 
12 registerMooseObject("MooseApp", ComboMarker);
13 
16 {
18  params.addRequiredParam<std::vector<MarkerName>>(
19  "markers", "A list of marker names to combine into a single marker.");
20  params.addClassDescription("A marker that converts many markers into a single marker by "
21  "considering the maximum value of the listed markers (i.e., "
22  "refinement takes precedent).");
23  return params;
24 }
25 
27  : Marker(parameters), _names(parameters.get<std::vector<MarkerName>>("markers"))
28 {
29  for (const auto & marker_name : _names)
30  _markers.push_back(&getMarkerValue(marker_name));
31 }
32 
35 {
36  // We start with DONT_MARK because it's -1
37  MarkerValue marker_value = DONT_MARK;
38 
39  for (const auto & var : _markers)
40  marker_value = std::max(marker_value, static_cast<MarkerValue>((*var)[0]));
41 
42  return marker_value;
43 }
virtual MarkerValue computeElementMarker() override
Definition: ComboMarker.C:34
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:1147
Definition: Marker.h:35
registerMooseObject("MooseApp", ComboMarker)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
MarkerValue
This mirrors the main refinement flag values in libMesh in Elem::RefinementState but adds "dont_mark"...
Definition: Marker.h:53
Combines multiple marker fields.
Definition: ComboMarker.h:17
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
auto max(const L &left, const R &right)
std::vector< MarkerName > _names
Definition: ComboMarker.h:27
ComboMarker(const InputParameters &parameters)
Definition: ComboMarker.C:26
std::vector< const VariableValue * > _markers
Definition: ComboMarker.h:29
const MooseArray< Real > & getMarkerValue(std::string name)
This is used to get the values of other Markers.
Definition: Marker.C:83
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
static InputParameters validParams()
Definition: Marker.C:19
static InputParameters validParams()
Definition: ComboMarker.C:15