https://mooseframework.inl.gov
ElementsAlongPlane.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 // MOOSE includes
11 #include "ElementsAlongPlane.h"
13 #include "MooseMesh.h"
14 
16 
19 {
21 
22  params.addRequiredParam<Point>("point", "Point in the plane");
23  params.addRequiredParam<Point>("normal", "Normal vector to the plane");
24  params.addClassDescription(
25  "Outputs the IDs of every element intersected by a user-defined plane");
26  return params;
27 }
28 
30  : GeneralVectorPostprocessor(parameters),
31  _p0(getParam<Point>("point")),
32  _normal(getParam<Point>("normal")),
33  _elem_ids(declareVector("elem_ids"))
34 {
35  _fe_problem.mesh().errorIfDistributedMesh("ElementsAlongPlane");
36 }
37 
38 void
40 {
41  _elem_ids.clear();
42 }
43 
44 void
46 {
47  std::vector<const Elem *> intersected_elems;
48 
50 
51  unsigned int num_elems = intersected_elems.size();
52 
53  _elem_ids.resize(num_elems);
54 
55  for (unsigned int i = 0; i < num_elems; i++)
56  _elem_ids[i] = intersected_elems[i]->id();
57 }
ElementsAlongPlane(const InputParameters &parameters)
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
void elementsIntersectedByPlane(const libMesh::Point &p0, const libMesh::Point &normal, const libMesh::MeshBase &mesh, std::vector< const libMesh::Elem *> &intersected_elems)
Find all of the elements intersected by a plane.
This class is here to combine the VectorPostprocessor interface and the base class VectorPostprocesso...
VectorPostprocessorValue & _elem_ids
The elements that intersect the plane.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const Point & _normal
Normal vector to the plane.
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 errorIfDistributedMesh(std::string name) const
Generate a unified error message if the underlying libMesh mesh is a DistributedMesh.
Definition: MooseMesh.C:3617
registerMooseObject("MooseApp", ElementsAlongPlane)
static InputParameters validParams()
static InputParameters validParams()
Get all of the elements that are intersected by a plane.
const Point & _p0
Point in the plane.
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
Definition: UserObject.h:211
virtual void execute() override
Find the elements.
virtual MooseMesh & mesh() override
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...