/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM 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 3 of the License, or (at your option) any later version. OpenFOAM 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 OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ #define TEMPLATE template #include "FieldFunctionsM.H" #include "UPstream.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // template void component ( Field::cmptType>& res, const UList& f, const direction d ); template void T(Field& res, const UList& f); template void pow ( Field::type>& res, const UList& vf ); template tmp::type> > pow ( const UList& f, typename powProduct::type = pTraits::type>::zero ); template tmp::type> > pow ( const tmp >& tf, typename powProduct::type = pTraits::type>::zero ); template void sqr ( Field::type>& res, const UList& vf ); template tmp::type> > sqr(const UList& f); template tmp::type> > sqr(const tmp >& tf); template void magSqr(Field& res, const UList& f); template tmp > magSqr(const UList& f); template tmp > magSqr(const tmp >& tf); template void mag(Field& res, const UList& f); template tmp > mag(const UList& f); template tmp > mag(const tmp >& tf); template void cmptMax(Field::cmptType>& res, const UList& f); template tmp::cmptType> > cmptMax(const UList& f); template tmp::cmptType> > cmptMax(const tmp >& tf); template void cmptMin(Field::cmptType>& res, const UList& f); template tmp::cmptType> > cmptMin(const UList& f); template tmp::cmptType> > cmptMin(const tmp >& tf); template void cmptAv(Field::cmptType>& res, const UList& f); template tmp::cmptType> > cmptAv(const UList& f); template tmp::cmptType> > cmptAv(const tmp >& tf); template void cmptMag(Field& res, const UList& f); template tmp > cmptMag(const UList& f); template tmp > cmptMag(const tmp >& tf); #define TMP_UNARY_FUNCTION(ReturnType, Func) \ \ template \ ReturnType Func(const tmp >& tf1); template Type max(const UList& f); TMP_UNARY_FUNCTION(Type, max) template Type min(const UList& f); TMP_UNARY_FUNCTION(Type, min) template Type sum(const UList& f); TMP_UNARY_FUNCTION(Type, sum) template Type maxMagSqr(const UList& f); TMP_UNARY_FUNCTION(Type, maxMagSqr) template Type minMagSqr(const UList& f); TMP_UNARY_FUNCTION(Type, minMagSqr) template scalar sumProd(const UList& f1, const UList& f2); template Type sumCmptProd(const UList& f1, const UList& f2); template scalar sumSqr(const UList& f); TMP_UNARY_FUNCTION(scalar, sumSqr) template scalar sumMag(const UList& f); TMP_UNARY_FUNCTION(scalar, sumMag) template Type sumCmptMag(const UList& f); TMP_UNARY_FUNCTION(Type, sumCmptMag) template Type average(const UList& f); TMP_UNARY_FUNCTION(Type, average) #define G_UNARY_FUNCTION(ReturnType, gFunc, Func, rFunc) \ \ template \ ReturnType gFunc(const UList& f, const int comm = UPstream::worldComm); \ TMP_UNARY_FUNCTION(ReturnType, gFunc) G_UNARY_FUNCTION(Type, gMax, max, max) G_UNARY_FUNCTION(Type, gMin, min, min) G_UNARY_FUNCTION(Type, gSum, sum, sum) G_UNARY_FUNCTION(Type, gMaxMagSqr, maxMagSqr, maxMagSqr) G_UNARY_FUNCTION(Type, gMinMagSqr, minMagSqr, minMagSqr) G_UNARY_FUNCTION(scalar, gSumSqr, sumSqr, sum) G_UNARY_FUNCTION(scalar, gSumMag, sumMag, sum) G_UNARY_FUNCTION(Type, gSumCmptMag, sumCmptMag, sum) #undef G_UNARY_FUNCTION template scalar gSumProd ( const UList& f1, const UList& f2, const int comm = UPstream::worldComm ); template Type gSumCmptProd ( const UList& f1, const UList& f2, const int comm = UPstream::worldComm ); template Type gAverage ( const UList& f, const int comm = UPstream::worldComm ); TMP_UNARY_FUNCTION(Type, gAverage) #undef TMP_UNARY_FUNCTION BINARY_FUNCTION(Type, Type, Type, max) BINARY_FUNCTION(Type, Type, Type, min) BINARY_FUNCTION(Type, Type, Type, cmptMultiply) BINARY_FUNCTION(Type, Type, Type, cmptDivide) BINARY_TYPE_FUNCTION(Type, Type, Type, max) BINARY_TYPE_FUNCTION(Type, Type, Type, min) BINARY_TYPE_FUNCTION(Type, Type, Type, cmptMultiply) BINARY_TYPE_FUNCTION(Type, Type, Type, cmptDivide) // * * * * * * * * * * * * * * * Global operators * * * * * * * * * * * * * // UNARY_OPERATOR(Type, Type, -, negate) BINARY_OPERATOR(Type, Type, scalar, *, multiply) BINARY_OPERATOR(Type, scalar, Type, *, multiply) BINARY_OPERATOR(Type, Type, scalar, /, divide) BINARY_TYPE_OPERATOR_SF(Type, scalar, Type, *, multiply) BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, *, multiply) BINARY_TYPE_OPERATOR_FS(Type, Type, scalar, /, divide) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #define PRODUCT_OPERATOR(product, Op, OpFunc) \ \ template \ void OpFunc \ ( \ Field::type>& res, \ const UList& f1, \ const UList& f2 \ ); \ \ template \ tmp::type> > \ operator Op(const UList& f1, const UList& f2); \ \ template \ tmp::type> > \ operator Op(const UList& f1, const tmp >& tf2); \ \ template \ tmp::type> > \ operator Op(const tmp >& tf1, const UList& f2); \ \ template \ tmp::type> > \ operator Op(const tmp >& tf1, const tmp >& tf2); \ \ template \ void OpFunc \ ( \ Field::type>& res, \ const UList& f1, \ const VectorSpace& vs \ ); \ \ template \ tmp::type> > \ operator Op(const UList& f1, const VectorSpace& vs); \ \ template \ tmp::type> > \ operator Op(const tmp >&tf1,const VectorSpace&vs);\ \ template \ void OpFunc \ ( \ Field::type>& res, \ const VectorSpace& vs, \ const UList& f1 \ ); \ \ template \ tmp::type> > \ operator Op(const VectorSpace& vs, const UList& f1); \ \ template \ tmp::type> > \ operator Op(const VectorSpace&vs,const tmp >&tf1); PRODUCT_OPERATOR(typeOfSum, +, add) PRODUCT_OPERATOR(typeOfSum, -, subtract) PRODUCT_OPERATOR(outerProduct, *, outer) PRODUCT_OPERATOR(crossProduct, ^, cross) PRODUCT_OPERATOR(innerProduct, &, dot) PRODUCT_OPERATOR(scalarProduct, &&, dotdot) #undef PRODUCT_OPERATOR // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "undefFieldFunctionsM.H" #include "scalarField.H" // ************************************************************************* //