From 35a2db86dfd4738036d86cf035195b85acb01a5c Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 28 Sep 2024 15:20:50 -0400 Subject: [PATCH 01/10] Remove dead code. --- Common/DataModel/vtkCellGridSidesQuery.cxx | 29 ---------------------- 1 file changed, 29 deletions(-) diff --git a/Common/DataModel/vtkCellGridSidesQuery.cxx b/Common/DataModel/vtkCellGridSidesQuery.cxx index 4b61e96e819..40965a53e2f 100644 --- a/Common/DataModel/vtkCellGridSidesQuery.cxx +++ b/Common/DataModel/vtkCellGridSidesQuery.cxx @@ -74,35 +74,6 @@ bool vtkCellGridSidesQuery::Finalize() return true; } -#if 0 -void vtkCellGridSidesQuery::SummarizeSides() -{ - this->Sides.clear(); -#ifdef VTK_DBG_SUMMARIZE_SIDES - std::cout << "Hash table\n"; - for (const auto& entry : this->Hashes) - { - std::cout << " " << std::hex << entry.first << std::dec << "\n"; - for (const auto& side : entry.second.Sides) - { - std::cout << " " << side.CellType.Data() << " " << side.SideShape.Data() << ": " << side.DOF << " " << side.SideId << "\n"; - } - } -#endif - for (const auto& entry : this->Hashes) - { - if (entry.second.Sides.size() % 2 == 0) - { - continue; // Do not output matching pairs of sides. - } - for (const auto& ss : entry.second.Sides) - { - this->Sides[ss.CellType][ss.SideShape][ss.DOF].insert(ss.SideId); - } - } -} -#endif // 0 - std::vector vtkCellGridSidesQuery::GetSideSetArrays( vtkStringToken cellType) { -- GitLab From d6dedf1aaf32345a8b78db257a79c469c7a0f766 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 28 Sep 2024 15:21:01 -0400 Subject: [PATCH 02/10] =?UTF-8?q?Add=20methods=20for=20ParaView=20client-s?= =?UTF-8?q?erver=20access=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … to the cell-grid "Compute Sides" filter so that the summarization strategy and selection style can be set by users. --- Common/DataModel/vtkCellGridSidesQuery.h | 10 ++++++++++ Filters/CellGrid/vtkCellGridComputeSides.h | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/Common/DataModel/vtkCellGridSidesQuery.h b/Common/DataModel/vtkCellGridSidesQuery.h index aecf57e131d..fe18cf92990 100644 --- a/Common/DataModel/vtkCellGridSidesQuery.h +++ b/Common/DataModel/vtkCellGridSidesQuery.h @@ -192,6 +192,11 @@ public: void SetStrategyToWinding() { this->SetStrategy(SummaryStrategy::Winding); } void SetStrategyToAnyOccurrence() { this->SetStrategy(SummaryStrategy::AnyOccurrence); } void SetStrategyToBoundary() { this->SetStrategy(SummaryStrategy::Boundary); } + /// This method exists for ParaView to set the strategy. + virtual void SetStrategy(int strategy) + { + this->SetStrategy(static_cast(strategy)); + } /// Set/get whether the extracted sides should be marked as selectable /// or whether their originating data should be selectable. @@ -205,6 +210,11 @@ public: /// Other values indicate the generated output sides should be selected. vtkSetEnumMacro(SelectionType, SelectionMode); vtkGetEnumMacro(SelectionType, SelectionMode); + /// This method exists for ParaView to set the selection mode. + virtual void SetSelectionType(int selnType) + { + this->SetSelectionType(static_cast(selnType)); + } bool Initialize() override; void StartPass() override; diff --git a/Filters/CellGrid/vtkCellGridComputeSides.h b/Filters/CellGrid/vtkCellGridComputeSides.h index 1fc18603d2a..5b5a805a081 100644 --- a/Filters/CellGrid/vtkCellGridComputeSides.h +++ b/Filters/CellGrid/vtkCellGridComputeSides.h @@ -71,6 +71,11 @@ public: /// Set/get the strategy used to determine which input sides appear in the output. virtual void SetStrategy(SummaryStrategy strategy); SummaryStrategy GetStrategy(); + /// This method exists for ParaView to set the strategy. + virtual void SetStrategy(int strategy) + { + this->SetStrategy(static_cast(strategy)); + } /// Re-export the bit-values that SetOutputDimensionControl accepts. using SelectionMode = vtkCellGridSidesQuery::SelectionMode; @@ -81,6 +86,11 @@ public: /// this filter are picked by a user. virtual void SetSelectionType(SelectionMode selectionType); SelectionMode GetSelectionType(); + /// This method exists for ParaView to set the selection mode. + virtual void SetSelectionType(int selnType) + { + this->SetSelectionType(static_cast(selnType)); + } static vtkStringToken GetSideAttribute(); -- GitLab From 2826dd74c0c75ee9d68ef16015993512d120a3a7 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 28 Sep 2024 20:37:24 -0400 Subject: [PATCH 03/10] =?UTF-8?q?Split=20the=20cell-grid=20sides=20query?= =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … into a cache object and the query that uses the cache. This will allow other filters to use cached sides (specifically the forthcoming vtkCellGridCrinkleCleaver). --- Common/DataModel/CMakeLists.txt | 1 + Common/DataModel/vtkCellGrid.cxx | 3 + Common/DataModel/vtkCellGridSidesCache.cxx | 54 ++++++ Common/DataModel/vtkCellGridSidesCache.h | 166 ++++++++++++++++++ Common/DataModel/vtkCellGridSidesQuery.cxx | 57 +++++- Common/DataModel/vtkCellGridSidesQuery.h | 173 +++---------------- Filters/CellGrid/vtkCellGridComputeSides.cxx | 11 ++ Filters/CellGrid/vtkDGSidesResponder.cxx | 10 +- 8 files changed, 313 insertions(+), 162 deletions(-) create mode 100644 Common/DataModel/vtkCellGridSidesCache.cxx create mode 100644 Common/DataModel/vtkCellGridSidesCache.h diff --git a/Common/DataModel/CMakeLists.txt b/Common/DataModel/CMakeLists.txt index 5c6d3caf96b..98631ffbe1e 100644 --- a/Common/DataModel/CMakeLists.txt +++ b/Common/DataModel/CMakeLists.txt @@ -44,6 +44,7 @@ set(classes vtkCellGridRangeQuery vtkCellGridQuery vtkCellGridResponders + vtkCellGridSidesCache vtkCellGridSidesQuery vtkCellIterator vtkCellLinks diff --git a/Common/DataModel/vtkCellGrid.cxx b/Common/DataModel/vtkCellGrid.cxx index 93c09c394b8..9196b27bedf 100644 --- a/Common/DataModel/vtkCellGrid.cxx +++ b/Common/DataModel/vtkCellGrid.cxx @@ -99,6 +99,7 @@ void vtkCellGrid::ShallowCopy(vtkDataObject* baseSrc) return; } + this->Initialize(); vtkNew copier; copier->SetSource(src); copier->SetTarget(this); @@ -123,6 +124,7 @@ void vtkCellGrid::DeepCopy(vtkDataObject* baseSrc) return; } + this->Initialize(); vtkNew copier; copier->SetSource(src); copier->SetTarget(this); @@ -140,6 +142,7 @@ void vtkCellGrid::DeepCopy(vtkDataObject* baseSrc) bool vtkCellGrid::CopyStructure(vtkCellGrid* other, bool byReference) { + this->Initialize(); vtkNew copier; copier->SetSource(other); copier->SetTarget(this); diff --git a/Common/DataModel/vtkCellGridSidesCache.cxx b/Common/DataModel/vtkCellGridSidesCache.cxx new file mode 100644 index 00000000000..a95a649efc0 --- /dev/null +++ b/Common/DataModel/vtkCellGridSidesCache.cxx @@ -0,0 +1,54 @@ +// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen +// SPDX-License-Identifier: BSD-3-Clause +#include "vtkCellGridSidesCache.h" + +#include "vtkBoundingBox.h" +#include "vtkIdTypeArray.h" +#include "vtkMath.h" +#include "vtkObjectFactory.h" + +#include +#include + +#define VTK_DBG_MAX_HASHES 1024 + +VTK_ABI_NAMESPACE_BEGIN + +using namespace vtk::literals; + +vtkStandardNewMacro(vtkCellGridSidesCache); + +void vtkCellGridSidesCache::PrintSelf(ostream& os, vtkIndent indent) +{ + this->Superclass::PrintSelf(os, indent); + os << indent << "Hashes: " << this->Hashes.size() << " entries\n"; + vtkIndent i2 = indent.GetNextIndent(); + vtkIndent i3 = i2.GetNextIndent(); + int numPrinted = 0; + for (const auto& keyVal : this->Hashes) + { + os << i2 << std::hex << keyVal.first << std::dec << " (" << keyVal.second.Sides.size() << ")\n"; + for (const auto& side : keyVal.second.Sides) + { + os << i3 << side.CellType.Data() << " " << side.SideShape.Data() << " start id " << side.DOF + << " side " << side.SideId << "\n"; + } + ++numPrinted; + if (numPrinted > VTK_DBG_MAX_HASHES) + { + if (this->Hashes.size() > static_cast(numPrinted)) + { + os << i2 << "... and " << (this->Hashes.size() - numPrinted) << " more.\n"; + } + break; + } + } +} + +void vtkCellGridSidesCache::Initialize() +{ + this->Hashes.clear(); + this->Modified(); +} + +VTK_ABI_NAMESPACE_END diff --git a/Common/DataModel/vtkCellGridSidesCache.h b/Common/DataModel/vtkCellGridSidesCache.h new file mode 100644 index 00000000000..2a3e9882a4e --- /dev/null +++ b/Common/DataModel/vtkCellGridSidesCache.h @@ -0,0 +1,166 @@ +// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen +// SPDX-License-Identifier: BSD-3-Clause + +#ifndef vtkCellGridSidesCache_h +#define vtkCellGridSidesCache_h + +#include "vtkObject.h" + +#include "vtkCommonDataModelModule.h" // For export macro. +#include "vtkHashCombiner.h" // For templated AddSide() method. +#include "vtkStringToken.h" // For API. + +#include +#include +#include +#include +#include + +VTK_ABI_NAMESPACE_BEGIN + +class vtkIdTypeArray; + +/** + * @class vtkCellGridSidesCache + * @brief Hold a map from hash-ids (representing sides of cells of multiple types) + * to details on the cells that claim the corresponding side. + * + * This class is created by filters such as vtkCellGridComputeSides and + * vtkCellGridExtractCrinkle; it can be re-used by the same filter and + * any others that process the same input (since it is stored in a + * cache available to them). + */ +class VTKCOMMONDATAMODEL_EXPORT vtkCellGridSidesCache : public vtkObject +{ +public: + static vtkCellGridSidesCache* New(); + vtkTypeMacro(vtkCellGridSidesCache, vtkObject); + void PrintSelf(ostream& os, vtkIndent indent) override; + + /// Records held by a hash-entry that represent the side of one cell. + /// + /// All instances of Side owned by a single hash-entry have the same + /// hash but correspond to distinct sides of different cells. + struct Side + { + /// The type of cell whose side is hashed. + vtkStringToken CellType; + /// The shape of the side being hashed. + vtkStringToken SideShape; + /// The degree of freedom starting the hash sequence. + vtkIdType DOF; + /// The ID of the side being hashed. + int SideId; + + /// Compare side-hashes to allow set insertion. + bool operator<(const Side& other) const + { + return (this->CellType < other.CellType) || + (this->CellType == other.CellType && + ((this->DOF < other.DOF) || (this->DOF == other.DOF && this->SideId < other.SideId))); + } + }; + + /// Each hash entry corresponds to one or more sides of one or more cells. + struct Entry + { + std::set Sides; + }; + + /// Return the map of hashed side information. + std::unordered_map& GetHashes() { return this->Hashes; } + + /// Compute the hash of a side (but do not insert a side into the map). + template + std::size_t HashSide(vtkStringToken shape, const C& conn) + { + std::size_t ss = 0; + std::size_t NN = conn.size(); + if (NN == 0) + { + return 0; + } + + T smin = conn[0]; + for (std::size_t jj = 1; jj < NN; ++jj) + { + if (conn[jj] < smin) + { + smin = conn[jj]; + ss = jj; + } + } + bool forward = conn[(ss + 1) % NN] > conn[(ss + NN - 1) % NN]; + + std::size_t hashedValue = std::hash{}(NN); + vtkHashCombiner()(hashedValue, shape.GetId()); + // std::cout << "Hash(" << (forward ? "F" : "R") << ")"; + if (forward) + { + for (std::size_t ii = 0; ii < NN; ++ii) + { + std::size_t hashedToken = std::hash{}(conn[(ss + ii) % NN]); + vtkHashCombiner()(hashedValue, hashedToken); + // std::cout << " " << conn[(ss + ii) % NN]; + } + } + else // backward + { + for (std::size_t ii = 0; ii < NN; ++ii) + { + std::size_t hashedToken = std::hash{}(conn[(ss + NN - ii) % NN]); + // hashedValue = hashedValue ^ (hashedToken << (ii + 1)); + vtkHashCombiner()(hashedValue, hashedToken); + // std::cout << " " << conn[(ss + NN - ii) % NN]; + } + } + // std::cout << " = " << std::hex << hashedValue << std::dec << "\n"; + return hashedValue; + } + + /// Add a \a side with the given \a shape and connectivity to the request's state. + /// + /// The \a shape, \a conn size, and \a conn entries are hashed together into a key + /// which is mapped to a set of all the matching sides. + /// The \a cellType and \a cell ID are also stored with each matching side; these + /// are used during Finalize() to generate the output map-of-maps returned + /// by GetSides() so that the sides are reported by cell type, cell ID, and then side ID. + /// + /// Note that the \a conn entries are hashed in a particular canonical order so + /// that the same hash is generated for sides with point IDs that have been shifted + /// and/or reversed. + /// The hash always starts at the smallest entry of \a conn and goes + /// in the direction that has the largest next entry. + /// Examples: + /// (3, 2, 0, 1) → starts at index 2 (0) and hashes backwards: (0, 2, 3, 1) + /// (4, 5, 6, 7) → starts at index 0 (4) and hashes backwards: (4, 7, 6, 5) + /// (7, 3, 6, 2) → starts at index 3 (2) and hashes forwards: (2, 7, 3, 6) + // + /// By storing the \a cellType, we avoid requiring a global-to-local cell numbering + /// in vtkCellGrid instances (as vtkPolyData incurs) which may hold multiple types of cells. + //@{ + template + void AddSide( + vtkStringToken cellType, vtkIdType cell, int side, vtkStringToken shape, const C& conn) + { + auto hashedValue = this->HashSide(shape, conn); + this->Hashes[hashedValue].Sides.insert(Side{ cellType, shape, cell, side }); + } + //@} + + /// Empty the cache of all hashes. + void Initialize(); + +protected: + vtkCellGridSidesCache() = default; + ~vtkCellGridSidesCache() override = default; + + std::unordered_map Hashes; + +private: + vtkCellGridSidesCache(const vtkCellGridSidesCache&) = delete; + void operator=(const vtkCellGridSidesCache&) = delete; +}; + +VTK_ABI_NAMESPACE_END +#endif // vtkCellGridSidesCache_h diff --git a/Common/DataModel/vtkCellGridSidesQuery.cxx b/Common/DataModel/vtkCellGridSidesQuery.cxx index 40965a53e2f..6172354d1c0 100644 --- a/Common/DataModel/vtkCellGridSidesQuery.cxx +++ b/Common/DataModel/vtkCellGridSidesQuery.cxx @@ -3,6 +3,7 @@ #include "vtkCellGridSidesQuery.h" #include "vtkBoundingBox.h" +#include "vtkCellGridSidesCache.h" #include "vtkIdTypeArray.h" #include "vtkMath.h" #include "vtkObjectFactory.h" @@ -10,19 +11,21 @@ #include #include -// Uncomment the next line for debug printouts. -// #define VTK_DBG_SUMMARIZE_SIDES 1 - VTK_ABI_NAMESPACE_BEGIN using namespace vtk::literals; vtkStandardNewMacro(vtkCellGridSidesQuery); +vtkCellGridSidesQuery::~vtkCellGridSidesQuery() +{ + this->SetSideCache(nullptr); +} + void vtkCellGridSidesQuery::PrintSelf(ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os, indent); - os << indent << "Hashes: " << this->Hashes.size() << "\n"; + os << indent << "SideCache: " << this->SideCache << "\n"; os << indent << "Sides: " << this->Sides.size() << "\n"; os << indent << "PreserveRenderableInputs: " << (this->PreserveRenderableInputs ? "Y" : "N") << "\n"; @@ -42,7 +45,26 @@ void vtkCellGridSidesQuery::PrintSelf(ostream& os, vtkIndent indent) bool vtkCellGridSidesQuery::Initialize() { bool ok = this->Superclass::Initialize(); // Reset Pass number. - this->Hashes.clear(); + // If we don't have a side-cache, make one as responders should be able to + // assume it exists. But warn if we have to create one; this is really the + // job of the filter. + if (!this->SideCache) + { + this->TemporarySideCache = true; + auto* sideCache = vtkCellGridSidesCache::New(); + this->SideCache = sideCache; + vtkWarningMacro("No side cache was provided; creating a temporary."); + } + else + { + // If the cache is older than the query, reset the cache. + // Otherwise, allow responders to skip hashing their sides. + if (this->GetMTime() > this->SideCache->GetMTime()) + { + this->SideCache->Initialize(); + } + } + return ok; } @@ -70,7 +92,11 @@ bool vtkCellGridSidesQuery::IsAnotherPassRequired() bool vtkCellGridSidesQuery::Finalize() { this->Sides.clear(); - this->Hashes.clear(); + if (this->TemporarySideCache) + { + this->SideCache->Delete(); + this->SideCache = nullptr; + } return true; } @@ -189,4 +215,23 @@ vtkCellGridSidesQuery::SummaryStrategy vtkCellGridSidesQuery::SummaryStrategyFro #endif } +void vtkCellGridSidesQuery::SetSideCache(vtkCellGridSidesCache* cache) +{ + if (this->SideCache == cache) + { + return; + } + if (this->SideCache) + { + this->SideCache->Delete(); + } + this->SideCache = cache; + this->TemporarySideCache = !cache; + if (this->SideCache) + { + this->SideCache->Register(this); + } + this->Modified(); +} + VTK_ABI_NAMESPACE_END diff --git a/Common/DataModel/vtkCellGridSidesQuery.h b/Common/DataModel/vtkCellGridSidesQuery.h index fe18cf92990..13ba6afea76 100644 --- a/Common/DataModel/vtkCellGridSidesQuery.h +++ b/Common/DataModel/vtkCellGridSidesQuery.h @@ -22,6 +22,7 @@ VTK_ABI_NAMESPACE_BEGIN class vtkIdTypeArray; +class vtkCellGridSidesCache; /**\brief A cell-grid query for enumerating sides of cells. * @@ -70,10 +71,10 @@ public: enum PassWork : int { /// Responders should call AddSide() on each cell's sides to insert - /// entries into this->Hashes. + /// entries into this->SideCache. HashSides = 0, - /// Responders should claim entries in this->Hashes by transcribing them - /// to this->Sides and then deleting the entry in this->Hashes to prevent + /// Responders should claim entries in this->SideCache by transcribing them + /// to this->Sides and then deleting the entry in this->SideCache to prevent /// multiple responders from processing them. Summarize = 1, /// Responders should insert new side sets into their parent cell-grid @@ -107,36 +108,6 @@ public: Output //!< Output sides should be selected when they are picked. }; - /// Records held by a hash-entry that represent the side of one cell. - /// - /// All instances of Side owned by a single hash-entry have the same - /// hash but correspond to distinct sides of different cells. - struct Side - { - /// The type of cell whose side is hashed. - vtkStringToken CellType; - /// The shape of the side being hashed. - vtkStringToken SideShape; - /// The degree of freedom starting the hash sequence. - vtkIdType DOF; - /// The ID of the side being hashed. - int SideId; - - /// Compare side-hashes to allow set insertion. - bool operator<(const Side& other) const - { - return (this->CellType < other.CellType) || - (this->CellType == other.CellType && - ((this->DOF < other.DOF) || (this->DOF == other.DOF && this->SideId < other.SideId))); - } - }; - - /// Each hash entry corresponds to one or more sides of one or more cells. - struct Entry - { - std::set Sides; - }; - /// A structure created by the GetSideSetArrays() method for responders to use. struct SideSetArray { @@ -184,7 +155,7 @@ public: vtkBooleanMacro(OutputDimensionControl, int); /// Set/get the strategy responders should use to generate entries in - /// Sides from entries in Hashes. + /// Sides from entries in SideCache. /// /// The default is BoundaryStrategy. vtkSetEnumMacro(Strategy, SummaryStrategy); @@ -221,129 +192,12 @@ public: bool IsAnotherPassRequired() override; bool Finalize() override; - /// Return the map of hashed side information. - /// - /// This is public so that responders may edit it - /// during the PassWork::Summarize pass. - std::unordered_map& GetHashes() { return this->Hashes; } - std::unordered_map>>>& GetSides() { return this->Sides; } - // std::map>>& GetSides() { return - // this->Sides; } - - /// Add a \a side with the given \a shape and connectivity to the request's state. - /// - /// The \a shape, \a conn size, and \a conn entries are hashed together into a key - /// which is mapped to a set of all the matching sides. - /// The \a cellType and \a cell ID are also stored with each matching side; these - /// are used during Finalize() to generate the output map-of-maps returned - /// by GetSides() so that the sides are reported by cell type, cell ID, and then side ID. - /// - /// Note that the \a conn entries are hashed in a particular canonical order so - /// that the same hash is generated for sides with point IDs that have been shifted - /// and/or reversed. - /// The hash always starts at the smallest entry of \a conn and goes - /// in the direction that has the largest next entry. - /// Examples: - /// (3, 2, 0, 1) → starts at index 2 (0) and hashes backwards: (0, 2, 3, 1) - /// (4, 5, 6, 7) → starts at index 0 (4) and hashes backwards: (4, 7, 6, 5) - /// (7, 3, 6, 2) → starts at index 3 (2) and hashes forwards: (2, 7, 3, 6) - // - /// By storing the \a cellType, we avoid requiring a global-to-local cell numbering - /// in vtkCellGrid instances (as vtkPolyData incurs) which may hold multiple types of cells. - //@{ - template - void AddSide(vtkStringToken cellType, vtkIdType cell, int side, vtkStringToken shape, - const std::array& conn) - { - // Find where we should start hashing and in what direction. - std::size_t ss = 0; - T smin = conn[0]; - for (std::size_t jj = 1; jj < NN; ++jj) - { - if (conn[jj] < smin) - { - smin = conn[jj]; - ss = jj; - } - } - bool forward = conn[(ss + 1) % NN] > conn[(ss + NN - 1) % NN]; - - std::size_t hashedValue = std::hash{}(NN); - vtkHashCombiner()(hashedValue, shape.GetId()); - if (forward) - { - for (std::size_t ii = 0; ii < NN; ++ii) - { - std::size_t hashedToken = std::hash{}(conn[(ss + ii) % NN]); - vtkHashCombiner()(hashedValue, hashedToken); - } - } - else // backward - { - for (std::size_t ii = 0; ii < NN; ++ii) - { - std::size_t hashedToken = std::hash{}(conn[(ss + NN - ii) % NN]); - // hashedValue = hashedValue ^ (hashedToken << (ii + 1)); - vtkHashCombiner()(hashedValue, hashedToken); - } - } - this->Hashes[hashedValue].Sides.insert(Side{ cellType, shape, cell, side }); - } - - template - void AddSide(vtkStringToken cellType, vtkIdType cell, int side, vtkStringToken shape, - const std::vector& conn) - { - std::size_t ss = 0; - std::size_t NN = conn.size(); - if (NN == 0) - { - return; - } - - T smin = conn[0]; - for (std::size_t jj = 1; jj < NN; ++jj) - { - if (conn[jj] < smin) - { - smin = conn[jj]; - ss = jj; - } - } - bool forward = conn[(ss + 1) % NN] > conn[(ss + NN - 1) % NN]; - - std::size_t hashedValue = std::hash{}(NN); - vtkHashCombiner()(hashedValue, shape.GetId()); - // std::cout << "Hash(" << (forward ? "F" : "R") << ")"; - if (forward) - { - for (std::size_t ii = 0; ii < NN; ++ii) - { - std::size_t hashedToken = std::hash{}(conn[(ss + ii) % NN]); - vtkHashCombiner()(hashedValue, hashedToken); - // std::cout << " " << conn[(ss + ii) % NN]; - } - } - else // backward - { - for (std::size_t ii = 0; ii < NN; ++ii) - { - std::size_t hashedToken = std::hash{}(conn[(ss + NN - ii) % NN]); - // hashedValue = hashedValue ^ (hashedToken << (ii + 1)); - vtkHashCombiner()(hashedValue, hashedToken); - // std::cout << " " << conn[(ss + NN - ii) % NN]; - } - } - // std::cout << " = " << std::hex << hashedValue << std::dec << "\n"; - this->Hashes[hashedValue].Sides.insert(Side{ cellType, shape, cell, side }); - } - //@} /// Return arrays of cell+side IDs for the given \a cellType. std::vector GetSideSetArrays(vtkStringToken cellType); @@ -356,16 +210,29 @@ public: static vtkStringToken SummaryStrategyToLabel(SummaryStrategy strategy); static SummaryStrategy SummaryStrategyFromLabel(vtkStringToken token); + /// Set/get cached hashtable of sides. + /// + /// The idea is that vtkCellGridSidesCache is generic enough to accommodate + /// a wide variety of cell types and that many of them will be capable of + /// having sides that are conformal to cells of different types that may + /// reside in the same cell-grid. Filters may own this cache or they may + /// attach it to a collection of cell-grid objects that participate by inserting + /// their cells' sides into the cache. (For example, all the cell-grids within + /// a partitioned dataset collection may wish to insert sides in the same cache.) + vtkGetObjectMacro(SideCache, vtkCellGridSidesCache); + virtual void SetSideCache(vtkCellGridSidesCache* cache); + protected: vtkCellGridSidesQuery() = default; - ~vtkCellGridSidesQuery() override = default; + ~vtkCellGridSidesQuery() override; vtkTypeBool PreserveRenderableInputs{ false }; vtkTypeBool OmitSidesForRenderableInputs{ false }; int OutputDimensionControl{ SideFlags::SurfacesOfInputs }; SelectionMode SelectionType{ SelectionMode::Input }; SummaryStrategy Strategy{ SummaryStrategy::Boundary }; - std::unordered_map Hashes; + vtkCellGridSidesCache* SideCache{ nullptr }; + bool TemporarySideCache{ false }; std::unordered_map>>> Sides; diff --git a/Filters/CellGrid/vtkCellGridComputeSides.cxx b/Filters/CellGrid/vtkCellGridComputeSides.cxx index 37e4d1643ac..aab56303760 100644 --- a/Filters/CellGrid/vtkCellGridComputeSides.cxx +++ b/Filters/CellGrid/vtkCellGridComputeSides.cxx @@ -3,6 +3,7 @@ #include "vtkCellGridComputeSides.h" +#include "vtkCellGridSidesCache.h" #include "vtkCellGridSidesQuery.h" #include "vtkDataSetAttributes.h" #include "vtkFiltersCellGrid.h" // for RegisterCellsAndResponders() @@ -20,6 +21,12 @@ vtkStandardNewMacro(vtkCellGridComputeSides); vtkCellGridComputeSides::vtkCellGridComputeSides() { vtkFiltersCellGrid::RegisterCellsAndResponders(); + // For now, just keep the cached data on the filter. + // Eventually, a side-cache should be stored in the + // vtkCellGridResponders map of cached objects with + // a key appropriate to the input data object. + vtkNew sideCache; + this->Request->SetSideCache(sideCache); } void vtkCellGridComputeSides::PrintSelf(ostream& os, vtkIndent indent) @@ -118,6 +125,10 @@ int vtkCellGridComputeSides::RequestData( return 0; } output->ShallowCopy(input); + // TODO: For now, always reset the side cache. + // In the future, the cache should invalidate + // itself as the query parameters are modified. + this->Request->GetSideCache()->Initialize(); if (!output->Query(this->Request)) { vtkErrorMacro("Input failed to respond to query."); diff --git a/Filters/CellGrid/vtkDGSidesResponder.cxx b/Filters/CellGrid/vtkDGSidesResponder.cxx index 9886f6cb30c..26a94df6b8a 100644 --- a/Filters/CellGrid/vtkDGSidesResponder.cxx +++ b/Filters/CellGrid/vtkDGSidesResponder.cxx @@ -6,6 +6,7 @@ #include "vtkCellAttribute.h" #include "vtkCellGrid.h" #include "vtkCellGridBoundsQuery.h" +#include "vtkCellGridSidesCache.h" #include "vtkDGCell.h" #include "vtkDataSetAttributes.h" #include "vtkIdTypeArray.h" @@ -68,6 +69,7 @@ bool vtkDGSidesResponder::HashSides(vtkCellGridSidesQuery* query, vtkDGCell* cel entry.resize(nc); int numSideTypes = cellType->GetNumberOfSideTypes(); + auto* sideCache = query->GetSideCache(); if (!cellSpec.Blanked) { // int minSideDim = cellType->GetDimension() - 1; // We only care about sides of dimension d-1. @@ -136,7 +138,7 @@ bool vtkDGSidesResponder::HashSides(vtkCellGridSidesQuery* query, vtkDGCell* cel } } // Hash the sideIdx'th side of element ii and add it to the query's storage. - query->AddSide(cellTypeToken, ii, sideIdx, shapeName, side); + sideCache->AddSide(cellTypeToken, ii, sideIdx, shapeName, side); } } } @@ -191,7 +193,7 @@ bool vtkDGSidesResponder::HashSides(vtkCellGridSidesQuery* query, vtkDGCell* cel bool vtkDGSidesResponder::SummarizeSides(vtkCellGridSidesQuery* query, vtkDGCell* cellType) { - auto& hashes = query->GetHashes(); + auto& hashes = query->GetSideCache()->GetHashes(); auto& sides = query->GetSides(); vtkStringToken cellTypeToken(cellType->GetClassName()); @@ -452,6 +454,7 @@ void vtkDGSidesResponder::HashSidesOfSide(vtkCellGridSidesQuery* query, vtkDGCel const std::vector& sidesToHash, vtkIdType cellId, const std::vector& entry, std::set& sidesVisited, vtkDataArray* ngm) { + auto* sideCache = query->GetSideCache(); vtkStringToken cellTypeToken = cellType->GetClassName(); for (const auto& sideId : sidesToHash) { @@ -504,7 +507,8 @@ void vtkDGSidesResponder::HashSidesOfSide(vtkCellGridSidesQuery* query, vtkDGCel } } // Hash the sideId'th side of cellId and add it to the query's storage. - query->AddSide(cellTypeToken, cellId, sideId, vtkDGCell::GetShapeName(sideOfSideShape), side); + sideCache->AddSide( + cellTypeToken, cellId, sideId, vtkDGCell::GetShapeName(sideOfSideShape), side); } // Regardless of whether we hashed the side, compute any child sides and recurse const auto& childSides = cellType->GetSidesOfSide(sideId); -- GitLab From b1f67872508765ac18373a293da23c8322191d79 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 28 Sep 2024 21:54:47 -0400 Subject: [PATCH 04/10] Fix the vertex cell-grid source. + The shape function must have a function space named "constant". + Also, the "point" array-group is renamed "points" to match the group name for the point coordinates so that HGRAD values are shown in the array editor. + Finally, the centers of all sides (not just the edges) are glyphed when rendering glyphs to better illustrate the vector fields in the CellGridSource application. + Make Ctrl+Q a shortcut to quit the example CellGridSource app. --- .../GUI/Qt/CellGridSource/CellGridSource.cxx | 16 ++++++++++++-- Filters/CellGrid/vtkDGCellSourceResponder.cxx | 21 ++++++++++++++----- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Examples/GUI/Qt/CellGridSource/CellGridSource.cxx b/Examples/GUI/Qt/CellGridSource/CellGridSource.cxx index 2588302e8e0..b3e5aaf4daf 100644 --- a/Examples/GUI/Qt/CellGridSource/CellGridSource.cxx +++ b/Examples/GUI/Qt/CellGridSource/CellGridSource.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -209,12 +210,16 @@ int main(int argc, char* argv[]) bdyActor->GetProperty()->SetRepresentationToSurface(); bdyActor->SetVisibility(false); // Turn off initially. + vtkNew centerSides; vtkNew centers; vtkNew ugridCvt; vtkNew glyMapper; vtkNew arrow; vtkNew glyActor; - centers->SetInputConnection(cellEdges->GetOutputPort()); + centerSides->SetInputDataObject(0, cellSource->GetOutput()); + centerSides->SetOutputDimensionControl(vtkCellGridSidesQuery::SideFlags::AllSides); + centerSides->OmitSidesForRenderableInputsOff(); + centers->SetInputConnection(centerSides->GetOutputPort()); ugridCvt->SetInputConnection(centers->GetOutputPort()); glyMapper->SetInputConnection(ugridCvt->GetOutputPort()); glyMapper->OrientOn(); @@ -237,7 +242,12 @@ int main(int argc, char* argv[]) // Re-render upon each user edit of a cell-grid data-array: QObject::connect(&model, &ArrayGroupModel::dataChanged, - [&vtkRenderWidget]() { vtkRenderWidget->renderWindow()->Render(); }); + [&vtkRenderWidget, &cellEdges, ¢erSides]() + { + cellEdges->Modified(); + centerSides->Modified(); + vtkRenderWidget->renderWindow()->Render(); + }); QObject::connect(&bdyBtn, &QCheckBox::toggled, [&](bool enabled) @@ -277,6 +287,8 @@ int main(int argc, char* argv[]) updateGlyphSources(cellSource, &glySelector); updateArrayGroups(model, cellSource, &arrayGroupSelector, false); + QShortcut exitKey(QKeySequence("Ctrl+Q"), &mainWindow); + QObject::connect(&exitKey, &QShortcut::activated, [&]() { app.exit(); }); mainWindow.show(); return app.exec(); diff --git a/Filters/CellGrid/vtkDGCellSourceResponder.cxx b/Filters/CellGrid/vtkDGCellSourceResponder.cxx index ff61189ffd5..97ed73aed0a 100644 --- a/Filters/CellGrid/vtkDGCellSourceResponder.cxx +++ b/Filters/CellGrid/vtkDGCellSourceResponder.cxx @@ -107,11 +107,22 @@ bool vtkDGCellSourceResponder::Query( grid->SetShapeAttribute(shape); // clang-format off - this->CreateCellAttribute( - dgCell, cellTypeToken, - "hgrad", "ℝ³", 3, - "HGRAD"_token, "C"_token, 1, - dgCell->GetNumberOfSidesOfDimension(0) * 3, 1, "point"_token); + if (cellTypeToken == "vtkDGVert"_token) + { + this->CreateCellAttribute( + dgCell, cellTypeToken, + "constant", "ℝ³", 3, + "constant"_token, "C"_token, 0, + 3, 1, "points"_token); + } + else + { + this->CreateCellAttribute( + dgCell, cellTypeToken, + "hgrad", "ℝ³", 3, + "HGRAD"_token, "C"_token, 1, + dgCell->GetNumberOfSidesOfDimension(0) * 3, 1, "points"_token); + } // clang-format on if (dgCell->IsA("vtkDeRhamCell")) { -- GitLab From f2882f360ab54eb6a9949c4b958c437e5003e6e4 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 30 Sep 2024 14:49:39 -0400 Subject: [PATCH 05/10] =?UTF-8?q?Fix=20the=20cell-grid=20side=20filter?= =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … so it is marked modified when the query parameters for Strategy and SelectionType are changed. --- Common/DataModel/vtkCellGridSidesQuery.h | 15 ++++--------- Filters/CellGrid/vtkCellGridComputeSides.cxx | 22 ++++++++++++++++++++ Filters/CellGrid/vtkCellGridComputeSides.h | 10 ++------- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/Common/DataModel/vtkCellGridSidesQuery.h b/Common/DataModel/vtkCellGridSidesQuery.h index 13ba6afea76..622a470750c 100644 --- a/Common/DataModel/vtkCellGridSidesQuery.h +++ b/Common/DataModel/vtkCellGridSidesQuery.h @@ -1,17 +1,11 @@ // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen // SPDX-License-Identifier: BSD-3-Clause -/** - * @class vtkCellGridSidesQuery - * @brief Compute external faces of a cell-grid. - */ - #ifndef vtkCellGridSidesQuery_h #define vtkCellGridSidesQuery_h #include "vtkCellGridQuery.h" -#include "vtkHashCombiner.h" // For templated AddSide() method. -#include "vtkStringToken.h" // For API. +#include "vtkStringToken.h" // For API. #include #include @@ -21,8 +15,8 @@ VTK_ABI_NAMESPACE_BEGIN -class vtkIdTypeArray; class vtkCellGridSidesCache; +class vtkIdTypeArray; /**\brief A cell-grid query for enumerating sides of cells. * @@ -31,9 +25,8 @@ class vtkCellGridSidesCache; * + In the first pass, responders invoke the AddSides() method on * this query, entries are added to this->Hashes storage indicating * the cells which are bounded by a given shape + connectivity. - * + In the second pass, responders consume the entries created above - * (removing them as they are processed) and replace them with - * entries in this->Sides. This reorganizes the hashes into groups + * + In the second pass, responders mark the entries created above and + * add entries in this->Sides. This reorganizes the hashes into groups * more amenable to output as side arrays. This pass is called * "Summarization," since not every input side identified will be * output. diff --git a/Filters/CellGrid/vtkCellGridComputeSides.cxx b/Filters/CellGrid/vtkCellGridComputeSides.cxx index aab56303760..810e3e5ee6c 100644 --- a/Filters/CellGrid/vtkCellGridComputeSides.cxx +++ b/Filters/CellGrid/vtkCellGridComputeSides.cxx @@ -104,6 +104,28 @@ vtkCellGridComputeSides::SelectionMode vtkCellGridComputeSides::GetSelectionType return this->Request->GetSelectionType(); } +void vtkCellGridComputeSides::SetStrategy(int strategy) +{ + auto strat = static_cast(strategy); + if (strat == this->GetStrategy()) + { + return; + } + this->SetStrategy(strat); + this->Modified(); +} + +void vtkCellGridComputeSides::SetSelectionType(int selnType) +{ + auto stype = static_cast(selnType); + if (stype == this->GetSelectionType()) + { + return; + } + this->SetSelectionType(stype); + this->Modified(); +} + vtkStringToken vtkCellGridComputeSides::GetSideAttribute() { return vtkStringToken("Sides"); diff --git a/Filters/CellGrid/vtkCellGridComputeSides.h b/Filters/CellGrid/vtkCellGridComputeSides.h index 5b5a805a081..3a2cb909250 100644 --- a/Filters/CellGrid/vtkCellGridComputeSides.h +++ b/Filters/CellGrid/vtkCellGridComputeSides.h @@ -72,10 +72,7 @@ public: virtual void SetStrategy(SummaryStrategy strategy); SummaryStrategy GetStrategy(); /// This method exists for ParaView to set the strategy. - virtual void SetStrategy(int strategy) - { - this->SetStrategy(static_cast(strategy)); - } + virtual void SetStrategy(int strategy); /// Re-export the bit-values that SetOutputDimensionControl accepts. using SelectionMode = vtkCellGridSidesQuery::SelectionMode; @@ -87,10 +84,7 @@ public: virtual void SetSelectionType(SelectionMode selectionType); SelectionMode GetSelectionType(); /// This method exists for ParaView to set the selection mode. - virtual void SetSelectionType(int selnType) - { - this->SetSelectionType(static_cast(selnType)); - } + virtual void SetSelectionType(int selnType); static vtkStringToken GetSideAttribute(); -- GitLab From bbf053df8f69afaec79a947ddd68849c4b6604c8 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 30 Sep 2024 16:17:23 -0400 Subject: [PATCH 06/10] Allow empty output in cell-grid to unstructured-grid conversion. --- .../vtkCellGridToUnstructuredGrid.cxx | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/Filters/CellGrid/vtkCellGridToUnstructuredGrid.cxx b/Filters/CellGrid/vtkCellGridToUnstructuredGrid.cxx index b5ce97b0fa1..e35ddb2e22c 100644 --- a/Filters/CellGrid/vtkCellGridToUnstructuredGrid.cxx +++ b/Filters/CellGrid/vtkCellGridToUnstructuredGrid.cxx @@ -126,20 +126,23 @@ void vtkCellGridToUnstructuredGrid::Query::StartPass() array->FillComponent(jj, 0.); } } - // Invert the connectivity counts into weights: - vtkIdType np = this->ConnectivityCount.rbegin()->first + 1; - this->ConnectivityWeights.resize(np, 0.); - vtkSMPTools::For(0, np, - [this](vtkIdType begin, vtkIdType end) - { - for (vtkIdType ii = begin; ii < end; ++ii) + if (!this->ConnectivityCount.empty()) + { + // Invert the connectivity counts into weights: + vtkIdType np = this->ConnectivityCount.rbegin()->first + 1; + this->ConnectivityWeights.resize(np, 0.); + vtkSMPTools::For(0, np, + [this](vtkIdType begin, vtkIdType end) { - auto it = this->ConnectivityCount.find(ii); - this->ConnectivityWeights[ii] = - (it == this->ConnectivityCount.end() ? 1.0 : 1.0 / it->second); - } - }); - this->ConnectivityCount.clear(); + for (vtkIdType ii = begin; ii < end; ++ii) + { + auto it = this->ConnectivityCount.find(ii); + this->ConnectivityWeights[ii] = + (it == this->ConnectivityCount.end() ? 1.0 : 1.0 / it->second); + } + }); + this->ConnectivityCount.clear(); + } } break; default: -- GitLab From 745d6439382115d83a0ab0a086eb3bdb73259dd6 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 30 Sep 2024 16:17:46 -0400 Subject: [PATCH 07/10] Glyph vectors at cell center as well as side centers. --- .../GUI/Qt/CellGridSource/CellGridSource.cxx | 67 +++++++++++++------ 1 file changed, 46 insertions(+), 21 deletions(-) diff --git a/Examples/GUI/Qt/CellGridSource/CellGridSource.cxx b/Examples/GUI/Qt/CellGridSource/CellGridSource.cxx index b3e5aaf4daf..66c7f212496 100644 --- a/Examples/GUI/Qt/CellGridSource/CellGridSource.cxx +++ b/Examples/GUI/Qt/CellGridSource/CellGridSource.cxx @@ -211,39 +211,60 @@ int main(int argc, char* argv[]) bdyActor->SetVisibility(false); // Turn off initially. vtkNew centerSides; - vtkNew centers; + vtkNew sideCenters; vtkNew ugridCvt; - vtkNew glyMapper; + vtkNew glyMapperCC; + vtkNew glyMapperSC; vtkNew arrow; - vtkNew glyActor; + vtkNew glyActorCC; + vtkNew glyActorSC; centerSides->SetInputDataObject(0, cellSource->GetOutput()); centerSides->SetOutputDimensionControl(vtkCellGridSidesQuery::SideFlags::AllSides); centerSides->OmitSidesForRenderableInputsOff(); - centers->SetInputConnection(centerSides->GetOutputPort()); - ugridCvt->SetInputConnection(centers->GetOutputPort()); - glyMapper->SetInputConnection(ugridCvt->GetOutputPort()); - glyMapper->OrientOn(); - glyMapper->SetOrientationArray("curl"); - glyMapper->SetSourceConnection(arrow->GetOutputPort()); - glyMapper->ScalingOn(); - glyMapper->SetScaleMode(vtkGlyph3DMapper::SCALE_BY_MAGNITUDE); - glyMapper->SetScaleArray("curl"); - glyMapper->SetScaleFactor(1.); - glyActor->SetMapper(glyMapper); - glyActor->SetVisibility(false); + sideCenters->SetInputConnection(centerSides->GetOutputPort()); + ugridCvt->SetInputConnection(sideCenters->GetOutputPort()); + // Put arrows at side centers + glyMapperSC->SetInputConnection(ugridCvt->GetOutputPort()); + glyMapperSC->OrientOn(); + glyMapperSC->SetOrientationArray("curl"); + glyMapperSC->SetSourceConnection(arrow->GetOutputPort()); + glyMapperSC->ScalingOn(); + glyMapperSC->SetScaleMode(vtkGlyph3DMapper::SCALE_BY_MAGNITUDE); + glyMapperSC->SetScaleArray("curl"); + glyMapperSC->SetScaleFactor(1.); + glyActorSC->SetMapper(glyMapperSC); + glyActorSC->SetVisibility(false); + + vtkNew cellCenters; + vtkNew ugridCvtCC; + cellCenters->SetInputConnection(cellSource->GetOutputPort()); + ugridCvtCC->SetInputConnection(cellCenters->GetOutputPort()); + // Put arrows at cell center + glyMapperCC->SetInputConnection(ugridCvtCC->GetOutputPort()); + glyMapperCC->OrientOn(); + glyMapperCC->SetOrientationArray("curl"); + glyMapperCC->SetSourceConnection(arrow->GetOutputPort()); + glyMapperCC->ScalingOn(); + glyMapperCC->SetScaleMode(vtkGlyph3DMapper::SCALE_BY_MAGNITUDE); + glyMapperCC->SetScaleArray("curl"); + glyMapperCC->SetScaleFactor(1.); + glyActorCC->SetMapper(glyMapperCC); + glyActorCC->SetVisibility(false); vtkNew renderer; renderer->AddActor(actor); renderer->AddActor(bdyActor); - renderer->AddActor(glyActor); + renderer->AddActor(glyActorCC); + renderer->AddActor(glyActorSC); renderer->ResetCamera(); window->AddRenderer(renderer); // Re-render upon each user edit of a cell-grid data-array: QObject::connect(&model, &ArrayGroupModel::dataChanged, - [&vtkRenderWidget, &cellEdges, ¢erSides]() + [&vtkRenderWidget, &cellEdges, ¢erSides, &cellCenters]() { + cellCenters->Modified(); cellEdges->Modified(); centerSides->Modified(); vtkRenderWidget->renderWindow()->Render(); @@ -262,13 +283,17 @@ int main(int argc, char* argv[]) { if (text == QString("–none–")) { - glyActor->SetVisibility(false); + glyActorCC->SetVisibility(false); + glyActorSC->SetVisibility(false); } else { - glyActor->SetVisibility(true); - glyMapper->SetOrientationArray(text.toStdString().c_str()); - glyMapper->SetScaleArray(text.toStdString().c_str()); + glyActorCC->SetVisibility(true); + glyActorSC->SetVisibility(true); + glyMapperCC->SetOrientationArray(text.toStdString().c_str()); + glyMapperCC->SetScaleArray(text.toStdString().c_str()); + glyMapperSC->SetOrientationArray(text.toStdString().c_str()); + glyMapperSC->SetScaleArray(text.toStdString().c_str()); } vtkRenderWidget->renderWindow()->Render(); }); -- GitLab From c9373f8e4b9b412708ab2cb2d3caef9bb06604b6 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 30 Sep 2024 17:34:58 -0400 Subject: [PATCH 08/10] Add descriptions for some VTK modules. --- Filters/Hybrid/vtk.module | 2 ++ Filters/Modeling/vtk.module | 2 ++ Filters/OpenTURNS/vtk.module | 2 ++ Filters/Parallel/vtk.module | 2 ++ Filters/ParallelDIY2/vtk.module | 2 ++ Filters/ParallelFlowPaths/vtk.module | 2 ++ Filters/ParallelGeometry/vtk.module | 2 ++ Filters/ParallelImaging/vtk.module | 2 ++ Filters/ParallelMPI/vtk.module | 2 ++ Filters/ParallelStatistics/vtk.module | 2 ++ Filters/ParallelVerdict/vtk.module | 2 ++ Filters/Points/vtk.module | 2 ++ Filters/Programmable/vtk.module | 2 ++ Filters/Python/vtk.module | 2 ++ Filters/Reduction/vtk.module | 2 ++ Filters/ReebGraph/vtk.module | 2 ++ Filters/SMP/vtk.module | 2 ++ Filters/Selection/vtk.module | 2 ++ Filters/Sources/vtk.module | 2 ++ Filters/Statistics/vtk.module | 2 ++ Filters/Temporal/vtk.module | 2 ++ Filters/Texture/vtk.module | 2 ++ Filters/Topology/vtk.module | 2 ++ GUISupport/MFC/vtk.module | 2 ++ GUISupport/Qt/vtk.module | 2 ++ GUISupport/QtQuick/vtk.module | 2 ++ GUISupport/QtSQL/vtk.module | 2 ++ Geovis/Core/vtk.module | 2 ++ Geovis/GDAL/vtk.module | 2 ++ Serialization/Manager/vtk.module | 2 ++ Testing/Core/vtk.module | 2 ++ Testing/DataModel/vtk.module | 2 ++ Testing/GenericBridge/vtk.module | 2 ++ Testing/IOSQL/vtk.module | 2 ++ Testing/Rendering/vtk.module | 2 ++ 35 files changed, 70 insertions(+) diff --git a/Filters/Hybrid/vtk.module b/Filters/Hybrid/vtk.module index 5e700346fdc..681bd148ba8 100644 --- a/Filters/Hybrid/vtk.module +++ b/Filters/Hybrid/vtk.module @@ -4,6 +4,8 @@ LIBRARY_NAME vtkFiltersHybrid GROUPS StandAlone +DESCRIPTION + Filters that process both regular (image) and unstructured data. SPDX_LICENSE_IDENTIFIER LicenseRef-BSD-3-Clause-Sandia-USGov SPDX_COPYRIGHT_TEXT diff --git a/Filters/Modeling/vtk.module b/Filters/Modeling/vtk.module index f258572d83b..a89da1e8902 100644 --- a/Filters/Modeling/vtk.module +++ b/Filters/Modeling/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Filters GROUPS StandAlone +DESCRIPTION + Geometric modeling tools for VTK. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/OpenTURNS/vtk.module b/Filters/OpenTURNS/vtk.module index 1b5c7986f28..25b979f46f1 100644 --- a/Filters/OpenTURNS/vtk.module +++ b/Filters/OpenTURNS/vtk.module @@ -4,6 +4,8 @@ LIBRARY_NAME vtkFiltersOpenTURNS IMPLEMENTS VTK::ChartsCore +DESCRIPTION + Filters that depend on the OpenTURNS library for uncertainty quantification. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/Parallel/vtk.module b/Filters/Parallel/vtk.module index a0c236a3464..4ddcbff72a4 100644 --- a/Filters/Parallel/vtk.module +++ b/Filters/Parallel/vtk.module @@ -9,6 +9,8 @@ KIT VTK::Parallel GROUPS StandAlone +DESCRIPTION + Filters that work in a distributed-memory environment. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/ParallelDIY2/vtk.module b/Filters/ParallelDIY2/vtk.module index d08d647fa09..ed50a172e3e 100644 --- a/Filters/ParallelDIY2/vtk.module +++ b/Filters/ParallelDIY2/vtk.module @@ -7,6 +7,8 @@ KIT IMPLEMENTS VTK::FiltersCore VTK::FiltersParallel +DESCRIPTION + Filters that use the DIY MPI library to perform tasks in a distributed-memory environment. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/ParallelFlowPaths/vtk.module b/Filters/ParallelFlowPaths/vtk.module index 782ced12d7c..991e7b9563f 100644 --- a/Filters/ParallelFlowPaths/vtk.module +++ b/Filters/ParallelFlowPaths/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Parallel IMPLEMENTS VTK::FiltersFlowPaths +DESCRIPTION + Filters that trace particles in a distributed-memory parallel environment. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/ParallelGeometry/vtk.module b/Filters/ParallelGeometry/vtk.module index a420ca4f9b2..a6617fc3440 100644 --- a/Filters/ParallelGeometry/vtk.module +++ b/Filters/ParallelGeometry/vtk.module @@ -8,6 +8,8 @@ GROUPS MPI IMPLEMENTS VTK::FiltersCore +DESCRIPTION + Filters for distributed-memory processing of geometric data. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/ParallelImaging/vtk.module b/Filters/ParallelImaging/vtk.module index 8d09a746b26..368e8cb580c 100644 --- a/Filters/ParallelImaging/vtk.module +++ b/Filters/ParallelImaging/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Parallel GROUPS StandAlone +DESCRIPTION + Filters that perform image processing in distributed-memory parallel environments. SPDX_LICENSE_IDENTIFIER LicenseRef-BSD-3-Clause-Sandia-USGov SPDX_COPYRIGHT_TEXT diff --git a/Filters/ParallelMPI/vtk.module b/Filters/ParallelMPI/vtk.module index c3135faea32..99203bdde86 100644 --- a/Filters/ParallelMPI/vtk.module +++ b/Filters/ParallelMPI/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Parallel GROUPS MPI +DESCRIPTION + Distributed-memory algorithms that require the message-passing interface (MPI) library. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/ParallelStatistics/vtk.module b/Filters/ParallelStatistics/vtk.module index 81feaa38049..25fa8a6c5bf 100644 --- a/Filters/ParallelStatistics/vtk.module +++ b/Filters/ParallelStatistics/vtk.module @@ -4,6 +4,8 @@ LIBRARY_NAME vtkFiltersParallelStatistics KIT VTK::Parallel +DESCRIPTION + Filters to compute statistics in distributed-memory parallel environments. SPDX_LICENSE_IDENTIFIER LicenseRef-BSD-3-Clause-Sandia-USGov SPDX_COPYRIGHT_TEXT diff --git a/Filters/ParallelVerdict/vtk.module b/Filters/ParallelVerdict/vtk.module index 9fac482648d..c7d19153c70 100644 --- a/Filters/ParallelVerdict/vtk.module +++ b/Filters/ParallelVerdict/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Parallel GROUPS MPI +DESCRIPTION + Parallel mesh-quality computation. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/Points/vtk.module b/Filters/Points/vtk.module index c3630de2fdd..0bbc6540878 100644 --- a/Filters/Points/vtk.module +++ b/Filters/Points/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Filters GROUPS StandAlone +DESCRIPTION + Filters for point-cloud processing. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/Programmable/vtk.module b/Filters/Programmable/vtk.module index 916edbed86d..a4e5c7c3d63 100644 --- a/Filters/Programmable/vtk.module +++ b/Filters/Programmable/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Filters GROUPS StandAlone +DESCRIPTION + Filters that accept user input at run-time to process VTK data. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/Python/vtk.module b/Filters/Python/vtk.module index c4b01340671..1317e96e8a3 100644 --- a/Filters/Python/vtk.module +++ b/Filters/Python/vtk.module @@ -6,6 +6,8 @@ CONDITION VTK_WRAP_PYTHON GROUPS StandAlone +DESCRIPTION + Provide a python base class for writing VTK algorithms in python. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/Reduction/vtk.module b/Filters/Reduction/vtk.module index 6eb31dc5a4b..c9a4fe87d29 100644 --- a/Filters/Reduction/vtk.module +++ b/Filters/Reduction/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Filters GROUPS StandAlone +DESCRIPTION + Tools to convert explicit (tabular) arrays into implicit (procedural) arrays, which can reduce memory consumption. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/ReebGraph/vtk.module b/Filters/ReebGraph/vtk.module index 53531b5ec8c..f8fa4aae5bd 100644 --- a/Filters/ReebGraph/vtk.module +++ b/Filters/ReebGraph/vtk.module @@ -4,6 +4,8 @@ LIBRARY_NAME vtkFiltersReebGraph KIT VTK::Filters +DESCRIPTION + Compute Reeb graphs of VTK data. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/SMP/vtk.module b/Filters/SMP/vtk.module index 281c8875f59..d87c36e25d6 100644 --- a/Filters/SMP/vtk.module +++ b/Filters/SMP/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Filters GROUPS StandAlone +DESCRIPTION + Filters that take advantage of symmetric multiprocessing (SMP) for speed. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/Selection/vtk.module b/Filters/Selection/vtk.module index 3c687836d83..058556a8b6d 100644 --- a/Filters/Selection/vtk.module +++ b/Filters/Selection/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Filters GROUPS StandAlone +DESCRIPTION + Filters to create and process selections of VTK data. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/Sources/vtk.module b/Filters/Sources/vtk.module index 663757b24f9..fa7ded451df 100644 --- a/Filters/Sources/vtk.module +++ b/Filters/Sources/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Filters GROUPS StandAlone +DESCRIPTION + Filters that construct VTK data from scratch. SPDX_LICENSE_IDENTIFIER LicenseRef-BSD-3-Clause-Sandia-USGov SPDX_COPYRIGHT_TEXT diff --git a/Filters/Statistics/vtk.module b/Filters/Statistics/vtk.module index 37d58520309..1b154b16daf 100644 --- a/Filters/Statistics/vtk.module +++ b/Filters/Statistics/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Filters GROUPS StandAlone +DESCRIPTION + Compute statistics of VTK data. SPDX_LICENSE_IDENTIFIER LicenseRef-BSD-3-Clause-Sandia-USGov SPDX_COPYRIGHT_TEXT diff --git a/Filters/Temporal/vtk.module b/Filters/Temporal/vtk.module index 80eba9d8f0a..42203b25d22 100644 --- a/Filters/Temporal/vtk.module +++ b/Filters/Temporal/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Filters GROUPS StandAlone +DESCRIPTION + Filters that process time-varying data. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/Texture/vtk.module b/Filters/Texture/vtk.module index 3f8bc653b0d..c48c79596ee 100644 --- a/Filters/Texture/vtk.module +++ b/Filters/Texture/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Filters GROUPS StandAlone +DESCRIPTION + Utilities to aid with texture-mapping of VTK data. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Filters/Topology/vtk.module b/Filters/Topology/vtk.module index bfc890e5fa8..0b9fc84f66b 100644 --- a/Filters/Topology/vtk.module +++ b/Filters/Topology/vtk.module @@ -6,6 +6,8 @@ KIT VTK::Filters GROUPS StandAlone +DESCRIPTION + Topological analysis of VTK data objects. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/GUISupport/MFC/vtk.module b/GUISupport/MFC/vtk.module index 9a3611287eb..9339bbd109a 100644 --- a/GUISupport/MFC/vtk.module +++ b/GUISupport/MFC/vtk.module @@ -2,6 +2,8 @@ NAME VTK::GUISupportMFC LIBRARY_NAME vtkGUISupportMFC +DESCRIPTION + Make VTK available to Microsoft MFC applications. CONDITION MSVC SPDX_LICENSE_IDENTIFIER diff --git a/GUISupport/Qt/vtk.module b/GUISupport/Qt/vtk.module index c8243c67453..eef34418950 100644 --- a/GUISupport/Qt/vtk.module +++ b/GUISupport/Qt/vtk.module @@ -2,6 +2,8 @@ NAME VTK::GUISupportQt LIBRARY_NAME vtkGUISupportQt +DESCRIPTION + Make VTK render-windows, interactors, and widgets available to Qt applications. GROUPS Qt SPDX_LICENSE_IDENTIFIER diff --git a/GUISupport/QtQuick/vtk.module b/GUISupport/QtQuick/vtk.module index 5f4f64a0803..de107ad5cd0 100644 --- a/GUISupport/QtQuick/vtk.module +++ b/GUISupport/QtQuick/vtk.module @@ -4,6 +4,8 @@ LIBRARY_NAME vtkGUISupportQtQuick GROUPS Qt +DESCRIPTION + Make VTK render-windows and interactors available in Qt Quick applications. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/GUISupport/QtSQL/vtk.module b/GUISupport/QtSQL/vtk.module index 471570a8938..129d8d067f6 100644 --- a/GUISupport/QtSQL/vtk.module +++ b/GUISupport/QtSQL/vtk.module @@ -2,6 +2,8 @@ NAME VTK::GUISupportQtSQL LIBRARY_NAME vtkGUISupportQtSQL +DESCRIPTION + Adapt Qt's SQL interface to VTK's vtkSQLDatabase. GROUPS Qt SPDX_LICENSE_IDENTIFIER diff --git a/Geovis/Core/vtk.module b/Geovis/Core/vtk.module index e783c4fa9b5..d42219b7867 100644 --- a/Geovis/Core/vtk.module +++ b/Geovis/Core/vtk.module @@ -2,6 +2,8 @@ NAME VTK::GeovisCore LIBRARY_NAME vtkGeovisCore +DESCRIPTION + Core functionality for geospatial visualizations, such as spherical projections. GROUPS Rendering SPDX_LICENSE_IDENTIFIER diff --git a/Geovis/GDAL/vtk.module b/Geovis/GDAL/vtk.module index 9fd967fe65f..5aa7a25a8b4 100644 --- a/Geovis/GDAL/vtk.module +++ b/Geovis/GDAL/vtk.module @@ -2,6 +2,8 @@ NAME VTK::GeovisGDAL LIBRARY_NAME vtkGeovisGDAL +DESCRIPTION + Geospatial reprojection filters that use GDAL. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Serialization/Manager/vtk.module b/Serialization/Manager/vtk.module index 22c02a5f963..3d559b5108b 100644 --- a/Serialization/Manager/vtk.module +++ b/Serialization/Manager/vtk.module @@ -2,6 +2,8 @@ NAME VTK::SerializationManager LIBRARY_NAME vtkSerializationManager +DESCRIPTION + Manage object serialization and deserialization utilities. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Testing/Core/vtk.module b/Testing/Core/vtk.module index d919fc1f6c2..3e276b3412a 100644 --- a/Testing/Core/vtk.module +++ b/Testing/Core/vtk.module @@ -2,6 +2,8 @@ NAME VTK::TestingCore LIBRARY_NAME vtkTestingCore +DESCRIPTION + Core classes for regression and unit testing of VTK. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Testing/DataModel/vtk.module b/Testing/DataModel/vtk.module index 129d7944d72..8f3d4a80df5 100644 --- a/Testing/DataModel/vtk.module +++ b/Testing/DataModel/vtk.module @@ -2,6 +2,8 @@ NAME VTK::TestingDataModel LIBRARY_NAME vtkTestingDataModel +DESCRIPTION + Utilities to aid testing of VTK::CommonDataModel classes. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Testing/GenericBridge/vtk.module b/Testing/GenericBridge/vtk.module index de443b381e0..a7ff392972f 100644 --- a/Testing/GenericBridge/vtk.module +++ b/Testing/GenericBridge/vtk.module @@ -2,6 +2,8 @@ NAME VTK::TestingGenericBridge LIBRARY_NAME vtkTestingGenericBridge +DESCRIPTION + An adaptor that presents vtkDataSet instances as vtkGenericDataSet instances for testing. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT diff --git a/Testing/IOSQL/vtk.module b/Testing/IOSQL/vtk.module index 95ae207842f..13c86f599c0 100644 --- a/Testing/IOSQL/vtk.module +++ b/Testing/IOSQL/vtk.module @@ -2,6 +2,8 @@ NAME VTK::TestingIOSQL LIBRARY_NAME vtkTestingIOSQL +DESCRIPTION + Facilities for testing SQL database functionality in VTK. PRIVATE_DEPENDS VTK::IOSQL SPDX_LICENSE_IDENTIFIER diff --git a/Testing/Rendering/vtk.module b/Testing/Rendering/vtk.module index 53024a8e2a0..c8df16f9759 100644 --- a/Testing/Rendering/vtk.module +++ b/Testing/Rendering/vtk.module @@ -4,6 +4,8 @@ LIBRARY_NAME vtkTestingRendering GROUPS Rendering +DESCRIPTION + Utilities for testing VTK by rendering and image comparison. SPDX_LICENSE_IDENTIFIER BSD-3-Clause SPDX_COPYRIGHT_TEXT -- GitLab From e80b8c7201a813d34df23f082903997c0aba914b Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 2 Oct 2024 15:06:37 -0400 Subject: [PATCH 09/10] Fix bad exclusion. --- .gitlab/ci/ctest_exclusions.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/ci/ctest_exclusions.cmake b/.gitlab/ci/ctest_exclusions.cmake index 0dbb24f9a25..27fc784a0b2 100644 --- a/.gitlab/ci/ctest_exclusions.cmake +++ b/.gitlab/ci/ctest_exclusions.cmake @@ -1,6 +1,6 @@ set(test_exclusions # Flaky when run with threads enabled. See #19471. - "^VTK::FiltersCellGridPython-TestCellGridRange$" + "^VTK::FiltersCellGridCxx-TestCellGridEvaluator$" # https://gitlab.kitware.com/vtk/vtk/-/issues/19427 "^VTK::RenderingOpenGL2Cxx-TestGlyph3DMapperPickability$") -- GitLab From 311d988fd20adb3aa0f9f24603f95bbfe227f61e Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 3 Oct 2024 09:20:19 -0400 Subject: [PATCH 10/10] Fix TestCellGridRange on older Windows platforms. --- .../CellGrid/Testing/Python/TestCellGridRange.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Filters/CellGrid/Testing/Python/TestCellGridRange.py b/Filters/CellGrid/Testing/Python/TestCellGridRange.py index ad7793c3ab5..f5225e7ad49 100644 --- a/Filters/CellGrid/Testing/Python/TestCellGridRange.py +++ b/Filters/CellGrid/Testing/Python/TestCellGridRange.py @@ -8,6 +8,17 @@ from vtkmodules import vtkIOCellGrid as io from vtkmodules.test import Testing import os +# Avoid Unicode console output on Windows: +L1n='L1 norm' +L2n='L2 norm' +try: + import platform + if platform.system() != 'Windows': + L1n='L₁ norm' + L2n='L₂ norm' +finally: + pass + class TestCellGridRange(Testing.vtkTest): def setUp(self): @@ -42,7 +53,7 @@ class TestCellGridRange(Testing.vtkTest): for comp in range(numComp + 2): cr = [1, -1] self.source.GetCellAttributeRange(attribute, comp - 2, cr, True) - compName = 'L₂ norm' if comp == 0 else 'L₁ norm' if comp == 1 else '%d' % (comp - 2) + compName = L2n if comp == 0 else L1n if comp == 1 else '%d' % (comp - 2) print(' %s: [ %g, %g ]' % (compName, cr[0], cr[1])) if comp - 2 in expectedComponentRanges: expectedRange = expectedComponentRanges[comp - 2] -- GitLab