/* 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 SUPER_BASE_F_2D_H #define SUPER_BASE_F_2D_H #include #include "functors/genericF.h" #include "blockBaseF2D.h" #include "communication/superStructure2D.h" #include "core/superData2D.h" #include "core/superLattice2D.h" /** Note: Throughout the whole source code directory genericFunctions, the * template parameters for i/o dimensions are: * F: S^m -> T^n (S=source, T=target) */ namespace olb { template class SuperLattice2D; template class SuperData2D; template class SuperStructure2D; template class SuperIdentity2D; template class BlockF2D; /// represents all functors that operate on a SuperStructure2D in general template class SuperF2D : public GenericF { protected: SuperF2D(SuperStructure2D& superStructure, int targetDim); SuperStructure2D& _superStructure; /// Super functors may consist of several BlockF2D derived functors /** * By convention: If block level functors are used at all they should * number exactly LoadBalancer::size per process. **/ std::vector>> _blockF; public: using identity_functor_type = SuperIdentity2D; SuperF2D& operator-(SuperF2D& rhs); SuperF2D& operator+(SuperF2D& rhs); SuperF2D& operator*(SuperF2D& rhs); SuperF2D& operator/(SuperF2D& rhs); /// \return _superStructure SuperStructure2D& getSuperStructure(); /// \return Size of SuperF3D::_blockF vector int getBlockFSize() const; /// \return _blockF[iCloc] BlockF2D& getBlockF(int iCloc); }; /// Functor from `SuperData2D` template class SuperDataF2D : public SuperF2D { protected: /// `SuperData2D` object this functor was created from SuperData2D& _superData; public: /// Constructor from `SuperData2D` - stores `_superData` reference SuperDataF2D(SuperData2D& superData); /// Operator for this functor - copies data from `_superData` object into output bool operator() (BaseType output[], const int input[]); /// Getter for `_superData` SuperData2D& getSuperData(); }; /// identity functor for memory management template class SuperIdentity2D : public SuperF2D { protected: FunctorPtr> _f; public: SuperIdentity2D(FunctorPtr>&& f); bool operator() (W output[], const int input[]) override; }; /// represents all functors that operate on a SuperLattice in general, e.g. getVelocity(), getForce(), getPressure() template class SuperLatticeF2D : public SuperF2D { protected: SuperLatticeF2D(SuperLattice2D& superLattice, int targetDim); SuperLattice2D& _sLattice; public: SuperLattice2D& getSuperLattice(); }; /// represents all functors that operate on a DESCRIPTOR with output in Phys, e.g. physVelocity(), physForce(), physPressure() template class SuperLatticePhysF2D : public SuperLatticeF2D { protected: SuperLatticePhysF2D(SuperLattice2D& sLattice, const UnitConverter& converter, int targetDim); const UnitConverter& _converter; public: UnitConverter const& getConverter() const; }; /// represents all thermal functors that operate on a DESCRIPTOR with output in Phys, e.g. physTemperature(), physHeatFlux() template class SuperLatticeThermalPhysF2D : public SuperLatticeF2D { protected: SuperLatticeThermalPhysF2D(SuperLattice2D& sLattice, const ThermalUnitConverter& converter, int targetDim); const ThermalUnitConverter& _converter; public: ThermalUnitConverter const& getConverter() const; }; } // end namespace olb #endif