www.mooseframework.org
ThreadedElementLoop.h
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 #ifndef THREADEDELEMENTLOOP_H
16 #define THREADEDELEMENTLOOP_H
17 
18 #include "ParallelUniqueId.h"
19 #include "FEProblemBase.h"
20 #include "Assembly.h"
22 
23 // Forward declarations
24 class SystemBase;
25 
33 static Threads::spin_mutex threaded_element_mutex;
34 
38 template <typename RangeType>
40 {
41 public:
43 
44  ThreadedElementLoop(ThreadedElementLoop & x, Threads::split split);
45 
46  virtual ~ThreadedElementLoop();
47 
48  virtual void caughtMooseException(MooseException & e) override;
49 
50  virtual bool keepGoing() override { return !_fe_problem.hasException(); }
51 
52  virtual void preElement(const Elem * elem) override;
53 
54  virtual void preInternalSide(const Elem * elem, unsigned int side) override;
55 
56  virtual void neighborSubdomainChanged() override;
57 
58 protected:
60 };
61 
62 template <typename RangeType>
64  : ThreadedElementLoopBase<RangeType>(fe_problem.mesh()), _fe_problem(fe_problem)
65 {
66 }
67 
68 template <typename RangeType>
70  Threads::split /*split*/)
72 {
73 }
74 
75 template <typename RangeType>
77 {
78 }
79 
80 template <typename RangeType>
81 void
83 {
84  Threads::spin_mutex::scoped_lock lock(threaded_element_mutex);
85 
86  std::string what(e.what());
88 }
89 
90 template <typename RangeType>
91 void
93 {
95 }
96 
97 template <typename RangeType>
98 void
99 ThreadedElementLoop<RangeType>::preInternalSide(const Elem * el, unsigned int side)
100 {
102 }
103 
104 template <typename RangeType>
105 void
107 {
110 }
111 
112 #endif // THREADEDELEMENTLOOP_H
Base class for assembly-like calculations.
FEProblemBase & _fe_problem
virtual void neighborSubdomainChanged() override
Called every time the neighbor subdomain changes (i.e.
virtual void setException(const std::string &message)
Set an exception.
virtual void preInternalSide(const Elem *elem, unsigned int side) override
Called before evaluations on an element internal side.
virtual void preElement(const Elem *elem) override
Called before the element assembly.
static PetscErrorCode Vec x
Base class for a system (of equations)
Definition: SystemBase.h:91
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual const char * what() const
Get out the error message.
virtual bool keepGoing() override
Whether or not the loop should continue.
ThreadedElementLoop(FEProblemBase &feproblem)
Provides a way for users to bail out of the current solve.
virtual void neighborSubdomainSetup(SubdomainID subdomain, THREAD_ID tid)
virtual void setCurrentSubdomainID(const Elem *elem, THREAD_ID tid) override
Base class for assembly-like calculations.
static Threads::spin_mutex threaded_element_mutex
This mutex is used by all derived classes of the ThreadedElementLoop.
virtual void caughtMooseException(MooseException &e) override
Called if a MooseException is caught anywhere during the computation.
virtual bool hasException()
Whether or not an exception has occurred.
virtual void setNeighborSubdomainID(const Elem *elem, unsigned int side, THREAD_ID tid) override