updated magGrad utility, and separated out template functions

This commit is contained in:
andy
2008-05-22 17:03:25 +01:00
parent 14dc0cae85
commit 6342010a89
9 changed files with 327 additions and 180 deletions

View File

@ -35,44 +35,7 @@ Description
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template <class Type>
void writeComponents
(
const IOobject& header,
const fvMesh& mesh,
bool& processed
)
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
if (header.headerClassName() == fieldType::typeName)
{
Info<< " Reading " << header.name() << endl;
fieldType field(header, mesh);
for (direction i=0; i<Type::nComponents; i++)
{
Info<< " Calculating " << header.name()
<< Type::componentNames[i] << endl;
volScalarField componentField
(
IOobject
(
header.name() + word(Type::componentNames[i]),
mesh.time().timeName(),
mesh,
IOobject::NO_READ
),
field.component(i)
);
componentField.write();
}
processed = true;
}
}
#include "writeComponentFields.C"
int main(int argc, char *argv[])
{
@ -115,10 +78,15 @@ int main(int argc, char *argv[])
mesh.readUpdate();
bool processed = false;
writeComponents<vector>(fieldHeader, mesh, processed);
writeComponents<sphericalTensor>(fieldHeader, mesh, processed);
writeComponents<symmTensor>(fieldHeader, mesh, processed);
writeComponents<tensor>(fieldHeader, mesh, processed);
writeComponentFields<vector>(fieldHeader, mesh, processed);
writeComponentFields<sphericalTensor>
(
fieldHeader,
mesh,
processed
);
writeComponentFields<symmTensor>(fieldHeader, mesh, processed);
writeComponentFields<tensor>(fieldHeader, mesh, processed);
if (!processed)
{
FatalError