/* This file is part of the OpenLB library
*
* Copyright (C) 2012-2018 Lukas Baron, Tim Dornieden, Mathias J. Krause,
* Albert Mink, Adrian Kummerlaender
* 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 ANALYTICAL_CALC_F_H
#define ANALYTICAL_CALC_F_H
#include "analyticalBaseF.h"
#include "utilities/functorPtr.h"
#include "utilities/arithmetic.h"
namespace olb {
/*
arithmetic helper classes for AnalyticalF1D, AnalyticalF3D, AnalyticalF3D
pointwise: difference, plus, multiplication, division
*/
//////////////////////////////// AnalyticCalcF1D ////////////////////////////////
/// arithmetic helper class for analytical 1D functors
template class F>
class AnalyticCalcF1D : public AnalyticalF1D {
protected:
FunctorPtr> _f;
FunctorPtr> _g;
public:
AnalyticCalcF1D(FunctorPtr>&& f,
FunctorPtr>&& g);
AnalyticCalcF1D(T scalar, FunctorPtr>&& g);
AnalyticCalcF1D(FunctorPtr>&& f, T scalar);
bool operator() (T output[], const S input[]) override;
};
/// addition functor
template
using AnalyticCalcPlus1D = AnalyticCalcF1D;
/// subtraction functor
template
using AnalyticCalcMinus1D = AnalyticCalcF1D;
/// multiplication functor
template
using AnalyticCalcMultiplication1D = AnalyticCalcF1D;
/// division functor
template
using AnalyticCalcDivision1D = AnalyticCalcF1D;
//////////////////////////////// AnalyticCalcF2D ////////////////////////////////
/// arithmetic helper class for analytical 2D functors
template class F>
class AnalyticCalcF2D : public AnalyticalF2D {
protected:
FunctorPtr> _f;
FunctorPtr> _g;
public:
AnalyticCalcF2D(FunctorPtr>&& f,
FunctorPtr>&& g);
AnalyticCalcF2D(T scalar, FunctorPtr>&& g);
AnalyticCalcF2D(FunctorPtr>&& f, T scalar);
bool operator() (T output[], const S input[]) override;
};
/// addition functor
template
using AnalyticCalcPlus2D = AnalyticCalcF2D;
/// subtraction functor
template
using AnalyticCalcMinus2D = AnalyticCalcF2D;
/// multiplication functor
template
using AnalyticCalcMultiplication2D = AnalyticCalcF2D;
/// division functor
template
using AnalyticCalcDivision2D = AnalyticCalcF2D;
//////////////////////////////// AnalyticCalcF3D ////////////////////////////////
/// arithmetic helper class for analytical 3D functors
template class F>
class AnalyticCalcF3D : public AnalyticalF3D {
protected:
FunctorPtr> _f;
FunctorPtr> _g;
public:
AnalyticCalcF3D(FunctorPtr>&& f,
FunctorPtr>&& g);
AnalyticCalcF3D(T scalar, FunctorPtr>&& g);
AnalyticCalcF3D(FunctorPtr>&& f, T scalar);
bool operator() (T output[], const S input[]) override;
};
/// addition functor
template
using AnalyticCalcPlus3D = AnalyticCalcF3D;
/// subtraction functor
template
using AnalyticCalcMinus3D = AnalyticCalcF3D;
/// multiplication functor
template
using AnalyticCalcMultiplication3D = AnalyticCalcF3D;
/// division functor
template
using AnalyticCalcDivision3D = AnalyticCalcF3D;
/**
* \name Arithmetic for functors managed by std::shared_ptr
* \{
**/
template
std::shared_ptr> operator+(std::shared_ptr> lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator+(std::shared_ptr> lhs, T rhs);
template
std::shared_ptr> operator+(T lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator-(std::shared_ptr> lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator-(std::shared_ptr> lhs, T rhs);
template
std::shared_ptr> operator-(T lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator*(std::shared_ptr> lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator*(std::shared_ptr> lhs, T rhs);
template
std::shared_ptr> operator*(T lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator/(std::shared_ptr> lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator/(std::shared_ptr> lhs, T rhs);
template
std::shared_ptr> operator/(T lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator+(std::shared_ptr> lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator+(std::shared_ptr> lhs, T rhs);
template
std::shared_ptr> operator+(T lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator-(std::shared_ptr> lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator-(std::shared_ptr> lhs, T rhs);
template
std::shared_ptr> operator-(T lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator*(std::shared_ptr> lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator*(std::shared_ptr> lhs, T rhs);
template
std::shared_ptr> operator*(T lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator/(std::shared_ptr> lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator/(std::shared_ptr> lhs, T rhs);
template
std::shared_ptr> operator/(T lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator+(std::shared_ptr> lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator+(std::shared_ptr> lhs, T rhs);
template
std::shared_ptr> operator+(T lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator-(std::shared_ptr> lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator-(std::shared_ptr> lhs, T rhs);
template
std::shared_ptr> operator-(T lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator*(std::shared_ptr> lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator*(std::shared_ptr> lhs, T rhs);
template
std::shared_ptr> operator*(T lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator/(std::shared_ptr> lhs, std::shared_ptr> rhs);
template
std::shared_ptr> operator/(std::shared_ptr> lhs, T rhs);
template
std::shared_ptr> operator/(T lhs, std::shared_ptr> rhs);
///\}
} // end namespace olb
#endif