From e5267bf81d1190a2feeba42e95e861b4d405bc8e Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Thu, 11 Nov 2021 12:30:50 +0000 Subject: [PATCH] ENH: sampledSetWriters - updated writing of particle tracks --- .../sampledSetWriters/csv/csvSetWriter.C | 16 +++++---------- .../sampledSetWriters/csv/csvSetWriter.H | 7 ++++--- .../ensight/ensightSetWriter.C | 7 +------ .../ensight/ensightSetWriter.H | 7 ++++--- .../gnuplot/gnuplotSetWriter.C | 17 ++++++---------- .../gnuplot/gnuplotSetWriter.H | 7 ++++--- .../sampledSetWriters/jplot/jplotSetWriter.C | 7 ------- .../sampledSetWriters/jplot/jplotSetWriter.H | 7 ++++--- .../nastran/nastranSetWriter.C | 7 +------ .../nastran/nastranSetWriter.H | 7 ++++--- .../sampledSetWriters/raw/rawSetWriter.C | 14 ++++--------- .../sampledSetWriters/raw/rawSetWriter.H | 7 ++++--- .../sampledSetWriters/vtk/vtkSetWriter.C | 7 +------ .../sampledSetWriters/vtk/vtkSetWriter.H | 7 ++++--- src/fileFormats/sampledSetWriters/writer.H | 5 +++-- .../xmgrace/xmgraceSetWriter.C | 20 +++++++------------ .../xmgrace/xmgraceSetWriter.H | 7 ++++--- .../field/streamLine/streamLineBase.C | 6 ++++-- .../meshRefinement/meshRefinement.C | 3 ++- 19 files changed, 66 insertions(+), 99 deletions(-) diff --git a/src/fileFormats/sampledSetWriters/csv/csvSetWriter.C b/src/fileFormats/sampledSetWriters/csv/csvSetWriter.C index fc469c5e5e..b0a92cd375 100644 --- a/src/fileFormats/sampledSetWriters/csv/csvSetWriter.C +++ b/src/fileFormats/sampledSetWriters/csv/csvSetWriter.C @@ -39,13 +39,6 @@ Foam::csvSetWriter::csvSetWriter() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::csvSetWriter::~csvSetWriter() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template @@ -86,13 +79,14 @@ template void Foam::csvSetWriter::write ( const bool writeTracks, - const PtrList& points, + const List& times, + const PtrList& tracks, const wordList& valueSetNames, const List>>& valueSets, Ostream& os ) const { - writeHeader(points[0],valueSetNames,os); + writeHeader(tracks[0],valueSetNames,os); if (valueSets.size() != valueSetNames.size()) { @@ -104,7 +98,7 @@ void Foam::csvSetWriter::write List*> columns(valueSets.size()); - forAll(points, trackI) + forAll(tracks, trackI) { // Collect sets into columns forAll(valueSets, i) @@ -112,7 +106,7 @@ void Foam::csvSetWriter::write columns[i] = &valueSets[i][trackI]; } - this->writeTable(points[trackI], columns, os); + this->writeTable(tracks[trackI], columns, os); os << nl << nl; } } diff --git a/src/fileFormats/sampledSetWriters/csv/csvSetWriter.H b/src/fileFormats/sampledSetWriters/csv/csvSetWriter.H index 83c724b806..e2f464affb 100644 --- a/src/fileFormats/sampledSetWriters/csv/csvSetWriter.H +++ b/src/fileFormats/sampledSetWriters/csv/csvSetWriter.H @@ -79,7 +79,7 @@ public: //- Destructor - virtual ~csvSetWriter(); + virtual ~csvSetWriter() = default; // Member Functions @@ -101,9 +101,10 @@ public: virtual void write ( const bool writeTracks, - const PtrList&, + const List& times, + const PtrList& tracks, const wordList& valueSetNames, - const List>>&, + const List>>& valueSets, Ostream& ) const; }; diff --git a/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C index 46880d0bd9..17754ff2dc 100644 --- a/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C +++ b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C @@ -41,12 +41,6 @@ Foam::ensightSetWriter::ensightSetWriter() writer() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::ensightSetWriter::~ensightSetWriter() -{} - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -174,6 +168,7 @@ template void Foam::ensightSetWriter::write ( const bool writeTracks, + const List& times, const PtrList& tracks, const wordList& valueSetNames, const List>>& valueSets, diff --git a/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.H b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.H index d98a32b2ef..2629b3c68b 100644 --- a/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.H +++ b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.H @@ -66,7 +66,7 @@ public: //- Destructor - virtual ~ensightSetWriter(); + virtual ~ensightSetWriter() = default; // Member Functions @@ -88,9 +88,10 @@ public: virtual void write ( const bool writeTracks, - const PtrList&, + const List& times, + const PtrList& tracks, const wordList& valueSetNames, - const List>>&, + const List>>& valueSets, Ostream& ) const; }; diff --git a/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.C b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.C index a0e0267490..df3fafc5e3 100644 --- a/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.C +++ b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.C @@ -41,12 +41,6 @@ Foam::gnuplotSetWriter::gnuplotSetWriter() writer() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::gnuplotSetWriter::~gnuplotSetWriter() -{} - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -112,7 +106,8 @@ template void Foam::gnuplotSetWriter::write ( const bool writeTracks, - const PtrList& trackPoints, + const List& times, + const PtrList& tracks, const wordList& valueSetNames, const List>>& valueSets, Ostream& os @@ -125,12 +120,12 @@ void Foam::gnuplotSetWriter::write << "Number of valueSets:" << valueSets.size() << exit(FatalError); } - if (trackPoints.size() > 0) + if (tracks.size() > 0) { os << "set term postscript color" << nl - << "set output \"" << trackPoints[0].name() << ".ps\"" << nl; + << "set output \"" << tracks[0].name() << ".ps\"" << nl; - forAll(trackPoints, trackI) + forAll(tracks, trackI) { os << "plot"; @@ -147,7 +142,7 @@ void Foam::gnuplotSetWriter::write forAll(valueSets, i) { - this->writeTable(trackPoints[trackI], valueSets[i][trackI], os); + this->writeTable(tracks[trackI], valueSets[i][trackI], os); os << "e" << nl; } } diff --git a/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.H b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.H index feb1ace910..08c237d091 100644 --- a/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.H +++ b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.H @@ -66,7 +66,7 @@ public: //- Destructor - virtual ~gnuplotSetWriter(); + virtual ~gnuplotSetWriter() = default; // Member Functions @@ -88,9 +88,10 @@ public: virtual void write ( const bool writeTracks, - const PtrList&, + const List& times, + const PtrList& tracks, const wordList& valueSetNames, - const List>>&, + const List>>& valueSets, Ostream& ) const; }; diff --git a/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.C b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.C index 0f6c77fd6e..c3c4eb3190 100644 --- a/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.C +++ b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.C @@ -53,13 +53,6 @@ Foam::jplotSetWriter::jplotSetWriter() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::jplotSetWriter::~jplotSetWriter() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template diff --git a/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.H b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.H index e67f5202ce..39f19ccf32 100644 --- a/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.H +++ b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.H @@ -70,7 +70,7 @@ public: //- Destructor - virtual ~jplotSetWriter(); + virtual ~jplotSetWriter() = default; // Member Functions @@ -92,9 +92,10 @@ public: virtual void write ( const bool writeTracks, - const PtrList&, + const List& times, + const PtrList& tracks, const wordList& valueSetNames, - const List>>&, + const List>>& valueSets, Ostream& ) const { diff --git a/src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.C b/src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.C index ed2c734ca4..218384cb59 100644 --- a/src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.C +++ b/src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.C @@ -38,12 +38,6 @@ Foam::nastranSetWriter::nastranSetWriter() writer() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::nastranSetWriter::~nastranSetWriter() -{} - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -129,6 +123,7 @@ template void Foam::nastranSetWriter::write ( const bool writeTracks, + const List& times, const PtrList& tracks, const wordList& valueSetNames, const List>>& valueSets, diff --git a/src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.H b/src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.H index 5ae415744f..34ec75ffce 100644 --- a/src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.H +++ b/src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.H @@ -86,7 +86,7 @@ public: //- Destructor - virtual ~nastranSetWriter(); + virtual ~nastranSetWriter() = default; // Member Functions @@ -108,9 +108,10 @@ public: virtual void write ( const bool writeTracks, - const PtrList&, + const List& times, + const PtrList& tracks, const wordList& valueSetNames, - const List>>&, + const List>>& valueSets, Ostream& ) const; }; diff --git a/src/fileFormats/sampledSetWriters/raw/rawSetWriter.C b/src/fileFormats/sampledSetWriters/raw/rawSetWriter.C index 34d99f9968..dc6a120606 100644 --- a/src/fileFormats/sampledSetWriters/raw/rawSetWriter.C +++ b/src/fileFormats/sampledSetWriters/raw/rawSetWriter.C @@ -39,13 +39,6 @@ Foam::rawSetWriter::rawSetWriter() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::rawSetWriter::~rawSetWriter() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template @@ -84,7 +77,8 @@ template void Foam::rawSetWriter::write ( const bool writeTracks, - const PtrList& points, + const List& times, + const PtrList& tracks, const wordList& valueSetNames, const List>>& valueSets, Ostream& os @@ -100,7 +94,7 @@ void Foam::rawSetWriter::write List*> columns(valueSets.size()); - forAll(points, trackI) + forAll(tracks, trackI) { // Collect sets into columns forAll(valueSets, i) @@ -108,7 +102,7 @@ void Foam::rawSetWriter::write columns[i] = &valueSets[i][trackI]; } - this->writeTable(points[trackI], columns, os); + this->writeTable(tracks[trackI], columns, os); os << nl << nl; } } diff --git a/src/fileFormats/sampledSetWriters/raw/rawSetWriter.H b/src/fileFormats/sampledSetWriters/raw/rawSetWriter.H index 2109ed78d7..817c80ce1d 100644 --- a/src/fileFormats/sampledSetWriters/raw/rawSetWriter.H +++ b/src/fileFormats/sampledSetWriters/raw/rawSetWriter.H @@ -66,7 +66,7 @@ public: //- Destructor - virtual ~rawSetWriter(); + virtual ~rawSetWriter() = default; // Member Functions @@ -88,9 +88,10 @@ public: virtual void write ( const bool writeTracks, - const PtrList&, + const List& times, + const PtrList& tracks, const wordList& valueSetNames, - const List>>&, + const List>>& valueSets, Ostream& ) const; }; diff --git a/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.C b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.C index 0413bfdb90..ab0dde0a65 100644 --- a/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.C +++ b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.C @@ -41,12 +41,6 @@ Foam::vtkSetWriter::vtkSetWriter() writer() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::vtkSetWriter::~vtkSetWriter() -{} - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -111,6 +105,7 @@ template void Foam::vtkSetWriter::write ( const bool writeTracks, + const List& times, const PtrList& tracks, const wordList& valueSetNames, const List>>& valueSets, diff --git a/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.H b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.H index 570a674bfb..da000a0acc 100644 --- a/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.H +++ b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.H @@ -69,7 +69,7 @@ public: //- Destructor - virtual ~vtkSetWriter(); + virtual ~vtkSetWriter() = default; // Member Functions @@ -91,9 +91,10 @@ public: virtual void write ( const bool writeTracks, - const PtrList&, + const List& times, + const PtrList& tracks, const wordList& valueSetNames, - const List>>&, + const List>>& valueSets, Ostream& ) const; }; diff --git a/src/fileFormats/sampledSetWriters/writer.H b/src/fileFormats/sampledSetWriters/writer.H index 1c09a54d1d..da591db0f3 100644 --- a/src/fileFormats/sampledSetWriters/writer.H +++ b/src/fileFormats/sampledSetWriters/writer.H @@ -178,9 +178,10 @@ public: virtual void write ( const bool writeTracks, - const PtrList&, + const List& times, + const PtrList& tracks, const wordList& valueSetNames, - const List>>&, + const List>>& valueSets, Ostream& ) const = 0; diff --git a/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.C b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.C index abc6c094b0..74b6d19a85 100644 --- a/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.C +++ b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.C @@ -40,13 +40,6 @@ Foam::xmgraceSetWriter::xmgraceSetWriter() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::xmgraceSetWriter::~xmgraceSetWriter() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template @@ -91,7 +84,8 @@ template void Foam::xmgraceSetWriter::write ( const bool writeTracks, - const PtrList& trackPoints, + const List& times, + const PtrList& tracks, const wordList& valueSetNames, const List>>& valueSets, Ostream& os @@ -104,24 +98,24 @@ void Foam::xmgraceSetWriter::write << "Number of valueSets:" << valueSets.size() << exit(FatalError); } - if (trackPoints.size() > 0) + if (tracks.size() > 0) { os << "@g0 on" << nl << "@with g0" << nl - << "@ title \"" << trackPoints[0].name() << '"' << nl - << "@ xaxis label " << '"' << trackPoints[0].axis() << '"' << nl; + << "@ title \"" << tracks[0].name() << '"' << nl + << "@ xaxis label " << '"' << tracks[0].axis() << '"' << nl; // Data index. label sI = 0; - forAll(trackPoints, trackI) + forAll(tracks, trackI) { forAll(valueSets, i) { os << "@ s" << sI << " legend " << '"' << valueSetNames[i] << "_track" << i << '"' << nl << "@target G0.S" << sI << nl; - this->writeTable(trackPoints[trackI], valueSets[i][trackI], os); + this->writeTable(tracks[trackI], valueSets[i][trackI], os); os << '&' << nl; sI++; diff --git a/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.H b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.H index 2c92aa4be1..31ec5e41e3 100644 --- a/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.H +++ b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.H @@ -66,7 +66,7 @@ public: //- Destructor - virtual ~xmgraceSetWriter(); + virtual ~xmgraceSetWriter() = default; // Member Functions @@ -88,9 +88,10 @@ public: virtual void write ( const bool writeTracks, - const PtrList&, + const List& times, + const PtrList& tracks, const wordList& valueSetNames, - const List>>&, + const List>>& valueSets, Ostream& ) const; }; diff --git a/src/functionObjects/field/streamLine/streamLineBase.C b/src/functionObjects/field/streamLine/streamLineBase.C index e763f5bd72..efd37d24fa 100644 --- a/src/functionObjects/field/streamLine/streamLineBase.C +++ b/src/functionObjects/field/streamLine/streamLineBase.C @@ -742,7 +742,8 @@ bool Foam::functionObjects::streamLineBase::writeToFile() scalarFormatterPtr_().write ( - true, // writeTracks + true, // writeTracks + List(), // times tracks, scalarNames_, scalarValues, @@ -782,7 +783,8 @@ bool Foam::functionObjects::streamLineBase::writeToFile() vectorFormatterPtr_().write ( - true, // writeTracks + true, // writeTracks + List(), // times tracks, vectorNames_, vectorValues, diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C index 5be91fd952..3c19ea7087 100644 --- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C +++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C @@ -2700,7 +2700,8 @@ Foam::label Foam::meshRefinement::findRegions { leakPathFormatter.write ( - true, // write tracks + true, // write tracks + List(), // times allLeakPaths, valueSetNames, allLeakData,