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 
24 
27 {
30 
31  MooseEnum marker_states = Marker::markerStates();
32 
34  "inside", marker_states, "How to mark elements inside the box.");
36  "outside", marker_states, "How to mark elements outside the box.");
37 
38  params.addClassDescription(
39  "Marks inside and outside a box that can have arbitrary orientation and center point.");
40  return params;
41 }
42 
44  : Marker(parameters),
45  OrientedBoxInterface(parameters),
46  _inside((MarkerValue)(int)parameters.get<MooseEnum>("inside")),
47  _outside((MarkerValue)(int)parameters.get<MooseEnum>("outside"))
48 {
49 }
50 
56 {
57  Point centroid = _current_elem->centroid();
58 
59  if (containsPoint(centroid))
60  return _inside;
61 
62  return _outside;
63 }
OrientedBoxInterface::containsPoint
bool containsPoint(const Point &point)
Test if the supplied point is within the defined oriented bounding box.
Definition: OrientedBoxInterface.C:83
OrientedBoxMarker
Creates a box of specified width, length and height, with its center at specified position,...
Definition: OrientedBoxMarker.h:29
OrientedBoxMarker::OrientedBoxMarker
OrientedBoxMarker(const InputParameters &parameters)
Definition: OrientedBoxMarker.C:43
OrientedBoxMarker::_inside
MarkerValue _inside
Definition: OrientedBoxMarker.h:39
Marker::markerStates
static MooseEnum markerStates()
Helper function for getting the valid refinement flag states a marker can use as a MooseEnum.
Definition: Marker.C:63
MooseEnum
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:31
defineLegacyParams
defineLegacyParams(OrientedBoxMarker)
OrientedBoxInterface
Definition: OrientedBoxInterface.h:43
OrientedBoxMarker::_outside
MarkerValue _outside
Definition: OrientedBoxMarker.h:40
InputParameters
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Definition: InputParameters.h:53
Marker::validParams
static InputParameters validParams()
Definition: Marker.C:21
Marker::MarkerValue
MarkerValue
This mirrors the main refinement flag values in libMesh in Elem::RefinementState but adds "dont_mark"...
Definition: Marker.h:57
InputParameters::addClassDescription
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.
Definition: InputParameters.C:70
OrientedBoxMarker::validParams
static InputParameters validParams()
Definition: OrientedBoxMarker.C:26
OrientedBoxInterface.h
Marker::_current_elem
const Elem *const & _current_elem
Definition: Marker.h:117
OrientedBoxInterface::validParams
static InputParameters validParams()
Class constructor.
Definition: OrientedBoxInterface.C:21
registerMooseObject
registerMooseObject("MooseApp", OrientedBoxMarker)
Creates a box of specified width, length and height, with its center at specified position,...
OrientedBoxMarker.h
Marker
Definition: Marker.h:39
InputParameters::addRequiredParam
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...
Definition: InputParameters.h:1176
OrientedBoxMarker::computeElementMarker
virtual MarkerValue computeElementMarker() override
Marks elements inside and outside the box.
Definition: OrientedBoxMarker.C:55