sampledSurface: Added support for writing surfaces in binary format
by specifying
writeFormat binary;
in the sampledSurface dictionary.
This commit is contained in:
@ -286,7 +286,10 @@ Foam::tmp<Foam::triSurfacePointScalarField> Foam::automatic::load()
|
||||
faces[fI] = surface_.triSurface::operator[](fI).triFaceFace();
|
||||
}
|
||||
|
||||
vtkSurfaceWriter().write
|
||||
vtkSurfaceWriter
|
||||
(
|
||||
surface_.searchableSurface::time().writeFormat()
|
||||
).write
|
||||
(
|
||||
surface_.searchableSurface::time().constant()/"triSurface",
|
||||
surfaceName_.lessExt().name(),
|
||||
|
||||
@ -523,7 +523,7 @@ void Foam::writeAMIWeightsSum
|
||||
// Write the surface
|
||||
if (Pstream::master())
|
||||
{
|
||||
vtkSurfaceWriter().write
|
||||
vtkSurfaceWriter(mesh.time().writeFormat()).write
|
||||
(
|
||||
file.path(),
|
||||
file.name(),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -163,7 +163,11 @@ int main(int argc, char *argv[])
|
||||
autoPtr<writer<scalar>> setWriter;
|
||||
if (writeSets)
|
||||
{
|
||||
surfWriter = surfaceWriter::New(surfaceFormat);
|
||||
surfWriter = surfaceWriter::New
|
||||
(
|
||||
surfaceFormat,
|
||||
mesh.time().writeFormat()
|
||||
);
|
||||
setWriter = writer<scalar>::New(vtkSetWriter<scalar>::typeName);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -629,7 +629,7 @@ int main(int argc, char *argv[])
|
||||
faces[i] = surf[i].triFaceFace();
|
||||
}
|
||||
|
||||
vtkSurfaceWriter().write
|
||||
vtkSurfaceWriter(IOstream::ASCII).write
|
||||
(
|
||||
surfFileName.path(),
|
||||
surfFileNameBase,
|
||||
|
||||
@ -463,7 +463,7 @@ namespace Foam
|
||||
{
|
||||
const faceList faces(searchSurf.faces());
|
||||
|
||||
vtkSurfaceWriter().write
|
||||
vtkSurfaceWriter(runTime.writeFormat()).write
|
||||
(
|
||||
runTime.constantPath()/"triSurface",// outputDir
|
||||
searchSurf.objectRegistry::name(), // surfaceName
|
||||
@ -474,7 +474,7 @@ namespace Foam
|
||||
false // isNodeValues
|
||||
);
|
||||
|
||||
vtkSurfaceWriter().write
|
||||
vtkSurfaceWriter(runTime.writeFormat()).write
|
||||
(
|
||||
runTime.constantPath()/"triSurface",// outputDir
|
||||
searchSurf.objectRegistry::name(), // surfaceName
|
||||
@ -525,7 +525,7 @@ namespace Foam
|
||||
externalClosenessPointField[meshPointMap[pi]];
|
||||
}
|
||||
|
||||
vtkSurfaceWriter().write
|
||||
vtkSurfaceWriter(runTime.writeFormat()).write
|
||||
(
|
||||
runTime.constantPath()/"triSurface",// outputDir
|
||||
searchSurf.objectRegistry::name(), // surfaceName
|
||||
@ -536,7 +536,7 @@ namespace Foam
|
||||
true // isNodeValues
|
||||
);
|
||||
|
||||
vtkSurfaceWriter().write
|
||||
vtkSurfaceWriter(runTime.writeFormat()).write
|
||||
(
|
||||
runTime.constantPath()/"triSurface",// outputDir
|
||||
searchSurf.objectRegistry::name(), // surfaceName
|
||||
@ -574,7 +574,7 @@ namespace Foam
|
||||
|
||||
if (writeVTK)
|
||||
{
|
||||
vtkSurfaceWriter().write
|
||||
vtkSurfaceWriter(runTime.writeFormat()).write
|
||||
(
|
||||
runTime.constantPath()/"triSurface",// outputDir
|
||||
sFeatFileName, // surfaceName
|
||||
@ -646,7 +646,7 @@ namespace Foam
|
||||
|
||||
if (writeVTK)
|
||||
{
|
||||
vtkSurfaceWriter().write
|
||||
vtkSurfaceWriter(runTime.writeFormat()).write
|
||||
(
|
||||
runTime.constantPath()/"triSurface",// outputDir
|
||||
sFeatFileName, // surfaceName
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -449,7 +449,10 @@ void Foam::ParticleCollector<CloudType>::write()
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
autoPtr<surfaceWriter> writer(surfaceWriter::New(surfaceFormat_));
|
||||
autoPtr<surfaceWriter> writer
|
||||
(
|
||||
surfaceWriter::New(surfaceFormat_, time.writeFormat())
|
||||
);
|
||||
|
||||
writer->write
|
||||
(
|
||||
|
||||
@ -112,24 +112,19 @@ void Foam::ensightSurfaceWriter::write
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::ensightSurfaceWriter::ensightSurfaceWriter()
|
||||
Foam::ensightSurfaceWriter::ensightSurfaceWriter
|
||||
(
|
||||
const IOstream::streamFormat writeFormat
|
||||
)
|
||||
:
|
||||
surfaceWriter(),
|
||||
writeFormat_(IOstream::ASCII)
|
||||
surfaceWriter(writeFormat)
|
||||
{}
|
||||
|
||||
|
||||
Foam::ensightSurfaceWriter::ensightSurfaceWriter(const dictionary& options)
|
||||
Foam::ensightSurfaceWriter::ensightSurfaceWriter(const dictionary& optDict)
|
||||
:
|
||||
surfaceWriter(),
|
||||
writeFormat_(IOstream::ASCII)
|
||||
{
|
||||
// choose ascii or binary format
|
||||
if (options.found("format"))
|
||||
{
|
||||
writeFormat_ = IOstream::formatEnum(options.lookup("format"));
|
||||
}
|
||||
}
|
||||
surfaceWriter(optDict)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -50,12 +50,6 @@ class ensightSurfaceWriter
|
||||
:
|
||||
public surfaceWriter
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Write option (default is IOstream::ASCII
|
||||
IOstream::streamFormat writeFormat_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Templated write operation
|
||||
@ -80,11 +74,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
ensightSurfaceWriter();
|
||||
//- Construct given write format
|
||||
ensightSurfaceWriter(const IOstream::streamFormat writeFormat);
|
||||
|
||||
//- Construct with some output options
|
||||
ensightSurfaceWriter(const dictionary& options);
|
||||
ensightSurfaceWriter(const dictionary& optDict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -80,9 +80,12 @@ void Foam::foamSurfaceWriter::write
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::foamSurfaceWriter::foamSurfaceWriter()
|
||||
Foam::foamSurfaceWriter::foamSurfaceWriter
|
||||
(
|
||||
const IOstream::streamFormat writeFormat
|
||||
)
|
||||
:
|
||||
surfaceWriter()
|
||||
surfaceWriter(writeFormat)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -74,8 +74,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
foamSurfaceWriter();
|
||||
//- Construct given write format
|
||||
foamSurfaceWriter(const IOstream::streamFormat writeFormat);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -316,28 +316,31 @@ void Foam::nastranSurfaceWriter::writeGeometry
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::nastranSurfaceWriter::nastranSurfaceWriter()
|
||||
Foam::nastranSurfaceWriter::nastranSurfaceWriter
|
||||
(
|
||||
const IOstream::streamFormat writeFormat
|
||||
)
|
||||
:
|
||||
surfaceWriter(),
|
||||
surfaceWriter(writeFormat),
|
||||
writeFormat_(wfShort),
|
||||
fieldMap_(),
|
||||
scale_(1.0)
|
||||
{}
|
||||
|
||||
|
||||
Foam::nastranSurfaceWriter::nastranSurfaceWriter(const dictionary& options)
|
||||
Foam::nastranSurfaceWriter::nastranSurfaceWriter(const dictionary& optDict)
|
||||
:
|
||||
surfaceWriter(),
|
||||
surfaceWriter(optDict),
|
||||
writeFormat_(wfLong),
|
||||
fieldMap_(),
|
||||
scale_(options.lookupOrDefault("scale", 1.0))
|
||||
scale_(optDict.lookupOrDefault("scale", 1.0))
|
||||
{
|
||||
if (options.found("format"))
|
||||
if (optDict.found("format"))
|
||||
{
|
||||
writeFormat_ = writeFormatNames_.read(options.lookup("format"));
|
||||
writeFormat_ = writeFormatNames_.read(optDict.lookup("format"));
|
||||
}
|
||||
|
||||
List<Tuple2<word, word>> fieldSet(options.lookup("fields"));
|
||||
List<Tuple2<word, word>> fieldSet(optDict.lookup("fields"));
|
||||
|
||||
forAll(fieldSet, i)
|
||||
{
|
||||
|
||||
@ -155,11 +155,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
nastranSurfaceWriter();
|
||||
//- Construct given write format
|
||||
nastranSurfaceWriter(const IOstream::streamFormat writeFormat);
|
||||
|
||||
//- Construct with some output options
|
||||
nastranSurfaceWriter(const dictionary& options);
|
||||
nastranSurfaceWriter(const dictionary& optDict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -36,9 +36,9 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::noSurfaceWriter::noSurfaceWriter()
|
||||
Foam::noSurfaceWriter::noSurfaceWriter(const IOstream::streamFormat writeFormat)
|
||||
:
|
||||
surfaceWriter()
|
||||
surfaceWriter(writeFormat)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -59,8 +59,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
noSurfaceWriter();
|
||||
//- Construct given write format
|
||||
noSurfaceWriter(const IOstream::streamFormat writeFormat);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -39,7 +39,7 @@ namespace Foam
|
||||
|
||||
Foam::proxySurfaceWriter::proxySurfaceWriter(const word& ext)
|
||||
:
|
||||
surfaceWriter(),
|
||||
surfaceWriter(IOstream::ASCII),
|
||||
ext_(ext)
|
||||
{}
|
||||
|
||||
|
||||
@ -273,22 +273,25 @@ void Foam::rawSurfaceWriter::write
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::rawSurfaceWriter::rawSurfaceWriter()
|
||||
Foam::rawSurfaceWriter::rawSurfaceWriter
|
||||
(
|
||||
const IOstream::streamFormat writeFormat
|
||||
)
|
||||
:
|
||||
surfaceWriter(),
|
||||
surfaceWriter(writeFormat),
|
||||
writeCompression_(IOstream::UNCOMPRESSED)
|
||||
{}
|
||||
|
||||
|
||||
Foam::rawSurfaceWriter::rawSurfaceWriter(const dictionary& options)
|
||||
Foam::rawSurfaceWriter::rawSurfaceWriter(const dictionary& optDict)
|
||||
:
|
||||
surfaceWriter(),
|
||||
surfaceWriter(optDict),
|
||||
writeCompression_(IOstream::UNCOMPRESSED)
|
||||
{
|
||||
if (options.found("compression"))
|
||||
if (optDict.found("compression"))
|
||||
{
|
||||
writeCompression_ =
|
||||
IOstream::compressionEnum(options.lookup("compression"));
|
||||
IOstream::compressionEnum(optDict.lookup("compression"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -108,11 +108,11 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
rawSurfaceWriter();
|
||||
//- Construct given write format
|
||||
rawSurfaceWriter(const IOstream::streamFormat writeFormat);
|
||||
|
||||
//- Construct with some output options
|
||||
rawSurfaceWriter(const dictionary& options);
|
||||
//- Construct with output options
|
||||
rawSurfaceWriter(const dictionary& optDict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -119,9 +119,12 @@ void Foam::starcdSurfaceWriter::write
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::starcdSurfaceWriter::starcdSurfaceWriter()
|
||||
Foam::starcdSurfaceWriter::starcdSurfaceWriter
|
||||
(
|
||||
const IOstream::streamFormat writeFormat
|
||||
)
|
||||
:
|
||||
surfaceWriter()
|
||||
surfaceWriter(writeFormat)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -97,8 +97,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
starcdSurfaceWriter();
|
||||
//- Construct given write format
|
||||
starcdSurfaceWriter(const IOstream::streamFormat writeFormat);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,7 +41,11 @@ namespace Foam
|
||||
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::surfaceWriter>
|
||||
Foam::surfaceWriter::New(const word& writeType)
|
||||
Foam::surfaceWriter::New
|
||||
(
|
||||
const word& writeType,
|
||||
const IOstream::streamFormat format
|
||||
)
|
||||
{
|
||||
wordConstructorTable::iterator cstrIter =
|
||||
wordConstructorTablePtr_->find(writeType);
|
||||
@ -67,12 +71,16 @@ Foam::surfaceWriter::New(const word& writeType)
|
||||
}
|
||||
}
|
||||
|
||||
return autoPtr<surfaceWriter>(cstrIter()());
|
||||
return autoPtr<surfaceWriter>(cstrIter()(format));
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::surfaceWriter>
|
||||
Foam::surfaceWriter::New(const word& writeType, const dictionary& optDict)
|
||||
Foam::surfaceWriter::New
|
||||
(
|
||||
const word& writeType,
|
||||
const dictionary& optDict
|
||||
)
|
||||
{
|
||||
// find constructors with dictionary options
|
||||
wordDictConstructorTable::iterator cstrIter =
|
||||
@ -80,8 +88,18 @@ Foam::surfaceWriter::New(const word& writeType, const dictionary& optDict)
|
||||
|
||||
if (cstrIter == wordDictConstructorTablePtr_->end())
|
||||
{
|
||||
// revert to versions without options
|
||||
return Foam::surfaceWriter::New(writeType);
|
||||
IOstream::streamFormat writeFormat = IOstream::ASCII;
|
||||
|
||||
if (optDict.found("writeFormat"))
|
||||
{
|
||||
writeFormat = IOstream::formatEnum
|
||||
(
|
||||
optDict.lookup("writeFormat")
|
||||
);
|
||||
}
|
||||
|
||||
// Revert to versions without options
|
||||
return Foam::surfaceWriter::New(writeType, writeFormat);
|
||||
}
|
||||
|
||||
return autoPtr<surfaceWriter>(cstrIter()(optDict));
|
||||
@ -90,10 +108,26 @@ Foam::surfaceWriter::New(const word& writeType, const dictionary& optDict)
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::surfaceWriter::surfaceWriter()
|
||||
Foam::surfaceWriter::surfaceWriter(const IOstream::streamFormat writeFormat)
|
||||
:
|
||||
writeFormat_(writeFormat)
|
||||
{}
|
||||
|
||||
|
||||
Foam::surfaceWriter::surfaceWriter(const dictionary& optDict)
|
||||
:
|
||||
writeFormat_(IOstream::ASCII)
|
||||
{
|
||||
if (optDict.found("writeFormat"))
|
||||
{
|
||||
writeFormat_ = IOstream::formatEnum
|
||||
(
|
||||
optDict.lookup("writeFormat")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::surfaceWriter::~surfaceWriter()
|
||||
|
||||
@ -54,6 +54,15 @@ namespace Foam
|
||||
|
||||
class surfaceWriter
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Data
|
||||
|
||||
//- Write format
|
||||
IOstream::streamFormat writeFormat_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -66,8 +75,10 @@ public:
|
||||
autoPtr,
|
||||
surfaceWriter,
|
||||
word,
|
||||
(),
|
||||
()
|
||||
(
|
||||
const IOstream::streamFormat writeFormat
|
||||
),
|
||||
(writeFormat)
|
||||
);
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
@ -85,21 +96,28 @@ public:
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected surfaceWriter
|
||||
static autoPtr<surfaceWriter> New(const word& writeType);
|
||||
static autoPtr<surfaceWriter> New
|
||||
(
|
||||
const word& writeType,
|
||||
const IOstream::streamFormat writeFormat
|
||||
);
|
||||
|
||||
//- Return a reference to the selected surfaceWriter
|
||||
// Select with extra write option
|
||||
static autoPtr<surfaceWriter> New
|
||||
(
|
||||
const word& writeType,
|
||||
const dictionary& writeOptions
|
||||
const dictionary& optDict
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
surfaceWriter();
|
||||
//- Construct given write format
|
||||
surfaceWriter(const IOstream::streamFormat writeFormat);
|
||||
|
||||
//- Construct with output options
|
||||
surfaceWriter(const dictionary& optDict);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -153,9 +153,12 @@ void Foam::vtkSurfaceWriter::write
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::vtkSurfaceWriter::vtkSurfaceWriter()
|
||||
Foam::vtkSurfaceWriter::vtkSurfaceWriter
|
||||
(
|
||||
const IOstream::streamFormat writeFormat
|
||||
)
|
||||
:
|
||||
surfaceWriter()
|
||||
surfaceWriter(writeFormat)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -81,8 +81,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
vtkSurfaceWriter();
|
||||
//- Construct given write format
|
||||
vtkSurfaceWriter(const IOstream::streamFormat writeFormat);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
Reference in New Issue
Block a user