https://mooseframework.inl.gov
OrientedBoxMarker.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 
18 #include "OrientedBoxMarker.h"
19 #include "OrientedBoxInterface.h"
20 
22 
25 {
28 
29  MooseEnum marker_states = Marker::markerStates();
30 
32  "inside", marker_states, "How to mark elements inside the box.");
34  "outside", marker_states, "How to mark elements outside the box.");
35 
36  params.addClassDescription(
37  "Marks inside and outside a box that can have arbitrary orientation and center point.");
38  return params;
39 }
40 
42  : Marker(parameters),
43  OrientedBoxInterface(parameters),
44  _inside((MarkerValue)(int)parameters.get<MooseEnum>("inside")),
45  _outside((MarkerValue)(int)parameters.get<MooseEnum>("outside"))
46 {
47 }
48 
54 {
55  Point centroid = _current_elem->vertex_average();
56 
57  if (containsPoint(centroid))
58  return _inside;
59 
60  return _outside;
61 }
bool containsPoint(const Point &point)
Test if the supplied point is within the defined oriented bounding box.
static InputParameters validParams()
Class constructor.
Creates a box of specified width, length and height, with its center at specified position...
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
Definition: Marker.h:41
const Elem *const & _current_elem
Pointer to the current element being considered in the marker element-based loop. ...
Definition: Marker.h:122
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:59
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:33
virtual MarkerValue computeElementMarker() override
Marks elements inside and outside the box.
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()
OrientedBoxMarker(const InputParameters &parameters)
registerMooseObject("MooseApp", OrientedBoxMarker)
Creates a box of specified width, length and height, with its center at specified position...
void ErrorVector unsigned int