1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-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_
43 if (cstrIter == wordConstructorTablePtr_->end())
47 "writer::New(const word&)"
48 ) << "Unknown write type " << writeType
50 << "Valid write types : " << nl
51 << wordConstructorTablePtr_->sortedToc()
55 return autoPtr<writer<Type> >(cstrIter()());
59 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
62 Foam::fileName Foam::writer<Type>::getBaseName
64 const coordSet& points,
65 const wordList& valueSets
68 fileName fName(points.name());
72 fName += '_' + valueSets[i];
80 void Foam::writer<Type>::writeCoord
82 const coordSet& points,
87 if (points.hasVectorAxis())
89 write(points.vectorCoord(pointI), os);
93 write(points.scalarCoord(pointI), os);
99 void Foam::writer<Type>::writeTable
101 const coordSet& points,
102 const List<Type>& values,
106 forAll(points, pointI)
108 writeCoord(points, pointI, os);
110 write(values[pointI], os);
117 void Foam::writer<Type>::writeTable
119 const coordSet& points,
120 const List<const List<Type>*>& valuesPtrList,
124 forAll(points, pointI)
126 writeCoord(points, pointI, os);
128 forAll(valuesPtrList, i)
132 const List<Type>& values = *valuesPtrList[i];
133 write(values[pointI], os);
140 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
143 Foam::writer<Type>::writer()
147 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
150 Foam::writer<Type>::~writer()
154 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
157 Foam::Ostream& Foam::writer<Type>::write
168 template<class VSType>
169 Foam::Ostream& Foam::writer<Type>::writeVS
175 for (direction d=0; d<VSType::nComponents; d++)
182 os << value.component(d);
189 void Foam::writer<Type>::writeSeparator
194 os << token::SPACE << token::TAB;
199 Foam::Ostream& Foam::writer<Type>::write
205 return writeVS(value, os);
210 Foam::Ostream& Foam::writer<Type>::write
212 const sphericalTensor& value,
216 return writeVS(value, os);
221 Foam::Ostream& Foam::writer<Type>::write
223 const symmTensor& value,
227 return writeVS(value, os);
232 Foam::Ostream& Foam::writer<Type>::write
238 return writeVS(value, os);
242 // ************************************************************************* //