ENH: pass through format options from sampledSurface to proxy writers

- preliminary work to #1057

- add dictionary selectable format (ascii|binary) to
  VTKsurfaceFormat, VTPsurfaceFormat
This commit is contained in:
Mark Olesen
2018-11-01 14:09:53 +00:00
parent 30dcac006f
commit 3366a16b35
29 changed files with 247 additions and 222 deletions

View File

@ -53,7 +53,13 @@ Description
// Output surface format
surfaceFormat vtk;
formatOptions { }
formatOptions
{
vtk
{
precision 10;
}
}
surfaces
(

View File

@ -45,6 +45,18 @@ Foam::proxySurfaceWriter::proxySurfaceWriter(const word& fileExt)
{}
Foam::proxySurfaceWriter::proxySurfaceWriter
(
const word& fileExt,
const dictionary& options
)
:
surfaceWriter(),
fileExtension_(fileExt),
options_(options)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::fileName Foam::proxySurfaceWriter::write
@ -73,8 +85,16 @@ Foam::fileName Foam::proxySurfaceWriter::write
Info<< "Writing geometry to " << outputFile << endl;
}
MeshedSurfaceProxy<face>(surf.points(), surf.faces())
.write(outputFile, fileExtension_);
MeshedSurfaceProxy<face>
(
surf.points(),
surf.faces()
).write
(
outputFile,
fileExtension_,
options_
);
return outputFile;
}

View File

