/* This file is part of the OpenLB library * * Copyright (C) 2012 Lukas Baron, 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 BLOCK_BASE_F_3D_H #define BLOCK_BASE_F_3D_H #include "functors/genericF.h" #include "core/blockData3D.h" #include "core/blockStructure3D.h" #include "core/blockLatticeStructure3D.h" #include "core/unitConverter.h" #include /** 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 { /// represents all functors that operate on a cuboid in general, mother class of BlockLatticeF, .. template class BlockF3D : public GenericF { protected: BlockF3D(BlockStructure3D& blockStructure, int targetDim); BlockStructure3D& _blockStructure; public: /// virtual destructor for defined behaviour ~BlockF3D() override {}; virtual BlockStructure3D& getBlockStructure() const; std::vector getMinValue(); std::vector getMaxValue(); BlockF3D& operator-(BlockF3D& rhs); BlockF3D& operator+(BlockF3D& rhs); BlockF3D& operator*(BlockF3D& rhs); BlockF3D& operator/(BlockF3D& rhs); }; /// BlockDataF3D can store data of any BlockFunctor3D template class BlockDataF3D : public BlockF3D { protected: BlockDataF3D(int nx, int ny, int nz, int size=1); std::unique_ptr> _blockDataStorage; BlockData3D& _blockData; public: /// Constructor BlockDataF3D(BlockData3D& blockData); /// to store functor data, constuctor creates _blockData with functor data BlockDataF3D(BlockF3D& f); /// returns _blockData BlockData3D& getBlockData(); /// access to _blockData via its get() bool operator() (BaseType output[], const int input[]) override; }; /// Overlap-aware version of BlockDataF3D for usage in SuperDataF3D template class BlockDataViewF3D : public BlockDataF3D { private: const int _overlap; public: BlockDataViewF3D(BlockData3D& blockData, int overlap); /// access to _blockData shifted by overlap bool operator() (BaseType output[], const int input[]) override; }; /// identity functor template class BlockIdentity3D final : public BlockF3D { protected: BlockF3D& _f; public: BlockIdentity3D(BlockF3D& f); // access operator should not delete f, since f still has the identity as child bool operator() (T output[], const int input[]) override; }; /// functor to extract one component template class BlockExtractComponentF3D : public BlockF3D { protected: BlockF3D& _f; int _extractDim; public: BlockExtractComponentF3D(BlockF3D& f, int extractDim); int getExtractDim(); bool operator() (T output[], const int input[]); }; /// functor to extract one component inside an indicator template class BlockExtractComponentIndicatorF3D : public BlockExtractComponentF3D { protected: BlockIndicatorF3D& _indicatorF; public: BlockExtractComponentIndicatorF3D(BlockF3D& f, int extractDim, BlockIndicatorF3D& indicatorF); bool operator() (T output[], const int input[]) override; }; /// functor to extract data inside an indicator template class BlockExtractIndicatorF3D : public BlockF3D { protected: BlockF3D& _f; BlockIndicatorF3D& _indicatorF; public: BlockExtractIndicatorF3D(BlockF3D& f, BlockIndicatorF3D& indicatorF); bool operator() (T output[], const int input[]); }; /// functor to extract one component template class BlockDotProductF3D : public BlockF3D { protected: BlockF3D& _f; T _vector[]; public: BlockDotProductF3D(BlockF3D& f, T vector[]); bool operator() (T output[], const int input[]); }; /// represents all functors that operate on a DESCRIPTOR in general, e.g. getVelocity(), getForce(), getPressure() template class BlockLatticeF3D : public BlockF3D { protected: BlockLatticeF3D(BlockLatticeStructure3D& blockLattice, int targetDim); BlockLatticeStructure3D& _blockLattice; public: /// Copy Constructor //BlockLatticeF3D(BlockLatticeF3D const& rhs); /// Assignment Operator //BlockLatticeF3D& operator=(BlockLatticeF3D const& rhs); BlockLatticeStructure3D& getBlockLattice(); }; /// identity functor template class BlockLatticeIdentity3D final : public BlockLatticeF3D { protected: BlockLatticeF3D& _f; public: BlockLatticeIdentity3D(BlockLatticeF3D& f); bool operator() (T output[], const int input[]) override; }; /// represents all functors that operate on a DESCRIPTOR with output in Phys, e.g. physVelocity(), physForce(), physPressure() template class BlockLatticePhysF3D : public BlockLatticeF3D { protected: const UnitConverter& _converter; BlockLatticePhysF3D(BlockLatticeStructure3D& blockLattice, const UnitConverter& converter, int targetDim); public: /// Copy Constructor //BlockLatticePhysF3D(BlockLatticePhysF3D const& rhs); /// Assignment Operator //BlockLatticePhysF3D& operator=(BlockLatticePhysF3D const& rhs); }; /// represents all thermal functors that operate on a DESCRIPTOR with output in Phys, e.g. physTemperature(), physHeatFlux() template class BlockLatticeThermalPhysF3D : public BlockLatticeF3D { protected: BlockLatticeThermalPhysF3D(BlockLatticeStructure3D& blockLattice, const ThermalUnitConverter& converter, int targetDim); const ThermalUnitConverter& _converter; }; } // end namespace olb #endif