1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "fieldCoordinateSystemTransform.H"
27 #include "volFields.H"
28 #include "surfaceFields.H"
30 #include "transformGeometricField.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 void Foam::fieldCoordinateSystemTransform::transformField
40 const word& fieldName = field.name() + "Transformed";
42 dimensionedTensor R("R", field.dimensions(), coordSys_.R());
44 if (obr_.foundObject<Type>(fieldName))
47 const_cast<Type&>(obr_.lookupObject<Type>(fieldName));
53 Foam::transform(transField, R, transField);
60 Type& transField = obr_.store
67 obr_.time().timeName(),
69 IOobject::READ_IF_PRESENT,
78 Foam::transform(transField, R, transField);
87 void Foam::fieldCoordinateSystemTransform::transform
92 typedef GeometricField<Type, fvPatchField, volMesh> vfType;
93 typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfType;
95 if (obr_.foundObject<vfType>(fieldName))
99 Info<< type() << ": Field " << fieldName << " already in database"
103 transformField<vfType>(obr_.lookupObject<vfType>(fieldName));
105 else if (obr_.foundObject<sfType>(fieldName))
109 Info<< type() << ": Field " << fieldName << " already in database"
113 transformField<sfType>(obr_.lookupObject<sfType>(fieldName));
120 obr_.time().timeName(),
128 fieldHeader.headerOk()
129 && fieldHeader.headerClassName() == vfType::typeName
134 Info<< type() << ": Field " << fieldName << " read from file"
138 transformField<vfType>(obr_.lookupObject<vfType>(fieldName));
142 fieldHeader.headerOk()
143 && fieldHeader.headerClassName() == sfType::typeName
148 Info<< type() << ": Field " << fieldName << " read from file"
152 transformField<sfType>(obr_.lookupObject<sfType>(fieldName));
158 // ************************************************************************* //