www.mooseframework.org
OrientedBoxMarker.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 
18 #include "OrientedBoxMarker.h"
19 #include "OrientedBoxInterface.h"
20 
22 
23 template <>
26 {
29 
30  MooseEnum marker_states = Marker::markerStates();
31 
32  params.addRequiredParam<MooseEnum>(
33  "inside", marker_states, "How to mark elements inside the box.");
34  params.addRequiredParam<MooseEnum>(
35  "outside", marker_states, "How to mark elements outside the box.");
36 
37  params.addClassDescription(
38  "Marks inside and outside a box that can have arbitrary orientation and center point.");
39  return params;
40 }
41 
43  : Marker(parameters),
44  OrientedBoxInterface(parameters),
45  _inside((MarkerValue)(int)parameters.get<MooseEnum>("inside")),
46  _outside((MarkerValue)(int)parameters.get<MooseEnum>("outside"))
47 {
48 }
49 
55 {
56  Point centroid = _current_elem->centroid();
57 
58  if (containsPoint(centroid))
59  return _inside;
60 
61  return _outside;
62 }
bool containsPoint(const Point &point)
Test if the supplied point is within the defined oriented bounding box.
InputParameters validParams< Marker >()
Definition: Marker.C:20
Creates a box of specified width, length and height, with its center at specified position...
Definition: Marker.h:39
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
InputParameters validParams< OrientedBoxMarker >()
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
virtual MarkerValue computeElementMarker() override
Marks elements inside and outside the box.
OrientedBoxMarker(const InputParameters &parameters)
registerMooseObject("MooseApp", OrientedBoxMarker)
Creates a box of specified width, length and height, with its center at specified position...
InputParameters validParams< OrientedBoxInterface >()