summaryrefslogtreecommitdiff
path: root/src/functors/lattice/indicator
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-06-24 14:43:36 +0200
committerAdrian Kummerlaender2019-06-24 14:43:36 +0200
commit94d3e79a8617f88dc0219cfdeedfa3147833719d (patch)
treec1a6894679563e271f5c6ea7a17fa3462f7212a3 /src/functors/lattice/indicator
downloadgrid_refinement_openlb-94d3e79a8617f88dc0219cfdeedfa3147833719d.tar
grid_refinement_openlb-94d3e79a8617f88dc0219cfdeedfa3147833719d.tar.gz
grid_refinement_openlb-94d3e79a8617f88dc0219cfdeedfa3147833719d.tar.bz2
grid_refinement_openlb-94d3e79a8617f88dc0219cfdeedfa3147833719d.tar.lz
grid_refinement_openlb-94d3e79a8617f88dc0219cfdeedfa3147833719d.tar.xz
grid_refinement_openlb-94d3e79a8617f88dc0219cfdeedfa3147833719d.tar.zst
grid_refinement_openlb-94d3e79a8617f88dc0219cfdeedfa3147833719d.zip
Initialize at openlb-1-3
Diffstat (limited to 'src/functors/lattice/indicator')
-rw-r--r--src/functors/lattice/indicator/MakeHeader33
-rw-r--r--src/functors/lattice/indicator/blockIndicatorBaseF2D.cpp32
-rw-r--r--src/functors/lattice/indicator/blockIndicatorBaseF2D.h87
-rw-r--r--src/functors/lattice/indicator/blockIndicatorBaseF2D.hh87
-rw-r--r--src/functors/lattice/indicator/blockIndicatorBaseF3D.cpp32
-rw-r--r--src/functors/lattice/indicator/blockIndicatorBaseF3D.h107
-rw-r--r--src/functors/lattice/indicator/blockIndicatorBaseF3D.hh88
-rw-r--r--src/functors/lattice/indicator/blockIndicatorF2D.cpp35
-rw-r--r--src/functors/lattice/indicator/blockIndicatorF2D.h144
-rw-r--r--src/functors/lattice/indicator/blockIndicatorF2D.hh215
-rw-r--r--src/functors/lattice/indicator/blockIndicatorF3D.cpp35
-rw-r--r--src/functors/lattice/indicator/blockIndicatorF3D.h140
-rw-r--r--src/functors/lattice/indicator/blockIndicatorF3D.hh228
-rw-r--r--src/functors/lattice/indicator/indicator2D.h32
-rw-r--r--src/functors/lattice/indicator/indicator2D.hh32
-rw-r--r--src/functors/lattice/indicator/indicator3D.h32
-rw-r--r--src/functors/lattice/indicator/indicator3D.hh32
-rw-r--r--src/functors/lattice/indicator/module.mk27
-rw-r--r--src/functors/lattice/indicator/superIndicatorBaseF2D.cpp32
-rw-r--r--src/functors/lattice/indicator/superIndicatorBaseF2D.h95
-rw-r--r--src/functors/lattice/indicator/superIndicatorBaseF2D.hh102
-rw-r--r--src/functors/lattice/indicator/superIndicatorBaseF3D.cpp32
-rw-r--r--src/functors/lattice/indicator/superIndicatorBaseF3D.h104
-rw-r--r--src/functors/lattice/indicator/superIndicatorBaseF3D.hh102
-rw-r--r--src/functors/lattice/indicator/superIndicatorF2D.cpp34
-rw-r--r--src/functors/lattice/indicator/superIndicatorF2D.h119
-rw-r--r--src/functors/lattice/indicator/superIndicatorF2D.hh164
-rw-r--r--src/functors/lattice/indicator/superIndicatorF3D.cpp35
-rw-r--r--src/functors/lattice/indicator/superIndicatorF3D.h129
-rw-r--r--src/functors/lattice/indicator/superIndicatorF3D.hh171
30 files changed, 2537 insertions, 0 deletions
diff --git a/src/functors/lattice/indicator/MakeHeader b/src/functors/lattice/indicator/MakeHeader
new file mode 100644
index 0000000..29e478d
--- /dev/null
+++ b/src/functors/lattice/indicator/MakeHeader
@@ -0,0 +1,33 @@
+# This file is part of the OpenLB library
+#
+# Copyright (C) 2007 Mathias Krause
+# E-mail contact: info@openlb.net
+# The most recent release of OpenLB can be downloaded at
+# <http://www.openlb.net/>
+#
+# 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.
+
+
+generic :=
+
+precompiled := blockIndicatorF2D \
+ blockIndicatorF3D \
+ blockIndicatorBaseF2D \
+ blockIndicatorBaseF3D \
+ superIndicatorBaseF2D \
+ superIndicatorBaseF3D \
+ superIndicatorF2D \
+ superIndicatorF3D
diff --git a/src/functors/lattice/indicator/blockIndicatorBaseF2D.cpp b/src/functors/lattice/indicator/blockIndicatorBaseF2D.cpp
new file mode 100644
index 0000000..7852fac
--- /dev/null
+++ b/src/functors/lattice/indicator/blockIndicatorBaseF2D.cpp
@@ -0,0 +1,32 @@
+/* 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
+ * <http://www.openlb.net/>
+ *
+ * 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.
+*/
+
+
+#include "blockIndicatorBaseF2D.h"
+#include "blockIndicatorBaseF2D.hh"
+
+namespace olb {
+
+template class BlockIndicatorF2D<double>;
+
+}
diff --git a/src/functors/lattice/indicator/blockIndicatorBaseF2D.h b/src/functors/lattice/indicator/blockIndicatorBaseF2D.h
new file mode 100644
index 0000000..f556de8
--- /dev/null
+++ b/src/functors/lattice/indicator/blockIndicatorBaseF2D.h
@@ -0,0 +1,87 @@
+/* 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
+ * <http://www.openlb.net/>
+ *
+ * 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_BASE_F_2D_H
+#define BLOCK_INDICATOR_BASE_F_2D_H
+
+#include "functors/lattice/blockBaseF2D.h"
+#include "core/blockData2D.h"
+#include "core/blockStructure2D.h"
+
+namespace olb {
+
+/// Base block indicator functor (discrete)
+template <typename T>
+class BlockIndicatorF2D : public BlockF2D<bool> {
+protected:
+ BlockGeometryStructure2D<T>& _blockGeometryStructure;
+ const BlockData2D<T,bool>* _cachedData;
+public:
+ using BlockF2D<bool>::operator();
+
+ BlockIndicatorF2D(BlockGeometryStructure2D<T>& geometry);
+ /// Get underlying block geometry structure
+ /**
+ * \returns _blockGeometryStructure
+ **/
+ BlockGeometryStructure2D<T>& getBlockGeometryStructure();
+ /// Block indicator specific function operator overload
+ /**
+ * The boolean return value of `operator()(T output[], S input[])` describes
+ * the call's success and by convention must not describe the indicated domain.
+ *
+ * \return Domain indicator i.e. `true` iff the input lies within the described subset.
+ **/
+ bool operator() (const int input[]);
+ /// Block indicator specific function operator overload
+ /**
+ * The boolean return value of `operator()(T output[], S input[])` describes
+ * the call's success and by convention must not describe the indicated domain.
+ *
+ * \return Domain indicator i.e. `true` iff the input lies within the described subset.
+ **/
+ bool operator() (int iX, int iY);
+
+ /// Set bool-mask cache to be used by indicator operator overloads
+ void setCache(const BlockData2D<T,bool>& cache);
+
+ /// Returns true only if the indicated domain subset is empty
+ /**
+ * May return false even if the indicated domain subset is in fact empty.
+ * Primarily implemented to minimize block accesses if an empty domain can
+ * be inferred by e.g. BlockGeometryStatistics2D data.
+ *
+ * i.e. only override this method if the domain can be checked for emptyness
+ * in an efficient fashion.
+ **/
+ virtual bool isEmpty();
+ /// Returns min lattice position of the indicated subset's bounding box
+ virtual Vector<int,2> getMin() = 0;
+ /// Returns max lattice position of the indicated subset's bounding box
+ virtual Vector<int,2> getMax() = 0;
+
+};
+
+} // namespace olb
+
+#endif
diff --git a/src/functors/lattice/indicator/blockIndicatorBaseF2D.hh b/src/functors/lattice/indicator/blockIndicatorBaseF2D.hh
new file mode 100644
index 0000000..4a64ddd
--- /dev/null
+++ b/src/functors/lattice/indicator/blockIndicatorBaseF2D.hh
@@ -0,0 +1,87 @@
+/* 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
+ * <http://www.openlb.net/>
+ *
+ * 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_BASE_F_2D_HH
+#define BLOCK_INDICATOR_BASE_F_2D_HH
+
+#include "blockIndicatorBaseF2D.h"
+#include "geometry/blockGeometry2D.h"
+
+namespace olb {
+
+template <typename T>
+BlockIndicatorF2D<T>::BlockIndicatorF2D(BlockGeometryStructure2D<T>& geometry)
+ : BlockF2D<bool>(geometry.getBlockStructure(), 1),
+ _blockGeometryStructure(geometry),
+ _cachedData{nullptr}
+{ }
+
+template <typename T>
+BlockGeometryStructure2D<T>& BlockIndicatorF2D<T>::getBlockGeometryStructure()
+{
+ return _blockGeometryStructure;
+}
+
+template <typename T>
+bool BlockIndicatorF2D<T>::operator() (const int input[])
+{
+ bool output{};
+ if (_cachedData == nullptr) {
+ this->operator()(&output, input);
+ }
+ else {
+ _cachedData->get(input[0], input[1]);
+ }
+ return output;
+}
+
+template <typename T>
+bool BlockIndicatorF2D<T>::operator() (int iX, int iY)
+{
+ bool output{};
+ if (_cachedData == nullptr) {
+ this->operator()(&output, iX, iY);
+ }
+ else {
+ _cachedData->get(iX, iY);
+ }
+ return output;
+}
+
+template <typename T>
+void BlockIndicatorF2D<T>::setCache(const BlockData2D<T,bool>& cache)
+{
+ _cachedData = &cache;
+}
+
+template <typename T>
+bool BlockIndicatorF2D<T>::isEmpty()
+{
+ // There is no way to determine domain emptyness in a fashion that is both
+ // generic and efficient.
+ return false;
+}
+
+} // namespace olb
+
+#endif
diff --git a/src/functors/lattice/indicator/blockIndicatorBaseF3D.cpp b/src/functors/lattice/indicator/blockIndicatorBaseF3D.cpp
new file mode 100644
index 0000000..487d27d
--- /dev/null
+++ b/src/functors/lattice/indicator/blockIndicatorBaseF3D.cpp
@@ -0,0 +1,32 @@
+/* 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
+ * <http://www.openlb.net/>
+ *
+ * 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.
+*/
+
+
+#include "blockIndicatorBaseF3D.h"
+#include "blockIndicatorBaseF3D.hh"
+
+namespace olb {
+
+template class BlockIndicatorF3D<double>;
+
+}
diff --git a/src/functors/lattice/indicator/blockIndicatorBaseF3D.h b/src/functors/lattice/indicator/blockIndicatorBaseF3D.h
new file mode 100644
index 0000000..96dd05a
--- /dev/null
+++ b/src/functors/lattice/indicator/blockIndicatorBaseF3D.h
@@ -0,0 +1,107 @@
+/* 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
+ * <http://www.openlb.net/>
+ *
+ * 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_BASE_F_3D_H
+#define BLOCK_INDICATOR_BASE_F_3D_H
+
+#include "functors/lattice/superBaseF3D.h"
+#include "functors/lattice/blockBaseF3D.h"
+#include "core/blockData3D.h"
+#include "core/blockStructure3D.h"
+
+namespace olb {
+
+/// Base block indicator functor
+/**
+ * Derived functors implement a indicator function on the full domain given by
+ * BlockGeometryStructure3D. Note the distinction between normal and extended
+ * block geometries exposed by SuperGeometry3D.
+ *
+ * By convention SuperIndicatorF3D::_blockF functors are expected to operate on
+ * overlap-less domains i.e. BlockGeometryView3D instances.
+ *
+ * Block indicators to be queried on a full block including its overlap must be
+ * constructed on extended BlockGeometry3D instances such as those exposed by
+ * SuperGeometry3D::getExtendedBlockGeometry
+ **/
+template <typename T>
+class BlockIndicatorF3D : public BlockF3D<bool> {
+protected:
+ BlockGeometryStructure3D<T>& _blockGeometryStructure;
+ const BlockData3D<T,bool>* _cachedData;
+public:
+ using BlockF3D<bool>::operator();
+
+ /// Constructor
+ /**
+ * \param geometry Any implementation of BlockGeometryStructure3D
+ * e.g. BlockGeometry3D or BlockGeometryView3D
+ **/
+ BlockIndicatorF3D(BlockGeometryStructure3D<T>& geometry);
+
+ /// Get underlying block geometry structure
+ /**
+ * \returns _blockGeometryStructure
+ **/
+ BlockGeometryStructure3D<T>& getBlockGeometryStructure();
+
+ /// Block indicator specific function operator overload
+ /**
+ * The boolean return value of `operator()(T output[], S input[])` describes
+ * the call's success and by convention must not describe the indicated domain.
+ *
+ * \return Domain indicator i.e. `true` iff the input lies within the described subset.
+ **/
+ bool operator() (const int input[]);
+ /// Block indicator specific function operator overload
+ /**
+ * The boolean return value of `operator()(T output[], S input[])` describes
+ * the call's success and by convention must not describe the indicated domain.
+ *
+ * \return Domain indicator i.e. `true` iff the input lies within the described subset.
+ **/
+ bool operator() (int iX, int iY, int iZ);
+
+ /// Set bool-mask cache to be used by indicator operator overloads
+ void setCache(const BlockData3D<T,bool>& cache);
+
+ /// Returns true only if the indicated domain subset is empty
+ /**
+ * May return false even if the indicated domain subset is in fact empty.
+ * Primarily implemented to minimize block accesses if an empty domain can
+ * be inferred by e.g. BlockGeometryStatistics3D data.
+ *
+ * i.e. only override this method if the domain can be checked for emptyness
+ * in an efficient fashion.
+ **/
+ virtual bool isEmpty();
+ /// Returns min lattice position of the indicated subset's bounding box
+ virtual Vector<int,3> getMin() = 0;
+ /// Returns max lattice position of the indicated subset's bounding box
+ virtual Vector<int,3> getMax() = 0;
+
+};
+
+} // namespace olb
+
+#endif
diff --git a/src/functors/lattice/indicator/blockIndicatorBaseF3D.hh b/src/functors/lattice/indicator/blockIndicatorBaseF3D.hh
new file mode 100644
index 0000000..dc0cc1a
--- /dev/null
+++ b/src/functors/lattice/indicator/blockIndicatorBaseF3D.hh
@@ -0,0 +1,88 @@
+/* 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
+ * <http://www.openlb.net/>
+ *
+ * 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_BASE_F_3D_HH
+#define BLOCK_INDICATOR_BASE_F_3D_HH
+
+#include "blockIndicatorBaseF3D.h"
+#include "geometry/blockGeometry3D.h"
+
+namespace olb {
+
+template <typename T>
+BlockIndicatorF3D<T>::BlockIndicatorF3D(BlockGeometryStructure3D<T>& geometry)
+ : BlockF3D<bool>(geometry.getBlockStructure(), 1),
+ _blockGeometryStructure(geometry),
+ _cachedData{nullptr}
+{ }
+
+template <typename T>
+BlockGeometryStructure3D<T>& BlockIndicatorF3D<T>::getBlockGeometryStructure()
+{
+ return _blockGeometryStructure;
+}
+
+template <typename T>
+bool BlockIndicatorF3D<T>::operator() (const int input[])
+{
+ bool output{};
+ if (_cachedData == nullptr) {
+ this->operator()(&output, input);
+ }
+ else {
+ _cachedData->get(input[0], input[1], input[2]);
+ }
+ return output;
+}
+
+template <typename T>
+bool BlockIndicatorF3D<T>::operator() (int iX, int iY, int iZ)
+{
+ bool output{};
+ if (_cachedData == nullptr) {
+ this->operator()(&output, iX, iY, iZ);
+ }
+ else {
+ _cachedData->get(iX, iY, iZ);
+ }
+ return output;
+}
+
+template <typename T>
+void BlockIndicatorF3D<T>::setCache(const BlockData3D<T,bool>& cache)
+{
+ _cachedData = &cache;
+}
+
+template <typename T>
+bool BlockIndicatorF3D<T>::isEmpty()
+{
+ // There is no way to determine domain emptyness in a fashion that is both
+ // generic and efficient.
+ return false;
+}
+
+
+} // namespace olb
+
+#endif
diff --git a/src/functors/lattice/indicator/blockIndicatorF2D.cpp b/src/functors/lattice/indicator/blockIndicatorF2D.cpp
new file mode 100644
index 0000000..073e173
--- /dev/null
+++ b/src/functors/lattice/indicator/blockIndicatorF2D.cpp
@@ -0,0 +1,35 @@
+/* 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
+ * <http://www.openlb.net/>
+ *
+ * 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.
+*/
+
+
+#include "blockIndicatorF2D.h"
+#include "blockIndicatorF2D.hh"
+
+namespace olb {
+
+template class BlockIndicatorFfromIndicatorF2D<double>;
+template class BlockIndicatorFfromSmoothIndicatorF2D<double,false>;
+template class BlockIndicatorMaterial2D<double>;
+template class BlockIndicatorIdentity2D<double>;
+
+}
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
+ * <http://www.openlb.net/>
+ *
+ * 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 <typename T>
+class BlockIndicatorFfromIndicatorF2D : public BlockIndicatorF2D<T> {
+protected:
+ IndicatorF2D<T>& _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<T>& indicatorF,
+ BlockGeometryStructure2D<T>& blockGeometry);
+
+ using BlockIndicatorF2D<T>::operator();
+ bool operator() (bool output[], const int input[]) override;
+
+ /// Returns min lattice position of the indicated domain's bounding box
+ Vector<int,2> getMin() override;
+ /// Returns max lattice position of the indicated domain's bounding box
+ Vector<int,2> 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 <typename T, bool HLBM>
+class BlockIndicatorFfromSmoothIndicatorF2D : public BlockIndicatorF2D<T> {
+protected:
+ SmoothIndicatorF2D<T,T,HLBM>& _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<T,T,HLBM>& indicatorF,
+ BlockGeometryStructure2D<T>& blockGeometry);
+
+ using BlockIndicatorF2D<T>::operator();
+ bool operator() (bool output[], const int input[]) override;
+
+ /// Returns a min lattice position of the indicated domain's bounding box
+ Vector<int,2> getMin() override;
+ /// Returns a max lattice position of the indicated domain's bounding box
+ Vector<int,2> getMax() override;
+};
+
+
+/// Block indicator functor from material numbers
+template <typename T>
+class BlockIndicatorMaterial2D : public BlockIndicatorF2D<T> {
+protected:
+ const std::vector<int> _materials;
+public:
+ /**
+ * \param blockGeometry Block geometry structue to be queried
+ * \param materials Material number vector
+ **/
+ BlockIndicatorMaterial2D(BlockGeometryStructure2D<T>& blockGeometry,
+ std::vector<int> materials);
+ /**
+ * \param blockGeometry Block geometry structure to be queried
+ * \param materials Material number list
+ **/
+ BlockIndicatorMaterial2D(BlockGeometryStructure2D<T>& blockGeometry,
+ std::list<int> materials);
+ /**
+ * \param blockGeometry Block geometry structure to be queried
+ * \param material Material number
+ **/
+ BlockIndicatorMaterial2D(BlockGeometryStructure2D<T>& blockGeometry,
+ int material);
+
+ using BlockIndicatorF2D<T>::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<int,2> getMin() override;
+ /// Returns max lattice position of the indicated domain's bounding box
+ Vector<int,2> getMax() override;
+};
+
+
+/// Block indicator identity
+template <typename T>
+class BlockIndicatorIdentity2D : public BlockIndicatorF2D<T> {
+protected:
+ BlockIndicatorF2D<T>& _indicatorF;
+public:
+ /**
+ * \param indicatorF Block indicator to be proxied
+ **/
+ BlockIndicatorIdentity2D(BlockIndicatorF2D<T>& indicatorF);
+
+ using BlockIndicatorF2D<T>::operator();
+ bool operator() (bool output[], const int input[]) override;
+
+ /// Returns min lattice position of the indicated domain's bounding box
+ Vector<int,2> getMin() override;
+ /// Returns max lattice position of the indicated domain's bounding box
+ Vector<int,2> getMax() override;
+};
+
+} // namespace olb
+
+#endif
diff --git a/src/functors/lattice/indicator/blockIndicatorF2D.hh b/src/functors/lattice/indicator/blockIndicatorF2D.hh
new file mode 100644
index 0000000..8d01a6b
--- /dev/null
+++ b/src/functors/lattice/indicator/blockIndicatorF2D.hh
@@ -0,0 +1,215 @@
+/* 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
+ * <http://www.openlb.net/>
+ *
+ * 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_HH
+#define BLOCK_INDICATOR_F_2D_HH
+
+#include <algorithm>
+
+#include "blockIndicatorF2D.h"
+#include "core/util.h"
+
+namespace olb {
+
+template <typename T