mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add stream format options for surface writers (#1595)
- additional boundaryData options (header, binary, compression) - remove vtkSurfaceWriter "writePrecision" keyword (1806 compatibilty) and use "precision" in format option sub-dictionary.
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -111,10 +111,11 @@ void Foam::MeshedSurface<Face>::write
|
||||
(
|
||||
const fileName& name,
|
||||
const MeshedSurface<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary& options
|
||||
)
|
||||
{
|
||||
write(name, name.ext(), surf, options);
|
||||
write(name, name.ext(), surf, streamOpt, options);
|
||||
}
|
||||
|
||||
|
||||
@ -124,6 +125,7 @@ void Foam::MeshedSurface<Face>::write
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
const MeshedSurface<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary& options
|
||||
)
|
||||
{
|
||||
@ -141,7 +143,7 @@ void Foam::MeshedSurface<Face>::write
|
||||
|
||||
if (delegate.found(ext))
|
||||
{
|
||||
MeshedSurfaceProxy<Face>(surf).write(name, ext, options);
|
||||
MeshedSurfaceProxy<Face>(surf).write(name, ext, streamOpt, options);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -154,7 +156,7 @@ void Foam::MeshedSurface<Face>::write
|
||||
}
|
||||
else
|
||||
{
|
||||
mfIter()(name, surf, options);
|
||||
mfIter()(name, surf, streamOpt, options);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -67,7 +67,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
// Forward Declarations
|
||||
|
||||
class Time;
|
||||
class surfMesh;
|
||||
@ -104,7 +104,7 @@ class MeshedSurface
|
||||
|
||||
private:
|
||||
|
||||
// Private typedefs for convenience
|
||||
// Private Typedefs (convenience)
|
||||
|
||||
typedef PrimitivePatch
|
||||
<
|
||||
@ -119,7 +119,7 @@ private:
|
||||
typedef MeshedSurfaceProxy<Face> ProxyType;
|
||||
|
||||
|
||||
// Private Member Data
|
||||
// Private Data
|
||||
|
||||
//- Zone information
|
||||
// (face ordering nFaces/startFace only used during reading/writing)
|
||||
@ -137,7 +137,7 @@ private:
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member functions
|
||||
// Protected Member Functions
|
||||
|
||||
//- Transfer points/zones from 'face' to other other shapes.
|
||||
// Eg, transcribe face to triFace, or face -> labelledTri, including
|
||||
@ -180,16 +180,17 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
// Public typedefs
|
||||
// Public Typedefs
|
||||
|
||||
//- Face type used
|
||||
typedef Face FaceType;
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("MeshedSurface");
|
||||
|
||||
//- Declare type-name (with debug switch)
|
||||
ClassName("MeshedSurface");
|
||||
|
||||
|
||||
// Static
|
||||
// Static Functions
|
||||
|
||||
//- Can we read this file format?
|
||||
static bool canRead(const fileName& name, bool verbose=false);
|
||||
@ -209,7 +210,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null, an empty surface
|
||||
//- Default construct, an empty surface
|
||||
MeshedSurface();
|
||||
|
||||
//- Copy construct
|
||||
@ -326,9 +327,10 @@ public:
|
||||
(
|
||||
const fileName& name,
|
||||
const MeshedSurface<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary& options
|
||||
),
|
||||
(name, surf, options)
|
||||
(name, surf, streamOpt, options)
|
||||
);
|
||||
|
||||
//- Write to file, selecting writer based on its extension
|
||||
@ -336,6 +338,7 @@ public:
|
||||
(
|
||||
const fileName& name,
|
||||
const MeshedSurface<Face>& surf,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
);
|
||||
|
||||
@ -345,6 +348,7 @@ public:
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
const MeshedSurface<Face>& surf,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
);
|
||||
|
||||
@ -526,10 +530,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, *this, options);
|
||||
write(name, *this, streamOpt, options);
|
||||
}
|
||||
|
||||
//- Write to database
|
||||
@ -540,7 +545,7 @@ public:
|
||||
) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
// Member Operators
|
||||
|
||||
//- Copy assignment
|
||||
void operator=(const MeshedSurface<Face>& surf);
|
||||
@ -570,7 +575,6 @@ public:
|
||||
Ostream& os,
|
||||
const MeshedSurface<Face>& surf
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -62,10 +62,11 @@ void Foam::MeshedSurfaceProxy<Face>::write
|
||||
(
|
||||
const fileName& name,
|
||||
const MeshedSurfaceProxy& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary& options
|
||||
)
|
||||
{
|
||||
write(name, name.ext(), surf, options);
|
||||
write(name, name.ext(), surf, streamOpt, options);
|
||||
}
|
||||
|
||||
|
||||
@ -75,6 +76,7 @@ void Foam::MeshedSurfaceProxy<Face>::write
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
const MeshedSurfaceProxy& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary& options
|
||||
)
|
||||
{
|
||||
@ -94,7 +96,7 @@ void Foam::MeshedSurfaceProxy<Face>::write
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
mfIter()(name, surf, options);
|
||||
mfIter()(name, surf, streamOpt, options);
|
||||
}
|
||||
|
||||
|
||||
@ -210,7 +212,6 @@ void Foam::MeshedSurfaceProxy<Face>::write
|
||||
|
||||
io.writeEndDivider(os);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -54,7 +54,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
// Forward Declarations
|
||||
|
||||
template<class Face> class MeshedSurface;
|
||||
|
||||
@ -67,7 +67,7 @@ class MeshedSurfaceProxy
|
||||
:
|
||||
public fileFormats::surfaceFormatsCore
|
||||
{
|
||||
// Private Member Data
|
||||
// Private Data
|
||||
|
||||
const pointField& points_;
|
||||
|
||||
@ -79,16 +79,17 @@ class MeshedSurfaceProxy
|
||||
|
||||
public:
|
||||
|
||||
// Public typedefs
|
||||
// Public Typedefs
|
||||
|
||||
//- Face type used
|
||||
typedef Face FaceType;
|
||||
|
||||
|
||||
// Static
|
||||
//- Declare type-name (with debug switch)
|
||||
ClassName("MeshedSurfaceProxy");
|
||||
|
||||
//- Runtime type information
|
||||
ClassName("MeshedSurfaceProxy");
|
||||
|
||||
// Static Functions
|
||||
|
||||
//- The file format types that can be written via MeshedSurfaceProxy
|
||||
static wordHashSet writeTypes();
|
||||
@ -124,9 +125,10 @@ public:
|
||||
(
|
||||
const fileName& name,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary& options
|
||||
),
|
||||
(name, surf, options)
|
||||
(name, surf, streamOpt, options)
|
||||
);
|
||||
|
||||
//- Write to file, select based on its extension
|
||||
@ -134,7 +136,8 @@ public:
|
||||
(
|
||||
const fileName& name,
|
||||
const MeshedSurfaceProxy& surf,
|
||||
const dictionary& options
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
);
|
||||
|
||||
//- Write to file, selected based on given extension
|
||||
@ -143,7 +146,8 @@ public:
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
const MeshedSurfaceProxy& surf,
|
||||
const dictionary& options
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
);
|
||||
|
||||
|
||||
@ -199,10 +203,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, *this, options);
|
||||
write(name, *this, streamOpt, options);
|
||||
}
|
||||
|
||||
//- Generic write routine. Chooses writer based on extension.
|
||||
@ -210,10 +215,11 @@ public:
|
||||
(
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, ext, *this, options);
|
||||
write(name, ext, *this, streamOpt, options);
|
||||
}
|
||||
|
||||
//- Write to database
|
||||
|
||||
@ -106,10 +106,11 @@ void Foam::UnsortedMeshedSurface<Face>::write
|
||||
(
|
||||
const fileName& name,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary& options
|
||||
)
|
||||
{
|
||||
write(name, name.ext(), surf, options);
|
||||
write(name, name.ext(), surf, streamOpt, options);
|
||||
}
|
||||
|
||||
|
||||
@ -119,6 +120,7 @@ void Foam::UnsortedMeshedSurface<Face>::write
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary& options
|
||||
)
|
||||
{
|
||||
@ -136,7 +138,7 @@ void Foam::UnsortedMeshedSurface<Face>::write
|
||||
|
||||
if (delegate.found(ext))
|
||||
{
|
||||
MeshedSurfaceProxy<Face>(surf).write(name, ext, options);
|
||||
MeshedSurfaceProxy<Face>(surf).write(name, ext, streamOpt, options);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -149,7 +151,7 @@ void Foam::UnsortedMeshedSurface<Face>::write
|
||||
}
|
||||
else
|
||||
{
|
||||
mfIter()(name, surf, options);
|
||||
mfIter()(name, surf, streamOpt, options);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -62,8 +62,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
//
|
||||
// Forward Declarations
|
||||
class Time;
|
||||
class Istream;
|
||||
class Ostream;
|
||||
@ -95,14 +94,14 @@ class UnsortedMeshedSurface
|
||||
|
||||
private:
|
||||
|
||||
// Private typedefs for convenience
|
||||
// Private Typedefs (convenience)
|
||||
|
||||
typedef MeshedSurface<Face> ParentType;
|
||||
typedef MeshedSurface<Face> FriendType;
|
||||
typedef MeshedSurfaceProxy<Face> ProxyType;
|
||||
|
||||
|
||||
// Private Member Data
|
||||
// Private Data
|
||||
|
||||
//- The zone Id associated with each face
|
||||
labelList zoneIds_;
|
||||
@ -128,7 +127,7 @@ private:
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member functions
|
||||
// Protected Member Functions
|
||||
|
||||
//- Return non-const access to the zone Ids
|
||||
labelList& storedZoneIds()
|
||||
@ -148,16 +147,17 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
// Public typedefs
|
||||
// Public Typedefs
|
||||
|
||||
//- Face type used
|
||||
typedef Face FaceType;
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("UnsortedMeshedSurface");
|
||||
|
||||
//- Declare type-name, virtual type (with debug switch)
|
||||
TypeName("UnsortedMeshedSurface");
|
||||
|
||||
|
||||
// Static
|
||||
// Static Functions
|
||||
|
||||
//- Can we read this file format type?
|
||||
static bool canReadType(const word& ext, bool verbose=false);
|
||||
@ -177,10 +177,10 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
UnsortedMeshedSurface();
|
||||
|
||||
//- Construct as copy
|
||||
//- Copy construct
|
||||
UnsortedMeshedSurface(const UnsortedMeshedSurface<Face>& surf);
|
||||
|
||||
//- Construct from a MeshedSurface
|
||||
@ -261,9 +261,10 @@ public:
|
||||
(
|
||||
const fileName& name,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary& options
|
||||
),
|
||||
(name, surf, options)
|
||||
(name, surf, streamOpt, options)
|
||||
);
|
||||
|
||||
//- Write to file, select based on its extension
|
||||
@ -271,6 +272,7 @@ public:
|
||||
(
|
||||
const fileName& name,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
);
|
||||
|
||||
@ -280,7 +282,8 @@ public:
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
const dictionary& options
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
);
|
||||
|
||||
|
||||
@ -382,10 +385,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, *this, options);
|
||||
write(name, *this, streamOpt, options);
|
||||
}
|
||||
|
||||
//- Write to database
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -44,6 +44,7 @@ namespace Foam
|
||||
|
||||
Foam::word Foam::surfMesh::meshSubDir = "surfMesh";
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// void Foam::surfMesh::oneZone()
|
||||
@ -566,10 +567,11 @@ void Foam::surfMesh::removeFiles() const
|
||||
void Foam::surfMesh::write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary& options
|
||||
) const
|
||||
{
|
||||
write(name, name.ext(), options);
|
||||
write(name, name.ext(), streamOpt, options);
|
||||
}
|
||||
|
||||
|
||||
@ -577,6 +579,7 @@ void Foam::surfMesh::write
|
||||
(
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary& options
|
||||
) const
|
||||
{
|
||||
@ -585,7 +588,7 @@ void Foam::surfMesh::write
|
||||
this->points(),
|
||||
this->faces(),
|
||||
this->surfZones()
|
||||
).write(name, ext, options);
|
||||
).write(name, ext, streamOpt, options);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -53,7 +53,7 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declarations
|
||||
// Forward Declarations
|
||||
class dimensionSet;
|
||||
class meshedSurf;
|
||||
template<class Face> class MeshedSurface;
|
||||
@ -100,7 +100,7 @@ private:
|
||||
MeshReference;
|
||||
|
||||
|
||||
// Demand driven private data
|
||||
// Private Data
|
||||
|
||||
//- The surface zones
|
||||
surfZoneIOList surfZones_;
|
||||
@ -149,7 +149,7 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
// Public typedefs
|
||||
// Public Typedefs
|
||||
|
||||
//- Typedef required for GeoMesh
|
||||
typedef surfMesh Mesh;
|
||||
@ -158,7 +158,7 @@ public:
|
||||
typedef bool BoundaryMesh;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
//- Declare type-name, virtual type (with debug switch)
|
||||
TypeName("surfMesh");
|
||||
|
||||
//- Return the mesh sub-directory name (normally "surfMesh")
|
||||
@ -361,6 +361,7 @@ public:
|
||||
void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const;
|
||||
|
||||
@ -370,11 +371,12 @@ public:
|
||||
(
|
||||
const fileName& name,
|
||||
const word& ext,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const;
|
||||
|
||||
|
||||
// Storage management
|
||||
// Storage Management
|
||||
|
||||
//- Release the geometry and return as a MeshedSurface<face>.
|
||||
autoPtr<MeshedSurface<face>> releaseGeom();
|
||||
@ -399,9 +401,9 @@ public:
|
||||
|
||||
//- Remove all files from mesh instance()
|
||||
void removeFiles() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -309,9 +309,13 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary&
|
||||
)
|
||||
{
|
||||
// ASCII only, allow output compression
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
const pointField& pointLst = surf.points();
|
||||
const UList<Face>& faceLst = surf.surfFaces();
|
||||
|
||||
@ -324,7 +328,7 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write
|
||||
|
||||
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);
|
||||
|
||||
OFstream os(filename);
|
||||
OFstream os(filename, streamOpt);
|
||||
if (!os.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -380,10 +384,14 @@ void Foam::fileFormats::AC3DsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary&
|
||||
)
|
||||
{
|
||||
OFstream os(filename);
|
||||
// ASCII only, allow output compression
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
OFstream os(filename, streamOpt);
|
||||
if (!os.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,6 +32,12 @@ Description
|
||||
|
||||
http://www.inivis.com/ac3d/man/ac3dfileformat.html
|
||||
|
||||
Output stream options:
|
||||
- ASCII only
|
||||
- compression on/off
|
||||
|
||||
Output dictionary options: ignored
|
||||
|
||||
Note
|
||||
On input, the faces are already organized as zones.
|
||||
The output is always sorted by zones.
|
||||
@ -79,14 +85,15 @@ public:
|
||||
virtual ~AC3DsurfaceFormat() = default;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
// Static Functions
|
||||
|
||||
//- Write surface mesh components by proxy
|
||||
static void write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const dictionary& options = dictionary::null
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& /*unused*/ = dictionary::null
|
||||
);
|
||||
|
||||
//- Write UnsortedMeshedSurface, the output is always sorted by zones.
|
||||
@ -94,7 +101,8 @@ public:
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
const dictionary& options = dictionary::null
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& /*unused*/ = dictionary::null
|
||||
);
|
||||
|
||||
|
||||
@ -107,10 +115,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
const dictionary& options
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), options);
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -27,7 +27,6 @@ License
|
||||
|
||||
#include "FLMAsurfaceFormat.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
//! \cond fileScope
|
||||
@ -318,32 +317,27 @@ void Foam::fileFormats::FLMAsurfaceFormat<Face>::write
|
||||
template<class Face>
|
||||
void Foam::fileFormats::FLMAsurfaceFormat<Face>::write
|
||||
(
|
||||
bool compress,
|
||||
IOstreamOption::compressionType comp,
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf
|
||||
)
|
||||
{
|
||||
// ASCII only, allow output compression
|
||||
autoPtr<OFstream> osPtr
|
||||
(
|
||||
compress
|
||||
? new OFstream
|
||||
(
|
||||
filename,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
IOstream::COMPRESSED
|
||||
)
|
||||
: new OFstream(filename)
|
||||
new OFstream(filename, IOstreamOption(IOstream::ASCII, comp))
|
||||
);
|
||||
|
||||
if (osPtr->good())
|
||||
{
|
||||
FLMAsurfaceFormat<Face>::write(osPtr(), surf);
|
||||
osPtr.clear(); // implicitly close the file
|
||||
FLMAsurfaceFormat<Face>::write(*osPtr, surf);
|
||||
|
||||
if (compress)
|
||||
if (comp == IOstream::COMPRESSED)
|
||||
{
|
||||
// rename .flmaz.gz -> .flmaz
|
||||
// Close the file
|
||||
osPtr.clear();
|
||||
|
||||
// Rename .flmaz.gz -> .flmaz
|
||||
// The '.gz' is automatically added by OFstream in compression mode
|
||||
Foam::mv(filename + ".gz", filename);
|
||||
}
|
||||
@ -364,10 +358,11 @@ void Foam::fileFormats::FLMAsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstreamOption,
|
||||
const dictionary&
|
||||
)
|
||||
{
|
||||
write(false, filename, surf);
|
||||
FLMAsurfaceFormat<Face>::write(IOstream::UNCOMPRESSED, filename, surf);
|
||||
}
|
||||
|
||||
|
||||
@ -376,10 +371,11 @@ void Foam::fileFormats::FLMAZsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstreamOption,
|
||||
const dictionary&
|
||||
)
|
||||
{
|
||||
FLMAsurfaceFormat<Face>::write(true, filename, surf);
|
||||
FLMAsurfaceFormat<Face>::write(IOstream::COMPRESSED, filename, surf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -29,6 +29,17 @@ Class
|
||||
Description
|
||||
Provide a means of writing AVL/FIRE FLMA format.
|
||||
|
||||
Output stream options:
|
||||
- ASCII only
|
||||
- compression : ignored
|
||||
|
||||
Output dictionary options: ignored
|
||||
|
||||
Note
|
||||
The internal logic is still a bit odd (2020-02) since compressed files
|
||||
must have a \b .flmaz ending.
|
||||
To be revisited in the future.
|
||||
|
||||
SourceFiles
|
||||
FLMAsurfaceFormat.C
|
||||
|
||||
@ -75,11 +86,10 @@ protected:
|
||||
const MeshedSurfaceProxy<Face>& surf
|
||||
);
|
||||
|
||||
|
||||
//- Write surface mesh components by proxy with/without compression
|
||||
static void write
|
||||
(
|
||||
bool compress,
|
||||
IOstreamOption::compressionType comp,
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf
|
||||
);
|
||||
@ -89,7 +99,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
FLMAsurfaceFormat() = default;
|
||||
|
||||
|
||||
@ -97,14 +107,15 @@ public:
|
||||
virtual ~FLMAsurfaceFormat() = default;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
// Static Functions
|
||||
|
||||
//- Write surface mesh components by proxy
|
||||
static void write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const dictionary& options = dictionary::null
|
||||
IOstreamOption /*ignored*/ = IOstreamOption(),
|
||||
const dictionary& /*unused*/ = dictionary::null
|
||||
);
|
||||
|
||||
|
||||
@ -114,12 +125,12 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), options);
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -136,7 +147,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
FLMAZsurfaceFormat() = default;
|
||||
|
||||
|
||||
@ -144,14 +155,15 @@ public:
|
||||
virtual ~FLMAZsurfaceFormat() = default;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
// Static Functions
|
||||
|
||||
//- Write surface mesh components by proxy
|
||||
static void write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const dictionary& options = dictionary::null
|
||||
IOstreamOption /*ignored*/ = IOstreamOption(),
|
||||
const dictionary& /*unused*/ = dictionary::null
|
||||
);
|
||||
|
||||
|
||||
@ -161,12 +173,12 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), options);
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -249,9 +249,13 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurface<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary&
|
||||
)
|
||||
{
|
||||
// ASCII only, allow output compression
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
const UList<point>& pointLst = surf.points();
|
||||
const UList<Face>& faceLst = surf.surfFaces();
|
||||
|
||||
@ -264,7 +268,7 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
||||
|
||||
checkIfTriangulated(faceLst);
|
||||
|
||||
OFstream os(filename);
|
||||
OFstream os(filename, streamOpt);
|
||||
if (!os.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -336,9 +340,13 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary&
|
||||
)
|
||||
{
|
||||
// ASCII only, allow output compression
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
const UList<point>& pointLst = surf.points();
|
||||
const UList<Face>& faceLst = surf.surfFaces();
|
||||
const UList<label>& zoneIds = surf.zoneIds();
|
||||
@ -346,7 +354,7 @@ void Foam::fileFormats::GTSsurfaceFormat<Face>::write
|
||||
|
||||
checkIfTriangulated(faceLst);
|
||||
|
||||
OFstream os(filename);
|
||||
OFstream os(filename, streamOpt);
|
||||
if (!os.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -33,6 +33,12 @@ Description
|
||||
The output is never sorted by zone and is only written if it consists
|
||||
entirely of triangles.
|
||||
|
||||
Output stream options:
|
||||
- ASCII only
|
||||
- compression on/off
|
||||
|
||||
Output dictionary options: ignored
|
||||
|
||||
SourceFiles
|
||||
GTSsurfaceFormat.C
|
||||
|
||||
@ -80,14 +86,15 @@ public:
|
||||
virtual ~GTSsurfaceFormat() = default;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
// Static Functions
|
||||
|
||||
//- Write MeshedSurface
|
||||
static void write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurface<Face>& surf,
|
||||
const dictionary& options = dictionary::null
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& /*ununsed*/ = dictionary::null
|
||||
);
|
||||
|
||||
//- Write UnsortedMeshedSurface, the output remains unsorted
|
||||
@ -95,7 +102,8 @@ public:
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
const dictionary& options = dictionary::null
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& /*ununsed*/ = dictionary::null
|
||||
);
|
||||
|
||||
|
||||
@ -108,10 +116,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, *this, options);
|
||||
write(name, *this, streamOpt, options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -417,9 +417,13 @@ void Foam::fileFormats::NASsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const dictionary& options
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary&
|
||||
)
|
||||
{
|
||||
// ASCII only, allow output compression
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
const UList<point>& pointLst = surf.points();
|
||||
const UList<Face>& faceLst = surf.surfFaces();
|
||||
const UList<label>& faceMap = surf.faceMap();
|
||||
@ -434,7 +438,7 @@ void Foam::fileFormats::NASsurfaceFormat<Face>::write
|
||||
|
||||
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);
|
||||
|
||||
OFstream os(filename);
|
||||
OFstream os(filename, streamOpt);
|
||||
if (!os.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -40,6 +40,12 @@ Description
|
||||
|
||||
The Nastran writer uses FREE format only.
|
||||
|
||||
Output stream options:
|
||||
- ASCII only
|
||||
- compression on/off
|
||||
|
||||
Output dictionary options: ignored
|
||||
|
||||
SourceFiles
|
||||
NASsurfaceFormat.C
|
||||
|
||||
@ -94,14 +100,15 @@ public:
|
||||
virtual ~NASsurfaceFormat() = default;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
// Static Functions
|
||||
|
||||
//- Write surface mesh components by proxy
|
||||
static void write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const dictionary& options = dictionary::null
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& /*unused*/ = dictionary::null
|
||||
);
|
||||
|
||||
|
||||
@ -114,10 +121,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), options);
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -221,9 +221,13 @@ void Foam::fileFormats::OBJsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const dictionary& options
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary&
|
||||
)
|
||||
{
|
||||
// ASCII only, allow output compression
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
const UList<point>& pointLst = surf.points();
|
||||
const UList<Face>& faceLst = surf.surfFaces();
|
||||
const UList<label>& faceMap = surf.faceMap();
|
||||
@ -238,7 +242,7 @@ void Foam::fileFormats::OBJsurfaceFormat<Face>::write
|
||||
|
||||
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);
|
||||
|
||||
OFstream os(filename);
|
||||
OFstream os(filename, streamOpt);
|
||||
if (!os.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,6 +32,12 @@ Description
|
||||
|
||||
Does not handle negative face indices.
|
||||
|
||||
Output stream options:
|
||||
- ASCII only
|
||||
- compression on/off
|
||||
|
||||
Output dictionary options: ignored
|
||||
|
||||
SourceFiles
|
||||
OBJsurfaceFormat.C
|
||||
|
||||
@ -72,14 +78,15 @@ public:
|
||||
virtual ~OBJsurfaceFormat() = default;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
// Static Functions
|
||||
|
||||
//- Write surface mesh components by proxy
|
||||
static void write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const dictionary& options = dictionary::null
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& /*ununsed*/ = dictionary::null
|
||||
);
|
||||
|
||||
|
||||
@ -92,10 +99,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), options);
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -149,15 +149,19 @@ void Foam::fileFormats::OFFsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary&
|
||||
)
|
||||
{
|
||||
// ASCII only, allow output compression
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
const UList<point>& pointLst = surf.points();
|
||||
const UList<Face>& faceLst = surf.surfFaces();
|
||||
const UList<label>& faceMap = surf.faceMap();
|
||||
const UList<surfZone>& zoneLst = surf.surfZones();
|
||||
|
||||
OFstream os(filename);
|
||||
OFstream os(filename, streamOpt);
|
||||
if (!os.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -39,6 +39,12 @@ Note
|
||||
When reading, the optional \a colorspec is ignored.
|
||||
When writing, it is set to the zone number (integer).
|
||||
|
||||
Output stream options:
|
||||
- ASCII only
|
||||
- compression on/off
|
||||
|
||||
Output dictionary options: ignored
|
||||
|
||||
SourceFiles
|
||||
OFFsurfaceFormat.C
|
||||
|
||||
@ -79,14 +85,15 @@ public:
|
||||
virtual ~OFFsurfaceFormat() = default;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
// Static Functions
|
||||
|
||||
//- Write surface mesh components by proxy
|
||||
static void write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const dictionary& options = dictionary::null
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& /*unused*/ = dictionary::null
|
||||
);
|
||||
|
||||
|
||||
@ -99,10 +106,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), options);
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -37,9 +37,13 @@ void Foam::fileFormats::SMESHsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary&
|
||||
)
|
||||
{
|
||||
// ASCII only, allow output compression
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
const UList<point>& pointLst = surf.points();
|
||||
const UList<Face>& faceLst = surf.surfFaces();
|
||||
const UList<label>& faceMap = surf.faceMap();
|
||||
@ -53,7 +57,7 @@ void Foam::fileFormats::SMESHsurfaceFormat<Face>::write
|
||||
|
||||
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);
|
||||
|
||||
OFstream os(filename);
|
||||
OFstream os(filename, streamOpt);
|
||||
if (!os.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,9 +28,13 @@ Class
|
||||
Foam::fileFormats::SMESHsurfaceFormat
|
||||
|
||||
Description
|
||||
Write tetgen SMESH format.
|
||||
Write tetgen SMESH format (Tetgen http://tetgen.berlios.de)
|
||||
|
||||
Tetgen http://tetgen.berlios.de
|
||||
Output stream options:
|
||||
- ASCII only
|
||||
- compression on/off
|
||||
|
||||
Output dictionary options: ignored
|
||||
|
||||
See also
|
||||
File format information:
|
||||
@ -68,7 +72,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
SMESHsurfaceFormat() = default;
|
||||
|
||||
|
||||
@ -76,14 +80,15 @@ public:
|
||||
virtual ~SMESHsurfaceFormat() = default;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
// Static Functions
|
||||
|
||||
//- Write surface mesh components by proxy
|
||||
static void write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const dictionary& options = dictionary::null
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& /*unused*/ = dictionary::null
|
||||
);
|
||||
|
||||
|
||||
@ -93,10 +98,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), options);
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -241,9 +241,13 @@ void Foam::fileFormats::STARCDsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary&
|
||||
)
|
||||
{
|
||||
// ASCII only, allow output compression
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
const UList<point>& pointLst = surf.points();
|
||||
const UList<Face>& faceLst = surf.surfFaces();
|
||||
const UList<label>& faceMap = surf.faceMap();
|
||||
@ -259,12 +263,14 @@ void Foam::fileFormats::STARCDsurfaceFormat<Face>::write
|
||||
|
||||
fileName baseName = filename.lessExt();
|
||||
|
||||
writePoints
|
||||
(
|
||||
OFstream(starFileName(baseName, STARCDCore::VRT_FILE))(),
|
||||
pointLst
|
||||
);
|
||||
OFstream os(starFileName(baseName, STARCDCore::CEL_FILE));
|
||||
// The .vrt file
|
||||
{
|
||||
OFstream os(starFileName(baseName, STARCDCore::VRT_FILE), streamOpt);
|
||||
writePoints(os, pointLst);
|
||||
}
|
||||
|
||||
// The .cel file
|
||||
OFstream os(starFileName(baseName, STARCDCore::CEL_FILE), streamOpt);
|
||||
writeHeader(os, STARCDCore::HEADER_CEL);
|
||||
|
||||
label faceIndex = 0;
|
||||
@ -291,14 +297,18 @@ void Foam::fileFormats::STARCDsurfaceFormat<Face>::write
|
||||
}
|
||||
}
|
||||
|
||||
// Write simple .inp file
|
||||
writeCase
|
||||
(
|
||||
OFstream(starFileName(baseName, STARCDCore::INP_FILE))(),
|
||||
pointLst,
|
||||
faceLst.size(),
|
||||
zones
|
||||
);
|
||||
// Simple .inp file - always UNCOMPRESSED
|
||||
{
|
||||
OFstream os(starFileName(baseName, STARCDCore::INP_FILE));
|
||||
|
||||
writeCase
|
||||
(
|
||||
os,
|
||||
pointLst,
|
||||
faceLst.size(),
|
||||
zones
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,6 +30,12 @@ Class
|
||||
Description
|
||||
Read/write the surface shells from PROSTAR vrt/cel files.
|
||||
|
||||
Output stream options:
|
||||
- ASCII only
|
||||
- compression on/off
|
||||
|
||||
Output dictionary options: ignored
|
||||
|
||||
Note
|
||||
Uses the extension \a .inp (input) to denote the format.
|
||||
|
||||
@ -89,14 +95,15 @@ public:
|
||||
virtual ~STARCDsurfaceFormat() = default;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
// Static Functions
|
||||
|
||||
//- Write surface mesh components by proxy
|
||||
static void write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const dictionary& options = dictionary::null
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& /*ununsed*/ = dictionary::null
|
||||
);
|
||||
|
||||
|
||||
@ -109,10 +116,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), options);
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -202,10 +202,11 @@ template<class Face>
|
||||
void Foam::fileFormats::STLsurfaceFormat<Face>::writeAscii
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstream::compressionType comp
|
||||
)
|
||||
{
|
||||
OFstream os(filename);
|
||||
OFstream os(filename, IOstreamOption(IOstream::ASCII, comp));
|
||||
if (!os.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -316,23 +317,24 @@ template<class Face>
|
||||
void Foam::fileFormats::STLsurfaceFormat<Face>::writeAscii
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstream::compressionType comp
|
||||
)
|
||||
{
|
||||
OFstream os(filename);
|
||||
if (!os.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot open file for writing " << filename
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const pointField& pointLst = surf.points();
|
||||
const UList<Face>& faceLst = surf.surfFaces();
|
||||
|
||||
// A single zone - we can skip sorting
|
||||
if (surf.zoneToc().size() == 1)
|
||||
{
|
||||
OFstream os(filename, IOstreamOption(IOstream::ASCII, comp));
|
||||
if (!os.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot open file for writing " << filename
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
os << "solid " << surf.zoneToc()[0].name() << nl;
|
||||
for (const Face& f : faceLst)
|
||||
{
|
||||
@ -354,7 +356,8 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::writeAscii
|
||||
faceLst,
|
||||
zoneLst,
|
||||
faceMap
|
||||
)
|
||||
),
|
||||
comp
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -402,19 +405,22 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary& options
|
||||
)
|
||||
{
|
||||
// Detect "stlb" extension
|
||||
bool useBinary = STLCore::isBinaryName(filename, STLCore::UNKNOWN);
|
||||
|
||||
if (useBinary)
|
||||
if
|
||||
(
|
||||
streamOpt.format() == IOstream::BINARY
|
||||
// Detected "stlb" extension?
|
||||
|| STLCore::isBinaryName(filename, STLCore::UNKNOWN)
|
||||
)
|
||||
{
|
||||
writeBinary(filename, surf);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeAscii(filename, surf);
|
||||
writeAscii(filename, surf, streamOpt.compression());
|
||||
}
|
||||
}
|
||||
|
||||
@ -424,7 +430,8 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const STLFormat format
|
||||
const STLFormat format,
|
||||
IOstream::compressionType comp
|
||||
)
|
||||
{
|
||||
if (STLCore::isBinaryName(filename, format))
|
||||
@ -433,7 +440,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::write
|
||||
}
|
||||
else
|
||||
{
|
||||
writeAscii(filename, surf);
|
||||
writeAscii(filename, surf, comp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -443,19 +450,22 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary& options
|
||||
)
|
||||
{
|
||||
// Detect "stlb" extension
|
||||
bool useBinary = STLCore::isBinaryName(filename, STLCore::UNKNOWN);
|
||||
|
||||
if (useBinary)
|
||||
if
|
||||
(
|
||||
streamOpt.format() == IOstream::BINARY
|
||||
// Detected "stlb" extension?
|
||||
|| STLCore::isBinaryName(filename, STLCore::UNKNOWN)
|
||||
)
|
||||
{
|
||||
writeBinary(filename, surf);
|
||||
}
|
||||
else
|
||||
{
|
||||
writeAscii(filename, surf);
|
||||
writeAscii(filename, surf, streamOpt.compression());
|
||||
}
|
||||
}
|
||||
|
||||
@ -465,7 +475,8 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
const STLFormat format
|
||||
const STLFormat format,
|
||||
IOstream::compressionType comp
|
||||
)
|
||||
{
|
||||
if (STLCore::isBinaryName(filename, format))
|
||||
@ -474,7 +485,7 @@ void Foam::fileFormats::STLsurfaceFormat<Face>::write
|
||||
}
|
||||
else
|
||||
{
|
||||
writeAscii(filename, surf);
|
||||
writeAscii(filename, surf, comp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,6 +30,10 @@ Class
|
||||
Description
|
||||
Provide a means of reading/writing STL files (ASCII and BINARY).
|
||||
|
||||
Output stream options: ASCII/BINARY, compression for ASCII only
|
||||
|
||||
Output dictionary options: ignored
|
||||
|
||||
Note
|
||||
For efficiency, the zones are sorted before creating the faces.
|
||||
The class is thus derived from MeshedSurface.
|
||||
@ -97,13 +101,14 @@ public:
|
||||
virtual ~STLsurfaceFormat() = default;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
// Static Functions
|
||||
|
||||
//- Write surface mesh components by proxy (as ASCII)
|
||||
static void writeAscii
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstream::compressionType comp = IOstream::UNCOMPRESSED
|
||||
);
|
||||
|
||||
//- Write surface mesh components by proxy (as BINARY)
|
||||
@ -117,7 +122,8 @@ public:
|
||||
static void writeAscii
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstream::compressionType comp = IOstream::UNCOMPRESSED
|
||||
);
|
||||
|
||||
//- Write UnsortedMeshedSurface (as BINARY) unsorted by zone
|
||||
@ -133,7 +139,8 @@ public:
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const STLFormat format
|
||||
const STLFormat format,
|
||||
IOstream::compressionType comp = IOstream::UNCOMPRESSED
|
||||
);
|
||||
|
||||
//- Write UnsortedMeshedSurface
|
||||
@ -142,7 +149,8 @@ public:
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
const STLFormat format
|
||||
const STLFormat format,
|
||||
IOstream::compressionType comp = IOstream::UNCOMPRESSED
|
||||
);
|
||||
|
||||
|
||||
@ -152,6 +160,7 @@ public:
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
);
|
||||
|
||||
@ -161,6 +170,7 @@ public:
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
);
|
||||
|
||||
@ -174,10 +184,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), options);
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -156,9 +156,13 @@ void Foam::fileFormats::TRIsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const dictionary& options
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary&
|
||||
)
|
||||
{
|
||||
// ASCII only, allow output compression
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
const UList<point>& pointLst = surf.points();
|
||||
const UList<Face>& faceLst = surf.surfFaces();
|
||||
const UList<label>& faceMap = surf.faceMap();
|
||||
@ -172,7 +176,7 @@ void Foam::fileFormats::TRIsurfaceFormat<Face>::write
|
||||
|
||||
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);
|
||||
|
||||
OFstream os(filename);
|
||||
OFstream os(filename, streamOpt);
|
||||
if (!os.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -213,13 +217,17 @@ void Foam::fileFormats::TRIsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
const dictionary& options
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary&
|
||||
)
|
||||
{
|
||||
// ASCII only, allow output compression
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
const UList<point>& pointLst = surf.points();
|
||||
const UList<Face>& faceLst = surf.surfFaces();
|
||||
|
||||
OFstream os(filename);
|
||||
OFstream os(filename, streamOpt);
|
||||
if (!os.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,6 +30,12 @@ Class
|
||||
Description
|
||||
Provide a means of reading/writing .tri format.
|
||||
|
||||
Output stream options:
|
||||
- ASCII only
|
||||
- compression on/off
|
||||
|
||||
Output dictionary options: ignored
|
||||
|
||||
Note
|
||||
For efficiency, the zones are sorted before creating the faces.
|
||||
The class is thus derived from MeshedSurface.
|
||||
@ -85,14 +91,15 @@ public:
|
||||
virtual ~TRIsurfaceFormat() = default;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
// Static Functions
|
||||
|
||||
//- Write surface mesh components by proxy
|
||||
static void write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const dictionary& options = dictionary::null
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& /*unused*/ = dictionary::null
|
||||
);
|
||||
|
||||
//- Write UnsortedMeshedSurface, the output remains unsorted
|
||||
@ -100,7 +107,8 @@ public:
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
const dictionary& options = dictionary::null
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& /*unused*/ = dictionary::null
|
||||
);
|
||||
|
||||
|
||||
@ -113,10 +121,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), options);
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -243,6 +243,7 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstreamOption,
|
||||
const dictionary& options
|
||||
)
|
||||
{
|
||||
@ -316,6 +317,7 @@ void Foam::fileFormats::VTKsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstreamOption,
|
||||
const dictionary& options
|
||||
)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,7 +32,9 @@ Description
|
||||
|
||||
The output is never sorted by zone.
|
||||
|
||||
\heading Output Options
|
||||
Output stream options: ignored (dictionary options only)
|
||||
|
||||
\heading Format options
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
format | ascii or binary format | no | ascii
|
||||
@ -91,13 +93,14 @@ public:
|
||||
virtual ~VTKsurfaceFormat() = default;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
// Static Functions
|
||||
|
||||
//- Write surface mesh components by proxy
|
||||
static void write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstreamOption /*ignored*/ = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
);
|
||||
|
||||
@ -106,6 +109,7 @@ public:
|
||||
(
|
||||
const fileName& fileName,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstreamOption /*ignored*/ = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
);
|
||||
|
||||
@ -119,10 +123,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), options);
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -96,6 +96,7 @@ void Foam::fileFormats::VTPsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstreamOption,
|
||||
const dictionary& options
|
||||
)
|
||||
{
|
||||
@ -204,6 +205,7 @@ void Foam::fileFormats::VTPsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstreamOption,
|
||||
const dictionary& options
|
||||
)
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,7 +32,9 @@ Description
|
||||
|
||||
The output is never sorted by zone.
|
||||
|
||||
\heading Output Options
|
||||
Output stream options: ignored (dictionary options only)
|
||||
|
||||
\heading Format options
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
format | ascii or binary format | no | binary
|
||||
@ -83,7 +85,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
VTPsurfaceFormat() = default;
|
||||
|
||||
|
||||
@ -91,13 +93,14 @@ public:
|
||||
virtual ~VTPsurfaceFormat() = default;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
// Static Functions
|
||||
|
||||
//- Write surface mesh components by proxy
|
||||
static void write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstreamOption /*ignored*/ = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
);
|
||||
|
||||
@ -106,6 +109,7 @@ public:
|
||||
(
|
||||
const fileName& filename,
|
||||
const UnsortedMeshedSurface<Face>& surf,
|
||||
IOstreamOption /*ignored*/ = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
);
|
||||
|
||||
@ -116,10 +120,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), options);
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -36,9 +36,13 @@ void Foam::fileFormats::X3DsurfaceFormat<Face>::write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
IOstreamOption streamOpt,
|
||||
const dictionary&
|
||||
)
|
||||
{
|
||||
// ASCII only, allow output compression
|
||||
streamOpt.format(IOstream::ASCII);
|
||||
|
||||
const UList<point>& pointLst = surf.points();
|
||||
const UList<Face>& faceLst = surf.surfFaces();
|
||||
const UList<label>& faceMap = surf.faceMap();
|
||||
@ -53,7 +57,7 @@ void Foam::fileFormats::X3DsurfaceFormat<Face>::write
|
||||
|
||||
const bool useFaceMap = (surf.useFaceMap() && zones.size() > 1);
|
||||
|
||||
OFstream os(filename);
|
||||
OFstream os(filename, streamOpt);
|
||||
if (!os.good())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2016 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,6 +30,12 @@ Class
|
||||
Description
|
||||
Provide a means of writing x3d format.
|
||||
|
||||
Output stream options:
|
||||
- ASCII only
|
||||
- compression on/off
|
||||
|
||||
Output dictionary options: ignored
|
||||
|
||||
SourceFiles
|
||||
X3DsurfaceFormat.C
|
||||
|
||||
@ -64,7 +70,7 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
X3DsurfaceFormat() = default;
|
||||
|
||||
|
||||
@ -72,14 +78,15 @@ public:
|
||||
virtual ~X3DsurfaceFormat() = default;
|
||||
|
||||
|
||||
// Static Member Functions
|
||||
// Static Functions
|
||||
|
||||
//- Write surface mesh components by proxy
|
||||
static void write
|
||||
(
|
||||
const fileName& filename,
|
||||
const MeshedSurfaceProxy<Face>& surf,
|
||||
const dictionary& options = dictionary::null
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& /*unused*/ = dictionary::null
|
||||
);
|
||||
|
||||
|
||||
@ -89,10 +96,11 @@ public:
|
||||
virtual void write
|
||||
(
|
||||
const fileName& name,
|
||||
IOstreamOption streamOpt = IOstreamOption(),
|
||||
const dictionary& options = dictionary::null
|
||||
) const
|
||||
{
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), options);
|
||||
write(name, MeshedSurfaceProxy<Face>(*this), streamOpt, options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -45,6 +45,7 @@ namespace surfaceWriters
|
||||
{
|
||||
defineTypeName(boundaryDataWriter);
|
||||
addToRunTimeSelectionTable(surfaceWriter, boundaryDataWriter, word);
|
||||
addToRunTimeSelectionTable(surfaceWriter, boundaryDataWriter, wordDict);
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +54,9 @@ namespace surfaceWriters
|
||||
|
||||
Foam::surfaceWriters::boundaryDataWriter::boundaryDataWriter()
|
||||
:
|
||||
surfaceWriter()
|
||||
surfaceWriter(),
|
||||
header_(false),
|
||||
streamOpt_()
|
||||
{}
|
||||
|
||||
|
||||
@ -62,7 +65,13 @@ Foam::surfaceWriters::boundaryDataWriter::boundaryDataWriter
|
||||
const dictionary& options
|
||||
)
|
||||
:
|
||||
surfaceWriter(options)
|
||||
surfaceWriter(options),
|
||||
header_(options.getOrDefault("header", false)),
|
||||
streamOpt_
|
||||
(
|
||||
IOstream::formatEnum("format", options, IOstream::ASCII),
|
||||
IOstream::compressionEnum("compression", options)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -106,17 +115,9 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::write()
|
||||
|
||||
fileName surfaceDir = outputPath_;
|
||||
|
||||
// Write points
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< "Writing points to " << surfaceDir/"points" << endl;
|
||||
}
|
||||
|
||||
|
||||
// Dummy Time to use as objectRegistry
|
||||
autoPtr<Time> dummyTimePtr(Time::New(argList::envGlobalPath()));
|
||||
|
||||
|
||||
const meshedSurf& surf = surface();
|
||||
|
||||
if (Pstream::master() || !parallel_)
|
||||
@ -126,7 +127,7 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::write()
|
||||
mkDir(surfaceDir);
|
||||
}
|
||||
|
||||
pointIOField pts
|
||||
pointIOField iopts
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -135,19 +136,32 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::write()
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
surf.points()
|
||||
)
|
||||
);
|
||||
|
||||
// Do like regIOobject::writeObject but don't do instance() adaptation
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< "Writing points: " << iopts.objectPath() << endl;
|
||||
}
|
||||
|
||||
|
||||
// Like regIOobject::writeObject without instance() adaptation
|
||||
// since this would write to e.g. 0/ instead of postProcessing/
|
||||
|
||||
// Try opening an OFstream for object
|
||||
OFstream os(pts.objectPath());
|
||||
OFstream osGeom(iopts.objectPath(), streamOpt_);
|
||||
|
||||
//pts.writeHeader(os);
|
||||
pts.writeData(os);
|
||||
//pts.writeEndDivider(os);
|
||||
if (header_)
|
||||
{
|
||||
iopts.writeHeader(osGeom);
|
||||
}
|
||||
|
||||
// Just like writeData, but without copying beforehand
|
||||
osGeom << surf.points();
|
||||
|
||||
if (header_)
|
||||
{
|
||||
iopts.writeEndDivider(osGeom);
|
||||
}
|
||||
}
|
||||
|
||||
wroteGeom_ = true;
|
||||
@ -193,7 +207,7 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::writeTemplate
|
||||
mkDir(outputFile.path());
|
||||
}
|
||||
|
||||
pointIOField pts
|
||||
pointIOField iopts
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -202,48 +216,79 @@ Foam::fileName Foam::surfaceWriters::boundaryDataWriter::writeTemplate
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
label(0)
|
||||
)
|
||||
);
|
||||
|
||||
if (verbose_)
|
||||
{
|
||||
if (this->isPointData())
|
||||
{
|
||||
Info<< "Writing points: " << iopts.objectPath() << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "Writing face centres: " << iopts.objectPath() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Like regIOobject::writeObject without instance() adaptation
|
||||
// since this would write to e.g. 0/ instead of postProcessing/
|
||||
|
||||
OFstream osGeom(iopts.objectPath(), streamOpt_);
|
||||
|
||||
if (header_)
|
||||
{
|
||||
iopts.writeHeader(osGeom);
|
||||
}
|
||||
|
||||
if (this->isPointData())
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< "Writing points to "
|
||||
<< surfaceDir/"points" << endl;
|
||||
}
|
||||
pts = points;
|
||||
// Just like writeData, but without copying beforehand
|
||||
osGeom << points;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (verbose_)
|
||||
{
|
||||
Info<< "Writing face centres to "
|
||||
<< surfaceDir/"points" << endl;
|
||||
}
|
||||
primitivePatch pp(SubList<face>(faces), points);
|
||||
|
||||
primitivePatch pp(SubList<face>(faces, faces.size()), points);
|
||||
|
||||
pts = pp.faceCentres();
|
||||
// Just like writeData, but without copying beforehand
|
||||
osGeom << pp.faceCentres();
|
||||
}
|
||||
|
||||
if (header_)
|
||||
{
|
||||
// Do like regIOobject::writeObject but don't do instance()
|
||||
// adaptation
|
||||
// since this would write to e.g. 0/ instead of postProcessing/
|
||||
|
||||
// Try opening an OFstream for object
|
||||
OFstream os(pts.objectPath());
|
||||
|
||||
//pts.writeHeader(os);
|
||||
pts.writeData(os);
|
||||
//pts.writeEndDivider(os);
|
||||
iopts.writeEndDivider(osGeom);
|
||||
}
|
||||
|
||||
|
||||
// Write field
|
||||
OFstream(outputFile)() << tfield();
|
||||
{
|
||||
IOField<Type> iofld
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
outputFile,
|
||||
*dummyTimePtr,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
OFstream osField(iofld.objectPath(), streamOpt_);
|
||||
|
||||
if (header_)
|
||||
{
|
||||
iofld.writeHeader(osField);
|
||||
}
|
||||
|
||||
// Just like writeData, but without copying beforehand
|
||||
osField << tfield();
|
||||
|
||||
if (header_)
|
||||
{
|
||||
iofld.writeEndDivider(osField);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wroteGeom_ = true;
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -29,7 +29,27 @@ Class
|
||||
Description
|
||||
A surfaceWriter for outputting to a form useable for the
|
||||
timeVaryingMapped boundary condition. This reads the data from
|
||||
constant/boundaryData/\<patch\> directory
|
||||
constant/boundaryData/\<patch\> directory.
|
||||
|
||||
\verbatim
|
||||
formatOptions
|
||||
{
|
||||
boundaryData
|
||||
{
|
||||
header false;
|
||||
format ascii;
|
||||
compression false;
|
||||
}
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Format options:
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
header | Generate files with FoamFile header | no | false
|
||||
format | ascii/binary | no | ascii
|
||||
compression | Use file compression | no | false
|
||||
\endtable
|
||||
|
||||
Typical way of working:
|
||||
- use a sampledSurface of type 'patch' (to sample a patch):
|
||||
@ -37,17 +57,25 @@ Description
|
||||
surfaces
|
||||
{
|
||||
type surfaces;
|
||||
surfaceFormat boundaryData;
|
||||
fields ( p );
|
||||
surfaceFormat boundaryData;
|
||||
formatOptions
|
||||
{
|
||||
boundaryData
|
||||
{
|
||||
header true;
|
||||
format binary;
|
||||
}
|
||||
}
|
||||
surfaces
|
||||
(
|
||||
{
|
||||
outlet
|
||||
{
|
||||
type patch;
|
||||
patches (outlet);
|
||||
interpolate false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -113,6 +141,15 @@ class boundaryDataWriter
|
||||
:
|
||||
public surfaceWriter
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Output files with FoamFile header
|
||||
bool header_;
|
||||
|
||||
//- Output stream option
|
||||
IOstreamOption streamOpt_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Templated write field operation
|
||||
@ -126,13 +163,13 @@ class boundaryDataWriter
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
//- Declare type-name, virtual type (without debug switch)
|
||||
TypeNameNoDebug("boundaryData");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
boundaryDataWriter();
|
||||
|
||||
//- Construct with some output options
|
||||
|
||||
@ -81,7 +81,7 @@ class ensightWriter
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Write option (default: IOstream::ASCII)
|
||||
//- Output format option (default: IOstream::ASCII)
|
||||
IOstream::streamFormat writeFormat_;
|
||||
|
||||
//- Collate times (default: true)
|
||||
@ -193,13 +193,13 @@ class ensightWriter
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
//- Declare type-name, virtual type (without debug switch)
|
||||
TypeNameNoDebug("ensight");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
ensightWriter();
|
||||
|
||||
//- Construct with some output options
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -40,6 +40,7 @@ namespace surfaceWriters
|
||||
{
|
||||
defineTypeName(foamWriter);
|
||||
addToRunTimeSelectionTable(surfaceWriter, foamWriter, word);
|
||||
addToRunTimeSelectionTable(surfaceWriter, foamWriter, wordDict);
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +49,8 @@ namespace surfaceWriters
|
||||
|
||||
Foam::surfaceWriters::foamWriter::foamWriter()
|
||||
:
|
||||
surfaceWriter()
|
||||
surfaceWriter(),
|
||||
streamOpt_()
|
||||
{}
|
||||
|
||||
|
||||
@ -57,7 +59,12 @@ Foam::surfaceWriters::foamWriter::foamWriter
|
||||
const dictionary& options
|
||||
)
|
||||
:
|
||||
surfaceWriter(options)
|
||||
surfaceWriter(options),
|
||||
streamOpt_
|
||||
(
|
||||
IOstream::formatEnum("format", options, IOstream::ASCII),
|
||||
IOstream::compressionEnum("compression", options)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -125,10 +132,10 @@ Foam::fileName Foam::surfaceWriters::foamWriter::write()
|
||||
}
|
||||
|
||||
// Points
|
||||
OFstream(surfaceDir/"points")() << points;
|
||||
OFstream(surfaceDir/"points", streamOpt_)() << points;
|
||||
|
||||
// Faces
|
||||
OFstream(surfaceDir/"faces")() << faces;
|
||||
OFstream(surfaceDir/"faces", streamOpt_)() << faces;
|
||||
|
||||
// Face centers.
|
||||
// Not really necessary but very handy when reusing as inputs
|
||||
@ -140,7 +147,7 @@ Foam::fileName Foam::surfaceWriters::foamWriter::write()
|
||||
faceCentres[facei] = faces[facei].centre(points);
|
||||
}
|
||||
|
||||
OFstream(surfaceDir/"faceCentres")() << faceCentres;
|
||||
OFstream(surfaceDir/"faceCentres", streamOpt_)() << faceCentres;
|
||||
}
|
||||
|
||||
wroteGeom_ = true;
|
||||
@ -202,7 +209,7 @@ Foam::fileName Foam::surfaceWriters::foamWriter::writeTemplate
|
||||
}
|
||||
|
||||
// Write field
|
||||
OFstream(outputFile)() << tfield();
|
||||
OFstream(outputFile, streamOpt_)() << tfield();
|
||||
}
|
||||
|
||||
wroteGeom_ = true;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,6 +30,24 @@ Class
|
||||
Description
|
||||
A surfaceWriter for OpenFOAM surfaces
|
||||
|
||||
\verbatim
|
||||
formatOptions
|
||||
{
|
||||
foam
|
||||
{
|
||||
format ascii;
|
||||
compression true;
|
||||
}
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
Format options:
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
format | ascii/binary | no | ascii
|
||||
compression | output file compression | no | false
|
||||
\endtable
|
||||
|
||||
\heading Output file locations
|
||||
|
||||
The \c rootdir normally corresponds to something like
|
||||
@ -83,6 +101,12 @@ class foamWriter
|
||||
:
|
||||
public surfaceWriter
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Output stream option
|
||||
IOstreamOption streamOpt_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Templated write operation
|
||||
@ -96,13 +120,13 @@ class foamWriter
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
//- Declare type-name, virtual type (without debug switch)
|
||||
TypeNameNoDebug("foam");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
foamWriter();
|
||||
|
||||
//- Construct with some output options
|
||||
|
||||
@ -142,7 +142,7 @@ private:
|
||||
(
|
||||
Ostream& os,
|
||||
const point& pt,
|
||||
const label pointI //!< 0-based Point Id
|
||||
const label pointI //!< 0-based Point Id
|
||||
) const;
|
||||
|
||||
//- Write a face element (CTRIA3 or CQUAD4)
|
||||
|
||||
@ -52,7 +52,7 @@ Foam::surfaceWriters::nullWriter::nullWriter()
|
||||
|
||||
Foam::surfaceWriters::nullWriter::nullWriter(const dictionary& options)
|
||||
:
|
||||
surfaceWriter()
|
||||
nullWriter()
|
||||
{}
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ Foam::surfaceWriters::nullWriter::nullWriter
|
||||
const dictionary& options
|
||||
)
|
||||
:
|
||||
surfaceWriter()
|
||||
nullWriter()
|
||||
{}
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ Foam::surfaceWriters::nullWriter::nullWriter
|
||||
const dictionary& options
|
||||
)
|
||||
:
|
||||
surfaceWriter()
|
||||
nullWriter()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -56,16 +56,16 @@ class nullWriter
|
||||
{
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
//- Declare type-name, virtual type (without debug switch)
|
||||
TypeNameNoDebug("none");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for a given extension
|
||||
//- Default construct
|
||||
nullWriter();
|
||||
|
||||
//- Construct for a given extension
|
||||
//- Construct with some output options
|
||||
explicit nullWriter(const dictionary& options);
|
||||
|
||||
//- Construct from components
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -47,7 +47,8 @@ namespace surfaceWriters
|
||||
Foam::surfaceWriters::proxyWriter::proxyWriter(const word& fileExt)
|
||||
:
|
||||
surfaceWriter(),
|
||||
fileExtension_(fileExt)
|
||||
fileExtension_(fileExt),
|
||||
streamOpt_()
|
||||
{}
|
||||
|
||||
|
||||
@ -59,6 +60,11 @@ Foam::surfaceWriters::proxyWriter::proxyWriter
|
||||
:
|
||||
surfaceWriter(options),
|
||||
fileExtension_(fileExt),
|
||||
streamOpt_
|
||||
(
|
||||
IOstream::formatEnum("format", options, IOstream::ASCII),
|
||||
IOstream::compressionEnum("compression", options)
|
||||
),
|
||||
options_(options)
|
||||
{}
|
||||
|
||||
@ -132,6 +138,7 @@ Foam::fileName Foam::surfaceWriters::proxyWriter::write()
|
||||
(
|
||||
outputFile,
|
||||
fileExtension_,
|
||||
streamOpt_,
|
||||
options_
|
||||
);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -46,6 +46,14 @@ Description
|
||||
Note
|
||||
The formatOptions for proxy are file-type dependent.
|
||||
|
||||
The following stream options are read and passed through,
|
||||
but not necessarily used by the corresponding backend.
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
format | ascii/binary | no | ascii
|
||||
compression | File compression | no | false
|
||||
\endtable
|
||||
|
||||
SourceFiles
|
||||
proxySurfaceWriter.C
|
||||
|
||||
@ -76,13 +84,16 @@ class proxyWriter
|
||||
//- The file extension associated with the proxy
|
||||
word fileExtension_;
|
||||
|
||||
//- Output stream option
|
||||
IOstreamOption streamOpt_;
|
||||
|
||||
//- Format options
|
||||
dictionary options_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
//- Declare type-name, virtual type (without debug switch)
|
||||
TypeNameNoDebug("proxy");
|
||||
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ defineSurfaceWriterWriteFields(Foam::surfaceWriters::rawWriter);
|
||||
Foam::surfaceWriters::rawWriter::rawWriter()
|
||||
:
|
||||
surfaceWriter(),
|
||||
writeCompression_(IOstream::UNCOMPRESSED)
|
||||
streamOpt_()
|
||||
{}
|
||||
|
||||
|
||||
@ -82,8 +82,9 @@ Foam::surfaceWriters::rawWriter::rawWriter
|
||||
)
|
||||
:
|
||||
surfaceWriter(options),
|
||||
writeCompression_
|
||||
streamOpt_
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::compressionEnum("compression", options)
|
||||
)
|
||||
{}
|
||||
@ -152,13 +153,7 @@ Foam::fileName Foam::surfaceWriters::rawWriter::write()
|
||||
mkDir(outputFile.path());
|
||||
}
|
||||
|
||||
OFstream os
|
||||
(
|
||||
outputFile,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
writeCompression_
|
||||
);
|
||||
OFstream os(outputFile, streamOpt_);
|
||||
|
||||
// Header
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,8 +32,8 @@ Description
|
||||
|
||||
The formatOptions for raw:
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
compression | on / off | no | off
|
||||
Property | Description | Required | Default
|
||||
compression | Use file compression | no | false
|
||||
\endtable
|
||||
|
||||
For example,
|
||||
@ -92,10 +92,10 @@ class rawWriter
|
||||
:
|
||||
public surfaceWriter
|
||||
{
|
||||
// Private data
|
||||
// Private Data
|
||||
|
||||
//- Output compression (default: uncompressed)
|
||||
IOstream::compressionType writeCompression_;
|
||||
//- Output stream option
|
||||
IOstreamOption streamOpt_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -111,13 +111,13 @@ class rawWriter
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
//- Declare type-name, virtual type (without debug switch)
|
||||
TypeNameNoDebug("raw");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
rawWriter();
|
||||
|
||||
//- Construct with some output options
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -152,13 +152,7 @@ Foam::fileName Foam::surfaceWriters::rawWriter::writeTemplate
|
||||
mkDir(outputFile.path());
|
||||
}
|
||||
|
||||
OFstream os
|
||||
(
|
||||
outputFile,
|
||||
IOstream::ASCII,
|
||||
IOstream::currentVersion,
|
||||
writeCompression_
|
||||
);
|
||||
OFstream os(outputFile, streamOpt_);
|
||||
|
||||
// Header
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -41,6 +41,7 @@ namespace surfaceWriters
|
||||
{
|
||||
defineTypeName(starcdWriter);
|
||||
addToRunTimeSelectionTable(surfaceWriter, starcdWriter, word);
|
||||
addToRunTimeSelectionTable(surfaceWriter, starcdWriter, wordDict);
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,8 +53,7 @@ namespace Foam
|
||||
template<class Type>
|
||||
static inline void writeData(Ostream& os, const Type& val)
|
||||
{
|
||||
const direction ncmpt = pTraits<Type>::nComponents;
|
||||
for (direction cmpt=0; cmpt < ncmpt; ++cmpt)
|
||||
for (direction cmpt=0; cmpt < pTraits<Type>::nComponents; ++cmpt)
|
||||
{
|
||||
os << ' ' << component(val, cmpt);
|
||||
}
|
||||
@ -67,7 +67,8 @@ namespace Foam
|
||||
|
||||
Foam::surfaceWriters::starcdWriter::starcdWriter()
|
||||
:
|
||||
surfaceWriter()
|
||||
surfaceWriter(),
|
||||
streamOpt_()
|
||||
{}
|
||||
|
||||
|
||||
@ -76,7 +77,12 @@ Foam::surfaceWriters::starcdWriter::starcdWriter
|
||||
const dictionary& options
|
||||
)
|
||||
:
|
||||
surfaceWriter(options)
|
||||
surfaceWriter(options),
|
||||
streamOpt_
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::compressionEnum("compression", options)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -139,11 +145,12 @@ Foam::fileName Foam::surfaceWriters::starcdWriter::write()
|
||||
mkDir(outputFile.path());
|
||||
}
|
||||
|
||||
MeshedSurfaceProxy<face>
|
||||
MeshedSurfaceProxy<face>(surf.points(), surf.faces()).write
|
||||
(
|
||||
surf.points(),
|
||||
surf.faces()
|
||||
).write(outputFile, "inp");
|
||||
outputFile,
|
||||
"inp",
|
||||
streamOpt_
|
||||
);
|
||||
}
|
||||
|
||||
wroteGeom_ = true;
|
||||
@ -199,7 +206,7 @@ Foam::fileName Foam::surfaceWriters::starcdWriter::writeTemplate
|
||||
mkDir(outputFile.path());
|
||||
}
|
||||
|
||||
OFstream os(outputFile);
|
||||
OFstream os(outputFile, streamOpt_);
|
||||
|
||||
// 1-based ids
|
||||
label elemId = 1;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -30,6 +30,12 @@ Class
|
||||
Description
|
||||
A surfaceWriter for STARCD files.
|
||||
|
||||
The formatOptions for starcd:
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
compression | Use file compression | no | false
|
||||
\endtable
|
||||
|
||||
The geometry is written via the MeshedSurfaceProxy, the fields
|
||||
are written in a trivial ASCII format with ID and VALUE as
|
||||
so-called user data. These \c .usr files can be read into proSTAR
|
||||
@ -89,6 +95,12 @@ class starcdWriter
|
||||
:
|
||||
public surfaceWriter
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Output stream option
|
||||
IOstreamOption streamOpt_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Templated write operation
|
||||
@ -102,13 +114,13 @@ class starcdWriter
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
//- Declare type-name, virtual type (without debug switch)
|
||||
TypeNameNoDebug("starcd");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
starcdWriter();
|
||||
|
||||
//- Construct with some output options
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -278,7 +278,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
//- Destructor. Calls close()
|
||||
virtual ~surfaceWriter();
|
||||
|
||||
|
||||
|
||||
@ -91,11 +91,7 @@ Foam::surfaceWriters::vtkWriter::vtkWriter
|
||||
fmtType_(static_cast<unsigned>(vtk::formatType::INLINE_BASE64)),
|
||||
precision_
|
||||
(
|
||||
options.lookupOrDefaultCompat
|
||||
(
|
||||
"precision", {{"writePrecision", 1806}},
|
||||
IOstream::defaultPrecision()
|
||||
)
|
||||
options.getOrDefault("precision", IOstream::defaultPrecision())
|
||||
),
|
||||
writer_(nullptr)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -80,7 +80,7 @@ namespace Foam
|
||||
|
||||
namespace vtk
|
||||
{
|
||||
// Forward declarations
|
||||
// Forward Declarations
|
||||
class outputOptions;
|
||||
class surfaceWriter;
|
||||
}
|
||||
@ -122,13 +122,13 @@ class vtkWriter
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
//- Declare type-name, virtual type (without debug switch)
|
||||
TypeNameNoDebug("vtk");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
vtkWriter();
|
||||
|
||||
//- Construct with some output options
|
||||
@ -159,7 +159,7 @@ public:
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
//- Destructor. Calls close()
|
||||
virtual ~vtkWriter();
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -91,6 +91,7 @@ static inline void printColour(Ostream& os, const vector& rgb)
|
||||
Foam::surfaceWriters::x3dWriter::x3dWriter()
|
||||
:
|
||||
surfaceWriter(),
|
||||
streamOpt_(),
|
||||
range_(),
|
||||
colourTablePtr_(nullptr)
|
||||
{}
|
||||
@ -102,6 +103,11 @@ Foam::surfaceWriters::x3dWriter::x3dWriter
|
||||
)
|
||||
:
|
||||
surfaceWriter(options),
|
||||
streamOpt_
|
||||
(
|
||||
IOstream::ASCII,
|
||||
IOstream::compressionEnum("compression", options)
|
||||
),
|
||||
range_(),
|
||||
colourTablePtr_(nullptr)
|
||||
{
|
||||
@ -202,11 +208,12 @@ Foam::fileName Foam::surfaceWriters::x3dWriter::write()
|
||||
mkDir(outputFile.path());
|
||||
}
|
||||
|
||||
MeshedSurfaceProxy<face>
|
||||
MeshedSurfaceProxy<face>(surf.points(), surf.faces()).write
|
||||
(
|
||||
surf.points(),
|
||||
surf.faces()
|
||||
).write(outputFile, "x3d");
|
||||
outputFile,
|
||||
"x3d",
|
||||
streamOpt_
|
||||
);
|
||||
}
|
||||
|
||||
wroteGeom_ = true;
|
||||
@ -243,7 +250,7 @@ Foam::fileName Foam::surfaceWriters::x3dWriter::writeTemplate
|
||||
outputFile /= timeName();
|
||||
}
|
||||
|
||||
// Append <field>_surfaceName.usr
|
||||
// Append <field>_surfaceName.x3d
|
||||
outputFile /= fieldName + '_' + outputPath_.name();
|
||||
outputFile.ext("x3d");
|
||||
|
||||
@ -273,7 +280,7 @@ Foam::fileName Foam::surfaceWriters::x3dWriter::writeTemplate
|
||||
mkDir(outputFile.path());
|
||||
}
|
||||
|
||||
OFstream os(outputFile);
|
||||
OFstream os(outputFile, streamOpt_);
|
||||
|
||||
writeHeader(os);
|
||||
beginGroup(os);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2019 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -32,6 +32,7 @@ Description
|
||||
The formatOptions for x3d:
|
||||
\table
|
||||
Property | Description | Required | Default
|
||||
compression | Use file compression | no | false
|
||||
range | The min/max range for colour table | no | automatic
|
||||
colourMap | The colour map for rendering | no | coolToWarm
|
||||
\endtable
|
||||
@ -87,6 +88,9 @@ class x3dWriter
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Output stream option
|
||||
IOstreamOption streamOpt_;
|
||||
|
||||
//- Range of values
|
||||
// The lower/upper limits for the colour table output
|
||||
// Undefined means calculate from the data
|
||||
@ -109,13 +113,13 @@ class x3dWriter
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
//- Declare type-name, virtual type (without debug switch)
|
||||
TypeNameNoDebug("x3d");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
//- Default construct
|
||||
x3dWriter();
|
||||
|
||||
//- Construct with some output options
|
||||
|
||||
Reference in New Issue
Block a user