mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: sampledSets - enable writer construction from dictionary
Users can now include additional controls via a new formatOptions dictionary.
This commit is contained in:
committed by
Mark Olesen
parent
e5267bf81d
commit
98c25d163a
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,6 +40,13 @@ Foam::csvSetWriter<Type>::csvSetWriter()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::csvSetWriter<Type>::csvSetWriter(const dictionary& dict)
|
||||||
|
:
|
||||||
|
writer<Type>(dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -74,9 +75,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
csvSetWriter();
|
csvSetWriter();
|
||||||
|
|
||||||
|
//- Construct with dictionary
|
||||||
|
explicit csvSetWriter(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~csvSetWriter() = default;
|
virtual ~csvSetWriter() = default;
|
||||||
|
|||||||
@ -42,6 +42,13 @@ Foam::ensightSetWriter<Type>::ensightSetWriter()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::ensightSetWriter<Type>::ensightSetWriter(const dictionary& dict)
|
||||||
|
:
|
||||||
|
writer<Type>(dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -61,9 +62,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
ensightSetWriter();
|
ensightSetWriter();
|
||||||
|
|
||||||
|
//- Construct with dictionary
|
||||||
|
explicit ensightSetWriter(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~ensightSetWriter() = default;
|
virtual ~ensightSetWriter() = default;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -42,6 +42,13 @@ Foam::gnuplotSetWriter<Type>::gnuplotSetWriter()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::gnuplotSetWriter<Type>::gnuplotSetWriter(const dictionary& dict)
|
||||||
|
:
|
||||||
|
writer<Type>(dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -52,7 +53,6 @@ class gnuplotSetWriter
|
|||||||
:
|
:
|
||||||
public writer<Type>
|
public writer<Type>
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -61,9 +61,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
gnuplotSetWriter();
|
gnuplotSetWriter();
|
||||||
|
|
||||||
|
//- Construct with dictionary
|
||||||
|
explicit gnuplotSetWriter(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~gnuplotSetWriter() = default;
|
virtual ~gnuplotSetWriter() = default;
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -31,7 +32,6 @@ License
|
|||||||
#include "fileName.H"
|
#include "fileName.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
@ -53,6 +53,13 @@ Foam::jplotSetWriter<Type>::jplotSetWriter()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::jplotSetWriter<Type>::jplotSetWriter(const dictionary& dict)
|
||||||
|
:
|
||||||
|
writer<Type>(dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -65,9 +66,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
jplotSetWriter();
|
jplotSetWriter();
|
||||||
|
|
||||||
|
//- Construct with dictionary
|
||||||
|
explicit jplotSetWriter(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~jplotSetWriter() = default;
|
virtual ~jplotSetWriter() = default;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2019 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,6 +39,13 @@ Foam::nastranSetWriter<Type>::nastranSetWriter()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::nastranSetWriter<Type>::nastranSetWriter(const dictionary& dict)
|
||||||
|
:
|
||||||
|
writer<Type>(dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -56,13 +56,6 @@ class nastranSetWriter
|
|||||||
:
|
:
|
||||||
public writer<Type>
|
public writer<Type>
|
||||||
{
|
{
|
||||||
public:
|
|
||||||
|
|
||||||
//- File field formats
|
|
||||||
using fieldFormat = Foam::fileFormats::NASCore::fieldFormat;
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Write the formatted keyword to the output stream
|
//- Write the formatted keyword to the output stream
|
||||||
@ -75,15 +68,22 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- File field formats
|
||||||
|
using fieldFormat = Foam::fileFormats::NASCore::fieldFormat;
|
||||||
|
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("nastran");
|
TypeName("nastran");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
nastranSetWriter();
|
nastranSetWriter();
|
||||||
|
|
||||||
|
//- Construct with dictionary
|
||||||
|
explicit nastranSetWriter(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~nastranSetWriter() = default;
|
virtual ~nastranSetWriter() = default;
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -39,6 +40,13 @@ Foam::rawSetWriter<Type>::rawSetWriter()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::rawSetWriter<Type>::rawSetWriter(const dictionary& dict)
|
||||||
|
:
|
||||||
|
writer<Type>(dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -52,7 +53,6 @@ class rawSetWriter
|
|||||||
:
|
:
|
||||||
public writer<Type>
|
public writer<Type>
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -61,9 +61,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
rawSetWriter();
|
rawSetWriter();
|
||||||
|
|
||||||
|
//- Construct with dictionary
|
||||||
|
explicit rawSetWriter(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~rawSetWriter() = default;
|
virtual ~rawSetWriter() = default;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2016 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -42,6 +42,13 @@ Foam::vtkSetWriter<Type>::vtkSetWriter()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::vtkSetWriter<Type>::vtkSetWriter(const dictionary& dict)
|
||||||
|
:
|
||||||
|
writer<Type>(dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -55,7 +56,6 @@ class vtkSetWriter
|
|||||||
:
|
:
|
||||||
public writer<Type>
|
public writer<Type>
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -64,9 +64,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
vtkSetWriter();
|
vtkSetWriter();
|
||||||
|
|
||||||
|
//- Construct with dictionary
|
||||||
|
explicit vtkSetWriter(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~vtkSetWriter() = default;
|
virtual ~vtkSetWriter() = default;
|
||||||
|
|||||||
@ -31,7 +31,7 @@ License
|
|||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "OSspecific.H"
|
#include "OSspecific.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::autoPtr<Foam::writer<Type>> Foam::writer<Type>::New
|
Foam::autoPtr<Foam::writer<Type>> Foam::writer<Type>::New
|
||||||
@ -55,6 +55,29 @@ Foam::autoPtr<Foam::writer<Type>> Foam::writer<Type>::New
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::autoPtr<Foam::writer<Type>> Foam::writer<Type>::New
|
||||||
|
(
|
||||||
|
const word& writeType,
|
||||||
|
const dictionary& formatOptions
|
||||||
|
)
|
||||||
|
{
|
||||||
|
auto ctorPtr = dictConstructorTable(writeType);
|
||||||
|
|
||||||
|
if (!ctorPtr)
|
||||||
|
{
|
||||||
|
FatalErrorInLookup
|
||||||
|
(
|
||||||
|
"writer",
|
||||||
|
writeType,
|
||||||
|
*dictConstructorTablePtr_
|
||||||
|
) << exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<writer<Type>>(ctorPtr(formatOptions));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
@ -143,10 +166,8 @@ Foam::writer<Type>::writer()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::writer<Type>::~writer()
|
Foam::writer<Type>::writer(const dictionary& dict)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -70,7 +71,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward Declarations
|
||||||
class coordSet;
|
class coordSet;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -80,7 +81,6 @@ class coordSet;
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
class writer
|
class writer
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//- Generates filename from coordSet and sampled fields
|
//- Generates filename from coordSet and sampled fields
|
||||||
@ -123,21 +123,42 @@ public:
|
|||||||
()
|
()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
writer,
|
||||||
|
dict,
|
||||||
|
(
|
||||||
|
const dictionary& formatOptions
|
||||||
|
),
|
||||||
|
(formatOptions)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
//- Return a reference to the selected writer
|
//- Return a reference to the selected writer
|
||||||
static autoPtr<writer> New(const word& writeFormat);
|
static autoPtr<writer> New(const word& writeFormat);
|
||||||
|
|
||||||
|
//- Return a reference to the selected writer
|
||||||
|
static autoPtr<writer> New
|
||||||
|
(
|
||||||
|
const word& writeFormat,
|
||||||
|
const dictionary& formatOptions
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
writer();
|
writer();
|
||||||
|
|
||||||
|
//- Construct with dictionary
|
||||||
|
explicit writer(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~writer() = 0;
|
virtual ~writer() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -36,7 +37,8 @@ namespace Foam
|
|||||||
|
|
||||||
#define defineSetWriterType(dataType) \
|
#define defineSetWriterType(dataType) \
|
||||||
defineNamedTemplateTypeNameAndDebug(writer<dataType >, 0); \
|
defineNamedTemplateTypeNameAndDebug(writer<dataType >, 0); \
|
||||||
defineTemplatedRunTimeSelectionTable(writer, word, dataType);
|
defineTemplatedRunTimeSelectionTable(writer, word, dataType); \
|
||||||
|
defineTemplatedRunTimeSelectionTable(writer, dict, dataType);
|
||||||
|
|
||||||
defineSetWriterType(scalar);
|
defineSetWriterType(scalar);
|
||||||
defineSetWriterType(vector);
|
defineSetWriterType(vector);
|
||||||
|
|||||||
@ -61,7 +61,11 @@ SourceFiles
|
|||||||
addTemplatedToRunTimeSelectionTable \
|
addTemplatedToRunTimeSelectionTable \
|
||||||
( \
|
( \
|
||||||
writer, typeWriter, dataType, word \
|
writer, typeWriter, dataType, word \
|
||||||
)
|
); \
|
||||||
|
addTemplatedToRunTimeSelectionTable \
|
||||||
|
( \
|
||||||
|
writer, typeWriter, dataType, dict \
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Define type info for scalar, vector etc. instantiations
|
// Define type info for scalar, vector etc. instantiations
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,6 +41,13 @@ Foam::xmgraceSetWriter<Type>::xmgraceSetWriter()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::xmgraceSetWriter<Type>::xmgraceSetWriter(const dictionary& dict)
|
||||||
|
:
|
||||||
|
writer<Type>(dict)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -52,7 +53,6 @@ class xmgraceSetWriter
|
|||||||
:
|
:
|
||||||
public writer<Type>
|
public writer<Type>
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -61,9 +61,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct null
|
//- Default construct
|
||||||
xmgraceSetWriter();
|
xmgraceSetWriter();
|
||||||
|
|
||||||
|
//- Construct with dictionary
|
||||||
|
explicit xmgraceSetWriter(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~xmgraceSetWriter() = default;
|
virtual ~xmgraceSetWriter() = default;
|
||||||
|
|||||||
@ -97,7 +97,8 @@ Foam::sampledSets::sampledSets
|
|||||||
outputPath_(fileName::null),
|
outputPath_(fileName::null),
|
||||||
searchEngine_(mesh_),
|
searchEngine_(mesh_),
|
||||||
interpolationScheme_(word::null),
|
interpolationScheme_(word::null),
|
||||||
writeFormat_(word::null)
|
writeFormat_(word::null),
|
||||||
|
writeFormatOptions_(dict.subOrEmptyDict("formatOptions"))
|
||||||
{
|
{
|
||||||
outputPath_ =
|
outputPath_ =
|
||||||
(
|
(
|
||||||
@ -106,7 +107,7 @@ Foam::sampledSets::sampledSets
|
|||||||
|
|
||||||
if (mesh_.name() != polyMesh::defaultRegion)
|
if (mesh_.name() != polyMesh::defaultRegion)
|
||||||
{
|
{
|
||||||
outputPath_ = outputPath_/mesh_.name();
|
outputPath_ /= mesh_.name();
|
||||||
}
|
}
|
||||||
|
|
||||||
outputPath_.clean(); // Remove unneeded ".."
|
outputPath_.clean(); // Remove unneeded ".."
|
||||||
@ -130,7 +131,8 @@ Foam::sampledSets::sampledSets
|
|||||||
outputPath_(fileName::null),
|
outputPath_(fileName::null),
|
||||||
searchEngine_(mesh_),
|
searchEngine_(mesh_),
|
||||||
interpolationScheme_(word::null),
|
interpolationScheme_(word::null),
|
||||||
writeFormat_(word::null)
|
writeFormat_(word::null),
|
||||||
|
writeFormatOptions_(dict.subOrEmptyDict("formatOptions"))
|
||||||
{
|
{
|
||||||
outputPath_ =
|
outputPath_ =
|
||||||
(
|
(
|
||||||
@ -139,7 +141,7 @@ Foam::sampledSets::sampledSets
|
|||||||
|
|
||||||
if (mesh_.name() != polyMesh::defaultRegion)
|
if (mesh_.name() != polyMesh::defaultRegion)
|
||||||
{
|
{
|
||||||
outputPath_ = outputPath_/mesh_.name();
|
outputPath_ /= mesh_.name();
|
||||||
}
|
}
|
||||||
|
|
||||||
outputPath_.clean(); // Remove unneeded ".."
|
outputPath_.clean(); // Remove unneeded ".."
|
||||||
|
|||||||
@ -53,7 +53,7 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declarations
|
// Forward Declarations
|
||||||
class Time;
|
class Time;
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
class dictionary;
|
||||||
@ -68,7 +68,7 @@ class sampledSets
|
|||||||
public functionObjects::regionFunctionObject,
|
public functionObjects::regionFunctionObject,
|
||||||
public PtrList<sampledSet>
|
public PtrList<sampledSet>
|
||||||
{
|
{
|
||||||
// Private classes
|
// Private Classes
|
||||||
|
|
||||||
//- Class used for grouping field types
|
//- Class used for grouping field types
|
||||||
template<class Type>
|
template<class Type>
|
||||||
@ -82,18 +82,7 @@ class sampledSets
|
|||||||
autoPtr<writer<Type>> formatter;
|
autoPtr<writer<Type>> formatter;
|
||||||
|
|
||||||
//- Construct null
|
//- Construct null
|
||||||
fieldGroup()
|
fieldGroup() = default;
|
||||||
:
|
|
||||||
DynamicList<word>(0),
|
|
||||||
formatter(nullptr)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Construct for a particular format
|
|
||||||
fieldGroup(const word& writeFormat)
|
|
||||||
:
|
|
||||||
DynamicList<word>(0),
|
|
||||||
formatter(writer<Type>::New(writeFormat))
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Reset format and field list
|
//- Reset format and field list
|
||||||
void clear()
|
void clear()
|
||||||
@ -102,10 +91,9 @@ class sampledSets
|
|||||||
formatter.clear();
|
formatter.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Assign a new formatter
|
void setFormatter(const word& writeFormat, const dictionary& dict)
|
||||||
void operator=(const word& writeFormat)
|
|
||||||
{
|
{
|
||||||
formatter = writer<Type>::New(writeFormat);
|
formatter = writer<Type>::New(writeFormat, dict);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -151,13 +139,13 @@ class sampledSets
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Static data members
|
// Static Data Members
|
||||||
|
|
||||||
//- Output verbosity
|
//- Output verbosity
|
||||||
static bool verbose_;
|
static bool verbose_;
|
||||||
|
|
||||||
|
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Const reference to fvMesh
|
//- Const reference to fvMesh
|
||||||
const fvMesh& mesh_;
|
const fvMesh& mesh_;
|
||||||
@ -175,7 +163,7 @@ class sampledSets
|
|||||||
meshSearch searchEngine_;
|
meshSearch searchEngine_;
|
||||||
|
|
||||||
|
|
||||||
// Read from dictonary
|
// Read from dictionary
|
||||||
|
|
||||||
//- Names of fields to sample
|
//- Names of fields to sample
|
||||||
wordRes fieldSelection_;
|
wordRes fieldSelection_;
|
||||||
@ -186,8 +174,11 @@ class sampledSets
|
|||||||
//- Output format to use
|
//- Output format to use
|
||||||
word writeFormat_;
|
word writeFormat_;
|
||||||
|
|
||||||
|
//- Dictionary containing writer options
|
||||||
|
dictionary writeFormatOptions_;
|
||||||
|
|
||||||
// Categorized scalar/vector/tensor fields
|
|
||||||
|
// Categorized scalar/vector/tensor fields
|
||||||
|
|
||||||
fieldGroup<scalar> scalarFields_;
|
fieldGroup<scalar> scalarFields_;
|
||||||
fieldGroup<vector> vectorFields_;
|
fieldGroup<vector> vectorFields_;
|
||||||
@ -196,7 +187,7 @@ class sampledSets
|
|||||||
fieldGroup<tensor> tensorFields_;
|
fieldGroup<tensor> tensorFields_;
|
||||||
|
|
||||||
|
|
||||||
// Merging structures
|
// Merging structures
|
||||||
|
|
||||||
PtrList<coordSet> masterSampledSets_;
|
PtrList<coordSet> masterSampledSets_;
|
||||||
labelListList indexSets_;
|
labelListList indexSets_;
|
||||||
@ -211,7 +202,7 @@ class sampledSets
|
|||||||
label classifyFields();
|
label classifyFields();
|
||||||
|
|
||||||
//- Combine points from all processors. Sort by curveDist and produce
|
//- Combine points from all processors. Sort by curveDist and produce
|
||||||
// index list. Valid result only on master processor.
|
//- index list. Valid result only on master processor.
|
||||||
void combineSampledSets
|
void combineSampledSets
|
||||||
(
|
(
|
||||||
PtrList<coordSet>& masterSampledSets,
|
PtrList<coordSet>& masterSampledSets,
|
||||||
|
|||||||
@ -231,7 +231,7 @@ void Foam::sampledSets::sampleAndWrite(fieldGroup<Type>& fields)
|
|||||||
// Create or use existing writer
|
// Create or use existing writer
|
||||||
if (!fields.formatter)
|
if (!fields.formatter)
|
||||||
{
|
{
|
||||||
fields = writeFormat_;
|
fields.setFormatter(writeFormat_, writeFormatOptions_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Storage for interpolated values
|
// Storage for interpolated values
|
||||||
|
|||||||
Reference in New Issue
Block a user