www.mooseframework.org
BoxMarker.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 "BoxMarker.h"
11 
12 registerMooseObject("MooseApp", BoxMarker);
13 
14 template <>
17 {
20  "bottom_left", "The bottom left point (in x,y,z with spaces in-between).");
22  "top_right", "The bottom left point (in x,y,z with spaces in-between).");
23 
24  MooseEnum marker_states = Marker::markerStates();
25 
27  "inside", marker_states, "How to mark elements inside the box.");
29  "outside", marker_states, "How to mark elements outside the box.");
30 
31  params.addClassDescription(
32  "Marks the region inside and outside of a 'box' domain for refinement or coarsening.");
33  return params;
34 }
35 
37  : Marker(parameters),
38  _inside((MarkerValue)(int)parameters.get<MooseEnum>("inside")),
39  _outside((MarkerValue)(int)parameters.get<MooseEnum>("outside")),
40  _bounding_box(parameters.get<RealVectorValue>("bottom_left"),
41  parameters.get<RealVectorValue>("top_right"))
42 {
43 }
44 
47 {
48  RealVectorValue centroid = _current_elem->centroid();
49 
50  if (_bounding_box.contains_point(centroid))
51  return _inside;
52 
53  return _outside;
54 }
InputParameters validParams< Marker >()
Definition: Marker.C:20
registerMooseObject("MooseApp", BoxMarker)
MarkerValue _inside
Definition: BoxMarker.h:29
VectorValue< Real > RealVectorValue
Definition: Assembly.h:31
Definition: Marker.h:39
BoundingBox _bounding_box
Definition: BoxMarker.h:32
const Elem *const & _current_elem
Definition: Marker.h:115
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:55
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...
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
MarkerValue _outside
Definition: BoxMarker.h:30
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...
BoxMarker(const InputParameters &parameters)
Definition: BoxMarker.C:36
InputParameters validParams< BoxMarker >()
Definition: BoxMarker.C:16
virtual MarkerValue computeElementMarker() override
Definition: BoxMarker.C:46