From 74f667a85be07ce2d7505f7afd2a86fbc0cf43a7 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 20 Oct 2017 10:26:55 +0200 Subject: [PATCH] ENH: additional low-level raw binary output for Ostream. - low-level beginRaw(), writeRaw(), endRaw() methods. These can be used to directly add '()' decorators for serial output or prepare/cleanup parallel buffers. Used, for example, when outputting indirect lists in binary to avoid. --- .../test/IndirectList/Test-IndirectList.C | 65 ++++++++++- .../containers/Lists/FixedList/FixedListIO.C | 16 +-- src/OpenFOAM/containers/Lists/List/ListIO.C | 16 +-- .../containers/Lists/PtrList/PtrListIO.C | 10 +- .../Lists/UIndirectList/UIndirectListIO.C | 65 ++++++----- src/OpenFOAM/containers/Lists/UList/UListIO.C | 72 +++++++------ .../containers/Lists/UPtrList/UPtrListIO.C | 18 ++-- src/OpenFOAM/db/IOstreams/IOstreams/Ostream.H | 45 +++++--- .../db/IOstreams/Pstreams/UOPstream.C | 101 ++++++++++++++---- .../db/IOstreams/Pstreams/UOPstream.H | 27 ++++- src/OpenFOAM/db/IOstreams/Sstreams/OSstream.C | 48 ++++++++- src/OpenFOAM/db/IOstreams/Sstreams/OSstream.H | 21 +++- 12 files changed, 370 insertions(+), 134 deletions(-) diff --git a/applications/test/IndirectList/Test-IndirectList.C b/applications/test/IndirectList/Test-IndirectList.C index 4727ed5248..449af8ca7d 100644 --- a/applications/test/IndirectList/Test-IndirectList.C +++ b/applications/test/IndirectList/Test-IndirectList.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,15 +27,18 @@ Description #include "IndirectList.H" #include "IOstreams.H" +#include "Fstream.H" #include "ListOps.H" #include "labelIndList.H" +#include "argList.H" using namespace Foam; template void printInfo(const ListType& lst) { - Info<< "addr: " << flatOutput(lst.addressing()) << nl + Info<< "full: " << flatOutput(lst.completeList()) << nl + << "addr: " << flatOutput(lst.addressing()) << nl << "list: " << flatOutput(lst) << nl << endl; } @@ -61,6 +64,15 @@ void testFind(const T& val, const ListType& lst) int main(int argc, char *argv[]) { + argList::addOption + ( + "binary", + "file", + "write lists in binary to specified file" + ); + + argList args(argc, argv); + List