1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2011 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
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 \*---------------------------------------------------------------------------*/
29 #include "OSspecific.H"
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 Foam::autoPtr< Foam::writer<Type> > Foam::writer<Type>::New
39 typename wordConstructorTable::iterator cstrIter =
40 wordConstructorTablePtr_->find(writeType);
42 if (cstrIter == wordConstructorTablePtr_->end())
46 "writer::New(const word&)"
47 ) << "Unknown write type "
48 << writeType << nl << nl
49 << "Valid write types : " << endl
50 << wordConstructorTablePtr_->sortedToc()
54 return autoPtr<writer<Type> >(cstrIter()());
58 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
61 Foam::fileName Foam::writer<Type>::getBaseName
63 const coordSet& points,
64 const wordList& valueSets
67 fileName fName(points.name());
71 fName += '_' + valueSets[i];
79 void Foam::writer<Type>::writeCoord
81 const coordSet& points,
86 if (points.hasVectorAxis())
88 write(points.vectorCoord(pointI), os);
92 write(points.scalarCoord(pointI), os);
98 void Foam::writer<Type>::writeTable
100 const coordSet& points,
101 const List<Type>& values,
105 forAll(points, pointI)
107 writeCoord(points, pointI, os);
109 write(values[pointI], os);
116 void Foam::writer<Type>::writeTable
118 const coordSet& points,
119 const List<const List<Type>*>& valuesPtrList,
123 forAll(points, pointI)
125 writeCoord(points, pointI, os);
127 forAll(valuesPtrList, i)
131 const List<Type>& values = *valuesPtrList[i];
132 write(values[pointI], os);
139 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
142 Foam::writer<Type>::writer()
146 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
149 Foam::writer<Type>::~writer()
153 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
156 Foam::Ostream& Foam::writer<Type>::write
167 template<class VSType>
168 Foam::Ostream& Foam::writer<Type>::writeVS
174 for (direction d=0; d<VSType::nComponents; d++)
181 os << value.component(d);
188 void Foam::writer<Type>::writeSeparator
193 os << token::SPACE << token::TAB;
198 Foam::Ostream& Foam::writer<Type>::write
204 return writeVS(value, os);
209 Foam::Ostream& Foam::writer<Type>::write
211 const sphericalTensor& value,
215 return writeVS(value, os);
220 Foam::Ostream& Foam::writer<Type>::write
222 const symmTensor& value,
226 return writeVS(value, os);
231 Foam::Ostream& Foam::writer<Type>::write
237 return writeVS(value, os);
241 // ************************************************************************* //