/* This file is part of the OpenLB library * * Copyright (C) 2014-2016 Cyril Masquelier, Albert Mink, Mathias J. Krause, Benjamin Förster * E-mail contact: info@openlb.net * The most recent release of OpenLB can be downloaded at * * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef SMOOTH_INDICATOR_BASE_F_3D_HH #define SMOOTH_INDICATOR_BASE_F_3D_HH #include #include "smoothIndicatorBaseF3D.h" #include "utilities/vectorHelpers.h" namespace olb { template SmoothIndicatorF3D::SmoothIndicatorF3D() : AnalyticalF3D(1), _myMin(S()), _myMax(S()), _pos(S()), _rotMat(S()), _circumRadius(S()), _theta(S()), _epsilon(S()) { } template void SmoothIndicatorF3D::init(Vector theta, Vector vel, T mass, Vector mofi) { this->_rotMat[0] = std::cos(theta[1])*std::cos(theta[2]); this->_rotMat[1] = std::sin(theta[0])*std::sin(theta[1])*std::cos(theta[2]) - std::cos(theta[0])*std::sin(theta[2]); this->_rotMat[2] = std::cos(theta[0])*std::sin(theta[1])*std::cos(theta[2]) + std::sin(theta[0])*std::sin(theta[2]); this->_rotMat[3] = std::cos(theta[1])*std::sin(theta[2]); this->_rotMat[4] = std::sin(theta[0])*std::sin(theta[1])*std::sin(theta[2]) + std::cos(theta[0])*std::cos(theta[2]); this->_rotMat[5] = std::cos(theta[0])*std::sin(theta[1])*std::sin(theta[2]) - std::sin(theta[0])*std::cos(theta[2]); this->_rotMat[6] = -std::sin(theta[1]); this->_rotMat[7] = std::sin(theta[0])*std::cos(theta[1]); this->_rotMat[8] = std::cos(theta[0])*std::cos(theta[1]); } template const Vector& SmoothIndicatorF3D::getMin() const { return _myMin; } template const Vector& SmoothIndicatorF3D::getMax() const { return _myMax; } template const Vector& SmoothIndicatorF3D::getPos() const { return _pos; } template const S& SmoothIndicatorF3D::getCircumRadius() const { return _circumRadius; } template const Vector& SmoothIndicatorF3D::getRotationMatrix() const { return _rotMat; } template const Vector& SmoothIndicatorF3D::getTheta() const { return _theta; } template const S& SmoothIndicatorF3D::getEpsilon() const { return _epsilon; } template std::string SmoothIndicatorF3D::name() { return _name; } template void SmoothIndicatorF3D::setTheta(Vector theta) { _theta[0] = theta[0]; _theta[1] = theta[1]; _theta[2] = theta[2]; } template void SmoothIndicatorF3D::setEpsilon(S epsilon) { _epsilon = epsilon; } // identity to "store results" template SmoothIndicatorIdentity3D::SmoothIndicatorIdentity3D(SmoothIndicatorF3D& f) : _f(f) { this->_myMin = _f.getMin(); this->_myMax = _f.getMax(); std::swap( _f._ptrCalcC, this->_ptrCalcC ); } template bool SmoothIndicatorIdentity3D::operator() (T output[], const S input[]) { _f(output, input); return true; } ///////////////////////// for template specialisation HLBM=true template SmoothIndicatorF3D::SmoothIndicatorF3D() : AnalyticalF3D(1), _myMin(S()), _myMax(S()), _pos(S()), _vel(S()), _acc(S()), _acc2(S()), _force(S()), _rotMat(S()), _circumRadius(S()), _theta(S()), _omega(S()), _alpha(S()), _alpha2(S()), _mass(S()), _mofi(S()), _epsilon(S()) { } template void SmoothIndicatorF3D::init(Vector theta, Vector vel, T mass, Vector mofi) { this->_rotMat[0] = std::cos(theta[1])*std::cos(theta[2]); this->_rotMat[1] = std::sin(theta[0])*std::sin(theta[1])*std::cos(theta[2]) - std::cos(theta[0])*std::sin(theta[2]); this->_rotMat[2] = std::cos(theta[0])*std::sin(theta[1])*std::cos(theta[2]) + std::sin(theta[0])*std::sin(theta[2]); this->_rotMat[3] = std::cos(theta[1])*std::sin(theta[2]); this->_rotMat[4] = std::sin(theta[0])*std::sin(theta[1])*std::sin(theta[2]) + std::cos(theta[0])*std::cos(theta[2]); this->_rotMat[5] = std::cos(theta[0])*std::sin(theta[1])*std::sin(theta[2]) - std::sin(theta[0])*std::cos(theta[2]); this->_rotMat[6] = -std::sin(theta[1]); this->_rotMat[7] = std::sin(theta[0])*std::cos(theta[1]); this->_rotMat[8] = std::cos(theta[0])*std::cos(theta[1]); _vel = vel; _mass = mass; _mofi = mofi; } template const Vector& SmoothIndicatorF3D::getMin() const { return _myMin; } template const Vector& SmoothIndicatorF3D::getMax() const { return _myMax; } template const Vector& SmoothIndicatorF3D::getPos() const { return _pos; } template const Vector& SmoothIndicatorF3D::getVel() const { return _vel; } template const Vector& SmoothIndicatorF3D::getAcc() const { return _acc; } template const Vector& SmoothIndicatorF3D::getAcc2() const { return _acc2; } template const Vector& SmoothIndicatorF3D::getForce() const { return _force; } template const Vector& SmoothIndicatorF3D::getRotationMatrix() const { return _rotMat; } template const S& SmoothIndicatorF3D::getCircumRadius() const { return _circumRadius; } template const Vector& SmoothIndicatorF3D::getTheta() const { return _theta; } template const Vector& SmoothIndicatorF3D::getOmega() const { return _omega; } template const Vector& SmoothIndicatorF3D::getAlpha() const { return _alpha; } template const Vector& SmoothIndicatorF3D::getAlpha2() const { return _alpha2; } template const S& SmoothIndicatorF3D::getMass() const { return _mass; } template const Vector& SmoothIndicatorF3D::getMofi() const { return _mofi; } template const S& SmoothIndicatorF3D::getEpsilon() const { return _epsilon; } template std::string SmoothIndicatorF3D::name() { return _name; } // identity to "store results" template void SmoothIndicatorF3D::setPos(Vector pos) { _pos[0] = pos[0]; _pos[1] = pos[1]; _pos[2] = pos[2]; } template void SmoothIndicatorF3D::setVel(Vector vel) { _vel[0] = vel[0]; _vel[1] = vel[1]; _vel[2] = vel[2]; } template void SmoothIndicatorF3D::setAcc(Vector acc) { _acc[0] = acc[0]; _acc[1] = acc[1]; _acc[2] = acc[2]; } template void SmoothIndicatorF3D::setAcc2(Vector acc2) { _acc2[0] = acc2[0]; _acc2[1] = acc2[1]; _acc2[2] = acc2[2]; } template void SmoothIndicatorF3D::setForce(Vector force) { _force[0] = force[0]; _force[1] = force[1]; _force[2] = force[2]; } template void SmoothIndicatorF3D::setRotationMatrix(Vector rotMat) { _rotMat[0] = rotMat[0]; _rotMat[1] = rotMat[1]; _rotMat[2] = rotMat[2]; _rotMat[3] = rotMat[3]; _rotMat[4] = rotMat[4]; _rotMat[5] = rotMat[5]; _rotMat[6] = rotMat[6]; _rotMat[7] = rotMat[7]; _rotMat[8] = rotMat[8]; } template void SmoothIndicatorF3D::setTheta(Vector theta) { _theta[0] = theta[0]; _theta[1] = theta[1]; _theta[2] = theta[2]; } template void SmoothIndicatorF3D::setOmega(Vector omega) { _omega[0] = omega[0]; _omega[1] = omega[1]; _omega[2] = omega[2]; } template void SmoothIndicatorF3D::setAlpha(Vector alpha) { _alpha[0] = alpha[0]; _alpha[1] = alpha[1]; _alpha[2] = alpha[2]; } template void SmoothIndicatorF3D::setAlpha2(Vector alpha2) { _alpha2[0] = alpha2[0]; _alpha2[1] = alpha2[1]; _alpha2[2] = alpha2[2]; } template void SmoothIndicatorF3D::setMass(S mass) { _mass = mass; } template void SmoothIndicatorF3D::setMofi(Vector mofi) { _mofi[0] = mofi[0]; _mofi[1] = mofi[1]; _mofi[2] = mofi[2]; } template void SmoothIndicatorF3D::setEpsilon(S epsilon) { _epsilon = epsilon; } } // namespace olb #endif