/* This file is part of the OpenLB library
*
* Copyright (C) 2014-2016 Mathias J. Krause, Cyril Masquelier,
* Benjamin Förster, Albert Mink
* 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 INDIC_CALC_2D_H
#define INDIC_CALC_2D_H
#include "indicatorBaseF2D.h"
#include "utilities/arithmetic.h"
namespace olb {
/*
* arithmetic helper classes for IndicatorF1D, IndicatorF2D, smoothIndicator2D
* UNION +
* WITHOUT -
* INTERSECTION *
*/
//////////////////////////////// IndicCalc1D ////////////////////////////////
/// arithmetic helper class for Indicator 1d functors
template
class IndicCalc1D : public IndicatorF1D {
protected:
IndicatorF1D& _f;
IndicatorF1D& _g;
public:
// set image/target dimensions of IndicCalc1D as well
IndicCalc1D(IndicatorF1D& f, IndicatorF1D& g);
};
/// addition functor acts as union
template
class IndicPlus1D : public IndicCalc1D {
public:
IndicPlus1D(IndicatorF1D& f, IndicatorF1D& g);
bool operator() (bool output[], const S input[]) override;
};
/// subtraction functor acts as without
template
class IndicMinus1D : public IndicCalc1D {
public:
IndicMinus1D(IndicatorF1D& f, IndicatorF1D& g);
bool operator() (bool output[], const S input[]) override;
};
/// multiplication functor acts as intersection
template
class IndicMultiplication1D : public IndicCalc1D {
public:
IndicMultiplication1D(IndicatorF1D& f, IndicatorF1D& g);
bool operator() (bool output[], const S input[]) override;
};
//////////////////////////////// indicCalc2D ////////////////////////////////
/// arithmetic helper class for Indicator 2D functors
template class F>
class IndicCalc2D : public IndicatorF2D {
protected:
std::shared_ptr> _f;
std::shared_ptr> _g;
public:
IndicCalc2D( std::shared_ptr> f, std::shared_ptr> g );
bool operator() (bool output[], const S input[2]) override;
};
/// Addition functor (W==bool: Union)
template
using IndicPlus2D = IndicCalc2D;
template
using IndicMinus2D = IndicCalc2D;
template
using IndicMultiplication2D = IndicCalc2D;
template class F1, template class F2,
typename=typename std::enable_if, F1>::value>::type>
std::shared_ptr> operator+(std::shared_ptr> lhs, std::shared_ptr> rhs);
template class F1, template class F2,
typename=typename std::enable_if, F1>::value>::type>
std::shared_ptr> operator-(std::shared_ptr> lhs, std::shared_ptr> rhs);
template class F1, template class F2,
typename=typename std::enable_if, F1>::value>::type>
std::shared_ptr> operator*(std::shared_ptr> lhs, std::shared_ptr> rhs);
template class F1, template class F2,
typename=typename std::enable_if, F1>::value>::type>
std::shared_ptr> operator+(F1 & lhs, std::shared_ptr> rhs);
template class F1, template class F2,
typename=typename std::enable_if, F1>::value>::type>
std::shared_ptr> operator-(F1 & lhs, std::shared_ptr> rhs);
template class F1, template class F2,
typename=typename std::enable_if, F1>::value>::type>
std::shared_ptr> operator*(F1 & lhs, std::shared_ptr> rhs);
} // end namespace olb
#endif