Line data Source code
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 : /** 11 : * Creates a box of specified width, length and height, 12 : * with its center at specified position, 13 : * and with the direction along the width direction specified, 14 : * and with the direction along the length direction specified. 15 : * Then elements are marked as inside or outside this box 16 : */ 17 : 18 : #include "OrientedBoxMarker.h" 19 : #include "OrientedBoxInterface.h" 20 : 21 : registerMooseObject("MooseApp", OrientedBoxMarker); 22 : 23 : InputParameters 24 14292 : OrientedBoxMarker::validParams() 25 : { 26 14292 : InputParameters params = Marker::validParams(); 27 14292 : params += OrientedBoxInterface::validParams(); 28 : 29 14292 : MooseEnum marker_states = Marker::markerStates(); 30 : 31 14292 : params.addRequiredParam<MooseEnum>( 32 : "inside", marker_states, "How to mark elements inside the box."); 33 14292 : params.addRequiredParam<MooseEnum>( 34 : "outside", marker_states, "How to mark elements outside the box."); 35 : 36 14292 : params.addClassDescription( 37 : "Marks inside and outside a box that can have arbitrary orientation and center point."); 38 28584 : return params; 39 14292 : } 40 : 41 14 : OrientedBoxMarker::OrientedBoxMarker(const InputParameters & parameters) 42 : : Marker(parameters), 43 : OrientedBoxInterface(parameters), 44 14 : _inside((MarkerValue)(int)parameters.get<MooseEnum>("inside")), 45 28 : _outside((MarkerValue)(int)parameters.get<MooseEnum>("outside")) 46 : { 47 14 : } 48 : 49 : /** 50 : * Marks elements inside and outside the box 51 : */ 52 : Marker::MarkerValue 53 12960 : OrientedBoxMarker::computeElementMarker() 54 : { 55 12960 : Point centroid = _current_elem->vertex_average(); 56 : 57 12960 : if (containsPoint(centroid)) 58 1836 : return _inside; 59 : 60 11124 : return _outside; 61 : }