www.mooseframework.org
ElementsAlongPlane.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 // MOOSE includes
16 #include "ElementsAlongPlane.h"
18 #include "MooseMesh.h"
19 
20 template <>
23 {
25 
26  params.addRequiredParam<Point>("point", "Point in the plane");
27  params.addRequiredParam<Point>("normal", "Normal vector to the plane");
28  return params;
29 }
30 
32  : GeneralVectorPostprocessor(parameters),
33  _p0(getParam<Point>("point")),
34  _normal(getParam<Point>("normal")),
35  _elem_ids(declareVector("elem_ids"))
36 {
37 }
38 
39 void
41 {
42  _elem_ids.clear();
43 }
44 
45 void
47 {
48  std::vector<const Elem *> intersected_elems;
49 
51 
52  unsigned int num_elems = intersected_elems.size();
53 
54  _elem_ids.resize(num_elems);
55 
56  for (unsigned int i = 0; i < num_elems; i++)
57  _elem_ids[i] = intersected_elems[i]->id();
58 }
ElementsAlongPlane(const InputParameters &parameters)
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
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.
InputParameters validParams< ElementsAlongPlane >()
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...
InputParameters validParams< GeneralVectorPostprocessor >()
void elementsIntersectedByPlane(const Point &p0, const Point &normal, const MeshBase &mesh, std::vector< const Elem * > &intersected_elems)
Find all of the elements 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:149
virtual void execute() override
Find the elements.
virtual MooseMesh & mesh() override