1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 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 \*---------------------------------------------------------------------------*/
30 #include "OSspecific.H"
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 Foam::autoPtr<Foam::writer<Type> > Foam::writer<Type>::New
40 typename wordConstructorTable::iterator cstrIter =
41 wordConstructorTablePtr_
44 if (cstrIter == wordConstructorTablePtr_->end())
48 "writer::New(const word&)"
49 ) << "Unknown write type " << writeType
51 << "Valid write types : " << endl
52 << wordConstructorTablePtr_->toc()
56 return autoPtr<writer<Type> >(cstrIter()());
60 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
63 Foam::fileName Foam::writer<Type>::getBaseName
65 const coordSet& points,
66 const wordList& valueSets
69 fileName fName(points.name());
73 fName += '_' + valueSets[i];
81 void Foam::writer<Type>::writeCoord
83 const coordSet& points,
88 if (points.hasVectorAxis())
90 write(points.vectorCoord(pointI), os);
94 write(points.scalarCoord(pointI), os);
100 void Foam::writer<Type>::writeTable
102 const coordSet& points,
103 const List<Type>& values,
107 forAll(points, pointI)
109 writeCoord(points, pointI, os);
112 write(values[pointI], os);
119 void Foam::writer<Type>::writeTable
121 const coordSet& points,
122 const List<const List<Type>*>& valuesPtrList,
126 forAll(points, pointI)
128 writeCoord(points, pointI, os);
130 forAll(valuesPtrList, i)
133 const List<Type>& values = *valuesPtrList[i];
134 write(values[pointI], os);
141 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
144 Foam::writer<Type>::writer()
148 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
151 Foam::writer<Type>::~writer()
155 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
158 Foam::Ostream& Foam::writer<Type>::write
169 template<class VSType>
170 Foam::Ostream& Foam::writer<Type>::writeVS
176 for (direction d=0; d<VSType::nComponents; d++)
178 os << value.component(d);
180 if (d <= VSType::nComponents-1)
190 Foam::Ostream& Foam::writer<Type>::write
196 return writeVS(value, os);
201 Foam::Ostream& Foam::writer<Type>::write
203 const sphericalTensor& value,
207 return writeVS(value, os);
212 Foam::Ostream& Foam::writer<Type>::write
214 const symmTensor& value,
218 return writeVS(value, os);
223 Foam::Ostream& Foam::writer<Type>::write
229 return writeVS(value, os);
233 // ************************************************************************* //