55 T physPosMin[3] = {T(), T(), T()};
56 physPosMin[0] = physPosP[0] - _kernelLength;
57 physPosMin[1] = physPosP[1] - _kernelLength;
58 physPosMin[2] = physPosP[2] - _kernelLength;
59 int latticePosMin[3] = {0, 0, 0};
60 this->_sLattice.getCuboidGeometry().get(globic).getLatticeR (
61 latticePosMin, physPosMin );
64 T physPosMax[3] = {T(), T(), T()};
65 physPosMax[0] = physPosP[0] + _kernelLength;
66 physPosMax[1] = physPosP[1] + _kernelLength;
67 physPosMax[2] = physPosP[2] + _kernelLength;
68 int latticePosMax[3] = {0, 0, 0};
69 this->_sLattice.getCuboidGeometry().get(globic).getLatticeR (
70 latticePosMax, physPosMax );
73 _latticePosAndWeight.clear();
76 int iLatticePos[3] = {0, 0, 0};
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]++) {
82 T iPhysPos[3] = {T(), T(), T()};
83 this->_sLattice.getCuboidGeometry().get(globic).getPhysR (
84 iPhysPos, iLatticePos );
87 if (
util::pow(physPosP[0] - iPhysPos[0], 2) +
96 item.
weight = this->compute(physPosP, iPhysPos);
99 _latticePosAndWeight.push_back(item);
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;
127 for (
auto&& i : _latticePosAndWeight) {
128 i.weight /= normalizer;
217 for (
auto&& i : this->_latticePosAndWeight) {
218 T iPhysPos[3] = {T(), T(), T()};
219 this->_sLattice.getCuboidGeometry().get(globic).getPhysR (
220 iPhysPos, i.latticePos );
222 T iExtremaMin[3] = {T(), T(), T()};
223 iExtremaMin[0] =
util::max( physPosP[0] - this->_kernelLength, iPhysPos[0] - 0.5 *this->_converter.getPhysDeltaX() );
224 iExtremaMin[1] =
util::max( physPosP[1] - this->_kernelLength, iPhysPos[1] - 0.5 *this->_converter.getPhysDeltaX() );
225 iExtremaMin[2] =
util::max( physPosP[2] - this->_kernelLength, iPhysPos[2] - 0.5 *this->_converter.getPhysDeltaX() );
227 T iExtremaMax[3] = {T(), T(), T()};
228 iExtremaMax[0] =
util::min( physPosP[0] + this->_kernelLength, iPhysPos[0] + 0.5 *this->_converter.getPhysDeltaX() );
229 iExtremaMax[1] =
util::min( physPosP[1] + this->_kernelLength, iPhysPos[1] + 0.5 *this->_converter.getPhysDeltaX() );
230 iExtremaMax[2] =
util::min( physPosP[2] + this->_kernelLength, iPhysPos[2] + 0.5 *this->_converter.getPhysDeltaX() );
232 T discretePhaseFraction = T();
233 for (
int nx=1; nx<=this->_nVoxelInterpPoints; nx++) {
234 for (
int ny=1; ny<=this->_nVoxelInterpPoints; ny++) {
235 for (
int nz=1; nz<=this->_nVoxelInterpPoints; nz++) {
236 T physPosNm[3] = {T(), T(), T()};
237 physPosNm[0] = iExtremaMin[0] + nx * (iExtremaMax[0] - iExtremaMin[0]) / ((T) this->_nVoxelInterpPoints + 1.0);
238 physPosNm[1] = iExtremaMin[1] + ny * (iExtremaMax[1] - iExtremaMin[1]) / ((T) this->_nVoxelInterpPoints + 1.0);
239 physPosNm[2] = iExtremaMin[2] + nz * (iExtremaMax[2] - iExtremaMin[2]) / ((T) this->_nVoxelInterpPoints + 1.0);
241 discretePhaseFraction += (
util::pow(physPosNm[0] - physPosP[0], 2)
242 +
util::pow(physPosNm[1] - physPosP[1], 2)
243 +
util::pow(physPosNm[2] - physPosP[2], 2)
247 T physPosNp[3] = {T(), T(), T()};
248 physPosNp[0] = iExtremaMin[0] + (nx - 1.0) * (iExtremaMax[0] - iExtremaMin[0]) / ((T) this->_nVoxelInterpPoints - 1.0);
249 physPosNp[1] = iExtremaMin[1] + (ny - 1.0) * (iExtremaMax[1] - iExtremaMin[1]) / ((T) this->_nVoxelInterpPoints - 1.0);
250 physPosNp[2] = iExtremaMin[2] + (nz - 1.0) * (iExtremaMax[2] - iExtremaMin[2]) / ((T) this->_nVoxelInterpPoints - 1.0);
252 discretePhaseFraction += (
util::pow(physPosNp[0] - physPosP[0], 2)
253 +
util::pow(physPosNp[1] - physPosP[1], 2)
254 +
util::pow(physPosNp[2] - physPosP[2], 2)
261 discretePhaseFraction *= (iExtremaMax[0]-iExtremaMin[0]) * (iExtremaMax[1]-iExtremaMin[1]) * (iExtremaMax[2]-iExtremaMin[2])
262 /
util::pow(this->_nVoxelInterpPoints * this->_converter.getPhysDeltaX(), 3);
264 i.continuousPhaseFraction = 1.0 - discretePhaseFraction;