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 14290 : OrientedBoxMarker::validParams() 25 : { 26 14290 : InputParameters params = Marker::validParams(); 27 14290 : params += OrientedBoxInterface::validParams(); 28 : 29 14290 : MooseEnum marker_states = Marker::markerStates(); 30 : 31 14290 : params.addRequiredParam<MooseEnum>( 32 : "inside", marker_states, "How to mark elements inside the box."); 33 14290 : params.addRequiredParam<MooseEnum>( 34 : "outside", marker_states, "How to mark elements outside the box."); 35 : 36 14290 : params.addClassDescription( 37 : "Marks inside and outside a box that can have arbitrary orientation and center point."); 38 28580 : return params; 39 14290 : } 40 : 41 13 : OrientedBoxMarker::OrientedBoxMarker(const InputParameters & parameters) 42 : : Marker(parameters), 43 : OrientedBoxInterface(parameters), 44 13 : _inside((MarkerValue)(int)parameters.get<MooseEnum>("inside")), 45 26 : _outside((MarkerValue)(int)parameters.get<MooseEnum>("outside")) 46 : { 47 13 : } 48 : 49 : /** 50 : * Marks elements inside and outside the box 51 : */ 52 : Marker::MarkerValue 53 11520 : OrientedBoxMarker::computeElementMarker() 54 : { 55 11520 : Point centroid = _current_elem->vertex_average(); 56 : 57 11520 : if (containsPoint(centroid)) 58 1632 : return _inside; 59 : 60 9888 : return _outside; 61 : }