/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd. \\/ 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 2 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, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA \*---------------------------------------------------------------------------*/ #include "cyclicPointPatchField.H" #include "Swap.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template cyclicPointPatchField::cyclicPointPatchField ( const pointPatch& p, const DimensionedField& iF ) : coupledPointPatchField(p, iF), cyclicPatch_(refCast(p)) {} template cyclicPointPatchField::cyclicPointPatchField ( const pointPatch& p, const DimensionedField& iF, const dictionary& dict ) : coupledPointPatchField(p, iF, dict), cyclicPatch_(refCast(p)) { if (!isType(p)) { FatalIOErrorIn ( "cyclicPointPatchField::cyclicPointPatchField\n" "(\n" " const pointPatch& p,\n" " const Field& field,\n" " const dictionary& dict\n" ")\n", dict ) << "patch " << this->patch().index() << " not cyclic type. " << "Patch type = " << p.type() << exit(FatalIOError); } } template cyclicPointPatchField::cyclicPointPatchField ( const cyclicPointPatchField& ptf, const pointPatch& p, const DimensionedField& iF, const pointPatchFieldMapper& mapper ) : coupledPointPatchField(ptf, p, iF, mapper), cyclicPatch_(refCast(p)) { if (!isType(this->patch())) { FatalErrorIn ( "cyclicPointPatchField::cyclicPointPatchField\n" "(\n" " const cyclicPointPatchField& ptf,\n" " const pointPatch& p,\n" " const DimensionedField& iF,\n" " const pointPatchFieldMapper& mapper\n" ")\n" ) << "Field type does not correspond to patch type for patch " << this->patch().index() << "." << endl << "Field type: " << typeName << endl << "Patch type: " << this->patch().type() << exit(FatalError); } } template cyclicPointPatchField::cyclicPointPatchField ( const cyclicPointPatchField& ptf, const DimensionedField& iF ) : coupledPointPatchField(ptf, iF), cyclicPatch_(ptf.cyclicPatch_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template void cyclicPointPatchField::swapAdd(Field& pField) const { Field pf(this->patchInternalField(pField)); const edgeList& pairs = cyclicPatch_.transformPairs(); if (doTransform()) { forAll(pairs, pairi) { Type tmp = pf[pairs[pairi][0]]; pf[pairs[pairi][0]] = transform(forwardT(), pf[pairs[pairi][1]]); pf[pairs[pairi][1]] = transform(reverseT(), tmp); } } else { forAll(pairs, pairi) { Swap(pf[pairs[pairi][0]], pf[pairs[pairi][1]]); } } addToInternalField(pField, pf); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // ************************************************************************* //