53{
54
55 T physPosMin[3] = {T(), T(), T()};
59 int latticePosMin[3] = {0, 0, 0};
61 latticePosMin, physPosMin );
62
63
64 T physPosMax[3] = {T(), T(), T()};
68 int latticePosMax[3] = {0, 0, 0};
70 latticePosMax, physPosMax );
71
72
74
75 T normalizer = T();
76 int iLatticePos[3] = {0, 0, 0};
77
78 for (iLatticePos[0]=latticePosMin[0]; iLatticePos[0]<=latticePosMax[0]; iLatticePos[0]++) {
79 for (iLatticePos[1]=latticePosMin[1]; iLatticePos[1]<=latticePosMax[1]; iLatticePos[1]++) {
80 for (iLatticePos[2]=latticePosMin[2]; iLatticePos[2]<=latticePosMax[2]; iLatticePos[2]++) {
81
82 T iPhysPos[3] = {T(), T(), T()};
84 iPhysPos, iLatticePos );
85
86
87 if (
util::pow(physPosP[0] - iPhysPos[0], 2) +
90
91
92 LatticePosAndWeight<T> item;
93 item.latticePos[0] = iLatticePos[0];
94 item.latticePos[1] = iLatticePos[1];
95 item.latticePos[2] = iLatticePos[2];
96 item.weight = this->
compute(physPosP, iPhysPos);
97
98 normalizer += item.weight;
100 }
101 }
102 }
103 }
104
105
106
107 if (normalizer == T()) {
108 std::cout << "ERROR: SmoothingFunctional::update(...):" << std::endl
109 << "[smoothingFunctional] physPosP: "
110 << physPosP[0] << " "
111 << physPosP[1] << " "
112 << physPosP[2] << std::endl
113 << "[smoothingFunctional] physPosMin: "
114 << physPosMin[0] << " "
115 << physPosMin[1] << " "
116 << physPosMin[2] << std::endl
117 << "[smoothingFunctional] physPosMax: "
118 << latticePosMax[0] << " "
119 << latticePosMax[1] << " "
120 << latticePosMax[2] << std::endl
121 << "[smoothingFunctional] normalizer: "
122 << normalizer << std::endl;
123 return false;
124 }
125
126
128 i.weight /= normalizer;
129 }
130 return true;
131}
virtual T compute(T physPosP[], T physPosL[])=0
Returns the weight for smoothing.
CuboidGeometry< T, D > & getCuboidGeometry()
Read and write access to cuboid geometry.
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)