ENH: Added helper function to set 'writer' API

This commit is contained in:
andy
2012-09-24 12:37:56 +01:00
parent b9820bf4e7
commit 4414a65683
2 changed files with 33 additions and 9 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -152,6 +152,25 @@ Foam::writer<Type>::~writer()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::writer<Type>::write
(
const coordSet& points,
const wordList& valueSetNames,
const List<Field<Type> >& valueSets,
Ostream& os
) const
{
List<const Field<Type>*> valueSetPtrs(valueSets.size());
forAll(valueSetPtrs, i)
{
valueSetPtrs[i] = &valueSets[i];
}
write(points, valueSetNames, valueSetPtrs, os);
}
template<class Type>
Foam::Ostream& Foam::writer<Type>::write
(

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -40,13 +40,7 @@ Description
// Output list of points and corresponding values
scalarFormatter().write
(
coordSet
(
points, // sample coordinates
"someLine", // name of coordSet
"distance", // write coordinates as distance to refPoint
points[0] // reference point
),
coordSet(...)
"U.component(0)", // name of values
vals // values
);
@ -164,6 +158,17 @@ public:
Ostream&
) const = 0;
//- General entry point for writing.
// The data is organized in a set of point with one or more values
// per point
virtual void write
(
const coordSet&,
const wordList&,
const List<Field<Type> >&,
Ostream&
) const;
//- General entry point for writing of multiple coordSets.
// Each coordSet (track) has same data variables.
// The data is per variable, per track, per point of track.