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/indicator/blockIndicatorF2D.h | 144 +++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 src/functors/lattice/indicator/blockIndicatorF2D.h (limited to 'src/functors/lattice/indicator/blockIndicatorF2D.h') diff --git a/src/functors/lattice/indicator/blockIndicatorF2D.h b/src/functors/lattice/indicator/blockIndicatorF2D.h new file mode 100644 index 0000000..a0bdb3a --- /dev/null +++ b/src/functors/lattice/indicator/blockIndicatorF2D.h @@ -0,0 +1,144 @@ +/* This file is part of the OpenLB library + * + * Copyright (C) 2017 Adrian Kummerlaender + * 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_INDICATOR_F_2D_H +#define BLOCK_INDICATOR_F_2D_H + +#include "blockIndicatorBaseF2D.h" +#include "geometry/blockGeometryView2D.h" +#include "functors/analytical/indicator/smoothIndicatorBaseF2D.h" + +namespace olb { + +/// BlockIndicatorF2D from IndicatorF2D +template +class BlockIndicatorFfromIndicatorF2D : public BlockIndicatorF2D { +protected: + IndicatorF2D& _indicatorF; +public: + /** + * \param indicatorF Indicator to be reduced to lattice space + * \param blockGeometry Block geometry structure to be used for conversion + * between lattice and physical coordinates. + **/ + BlockIndicatorFfromIndicatorF2D(IndicatorF2D& indicatorF, + BlockGeometryStructure2D& blockGeometry); + + using BlockIndicatorF2D::operator(); + bool operator() (bool output[], const int input[]) override; + + /// Returns min lattice position of the indicated domain's bounding box + Vector getMin() override; + /// Returns max lattice position of the indicated domain's bounding box + Vector getMax() override; +}; + + +/// BlockIndicatorF2D from SmoothIndicatorF2D +/** + * Note on get(Min,Max): SmoothIndicatorF2D currently doesn't expose a bounding box + * which is why these methods return the full block domain. + **/ +template +class BlockIndicatorFfromSmoothIndicatorF2D : public BlockIndicatorF2D { +protected: + SmoothIndicatorF2D& _indicatorF; +public: + /** + * \param indicatorF Smooth indicator to be reduced to lattice space + * \param blockGeometry Block geometry structure to be used for conversion + * between lattice and physical coordinates. + **/ + BlockIndicatorFfromSmoothIndicatorF2D(SmoothIndicatorF2D& indicatorF, + BlockGeometryStructure2D& blockGeometry); + + using BlockIndicatorF2D::operator(); + bool operator() (bool output[], const int input[]) override; + + /// Returns a min lattice position of the indicated domain's bounding box + Vector getMin() override; + /// Returns a max lattice position of the indicated domain's bounding box + Vector getMax() override; +}; + + +/// Block indicator functor from material numbers +template +class BlockIndicatorMaterial2D : public BlockIndicatorF2D { +protected: + const std::vector _materials; +public: + /** + * \param blockGeometry Block geometry structue to be queried + * \param materials Material number vector + **/ + BlockIndicatorMaterial2D(BlockGeometryStructure2D& blockGeometry, + std::vector materials); + /** + * \param blockGeometry Block geometry structure to be queried + * \param materials Material number list + **/ + BlockIndicatorMaterial2D(BlockGeometryStructure2D& blockGeometry, + std::list materials); + /** + * \param blockGeometry Block geometry structure to be queried + * \param material Material number + **/ + BlockIndicatorMaterial2D(BlockGeometryStructure2D& blockGeometry, + int material); + + using BlockIndicatorF2D::operator(); + bool operator() (bool output[], const int input[]) override; + + /// Returns true iff indicated domain subset is empty + bool isEmpty() override; + /// Returns min lattice position of the indicated domain's bounding box + Vector getMin() override; + /// Returns max lattice position of the indicated domain's bounding box + Vector getMax() override; +}; + + +/// Block indicator identity +template +class BlockIndicatorIdentity2D : public BlockIndicatorF2D { +protected: + BlockIndicatorF2D& _indicatorF; +public: + /** + * \param indicatorF Block indicator to be proxied + **/ + BlockIndicatorIdentity2D(BlockIndicatorF2D& indicatorF); + + using BlockIndicatorF2D::operator(); + bool operator() (bool output[], const int input[]) override; + + /// Returns min lattice position of the indicated domain's bounding box + Vector getMin() override; + /// Returns max lattice position of the indicated domain's bounding box + Vector getMax() override; +}; + +} // namespace olb + +#endif -- cgit v1.2.3