1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "tecplotWriter.H"
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 void Foam::tecplotWriter::writeField(const Field<Type>& fld) const
42 for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
44 scalarField cmptFld(fld.component(cmpt));
47 Field<float> floats(cmptFld.size());
50 floats[i] = float(cmptFld[i]);
53 INTEGER4 size = INTEGER4(floats.size());
54 INTEGER4 IsDouble = 0; //float
56 //Pout<< "Writing component:" << cmpt << " of size:" << size
57 // << " floats." << endl;
59 if (!TECDAT112(&size, floats.begin(), &IsDouble))
61 // FatalErrorIn("tecplotWriter::writeField(..) const")
62 // << "Error in TECDAT112." << exit(FatalError);
69 Foam::tmp<Field<Type> > Foam::tecplotWriter::getPatchField
71 const bool nearCellValue,
72 const GeometricField<Type, fvPatchField, volMesh>& vfld,
78 return vfld.boundaryField()[patchI].patchInternalField();
82 return vfld.boundaryField()[patchI];
88 Foam::tmp<Field<Type> > Foam::tecplotWriter::getFaceField
90 const GeometricField<Type, fvsPatchField, surfaceMesh>& sfld,
91 const labelList& faceLabels
94 const polyBoundaryMesh& patches = sfld.mesh().boundaryMesh();
96 tmp<Field<Type> > tfld(new Field<Type>(faceLabels.size()));
97 Field<Type>& fld = tfld();
101 label faceI = faceLabels[i];
103 label patchI = patches.whichPatch(faceI);
107 fld[i] = sfld[faceI];
111 label localFaceI = faceI - patches[patchI].start();
112 fld[i] = sfld.boundaryField()[patchI][localFaceI];
120 template<class GeoField>
121 Foam::wordList Foam::tecplotWriter::getNames
123 const PtrList<GeoField>& flds
126 wordList names(flds.size());
129 names[i] = flds[i].name();
136 void Foam::tecplotWriter::getTecplotNames
138 const wordList& names,
141 DynamicList<INTEGER4>& varLocation
146 if (!varNames.empty())
151 label nCmpts = pTraits<Type>::nComponents;
155 varNames += names[i];
156 varLocation.append(loc);
168 (cmpt != 0 ? " " : string::null)
171 + pTraits<Type>::componentNames[cmpt];
173 varLocation.append(loc);
180 template<class GeoField>
181 void Foam::tecplotWriter::getTecplotNames
183 const PtrList<GeoField>& flds,
186 DynamicList<INTEGER4>& varLocation
189 getTecplotNames<typename GeoField::value_type>
199 // ************************************************************************* //