OpenLB 1.7
Loading...
Searching...
No Matches
smoothIndicatorCalcF3D.hh
Go to the documentation of this file.
1/* This file is part of the OpenLB library
2 *
3 * Copyright (C) 2014-2016 Mathias J. Krause, Cyril Masquelier, Benjamin Förster, Albert Mink
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 SMOOTH_INDICATOR_CALC_F_3D_HH
25#define SMOOTH_INDICATOR_CALC_F_3D_HH
26
28
29namespace olb {
30
31
33template <typename T, typename S>
35 : _f(f), _g(g)
36{
37 for ( int i=0; i<3; i++) {
38 this->_myMin[i] = util::min(f.getMin()[i], g.getMin()[i]);
39 this->_myMax[i] = util::max(f.getMax()[i], g.getMax()[i]);
40 }
41 std::swap(f._ptrCalcC, this->_ptrCalcC);
42}
43
44
45template <typename T, typename S>
49
50// returns 1 if( f==1 || g==1 ) UNION
51template <typename T, typename S>
52bool SmoothIndicPlus3D<T, S>::operator()(T output[], const S input[])
53{
54 this->_f(output, input);
55 T tmp;
56 this->_g(&tmp, input);
57 output[0] = util::max(output[0], tmp);
58 return true;
59}
60
61
62template <typename T, typename S>
64{
65 auto tmp = std::make_shared< SmoothIndicPlus3D<T,S> >(*this, rhs);
66 this->_ptrCalcC = tmp;
67 return *tmp;
68}
69
70
71} // end namespace olb
72
73#endif
IndicSmoothCalc3D //////////////////////////////// arithmetic helper class for Indicator 3d functors.
SmoothIndicCalc3D(SmoothIndicatorF3D< T, S > &f, SmoothIndicatorF3D< T, S > &g)
SmoothIndicPlus3D(SmoothIndicatorF3D< T, S > &f, SmoothIndicatorF3D< T, S > &g)
bool operator()(T output[], const S input[]) override
cpu::simd::Pack< T > min(cpu::simd::Pack< T > rhs, cpu::simd::Pack< T > lhs)
Definition pack.h:124
cpu::simd::Pack< T > max(cpu::simd::Pack< T > rhs, cpu::simd::Pack< T > lhs)
Definition pack.h:130
Top level namespace for all of OpenLB.