1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
32 #include "tecplotWriter.H"
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 void Foam::tecplotWriter::writeField(const Field<Type>& fld) const
41 for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
43 scalarField cmptFld(fld.component(cmpt));
46 Field<float> floats(cmptFld.size());
49 floats[i] = float(cmptFld[i]);
52 INTEGER4 size = INTEGER4(floats.size());
53 INTEGER4 IsDouble = 0; //float
55 //Pout<< "Writing component:" << cmpt << " of size:" << size
56 // << " floats." << endl;
58 if (!TECDAT112(&size, floats.begin(), &IsDouble))
60 // FatalErrorIn("tecplotWriter::writeField(..) const")
61 // << "Error in TECDAT112." << exit(FatalError);
68 Foam::tmp<Field<Type> > Foam::tecplotWriter::getPatchField
70 const bool nearCellValue,
71 const GeometricField<Type, fvPatchField, volMesh>& vfld,
77 return vfld.boundaryField()[patchI].patchInternalField();
81 return vfld.boundaryField()[patchI];
87 Foam::tmp<Field<Type> > Foam::tecplotWriter::getFaceField
89 const GeometricField<Type, fvsPatchField, surfaceMesh>& sfld,
90 const labelList& faceLabels
93 const polyBoundaryMesh& patches = sfld.mesh().boundaryMesh();
95 tmp<Field<Type> > tfld(new Field<Type>(faceLabels.size()));
96 Field<Type>& fld = tfld();
100 label faceI = faceLabels[i];
102 label patchI = patches.whichPatch(faceI);
106 fld[i] = sfld[faceI];
110 label localFaceI = faceI - patches[patchI].start();
111 fld[i] = sfld.boundaryField()[patchI][localFaceI];
119 template<class GeoField>
120 Foam::wordList Foam::tecplotWriter::getNames
122 const PtrList<GeoField>& flds
125 wordList names(flds.size());
128 names[i] = flds[i].name();
135 void Foam::tecplotWriter::getTecplotNames
137 const wordList& names,
140 DynamicList<INTEGER4>& varLocation
145 if (!varNames.empty())
150 direction nCmpts = pTraits<Type>::nComponents;
154 varNames += names[i];
155 varLocation.append(loc);
167 (cmpt != 0 ? " " : string::null)
170 + pTraits<Type>::componentNames[cmpt];
172 varLocation.append(loc);
179 template<class GeoField>
180 void Foam::tecplotWriter::getTecplotNames
182 const PtrList<GeoField>& flds,
185 DynamicList<INTEGER4>& varLocation
188 getTecplotNames<typename GeoField::value_type>
198 // ************************************************************************* //