/* This file is part of the OpenLB library * * Copyright (C) 2014-2017 Albert Mink, Mathias J. Krause, * 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 SUPER_CALC_F_2D_H #define SUPER_CALC_F_2D_H #include "utilities/arithmetic.h" #include "superBaseF2D.h" #include "utilities/functorPtr.h" /** Note: Throughout the whole source code directory genericFunctions, the * template parameters for i/o dimensions are: * F: S^m -> T^n (S=source, T=target) */ namespace olb { /// Arithmetic operations for SuperF2D functors /** * \tparam F Function object defining the arithmetic operation to be perfomed * e.g. std::minus for substraction * * Block level functors are instantiated for operations if at least one input * functor exposes block level functors. See BlockCalcF2D * * Global queries are not delegated to block level functors to prevent unnecessary * synchronization. * * Warning: Allocation error possible in functors that have multiple functor * evaluation like SuperSum2D **/ template class F> class SuperCalcF2D : public SuperF2D { protected: FunctorPtr> _f; FunctorPtr> _g; public: SuperCalcF2D(FunctorPtr>&& f, FunctorPtr>&& g); SuperCalcF2D(W scalar, FunctorPtr>&& g); SuperCalcF2D(FunctorPtr>&& f, W scalar); bool operator() (W output[], const int input[]) override; }; /// Addition functor (W==bool: Union) template using SuperCalcPlus2D = SuperCalcF2D; /// Subtraction functor (W==bool: Without) template using SuperCalcMinus2D = SuperCalcF2D; /// Multiplication functor (W==bool: Intersection) template using SuperCalcMultiplication2D = SuperCalcF2D; /// Division functor template using SuperCalcDivision2D = SuperCalcF2D; /// Power functor template using SuperCalcPower2D = SuperCalcF2D; /** * \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, W rhs); template std::shared_ptr> operator+(W 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, W rhs); template std::shared_ptr> operator-(W 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, W rhs); template std::shared_ptr> operator*(W 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, W rhs); template std::shared_ptr> operator/(W lhs, std::shared_ptr> rhs); ///\} } // end namespace olb #endif