From c685f70c820011a0cc013633635c11ccfa1c8bc5 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 19 May 2017 12:11:49 +0200 Subject: [PATCH] ENH: rationalize VTK output classes and structures - relocated to dedicated foamVtkOutput namespace. Make it easier to obtain a formatter directly without a foamVtkOutput::outputOptions. Make the logic clear within outputOptions (avoid previous, cryptic bit masking). foamVtkOutput::legacy also becomes a namespace instead of a class. Relocate commonly used things into src/fileFormats, leave volField-related parts in src/conversion. --- src/conversion/Make/files | 1 - src/conversion/vtk/output/foamVtkOutput.H | 231 ----------------- .../vtk/output/foamVtkOutputFields.H | 105 ++++++++ .../vtk/output/foamVtkOutputFieldsTemplates.C | 107 ++++++++ src/fileFormats/Make/files | 12 +- .../vtk/format/foamVtkAppendBase64Formatter.C | 8 +- .../vtk/format/foamVtkAppendBase64Formatter.H | 23 +- .../vtk/format/foamVtkAppendRawFormatter.C | 28 +-- .../vtk/format/foamVtkAppendRawFormatter.H | 27 +- .../vtk/format/foamVtkAsciiFormatter.C | 34 +-- .../vtk/format/foamVtkAsciiFormatter.H | 30 ++- .../vtk/format/foamVtkBase64Formatter.C | 10 +- .../vtk/format/foamVtkBase64Formatter.H | 24 +- .../vtk/format/foamVtkBase64Layer.C | 29 ++- .../vtk/format/foamVtkBase64Layer.H | 11 +- src/fileFormats/vtk/format/foamVtkFormatter.C | 80 +++--- src/fileFormats/vtk/format/foamVtkFormatter.H | 99 +++++--- .../vtk/format/foamVtkFormatterTemplates.C | 13 +- ...tionsI.H => foamVtkLegacyAsciiFormatter.C} | 64 +++-- .../vtk/format/foamVtkLegacyAsciiFormatter.H | 108 ++++++++ ...ormatter.C => foamVtkLegacyRawFormatter.C} | 50 ++-- ...ormatter.H => foamVtkLegacyRawFormatter.H} | 35 ++- .../vtk/format/foamVtkOutputOptions.C | 235 ------------------ .../vtk/output/foamVtkOutput.C | 86 +++++-- src/fileFormats/vtk/output/foamVtkOutput.H | 211 ++++++++++++++++ .../vtk/output/foamVtkOutputOptions.C | 131 ++++++++++ .../{format => output}/foamVtkOutputOptions.H | 74 +++--- .../vtk/output/foamVtkOutputOptionsI.H | 102 ++++++++ .../vtk/output/foamVtkOutputTemplates.C | 46 +--- src/fileFormats/vtk/type/foamVtkOutputTypes.H | 77 ++++++ 30 files changed, 1301 insertions(+), 790 deletions(-) delete mode 100644 src/conversion/vtk/output/foamVtkOutput.H create mode 100644 src/conversion/vtk/output/foamVtkOutputFields.H create mode 100644 src/conversion/vtk/output/foamVtkOutputFieldsTemplates.C rename src/fileFormats/vtk/format/{foamVtkOutputOptionsI.H => foamVtkLegacyAsciiFormatter.C} (53%) create mode 100644 src/fileFormats/vtk/format/foamVtkLegacyAsciiFormatter.H rename src/fileFormats/vtk/format/{foamVtkLegacyFormatter.C => foamVtkLegacyRawFormatter.C} (76%) rename src/fileFormats/vtk/format/{foamVtkLegacyFormatter.H => foamVtkLegacyRawFormatter.H} (78%) delete mode 100644 src/fileFormats/vtk/format/foamVtkOutputOptions.C rename src/{conversion => fileFormats}/vtk/output/foamVtkOutput.C (54%) create mode 100644 src/fileFormats/vtk/output/foamVtkOutput.H create mode 100644 src/fileFormats/vtk/output/foamVtkOutputOptions.C rename src/fileFormats/vtk/{format => output}/foamVtkOutputOptions.H (65%) create mode 100644 src/fileFormats/vtk/output/foamVtkOutputOptionsI.H rename src/{conversion => fileFormats}/vtk/output/foamVtkOutputTemplates.C (69%) create mode 100644 src/fileFormats/vtk/type/foamVtkOutputTypes.H diff --git a/src/conversion/Make/files b/src/conversion/Make/files index bc77df3454..7e3d56e5df 100644 --- a/src/conversion/Make/files +++ b/src/conversion/Make/files @@ -27,6 +27,5 @@ polyDualMesh/polyDualMesh.C vtk/part/foamVtkCells.C vtk/part/foamVtkMeshMaps.C vtk/part/foamVtuSizing.C -vtk/output/foamVtkOutput.C LIB = $(FOAM_LIBBIN)/libconversion diff --git a/src/conversion/vtk/output/foamVtkOutput.H b/src/conversion/vtk/output/foamVtkOutput.H deleted file mode 100644 index b1cbfb2438..0000000000 --- a/src/conversion/vtk/output/foamVtkOutput.H +++ /dev/null @@ -1,231 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2016-2107 OpenCFD Ltd. - \\/ 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 . - -Class - foamVtkOutput - -Description - A collection of functions for writing vtk file content. - -SourceFiles - foamVtkOutput.C - foamVtkOutputTemplates.C - -\*---------------------------------------------------------------------------*/ - -#ifndef foamVtkOutput_H -#define foamVtkOutput_H - -#include "floatScalar.H" -#include "volFields.H" -#include "foamVtkFormatter.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class foamVtkOutput Declaration -\*---------------------------------------------------------------------------*/ - -class foamVtkOutput -{ - // Private Member Functions - - //- Disallow construction - foamVtkOutput() = delete; - -public: - - // Public typedefs - - //- Use UInt64 for header data - typedef foamVtkFormatter::headerType headerType; - - - // Forward declarations - class legacy; - - - // Static Members - - //- Write vtm datasets for specified files - static Foam::label writeVtmFile - ( - std::ostream& os, - const UList& files - ); - - - //- Write a value component-wise. - template - inline static void write(foamVtkFormatter& fmt, const Type& val); - - - //- Write a list of values. - // The output does not include the payload size. - template - static void writeList - ( - foamVtkFormatter& fmt, - const UList& lst - ); - - - //- Write a list of values via indirect addressing. - // The output does not include the payload size. - template - static void writeList - ( - foamVtkFormatter& fmt, - const UList& lst, - const UList