Commit 5235d416 authored by Andrew Heather's avatar Andrew Heather
Browse files

single operations only

parent 03f95034
......@@ -57,8 +57,8 @@ Foam::calcTypes::components::~components()
void Foam::calcTypes::components::init()
{
Foam::argList::validArgs.append("components");
argList::validArgs.append("fieldName1 .. fieldNameN");
argList::validArgs.append("components");
argList::validArgs.append("fieldName");
}
......@@ -68,14 +68,7 @@ void Foam::calcTypes::components::preCalc
const Time& runTime,
const fvMesh& mesh
)
{
if (args.additionalArgs().size() < 2)
{
Info<< nl << "must specify one or more fields" << nl;
args.printUsage();
FatalError.exit();
}
}
{}
void Foam::calcTypes::components::calc
......@@ -85,49 +78,39 @@ void Foam::calcTypes::components::calc
const fvMesh& mesh
)
{
const stringList& params = args.additionalArgs();
for (label fieldi=1; fieldi<params.size(); fieldi++)
const word& fieldName = args.additionalArgs()[1];
IOobject fieldHeader
(
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check field exists
if (fieldHeader.headerOk())
{
const word fieldName(params[fieldi]);
IOobject fieldHeader
(
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check field exists
if (fieldHeader.headerOk())
{
bool processed = false;
writeComponentFields<vector>(fieldHeader, mesh, processed);
writeComponentFields<sphericalTensor>
(
fieldHeader,
mesh,
processed
);
writeComponentFields<symmTensor>(fieldHeader, mesh, processed);
writeComponentFields<tensor>(fieldHeader, mesh, processed);
if (!processed)
{
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to components for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
bool processed = false;
writeComponentFields<vector>(fieldHeader, mesh, processed);
writeComponentFields<sphericalTensor>(fieldHeader, mesh, processed);
writeComponentFields<symmTensor>(fieldHeader, mesh, processed);
writeComponentFields<tensor>(fieldHeader, mesh, processed);
if (!processed)
{
Info<< " No " << fieldName << endl;
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to components for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
{
Info<< " No " << fieldName << endl;
}
}
......
......@@ -57,8 +57,8 @@ Foam::calcTypes::div::~div()
void Foam::calcTypes::div::init()
{
Foam::argList::validArgs.append("div");
argList::validArgs.append("fieldName1 .. fieldNameN");
argList::validArgs.append("div");
argList::validArgs.append("fieldName");
}
......@@ -68,14 +68,7 @@ void Foam::calcTypes::div::preCalc
const Time& runTime,
const fvMesh& mesh
)
{
if (args.additionalArgs().size() < 2)
{
Info<< nl << "must specify one or more fields" << nl;
args.printUsage();
FatalError.exit();
}
}
{}
void Foam::calcTypes::div::calc
......@@ -85,42 +78,37 @@ void Foam::calcTypes::div::calc
const fvMesh& mesh
)
{
const stringList& params = args.additionalArgs();
for (label fieldi=1; fieldi<params.size(); fieldi++)
const word& fieldName = args.additionalArgs()[1];
IOobject fieldHeader
(
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check field exists
if (fieldHeader.headerOk())
{
const word fieldName(params[fieldi]);
IOobject fieldHeader
(
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check field exists
if (fieldHeader.headerOk())
{
bool processed = false;
writeDivField<surfaceScalarField>(fieldHeader, mesh, processed);
writeDivField<volVectorField>(fieldHeader, mesh, processed);
if (!processed)
{
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to div for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
bool processed = false;
writeDivField<surfaceScalarField>(fieldHeader, mesh, processed);
writeDivField<volVectorField>(fieldHeader, mesh, processed);
if (!processed)
{
Info<< " No " << fieldName << endl;
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to div for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
{
Info<< " No " << fieldName << endl;
}
}
......
......@@ -58,7 +58,7 @@ Foam::calcTypes::interpolate::~interpolate()
void Foam::calcTypes::interpolate::init()
{
Foam::argList::validArgs.append("interpolate");
argList::validArgs.append("fieldName1 .. fieldNameN");
argList::validArgs.append("fieldName");
}
......@@ -68,14 +68,7 @@ void Foam::calcTypes::interpolate::preCalc
const Time& runTime,
const fvMesh& mesh
)
{
if (args.additionalArgs().size() < 2)
{
Info<< nl << "must specify one or more fields" << nl;
args.printUsage();
FatalError.exit();
}
}
{}
void Foam::calcTypes::interpolate::calc
......@@ -85,50 +78,40 @@ void Foam::calcTypes::interpolate::calc
const fvMesh& mesh
)
{
const stringList& params = args.additionalArgs();
for (label fieldi=1; fieldi<params.size(); fieldi++)
const word& fieldName = args.additionalArgs()[1];
IOobject fieldHeader
(
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check field exists
if (fieldHeader.headerOk())
{
const word fieldName(params[fieldi]);
IOobject fieldHeader
(
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check field exists
if (fieldHeader.headerOk())
{
bool processed = false;
writeInterpolateField<scalar>(fieldHeader, mesh, processed);
writeInterpolateField<vector>(fieldHeader, mesh, processed);
writeInterpolateField<sphericalTensor>
(
fieldHeader,
mesh,
processed
);
writeInterpolateField<symmTensor>(fieldHeader, mesh, processed);
writeInterpolateField<tensor>(fieldHeader, mesh, processed);
if (!processed)
{
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to interpolate for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
bool processed = false;
writeInterpolateField<scalar>(fieldHeader, mesh, processed);
writeInterpolateField<vector>(fieldHeader, mesh, processed);
writeInterpolateField<sphericalTensor>(fieldHeader, mesh, processed);
writeInterpolateField<symmTensor>(fieldHeader, mesh, processed);
writeInterpolateField<tensor>(fieldHeader, mesh, processed);
if (!processed)
{
Info<< " No " << fieldName << endl;
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to interpolate for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
{
Info<< " No " << fieldName << endl;
}
}
......
......@@ -57,8 +57,8 @@ Foam::calcTypes::mag::~mag()
void Foam::calcTypes::mag::init()
{
Foam::argList::validArgs.append("mag");
argList::validArgs.append("fieldName1 .. fieldNameN");
argList::validArgs.append("mag");
argList::validArgs.append("fieldName");
}
......@@ -68,14 +68,7 @@ void Foam::calcTypes::mag::preCalc
const Time& runTime,
const fvMesh& mesh
)
{
if (args.additionalArgs().size() < 2)
{
Info<< nl << "must specify one or more fields" << nl;
args.printUsage();
FatalError.exit();
}
}
{}
void Foam::calcTypes::mag::calc
......@@ -85,45 +78,40 @@ void Foam::calcTypes::mag::calc
const fvMesh& mesh
)
{
const stringList& params = args.additionalArgs();
for (label fieldi=1; fieldi<params.size(); fieldi++)
const word& fieldName = args.additionalArgs()[1];
IOobject fieldHeader
(
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check field exists
if (fieldHeader.headerOk())
{
const word fieldName(params[fieldi]);
IOobject fieldHeader
(
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check field exists
if (fieldHeader.headerOk())
{
bool processed = false;
writeMagField<scalar>(fieldHeader, mesh, processed);
writeMagField<vector>(fieldHeader, mesh, processed);
writeMagField<sphericalTensor>(fieldHeader, mesh, processed);
writeMagField<symmTensor>(fieldHeader, mesh, processed);
writeMagField<tensor>(fieldHeader, mesh, processed);
if (!processed)
{
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to mag for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
bool processed = false;
writeMagField<scalar>(fieldHeader, mesh, processed);
writeMagField<vector>(fieldHeader, mesh, processed);
writeMagField<sphericalTensor>(fieldHeader, mesh, processed);
writeMagField<symmTensor>(fieldHeader, mesh, processed);
writeMagField<tensor>(fieldHeader, mesh, processed);
if (!processed)
{
Info<< " No " << fieldName << endl;
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to mag for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
{
Info<< " No " << fieldName << endl;
}
}
......
......@@ -57,8 +57,8 @@ Foam::calcTypes::magGrad::~magGrad()
void Foam::calcTypes::magGrad::init()
{
Foam::argList::validArgs.append("magGrad");
argList::validArgs.append("fieldName1 .. fieldNameN");
argList::validArgs.append("magGrad");
argList::validArgs.append("fieldName");
}
......@@ -68,14 +68,7 @@ void Foam::calcTypes::magGrad::preCalc
const Time& runTime,
const fvMesh& mesh
)
{
if (args.additionalArgs().size() < 2)
{
Info<< nl << "must specify one or more fields" << nl;
args.printUsage();
FatalError.exit();
}
}
{}
void Foam::calcTypes::magGrad::calc
......@@ -85,42 +78,37 @@ void Foam::calcTypes::magGrad::calc
const fvMesh& mesh
)
{
const stringList& params = args.additionalArgs();
for (label fieldi=1; fieldi<params.size(); fieldi++)
const word& fieldName = args.additionalArgs()[1];
IOobject fieldHeader
(
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check field exists
if (fieldHeader.headerOk())
{
const word fieldName(params[fieldi]);
IOobject fieldHeader
(
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check field exists
if (fieldHeader.headerOk())
{
bool processed = false;
writeMagGradField<scalar>(fieldHeader, mesh, processed);
writeMagGradField<vector>(fieldHeader, mesh, processed);
if (!processed)
{
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to magGrad for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
bool processed = false;
writeMagGradField<scalar>(fieldHeader, mesh, processed);
writeMagGradField<vector>(fieldHeader, mesh, processed);
if (!processed)
{
Info<< " No " << fieldName << endl;
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to magGrad for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
{
Info<< " No " << fieldName << endl;
}
}
......
......@@ -58,7 +58,7 @@ Foam::calcTypes::magSqr::~magSqr()
void Foam::calcTypes::magSqr::init()
{
Foam::argList::validArgs.append("magSqr");
argList::validArgs.append("fieldName1 .. fieldNameN");
argList::validArgs.append("fieldName");
}
......@@ -68,14 +68,7 @@ void Foam::calcTypes::magSqr::preCalc
const Time& runTime,
const fvMesh& mesh
)
{
if (args.additionalArgs().size() < 2)
{
Info<< nl << "must specify one or more fields" << nl;
args.printUsage();
FatalError.exit();
}
}
{}
void Foam::calcTypes::magSqr::calc
......@@ -85,47 +78,43 @@ void Foam::calcTypes::magSqr::calc
const fvMesh& mesh
)
{
const stringList& params = args.additionalArgs();
for (label fieldi=1; fieldi<params.size(); fieldi++)
const word& fieldName = args.additionalArgs()[1];
IOobject fieldHeader
(
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check field exists
if (fieldHeader.headerOk())
{
const word fieldName(params[fieldi]);
IOobject fieldHeader
(
fieldName,
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
// Check field exists
if (fieldHeader.headerOk())
{
bool processed = false;
writeMagSqrField<scalar>(fieldHeader, mesh, processed);
writeMagSqrField<vector>(fieldHeader, mesh, processed);
writeMagSqrField<sphericalTensor>(fieldHeader, mesh, processed);
writeMagSqrField<symmTensor>(fieldHeader, mesh, processed);
writeMagSqrField<tensor>(fieldHeader, mesh, processed);
if (!processed)
{
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to magSqr for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
bool processed = false;
writeMagSqrField<scalar>(fieldHeader, mesh, processed);
writeMagSqrField<vector>(fieldHeader, mesh, processed);
writeMagSqrField<sphericalTensor>(fieldHeader, mesh, processed);
writeMagSqrField<symmTensor>(fieldHeader, mesh, processed);
writeMagSqrField<tensor>(fieldHeader, mesh, processed);
if (!processed)
{
Info<< " No " << fieldName << endl;
FatalError
<< "Unable to process " << fieldName << nl
<< "No call to magSqr for fields of type "
<< fieldHeader.headerClassName() << nl << nl
<< exit(FatalError);
}
}
else
{
Info<< " No " << fieldName << endl;