www.mooseframework.org
ElementLoopUserObject.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 #pragma once
11 
12 #include "GeneralUserObject.h"
13 #include "Coupleable.h"
14 #include "ScalarCoupleable.h"
15 #include "MooseVariableDependencyInterface.h"
16 #include "MooseVariable.h"
17 #include "SubProblem.h"
18 #include "NonlinearSystem.h"
19 #include "Assembly.h"
20 #include "FEProblem.h"
21 #include "MooseMesh.h"
22 
23 #include "libmesh/elem.h"
24 #include "libmesh/parallel_algebra.h"
25 
26 // Forward Declarations
28 
29 namespace libMesh
30 {
31 class Elem;
32 class QBase;
33 }
34 
35 template <>
36 InputParameters validParams<ElementLoopUserObject>();
37 
58 class ElementLoopUserObject : public GeneralUserObject,
59  public BlockRestrictable,
60  public Coupleable,
61  public MooseVariableDependencyInterface
62 {
63 public:
64  ElementLoopUserObject(const InputParameters & parameters);
65  ElementLoopUserObject(ElementLoopUserObject & x, Threads::split split);
66  virtual ~ElementLoopUserObject();
67 
68  virtual void initialize();
69  virtual void execute();
70  virtual void finalize();
71 
72  virtual void pre();
73  virtual void preElement(const Elem * elem);
74  virtual void onElement(const Elem * elem);
75  virtual void onBoundary(const Elem * elem, unsigned int side, BoundaryID bnd_id);
76  virtual void onInternalSide(const Elem * elem, unsigned int side);
77  virtual void onInterface(const Elem * elem, unsigned int side, BoundaryID bnd_id);
78  virtual void post();
79  virtual void subdomainChanged();
80  virtual bool keepGoing() { return true; }
81 
82  virtual void meshChanged();
83 
84  void join(const ElementLoopUserObject & /*y*/);
85 
86 protected:
87  virtual void caughtMooseException(MooseException & e);
88 
89  MooseMesh & _mesh;
90 
91  const Elem * _current_elem;
92  const Real & _current_elem_volume;
93  unsigned int _current_side;
94  const Elem * _current_neighbor;
95 
96  const MooseArray<Point> & _q_point;
97  const QBase * const & _qrule;
98  const MooseArray<Real> & _JxW;
99  const MooseArray<Real> & _coord;
100 
104  std::set<dof_id_type> _interface_elem_ids;
105 
107  SubdomainID _subdomain;
108 
110  SubdomainID _old_subdomain;
111 
112  virtual void computeElement();
113  virtual void computeBoundary();
114  virtual void computeInternalSide();
115  virtual void computeInterface();
116 };
ElementLoopUserObject::initialize
virtual void initialize()
Definition: ElementLoopUserObject.C:64
ElementLoopUserObject::execute
virtual void execute()
Definition: ElementLoopUserObject.C:75
ElementLoopUserObject
A base class that loops over elements and do things.
Definition: ElementLoopUserObject.h:58
ElementLoopUserObject::_mesh
MooseMesh & _mesh
Definition: ElementLoopUserObject.h:89
ElementLoopUserObject::computeInternalSide
virtual void computeInternalSide()
Definition: ElementLoopUserObject.C:243
ElementLoopUserObject::computeBoundary
virtual void computeBoundary()
Definition: ElementLoopUserObject.C:238
ElementLoopUserObject::_current_side
unsigned int _current_side
Definition: ElementLoopUserObject.h:93
libMesh
Definition: RANFSNormalMechanicalContact.h:24
ElementLoopUserObject::join
void join(const ElementLoopUserObject &)
Definition: ElementLoopUserObject.C:228
ElementLoopUserObject::_interface_elem_ids
std::set< dof_id_type > _interface_elem_ids
List of element IDs that are on the processor boundary and need to be send to other processors.
Definition: ElementLoopUserObject.h:104
ElementLoopUserObject::keepGoing
virtual bool keepGoing()
Definition: ElementLoopUserObject.h:80
ElementLoopUserObject::_coord
const MooseArray< Real > & _coord
Definition: ElementLoopUserObject.h:99
ElementLoopUserObject::computeInterface
virtual void computeInterface()
Definition: ElementLoopUserObject.C:248
ElementLoopUserObject::_subdomain
SubdomainID _subdomain
The subdomain for the current element.
Definition: ElementLoopUserObject.h:107
ElementLoopUserObject::preElement
virtual void preElement(const Elem *elem)
Definition: ElementLoopUserObject.C:69
validParams< ElementLoopUserObject >
InputParameters validParams< ElementLoopUserObject >()
Definition: ElementLoopUserObject.C:14
ElementLoopUserObject::onBoundary
virtual void onBoundary(const Elem *elem, unsigned int side, BoundaryID bnd_id)
Definition: ElementLoopUserObject.C:160
ElementLoopUserObject::_have_interface_elems
bool _have_interface_elems
true if we have cached interface elements, false if they need to be cached. We want to (re)cache only...
Definition: ElementLoopUserObject.h:102
ElementLoopUserObject::pre
virtual void pre()
Definition: ElementLoopUserObject.C:143
ElementLoopUserObject::onElement
virtual void onElement(const Elem *elem)
Definition: ElementLoopUserObject.C:153
ElementLoopUserObject::post
virtual void post()
Definition: ElementLoopUserObject.C:223
ElementLoopUserObject::onInternalSide
virtual void onInternalSide(const Elem *elem, unsigned int side)
Definition: ElementLoopUserObject.C:167
ElementLoopUserObject::_old_subdomain
SubdomainID _old_subdomain
The subdomain for the last element.
Definition: ElementLoopUserObject.h:110
ElementLoopUserObject::_current_elem_volume
const Real & _current_elem_volume
Definition: ElementLoopUserObject.h:92
ElementLoopUserObject::_q_point
const MooseArray< Point > & _q_point
Definition: ElementLoopUserObject.h:96
ElementLoopUserObject::caughtMooseException
virtual void caughtMooseException(MooseException &e)
Definition: ElementLoopUserObject.C:260
ElementLoopUserObject::onInterface
virtual void onInterface(const Elem *elem, unsigned int side, BoundaryID bnd_id)
Definition: ElementLoopUserObject.C:195
ElementLoopUserObject::subdomainChanged
virtual void subdomainChanged()
Definition: ElementLoopUserObject.C:148
ElementLoopUserObject::_JxW
const MooseArray< Real > & _JxW
Definition: ElementLoopUserObject.h:98
ElementLoopUserObject::computeElement
virtual void computeElement()
Definition: ElementLoopUserObject.C:233
ElementLoopUserObject::_qrule
const QBase *const & _qrule
Definition: ElementLoopUserObject.h:97
ElementLoopUserObject::_current_elem
const Elem * _current_elem
Definition: ElementLoopUserObject.h:91
ElementLoopUserObject::~ElementLoopUserObject
virtual ~ElementLoopUserObject()
Definition: ElementLoopUserObject.C:61
ElementLoopUserObject::finalize
virtual void finalize()
Definition: ElementLoopUserObject.C:137
ElementLoopUserObject::_current_neighbor
const Elem * _current_neighbor
Definition: ElementLoopUserObject.h:94
ElementLoopUserObject::ElementLoopUserObject
ElementLoopUserObject(const InputParameters &parameters)
Definition: ElementLoopUserObject.C:21
ElementLoopUserObject::meshChanged
virtual void meshChanged()
Definition: ElementLoopUserObject.C:253