OpenLB 1.7
Loading...
Searching...
No Matches
smoothIndicatorCalcF2D.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,
4 * Benjamin Förster, Albert Mink
5 * E-mail contact: info@openlb.net
6 * The most recent release of OpenLB can be downloaded at
7 * <http://www.openlb.net/>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program; if not, write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
23*/
24
25#ifndef SMOOTH_INDICATOR_CALC_F_2D_HH
26#define SMOOTH_INDICATOR_CALC_F_2D_HH
27
29
30namespace olb {
31
32
34template <typename T, typename S>
36 : _f(f), _g(g)
37{
38 for ( int i=0; i<2; i++) {
39 this->_myMin[i] = util::min(f.getMin()[i], g.getMin()[i]);
40 this->_myMax[i] = util::max(f.getMax()[i], g.getMax()[i]);
41 }
42 this->_circumRadius = util::max( 0.5*(this->getMax()[0]-this->getMin()[0]), 0.5*(this->getMax()[1]-this->getMin()[1]));
43 std::swap(f._ptrCalcC, this->_ptrCalcC);
44}
45
46
47template <typename T, typename S>
51
52// returns 1 if( f==1 || g==1 ) UNION
53template <typename T, typename S>
54bool SmoothIndicPlus2D<T, S>::operator()(T output[], const S input[])
55{
56 this->_f(output, input);
57 T tmp;
58 this->_g(&tmp, input);
59 output[0] = util::max(output[0], tmp);
60 return true;
61}
62
63
64template <typename T, typename S>
66{
67 auto tmp = std::make_shared< SmoothIndicPlus2D<T,S> >(*this,rhs);
68 this->_ptrCalcC = tmp;
69 return *tmp;
70}
71
72
73} // end namespace olb
74
75#endif
IndicSmoothCalc2D //////////////////////////////// arithmetic helper class for Indicator 2d functors.
SmoothIndicCalc2D(SmoothIndicatorF2D< T, S > &f, SmoothIndicatorF2D< T, S > &g)
SmoothIndicPlus2D(SmoothIndicatorF2D< T, S > &f, SmoothIndicatorF2D< 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.