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/lattice/blockBaseF2D.h | 140 ++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 src/functors/lattice/blockBaseF2D.h (limited to 'src/functors/lattice/blockBaseF2D.h') diff --git a/src/functors/lattice/blockBaseF2D.h b/src/functors/lattice/blockBaseF2D.h new file mode 100644 index 0000000..9dda191 --- /dev/null +++ b/src/functors/lattice/blockBaseF2D.h @@ -0,0 +1,140 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2013 Albert Mink, Lukas Baron, Mathias J. Krause + * 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_2D_H +#define BLOCK_BASE_F_2D_H + +#include "functors/genericF.h" +#include "core/blockStructure2D.h" +#include "core/blockData2D.h" +#include "core/blockLatticeStructure2D.h" +#include "core/unitConverter.h" + +#include +#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 BlockF2D : public GenericF { +protected: + BlockF2D(BlockStructure2D& blockStructure, int targetDim); + BlockF2D(int targetDim); + BlockStructure2D* _blockStructure; +public: + // virtual due to BlockReduction2D1D + virtual BlockStructure2D& getBlockStructure(); + void setBlockStructure(BlockStructure2D* blockStructure); + + // not used anymore? blockData2D computes min/max as well + /// computes min/maxValue of blockStructure, [iDim] + // std::vector getMinValue(); + // std::vector getMaxValue(); + + BlockF2D& operator-(BlockF2D& rhs); + BlockF2D& operator+(BlockF2D& rhs); + BlockF2D& operator*(BlockF2D& rhs); + BlockF2D& operator/(BlockF2D& rhs); +}; + +/// BlockDataF2D can store data of any BlockF2D +template +class BlockDataF2D : public BlockF2D { +protected: + /// used for BlockReduction2D1D to build BlockData2D by the constructor + BlockDataF2D(int nx, int ny, int size=1); + + std::unique_ptr> _blockDataStorage; + BlockData2D& _blockData; +public: + BlockDataF2D(BlockData2D& blockData); + /// to store functor data, constuctor creates _blockData with functor data + BlockDataF2D(BlockF2D& f); + /// returns _blockData + BlockData2D& getBlockData(); + /// access to _blockData via its get() + bool operator() (T output[], const int input[]) override; +}; + +/// Overlap-aware version of BlockDataF2D for usage in SuperDataF2D +template +class BlockDataViewF2D : public BlockDataF2D { +private: + const int _overlap; +public: + BlockDataViewF2D(BlockData2D& blockData, int overlap); + /// access to _blockData shifted by overlap + bool operator() (T output[], const int input[]) override; +}; + +/// identity functor +template +class BlockIdentity2D final : public BlockF2D { +protected: + BlockF2D& _f; +public: + BlockIdentity2D(BlockF2D& f); + // access operator should not delete f, since f still has the identity as child + bool operator() (T output[], const int input[]) override; +}; + +/// represents all functors that operate on a DESCRIPTOR in general, e.g. getVelocity(), getForce(), getPressure() +template +class BlockLatticeF2D : public BlockF2D { +protected: + BlockLatticeF2D(BlockLatticeStructure2D& blockLattice, int targetDim); + BlockLatticeStructure2D& _blockLattice; +public: + BlockLatticeStructure2D& getBlockLattice(); +}; + +/// represents all functors that operate on a DESCRIPTOR with output in Phys, e.g. physVelocity(), physForce(), physPressure() +template +class BlockLatticePhysF2D : public BlockLatticeF2D { +protected: + BlockLatticePhysF2D(BlockLatticeStructure2D& blockLattice, + const UnitConverter& converter, int targetDim); + const UnitConverter& _converter; +}; + + +/// represents all thermal functors that operate on a DESCRIPTOR with output in Phys, e.g. physTemperature(), physHeatFlux() +template +class BlockLatticeThermalPhysF2D : public BlockLatticeF2D { +protected: + BlockLatticeThermalPhysF2D(BlockLatticeStructure2D& blockLattice, + const ThermalUnitConverter& converter, int targetDim); + const ThermalUnitConverter& _converter; +}; + + +} // end namespace olb + +#endif -- cgit v1.2.3