808{
809
810 T cuboidMofi =
util::pow(this->_latticeSpacing, 2)/ 6.0;
811 unsigned nCells = 0;
812 Vector<T,3> mofi = {T(0), T(0), T(0)};
813 T dx, dy, dz;
814 int input[3];
815 for (input[0] = 0; input[0] < this->_blockData->getNx(); ++input[0]) {
816 dx =
util::abs(this->_latticeSpacing*input[0] - this->_center[0]);
817 for (input[1] = 0; input[1] < this->_blockData->getNy(); ++input[1]) {
818 dy =
util::abs(this->_latticeSpacing*input[1] - this->_center[1]);
819 for (input[2] = 0; input[2] < this->_blockData->getNz(); ++input[2]) {
821 dz =
util::abs(this->_latticeSpacing*input[2] - this->_center[2]);
822 mofi[0] += (dy*dy+dz*dz+cuboidMofi);
823 mofi[1] += (dx*dx+dz*dz+cuboidMofi);
824 mofi[2] += (dx*dx+dy*dy+cuboidMofi);
825 ++nCells;
826 }
827 }
828 }
829 }
830 _volume = nCells *
util::pow(_latticeSpacing,3);
831 const T mass = rhoP * _volume;
832 const T cuboidMass = mass/nCells;
833 mofi *= cuboidMass;
834
835 return Vector<T,4>(mofi[0], mofi[1], mofi[2], mass);
836}
bool regardCell(int input[3])
ADf< T, DIM > abs(const ADf< T, DIM > &a)
cpu::simd::Pack< T > pow(cpu::simd::Pack< T > base, cpu::simd::Pack< T > exp)