Commit f2c8e739 authored by Mark Olesen's avatar Mark Olesen

BUG: faulty logic for caching patch geometries

parent fe0560fc
......@@ -62,7 +62,6 @@ void Foam::vtk::faMeshAdaptor::convertGeometryInternal()
}
}
if (!vtkgeom)
{
if (debug)
......
......@@ -76,24 +76,24 @@ Foam::vtk::fvMeshAdaptor::fvMeshAdaptor
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::vtk::fvMeshAdaptor::channels(const wordList& names)
void Foam::vtk::fvMeshAdaptor::channels(const wordList& chanNames)
{
unsigned selected = 0;
for (const word& chan : names)
unsigned chanIds = 0;
for (const word& chan : chanNames)
{
if (channelNames.found(chan))
{
selected |= channelNames[chan];
chanIds |= channelNames[chan];
}
}
channels(selected);
channels(chanIds);
}
void Foam::vtk::fvMeshAdaptor::channels(unsigned channels)
void Foam::vtk::fvMeshAdaptor::channels(unsigned chanIds)
{
channels_ = (channels & 0x3);
channels_ = (chanIds & 0x3);
if (!usingVolume())
{
......@@ -107,17 +107,23 @@ void Foam::vtk::fvMeshAdaptor::channels(unsigned channels)
}
Foam::label Foam::vtk::fvMeshAdaptor::channels() const
{
return label(channels_);
}
bool Foam::vtk::fvMeshAdaptor::usingVolume() const
{
// MESH = "internal"
return ((channels_ & INPUT) || (channels_ & MESH));
return (channels_ & (INPUT | MESH));
}
bool Foam::vtk::fvMeshAdaptor::usingPatches() const
{
// PATCHES
return ((channels_ & INPUT) || (channels_ & PATCHES));
return (channels_ & (INPUT | PATCHES));
}
......@@ -235,6 +241,7 @@ Foam::vtk::fvMeshAdaptor::output(const wordRes& select)
auto iter = cachedVtu_.find(longName);
if (!iter.found() || !iter.object().dataset)
{
Pout<<"Cache miss for VTU " << longName << endl;
break; // Should never happen
}
......@@ -275,6 +282,7 @@ Foam::vtk::fvMeshAdaptor::output(const wordRes& select)
auto iter = cachedVtp_.find(longName);
if (!iter.found() || !iter.object().dataset)
{
Pout<<"Cache miss for VTP patch " << longName << endl;
break; // Should never happen
}
......
......@@ -272,10 +272,13 @@ public:
// Member Functions
//- Define the output channels by name
void channels(const wordList& names);
void channels(const wordList& chanNames);
//- Define the output channels by value
void channels(unsigned channels);
void channels(unsigned chanIds);
//- Return the selected output channel ids
label channels() const;
//- True if MESH channel is being used
bool usingVolume() const;
......
......@@ -2,8 +2,8 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......
......@@ -2,8 +2,8 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
......@@ -86,8 +86,6 @@ void Foam::vtk::fvMeshAdaptor::convertGeometryInternal()
void Foam::vtk::fvMeshAdaptor::convertGeometryPatches()
{
HashSet<string> currentPatchNames;
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
const label npatches = this->nPatches();
......@@ -139,6 +137,9 @@ void Foam::vtk::fvMeshAdaptor::convertGeometryPatches()
// Store good patch id as additionalIds
vtpData.additionalIds() = {patchId};
// This is somewhat inconsistent, since we currently only have
// normal (non-grouped) patches but this may change in the future.
vtkgeom = vtk::Tools::Patch::mesh(patches[patchId]);
if (vtkgeom)
......@@ -147,14 +148,10 @@ void Foam::vtk::fvMeshAdaptor::convertGeometryPatches()
}
else
{
// Catch any problems
cachedVtp_.erase(longName);
}
currentPatchNames.insert(longName);
}
// Remove any old junk
cachedVtp_.retain(currentPatchNames);
}
......
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