Line data Source code
1 : /**********************************************************************/
2 : /* DO NOT MODIFY THIS HEADER */
3 : /* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */
4 : /* */
5 : /* Copyright 2017 Battelle Energy Alliance, LLC */
6 : /* ALL RIGHTS RESERVED */
7 : /**********************************************************************/
8 :
9 : #include "ThreadedRecoilDiracSourceLoop.h"
10 :
11 19 : ThreadedRecoilDiracSourceLoop::ThreadedRecoilDiracSourceLoop(const MyTRIMRasterizer & rasterizer,
12 19 : const MooseMesh & mesh)
13 19 : : ThreadedRecoilLoopBase(rasterizer, mesh)
14 : {
15 19 : }
16 :
17 : // Splitting Constructor
18 3 : ThreadedRecoilDiracSourceLoop::ThreadedRecoilDiracSourceLoop(
19 3 : const ThreadedRecoilDiracSourceLoop & x, Threads::split /*split*/)
20 3 : : ThreadedRecoilLoopBase(x, Threads::split())
21 : {
22 3 : }
23 :
24 : void
25 3 : ThreadedRecoilDiracSourceLoop::join(const ThreadedRecoilDiracSourceLoop & rl)
26 : {
27 3 : _result_list.insert(_result_list.end(), rl._result_list.begin(), rl._result_list.end());
28 3 : }
29 :
30 : void
31 1123524 : ThreadedRecoilDiracSourceLoop::addDefectToResult(const Point & p,
32 : unsigned int var,
33 : Real weight,
34 : ThreadedRecoilDiracSourceLoop::DefectType type)
35 : {
36 : // TODO: if weight != 1, we need to insert a weight into the DiracKernel for each
37 : // point. That is currently not possible so still throw error here.
38 1123524 : if (weight != 1)
39 0 : mooseError("Weight != 1 is currently not supported in ThreadedRecoilDiracSourceLoop. This "
40 : "usually occurs when setting analytical_cutoff != 0.");
41 :
42 1123524 : const Elem * elem = (*_pl)(p);
43 1123524 : if (elem != nullptr && var < _nvars)
44 1123431 : _result_list.push_back(MyTRIMResult(p, var, type, elem->id(), weight));
45 1123524 : }
46 :
47 : void
48 45279 : ThreadedRecoilDiracSourceLoop::addEnergyToResult(const Point & p, Real edep)
49 : {
50 45279 : const Elem * elem = (*_pl)(p);
51 45279 : if (elem != nullptr)
52 45279 : _result_list.push_back(MyTRIMResult(p, 0, ENERGY_DEPOSITION, elem->id(), edep));
53 45279 : }
54 :
55 : template <>
56 : void
57 383742 : dataStore(std::ostream & stream, ThreadedRecoilDiracSourceLoop::MyTRIMResult & dsl, void * context)
58 : {
59 383742 : dataStore(stream, dsl._location, context);
60 383742 : dataStore(stream, dsl._var, context);
61 383742 : dataStore(stream, dsl._type, context);
62 383742 : dataStore(stream, dsl._elem_id, context);
63 383742 : dataStore(stream, dsl._weight, context);
64 383742 : }
65 :
66 : template <>
67 : void
68 383742 : dataLoad(std::istream & stream, ThreadedRecoilDiracSourceLoop::MyTRIMResult & dsl, void * context)
69 : {
70 383742 : dataLoad(stream, dsl._location, context);
71 383742 : dataLoad(stream, dsl._var, context);
72 383742 : dataLoad(stream, dsl._type, context);
73 383742 : dataLoad(stream, dsl._elem_id, context);
74 383742 : dataLoad(stream, dsl._weight, context);
75 383742 : }
|