diff --git a/src/catalyst/foamVtkFaMeshAdaptorGeom.C b/src/catalyst/foamVtkFaMeshAdaptorGeom.C index 30962c2f16653374ca673e7f08f7798289c01a38..29d34ab02adc542f072d48aa9bb8d757509dc817 100644 --- a/src/catalyst/foamVtkFaMeshAdaptorGeom.C +++ b/src/catalyst/foamVtkFaMeshAdaptorGeom.C @@ -62,7 +62,6 @@ void Foam::vtk::faMeshAdaptor::convertGeometryInternal() } } - if (!vtkgeom) { if (debug) diff --git a/src/catalyst/foamVtkFvMeshAdaptor.C b/src/catalyst/foamVtkFvMeshAdaptor.C index 0684207c6b313269586edff162f3878676fb240b..beb45d82fa4c7c582a22bab6ccbeb573844d82fd 100644 --- a/src/catalyst/foamVtkFvMeshAdaptor.C +++ b/src/catalyst/foamVtkFvMeshAdaptor.C @@ -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 } diff --git a/src/catalyst/foamVtkFvMeshAdaptor.H b/src/catalyst/foamVtkFvMeshAdaptor.H index 8253e41b05f4d274c25c102f9ed5b91611e57561..35969eb31ed8845d2abab31810670b4249b3ea82 100644 --- a/src/catalyst/foamVtkFvMeshAdaptor.H +++ b/src/catalyst/foamVtkFvMeshAdaptor.H @@ -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; diff --git a/src/catalyst/foamVtkFvMeshAdaptorFields.C b/src/catalyst/foamVtkFvMeshAdaptorFields.C index a06466335541507bec2a9e35d7e5d8f4f127f471..1db58fef52184a5bd503d91849ab38053aee3c4c 100644 --- a/src/catalyst/foamVtkFvMeshAdaptorFields.C +++ b/src/catalyst/foamVtkFvMeshAdaptorFields.C @@ -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. diff --git a/src/catalyst/foamVtkFvMeshAdaptorGeom.C b/src/catalyst/foamVtkFvMeshAdaptorGeom.C index 202274fd5263215c22a2c535e05ae56204e35d8a..e84652b73a38cdf93aa60a51c4f6a1c51486269b 100644 --- a/src/catalyst/foamVtkFvMeshAdaptorGeom.C +++ b/src/catalyst/foamVtkFvMeshAdaptorGeom.C @@ -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); }