Skip to content

Commit

Permalink
Get rid of System from ThreadedElementLoop
Browse files Browse the repository at this point in the history
ThreadedElementLoop does not necessarily depend on
System.

Refs idaholab#7398 idaholab#7654
  • Loading branch information
fdkong committed Sep 20, 2016
1 parent a60ccdf commit fc893e3
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 21 deletions.
9 changes: 3 additions & 6 deletions framework/include/base/ThreadedElementLoop.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ template<typename RangeType>
class ThreadedElementLoop : public ThreadedElementLoopBase<RangeType>
{
public:
ThreadedElementLoop(FEProblem & feproblem, SystemBase & system);
ThreadedElementLoop(FEProblem & feproblem);

ThreadedElementLoop(ThreadedElementLoop & x, Threads::split split);

Expand All @@ -48,23 +48,20 @@ class ThreadedElementLoop : public ThreadedElementLoopBase<RangeType>

virtual bool keepGoing() override { return !_fe_problem.hasException(); }
protected:
SystemBase & _system;
FEProblem & _fe_problem;
};


template<typename RangeType>
ThreadedElementLoop<RangeType>::ThreadedElementLoop(FEProblem & fe_problem, SystemBase & system) :
ThreadedElementLoopBase<RangeType>(system.mesh()),
_system(system),
ThreadedElementLoop<RangeType>::ThreadedElementLoop(FEProblem & fe_problem) :
ThreadedElementLoopBase<RangeType>(fe_problem.mesh()),
_fe_problem(fe_problem)
{
}

template<typename RangeType>
ThreadedElementLoop<RangeType>::ThreadedElementLoop(ThreadedElementLoop & x, Threads::split /*split*/) :
ThreadedElementLoopBase<RangeType>(x),
_system(x._system),
_fe_problem(x._fe_problem)
{
}
Expand Down
2 changes: 1 addition & 1 deletion framework/src/base/ComputeDiracThread.C
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
ComputeDiracThread::ComputeDiracThread(FEProblem & feproblem,
NonlinearSystem & system,
SparseMatrix<Number> * jacobian) :
ThreadedElementLoop<DistElemRange>(feproblem, system),
ThreadedElementLoop<DistElemRange>(feproblem),
_jacobian(jacobian),
_sys(system),
_dirac_kernels(_sys.getDiracKernelWarehouse())
Expand Down
6 changes: 3 additions & 3 deletions framework/src/base/ComputeElemAuxVarsThread.C
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


