https://mooseframework.inl.gov
Loading...
Searching...
No Matches
BoxMarker.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
10#include "BoxMarker.h"
11#include "MooseUtils.h"
12
14
17{
19 params.addRequiredParam<RealVectorValue>(
20 "bottom_left", "The bottom left point (in x,y,z with spaces in-between).");
21 params.addRequiredParam<RealVectorValue>(
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
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(parameters.get<MooseEnum>("inside").getEnum<MarkerValue>()),
39 _outside(parameters.get<MooseEnum>("outside").getEnum<MarkerValue>()),
40 _bounding_box(MooseUtils::buildBoundingBox(parameters.get<RealVectorValue>("bottom_left"),
41 parameters.get<RealVectorValue>("top_right")))
42{
43}
44
47{
48 RealVectorValue centroid = _current_elem->vertex_average();
49
50 if (_bounding_box.contains_point(centroid))
51 return _inside;
52
53 return _outside;
54}
registerMooseObject("MooseApp", BoxMarker)
BoundingBox _bounding_box
Definition BoxMarker.h:29
MarkerValue _inside
Definition BoxMarker.h:26
BoxMarker(const InputParameters &parameters)
Definition BoxMarker.C:36
static InputParameters validParams()
Definition BoxMarker.C:16
virtual MarkerValue computeElementMarker() override
Definition BoxMarker.C:46
MarkerValue _outside
Definition BoxMarker.h:27
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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...
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
const Elem *const & _current_elem
Pointer to the current element being considered in the marker element-based loop.
Definition Marker.h:122
MarkerValue
This mirrors the main refinement flag values in libMesh in Elem::RefinementState but adds "dont_mark"...
Definition Marker.h:60
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:55