mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: ensight binary surface output, formatOptions in sampleDict
- For example,
// optionally define extra controls for the output formats
formatOptions
{
ensight
{
format binary;
}
}
These are passed to the writer that support a dictionary of options.
Otherwise the normal null constructor is used.
This commit is contained in:
@ -38,6 +38,16 @@ setFormat raw;
|
|||||||
// but without any values!
|
// but without any values!
|
||||||
surfaceFormat vtk;
|
surfaceFormat vtk;
|
||||||
|
|
||||||
|
// optionally define extra controls for the output formats
|
||||||
|
formatOptions
|
||||||
|
{
|
||||||
|
ensight
|
||||||
|
{
|
||||||
|
format ascii;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// interpolationScheme. choice of
|
// interpolationScheme. choice of
|
||||||
// cell : use cell-centre value only; constant over cells (default)
|
// cell : use cell-centre value only; constant over cells (default)
|
||||||
// cellPoint : use cell-centre and vertex values
|
// cellPoint : use cell-centre and vertex values
|
||||||
|
|||||||
@ -220,11 +220,15 @@ void Foam::sampledSurfaces::read(const dictionary& dict)
|
|||||||
clearFieldGroups();
|
clearFieldGroups();
|
||||||
|
|
||||||
dict.lookup("interpolationScheme") >> interpolationScheme_;
|
dict.lookup("interpolationScheme") >> interpolationScheme_;
|
||||||
|
const word writeType(dict.lookup("surfaceFormat"));
|
||||||
word writeType(dict.lookup("surfaceFormat"));
|
|
||||||
|
|
||||||
// define the surface formatter
|
// define the surface formatter
|
||||||
formatter_ = surfaceWriter::New(writeType);
|
// optionally defined extra controls for the output formats
|
||||||
|
formatter_ = surfaceWriter::New
|
||||||
|
(
|
||||||
|
writeType,
|
||||||
|
dict.subOrEmptyDict("formatOptions").subOrEmptyDict(writeType)
|
||||||
|
);
|
||||||
|
|
||||||
PtrList<sampledSurface> newList
|
PtrList<sampledSurface> newList
|
||||||
(
|
(
|
||||||
|
|||||||
@ -37,6 +37,7 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
makeSurfaceWriterType(ensightSurfaceWriter);
|
makeSurfaceWriterType(ensightSurfaceWriter);
|
||||||
|
addToRunTimeSelectionTable(surfaceWriter, ensightSurfaceWriter, wordDict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -120,6 +121,19 @@ Foam::ensightSurfaceWriter::ensightSurfaceWriter()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::ensightSurfaceWriter::ensightSurfaceWriter(const dictionary& options)
|
||||||
|
:
|
||||||
|
surfaceWriter(),
|
||||||
|
writeFormat_(IOstream::ASCII)
|
||||||
|
{
|
||||||
|
// choose ascii or binary format
|
||||||
|
if (options.found("format"))
|
||||||
|
{
|
||||||
|
writeFormat_ = IOstream::formatEnum(options.lookup("format"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::ensightSurfaceWriter::~ensightSurfaceWriter()
|
Foam::ensightSurfaceWriter::~ensightSurfaceWriter()
|
||||||
|
|||||||
@ -84,6 +84,9 @@ public:
|
|||||||
//- Construct null
|
//- Construct null
|
||||||
ensightSurfaceWriter();
|
ensightSurfaceWriter();
|
||||||
|
|
||||||
|
//- Construct with some output options
|
||||||
|
ensightSurfaceWriter(const dictionary& options);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~ensightSurfaceWriter();
|
virtual ~ensightSurfaceWriter();
|
||||||
|
|||||||
@ -38,6 +38,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
defineTypeNameAndDebug(surfaceWriter, 0);
|
defineTypeNameAndDebug(surfaceWriter, 0);
|
||||||
defineRunTimeSelectionTable(surfaceWriter, word);
|
defineRunTimeSelectionTable(surfaceWriter, word);
|
||||||
|
defineRunTimeSelectionTable(surfaceWriter, wordDict);
|
||||||
addNamedToRunTimeSelectionTable
|
addNamedToRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
surfaceWriter,
|
surfaceWriter,
|
||||||
@ -83,6 +84,23 @@ Foam::surfaceWriter::New(const word& writeType)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::autoPtr<Foam::surfaceWriter>
|
||||||
|
Foam::surfaceWriter::New(const word& writeType, const dictionary& optDict)
|
||||||
|
{
|
||||||
|
// find constructors with dictionary options
|
||||||
|
wordDictConstructorTable::iterator cstrIter =
|
||||||
|
wordDictConstructorTablePtr_->find(writeType);
|
||||||
|
|
||||||
|
if (cstrIter == wordDictConstructorTablePtr_->end())
|
||||||
|
{
|
||||||
|
// revert to versions without options
|
||||||
|
return Foam::surfaceWriter::New(writeType);
|
||||||
|
}
|
||||||
|
|
||||||
|
return autoPtr<surfaceWriter>(cstrIter()(optDict));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::surfaceWriter::surfaceWriter()
|
Foam::surfaceWriter::surfaceWriter()
|
||||||
|
|||||||
@ -70,12 +70,31 @@ public:
|
|||||||
()
|
()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
surfaceWriter,
|
||||||
|
wordDict,
|
||||||
|
(
|
||||||
|
const dictionary& optDict
|
||||||
|
),
|
||||||
|
(optDict)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
|
|
||||||
//- Return a reference to the selected surfaceWriter
|
//- Return a reference to the selected surfaceWriter
|
||||||
static autoPtr<surfaceWriter> New(const word& writeType);
|
static autoPtr<surfaceWriter> New(const word& writeType);
|
||||||
|
|
||||||
|
//- Return a reference to the selected surfaceWriter
|
||||||
|
// Select with extra write option
|
||||||
|
static autoPtr<surfaceWriter> New
|
||||||
|
(
|
||||||
|
const word& writeType,
|
||||||
|
const dictionary& writeOptions
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user