www.mooseframework.org
AutoPositionsMultiApp.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 "AutoPositionsMultiApp.h"
17 #include "MooseMesh.h"
18 #include "FEProblem.h"
19 
20 template <>
23 {
25 
27 
28  params.suppressParameter<std::vector<Point>>("positions");
29  params.suppressParameter<std::vector<FileName>>("positions_file");
30 
31  return params;
32 }
33 
35  : TransientMultiApp(parameters), BoundaryRestrictable(this, true) // true for applying to nodesets
36 {
37 }
38 
39 void
41 {
42  MooseMesh & master_mesh = _fe_problem.mesh();
43 
44  const std::set<BoundaryID> & bids = boundaryIDs();
45 
46  for (const auto & boundary_id : bids)
47  {
48  // Grab the nodes on the boundary ID and add a Sub-App at each one.
49  const std::vector<dof_id_type> & boundary_node_ids = master_mesh.getNodeList(boundary_id);
50 
51  for (const auto & boundary_node_id : boundary_node_ids)
52  {
53  Node & node = master_mesh.nodeRef(boundary_node_id);
54 
55  _positions.push_back(node);
56  }
57  }
58 }
virtual const std::set< BoundaryID > & boundaryIDs() const
Return the boundary IDs for this object.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
/class BoundaryRestrictable /brief Provides functionality for limiting the object to certain boundary...
MultiApp Implementation for Transient Apps.
FEProblemBase & _fe_problem
The FEProblemBase this MultiApp is part of.
Definition: MultiApp.h:305
void suppressParameter(const std::string &name)
This method suppresses an inherited parameter so that it isn&#39;t required or valid in the derived class...
AutoPositionsMultiApp(const InputParameters &parameters)
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:74
virtual void fillPositions() override
must fill in _positions with the positions of the sub-aps
InputParameters validParams< AutoPositionsMultiApp >()
InputParameters validParams< BoundaryRestrictable >()
virtual const Node & nodeRef(const dof_id_type i) const
Definition: MooseMesh.C:437
virtual MooseMesh & mesh() override
std::vector< Point > _positions
The positions of all of the apps.
Definition: MultiApp.h:311
const std::vector< dof_id_type > & getNodeList(boundary_id_type nodeset_id) const
Return a writable reference to a vector of node IDs that belong to nodeset_id.
Definition: MooseMesh.C:2435
InputParameters validParams< TransientMultiApp >()