From 94d3e79a8617f88dc0219cfdeedfa3147833719d Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 24 Jun 2019 14:43:36 +0200 Subject: Initialize at openlb-1-3 --- .../analytical/indicator/smoothIndicatorBaseF2D.hh | 302 +++++++++++++++++++++ 1 file changed, 302 insertions(+) create mode 100644 src/functors/analytical/indicator/smoothIndicatorBaseF2D.hh (limited to 'src/functors/analytical/indicator/smoothIndicatorBaseF2D.hh') diff --git a/src/functors/analytical/indicator/smoothIndicatorBaseF2D.hh b/src/functors/analytical/indicator/smoothIndicatorBaseF2D.hh new file mode 100644 index 0000000..f59dc9b --- /dev/null +++ b/src/functors/analytical/indicator/smoothIndicatorBaseF2D.hh @@ -0,0 +1,302 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2014-2016 Cyril Masquelier, 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_2D_HH +#define SMOOTH_INDICATOR_BASE_F_2D_HH + +#include + +#include "smoothIndicatorBaseF2D.h" + +namespace olb { + + +template +SmoothIndicatorF2D::SmoothIndicatorF2D() + : AnalyticalF2D(1), + _myMin(S()), _myMax(S()), _pos(S()), _rotMat(S()), _circumRadius(S()), _theta(S()), _epsilon(S()) +{ } + +template +void SmoothIndicatorF2D::init(T theta, Vector vel, T mass, T mofi) { + _rotMat[0] = std::cos(theta); + _rotMat[1] = std::sin(theta); + _rotMat[2] = -std::sin(theta); + _rotMat[3] = std::cos(theta); +} + +template +const Vector& SmoothIndicatorF2D::getMin() const { + return _myMin; +} + +template +const Vector& SmoothIndicatorF2D::getMax() const { + return _myMax; +} + +template +const Vector& SmoothIndicatorF2D::getPos() const { + return _pos; +} + +template +const Vector& SmoothIndicatorF2D::getRotationMatrix() const { + return _rotMat; +} + +template +const S& SmoothIndicatorF2D::getCircumRadius() const { + return _circumRadius; +} + +template +const S& SmoothIndicatorF2D::getTheta() const { + return _theta; +} + +template +const S& SmoothIndicatorF2D::getEpsilon() const { + return _epsilon; +} + +template +std::string SmoothIndicatorF2D::name() { + return _name; +} + +template +void SmoothIndicatorF2D::setRotationMatrix(Vector rotMat) { + _rotMat[0] = rotMat[0]; + _rotMat[1] = rotMat[1]; + _rotMat[2] = rotMat[2]; + _rotMat[3] = rotMat[3]; +} + +template +void SmoothIndicatorF2D::setTheta(S theta) { + _theta = theta; +} + +template +void SmoothIndicatorF2D::setEpsilon(S epsilon) { + _epsilon = epsilon; +} + +// identity to "store results" +template +SmoothIndicatorIdentity2D::SmoothIndicatorIdentity2D(SmoothIndicatorF2D& f) + : _f(f) { + this->_myMin = _f.getMin(); + this->_myMax = _f.getMax(); + std::swap( _f._ptrCalcC, this->_ptrCalcC ); +} + +template +bool SmoothIndicatorIdentity2D::operator() (T output[], const S input[]) { + _f(output, input); + return true; +} + +///////////////////////// for template specialisation HLBM=true + +template +SmoothIndicatorF2D::SmoothIndicatorF2D() + : AnalyticalF2D(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 SmoothIndicatorF2D::init(T theta, Vector vel, T mass, T mofi) { + _rotMat[0] = std::cos(theta); + _rotMat[1] = std::sin(theta); + _rotMat[2] = -std::sin(theta); + _rotMat[3] = std::cos(theta); + _vel = vel; + _mass = mass; + _mofi = mofi; +} + +template +const Vector& SmoothIndicatorF2D::getMin() const { + return _myMin; +} + +template +const Vector& SmoothIndicatorF2D::getMax() const { + return _myMax; +} + +template +const Vector& SmoothIndicatorF2D::getPos() const { + return _pos; +} + +template +const Vector& SmoothIndicatorF2D::getVel() const { + return _vel; +} + +template +const Vector& SmoothIndicatorF2D::getAcc() const { + return _acc; +} + +template +const Vector& SmoothIndicatorF2D::getAcc2() const { + return _acc2; +} + +template +const Vector& SmoothIndicatorF2D::getForce() const { + return _force; +} + +template +const Vector& SmoothIndicatorF2D::getRotationMatrix() const { + return _rotMat; +} + +template +const S& SmoothIndicatorF2D::getCircumRadius() const { + return _circumRadius; +} + +template +const S& SmoothIndicatorF2D::getTheta() const { + return _theta; +} + +template +const S& SmoothIndicatorF2D::getOmega() const { + return _omega; +} + +template +const S& SmoothIndicatorF2D::getAlpha() const { + return _alpha; +} + +template +const S& SmoothIndicatorF2D::getAlpha2() const { + return _alpha2; +} + +template +const S& SmoothIndicatorF2D::getMass() const { + return _mass; +} + +template +const S& SmoothIndicatorF2D::getMofi() const { + return _mofi; +} + +template +const S& SmoothIndicatorF2D::getEpsilon() const { + return _epsilon; +} + +template +std::string SmoothIndicatorF2D::name() { + return _name; +} + +template +void SmoothIndicatorF2D::setPos(Vector pos) { + _pos[0] = pos[0]; + _pos[1] = pos[1]; +} + +template +void SmoothIndicatorF2D::setVel(Vector vel) { + _vel[0] = vel[0]; + _vel[1] = vel[1]; +} + +template +void SmoothIndicatorF2D::setAcc(Vector acc) { + _acc[0] = acc[0]; + _acc[1] = acc[1]; +} + +template +void SmoothIndicatorF2D::setAcc2(Vector acc2) { + _acc2[0] = acc2[0]; + _acc2[1] = acc2[1]; +} + +template +void SmoothIndicatorF2D::setForce(Vector force) { + _force[0] = force[0]; + _force[1] = force[1]; +} + +template +void SmoothIndicatorF2D::setRotationMatrix(Vector rotMat) { + _rotMat[0] = rotMat[0]; + _rotMat[1] = rotMat[1]; + _rotMat[2] = rotMat[2]; + _rotMat[3] = rotMat[3]; +} + +template +void SmoothIndicatorF2D::setTheta(S theta) { + _theta = theta; +} + +template +void SmoothIndicatorF2D::setOmega(S omega) { + _omega = omega; +} + +template +void SmoothIndicatorF2D::setAlpha(S alpha) { + _alpha = alpha; +} + +template +void SmoothIndicatorF2D::setAlpha2(S alpha2) { + _alpha2 = alpha2; +} + +template +void SmoothIndicatorF2D::setMass(S mass) { + _mass = mass; +} + +template +void SmoothIndicatorF2D::setMofi(S mofi) { + _mofi = mofi; +} + +template +void SmoothIndicatorF2D::setEpsilon(S epsilon) { + _epsilon = epsilon; +} + +} // namespace olb + +#endif -- cgit v1.2.3