Commit 680ca788 authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

BUG: new surface writer loses serial/parallel preference (fixes #1214)

parent dcdc9e68
......@@ -108,7 +108,7 @@ public:
virtual void setSurface
(
const meshedSurf& s,
bool parallel = Pstream::parRun()
bool parallel
); // override
//- Change association with a surface (no-op).
......@@ -116,7 +116,7 @@ public:
(
const pointField& points,
const faceList& faces,
bool parallel = Pstream::parRun()
bool parallel
); // override
......
......@@ -185,6 +185,12 @@ Foam::surfaceWriter::surfaceWriter
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfaceWriter::~surfaceWriter()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::surfaceWriter::setTime(const instant& inst)
......@@ -264,6 +270,31 @@ void Foam::surfaceWriter::open
}
void Foam::surfaceWriter::open
(
const meshedSurf& surf,
const fileName& outputPath
)
{
close();
setSurface(surf, parallel_);
open(outputPath);
}
void Foam::surfaceWriter::open
(
const pointField& points,
const faceList& faces,
const fileName& outputPath
)
{
close();
setSurface(points, faces, parallel_);
open(outputPath);
}
void Foam::surfaceWriter::close()
{
outputPath_.clear();
......@@ -286,6 +317,7 @@ void Foam::surfaceWriter::setSurface
{
expire();
surf_ = std::cref<meshedSurf>(surf);
parallel_ = (parallel && Pstream::parRun());
}
......@@ -301,6 +333,25 @@ void Foam::surfaceWriter::setSurface
}
void Foam::surfaceWriter::setSurface
(
const meshedSurf& surf
)
{
setSurface(surf, parallel_);
}
void Foam::surfaceWriter::setSurface
(
const pointField& points,
const faceList& faces
)
{
setSurface(points, faces, parallel_);
}
bool Foam::surfaceWriter::needsUpdate() const
{
return !upToDate_;
......
......@@ -261,7 +261,7 @@ public:
//- Destructor
virtual ~surfaceWriter() = default;
virtual ~surfaceWriter();
// Member Functions
......@@ -301,19 +301,36 @@ public:
// Surface association
//- Change association with a surface and expire the writer
//- Change association with a surface, expire the writer
//- with defined parallel/serial treatment
virtual void setSurface
(
const meshedSurf& surf,
bool parallel = Pstream::parRun()
bool parallel
);
//- Change association with a surface and expire the writer
//- Change association with a surface, expire the writer
//- with defined parallel/serial treatment
virtual void setSurface
(
const pointField& points,
const faceList& faces,
bool parallel = Pstream::parRun()
bool parallel
);
//- Change association with a surface, expire the writer
//- with the current parallel/serial treatment
virtual void setSurface
(
const meshedSurf& surf
);
//- Change association with a surface, expire the writer
//- with the current parallel/serial treatment
virtual void setSurface
(
const pointField& points,
const faceList& faces
);
......@@ -407,7 +424,7 @@ public:
const pointField& points,
const faceList& faces,
const fileName& outputPath,
bool parallel = Pstream::parRun()
bool parallel
);
//- Open from components
......@@ -415,7 +432,22 @@ public:
(
const meshedSurf& surf,
const fileName& outputPath,
bool parallel = Pstream::parRun()
bool parallel
);
//- Open from components, with the current parallel/serial treatment
virtual void open
(
const pointField& points,
const faceList& faces,
const fileName& outputPath
);
//- Open from components, with the current parallel/serial treatment
virtual void open
(
const meshedSurf& surf,
const fileName& outputPath
);
//- Finish output, performing any necessary cleanup
......
......@@ -150,6 +150,12 @@ Foam::surfaceWriters::vtkWriter::vtkWriter
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfaceWriters::vtkWriter::~vtkWriter()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::surfaceWriters::vtkWriter::close()
......
......@@ -159,7 +159,7 @@ public:
//- Destructor
virtual ~vtkWriter() = default;
virtual ~vtkWriter();
// Member Functions
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment