/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2018 OpenCFD Ltd. ------------------------------------------------------------------------------- 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 . \*---------------------------------------------------------------------------*/ #include "PatchFunction1.H" #include "Time.H" #include "polyMesh.H" // * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * // template Foam::PatchFunction1::PatchFunction1 ( const polyPatch& pp, const word& entryName, const bool faceValues ) : refCount(), name_(entryName), patch_(pp), faceValues_(faceValues), coordSys_() {} template Foam::PatchFunction1::PatchFunction1 ( const polyPatch& pp, const word& entryName, const dictionary& dict, const bool faceValues ) : refCount(), name_(entryName), patch_(pp), faceValues_(faceValues), coordSys_(pp.boundaryMesh().mesh().thisDb(), dict) {} template Foam::PatchFunction1::PatchFunction1(const PatchFunction1& pf1) : refCount(), name_(pf1.name_), patch_(pf1.patch_), faceValues_(pf1.faceValues_), coordSys_(pf1.coordSys_) {} template Foam::PatchFunction1::PatchFunction1 ( const PatchFunction1& pf1, const polyPatch& pp ) : refCount(), name_(pf1.name_), patch_(pp), faceValues_(pf1.faceValues_), coordSys_(pf1.coordSys_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template const Foam::word& Foam::PatchFunction1::name() const { return name_; } template const Foam::polyPatch& Foam::PatchFunction1::patch() const { return patch_; } template bool Foam::PatchFunction1::faceValues() const { return faceValues_; } template void Foam::PatchFunction1::convertTimeBase(const Time&) {} template Foam::tmp> Foam::PatchFunction1::value ( const scalar x ) const { NotImplemented; return Field(); } template bool Foam::PatchFunction1::uniform() const { return !coordSys_.active(); } template Foam::tmp> Foam::PatchFunction1::integrate ( const scalar x1, const scalar x2 ) const { NotImplemented; return Field(); } template Foam::tmp Foam::PatchFunction1::localPosition(const pointField& globalPos) const { if (!coordSys_.active()) { return globalPos; } return coordSys_.coordSys()().localPosition(globalPos); } template Foam::tmp> Foam::PatchFunction1::transform ( const tmp>& tfld ) const { if (!coordSys_.active()) { return tfld; } tmp> tresult = ( faceValues_ ? this->coordSys_.transform(this->patch_.faceCentres(), tfld()) : this->coordSys_.transform(this->patch_.localPoints(), tfld()) ); tfld.clear(); return tresult; } template Foam::tmp> Foam::PatchFunction1::transform ( const Field& fld ) const { if (!coordSys_.active()) { return fld; } if (faceValues_) { return this->coordSys_.transform(this->patch_.faceCentres(), fld); } else { return this->coordSys_.transform(this->patch_.localPoints(), fld); } } template void Foam::PatchFunction1::autoMap(const FieldMapper& mapper) {} template void Foam::PatchFunction1::rmap ( const PatchFunction1& pf1, const labelList& addr ) {} template void Foam::PatchFunction1::writeData(Ostream& os) const { coordSys_.writeEntry(os); // Leave type() output up to derived type. This is so 'Constant'&Uniform // can do backwards compatibility. //os.writeKeyword(name_) << type(); } // * * * * * * * * * * * * * * IOStream Operators * * * * * * * * * * * * * // template Foam::Ostream& Foam::operator<< ( Ostream& os, const PatchFunction1& rhs ) { os.check(FUNCTION_NAME); os << rhs.name_; rhs.writeData(os); return os; } // ************************************************************************* //