@ -40,6 +40,9 @@ Description
`-- surfaceName.{obj|stl|..}
\endverbatim
Note
The formatOptions for proxy are file-type dependent.
SourceFiles
proxySurfaceWriter.C
@ -63,12 +66,14 @@ class proxySurfaceWriter
:
public surfaceWriter
{
// Private data
//- The file extension associated with the proxy
word fileExtension_;
//- Format options
dictionary options_;
public:
@ -79,7 +84,10 @@ public:
// Constructors
//- Construct for a given extension
proxySurfaceWriter(const word& fileExt);
explicit proxySurfaceWriter(const word& fileExt);
//- Construct for a given extension, with some output options
proxySurfaceWriter(const word& fileExt, const dictionary& options);
//- Destructor

View File

@ -54,46 +54,70 @@ namespace Foam
Foam::autoPtr<Foam::surfaceWriter>
Foam::surfaceWriter::New(const word& writeType)
{
auto cstrIter = wordConstructorTablePtr_->cfind(writeType);
const auto cstrIter = wordConstructorTablePtr_->cfind(writeType);
if (!cstrIter.found())
if (cstrIter.found())
{
if (MeshedSurfaceProxy<face>::canWriteType(writeType))
{
// generally unknown, but can be written via MeshedSurfaceProxy
// use 'proxy' handler instead
return autoPtr<surfaceWriter>(new proxySurfaceWriter(writeType));
}
if (!cstrIter.found())
{
FatalErrorInFunction
<< "Unknown write type \"" << writeType << "\"\n\n"
<< "Valid types : "
<< wordConstructorTablePtr_->sortedToc() << nl
<< "Valid proxy types : "
<< MeshedSurfaceProxy<face>::writeTypes() << endl
<< exit(FatalError);
}
return autoPtr<surfaceWriter>(cstrIter()());
}
else if (MeshedSurfaceProxy<face>::canWriteType(writeType))
{
// Unknown, but proxy handler can manage it
return autoPtr<surfaceWriter>(new proxySurfaceWriter(writeType));
}
return autoPtr<surfaceWriter>(cstrIter()());
FatalErrorInFunction
<< "Unknown write type \"" << writeType << "\"\n\n"
<< "Valid types : "
<< wordConstructorTablePtr_->sortedToc() << nl
<< "Valid proxy types : "
<< MeshedSurfaceProxy<face>::writeTypes() << endl
<< exit(FatalError);
return nullptr;
}
Foam::autoPtr<Foam::surfaceWriter>
Foam::surfaceWriter::New(const word& writeType, const dictionary& options)
{
// Constructors with dictionary options
auto cstrIter = wordDictConstructorTablePtr_->cfind(writeType);
if (!cstrIter.found())
{
// Revert to version without options
return Foam::surfaceWriter::New(writeType);
// Constructor with options (dictionary)
const auto cstrIter = wordDictConstructorTablePtr_->cfind(writeType);
if (cstrIter.found())
{
return autoPtr<surfaceWriter>(cstrIter()(options));
}
}
return autoPtr<surfaceWriter>(cstrIter()(options));
// Drop through to version without options
const auto cstrIter = wordConstructorTablePtr_->cfind(writeType);
if (cstrIter.found())
{
return autoPtr<surfaceWriter>(cstrIter()());
}
else if (MeshedSurfaceProxy<face>::canWriteType(writeType))
{
// Unknown, but proxy handler can manage it
return autoPtr<surfaceWriter>
(
new proxySurfaceWriter(writeType, options)
);
}
FatalErrorInFunction
<< "Unknown write type \"" << writeType << "\"\n\n"
<< "Valid types : "
<< wordConstructorTablePtr_->sortedToc() << nl
<< "Valid proxy types : "
<< MeshedSurfaceProxy<face>::writeTypes() << endl
<< exit(FatalError);
return nullptr;
}

View File

@ -142,7 +142,7 @@ public:
vtkSurfaceWriter();
//- Construct with some output options
vtkSurfaceWriter(const dictionary& options);
explicit vtkSurfaceWriter(const dictionary& options);
//- Destructor

View File

@ -51,7 +51,7 @@ SourceFiles
namespace Foam
{
// Forward declaration of friend functions and operators
// Forward declarations
template<class Face> class MeshedSurface;

View File

@ -64,15 +64,6 @@ class AC3DsurfaceFormat
public MeshedSurface<Face>,
public AC3DsurfaceFormatCore
{
// Private Member Functions
//- No copy construct
AC3DsurfaceFormat(const AC3DsurfaceFormat<Face>&) = delete;
//- No copy assignment
void operator=(const AC3DsurfaceFormat<Face>&) = delete;
public:
// Constructors
@ -109,7 +100,7 @@ public:
//- Read from file
virtual bool read(const fileName& filename);
//- Write object
//- Write surface mesh to file
virtual void write
(
const fileName& name,

View File

@ -61,12 +61,6 @@ class FLMAsurfaceFormat
static inline void writeShell(OSstream& os, const Face& f);
static inline void writeType(OSstream& os, const Face& f);
//- No copy construct
FLMAsurfaceFormat(const FLMAsurfaceFormat<Face>&) = delete;
//- No copy assignment
void operator=(const FLMAsurfaceFormat<Face>&) = delete;
protected:
@ -114,7 +108,7 @@ public:
// Member Functions
//- Write flma file
//- Write surface mesh as flma file
virtual void write
(
const fileName& name,
@ -136,15 +130,6 @@ class FLMAZsurfaceFormat
:
public FLMAsurfaceFormat<Face>
{
// Private Member Functions
//- No copy construct
FLMAZsurfaceFormat(const FLMAZsurfaceFormat<Face>&) = delete;
//- No copy assignment
void operator=(const FLMAZsurfaceFormat<Face>&) = delete;
public:
// Constructors
@ -170,7 +155,7 @@ public:
// Member Functions
//- Write flmaz file
//- Write surface mesh as flmaz file
virtual void write
(
const fileName& name,

View File

@ -30,7 +30,6 @@ License
#include "StringStream.H"
#include "faceTraits.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Face>

View File

@ -64,12 +64,6 @@ class GTSsurfaceFormat
// Triangulating on-the-fly is otherwise too annoying
static bool checkIfTriangulated(const UList<Face>& faceLst);
//- No copy construct
GTSsurfaceFormat(const GTSsurfaceFormat<Face>&) = delete;
//- No copy assignment
void operator=(const GTSsurfaceFormat<Face>&) = delete;
public:
@ -107,7 +101,7 @@ public:
//- Read from file
virtual bool read(const fileName& filename);
//- Write object
//- Write surface mesh to file
virtual void write
(
const fileName& name,

View File

@ -35,6 +35,8 @@ Description
GRID 28 10.20269-.030265-2.358-8
\endverbatim
The Nastran writer uses FREE format only.
SourceFiles
NASsurfaceFormat.C
@ -76,12 +78,6 @@ class NASsurfaceFormat
label elementId
);
//- No copy construct
NASsurfaceFormat(const NASsurfaceFormat<Face>&) = delete;
//- No copy assignment
void operator=(const NASsurfaceFormat<Face>&) = delete;
public:
@ -108,10 +104,10 @@ public:
// Member Functions
//- Read from a file
//- Read from file
virtual bool read(const fileName& filename);
//- Write object file
//- Write surface mesh to file
virtual void write
(
const fileName& name,

View File

@ -57,15 +57,6 @@ class OBJsurfaceFormat
:
public MeshedSurface<Face>
{
// Private Member Functions
//- No copy construct
OBJsurfaceFormat(const OBJsurfaceFormat<Face>&) = delete;
//- No copy assignment
void operator=(const OBJsurfaceFormat<Face>&) = delete;
public:
// Constructors
@ -94,7 +85,7 @@ public:
//- Read from file
virtual bool read(const fileName& filename);
//- Write object file
//- Write surface mesh to file
virtual void write
(
const fileName& name,

View File

@ -64,15 +64,6 @@ class OFFsurfaceFormat
:
public MeshedSurface<Face>
{
// Private Member Functions
//- No copy construct
OFFsurfaceFormat(const OFFsurfaceFormat&) = delete;
//- No copy assignment
void operator=(const OFFsurfaceFormat&) = delete;
public:
// Constructors
@ -101,7 +92,7 @@ public:
//- Read from file
virtual bool read(const fileName& filename);
//- Write object
//- Write surface mesh to file
virtual void write
(
const fileName& name,

View File

@ -61,15 +61,6 @@ class SMESHsurfaceFormat
:
public MeshedSurface<Face>
{
// Private Member Functions
//- No copy construct
SMESHsurfaceFormat(const SMESHsurfaceFormat<Face>&) = delete;
//- No copy assignment
void operator=(const SMESHsurfaceFormat<Face>&) = delete;
public:
// Constructors
@ -95,7 +86,7 @@ public:
// Member Functions
//- Write object
//- Write surface mesh to file
virtual void write
(
const fileName& name,

View File

@ -73,12 +73,6 @@ class STARCDsurfaceFormat
const label cellTableId
);
//- No copy construct
STARCDsurfaceFormat(const STARCDsurfaceFormat<Face>&) = delete;
//- No copy assignment
void operator=(const STARCDsurfaceFormat<Face>&) = delete;
public:
@ -108,7 +102,7 @@ public:
//- Read from file
virtual bool read(const fileName& filename);
//- Write object
//- Write surface mesh to file
virtual void write
(
const fileName& name,

View File

@ -82,13 +82,6 @@ class STLsurfaceFormat
);
//- No copy construct
STLsurfaceFormat(const STLsurfaceFormat<Face>&) = delete;
//- No copy assignment
void operator=(const STLsurfaceFormat<Face>&) = delete;
public:
// Constructors
@ -174,7 +167,7 @@ public:
//- Read from file
virtual bool read(const fileName& filename);
//- Write object
//- Write surface mesh to file
virtual void write
(
const fileName& name,

View File

@ -78,12 +78,6 @@ class TRIReader
bool readFile(const fileName& filename);
//- No copy construct
TRIReader(const TRIReader&) = delete;
//- No copy assignment
TRIReader& operator=(const TRIReader&) = delete;
public:

View File

@ -69,12 +69,6 @@ class TRIsurfaceFormat
const label zoneI
);
//- No copy construct
TRIsurfaceFormat(const TRIsurfaceFormat<Face>&) = delete;
//- No copy assignment
void operator=(const TRIsurfaceFormat<Face>&) = delete;
public:
@ -98,8 +92,7 @@ public:
const dictionary& options = dictionary::null
);
//- Write UnsortedMeshedSurface,
// by default the output is not sorted by zones
//- Write UnsortedMeshedSurface, the output remains unsorted
static void write
(
const fileName& filename,
@ -113,7 +106,7 @@ public:
//- Read from file
virtual bool read(const fileName& filename);
//- Write object
//- Write surface mesh to file
virtual void write
(
const fileName& name,

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -27,20 +27,7 @@ License
#include "vtkUnstructuredReader.H"
#include "scalarIOField.H"
#include "faceTraits.H"
#include "OFstream.H"
#include "foamVtkOutput.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// File-scope constant.
//
// TODO: make this run-time selectable (ASCII | BINARY)
// - Legacy mode only
static const Foam::vtk::formatType fmtType =
Foam::vtk::formatType::LEGACY_ASCII;
// Foam::vtk::formatType::LEGACY_BINARY;
#include <fstream>
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -278,10 +265,11 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);
std::ofstream os(filename);
vtk::outputOptions opts = formatOptions(options);
autoPtr<vtk::formatter> format =
vtk::newFormatter(os, fmtType);
std::ofstream os(filename, std::ios::binary);
autoPtr<vtk::formatter> format = opts.newFormatter(os);
writeHeader(format(), pointLst);
@ -337,10 +325,11 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write
const dictionary& options
)
{
std::ofstream os(filename);
vtk::outputOptions opts = formatOptions(options);
autoPtr<vtk::formatter> format =
vtk::newFormatter(os, fmtType);
std::ofstream os(filename, std::ios::binary);
autoPtr<vtk::formatter> format = opts.newFormatter(os);
writeHeader(format(), surf.points());

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,6 +29,13 @@ Description
The output is never sorted by zone.
\heading Output Options
\table
Property | Description | Required | Default
format | ascii or binary format | no | ascii
precision | Write precision in ascii | no | same as IOstream
\endtable
SourceFiles
VTKsurfaceFormat.C
@ -69,13 +76,6 @@ class VTKsurfaceFormat
);
//- No copy construct
VTKsurfaceFormat(const VTKsurfaceFormat<Face>&) = delete;
//- No copy assignment
void operator=(const VTKsurfaceFormat<Face>&) = delete;
public:
// Constructors
@ -112,7 +112,7 @@ public:
//- Read from file
virtual bool read(const fileName& filename);
//- Write object file
//- Write meshed surface to file
virtual void write
(
const fileName& name,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,10 +25,38 @@ License
#include "VTKsurfaceFormatCore.H"
#include "clock.H"
#include "foamVtkOutput.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::vtk::outputOptions
Foam::fileFormats::VTKsurfaceFormatCore::formatOptions
(
const dictionary& dict,
vtk::outputOptions opts
)
{
opts.legacy(true); // Legacy. Use VTPsurfaceFormat for non-legacy
opts.append(false); // No append format for legacy
const word formatName = dict.lookupOrDefault<word>("format", "");
if (formatName.size())
{
opts.ascii(IOstream::formatEnum(formatName) == IOstream::ASCII);
}
opts.precision
(
dict.lookupOrDefault
(
"precision",
IOstream::defaultPrecision()
)
);
return opts;
}
void Foam::fileFormats::VTKsurfaceFormatCore::writeHeader
(
vtk::formatter& format,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,6 +26,14 @@ Class
Description
Internal class used by the VTKsurfaceFormat
Format is LEGACY_ASCII
\heading Output Options
\table
Property | Description | Required | Default
format | ascii or binary format | no | ascii
precision | Write precision in ascii | no | same as IOstream
\endtable
SourceFiles
VTKsurfaceFormatCore.C
@ -35,9 +43,9 @@ SourceFiles
#ifndef VTKsurfaceFormatCore_H
#define VTKsurfaceFormatCore_H
#include "foamVtkFormatter.H"
#include "point.H"
#include "surfZone.H"
#include "foamVtkOutputOptions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,6 +64,13 @@ protected:
// Protected Static Member Functions
//- Extract format options (default format LEGACY_ASCII)
static vtk::outputOptions formatOptions
(
const dictionary& dict,
vtk::outputOptions opts = vtk::formatType::LEGACY_ASCII
);
//- Write header information with points
static void writeHeader
(
@ -76,7 +91,6 @@ protected:
vtk::formatter& format,
const labelUList& zoneIds
);
};

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,21 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "VTPsurfaceFormat.H"
#include "OFstream.H"
#include "foamVtkOutput.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
// File-scope constant.
//
// TODO: make this run-time selectable
// - No append mode supported
// - Legacy mode is dispatched via 'VTKsurfaceFormat' instead
static const Foam::vtk::formatType fmtType =
Foam::vtk::formatType::INLINE_ASCII;
// Foam::vtk::formatType::INLINE_BASE64;
#include <fstream>
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -127,10 +113,11 @@ void Foam::fileFormats::VTPsurfaceFormat<Face>::write
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);
vtk::outputOptions opts = formatOptions(options);
std::ofstream os(filename, std::ios::binary);
autoPtr<vtk::formatter> format =
vtk::newFormatter(os, fmtType);
autoPtr<vtk::formatter> format = opts.newFormatter(os);
writeHeader(format(), pointLst, faceLst.size());
@ -224,10 +211,11 @@ void Foam::fileFormats::VTPsurfaceFormat<Face>::write
const dictionary& options
)
{
vtk::outputOptions opts = formatOptions(options);
std::ofstream os(filename, std::ios::binary);
autoPtr<vtk::formatter> format =
vtk::newFormatter(os, fmtType);
autoPtr<vtk::formatter> format = opts.newFormatter(os);
const UList<Face>& faceLst = surf.surfFaces();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,9 +26,17 @@ Class
Description
Write surfaces in VTP (xml) format.
The default format is INLINE_BASE64
The output is never sorted by zone.
\heading Output Options
\table
Property | Description | Required | Default
format | ascii or binary format | no | binary
precision | Write precision in ascii | no | same as IOstream
\endtable
SourceFiles
VTPsurfaceFormat.C
@ -69,13 +77,6 @@ class VTPsurfaceFormat
);
//- No copy construct
VTPsurfaceFormat(const VTPsurfaceFormat<Face>&) = delete;
//- No copy assignment
void operator=(const VTPsurfaceFormat<Face>&) = delete;
public:
// Constructors
@ -109,7 +110,7 @@ public:
// Member Functions
//- Write object file
//- Write meshed surface to a file
virtual void write
(
const fileName& name,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,10 +25,38 @@ License
#include "VTPsurfaceFormatCore.H"
#include "clock.H"
#include "foamVtkOutput.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::vtk::outputOptions
Foam::fileFormats::VTPsurfaceFormatCore::formatOptions
(
const dictionary& dict,
vtk::outputOptions opts
)
{
opts.legacy(false); // Non-legacy. Use VTKsurfaceFormat for legacy
opts.append(false); // No append format
const word formatName = dict.lookupOrDefault<word>("format", "");
if (formatName.size())
{
opts.ascii(IOstream::formatEnum(formatName) == IOstream::ASCII);
}
opts.precision
(
dict.lookupOrDefault
(
"precision",
IOstream::defaultPrecision()
)
);
return opts;
}
void Foam::fileFormats::VTPsurfaceFormatCore::writeHeader
(
vtk::formatter& format,

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -25,7 +25,15 @@ Class
Foam::fileFormats::VTPsurfaceFormatCore
Description
Internal class used by the VTPsurfaceFormat
Internal class used by the VTPsurfaceFormat.
The default format is INLINE_BASE64
\heading Output Options
\table
Property | Description | Required | Default
format | ascii or binary format | no | binary
precision | Write precision in ascii | no | same as IOstream
\endtable
SourceFiles
VTPsurfaceFormatCore.C
@ -35,9 +43,9 @@ SourceFiles
#ifndef VTPsurfaceFormatCore_H
#define VTPsurfaceFormatCore_H
#include "foamVtkFormatter.H"
#include "point.H"
#include "surfZone.H"
#include "foamVtkOutputOptions.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,6 +64,13 @@ protected:
// Protected Static Member Functions
//- Extract format options (default format INLINE_BASE64)
static vtk::outputOptions formatOptions
(
const dictionary& dict,
vtk::outputOptions opts = vtk::formatType::INLINE_BASE64
);
//- Write header information with points
static void writeHeader
(

View File

@ -84,9 +84,9 @@ void Foam::fileFormats::X3DsurfaceFormat<Face>::write
{
const Face& f = faceLst[faceMap[faceIndex++]];
forAll(f, fp)
for (const label vrti : f)
{
os << f[fp] << ' ';
os << vrti << ' ';
}
os << "-1\n";
}
@ -97,9 +97,9 @@ void Foam::fileFormats::X3DsurfaceFormat<Face>::write
{
const Face& f = faceLst[faceIndex++];
forAll(f, fp)
for (const label vrti : f)
{
os << f[fp] << ' ';
os << vrti << ' ';
}
os << "-1\n";
}
@ -110,9 +110,9 @@ void Foam::fileFormats::X3DsurfaceFormat<Face>::write
"' >\n"
" <Coordinate point='\n";
for (const point& pt : pointLst)
for (const point& p : pointLst)
{
os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << nl;
os << p.x() << ' ' << p.y() << ' ' << p.z() << nl;
}
os <<

View File

@ -57,14 +57,6 @@ class X3DsurfaceFormat
public MeshedSurface<Face>,
public X3DsurfaceFormatCore
{
// Private Member Functions
//- No copy construct
X3DsurfaceFormat(const X3DsurfaceFormat<Face>&) = delete;
//- No copy assignment
void operator=(const X3DsurfaceFormat<Face>&) = delete;
public:
// Constructors
@ -90,7 +82,7 @@ public:
// Member Functions
//- Write object
//- Write surface mesh to file
virtual void write
(
const fileName& name,
@ -99,7 +91,6 @@ public:
{
write(name, MeshedSurfaceProxy<Face>(*this), options);
}
};

View File

@ -51,6 +51,7 @@ namespace fileFormats
class X3DsurfaceFormatCore
{
protected:
// Protected Member Functions
//- Write file header