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

This commit is contained in:
Mark Olesen
2019-02-22 10:21:01 +01:00
parent b1679a4081
commit 3390103285
5 changed files with 99 additions and 10 deletions

View File

@ -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

View File

@ -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_;

View File

@ -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

View File

@ -150,6 +150,12 @@ Foam::surfaceWriters::vtkWriter::vtkWriter
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfaceWriters::vtkWriter::~vtkWriter()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::surfaceWriters::vtkWriter::close()

View File

@ -159,7 +159,7 @@ public:
//- Destructor
virtual ~vtkWriter() = default;
virtual ~vtkWriter();
// Member Functions