ComputeElemAuxVarsThread::ComputeElemAuxVarsThread(FEProblem & problem, AuxiliarySystem & sys, const MooseObjectWarehouse<AuxKernel> & storage, bool need_materials) :
ThreadedElementLoop<ConstElemRange>(problem, sys),
ThreadedElementLoop<ConstElemRange>(problem),
_aux_sys(sys),
_aux_kernels(storage),
_need_materials(need_materials)
Expand All @@ -30,7 +30,7 @@ ComputeElemAuxVarsThread::ComputeElemAuxVarsThread(FEProblem & problem, Auxiliar

// Splitting Constructor
ComputeElemAuxVarsThread::ComputeElemAuxVarsThread(ComputeElemAuxVarsThread & x, Threads::split /*split*/) :
ThreadedElementLoop<ConstElemRange>(x._fe_problem, x._system),
ThreadedElementLoop<ConstElemRange>(x._fe_problem),
_aux_sys(x._aux_sys),
_aux_kernels(x._aux_kernels),
_need_materials(x._need_materials)
Expand Down Expand Up @@ -93,7 +93,7 @@ ComputeElemAuxVarsThread::onElement(const Elem * elem)
for (const auto & it : _aux_sys._elem_vars[_tid])
{
MooseVariable * var = it.second;
var->insert(_system.solution());
var->insert(_aux_sys.solution());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion framework/src/base/ComputeElemDampingThread.C
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

ComputeElemDampingThread::ComputeElemDampingThread(FEProblem & feproblem,
NonlinearSystem & sys) :
ThreadedElementLoop<ConstElemRange>(feproblem, sys),
ThreadedElementLoop<ConstElemRange>(feproblem),
_damping(1.0),
_nl(sys),
_element_dampers(sys.getElementDamperWarehouse())
Expand Down
2 changes: 1 addition & 1 deletion framework/src/base/ComputeIndicatorThread.C
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
ComputeIndicatorThread::ComputeIndicatorThread(FEProblem & fe_problem,
AuxiliarySystem & sys,
bool finalize) :
ThreadedElementLoop<ConstElemRange>(fe_problem, sys),
ThreadedElementLoop<ConstElemRange>(fe_problem),
_fe_problem(fe_problem),
_aux_sys(sys),
_indicator_whs(_fe_problem.getIndicatorWarehouse()),
Expand Down
2 changes: 1 addition & 1 deletion framework/src/base/ComputeJacobianThread.C
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "libmesh/threads.h"

ComputeJacobianThread::ComputeJacobianThread(FEProblem & fe_problem, NonlinearSystem & sys, SparseMatrix<Number> & jacobian) :
ThreadedElementLoop<ConstElemRange>(fe_problem, sys),
ThreadedElementLoop<ConstElemRange>(fe_problem),
_jacobian(jacobian),
_sys(sys),
_num_cached(0),
Expand Down
2 changes: 1 addition & 1 deletion framework/src/base/ComputeMarkerThread.C
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "libmesh/threads.h"

ComputeMarkerThread::ComputeMarkerThread(FEProblem & fe_problem, AuxiliarySystem & sys) :
ThreadedElementLoop<ConstElemRange>(fe_problem, sys),
ThreadedElementLoop<ConstElemRange>(fe_problem),
_fe_problem(fe_problem),
_aux_sys(sys),
_marker_whs(_fe_problem.getMarkerWarehouse())
Expand Down
2 changes: 1 addition & 1 deletion framework/src/base/ComputeMaterialsObjectThread.C
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ComputeMaterialsObjectThread::ComputeMaterialsObjectThread(FEProblem & fe_proble
MaterialPropertyStorage & material_props,
MaterialPropertyStorage & bnd_material_props,
std::vector<Assembly *> & assembly) :
ThreadedElementLoop<ConstElemRange>(fe_problem, sys),
ThreadedElementLoop<ConstElemRange>(fe_problem),
_fe_problem(fe_problem),
_sys(sys),
_material_data(material_data),
Expand Down
2 changes: 1 addition & 1 deletion framework/src/base/ComputeResidualThread.C
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "libmesh/threads.h"

ComputeResidualThread::ComputeResidualThread(FEProblem & fe_problem, NonlinearSystem & sys, Moose::KernelType type) :
ThreadedElementLoop<ConstElemRange>(fe_problem, sys),
ThreadedElementLoop<ConstElemRange>(fe_problem),
_sys(sys),
_kernel_type(type),
_num_cached(0),
Expand Down
4 changes: 2 additions & 2 deletions framework/src/base/ComputeUserObjectsThread.C
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ComputeUserObjectsThread::ComputeUserObjectsThread(FEProblem & problem,
const MooseObjectWarehouse<ElementUserObject> & elemental_user_objects,
const MooseObjectWarehouse<SideUserObject> & side_user_objects,
const MooseObjectWarehouse<InternalSideUserObject> & internal_side_user_objects) :
ThreadedElementLoop<ConstElemRange>(problem, sys),
ThreadedElementLoop<ConstElemRange>(problem),
_soln(*sys.currentSolution()),
_elemental_user_objects(elemental_user_objects),
_side_user_objects(side_user_objects),
Expand All @@ -39,7 +39,7 @@ ComputeUserObjectsThread::ComputeUserObjectsThread(FEProblem & problem,

// Splitting Constructor
ComputeUserObjectsThread::ComputeUserObjectsThread(ComputeUserObjectsThread & x, Threads::split) :
ThreadedElementLoop<ConstElemRange>(x._fe_problem, x._system),
ThreadedElementLoop<ConstElemRange>(x._fe_problem),
_soln(x._soln),
_elemental_user_objects(x._elemental_user_objects),
_side_user_objects(x._side_user_objects),
Expand Down
2 changes: 1 addition & 1 deletion framework/src/base/FlagElementsThread.C
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ FlagElementsThread::FlagElementsThread(FEProblem & fe_problem,
std::vector<Number> & serialized_solution,
unsigned int max_h_level,
const std::string & marker_name) :
ThreadedElementLoop<ConstElemRange>(fe_problem, fe_problem.getAuxiliarySystem()),
ThreadedElementLoop<ConstElemRange>(fe_problem),
_fe_problem(fe_problem),
_displaced_problem(_fe_problem.getDisplacedProblem()),
_aux_sys(fe_problem.getAuxiliarySystem()),
Expand Down
2 changes: 1 addition & 1 deletion framework/src/base/ProjectMaterialProperties.C
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ProjectMaterialProperties::ProjectMaterialProperties(bool refine,
std::vector<MooseSharedPointer<MaterialData> > & bnd_material_data,
MaterialPropertyStorage & material_props,
MaterialPropertyStorage & bnd_material_props, std::vector<Assembly *> & assembly) :
ThreadedElementLoop<ConstElemPointerRange>(fe_problem, sys),
ThreadedElementLoop<ConstElemPointerRange>(fe_problem),
_refine(refine),
_fe_problem(fe_problem),
_sys(sys),
Expand Down
2 changes: 1 addition & 1 deletion framework/src/base/UpdateErrorVectorsThread.C
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

UpdateErrorVectorsThread::UpdateErrorVectorsThread(FEProblem & fe_problem,
const std::map<std::string, std::unique_ptr<ErrorVector> > & indicator_field_to_error_vector) :
ThreadedElementLoop<ConstElemRange>(fe_problem, fe_problem.getAuxiliarySystem()),
ThreadedElementLoop<ConstElemRange>(fe_problem),
_indicator_field_to_error_vector(indicator_field_to_error_vector),
_aux_sys(fe_problem.getAuxiliarySystem()),
_system_number(_aux_sys.number()),
Expand Down

0 comments on commit fc893e3

Please sign in to comment.