Skip to content
Snippets Groups Projects
Commit 4d364cdb authored by mark's avatar mark
Browse files

STYLE: reduce typing by providing flatOutput function

parent 586222c5
Branches
Tags
No related merge requests found
...@@ -129,6 +129,23 @@ public: ...@@ -129,6 +129,23 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Global function
template<class T>
FlatListOutput<T> flatOutput(const UList<T>& input)
{
return FlatListOutput<T>(input);
}
//- Global function
template<class T>
FlatListOutput<T> flatOutput(const char separator, const UList<T>& input)
{
return FlatListOutput<T>(separator, input);
}
} // End namespace Foam } // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
...@@ -118,10 +118,10 @@ Foam::label Foam::adiosWrite::writeCloud ...@@ -118,10 +118,10 @@ Foam::label Foam::adiosWrite::writeCloud
Info<< "cloud: " << cld.name() << " (" << cInfo.nTotal() Info<< "cloud: " << cld.name() << " (" << cInfo.nTotal()
<< " parcels, " << encoded.length() << " min-size) type: " << " parcels, " << encoded.length() << " min-size) type: "
<< cld.type() << nl << cld.type() << nl
<< " types: " << FlatListOutput<word>(encoded.types()) << nl << " types: " << flatOutput(encoded.types()) << nl
<< " names: " << FlatListOutput<word>(encoded.names()) << nl << " names: " << flatOutput(encoded.names()) << nl
<< " offset:" << FlatListOutput<label>(encoded.offsets()) << nl << " offset:" << flatOutput(encoded.offsets()) << nl
<< " sizes: " << FlatListOutput<label>(encoded.sizes()) << endl; << " sizes: " << flatOutput(encoded.sizes()) << endl;
} }
else else
{ {
...@@ -271,7 +271,7 @@ Foam::label Foam::adiosWrite::writeCloud ...@@ -271,7 +271,7 @@ Foam::label Foam::adiosWrite::writeCloud
} }
// Info<< frag.name() << " (" << frag.type() << ") = " // Info<< frag.name() << " (" << frag.type() << ") = "
// << FlatListOutput<int>(SubList<int>(labelBuffer, i)) << nl; // << flatOutput(SubList<int>(labelBuffer, i)) << nl;
defineVariable defineVariable
( (
...@@ -297,7 +297,7 @@ Foam::label Foam::adiosWrite::writeCloud ...@@ -297,7 +297,7 @@ Foam::label Foam::adiosWrite::writeCloud
} }
// Info<< frag.name() << " (" << frag.type() << ") = " // Info<< frag.name() << " (" << frag.type() << ") = "
// << FlatListOutput<scalar>(SubList<scalar>(scalarBuffer, i)) << nl; // << flatOutput(SubList<scalar>(scalarBuffer, i)) << nl;
defineVariable defineVariable
( (
...@@ -335,7 +335,7 @@ Foam::label Foam::adiosWrite::writeCloud ...@@ -335,7 +335,7 @@ Foam::label Foam::adiosWrite::writeCloud
); );
// Info<< frag.name() << " (" << frag.type() << ") = " // Info<< frag.name() << " (" << frag.type() << ") = "
// << FlatListOutput<scalar>(SubList<scalar>(scalarBuffer, i)) << nl; // << flatOutput(SubList<scalar>(scalarBuffer, i)) << nl;
writeVariable(varName/frag.name(), scalarBuffer); writeVariable(varName/frag.name(), scalarBuffer);
} }
...@@ -378,10 +378,10 @@ Foam::label Foam::adiosWrite::printCloud ...@@ -378,10 +378,10 @@ Foam::label Foam::adiosWrite::printCloud
Info<< "cloud: " << cld.name() << " (" << cInfo.nTotal() Info<< "cloud: " << cld.name() << " (" << cInfo.nTotal()
<< " parcels, " << encoded.length() << " min-size) type: " << " parcels, " << encoded.length() << " min-size) type: "
<< cld.type() << nl << cld.type() << nl
<< " types: " << FlatListOutput<word>(encoded.types()) << nl << " types: " << flatOutput(encoded.types()) << nl
<< " names: " << FlatListOutput<word>(encoded.names()) << nl << " names: " << flatOutput(encoded.names()) << nl
<< " offset:" << FlatListOutput<label>(encoded.offsets()) << nl << " offset:" << flatOutput(encoded.offsets()) << nl
<< " sizes: " << FlatListOutput<label>(encoded.sizes()) << endl; << " sizes: " << flatOutput(encoded.sizes()) << endl;
// ASCII output // ASCII output
......
...@@ -63,8 +63,8 @@ Foam::adiosTime Foam::adiosWrite::readData(const fileName& bpFile) ...@@ -63,8 +63,8 @@ Foam::adiosTime Foam::adiosWrite::readData(const fileName& bpFile)
wordList cloudNames = readerClouds.sortedToc(); wordList cloudNames = readerClouds.sortedToc();
Info<<"region " << regName << " has reader:" << nl Info<<"region " << regName << " has reader:" << nl
<< " fields: " << FlatListOutput<word>(fieldNames) << nl << " fields: " << flatOutput(fieldNames) << nl
<< " clouds: " << FlatListOutput<word>(cloudNames) << endl; << " clouds: " << flatOutput(cloudNames) << endl;
// fields // fields
forAll(fieldNames, fieldI) forAll(fieldNames, fieldI)
......
...@@ -99,7 +99,7 @@ void Foam::adiosWrite::regionInfo::read ...@@ -99,7 +99,7 @@ void Foam::adiosWrite::regionInfo::read
WarningInFunction WarningInFunction
<< nl << nl
<< missing.size() << " objects not found in database:" << nl << missing.size() << " objects not found in database:" << nl
<< " " << FlatListOutput<word>(missing) << endl; << " " << flatOutput(missing) << endl;
} }
} }
......
...@@ -157,7 +157,7 @@ void Foam::adiosWrite::read(const dictionary& dict) ...@@ -157,7 +157,7 @@ void Foam::adiosWrite::read(const dictionary& dict)
WarningInFunction WarningInFunction
<< warn.size() << " unknown regions specified in adiosDict:" << warn.size() << " unknown regions specified in adiosDict:"
<< nl << nl
<< " " << FlatListOutput<word>(warn) << endl; << " " << flatOutput(warn) << endl;
} }
if (nbad) if (nbad)
...@@ -167,7 +167,7 @@ void Foam::adiosWrite::read(const dictionary& dict) ...@@ -167,7 +167,7 @@ void Foam::adiosWrite::read(const dictionary& dict)
FatalErrorInFunction FatalErrorInFunction
<< bad.size() << " bad region specifications in adiosDict:" << bad.size() << " bad region specifications in adiosDict:"
<< nl << nl
<< " " << FlatListOutput<word>(bad) << nl << " " << flatOutput(bad) << nl
<< "must be dictionary format with region-name as the keyword" << "must be dictionary format with region-name as the keyword"
<< nl << nl
<< exit(FatalIOError); << exit(FatalIOError);
...@@ -526,8 +526,8 @@ Foam::label Foam::adiosWrite::writeFields ...@@ -526,8 +526,8 @@ Foam::label Foam::adiosWrite::writeFields
WarningInFunction WarningInFunction
<< nl << nl
<< badFields.size() << " fields not handled by adiosWrite" << nl << badFields.size() << " fields not handled by adiosWrite" << nl
<< " names: " << FlatListOutput<word>(names) << nl << " names: " << flatOutput(names) << nl
<< " types: " << FlatListOutput<word>(types) << nl << endl; << " types: " << flatOutput(types) << nl << endl;
} }
...@@ -596,8 +596,8 @@ Foam::label Foam::adiosWrite::writeClouds(const regionInfo& rInfo) ...@@ -596,8 +596,8 @@ Foam::label Foam::adiosWrite::writeClouds(const regionInfo& rInfo)
WarningInFunction WarningInFunction
<< nl << nl
<< badClouds.size() << " clouds not handled by adiosWrite" << nl << badClouds.size() << " clouds not handled by adiosWrite" << nl
<< " names: " << FlatListOutput<word>(names) << nl << " names: " << flatOutput(names) << nl
<< " types: " << FlatListOutput<word>(types) << nl << endl; << " types: " << flatOutput(types) << nl << endl;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment