/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
\*---------------------------------------------------------------------------*/
#include "steadyParticleTracksTemplates.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template
bool fieldOk(const IOobjectList& cloudObjs, const word& name)
{
IOobjectList objects(cloudObjs.lookupClass(IOField::typeName));
return (objects.lookup(name) != NULL);
}
template
tmp > readParticleField
(
const word& name,
const IOobjectList cloudObjs
)
{
IOobjectList objects(cloudObjs.lookupClass(IOField::typeName));
const IOobject* obj = objects.lookup(name);
if (obj != NULL)
{
IOField newField(*obj);
return tmp >(new Field(newField.xfer()));
}
FatalErrorIn
(
"template"
"void readParticleField"
"("
"const word&, "
"const IOobjectList"
")"
)
<< "error: cloud field name " << name << " not found"
<< abort(FatalError);
return Field::null();
}
template
void readFields
(
PtrList >& values,
const List& fieldNames,
const IOobjectList& cloudObjs
)
{
IOobjectList objects(cloudObjs.lookupClass(IOField::typeName));
forAll(fieldNames, j)
{
const IOobject* obj = objects.lookup(fieldNames[j]);
if (obj != NULL)
{
Info<< " reading field " << fieldNames[j] << endl;
IOField newField(*obj);
values.set(j, new List(newField.xfer()));
}
else
{
FatalErrorIn
(
"template"
"void readFields"
"("
"PtrList >&, "
"const List&, "
"const IOobjectList&"
")"
)
<< "Unable to read field " << fieldNames[j]
<< abort(FatalError);
}
}
}
template
void writeVTK(OFstream& os, const Type& value)
{
os << value.component(0);
for (label i=1; i::nComponents; i++)
{
os << ' ' << value.component(i);
}
}
template
void writeVTKFields
(
OFstream& os,
const PtrList >& values,
const List >& addr,
const List& fieldNames
)
{
label step = max(floor(8/pTraits::nComponents), 1);
forAll(values, fieldI)
{
Info<< " writing field " << fieldNames[fieldI] << endl;
os << nl << fieldNames[fieldI] << ' ' << pTraits::nComponents
<< ' ' << values[fieldI].size() << " float" << nl;
label offset = 0;
forAll(addr, trackI)
{
const List