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 --- src/functors/analytical/analyticalBaseF.h | 135 ++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 src/functors/analytical/analyticalBaseF.h (limited to 'src/functors/analytical/analyticalBaseF.h') diff --git a/src/functors/analytical/analyticalBaseF.h b/src/functors/analytical/analyticalBaseF.h new file mode 100644 index 0000000..725bbe1 --- /dev/null +++ b/src/functors/analytical/analyticalBaseF.h @@ -0,0 +1,135 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2012 Lukas Baron, Tim Dornieden, Mathias J. Krause, Albert Mink + * 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 ANALYTICAL_BASE_F_H +#define ANALYTICAL_BASE_F_H + +#include "functors/genericF.h" +#include "functors/analytical/indicator/indicatorBaseF3D.h" + +/** + * The functor dimensions are given by F: S^m -> T^n (S=source, T=target) + * and are implemented via GenericF(n,m). + * Don't get confused by the flipped order of source and target. + */ + +namespace olb { + +//////////////////////////////////////////////////////////////////////////////// +// 2nd level classes +// note: for LatticeFunctions the number indicates the SOURCE dimension, +// target dim depends on return variable type, so std::vector is used + +template class AnalyticalIdentity2D; +template class AnalyticalIdentity3D; + + +/// AnalyticalF1D are applications from 1D to XD, where X is set by the constructor. +template +class AnalyticalF1D : public GenericF { +protected: + // n denotes the target dimension + AnalyticalF1D(int n); +public: + AnalyticalF1D& operator-(AnalyticalF1D& rhs); + AnalyticalF1D& operator+(AnalyticalF1D& rhs); + AnalyticalF1D& operator*(AnalyticalF1D& rhs); + AnalyticalF1D& operator/(AnalyticalF1D& rhs); +}; + +/// AnalyticalF2D are applications from 2D to XD, where X is set by the constructor. +template +class AnalyticalF2D : public GenericF { +protected: + // n denotes the target dimension + AnalyticalF2D(int n); +public: + using identity_functor_type = AnalyticalIdentity2D; + + AnalyticalF2D& operator-(AnalyticalF2D& rhs); + AnalyticalF2D& operator+(AnalyticalF2D& rhs); + AnalyticalF2D& operator*(AnalyticalF2D& rhs); + AnalyticalF2D& operator/(AnalyticalF2D& rhs); +}; + +/// AnalyticalF3D are applications from 3D to XD, where X is set by the constructor. +template +class AnalyticalF3D : public GenericF { +protected: + // n denotes the target dimension + AnalyticalF3D(int n); +public: + using identity_functor_type = AnalyticalIdentity3D; + + AnalyticalF3D& operator-(AnalyticalF3D& rhs); + AnalyticalF3D& operator+(AnalyticalF3D& rhs); + AnalyticalF3D& operator*(AnalyticalF3D& rhs); + AnalyticalF3D& operator/(AnalyticalF3D& rhs); +}; + +/// AnalyticalIdentity1D stores vectors, result of addition,multiplication, ... +template +class AnalyticalIdentity1D final : public AnalyticalF1D { +protected: + AnalyticalF1D& _f; +public: + AnalyticalIdentity1D(AnalyticalF1D& f); + bool operator() (T output[], const S input[]) override; +}; + +/// AnalyticalIdentity2D stores vectors, result of addition,multiplication, ... +template +class AnalyticalIdentity2D final : public AnalyticalF2D { +protected: + AnalyticalF2D& _f; +public: + AnalyticalIdentity2D(AnalyticalF2D& f); + bool operator() (T output[], const S input[]) override; +}; + +/// AnalyticalIdentity3D stores vectors, result of addition,multiplication, ... +template +class AnalyticalIdentity3D final : public AnalyticalF3D { +protected: + AnalyticalF3D& _f; +public: + AnalyticalIdentity3D(AnalyticalF3D& f); + bool operator() (T output[], const S input[]) override; +}; + + +/// Converts IndicatorF to AnalyticalF (used for Analytical operands for Identity) +template +class AnalyticalFfromIndicatorF3D : public AnalyticalF3D { +protected: + IndicatorF3D& _indicatorF; +public: + AnalyticalFfromIndicatorF3D(IndicatorF3D& indicatorF); + bool operator() (T output[], const S input[]) override; +}; + + + +} // end namespace olb + +#endif -- cgit v1.2.3