From 82cc00b153b3a778cdedf3d9acb7c048a7e034ec Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 28 May 2021 15:24:22 +0200 Subject: [PATCH] STYLE: VTK ascii output with 9 items per line - corresponds to the more recent VTK convention --- src/fileFormats/vtk/format/foamVtkAsciiFormatter.C | 4 ++-- src/fileFormats/vtk/format/foamVtkAsciiFormatter.H | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/fileFormats/vtk/format/foamVtkAsciiFormatter.C b/src/fileFormats/vtk/format/foamVtkAsciiFormatter.C index d850bf186f..8533d20ac0 100644 --- a/src/fileFormats/vtk/format/foamVtkAsciiFormatter.C +++ b/src/fileFormats/vtk/format/foamVtkAsciiFormatter.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2018 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -41,7 +41,7 @@ Foam::vtk::asciiFormatter::opts_(formatType::INLINE_ASCII); inline void Foam::vtk::asciiFormatter::next() { - if (pos_ == 6) + if (pos_ >= itemsPerLine_) { os()<< '\n'; pos_ = 0; diff --git a/src/fileFormats/vtk/format/foamVtkAsciiFormatter.H b/src/fileFormats/vtk/format/foamVtkAsciiFormatter.H index f01a0dbef6..49d00918f7 100644 --- a/src/fileFormats/vtk/format/foamVtkAsciiFormatter.H +++ b/src/fileFormats/vtk/format/foamVtkAsciiFormatter.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2018 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -28,7 +28,7 @@ Class Description Inline ASCII output. - Adds spaces between entries and a newline every 6 items + Adds spaces between entries and a newline every 9 items (for consistency with what VTK itself outputs). SourceFiles @@ -61,6 +61,9 @@ class asciiFormatter static const char* name_; static const outputOptions opts_; + //- Number of items per line + static constexpr unsigned short itemsPerLine_ = 9; + //- Track the current output position unsigned short pos_;