Line data Source code
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 : #pragma once 11 : 12 : #include "ParallelUniqueId.h" 13 : #include "MooseTypes.h" 14 : #include "MooseException.h" 15 : #include "GeneralUserObject.h" 16 : 17 : typedef StoredRange<std::vector<GeneralUserObject *>::iterator, GeneralUserObject *> 18 : GeneralUserObjectRange; 19 : 20 : /** 21 : * This mutex is used to protect the creation of the strings used in the propogation 22 : * of the error messages. It's possible for a thread to have acquired the 23 : * commonly used mutex in the Threads namespace so this one is here to 24 : * avoid any deadlocking. 25 : */ 26 : static Threads::spin_mutex threaded_general_user_objects_mutex; 27 : 28 : /** 29 : * Thread to compute threaded general user objects 30 : * 31 : * This works on a range of thread IDs, so that we always compute all user objects for every 32 : * threaded copy. 33 : */ 34 : class ComputeThreadedGeneralUserObjectsThread 35 : { 36 : public: 37 : ComputeThreadedGeneralUserObjectsThread(FEProblemBase & fe_problem); 38 : ComputeThreadedGeneralUserObjectsThread(ComputeThreadedGeneralUserObjectsThread & x, 39 : Threads::split split); 40 : 41 : virtual ~ComputeThreadedGeneralUserObjectsThread(); 42 : 43 : void operator()(const GeneralUserObjectRange & range); 44 : 45 308 : void join(const ComputeThreadedGeneralUserObjectsThread & /*y*/) {} 46 : 47 : /** 48 : * Called if a MooseException is caught anywhere during the computation. 49 : * The single input parameter taken is a MooseException object. 50 : */ 51 : virtual void caughtMooseException(MooseException &); 52 : 53 : protected: 54 : /// Print information about the loop, mostly order of execution of objects 55 : void printGeneralExecutionInformation(const GeneralUserObjectRange & range) const; 56 : 57 : /// FEProblem running this thread 58 : FEProblemBase & _fe_problem; 59 : };