https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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");
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
38void
43
44void
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}
registerMooseObject("MooseApp", ElementsAlongPlane)
Get all of the elements that are intersected by a plane.
VectorPostprocessorValue & _elem_ids
The elements that intersect the plane.
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
static InputParameters validParams()
const Point & _p0
Point in the plane.
ElementsAlongPlane(const InputParameters &parameters)
const Point & _normal
Normal vector to the plane.
virtual void execute() override
Find the elements.
virtual MooseMesh & mesh() override
This class is here to combine the VectorPostprocessor interface and the base class VectorPostprocesso...
static InputParameters validParams()
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.
void errorIfDistributedMesh(std::string name) const
Generate a unified error message if the underlying libMesh mesh is a DistributedMesh.
Definition MooseMesh.C:3718
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
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.