OpenLB 1.7
Loading...
Searching...
No Matches
superIndicatorBaseF3D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2016 Benjamin Förster
4 * E-mail contact: info@openlb.net
5 * The most recent release of OpenLB can be downloaded at
6 * <http://www.openlb.net/>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program; if not, write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22*/
23
24#ifndef SUPER_INDICATOR_BASE_F_3D_HH
25#define SUPER_INDICATOR_BASE_F_3D_HH
26
29
30namespace olb {
31
32
33template <typename T>
35 : SuperF3D<T, bool>(geometry, 1),
36 _superGeometry(geometry)
37{ }
38
39template <typename T>
41{
42 OLB_ASSERT(iCloc < int(this->_blockF.size()) && iCloc >= 0,
43 "block functor index within bounds");
44 // Note: The type system doesn't guarantee this operation to be valid
45 // as blockF may contain any implementation of the BlockF3D interface.
46 return *static_cast<BlockIndicatorF3D<T>*>(this->_blockF[iCloc].get());
47}
48
49template <typename T>
51{
52 return this->_superGeometry;
53}
54
55template <typename T>
56bool SuperIndicatorF3D<T>::operator() (const int input[])
57{
58 bool output{};
59 if (_cachedData) {
60 output = _cachedData->getBlock(input[0]).get(input+1);
61 }
62 else {
63 this->operator()(&output, input);
64 }
65 return output;
66}
67
68template <typename T>
69bool SuperIndicatorF3D<T>::operator() (int iC, int iX, int iY, int iZ)
70{
71 bool output{};
72 if (_cachedData) {
73 output = _cachedData->getBlock(iC).get({iX, iY, iZ});
74 }
75 else {
76 this->operator()(&output, iC, iX, iY, iZ);
77 }
78 return output;
79}
80
81template <typename T>
83{
84 _cachedData = std::unique_ptr<SuperData<3,T,bool>>(
85 new SuperData<3,T,bool>(*this));
86 for (unsigned iC = 0; iC < this->_blockF.size(); ++iC) {
87 getBlockIndicatorF(iC).setCache(_cachedData->getBlock(iC));
88 }
89}
90
91
92} // namespace olb
93
94#endif
Base block indicator functor.
represents all functors that operate on a SuperStructure<T,3> in general
Representation of a statistic for a parallel 2D geometry.
BLOCK & getBlock(int locIC)
Read and write access to a single extended block geometry.
SuperIndicatorF3D(SuperGeometry< T, 3 > &geometry)
bool operator()(const int input[])
Indicator specific function operator overload.
void cache()
Optional: initialize _cachedData for faster access.
BlockIndicatorF3D< T > & getBlockIndicatorF(int iCloc)
Get block indicator.
SuperGeometry< T, 3 > & getSuperGeometry()
Get underlying super geometry.
Top level namespace for all of OpenLB.
#define OLB_ASSERT(COND, MESSAGE)
Definition olbDebug.h:45
Representation of a parallel 2D geometry – header file.