1 | /* |
2 | * LB_Model.hpp |
3 | * |
4 | * Created on: Jan 18, 2017 |
5 | * Author: i-bird |
6 | */ |
7 | |
8 | #ifndef SRC_DLB_LB_MODEL_HPP_ |
9 | #define SRC_DLB_LB_MODEL_HPP_ |
10 | |
11 | /*! \brief Linear model |
12 | * |
13 | * The linear model count each particle as weight one |
14 | * |
15 | */ |
16 | struct ModelLin |
17 | { |
18 | size_t factor = 1; |
19 | |
20 | ModelLin(size_t factor) |
21 | :factor(factor) |
22 | {} |
23 | |
24 | ModelLin() {} |
25 | |
26 | template<typename Decomposition, typename vector> inline void addComputation(Decomposition & dec, const vector & vd, size_t v, size_t p) |
27 | { |
28 | dec.addComputationCost(v, 1); |
29 | } |
30 | |
31 | template<typename Decomposition> inline void applyModel(Decomposition & dec, size_t v) |
32 | { |
33 | dec.setSubSubDomainComputationCost(v, dec.getSubSubDomainComputationCost(v)); |
34 | } |
35 | |
36 | double distributionTol() |
37 | { |
38 | return 1.01; |
39 | } |
40 | }; |
41 | |
42 | /*! \brief Linear model |
43 | * |
44 | * The linear model count each particle as weight one |
45 | * |
46 | */ |
47 | struct ModelSquare |
48 | { |
49 | size_t factor = 1; |
50 | |
51 | template<typename Decomposition, typename vector> inline void addComputation(Decomposition & dec, const vector & vd, size_t v, size_t p) |
52 | { |
53 | dec.addComputationCost(v, factor); |
54 | } |
55 | |
56 | template<typename Decomposition> inline void applyModel(Decomposition & dec, size_t v) |
57 | { |
58 | dec.setSubSubDomainComputationCost(v, dec.getSubSubDomainComputationCost(v) * dec.getSubSubDomainComputationCost(v)); |
59 | } |
60 | |
61 | double distributionTol() |
62 | { |
63 | return 1.01; |
64 | } |
65 | }; |
66 | |
67 | |
68 | #endif /* SRC_DLB_LB_MODEL_HPP_ */ |
69 | |