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 fc469c5e5eb..b0a92cd3759 100644 --- a/src/fileFormats/sampledSetWriters/csv/csvSetWriter.C +++ b/src/fileFormats/sampledSetWriters/csv/csvSetWriter.C @@ -39,13 +39,6 @@ Foam::csvSetWriter<Type>::csvSetWriter() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::csvSetWriter<Type>::~csvSetWriter() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> @@ -86,13 +79,14 @@ template<class Type> void Foam::csvSetWriter<Type>::write ( const bool writeTracks, - const PtrList<coordSet>& points, + const List<scalarField>& times, + const PtrList<coordSet>& tracks, const wordList& valueSetNames, const List<List<Field<Type>>>& 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<Type>::write List<const List<Type>*> columns(valueSets.size()); - forAll(points, trackI) + forAll(tracks, trackI) { // Collect sets into columns forAll(valueSets, i) @@ -112,7 +106,7 @@ void Foam::csvSetWriter<Type>::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 83c724b8069..e2f464affb1 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<coordSet>&, + const List<scalarField>& times, + const PtrList<coordSet>& tracks, const wordList& valueSetNames, - const List<List<Field<Type>>>&, + const List<List<Field<Type>>>& valueSets, Ostream& ) const; }; diff --git a/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C index 46880d0bd92..17754ff2dc3 100644 --- a/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C +++ b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.C @@ -41,12 +41,6 @@ Foam::ensightSetWriter<Type>::ensightSetWriter() writer<Type>() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::ensightSetWriter<Type>::~ensightSetWriter() -{} - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -174,6 +168,7 @@ template<class Type> void Foam::ensightSetWriter<Type>::write ( const bool writeTracks, + const List<scalarField>& times, const PtrList<coordSet>& tracks, const wordList& valueSetNames, const List<List<Field<Type>>>& valueSets, diff --git a/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.H b/src/fileFormats/sampledSetWriters/ensight/ensightSetWriter.H index d98a32b2ef5..2629b3c68b4 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<coordSet>&, + const List<scalarField>& times, + const PtrList<coordSet>& tracks, const wordList& valueSetNames, - const List<List<Field<Type>>>&, + const List<List<Field<Type>>>& valueSets, Ostream& ) const; }; diff --git a/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.C b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.C index a0e02674909..df3fafc5e3e 100644 --- a/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.C +++ b/src/fileFormats/sampledSetWriters/gnuplot/gnuplotSetWriter.C @@ -41,12 +41,6 @@ Foam::gnuplotSetWriter<Type>::gnuplotSetWriter() writer<Type>() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::gnuplotSetWriter<Type>::~gnuplotSetWriter() -{} - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -112,7 +106,8 @@ template<class Type> void Foam::gnuplotSetWriter<Type>::write ( const bool writeTracks, - const PtrList<coordSet>& trackPoints, + const List<scalarField>& times, + const PtrList<coordSet>& tracks, const wordList& valueSetNames, const List<List<Field<Type>>>& valueSets, Ostream& os @@ -125,12 +120,12 @@ void Foam::gnuplotSetWriter<Type>::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<Type>::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 feb1ace9109..08c237d0912 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<coordSet>&, + const List<scalarField>& times, + const PtrList<coordSet>& tracks, const wordList& valueSetNames, - const List<List<Field<Type>>>&, + const List<List<Field<Type>>>& valueSets, Ostream& ) const; }; diff --git a/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.C b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.C index 0f6c77fd6ea..c3c4eb31909 100644 --- a/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.C +++ b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.C @@ -53,13 +53,6 @@ Foam::jplotSetWriter<Type>::jplotSetWriter() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::jplotSetWriter<Type>::~jplotSetWriter() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> diff --git a/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.H b/src/fileFormats/sampledSetWriters/jplot/jplotSetWriter.H index e67f5202cec..39f19ccf322 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<coordSet>&, + const List<scalarField>& times, + const PtrList<coordSet>& tracks, const wordList& valueSetNames, - const List<List<Field<Type>>>&, + const List<List<Field<Type>>>& valueSets, Ostream& ) const { diff --git a/src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.C b/src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.C index ed2c734ca42..218384cb590 100644 --- a/src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.C +++ b/src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.C @@ -38,12 +38,6 @@ Foam::nastranSetWriter<Type>::nastranSetWriter() writer<Type>() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::nastranSetWriter<Type>::~nastranSetWriter() -{} - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -129,6 +123,7 @@ template<class Type> void Foam::nastranSetWriter<Type>::write ( const bool writeTracks, + const List<scalarField>& times, const PtrList<coordSet>& tracks, const wordList& valueSetNames, const List<List<Field<Type>>>& valueSets, diff --git a/src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.H b/src/fileFormats/sampledSetWriters/nastran/nastranSetWriter.H index 5ae415744f6..34ec75ffce1 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<coordSet>&, + const List<scalarField>& times, + const PtrList<coordSet>& tracks, const wordList& valueSetNames, - const List<List<Field<Type>>>&, + const List<List<Field<Type>>>& valueSets, Ostream& ) const; }; diff --git a/src/fileFormats/sampledSetWriters/raw/rawSetWriter.C b/src/fileFormats/sampledSetWriters/raw/rawSetWriter.C index 34d99f9968c..dc6a120606f 100644 --- a/src/fileFormats/sampledSetWriters/raw/rawSetWriter.C +++ b/src/fileFormats/sampledSetWriters/raw/rawSetWriter.C @@ -39,13 +39,6 @@ Foam::rawSetWriter<Type>::rawSetWriter() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::rawSetWriter<Type>::~rawSetWriter() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> @@ -84,7 +77,8 @@ template<class Type> void Foam::rawSetWriter<Type>::write ( const bool writeTracks, - const PtrList<coordSet>& points, + const List<scalarField>& times, + const PtrList<coordSet>& tracks, const wordList& valueSetNames, const List<List<Field<Type>>>& valueSets, Ostream& os @@ -100,7 +94,7 @@ void Foam::rawSetWriter<Type>::write List<const List<Type>*> columns(valueSets.size()); - forAll(points, trackI) + forAll(tracks, trackI) { // Collect sets into columns forAll(valueSets, i) @@ -108,7 +102,7 @@ void Foam::rawSetWriter<Type>::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 2109ed78d7f..817c80ce1de 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<coordSet>&, + const List<scalarField>& times, + const PtrList<coordSet>& tracks, const wordList& valueSetNames, - const List<List<Field<Type>>>&, + const List<List<Field<Type>>>& valueSets, Ostream& ) const; }; diff --git a/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.C b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.C index 0413bfdb90e..ab0dde0a658 100644 --- a/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.C +++ b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.C @@ -41,12 +41,6 @@ Foam::vtkSetWriter<Type>::vtkSetWriter() writer<Type>() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::vtkSetWriter<Type>::~vtkSetWriter() -{} - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -111,6 +105,7 @@ template<class Type> void Foam::vtkSetWriter<Type>::write ( const bool writeTracks, + const List<scalarField>& times, const PtrList<coordSet>& tracks, const wordList& valueSetNames, const List<List<Field<Type>>>& valueSets, diff --git a/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.H b/src/fileFormats/sampledSetWriters/vtk/vtkSetWriter.H index 570a674bfb5..da000a0acc5 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<coordSet>&, + const List<scalarField>& times, + const PtrList<coordSet>& tracks, const wordList& valueSetNames, - const List<List<Field<Type>>>&, + const List<List<Field<Type>>>& valueSets, Ostream& ) const; }; diff --git a/src/fileFormats/sampledSetWriters/writer.H b/src/fileFormats/sampledSetWriters/writer.H index 1c09a54d1da..da591db0f30 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<coordSet>&, + const List<scalarField>& times, + const PtrList<coordSet>& tracks, const wordList& valueSetNames, - const List<List<Field<Type>>>&, + const List<List<Field<Type>>>& valueSets, Ostream& ) const = 0; diff --git a/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.C b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.C index abc6c094b06..74b6d19a85f 100644 --- a/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.C +++ b/src/fileFormats/sampledSetWriters/xmgrace/xmgraceSetWriter.C @@ -40,13 +40,6 @@ Foam::xmgraceSetWriter<Type>::xmgraceSetWriter() {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::xmgraceSetWriter<Type>::~xmgraceSetWriter() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class Type> @@ -91,7 +84,8 @@ template<class Type> void Foam::xmgraceSetWriter<Type>::write ( const bool writeTracks, - const PtrList<coordSet>& trackPoints, + const List<scalarField>& times, + const PtrList<coordSet>& tracks, const wordList& valueSetNames, const List<List<Field<Type>>>& valueSets, Ostream& os @@ -104,24 +98,24 @@ void Foam::xmgraceSetWriter<Type>::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 2c92aa4be1a..31ec5e41e37 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<coordSet>&, + const List<scalarField>& times, + const PtrList<coordSet>& tracks, const wordList& valueSetNames, - const List<List<Field<Type>>>&, + const List<List<Field<Type>>>& valueSets, Ostream& ) const; }; diff --git a/src/functionObjects/field/streamLine/streamLineBase.C b/src/functionObjects/field/streamLine/streamLineBase.C index e763f5bd72d..efd37d24fad 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<scalarField>(), // times tracks, scalarNames_, scalarValues, @@ -782,7 +783,8 @@ bool Foam::functionObjects::streamLineBase::writeToFile() vectorFormatterPtr_().write ( - true, // writeTracks + true, // writeTracks + List<scalarField>(), // times tracks, vectorNames_, vectorValues, diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C index 5be91fd952c..3c19ea70872 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<scalarField>(), // times allLeakPaths, valueSetNames, allLeakData, -- GitLab