From 76c32d8d3664e8f8b98d15b9233c6fc5f4e9b3ba Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 17 May 2021 13:46:19 -0400 Subject: [PATCH 001/136] clang-tidy: fix `readability-use-anyofallof` lints --- smtk/common/Generator.h | 13 +++++-------- smtk/resource/Properties.h | 17 +++++++++-------- smtk/resource/filter/Rule.h | 15 +++++++-------- smtk/resource/filter/Rules.h | 13 +++++-------- 4 files changed, 26 insertions(+), 32 deletions(-) diff --git a/smtk/common/Generator.h b/smtk/common/Generator.h index 772ad90084..2a3b7c1236 100644 --- a/smtk/common/Generator.h +++ b/smtk/common/Generator.h @@ -13,6 +13,7 @@ #include "smtk/common/CompilerInformation.h" +#include #include #include #include @@ -181,14 +182,10 @@ bool Generator::valid(const Input& input) const { return false; } - for (auto gen : *gens) - { - if (gen->valid(input)) - { - return true; - } - } - return false; + return std::any_of( + gens->begin(), gens->end(), [&input](const GeneratorBase* gen) { + return gen->valid(input); + }); } template diff --git a/smtk/resource/Properties.h b/smtk/resource/Properties.h index ce60892365..90c6c876c8 100644 --- a/smtk/resource/Properties.h +++ b/smtk/resource/Properties.h @@ -17,6 +17,8 @@ #include "smtk/common/json/jsonUUID.h" +#include + namespace smtk { namespace resource @@ -183,14 +185,13 @@ public: /// Check if any properties of this type are associated with m_id. bool empty() const { - for (auto& pair : m_properties.data()) - { - if (pair.second.find(m_id) != pair.second.end()) - { - return false; - } - } - return true; + using PropertyDataMap = + std::unordered_map>; + const PropertyDataMap& data = m_properties.data(); + return std::all_of( + data.begin(), data.end(), [this](const typename PropertyDataMap::value_type& pair) { + return pair.second.find(m_id) == pair.second.end(); + }); } std::set keys() const diff --git a/smtk/resource/filter/Rule.h b/smtk/resource/filter/Rule.h index c70af31c8a..80238c5658 100644 --- a/smtk/resource/filter/Rule.h +++ b/smtk/resource/filter/Rule.h @@ -12,6 +12,8 @@ #include "smtk/resource/PersistentObject.h" +#include + namespace smtk { namespace resource @@ -43,14 +45,11 @@ public: bool operator()(const PersistentObject& object) const override { - for (const auto& key : acceptableKeys(object)) - { - if (acceptableValue(object.properties().at(key))) - { - return true; - } - } - return false; + auto acceptable = acceptableKeys(object); + return std::any_of( + acceptable.begin(), acceptable.end(), [this, &object](const std::string& key) { + return acceptableValue(object.properties().at(key)); + }); } // Given a persistent object, return a vector of keys that match the diff --git a/smtk/resource/filter/Rules.h b/smtk/resource/filter/Rules.h index c78a4a3cf3..7b0c9e7d62 100644 --- a/smtk/resource/filter/Rules.h +++ b/smtk/resource/filter/Rules.h @@ -14,6 +14,8 @@ #include "smtk/resource/filter/Rule.h" +#include + namespace smtk { namespace resource @@ -36,14 +38,9 @@ public: bool operator()(const PersistentObject& object) const { - for (const auto& rule : m_data) - { - if (!(*rule)(object)) - { - return false; - } - } - return true; + return std::all_of(m_data.begin(), m_data.end(), [&object](const std::unique_ptr& rule) { + return (*rule)(object); + }); } template -- GitLab From 29d5fdf16ad9f00788e4ca21ed2e39aecd0a8fdd Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 17 May 2021 16:51:18 -0400 Subject: [PATCH 002/136] clang-tidy: fix `misc-definitions-in-headers` lints Without `inline`, if the header is included multiple times, it is subject to ODR violations. --- smtk/attribute/pybind11/PybindAnalyses.h | 2 +- smtk/attribute/pybind11/PybindAssociate.h | 2 +- smtk/attribute/pybind11/PybindAttribute.h | 2 +- smtk/attribute/pybind11/PybindCategories.h | 2 +- smtk/attribute/pybind11/PybindComponentItem.h | 2 +- .../pybind11/PybindComponentItemDefinition.h | 2 +- smtk/attribute/pybind11/PybindDateTimeItem.h | 2 +- .../pybind11/PybindDateTimeItemDefinition.h | 2 +- smtk/attribute/pybind11/PybindDefinition.h | 2 +- smtk/attribute/pybind11/PybindDirectoryItem.h | 2 +- .../pybind11/PybindDirectoryItemDefinition.h | 2 +- smtk/attribute/pybind11/PybindDissociate.h | 2 +- smtk/attribute/pybind11/PybindDoubleItem.h | 2 +- .../pybind11/PybindDoubleItemDefinition.h | 2 +- smtk/attribute/pybind11/PybindExport.h | 2 +- smtk/attribute/pybind11/PybindFileItem.h | 2 +- .../pybind11/PybindFileItemDefinition.h | 2 +- .../attribute/pybind11/PybindFileSystemItem.h | 2 +- .../pybind11/PybindFileSystemItemDefinition.h | 2 +- smtk/attribute/pybind11/PybindGroupItem.h | 2 +- .../pybind11/PybindGroupItemDefinition.h | 2 +- smtk/attribute/pybind11/PybindImport.h | 2 +- smtk/attribute/pybind11/PybindIntItem.h | 2 +- .../pybind11/PybindIntItemDefinition.h | 2 +- smtk/attribute/pybind11/PybindItem.h | 2 +- .../attribute/pybind11/PybindItemDefinition.h | 2 +- .../pybind11/PybindModelEntityItem.h | 2 +- .../PybindModelEntityItemDefinition.h | 2 +- smtk/attribute/pybind11/PybindQueries.h | 2 +- smtk/attribute/pybind11/PybindRead.h | 2 +- smtk/attribute/pybind11/PybindReferenceItem.h | 2 +- .../pybind11/PybindReferenceItemDefinition.h | 2 +- smtk/attribute/pybind11/PybindRegistrar.h | 2 +- smtk/attribute/pybind11/PybindResource.h | 2 +- smtk/attribute/pybind11/PybindResourceItem.h | 2 +- .../pybind11/PybindResourceItemDefinition.h | 2 +- smtk/attribute/pybind11/PybindSearchStyle.h | 2 +- smtk/attribute/pybind11/PybindStringItem.h | 2 +- .../pybind11/PybindStringItemDefinition.h | 2 +- smtk/attribute/pybind11/PybindTag.h | 2 +- smtk/attribute/pybind11/PybindValueItem.h | 2 +- .../pybind11/PybindValueItemDefinition.h | 2 +- .../PybindValueItemDefinitionTemplate.h | 8 ++-- .../pybind11/PybindValueItemTemplate.h | 6 +-- smtk/attribute/pybind11/PybindVoidItem.h | 2 +- .../pybind11/PybindVoidItemDefinition.h | 2 +- smtk/attribute/pybind11/PybindWrite.h | 2 +- smtk/common/pybind11/PybindColor.h | 2 +- smtk/common/pybind11/PybindDateTime.h | 2 +- smtk/common/pybind11/PybindDateTimeZonePair.h | 2 +- smtk/common/pybind11/PybindEnvironment.h | 2 +- smtk/common/pybind11/PybindFileLocation.h | 2 +- smtk/common/pybind11/PybindPaths.h | 2 +- smtk/common/pybind11/PybindPathsHelperUnix.h | 2 +- smtk/common/pybind11/PybindStringUtil.h | 2 +- smtk/common/pybind11/PybindTimeZone.h | 2 +- smtk/common/pybind11/PybindUUID.h | 2 +- smtk/common/pybind11/PybindUUIDGenerator.h | 2 +- smtk/common/pybind11/PybindVersion.h | 2 +- .../delaunay/pybind11/PybindRegistrar.h | 2 +- .../delaunay/pybind11/PybindTessellateFaces.h | 2 +- .../pybind11/PybindTriangulateFaces.h | 2 +- .../vtk/io/pybind11/PybindExportVTKData.h | 2 +- .../vtk/io/pybind11/PybindImportAsVTKData.h | 2 +- .../vtk/io/pybind11/PybindImportVTKData.h | 2 +- .../vtk/io/pybind11/PybindMeshIOVTK.h | 2 +- smtk/geometry/pybind11/PybindBackend.h | 2 +- smtk/geometry/pybind11/PybindGeometry.h | 2 +- smtk/geometry/pybind11/PybindManager.h | 2 +- smtk/geometry/pybind11/PybindResource.h | 2 +- smtk/io/pybind11/PybindAttributeReader.h | 2 +- smtk/io/pybind11/PybindAttributeWriter.h | 2 +- smtk/io/pybind11/PybindExportMesh.h | 6 +-- smtk/io/pybind11/PybindFormat.h | 2 +- smtk/io/pybind11/PybindImportMesh.h | 10 ++-- smtk/io/pybind11/PybindLogger.h | 2 +- smtk/io/pybind11/PybindMeshIO.h | 4 +- smtk/io/pybind11/PybindMeshIOMoab.h | 2 +- smtk/io/pybind11/PybindMeshIOXMS.h | 2 +- smtk/io/pybind11/PybindModelToMesh.h | 2 +- smtk/io/pybind11/PybindReadMesh.h | 22 ++++----- smtk/io/pybind11/PybindWriteMesh.h | 22 ++++----- smtk/mesh/pybind11/PybindApplyToMesh.h | 12 ++--- smtk/mesh/pybind11/PybindCellField.h | 2 +- smtk/mesh/pybind11/PybindCellSet.h | 14 +++--- smtk/mesh/pybind11/PybindCellTypes.h | 6 +-- smtk/mesh/pybind11/PybindComponent.h | 2 +- smtk/mesh/pybind11/PybindDeleteMesh.h | 2 +- smtk/mesh/pybind11/PybindDimensionTypes.h | 2 +- smtk/mesh/pybind11/PybindElevateMesh.h | 2 +- smtk/mesh/pybind11/PybindExport.h | 2 +- .../pybind11/PybindExtractCanonicalIndices.h | 6 +-- .../pybind11/PybindExtractMeshConstants.h | 16 +++---- .../mesh/pybind11/PybindExtractTessellation.h | 26 +++++----- smtk/mesh/pybind11/PybindFieldTypes.h | 2 +- smtk/mesh/pybind11/PybindForEachTypes.h | 6 +-- smtk/mesh/pybind11/PybindHandle.h | 20 ++++---- smtk/mesh/pybind11/PybindImport.h | 2 +- smtk/mesh/pybind11/PybindInterface.h | 12 ++--- .../mesh/pybind11/PybindInterpolateOntoMesh.h | 2 +- smtk/mesh/pybind11/PybindMeshSet.h | 10 ++-- smtk/mesh/pybind11/PybindMetrics.h | 2 +- smtk/mesh/pybind11/PybindPointCloud.h | 2 +- .../mesh/pybind11/PybindPointCloudGenerator.h | 2 +- smtk/mesh/pybind11/PybindPointConnectivity.h | 2 +- smtk/mesh/pybind11/PybindPointField.h | 2 +- smtk/mesh/pybind11/PybindPointLocator.h | 2 +- smtk/mesh/pybind11/PybindPointSet.h | 10 ++-- smtk/mesh/pybind11/PybindQueryTypes.h | 16 +++---- smtk/mesh/pybind11/PybindRead.h | 2 +- smtk/mesh/pybind11/PybindReclassify.h | 8 ++-- smtk/mesh/pybind11/PybindRegistrar.h | 2 +- smtk/mesh/pybind11/PybindResource.h | 2 +- smtk/mesh/pybind11/PybindSelection.h | 2 +- smtk/mesh/pybind11/PybindStructuredGrid.h | 2 +- .../pybind11/PybindStructuredGridGenerator.h | 2 +- smtk/mesh/pybind11/PybindTypeSet.h | 2 +- smtk/mesh/pybind11/PybindWrite.h | 2 +- .../pybind11/PybindAddAuxiliaryGeometry.h | 2 +- smtk/model/pybind11/PybindArrangement.h | 4 +- smtk/model/pybind11/PybindArrangementHelper.h | 2 +- smtk/model/pybind11/PybindArrangementKind.h | 14 +++--- .../pybind11/PybindAttributeAssignments.h | 2 +- smtk/model/pybind11/PybindAuxiliaryGeometry.h | 2 +- smtk/model/pybind11/PybindCellEntity.h | 2 +- smtk/model/pybind11/PybindChain.h | 2 +- smtk/model/pybind11/PybindCloseModel.h | 2 +- smtk/model/pybind11/PybindCreateInstances.h | 2 +- smtk/model/pybind11/PybindDefaultSession.h | 2 +- smtk/model/pybind11/PybindDelete.h | 2 +- smtk/model/pybind11/PybindEdge.h | 2 +- smtk/model/pybind11/PybindEdgeUse.h | 2 +- smtk/model/pybind11/PybindEntity.h | 2 +- smtk/model/pybind11/PybindEntityIterator.h | 4 +- smtk/model/pybind11/PybindEntityRef.h | 6 +-- .../pybind11/PybindEntityRefArrangementOps.h | 2 +- smtk/model/pybind11/PybindEntityTypeBits.h | 48 +++++++++---------- smtk/model/pybind11/PybindEvents.h | 4 +- smtk/model/pybind11/PybindExportModelJSON.h | 2 +- smtk/model/pybind11/PybindFace.h | 2 +- smtk/model/pybind11/PybindFaceUse.h | 2 +- smtk/model/pybind11/PybindGroup.h | 2 +- smtk/model/pybind11/PybindInstance.h | 2 +- smtk/model/pybind11/PybindLoop.h | 2 +- smtk/model/pybind11/PybindModel.h | 2 +- smtk/model/pybind11/PybindRegistrar.h | 2 +- smtk/model/pybind11/PybindResource.h | 2 +- smtk/model/pybind11/PybindSession.h | 4 +- smtk/model/pybind11/PybindSessionIO.h | 2 +- smtk/model/pybind11/PybindSessionIOJSON.h | 2 +- smtk/model/pybind11/PybindSessionRef.h | 2 +- smtk/model/pybind11/PybindShell.h | 2 +- smtk/model/pybind11/PybindShellEntity.h | 2 +- smtk/model/pybind11/PybindTessellation.h | 4 +- smtk/model/pybind11/PybindUseEntity.h | 2 +- smtk/model/pybind11/PybindVertex.h | 2 +- smtk/model/pybind11/PybindVertexUse.h | 2 +- smtk/model/pybind11/PybindVolume.h | 2 +- smtk/model/pybind11/PybindVolumeUse.h | 2 +- smtk/operation/pybind11/PybindManager.h | 2 +- smtk/operation/pybind11/PybindMetadata.h | 2 +- .../pybind11/PybindMetadataContainer.h | 4 +- .../pybind11/PybindMetadataObserver.h | 2 +- smtk/operation/pybind11/PybindObserver.h | 4 +- smtk/operation/pybind11/PybindOperation.h | 2 +- smtk/operation/pybind11/PybindReadResource.h | 2 +- smtk/operation/pybind11/PybindRegistrar.h | 2 +- .../operation/pybind11/PybindRemoveResource.h | 2 +- .../pybind11/PybindResourceManagerOperation.h | 2 +- smtk/operation/pybind11/PybindSetProperty.h | 2 +- smtk/operation/pybind11/PybindWriteResource.h | 2 +- smtk/operation/pybind11/PybindXMLOperation.h | 2 +- smtk/project/pybind11/PybindContainer.h | 8 ++-- smtk/project/pybind11/PybindManager.h | 2 +- smtk/project/pybind11/PybindMetadata.h | 2 +- smtk/project/pybind11/PybindObserver.h | 2 +- smtk/project/pybind11/PybindOperation.h | 2 +- .../project/pybind11/PybindOperationFactory.h | 2 +- smtk/project/pybind11/PybindProject.h | 2 +- smtk/project/pybind11/PybindRegistrar.h | 2 +- .../pybind11/PybindResourceContainer.h | 4 +- smtk/project/pybind11/PybindTags.h | 10 ++-- smtk/resource/pybind11/PybindComponent.h | 2 +- smtk/resource/pybind11/PybindManager.h | 2 +- smtk/resource/pybind11/PybindObserver.h | 4 +- .../pybind11/PybindPersistentObject.h | 2 +- smtk/resource/pybind11/PybindPropertyType.h | 2 +- smtk/resource/pybind11/PybindResource.h | 2 +- .../mesh/pybind11/PybindCreateUniformGrid.h | 2 +- .../pybind11/PybindEulerCharacteristicRatio.h | 2 +- smtk/session/mesh/pybind11/PybindExport.h | 2 +- smtk/session/mesh/pybind11/PybindImport.h | 2 +- smtk/session/mesh/pybind11/PybindRead.h | 2 +- smtk/session/mesh/pybind11/PybindRegistrar.h | 2 +- smtk/session/mesh/pybind11/PybindResource.h | 2 +- smtk/session/mesh/pybind11/PybindSession.h | 2 +- smtk/session/mesh/pybind11/PybindTopology.h | 2 +- smtk/session/mesh/pybind11/PybindWrite.h | 2 +- .../polygon/pybind11/PybindCreateEdge.h | 2 +- .../pybind11/PybindCreateEdgeFromPoints.h | 2 +- .../pybind11/PybindCreateEdgeFromVertices.h | 2 +- .../polygon/pybind11/PybindCreateFaces.h | 4 +- .../polygon/pybind11/PybindCreateModel.h | 2 +- .../polygon/pybind11/PybindCreateVertices.h | 2 +- smtk/session/polygon/pybind11/PybindDelete.h | 2 +- .../polygon/pybind11/PybindDemoteVertex.h | 2 +- .../polygon/pybind11/PybindExtractContours.h | 2 +- .../polygon/pybind11/PybindForceCreateFace.h | 2 +- smtk/session/polygon/pybind11/PybindImport.h | 2 +- .../polygon/pybind11/PybindLegacyRead.h | 2 +- .../polygon/pybind11/PybindOperation.h | 2 +- smtk/session/polygon/pybind11/PybindRead.h | 2 +- .../polygon/pybind11/PybindRegistrar.h | 2 +- smtk/session/polygon/pybind11/PybindSession.h | 2 +- .../polygon/pybind11/PybindSessionIOJSON.h | 2 +- .../polygon/pybind11/PybindSplitEdge.h | 2 +- .../polygon/pybind11/PybindTweakEdge.h | 2 +- smtk/session/polygon/pybind11/PybindWrite.h | 2 +- smtk/session/vtk/pybind11/PybindExport.h | 2 +- smtk/session/vtk/pybind11/PybindImport.h | 2 +- smtk/session/vtk/pybind11/PybindLegacyRead.h | 2 +- smtk/session/vtk/pybind11/PybindOperation.h | 2 +- smtk/session/vtk/pybind11/PybindRead.h | 2 +- smtk/session/vtk/pybind11/PybindRegistrar.h | 2 +- smtk/session/vtk/pybind11/PybindResource.h | 2 +- smtk/session/vtk/pybind11/PybindSession.h | 8 ++-- smtk/session/vtk/pybind11/PybindWrite.h | 2 +- smtk/simulation/pybind11/PybindExportSpec.h | 2 +- smtk/simulation/pybind11/PybindUserData.h | 8 ++-- smtk/view/DefaultOperationIcon.h | 2 +- smtk/view/pybind11/PybindDescriptivePhrase.h | 4 +- smtk/view/pybind11/PybindSelection.h | 4 +- smtk/view/pybind11/PybindSelectionObserver.h | 2 +- smtk/view/pybind11/PybindSubphraseGenerator.h | 2 +- smtk/view/pybind11/PybindView.h | 2 +- 235 files changed, 391 insertions(+), 391 deletions(-) diff --git a/smtk/attribute/pybind11/PybindAnalyses.h b/smtk/attribute/pybind11/PybindAnalyses.h index 7b5bbf512d..0c6dc50170 100644 --- a/smtk/attribute/pybind11/PybindAnalyses.h +++ b/smtk/attribute/pybind11/PybindAnalyses.h @@ -23,7 +23,7 @@ namespace py = pybind11; -py::class_< smtk::attribute::Analyses > pybind11_init_smtk_attribute_Analyses(py::module &m) +inline py::class_< smtk::attribute::Analyses > pybind11_init_smtk_attribute_Analyses(py::module &m) { py::class_< smtk::attribute::Analyses, std::unique_ptr> instance(m, "Analyses"); instance diff --git a/smtk/attribute/pybind11/PybindAssociate.h b/smtk/attribute/pybind11/PybindAssociate.h index 001ceb5b9a..d87c54fc7f 100644 --- a/smtk/attribute/pybind11/PybindAssociate.h +++ b/smtk/attribute/pybind11/PybindAssociate.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::Associate, smtk::operation::XMLOperation > pybind11_init_smtk_attribute_Associate(py::module &m) +inline PySharedPtrClass< smtk::attribute::Associate, smtk::operation::XMLOperation > pybind11_init_smtk_attribute_Associate(py::module &m) { PySharedPtrClass< smtk::attribute::Associate, smtk::operation::XMLOperation > instance(m, "Associate"); instance diff --git a/smtk/attribute/pybind11/PybindAttribute.h b/smtk/attribute/pybind11/PybindAttribute.h index e5dbcde9fb..4e433ceb6b 100644 --- a/smtk/attribute/pybind11/PybindAttribute.h +++ b/smtk/attribute/pybind11/PybindAttribute.h @@ -37,7 +37,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::Attribute > pybind11_init_smtk_attribute_Attribute(py::module &m) +inline PySharedPtrClass< smtk::attribute::Attribute > pybind11_init_smtk_attribute_Attribute(py::module &m) { PySharedPtrClass< smtk::attribute::Attribute, smtk::resource::Component > instance(m, "Attribute", py::dynamic_attr()); instance diff --git a/smtk/attribute/pybind11/PybindCategories.h b/smtk/attribute/pybind11/PybindCategories.h index 9c581ca319..e7257566da 100644 --- a/smtk/attribute/pybind11/PybindCategories.h +++ b/smtk/attribute/pybind11/PybindCategories.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::attribute::Categories > pybind11_init_smtk_attribute_Categories(py::module &m) +inline py::class_< smtk::attribute::Categories > pybind11_init_smtk_attribute_Categories(py::module &m) { py::class_< smtk::attribute::Categories > instance(m, "Categories"); instance diff --git a/smtk/attribute/pybind11/PybindComponentItem.h b/smtk/attribute/pybind11/PybindComponentItem.h index e16d68de73..e68e89d4f2 100644 --- a/smtk/attribute/pybind11/PybindComponentItem.h +++ b/smtk/attribute/pybind11/PybindComponentItem.h @@ -22,7 +22,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::ComponentItem, smtk::attribute::ReferenceItem > pybind11_init_smtk_attribute_ComponentItem(py::module &m) +inline PySharedPtrClass< smtk::attribute::ComponentItem, smtk::attribute::ReferenceItem > pybind11_init_smtk_attribute_ComponentItem(py::module &m) { PySharedPtrClass< smtk::attribute::ComponentItem, smtk::attribute::ReferenceItem > instance(m, "ComponentItem"); instance diff --git a/smtk/attribute/pybind11/PybindComponentItemDefinition.h b/smtk/attribute/pybind11/PybindComponentItemDefinition.h index c50daaf771..7bad40de16 100644 --- a/smtk/attribute/pybind11/PybindComponentItemDefinition.h +++ b/smtk/attribute/pybind11/PybindComponentItemDefinition.h @@ -22,7 +22,7 @@ namespace py = pybind11; -py::class_< smtk::attribute::ComponentItemDefinition, smtk::attribute::ReferenceItemDefinition > pybind11_init_smtk_attribute_ComponentItemDefinition(py::module &m) +inline py::class_< smtk::attribute::ComponentItemDefinition, smtk::attribute::ReferenceItemDefinition > pybind11_init_smtk_attribute_ComponentItemDefinition(py::module &m) { PySharedPtrClass< smtk::attribute::ComponentItemDefinition, smtk::attribute::ReferenceItemDefinition > instance(m, "ComponentItemDefinition"); instance diff --git a/smtk/attribute/pybind11/PybindDateTimeItem.h b/smtk/attribute/pybind11/PybindDateTimeItem.h index 3c3fd28ce9..4fc91e01dc 100644 --- a/smtk/attribute/pybind11/PybindDateTimeItem.h +++ b/smtk/attribute/pybind11/PybindDateTimeItem.h @@ -20,7 +20,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::DateTimeItem, smtk::attribute::Item > pybind11_init_smtk_attribute_DateTimeItem(py::module &m) +inline PySharedPtrClass< smtk::attribute::DateTimeItem, smtk::attribute::Item > pybind11_init_smtk_attribute_DateTimeItem(py::module &m) { PySharedPtrClass< smtk::attribute::DateTimeItem, smtk::attribute::Item > instance(m, "DateTimeItem"); instance diff --git a/smtk/attribute/pybind11/PybindDateTimeItemDefinition.h b/smtk/attribute/pybind11/PybindDateTimeItemDefinition.h index 61c87b35c4..d37ab90f51 100644 --- a/smtk/attribute/pybind11/PybindDateTimeItemDefinition.h +++ b/smtk/attribute/pybind11/PybindDateTimeItemDefinition.h @@ -22,7 +22,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::DateTimeItemDefinition, smtk::attribute::ItemDefinition > pybind11_init_smtk_attribute_DateTimeItemDefinition(py::module &m) +inline PySharedPtrClass< smtk::attribute::DateTimeItemDefinition, smtk::attribute::ItemDefinition > pybind11_init_smtk_attribute_DateTimeItemDefinition(py::module &m) { PySharedPtrClass< smtk::attribute::DateTimeItemDefinition, smtk::attribute::ItemDefinition > instance(m, "DateTimeItemDefinition"); instance diff --git a/smtk/attribute/pybind11/PybindDefinition.h b/smtk/attribute/pybind11/PybindDefinition.h index 4c82b04247..dda4386c13 100644 --- a/smtk/attribute/pybind11/PybindDefinition.h +++ b/smtk/attribute/pybind11/PybindDefinition.h @@ -24,7 +24,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::Definition > pybind11_init_smtk_attribute_Definition(py::module &m) +inline PySharedPtrClass< smtk::attribute::Definition > pybind11_init_smtk_attribute_Definition(py::module &m) { PySharedPtrClass< smtk::attribute::Definition > instance(m, "Definition"); instance diff --git a/smtk/attribute/pybind11/PybindDirectoryItem.h b/smtk/attribute/pybind11/PybindDirectoryItem.h index c3cba97435..0675a8b6f9 100644 --- a/smtk/attribute/pybind11/PybindDirectoryItem.h +++ b/smtk/attribute/pybind11/PybindDirectoryItem.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::DirectoryItem, smtk::attribute::FileSystemItem > pybind11_init_smtk_attribute_DirectoryItem(py::module &m) +inline PySharedPtrClass< smtk::attribute::DirectoryItem, smtk::attribute::FileSystemItem > pybind11_init_smtk_attribute_DirectoryItem(py::module &m) { PySharedPtrClass< smtk::attribute::DirectoryItem, smtk::attribute::FileSystemItem > instance(m, "DirectoryItem"); instance diff --git a/smtk/attribute/pybind11/PybindDirectoryItemDefinition.h b/smtk/attribute/pybind11/PybindDirectoryItemDefinition.h index fcaaab176f..f494a72336 100644 --- a/smtk/attribute/pybind11/PybindDirectoryItemDefinition.h +++ b/smtk/attribute/pybind11/PybindDirectoryItemDefinition.h @@ -22,7 +22,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::DirectoryItemDefinition, smtk::attribute::FileSystemItemDefinition > pybind11_init_smtk_attribute_DirectoryItemDefinition(py::module &m) +inline PySharedPtrClass< smtk::attribute::DirectoryItemDefinition, smtk::attribute::FileSystemItemDefinition > pybind11_init_smtk_attribute_DirectoryItemDefinition(py::module &m) { PySharedPtrClass< smtk::attribute::DirectoryItemDefinition, smtk::attribute::FileSystemItemDefinition > instance(m, "DirectoryItemDefinition"); instance diff --git a/smtk/attribute/pybind11/PybindDissociate.h b/smtk/attribute/pybind11/PybindDissociate.h index a9b80f68a2..a9d928807c 100644 --- a/smtk/attribute/pybind11/PybindDissociate.h +++ b/smtk/attribute/pybind11/PybindDissociate.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::Dissociate, smtk::operation::XMLOperation > pybind11_init_smtk_attribute_Dissociate(py::module &m) +inline PySharedPtrClass< smtk::attribute::Dissociate, smtk::operation::XMLOperation > pybind11_init_smtk_attribute_Dissociate(py::module &m) { PySharedPtrClass< smtk::attribute::Dissociate, smtk::operation::XMLOperation > instance(m, "Dissociate"); instance diff --git a/smtk/attribute/pybind11/PybindDoubleItem.h b/smtk/attribute/pybind11/PybindDoubleItem.h index 68da230dd3..cb636cac8b 100644 --- a/smtk/attribute/pybind11/PybindDoubleItem.h +++ b/smtk/attribute/pybind11/PybindDoubleItem.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::DoubleItem, smtk::attribute::ValueItemTemplate > pybind11_init_smtk_attribute_DoubleItem(py::module &m) +inline PySharedPtrClass< smtk::attribute::DoubleItem, smtk::attribute::ValueItemTemplate > pybind11_init_smtk_attribute_DoubleItem(py::module &m) { PySharedPtrClass< smtk::attribute::DoubleItem, smtk::attribute::ValueItemTemplate > instance(m, "DoubleItem"); instance diff --git a/smtk/attribute/pybind11/PybindDoubleItemDefinition.h b/smtk/attribute/pybind11/PybindDoubleItemDefinition.h index 2da22dda64..96167bffd5 100644 --- a/smtk/attribute/pybind11/PybindDoubleItemDefinition.h +++ b/smtk/attribute/pybind11/PybindDoubleItemDefinition.h @@ -21,7 +21,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::DoubleItemDefinition, smtk::attribute::ValueItemDefinitionTemplate > pybind11_init_smtk_attribute_DoubleItemDefinition(py::module &m) +inline PySharedPtrClass< smtk::attribute::DoubleItemDefinition, smtk::attribute::ValueItemDefinitionTemplate > pybind11_init_smtk_attribute_DoubleItemDefinition(py::module &m) { PySharedPtrClass< smtk::attribute::DoubleItemDefinition, smtk::attribute::ValueItemDefinitionTemplate > instance(m, "DoubleItemDefinition"); instance diff --git a/smtk/attribute/pybind11/PybindExport.h b/smtk/attribute/pybind11/PybindExport.h index b8ea3b385f..a20bb348f9 100644 --- a/smtk/attribute/pybind11/PybindExport.h +++ b/smtk/attribute/pybind11/PybindExport.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::Export, smtk::operation::XMLOperation > pybind11_init_smtk_attribute_Export(py::module &m) +inline PySharedPtrClass< smtk::attribute::Export, smtk::operation::XMLOperation > pybind11_init_smtk_attribute_Export(py::module &m) { PySharedPtrClass< smtk::attribute::Export, smtk::operation::XMLOperation > instance(m, "Export"); instance diff --git a/smtk/attribute/pybind11/PybindFileItem.h b/smtk/attribute/pybind11/PybindFileItem.h index 93bdc56db4..ac714c3ed1 100644 --- a/smtk/attribute/pybind11/PybindFileItem.h +++ b/smtk/attribute/pybind11/PybindFileItem.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::FileItem, smtk::attribute::FileSystemItem > pybind11_init_smtk_attribute_FileItem(py::module &m) +inline PySharedPtrClass< smtk::attribute::FileItem, smtk::attribute::FileSystemItem > pybind11_init_smtk_attribute_FileItem(py::module &m) { PySharedPtrClass< smtk::attribute::FileItem, smtk::attribute::FileSystemItem > instance(m, "FileItem"); instance diff --git a/smtk/attribute/pybind11/PybindFileItemDefinition.h b/smtk/attribute/pybind11/PybindFileItemDefinition.h index 9d7174a5c0..7418243489 100644 --- a/smtk/attribute/pybind11/PybindFileItemDefinition.h +++ b/smtk/attribute/pybind11/PybindFileItemDefinition.h @@ -22,7 +22,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::FileItemDefinition, smtk::attribute::FileSystemItemDefinition > pybind11_init_smtk_attribute_FileItemDefinition(py::module &m) +inline PySharedPtrClass< smtk::attribute::FileItemDefinition, smtk::attribute::FileSystemItemDefinition > pybind11_init_smtk_attribute_FileItemDefinition(py::module &m) { PySharedPtrClass< smtk::attribute::FileItemDefinition, smtk::attribute::FileSystemItemDefinition > instance(m, "FileItemDefinition"); instance diff --git a/smtk/attribute/pybind11/PybindFileSystemItem.h b/smtk/attribute/pybind11/PybindFileSystemItem.h index 4c7f0b189e..5def35fc17 100644 --- a/smtk/attribute/pybind11/PybindFileSystemItem.h +++ b/smtk/attribute/pybind11/PybindFileSystemItem.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::FileSystemItem, smtk::attribute::Item > pybind11_init_smtk_attribute_FileSystemItem(py::module &m) +inline PySharedPtrClass< smtk::attribute::FileSystemItem, smtk::attribute::Item > pybind11_init_smtk_attribute_FileSystemItem(py::module &m) { PySharedPtrClass< smtk::attribute::FileSystemItem, smtk::attribute::Item > instance(m, "FileSystemItem"); instance diff --git a/smtk/attribute/pybind11/PybindFileSystemItemDefinition.h b/smtk/attribute/pybind11/PybindFileSystemItemDefinition.h index e5db391be2..5de6e3ded5 100644 --- a/smtk/attribute/pybind11/PybindFileSystemItemDefinition.h +++ b/smtk/attribute/pybind11/PybindFileSystemItemDefinition.h @@ -21,7 +21,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::FileSystemItemDefinition, smtk::attribute::ItemDefinition > pybind11_init_smtk_attribute_FileSystemItemDefinition(py::module &m) +inline PySharedPtrClass< smtk::attribute::FileSystemItemDefinition, smtk::attribute::ItemDefinition > pybind11_init_smtk_attribute_FileSystemItemDefinition(py::module &m) { PySharedPtrClass< smtk::attribute::FileSystemItemDefinition, smtk::attribute::ItemDefinition > instance(m, "FileSystemItemDefinition"); instance diff --git a/smtk/attribute/pybind11/PybindGroupItem.h b/smtk/attribute/pybind11/PybindGroupItem.h index a2ac7f9348..a4d966ea14 100644 --- a/smtk/attribute/pybind11/PybindGroupItem.h +++ b/smtk/attribute/pybind11/PybindGroupItem.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::GroupItem, smtk::attribute::Item > pybind11_init_smtk_attribute_GroupItem(py::module &m) +inline PySharedPtrClass< smtk::attribute::GroupItem, smtk::attribute::Item > pybind11_init_smtk_attribute_GroupItem(py::module &m) { PySharedPtrClass< smtk::attribute::GroupItem, smtk::attribute::Item > instance(m, "GroupItem"); instance diff --git a/smtk/attribute/pybind11/PybindGroupItemDefinition.h b/smtk/attribute/pybind11/PybindGroupItemDefinition.h index ed7073a8f2..3e6551270b 100644 --- a/smtk/attribute/pybind11/PybindGroupItemDefinition.h +++ b/smtk/attribute/pybind11/PybindGroupItemDefinition.h @@ -22,7 +22,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::GroupItemDefinition, smtk::attribute::ItemDefinition > pybind11_init_smtk_attribute_GroupItemDefinition(py::module &m) +inline PySharedPtrClass< smtk::attribute::GroupItemDefinition, smtk::attribute::ItemDefinition > pybind11_init_smtk_attribute_GroupItemDefinition(py::module &m) { PySharedPtrClass< smtk::attribute::GroupItemDefinition, smtk::attribute::ItemDefinition > instance(m, "GroupItemDefinition"); instance diff --git a/smtk/attribute/pybind11/PybindImport.h b/smtk/attribute/pybind11/PybindImport.h index c728415f62..2c6d16ad18 100644 --- a/smtk/attribute/pybind11/PybindImport.h +++ b/smtk/attribute/pybind11/PybindImport.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::Import, smtk::operation::XMLOperation > pybind11_init_smtk_attribute_Import(py::module &m) +inline PySharedPtrClass< smtk::attribute::Import, smtk::operation::XMLOperation > pybind11_init_smtk_attribute_Import(py::module &m) { PySharedPtrClass< smtk::attribute::Import, smtk::operation::XMLOperation > instance(m, "Import"); instance diff --git a/smtk/attribute/pybind11/PybindIntItem.h b/smtk/attribute/pybind11/PybindIntItem.h index d87a753cbd..6ec42bbfc5 100644 --- a/smtk/attribute/pybind11/PybindIntItem.h +++ b/smtk/attribute/pybind11/PybindIntItem.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::IntItem, smtk::attribute::ValueItemTemplate > pybind11_init_smtk_attribute_IntItem(py::module &m) +inline PySharedPtrClass< smtk::attribute::IntItem, smtk::attribute::ValueItemTemplate > pybind11_init_smtk_attribute_IntItem(py::module &m) { PySharedPtrClass< smtk::attribute::IntItem, smtk::attribute::ValueItemTemplate > instance(m, "IntItem"); instance diff --git a/smtk/attribute/pybind11/PybindIntItemDefinition.h b/smtk/attribute/pybind11/PybindIntItemDefinition.h index c213c9b581..91e73a6fbe 100644 --- a/smtk/attribute/pybind11/PybindIntItemDefinition.h +++ b/smtk/attribute/pybind11/PybindIntItemDefinition.h @@ -21,7 +21,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::IntItemDefinition, smtk::attribute::ValueItemDefinitionTemplate > pybind11_init_smtk_attribute_IntItemDefinition(py::module &m) +inline PySharedPtrClass< smtk::attribute::IntItemDefinition, smtk::attribute::ValueItemDefinitionTemplate > pybind11_init_smtk_attribute_IntItemDefinition(py::module &m) { PySharedPtrClass< smtk::attribute::IntItemDefinition, smtk::attribute::ValueItemDefinitionTemplate > instance(m, "IntItemDefinition"); instance diff --git a/smtk/attribute/pybind11/PybindItem.h b/smtk/attribute/pybind11/PybindItem.h index 3203896fb9..c8c443813b 100644 --- a/smtk/attribute/pybind11/PybindItem.h +++ b/smtk/attribute/pybind11/PybindItem.h @@ -20,7 +20,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::Item > pybind11_init_smtk_attribute_Item(py::module &m) +inline PySharedPtrClass< smtk::attribute::Item > pybind11_init_smtk_attribute_Item(py::module &m) { PySharedPtrClass< smtk::attribute::Item > instance(m, "Item"); instance diff --git a/smtk/attribute/pybind11/PybindItemDefinition.h b/smtk/attribute/pybind11/PybindItemDefinition.h index b49e7d5fe6..51d3378fba 100644 --- a/smtk/attribute/pybind11/PybindItemDefinition.h +++ b/smtk/attribute/pybind11/PybindItemDefinition.h @@ -22,7 +22,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::ItemDefinition > pybind11_init_smtk_attribute_ItemDefinition(py::module &m) +inline PySharedPtrClass< smtk::attribute::ItemDefinition > pybind11_init_smtk_attribute_ItemDefinition(py::module &m) { PySharedPtrClass< smtk::attribute::ItemDefinition > instance(m, "ItemDefinition"); instance diff --git a/smtk/attribute/pybind11/PybindModelEntityItem.h b/smtk/attribute/pybind11/PybindModelEntityItem.h index 435f32bbcc..c47b31ada8 100644 --- a/smtk/attribute/pybind11/PybindModelEntityItem.h +++ b/smtk/attribute/pybind11/PybindModelEntityItem.h @@ -22,7 +22,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::ModelEntityItem, smtk::attribute::ComponentItem > pybind11_init_smtk_attribute_ModelEntityItem(py::module &m) +inline PySharedPtrClass< smtk::attribute::ModelEntityItem, smtk::attribute::ComponentItem > pybind11_init_smtk_attribute_ModelEntityItem(py::module &m) { PySharedPtrClass< smtk::attribute::ModelEntityItem, smtk::attribute::ComponentItem > instance(m, "ModelEntityItem"); instance diff --git a/smtk/attribute/pybind11/PybindModelEntityItemDefinition.h b/smtk/attribute/pybind11/PybindModelEntityItemDefinition.h index 50796c1455..afdeca20ee 100644 --- a/smtk/attribute/pybind11/PybindModelEntityItemDefinition.h +++ b/smtk/attribute/pybind11/PybindModelEntityItemDefinition.h @@ -22,7 +22,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::ModelEntityItemDefinition, smtk::attribute::ComponentItemDefinition > pybind11_init_smtk_attribute_ModelEntityItemDefinition(py::module &m) +inline PySharedPtrClass< smtk::attribute::ModelEntityItemDefinition, smtk::attribute::ComponentItemDefinition > pybind11_init_smtk_attribute_ModelEntityItemDefinition(py::module &m) { PySharedPtrClass< smtk::attribute::ModelEntityItemDefinition, smtk::attribute::ComponentItemDefinition > instance(m, "ModelEntityItemDefinition"); instance diff --git a/smtk/attribute/pybind11/PybindQueries.h b/smtk/attribute/pybind11/PybindQueries.h index d3e477a2e5..877f96ad30 100644 --- a/smtk/attribute/pybind11/PybindQueries.h +++ b/smtk/attribute/pybind11/PybindQueries.h @@ -19,7 +19,7 @@ namespace py = pybind11; -void pybind11_init_smtk_attribute_queries(py::module &m) +inline void pybind11_init_smtk_attribute_queries(py::module &m) { m.def("checkUniquenessCondition", &smtk::attribute::utility::checkUniquenessCondition); m.def("associatableObjects", (std::set (*)(const smtk::attribute::ConstReferenceItemDefinitionPtr&, diff --git a/smtk/attribute/pybind11/PybindRead.h b/smtk/attribute/pybind11/PybindRead.h index 4251b18644..9991d9116c 100644 --- a/smtk/attribute/pybind11/PybindRead.h +++ b/smtk/attribute/pybind11/PybindRead.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::Read, smtk::operation::XMLOperation > pybind11_init_smtk_attribute_Read(py::module &m) +inline PySharedPtrClass< smtk::attribute::Read, smtk::operation::XMLOperation > pybind11_init_smtk_attribute_Read(py::module &m) { PySharedPtrClass< smtk::attribute::Read, smtk::operation::XMLOperation > instance(m, "Read"); instance diff --git a/smtk/attribute/pybind11/PybindReferenceItem.h b/smtk/attribute/pybind11/PybindReferenceItem.h index 3a07990468..589fa20d54 100644 --- a/smtk/attribute/pybind11/PybindReferenceItem.h +++ b/smtk/attribute/pybind11/PybindReferenceItem.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::ReferenceItem, smtk::attribute::Item > pybind11_init_smtk_attribute_ReferenceItem(py::module &m) +inline PySharedPtrClass< smtk::attribute::ReferenceItem, smtk::attribute::Item > pybind11_init_smtk_attribute_ReferenceItem(py::module &m) { PySharedPtrClass< smtk::attribute::ReferenceItem, smtk::attribute::Item > instance(m, "ReferenceItem"); instance diff --git a/smtk/attribute/pybind11/PybindReferenceItemDefinition.h b/smtk/attribute/pybind11/PybindReferenceItemDefinition.h index dc538c2077..da0c783275 100644 --- a/smtk/attribute/pybind11/PybindReferenceItemDefinition.h +++ b/smtk/attribute/pybind11/PybindReferenceItemDefinition.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass +inline PySharedPtrClass pybind11_init_smtk_attribute_ReferenceItemDefinition(py::module& m) { PySharedPtrClass diff --git a/smtk/attribute/pybind11/PybindRegistrar.h b/smtk/attribute/pybind11/PybindRegistrar.h index 5ea2c02888..a8596cdd46 100644 --- a/smtk/attribute/pybind11/PybindRegistrar.h +++ b/smtk/attribute/pybind11/PybindRegistrar.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::attribute::Registrar > pybind11_init_smtk_attribute_Registrar(py::module &m) +inline py::class_< smtk::attribute::Registrar > pybind11_init_smtk_attribute_Registrar(py::module &m) { py::class_< smtk::attribute::Registrar > instance(m, "Registrar"); instance diff --git a/smtk/attribute/pybind11/PybindResource.h b/smtk/attribute/pybind11/PybindResource.h index daf0947d80..35deee0e0f 100644 --- a/smtk/attribute/pybind11/PybindResource.h +++ b/smtk/attribute/pybind11/PybindResource.h @@ -25,7 +25,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::Resource> pybind11_init_smtk_attribute_Resource(py::module &m) +inline PySharedPtrClass< smtk::attribute::Resource> pybind11_init_smtk_attribute_Resource(py::module &m) { PySharedPtrClass< smtk::attribute::Resource, smtk::resource::Resource> instance(m, "Resource"); instance diff --git a/smtk/attribute/pybind11/PybindResourceItem.h b/smtk/attribute/pybind11/PybindResourceItem.h index 577801c455..34feedbe79 100644 --- a/smtk/attribute/pybind11/PybindResourceItem.h +++ b/smtk/attribute/pybind11/PybindResourceItem.h @@ -22,7 +22,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::ResourceItem, smtk::attribute::ReferenceItem > pybind11_init_smtk_attribute_ResourceItem(py::module &m) +inline PySharedPtrClass< smtk::attribute::ResourceItem, smtk::attribute::ReferenceItem > pybind11_init_smtk_attribute_ResourceItem(py::module &m) { PySharedPtrClass< smtk::attribute::ResourceItem, smtk::attribute::ReferenceItem > instance(m, "ResourceItem"); instance diff --git a/smtk/attribute/pybind11/PybindResourceItemDefinition.h b/smtk/attribute/pybind11/PybindResourceItemDefinition.h index 3de7243589..e13866c1e6 100644 --- a/smtk/attribute/pybind11/PybindResourceItemDefinition.h +++ b/smtk/attribute/pybind11/PybindResourceItemDefinition.h @@ -22,7 +22,7 @@ namespace py = pybind11; -py::class_< smtk::attribute::ResourceItemDefinition, smtk::attribute::ReferenceItemDefinition > pybind11_init_smtk_attribute_ResourceItemDefinition(py::module &m) +inline py::class_< smtk::attribute::ResourceItemDefinition, smtk::attribute::ReferenceItemDefinition > pybind11_init_smtk_attribute_ResourceItemDefinition(py::module &m) { PySharedPtrClass< smtk::attribute::ResourceItemDefinition, smtk::attribute::ReferenceItemDefinition > instance(m, "ResourceItemDefinition"); instance diff --git a/smtk/attribute/pybind11/PybindSearchStyle.h b/smtk/attribute/pybind11/PybindSearchStyle.h index cdf32b727c..fbade45444 100644 --- a/smtk/attribute/pybind11/PybindSearchStyle.h +++ b/smtk/attribute/pybind11/PybindSearchStyle.h @@ -17,7 +17,7 @@ namespace py = pybind11; -void pybind11_init_smtk_attribute_SearchStyle(py::module &m) +inline void pybind11_init_smtk_attribute_SearchStyle(py::module &m) { py::enum_(m, "SearchStyle") .value("IMMEDIATE", smtk::attribute::SearchStyle::IMMEDIATE) diff --git a/smtk/attribute/pybind11/PybindStringItem.h b/smtk/attribute/pybind11/PybindStringItem.h index 6cd6bc4188..431f01c819 100644 --- a/smtk/attribute/pybind11/PybindStringItem.h +++ b/smtk/attribute/pybind11/PybindStringItem.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::StringItem, smtk::attribute::ValueItemTemplate > > pybind11_init_smtk_attribute_StringItem(py::module &m) +inline PySharedPtrClass< smtk::attribute::StringItem, smtk::attribute::ValueItemTemplate > > pybind11_init_smtk_attribute_StringItem(py::module &m) { PySharedPtrClass< smtk::attribute::StringItem, smtk::attribute::ValueItemTemplate > > instance(m, "StringItem"); instance diff --git a/smtk/attribute/pybind11/PybindStringItemDefinition.h b/smtk/attribute/pybind11/PybindStringItemDefinition.h index 2c956cc851..44e6b9e5fa 100644 --- a/smtk/attribute/pybind11/PybindStringItemDefinition.h +++ b/smtk/attribute/pybind11/PybindStringItemDefinition.h @@ -21,7 +21,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::StringItemDefinition, smtk::attribute::ValueItemDefinitionTemplate > > pybind11_init_smtk_attribute_StringItemDefinition(py::module &m) +inline PySharedPtrClass< smtk::attribute::StringItemDefinition, smtk::attribute::ValueItemDefinitionTemplate > > pybind11_init_smtk_attribute_StringItemDefinition(py::module &m) { PySharedPtrClass< smtk::attribute::StringItemDefinition, smtk::attribute::ValueItemDefinitionTemplate > > instance(m, "StringItemDefinition"); instance diff --git a/smtk/attribute/pybind11/PybindTag.h b/smtk/attribute/pybind11/PybindTag.h index b448753965..f6524d9c98 100644 --- a/smtk/attribute/pybind11/PybindTag.h +++ b/smtk/attribute/pybind11/PybindTag.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::attribute::Tag > pybind11_init_smtk_attribute_Tag(py::module &m) +inline py::class_< smtk::attribute::Tag > pybind11_init_smtk_attribute_Tag(py::module &m) { py::class_< smtk::attribute::Tag > instance(m, "Tag"); instance diff --git a/smtk/attribute/pybind11/PybindValueItem.h b/smtk/attribute/pybind11/PybindValueItem.h index 604520cc59..80125c2b9a 100644 --- a/smtk/attribute/pybind11/PybindValueItem.h +++ b/smtk/attribute/pybind11/PybindValueItem.h @@ -21,7 +21,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::ValueItem, smtk::attribute::Item > pybind11_init_smtk_attribute_ValueItem(py::module &m) +inline PySharedPtrClass< smtk::attribute::ValueItem, smtk::attribute::Item > pybind11_init_smtk_attribute_ValueItem(py::module &m) { PySharedPtrClass< smtk::attribute::ValueItem, smtk::attribute::Item > instance(m, "ValueItem"); instance diff --git a/smtk/attribute/pybind11/PybindValueItemDefinition.h b/smtk/attribute/pybind11/PybindValueItemDefinition.h index 5243bc03b2..f43558edd0 100644 --- a/smtk/attribute/pybind11/PybindValueItemDefinition.h +++ b/smtk/attribute/pybind11/PybindValueItemDefinition.h @@ -22,7 +22,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::ValueItemDefinition, smtk::attribute::ItemDefinition > pybind11_init_smtk_attribute_ValueItemDefinition(py::module &m) +inline PySharedPtrClass< smtk::attribute::ValueItemDefinition, smtk::attribute::ItemDefinition > pybind11_init_smtk_attribute_ValueItemDefinition(py::module &m) { PySharedPtrClass< smtk::attribute::ValueItemDefinition, smtk::attribute::ItemDefinition > instance(m, "ValueItemDefinition"); instance diff --git a/smtk/attribute/pybind11/PybindValueItemDefinitionTemplate.h b/smtk/attribute/pybind11/PybindValueItemDefinitionTemplate.h index e7ecd8d868..2443865759 100644 --- a/smtk/attribute/pybind11/PybindValueItemDefinitionTemplate.h +++ b/smtk/attribute/pybind11/PybindValueItemDefinitionTemplate.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass, smtk::attribute::ValueItemDefinition> pybind11_init_smtk_attribute_ValueItemDefinitionTemplate_int_(py::module &m) +inline PySharedPtrClass, smtk::attribute::ValueItemDefinition> pybind11_init_smtk_attribute_ValueItemDefinitionTemplate_int_(py::module &m) { PySharedPtrClass, smtk::attribute::ValueItemDefinition> instance(m, "ValueItemDefinitionTemplate_int_"); instance @@ -48,7 +48,7 @@ PySharedPtrClass, smtk::attrib return instance; } -PySharedPtrClass, smtk::attribute::ValueItemDefinition> pybind11_init_smtk_attribute_ValueItemDefinitionTemplate_double_(py::module &m) +inline PySharedPtrClass, smtk::attribute::ValueItemDefinition> pybind11_init_smtk_attribute_ValueItemDefinitionTemplate_double_(py::module &m) { PySharedPtrClass, smtk::attribute::ValueItemDefinition> instance(m, "ValueItemDefinitionTemplate_double_"); instance @@ -77,7 +77,7 @@ PySharedPtrClass, smtk::att return instance; } -PySharedPtrClass, smtk::attribute::ValueItemDefinition> pybind11_init_smtk_attribute_ValueItemDefinitionTemplate_string_(py::module &m) +inline PySharedPtrClass, smtk::attribute::ValueItemDefinition> pybind11_init_smtk_attribute_ValueItemDefinitionTemplate_string_(py::module &m) { PySharedPtrClass, smtk::attribute::ValueItemDefinition> instance(m, "ValueItemDefinitionTemplate_string_"); instance @@ -106,7 +106,7 @@ PySharedPtrClass, smtk return instance; } -PySharedPtrClass, smtk::attribute::ValueItemDefinition> pybind11_init_smtk_attribute_ValueItemDefinitionTemplate_datetime_(py::module &m) +inline PySharedPtrClass, smtk::attribute::ValueItemDefinition> pybind11_init_smtk_attribute_ValueItemDefinitionTemplate_datetime_(py::module &m) { PySharedPtrClass, smtk::attribute::ValueItemDefinition> instance(m, "ValueItemDefinitionTemplate_datetime_"); instance diff --git a/smtk/attribute/pybind11/PybindValueItemTemplate.h b/smtk/attribute/pybind11/PybindValueItemTemplate.h index 33a514f3c3..e2e5b8e921 100644 --- a/smtk/attribute/pybind11/PybindValueItemTemplate.h +++ b/smtk/attribute/pybind11/PybindValueItemTemplate.h @@ -18,7 +18,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::ValueItemTemplate, smtk::attribute::ValueItem > pybind11_init_smtk_attribute_ValueItemTemplate_int_(py::module &m) +inline PySharedPtrClass< smtk::attribute::ValueItemTemplate, smtk::attribute::ValueItem > pybind11_init_smtk_attribute_ValueItemTemplate_int_(py::module &m) { PySharedPtrClass< smtk::attribute::ValueItemTemplate, smtk::attribute::ValueItem > instance(m, "ValueItemTemplate_int_"); instance @@ -47,7 +47,7 @@ PySharedPtrClass< smtk::attribute::ValueItemTemplate, smtk::attribute::Valu return instance; } -PySharedPtrClass, smtk::attribute::ValueItem > pybind11_init_smtk_attribute_ValueItemTemplate_double_(py::module &m) +inline PySharedPtrClass, smtk::attribute::ValueItem > pybind11_init_smtk_attribute_ValueItemTemplate_double_(py::module &m) { PySharedPtrClass, smtk::attribute::ValueItem > instance(m, "ValueItemTemplate_double_"); instance @@ -76,7 +76,7 @@ PySharedPtrClass, smtk::attribute::Va return instance; } -PySharedPtrClass, smtk::attribute::ValueItem > pybind11_init_smtk_attribute_ValueItemTemplate_string_(py::module &m) +inline PySharedPtrClass, smtk::attribute::ValueItem > pybind11_init_smtk_attribute_ValueItemTemplate_string_(py::module &m) { PySharedPtrClass, smtk::attribute::ValueItem > instance(m, "ValueItemTemplate_string_"); instance diff --git a/smtk/attribute/pybind11/PybindVoidItem.h b/smtk/attribute/pybind11/PybindVoidItem.h index 75d4a205c3..c3ddcb0ded 100644 --- a/smtk/attribute/pybind11/PybindVoidItem.h +++ b/smtk/attribute/pybind11/PybindVoidItem.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::VoidItem, smtk::attribute::Item > pybind11_init_smtk_attribute_VoidItem(py::module &m) +inline PySharedPtrClass< smtk::attribute::VoidItem, smtk::attribute::Item > pybind11_init_smtk_attribute_VoidItem(py::module &m) { PySharedPtrClass< smtk::attribute::VoidItem, smtk::attribute::Item > instance(m, "VoidItem"); instance diff --git a/smtk/attribute/pybind11/PybindVoidItemDefinition.h b/smtk/attribute/pybind11/PybindVoidItemDefinition.h index 441de74cad..ba10252f2b 100644 --- a/smtk/attribute/pybind11/PybindVoidItemDefinition.h +++ b/smtk/attribute/pybind11/PybindVoidItemDefinition.h @@ -21,7 +21,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::VoidItemDefinition, smtk::attribute::ItemDefinition > pybind11_init_smtk_attribute_VoidItemDefinition(py::module &m) +inline PySharedPtrClass< smtk::attribute::VoidItemDefinition, smtk::attribute::ItemDefinition > pybind11_init_smtk_attribute_VoidItemDefinition(py::module &m) { PySharedPtrClass< smtk::attribute::VoidItemDefinition, smtk::attribute::ItemDefinition > instance(m, "VoidItemDefinition"); instance diff --git a/smtk/attribute/pybind11/PybindWrite.h b/smtk/attribute/pybind11/PybindWrite.h index 497ef96766..732168964a 100644 --- a/smtk/attribute/pybind11/PybindWrite.h +++ b/smtk/attribute/pybind11/PybindWrite.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::attribute::Write, smtk::operation::XMLOperation > pybind11_init_smtk_attribute_Write(py::module &m) +inline PySharedPtrClass< smtk::attribute::Write, smtk::operation::XMLOperation > pybind11_init_smtk_attribute_Write(py::module &m) { PySharedPtrClass< smtk::attribute::Write, smtk::operation::XMLOperation > instance(m, "Write"); instance diff --git a/smtk/common/pybind11/PybindColor.h b/smtk/common/pybind11/PybindColor.h index 02c55476a6..486a047d96 100644 --- a/smtk/common/pybind11/PybindColor.h +++ b/smtk/common/pybind11/PybindColor.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::common::Color > pybind11_init_smtk_common_Color(py::module &m) +inline py::class_< smtk::common::Color > pybind11_init_smtk_common_Color(py::module &m) { py::class_< smtk::common::Color > instance(m, "Color"); instance diff --git a/smtk/common/pybind11/PybindDateTime.h b/smtk/common/pybind11/PybindDateTime.h index da998fe973..91f5a5e271 100644 --- a/smtk/common/pybind11/PybindDateTime.h +++ b/smtk/common/pybind11/PybindDateTime.h @@ -18,7 +18,7 @@ namespace py = pybind11; -py::class_< smtk::common::DateTime > pybind11_init_smtk_common_DateTime(py::module &m) +inline py::class_< smtk::common::DateTime > pybind11_init_smtk_common_DateTime(py::module &m) { py::class_< smtk::common::DateTime > instance(m, "DateTime"); instance diff --git a/smtk/common/pybind11/PybindDateTimeZonePair.h b/smtk/common/pybind11/PybindDateTimeZonePair.h index 68bdd765b9..b6e31c09b1 100644 --- a/smtk/common/pybind11/PybindDateTimeZonePair.h +++ b/smtk/common/pybind11/PybindDateTimeZonePair.h @@ -20,7 +20,7 @@ namespace py = pybind11; -py::class_< smtk::common::DateTimeZonePair > pybind11_init_smtk_common_DateTimeZonePair(py::module &m) +inline py::class_< smtk::common::DateTimeZonePair > pybind11_init_smtk_common_DateTimeZonePair(py::module &m) { py::class_< smtk::common::DateTimeZonePair > instance(m, "DateTimeZonePair"); instance diff --git a/smtk/common/pybind11/PybindEnvironment.h b/smtk/common/pybind11/PybindEnvironment.h index e68f39b7e3..c0a629523d 100644 --- a/smtk/common/pybind11/PybindEnvironment.h +++ b/smtk/common/pybind11/PybindEnvironment.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::common::Environment > pybind11_init_smtk_common_Environment(py::module &m) +inline py::class_< smtk::common::Environment > pybind11_init_smtk_common_Environment(py::module &m) { py::class_< smtk::common::Environment > instance(m, "Environment"); instance diff --git a/smtk/common/pybind11/PybindFileLocation.h b/smtk/common/pybind11/PybindFileLocation.h index 13f4d7729b..3a14fae5ca 100644 --- a/smtk/common/pybind11/PybindFileLocation.h +++ b/smtk/common/pybind11/PybindFileLocation.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::common::FileLocation > pybind11_init_smtk_common_FileLocation(py::module &m) +inline py::class_< smtk::common::FileLocation > pybind11_init_smtk_common_FileLocation(py::module &m) { py::class_< smtk::common::FileLocation > instance(m, "FileLocation"); instance diff --git a/smtk/common/pybind11/PybindPaths.h b/smtk/common/pybind11/PybindPaths.h index 731f6e3464..8422104e00 100644 --- a/smtk/common/pybind11/PybindPaths.h +++ b/smtk/common/pybind11/PybindPaths.h @@ -18,7 +18,7 @@ namespace py = pybind11; -py::class_< smtk::common::Paths > pybind11_init_smtk_common_Paths(py::module &m) +inline py::class_< smtk::common::Paths > pybind11_init_smtk_common_Paths(py::module &m) { py::class_< smtk::common::Paths > instance(m, "Paths"); instance diff --git a/smtk/common/pybind11/PybindPathsHelperUnix.h b/smtk/common/pybind11/PybindPathsHelperUnix.h index 5770eb2dd1..6e7babe152 100644 --- a/smtk/common/pybind11/PybindPathsHelperUnix.h +++ b/smtk/common/pybind11/PybindPathsHelperUnix.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::common::PathsHelperUnix > pybind11_init_smtk_common_PathsHelperUnix(py::module &m) +inline py::class_< smtk::common::PathsHelperUnix > pybind11_init_smtk_common_PathsHelperUnix(py::module &m) { py::class_< smtk::common::PathsHelperUnix > instance(m, "PathsHelperUnix"); instance diff --git a/smtk/common/pybind11/PybindStringUtil.h b/smtk/common/pybind11/PybindStringUtil.h index 95de06c409..c74d124477 100644 --- a/smtk/common/pybind11/PybindStringUtil.h +++ b/smtk/common/pybind11/PybindStringUtil.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::common::StringUtil > pybind11_init_smtk_common_StringUtil(py::module &m) +inline py::class_< smtk::common::StringUtil > pybind11_init_smtk_common_StringUtil(py::module &m) { py::class_< smtk::common::StringUtil > instance(m, "StringUtil"); instance diff --git a/smtk/common/pybind11/PybindTimeZone.h b/smtk/common/pybind11/PybindTimeZone.h index 1541eac858..85451d55f7 100644 --- a/smtk/common/pybind11/PybindTimeZone.h +++ b/smtk/common/pybind11/PybindTimeZone.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::common::TimeZone > pybind11_init_smtk_common_TimeZone(py::module &m) +inline py::class_< smtk::common::TimeZone > pybind11_init_smtk_common_TimeZone(py::module &m) { py::class_< smtk::common::TimeZone > instance(m, "TimeZone"); instance diff --git a/smtk/common/pybind11/PybindUUID.h b/smtk/common/pybind11/PybindUUID.h index fe21e76466..a3c0c968b7 100644 --- a/smtk/common/pybind11/PybindUUID.h +++ b/smtk/common/pybind11/PybindUUID.h @@ -19,7 +19,7 @@ namespace py = pybind11; -py::class_< smtk::common::UUID > pybind11_init_smtk_common_UUID(py::module &m) +inline py::class_< smtk::common::UUID > pybind11_init_smtk_common_UUID(py::module &m) { py::class_< smtk::common::UUID > instance(m, "UUID"); instance diff --git a/smtk/common/pybind11/PybindUUIDGenerator.h b/smtk/common/pybind11/PybindUUIDGenerator.h index 6d2cdaaaa1..57ea902122 100644 --- a/smtk/common/pybind11/PybindUUIDGenerator.h +++ b/smtk/common/pybind11/PybindUUIDGenerator.h @@ -21,7 +21,7 @@ namespace py = pybind11; -py::class_< smtk::common::UUIDGenerator > pybind11_init_smtk_common_UUIDGenerator(py::module &m) +inline py::class_< smtk::common::UUIDGenerator > pybind11_init_smtk_common_UUIDGenerator(py::module &m) { py::class_< smtk::common::UUIDGenerator > instance(m, "UUIDGenerator"); instance diff --git a/smtk/common/pybind11/PybindVersion.h b/smtk/common/pybind11/PybindVersion.h index cdbf2e52a7..2b17446625 100644 --- a/smtk/common/pybind11/PybindVersion.h +++ b/smtk/common/pybind11/PybindVersion.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::common::Version > pybind11_init_smtk_common_Version(py::module &m) +inline py::class_< smtk::common::Version > pybind11_init_smtk_common_Version(py::module &m) { py::class_< smtk::common::Version > instance(m, "Version"); instance diff --git a/smtk/extension/delaunay/pybind11/PybindRegistrar.h b/smtk/extension/delaunay/pybind11/PybindRegistrar.h index 980d58fee7..0af4a20759 100644 --- a/smtk/extension/delaunay/pybind11/PybindRegistrar.h +++ b/smtk/extension/delaunay/pybind11/PybindRegistrar.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::extension::delaunay::Registrar > pybind11_init_smtk_extension_delaunay_Registrar(py::module &m) +inline py::class_< smtk::extension::delaunay::Registrar > pybind11_init_smtk_extension_delaunay_Registrar(py::module &m) { py::class_< smtk::extension::delaunay::Registrar > instance(m, "Registrar"); instance diff --git a/smtk/extension/delaunay/pybind11/PybindTessellateFaces.h b/smtk/extension/delaunay/pybind11/PybindTessellateFaces.h index 4056734e85..e5450bed20 100644 --- a/smtk/extension/delaunay/pybind11/PybindTessellateFaces.h +++ b/smtk/extension/delaunay/pybind11/PybindTessellateFaces.h @@ -15,7 +15,7 @@ #include "smtk/extension/delaunay/operators/TessellateFaces.h" -PySharedPtrClass< smtk::extension::delaunay::TessellateFaces, smtk::operation::XMLOperation > pybind11_init_smtk_extension_delaunay_TessellateFaces(py::module &m) +inline PySharedPtrClass< smtk::extension::delaunay::TessellateFaces, smtk::operation::XMLOperation > pybind11_init_smtk_extension_delaunay_TessellateFaces(py::module &m) { PySharedPtrClass< smtk::extension::delaunay::TessellateFaces, smtk::operation::XMLOperation > instance(m, "TessellateFaces"); instance diff --git a/smtk/extension/delaunay/pybind11/PybindTriangulateFaces.h b/smtk/extension/delaunay/pybind11/PybindTriangulateFaces.h index e5afde37b0..3d5630a1a9 100644 --- a/smtk/extension/delaunay/pybind11/PybindTriangulateFaces.h +++ b/smtk/extension/delaunay/pybind11/PybindTriangulateFaces.h @@ -17,7 +17,7 @@ #include "smtk/operation/XMLOperation.h" -PySharedPtrClass< smtk::extension::delaunay::TriangulateFaces, smtk::operation::XMLOperation > pybind11_init_smtk_extension_delaunay_TriangulateFaces(py::module &m) +inline PySharedPtrClass< smtk::extension::delaunay::TriangulateFaces, smtk::operation::XMLOperation > pybind11_init_smtk_extension_delaunay_TriangulateFaces(py::module &m) { PySharedPtrClass< smtk::extension::delaunay::TriangulateFaces, smtk::operation::XMLOperation > instance(m, "TriangulateFaces"); instance diff --git a/smtk/extension/vtk/io/pybind11/PybindExportVTKData.h b/smtk/extension/vtk/io/pybind11/PybindExportVTKData.h index ae39634b21..d45aa509b9 100644 --- a/smtk/extension/vtk/io/pybind11/PybindExportVTKData.h +++ b/smtk/extension/vtk/io/pybind11/PybindExportVTKData.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::extension::vtk::io::mesh::ExportVTKData > pybind11_init_smtk_extension_vtk_io_mesh_ExportVTKData(py::module &m) +inline py::class_< smtk::extension::vtk::io::mesh::ExportVTKData > pybind11_init_smtk_extension_vtk_io_mesh_ExportVTKData(py::module &m) { py::class_< smtk::extension::vtk::io::mesh::ExportVTKData > instance(m, "ExportVTKData"); instance diff --git a/smtk/extension/vtk/io/pybind11/PybindImportAsVTKData.h b/smtk/extension/vtk/io/pybind11/PybindImportAsVTKData.h index 53d505c23d..5995e1224a 100644 --- a/smtk/extension/vtk/io/pybind11/PybindImportAsVTKData.h +++ b/smtk/extension/vtk/io/pybind11/PybindImportAsVTKData.h @@ -21,7 +21,7 @@ namespace py = pybind11; -py::class_ pybind11_init_smtk_extension_vtk_io_ImportAsVTKData(py::module &m) +inline py::class_ pybind11_init_smtk_extension_vtk_io_ImportAsVTKData(py::module &m) { py::class_< smtk::extension::vtk::io::ImportAsVTKData> instance(m, "ImportAsVTKData"); instance diff --git a/smtk/extension/vtk/io/pybind11/PybindImportVTKData.h b/smtk/extension/vtk/io/pybind11/PybindImportVTKData.h index 3a77f4053e..c176234031 100644 --- a/smtk/extension/vtk/io/pybind11/PybindImportVTKData.h +++ b/smtk/extension/vtk/io/pybind11/PybindImportVTKData.h @@ -19,7 +19,7 @@ namespace py = pybind11; -py::class_< smtk::extension::vtk::io::mesh::ImportVTKData > pybind11_init_smtk_extension_vtk_io_mesh_ImportVTKData(py::module &m) +inline py::class_< smtk::extension::vtk::io::mesh::ImportVTKData > pybind11_init_smtk_extension_vtk_io_mesh_ImportVTKData(py::module &m) { py::class_< smtk::extension::vtk::io::mesh::ImportVTKData > instance(m, "ImportVTKData"); instance diff --git a/smtk/extension/vtk/io/pybind11/PybindMeshIOVTK.h b/smtk/extension/vtk/io/pybind11/PybindMeshIOVTK.h index 453aa4e132..acc788d56a 100644 --- a/smtk/extension/vtk/io/pybind11/PybindMeshIOVTK.h +++ b/smtk/extension/vtk/io/pybind11/PybindMeshIOVTK.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::extension::vtk::io::mesh::MeshIOVTK, smtk::io::mesh::MeshIO > pybind11_init_smtk_extension_vtk_io_mesh_MeshIOVTK(py::module &m) +inline PySharedPtrClass< smtk::extension::vtk::io::mesh::MeshIOVTK, smtk::io::mesh::MeshIO > pybind11_init_smtk_extension_vtk_io_mesh_MeshIOVTK(py::module &m) { PySharedPtrClass< smtk::extension::vtk::io::mesh::MeshIOVTK, smtk::io::mesh::MeshIO > instance(m, "MeshIOVTK"); instance diff --git a/smtk/geometry/pybind11/PybindBackend.h b/smtk/geometry/pybind11/PybindBackend.h index dacb4c5b66..7817683e42 100644 --- a/smtk/geometry/pybind11/PybindBackend.h +++ b/smtk/geometry/pybind11/PybindBackend.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::geometry::Backend > pybind11_init_smtk_geometry_Backend(py::module &m) +inline py::class_< smtk::geometry::Backend > pybind11_init_smtk_geometry_Backend(py::module &m) { py::class_< smtk::geometry::Backend > instance(m, "Backend"); instance diff --git a/smtk/geometry/pybind11/PybindGeometry.h b/smtk/geometry/pybind11/PybindGeometry.h index 38f4ad69a5..da6e9c50c5 100644 --- a/smtk/geometry/pybind11/PybindGeometry.h +++ b/smtk/geometry/pybind11/PybindGeometry.h @@ -22,7 +22,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::geometry::Geometry > pybind11_init_smtk_geometry_Geometry(py::module &m) +inline PySharedPtrClass< smtk::geometry::Geometry > pybind11_init_smtk_geometry_Geometry(py::module &m) { PySharedPtrClass< smtk::geometry::Geometry > instance(m, "Geometry"); instance diff --git a/smtk/geometry/pybind11/PybindManager.h b/smtk/geometry/pybind11/PybindManager.h index 6736be8050..ebb8932ac1 100644 --- a/smtk/geometry/pybind11/PybindManager.h +++ b/smtk/geometry/pybind11/PybindManager.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::geometry::Manager > pybind11_init_smtk_geometry_Manager(py::module &m) +inline PySharedPtrClass< smtk::geometry::Manager > pybind11_init_smtk_geometry_Manager(py::module &m) { PySharedPtrClass< smtk::geometry::Manager > instance(m, "Manager"); instance diff --git a/smtk/geometry/pybind11/PybindResource.h b/smtk/geometry/pybind11/PybindResource.h index 07259d3ef9..96b664ebc8 100644 --- a/smtk/geometry/pybind11/PybindResource.h +++ b/smtk/geometry/pybind11/PybindResource.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::geometry::Resource, smtk::resource::DerivedFrom > pybind11_init_smtk_geometry_Resource(py::module &m) +inline PySharedPtrClass< smtk::geometry::Resource, smtk::resource::DerivedFrom > pybind11_init_smtk_geometry_Resource(py::module &m) { PySharedPtrClass< smtk::geometry::Resource, smtk::resource::DerivedFrom > instance(m, "Resource"); instance diff --git a/smtk/io/pybind11/PybindAttributeReader.h b/smtk/io/pybind11/PybindAttributeReader.h index 8ad653abe3..6e0cbd9559 100644 --- a/smtk/io/pybind11/PybindAttributeReader.h +++ b/smtk/io/pybind11/PybindAttributeReader.h @@ -21,7 +21,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::io::AttributeReader > pybind11_init_smtk_io_AttributeReader(py::module &m) +inline PySharedPtrClass< smtk::io::AttributeReader > pybind11_init_smtk_io_AttributeReader(py::module &m) { PySharedPtrClass< smtk::io::AttributeReader > instance(m, "AttributeReader"); instance diff --git a/smtk/io/pybind11/PybindAttributeWriter.h b/smtk/io/pybind11/PybindAttributeWriter.h index 03c0a07aa8..565b3e7d1f 100644 --- a/smtk/io/pybind11/PybindAttributeWriter.h +++ b/smtk/io/pybind11/PybindAttributeWriter.h @@ -20,7 +20,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::io::AttributeWriter > pybind11_init_smtk_io_AttributeWriter(py::module &m) +inline PySharedPtrClass< smtk::io::AttributeWriter > pybind11_init_smtk_io_AttributeWriter(py::module &m) { PySharedPtrClass< smtk::io::AttributeWriter > instance(m, "AttributeWriter"); instance diff --git a/smtk/io/pybind11/PybindExportMesh.h b/smtk/io/pybind11/PybindExportMesh.h index cc7285e0d3..99734d0a1f 100644 --- a/smtk/io/pybind11/PybindExportMesh.h +++ b/smtk/io/pybind11/PybindExportMesh.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::io::ExportMesh > pybind11_init_smtk_io_ExportMesh(py::module &m) +inline PySharedPtrClass< smtk::io::ExportMesh > pybind11_init_smtk_io_ExportMesh(py::module &m) { PySharedPtrClass< smtk::io::ExportMesh > instance(m, "ExportMesh"); instance @@ -29,12 +29,12 @@ PySharedPtrClass< smtk::io::ExportMesh > pybind11_init_smtk_io_ExportMesh(py::mo return instance; } -void pybind11_init__ZN4smtk2io10exportMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io10exportMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) { m.def("exportMesh", (bool (*)(::std::string const &, ::smtk::mesh::ResourcePtr)) &smtk::io::exportMesh, "", py::arg("filePath"), py::arg("resource")); } -void pybind11_init__ZN4smtk2io10exportMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEENSA_INS_5model7ResourceEEES9_(py::module &m) +inline void pybind11_init__ZN4smtk2io10exportMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEENSA_INS_5model7ResourceEEES9_(py::module &m) { m.def("exportMesh", (bool (*)(::std::string const &, ::smtk::mesh::ResourcePtr, ::smtk::model::ResourcePtr, ::std::string const &)) &smtk::io::exportMesh, "", py::arg("filePath"), py::arg("resource"), py::arg("resource"), py::arg("modelPropertyName")); } diff --git a/smtk/io/pybind11/PybindFormat.h b/smtk/io/pybind11/PybindFormat.h index 382906209e..2110e865e2 100644 --- a/smtk/io/pybind11/PybindFormat.h +++ b/smtk/io/pybind11/PybindFormat.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::io::mesh::Format > pybind11_init_smtk_io_mesh_Format(py::module &m) +inline PySharedPtrClass< smtk::io::mesh::Format > pybind11_init_smtk_io_mesh_Format(py::module &m) { PySharedPtrClass< smtk::io::mesh::Format > instance(m, "Format"); instance diff --git a/smtk/io/pybind11/PybindImportMesh.h b/smtk/io/pybind11/PybindImportMesh.h index f09f29d346..39ab9f2ffd 100644 --- a/smtk/io/pybind11/PybindImportMesh.h +++ b/smtk/io/pybind11/PybindImportMesh.h @@ -18,7 +18,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::io::ImportMesh > pybind11_init_smtk_io_ImportMesh(py::module &m) +inline PySharedPtrClass< smtk::io::ImportMesh > pybind11_init_smtk_io_ImportMesh(py::module &m) { PySharedPtrClass< smtk::io::ImportMesh > instance(m, "ImportMesh"); instance @@ -30,22 +30,22 @@ PySharedPtrClass< smtk::io::ImportMesh > pybind11_init_smtk_io_ImportMesh(py::mo return instance; } -void pybind11_init__ZN4smtk2io10importMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh7InterfaceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io10importMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh7InterfaceEEE(py::module &m) { m.def("importMesh", (smtk::mesh::ResourcePtr (*)(::std::string const &, const ::smtk::mesh::InterfacePtr&)) &smtk::io::importMesh, "", py::arg("filePath"), py::arg("interface")); } -void pybind11_init__ZN4smtk2io10importMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh7InterfaceEEES9_(py::module &m) +inline void pybind11_init__ZN4smtk2io10importMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh7InterfaceEEES9_(py::module &m) { m.def("importMesh", (smtk::mesh::ResourcePtr (*)(::std::string const &, const ::smtk::mesh::InterfacePtr&, ::std::string const &)) &smtk::io::importMesh, "", py::arg("filePath"), py::arg("interface"), py::arg("domainPropertyName")); } -void pybind11_init__ZN4smtk2io10importMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io10importMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) { m.def("importMesh", (bool (*)(::std::string const &, ::smtk::mesh::ResourcePtr)) &smtk::io::importMesh, "", py::arg("filePath"), py::arg("resource")); } -void pybind11_init__ZN4smtk2io10importMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEES9_(py::module &m) +inline void pybind11_init__ZN4smtk2io10importMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEES9_(py::module &m) { m.def("importMesh", (bool (*)(::std::string const &, ::smtk::mesh::ResourcePtr, ::std::string const &)) &smtk::io::importMesh, "", py::arg("filePath"), py::arg("resource"), py::arg("domainPropertyName")); } diff --git a/smtk/io/pybind11/PybindLogger.h b/smtk/io/pybind11/PybindLogger.h index 6b5ec6d72e..3a334634e0 100644 --- a/smtk/io/pybind11/PybindLogger.h +++ b/smtk/io/pybind11/PybindLogger.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::io::Logger > pybind11_init_smtk_io_Logger(py::module &m) +inline PySharedPtrClass< smtk::io::Logger > pybind11_init_smtk_io_Logger(py::module &m) { PySharedPtrClass< smtk::io::Logger > instance(m, "Logger"); instance diff --git a/smtk/io/pybind11/PybindMeshIO.h b/smtk/io/pybind11/PybindMeshIO.h index aae70a4190..03cbd0f8e5 100644 --- a/smtk/io/pybind11/PybindMeshIO.h +++ b/smtk/io/pybind11/PybindMeshIO.h @@ -17,7 +17,7 @@ namespace py = pybind11; -void pybind11_init_smtk_io_mesh_Subset(py::module &m) +inline void pybind11_init_smtk_io_mesh_Subset(py::module &m) { py::enum_(m, "Subset") .value("EntireResource", smtk::io::mesh::Subset::EntireResource) @@ -27,7 +27,7 @@ void pybind11_init_smtk_io_mesh_Subset(py::module &m) .export_values(); } -PySharedPtrClass< smtk::io::mesh::MeshIO > pybind11_init_smtk_io_mesh_MeshIO(py::module &m) +inline PySharedPtrClass< smtk::io::mesh::MeshIO > pybind11_init_smtk_io_mesh_MeshIO(py::module &m) { PySharedPtrClass< smtk::io::mesh::MeshIO > instance(m, "MeshIO"); instance diff --git a/smtk/io/pybind11/PybindMeshIOMoab.h b/smtk/io/pybind11/PybindMeshIOMoab.h index 22d54b34f9..5a6397b755 100644 --- a/smtk/io/pybind11/PybindMeshIOMoab.h +++ b/smtk/io/pybind11/PybindMeshIOMoab.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::io::mesh::MeshIOMoab > pybind11_init_smtk_io_mesh_MeshIOMoab(py::module &m, PySharedPtrClass< smtk::io::mesh::MeshIO >& parent) +inline PySharedPtrClass< smtk::io::mesh::MeshIOMoab > pybind11_init_smtk_io_mesh_MeshIOMoab(py::module &m, PySharedPtrClass< smtk::io::mesh::MeshIO >& parent) { PySharedPtrClass< smtk::io::mesh::MeshIOMoab > instance(m, "MeshIOMoab", parent); instance diff --git a/smtk/io/pybind11/PybindMeshIOXMS.h b/smtk/io/pybind11/PybindMeshIOXMS.h index c1e350940a..8a6f899947 100644 --- a/smtk/io/pybind11/PybindMeshIOXMS.h +++ b/smtk/io/pybind11/PybindMeshIOXMS.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::io::mesh::MeshIOXMS > pybind11_init_smtk_io_mesh_MeshIOXMS(py::module &m, PySharedPtrClass< smtk::io::mesh::MeshIO >& parent) +inline PySharedPtrClass< smtk::io::mesh::MeshIOXMS > pybind11_init_smtk_io_mesh_MeshIOXMS(py::module &m, PySharedPtrClass< smtk::io::mesh::MeshIO >& parent) { PySharedPtrClass< smtk::io::mesh::MeshIOXMS > instance(m, "MeshIOXMS", parent); instance diff --git a/smtk/io/pybind11/PybindModelToMesh.h b/smtk/io/pybind11/PybindModelToMesh.h index 07e19fc69a..07426dd1e7 100644 --- a/smtk/io/pybind11/PybindModelToMesh.h +++ b/smtk/io/pybind11/PybindModelToMesh.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::io::ModelToMesh > pybind11_init_smtk_io_ModelToMesh(py::module &m) +inline PySharedPtrClass< smtk::io::ModelToMesh > pybind11_init_smtk_io_ModelToMesh(py::module &m) { PySharedPtrClass< smtk::io::ModelToMesh > instance(m, "ModelToMesh"); instance diff --git a/smtk/io/pybind11/PybindReadMesh.h b/smtk/io/pybind11/PybindReadMesh.h index 394d5f9b82..1b7d3c5fee 100644 --- a/smtk/io/pybind11/PybindReadMesh.h +++ b/smtk/io/pybind11/PybindReadMesh.h @@ -18,7 +18,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::io::ReadMesh > pybind11_init_smtk_io_ReadMesh(py::module &m) +inline PySharedPtrClass< smtk::io::ReadMesh > pybind11_init_smtk_io_ReadMesh(py::module &m) { PySharedPtrClass< smtk::io::ReadMesh > instance(m, "ReadMesh"); instance @@ -30,52 +30,52 @@ PySharedPtrClass< smtk::io::ReadMesh > pybind11_init_smtk_io_ReadMesh(py::module return instance; } -void pybind11_init__ZN4smtk2io13readDirichletERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh7InterfaceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io13readDirichletERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh7InterfaceEEE(py::module &m) { m.def("readDirichlet", (smtk::mesh::ResourcePtr (*)(::std::string const &, const ::smtk::mesh::InterfacePtr&)) &smtk::io::readDirichlet, "", py::arg("filePath"), py::arg("interface")); } -void pybind11_init__ZN4smtk2io13readDirichletERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io13readDirichletERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) { m.def("readDirichlet", (bool (*)(::std::string const &, ::smtk::mesh::ResourcePtr)) &smtk::io::readDirichlet, "", py::arg("filePath"), py::arg("resource")); } -void pybind11_init__ZN4smtk2io10readDomainERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh7InterfaceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io10readDomainERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh7InterfaceEEE(py::module &m) { m.def("readDomain", (smtk::mesh::ResourcePtr (*)(::std::string const &, const ::smtk::mesh::InterfacePtr&)) &smtk::io::readDomain, "", py::arg("filePath"), py::arg("interface")); } -void pybind11_init__ZN4smtk2io10readDomainERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io10readDomainERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) { m.def("readDomain", (bool (*)(::std::string const &, ::smtk::mesh::ResourcePtr)) &smtk::io::readDomain, "", py::arg("filePath"), py::arg("resource")); } -void pybind11_init__ZN4smtk2io20readEntireResourceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh7InterfaceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io20readEntireResourceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh7InterfaceEEE(py::module &m) { m.def("readEntireResource", (smtk::mesh::ResourcePtr (*)(::std::string const &, const ::smtk::mesh::InterfacePtr&)) &smtk::io::readEntireResource, "", py::arg("filePath"), py::arg("interface")); } -void pybind11_init__ZN4smtk2io20readEntireResourceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io20readEntireResourceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) { m.def("readEntireResource", (bool (*)(::std::string const &, ::smtk::mesh::ResourcePtr)) &smtk::io::readEntireResource, "", py::arg("filePath"), py::arg("resource")); } -void pybind11_init__ZN4smtk2io8readMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh7InterfaceEEENS0_4mesh6SubsetE(py::module &m) +inline void pybind11_init__ZN4smtk2io8readMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh7InterfaceEEENS0_4mesh6SubsetE(py::module &m) { m.def("readMesh", (smtk::mesh::ResourcePtr (*)(::std::string const &, const ::smtk::mesh::InterfacePtr&, ::smtk::io::mesh::Subset)) &smtk::io::readMesh, "", py::arg("filePath"), py::arg("interface"), py::arg("subset") = ::smtk::io::mesh::Subset::EntireResource); } -void pybind11_init__ZN4smtk2io8readMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEENS0_4mesh6SubsetE(py::module &m) +inline void pybind11_init__ZN4smtk2io8readMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEENS0_4mesh6SubsetE(py::module &m) { m.def("readMesh", (bool (*)(::std::string const &, ::smtk::mesh::ResourcePtr, ::smtk::io::mesh::Subset)) &smtk::io::readMesh, "", py::arg("filePath"), py::arg("resource"), py::arg("subset") = ::smtk::io::mesh::Subset::EntireResource); } -void pybind11_init__ZN4smtk2io11readNeumannERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh7InterfaceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io11readNeumannERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh7InterfaceEEE(py::module &m) { m.def("readNeumann", (smtk::mesh::ResourcePtr (*)(::std::string const &, const ::smtk::mesh::InterfacePtr&)) &smtk::io::readNeumann, "", py::arg("filePath"), py::arg("interface")); } -void pybind11_init__ZN4smtk2io11readNeumannERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io11readNeumannERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) { m.def("readNeumann", (bool (*)(::std::string const &, ::smtk::mesh::ResourcePtr)) &smtk::io::readNeumann, "", py::arg("filePath"), py::arg("resource")); } diff --git a/smtk/io/pybind11/PybindWriteMesh.h b/smtk/io/pybind11/PybindWriteMesh.h index 51f4728ef3..7cc97da8a6 100644 --- a/smtk/io/pybind11/PybindWriteMesh.h +++ b/smtk/io/pybind11/PybindWriteMesh.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::io::WriteMesh > pybind11_init_smtk_io_WriteMesh(py::module &m) +inline PySharedPtrClass< smtk::io::WriteMesh > pybind11_init_smtk_io_WriteMesh(py::module &m) { PySharedPtrClass< smtk::io::WriteMesh > instance(m, "WriteMesh"); instance @@ -28,52 +28,52 @@ PySharedPtrClass< smtk::io::WriteMesh > pybind11_init_smtk_io_WriteMesh(py::modu return instance; } -void pybind11_init__ZN4smtk2io14writeDirichletERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io14writeDirichletERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) { m.def("writeDirichlet", (bool (*)(::std::string const &, ::smtk::mesh::ResourcePtr)) &smtk::io::writeDirichlet, "", py::arg("filePath"), py::arg("resource")); } -void pybind11_init__ZN4smtk2io14writeDirichletENSt3__110shared_ptrINS_4mesh10ResourceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io14writeDirichletENSt3__110shared_ptrINS_4mesh10ResourceEEE(py::module &m) { m.def("writeDirichlet", (bool (*)(::smtk::mesh::ResourcePtr)) &smtk::io::writeDirichlet, "", py::arg("resource")); } -void pybind11_init__ZN4smtk2io11writeDomainERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io11writeDomainERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) { m.def("writeDomain", (bool (*)(::std::string const &, ::smtk::mesh::ResourcePtr)) &smtk::io::writeDomain, "", py::arg("filePath"), py::arg("resource")); } -void pybind11_init__ZN4smtk2io11writeDomainENSt3__110shared_ptrINS_4mesh10ResourceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io11writeDomainENSt3__110shared_ptrINS_4mesh10ResourceEEE(py::module &m) { m.def("writeDomain", (bool (*)(::smtk::mesh::ResourcePtr)) &smtk::io::writeDomain, "", py::arg("resource")); } -void pybind11_init__ZN4smtk2io21writeEntireResourceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io21writeEntireResourceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) { m.def("writeEntireResource", (bool (*)(::std::string const &, ::smtk::mesh::ResourcePtr)) &smtk::io::writeEntireResource, "", py::arg("filePath"), py::arg("resource")); } -void pybind11_init__ZN4smtk2io21writeEntireResourceENSt3__110shared_ptrINS_4mesh10ResourceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io21writeEntireResourceENSt3__110shared_ptrINS_4mesh10ResourceEEE(py::module &m) { m.def("writeEntireResource", (bool (*)(::smtk::mesh::ResourcePtr)) &smtk::io::writeEntireResource, "", py::arg("resource")); } -void pybind11_init__ZN4smtk2io9writeMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEENS0_4mesh6SubsetE(py::module &m) +inline void pybind11_init__ZN4smtk2io9writeMeshERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEENS0_4mesh6SubsetE(py::module &m) { m.def("writeMesh", (bool (*)(::std::string const &, ::smtk::mesh::ResourcePtr, ::smtk::io::mesh::Subset)) &smtk::io::writeMesh, "", py::arg("filePath"), py::arg("resource"), py::arg("subset") = ::smtk::io::mesh::Subset::EntireResource); } -void pybind11_init__ZN4smtk2io9writeMeshENSt3__110shared_ptrINS_4mesh10ResourceEEENS0_4mesh6SubsetE(py::module &m) +inline void pybind11_init__ZN4smtk2io9writeMeshENSt3__110shared_ptrINS_4mesh10ResourceEEENS0_4mesh6SubsetE(py::module &m) { m.def("writeMesh", (bool (*)(::smtk::mesh::ResourcePtr, ::smtk::io::mesh::Subset)) &smtk::io::writeMesh, "", py::arg("resource"), py::arg("subset") = ::smtk::io::mesh::Subset::EntireResource); } -void pybind11_init__ZN4smtk2io12writeNeumannERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io12writeNeumannERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10shared_ptrINS_4mesh10ResourceEEE(py::module &m) { m.def("writeNeumann", (bool (*)(::std::string const &, ::smtk::mesh::ResourcePtr)) &smtk::io::writeNeumann, "", py::arg("filePath"), py::arg("resource")); } -void pybind11_init__ZN4smtk2io12writeNeumannENSt3__110shared_ptrINS_4mesh10ResourceEEE(py::module &m) +inline void pybind11_init__ZN4smtk2io12writeNeumannENSt3__110shared_ptrINS_4mesh10ResourceEEE(py::module &m) { m.def("writeNeumann", (bool (*)(::smtk::mesh::ResourcePtr)) &smtk::io::writeNeumann, "", py::arg("resource")); } diff --git a/smtk/mesh/pybind11/PybindApplyToMesh.h b/smtk/mesh/pybind11/PybindApplyToMesh.h index af732e07a4..f3e00bc401 100644 --- a/smtk/mesh/pybind11/PybindApplyToMesh.h +++ b/smtk/mesh/pybind11/PybindApplyToMesh.h @@ -19,32 +19,32 @@ namespace py = pybind11; -void pybind11_init_smtk_mesh_utility_applyScalarCellField(py::module &m) +inline void pybind11_init_smtk_mesh_utility_applyScalarCellField(py::module &m) { m.def("applyScalarCellField", &smtk::mesh::utility::applyScalarCellField, "", py::arg("arg0"), py::arg("name"), py::arg("ms")); } -void pybind11_init_smtk_mesh_utility_applyScalarPointField(py::module &m) +inline void pybind11_init_smtk_mesh_utility_applyScalarPointField(py::module &m) { m.def("applyScalarPointField", &smtk::mesh::utility::applyScalarPointField, "", py::arg("arg0"), py::arg("name"), py::arg("ms")); } -void pybind11_init_smtk_mesh_utility_applyVectorCellField(py::module &m) +inline void pybind11_init_smtk_mesh_utility_applyVectorCellField(py::module &m) { m.def("applyVectorCellField", &smtk::mesh::utility::applyVectorCellField, "", py::arg("arg0"), py::arg("name"), py::arg("ms")); } -void pybind11_init_smtk_mesh_utility_applyVectorPointField(py::module &m) +inline void pybind11_init_smtk_mesh_utility_applyVectorPointField(py::module &m) { m.def("applyVectorPointField", &smtk::mesh::utility::applyVectorPointField, "", py::arg("arg0"), py::arg("name"), py::arg("ms")); } -void pybind11_init_smtk_mesh_utility_applyWarp(py::module &m) +inline void pybind11_init_smtk_mesh_utility_applyWarp(py::module &m) { m.def("applyWarp", &smtk::mesh::utility::applyWarp, "", py::arg("arg0"), py::arg("ms"), py::arg("storePriorCoordinates") = false); } -void pybind11_init_smtk_mesh_utility_undoWarp(py::module &m) +inline void pybind11_init_smtk_mesh_utility_undoWarp(py::module &m) { m.def("undoWarp", &smtk::mesh::utility::undoWarp, "", py::arg("ms")); } diff --git a/smtk/mesh/pybind11/PybindCellField.h b/smtk/mesh/pybind11/PybindCellField.h index c637547d10..c4a24ff95b 100644 --- a/smtk/mesh/pybind11/PybindCellField.h +++ b/smtk/mesh/pybind11/PybindCellField.h @@ -21,7 +21,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::CellField > pybind11_init_smtk_mesh_CellField(py::module &m) +inline PySharedPtrClass< smtk::mesh::CellField > pybind11_init_smtk_mesh_CellField(py::module &m) { PySharedPtrClass< smtk::mesh::CellField > instance(m, "CellField"); instance diff --git a/smtk/mesh/pybind11/PybindCellSet.h b/smtk/mesh/pybind11/PybindCellSet.h index c56b70cc24..c5fd9d1c51 100644 --- a/smtk/mesh/pybind11/PybindCellSet.h +++ b/smtk/mesh/pybind11/PybindCellSet.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::CellSet > pybind11_init_smtk_mesh_CellSet(py::module &m) +inline PySharedPtrClass< smtk::mesh::CellSet > pybind11_init_smtk_mesh_CellSet(py::module &m) { PySharedPtrClass< smtk::mesh::CellSet > instance(m, "CellSet"); instance @@ -43,32 +43,32 @@ PySharedPtrClass< smtk::mesh::CellSet > pybind11_init_smtk_mesh_CellSet(py::modu return instance; } -void pybind11_init_smtk_mesh_cell_for_each(py::module &m) +inline void pybind11_init_smtk_mesh_cell_for_each(py::module &m) { m.def("for_each", (void (*)(const smtk::mesh::CellSet&, smtk::mesh::CellForEach&)) &smtk::mesh::for_each, "", py::arg("a"), py::arg("filter")); } -void pybind11_init_smtk_mesh_cell_point_difference(py::module &m) +inline void pybind11_init_smtk_mesh_cell_point_difference(py::module &m) { m.def("point_difference", (smtk::mesh::CellSet (*)(const smtk::mesh::CellSet&, const smtk::mesh::CellSet&, smtk::mesh::ContainmentType)) &smtk::mesh::point_difference, "", py::arg("a"), py::arg("b"), py::arg("t")); } -void pybind11_init_smtk_mesh_cell_point_intersect(py::module &m) +inline void pybind11_init_smtk_mesh_cell_point_intersect(py::module &m) { m.def("point_intersect", (smtk::mesh::CellSet (*)(const smtk::mesh::CellSet&, const smtk::mesh::CellSet&, smtk::mesh::ContainmentType)) &smtk::mesh::point_intersect, "", py::arg("a"), py::arg("b"), py::arg("t")); } -void pybind11_init_smtk_mesh_cell_set_difference(py::module &m) +inline void pybind11_init_smtk_mesh_cell_set_difference(py::module &m) { m.def("set_difference", (smtk::mesh::CellSet (*)(const smtk::mesh::CellSet&, const smtk::mesh::CellSet&)) &smtk::mesh::set_difference, "", py::arg("a"), py::arg("b")); } -void pybind11_init_smtk_mesh_cell_set_intersect(py::module &m) +inline void pybind11_init_smtk_mesh_cell_set_intersect(py::module &m) { m.def("set_intersect", (smtk::mesh::CellSet (*)(const smtk::mesh::CellSet&, const smtk::mesh::CellSet&)) &smtk::mesh::set_intersect, "", py::arg("a"), py::arg("b")); } -void pybind11_init_smtk_mesh_cell_set_union(py::module &m) +inline void pybind11_init_smtk_mesh_cell_set_union(py::module &m) { m.def("set_union", (smtk::mesh::CellSet (*)(const smtk::mesh::CellSet&, const smtk::mesh::CellSet&)) &smtk::mesh::set_union, "", py::arg("a"), py::arg("b")); } diff --git a/smtk/mesh/pybind11/PybindCellTypes.h b/smtk/mesh/pybind11/PybindCellTypes.h index aba51ad8bb..7e04322286 100644 --- a/smtk/mesh/pybind11/PybindCellTypes.h +++ b/smtk/mesh/pybind11/PybindCellTypes.h @@ -18,7 +18,7 @@ namespace py = pybind11; -void pybind11_init_smtk_mesh_CellType(py::module &m) +inline void pybind11_init_smtk_mesh_CellType(py::module &m) { py::enum_(m, "CellType") .value("Vertex", smtk::mesh::CellType::Vertex) @@ -34,12 +34,12 @@ void pybind11_init_smtk_mesh_CellType(py::module &m) .export_values(); } -void pybind11_init_smtk_mesh_verticesPerCell(py::module &m) +inline void pybind11_init_smtk_mesh_verticesPerCell(py::module &m) { m.def("verticesPerCell", &smtk::mesh::verticesPerCell, "", py::arg("ctype")); } -void pybind11_init_smtk_mesh_cellTypeSummary(py::module &m) +inline void pybind11_init_smtk_mesh_cellTypeSummary(py::module &m) { m.def("cellTypeSummary", &smtk::mesh::cellTypeSummary, "", py::arg("ctype"), py::arg("flag") = 0); } diff --git a/smtk/mesh/pybind11/PybindComponent.h b/smtk/mesh/pybind11/PybindComponent.h index e6040b26e8..9a96618c1c 100644 --- a/smtk/mesh/pybind11/PybindComponent.h +++ b/smtk/mesh/pybind11/PybindComponent.h @@ -22,7 +22,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::Component, smtk::resource::Component > pybind11_init_smtk_mesh_Component(py::module &m) +inline PySharedPtrClass< smtk::mesh::Component, smtk::resource::Component > pybind11_init_smtk_mesh_Component(py::module &m) { PySharedPtrClass< smtk::mesh::Component, smtk::resource::Component > instance(m, "Component"); instance diff --git a/smtk/mesh/pybind11/PybindDeleteMesh.h b/smtk/mesh/pybind11/PybindDeleteMesh.h index dbf5cf2001..be40074620 100644 --- a/smtk/mesh/pybind11/PybindDeleteMesh.h +++ b/smtk/mesh/pybind11/PybindDeleteMesh.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::DeleteMesh, smtk::operation::XMLOperation > pybind11_init_smtk_mesh_DeleteMesh(py::module &m) +inline PySharedPtrClass< smtk::mesh::DeleteMesh, smtk::operation::XMLOperation > pybind11_init_smtk_mesh_DeleteMesh(py::module &m) { PySharedPtrClass< smtk::mesh::DeleteMesh, smtk::operation::XMLOperation > instance(m, "DeleteMesh"); instance diff --git a/smtk/mesh/pybind11/PybindDimensionTypes.h b/smtk/mesh/pybind11/PybindDimensionTypes.h index 42ced50ed6..795642eaf9 100644 --- a/smtk/mesh/pybind11/PybindDimensionTypes.h +++ b/smtk/mesh/pybind11/PybindDimensionTypes.h @@ -17,7 +17,7 @@ namespace py = pybind11; -void pybind11_init_smtk_mesh_DimensionType(py::module &m) +inline void pybind11_init_smtk_mesh_DimensionType(py::module &m) { py::enum_(m, "DimensionType") .value("Dims0", smtk::mesh::DimensionType::Dims0) diff --git a/smtk/mesh/pybind11/PybindElevateMesh.h b/smtk/mesh/pybind11/PybindElevateMesh.h index 8c19056f0a..df4662f721 100644 --- a/smtk/mesh/pybind11/PybindElevateMesh.h +++ b/smtk/mesh/pybind11/PybindElevateMesh.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::ElevateMesh, smtk::operation::XMLOperation > pybind11_init_smtk_mesh_ElevateMesh(py::module &m) +inline PySharedPtrClass< smtk::mesh::ElevateMesh, smtk::operation::XMLOperation > pybind11_init_smtk_mesh_ElevateMesh(py::module &m) { PySharedPtrClass< smtk::mesh::ElevateMesh, smtk::operation::XMLOperation > instance(m, "ElevateMesh"); instance diff --git a/smtk/mesh/pybind11/PybindExport.h b/smtk/mesh/pybind11/PybindExport.h index a4c1aeceef..11a2a8e8b2 100644 --- a/smtk/mesh/pybind11/PybindExport.h +++ b/smtk/mesh/pybind11/PybindExport.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::Export, smtk::operation::XMLOperation > pybind11_init_smtk_mesh_Export(py::module &m) +inline PySharedPtrClass< smtk::mesh::Export, smtk::operation::XMLOperation > pybind11_init_smtk_mesh_Export(py::module &m) { PySharedPtrClass< smtk::mesh::Export, smtk::operation::XMLOperation > instance(m, "Export"); instance diff --git a/smtk/mesh/pybind11/PybindExtractCanonicalIndices.h b/smtk/mesh/pybind11/PybindExtractCanonicalIndices.h index 439bd2e723..cdc19e8e3a 100644 --- a/smtk/mesh/pybind11/PybindExtractCanonicalIndices.h +++ b/smtk/mesh/pybind11/PybindExtractCanonicalIndices.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::utility::PreAllocatedCanonicalIndices > pybind11_init_smtk_mesh_PreAllocatedCanonicalIndices(py::module &m) +inline PySharedPtrClass< smtk::mesh::utility::PreAllocatedCanonicalIndices > pybind11_init_smtk_mesh_PreAllocatedCanonicalIndices(py::module &m) { PySharedPtrClass< smtk::mesh::utility::PreAllocatedCanonicalIndices > instance(m, "PreAllocatedCanonicalIndices"); instance @@ -29,7 +29,7 @@ PySharedPtrClass< smtk::mesh::utility::PreAllocatedCanonicalIndices > pybind11_i return instance; } -PySharedPtrClass< smtk::mesh::utility::CanonicalIndices > pybind11_init_smtk_mesh_CanonicalIndices(py::module &m) +inline PySharedPtrClass< smtk::mesh::utility::CanonicalIndices > pybind11_init_smtk_mesh_CanonicalIndices(py::module &m) { PySharedPtrClass< smtk::mesh::utility::CanonicalIndices > instance(m, "CanonicalIndices"); instance @@ -43,7 +43,7 @@ PySharedPtrClass< smtk::mesh::utility::CanonicalIndices > pybind11_init_smtk_mes return instance; } -void pybind11_init__extractCanonicalIndices(py::module &m) +inline void pybind11_init__extractCanonicalIndices(py::module &m) { m.def("extractCanonicalIndices", (void (*)(::smtk::mesh::MeshSet const &, ::smtk::mesh::MeshSet const &, ::smtk::mesh::utility::PreAllocatedCanonicalIndices &)) &smtk::mesh::utility::extractCanonicalIndices, "", py::arg("arg0"), py::arg("arg1"), py::arg("arg2")); } diff --git a/smtk/mesh/pybind11/PybindExtractMeshConstants.h b/smtk/mesh/pybind11/PybindExtractMeshConstants.h index d2ceaeda42..8fbd226a9e 100644 --- a/smtk/mesh/pybind11/PybindExtractMeshConstants.h +++ b/smtk/mesh/pybind11/PybindExtractMeshConstants.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::utility::PreAllocatedMeshConstants > pybind11_init_smtk_mesh_PreAllocatedMeshConstants(py::module &m) +inline PySharedPtrClass< smtk::mesh::utility::PreAllocatedMeshConstants > pybind11_init_smtk_mesh_PreAllocatedMeshConstants(py::module &m) { PySharedPtrClass< smtk::mesh::utility::PreAllocatedMeshConstants > instance(m, "PreAllocatedMeshConstants"); instance @@ -29,7 +29,7 @@ PySharedPtrClass< smtk::mesh::utility::PreAllocatedMeshConstants > pybind11_init return instance; } -PySharedPtrClass< smtk::mesh::utility::MeshConstants > pybind11_init_smtk_mesh_MeshConstants(py::module &m) +inline PySharedPtrClass< smtk::mesh::utility::MeshConstants > pybind11_init_smtk_mesh_MeshConstants(py::module &m) { PySharedPtrClass< smtk::mesh::utility::MeshConstants > instance(m, "MeshConstants"); instance @@ -48,32 +48,32 @@ PySharedPtrClass< smtk::mesh::utility::MeshConstants > pybind11_init_smtk_mesh_M return instance; } -void pybind11_init__ZN4smtk4mesh21extractDirichletMeshConstantsERKNS0_7MeshSetERNS0_17PreAllocatedMeshConstantsE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh21extractDirichletMeshConstantsERKNS0_7MeshSetERNS0_17PreAllocatedMeshConstantsE(py::module &m) { m.def("extractDirichletMeshConstants", (void (*)(::smtk::mesh::MeshSet const &, ::smtk::mesh::utility::PreAllocatedMeshConstants &)) &smtk::mesh::utility::extractDirichletMeshConstants, "", py::arg("arg0"), py::arg("arg1")); } -void pybind11_init__ZN4smtk4mesh21extractDirichletMeshConstantsERKNS0_7MeshSetERKNS0_8PointSetERNS0_17PreAllocatedMeshConstantsE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh21extractDirichletMeshConstantsERKNS0_7MeshSetERKNS0_8PointSetERNS0_17PreAllocatedMeshConstantsE(py::module &m) { m.def("extractDirichletMeshConstants", (void (*)(::smtk::mesh::MeshSet const &, ::smtk::mesh::PointSet const &, ::smtk::mesh::utility::PreAllocatedMeshConstants &)) &smtk::mesh::utility::extractDirichletMeshConstants, "", py::arg("arg0"), py::arg("arg1"), py::arg("arg2")); } -void pybind11_init__ZN4smtk4mesh18extractDomainMeshConstantsERKNS0_7MeshSetERNS0_17PreAllocatedMeshConstantsE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh18extractDomainMeshConstantsERKNS0_7MeshSetERNS0_17PreAllocatedMeshConstantsE(py::module &m) { m.def("extractDomainMeshConstants", (void (*)(::smtk::mesh::MeshSet const &, ::smtk::mesh::utility::PreAllocatedMeshConstants &)) &smtk::mesh::utility::extractDomainMeshConstants, "", py::arg("arg0"), py::arg("arg1")); } -void pybind11_init__ZN4smtk4mesh18extractDomainMeshConstantsERKNS0_7MeshSetERKNS0_8PointSetERNS0_17PreAllocatedMeshConstantsE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh18extractDomainMeshConstantsERKNS0_7MeshSetERKNS0_8PointSetERNS0_17PreAllocatedMeshConstantsE(py::module &m) { m.def("extractDomainMeshConstants", (void (*)(::smtk::mesh::MeshSet const &, ::smtk::mesh::PointSet const &, ::smtk::mesh::utility::PreAllocatedMeshConstants &)) &smtk::mesh::utility::extractDomainMeshConstants, "", py::arg("arg0"), py::arg("arg1"), py::arg("arg2")); } -void pybind11_init__ZN4smtk4mesh19extractNeumannMeshConstantsERKNS0_7MeshSetERNS0_17PreAllocatedMeshConstantsE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh19extractNeumannMeshConstantsERKNS0_7MeshSetERNS0_17PreAllocatedMeshConstantsE(py::module &m) { m.def("extractNeumannMeshConstants", (void (*)(::smtk::mesh::MeshSet const &, ::smtk::mesh::utility::PreAllocatedMeshConstants &)) &smtk::mesh::utility::extractNeumannMeshConstants, "", py::arg("arg0"), py::arg("arg1")); } -void pybind11_init__ZN4smtk4mesh19extractNeumannMeshConstantsERKNS0_7MeshSetERKNS0_8PointSetERNS0_17PreAllocatedMeshConstantsE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh19extractNeumannMeshConstantsERKNS0_7MeshSetERKNS0_8PointSetERNS0_17PreAllocatedMeshConstantsE(py::module &m) { m.def("extractNeumannMeshConstants", (void (*)(::smtk::mesh::MeshSet const &, ::smtk::mesh::PointSet const &, ::smtk::mesh::utility::PreAllocatedMeshConstants &)) &smtk::mesh::utility::extractNeumannMeshConstants, "", py::arg("arg0"), py::arg("arg1"), py::arg("arg2")); } diff --git a/smtk/mesh/pybind11/PybindExtractTessellation.h b/smtk/mesh/pybind11/PybindExtractTessellation.h index 2c8ab9d133..69467fdcfc 100644 --- a/smtk/mesh/pybind11/PybindExtractTessellation.h +++ b/smtk/mesh/pybind11/PybindExtractTessellation.h @@ -20,7 +20,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::utility::PreAllocatedTessellation > pybind11_init_smtk_mesh_PreAllocatedTessellation(py::module &m) +inline PySharedPtrClass< smtk::mesh::utility::PreAllocatedTessellation > pybind11_init_smtk_mesh_PreAllocatedTessellation(py::module &m) { PySharedPtrClass< smtk::mesh::utility::PreAllocatedTessellation > instance(m, "PreAllocatedTessellation"); instance @@ -49,7 +49,7 @@ PySharedPtrClass< smtk::mesh::utility::PreAllocatedTessellation > pybind11_init_ return instance; } -PySharedPtrClass< smtk::mesh::utility::Tessellation > pybind11_init_smtk_mesh_Tessellation(py::module &m) +inline PySharedPtrClass< smtk::mesh::utility::Tessellation > pybind11_init_smtk_mesh_Tessellation(py::module &m) { PySharedPtrClass< smtk::mesh::utility::Tessellation > instance(m, "Tessellation"); instance @@ -71,57 +71,57 @@ PySharedPtrClass< smtk::mesh::utility::Tessellation > pybind11_init_smtk_mesh_Te return instance; } -void pybind11_init__ZN4smtk4mesh26extractOrderedTessellationERKNS_5model4EdgeERKNSt3__110shared_ptrINS0_10ResourceEEERNS0_24PreAllocatedTessellationE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh26extractOrderedTessellationERKNS_5model4EdgeERKNSt3__110shared_ptrINS0_10ResourceEEERNS0_24PreAllocatedTessellationE(py::module &m) { m.def("extractOrderedTessellation", (void (*)(::smtk::model::EdgeUse const &, ::smtk::mesh::ResourcePtr const &, ::smtk::mesh::utility::PreAllocatedTessellation &)) &smtk::mesh::utility::extractOrderedTessellation, "", py::arg("arg0"), py::arg("arg1"), py::arg("arg2")); } -void pybind11_init__ZN4smtk4mesh26extractOrderedTessellationERKNS_5model4LoopERKNSt3__110shared_ptrINS0_10ResourceEEERNS0_24PreAllocatedTessellationE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh26extractOrderedTessellationERKNS_5model4LoopERKNSt3__110shared_ptrINS0_10ResourceEEERNS0_24PreAllocatedTessellationE(py::module &m) { m.def("extractOrderedTessellation", (void (*)(::smtk::model::Loop const &, ::smtk::mesh::ResourcePtr const &, ::smtk::mesh::utility::PreAllocatedTessellation &)) &smtk::mesh::utility::extractOrderedTessellation, "", py::arg("arg0"), py::arg("arg1"), py::arg("arg2")); } -void pybind11_init__ZN4smtk4mesh26extractOrderedTessellationERKNS_5model4EdgeERKNSt3__110shared_ptrINS0_10ResourceEEERKNS0_8PointSetERNS0_24PreAllocatedTessellationE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh26extractOrderedTessellationERKNS_5model4EdgeERKNSt3__110shared_ptrINS0_10ResourceEEERKNS0_8PointSetERNS0_24PreAllocatedTessellationE(py::module &m) { m.def("extractOrderedTessellation", (void (*)(::smtk::model::EdgeUse const &, ::smtk::mesh::ResourcePtr const &, ::smtk::mesh::PointSet const &, ::smtk::mesh::utility::PreAllocatedTessellation &)) &smtk::mesh::utility::extractOrderedTessellation, "", py::arg("arg0"), py::arg("arg1"), py::arg("arg2"), py::arg("arg3")); } -void pybind11_init__ZN4smtk4mesh26extractOrderedTessellationERKNS_5model4LoopERKNSt3__110shared_ptrINS0_10ResourceEEERKNS0_8PointSetERNS0_24PreAllocatedTessellationE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh26extractOrderedTessellationERKNS_5model4LoopERKNSt3__110shared_ptrINS0_10ResourceEEERKNS0_8PointSetERNS0_24PreAllocatedTessellationE(py::module &m) { m.def("extractOrderedTessellation", (void (*)(::smtk::model::Loop const &, ::smtk::mesh::ResourcePtr const &, ::smtk::mesh::PointSet const &, ::smtk::mesh::utility::PreAllocatedTessellation &)) &smtk::mesh::utility::extractOrderedTessellation, "", py::arg("arg0"), py::arg("arg1"), py::arg("arg2"), py::arg("arg3")); } -void pybind11_init__ZN4smtk4mesh19extractTessellationERKNS0_7MeshSetERNS0_24PreAllocatedTessellationE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh19extractTessellationERKNS0_7MeshSetERNS0_24PreAllocatedTessellationE(py::module &m) { m.def("extractTessellation", (void (*)(::smtk::mesh::MeshSet const &, ::smtk::mesh::utility::PreAllocatedTessellation &)) &smtk::mesh::utility::extractTessellation, "", py::arg("arg0"), py::arg("arg1")); } -void pybind11_init__ZN4smtk4mesh19extractTessellationERKNS0_7CellSetERNS0_24PreAllocatedTessellationE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh19extractTessellationERKNS0_7CellSetERNS0_24PreAllocatedTessellationE(py::module &m) { m.def("extractTessellation", (void (*)(::smtk::mesh::CellSet const &, ::smtk::mesh::utility::PreAllocatedTessellation &)) &smtk::mesh::utility::extractTessellation, "", py::arg("arg0"), py::arg("arg1")); } -void pybind11_init__ZN4smtk4mesh19extractTessellationERKNS_5model9EntityRefERKNSt3__110shared_ptrINS0_10ResourceEEERNS0_24PreAllocatedTessellationE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh19extractTessellationERKNS_5model9EntityRefERKNSt3__110shared_ptrINS0_10ResourceEEERNS0_24PreAllocatedTessellationE(py::module &m) { m.def("extractTessellation", (void (*)(::smtk::model::EntityRef const &, ::smtk::mesh::ResourcePtr const &, ::smtk::mesh::utility::PreAllocatedTessellation &)) &smtk::mesh::utility::extractTessellation, "", py::arg("arg0"), py::arg("arg1"), py::arg("arg2")); } -void pybind11_init__ZN4smtk4mesh19extractTessellationERKNS0_7MeshSetERKNS0_8PointSetERNS0_24PreAllocatedTessellationE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh19extractTessellationERKNS0_7MeshSetERKNS0_8PointSetERNS0_24PreAllocatedTessellationE(py::module &m) { m.def("extractTessellation", (void (*)(::smtk::mesh::MeshSet const &, ::smtk::mesh::PointSet const &, ::smtk::mesh::utility::PreAllocatedTessellation &)) &smtk::mesh::utility::extractTessellation, "", py::arg("arg0"), py::arg("arg1"), py::arg("arg2")); } -void pybind11_init__ZN4smtk4mesh19extractTessellationERKNS0_7CellSetERKNS0_8PointSetERNS0_24PreAllocatedTessellationE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh19extractTessellationERKNS0_7CellSetERKNS0_8PointSetERNS0_24PreAllocatedTessellationE(py::module &m) { m.def("extractTessellation", (void (*)(::smtk::mesh::CellSet const &, ::smtk::mesh::PointSet const &, ::smtk::mesh::utility::PreAllocatedTessellation &)) &smtk::mesh::utility::extractTessellation, "", py::arg("arg0"), py::arg("arg1"), py::arg("arg2")); } -void pybind11_init__ZN4smtk4mesh19extractTessellationERNS0_17PointConnectivityERKNS0_8PointSetERNS0_24PreAllocatedTessellationE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh19extractTessellationERNS0_17PointConnectivityERKNS0_8PointSetERNS0_24PreAllocatedTessellationE(py::module &m) { m.def("extractTessellation", (void (*)(::smtk::mesh::PointConnectivity &, ::smtk::mesh::PointSet const &, ::smtk::mesh::utility::PreAllocatedTessellation &)) &smtk::mesh::utility::extractTessellation, "", py::arg("arg0"), py::arg("arg1"), py::arg("arg2")); } -void pybind11_init__ZN4smtk4mesh19extractTessellationERKNS_5model9EntityRefERKNSt3__110shared_ptrINS0_10ResourceEEERKNS0_8PointSetERNS0_24PreAllocatedTessellationE(py::module &m) +inline void pybind11_init__ZN4smtk4mesh19extractTessellationERKNS_5model9EntityRefERKNSt3__110shared_ptrINS0_10ResourceEEERKNS0_8PointSetERNS0_24PreAllocatedTessellationE(py::module &m) { m.def("extractTessellation", (void (*)(::smtk::model::EntityRef const &, ::smtk::mesh::ResourcePtr const &, ::smtk::mesh::PointSet const &, ::smtk::mesh::utility::PreAllocatedTessellation &)) &smtk::mesh::utility::extractTessellation, "", py::arg("arg0"), py::arg("arg1"), py::arg("arg2"), py::arg("arg3")); } diff --git a/smtk/mesh/pybind11/PybindFieldTypes.h b/smtk/mesh/pybind11/PybindFieldTypes.h index 958631684e..8ecd0f056d 100644 --- a/smtk/mesh/pybind11/PybindFieldTypes.h +++ b/smtk/mesh/pybind11/PybindFieldTypes.h @@ -17,7 +17,7 @@ namespace py = pybind11; -void pybind11_init_smtk_mesh_FieldType(py::module &m) +inline void pybind11_init_smtk_mesh_FieldType(py::module &m) { py::enum_(m, "FieldType") .value("Integer", smtk::mesh::FieldType::Integer) diff --git a/smtk/mesh/pybind11/PybindForEachTypes.h b/smtk/mesh/pybind11/PybindForEachTypes.h index 8ec8d88d01..7b4335b595 100644 --- a/smtk/mesh/pybind11/PybindForEachTypes.h +++ b/smtk/mesh/pybind11/PybindForEachTypes.h @@ -55,7 +55,7 @@ public: } }; -PySharedPtrClass< smtk::mesh::MeshForEach > pybind11_init_smtk_mesh_MeshForEach(py::module &m) +inline PySharedPtrClass< smtk::mesh::MeshForEach > pybind11_init_smtk_mesh_MeshForEach(py::module &m) { py::class_, PyMeshForEach > instance(m, "MeshForEach"); instance @@ -68,7 +68,7 @@ PySharedPtrClass< smtk::mesh::MeshForEach > pybind11_init_smtk_mesh_MeshForEach( return std::move(instance); } -PySharedPtrClass< smtk::mesh::CellForEach > pybind11_init_smtk_mesh_CellForEach(py::module &m) +inline PySharedPtrClass< smtk::mesh::CellForEach > pybind11_init_smtk_mesh_CellForEach(py::module &m) { py::class_, PyCellForEach > instance(m, "CellForEach"); instance @@ -88,7 +88,7 @@ PySharedPtrClass< smtk::mesh::CellForEach > pybind11_init_smtk_mesh_CellForEach( return std::move(instance); } -PySharedPtrClass< smtk::mesh::PointForEach > pybind11_init_smtk_mesh_PointForEach(py::module &m) +inline PySharedPtrClass< smtk::mesh::PointForEach > pybind11_init_smtk_mesh_PointForEach(py::module &m) { py::class_, PyPointForEach > instance(m, "PointForEach"); instance diff --git a/smtk/mesh/pybind11/PybindHandle.h b/smtk/mesh/pybind11/PybindHandle.h index 0054007481..81abedc15d 100644 --- a/smtk/mesh/pybind11/PybindHandle.h +++ b/smtk/mesh/pybind11/PybindHandle.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::mesh::HandleInterval > pybind11_init_HandleInterval(py::module &m) +inline py::class_< smtk::mesh::HandleInterval > pybind11_init_HandleInterval(py::module &m) { py::class_< smtk::mesh::HandleInterval > instance(m, "HandleInterval"); instance @@ -34,7 +34,7 @@ py::class_< smtk::mesh::HandleInterval > pybind11_init_HandleInterval(py::module return instance; } -PySharedPtrClass< smtk::mesh::const_element_iterator > pybind11_init_const_element_iterator(py::module &m) +inline PySharedPtrClass< smtk::mesh::const_element_iterator > pybind11_init_const_element_iterator(py::module &m) { PySharedPtrClass< smtk::mesh::const_element_iterator > instance(m, "const_element_iterator"); instance @@ -45,7 +45,7 @@ PySharedPtrClass< smtk::mesh::const_element_iterator > pybind11_init_const_eleme return instance; } -py::class_< smtk::mesh::HandleRange > pybind11_init_HandleRange(py::module &m) +inline py::class_< smtk::mesh::HandleRange > pybind11_init_HandleRange(py::module &m) { py::class_< smtk::mesh::HandleRange > instance(m, "HandleRange"); instance @@ -64,38 +64,38 @@ py::class_< smtk::mesh::HandleRange > pybind11_init_HandleRange(py::module &m) return instance; } -void pybind11_init_smtk_mesh_rangeElementsBegin(py::module &m) +inline void pybind11_init_smtk_mesh_rangeElementsBegin(py::module &m) { m.def("rangeElementsBegin", &smtk::mesh::rangeElementsBegin, "", py::arg("arg0")); } -void pybind11_init_smtk_mesh_rangeElementsEnd(py::module &m) +inline void pybind11_init_smtk_mesh_rangeElementsEnd(py::module &m) { m.def("rangeElementsEnd", &smtk::mesh::rangeElementsEnd, "", py::arg("arg0")); } -void pybind11_init_smtk_mesh_rangeElement(py::module &m) +inline void pybind11_init_smtk_mesh_rangeElement(py::module &m) { m.def("rangeElement", &smtk::mesh::rangeElement, "", py::arg("arg0"), py::arg("arg1")); } -void pybind11_init_smtk_mesh_rangeContains(py::module &m) +inline void pybind11_init_smtk_mesh_rangeContains(py::module &m) { m.def("rangeContains", (bool (*)(smtk::mesh::HandleRange const &, smtk::mesh::Handle)) &smtk::mesh::rangeContains, "", py::arg("arg0"), py::arg("arg1")); m.def("rangeContains", (bool (*)(smtk::mesh::HandleRange const &, smtk::mesh::HandleRange const &)) &smtk::mesh::rangeContains, "", py::arg("super"), py::arg("sub")); } -void pybind11_init_smtk_mesh_rangeIndex(py::module &m) +inline void pybind11_init_smtk_mesh_rangeIndex(py::module &m) { m.def("rangeIndex", &smtk::mesh::rangeIndex, "", py::arg("arg0"), py::arg("arg1")); } -void pybind11_init_smtk_mesh_rangeIntervalCount(py::module &m) +inline void pybind11_init_smtk_mesh_rangeIntervalCount(py::module &m) { m.def("rangeIntervalCount", &smtk::mesh::rangeIntervalCount, "", py::arg("arg0")); } -void pybind11_init_smtk_mesh_rangesEqual(py::module &m) +inline void pybind11_init_smtk_mesh_rangesEqual(py::module &m) { m.def("rangesEqual", &smtk::mesh::rangesEqual, "", py::arg("arg0"), py::arg("arg1")); } diff --git a/smtk/mesh/pybind11/PybindImport.h b/smtk/mesh/pybind11/PybindImport.h index d4fad2006f..2e54d72de5 100644 --- a/smtk/mesh/pybind11/PybindImport.h +++ b/smtk/mesh/pybind11/PybindImport.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::Import, smtk::operation::XMLOperation > pybind11_init_smtk_mesh_Import(py::module &m) +inline PySharedPtrClass< smtk::mesh::Import, smtk::operation::XMLOperation > pybind11_init_smtk_mesh_Import(py::module &m) { PySharedPtrClass< smtk::mesh::Import, smtk::operation::XMLOperation > instance(m, "Import"); instance diff --git a/smtk/mesh/pybind11/PybindInterface.h b/smtk/mesh/pybind11/PybindInterface.h index c871e284b8..6ab40fb659 100644 --- a/smtk/mesh/pybind11/PybindInterface.h +++ b/smtk/mesh/pybind11/PybindInterface.h @@ -24,7 +24,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::Allocator > pybind11_init_smtk_mesh_Allocator(py::module &m) +inline PySharedPtrClass< smtk::mesh::Allocator > pybind11_init_smtk_mesh_Allocator(py::module &m) { PySharedPtrClass< smtk::mesh::Allocator > instance(m, "Allocator"); instance @@ -36,7 +36,7 @@ PySharedPtrClass< smtk::mesh::Allocator > pybind11_init_smtk_mesh_Allocator(py:: return instance; } -PySharedPtrClass< smtk::mesh::BufferedCellAllocator > pybind11_init_smtk_mesh_BufferedCellAllocator(py::module &m) +inline PySharedPtrClass< smtk::mesh::BufferedCellAllocator > pybind11_init_smtk_mesh_BufferedCellAllocator(py::module &m) { PySharedPtrClass< smtk::mesh::BufferedCellAllocator > instance(m, "BufferedCellAllocator"); instance @@ -56,7 +56,7 @@ PySharedPtrClass< smtk::mesh::BufferedCellAllocator > pybind11_init_smtk_mesh_Bu return instance; } -PySharedPtrClass< smtk::mesh::ConnectivityStorage > pybind11_init_smtk_mesh_ConnectivityStorage(py::module &m) +inline PySharedPtrClass< smtk::mesh::ConnectivityStorage > pybind11_init_smtk_mesh_ConnectivityStorage(py::module &m) { PySharedPtrClass< smtk::mesh::ConnectivityStorage > instance(m, "ConnectivityStorage"); instance @@ -77,7 +77,7 @@ PySharedPtrClass< smtk::mesh::ConnectivityStorage > pybind11_init_smtk_mesh_Conn return instance; } -PySharedPtrClass< smtk::mesh::IncrementalAllocator > pybind11_init_smtk_mesh_IncrementalAllocator(py::module &m) +inline PySharedPtrClass< smtk::mesh::IncrementalAllocator > pybind11_init_smtk_mesh_IncrementalAllocator(py::module &m) { PySharedPtrClass< smtk::mesh::IncrementalAllocator > instance(m, "IncrementalAllocator"); instance @@ -100,7 +100,7 @@ PySharedPtrClass< smtk::mesh::IncrementalAllocator > pybind11_init_smtk_mesh_Inc return instance; } -PySharedPtrClass< smtk::mesh::Interface > pybind11_init_smtk_mesh_Interface(py::module &m) +inline PySharedPtrClass< smtk::mesh::Interface > pybind11_init_smtk_mesh_Interface(py::module &m) { PySharedPtrClass< smtk::mesh::Interface > instance(m, "Interface"); instance @@ -177,7 +177,7 @@ PySharedPtrClass< smtk::mesh::Interface > pybind11_init_smtk_mesh_Interface(py:: return instance; } -PySharedPtrClass< smtk::mesh::PointLocatorImpl > pybind11_init_smtk_mesh_PointLocatorImpl(py::module &m) +inline PySharedPtrClass< smtk::mesh::PointLocatorImpl > pybind11_init_smtk_mesh_PointLocatorImpl(py::module &m) { PySharedPtrClass< smtk::mesh::PointLocatorImpl > instance(m, "PointLocatorImpl"); instance diff --git a/smtk/mesh/pybind11/PybindInterpolateOntoMesh.h b/smtk/mesh/pybind11/PybindInterpolateOntoMesh.h index 37910b1793..c00203f0cf 100644 --- a/smtk/mesh/pybind11/PybindInterpolateOntoMesh.h +++ b/smtk/mesh/pybind11/PybindInterpolateOntoMesh.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::InterpolateOntoMesh, smtk::operation::XMLOperation > pybind11_init_smtk_mesh_InterpolateOntoMesh(py::module &m) +inline PySharedPtrClass< smtk::mesh::InterpolateOntoMesh, smtk::operation::XMLOperation > pybind11_init_smtk_mesh_InterpolateOntoMesh(py::module &m) { PySharedPtrClass< smtk::mesh::InterpolateOntoMesh, smtk::operation::XMLOperation > instance(m, "InterpolateOntoMesh"); instance diff --git a/smtk/mesh/pybind11/PybindMeshSet.h b/smtk/mesh/pybind11/PybindMeshSet.h index fb807275d4..1e0e558255 100644 --- a/smtk/mesh/pybind11/PybindMeshSet.h +++ b/smtk/mesh/pybind11/PybindMeshSet.h @@ -30,7 +30,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::MeshSet > pybind11_init_smtk_mesh_MeshSet(py::module &m) +inline PySharedPtrClass< smtk::mesh::MeshSet > pybind11_init_smtk_mesh_MeshSet(py::module &m) { PySharedPtrClass< smtk::mesh::MeshSet > instance(m, "MeshSet"); instance @@ -95,22 +95,22 @@ PySharedPtrClass< smtk::mesh::MeshSet > pybind11_init_smtk_mesh_MeshSet(py::modu return instance; } -void pybind11_init_smtk_mesh_mesh_for_each(py::module &m) +inline void pybind11_init_smtk_mesh_mesh_for_each(py::module &m) { m.def("for_each", (void (*)(const smtk::mesh::MeshSet&, smtk::mesh::MeshForEach&)) &smtk::mesh::for_each, "", py::arg("a"), py::arg("filter")); } -void pybind11_init_smtk_mesh_mesh_set_difference(py::module &m) +inline void pybind11_init_smtk_mesh_mesh_set_difference(py::module &m) { m.def("set_difference", (smtk::mesh::MeshSet (*)(const smtk::mesh::MeshSet&, const smtk::mesh::MeshSet&)) &smtk::mesh::set_difference, "", py::arg("a"), py::arg("b")); } -void pybind11_init_smtk_mesh_mesh_set_intersect(py::module &m) +inline void pybind11_init_smtk_mesh_mesh_set_intersect(py::module &m) { m.def("set_intersect", (smtk::mesh::MeshSet (*)(const smtk::mesh::MeshSet&, const smtk::mesh::MeshSet&)) &smtk::mesh::set_intersect, "", py::arg("a"), py::arg("b")); } -void pybind11_init_smtk_mesh_mesh_set_union(py::module &m) +inline void pybind11_init_smtk_mesh_mesh_set_union(py::module &m) { m.def("set_union", (smtk::mesh::MeshSet (*)(const smtk::mesh::MeshSet&, const smtk::mesh::MeshSet&)) &smtk::mesh::set_union, "", py::arg("a"), py::arg("b")); } diff --git a/smtk/mesh/pybind11/PybindMetrics.h b/smtk/mesh/pybind11/PybindMetrics.h index 6281ef0f09..3546bb3a4f 100644 --- a/smtk/mesh/pybind11/PybindMetrics.h +++ b/smtk/mesh/pybind11/PybindMetrics.h @@ -19,7 +19,7 @@ namespace py = pybind11; -void pybind11_init_smtk_mesh_metrics(py::module &m) +inline void pybind11_init_smtk_mesh_metrics(py::module &m) { m.def("extent", &smtk::mesh::utility::extent); m.def("highestDimension", &smtk::mesh::utility::highestDimension); diff --git a/smtk/mesh/pybind11/PybindPointCloud.h b/smtk/mesh/pybind11/PybindPointCloud.h index 992e659e22..3495af77f3 100644 --- a/smtk/mesh/pybind11/PybindPointCloud.h +++ b/smtk/mesh/pybind11/PybindPointCloud.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::mesh::PointCloud > pybind11_init_smtk_mesh_PointCloud(py::module &m) +inline py::class_< smtk::mesh::PointCloud > pybind11_init_smtk_mesh_PointCloud(py::module &m) { py::class_< smtk::mesh::PointCloud > instance(m, "PointCloud"); instance diff --git a/smtk/mesh/pybind11/PybindPointCloudGenerator.h b/smtk/mesh/pybind11/PybindPointCloudGenerator.h index 09d10c3e98..c318004bae 100644 --- a/smtk/mesh/pybind11/PybindPointCloudGenerator.h +++ b/smtk/mesh/pybind11/PybindPointCloudGenerator.h @@ -18,7 +18,7 @@ namespace py = pybind11; -py::class_ pybind11_init_smtk_mesh_PointCloudGenerator(py::module &m) +inline py::class_ pybind11_init_smtk_mesh_PointCloudGenerator(py::module &m) { py::class_ instance(m, "PointCloudGenerator"); instance diff --git a/smtk/mesh/pybind11/PybindPointConnectivity.h b/smtk/mesh/pybind11/PybindPointConnectivity.h index 129f6d299e..4738bf2c65 100644 --- a/smtk/mesh/pybind11/PybindPointConnectivity.h +++ b/smtk/mesh/pybind11/PybindPointConnectivity.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::PointConnectivity > pybind11_init_smtk_mesh_PointConnectivity(py::module &m) +inline PySharedPtrClass< smtk::mesh::PointConnectivity > pybind11_init_smtk_mesh_PointConnectivity(py::module &m) { PySharedPtrClass< smtk::mesh::PointConnectivity > instance(m, "PointConnectivity"); instance diff --git a/smtk/mesh/pybind11/PybindPointField.h b/smtk/mesh/pybind11/PybindPointField.h index 4933d4bffc..e25b1e61a9 100644 --- a/smtk/mesh/pybind11/PybindPointField.h +++ b/smtk/mesh/pybind11/PybindPointField.h @@ -20,7 +20,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::PointField > pybind11_init_smtk_mesh_PointField(py::module &m) +inline PySharedPtrClass< smtk::mesh::PointField > pybind11_init_smtk_mesh_PointField(py::module &m) { PySharedPtrClass< smtk::mesh::PointField > instance(m, "PointField"); instance diff --git a/smtk/mesh/pybind11/PybindPointLocator.h b/smtk/mesh/pybind11/PybindPointLocator.h index 852402894e..8fbdebaf12 100644 --- a/smtk/mesh/pybind11/PybindPointLocator.h +++ b/smtk/mesh/pybind11/PybindPointLocator.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::PointLocator > pybind11_init_smtk_mesh_PointLocator(py::module &m) +inline PySharedPtrClass< smtk::mesh::PointLocator > pybind11_init_smtk_mesh_PointLocator(py::module &m) { PySharedPtrClass< smtk::mesh::PointLocator > instance(m, "PointLocator"); instance diff --git a/smtk/mesh/pybind11/PybindPointSet.h b/smtk/mesh/pybind11/PybindPointSet.h index f4eb0f2ce5..e03120f2e0 100644 --- a/smtk/mesh/pybind11/PybindPointSet.h +++ b/smtk/mesh/pybind11/PybindPointSet.h @@ -18,7 +18,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::PointSet > pybind11_init_smtk_mesh_PointSet(py::module &m) +inline PySharedPtrClass< smtk::mesh::PointSet > pybind11_init_smtk_mesh_PointSet(py::module &m) { PySharedPtrClass< smtk::mesh::PointSet > instance(m, "PointSet"); instance @@ -49,22 +49,22 @@ PySharedPtrClass< smtk::mesh::PointSet > pybind11_init_smtk_mesh_PointSet(py::mo return instance; } -void pybind11_init_smtk_mesh_point_for_each(py::module &m) +inline void pybind11_init_smtk_mesh_point_for_each(py::module &m) { m.def("for_each", (void (*)(const smtk::mesh::PointSet&, smtk::mesh::PointForEach&)) &smtk::mesh::for_each, "", py::arg("a"), py::arg("filter")); } -void pybind11_init_smtk_mesh_point_set_difference(py::module &m) +inline void pybind11_init_smtk_mesh_point_set_difference(py::module &m) { m.def("set_difference", (smtk::mesh::PointSet (*)(const smtk::mesh::PointSet&, const smtk::mesh::PointSet&)) &smtk::mesh::set_difference, "", py::arg("a"), py::arg("b")); } -void pybind11_init_smtk_mesh_point_set_intersect(py::module &m) +inline void pybind11_init_smtk_mesh_point_set_intersect(py::module &m) { m.def("set_intersect", (smtk::mesh::PointSet (*)(const smtk::mesh::PointSet&, const smtk::mesh::PointSet&)) &smtk::mesh::set_intersect, "", py::arg("a"), py::arg("b")); } -void pybind11_init_smtk_mesh_point_set_union(py::module &m) +inline void pybind11_init_smtk_mesh_point_set_union(py::module &m) { m.def("set_union", (smtk::mesh::PointSet (*)(const smtk::mesh::PointSet&, const smtk::mesh::PointSet&)) &smtk::mesh::set_union, "", py::arg("a"), py::arg("b")); } diff --git a/smtk/mesh/pybind11/PybindQueryTypes.h b/smtk/mesh/pybind11/PybindQueryTypes.h index 79a13c4c86..615691be08 100644 --- a/smtk/mesh/pybind11/PybindQueryTypes.h +++ b/smtk/mesh/pybind11/PybindQueryTypes.h @@ -17,7 +17,7 @@ namespace py = pybind11; -void pybind11_init_smtk_mesh_ContainmentType(py::module &m) +inline void pybind11_init_smtk_mesh_ContainmentType(py::module &m) { py::enum_(m, "ContainmentType") .value("PartiallyContained", smtk::mesh::ContainmentType::PartiallyContained) @@ -25,7 +25,7 @@ void pybind11_init_smtk_mesh_ContainmentType(py::module &m) .export_values(); } -PySharedPtrClass< smtk::mesh::Dirichlet > pybind11_init_smtk_mesh_Dirichlet(py::module &m, PySharedPtrClass< smtk::mesh::IntegerTag >& parent) +inline PySharedPtrClass< smtk::mesh::Dirichlet > pybind11_init_smtk_mesh_Dirichlet(py::module &m, PySharedPtrClass< smtk::mesh::IntegerTag >& parent) { PySharedPtrClass< smtk::mesh::Dirichlet > instance(m, "Dirichlet", parent); instance @@ -36,7 +36,7 @@ PySharedPtrClass< smtk::mesh::Dirichlet > pybind11_init_smtk_mesh_Dirichlet(py:: return instance; } -PySharedPtrClass< smtk::mesh::Domain > pybind11_init_smtk_mesh_Domain(py::module &m, PySharedPtrClass< smtk::mesh::IntegerTag >& parent) +inline PySharedPtrClass< smtk::mesh::Domain > pybind11_init_smtk_mesh_Domain(py::module &m, PySharedPtrClass< smtk::mesh::IntegerTag >& parent) { PySharedPtrClass< smtk::mesh::Domain > instance(m, "Domain", parent); instance @@ -47,7 +47,7 @@ PySharedPtrClass< smtk::mesh::Domain > pybind11_init_smtk_mesh_Domain(py::module return instance; } -PySharedPtrClass< smtk::mesh::IntegerTag > pybind11_init_smtk_mesh_IntegerTag(py::module &m) +inline PySharedPtrClass< smtk::mesh::IntegerTag > pybind11_init_smtk_mesh_IntegerTag(py::module &m) { PySharedPtrClass< smtk::mesh::IntegerTag > instance(m, "IntegerTag"); instance @@ -62,7 +62,7 @@ PySharedPtrClass< smtk::mesh::IntegerTag > pybind11_init_smtk_mesh_IntegerTag(py return instance; } -PySharedPtrClass< smtk::mesh::Model > pybind11_init_smtk_mesh_Model(py::module &m, PySharedPtrClass< smtk::mesh::UUIDTag >& parent) +inline PySharedPtrClass< smtk::mesh::Model > pybind11_init_smtk_mesh_Model(py::module &m, PySharedPtrClass< smtk::mesh::UUIDTag >& parent) { PySharedPtrClass< smtk::mesh::Model > instance(m, "Model", parent); instance @@ -73,7 +73,7 @@ PySharedPtrClass< smtk::mesh::Model > pybind11_init_smtk_mesh_Model(py::module & return instance; } -PySharedPtrClass< smtk::mesh::Neumann > pybind11_init_smtk_mesh_Neumann(py::module &m, PySharedPtrClass< smtk::mesh::IntegerTag >& parent) +inline PySharedPtrClass< smtk::mesh::Neumann > pybind11_init_smtk_mesh_Neumann(py::module &m, PySharedPtrClass< smtk::mesh::IntegerTag >& parent) { PySharedPtrClass< smtk::mesh::Neumann > instance(m, "Neumann", parent); instance @@ -84,7 +84,7 @@ PySharedPtrClass< smtk::mesh::Neumann > pybind11_init_smtk_mesh_Neumann(py::modu return instance; } -PySharedPtrClass< smtk::mesh::OpaqueTag<16> > pybind11_init_smtk_mesh_OpaqueTag_16_(py::module &m) +inline PySharedPtrClass< smtk::mesh::OpaqueTag<16> > pybind11_init_smtk_mesh_OpaqueTag_16_(py::module &m) { PySharedPtrClass< smtk::mesh::OpaqueTag<16> > instance(m, "OpaqueTag_16_"); instance @@ -100,7 +100,7 @@ PySharedPtrClass< smtk::mesh::OpaqueTag<16> > pybind11_init_smtk_mesh_OpaqueTag_ return instance; } -PySharedPtrClass< smtk::mesh::UUIDTag > pybind11_init_smtk_mesh_UUIDTag(py::module &m, PySharedPtrClass< smtk::mesh::OpaqueTag<16> >& parent) +inline PySharedPtrClass< smtk::mesh::UUIDTag > pybind11_init_smtk_mesh_UUIDTag(py::module &m, PySharedPtrClass< smtk::mesh::OpaqueTag<16> >& parent) { PySharedPtrClass< smtk::mesh::UUIDTag > instance(m, "UUIDTag", parent); instance diff --git a/smtk/mesh/pybind11/PybindRead.h b/smtk/mesh/pybind11/PybindRead.h index 3a4118b797..cd402f3f16 100644 --- a/smtk/mesh/pybind11/PybindRead.h +++ b/smtk/mesh/pybind11/PybindRead.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::Read, smtk::operation::XMLOperation > pybind11_init_smtk_mesh_Read(py::module &m) +inline PySharedPtrClass< smtk::mesh::Read, smtk::operation::XMLOperation > pybind11_init_smtk_mesh_Read(py::module &m) { PySharedPtrClass< smtk::mesh::Read, smtk::operation::XMLOperation > instance(m, "Read"); instance diff --git a/smtk/mesh/pybind11/PybindReclassify.h b/smtk/mesh/pybind11/PybindReclassify.h index 404eb8563c..f51379c416 100644 --- a/smtk/mesh/pybind11/PybindReclassify.h +++ b/smtk/mesh/pybind11/PybindReclassify.h @@ -17,22 +17,22 @@ namespace py = pybind11; -void pybind11_init_smtk_mesh_split(py::module &m) +inline void pybind11_init_smtk_mesh_split(py::module &m) { m.def("split", &smtk::mesh::utility::split, "", py::arg("arg0"), py::arg("orignalEdge"), py::arg("newEdge"), py::arg("promotedVertex")); } -void pybind11_init_smtk_mesh_merge(py::module &m) +inline void pybind11_init_smtk_mesh_merge(py::module &m) { m.def("merge", &smtk::mesh::utility::merge, "", py::arg("arg0"), py::arg("toRemoveVert"), py::arg("toRemoveEdge"), py::arg("toAddTo")); } -void pybind11_init_smtk_mesh_make_disjoint(py::module &m) +inline void pybind11_init_smtk_mesh_make_disjoint(py::module &m) { m.def("make_disjoint", &smtk::mesh::utility::make_disjoint, "", py::arg("arg0"), py::arg("a"), py::arg("b"), py::arg("modelAssoc")); } -void pybind11_init_smtk_mesh_fuse(py::module &m) +inline void pybind11_init_smtk_mesh_fuse(py::module &m) { m.def("fuse", &smtk::mesh::utility::fuse, "", py::arg("arg0"), py::arg("toRemove"), py::arg("toAddTo"), py::arg("assoc")); } diff --git a/smtk/mesh/pybind11/PybindRegistrar.h b/smtk/mesh/pybind11/PybindRegistrar.h index b786dff0ae..9caf211d48 100644 --- a/smtk/mesh/pybind11/PybindRegistrar.h +++ b/smtk/mesh/pybind11/PybindRegistrar.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::mesh::Registrar > pybind11_init_smtk_mesh_Registrar(py::module &m) +inline py::class_< smtk::mesh::Registrar > pybind11_init_smtk_mesh_Registrar(py::module &m) { py::class_< smtk::mesh::Registrar > instance(m, "Registrar"); instance diff --git a/smtk/mesh/pybind11/PybindResource.h b/smtk/mesh/pybind11/PybindResource.h index 4587555901..72b025e8a2 100644 --- a/smtk/mesh/pybind11/PybindResource.h +++ b/smtk/mesh/pybind11/PybindResource.h @@ -22,7 +22,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::Resource> pybind11_init_smtk_mesh_Resource(py::module &m) +inline PySharedPtrClass< smtk::mesh::Resource> pybind11_init_smtk_mesh_Resource(py::module &m) { PySharedPtrClass< smtk::mesh::Resource, smtk::resource::Resource > instance(m, "Resource"); instance diff --git a/smtk/mesh/pybind11/PybindSelection.h b/smtk/mesh/pybind11/PybindSelection.h index 09cf54b901..9e27d6c560 100644 --- a/smtk/mesh/pybind11/PybindSelection.h +++ b/smtk/mesh/pybind11/PybindSelection.h @@ -20,7 +20,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::Selection, smtk::mesh::Component > pybind11_init_smtk_mesh_Selection(py::module &m) +inline PySharedPtrClass< smtk::mesh::Selection, smtk::mesh::Component > pybind11_init_smtk_mesh_Selection(py::module &m) { PySharedPtrClass< smtk::mesh::Selection, smtk::mesh::Component > instance(m, "Selection"); instance diff --git a/smtk/mesh/pybind11/PybindStructuredGrid.h b/smtk/mesh/pybind11/PybindStructuredGrid.h index b447cefa78..731928cc49 100644 --- a/smtk/mesh/pybind11/PybindStructuredGrid.h +++ b/smtk/mesh/pybind11/PybindStructuredGrid.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::mesh::StructuredGrid > pybind11_init_smtk_mesh_StructuredGrid(py::module &m) +inline py::class_< smtk::mesh::StructuredGrid > pybind11_init_smtk_mesh_StructuredGrid(py::module &m) { py::class_< smtk::mesh::StructuredGrid > instance(m, "StructuredGrid"); instance diff --git a/smtk/mesh/pybind11/PybindStructuredGridGenerator.h b/smtk/mesh/pybind11/PybindStructuredGridGenerator.h index 0855301697..d32364b5e1 100644 --- a/smtk/mesh/pybind11/PybindStructuredGridGenerator.h +++ b/smtk/mesh/pybind11/PybindStructuredGridGenerator.h @@ -18,7 +18,7 @@ namespace py = pybind11; -py::class_ pybind11_init_smtk_mesh_StructuredGridGenerator(py::module &m) +inline py::class_ pybind11_init_smtk_mesh_StructuredGridGenerator(py::module &m) { py::class_ instance(m, "StructuredGridGenerator"); instance diff --git a/smtk/mesh/pybind11/PybindTypeSet.h b/smtk/mesh/pybind11/PybindTypeSet.h index 36459565bd..371b03f5c0 100644 --- a/smtk/mesh/pybind11/PybindTypeSet.h +++ b/smtk/mesh/pybind11/PybindTypeSet.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::TypeSet > pybind11_init_smtk_mesh_TypeSet(py::module &m) +inline PySharedPtrClass< smtk::mesh::TypeSet > pybind11_init_smtk_mesh_TypeSet(py::module &m) { PySharedPtrClass< smtk::mesh::TypeSet > instance(m, "TypeSet"); instance diff --git a/smtk/mesh/pybind11/PybindWrite.h b/smtk/mesh/pybind11/PybindWrite.h index f2f5637018..83c6259021 100644 --- a/smtk/mesh/pybind11/PybindWrite.h +++ b/smtk/mesh/pybind11/PybindWrite.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::mesh::Write, smtk::operation::XMLOperation > pybind11_init_smtk_mesh_Write(py::module &m) +inline PySharedPtrClass< smtk::mesh::Write, smtk::operation::XMLOperation > pybind11_init_smtk_mesh_Write(py::module &m) { PySharedPtrClass< smtk::mesh::Write, smtk::operation::XMLOperation > instance(m, "Write"); instance diff --git a/smtk/model/pybind11/PybindAddAuxiliaryGeometry.h b/smtk/model/pybind11/PybindAddAuxiliaryGeometry.h index 864a0fcf62..35c0d26f8b 100644 --- a/smtk/model/pybind11/PybindAddAuxiliaryGeometry.h +++ b/smtk/model/pybind11/PybindAddAuxiliaryGeometry.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::model::AddAuxiliaryGeometry, smtk::operation::XMLOperation > pybind11_init_smtk_model_AddAuxiliaryGeometry(py::module &m) +inline PySharedPtrClass< smtk::model::AddAuxiliaryGeometry, smtk::operation::XMLOperation > pybind11_init_smtk_model_AddAuxiliaryGeometry(py::module &m) { PySharedPtrClass< smtk::model::AddAuxiliaryGeometry, smtk::operation::XMLOperation > instance(m, "AddAuxiliaryGeometry"); instance diff --git a/smtk/model/pybind11/PybindArrangement.h b/smtk/model/pybind11/PybindArrangement.h index 398bbdb049..aa2ae8795b 100644 --- a/smtk/model/pybind11/PybindArrangement.h +++ b/smtk/model/pybind11/PybindArrangement.h @@ -23,7 +23,7 @@ namespace py = pybind11; -py::class_< smtk::model::Arrangement > pybind11_init_smtk_model_Arrangement(py::module &m) +inline py::class_< smtk::model::Arrangement > pybind11_init_smtk_model_Arrangement(py::module &m) { py::class_< smtk::model::Arrangement > instance(m, "Arrangement"); instance @@ -71,7 +71,7 @@ py::class_< smtk::model::Arrangement > pybind11_init_smtk_model_Arrangement(py:: return instance; } -py::class_< smtk::model::ArrangementReference > pybind11_init_smtk_model_ArrangementReference(py::module &m) +inline py::class_< smtk::model::ArrangementReference > pybind11_init_smtk_model_ArrangementReference(py::module &m) { py::class_< smtk::model::ArrangementReference > instance(m, "ArrangementReference"); instance diff --git a/smtk/model/pybind11/PybindArrangementHelper.h b/smtk/model/pybind11/PybindArrangementHelper.h index b3ffe3acc7..72a5f3a04a 100644 --- a/smtk/model/pybind11/PybindArrangementHelper.h +++ b/smtk/model/pybind11/PybindArrangementHelper.h @@ -20,7 +20,7 @@ namespace py = pybind11; -py::class_< smtk::model::ArrangementHelper > pybind11_init_smtk_model_ArrangementHelper(py::module &m) +inline py::class_< smtk::model::ArrangementHelper > pybind11_init_smtk_model_ArrangementHelper(py::module &m) { py::class_< smtk::model::ArrangementHelper > instance(m, "ArrangementHelper"); instance diff --git a/smtk/model/pybind11/PybindArrangementKind.h b/smtk/model/pybind11/PybindArrangementKind.h index 18900efb4f..e5586b82c4 100644 --- a/smtk/model/pybind11/PybindArrangementKind.h +++ b/smtk/model/pybind11/PybindArrangementKind.h @@ -19,7 +19,7 @@ namespace py = pybind11; -void pybind11_init_smtk_model_Orientation(py::module &m) +inline void pybind11_init_smtk_model_Orientation(py::module &m) { py::enum_(m, "Orientation") .value("NEGATIVE", smtk::model::Orientation::NEGATIVE) @@ -28,7 +28,7 @@ void pybind11_init_smtk_model_Orientation(py::module &m) .export_values(); } -void pybind11_init_smtk_model_ArrangementKind(py::module &m) +inline void pybind11_init_smtk_model_ArrangementKind(py::module &m) { py::enum_(m, "ArrangementKind") .value("INCLUDES", smtk::model::ArrangementKind::INCLUDES) @@ -44,27 +44,27 @@ void pybind11_init_smtk_model_ArrangementKind(py::module &m) .export_values(); } -void pybind11_init_smtk_model_ArrangementKindFromName(py::module &m) +inline void pybind11_init_smtk_model_ArrangementKindFromName(py::module &m) { m.def("ArrangementKindFromName", &smtk::model::ArrangementKindFromName, "", py::arg("name")); } -void pybind11_init_smtk_model_NameForArrangementKind(py::module &m) +inline void pybind11_init_smtk_model_NameForArrangementKind(py::module &m) { m.def("NameForArrangementKind", &smtk::model::NameForArrangementKind, "", py::arg("k")); } -void pybind11_init_smtk_model_ArrangementKindFromAbbreviation(py::module &m) +inline void pybind11_init_smtk_model_ArrangementKindFromAbbreviation(py::module &m) { m.def("ArrangementKindFromAbbreviation", &smtk::model::ArrangementKindFromAbbreviation, "", py::arg("abbr")); } -void pybind11_init_smtk_model_AbbreviationForArrangementKind(py::module &m) +inline void pybind11_init_smtk_model_AbbreviationForArrangementKind(py::module &m) { m.def("AbbreviationForArrangementKind", &smtk::model::AbbreviationForArrangementKind, "", py::arg("k")); } -void pybind11_init_smtk_model_Dual(py::module &m) +inline void pybind11_init_smtk_model_Dual(py::module &m) { m.def("Dual", &smtk::model::Dual, "", py::arg("entType"), py::arg("k")); } diff --git a/smtk/model/pybind11/PybindAttributeAssignments.h b/smtk/model/pybind11/PybindAttributeAssignments.h index 461c27026d..55a270b2a9 100644 --- a/smtk/model/pybind11/PybindAttributeAssignments.h +++ b/smtk/model/pybind11/PybindAttributeAssignments.h @@ -20,7 +20,7 @@ namespace py = pybind11; -py::class_< smtk::model::AttributeAssignments > pybind11_init_smtk_model_AttributeAssignments(py::module &m) +inline py::class_< smtk::model::AttributeAssignments > pybind11_init_smtk_model_AttributeAssignments(py::module &m) { py::class_< smtk::model::AttributeAssignments > instance(m, "AttributeAssignments"); instance diff --git a/smtk/model/pybind11/PybindAuxiliaryGeometry.h b/smtk/model/pybind11/PybindAuxiliaryGeometry.h index 36ec48fdcd..f87d6b0468 100644 --- a/smtk/model/pybind11/PybindAuxiliaryGeometry.h +++ b/smtk/model/pybind11/PybindAuxiliaryGeometry.h @@ -23,7 +23,7 @@ namespace py = pybind11; -py::class_< smtk::model::AuxiliaryGeometry, smtk::model::EntityRef > pybind11_init_smtk_model_AuxiliaryGeometry(py::module &m) +inline py::class_< smtk::model::AuxiliaryGeometry, smtk::model::EntityRef > pybind11_init_smtk_model_AuxiliaryGeometry(py::module &m) { py::class_< smtk::model::AuxiliaryGeometry, smtk::model::EntityRef > instance(m, "AuxiliaryGeometry"); instance diff --git a/smtk/model/pybind11/PybindCellEntity.h b/smtk/model/pybind11/PybindCellEntity.h index 53be0d5239..21301829bc 100644 --- a/smtk/model/pybind11/PybindCellEntity.h +++ b/smtk/model/pybind11/PybindCellEntity.h @@ -26,7 +26,7 @@ namespace py = pybind11; -py::class_< smtk::model::CellEntity, smtk::model::EntityRef > pybind11_init_smtk_model_CellEntity(py::module &m) +inline py::class_< smtk::model::CellEntity, smtk::model::EntityRef > pybind11_init_smtk_model_CellEntity(py::module &m) { py::class_< smtk::model::CellEntity, smtk::model::EntityRef > instance(m, "CellEntity"); instance diff --git a/smtk/model/pybind11/PybindChain.h b/smtk/model/pybind11/PybindChain.h index b03f4a17e3..eb87b3b5f7 100644 --- a/smtk/model/pybind11/PybindChain.h +++ b/smtk/model/pybind11/PybindChain.h @@ -25,7 +25,7 @@ namespace py = pybind11; -py::class_< smtk::model::Chain, smtk::model::ShellEntity > pybind11_init_smtk_model_Chain(py::module &m) +inline py::class_< smtk::model::Chain, smtk::model::ShellEntity > pybind11_init_smtk_model_Chain(py::module &m) { py::class_< smtk::model::Chain, smtk::model::ShellEntity > instance(m, "Chain"); instance diff --git a/smtk/model/pybind11/PybindCloseModel.h b/smtk/model/pybind11/PybindCloseModel.h index 9c959e4dd0..7167f61c1b 100644 --- a/smtk/model/pybind11/PybindCloseModel.h +++ b/smtk/model/pybind11/PybindCloseModel.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::model::CloseModel, smtk::operation::XMLOperation > pybind11_init_smtk_model_CloseModel(py::module &m) +inline PySharedPtrClass< smtk::model::CloseModel, smtk::operation::XMLOperation > pybind11_init_smtk_model_CloseModel(py::module &m) { PySharedPtrClass< smtk::model::CloseModel, smtk::operation::XMLOperation > instance(m, "CloseModel"); instance diff --git a/smtk/model/pybind11/PybindCreateInstances.h b/smtk/model/pybind11/PybindCreateInstances.h index a42d452dba..9a5a132911 100644 --- a/smtk/model/pybind11/PybindCreateInstances.h +++ b/smtk/model/pybind11/PybindCreateInstances.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::model::CreateInstances, smtk::operation::XMLOperation > pybind11_init_smtk_model_CreateInstances(py::module &m) +inline PySharedPtrClass< smtk::model::CreateInstances, smtk::operation::XMLOperation > pybind11_init_smtk_model_CreateInstances(py::module &m) { PySharedPtrClass< smtk::model::CreateInstances, smtk::operation::XMLOperation > instance(m, "CreateInstances"); instance diff --git a/smtk/model/pybind11/PybindDefaultSession.h b/smtk/model/pybind11/PybindDefaultSession.h index 246b1a9eeb..4048d96b41 100644 --- a/smtk/model/pybind11/PybindDefaultSession.h +++ b/smtk/model/pybind11/PybindDefaultSession.h @@ -21,7 +21,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::model::DefaultSession, smtk::model::Session > pybind11_init_smtk_model_DefaultSession(py::module &m) +inline PySharedPtrClass< smtk::model::DefaultSession, smtk::model::Session > pybind11_init_smtk_model_DefaultSession(py::module &m) { PySharedPtrClass< smtk::model::DefaultSession, smtk::model::Session > instance(m, "DefaultSession"); instance diff --git a/smtk/model/pybind11/PybindDelete.h b/smtk/model/pybind11/PybindDelete.h index e4942a5721..21922018b3 100644 --- a/smtk/model/pybind11/PybindDelete.h +++ b/smtk/model/pybind11/PybindDelete.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::model::Delete, smtk::operation::XMLOperation > pybind11_init_smtk_model_Delete(py::module &m) +inline PySharedPtrClass< smtk::model::Delete, smtk::operation::XMLOperation > pybind11_init_smtk_model_Delete(py::module &m) { PySharedPtrClass< smtk::model::Delete, smtk::operation::XMLOperation > instance(m, "Delete"); instance diff --git a/smtk/model/pybind11/PybindEdge.h b/smtk/model/pybind11/PybindEdge.h index 86da7e9647..aa17619a60 100644 --- a/smtk/model/pybind11/PybindEdge.h +++ b/smtk/model/pybind11/PybindEdge.h @@ -25,7 +25,7 @@ namespace py = pybind11; -py::class_< smtk::model::Edge, smtk::model::CellEntity > pybind11_init_smtk_model_Edge(py::module &m) +inline py::class_< smtk::model::Edge, smtk::model::CellEntity > pybind11_init_smtk_model_Edge(py::module &m) { py::class_< smtk::model::Edge, smtk::model::CellEntity > instance(m, "Edge"); instance diff --git a/smtk/model/pybind11/PybindEdgeUse.h b/smtk/model/pybind11/PybindEdgeUse.h index 2ee40f3e90..1501206c64 100644 --- a/smtk/model/pybind11/PybindEdgeUse.h +++ b/smtk/model/pybind11/PybindEdgeUse.h @@ -27,7 +27,7 @@ namespace py = pybind11; -py::class_< smtk::model::EdgeUse, smtk::model::UseEntity > pybind11_init_smtk_model_EdgeUse(py::module &m) +inline py::class_< smtk::model::EdgeUse, smtk::model::UseEntity > pybind11_init_smtk_model_EdgeUse(py::module &m) { py::class_< smtk::model::EdgeUse, smtk::model::UseEntity > instance(m, "EdgeUse"); instance diff --git a/smtk/model/pybind11/PybindEntity.h b/smtk/model/pybind11/PybindEntity.h index ae433e3490..9091342d4d 100644 --- a/smtk/model/pybind11/PybindEntity.h +++ b/smtk/model/pybind11/PybindEntity.h @@ -23,7 +23,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::model::Entity, smtk::resource::Component > pybind11_init_smtk_model_Entity(py::module &m) +inline PySharedPtrClass< smtk::model::Entity, smtk::resource::Component > pybind11_init_smtk_model_Entity(py::module &m) { PySharedPtrClass< smtk::model::Entity, smtk::resource::Component > instance(m, "Entity"); instance diff --git a/smtk/model/pybind11/PybindEntityIterator.h b/smtk/model/pybind11/PybindEntityIterator.h index 53b89e29e6..af47305dbb 100644 --- a/smtk/model/pybind11/PybindEntityIterator.h +++ b/smtk/model/pybind11/PybindEntityIterator.h @@ -19,7 +19,7 @@ namespace py = pybind11; -void pybind11_init_smtk_model_IteratorStyle(py::module &m) +inline void pybind11_init_smtk_model_IteratorStyle(py::module &m) { py::enum_(m, "IteratorStyle") .value("ITERATE_BARE", smtk::model::IteratorStyle::ITERATE_BARE) @@ -28,7 +28,7 @@ void pybind11_init_smtk_model_IteratorStyle(py::module &m) .export_values(); } -py::class_< smtk::model::EntityIterator > pybind11_init_smtk_model_EntityIterator(py::module &m) +inline py::class_< smtk::model::EntityIterator > pybind11_init_smtk_model_EntityIterator(py::module &m) { py::class_< smtk::model::EntityIterator > instance(m, "EntityIterator"); instance diff --git a/smtk/model/pybind11/PybindEntityRef.h b/smtk/model/pybind11/PybindEntityRef.h index b46ddd3063..513fe0da3c 100644 --- a/smtk/model/pybind11/PybindEntityRef.h +++ b/smtk/model/pybind11/PybindEntityRef.h @@ -30,7 +30,7 @@ #include "smtk/model/Tessellation.h" namespace py = pybind11; -void pybind11_init_smtk_model_Exclusions(py::module &m) +inline void pybind11_init_smtk_model_Exclusions(py::module &m) { py::enum_(m, "Exclusions") .value("Nothing", smtk::model::Exclusions::Nothing) @@ -40,7 +40,7 @@ void pybind11_init_smtk_model_Exclusions(py::module &m) .export_values(); } -py::class_< smtk::model::EntityRef > pybind11_init_smtk_model_EntityRef(py::module &m) +inline py::class_< smtk::model::EntityRef > pybind11_init_smtk_model_EntityRef(py::module &m) { py::class_< smtk::model::EntityRef > instance(m, "EntityRef"); instance @@ -177,7 +177,7 @@ py::class_< smtk::model::EntityRef > pybind11_init_smtk_model_EntityRef(py::modu return instance; } -void pybind11_init_smtk_model_entityrefHash(py::module &m) +inline void pybind11_init_smtk_model_entityrefHash(py::module &m) { m.def("entityrefHash", &smtk::model::entityrefHash, "", py::arg("c")); } diff --git a/smtk/model/pybind11/PybindEntityRefArrangementOps.h b/smtk/model/pybind11/PybindEntityRefArrangementOps.h index 20887b10fb..b84785c824 100644 --- a/smtk/model/pybind11/PybindEntityRefArrangementOps.h +++ b/smtk/model/pybind11/PybindEntityRefArrangementOps.h @@ -20,7 +20,7 @@ namespace py = pybind11; -py::class_< smtk::model::EntityRefArrangementOps > pybind11_init_smtk_model_EntityRefArrangementOps(py::module &m) +inline py::class_< smtk::model::EntityRefArrangementOps > pybind11_init_smtk_model_EntityRefArrangementOps(py::module &m) { py::class_< smtk::model::EntityRefArrangementOps > instance(m, "EntityRefArrangementOps"); instance diff --git a/smtk/model/pybind11/PybindEntityTypeBits.h b/smtk/model/pybind11/PybindEntityTypeBits.h index ff7464a164..7153fb33b5 100644 --- a/smtk/model/pybind11/PybindEntityTypeBits.h +++ b/smtk/model/pybind11/PybindEntityTypeBits.h @@ -17,7 +17,7 @@ namespace py = pybind11; -void pybind11_init_smtk_model_EntityTypeBits(py::module &m) +inline void pybind11_init_smtk_model_EntityTypeBits(py::module &m) { py::enum_(m, "EntityTypeBits") .value("DIMENSION_0", smtk::model::EntityTypeBits::DIMENSION_0) @@ -93,7 +93,7 @@ void pybind11_init_smtk_model_EntityTypeBits(py::module &m) ; } -void pybind11_init_smtk_model_ModelGeometryStyle(py::module &m) +inline void pybind11_init_smtk_model_ModelGeometryStyle(py::module &m) { py::enum_(m, "ModelGeometryStyle") .value("DISCRETE", smtk::model::ModelGeometryStyle::DISCRETE) @@ -101,112 +101,112 @@ void pybind11_init_smtk_model_ModelGeometryStyle(py::module &m) .export_values(); } -void pybind11_init_smtk_model_isCellEntity(py::module &m) +inline void pybind11_init_smtk_model_isCellEntity(py::module &m) { m.def("isCellEntity", &smtk::model::isCellEntity, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isVertex(py::module &m) +inline void pybind11_init_smtk_model_isVertex(py::module &m) { m.def("isVertex", &smtk::model::isVertex, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isEdge(py::module &m) +inline void pybind11_init_smtk_model_isEdge(py::module &m) { m.def("isEdge", &smtk::model::isEdge, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isFace(py::module &m) +inline void pybind11_init_smtk_model_isFace(py::module &m) { m.def("isFace", &smtk::model::isFace, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isVolume(py::module &m) +inline void pybind11_init_smtk_model_isVolume(py::module &m) { m.def("isVolume", &smtk::model::isVolume, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isUseEntity(py::module &m) +inline void pybind11_init_smtk_model_isUseEntity(py::module &m) { m.def("isUseEntity", &smtk::model::isUseEntity, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isVertexUse(py::module &m) +inline void pybind11_init_smtk_model_isVertexUse(py::module &m) { m.def("isVertexUse", &smtk::model::isVertexUse, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isEdgeUse(py::module &m) +inline void pybind11_init_smtk_model_isEdgeUse(py::module &m) { m.def("isEdgeUse", &smtk::model::isEdgeUse, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isFaceUse(py::module &m) +inline void pybind11_init_smtk_model_isFaceUse(py::module &m) { m.def("isFaceUse", &smtk::model::isFaceUse, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isVolumeUse(py::module &m) +inline void pybind11_init_smtk_model_isVolumeUse(py::module &m) { m.def("isVolumeUse", &smtk::model::isVolumeUse, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isShellEntity(py::module &m) +inline void pybind11_init_smtk_model_isShellEntity(py::module &m) { m.def("isShellEntity", &smtk::model::isShellEntity, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isChain(py::module &m) +inline void pybind11_init_smtk_model_isChain(py::module &m) { m.def("isChain", &smtk::model::isChain, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isLoop(py::module &m) +inline void pybind11_init_smtk_model_isLoop(py::module &m) { m.def("isLoop", &smtk::model::isLoop, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isShell(py::module &m) +inline void pybind11_init_smtk_model_isShell(py::module &m) { m.def("isShell", &smtk::model::isShell, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isGroup(py::module &m) +inline void pybind11_init_smtk_model_isGroup(py::module &m) { m.def("isGroup", &smtk::model::isGroup, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isModel(py::module &m) +inline void pybind11_init_smtk_model_isModel(py::module &m) { m.def("isModel", &smtk::model::isModel, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isInstance(py::module &m) +inline void pybind11_init_smtk_model_isInstance(py::module &m) { m.def("isInstance", &smtk::model::isInstance, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isAuxiliaryGeometry(py::module &m) +inline void pybind11_init_smtk_model_isAuxiliaryGeometry(py::module &m) { m.def("isAuxiliaryGeometry", &smtk::model::isAuxiliaryGeometry, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isConcept(py::module &m) +inline void pybind11_init_smtk_model_isConcept(py::module &m) { m.def("isConcept", &smtk::model::isConcept, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_isSessionRef(py::module &m) +inline void pybind11_init_smtk_model_isSessionRef(py::module &m) { m.def("isSessionRef", &smtk::model::isSessionRef, "", py::arg("entityFlags")); } -void pybind11_init_smtk_model_ModelGeometryStyleName(py::module &m) +inline void pybind11_init_smtk_model_ModelGeometryStyleName(py::module &m) { m.def("ModelGeometryStyleName", &smtk::model::ModelGeometryStyleName, "", py::arg("s")); } -void pybind11_init_smtk_model_NamedModelGeometryStyle(py::module &m) +inline void pybind11_init_smtk_model_NamedModelGeometryStyle(py::module &m) { m.def("NamedModelGeometryStyle", &smtk::model::NamedModelGeometryStyle, "", py::arg("s")); } diff --git a/smtk/model/pybind11/PybindEvents.h b/smtk/model/pybind11/PybindEvents.h index ee5dd09472..8c5e77a8ef 100644 --- a/smtk/model/pybind11/PybindEvents.h +++ b/smtk/model/pybind11/PybindEvents.h @@ -17,7 +17,7 @@ namespace py = pybind11; -void pybind11_init_smtk_model_ResourceEventChangeType(py::module &m) +inline void pybind11_init_smtk_model_ResourceEventChangeType(py::module &m) { py::enum_(m, "ResourceEventChangeType") .value("ADD_EVENT", smtk::model::ResourceEventChangeType::ADD_EVENT) @@ -27,7 +27,7 @@ void pybind11_init_smtk_model_ResourceEventChangeType(py::module &m) .export_values(); } -void pybind11_init_smtk_model_ResourceEventRelationType(py::module &m) +inline void pybind11_init_smtk_model_ResourceEventRelationType(py::module &m) { py::enum_(m, "ResourceEventRelationType") .value("ENTITY_ENTRY", smtk::model::ResourceEventRelationType::ENTITY_ENTRY) diff --git a/smtk/model/pybind11/PybindExportModelJSON.h b/smtk/model/pybind11/PybindExportModelJSON.h index 84dcf1f2b5..87fafcd78d 100644 --- a/smtk/model/pybind11/PybindExportModelJSON.h +++ b/smtk/model/pybind11/PybindExportModelJSON.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::model::ExportModelJSON, smtk::operation::XMLOperation > pybind11_init_smtk_model_ExportModelJSON(py::module &m) +inline PySharedPtrClass< smtk::model::ExportModelJSON, smtk::operation::XMLOperation > pybind11_init_smtk_model_ExportModelJSON(py::module &m) { PySharedPtrClass< smtk::model::ExportModelJSON, smtk::operation::XMLOperation > instance(m, "ExportModelJSON"); instance diff --git a/smtk/model/pybind11/PybindFace.h b/smtk/model/pybind11/PybindFace.h index 78b8343232..565d1af600 100644 --- a/smtk/model/pybind11/PybindFace.h +++ b/smtk/model/pybind11/PybindFace.h @@ -25,7 +25,7 @@ namespace py = pybind11; -py::class_< smtk::model::Face, smtk::model::CellEntity > pybind11_init_smtk_model_Face(py::module &m) +inline py::class_< smtk::model::Face, smtk::model::CellEntity > pybind11_init_smtk_model_Face(py::module &m) { py::class_< smtk::model::Face, smtk::model::CellEntity > instance(m, "Face"); instance diff --git a/smtk/model/pybind11/PybindFaceUse.h b/smtk/model/pybind11/PybindFaceUse.h index a519b3194c..a35c7b5d03 100644 --- a/smtk/model/pybind11/PybindFaceUse.h +++ b/smtk/model/pybind11/PybindFaceUse.h @@ -27,7 +27,7 @@ namespace py = pybind11; -py::class_< smtk::model::FaceUse, smtk::model::UseEntity > pybind11_init_smtk_model_FaceUse(py::module &m) +inline py::class_< smtk::model::FaceUse, smtk::model::UseEntity > pybind11_init_smtk_model_FaceUse(py::module &m) { py::class_< smtk::model::FaceUse, smtk::model::UseEntity > instance(m, "FaceUse"); instance diff --git a/smtk/model/pybind11/PybindGroup.h b/smtk/model/pybind11/PybindGroup.h index 085840d976..5612967802 100644 --- a/smtk/model/pybind11/PybindGroup.h +++ b/smtk/model/pybind11/PybindGroup.h @@ -24,7 +24,7 @@ namespace py = pybind11; -py::class_< smtk::model::Group, smtk::model::EntityRef > pybind11_init_smtk_model_Group(py::module &m) +inline py::class_< smtk::model::Group, smtk::model::EntityRef > pybind11_init_smtk_model_Group(py::module &m) { py::class_< smtk::model::Group, smtk::model::EntityRef > instance(m, "Group"); instance diff --git a/smtk/model/pybind11/PybindInstance.h b/smtk/model/pybind11/PybindInstance.h index f604130288..6a26094168 100644 --- a/smtk/model/pybind11/PybindInstance.h +++ b/smtk/model/pybind11/PybindInstance.h @@ -23,7 +23,7 @@ namespace py = pybind11; -py::class_< smtk::model::Instance, smtk::model::EntityRef > pybind11_init_smtk_model_Instance(py::module &m) +inline py::class_< smtk::model::Instance, smtk::model::EntityRef > pybind11_init_smtk_model_Instance(py::module &m) { py::class_< smtk::model::Instance, smtk::model::EntityRef > instance(m, "Instance"); instance diff --git a/smtk/model/pybind11/PybindLoop.h b/smtk/model/pybind11/PybindLoop.h index 798a050ba5..99fce3bf88 100644 --- a/smtk/model/pybind11/PybindLoop.h +++ b/smtk/model/pybind11/PybindLoop.h @@ -27,7 +27,7 @@ namespace py = pybind11; -py::class_< smtk::model::Loop, smtk::model::ShellEntity > pybind11_init_smtk_model_Loop(py::module &m) +inline py::class_< smtk::model::Loop, smtk::model::ShellEntity > pybind11_init_smtk_model_Loop(py::module &m) { py::class_< smtk::model::Loop, smtk::model::ShellEntity > instance(m, "Loop"); instance diff --git a/smtk/model/pybind11/PybindModel.h b/smtk/model/pybind11/PybindModel.h index fc1918757c..b6bb0f324a 100644 --- a/smtk/model/pybind11/PybindModel.h +++ b/smtk/model/pybind11/PybindModel.h @@ -27,7 +27,7 @@ namespace py = pybind11; -py::class_< smtk::model::Model, smtk::model::EntityRef > pybind11_init_smtk_model_Model(py::module &m) +inline py::class_< smtk::model::Model, smtk::model::EntityRef > pybind11_init_smtk_model_Model(py::module &m) { py::class_< smtk::model::Model, smtk::model::EntityRef > instance(m, "Model"); instance diff --git a/smtk/model/pybind11/PybindRegistrar.h b/smtk/model/pybind11/PybindRegistrar.h index 71aac2515d..758fe9521e 100644 --- a/smtk/model/pybind11/PybindRegistrar.h +++ b/smtk/model/pybind11/PybindRegistrar.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::model::Registrar > pybind11_init_smtk_model_Registrar(py::module &m) +inline py::class_< smtk::model::Registrar > pybind11_init_smtk_model_Registrar(py::module &m) { py::class_< smtk::model::Registrar > instance(m, "Registrar"); instance diff --git a/smtk/model/pybind11/PybindResource.h b/smtk/model/pybind11/PybindResource.h index af7ee2abe1..4998f5fc83 100644 --- a/smtk/model/pybind11/PybindResource.h +++ b/smtk/model/pybind11/PybindResource.h @@ -47,7 +47,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::model::Resource> pybind11_init_smtk_model_Resource(py::module &m) +inline PySharedPtrClass< smtk::model::Resource> pybind11_init_smtk_model_Resource(py::module &m) { PySharedPtrClass< smtk::model::Resource, smtk::resource::Resource > instance(m, "Resource"); instance diff --git a/smtk/model/pybind11/PybindSession.h b/smtk/model/pybind11/PybindSession.h index 2d70b4b8a7..dcafa6d34b 100644 --- a/smtk/model/pybind11/PybindSession.h +++ b/smtk/model/pybind11/PybindSession.h @@ -24,7 +24,7 @@ namespace py = pybind11; -void pybind11_init_smtk_model_SessionInformation(py::module &m) +inline void pybind11_init_smtk_model_SessionInformation(py::module &m) { py::enum_(m, "SessionInformation") .value("SESSION_ENTITY_TYPE", smtk::model::SessionInformation::SESSION_ENTITY_TYPE) @@ -45,7 +45,7 @@ void pybind11_init_smtk_model_SessionInformation(py::module &m) .export_values(); } -PySharedPtrClass< smtk::model::Session > pybind11_init_smtk_model_Session(py::module &m) +inline PySharedPtrClass< smtk::model::Session > pybind11_init_smtk_model_Session(py::module &m) { PySharedPtrClass< smtk::model::Session > instance(m, "Session"); instance diff --git a/smtk/model/pybind11/PybindSessionIO.h b/smtk/model/pybind11/PybindSessionIO.h index 8b01545943..ca0adcd178 100644 --- a/smtk/model/pybind11/PybindSessionIO.h +++ b/smtk/model/pybind11/PybindSessionIO.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::model::SessionIO > pybind11_init_smtk_model_SessionIO(py::module &m) +inline py::class_< smtk::model::SessionIO > pybind11_init_smtk_model_SessionIO(py::module &m) { py::class_< smtk::model::SessionIO > instance(m, "SessionIO"); instance diff --git a/smtk/model/pybind11/PybindSessionIOJSON.h b/smtk/model/pybind11/PybindSessionIOJSON.h index 80ce51c686..3ab86fc205 100644 --- a/smtk/model/pybind11/PybindSessionIOJSON.h +++ b/smtk/model/pybind11/PybindSessionIOJSON.h @@ -20,7 +20,7 @@ namespace py = pybind11; -py::class_< smtk::model::SessionIOJSON, smtk::model::SessionIO > pybind11_init_smtk_model_SessionIOJSON(py::module &m) +inline py::class_< smtk::model::SessionIOJSON, smtk::model::SessionIO > pybind11_init_smtk_model_SessionIOJSON(py::module &m) { py::class_< smtk::model::SessionIOJSON, smtk::model::SessionIO > instance(m, "SessionIOJSON"); instance diff --git a/smtk/model/pybind11/PybindSessionRef.h b/smtk/model/pybind11/PybindSessionRef.h index cf8d660e07..4328a5e275 100644 --- a/smtk/model/pybind11/PybindSessionRef.h +++ b/smtk/model/pybind11/PybindSessionRef.h @@ -27,7 +27,7 @@ namespace py = pybind11; -py::class_< smtk::model::SessionRef, smtk::model::EntityRef > pybind11_init_smtk_model_SessionRef(py::module &m) +inline py::class_< smtk::model::SessionRef, smtk::model::EntityRef > pybind11_init_smtk_model_SessionRef(py::module &m) { py::class_< smtk::model::SessionRef, smtk::model::EntityRef > instance(m, "SessionRef"); instance diff --git a/smtk/model/pybind11/PybindShell.h b/smtk/model/pybind11/PybindShell.h index 8c295fdf65..006a9c9546 100644 --- a/smtk/model/pybind11/PybindShell.h +++ b/smtk/model/pybind11/PybindShell.h @@ -25,7 +25,7 @@ namespace py = pybind11; -py::class_< smtk::model::Shell, smtk::model::ShellEntity > pybind11_init_smtk_model_Shell(py::module &m) +inline py::class_< smtk::model::Shell, smtk::model::ShellEntity > pybind11_init_smtk_model_Shell(py::module &m) { py::class_< smtk::model::Shell, smtk::model::ShellEntity > instance(m, "Shell"); instance diff --git a/smtk/model/pybind11/PybindShellEntity.h b/smtk/model/pybind11/PybindShellEntity.h index f79d7786a2..aaf5e8b38b 100644 --- a/smtk/model/pybind11/PybindShellEntity.h +++ b/smtk/model/pybind11/PybindShellEntity.h @@ -25,7 +25,7 @@ namespace py = pybind11; -py::class_< smtk::model::ShellEntity, smtk::model::EntityRef > pybind11_init_smtk_model_ShellEntity(py::module &m) +inline py::class_< smtk::model::ShellEntity, smtk::model::EntityRef > pybind11_init_smtk_model_ShellEntity(py::module &m) { py::class_< smtk::model::ShellEntity, smtk::model::EntityRef > instance(m, "ShellEntity"); instance diff --git a/smtk/model/pybind11/PybindTessellation.h b/smtk/model/pybind11/PybindTessellation.h index 19f7401b53..10cd2eaba9 100644 --- a/smtk/model/pybind11/PybindTessellation.h +++ b/smtk/model/pybind11/PybindTessellation.h @@ -17,7 +17,7 @@ namespace py = pybind11; -void pybind11_init_smtk_model_TessellationCellType(py::module &m) +inline void pybind11_init_smtk_model_TessellationCellType(py::module &m) { py::enum_(m, "TessellationCellType") .value("TESS_VERTEX", smtk::model::TessellationCellType::TESS_VERTEX) @@ -41,7 +41,7 @@ void pybind11_init_smtk_model_TessellationCellType(py::module &m) .export_values(); } -py::class_< smtk::model::Tessellation > pybind11_init_smtk_model_Tessellation(py::module &m) +inline py::class_< smtk::model::Tessellation > pybind11_init_smtk_model_Tessellation(py::module &m) { py::class_< smtk::model::Tessellation > instance(m, "Tessellation"); instance diff --git a/smtk/model/pybind11/PybindUseEntity.h b/smtk/model/pybind11/PybindUseEntity.h index 634100bd39..b105dad958 100644 --- a/smtk/model/pybind11/PybindUseEntity.h +++ b/smtk/model/pybind11/PybindUseEntity.h @@ -25,7 +25,7 @@ namespace py = pybind11; -py::class_< smtk::model::UseEntity, smtk::model::EntityRef > pybind11_init_smtk_model_UseEntity(py::module &m) +inline py::class_< smtk::model::UseEntity, smtk::model::EntityRef > pybind11_init_smtk_model_UseEntity(py::module &m) { py::class_< smtk::model::UseEntity, smtk::model::EntityRef > instance(m, "UseEntity"); instance diff --git a/smtk/model/pybind11/PybindVertex.h b/smtk/model/pybind11/PybindVertex.h index 3765697c9a..a4adfd5784 100644 --- a/smtk/model/pybind11/PybindVertex.h +++ b/smtk/model/pybind11/PybindVertex.h @@ -25,7 +25,7 @@ namespace py = pybind11; -py::class_< smtk::model::Vertex, smtk::model::CellEntity > pybind11_init_smtk_model_Vertex(py::module &m) +inline py::class_< smtk::model::Vertex, smtk::model::CellEntity > pybind11_init_smtk_model_Vertex(py::module &m) { py::class_< smtk::model::Vertex, smtk::model::CellEntity > instance(m, "Vertex"); instance diff --git a/smtk/model/pybind11/PybindVertexUse.h b/smtk/model/pybind11/PybindVertexUse.h index 87d44d73a1..6fb003b295 100644 --- a/smtk/model/pybind11/PybindVertexUse.h +++ b/smtk/model/pybind11/PybindVertexUse.h @@ -25,7 +25,7 @@ namespace py = pybind11; -py::class_< smtk::model::VertexUse, smtk::model::UseEntity > pybind11_init_smtk_model_VertexUse(py::module &m) +inline py::class_< smtk::model::VertexUse, smtk::model::UseEntity > pybind11_init_smtk_model_VertexUse(py::module &m) { py::class_< smtk::model::VertexUse, smtk::model::UseEntity > instance(m, "VertexUse"); instance diff --git a/smtk/model/pybind11/PybindVolume.h b/smtk/model/pybind11/PybindVolume.h index 2a528463bc..90d59179ef 100644 --- a/smtk/model/pybind11/PybindVolume.h +++ b/smtk/model/pybind11/PybindVolume.h @@ -25,7 +25,7 @@ namespace py = pybind11; -py::class_< smtk::model::Volume, smtk::model::CellEntity > pybind11_init_smtk_model_Volume(py::module &m) +inline py::class_< smtk::model::Volume, smtk::model::CellEntity > pybind11_init_smtk_model_Volume(py::module &m) { py::class_< smtk::model::Volume, smtk::model::CellEntity > instance(m, "Volume"); instance diff --git a/smtk/model/pybind11/PybindVolumeUse.h b/smtk/model/pybind11/PybindVolumeUse.h index 3ae5ecb4ae..4a663cc310 100644 --- a/smtk/model/pybind11/PybindVolumeUse.h +++ b/smtk/model/pybind11/PybindVolumeUse.h @@ -25,7 +25,7 @@ namespace py = pybind11; -py::class_< smtk::model::VolumeUse, smtk::model::UseEntity > pybind11_init_smtk_model_VolumeUse(py::module &m) +inline py::class_< smtk::model::VolumeUse, smtk::model::UseEntity > pybind11_init_smtk_model_VolumeUse(py::module &m) { py::class_< smtk::model::VolumeUse, smtk::model::UseEntity > instance(m, "VolumeUse"); instance diff --git a/smtk/operation/pybind11/PybindManager.h b/smtk/operation/pybind11/PybindManager.h index b6ea751850..ff1cc51f90 100644 --- a/smtk/operation/pybind11/PybindManager.h +++ b/smtk/operation/pybind11/PybindManager.h @@ -30,7 +30,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::operation::Manager > pybind11_init_smtk_operation_Manager(py::module &m) +inline PySharedPtrClass< smtk::operation::Manager > pybind11_init_smtk_operation_Manager(py::module &m) { PySharedPtrClass< smtk::operation::Manager > instance(m, "Manager"); instance diff --git a/smtk/operation/pybind11/PybindMetadata.h b/smtk/operation/pybind11/PybindMetadata.h index 8d7dd0eac7..9d83c55334 100644 --- a/smtk/operation/pybind11/PybindMetadata.h +++ b/smtk/operation/pybind11/PybindMetadata.h @@ -22,7 +22,7 @@ namespace py = pybind11; -py::class_< smtk::operation::Metadata > pybind11_init_smtk_operation_Metadata(py::module &m) +inline py::class_< smtk::operation::Metadata > pybind11_init_smtk_operation_Metadata(py::module &m) { py::class_< smtk::operation::Metadata > instance(m, "Metadata"); instance diff --git a/smtk/operation/pybind11/PybindMetadataContainer.h b/smtk/operation/pybind11/PybindMetadataContainer.h index 596a5c81bb..e7f0293a83 100644 --- a/smtk/operation/pybind11/PybindMetadataContainer.h +++ b/smtk/operation/pybind11/PybindMetadataContainer.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::operation::IndexTag > pybind11_init_smtk_operation_IndexTag(py::module &m) +inline py::class_< smtk::operation::IndexTag > pybind11_init_smtk_operation_IndexTag(py::module &m) { py::class_< smtk::operation::IndexTag > instance(m, "IndexTag"); instance @@ -28,7 +28,7 @@ py::class_< smtk::operation::IndexTag > pybind11_init_smtk_operation_IndexTag(py return instance; } -py::class_< smtk::operation::NameTag > pybind11_init_smtk_operation_NameTag(py::module &m) +inline py::class_< smtk::operation::NameTag > pybind11_init_smtk_operation_NameTag(py::module &m) { py::class_< smtk::operation::NameTag > instance(m, "NameTag"); instance diff --git a/smtk/operation/pybind11/PybindMetadataObserver.h b/smtk/operation/pybind11/PybindMetadataObserver.h index 70ca2d7a46..2c86e0a11e 100644 --- a/smtk/operation/pybind11/PybindMetadataObserver.h +++ b/smtk/operation/pybind11/PybindMetadataObserver.h @@ -19,7 +19,7 @@ namespace py = pybind11; -py::class_< smtk::operation::MetadataObservers > pybind11_init_smtk_operation_MetadataObservers(py::module &m) +inline py::class_< smtk::operation::MetadataObservers > pybind11_init_smtk_operation_MetadataObservers(py::module &m) { py::class_< smtk::operation::MetadataObservers > instance(m, "MetadataObservers"); instance diff --git a/smtk/operation/pybind11/PybindObserver.h b/smtk/operation/pybind11/PybindObserver.h index f8a8e3a146..f58768114a 100644 --- a/smtk/operation/pybind11/PybindObserver.h +++ b/smtk/operation/pybind11/PybindObserver.h @@ -19,7 +19,7 @@ namespace py = pybind11; -void pybind11_init_smtk_operation_EventType(py::module &m) +inline void pybind11_init_smtk_operation_EventType(py::module &m) { py::enum_(m, "EventType") .value("WILL_OPERATE", smtk::operation::EventType::WILL_OPERATE) @@ -27,7 +27,7 @@ void pybind11_init_smtk_operation_EventType(py::module &m) .export_values(); } -py::class_< smtk::operation::Observers > pybind11_init_smtk_operation_Observers(py::module &m) +inline py::class_< smtk::operation::Observers > pybind11_init_smtk_operation_Observers(py::module &m) { py::class_< smtk::operation::Observers > instance(m, "Observers"); instance diff --git a/smtk/operation/pybind11/PybindOperation.h b/smtk/operation/pybind11/PybindOperation.h index df55c0bc0a..b5898f6725 100644 --- a/smtk/operation/pybind11/PybindOperation.h +++ b/smtk/operation/pybind11/PybindOperation.h @@ -23,7 +23,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::operation::Operation, smtk::operation::PyOperation > pybind11_init_smtk_operation_Operation(py::module &m) +inline PySharedPtrClass< smtk::operation::Operation, smtk::operation::PyOperation > pybind11_init_smtk_operation_Operation(py::module &m) { PySharedPtrClass< smtk::operation::Operation, smtk::operation::PyOperation > instance(m, "Operation"); instance diff --git a/smtk/operation/pybind11/PybindReadResource.h b/smtk/operation/pybind11/PybindReadResource.h index b4693e0f97..22e5738101 100644 --- a/smtk/operation/pybind11/PybindReadResource.h +++ b/smtk/operation/pybind11/PybindReadResource.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::operation::ReadResource, smtk::operation::XMLOperation > pybind11_init_smtk_operation_ReadResource(py::module &m) +inline PySharedPtrClass< smtk::operation::ReadResource, smtk::operation::XMLOperation > pybind11_init_smtk_operation_ReadResource(py::module &m) { PySharedPtrClass< smtk::operation::ReadResource, smtk::operation::XMLOperation > instance(m, "ReadResource"); instance diff --git a/smtk/operation/pybind11/PybindRegistrar.h b/smtk/operation/pybind11/PybindRegistrar.h index 88150e33b4..2c0eec1595 100644 --- a/smtk/operation/pybind11/PybindRegistrar.h +++ b/smtk/operation/pybind11/PybindRegistrar.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::operation::Registrar > pybind11_init_smtk_operation_Registrar(py::module &m) +inline py::class_< smtk::operation::Registrar > pybind11_init_smtk_operation_Registrar(py::module &m) { py::class_< smtk::operation::Registrar > instance(m, "Registrar"); instance diff --git a/smtk/operation/pybind11/PybindRemoveResource.h b/smtk/operation/pybind11/PybindRemoveResource.h index d7427e3a31..edb6de9498 100644 --- a/smtk/operation/pybind11/PybindRemoveResource.h +++ b/smtk/operation/pybind11/PybindRemoveResource.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::operation::RemoveResource, smtk::operation::XMLOperation > pybind11_init_smtk_operation_RemoveResource(py::module &m) +inline PySharedPtrClass< smtk::operation::RemoveResource, smtk::operation::XMLOperation > pybind11_init_smtk_operation_RemoveResource(py::module &m) { PySharedPtrClass< smtk::operation::RemoveResource, smtk::operation::XMLOperation > instance(m, "RemoveResource"); instance diff --git a/smtk/operation/pybind11/PybindResourceManagerOperation.h b/smtk/operation/pybind11/PybindResourceManagerOperation.h index edd7c77019..9d3d85f8c7 100644 --- a/smtk/operation/pybind11/PybindResourceManagerOperation.h +++ b/smtk/operation/pybind11/PybindResourceManagerOperation.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::operation::ResourceManagerOperation, smtk::operation::XMLOperation > pybind11_init_smtk_operation_ResourceManagerOperation(py::module &m) +inline PySharedPtrClass< smtk::operation::ResourceManagerOperation, smtk::operation::XMLOperation > pybind11_init_smtk_operation_ResourceManagerOperation(py::module &m) { PySharedPtrClass< smtk::operation::ResourceManagerOperation, smtk::operation::XMLOperation > instance(m, "ResourceManagerOperation"); instance diff --git a/smtk/operation/pybind11/PybindSetProperty.h b/smtk/operation/pybind11/PybindSetProperty.h index 37e1f9de81..2e0d964431 100644 --- a/smtk/operation/pybind11/PybindSetProperty.h +++ b/smtk/operation/pybind11/PybindSetProperty.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::operation::SetProperty, smtk::operation::XMLOperation > pybind11_init_smtk_operation_SetProperty(py::module &m) +inline PySharedPtrClass< smtk::operation::SetProperty, smtk::operation::XMLOperation > pybind11_init_smtk_operation_SetProperty(py::module &m) { PySharedPtrClass< smtk::operation::SetProperty, smtk::operation::XMLOperation > instance(m, "SetProperty"); instance diff --git a/smtk/operation/pybind11/PybindWriteResource.h b/smtk/operation/pybind11/PybindWriteResource.h index 32c3a47b8d..f54bbefa6b 100644 --- a/smtk/operation/pybind11/PybindWriteResource.h +++ b/smtk/operation/pybind11/PybindWriteResource.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::operation::WriteResource, smtk::operation::XMLOperation > pybind11_init_smtk_operation_WriteResource(py::module &m) +inline PySharedPtrClass< smtk::operation::WriteResource, smtk::operation::XMLOperation > pybind11_init_smtk_operation_WriteResource(py::module &m) { PySharedPtrClass< smtk::operation::WriteResource, smtk::operation::XMLOperation > instance(m, "WriteResource"); instance diff --git a/smtk/operation/pybind11/PybindXMLOperation.h b/smtk/operation/pybind11/PybindXMLOperation.h index 91678ecac2..5bad73ffdc 100644 --- a/smtk/operation/pybind11/PybindXMLOperation.h +++ b/smtk/operation/pybind11/PybindXMLOperation.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::operation::XMLOperation, smtk::operation::Operation > pybind11_init_smtk_operation_XMLOperation(py::module &m) +inline PySharedPtrClass< smtk::operation::XMLOperation, smtk::operation::Operation > pybind11_init_smtk_operation_XMLOperation(py::module &m) { PySharedPtrClass< smtk::operation::XMLOperation, smtk::operation::Operation > instance(m, "XMLOperation"); instance diff --git a/smtk/project/pybind11/PybindContainer.h b/smtk/project/pybind11/PybindContainer.h index b98bf18178..ab82971d48 100644 --- a/smtk/project/pybind11/PybindContainer.h +++ b/smtk/project/pybind11/PybindContainer.h @@ -21,22 +21,22 @@ namespace py = pybind11; -void pybind11_init_smtk_project_detail_id(py::module &m) +inline void pybind11_init_smtk_project_detail_id(py::module &m) { m.def("id", &smtk::project::detail::id, "", py::arg("r")); } -void pybind11_init_smtk_project_detail_index(py::module &m) +inline void pybind11_init_smtk_project_detail_index(py::module &m) { m.def("index", &smtk::project::detail::index, "", py::arg("r")); } -void pybind11_init_smtk_project_detail_location(py::module &m) +inline void pybind11_init_smtk_project_detail_location(py::module &m) { m.def("location", &smtk::project::detail::location, "", py::arg("r")); } -void pybind11_init_smtk_project_detail_name(py::module &m) +inline void pybind11_init_smtk_project_detail_name(py::module &m) { m.def("name", &smtk::project::detail::name, "", py::arg("r")); } diff --git a/smtk/project/pybind11/PybindManager.h b/smtk/project/pybind11/PybindManager.h index 054ab22236..860de408eb 100644 --- a/smtk/project/pybind11/PybindManager.h +++ b/smtk/project/pybind11/PybindManager.h @@ -25,7 +25,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::project::Manager > pybind11_init_smtk_project_Manager(py::module &m) +inline PySharedPtrClass< smtk::project::Manager > pybind11_init_smtk_project_Manager(py::module &m) { PySharedPtrClass< smtk::project::Manager > instance(m, "Manager"); instance diff --git a/smtk/project/pybind11/PybindMetadata.h b/smtk/project/pybind11/PybindMetadata.h index 0fdeabaff0..d548da6d61 100644 --- a/smtk/project/pybind11/PybindMetadata.h +++ b/smtk/project/pybind11/PybindMetadata.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::project::Metadata > pybind11_init_smtk_project_Metadata(py::module &m) +inline py::class_< smtk::project::Metadata > pybind11_init_smtk_project_Metadata(py::module &m) { py::class_< smtk::project::Metadata > instance(m, "Metadata"); instance diff --git a/smtk/project/pybind11/PybindObserver.h b/smtk/project/pybind11/PybindObserver.h index 5d361fbc07..7c826b6757 100644 --- a/smtk/project/pybind11/PybindObserver.h +++ b/smtk/project/pybind11/PybindObserver.h @@ -17,7 +17,7 @@ namespace py = pybind11; -void pybind11_init_smtk_project_EventType(py::module &m) +inline void pybind11_init_smtk_project_EventType(py::module &m) { py::enum_(m, "EventType") .value("ADDED", smtk::project::EventType::ADDED) diff --git a/smtk/project/pybind11/PybindOperation.h b/smtk/project/pybind11/PybindOperation.h index a6d324a16e..306815c304 100644 --- a/smtk/project/pybind11/PybindOperation.h +++ b/smtk/project/pybind11/PybindOperation.h @@ -20,7 +20,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::project::Operation, smtk::operation::XMLOperation > pybind11_init_smtk_project_Operation(py::module &m) +inline PySharedPtrClass< smtk::project::Operation, smtk::operation::XMLOperation > pybind11_init_smtk_project_Operation(py::module &m) { py::module::import("smtk.operation"); diff --git a/smtk/project/pybind11/PybindOperationFactory.h b/smtk/project/pybind11/PybindOperationFactory.h index e2079aeed5..d77141e37a 100644 --- a/smtk/project/pybind11/PybindOperationFactory.h +++ b/smtk/project/pybind11/PybindOperationFactory.h @@ -19,7 +19,7 @@ namespace py = pybind11; -py::class_< smtk::project::OperationFactory > pybind11_init_smtk_project_OperationFactory(py::module &m) +inline py::class_< smtk::project::OperationFactory > pybind11_init_smtk_project_OperationFactory(py::module &m) { py::class_< smtk::project::OperationFactory > instance(m, "OperationFactory"); instance diff --git a/smtk/project/pybind11/PybindProject.h b/smtk/project/pybind11/PybindProject.h index a3892d1506..bd38ce7abd 100644 --- a/smtk/project/pybind11/PybindProject.h +++ b/smtk/project/pybind11/PybindProject.h @@ -26,7 +26,7 @@ namespace py = pybind11; -PySharedPtrClass pybind11_init_smtk_project_Project(py::module& m) +inline PySharedPtrClass pybind11_init_smtk_project_Project(py::module& m) { PySharedPtrClass instance(m, "Project"); diff --git a/smtk/project/pybind11/PybindRegistrar.h b/smtk/project/pybind11/PybindRegistrar.h index c8695e0684..6d3ccc1fcb 100644 --- a/smtk/project/pybind11/PybindRegistrar.h +++ b/smtk/project/pybind11/PybindRegistrar.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::project::Registrar > pybind11_init_smtk_project_Registrar(py::module &m) +inline py::class_< smtk::project::Registrar > pybind11_init_smtk_project_Registrar(py::module &m) { py::class_< smtk::project::Registrar > instance(m, "Registrar"); instance diff --git a/smtk/project/pybind11/PybindResourceContainer.h b/smtk/project/pybind11/PybindResourceContainer.h index 852c621586..8f64840055 100644 --- a/smtk/project/pybind11/PybindResourceContainer.h +++ b/smtk/project/pybind11/PybindResourceContainer.h @@ -22,7 +22,7 @@ namespace py = pybind11; -py::class_< smtk::project::ResourceContainer > pybind11_init_smtk_project_ResourceContainer(py::module &m) +inline py::class_< smtk::project::ResourceContainer > pybind11_init_smtk_project_ResourceContainer(py::module &m) { py::class_< smtk::project::ResourceContainer > instance(m, "ResourceContainer"); instance @@ -67,7 +67,7 @@ py::class_< smtk::project::ResourceContainer > pybind11_init_smtk_project_Resour return instance; } -void pybind11_init_smtk_project_detail_role(py::module &m) +inline void pybind11_init_smtk_project_detail_role(py::module &m) { m.def("role", &smtk::project::detail::role, "", py::arg("r")); } diff --git a/smtk/project/pybind11/PybindTags.h b/smtk/project/pybind11/PybindTags.h index a303474f5b..2b121829a4 100644 --- a/smtk/project/pybind11/PybindTags.h +++ b/smtk/project/pybind11/PybindTags.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::project::IdTag > pybind11_init_smtk_project_IdTag(py::module &m) +inline py::class_< smtk::project::IdTag > pybind11_init_smtk_project_IdTag(py::module &m) { py::class_< smtk::project::IdTag > instance(m, "IdTag"); instance @@ -28,7 +28,7 @@ py::class_< smtk::project::IdTag > pybind11_init_smtk_project_IdTag(py::module & return instance; } -py::class_< smtk::project::IndexTag > pybind11_init_smtk_project_IndexTag(py::module &m) +inline py::class_< smtk::project::IndexTag > pybind11_init_smtk_project_IndexTag(py::module &m) { py::class_< smtk::project::IndexTag > instance(m, "IndexTag"); instance @@ -39,7 +39,7 @@ py::class_< smtk::project::IndexTag > pybind11_init_smtk_project_IndexTag(py::mo return instance; } -py::class_< smtk::project::LocationTag > pybind11_init_smtk_project_LocationTag(py::module &m) +inline py::class_< smtk::project::LocationTag > pybind11_init_smtk_project_LocationTag(py::module &m) { py::class_< smtk::project::LocationTag > instance(m, "LocationTag"); instance @@ -50,7 +50,7 @@ py::class_< smtk::project::LocationTag > pybind11_init_smtk_project_LocationTag( return instance; } -py::class_< smtk::project::NameTag > pybind11_init_smtk_project_NameTag(py::module &m) +inline py::class_< smtk::project::NameTag > pybind11_init_smtk_project_NameTag(py::module &m) { py::class_< smtk::project::NameTag > instance(m, "NameTag"); instance @@ -61,7 +61,7 @@ py::class_< smtk::project::NameTag > pybind11_init_smtk_project_NameTag(py::modu return instance; } -py::class_< smtk::project::RoleTag > pybind11_init_smtk_project_RoleTag(py::module &m) +inline py::class_< smtk::project::RoleTag > pybind11_init_smtk_project_RoleTag(py::module &m) { py::class_< smtk::project::RoleTag > instance(m, "RoleTag"); instance diff --git a/smtk/resource/pybind11/PybindComponent.h b/smtk/resource/pybind11/PybindComponent.h index f150f3bbf9..e511e74557 100644 --- a/smtk/resource/pybind11/PybindComponent.h +++ b/smtk/resource/pybind11/PybindComponent.h @@ -24,7 +24,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::resource::Component, smtk::resource::PyComponent, smtk::resource::PersistentObject > pybind11_init_smtk_resource_Component(py::module &m) +inline PySharedPtrClass< smtk::resource::Component, smtk::resource::PyComponent, smtk::resource::PersistentObject > pybind11_init_smtk_resource_Component(py::module &m) { PySharedPtrClass< smtk::resource::Component, smtk::resource::PyComponent, smtk::resource::PersistentObject > instance(m, "Component"); instance diff --git a/smtk/resource/pybind11/PybindManager.h b/smtk/resource/pybind11/PybindManager.h index 30dfbde2da..92822db8f6 100644 --- a/smtk/resource/pybind11/PybindManager.h +++ b/smtk/resource/pybind11/PybindManager.h @@ -21,7 +21,7 @@ namespace py = pybind11; -PySharedPtrClass pybind11_init_smtk_resource_Manager(py::module& m) +inline PySharedPtrClass pybind11_init_smtk_resource_Manager(py::module& m) { PySharedPtrClass instance(m, "Manager"); instance diff --git a/smtk/resource/pybind11/PybindObserver.h b/smtk/resource/pybind11/PybindObserver.h index c2713e470f..18fad50459 100644 --- a/smtk/resource/pybind11/PybindObserver.h +++ b/smtk/resource/pybind11/PybindObserver.h @@ -19,7 +19,7 @@ namespace py = pybind11; -void pybind11_init_smtk_resource_EventType(py::module &m) +inline void pybind11_init_smtk_resource_EventType(py::module &m) { py::enum_(m, "EventType") .value("ADDED", smtk::resource::EventType::ADDED) @@ -28,7 +28,7 @@ void pybind11_init_smtk_resource_EventType(py::module &m) .export_values(); } -py::class_< smtk::resource::Observers > pybind11_init_smtk_resource_Observers(py::module &m) +inline py::class_< smtk::resource::Observers > pybind11_init_smtk_resource_Observers(py::module &m) { py::class_< smtk::resource::Observers > instance(m, "Observers"); instance diff --git a/smtk/resource/pybind11/PybindPersistentObject.h b/smtk/resource/pybind11/PybindPersistentObject.h index a82a16c083..a332116973 100644 --- a/smtk/resource/pybind11/PybindPersistentObject.h +++ b/smtk/resource/pybind11/PybindPersistentObject.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::resource::PersistentObject > pybind11_init_smtk_resource_PersistentObject(py::module &m) +inline PySharedPtrClass< smtk::resource::PersistentObject > pybind11_init_smtk_resource_PersistentObject(py::module &m) { PySharedPtrClass< smtk::resource::PersistentObject > instance(m, "PersistentObject"); instance diff --git a/smtk/resource/pybind11/PybindPropertyType.h b/smtk/resource/pybind11/PybindPropertyType.h index a1d5b4c00c..812978b49b 100644 --- a/smtk/resource/pybind11/PybindPropertyType.h +++ b/smtk/resource/pybind11/PybindPropertyType.h @@ -17,7 +17,7 @@ namespace py = pybind11; -void pybind11_init_smtk_resource_PropertyType(py::module &m) +inline void pybind11_init_smtk_resource_PropertyType(py::module &m) { py::enum_(m, "PropertyType") .value("FLOAT_PROPERTY", smtk::resource::PropertyType::FLOAT_PROPERTY) diff --git a/smtk/resource/pybind11/PybindResource.h b/smtk/resource/pybind11/PybindResource.h index 9bda831ddf..ed7d95fdb3 100644 --- a/smtk/resource/pybind11/PybindResource.h +++ b/smtk/resource/pybind11/PybindResource.h @@ -20,7 +20,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::resource::Resource, smtk::resource::PyResource, smtk::resource::PersistentObject > pybind11_init_smtk_resource_Resource(py::module &m) +inline PySharedPtrClass< smtk::resource::Resource, smtk::resource::PyResource, smtk::resource::PersistentObject > pybind11_init_smtk_resource_Resource(py::module &m) { PySharedPtrClass< smtk::resource::Resource, smtk::resource::PyResource, smtk::resource::PersistentObject > instance(m, "Resource"); instance diff --git a/smtk/session/mesh/pybind11/PybindCreateUniformGrid.h b/smtk/session/mesh/pybind11/PybindCreateUniformGrid.h index a4e451fdac..8d307ef0ee 100644 --- a/smtk/session/mesh/pybind11/PybindCreateUniformGrid.h +++ b/smtk/session/mesh/pybind11/PybindCreateUniformGrid.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::mesh::CreateUniformGrid, smtk::operation::XMLOperation > pybind11_init_smtk_session_mesh_CreateUniformGrid(py::module &m) +inline PySharedPtrClass< smtk::session::mesh::CreateUniformGrid, smtk::operation::XMLOperation > pybind11_init_smtk_session_mesh_CreateUniformGrid(py::module &m) { PySharedPtrClass< smtk::session::mesh::CreateUniformGrid, smtk::operation::XMLOperation > instance(m, "CreateUniformGrid"); instance diff --git a/smtk/session/mesh/pybind11/PybindEulerCharacteristicRatio.h b/smtk/session/mesh/pybind11/PybindEulerCharacteristicRatio.h index 6090fb4478..f138013f3a 100644 --- a/smtk/session/mesh/pybind11/PybindEulerCharacteristicRatio.h +++ b/smtk/session/mesh/pybind11/PybindEulerCharacteristicRatio.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::mesh::EulerCharacteristicRatio, smtk::operation::XMLOperation > pybind11_init_smtk_session_mesh_EulerCharacteristicRatio(py::module &m) +inline PySharedPtrClass< smtk::session::mesh::EulerCharacteristicRatio, smtk::operation::XMLOperation > pybind11_init_smtk_session_mesh_EulerCharacteristicRatio(py::module &m) { PySharedPtrClass< smtk::session::mesh::EulerCharacteristicRatio, smtk::operation::XMLOperation > instance(m, "EulerCharacteristicRatio"); instance diff --git a/smtk/session/mesh/pybind11/PybindExport.h b/smtk/session/mesh/pybind11/PybindExport.h index 32d51c6bf2..631c8e6aeb 100644 --- a/smtk/session/mesh/pybind11/PybindExport.h +++ b/smtk/session/mesh/pybind11/PybindExport.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::mesh::Export, smtk::operation::XMLOperation > pybind11_init_smtk_session_mesh_Export(py::module &m) +inline PySharedPtrClass< smtk::session::mesh::Export, smtk::operation::XMLOperation > pybind11_init_smtk_session_mesh_Export(py::module &m) { PySharedPtrClass< smtk::session::mesh::Export, smtk::operation::XMLOperation > instance(m, "Export"); instance diff --git a/smtk/session/mesh/pybind11/PybindImport.h b/smtk/session/mesh/pybind11/PybindImport.h index 9a80edbe98..8c48f8bfaf 100644 --- a/smtk/session/mesh/pybind11/PybindImport.h +++ b/smtk/session/mesh/pybind11/PybindImport.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::mesh::Import, smtk::operation::XMLOperation > pybind11_init_smtk_session_mesh_Import(py::module &m) +inline PySharedPtrClass< smtk::session::mesh::Import, smtk::operation::XMLOperation > pybind11_init_smtk_session_mesh_Import(py::module &m) { PySharedPtrClass< smtk::session::mesh::Import, smtk::operation::XMLOperation > instance(m, "Import"); instance diff --git a/smtk/session/mesh/pybind11/PybindRead.h b/smtk/session/mesh/pybind11/PybindRead.h index 2179e7763d..8c96454785 100644 --- a/smtk/session/mesh/pybind11/PybindRead.h +++ b/smtk/session/mesh/pybind11/PybindRead.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::mesh::Read, smtk::operation::XMLOperation > pybind11_init_smtk_session_mesh_Read(py::module &m) +inline PySharedPtrClass< smtk::session::mesh::Read, smtk::operation::XMLOperation > pybind11_init_smtk_session_mesh_Read(py::module &m) { PySharedPtrClass< smtk::session::mesh::Read, smtk::operation::XMLOperation > instance(m, "Read"); instance diff --git a/smtk/session/mesh/pybind11/PybindRegistrar.h b/smtk/session/mesh/pybind11/PybindRegistrar.h index 6fbdc73b78..67b7d76ad4 100644 --- a/smtk/session/mesh/pybind11/PybindRegistrar.h +++ b/smtk/session/mesh/pybind11/PybindRegistrar.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::session::mesh::Registrar > pybind11_init_smtk_session_mesh_Registrar(py::module &m) +inline py::class_< smtk::session::mesh::Registrar > pybind11_init_smtk_session_mesh_Registrar(py::module &m) { py::class_< smtk::session::mesh::Registrar > instance(m, "Registrar"); instance diff --git a/smtk/session/mesh/pybind11/PybindResource.h b/smtk/session/mesh/pybind11/PybindResource.h index eb6675c8f7..054d4e6fd9 100644 --- a/smtk/session/mesh/pybind11/PybindResource.h +++ b/smtk/session/mesh/pybind11/PybindResource.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::mesh::Resource> pybind11_init_smtk_session_mesh_Resource(py::module &m) +inline PySharedPtrClass< smtk::session::mesh::Resource> pybind11_init_smtk_session_mesh_Resource(py::module &m) { PySharedPtrClass< smtk::session::mesh::Resource, smtk::model::Resource > instance(m, "Resource"); instance diff --git a/smtk/session/mesh/pybind11/PybindSession.h b/smtk/session/mesh/pybind11/PybindSession.h index f227500340..be97602615 100644 --- a/smtk/session/mesh/pybind11/PybindSession.h +++ b/smtk/session/mesh/pybind11/PybindSession.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::mesh::Session, smtk::model::Session > pybind11_init_smtk_session_mesh_Session(py::module &m) +inline PySharedPtrClass< smtk::session::mesh::Session, smtk::model::Session > pybind11_init_smtk_session_mesh_Session(py::module &m) { PySharedPtrClass< smtk::session::mesh::Session, smtk::model::Session > instance(m, "Session"); instance diff --git a/smtk/session/mesh/pybind11/PybindTopology.h b/smtk/session/mesh/pybind11/PybindTopology.h index 4c8b5093d5..21c6f32aa3 100644 --- a/smtk/session/mesh/pybind11/PybindTopology.h +++ b/smtk/session/mesh/pybind11/PybindTopology.h @@ -18,7 +18,7 @@ namespace py = pybind11; -py::class_< smtk::session::mesh::Topology > pybind11_init_smtk_session_mesh_Topology(py::module &m) +inline py::class_< smtk::session::mesh::Topology > pybind11_init_smtk_session_mesh_Topology(py::module &m) { py::class_< smtk::session::mesh::Topology > instance(m, "Topology"); instance diff --git a/smtk/session/mesh/pybind11/PybindWrite.h b/smtk/session/mesh/pybind11/PybindWrite.h index c1d9c2e777..2ef73cddc7 100644 --- a/smtk/session/mesh/pybind11/PybindWrite.h +++ b/smtk/session/mesh/pybind11/PybindWrite.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::mesh::Write, smtk::operation::XMLOperation > pybind11_init_smtk_session_mesh_Write(py::module &m) +inline PySharedPtrClass< smtk::session::mesh::Write, smtk::operation::XMLOperation > pybind11_init_smtk_session_mesh_Write(py::module &m) { PySharedPtrClass< smtk::session::mesh::Write, smtk::operation::XMLOperation > instance(m, "Write"); instance diff --git a/smtk/session/polygon/pybind11/PybindCreateEdge.h b/smtk/session/polygon/pybind11/PybindCreateEdge.h index 5183408ad4..4e727a8051 100644 --- a/smtk/session/polygon/pybind11/PybindCreateEdge.h +++ b/smtk/session/polygon/pybind11/PybindCreateEdge.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::CreateEdge > pybind11_init_smtk_session_polygon_CreateEdge(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::CreateEdge > pybind11_init_smtk_session_polygon_CreateEdge(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::CreateEdge > instance(m, "CreateEdge", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindCreateEdgeFromPoints.h b/smtk/session/polygon/pybind11/PybindCreateEdgeFromPoints.h index 4168f8609f..1935aeaceb 100644 --- a/smtk/session/polygon/pybind11/PybindCreateEdgeFromPoints.h +++ b/smtk/session/polygon/pybind11/PybindCreateEdgeFromPoints.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::CreateEdgeFromPoints > pybind11_init_smtk_session_polygon_CreateEdgeFromPoints(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::CreateEdgeFromPoints > pybind11_init_smtk_session_polygon_CreateEdgeFromPoints(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::CreateEdgeFromPoints > instance(m, "CreateEdgeFromPoints", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindCreateEdgeFromVertices.h b/smtk/session/polygon/pybind11/PybindCreateEdgeFromVertices.h index 50b4826016..5f293fe1ff 100644 --- a/smtk/session/polygon/pybind11/PybindCreateEdgeFromVertices.h +++ b/smtk/session/polygon/pybind11/PybindCreateEdgeFromVertices.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::CreateEdgeFromVertices > pybind11_init_smtk_session_polygon_CreateEdgeFromVertices(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::CreateEdgeFromVertices > pybind11_init_smtk_session_polygon_CreateEdgeFromVertices(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::CreateEdgeFromVertices > instance(m, "CreateEdgeFromVertices", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindCreateFaces.h b/smtk/session/polygon/pybind11/PybindCreateFaces.h index 49fbb5b353..0232a87849 100644 --- a/smtk/session/polygon/pybind11/PybindCreateFaces.h +++ b/smtk/session/polygon/pybind11/PybindCreateFaces.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::session::polygon::ModelEdgeInfo > pybind11_init_smtk_session_polygon_ModelEdgeInfo(py::module &m) +inline py::class_< smtk::session::polygon::ModelEdgeInfo > pybind11_init_smtk_session_polygon_ModelEdgeInfo(py::module &m) { py::class_< smtk::session::polygon::ModelEdgeInfo > instance(m, "ModelEdgeInfo"); instance @@ -30,7 +30,7 @@ py::class_< smtk::session::polygon::ModelEdgeInfo > pybind11_init_smtk_session_p return instance; } -PySharedPtrClass< smtk::session::polygon::CreateFaces > pybind11_init_smtk_session_polygon_CreateFaces(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::CreateFaces > pybind11_init_smtk_session_polygon_CreateFaces(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::CreateFaces > instance(m, "CreateFaces", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindCreateModel.h b/smtk/session/polygon/pybind11/PybindCreateModel.h index ae1dbfc3e9..c13f00b325 100644 --- a/smtk/session/polygon/pybind11/PybindCreateModel.h +++ b/smtk/session/polygon/pybind11/PybindCreateModel.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::CreateModel > pybind11_init_smtk_session_polygon_CreateModel(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::CreateModel > pybind11_init_smtk_session_polygon_CreateModel(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::CreateModel > instance(m, "CreateModel", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindCreateVertices.h b/smtk/session/polygon/pybind11/PybindCreateVertices.h index 69ae715236..fe29abbe64 100644 --- a/smtk/session/polygon/pybind11/PybindCreateVertices.h +++ b/smtk/session/polygon/pybind11/PybindCreateVertices.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::CreateVertices> pybind11_init_smtk_session_polygon_CreateVertices(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::CreateVertices> pybind11_init_smtk_session_polygon_CreateVertices(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::CreateVertices > instance(m, "CreateVertices", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindDelete.h b/smtk/session/polygon/pybind11/PybindDelete.h index f4e24fbd79..68c61196d2 100644 --- a/smtk/session/polygon/pybind11/PybindDelete.h +++ b/smtk/session/polygon/pybind11/PybindDelete.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::Delete> pybind11_init_smtk_session_polygon_Delete(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::Delete> pybind11_init_smtk_session_polygon_Delete(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::Delete > instance(m, "Delete", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindDemoteVertex.h b/smtk/session/polygon/pybind11/PybindDemoteVertex.h index 52ab794eb8..820101da1e 100644 --- a/smtk/session/polygon/pybind11/PybindDemoteVertex.h +++ b/smtk/session/polygon/pybind11/PybindDemoteVertex.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::DemoteVertex > pybind11_init_smtk_session_polygon_DemoteVertex(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::DemoteVertex > pybind11_init_smtk_session_polygon_DemoteVertex(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::DemoteVertex > instance(m, "DemoteVertex", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindExtractContours.h b/smtk/session/polygon/pybind11/PybindExtractContours.h index 148d75d145..eec43fff9e 100644 --- a/smtk/session/polygon/pybind11/PybindExtractContours.h +++ b/smtk/session/polygon/pybind11/PybindExtractContours.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::ExtractContours > pybind11_init_smtk_session_polygon_ExtractContours(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::ExtractContours > pybind11_init_smtk_session_polygon_ExtractContours(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::ExtractContours > instance(m, "ExtractContours", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindForceCreateFace.h b/smtk/session/polygon/pybind11/PybindForceCreateFace.h index c54bd0eb57..b380c71098 100644 --- a/smtk/session/polygon/pybind11/PybindForceCreateFace.h +++ b/smtk/session/polygon/pybind11/PybindForceCreateFace.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::ForceCreateFace > pybind11_init_smtk_session_polygon_ForceCreateFace(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::ForceCreateFace > pybind11_init_smtk_session_polygon_ForceCreateFace(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::ForceCreateFace > instance(m, "ForceCreateFace", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindImport.h b/smtk/session/polygon/pybind11/PybindImport.h index 9803d63a92..2b943c00d4 100644 --- a/smtk/session/polygon/pybind11/PybindImport.h +++ b/smtk/session/polygon/pybind11/PybindImport.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::Import > pybind11_init_smtk_session_polygon_Import(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::Import > pybind11_init_smtk_session_polygon_Import(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::Import > instance(m, "Import", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindLegacyRead.h b/smtk/session/polygon/pybind11/PybindLegacyRead.h index 7276462981..9850b93a68 100644 --- a/smtk/session/polygon/pybind11/PybindLegacyRead.h +++ b/smtk/session/polygon/pybind11/PybindLegacyRead.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::LegacyRead > pybind11_init_smtk_session_polygon_LegacyRead(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::LegacyRead > pybind11_init_smtk_session_polygon_LegacyRead(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::LegacyRead > instance(m, "LegacyRead", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindOperation.h b/smtk/session/polygon/pybind11/PybindOperation.h index c1979db30a..a5063a4587 100644 --- a/smtk/session/polygon/pybind11/PybindOperation.h +++ b/smtk/session/polygon/pybind11/PybindOperation.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation > pybind11_init_smtk_session_polygon_Operation(py::module &m) +inline PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation > pybind11_init_smtk_session_polygon_Operation(py::module &m) { PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation > instance(m, "Operation"); instance diff --git a/smtk/session/polygon/pybind11/PybindRead.h b/smtk/session/polygon/pybind11/PybindRead.h index 6856714a76..2d246b7838 100644 --- a/smtk/session/polygon/pybind11/PybindRead.h +++ b/smtk/session/polygon/pybind11/PybindRead.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::Read > pybind11_init_smtk_session_polygon_Read(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::Read > pybind11_init_smtk_session_polygon_Read(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::Read > instance(m, "Read", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindRegistrar.h b/smtk/session/polygon/pybind11/PybindRegistrar.h index 258c2d53be..c62a3af435 100644 --- a/smtk/session/polygon/pybind11/PybindRegistrar.h +++ b/smtk/session/polygon/pybind11/PybindRegistrar.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::session::polygon::Registrar > pybind11_init_smtk_session_polygon_Registrar(py::module &m) +inline py::class_< smtk::session::polygon::Registrar > pybind11_init_smtk_session_polygon_Registrar(py::module &m) { py::class_< smtk::session::polygon::Registrar > instance(m, "Registrar"); instance diff --git a/smtk/session/polygon/pybind11/PybindSession.h b/smtk/session/polygon/pybind11/PybindSession.h index 52b8f2df56..fa3c8196a7 100644 --- a/smtk/session/polygon/pybind11/PybindSession.h +++ b/smtk/session/polygon/pybind11/PybindSession.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::Session, smtk::model::Session > pybind11_init_smtk_session_polygon_Session(py::module &m) +inline PySharedPtrClass< smtk::session::polygon::Session, smtk::model::Session > pybind11_init_smtk_session_polygon_Session(py::module &m) { PySharedPtrClass< smtk::session::polygon::Session, smtk::model::Session > instance(m, "Session"); instance diff --git a/smtk/session/polygon/pybind11/PybindSessionIOJSON.h b/smtk/session/polygon/pybind11/PybindSessionIOJSON.h index 4b2c0180d5..57a0307474 100644 --- a/smtk/session/polygon/pybind11/PybindSessionIOJSON.h +++ b/smtk/session/polygon/pybind11/PybindSessionIOJSON.h @@ -19,7 +19,7 @@ namespace py = pybind11; -py::class_< smtk::session::polygon::SessionIOJSON, smtk::model::SessionIOJSON > pybind11_init_smtk_session_polygon_SessionIOJSON(py::module &m) +inline py::class_< smtk::session::polygon::SessionIOJSON, smtk::model::SessionIOJSON > pybind11_init_smtk_session_polygon_SessionIOJSON(py::module &m) { py::class_< smtk::session::polygon::SessionIOJSON, smtk::model::SessionIOJSON > instance(m, "SessionIOJSON"); instance diff --git a/smtk/session/polygon/pybind11/PybindSplitEdge.h b/smtk/session/polygon/pybind11/PybindSplitEdge.h index 0a52dc9a45..1e6527c1ba 100644 --- a/smtk/session/polygon/pybind11/PybindSplitEdge.h +++ b/smtk/session/polygon/pybind11/PybindSplitEdge.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::SplitEdge > pybind11_init_smtk_session_polygon_SplitEdge(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::SplitEdge > pybind11_init_smtk_session_polygon_SplitEdge(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::SplitEdge > instance(m, "SplitEdge", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindTweakEdge.h b/smtk/session/polygon/pybind11/PybindTweakEdge.h index c1dec63147..ec1467160f 100644 --- a/smtk/session/polygon/pybind11/PybindTweakEdge.h +++ b/smtk/session/polygon/pybind11/PybindTweakEdge.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::TweakEdge > pybind11_init_smtk_session_polygon_TweakEdge(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::TweakEdge > pybind11_init_smtk_session_polygon_TweakEdge(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::TweakEdge > instance(m, "TweakEdge", parent); instance diff --git a/smtk/session/polygon/pybind11/PybindWrite.h b/smtk/session/polygon/pybind11/PybindWrite.h index 563487f52e..4710e771d3 100644 --- a/smtk/session/polygon/pybind11/PybindWrite.h +++ b/smtk/session/polygon/pybind11/PybindWrite.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::Write > pybind11_init_smtk_session_polygon_Write(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::Write > pybind11_init_smtk_session_polygon_Write(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::Write > instance(m, "Write", parent); instance diff --git a/smtk/session/vtk/pybind11/PybindExport.h b/smtk/session/vtk/pybind11/PybindExport.h index ded4f702fd..4237b9400e 100644 --- a/smtk/session/vtk/pybind11/PybindExport.h +++ b/smtk/session/vtk/pybind11/PybindExport.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::vtk::Export > pybind11_init_smtk_session_vtk_Export(py::module &m, PySharedPtrClass< smtk::session::vtk::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::vtk::Export > pybind11_init_smtk_session_vtk_Export(py::module &m, PySharedPtrClass< smtk::session::vtk::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::vtk::Export > instance(m, "Export", parent); instance diff --git a/smtk/session/vtk/pybind11/PybindImport.h b/smtk/session/vtk/pybind11/PybindImport.h index c650b188ad..f63fa6a205 100644 --- a/smtk/session/vtk/pybind11/PybindImport.h +++ b/smtk/session/vtk/pybind11/PybindImport.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::vtk::Import > pybind11_init_smtk_session_vtk_Import(py::module &m, PySharedPtrClass< smtk::session::vtk::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::vtk::Import > pybind11_init_smtk_session_vtk_Import(py::module &m, PySharedPtrClass< smtk::session::vtk::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::vtk::Import > instance(m, "Import", parent); instance diff --git a/smtk/session/vtk/pybind11/PybindLegacyRead.h b/smtk/session/vtk/pybind11/PybindLegacyRead.h index 075cabdaf2..4e4b24dbb3 100644 --- a/smtk/session/vtk/pybind11/PybindLegacyRead.h +++ b/smtk/session/vtk/pybind11/PybindLegacyRead.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::vtk::LegacyRead > pybind11_init_smtk_session_vtk_LegacyRead(py::module &m, PySharedPtrClass< smtk::session::vtk::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::vtk::LegacyRead > pybind11_init_smtk_session_vtk_LegacyRead(py::module &m, PySharedPtrClass< smtk::session::vtk::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::vtk::LegacyRead > instance(m, "LegacyRead", parent); instance diff --git a/smtk/session/vtk/pybind11/PybindOperation.h b/smtk/session/vtk/pybind11/PybindOperation.h index 823c550314..239ebda656 100644 --- a/smtk/session/vtk/pybind11/PybindOperation.h +++ b/smtk/session/vtk/pybind11/PybindOperation.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::vtk::Operation, smtk::operation::XMLOperation > pybind11_init_smtk_session_vtk_Operation(py::module &m) +inline PySharedPtrClass< smtk::session::vtk::Operation, smtk::operation::XMLOperation > pybind11_init_smtk_session_vtk_Operation(py::module &m) { PySharedPtrClass< smtk::session::vtk::Operation, smtk::operation::XMLOperation > instance(m, "Operation"); instance diff --git a/smtk/session/vtk/pybind11/PybindRead.h b/smtk/session/vtk/pybind11/PybindRead.h index 59d9b07cc2..6e99ecdabc 100644 --- a/smtk/session/vtk/pybind11/PybindRead.h +++ b/smtk/session/vtk/pybind11/PybindRead.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::vtk::Read > pybind11_init_smtk_session_vtk_Read(py::module &m, PySharedPtrClass< smtk::session::vtk::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::vtk::Read > pybind11_init_smtk_session_vtk_Read(py::module &m, PySharedPtrClass< smtk::session::vtk::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::vtk::Read > instance(m, "Read", parent); instance diff --git a/smtk/session/vtk/pybind11/PybindRegistrar.h b/smtk/session/vtk/pybind11/PybindRegistrar.h index 779739de99..952a2f49f4 100644 --- a/smtk/session/vtk/pybind11/PybindRegistrar.h +++ b/smtk/session/vtk/pybind11/PybindRegistrar.h @@ -17,7 +17,7 @@ namespace py = pybind11; -py::class_< smtk::session::vtk::Registrar > pybind11_init_smtk_session_vtk_Registrar(py::module &m) +inline py::class_< smtk::session::vtk::Registrar > pybind11_init_smtk_session_vtk_Registrar(py::module &m) { py::class_< smtk::session::vtk::Registrar > instance(m, "Registrar"); instance diff --git a/smtk/session/vtk/pybind11/PybindResource.h b/smtk/session/vtk/pybind11/PybindResource.h index 08bd4d7f66..a82123c689 100644 --- a/smtk/session/vtk/pybind11/PybindResource.h +++ b/smtk/session/vtk/pybind11/PybindResource.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::vtk::Resource> pybind11_init_smtk_session_vtk_Resource(py::module &m) +inline PySharedPtrClass< smtk::session::vtk::Resource> pybind11_init_smtk_session_vtk_Resource(py::module &m) { PySharedPtrClass< smtk::session::vtk::Resource, smtk::model::Resource > instance(m, "Resource"); instance diff --git a/smtk/session/vtk/pybind11/PybindSession.h b/smtk/session/vtk/pybind11/PybindSession.h index 78dc3c19b4..4ce098abfd 100644 --- a/smtk/session/vtk/pybind11/PybindSession.h +++ b/smtk/session/vtk/pybind11/PybindSession.h @@ -32,7 +32,7 @@ namespace py = pybind11; -void pybind11_init_smtk_session_vtk_EntityType(py::module &m) +inline void pybind11_init_smtk_session_vtk_EntityType(py::module &m) { py::enum_(m, "EntityType") .value("EXO_MODEL", smtk::session::vtk::EntityType::EXO_MODEL) @@ -48,7 +48,7 @@ void pybind11_init_smtk_session_vtk_EntityType(py::module &m) .export_values(); } -py::class_< smtk::session::vtk::EntityHandle > pybind11_init_smtk_session_vtk_EntityHandle(py::module &m) +inline py::class_< smtk::session::vtk::EntityHandle > pybind11_init_smtk_session_vtk_EntityHandle(py::module &m) { py::class_< smtk::session::vtk::EntityHandle > instance(m, "EntityHandle"); instance @@ -71,7 +71,7 @@ py::class_< smtk::session::vtk::EntityHandle > pybind11_init_smtk_session_vtk_En return instance; } -PySharedPtrClass< smtk::session::vtk::Session, smtk::model::Session > pybind11_init_smtk_session_vtk_Session(py::module &m) +inline PySharedPtrClass< smtk::session::vtk::Session, smtk::model::Session > pybind11_init_smtk_session_vtk_Session(py::module &m) { PySharedPtrClass< smtk::session::vtk::Session, smtk::model::Session > instance(m, "Session"); instance @@ -98,7 +98,7 @@ PySharedPtrClass< smtk::session::vtk::Session, smtk::model::Session > pybind11_i return instance; } -void pybind11_init_smtk_session_vtk_EntityTypeNameString(py::module &m) +inline void pybind11_init_smtk_session_vtk_EntityTypeNameString(py::module &m) { m.def("EntityTypeNameString", &smtk::session::vtk::EntityTypeNameString, "", py::arg("etype")); } diff --git a/smtk/session/vtk/pybind11/PybindWrite.h b/smtk/session/vtk/pybind11/PybindWrite.h index cc00407ede..434fe17a22 100644 --- a/smtk/session/vtk/pybind11/PybindWrite.h +++ b/smtk/session/vtk/pybind11/PybindWrite.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::vtk::Write > pybind11_init_smtk_session_vtk_Write(py::module &m, PySharedPtrClass< smtk::session::vtk::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::vtk::Write > pybind11_init_smtk_session_vtk_Write(py::module &m, PySharedPtrClass< smtk::session::vtk::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::vtk::Write > instance(m, "Write", parent); instance diff --git a/smtk/simulation/pybind11/PybindExportSpec.h b/smtk/simulation/pybind11/PybindExportSpec.h index 18701b6482..64efaf04d0 100644 --- a/smtk/simulation/pybind11/PybindExportSpec.h +++ b/smtk/simulation/pybind11/PybindExportSpec.h @@ -24,7 +24,7 @@ namespace py = pybind11; -py::class_< smtk::simulation::ExportSpec > pybind11_init_smtk_simulation_ExportSpec(py::module &m) +inline py::class_< smtk::simulation::ExportSpec > pybind11_init_smtk_simulation_ExportSpec(py::module &m) { py::class_< smtk::simulation::ExportSpec > instance(m, "ExportSpec"); instance diff --git a/smtk/simulation/pybind11/PybindUserData.h b/smtk/simulation/pybind11/PybindUserData.h index 6a1d532cb8..c8d30cc99b 100644 --- a/smtk/simulation/pybind11/PybindUserData.h +++ b/smtk/simulation/pybind11/PybindUserData.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::simulation::UserData > pybind11_init_smtk_simulation_UserData(py::module &m) +inline PySharedPtrClass< smtk::simulation::UserData > pybind11_init_smtk_simulation_UserData(py::module &m) { PySharedPtrClass< smtk::simulation::UserData > instance(m, "UserData"); instance @@ -28,7 +28,7 @@ PySharedPtrClass< smtk::simulation::UserData > pybind11_init_smtk_simulation_Use return instance; } -PySharedPtrClass< smtk::simulation::UserDataInt, smtk::simulation::UserData > pybind11_init_smtk_simulation_UserDataInt(py::module &m) +inline PySharedPtrClass< smtk::simulation::UserDataInt, smtk::simulation::UserData > pybind11_init_smtk_simulation_UserDataInt(py::module &m) { PySharedPtrClass< smtk::simulation::UserDataInt, smtk::simulation::UserData > instance(m, "UserDataInt"); instance @@ -41,7 +41,7 @@ PySharedPtrClass< smtk::simulation::UserDataInt, smtk::simulation::UserData > py return instance; } -PySharedPtrClass< smtk::simulation::UserDataDouble, smtk::simulation::UserData > pybind11_init_smtk_simulation_UserDataDouble(py::module &m) +inline PySharedPtrClass< smtk::simulation::UserDataDouble, smtk::simulation::UserData > pybind11_init_smtk_simulation_UserDataDouble(py::module &m) { PySharedPtrClass< smtk::simulation::UserDataDouble, smtk::simulation::UserData > instance(m, "UserDataDouble"); instance @@ -54,7 +54,7 @@ PySharedPtrClass< smtk::simulation::UserDataDouble, smtk::simulation::UserData > return instance; } -PySharedPtrClass< smtk::simulation::UserDataString, smtk::simulation::UserData > pybind11_init_smtk_simulation_UserDataString(py::module &m) +inline PySharedPtrClass< smtk::simulation::UserDataString, smtk::simulation::UserData > pybind11_init_smtk_simulation_UserDataString(py::module &m) { PySharedPtrClass< smtk::simulation::UserDataString, smtk::simulation::UserData > instance(m, "UserDataString"); instance diff --git a/smtk/view/DefaultOperationIcon.h b/smtk/view/DefaultOperationIcon.h index f40e746ee3..152eb41315 100644 --- a/smtk/view/DefaultOperationIcon.h +++ b/smtk/view/DefaultOperationIcon.h @@ -23,7 +23,7 @@ namespace smtk namespace view { -std::string SMTKCORE_EXPORT DefaultOperationIcon(const std::string& secondaryColor) +inline std::string SMTKCORE_EXPORT DefaultOperationIcon(const std::string& secondaryColor) { std::string svg = default_operation_opt_svg; std::array rgba; diff --git a/smtk/view/pybind11/PybindDescriptivePhrase.h b/smtk/view/pybind11/PybindDescriptivePhrase.h index 53e91ada89..6b66a473b3 100644 --- a/smtk/view/pybind11/PybindDescriptivePhrase.h +++ b/smtk/view/pybind11/PybindDescriptivePhrase.h @@ -24,7 +24,7 @@ namespace py = pybind11; -void pybind11_init_smtk_view_DescriptivePhraseType(py::module &m) +inline void pybind11_init_smtk_view_DescriptivePhraseType(py::module &m) { py::enum_(m, "DescriptivePhraseType") .value("RESOURCE_LIST", smtk::view::DescriptivePhraseType::RESOURCE_LIST) @@ -39,7 +39,7 @@ void pybind11_init_smtk_view_DescriptivePhraseType(py::module &m) .export_values(); } -PySharedPtrClass< smtk::view::DescriptivePhrase > pybind11_init_smtk_view_DescriptivePhrase(py::module &m) +inline PySharedPtrClass< smtk::view::DescriptivePhrase > pybind11_init_smtk_view_DescriptivePhrase(py::module &m) { PySharedPtrClass< smtk::view::DescriptivePhrase > instance(m, "DescriptivePhrase"); instance diff --git a/smtk/view/pybind11/PybindSelection.h b/smtk/view/pybind11/PybindSelection.h index 3fd650abdd..4a1acf7c80 100644 --- a/smtk/view/pybind11/PybindSelection.h +++ b/smtk/view/pybind11/PybindSelection.h @@ -27,7 +27,7 @@ SMTK_THIRDPARTY_POST_INCLUDE namespace py = pybind11; -void pybind11_init_smtk_view_SelectionAction(py::module &m) +inline void pybind11_init_smtk_view_SelectionAction(py::module &m) { py::enum_(m, "SelectionAction") .value("FILTERED_REPLACE", smtk::view::SelectionAction::FILTERED_REPLACE) @@ -40,7 +40,7 @@ void pybind11_init_smtk_view_SelectionAction(py::module &m) .export_values(); } -PySharedPtrClass< smtk::view::Selection > pybind11_init_smtk_view_Selection(py::module &m) +inline PySharedPtrClass< smtk::view::Selection > pybind11_init_smtk_view_Selection(py::module &m) { PySharedPtrClass< smtk::view::Selection > instance(m, "Selection"); instance diff --git a/smtk/view/pybind11/PybindSelectionObserver.h b/smtk/view/pybind11/PybindSelectionObserver.h index 7c02995640..4b76ff59e7 100644 --- a/smtk/view/pybind11/PybindSelectionObserver.h +++ b/smtk/view/pybind11/PybindSelectionObserver.h @@ -19,7 +19,7 @@ namespace py = pybind11; -py::class_< smtk::view::SelectionObservers > pybind11_init_smtk_view_SelectionObservers(py::module &m) +inline py::class_< smtk::view::SelectionObservers > pybind11_init_smtk_view_SelectionObservers(py::module &m) { py::class_< smtk::view::SelectionObservers > instance(m, "SelectionObservers"); instance diff --git a/smtk/view/pybind11/PybindSubphraseGenerator.h b/smtk/view/pybind11/PybindSubphraseGenerator.h index f829571582..fa10c2539f 100644 --- a/smtk/view/pybind11/PybindSubphraseGenerator.h +++ b/smtk/view/pybind11/PybindSubphraseGenerator.h @@ -19,7 +19,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::view::SubphraseGenerator > pybind11_init_smtk_view_SubphraseGenerator(py::module &m) +inline PySharedPtrClass< smtk::view::SubphraseGenerator > pybind11_init_smtk_view_SubphraseGenerator(py::module &m) { PySharedPtrClass< smtk::view::SubphraseGenerator > instance(m, "SubphraseGenerator"); instance diff --git a/smtk/view/pybind11/PybindView.h b/smtk/view/pybind11/PybindView.h index 9d8d456e25..6b7ab29323 100644 --- a/smtk/view/pybind11/PybindView.h +++ b/smtk/view/pybind11/PybindView.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::view::Configuration > pybind11_init_smtk_view_View(py::module &m) +inline PySharedPtrClass< smtk::view::Configuration > pybind11_init_smtk_view_View(py::module &m) { PySharedPtrClass< smtk::view::Configuration > instance(m, "View"); instance -- GitLab From c1d097ce9226ce528385fae9debf3ebae83f84c9 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 19 May 2021 09:13:32 -0400 Subject: [PATCH 003/136] clang-tidy: fix `performance-no-automatic-move` lints --- smtk/model/pybind11/PybindSession.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smtk/model/pybind11/PybindSession.h b/smtk/model/pybind11/PybindSession.h index dcafa6d34b..50a9172bce 100644 --- a/smtk/model/pybind11/PybindSession.h +++ b/smtk/model/pybind11/PybindSession.h @@ -65,7 +65,7 @@ inline PySharedPtrClass< smtk::model::Session > pybind11_init_smtk_model_Session .def("removeGeneratedProperties", &smtk::model::Session::removeGeneratedProperties, py::arg("entity"), py::arg("propFlags")) .def("splitProperties", &smtk::model::Session::splitProperties, py::arg("from"), py::arg("to")) .def("mergeProperties", &smtk::model::Session::mergeProperties, py::arg("from"), py::arg("to")) - .def_static("CastTo", [](const std::shared_ptr i) { return i; }) + .def_static("CastTo", [](std::shared_ptr i) { return i; }) ; return instance; } -- GitLab From beb69a944793cdb2c7aca7eaf3a0f2dfe7544856 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 17 May 2021 18:15:39 -0400 Subject: [PATCH 004/136] clang-tidy: address `readability-redundant-declaration` lints Why this is a rendundant declaration is unknown. --- smtk/mesh/utility/ExtractMeshConstants.h | 1 + 1 file changed, 1 insertion(+) diff --git a/smtk/mesh/utility/ExtractMeshConstants.h b/smtk/mesh/utility/ExtractMeshConstants.h index 54a77e8a3e..d3ed4e0f42 100644 --- a/smtk/mesh/utility/ExtractMeshConstants.h +++ b/smtk/mesh/utility/ExtractMeshConstants.h @@ -107,6 +107,7 @@ SMTKCORE_EXPORT void extractDomainMeshConstants( PreAllocatedMeshConstants&); template +// NOLINTNEXTLINE(readability-redundant-declaration) SMTKCORE_EXPORT void extractMeshConstants( const smtk::mesh::MeshSet&, const smtk::mesh::PointSet&, -- GitLab From 29b53bdcc554f96fe8efe69c1cfebf30a2be9296 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 18 May 2021 10:45:03 -0400 Subject: [PATCH 005/136] clang-tidy: ignore `readability-redundant-access-specifiers` lints `clang-tidy` doesn't understand signals and slots decorator macros. --- .clang-tidy | 1 + 1 file changed, 1 insertion(+) diff --git a/.clang-tidy b/.clang-tidy index cfd481ce7c..46a1264c86 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -67,6 +67,7 @@ readability-*,\ -readability-make-member-function-const,\ -readability-named-parameter,\ -readability-non-const-parameter,\ +-readability-redundant-access-specifiers,\ -readability-redundant-control-flow,\ -readability-uppercase-literal-suffix,\ " -- GitLab From 51a5b934d38ae955af0180f55ce5225d3c8ad54e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 19 May 2021 14:03:37 -0400 Subject: [PATCH 006/136] clang-tidy: fix `modernize-use-default-member-init` lints --- smtk/attribute/Analyses.h | 9 +++--- smtk/attribute/Categories.h | 10 ++---- smtk/common/Observers.h | 4 +-- smtk/common/PythonInterpreter.cxx | 1 - smtk/common/PythonInterpreter.h | 2 +- smtk/common/ThreadPool.h | 5 ++- smtk/common/TimeZone.cxx | 1 - smtk/common/TimeZone.h | 2 +- .../appcomponents/VisibilityBadge.cxx | 1 - .../paraview/appcomponents/VisibilityBadge.h | 2 +- .../plugin/pqSMTKCloseResourceBehavior.cxx | 1 - .../plugin/pqSMTKCloseResourceBehavior.h | 2 +- .../pqSMTKDisplayAttributeOnLoadBehavior.cxx | 1 - .../pqSMTKDisplayAttributeOnLoadBehavior.h | 2 +- .../plugin/pqSMTKNewResourceBehavior.cxx | 1 - .../plugin/pqSMTKNewResourceBehavior.h | 2 +- .../pqSMTKPipelineSelectionBehavior.cxx | 1 - .../plugin/pqSMTKPipelineSelectionBehavior.h | 2 +- .../appcomponents/pqSMTKAttributePanel.cxx | 1 - .../appcomponents/pqSMTKAttributePanel.h | 2 +- .../appcomponents/pqSMTKOperationPanel.cxx | 3 -- .../appcomponents/pqSMTKOperationPanel.h | 8 +++-- .../appcomponents/pqSMTKResourcePanel.cxx | 2 -- .../appcomponents/pqSMTKResourcePanel.h | 4 +-- .../paraview/server/RespondToVTKSelection.cxx | 7 +--- .../paraview/server/RespondToVTKSelection.h | 10 +++--- .../paraview/server/vtkSMTKResource.cxx | 1 - .../paraview/server/vtkSMTKResource.h | 2 +- .../server/vtkSMTKResourceRepresentation.cxx | 7 +--- .../server/vtkSMTKResourceRepresentation.h | 10 +++--- .../paraview/server/vtkSMTKResourceSource.cxx | 1 - .../paraview/server/vtkSMTKResourceSource.h | 2 +- .../paraview/server/vtkSMTKSettings.cxx | 5 +-- .../paraview/server/vtkSMTKSettings.h | 6 ++-- .../paraview/server/vtkSMTKWrapper.cxx | 7 +--- .../paraview/server/vtkSMTKWrapper.h | 10 +++--- smtk/extension/qt/MembershipBadge.cxx | 7 ++-- smtk/extension/qt/MembershipBadge.h | 8 +++-- smtk/extension/qt/qtAvailableOperations.cxx | 3 -- smtk/extension/qt/qtAvailableOperations.h | 6 ++-- smtk/extension/qt/qtBaseView.h | 3 +- .../qt/qtDescriptivePhraseDelegate.cxx | 8 ----- .../qt/qtDescriptivePhraseDelegate.h | 16 +++++----- smtk/extension/qt/qtLineEdit.cxx | 4 --- smtk/extension/qt/qtLineEdit.h | 4 +-- smtk/extension/qt/qtReferenceItem.cxx | 6 +--- smtk/extension/qt/qtReferenceItemData.h | 10 +++--- smtk/extension/qt/qtResourceBrowserP.cxx | 7 +--- smtk/extension/qt/qtResourceBrowserP.h | 10 +++--- smtk/extension/vtk/source/vtkConeFrustum.cxx | 3 -- smtk/extension/vtk/source/vtkConeFrustum.h | 6 ++-- .../vtk/source/vtkImplicitConeFrustum.cxx | 2 -- .../vtk/source/vtkImplicitConeFrustum.h | 4 +-- .../source/vtkResourceMultiBlockSource.cxx | 1 - .../vtk/source/vtkResourceMultiBlockSource.h | 2 +- .../vtk/widgets/vtkConeRepresentation.cxx | 10 ------ .../vtk/widgets/vtkConeRepresentation.h | 20 ++++++------ .../vtk/widgets/vtkSBFunctionParser.cxx | 6 ---- .../vtk/widgets/vtkSBFunctionParser.h | 12 +++---- smtk/io/AttributeReader.cxx | 1 - smtk/io/AttributeReader.h | 2 +- smtk/io/AttributeWriter.cxx | 11 ------- smtk/io/AttributeWriter.h | 23 ++++++------- smtk/io/Logger.h | 24 ++++---------- smtk/io/ModelToMesh.cxx | 6 +--- smtk/io/ModelToMesh.h | 4 +-- smtk/mesh/core/ForEachTypes.cxx | 4 +-- smtk/mesh/core/ForEachTypes.h | 4 +-- smtk/mesh/core/Interface.h | 32 +++++-------------- smtk/mesh/core/MeshSet.cxx | 5 +-- smtk/mesh/core/MeshSet.h | 2 +- smtk/mesh/core/Resource.cxx | 4 --- smtk/mesh/core/Resource.h | 2 +- smtk/mesh/core/TypeSet.cxx | 6 +--- smtk/mesh/core/TypeSet.h | 4 +-- smtk/mesh/json/Interface.cxx | 2 -- smtk/mesh/json/MeshInfo.cxx | 5 +-- smtk/mesh/moab/Interface.cxx | 1 - smtk/mesh/moab/Interface.h | 2 +- smtk/mesh/moab/RandomPoint.h | 7 ++-- smtk/mesh/operators/DeleteMesh.cxx | 5 +-- smtk/mesh/operators/DeleteMesh.h | 2 +- smtk/mesh/utility/ExtractTessellation.cxx | 6 +--- smtk/mesh/utility/ExtractTessellation.h | 4 +-- smtk/model/Arrangement.h | 10 ++---- smtk/model/Entity.cxx | 4 +-- smtk/model/Entity.h | 4 +-- smtk/model/GridInfo.h | 7 ++-- smtk/model/LimitingClause.h | 7 ++-- smtk/model/Session.cxx | 1 - smtk/model/Session.h | 2 +- smtk/operation/Operation.cxx | 3 +- smtk/operation/Operation.h | 2 +- smtk/project/Project.cxx | 1 - smtk/project/Project.h | 2 +- smtk/project/view/PhraseContent.cxx | 6 +--- smtk/project/view/PhraseContent.h | 4 +-- smtk/resource/Lock.cxx | 7 +--- smtk/resource/Lock.h | 6 ++-- smtk/session/mesh/queries/RandomPoint.h | 7 ++-- smtk/session/polygon/Session.cxx | 5 +-- smtk/session/polygon/Session.h | 2 +- smtk/session/polygon/internal/Entity.h | 7 ++-- smtk/session/polygon/internal/Model.cxx | 1 - smtk/session/polygon/internal/Model.h | 2 +- smtk/session/polygon/internal/Region.cxx | 1 - smtk/session/polygon/internal/Region.h | 2 +- smtk/session/polygon/internal/Vertex.h | 20 +++++------- smtk/session/polygon/operators/CreateFaces.h | 8 ++--- smtk/session/polygon/qt/pqArcWidgetPanel.cxx | 3 -- smtk/session/polygon/qt/pqArcWidgetPanel.h | 14 ++++---- smtk/session/polygon/qt/pqSplitEdgeWidget.cxx | 1 - smtk/session/polygon/qt/pqSplitEdgeWidget.h | 2 +- smtk/session/vtk/Session.cxx | 3 +- smtk/session/vtk/Session.h | 5 +-- smtk/simulation/UserData.cxx | 10 ++---- smtk/simulation/UserData.h | 4 +-- smtk/view/AssociationBadge.cxx | 5 +-- smtk/view/AssociationBadge.h | 2 +- smtk/view/AvailableOperations.cxx | 6 +--- smtk/view/AvailableOperations.h | 6 ++-- smtk/view/Badge.h | 7 ++-- smtk/view/BadgeSet.h | 7 ++-- smtk/view/ComponentPhraseContent.cxx | 5 +-- smtk/view/ComponentPhraseContent.h | 2 +- smtk/view/DescriptivePhrase.cxx | 2 -- smtk/view/DescriptivePhrase.h | 4 +-- smtk/view/ObjectIconBadge.cxx | 5 +-- smtk/view/ObjectIconBadge.h | 2 +- smtk/view/PhraseListContent.cxx | 9 ++---- smtk/view/PhraseListContent.h | 6 ++-- smtk/view/PhraseModel.cxx | 2 -- smtk/view/PhraseModel.h | 3 +- smtk/view/ResourcePhraseContent.cxx | 5 +-- smtk/view/ResourcePhraseContent.h | 2 +- smtk/view/Selection.cxx | 3 +- smtk/view/Selection.h | 2 +- smtk/view/SelectionPhraseModel.cxx | 4 --- smtk/view/SelectionPhraseModel.h | 4 +-- 139 files changed, 237 insertions(+), 482 deletions(-) diff --git a/smtk/attribute/Analyses.h b/smtk/attribute/Analyses.h index 58ef3fa3dc..eb47579b1c 100644 --- a/smtk/attribute/Analyses.h +++ b/smtk/attribute/Analyses.h @@ -114,10 +114,7 @@ public: }; /// \brief Basic constructor - Note that by default top level Analyses are not Exclusive - Analyses() - : m_topLevelExclusive(false) - { - } + Analyses() = default; /// \brief Create a new Analysis and return it. /// Note that the name must be unique with respects to the other Analysis Instances defined within /// this Instance. If the name is not unique no Analysis is created and nullptr is returned. @@ -174,7 +171,9 @@ protected: void getAnalysisItemCategories(ConstItemPtr item, std::set& cats, bool itemNotAnalysis); - bool m_topLevelExclusive; ///< Indicates if the top level Analysis Instances are exclusive + bool m_topLevelExclusive{ + false + }; ///< Indicates if the top level Analysis Instances are exclusive std::vector m_analyses; ///< Analysis Instances managed by the Analyses Instance }; } // namespace attribute diff --git a/smtk/attribute/Categories.h b/smtk/attribute/Categories.h index 7cdcf53eef..5cde221dcc 100644 --- a/smtk/attribute/Categories.h +++ b/smtk/attribute/Categories.h @@ -56,12 +56,7 @@ public: Any = 0, //!< Check passes if any of the set's categories are found All = 1 //!< Check passes if all of the set's categories are found }; - Set() - : m_includeMode(CombinationMode::Any) - , m_excludeMode(CombinationMode::Any) - , m_combinationMode(CombinationMode::All) - { - } + Set() = default; ///@{ ///\brief Set/Get the how the sets of included and excluded categories are combined Set::CombinationMode combinationMode() const { return m_combinationMode; } @@ -178,7 +173,8 @@ public: } private: - Set::CombinationMode m_includeMode, m_excludeMode, m_combinationMode; + Set::CombinationMode m_includeMode{ CombinationMode::Any }, + m_excludeMode{ CombinationMode::Any }, m_combinationMode{ CombinationMode::All }; std::set m_includedCategories, m_excludedCategories; }; Categories() = default; diff --git a/smtk/common/Observers.h b/smtk/common/Observers.h index 00f5b5bb56..a853075c44 100644 --- a/smtk/common/Observers.h +++ b/smtk/common/Observers.h @@ -193,12 +193,10 @@ public: Observers() : m_initializer() - , m_observing(false) { } Observers(Initializer&& initializer) : m_initializer(initializer) - , m_observing(false) { } @@ -428,7 +426,7 @@ private: return m_observers.erase(key); } - bool m_observing; + bool m_observing{ false }; std::set m_toErase; std::mutex m_mutex; diff --git a/smtk/common/PythonInterpreter.cxx b/smtk/common/PythonInterpreter.cxx index d4432a08f6..26eda34384 100644 --- a/smtk/common/PythonInterpreter.cxx +++ b/smtk/common/PythonInterpreter.cxx @@ -75,7 +75,6 @@ PythonInterpreter& PythonInterpreter::instance() } PythonInterpreter::PythonInterpreter() - : m_embedded(false) { this->initialize(); } diff --git a/smtk/common/PythonInterpreter.h b/smtk/common/PythonInterpreter.h index e64fec816e..8badc1cc0b 100644 --- a/smtk/common/PythonInterpreter.h +++ b/smtk/common/PythonInterpreter.h @@ -93,7 +93,7 @@ private: static PythonInterpreter m_instance; - bool m_embedded; + bool m_embedded{ false }; }; } // namespace common } // namespace smtk diff --git a/smtk/common/ThreadPool.h b/smtk/common/ThreadPool.h index 84764c46b6..564aef115a 100644 --- a/smtk/common/ThreadPool.h +++ b/smtk/common/ThreadPool.h @@ -71,15 +71,14 @@ protected: std::mutex m_queueMutex; std::vector m_threads; std::queue> m_queue; - bool m_initialized; + bool m_initialized{ false }; std::atomic m_active; unsigned int m_maxThreads; }; template ThreadPool::ThreadPool(unsigned int maxThreads) - : m_initialized(false) - , m_active(true) + : m_active(true) , m_maxThreads(maxThreads == 0 ? std::thread::hardware_concurrency() : maxThreads) { } diff --git a/smtk/common/TimeZone.cxx b/smtk/common/TimeZone.cxx index 0857a66f3d..848115f0a7 100644 --- a/smtk/common/TimeZone.cxx +++ b/smtk/common/TimeZone.cxx @@ -26,7 +26,6 @@ bool TimeZone::s_databaseLoaded = false; TimeZone::TimeZone() : m_boostTimeZone(nullptr) - , m_isUTC(false) { } diff --git a/smtk/common/TimeZone.h b/smtk/common/TimeZone.h index f26e0fb4f1..6327b0d9a3 100644 --- a/smtk/common/TimeZone.h +++ b/smtk/common/TimeZone.h @@ -61,7 +61,7 @@ public: private: boost::local_time::time_zone_ptr m_boostTimeZone; - bool m_isUTC; + bool m_isUTC{ false }; std::string m_region; // Static timezone database diff --git a/smtk/extension/paraview/appcomponents/VisibilityBadge.cxx b/smtk/extension/paraview/appcomponents/VisibilityBadge.cxx index a09e43f335..c98ee0c5d7 100644 --- a/smtk/extension/paraview/appcomponents/VisibilityBadge.cxx +++ b/smtk/extension/paraview/appcomponents/VisibilityBadge.cxx @@ -213,7 +213,6 @@ int UpdateVisibilityForFootprint( VisibilityBadge::VisibilityBadge() : m_icon(pqEyeball_svg) , m_iconClosed(pqEyeballClosed_svg) - , m_parent(nullptr) { } diff --git a/smtk/extension/paraview/appcomponents/VisibilityBadge.h b/smtk/extension/paraview/appcomponents/VisibilityBadge.h index 6aac752c43..e85a95d436 100644 --- a/smtk/extension/paraview/appcomponents/VisibilityBadge.h +++ b/smtk/extension/paraview/appcomponents/VisibilityBadge.h @@ -87,7 +87,7 @@ private: std::string m_iconClosed; // Selection state of items shown in m_phraseModel: std::map m_visibleThings; - const smtk::view::BadgeSet* m_parent; + const smtk::view::BadgeSet* m_parent{ nullptr }; }; } // namespace appcomponents } // namespace paraview diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.cxx index e3fb5cdd1b..3226351d15 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.cxx @@ -204,7 +204,6 @@ static pqSMTKCloseResourceBehavior* g_instance = nullptr; pqSMTKCloseResourceBehavior::pqSMTKCloseResourceBehavior(QObject* parent) : Superclass(parent) - , m_newMenu(nullptr) { initCloseResourceBehaviorResources(); diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.h b/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.h index 795318bf25..03c2ca515f 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.h +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.h @@ -69,7 +69,7 @@ protected: private: Q_DISABLE_COPY(pqSMTKCloseResourceBehavior); - QMenu* m_newMenu; + QMenu* m_newMenu{ nullptr }; }; #endif // smtk_extension_paraview_appcomponents_pqSMTKCloseResourceBehavior_h diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKDisplayAttributeOnLoadBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKDisplayAttributeOnLoadBehavior.cxx index c78e26f0b9..b97ecc4f1d 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKDisplayAttributeOnLoadBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKDisplayAttributeOnLoadBehavior.cxx @@ -41,7 +41,6 @@ static pqSMTKDisplayAttributeOnLoadBehavior* g_displayOnLoad = nullptr; pqSMTKDisplayAttributeOnLoadBehavior::pqSMTKDisplayAttributeOnLoadBehavior(QObject* parent) : Superclass(parent) - , m_panel(nullptr) { if (!g_displayOnLoad) { diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKDisplayAttributeOnLoadBehavior.h b/smtk/extension/paraview/appcomponents/plugin/pqSMTKDisplayAttributeOnLoadBehavior.h index 43f4079249..2d646b800a 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKDisplayAttributeOnLoadBehavior.h +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKDisplayAttributeOnLoadBehavior.h @@ -52,7 +52,7 @@ protected slots: protected: std::map m_resourceManagerObservers; - pqSMTKAttributePanel* m_panel; + pqSMTKAttributePanel* m_panel{ nullptr }; std::weak_ptr m_attr; private: diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.cxx index ae11b326ea..96e3aad5d0 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.cxx @@ -155,7 +155,6 @@ static pqSMTKNewResourceBehavior* g_instance = nullptr; pqSMTKNewResourceBehavior::pqSMTKNewResourceBehavior(QObject* parent) : Superclass(parent) - , m_newMenu(nullptr) { // Wait until the event loop starts, ensuring that the main window will be // accessible. diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.h b/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.h index 4fbe962a2e..801cbd7d02 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.h +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.h @@ -73,7 +73,7 @@ protected: private: Q_DISABLE_COPY(pqSMTKNewResourceBehavior); - QMenu* m_newMenu; + QMenu* m_newMenu{ nullptr }; smtk::operation::GroupObservers::Key m_key; }; diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKPipelineSelectionBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKPipelineSelectionBehavior.cxx index 8350fe7cdd..5e4b567307 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKPipelineSelectionBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKPipelineSelectionBehavior.cxx @@ -38,7 +38,6 @@ static pqSMTKPipelineSelectionBehavior* g_pipelineSelection = nullptr; pqSMTKPipelineSelectionBehavior::pqSMTKPipelineSelectionBehavior(QObject* parent) : Superclass(parent) - , m_changingSource(false) , m_selectionValue("selected") { if (!g_pipelineSelection) diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKPipelineSelectionBehavior.h b/smtk/extension/paraview/appcomponents/plugin/pqSMTKPipelineSelectionBehavior.h index 1e3776d296..2be029e912 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKPipelineSelectionBehavior.h +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKPipelineSelectionBehavior.h @@ -52,7 +52,7 @@ protected slots: virtual void unobserveSelectionOnServer(vtkSMSMTKWrapperProxy* mgr, pqServer* server); protected: - bool m_changingSource; + bool m_changingSource{ false }; std::string m_selectionValue; std::map m_selectionObservers; diff --git a/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.cxx b/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.cxx index c58d8ddc94..490e2ce365 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.cxx +++ b/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.cxx @@ -44,7 +44,6 @@ pqSMTKAttributePanel::pqSMTKAttributePanel(QWidget* parent) : Superclass(parent) - , m_attrUIMgr(nullptr) { this->setObjectName("attributeEditor"); this->setWindowTitle("Attribute Editor"); diff --git a/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.h b/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.h index f7403886ff..62b5ecd014 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.h +++ b/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.h @@ -96,7 +96,7 @@ protected slots: virtual void updateSettings(); protected: - smtk::extension::qtUIManager* m_attrUIMgr; + smtk::extension::qtUIManager* m_attrUIMgr{ nullptr }; std::weak_ptr m_rsrc; smtk::view::SelectionPtr m_seln; smtk::view::ManagerPtr m_viewManager; diff --git a/smtk/extension/paraview/appcomponents/pqSMTKOperationPanel.cxx b/smtk/extension/paraview/appcomponents/pqSMTKOperationPanel.cxx index 99dfc9f680..08335536fe 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKOperationPanel.cxx +++ b/smtk/extension/paraview/appcomponents/pqSMTKOperationPanel.cxx @@ -96,10 +96,7 @@ public: pqSMTKOperationPanel::pqSMTKOperationPanel(QWidget* parent) : Superclass(parent) - , m_p(nullptr) - , m_wrapper(nullptr) , m_editing(nullptr) - , m_attrUIMgr(nullptr) { // This must come before m_p is created, since the m_p->OperationList widget will reference it: auto opFilterSort = smtk::workflow::OperationFilterSort::create(); diff --git a/smtk/extension/paraview/appcomponents/pqSMTKOperationPanel.h b/smtk/extension/paraview/appcomponents/pqSMTKOperationPanel.h index 21eaa4d080..af066710ec 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKOperationPanel.h +++ b/smtk/extension/paraview/appcomponents/pqSMTKOperationPanel.h @@ -100,10 +100,12 @@ protected: virtual void displayDocumentation(const smtk::operation::Operation::Index& index); class Internal; - Internal* m_p; - pqSMTKWrapper* m_wrapper; // TODO: Remove the need for me. This ties us to a single pqServer. + Internal* m_p{ nullptr }; + pqSMTKWrapper* m_wrapper{ + nullptr + }; // TODO: Remove the need for me. This ties us to a single pqServer. smtk::operation::OperationPtr m_editing; - smtk::extension::qtUIManager* m_attrUIMgr; + smtk::extension::qtUIManager* m_attrUIMgr{ nullptr }; std::weak_ptr m_rsrc; smtk::view::AvailableOperationsPtr m_availableOperations; smtk::resource::Observers::Key m_observer; diff --git a/smtk/extension/paraview/appcomponents/pqSMTKResourcePanel.cxx b/smtk/extension/paraview/appcomponents/pqSMTKResourcePanel.cxx index 993b076f37..777a87269f 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKResourcePanel.cxx +++ b/smtk/extension/paraview/appcomponents/pqSMTKResourcePanel.cxx @@ -23,8 +23,6 @@ pqSMTKResourcePanel::pqSMTKResourcePanel(QWidget* parent) : Superclass(parent) - , m_browser(nullptr) - , m_viewUIMgr(nullptr) { // Parse a json representation of our default config, save it. nlohmann::json j = nlohmann::json::parse(pqSMTKResourceBrowser::getJSONConfiguration()); diff --git a/smtk/extension/paraview/appcomponents/pqSMTKResourcePanel.h b/smtk/extension/paraview/appcomponents/pqSMTKResourcePanel.h index 3bbabdf97c..aff448754c 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKResourcePanel.h +++ b/smtk/extension/paraview/appcomponents/pqSMTKResourcePanel.h @@ -42,9 +42,9 @@ protected slots: virtual void resourceManagerRemoved(pqSMTKWrapper* mgr, pqServer* server); protected: - pqSMTKResourceBrowser* m_browser; + pqSMTKResourceBrowser* m_browser{ nullptr }; smtk::view::ConfigurationPtr m_view; - smtk::extension::qtUIManager* m_viewUIMgr; + smtk::extension::qtUIManager* m_viewUIMgr{ nullptr }; }; #endif // smtk_extension_paraview_appcomponents_pqSMTKResourcePanel_h diff --git a/smtk/extension/paraview/server/RespondToVTKSelection.cxx b/smtk/extension/paraview/server/RespondToVTKSelection.cxx index 0572cc0b98..64e84e2b6b 100644 --- a/smtk/extension/paraview/server/RespondToVTKSelection.cxx +++ b/smtk/extension/paraview/server/RespondToVTKSelection.cxx @@ -54,12 +54,7 @@ namespace view { RespondToVTKSelection::RespondToVTKSelection() - : m_vtkSelection(nullptr) - , m_vtkData(nullptr) - , m_smtkSelectionSource("paraview") - , m_smtkSelectionValue(1) - , m_modifier(/* replace current selection */ 0) - , m_selectingBlocks(false) + : m_smtkSelectionSource("paraview") { } diff --git a/smtk/extension/paraview/server/RespondToVTKSelection.h b/smtk/extension/paraview/server/RespondToVTKSelection.h index 5ac01f1268..4134bc51f9 100644 --- a/smtk/extension/paraview/server/RespondToVTKSelection.h +++ b/smtk/extension/paraview/server/RespondToVTKSelection.h @@ -149,13 +149,13 @@ protected: void generateSummary(Operation::Result&) override {} int m_interactionMode; - ::vtkSelection* m_vtkSelection; - vtkMultiBlockDataSet* m_vtkData; + ::vtkSelection* m_vtkSelection{ nullptr }; + vtkMultiBlockDataSet* m_vtkData{ nullptr }; smtk::view::WeakSelectionPtr m_smtkSelection; std::string m_smtkSelectionSource; - int m_smtkSelectionValue; - int m_modifier; - bool m_selectingBlocks; + int m_smtkSelectionValue{ 1 }; + int m_modifier{ /* replace current selection */ 0 }; + bool m_selectingBlocks{ false }; private: const char* xmlDescription() const override; diff --git a/smtk/extension/paraview/server/vtkSMTKResource.cxx b/smtk/extension/paraview/server/vtkSMTKResource.cxx index b3a4ebe408..9490a1ad51 100644 --- a/smtk/extension/paraview/server/vtkSMTKResource.cxx +++ b/smtk/extension/paraview/server/vtkSMTKResource.cxx @@ -31,7 +31,6 @@ vtkCxxSetObjectMacro(vtkSMTKResource, Wrapper, vtkSMTKWrapper); vtkSMTKResource::vtkSMTKResource() : Converter(nullptr) - , Wrapper(nullptr) { this->SetNumberOfInputPorts(0); } diff --git a/smtk/extension/paraview/server/vtkSMTKResource.h b/smtk/extension/paraview/server/vtkSMTKResource.h index 6a3847e526..2adf79435a 100644 --- a/smtk/extension/paraview/server/vtkSMTKResource.h +++ b/smtk/extension/paraview/server/vtkSMTKResource.h @@ -66,7 +66,7 @@ protected: std::weak_ptr Resource; smtk::common::UUID ResourceId; vtkSmartPointer Converter; - vtkSMTKWrapper* Wrapper; + vtkSMTKWrapper* Wrapper{ nullptr }; }; #endif diff --git a/smtk/extension/paraview/server/vtkSMTKResourceRepresentation.cxx b/smtk/extension/paraview/server/vtkSMTKResourceRepresentation.cxx index 8fa3629267..cf6ca703ec 100644 --- a/smtk/extension/paraview/server/vtkSMTKResourceRepresentation.cxx +++ b/smtk/extension/paraview/server/vtkSMTKResourceRepresentation.cxx @@ -174,8 +174,7 @@ typename std::enable_if::value, void>::type MarkRedistrib vtkStandardNewMacro(vtkSMTKResourceRepresentation); vtkSMTKResourceRepresentation::vtkSMTKResourceRepresentation() - : Wrapper(nullptr) - , EntityMapper(vtkSmartPointer::New()) + : EntityMapper(vtkSmartPointer::New()) , SelectedEntityMapper(vtkSmartPointer::New()) , GlyphMapper(vtkSmartPointer::New()) , SelectedGlyphMapper(vtkSmartPointer::New()) @@ -183,10 +182,6 @@ vtkSMTKResourceRepresentation::vtkSMTKResourceRepresentation() , SelectedEntities(vtkSmartPointer::New()) , GlyphEntities(vtkSmartPointer::New()) , SelectedGlyphEntities(vtkSmartPointer::New()) - , EntitiesActorPickId(-1) - , SelectedEntitiesActorPickId(-1) - , GlyphEntitiesActorPickId(-1) - , SelectedGlyphEntitiesActorPickId(-1) { this->SetupDefaults(); this->SetNumberOfInputPorts(3); diff --git a/smtk/extension/paraview/server/vtkSMTKResourceRepresentation.h b/smtk/extension/paraview/server/vtkSMTKResourceRepresentation.h index 342e78d86b..28bb61f420 100644 --- a/smtk/extension/paraview/server/vtkSMTKResourceRepresentation.h +++ b/smtk/extension/paraview/server/vtkSMTKResourceRepresentation.h @@ -425,7 +425,7 @@ protected: * + to determine the color for some non-visual entity types such as groups or models; and * + in certain coloring modes, such as when coloring by volume. */ - vtkSMTKWrapper* Wrapper; + vtkSMTKWrapper* Wrapper{ nullptr }; /// If Wrapper is non-null, SelectionObserver is the handle of an observer of Wrapper->GetSelection(). smtk::view::SelectionObservers::Key SelectionObserver; /** @@ -456,10 +456,10 @@ protected: vtkSmartPointer SelectedGlyphEntities; // IDs assigned by vtkPVRenderView for hardware picking: - int EntitiesActorPickId; - int SelectedEntitiesActorPickId; - int GlyphEntitiesActorPickId; - int SelectedGlyphEntitiesActorPickId; + int EntitiesActorPickId{ -1 }; + int SelectedEntitiesActorPickId{ -1 }; + int GlyphEntitiesActorPickId{ -1 }; + int SelectedGlyphEntitiesActorPickId{ -1 }; /** * Rendering properties shared between Entities and GlyphEntities diff --git a/smtk/extension/paraview/server/vtkSMTKResourceSource.cxx b/smtk/extension/paraview/server/vtkSMTKResourceSource.cxx index b834d6c6a5..412bde14bc 100644 --- a/smtk/extension/paraview/server/vtkSMTKResourceSource.cxx +++ b/smtk/extension/paraview/server/vtkSMTKResourceSource.cxx @@ -23,7 +23,6 @@ using namespace smtk; vtkStandardNewMacro(vtkSMTKResourceSource); vtkSMTKResourceSource::vtkSMTKResourceSource() - : VTKResource(nullptr) { this->SetNumberOfInputPorts(0); } diff --git a/smtk/extension/paraview/server/vtkSMTKResourceSource.h b/smtk/extension/paraview/server/vtkSMTKResourceSource.h index eca62ebd8e..b65b3dfea3 100644 --- a/smtk/extension/paraview/server/vtkSMTKResourceSource.h +++ b/smtk/extension/paraview/server/vtkSMTKResourceSource.h @@ -60,7 +60,7 @@ protected: vtkSMTKResourceSource(); ~vtkSMTKResourceSource() override; - vtkSMTKResource* VTKResource; + vtkSMTKResource* VTKResource{ nullptr }; }; #endif diff --git a/smtk/extension/paraview/server/vtkSMTKSettings.cxx b/smtk/extension/paraview/server/vtkSMTKSettings.cxx index 98067149e7..bcf2e42621 100644 --- a/smtk/extension/paraview/server/vtkSMTKSettings.cxx +++ b/smtk/extension/paraview/server/vtkSMTKSettings.cxx @@ -22,12 +22,9 @@ vtkSMTKSettings* vtkSMTKSettings::New() } vtkSMTKSettings::vtkSMTKSettings() - : HighlightOnHover(true) - , ShowSaveResourceOnClose(AskUser) + : ShowSaveResourceOnClose(AskUser) , SelectionRenderStyle(SolidSelectionStyle) , ResourceTreeStyle(HierarchicalStyle) - , WorkflowsFolder(nullptr) - , ProjectsRootFolder(nullptr) { } diff --git a/smtk/extension/paraview/server/vtkSMTKSettings.h b/smtk/extension/paraview/server/vtkSMTKSettings.h index b3a33859df..0138cc0d31 100644 --- a/smtk/extension/paraview/server/vtkSMTKSettings.h +++ b/smtk/extension/paraview/server/vtkSMTKSettings.h @@ -87,12 +87,12 @@ public: protected: vtkSMTKSettings(); - bool HighlightOnHover; + bool HighlightOnHover{ true }; int ShowSaveResourceOnClose; int SelectionRenderStyle; int ResourceTreeStyle; - char* WorkflowsFolder; - char* ProjectsRootFolder; + char* WorkflowsFolder{ nullptr }; + char* ProjectsRootFolder{ nullptr }; private: static vtkSmartPointer Instance; diff --git a/smtk/extension/paraview/server/vtkSMTKWrapper.cxx b/smtk/extension/paraview/server/vtkSMTKWrapper.cxx index b90b495636..299e8af073 100644 --- a/smtk/extension/paraview/server/vtkSMTKWrapper.cxx +++ b/smtk/extension/paraview/server/vtkSMTKWrapper.cxx @@ -75,12 +75,7 @@ vtkStandardNewMacro(vtkSMTKWrapper); vtkCxxSetObjectMacro(vtkSMTKWrapper, Representation, vtkPVDataRepresentation); vtkSMTKWrapper::vtkSMTKWrapper() - : ActiveResource(nullptr) - , Managers(smtk::common::Managers::create()) - , SelectedPort(nullptr) - , SelectionObj(nullptr) - , JSONRequest(nullptr) - , JSONResponse(nullptr) + : Managers(smtk::common::Managers::create()) , SelectionSource("paraview") { smtk::plugin::Manager::instance()->registerPluginsTo(this->Managers); diff --git a/smtk/extension/paraview/server/vtkSMTKWrapper.h b/smtk/extension/paraview/server/vtkSMTKWrapper.h index db4b452c1a..8c52d89a37 100644 --- a/smtk/extension/paraview/server/vtkSMTKWrapper.h +++ b/smtk/extension/paraview/server/vtkSMTKWrapper.h @@ -154,11 +154,11 @@ protected: vtkSMTKResource* GetVTKResource(vtkAlgorithm*); vtkPVDataRepresentation* Representation = nullptr; - vtkAlgorithmOutput* ActiveResource; - vtkAlgorithmOutput* SelectedPort; - vtkAlgorithmOutput* SelectionObj; - char* JSONRequest; - char* JSONResponse; + vtkAlgorithmOutput* ActiveResource{ nullptr }; + vtkAlgorithmOutput* SelectedPort{ nullptr }; + vtkAlgorithmOutput* SelectionObj{ nullptr }; + char* JSONRequest{ nullptr }; + char* JSONResponse{ nullptr }; smtk::common::Managers::Ptr Managers; std::string SelectionSource; diff --git a/smtk/extension/qt/MembershipBadge.cxx b/smtk/extension/qt/MembershipBadge.cxx index cb260380bc..0bfc580bee 100644 --- a/smtk/extension/qt/MembershipBadge.cxx +++ b/smtk/extension/qt/MembershipBadge.cxx @@ -42,18 +42,15 @@ namespace qt { MembershipBadge::MembershipBadge() - : m_singleSelect(false) - , m_iconOn(selected_svg) + : m_iconOn(selected_svg) , m_iconOff(unselected_svg) - , m_parent(nullptr) { } MembershipBadge::MembershipBadge( smtk::view::BadgeSet& parent, const smtk::view::Configuration::Component& config) - : m_singleSelect(false) - , m_iconOn(selected_svg) + : m_iconOn(selected_svg) , m_iconOff(unselected_svg) , m_parent(&parent) { diff --git a/smtk/extension/qt/MembershipBadge.h b/smtk/extension/qt/MembershipBadge.h index 3c915e8016..2d5889cff1 100644 --- a/smtk/extension/qt/MembershipBadge.h +++ b/smtk/extension/qt/MembershipBadge.h @@ -68,11 +68,13 @@ signals: void membershipChange(int val); protected: - MemberMap m_members; //!< From available items, has this object been turned on? - bool m_singleSelect; //!< If true, only 1 item may be a member; toggling an item resets others. + MemberMap m_members; //!< From available items, has this object been turned on? + bool m_singleSelect{ + false + }; //!< If true, only 1 item may be a member; toggling an item resets others. std::string m_iconOn; //!< SVG for icon showing membership. std::string m_iconOff; //!< SVG for icon showing non-membership. - const smtk::view::BadgeSet* m_parent; + const smtk::view::BadgeSet* m_parent{ nullptr }; }; } // namespace qt } // namespace extension diff --git a/smtk/extension/qt/qtAvailableOperations.cxx b/smtk/extension/qt/qtAvailableOperations.cxx index 0bde35fce4..e9ecafd623 100644 --- a/smtk/extension/qt/qtAvailableOperations.cxx +++ b/smtk/extension/qt/qtAvailableOperations.cxx @@ -20,10 +20,7 @@ namespace extension qtAvailableOperations::qtAvailableOperations(QWidget* parent) : QWidget(parent) - , m_operationList(nullptr) - , m_layout(nullptr) , m_operationSource(nullptr) - , m_useLabels(false) { m_operationList = new QListWidget(this); m_layout = new QVBoxLayout(this); diff --git a/smtk/extension/qt/qtAvailableOperations.h b/smtk/extension/qt/qtAvailableOperations.h index 27a9ef2598..06975d5987 100644 --- a/smtk/extension/qt/qtAvailableOperations.h +++ b/smtk/extension/qt/qtAvailableOperations.h @@ -50,11 +50,11 @@ signals: void hoverOperation(const smtk::operation::Operation::Index& op); protected: - QListWidget* m_operationList; - QVBoxLayout* m_layout; + QListWidget* m_operationList{ nullptr }; + QVBoxLayout* m_layout{ nullptr }; smtk::view::AvailableOperationsPtr m_operationSource; smtk::view::AvailableOperations::Observers::Key m_operationSourceObserverId; - bool m_useLabels; + bool m_useLabels{ false }; void updateList(); }; diff --git a/smtk/extension/qt/qtBaseView.h b/smtk/extension/qt/qtBaseView.h index c97b2890c4..f0eb154e11 100644 --- a/smtk/extension/qt/qtBaseView.h +++ b/smtk/extension/qt/qtBaseView.h @@ -38,8 +38,7 @@ class SMTKQTEXT_EXPORT ViewInfo : public smtk::view::Information { public: ViewInfo(smtk::view::ConfigurationPtr view, QWidget* parent, qtUIManager* uiman) - : smtk::view::Information() - , m_view(view) + : m_view(view) , m_parent(parent) , m_UIManager(uiman) { diff --git a/smtk/extension/qt/qtDescriptivePhraseDelegate.cxx b/smtk/extension/qt/qtDescriptivePhraseDelegate.cxx index 625fe397a7..de6ba94394 100644 --- a/smtk/extension/qt/qtDescriptivePhraseDelegate.cxx +++ b/smtk/extension/qt/qtDescriptivePhraseDelegate.cxx @@ -27,14 +27,6 @@ const int padding = 7; qtDescriptivePhraseDelegate::qtDescriptivePhraseDelegate(QWidget* owner) : QStyledItemDelegate(owner) - , m_titleFontSize(14) - , m_subtitleFontSize(10) - , m_titleFontWeight(2) - , m_subtitleFontWeight(1) - , m_textVerticalPad(2) - , m_drawSubtitle(true) - , m_visibilityMode(false) - , m_highlightOnHover(false) { } diff --git a/smtk/extension/qt/qtDescriptivePhraseDelegate.h b/smtk/extension/qt/qtDescriptivePhraseDelegate.h index 11723d88f0..cbb438dc16 100644 --- a/smtk/extension/qt/qtDescriptivePhraseDelegate.h +++ b/smtk/extension/qt/qtDescriptivePhraseDelegate.h @@ -88,14 +88,14 @@ protected: const QStyleOptionViewItem& option, const QModelIndex& index) override; - int m_titleFontSize; - int m_subtitleFontSize; - int m_titleFontWeight; - int m_subtitleFontWeight; - int m_textVerticalPad; - bool m_drawSubtitle; - bool m_visibilityMode; - bool m_highlightOnHover; + int m_titleFontSize{ 14 }; + int m_subtitleFontSize{ 10 }; + int m_titleFontWeight{ 2 }; + int m_subtitleFontWeight{ 1 }; + int m_textVerticalPad{ 2 }; + bool m_drawSubtitle{ true }; + bool m_visibilityMode{ false }; + bool m_highlightOnHover{ false }; }; } // namespace extension diff --git a/smtk/extension/qt/qtLineEdit.cxx b/smtk/extension/qt/qtLineEdit.cxx index 54e50fe941..21a5805fb3 100644 --- a/smtk/extension/qt/qtLineEdit.cxx +++ b/smtk/extension/qt/qtLineEdit.cxx @@ -45,8 +45,6 @@ using namespace smtk::extension; //----------------------------------------------------------------------------- qtLineEdit::qtLineEdit(QWidget* _parent) : Superclass(_parent) - , EditingFinishedPending(false) - , ResetCursorPositionOnEditingFinished(true) { qtLineEdit::connect(this, SIGNAL(editingFinished()), this, SLOT(onEditingFinished())); qtLineEdit::connect(this, SIGNAL(textEdited(const QString&)), this, SLOT(onTextEdited())); @@ -55,8 +53,6 @@ qtLineEdit::qtLineEdit(QWidget* _parent) //----------------------------------------------------------------------------- qtLineEdit::qtLineEdit(const QString& _contents, QWidget* _parent) : Superclass(_contents, _parent) - , EditingFinishedPending(false) - , ResetCursorPositionOnEditingFinished(true) { qtLineEdit::connect(this, SIGNAL(editingFinished()), this, SLOT(onEditingFinished())); qtLineEdit::connect(this, SIGNAL(textEdited(const QString&)), this, SLOT(onTextEdited())); diff --git a/smtk/extension/qt/qtLineEdit.h b/smtk/extension/qt/qtLineEdit.h index 86e3f11cda..25ea1138e9 100644 --- a/smtk/extension/qt/qtLineEdit.h +++ b/smtk/extension/qt/qtLineEdit.h @@ -135,8 +135,8 @@ protected: private: Q_DISABLE_COPY(qtLineEdit) - bool EditingFinishedPending; - bool ResetCursorPositionOnEditingFinished; + bool EditingFinishedPending{ false }; + bool ResetCursorPositionOnEditingFinished{ true }; }; } // namespace extension } // namespace smtk diff --git a/smtk/extension/qt/qtReferenceItem.cxx b/smtk/extension/qt/qtReferenceItem.cxx index f212a43854..eff4c8474a 100644 --- a/smtk/extension/qt/qtReferenceItem.cxx +++ b/smtk/extension/qt/qtReferenceItem.cxx @@ -100,11 +100,7 @@ qtItem* qtReferenceItem::createItemWidget(const qtAttributeItemInfo& info) } qtReferenceItemData::qtReferenceItemData() - : m_optional(nullptr) - , m_alreadyClosingPopup(false) - , m_qtModel(nullptr) - , m_qtDelegate(nullptr) - , m_selectedIconURL(":/icons/display/selected.png") + : m_selectedIconURL(":/icons/display/selected.png") , m_unselectedIconURL(":/icons/display/unselected.png") { } diff --git a/smtk/extension/qt/qtReferenceItemData.h b/smtk/extension/qt/qtReferenceItemData.h index 163c293044..c3cf2c2814 100644 --- a/smtk/extension/qt/qtReferenceItemData.h +++ b/smtk/extension/qt/qtReferenceItemData.h @@ -59,7 +59,7 @@ public: // Main widget contents QGridLayout* m_grid; - QCheckBox* m_optional; // Added if the item is optional to reflect IsEnabled(). + QCheckBox* m_optional{ nullptr }; // Added if the item is optional to reflect IsEnabled(). QLabel* m_label; // The item's label (or name if no label). QLabel* m_synopsis; // A live summary of the item's entries and acceptability QPushButton* m_copyFromSelection; // A button to copy the selection into the item's entries @@ -72,7 +72,9 @@ public: QDialog* m_popup; QVBoxLayout* m_popupLayout; QListView* m_popupList; - bool m_alreadyClosingPopup; // Set when synchronizeAndHide() should **not** hide the QMenu. + bool m_alreadyClosingPopup{ + false + }; // Set when synchronizeAndHide() should **not** hide the QMenu. // Selection state of items shown in m_phraseModel, from the MembershipBadge // std::map, int, @@ -80,8 +82,8 @@ public: // m_members; // Link between Qt and SMTK - smtk::extension::qtDescriptivePhraseModel* m_qtModel; - smtk::extension::qtDescriptivePhraseDelegate* m_qtDelegate; + smtk::extension::qtDescriptivePhraseModel* m_qtModel{ nullptr }; + smtk::extension::qtDescriptivePhraseDelegate* m_qtDelegate{ nullptr }; smtk::view::PhraseModelObservers::Key m_modelObserverId; diff --git a/smtk/extension/qt/qtResourceBrowserP.cxx b/smtk/extension/qt/qtResourceBrowserP.cxx index 5ad80535e1..07fbea4852 100644 --- a/smtk/extension/qt/qtResourceBrowserP.cxx +++ b/smtk/extension/qt/qtResourceBrowserP.cxx @@ -28,13 +28,8 @@ using namespace smtk::extension; /// @relates smtk::extension::qtResourceBrowser::Internal qtResourceBrowser::Internal::Internal() - : m_container(nullptr) - , m_layout(nullptr) - , m_view(nullptr) - , m_selnLabel("selected") + : m_selnLabel("selected") , m_hoverLabel("hovered") - , m_resourceTreeStyle(-1) - , m_updatingPanelSelectionFromSMTK(false) { std::ostringstream name; name << "resource panel " << this; diff --git a/smtk/extension/qt/qtResourceBrowserP.h b/smtk/extension/qt/qtResourceBrowserP.h index 3e3d52be97..4246c14455 100644 --- a/smtk/extension/qt/qtResourceBrowserP.h +++ b/smtk/extension/qt/qtResourceBrowserP.h @@ -46,9 +46,9 @@ public: smtk::extension::qtDescriptivePhraseModel* descriptivePhraseModel() const; void setDescriptivePhraseModel(QAbstractItemModel* qmodel); - QWidget* m_container; - QVBoxLayout* m_layout; - QTreeView* m_view; + QWidget* m_container{ nullptr }; + QVBoxLayout* m_layout{ nullptr }; + QTreeView* m_view{ nullptr }; QPointer m_self; QPointer m_model; QPointer m_delegate; @@ -63,12 +63,12 @@ public: std::string m_hoverLabel; std::string m_viewName; std::string m_resourceTreeType; // "default" or specific type. - int m_resourceTreeStyle; // Which default subphrase generator should be used? + int m_resourceTreeStyle{ -1 }; // Which default subphrase generator should be used? // Set to true when inside sendSMTKSelectionToPanel. // Used to avoid updating the SMTK selection from the panel while // the panel is being updated from SMTK: - bool m_updatingPanelSelectionFromSMTK; + bool m_updatingPanelSelectionFromSMTK{ false }; }; } // namespace extension } // namespace smtk diff --git a/smtk/extension/vtk/source/vtkConeFrustum.cxx b/smtk/extension/vtk/source/vtkConeFrustum.cxx index b20be08979..51fe05fd5e 100644 --- a/smtk/extension/vtk/source/vtkConeFrustum.cxx +++ b/smtk/extension/vtk/source/vtkConeFrustum.cxx @@ -31,11 +31,8 @@ vtkStandardNewMacro(vtkConeFrustum); vtkConeFrustum::vtkConeFrustum(int res) : BottomPoint{ 0, 0, 0 } - , BottomRadius(0.5) , TopPoint{ 0, 0, 1 } - , TopRadius(0.0) , Resolution(res <= 3 ? 3 : res) - , OutputPointsPrecision(SINGLE_PRECISION) { this->SetNumberOfInputPorts(0); this->SetNumberOfOutputPorts(NumberOfOutputs); diff --git a/smtk/extension/vtk/source/vtkConeFrustum.h b/smtk/extension/vtk/source/vtkConeFrustum.h index 5a825c5113..587a20e0d1 100644 --- a/smtk/extension/vtk/source/vtkConeFrustum.h +++ b/smtk/extension/vtk/source/vtkConeFrustum.h @@ -139,11 +139,11 @@ protected: int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override; double BottomPoint[3]; - double BottomRadius; + double BottomRadius{ 0.5 }; double TopPoint[3]; - double TopRadius; + double TopRadius{ 0.0 }; int Resolution; - int OutputPointsPrecision; + int OutputPointsPrecision{ SINGLE_PRECISION }; }; #endif diff --git a/smtk/extension/vtk/source/vtkImplicitConeFrustum.cxx b/smtk/extension/vtk/source/vtkImplicitConeFrustum.cxx index c72a50a4b1..b6c5b26b15 100644 --- a/smtk/extension/vtk/source/vtkImplicitConeFrustum.cxx +++ b/smtk/extension/vtk/source/vtkImplicitConeFrustum.cxx @@ -22,9 +22,7 @@ vtkStandardNewMacro(vtkImplicitConeFrustum); vtkImplicitConeFrustum::vtkImplicitConeFrustum() : BottomPoint{ 0, 0, 0 } - , BottomRadius(0.5) , TopPoint{ 0, 0, 1 } - , TopRadius(0.0) { // Our output is defined by our subclass, which we configure based on // calls that set our member variables. diff --git a/smtk/extension/vtk/source/vtkImplicitConeFrustum.h b/smtk/extension/vtk/source/vtkImplicitConeFrustum.h index a6f44edf62..fa83d1b8fc 100644 --- a/smtk/extension/vtk/source/vtkImplicitConeFrustum.h +++ b/smtk/extension/vtk/source/vtkImplicitConeFrustum.h @@ -117,11 +117,11 @@ protected: vtkNew ConeTransform; vtkVector3d BottomPoint; - double BottomRadius; + double BottomRadius{ 0.5 }; vtkNew BottomPlane; vtkVector3d TopPoint; - double TopRadius; + double TopRadius{ 0.0 }; vtkNew TopPlane; }; diff --git a/smtk/extension/vtk/source/vtkResourceMultiBlockSource.cxx b/smtk/extension/vtk/source/vtkResourceMultiBlockSource.cxx index 9b57d2a9a5..0872a09373 100644 --- a/smtk/extension/vtk/source/vtkResourceMultiBlockSource.cxx +++ b/smtk/extension/vtk/source/vtkResourceMultiBlockSource.cxx @@ -31,7 +31,6 @@ vtkInformationKeyMacro(vtkResourceMultiBlockSource, COMPONENT_ID, String); //---------------------------------------------------------------------------- vtkResourceMultiBlockSource::vtkResourceMultiBlockSource() - : LastModified(0) { this->SetNumberOfInputPorts(0); } diff --git a/smtk/extension/vtk/source/vtkResourceMultiBlockSource.h b/smtk/extension/vtk/source/vtkResourceMultiBlockSource.h index 38c11f0d80..d03b669910 100644 --- a/smtk/extension/vtk/source/vtkResourceMultiBlockSource.h +++ b/smtk/extension/vtk/source/vtkResourceMultiBlockSource.h @@ -172,7 +172,7 @@ protected: std::weak_ptr Resource; std::map Cache; std::set Visited; // Populated with extant entities during RequestData. - smtk::geometry::Geometry::GenerationNumber LastModified; + smtk::geometry::Geometry::GenerationNumber LastModified{ 0 }; }; #endif diff --git a/smtk/extension/vtk/widgets/vtkConeRepresentation.cxx b/smtk/extension/vtk/widgets/vtkConeRepresentation.cxx index 8c1de2b931..7cc17f04a5 100644 --- a/smtk/extension/vtk/widgets/vtkConeRepresentation.cxx +++ b/smtk/extension/vtk/widgets/vtkConeRepresentation.cxx @@ -53,16 +53,6 @@ vtkStandardNewMacro(vtkConeRepresentation); vtkConeRepresentation::vtkConeRepresentation() - : BumpDistance(0.01) - , AlongXAxis(0) - , AlongYAxis(0) - , AlongZAxis(0) - , Resolution(128) - , Tolerance(1e-8) - , ScaleEnabled(1) - , DrawCone(1) - , Tubing(1) - , Cylindrical(0) { this->HandleSize = 7.5; this->Cone->SetResolution(128); diff --git a/smtk/extension/vtk/widgets/vtkConeRepresentation.h b/smtk/extension/vtk/widgets/vtkConeRepresentation.h index 9267cc9d33..af460b30e3 100644 --- a/smtk/extension/vtk/widgets/vtkConeRepresentation.h +++ b/smtk/extension/vtk/widgets/vtkConeRepresentation.h @@ -391,21 +391,21 @@ protected: // Keep track of event positions double LastEventPosition[3]; // Controlling the push operation - double BumpDistance; + double BumpDistance{ 0.01 }; // Controlling ivars - vtkTypeBool AlongXAxis; - vtkTypeBool AlongYAxis; - vtkTypeBool AlongZAxis; + vtkTypeBool AlongXAxis{ 0 }; + vtkTypeBool AlongYAxis{ 0 }; + vtkTypeBool AlongZAxis{ 0 }; // The actual cylinder which is being manipulated vtkNew Cone; // The facet resolution for rendering purposes. - int Resolution; - double Tolerance; // How close are endpoints allowed to be? - vtkTypeBool ScaleEnabled; //whether the widget can be scaled - vtkTypeBool DrawCone; + int Resolution{ 128 }; + double Tolerance{ 1e-8 }; // How close are endpoints allowed to be? + vtkTypeBool ScaleEnabled{ 1 }; //whether the widget can be scaled + vtkTypeBool DrawCone{ 1 }; vtkNew AxisTuber; // Used to style edges. - vtkTypeBool Tubing; //control whether tubing is on - int Cylindrical; // control whether the cone is a cylinder (apex at infinity) + vtkTypeBool Tubing{ 1 }; //control whether tubing is on + int Cylindrical{ 0 }; // control whether the cone is a cylinder (apex at infinity) // Source of endpoint handle geometry vtkNew Sphere; diff --git a/smtk/extension/vtk/widgets/vtkSBFunctionParser.cxx b/smtk/extension/vtk/widgets/vtkSBFunctionParser.cxx index cb2fb4725b..35d218acd8 100644 --- a/smtk/extension/vtk/widgets/vtkSBFunctionParser.cxx +++ b/smtk/extension/vtk/widgets/vtkSBFunctionParser.cxx @@ -44,12 +44,6 @@ void vtkSBFunctionParser::vtkInternal::DefineConstants() vtkSBFunctionParser::vtkSBFunctionParser() : IndependentVariableName("X") - , IsVectorResult(false) - , InitialValue(0.0) - , Delta(0.0) - , NumberOfValues(-1) - , Help(nullptr) - , Result(nullptr) { this->Implementation = new vtkInternal(); diff --git a/smtk/extension/vtk/widgets/vtkSBFunctionParser.h b/smtk/extension/vtk/widgets/vtkSBFunctionParser.h index 52202b8d84..b561cc1e13 100644 --- a/smtk/extension/vtk/widgets/vtkSBFunctionParser.h +++ b/smtk/extension/vtk/widgets/vtkSBFunctionParser.h @@ -94,13 +94,13 @@ private: std::string Function; - bool IsVectorResult; - double InitialValue; - double Delta; - int NumberOfValues; + bool IsVectorResult{ false }; + double InitialValue{ 0.0 }; + double Delta{ 0.0 }; + int NumberOfValues{ -1 }; - char* Help; - vtkDoubleArray* Result; + char* Help{ nullptr }; + vtkDoubleArray* Result{ nullptr }; class vtkInternal; vtkInternal* Implementation; diff --git a/smtk/io/AttributeReader.cxx b/smtk/io/AttributeReader.cxx index c1aa928ee7..f1788db8fd 100644 --- a/smtk/io/AttributeReader.cxx +++ b/smtk/io/AttributeReader.cxx @@ -381,7 +381,6 @@ void AttributeReaderInternals::readAttributes( } AttributeReader::AttributeReader() - : m_reportAsError(true) { m_internals = new AttributeReaderInternals(); } diff --git a/smtk/io/AttributeReader.h b/smtk/io/AttributeReader.h index 9b3efd2faa..55ac4df382 100644 --- a/smtk/io/AttributeReader.h +++ b/smtk/io/AttributeReader.h @@ -72,7 +72,7 @@ public: protected: private: - bool m_reportAsError; + bool m_reportAsError{ true }; std::vector m_searchPaths; AttributeReaderInternals* m_internals; }; diff --git a/smtk/io/AttributeWriter.cxx b/smtk/io/AttributeWriter.cxx index 841e4ab9b7..79ca3b3f5c 100644 --- a/smtk/io/AttributeWriter.cxx +++ b/smtk/io/AttributeWriter.cxx @@ -29,17 +29,6 @@ namespace io AttributeWriter::AttributeWriter() : m_fileVersion(DEFAULT_FILE_VERSION) - , m_includeAdvanceLevels(true) - , m_includeAnalyses(true) - , m_includeAttributeAssociations(true) - , m_includeDefinitions(true) - , m_includeEvaluators(true) - , m_includeInstances(true) - , m_includeResourceAssociations(true) - , m_includeResourceID(true) - , m_includeUniqueRoles(true) - , m_includeViews(true) - , m_useDirectoryInfo(false) { } diff --git a/smtk/io/AttributeWriter.h b/smtk/io/AttributeWriter.h index c3e5be044b..de8ae47659 100644 --- a/smtk/io/AttributeWriter.h +++ b/smtk/io/AttributeWriter.h @@ -114,18 +114,19 @@ protected: smtk::io::Logger& logger) const; private: + // NOLINTNEXTLINE(modernize-use-default-member-init) unsigned int m_fileVersion; - bool m_includeAdvanceLevels; - bool m_includeAnalyses; - bool m_includeAttributeAssociations; - bool m_includeDefinitions; - bool m_includeEvaluators; - bool m_includeInstances; - bool m_includeResourceAssociations; - bool m_includeResourceID; - bool m_includeUniqueRoles; - bool m_includeViews; - bool m_useDirectoryInfo; + bool m_includeAdvanceLevels{ true }; + bool m_includeAnalyses{ true }; + bool m_includeAttributeAssociations{ true }; + bool m_includeDefinitions{ true }; + bool m_includeEvaluators{ true }; + bool m_includeInstances{ true }; + bool m_includeResourceAssociations{ true }; + bool m_includeResourceID{ true }; + bool m_includeUniqueRoles{ true }; + bool m_includeViews{ true }; + bool m_useDirectoryInfo{ false }; std::vector m_includedDefs; }; } // namespace io diff --git a/smtk/io/Logger.h b/smtk/io/Logger.h index 03c91512d0..c01ecd0c03 100644 --- a/smtk/io/Logger.h +++ b/smtk/io/Logger.h @@ -107,10 +107,10 @@ public: struct Record { - Severity severity; + Severity severity{ INFO }; std::string message; std::string fileName; - unsigned int lineNumber; + unsigned int lineNumber{ 0 }; Record(Severity s, const std::string& m, const std::string& f = "", unsigned int l = 0) : severity(s) , message(m) @@ -118,24 +118,14 @@ public: , lineNumber(l) { } - Record() - : severity(INFO) - , lineNumber(0) - { - } + Record() = default; }; - Logger() - : m_hasErrors(false) - , m_stream(nullptr) - , m_ownStream(false) - { - } + Logger() = default; Logger(const Logger& logger) : m_hasErrors(logger.m_hasErrors) , m_records(logger.m_records) - , m_ownStream(false) { } @@ -184,10 +174,10 @@ protected: void flushRecordsToStream(std::size_t beginRec, std::size_t endRec); std::string toStringInternal(std::size_t i, std::size_t j, bool includeSourceLoc = false) const; - bool m_hasErrors; + bool m_hasErrors{ false }; std::vector m_records; - std::ostream* m_stream; - bool m_ownStream; + std::ostream* m_stream{ nullptr }; + bool m_ownStream{ false }; std::function m_callback; private: diff --git a/smtk/io/ModelToMesh.cxx b/smtk/io/ModelToMesh.cxx index 94f5a0c0f9..b685ad4741 100644 --- a/smtk/io/ModelToMesh.cxx +++ b/smtk/io/ModelToMesh.cxx @@ -403,11 +403,7 @@ void find_entities_with_tessellation( } } //namespace detail -ModelToMesh::ModelToMesh() - : m_mergeDuplicates(true) - , m_tolerance(-1) -{ -} +ModelToMesh::ModelToMesh() = default; smtk::mesh::ResourcePtr ModelToMesh::operator()(const smtk::model::ResourcePtr& modelResource) const { diff --git a/smtk/io/ModelToMesh.h b/smtk/io/ModelToMesh.h index d88a067165..5c76fefb72 100644 --- a/smtk/io/ModelToMesh.h +++ b/smtk/io/ModelToMesh.h @@ -43,8 +43,8 @@ public: smtk::mesh::ResourcePtr operator()(const smtk::model::Model& model) const; private: - bool m_mergeDuplicates; - double m_tolerance; + bool m_mergeDuplicates{ true }; + double m_tolerance{ -1 }; }; } // namespace io } // namespace smtk diff --git a/smtk/mesh/core/ForEachTypes.cxx b/smtk/mesh/core/ForEachTypes.cxx index b52bd33dd2..34a7af9386 100644 --- a/smtk/mesh/core/ForEachTypes.cxx +++ b/smtk/mesh/core/ForEachTypes.cxx @@ -17,9 +17,7 @@ namespace mesh MeshForEach::~MeshForEach() = default; CellForEach::CellForEach(bool wantCoordinates) - : m_pointIds(nullptr) - , m_coords(nullptr) - , m_wantsCoordinates(wantCoordinates) + : m_wantsCoordinates(wantCoordinates) { } diff --git a/smtk/mesh/core/ForEachTypes.h b/smtk/mesh/core/ForEachTypes.h index 8892fd76f4..cd398ead14 100644 --- a/smtk/mesh/core/ForEachTypes.h +++ b/smtk/mesh/core/ForEachTypes.h @@ -72,8 +72,8 @@ public: private: smtk::mesh::ResourcePtr m_resource; - const smtk::mesh::Handle* m_pointIds; - std::vector* m_coords; + const smtk::mesh::Handle* m_pointIds{ nullptr }; + std::vector* m_coords{ nullptr }; bool m_wantsCoordinates; }; diff --git a/smtk/mesh/core/Interface.h b/smtk/mesh/core/Interface.h index 6d29cfb161..71b08982c1 100644 --- a/smtk/mesh/core/Interface.h +++ b/smtk/mesh/core/Interface.h @@ -77,10 +77,7 @@ public: class SMTKCORE_EXPORT BufferedCellAllocator { public: - BufferedCellAllocator() - : m_validState(false) - { - } + BufferedCellAllocator() = default; virtual ~BufferedCellAllocator() = default; @@ -115,7 +112,7 @@ public: bool isValid() const { return m_validState; } protected: - bool m_validState; + bool m_validState{ false }; }; // IncrementalAllocator allows for the allocation of meshes by incrementally @@ -181,13 +178,9 @@ public: //current cell when we are iterating. struct IterationState { - IterationState() - : whichConnectivityVector(0) - , ptrOffsetInVector(0) - { - } - std::size_t whichConnectivityVector; - std::size_t ptrOffsetInVector; + IterationState() = default; + std::size_t whichConnectivityVector{ 0 }; + std::size_t ptrOffsetInVector{ 0 }; }; virtual void initTraversal(IterationState& state) = 0; @@ -211,22 +204,13 @@ public: //copy of vector on return, ugggh. struct Results { - Results() - : pointIds() - , sqDistances() - , x_s() - , y_s() - , z_s() - , want_sqDistances(false) - , want_Coordinates(false) - { - } + Results() = default; std::vector pointIds; std::vector sqDistances; std::vector x_s, y_s, z_s; - bool want_sqDistances; - bool want_Coordinates; + bool want_sqDistances{ false }; + bool want_Coordinates{ false }; }; virtual ~PointLocatorImpl() = default; diff --git a/smtk/mesh/core/MeshSet.cxx b/smtk/mesh/core/MeshSet.cxx index a322b4c282..647a1ef831 100644 --- a/smtk/mesh/core/MeshSet.cxx +++ b/smtk/mesh/core/MeshSet.cxx @@ -22,10 +22,7 @@ namespace smtk namespace mesh { -MeshSet::MeshSet() - : m_handle() -{ -} +MeshSet::MeshSet() = default; MeshSet::MeshSet(const smtk::mesh::ResourcePtr& parent, smtk::mesh::Handle handle) { diff --git a/smtk/mesh/core/MeshSet.h b/smtk/mesh/core/MeshSet.h index c4c37e8b3b..909563cf36 100644 --- a/smtk/mesh/core/MeshSet.h +++ b/smtk/mesh/core/MeshSet.h @@ -222,7 +222,7 @@ private: friend std::shared_ptr Component::create(const MeshSet&); smtk::mesh::ResourcePtr m_parent; - smtk::mesh::Handle m_handle; + smtk::mesh::Handle m_handle{}; smtk::mesh::HandleRange m_range; //range of entity sets mutable smtk::common::UUID m_id; }; diff --git a/smtk/mesh/core/Resource.cxx b/smtk/mesh/core/Resource.cxx index 9d91753126..51103eb38b 100644 --- a/smtk/mesh/core/Resource.cxx +++ b/smtk/mesh/core/Resource.cxx @@ -54,7 +54,6 @@ typedef std::tuple QueryList; Resource::Resource() : Superclass(smtk::common::UUIDGenerator::instance().random()) - , m_nameCounter(-1) , m_internals(new InternalImpl()) { queries().registerQueries(); @@ -63,7 +62,6 @@ Resource::Resource() Resource::Resource(const smtk::common::UUID& resourceID) : smtk::resource::DerivedFrom(resourceID) - , m_nameCounter(-1) , m_internals(new InternalImpl()) { queries().registerQueries(); @@ -73,7 +71,6 @@ Resource::Resource(const smtk::common::UUID& resourceID) Resource::Resource(smtk::mesh::InterfacePtr interface) : smtk::resource::DerivedFrom( smtk::common::UUIDGenerator::instance().random()) - , m_nameCounter(-1) , m_internals(new InternalImpl(interface)) { queries().registerQueries(); @@ -82,7 +79,6 @@ Resource::Resource(smtk::mesh::InterfacePtr interface) Resource::Resource(const smtk::common::UUID& resourceID, smtk::mesh::InterfacePtr interface) : smtk::resource::DerivedFrom(resourceID) - , m_nameCounter(-1) , m_internals(new InternalImpl(interface)) { queries().registerQueries(); diff --git a/smtk/mesh/core/Resource.h b/smtk/mesh/core/Resource.h index cbcd9fe64d..95430edbf5 100644 --- a/smtk/mesh/core/Resource.h +++ b/smtk/mesh/core/Resource.h @@ -328,7 +328,7 @@ private: smtk::model::WeakResourcePtr m_modelResource; - int m_nameCounter; + int m_nameCounter{ -1 }; friend std::shared_ptr Component::create( const ResourcePtr&, diff --git a/smtk/mesh/core/TypeSet.cxx b/smtk/mesh/core/TypeSet.cxx index 3f9f4d8a23..2112370856 100644 --- a/smtk/mesh/core/TypeSet.cxx +++ b/smtk/mesh/core/TypeSet.cxx @@ -33,11 +33,7 @@ namespace smtk namespace mesh { -TypeSet::TypeSet() - : m_hasMesh(false) - , m_hasCell(false) -{ -} +TypeSet::TypeSet() = default; TypeSet::TypeSet(smtk::mesh::CellTypes ctypes, bool hasM, bool hasC) : m_cellTypes(ctypes) diff --git a/smtk/mesh/core/TypeSet.h b/smtk/mesh/core/TypeSet.h index 1fed7526aa..b69a8e4ab3 100644 --- a/smtk/mesh/core/TypeSet.h +++ b/smtk/mesh/core/TypeSet.h @@ -51,8 +51,8 @@ public: private: smtk::mesh::CellTypes m_cellTypes; smtk::mesh::DimensionTypes m_dimTypes; - bool m_hasMesh; - bool m_hasCell; + bool m_hasMesh{ false }; + bool m_hasCell{ false }; }; } // namespace mesh } // namespace smtk diff --git a/smtk/mesh/json/Interface.cxx b/smtk/mesh/json/Interface.cxx index 900de1fdb2..d5eb98710b 100644 --- a/smtk/mesh/json/Interface.cxx +++ b/smtk/mesh/json/Interface.cxx @@ -38,14 +38,12 @@ smtk::mesh::json::InterfacePtr make_interface() Interface::Interface() : m_associated_model(smtk::common::UUID::null()) - , m_modified(false) { } Interface::Interface(const std::vector& info) : m_meshInfo(info) , m_associated_model(smtk::common::UUID::null()) - , m_modified(false) { } diff --git a/smtk/mesh/json/MeshInfo.cxx b/smtk/mesh/json/MeshInfo.cxx index aa115a658d..0f9448ccbc 100644 --- a/smtk/mesh/json/MeshInfo.cxx +++ b/smtk/mesh/json/MeshInfo.cxx @@ -21,10 +21,7 @@ namespace mesh namespace json { -MeshInfo::MeshInfo() - : m_mesh() -{ -} +MeshInfo::MeshInfo() = default; MeshInfo::MeshInfo( smtk::mesh::Handle meshId, diff --git a/smtk/mesh/moab/Interface.cxx b/smtk/mesh/moab/Interface.cxx index 8a63082616..6f42a57c43 100644 --- a/smtk/mesh/moab/Interface.cxx +++ b/smtk/mesh/moab/Interface.cxx @@ -240,7 +240,6 @@ smtk::mesh::moab::InterfacePtr extract_interface(const smtk::mesh::ResourcePtr& Interface::Interface() : m_iface(new ::moab::Core()) - , m_modified(false) { m_alloc.reset(new smtk::mesh::moab::Allocator(m_iface.get())); m_bcAlloc.reset(new smtk::mesh::moab::BufferedCellAllocator(m_iface.get())); diff --git a/smtk/mesh/moab/Interface.h b/smtk/mesh/moab/Interface.h index da30c48a6a..95e93e301a 100644 --- a/smtk/mesh/moab/Interface.h +++ b/smtk/mesh/moab/Interface.h @@ -397,7 +397,7 @@ private: smtk::mesh::AllocatorPtr m_alloc; smtk::mesh::BufferedCellAllocatorPtr m_bcAlloc; smtk::mesh::IncrementalAllocatorPtr m_iAlloc; - mutable bool m_modified; + mutable bool m_modified{ false }; }; } // namespace moab } // namespace mesh diff --git a/smtk/mesh/moab/RandomPoint.h b/smtk/mesh/moab/RandomPoint.h index 4121326d83..2acc913588 100644 --- a/smtk/mesh/moab/RandomPoint.h +++ b/smtk/mesh/moab/RandomPoint.h @@ -33,10 +33,7 @@ namespace moab struct SMTKCORE_EXPORT RandomPoint : public smtk::resource::query::DerivedFrom { - RandomPoint() - : m_seed(0) - { - } + RandomPoint() = default; std::array operator()(const smtk::resource::Component::Ptr&) const override; @@ -45,7 +42,7 @@ struct SMTKCORE_EXPORT RandomPoint void seed(std::size_t seed) override { m_seed = seed; } private: - std::size_t m_seed; + std::size_t m_seed{ 0 }; }; } // namespace moab } // namespace mesh diff --git a/smtk/mesh/operators/DeleteMesh.cxx b/smtk/mesh/operators/DeleteMesh.cxx index 182cb676a6..ef6984a46a 100644 --- a/smtk/mesh/operators/DeleteMesh.cxx +++ b/smtk/mesh/operators/DeleteMesh.cxx @@ -28,10 +28,7 @@ namespace smtk namespace mesh { -DeleteMesh::DeleteMesh() - : m_suppressOutput(false) -{ -} +DeleteMesh::DeleteMesh() = default; smtk::mesh::DeleteMesh::Result DeleteMesh::operateInternal() { diff --git a/smtk/mesh/operators/DeleteMesh.h b/smtk/mesh/operators/DeleteMesh.h index 6808afe3c0..a941c4bc34 100644 --- a/smtk/mesh/operators/DeleteMesh.h +++ b/smtk/mesh/operators/DeleteMesh.h @@ -36,7 +36,7 @@ protected: void generateSummary(smtk::operation::Operation::Result&) override; - bool m_suppressOutput; + bool m_suppressOutput{ false }; }; } //namespace mesh diff --git a/smtk/mesh/utility/ExtractTessellation.cxx b/smtk/mesh/utility/ExtractTessellation.cxx index 15f073423b..3e6238b0b3 100644 --- a/smtk/mesh/utility/ExtractTessellation.cxx +++ b/smtk/mesh/utility/ExtractTessellation.cxx @@ -240,11 +240,7 @@ PreAllocatedTessellation::PreAllocatedTessellation( { } -Tessellation::Tessellation() - : m_useVTKConnectivity(true) - , m_useVTKCellTypes(true) -{ -} +Tessellation::Tessellation() = default; Tessellation::Tessellation(bool useVTKConnectivity, bool useVTKCellTypes) : m_useVTKConnectivity(useVTKConnectivity) diff --git a/smtk/mesh/utility/ExtractTessellation.h b/smtk/mesh/utility/ExtractTessellation.h index a7d1bf8f51..12f9f0fade 100644 --- a/smtk/mesh/utility/ExtractTessellation.h +++ b/smtk/mesh/utility/ExtractTessellation.h @@ -162,8 +162,8 @@ private: std::vector m_points; - bool m_useVTKConnectivity; - bool m_useVTKCellTypes; + bool m_useVTKConnectivity{ true }; + bool m_useVTKCellTypes{ true }; }; //Don't wrap these for python, instead python should use the Tessellation class diff --git a/smtk/model/Arrangement.h b/smtk/model/Arrangement.h index 534e899dd0..54a1ca8b8a 100644 --- a/smtk/model/Arrangement.h +++ b/smtk/model/Arrangement.h @@ -152,11 +152,7 @@ public: { } /// Construct an invalid reference. - ArrangementReference() - : kind(KINDS_OF_ARRANGEMENTS) - , index(-1) - { - } + ArrangementReference() = default; /// Indicate whether a reference is valid or not: bool isValid() const @@ -165,8 +161,8 @@ public: } smtk::common::UUID entityId; //!< The ID of the entity on which the arrangement is defined. - ArrangementKind kind; //!< The kind of the arrangement. - int index; //!< The index of the arrangement. + ArrangementKind kind{ KINDS_OF_ARRANGEMENTS }; //!< The kind of the arrangement. + int index{ -1 }; //!< The index of the arrangement. }; /// A vector of Arrangements is associated to each Manager entity. diff --git a/smtk/model/Entity.cxx b/smtk/model/Entity.cxx index b81dfbca6b..0c40c5ac91 100644 --- a/smtk/model/Entity.cxx +++ b/smtk/model/Entity.cxx @@ -91,9 +91,7 @@ static const char* entityTypeNames[] = { "cell", "use", "shell", "gro /// The default constructor creates an invalid link. Entity::Entity() - : m_entityFlags(INVALID) - , m_firstInvalid(-1) - , m_id(smtk::common::UUIDGenerator::instance().random()) + : m_id(smtk::common::UUIDGenerator::instance().random()) { } diff --git a/smtk/model/Entity.h b/smtk/model/Entity.h index 6f5a51a7c0..f9fdf08b43 100644 --- a/smtk/model/Entity.h +++ b/smtk/model/Entity.h @@ -177,11 +177,11 @@ protected: Entity(); int consumeInvalidIndex(const smtk::common::UUID& uid); - BitFlags m_entityFlags; + BitFlags m_entityFlags{ INVALID }; smtk::common::UUIDArray m_relations; smtk::model::WeakResourcePtr m_resource; KindsToArrangements m_arrangements; - int m_firstInvalid; + int m_firstInvalid{ -1 }; smtk::common::UUID m_id; }; diff --git a/smtk/model/GridInfo.h b/smtk/model/GridInfo.h index d09b963d94..9915cea5e2 100644 --- a/smtk/model/GridInfo.h +++ b/smtk/model/GridInfo.h @@ -52,12 +52,9 @@ public: { ApiReturnType returnType; std::string errorMessage; - smtk::io::Logger* logger; + smtk::io::Logger* logger{ nullptr }; - ApiStatus() - : logger(0) - { - } + ApiStatus() = default; }; /// Enum for specifying point set closure. diff --git a/smtk/model/LimitingClause.h b/smtk/model/LimitingClause.h index 5b16315358..5a7cd59f92 100644 --- a/smtk/model/LimitingClause.h +++ b/smtk/model/LimitingClause.h @@ -30,12 +30,9 @@ namespace model */ struct SMTKCORE_EXPORT LimitingClause { - LimitingClause() - : m_propType(smtk::resource::PropertyType::INVALID_PROPERTY) - { - } + LimitingClause() = default; - smtk::resource::PropertyType m_propType; + smtk::resource::PropertyType m_propType{ smtk::resource::PropertyType::INVALID_PROPERTY }; std::string m_propName; bool m_propNameIsRegex{ false }; std::vector m_propStringValues; diff --git a/smtk/model/Session.cxx b/smtk/model/Session.cxx index ad9e070a16..cb404052aa 100644 --- a/smtk/model/Session.cxx +++ b/smtk/model/Session.cxx @@ -41,7 +41,6 @@ namespace model /// Default constructor. This assigns a random session ID to each Session instance. Session::Session() : m_sessionId(smtk::common::UUID::random()) - , m_resource(nullptr) { } diff --git a/smtk/model/Session.h b/smtk/model/Session.h index b6d79d9861..b5288986cd 100644 --- a/smtk/model/Session.h +++ b/smtk/model/Session.h @@ -237,7 +237,7 @@ protected: DanglingEntities m_dangling; smtk::common::UUID m_sessionId; - Resource* m_resource; + Resource* m_resource{ nullptr }; }; } // namespace model diff --git a/smtk/operation/Operation.cxx b/smtk/operation/Operation.cxx index 208727d7e9..f1b8eb8ea4 100644 --- a/smtk/operation/Operation.cxx +++ b/smtk/operation/Operation.cxx @@ -46,8 +46,7 @@ namespace operation { Operation::Operation() - : m_debugLevel(0) - , m_specification(nullptr) + : m_specification(nullptr) , m_parameters(nullptr) , m_resultDefinition(nullptr) { diff --git a/smtk/operation/Operation.h b/smtk/operation/Operation.h index 64b02d2b61..7bbc08b219 100644 --- a/smtk/operation/Operation.h +++ b/smtk/operation/Operation.h @@ -168,7 +168,7 @@ protected: // an attribute .sbt file. Specification createBaseSpecification() const; - int m_debugLevel; + int m_debugLevel{ 0 }; std::weak_ptr m_manager; // Operations need the ability to execute Operations without going through diff --git a/smtk/project/Project.cxx b/smtk/project/Project.cxx index d455d7c80d..62b4a513af 100644 --- a/smtk/project/Project.cxx +++ b/smtk/project/Project.cxx @@ -19,7 +19,6 @@ Project::Project(const std::string& typeName) : m_resources(this, smtk::resource::Resource::m_manager) , m_operations(std::weak_ptr()) , m_typeName(typeName) - , m_manager(nullptr) { } diff --git a/smtk/project/Project.h b/smtk/project/Project.h index 81e348ac82..dc9d2eccfb 100644 --- a/smtk/project/Project.h +++ b/smtk/project/Project.h @@ -103,7 +103,7 @@ private: OperationFactory m_operations; std::string m_typeName; std::string m_version; - smtk::project::Manager* m_manager; + smtk::project::Manager* m_manager{ nullptr }; }; } // namespace project } // namespace smtk diff --git a/smtk/project/view/PhraseContent.cxx b/smtk/project/view/PhraseContent.cxx index f771ff4a1b..5e1a9cc66a 100644 --- a/smtk/project/view/PhraseContent.cxx +++ b/smtk/project/view/PhraseContent.cxx @@ -29,11 +29,7 @@ namespace project namespace view { -PhraseContent::PhraseContent() - : m_isProject(false) - , m_mutability(0) -{ -} +PhraseContent::PhraseContent() = default; PhraseContent::~PhraseContent() = default; diff --git a/smtk/project/view/PhraseContent.h b/smtk/project/view/PhraseContent.h index fcebf45a8b..9b7c8a1de4 100644 --- a/smtk/project/view/PhraseContent.h +++ b/smtk/project/view/PhraseContent.h @@ -73,8 +73,8 @@ protected: PhraseContent(); std::weak_ptr m_resource; - bool m_isProject; - int m_mutability; + bool m_isProject{ false }; + int m_mutability{ 0 }; }; } // namespace view } // namespace project diff --git a/smtk/resource/Lock.cxx b/smtk/resource/Lock.cxx index 27ec8bb27e..73109d13a9 100644 --- a/smtk/resource/Lock.cxx +++ b/smtk/resource/Lock.cxx @@ -14,12 +14,7 @@ namespace smtk namespace resource { -Lock::Lock() - : m_activeReaders(0) - , m_waitingWriters(0) - , m_activeWriters(0) -{ -} +Lock::Lock() = default; void Lock::lock(LockType lockType) { diff --git a/smtk/resource/Lock.h b/smtk/resource/Lock.h index c0d0882a5e..3c23753d31 100644 --- a/smtk/resource/Lock.h +++ b/smtk/resource/Lock.h @@ -51,9 +51,9 @@ private: std::mutex m_mutex; std::condition_variable m_readerCondition; std::condition_variable m_writerCondition; - std::size_t m_activeReaders; - std::size_t m_waitingWriters; - std::size_t m_activeWriters; + std::size_t m_activeReaders{ 0 }; + std::size_t m_waitingWriters{ 0 }; + std::size_t m_activeWriters{ 0 }; }; /// A scope-guarded utility for handling locks. diff --git a/smtk/session/mesh/queries/RandomPoint.h b/smtk/session/mesh/queries/RandomPoint.h index 96017e2e38..477cecd174 100644 --- a/smtk/session/mesh/queries/RandomPoint.h +++ b/smtk/session/mesh/queries/RandomPoint.h @@ -31,10 +31,7 @@ namespace mesh struct SMTKMESHSESSION_EXPORT RandomPoint : public smtk::resource::query::DerivedFrom { - RandomPoint() - : m_seed(0) - { - } + RandomPoint() = default; std::array operator()(const smtk::resource::Component::Ptr& component) const override { @@ -59,7 +56,7 @@ struct SMTKMESHSESSION_EXPORT RandomPoint void seed(std::size_t i) override { m_seed = i; } private: - std::size_t m_seed; + std::size_t m_seed{ 0 }; }; } // namespace mesh } // namespace session diff --git a/smtk/session/polygon/Session.cxx b/smtk/session/polygon/Session.cxx index 5edbe276f5..783ebc6115 100644 --- a/smtk/session/polygon/Session.cxx +++ b/smtk/session/polygon/Session.cxx @@ -50,10 +50,7 @@ namespace polygon { /// Default constructor. -Session::Session() - : m_nextModelNumber(0) -{ -} +Session::Session() = default; /// Virtual destructor. Here because Session overrides virtual methods from Session. Session::~Session() = default; diff --git a/smtk/session/polygon/Session.h b/smtk/session/polygon/Session.h index f2719ca411..fb2c63141e 100644 --- a/smtk/session/polygon/Session.h +++ b/smtk/session/polygon/Session.h @@ -124,7 +124,7 @@ protected: internal::EntityIdToPtr::iterator findStorageIterator(const smtk::common::UUID& uid); internal::EntityIdToPtr m_storage; - int m_nextModelNumber; + int m_nextModelNumber{ 0 }; }; } // namespace polygon diff --git a/smtk/session/polygon/internal/Entity.h b/smtk/session/polygon/internal/Entity.h index 0658c1e87a..7578ed9880 100644 --- a/smtk/session/polygon/internal/Entity.h +++ b/smtk/session/polygon/internal/Entity.h @@ -48,10 +48,7 @@ public: } protected: - entity() - : m_parent(nullptr) - { - } + entity() = default; entity(const Id& uid, entity* p) : m_parent(p) , m_id(uid) @@ -59,7 +56,7 @@ protected: } virtual ~entity() { m_parent = nullptr; } - entity* m_parent; + entity* m_parent{ nullptr }; Id m_id; }; diff --git a/smtk/session/polygon/internal/Model.cxx b/smtk/session/polygon/internal/Model.cxx index 249e8f0b45..951ed1d24f 100644 --- a/smtk/session/polygon/internal/Model.cxx +++ b/smtk/session/polygon/internal/Model.cxx @@ -48,7 +48,6 @@ typedef std::vector> SegmentSplitsT; pmodel::pmodel() : m_session(nullptr) - , m_featureSize(1e-8) { for (int i = 0; i < 3; ++i) { diff --git a/smtk/session/polygon/internal/Model.h b/smtk/session/polygon/internal/Model.h index 42a28c0078..176fb6a669 100644 --- a/smtk/session/polygon/internal/Model.h +++ b/smtk/session/polygon/internal/Model.h @@ -226,7 +226,7 @@ protected: SessionPtr m_session; // Parent session of this pmodel. long long m_scale; // Recommend this be a large composite number w/ factors 2, 3, 5 (e.g., 15360, 231000, or 1182720) - double m_featureSize; + double m_featureSize{ 1e-8 }; double m_origin[3]; // Base point of plane for pmodel diff --git a/smtk/session/polygon/internal/Region.cxx b/smtk/session/polygon/internal/Region.cxx index 94564cb4a0..8d3a35c126 100644 --- a/smtk/session/polygon/internal/Region.cxx +++ b/smtk/session/polygon/internal/Region.cxx @@ -18,7 +18,6 @@ namespace polygon Region::Region() : m_seedFragment(static_cast(-1)) - , m_seedSense(true) { } diff --git a/smtk/session/polygon/internal/Region.h b/smtk/session/polygon/internal/Region.h index 297c7a0a55..849681ab3d 100644 --- a/smtk/session/polygon/internal/Region.h +++ b/smtk/session/polygon/internal/Region.h @@ -36,7 +36,7 @@ class SMTKPOLYGONSESSION_EXPORT Region { public: FragmentId m_seedFragment; - bool m_seedSense; + bool m_seedSense{ true }; //std::deque > m_boundary; // size_t = fragment id, bool = sense rel to fragment std::set m_innerLoops; diff --git a/smtk/session/polygon/internal/Vertex.h b/smtk/session/polygon/internal/Vertex.h index 08d456dcbc..c3195499ba 100644 --- a/smtk/session/polygon/internal/Vertex.h +++ b/smtk/session/polygon/internal/Vertex.h @@ -40,8 +40,9 @@ public: { Id m_edgeId; // Should never be nullptr Id m_adjacentFace; // Face immediately CW of m_edgeId. May be nullptr. - bool - m_edgeOut; // True when edge points outward from vertex (i.e., edge oriented so beginning vertex is this vertex) + bool m_edgeOut{ + false + }; // True when edge points outward from vertex (i.e., edge oriented so beginning vertex is this vertex) incident_edge_data(Id edgeId, bool isEdgeOut) : m_edgeId(edgeId) @@ -64,10 +65,7 @@ public: , m_edgeOut(other.isEdgeOutgoing()) { } - incident_edge_data() - : m_edgeOut(false) - { - } + incident_edge_data() = default; Id edgeId() const { return m_edgeId; } Id clockwiseFaceId() const { return m_adjacentFace; } @@ -127,15 +125,13 @@ public: protected: friend class pmodel; - vertex() - : m_insideSplit(false) - { - } + vertex() = default; Point m_coords; // position in the plane. incident_edges m_edges; // CCW list of incident edges - bool - m_insideSplit; // Is an edge attached here being split? If so, canInsertEdge will behave differently. + bool m_insideSplit{ + false + }; // Is an edge attached here being split? If so, canInsertEdge will behave differently. // NB: One extension to this structure would be: // Ptr m_prev; // Previous model vertex located at this exact point in the plane diff --git a/smtk/session/polygon/operators/CreateFaces.h b/smtk/session/polygon/operators/CreateFaces.h index 83efb7dada..26a2496c2e 100644 --- a/smtk/session/polygon/operators/CreateFaces.h +++ b/smtk/session/polygon/operators/CreateFaces.h @@ -36,11 +36,7 @@ class Neighborhood; /// An internal structure used when discovering edge loops. struct SMTKPOLYGONSESSION_EXPORT ModelEdgeInfo { - ModelEdgeInfo() - : m_allowedOrientations(0) - { - m_visited[0] = m_visited[1] = false; - } + ModelEdgeInfo() { m_visited[0] = m_visited[1] = false; } ModelEdgeInfo(int allowedOrientations) { m_allowedOrientations = allowedOrientations > 0 ? +1 : allowedOrientations < 0 ? -1 : 0; @@ -53,7 +49,7 @@ struct SMTKPOLYGONSESSION_EXPORT ModelEdgeInfo m_visited[i] = other.m_visited[i]; } - int m_allowedOrientations; // 0: all, -1: only negative, +1: only positive + int m_allowedOrientations{ 0 }; // 0: all, -1: only negative, +1: only positive bool m_visited [2]; // has the [0]: negative, [1]: positive orientation of the edge been visited already? }; diff --git a/smtk/session/polygon/qt/pqArcWidgetPanel.cxx b/smtk/session/polygon/qt/pqArcWidgetPanel.cxx index 1f94c0209f..71703c2971 100644 --- a/smtk/session/polygon/qt/pqArcWidgetPanel.cxx +++ b/smtk/session/polygon/qt/pqArcWidgetPanel.cxx @@ -216,10 +216,7 @@ pqArcWidgetPanel::pqArcWidgetPanel(QWidget* parent) : QWidget(parent) , Internals(new pqArcWidgetPanel::pqInternals) , Picker(parent) - , View(nullptr) - , Arc(nullptr) , ArcWidget(nullptr) - , ArcManager(nullptr) { Internals->setupUi(this); this->setObjectName("pqArcWidgetPanel"); diff --git a/smtk/session/polygon/qt/pqArcWidgetPanel.h b/smtk/session/polygon/qt/pqArcWidgetPanel.h index 2df24df5bb..97c414275d 100644 --- a/smtk/session/polygon/qt/pqArcWidgetPanel.h +++ b/smtk/session/polygon/qt/pqArcWidgetPanel.h @@ -33,14 +33,12 @@ namespace Ui struct PickInfo { - pqOutputPort* port; + pqOutputPort* port{ nullptr }; smtk::common::UUID EdgeId; - vtkIdType BlockIndex; + vtkIdType BlockIndex{ -1 }; PickInfo() - : port(nullptr) - , EdgeId(smtk::common::UUID::null()) - , BlockIndex(-1) + : EdgeId(smtk::common::UUID::null()) { } }; @@ -139,10 +137,10 @@ private: Ui::PickInfo ArcInfo; Ui::ArcPicker Picker; - pqRenderView* View; - pqPolygonArc* Arc; + pqRenderView* View{ nullptr }; + pqPolygonArc* Arc{ nullptr }; QPointer ArcWidget; - pqArcWidgetManager* ArcManager; + pqArcWidgetManager* ArcManager{ nullptr }; }; #endif // __smtk_polygon_pq_ArcWidgetPanel_h diff --git a/smtk/session/polygon/qt/pqSplitEdgeWidget.cxx b/smtk/session/polygon/qt/pqSplitEdgeWidget.cxx index 0c307b23c4..b6d4312071 100644 --- a/smtk/session/polygon/qt/pqSplitEdgeWidget.cxx +++ b/smtk/session/polygon/qt/pqSplitEdgeWidget.cxx @@ -126,7 +126,6 @@ pqSplitEdgeWidget::pqSplitEdgeWidget(QWidget* prent) : QWidget(prent) , Internals(new pqSplitEdgeWidget::pqInternals) , m_edgePointPicker(new pqSplitEdgeWidgetInternals::EdgePointPicker(this)) - , View(nullptr) { this->setObjectName("pqSplitEdgeWidget"); QSizePolicy sizeFixedPolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); diff --git a/smtk/session/polygon/qt/pqSplitEdgeWidget.h b/smtk/session/polygon/qt/pqSplitEdgeWidget.h index ff07e22cf7..840f37ec2c 100644 --- a/smtk/session/polygon/qt/pqSplitEdgeWidget.h +++ b/smtk/session/polygon/qt/pqSplitEdgeWidget.h @@ -77,7 +77,7 @@ private: pqSplitEdgeWidgetInternals::EdgePointPicker* m_edgePointPicker; - pqRenderView* View; + pqRenderView* View{ nullptr }; smtk::weak_ptr m_edgeOp; }; diff --git a/smtk/session/vtk/Session.cxx b/smtk/session/vtk/Session.cxx index 3894212c1b..2f94eedcf4 100644 --- a/smtk/session/vtk/Session.cxx +++ b/smtk/session/vtk/Session.cxx @@ -95,8 +95,7 @@ std::string EntityTypeNameString(EntityType etype) /// Construct an invalid handle. EntityHandle::EntityHandle() - : m_modelNumber(-1) - , m_object(nullptr) + : m_object(nullptr) , m_session(nullptr) { } diff --git a/smtk/session/vtk/Session.h b/smtk/session/vtk/Session.h index 661c44d865..c672725da5 100644 --- a/smtk/session/vtk/Session.h +++ b/smtk/session/vtk/Session.h @@ -65,8 +65,9 @@ SMTKVTKSESSION_EXPORT std::string EntityTypeNameString(EntityType etype); /// A "handle" for a VTK entity (file, block, side set, or node set) struct SMTKVTKSESSION_EXPORT EntityHandle { - int - m_modelNumber; //!< An offset in the vector of models (m_models) owned by the session, whose model owns m_object. + int m_modelNumber{ + -1 + }; //!< An offset in the vector of models (m_models) owned by the session, whose model owns m_object. vtkSmartPointer m_object; //!< The dataset being presented as this entity. SessionPtr m_session; //!< The session owning this entity. diff --git a/smtk/simulation/UserData.cxx b/smtk/simulation/UserData.cxx index c609157dcc..97b84b9599 100644 --- a/smtk/simulation/UserData.cxx +++ b/smtk/simulation/UserData.cxx @@ -18,17 +18,11 @@ UserData::UserData() = default; UserData::~UserData() = default; -UserDataInt::UserDataInt() - : m_value(0) -{ -} +UserDataInt::UserDataInt() = default; UserDataInt::~UserDataInt() = default; -UserDataDouble::UserDataDouble() - : m_value(0.0) -{ -} +UserDataDouble::UserDataDouble() = default; UserDataDouble::~UserDataDouble() = default; diff --git a/smtk/simulation/UserData.h b/smtk/simulation/UserData.h index fde4e2b257..b5dd7a30e2 100644 --- a/smtk/simulation/UserData.h +++ b/smtk/simulation/UserData.h @@ -53,7 +53,7 @@ public: protected: UserDataInt(); - int m_value; + int m_value{ 0 }; }; // User Data Representing Doubles @@ -73,7 +73,7 @@ public: protected: UserDataDouble(); - double m_value; + double m_value{ 0.0 }; }; // User Data Representing Strings diff --git a/smtk/view/AssociationBadge.cxx b/smtk/view/AssociationBadge.cxx index 841eee758b..51d555c7d1 100644 --- a/smtk/view/AssociationBadge.cxx +++ b/smtk/view/AssociationBadge.cxx @@ -32,10 +32,7 @@ namespace smtk namespace view { -AssociationBadge::AssociationBadge() - : m_parent(nullptr) -{ -} +AssociationBadge::AssociationBadge() = default; AssociationBadge::AssociationBadge(BadgeSet& parent, const Configuration::Component& config) : m_parent(&parent) diff --git a/smtk/view/AssociationBadge.h b/smtk/view/AssociationBadge.h index f6502c9956..9b7a617e6b 100644 --- a/smtk/view/AssociationBadge.h +++ b/smtk/view/AssociationBadge.h @@ -77,7 +77,7 @@ protected: bool appliesToObject(const smtk::resource::PersistentObjectPtr& obj) const; std::set unmetRequirements(const smtk::resource::PersistentObjectPtr& obj) const; - const BadgeSet* m_parent; + const BadgeSet* m_parent{ nullptr }; std::string m_applyToResource; std::string m_applyToComponent; std::set m_requiredDefinitions; diff --git a/smtk/view/AvailableOperations.cxx b/smtk/view/AvailableOperations.cxx index f319fe5f01..1dd3d35c83 100644 --- a/smtk/view/AvailableOperations.cxx +++ b/smtk/view/AvailableOperations.cxx @@ -24,11 +24,7 @@ using namespace smtk::view; AvailableOperations::AvailableOperations() - : m_selectionMask(1) - , m_selectionExact(true) - , m_useSelection(true) - , m_workflowFilter(nullptr) - + : m_workflowFilter(nullptr) { // For debugging: #if !defined(NDEBUG) && DEBUG_AVAILABLE_OPERATIONS diff --git a/smtk/view/AvailableOperations.h b/smtk/view/AvailableOperations.h index 116f31ef7e..74d65ee626 100644 --- a/smtk/view/AvailableOperations.h +++ b/smtk/view/AvailableOperations.h @@ -128,9 +128,9 @@ protected: smtk::operation::MetadataObservers::Key m_operationManagerObserverId; SelectionPtr m_selection; SelectionObservers::Key m_selectionObserverId; - int m_selectionMask; - bool m_selectionExact; - bool m_useSelection; + int m_selectionMask{ 1 }; + bool m_selectionExact{ true }; + bool m_useSelection{ true }; OperationFilterSort m_workflowFilter; smtk::workflow::OperationFilterSort::Observers::Key m_workflowFilterObserverId; OperationIndexSet m_workingSet; diff --git a/smtk/view/Badge.h b/smtk/view/Badge.h index 09ba4703fe..9c793d34d8 100644 --- a/smtk/view/Badge.h +++ b/smtk/view/Badge.h @@ -79,10 +79,7 @@ class SMTKCORE_EXPORT Badge : smtkEnableSharedPtr(Badge) { public: smtkTypeMacroBase(Badge); - Badge() - : m_isDefault(false) - { - } + Badge() = default; Badge(const Badge&) = delete; Badge& operator=(const Badge&) = delete; virtual ~Badge() = default; @@ -129,7 +126,7 @@ public: protected: /// Should this badge be invoked by non-specific user gestures when it is applicable? - bool m_isDefault; + bool m_isDefault{ false }; }; } // namespace view } // namespace smtk diff --git a/smtk/view/BadgeSet.h b/smtk/view/BadgeSet.h index 63e3d37b9a..186d8a20f3 100644 --- a/smtk/view/BadgeSet.h +++ b/smtk/view/BadgeSet.h @@ -31,10 +31,7 @@ class SMTKCORE_EXPORT BadgeSet { public: /// Remove this once view::Manager uses the new factory method to construct PhraseModel with arguments. - BadgeSet() - : m_phraseModel(nullptr) - { - } + BadgeSet() = default; /// Construct and configure a set of badges for a view. BadgeSet(const Configuration* viewSpec, const ManagerPtr& manager, PhraseModel* phraseModel) @@ -69,7 +66,7 @@ public: private: std::weak_ptr m_manager; - PhraseModel* m_phraseModel; + PhraseModel* m_phraseModel{ nullptr }; std::vector> m_badges; }; diff --git a/smtk/view/ComponentPhraseContent.cxx b/smtk/view/ComponentPhraseContent.cxx index e03d1a2e0a..3275ae16b7 100644 --- a/smtk/view/ComponentPhraseContent.cxx +++ b/smtk/view/ComponentPhraseContent.cxx @@ -36,10 +36,7 @@ namespace smtk namespace view { -ComponentPhraseContent::ComponentPhraseContent() - : m_mutability(0) -{ -} +ComponentPhraseContent::ComponentPhraseContent() = default; ComponentPhraseContent::~ComponentPhraseContent() = default; diff --git a/smtk/view/ComponentPhraseContent.h b/smtk/view/ComponentPhraseContent.h index 3ed1894642..c486ed13b1 100644 --- a/smtk/view/ComponentPhraseContent.h +++ b/smtk/view/ComponentPhraseContent.h @@ -62,7 +62,7 @@ protected: ComponentPhraseContent(); std::weak_ptr m_component; - int m_mutability; + int m_mutability{ 0 }; }; } // namespace view diff --git a/smtk/view/DescriptivePhrase.cxx b/smtk/view/DescriptivePhrase.cxx index 55118b57d1..14ffad6828 100644 --- a/smtk/view/DescriptivePhrase.cxx +++ b/smtk/view/DescriptivePhrase.cxx @@ -31,8 +31,6 @@ namespace view unsigned int DescriptivePhrase::s_nextPhraseId = 0; DescriptivePhrase::DescriptivePhrase() - : m_type(DescriptivePhraseType::INVALID_DESCRIPTION) - , m_subphrasesBuilt(false) { m_phraseId = DescriptivePhrase::s_nextPhraseId++; } diff --git a/smtk/view/DescriptivePhrase.h b/smtk/view/DescriptivePhrase.h index 8dfcf2a6db..d8263aa69c 100644 --- a/smtk/view/DescriptivePhrase.h +++ b/smtk/view/DescriptivePhrase.h @@ -356,12 +356,12 @@ protected: int visitChildrenInternal(Visitor fn, std::vector& indices); WeakDescriptivePhrasePtr m_parent; - DescriptivePhraseType m_type; + DescriptivePhraseType m_type{ DescriptivePhraseType::INVALID_DESCRIPTION }; SubphraseGeneratorPtr m_delegate; PhraseContentPtr m_content; unsigned int m_phraseId; mutable DescriptivePhrases m_subphrases; - mutable bool m_subphrasesBuilt; + mutable bool m_subphrasesBuilt{ false }; private: static unsigned int s_nextPhraseId; diff --git a/smtk/view/ObjectIconBadge.cxx b/smtk/view/ObjectIconBadge.cxx index dcad956fff..0726035e2b 100644 --- a/smtk/view/ObjectIconBadge.cxx +++ b/smtk/view/ObjectIconBadge.cxx @@ -22,10 +22,7 @@ namespace smtk namespace view { -ObjectIconBadge::ObjectIconBadge() - : m_parent(nullptr) -{ -} +ObjectIconBadge::ObjectIconBadge() = default; ObjectIconBadge::ObjectIconBadge(BadgeSet& parent, const Configuration::Component&) : m_parent(&parent) diff --git a/smtk/view/ObjectIconBadge.h b/smtk/view/ObjectIconBadge.h index 5a477dd37c..036711524a 100644 --- a/smtk/view/ObjectIconBadge.h +++ b/smtk/view/ObjectIconBadge.h @@ -49,7 +49,7 @@ public: // void action(const DescriptivePhrase* phrase) const override { } protected: - const BadgeSet* m_parent; + const BadgeSet* m_parent{ nullptr }; }; } // namespace view } // namespace smtk diff --git a/smtk/view/PhraseListContent.cxx b/smtk/view/PhraseListContent.cxx index b9ee2b0a52..97fa738932 100644 --- a/smtk/view/PhraseListContent.cxx +++ b/smtk/view/PhraseListContent.cxx @@ -20,13 +20,8 @@ namespace smtk namespace view { -PhraseListContent::PhraseListContent() - : m_mutability(0) - , m_commonFlags(smtk::model::INVALID) - , m_unionFlags(0) -{ - // only color is mutable -} +// only color is mutable +PhraseListContent::PhraseListContent() = default; PhraseListContent::Ptr PhraseListContent::setup( DescriptivePhrase::Ptr parent, diff --git a/smtk/view/PhraseListContent.h b/smtk/view/PhraseListContent.h index e4ae454801..b90f5f1748 100644 --- a/smtk/view/PhraseListContent.h +++ b/smtk/view/PhraseListContent.h @@ -132,9 +132,9 @@ protected: std::string generateTitle(smtk::model::BitFlags& flagCommon, smtk::model::BitFlags& flagUnion) const; - int m_mutability; - mutable smtk::model::BitFlags m_commonFlags; - mutable smtk::model::BitFlags m_unionFlags; + int m_mutability{ 0 }; + mutable smtk::model::BitFlags m_commonFlags{ smtk::model::INVALID }; + mutable smtk::model::BitFlags m_unionFlags{ 0 }; mutable std::string m_title; }; diff --git a/smtk/view/PhraseModel.cxx b/smtk/view/PhraseModel.cxx index 676faa5894..a2a0b41268 100644 --- a/smtk/view/PhraseModel.cxx +++ b/smtk/view/PhraseModel.cxx @@ -114,14 +114,12 @@ smtk::operation::ManagerPtr PhraseModel::operationManager() const PhraseModel::PhraseModel() : m_observers(std::bind(notify, std::placeholders::_1, this->root())) - , m_mutableAspects(PhraseContent::EVERYTHING) { } PhraseModel::PhraseModel(const Configuration* config, Manager* manager) : m_observers(std::bind(notify, std::placeholders::_1, this->root())) , m_badges(config, manager->shared_from_this(), this) - , m_mutableAspects(PhraseContent::EVERYTHING) , m_manager(manager->shared_from_this()) { } diff --git a/smtk/view/PhraseModel.h b/smtk/view/PhraseModel.h index a898bc2303..335a2b178d 100644 --- a/smtk/view/PhraseModel.h +++ b/smtk/view/PhraseModel.h @@ -17,6 +17,7 @@ #include "smtk/common/TypeContainer.h" #include "smtk/view/BadgeSet.h" +#include "smtk/view/PhraseContent.h" #include "smtk/view/PhraseModelObserver.h" #include "smtk/view/Selection.h" @@ -273,7 +274,7 @@ protected: BadgeSet m_badges; - int m_mutableAspects; + int m_mutableAspects{ PhraseContent::EVERYTHING }; WeakManagerPtr m_manager; }; diff --git a/smtk/view/ResourcePhraseContent.cxx b/smtk/view/ResourcePhraseContent.cxx index 89d10f2af1..e990a9330f 100644 --- a/smtk/view/ResourcePhraseContent.cxx +++ b/smtk/view/ResourcePhraseContent.cxx @@ -27,10 +27,7 @@ namespace smtk namespace view { -ResourcePhraseContent::ResourcePhraseContent() - : m_mutability(0) -{ -} +ResourcePhraseContent::ResourcePhraseContent() = default; ResourcePhraseContent::~ResourcePhraseContent() = default; diff --git a/smtk/view/ResourcePhraseContent.h b/smtk/view/ResourcePhraseContent.h index 4a47728123..e8206c681b 100644 --- a/smtk/view/ResourcePhraseContent.h +++ b/smtk/view/ResourcePhraseContent.h @@ -64,7 +64,7 @@ protected: ResourcePhraseContent(); std::weak_ptr m_resource; - int m_mutability; + int m_mutability{ 0 }; }; } // namespace view diff --git a/smtk/view/Selection.cxx b/smtk/view/Selection.cxx index bf8a96b0d1..b9be39742d 100644 --- a/smtk/view/Selection.cxx +++ b/smtk/view/Selection.cxx @@ -35,8 +35,7 @@ static bool defaultFilter( static Selection* g_instance = nullptr; Selection::Selection() - : m_defaultAction(SelectionAction::FILTERED_REPLACE) - , m_observers( + : m_observers( [this](Selection::Observer& fn) { fn(g_selectionManagerSource, this->shared_from_this()); }) , m_filter(defaultFilter) { diff --git a/smtk/view/Selection.h b/smtk/view/Selection.h index fee7e5797c..6b82006eea 100644 --- a/smtk/view/Selection.h +++ b/smtk/view/Selection.h @@ -339,7 +339,7 @@ protected: bool bitwise); bool refilter(const std::string& source); - SelectionAction m_defaultAction; + SelectionAction m_defaultAction{ SelectionAction::FILTERED_REPLACE }; //smtk::model::BitFlags m_modelEntityMask; bool m_meshSetMask; std::set m_selectionSources; diff --git a/smtk/view/SelectionPhraseModel.cxx b/smtk/view/SelectionPhraseModel.cxx index f99d45ff9a..c72c4c86d3 100644 --- a/smtk/view/SelectionPhraseModel.cxx +++ b/smtk/view/SelectionPhraseModel.cxx @@ -32,8 +32,6 @@ using namespace smtk::view; SelectionPhraseModel::SelectionPhraseModel() : m_root(DescriptivePhrase::create()) , m_selectionBit(~0) - , m_componentMutability(0) - , m_resourceMutability(0) { // By default, do not show children of selected objects. auto generator = smtk::view::EmptySubphraseGenerator::create(); @@ -44,8 +42,6 @@ SelectionPhraseModel::SelectionPhraseModel(const Configuration* config, Manager* : Superclass(config, manager) , m_root(DescriptivePhrase::create()) , m_selectionBit(~0) - , m_componentMutability(0) - , m_resourceMutability(0) { auto generator = PhraseModel::configureSubphraseGenerator(config, manager); m_root->setDelegate(generator); diff --git a/smtk/view/SelectionPhraseModel.h b/smtk/view/SelectionPhraseModel.h index 3c4976d2cc..79071b8647 100644 --- a/smtk/view/SelectionPhraseModel.h +++ b/smtk/view/SelectionPhraseModel.h @@ -50,8 +50,8 @@ protected: smtk::view::DescriptivePhrasePtr m_root; smtk::view::SelectionPtr m_selection; int m_selectionBit; - int m_componentMutability; - int m_resourceMutability; + int m_componentMutability{ 0 }; + int m_resourceMutability{ 0 }; }; } // namespace view } // namespace smtk -- GitLab From 33fba0d1a8b700b327e508580eda6cce77e5b205 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 19 May 2021 14:04:09 -0400 Subject: [PATCH 007/136] clang-tidy: fix `readability-avoid-const-params-in-decls` lints --- smtk/mesh/core/PointLocator.h | 2 +- smtk/mesh/json/Interface.h | 10 +++++----- smtk/mesh/moab/ModelEntityPointLocator.h | 4 ++-- smtk/model/PointLocatorExtension.h | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/smtk/mesh/core/PointLocator.h b/smtk/mesh/core/PointLocator.h index 9e9273f09d..a6180b7379 100644 --- a/smtk/mesh/core/PointLocator.h +++ b/smtk/mesh/core/PointLocator.h @@ -43,7 +43,7 @@ public: //Based on the backend these points maybe be added to the resource for //duration of the PointLocator PointLocator( - const smtk::mesh::ResourcePtr resource, + smtk::mesh::ResourcePtr resource, std::size_t numPoints, const std::function(std::size_t)>& coordinates); PointLocator( diff --git a/smtk/mesh/json/Interface.h b/smtk/mesh/json/Interface.h index be1d915252..b86226ead2 100644 --- a/smtk/mesh/json/Interface.h +++ b/smtk/mesh/json/Interface.h @@ -280,7 +280,7 @@ public: bool setCellField( const smtk::mesh::HandleRange& meshsets, const smtk::mesh::CellFieldTag& cfTag, - const void* const data) override; + const void* data) override; bool getField( const smtk::mesh::HandleRange& cells, @@ -290,7 +290,7 @@ public: bool setField( const smtk::mesh::HandleRange& cells, const smtk::mesh::CellFieldTag& cfTag, - const void* const data) override; + const void* data) override; std::set computeCellFieldTags( const smtk::mesh::Handle& handle) const override; @@ -325,7 +325,7 @@ public: bool setPointField( const smtk::mesh::HandleRange& meshsets, const smtk::mesh::PointFieldTag& pfTag, - const void* const data) override; + const void* data) override; bool getField( const smtk::mesh::HandleRange& points, @@ -335,7 +335,7 @@ public: bool setField( const smtk::mesh::HandleRange& points, const smtk::mesh::PointFieldTag& pfTag, - const void* const data) override; + const void* data) override; std::set computePointFieldTags( const smtk::mesh::Handle& handle) const override; @@ -380,7 +380,7 @@ private: //with it. If we start adding more member variables, we should offload it //all to an internal class mutable smtk::common::UUID m_associated_model; - mutable bool m_modified; + mutable bool m_modified{ false }; }; } // namespace json } // namespace mesh diff --git a/smtk/mesh/moab/ModelEntityPointLocator.h b/smtk/mesh/moab/ModelEntityPointLocator.h index 06c285ce29..746e2d4873 100644 --- a/smtk/mesh/moab/ModelEntityPointLocator.h +++ b/smtk/mesh/moab/ModelEntityPointLocator.h @@ -43,9 +43,9 @@ public: // https://arxiv.org/abs/0802.2960 bool randomPoint( const smtk::model::EntityRef& entity, - const std::size_t nPoints, + std::size_t nPoints, std::vector& points, - const std::size_t seed) override; + std::size_t seed) override; protected: ModelEntityPointLocator(); diff --git a/smtk/model/PointLocatorExtension.h b/smtk/model/PointLocatorExtension.h index d2ce7a6e45..eb6a0d0104 100644 --- a/smtk/model/PointLocatorExtension.h +++ b/smtk/model/PointLocatorExtension.h @@ -48,7 +48,7 @@ public: const EntityRef& entity, std::size_t nPoints, std::vector& points, - const std::size_t seed) = 0; + std::size_t seed) = 0; /// Same as above, but seeded with a hardware-supplied random integer. bool randomPoint(const EntityRef& entity, std::size_t nPoints, std::vector& points); -- GitLab From 27fdbc6fb1601dec1734c008b76bc3e0abed773b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 19 May 2021 09:19:32 -0400 Subject: [PATCH 008/136] CTestCustom: ignore ParaView generated header warnings --- CMake/CTestCustom.cmake.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMake/CTestCustom.cmake.in b/CMake/CTestCustom.cmake.in index c229655d1c..78809199e9 100644 --- a/CMake/CTestCustom.cmake.in +++ b/CMake/CTestCustom.cmake.in @@ -16,6 +16,9 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION # Ignore warnings from CMake autogen code "autogen" + + # ParaView generated code (paraview/paraview!4957) + "AutoStartImplementation.*modernize-use-nullptr" ) ##------------------------------------------------------------------------------ -- GitLab From 21ed6b67037de2cb46ac6b54684975a836b6d2a2 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 17 May 2021 15:03:41 -0400 Subject: [PATCH 009/136] ci: force clang-tidy to look at in-source headers --- .gitlab/ci/configure_fedora33_tidy.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/ci/configure_fedora33_tidy.cmake b/.gitlab/ci/configure_fedora33_tidy.cmake index e27d5d5250..b069decaf2 100644 --- a/.gitlab/ci/configure_fedora33_tidy.cmake +++ b/.gitlab/ci/configure_fedora33_tidy.cmake @@ -1,4 +1,4 @@ -set(CMAKE_C_CLANG_TIDY "/usr/bin/clang-tidy" CACHE STRING "") -set(CMAKE_CXX_CLANG_TIDY "/usr/bin/clang-tidy" CACHE STRING "") +set(CMAKE_C_CLANG_TIDY "/usr/bin/clang-tidy" "--header-filter=$ENV{CI_PROJECT_DIR}" CACHE STRING "") +set(CMAKE_CXX_CLANG_TIDY "/usr/bin/clang-tidy" "--header-filter=$ENV{CI_PROJECT_DIR}" CACHE STRING "") include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora33.cmake") -- GitLab From 4a2c7104c5a1fb83180405409846d22349682b37 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 20 May 2021 19:03:01 -0400 Subject: [PATCH 010/136] python2: issue a deprecation warning when using Python2 --- CMakeLists.txt | 5 +++++ doc/release/notes/python2-deprecation.rst | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 doc/release/notes/python2-deprecation.rst diff --git a/CMakeLists.txt b/CMakeLists.txt index 969999b894..b4f900a27a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -403,6 +403,11 @@ if(SMTK_ENABLE_PYTHON_WRAPPING) set_property(CACHE SMTK_PYTHON_VERSION PROPERTY STRINGS "2;3") + if (SMTK_PYTHON_VERSION STREQUAL "2") + message(DEPRECATION + "Python2 support is deprecated and will be removed in a future release. " + "Please migrate to a supported version of Python.") + endif () if (SMTK_ENABLE_VTK_SUPPORT OR SMTK_ENABLE_PARAVIEW_SUPPORT) if (NOT SMTK_PYTHON_VERSION STREQUAL VTK_PYTHON_VERSION) message(FATAL_ERROR diff --git a/doc/release/notes/python2-deprecation.rst b/doc/release/notes/python2-deprecation.rst new file mode 100644 index 0000000000..7ea8c737ab --- /dev/null +++ b/doc/release/notes/python2-deprecation.rst @@ -0,0 +1,5 @@ +Deprecate Python 2.x support +============================ + +Python 2.x reached its end of life in January 2020. SMTK has deprecated its +Python 2 support and will remove it in a future release. -- GitLab From c48eb3e3bf327feaf35080d1a91fc7fc43c10855 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 May 2021 13:33:08 -0400 Subject: [PATCH 011/136] new-release: word wrap long lines --- .gitlab/issue_templates/new-release.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.gitlab/issue_templates/new-release.md b/.gitlab/issue_templates/new-release.md index 23022be0fa..4cd8e3dd9f 100644 --- a/.gitlab/issue_templates/new-release.md +++ b/.gitlab/issue_templates/new-release.md @@ -42,10 +42,14 @@ git tag -a -m 'SMTK VERSION' vVERSION HEAD - Make a commit for each of these `release`-only changes - [ ] Update `.gitlab/ci/cdash-groups.json` to track the `release` CDash groups - Create a merge request targeting `release` - - [ ] Obtain a GitLab API token for the `kwrobot.release.cmb` user (ask @ben.boeckel if you do not have one) - - [ ] Add the `kwrobot.release.cmb` user to your fork with at least `Developer` privileges (so it can open MRs) - - [ ] Use [the `release-mr`][release-mr] script to open the create the Merge Request (see script for usage) - - Pull the script for each release; it may have been updated since it was last used + - [ ] Obtain a GitLab API token for the `kwrobot.release.cmb` user (ask + @ben.boeckel if you do not have one) + - [ ] Add the `kwrobot.release.cmb` user to your fork with at least + `Developer` privileges (so it can open MRs) + - [ ] Use [the `release-mr`][release-mr] script to open the create the + Merge Request (see script for usage) + - Pull the script for each release; it may have been updated since it + was last used - [ ] Get positive review - [ ] `Do: merge` - [ ] Push the tag to the main repository @@ -54,9 +58,11 @@ git tag -a -m 'SMTK VERSION' vVERSION HEAD - Software process updates (these can all be done independently) - [ ] Update kwrobot with the new `release` branch rules (@ben.boeckel) - [ ] Run [this script][cdash-update-groups] to update the CDash groups - - This must be done after a nightly run to ensure all builds are in the `release` group + - This must be done after a nightly run to ensure all builds are in the + `release` group - See the script itself for usage documentation - - [ ] Add (or update if `PATCH` is greater than 0) version selection entry in cmb-superbuild + - [ ] Add (or update if `PATCH` is greater than 0) version selection entry + in cmb-superbuild [release-mr]: https://gitlab.kitware.com/utils/release-utils/-/blob/master/release-mr.py [cdash-update-groups]: https://gitlab.kitware.com/utils/cdash-utils/-/blob/master/cdash-update-groups.py -- GitLab From d707b84b06f4b99a641d79795eb5faa67bd6e4a5 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 May 2021 13:31:48 -0400 Subject: [PATCH 012/136] new-release: clarify the commits which go into the versioning topic --- .gitlab/issue_templates/new-release.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitlab/issue_templates/new-release.md b/.gitlab/issue_templates/new-release.md index 4cd8e3dd9f..fa9a3d7968 100644 --- a/.gitlab/issue_templates/new-release.md +++ b/.gitlab/issue_templates/new-release.md @@ -14,9 +14,6 @@ Please remove this comment. # Preparatory steps - Update smtk guides - - Assemble release notes into `doc/release/notes/smtk-MAJOR.MINOR.md`. - - [ ] If `PATCH` is greater than 0, add items to the end of this file. - - [ ] Get positive review and merge. # Update smtk @@ -30,17 +27,23 @@ git fetch origin git checkout master git merge --ff-only origin/master ``` - - [ ] Update `version.txt` and tag the commit + + - Integrate changes. + - Make a commit for each of these `release`-only changes on a single topic + (suggested branch name: `update-to-vVERSION`): + - Assemble release notes into `doc/release/notes/smtk-MAJOR.MINOR.md`. + - [ ] If `PATCH` is greater than 0, add items to the end of this file. + - [ ] Get positive review and merge. + - [ ] Update `version.txt` and tag the commit ``` git checkout -b update-to-vVERSION BRANCHPOINT echo VERSION > version.txt git commit -m 'Update version number to VERSION' version.txt git tag -a -m 'SMTK VERSION' vVERSION HEAD ``` + - [ ] Update `.gitlab/ci/cdash-groups.json` to track the `release` CDash + groups - - Integrate changes. - - Make a commit for each of these `release`-only changes - - [ ] Update `.gitlab/ci/cdash-groups.json` to track the `release` CDash groups - Create a merge request targeting `release` - [ ] Obtain a GitLab API token for the `kwrobot.release.cmb` user (ask @ben.boeckel if you do not have one) -- GitLab From 7f8a4acf279d9ecb28e720024d54f21071e5fe60 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 May 2021 13:33:16 -0400 Subject: [PATCH 013/136] new-release: add a note to verify the MR information before creating it --- .gitlab/issue_templates/new-release.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitlab/issue_templates/new-release.md b/.gitlab/issue_templates/new-release.md index fa9a3d7968..215fe421ee 100644 --- a/.gitlab/issue_templates/new-release.md +++ b/.gitlab/issue_templates/new-release.md @@ -53,6 +53,11 @@ git tag -a -m 'SMTK VERSION' vVERSION HEAD Merge Request (see script for usage) - Pull the script for each release; it may have been updated since it was last used + - The script outputs the information it will be using to create the + merge request. Please verify that it is all correct before creating + the merge request. See usage at the top of the script to provide + information that is either missing or incorrect (e.g., if its data + extraction heuristics fail). - [ ] Get positive review - [ ] `Do: merge` - [ ] Push the tag to the main repository -- GitLab From ee02b157a46230f3275b5f867091765b29eedd51 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 25 May 2021 18:14:44 -0400 Subject: [PATCH 014/136] new-release: move tagging to after the release is merged This avoids problems where a rebase is required during the review. --- .gitlab/issue_templates/new-release.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/issue_templates/new-release.md b/.gitlab/issue_templates/new-release.md index 215fe421ee..4c7f4cc302 100644 --- a/.gitlab/issue_templates/new-release.md +++ b/.gitlab/issue_templates/new-release.md @@ -34,12 +34,11 @@ git merge --ff-only origin/master - Assemble release notes into `doc/release/notes/smtk-MAJOR.MINOR.md`. - [ ] If `PATCH` is greater than 0, add items to the end of this file. - [ ] Get positive review and merge. - - [ ] Update `version.txt` and tag the commit + - [ ] Update `version.txt` and tag the commit (tag this commit below) ``` git checkout -b update-to-vVERSION BRANCHPOINT echo VERSION > version.txt git commit -m 'Update version number to VERSION' version.txt -git tag -a -m 'SMTK VERSION' vVERSION HEAD ``` - [ ] Update `.gitlab/ci/cdash-groups.json` to track the `release` CDash groups @@ -61,6 +60,7 @@ git tag -a -m 'SMTK VERSION' vVERSION HEAD - [ ] Get positive review - [ ] `Do: merge` - [ ] Push the tag to the main repository + - [ ] `git tag -a -m 'SMTK VERSION' vVERSION commit-that-updated-version.txt` - [ ] `git push origin vVERSION` - Software process updates (these can all be done independently) -- GitLab From 579e3b5f99305de82401262fed1b995cc0cfdabe Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 26 May 2021 14:17:16 -0400 Subject: [PATCH 015/136] new-release: update prepatory steps to consider patch releases --- .gitlab/issue_templates/new-release.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.gitlab/issue_templates/new-release.md b/.gitlab/issue_templates/new-release.md index 4c7f4cc302..a7eb62a1df 100644 --- a/.gitlab/issue_templates/new-release.md +++ b/.gitlab/issue_templates/new-release.md @@ -17,15 +17,13 @@ Please remove this comment. # Update smtk -Keep the relevant items for the kind of release this is. - -If making a first release candidate from master, i.e., `PATCH` is 0. - - - [ ] Update `master` branch for **smtk** + - Update the local copy of the base branch. + - If `PATCH` is 0, update `master` + - Otherwise, update `release` ``` git fetch origin -git checkout master -git merge --ff-only origin/master +git checkout $branch +git merge --ff-only origin/$branch # if this fails, there are local commits that need to be removed ``` - Integrate changes. -- GitLab From c12290c29d25070947db3b70d7de5903d87f7adc Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 26 May 2021 14:18:28 -0400 Subject: [PATCH 016/136] new-release: mention the `backport-mrs` script --- .gitlab/issue_templates/new-release.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitlab/issue_templates/new-release.md b/.gitlab/issue_templates/new-release.md index a7eb62a1df..efed0e4b58 100644 --- a/.gitlab/issue_templates/new-release.md +++ b/.gitlab/issue_templates/new-release.md @@ -25,6 +25,11 @@ git fetch origin git checkout $branch git merge --ff-only origin/$branch # if this fails, there are local commits that need to be removed ``` + - If this is not the first release candidate from `master`, i.e., `PATCH` > + 0, ensure merge requests which should be in the release have been merged. + The [`backport-mrs.py`][backport-mrs] script can be used to find and + ensure that merge requests assigned to the associated milestone are + available on the `release` branch. - Integrate changes. - Make a commit for each of these `release`-only changes on a single topic @@ -70,6 +75,7 @@ git commit -m 'Update version number to VERSION' version.txt - [ ] Add (or update if `PATCH` is greater than 0) version selection entry in cmb-superbuild +[backport-mrs]: https://gitlab.kitware.com/utils/release-utils/-/blob/master/backport-mrs.py [release-mr]: https://gitlab.kitware.com/utils/release-utils/-/blob/master/release-mr.py [cdash-update-groups]: https://gitlab.kitware.com/utils/cdash-utils/-/blob/master/cdash-update-groups.py -- GitLab From e9a8ec0bd111e2116282241c1366e11474f2e19b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 May 2021 13:43:43 -0400 Subject: [PATCH 017/136] new-release: make commands to run clearer --- .gitlab/issue_templates/new-release.md | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/.gitlab/issue_templates/new-release.md b/.gitlab/issue_templates/new-release.md index efed0e4b58..dec45344e4 100644 --- a/.gitlab/issue_templates/new-release.md +++ b/.gitlab/issue_templates/new-release.md @@ -20,29 +20,23 @@ Please remove this comment. - Update the local copy of the base branch. - If `PATCH` is 0, update `master` - Otherwise, update `release` -``` -git fetch origin -git checkout $branch -git merge --ff-only origin/$branch # if this fails, there are local commits that need to be removed -``` - - If this is not the first release candidate from `master`, i.e., `PATCH` > - 0, ensure merge requests which should be in the release have been merged. - The [`backport-mrs.py`][backport-mrs] script can be used to find and + - [ ] `git fetch origin` + - [ ] `git checkout $branch` + - [ ] `git merge --ff-only origin/$branch` + - If this fails, there are local commits that need to be removed + - Ensure that changes intended for the release are in it. + - The [`backport-mrs.py`][backport-mrs] script can be used to find and ensure that merge requests assigned to the associated milestone are - available on the `release` branch. - + available on the `release` branch. See its documentation for usage. - Integrate changes. - Make a commit for each of these `release`-only changes on a single topic (suggested branch name: `update-to-vVERSION`): - Assemble release notes into `doc/release/notes/smtk-MAJOR.MINOR.md`. - [ ] If `PATCH` is greater than 0, add items to the end of this file. - - [ ] Get positive review and merge. - [ ] Update `version.txt` and tag the commit (tag this commit below) -``` -git checkout -b update-to-vVERSION BRANCHPOINT -echo VERSION > version.txt -git commit -m 'Update version number to VERSION' version.txt -``` + - [ ] `git checkout -b update-to-vVERSION BRANCHPOINT` + - [ ] `echo VERSION > version.txt` + - [ ] `git commit -m 'Update version number to VERSION' version.txt` - [ ] Update `.gitlab/ci/cdash-groups.json` to track the `release` CDash groups -- GitLab From 0f8134c8f85a432112073bcae58bc61952444fd4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 27 May 2021 15:44:25 -0400 Subject: [PATCH 018/136] ci: remove Python2 testing --- .gitlab-ci.yml | 19 -------- .gitlab/ci/cdash-groups.json | 5 -- .../ci/docker/fedora33-vtk-python2/Dockerfile | 13 ------ .../fedora33-vtk-python2/install_deps.sh | 25 ---------- .../install_superbuild.sh | 46 ------------------- .gitlab/os-linux.yml | 7 --- 6 files changed, 115 deletions(-) delete mode 100644 .gitlab/ci/docker/fedora33-vtk-python2/Dockerfile delete mode 100755 .gitlab/ci/docker/fedora33-vtk-python2/install_deps.sh delete mode 100755 .gitlab/ci/docker/fedora33-vtk-python2/install_superbuild.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 71b511b0f6..052942a26d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -109,25 +109,6 @@ test:fedora33-nodata: needs: - build:fedora33-nodata -build:fedora33-vtk-python2: - extends: - - .fedora33_vtk_python2 - - .cmake_build_linux - - .cmake_build_artifacts - - .linux_builder_tags - - .run_automatically - -test:fedora33-vtk-python2: - extends: - - .fedora33_vtk_python2 - - .cmake_test_linux - - .linux_test_tags - - .run_automatically - dependencies: - - build:fedora33-vtk-python2 - needs: - - build:fedora33-vtk-python2 - ## Lint builds build:fedora33-asan: diff --git a/.gitlab/ci/cdash-groups.json b/.gitlab/ci/cdash-groups.json index 4df0cb4a17..ab19ce7e31 100644 --- a/.gitlab/ci/cdash-groups.json +++ b/.gitlab/ci/cdash-groups.json @@ -35,11 +35,6 @@ "site": "gitlab-ci", "buildname": "fedora33_ubsan" }, - { - "group": "master", - "site": "gitlab-ci", - "buildname": "fedora33_vtk_python2" - }, { "group": "master", "site": "gitlab-ci", diff --git a/.gitlab/ci/docker/fedora33-vtk-python2/Dockerfile b/.gitlab/ci/docker/fedora33-vtk-python2/Dockerfile deleted file mode 100644 index 72102eab4c..0000000000 --- a/.gitlab/ci/docker/fedora33-vtk-python2/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM fedora:33 -MAINTAINER Ben Boeckel - -COPY install_deps.sh /root/install_deps.sh -RUN sh /root/install_deps.sh - -VOLUME /root/helpers -ARG SCCACHE_REDIS - -ARG superbuild_ref=origin/master -ENV SUPERBUILD_PREFIX /root/misc/root/smtk-deps -COPY install_superbuild.sh /root/install_superbuild.sh -RUN sh /root/install_superbuild.sh "$superbuild_ref" diff --git a/.gitlab/ci/docker/fedora33-vtk-python2/install_deps.sh b/.gitlab/ci/docker/fedora33-vtk-python2/install_deps.sh deleted file mode 100755 index be06541b2c..0000000000 --- a/.gitlab/ci/docker/fedora33-vtk-python2/install_deps.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -# Install build requirements. -dnf install -y \ - zlib-devel libcurl-devel python-devel \ - freeglut-devel glew-devel graphviz-devel libpng-devel mesa-dri-drivers \ - libxcb libxcb-devel libXt-devel xcb-util xcb-util-devel mesa-libGL-devel \ - libxkbcommon-devel diffutils hostname file - -# Install development tools -dnf install -y \ - gcc-c++ \ - qt5-qtbase-devel \ - qt5-qtsvg-devel \ - qt5-qttools-devel \ - qt5-qtx11extras-devel \ - qt5-qtxmlpatterns-devel \ - cmake \ - git-core \ - git-lfs \ - ninja-build \ - make \ - chrpath - -dnf clean all diff --git a/.gitlab/ci/docker/fedora33-vtk-python2/install_superbuild.sh b/.gitlab/ci/docker/fedora33-vtk-python2/install_superbuild.sh deleted file mode 100755 index 1973a41cfa..0000000000 --- a/.gitlab/ci/docker/fedora33-vtk-python2/install_superbuild.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -set -e -set -x - -readonly superbuild_ref="$1" -shift - -readonly workdir="/builds/gitlab-kitware-sciviz-ci" -git clone --recursive https://gitlab.kitware.com/cmb/cmb-superbuild.git "$workdir" -git -C "$workdir" checkout "$superbuild_ref" -git -C "$workdir" submodule update --recursive --init -export GIT_CEILING_DIRECTORIES="$workdir" -mkdir -p "$workdir/build" -cd "$workdir/build" - -readonly sccache_mountpoint="/root/helpers/sccache" -sccache_settings="" -if [ -x "$sccache_mountpoint" ]; then - sccache_settings="-DCMAKE_C_COMPILER_LAUNCHER=$sccache_mountpoint -DCMAKE_CXX_COMPILER_LAUNCHER=$sccache_mountpoint" - "$sccache_mountpoint" --start-server - "$sccache_mountpoint" --show-stats -fi -readonly sccache_settings - -cmake -GNinja \ - -DDEVELOPER_MODE_smtk:BOOL=ON \ - -DENABLE_cmb:BOOL=OFF \ - -DENABLE_cmbusersguide:BOOL=OFF \ - -DENABLE_smtkprojectmanager:BOOL=OFF \ - -DENABLE_smtkresourcemanagerstate:BOOL=OFF \ - -DENABLE_vtkonly:BOOL=ON \ - -DENABLE_python2:BOOL=ON \ - -DSUPPRESS_szip_OUTPUT:BOOL=OFF \ - -DUSE_SYSTEM_qt5:BOOL=ON \ - $sccache_settings \ - "-D__BUILDBOT_INSTALL_LOCATION:PATH=$SUPERBUILD_PREFIX" \ - "$workdir" -ninja -cp smtk-developer-config.cmake "$SUPERBUILD_PREFIX" - -if [ -x "$sccache_mountpoint" ]; then - "$sccache_mountpoint" --show-stats -fi - -rm -rf "$workdir" diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index df9000f454..fff8f7aa98 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -77,13 +77,6 @@ variables: CMAKE_CONFIGURATION: fedora33_paraview -.fedora33_vtk_python2: - extends: .fedora33 - image: "kitware/cmb:ci-smtk-fedora33-vtk-python2-20210420" - - variables: - CMAKE_CONFIGURATION: fedora33_vtk_python2 - ## Tags .linux_builder_tags: -- GitLab From 617c78915b83aa22e5f531ce6fe2c943b1b06fb5 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Fri, 28 May 2021 22:19:44 -0400 Subject: [PATCH 019/136] Enable project UI by default --- smtk/project/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smtk/project/CMakeLists.txt b/smtk/project/CMakeLists.txt index 8fde791267..0f8654f73b 100644 --- a/smtk/project/CMakeLists.txt +++ b/smtk/project/CMakeLists.txt @@ -78,7 +78,7 @@ set(projectDependencies ${_projectDependencies} PARENT_SCOPE) smtk_public_headers(smtkCore ${projectHeaders}) cmake_dependent_option( - SMTK_ENABLE_PROJECT_UI "Build plugin with smtk::project UI elements" OFF SMTK_ENABLE_PARAVIEW_SUPPORT OFF) + SMTK_ENABLE_PROJECT_UI "Build plugin with smtk::project UI elements" ON SMTK_ENABLE_PARAVIEW_SUPPORT OFF) mark_as_advanced(SMTK_ENABLE_PROJECT_UI) if(SMTK_ENABLE_PARAVIEW_SUPPORT) -- GitLab From 0534d47d58f3ed0d1292d335cdba2bf51e91dc3a Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Sat, 29 May 2021 10:12:26 -0400 Subject: [PATCH 020/136] Fix bug writing empty project --- smtk/project/json/jsonResourceContainer.cxx | 1 + smtk/project/testing/cxx/CMakeLists.txt | 1 + .../testing/cxx/TestProjectReadWrite3.cxx | 106 ++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 smtk/project/testing/cxx/TestProjectReadWrite3.cxx diff --git a/smtk/project/json/jsonResourceContainer.cxx b/smtk/project/json/jsonResourceContainer.cxx index eb8a4e599f..45caec65d0 100644 --- a/smtk/project/json/jsonResourceContainer.cxx +++ b/smtk/project/json/jsonResourceContainer.cxx @@ -20,6 +20,7 @@ namespace project void to_json(json& j, const ResourceContainer& resourceContainer) { j["types"] = resourceContainer.types(); + j["resources"] = json::array(); for (const auto& resource : resourceContainer.resources()) { j["resources"].push_back(resource); diff --git a/smtk/project/testing/cxx/CMakeLists.txt b/smtk/project/testing/cxx/CMakeLists.txt index 91bb55781e..8a00c9d3fa 100644 --- a/smtk/project/testing/cxx/CMakeLists.txt +++ b/smtk/project/testing/cxx/CMakeLists.txt @@ -10,6 +10,7 @@ set(unit_tests set(unit_tests_which_require_data TestProjectReadWrite TestProjectReadWrite2 + TestProjectReadWrite3 ) set(extra_libs) if (SMTK_ENABLE_VTK_SUPPORT) diff --git a/smtk/project/testing/cxx/TestProjectReadWrite3.cxx b/smtk/project/testing/cxx/TestProjectReadWrite3.cxx new file mode 100644 index 0000000000..0062b19782 --- /dev/null +++ b/smtk/project/testing/cxx/TestProjectReadWrite3.cxx @@ -0,0 +1,106 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#include "smtk/attribute/Attribute.h" +#include "smtk/attribute/FileItem.h" +#include "smtk/attribute/IntItem.h" +#include "smtk/attribute/ResourceItem.h" +#include "smtk/common/testing/cxx/helpers.h" +#include "smtk/operation/Manager.h" +#include "smtk/operation/Operation.h" +#include "smtk/operation/Registrar.h" +#include "smtk/operation/operators/ReadResource.h" +#include "smtk/operation/operators/WriteResource.h" +#include "smtk/project/Manager.h" +#include "smtk/project/Project.h" +#include "smtk/project/Registrar.h" +#include "smtk/resource/Manager.h" + +#include + +// This test verifies that *empty* projects can be serialized to the file system +// and unserialized back. + +namespace +{ +const int OP_SUCCEEDED = static_cast(smtk::operation::Operation::Outcome::SUCCEEDED); + +//SMTK_DATA_DIR is a define setup by cmake +std::string data_root = SMTK_DATA_DIR; +std::string write_root = SMTK_SCRATCH_DIR; + +void cleanup(const std::string& file_path) +{ + //first verify the file exists + ::boost::filesystem::path path(file_path); + if (::boost::filesystem::is_regular_file(path)) + { + //remove the file_path if it exists. + ::boost::filesystem::remove(path); + } +} +} // namespace + +int TestProjectReadWrite3(int /*unused*/, char** const /*unused*/) +{ + // Create smtk managers + smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); + smtk::project::Registrar::registerTo(resourceManager); + + smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); + smtk::operation::Registrar::registerTo(operationManager); + operationManager->registerResourceManager(resourceManager); + + smtk::project::ManagerPtr projectManager = + smtk::project::Manager::create(resourceManager, operationManager); + smtk::project::Registrar::registerTo(projectManager); + projectManager->registerProject("foo"); + + std::string projectLocation = write_root + "/empty-project.smtk"; + + // Create empty project and write it to disk. + { + smtk::project::Project::Ptr project = projectManager->create("foo"); + + smtk::operation::WriteResource::Ptr writeOp = + operationManager->create(); + + auto att = writeOp->parameters(); + bool ok = att->associate(project); // , "failed to associate project to writeOp"); + smtkTest(ok, "failed to associate project to writeOp"); + writeOp->parameters()->findFile("filename")->setIsEnabled(true); + smtkTest( + writeOp->parameters()->findFile("filename")->setValue(projectLocation), + "failed to set filename item"); + + smtk::operation::Operation::Result writeResult = writeOp->operate(); + int writeOutcome = writeResult->findInt("outcome")->value(); + smtkTest(writeOutcome == OP_SUCCEEDED, "failed to write project, outcome " << writeOutcome); + } + + // Read the project back in + { + smtk::operation::ReadResource::Ptr readOp = + operationManager->create(); + readOp->parameters()->findFile("filename")->setValue(projectLocation); + smtk::operation::Operation::Result readResult = readOp->operate(); + int readOutcome = readResult->findInt("outcome")->value(); + smtkTest(readOutcome == OP_SUCCEEDED, "failed to read project, outcome " << readOutcome); + + // Make sure project is there too + auto project = readResult->findResource("resource")->valueAs(); + smtkTest(project != nullptr, "failed to return project"); + smtkTest(project->clean(), "project is marked modified"); + } + + cleanup(projectLocation); + + return 0; +} -- GitLab From 50dba785a8146f2d9b1b0dd659a515deb3f62b19 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Sat, 29 May 2021 10:49:17 -0400 Subject: [PATCH 021/136] Clang tidy updates --- smtk/project/plugin/AutoStart.cxx | 6 +++--- smtk/project/plugin/pqSMTKProjectBrowser.cxx | 4 ++-- smtk/project/plugin/pqSMTKProjectMenu.cxx | 6 +++--- smtk/project/plugin/pqSMTKProjectPanel.cxx | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/smtk/project/plugin/AutoStart.cxx b/smtk/project/plugin/AutoStart.cxx index 4936de3465..87c3003518 100644 --- a/smtk/project/plugin/AutoStart.cxx +++ b/smtk/project/plugin/AutoStart.cxx @@ -61,9 +61,9 @@ AutoStart::~AutoStart() = default; void AutoStart::startup() { #ifdef ENABLE_PROJECT_UI - auto projectMenuMgr = pqSMTKProjectMenu::instance(this); + auto* projectMenuMgr = pqSMTKProjectMenu::instance(this); - auto pqCore = pqApplicationCore::instance(); + auto* pqCore = pqApplicationCore::instance(); if (pqCore) { pqCore->registerManager("smtk project menu", projectMenuMgr); @@ -77,7 +77,7 @@ void AutoStart::startup() void AutoStart::shutdown() { - auto pqCore = pqApplicationCore::instance(); + auto* pqCore = pqApplicationCore::instance(); if (pqCore) { pqCore->unRegisterManager("smtk project menu"); diff --git a/smtk/project/plugin/pqSMTKProjectBrowser.cxx b/smtk/project/plugin/pqSMTKProjectBrowser.cxx index b2b97f089f..e03320b0b6 100644 --- a/smtk/project/plugin/pqSMTKProjectBrowser.cxx +++ b/smtk/project/plugin/pqSMTKProjectBrowser.cxx @@ -85,7 +85,7 @@ pqSMTKProjectBrowser::pqSMTKProjectBrowser(const smtk::view::Information& info) // Ensure the phrase model is configured to listen to the proper managers. // Listen for resources on current connections: - auto smtkBehavior = pqSMTKBehavior::instance(); + auto* smtkBehavior = pqSMTKBehavior::instance(); smtkBehavior->visitResourceManagersOnServers([this](pqSMTKWrapper* r, pqServer* s) { this->sourceAdded(r, s); return false; @@ -143,6 +143,6 @@ void pqSMTKProjectBrowser::sourceRemoved(pqSMTKWrapper* mgr, pqServer* server) void pqSMTKProjectBrowser::updateSettings() { - auto smtkSettings = vtkSMTKSettings::GetInstance(); + auto* smtkSettings = vtkSMTKSettings::GetInstance(); this->setHighlightOnHover(smtkSettings->GetHighlightOnHover()); } diff --git a/smtk/project/plugin/pqSMTKProjectMenu.cxx b/smtk/project/plugin/pqSMTKProjectMenu.cxx index 9628cd4097..47a605365d 100644 --- a/smtk/project/plugin/pqSMTKProjectMenu.cxx +++ b/smtk/project/plugin/pqSMTKProjectMenu.cxx @@ -106,8 +106,8 @@ void pqNewProjectReaction::newProject() if (!typeName.empty()) { - auto pqCore = pqApplicationCore::instance(); - auto builder = pqCore->getObjectBuilder(); + auto* pqCore = pqApplicationCore::instance(); + auto* builder = pqCore->getObjectBuilder(); pqSMTKResource* src = static_cast(builder->createSource("sources", "SMTKResourceCreator", server)); @@ -158,7 +158,7 @@ pqSMTKProjectMenu::pqSMTKProjectMenu(QObject* parent) // Wait until the event loop starts, ensuring that the main window will be // accessible. QTimer::singleShot(10, this, [this]() { - auto pqCore = pqApplicationCore::instance(); + auto* pqCore = pqApplicationCore::instance(); if (pqCore) { QMainWindow* mainWindow = qobject_cast(pqCoreUtilities::mainWidget()); diff --git a/smtk/project/plugin/pqSMTKProjectPanel.cxx b/smtk/project/plugin/pqSMTKProjectPanel.cxx index 3631a16bc3..f1668e4a0f 100644 --- a/smtk/project/plugin/pqSMTKProjectPanel.cxx +++ b/smtk/project/plugin/pqSMTKProjectPanel.cxx @@ -31,7 +31,7 @@ pqSMTKProjectPanel::pqSMTKProjectPanel(QWidget* parent) smtk::view::ConfigurationPtr config = j[0]; this->setView(config); - auto smtkBehavior = pqSMTKBehavior::instance(); + auto* smtkBehavior = pqSMTKBehavior::instance(); // Now listen for future connections. QObject::connect( smtkBehavior, @@ -56,7 +56,7 @@ void pqSMTKProjectPanel::setView(const smtk::view::ConfigurationPtr& view) { m_view = view; - auto smtkBehavior = pqSMTKBehavior::instance(); + auto* smtkBehavior = pqSMTKBehavior::instance(); smtkBehavior->visitResourceManagersOnServers([this](pqSMTKWrapper* r, pqServer* s) { this->sourceAdded(r, s); @@ -93,7 +93,7 @@ void pqSMTKProjectPanel::sourceAdded(pqSMTKWrapper* wrapper, pqServer* server) smtk::extension::ViewInfo resinfo(m_view, this, m_viewUIMgr); // the top-level "Type" in m_view should be pqSMTKProjectBrowser or compatible. - auto baseview = m_viewUIMgr->setSMTKView(resinfo); + auto* baseview = m_viewUIMgr->setSMTKView(resinfo); m_browser = dynamic_cast(baseview); if (!m_browser) { -- GitLab From ddeac15210aa75b01f1bfc929771601222fc6daa Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 1 Jun 2021 10:58:07 -0400 Subject: [PATCH 022/136] graph/Resource: explicitly delete the copy constructor MSVC is still generating this method which then fails because the base class has its copy constructor explicitly deleted. --- smtk/graph/Resource.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/smtk/graph/Resource.h b/smtk/graph/Resource.h index 12e26f5fb2..52d1b44217 100644 --- a/smtk/graph/Resource.h +++ b/smtk/graph/Resource.h @@ -134,6 +134,8 @@ public: return smtk::resource::filter::Filter(filterString); } + Resource(const Resource&) = delete; + protected: Resource(smtk::resource::ManagerPtr manager = nullptr) : Superclass(manager) -- GitLab From 448aed1f26c619e1f00122a75e0961d0e652e9b5 Mon Sep 17 00:00:00 2001 From: Corey Hart Date: Wed, 2 Jun 2021 09:33:59 -0500 Subject: [PATCH 023/136] Wrong delegate used for created objects. Use parent's delegate instead of root's when adding subphrases for created objects. --- smtk/view/SubphraseGenerator.cxx | 28 ++-------------------------- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/smtk/view/SubphraseGenerator.cxx b/smtk/view/SubphraseGenerator.cxx index cd29d8b6d2..d58047283d 100644 --- a/smtk/view/SubphraseGenerator.cxx +++ b/smtk/view/SubphraseGenerator.cxx @@ -219,7 +219,8 @@ void SubphraseGenerator::subphrasesForCreatedObjects( for (const auto& obj : objects) { DescriptivePhrasePtr actualParent(parent); - Path childPath = this->indexOfObjectInParent(obj, actualParent, parentPath); + Path childPath = + actualParent->findDelegate()->indexOfObjectInParent(obj, actualParent, parentPath); if (childPath.empty()) { continue; @@ -248,31 +249,6 @@ void SubphraseGenerator::subphrasesForCreatedObjects( } return 0; // 0 => continue iterating, 1 => skip children of parent, 2 => terminate }); - - smtk::attribute::AttributePtr attr; - smtk::model::EntityPtr ment; - smtk::mesh::ComponentPtr mcmp; - for (const auto& obj : objects) - { - auto comp = obj->as(); - if (!comp) - { - continue; - } - - int rsrcIdx = this->findResourceLocation(comp->resource(), localRoot); - if (rsrcIdx < 0) - { - continue; - } - - Path path{ rsrcIdx, -1 }; - - DescriptivePhrasePtr parent = localRoot->subphrases()[rsrcIdx]; - DescriptivePhrasePtr phr; - } - /* - */ } int SubphraseGenerator::directLimit() const -- GitLab From 93e932e7ccad52dd2a8311d8894631e31bf0bce9 Mon Sep 17 00:00:00 2001 From: Corey Hart Date: Wed, 2 Jun 2021 10:26:56 -0500 Subject: [PATCH 024/136] Adding operation NamingGroup for naming components Added naming operation group and test Register SetMeshName to naming group Make editStringValue use the naming operation group --- smtk/mesh/resource/Registrar.cxx | 4 + smtk/operation/CMakeLists.txt | 2 + smtk/operation/groups/NamingGroup.cxx | 47 ++++ smtk/operation/groups/NamingGroup.h | 92 ++++++++ smtk/operation/testing/cxx/CMakeLists.txt | 1 + .../operation/testing/cxx/unitNamingGroup.cxx | 201 ++++++++++++++++++ smtk/view/ComponentPhraseContent.cxx | 36 ++-- 7 files changed, 362 insertions(+), 21 deletions(-) create mode 100644 smtk/operation/groups/NamingGroup.cxx create mode 100644 smtk/operation/groups/NamingGroup.h create mode 100644 smtk/operation/testing/cxx/unitNamingGroup.cxx diff --git a/smtk/mesh/resource/Registrar.cxx b/smtk/mesh/resource/Registrar.cxx index 2314ba1bbf..fb3da56bc4 100644 --- a/smtk/mesh/resource/Registrar.cxx +++ b/smtk/mesh/resource/Registrar.cxx @@ -41,6 +41,7 @@ #include "smtk/operation/groups/ExporterGroup.h" #include "smtk/operation/groups/ImporterGroup.h" #include "smtk/operation/groups/InternalGroup.h" +#include "smtk/operation/groups/NamingGroup.h" #include "smtk/operation/groups/ReaderGroup.h" #include "smtk/operation/groups/WriterGroup.h" @@ -92,6 +93,9 @@ void Registrar::registerTo(const smtk::operation::Manager::Ptr& operationManager smtk::operation::DeleterGroup(operationManager).registerOperation(); + smtk::operation::NamingGroup(operationManager) + .registerOperation(); + smtk::operation::InternalGroup(operationManager).registerOperation(); } diff --git a/smtk/operation/CMakeLists.txt b/smtk/operation/CMakeLists.txt index 2fa76dad5a..db0d48f386 100644 --- a/smtk/operation/CMakeLists.txt +++ b/smtk/operation/CMakeLists.txt @@ -15,6 +15,7 @@ set(operationSrcs groups/ImporterGroup.cxx groups/InternalGroup.cxx groups/ExporterGroup.cxx + groups/NamingGroup.cxx groups/ReaderGroup.cxx groups/ResourceIOGroup.cxx groups/WriterGroup.cxx @@ -43,6 +44,7 @@ set(operationHeaders groups/ImporterGroup.h groups/InternalGroup.h groups/ExporterGroup.h + groups/NamingGroup.h groups/ReaderGroup.h groups/ResourceIOGroup.h groups/WriterGroup.h diff --git a/smtk/operation/groups/NamingGroup.cxx b/smtk/operation/groups/NamingGroup.cxx new file mode 100644 index 0000000000..651f62c21a --- /dev/null +++ b/smtk/operation/groups/NamingGroup.cxx @@ -0,0 +1,47 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#include "smtk/operation/groups/NamingGroup.h" + +#include "smtk/attribute/Attribute.h" +#include "smtk/attribute/ReferenceItemDefinition.h" + +#include "smtk/operation/Manager.h" +#include "smtk/operation/SpecificationOps.h" + +#include +#include + +namespace smtk +{ +namespace operation +{ + +Operation::Index NamingGroup::matchingOperation(const smtk::resource::PersistentObject& obj) const +{ + Operation::Index index = 0; + std::size_t indexGen = std::numeric_limits::max(); + for (const auto& candidate : this->operations()) + { + std::size_t gen = this->operationObjectDistance(candidate, obj); + if (gen < indexGen) + { + indexGen = gen; + index = candidate; + if (gen == 0) + { // This is the most exact + break; + } + } + } + return index; +} +} // namespace operation +} // namespace smtk diff --git a/smtk/operation/groups/NamingGroup.h b/smtk/operation/groups/NamingGroup.h new file mode 100644 index 0000000000..9a9d15e92c --- /dev/null +++ b/smtk/operation/groups/NamingGroup.h @@ -0,0 +1,92 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#ifndef smtk_operation_NamingGroup_h +#define smtk_operation_NamingGroup_h + +#include "smtk/CoreExports.h" + +#include "smtk/common/TypeName.h" + +#include "smtk/operation/Manager.h" +#include "smtk/operation/Operation.h" + +#include "smtk/operation/groups/ResourceIOGroup.h" + +#include +#include + +namespace smtk +{ +namespace operation +{ +class Manager; + +/**\brief A group that holds operations which can name Component. + * + * All operations added to this group must have a StringItem whose name is "name" and only 1 component association + * + */ +class SMTKCORE_EXPORT NamingGroup : protected Group +{ +public: + static constexpr const char* const type_name = "naming"; + + NamingGroup(std::shared_ptr manager) + : Group(type_name, manager) + { + } + + template + bool registerOperation(); + + using Group::unregisterOperation; + + /// Given an object return an operation that can delete it. + Operation::Index matchingOperation(const smtk::resource::PersistentObject& obj) const; +}; + +template +bool NamingGroup::registerOperation() +{ + auto manager = m_manager.lock(); + if (manager == nullptr) + { + return false; + } + + auto metadata = + manager->metadata().get().find(std::type_index(typeid(OperationType)).hash_code()); + if (metadata == manager->metadata().get().end()) + { + return false; + } + + Operation::Specification spec = specification(metadata->typeName()); + if (spec == nullptr) + { + return false; + } + + Operation::Parameters parameters = extractParameters(spec, metadata->typeName()); + if ( + parameters == nullptr || parameters->findString("name") == nullptr || + parameters->associations() == nullptr || + parameters->associations()->numberOfRequiredValues() != 1) + { + return false; + } + return Group::registerOperation( + std::type_index(typeid(OperationType)).hash_code(), { smtk::common::typeName() }); +} +} // namespace operation +} // namespace smtk + +#endif // smtk_operation_NamingGroup_h diff --git a/smtk/operation/testing/cxx/CMakeLists.txt b/smtk/operation/testing/cxx/CMakeLists.txt index feb0718fca..70eba066f9 100644 --- a/smtk/operation/testing/cxx/CMakeLists.txt +++ b/smtk/operation/testing/cxx/CMakeLists.txt @@ -3,6 +3,7 @@ set(unit_tests TestAvailableOperations TestMutexedOperation unitOperation + unitNamingGroup TestOperationGroup TestOperationLauncher TestRemoveResource diff --git a/smtk/operation/testing/cxx/unitNamingGroup.cxx b/smtk/operation/testing/cxx/unitNamingGroup.cxx new file mode 100644 index 0000000000..27943e5ac5 --- /dev/null +++ b/smtk/operation/testing/cxx/unitNamingGroup.cxx @@ -0,0 +1,201 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#include "smtk/common/testing/cxx/helpers.h" + +#include "smtk/resource/DerivedFrom.h" +#include +#include +#include +#include +#include + +class ResourceA : public smtk::resource::DerivedFrom +{ +public: + smtkTypeMacro(ResourceA); + smtkCreateMacro(ResourceA); + smtkSharedFromThisMacro(smtk::resource::PersistentObject); + + smtk::resource::ComponentPtr find(const smtk::common::UUID& /*compId*/) const override + { + return smtk::resource::ComponentPtr(); + } + + std::function queryOperation( + const std::string& /*unused*/) const override + { + return [](const smtk::resource::Component& /*unused*/) { return true; }; + } + + void visit(smtk::resource::Component::Visitor& /*v*/) const override {} + +protected: + ResourceA() + : smtk::resource::DerivedFrom() + { + } +}; + +class MyComponent : public smtk::resource::Component +{ +public: + smtkTypeMacro(MyComponent); + smtkCreateMacro(MyComponent); + smtkSharedFromThisMacro(smtk::resource::Component); + + const smtk::common::UUID& id() const override { return myId; } + bool setId(const smtk::common::UUID& anId) override + { + myId = anId; + return true; + } + + const smtk::resource::ResourcePtr resource() const override { return myResource; } + void setResource(smtk::resource::Resource::Ptr& r) { myResource = r; } + +private: + smtk::resource::Resource::Ptr myResource; + smtk::common::UUID myId; +}; + +const std::string setNameOp_xml = R"***( + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + )***"; +class SetNameOp : public smtk::operation::XMLOperation +{ +public: + smtkTypeMacro(SetNameOp); + smtkCreateMacro(SetNameOp); + smtkSharedFromThisMacro(smtk::operation::Operation); + + SetNameOp() = default; + ~SetNameOp() override = default; + + Result operateInternal() override { return this->createResult(Outcome::SUCCEEDED); } + + const char* xmlDescription() const override { return setNameOp_xml.c_str(); } +}; + +const std::string nonCompliantOp_xml = R"***( + + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + )***"; + +class NonCompliantOp : public smtk::operation::XMLOperation +{ +public: + smtkTypeMacro(NonCompliantOp); + smtkCreateMacro(NonCompliantOp); + smtkSharedFromThisMacro(smtk::operation::Operation); + + NonCompliantOp() = default; + ~NonCompliantOp() override = default; + + Result operateInternal() override { return this->createResult(Outcome::SUCCEEDED); } + + const char* xmlDescription() const override { return nonCompliantOp_xml.c_str(); } +}; + +int unitNamingGroup(int /*argc*/, char** const /*argv*/) +{ + // Create an operation manager + smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); + + // Register NonCompliantOp to the manager + operationManager->registerOperation("NonCompliantOp"); + operationManager->registerOperation("SetNameOp"); + + // Create a naming group + smtk::operation::NamingGroup namingGroup(operationManager); + + // Register OperationA to the group and test for success + bool success = namingGroup.registerOperation(); + smtkTest(!success, "Registered a non compliant operation to naming group"); + + success = namingGroup.registerOperation(); + smtkTest(success, "Compliant operation should have registered") + + // Check that the operation manager has one available group. This shows up only after first successful operation is registered + auto availableGroups = operationManager->availableGroups(); + smtkTest(availableGroups.size() == 1, "Operation manager should have one available group."); + + // Create a resource manager + smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); + resourceManager->registerResource(); + auto resourceA = resourceManager->create(); + auto component = MyComponent::create(); + auto rsrc = std::static_pointer_cast(resourceA); + component->setResource(rsrc); + + auto index = namingGroup.matchingOperation(*component); + auto op = operationManager->create(index); + smtkTest(op != nullptr, "Should return a SetNameOp"); + smtkTest(op->typeName() == "SetNameOp", "Should return a SetNameOp"); + // Query the operation + return 0; +} diff --git a/smtk/view/ComponentPhraseContent.cxx b/smtk/view/ComponentPhraseContent.cxx index 3275ae16b7..8921f0765b 100644 --- a/smtk/view/ComponentPhraseContent.cxx +++ b/smtk/view/ComponentPhraseContent.cxx @@ -18,6 +18,8 @@ #include "smtk/attribute/IntItem.h" #include "smtk/attribute/StringItem.h" +#include "smtk/graph/Component.h" + #include "smtk/mesh/core/CellSet.h" #include "smtk/mesh/core/Component.h" #include "smtk/mesh/core/MeshSet.h" @@ -27,6 +29,7 @@ #include "smtk/model/EntityRef.h" #include "smtk/operation/Manager.h" +#include "smtk/operation/groups/NamingGroup.h" #include "smtk/operation/operators/SetProperty.h" #include "smtk/resource/Resource.h" @@ -77,8 +80,9 @@ bool ComponentPhraseContent::editable(ContentType contentType) const { auto modelComponent = dynamic_pointer_cast(component); auto meshComponent = dynamic_pointer_cast(component); - // Models and meshes may be assigned a name. - return !!modelComponent || !!meshComponent; + auto graphComponent = dynamic_pointer_cast(component); + // Models, meshes and graphs may be assigned a name. + return !!modelComponent || !!meshComponent || !!graphComponent; } } } @@ -202,30 +206,20 @@ bool ComponentPhraseContent::editStringValue(ContentType contentType, const std: if (contentType == TITLE) { smtk::operation::Operation::Ptr op; - if (auto meshComponent = std::dynamic_pointer_cast(component)) + if (opManager) { - if (opManager) - { - op = opManager->create(); - } - if (!op) + smtk::operation::NamingGroup nameSetter(opManager); + auto index = nameSetter.matchingOperation(*component); + op = opManager->create(index); + if (op) { - op = smtk::mesh::SetMeshName::create(); + op->parameters()->findString("name")->setValue(val); } - - op->parameters()->findString("name")->setValue(val); } - else + if (!op) { - if (opManager) - { - op = opManager->create(); - } - if (!op) - { - op = smtk::operation::SetProperty::create(); - } - + // Todo: Use component setName if no operation provided + op = smtk::operation::SetProperty::create(); op->parameters()->findString("name")->setValue("name"); op->parameters()->findString("string value")->appendValue(val); } -- GitLab From 66398fb422cae13e526d4abaebcc99bbd0fc1e20 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 2 Jun 2021 14:52:52 -0400 Subject: [PATCH 025/136] Do not perform linear searches on insertion if possible. SMTK's model resource provides a way for resources to bypass checks that a relationship between components exists before adding the relationship. The VTK session exposes this option so that operations such as Import can scalably create models with many cells. --- doc/release/notes/model-transcription.rst | 16 ++++++++++++++++ smtk/model/EntityRef.cxx | 5 +++-- smtk/model/EntityRefArrangementOps.cxx | 5 +++-- smtk/model/EntityRefArrangementOps.h | 6 +++++- smtk/session/vtk/Session.cxx | 14 ++++++++++++-- smtk/session/vtk/Session.h | 8 ++++++++ 6 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 doc/release/notes/model-transcription.rst diff --git a/doc/release/notes/model-transcription.rst b/doc/release/notes/model-transcription.rst new file mode 100644 index 0000000000..63353dc967 --- /dev/null +++ b/doc/release/notes/model-transcription.rst @@ -0,0 +1,16 @@ +Model resource transcription +============================ + +SMTK now provides a way to avoid an O(n^2) performance +issue when embedding many cells into a model; +previously, each insertion would perform a linear search +of pre-existing relationships. However, many operations +(especially those in the importer group) will not attempt +to re-insert existing relationships. The ``Model::addCell()`` +and ``EntityRefArrangementOps::addSimpleRelationship()`` +methods now accept a boolean indicating whether to bypass +the linear-time check. + +The VTK session provides a static method, +``Session::setEnableTranscriptionChecks()``, for operations +to enable/disable this behavior during transcription. diff --git a/smtk/model/EntityRef.cxx b/smtk/model/EntityRef.cxx index 021dc14cda..5a6cd3b70f 100644 --- a/smtk/model/EntityRef.cxx +++ b/smtk/model/EntityRef.cxx @@ -1588,8 +1588,9 @@ EntityRef& EntityRef::embedEntity(const EntityRef& thingToEmbed, bool checkExist } else { - EntityRefArrangementOps::addSimpleRelationship(*this, INCLUDES, thingToEmbed); - EntityRefArrangementOps::addSimpleRelationship(thingToEmbed, EMBEDDED_IN, *this); + EntityRefArrangementOps::addSimpleRelationship(*this, INCLUDES, thingToEmbed, checkExistence); + EntityRefArrangementOps::addSimpleRelationship( + thingToEmbed, EMBEDDED_IN, *this, checkExistence); } rsrc->trigger(event, *this, thingToEmbed); } diff --git a/smtk/model/EntityRefArrangementOps.cxx b/smtk/model/EntityRefArrangementOps.cxx index 38104b5d33..fb9937f873 100644 --- a/smtk/model/EntityRefArrangementOps.cxx +++ b/smtk/model/EntityRefArrangementOps.cxx @@ -63,13 +63,14 @@ int EntityRefArrangementOps::findOrAddSimpleRelationship( int EntityRefArrangementOps::addSimpleRelationship( const EntityRef& a, ArrangementKind k, - const EntityRef& b) + const EntityRef& b, + bool find) { int relidx = -1; EntityPtr ent = a.resource()->findEntity(a.entity()); if (ent) { - int offset = ent->findOrAppendRelation(b.entity()); + int offset = find ? ent->findOrAppendRelation(b.entity()) : ent->appendRelation(b.entity()); relidx = a.resource()->arrangeEntity(a.entity(), k, Arrangement::SimpleIndex(offset)); } return relidx; diff --git a/smtk/model/EntityRefArrangementOps.h b/smtk/model/EntityRefArrangementOps.h index 1ef9395193..83ff2d6b6e 100644 --- a/smtk/model/EntityRefArrangementOps.h +++ b/smtk/model/EntityRefArrangementOps.h @@ -26,7 +26,11 @@ class SMTKCORE_EXPORT EntityRefArrangementOps public: static int findSimpleRelationship(const EntityRef& a, ArrangementKind k, const EntityRef& b); static int findOrAddSimpleRelationship(const EntityRef& a, ArrangementKind k, const EntityRef& b); - static int addSimpleRelationship(const EntityRef& a, ArrangementKind k, const EntityRef& b); + static int addSimpleRelationship( + const EntityRef& a, + ArrangementKind k, + const EntityRef& b, + bool find = true); /// Return the first relation of kind \a k as the specified entityref type \a T. template diff --git a/smtk/session/vtk/Session.cxx b/smtk/session/vtk/Session.cxx index 2f94eedcf4..a3ac4d17cb 100644 --- a/smtk/session/vtk/Session.cxx +++ b/smtk/session/vtk/Session.cxx @@ -53,6 +53,8 @@ vtkInformationKeyMacro(Session, SMTK_OUTER_LABEL, Integer); vtkInformationKeyMacro(Session, SMTK_CHILDREN, ObjectBaseVector); vtkInformationKeyMacro(Session, SMTK_LABEL_VALUE, Double); +bool Session::s_transcriptionChecks = true; + enum smtkCellTessRole { SMTK_ROLE_VERTS, @@ -406,15 +408,23 @@ SessionInfoBits Session::transcribeInternal( if (handle.entityType() == EXO_MODEL) { if (childEntityRef.isCellEntity()) - mutableEntityRef.as().addCell(childEntityRef); + { + auto model = mutableEntityRef.as(); + model.addCell(childEntityRef, s_transcriptionChecks); + } else if (childEntityRef.isGroup()) + { mutableEntityRef.as().addGroup(childEntityRef); + } } else { mutableEntityRef.as().addEntity(childEntityRef); if (childEntityRef.isCellEntity()) - mutableEntityRef.owningModel().addCell(childEntityRef); + { + auto model = mutableEntityRef.owningModel(); + model.addCell(childEntityRef, s_transcriptionChecks); + } } } diff --git a/smtk/session/vtk/Session.h b/smtk/session/vtk/Session.h index c672725da5..cef844162d 100644 --- a/smtk/session/vtk/Session.h +++ b/smtk/session/vtk/Session.h @@ -173,6 +173,13 @@ public: size_t numberOfModels() const; + /// Get/set whether adding cells to models during transcription will check for pre-existing + /// entries to avoid adding duplicates. This defaults to true, but some operations such as + /// imports may wish to diable for efficiency (if adding many cells to a model that cannot + /// already be present on the model). + static bool transcriptionChecksEnabled() { return s_transcriptionChecks; } + static void setEnableTranscriptionChecks(bool doCheck) { s_transcriptionChecks = doCheck; } + protected: friend struct EntityHandle; @@ -189,6 +196,7 @@ protected: m_cpMap; // vtkMultiBlockDataSet doesn't provide a fast way to obtain parent of leaf datasets. // std::map m_fwdIdMap; // not needed; store UUID in vtkInformation. // -- 1 -- + static bool s_transcriptionChecks; vtkDataObject* modelOfHandle(const EntityHandle& h) const; vtkDataObject* parent(vtkDataObject* obj) const; -- GitLab From 69f963e0d74551d70b1770f4e8cdd0d85c8ecc9c Mon Sep 17 00:00:00 2001 From: Robert O'Bara Date: Wed, 2 Jun 2021 16:56:41 -0400 Subject: [PATCH 026/136] ENH: Removed old deprecated methods --- doc/release/notes/removedMethods.rst | 18 ++++ doc/release/smtk-21.05.rst | 5 ++ .../implement_an_operator.cxx | 2 +- smtk/attribute/Categories.h | 45 ---------- smtk/attribute/ReferenceItem.cxx | 5 -- smtk/attribute/ReferenceItem.h | 54 ------------ smtk/attribute/pybind11/PybindCategories.h | 8 -- .../python/basicAttributeXMLWriterTest.py | 20 ++--- smtk/attribute/testing/python/categoryTest.py | 12 +-- smtk/view/PhraseModel.cxx | 84 ------------------- smtk/view/PhraseModel.h | 16 +--- 11 files changed, 42 insertions(+), 227 deletions(-) create mode 100644 doc/release/notes/removedMethods.rst diff --git a/doc/release/notes/removedMethods.rst b/doc/release/notes/removedMethods.rst new file mode 100644 index 0000000000..d270f7cec8 --- /dev/null +++ b/doc/release/notes/removedMethods.rst @@ -0,0 +1,18 @@ +Removed Deprecated API +==== +The following deprecated methods have been removed: + +* Categories::Set::mode has been replaced with Categories::Set::inclusionMode +* Categories::Set::setMode has been replaced with Categories::Set::setInclusionMode +* Categories::Set::categoryNames has been replaced with Categories::Set::includedCategoryNames +* Categories::Set::set has been replaced with Categories::Set::setInclusions +* Categories::Set::insert has been replaced with Categories::Set::insertInclusion +* Categories::Set::erase has been replaced with Categories::Set::eraseInclusion +* Categories::Set::size has been replaced with Categories::Set::inclusionSize +* ReferenceItem::objectValue has been replaced with ReferenceItem::value +* ReferenceItem::setObjectValue has been replaced with ReferenceItem::setValue +* ReferenceItem::appendObjectValue has been replaced with ReferenceItem::appendValue +* ReferenceItem::setObjectValues has been replaced with ReferenceItem::setValues +* ReferenceItem::appendObjectValues has been replaced with ReferenceItem::appendValues +* PhraseModel::addSource now accepts const smtk::common::TypeContainer& +* PhraseModel::removeSource now accepts const smtk::common::TypeContainer& diff --git a/doc/release/smtk-21.05.rst b/doc/release/smtk-21.05.rst index 88163dc452..0082fdeb83 100644 --- a/doc/release/smtk-21.05.rst +++ b/doc/release/smtk-21.05.rst @@ -2,6 +2,11 @@ SMTK 21.05 Release Notes ========= +See also `SMTK 21.04 Release Notes`_ for previous changes. + +.. _`SMTK 21.04 Release Notes`: smtk-21.04.md + + Changes to Project Subsystem ------ diff --git a/doc/tutorials/implement_an_operator/implement_an_operator.cxx b/doc/tutorials/implement_an_operator/implement_an_operator.cxx index cb176516a6..97d53c1095 100644 --- a/doc/tutorials/implement_an_operator/implement_an_operator.cxx +++ b/doc/tutorials/implement_an_operator/implement_an_operator.cxx @@ -79,7 +79,7 @@ void testOperation(Model model) auto op = ex::CounterOperation::create(); smtk::attribute::ComponentItemPtr input = op->parameters()->findComponent("model"); - input->setObjectValue(model.component()); + input->setValue(model.component()); test(!!op, "Could not create operator."); test( diff --git a/smtk/attribute/Categories.h b/smtk/attribute/Categories.h index 5cde221dcc..7269841721 100644 --- a/smtk/attribute/Categories.h +++ b/smtk/attribute/Categories.h @@ -127,51 +127,6 @@ public: static std::string combinationModeAsString(Set::CombinationMode mode); static bool combinationModeFromString(const std::string& val, Set::CombinationMode& mode); - // Deprecated Methods - [[deprecated( - "Categories::Set::mode has been replaced with Categories::Set::inclusionMode")]] Set:: - CombinationMode - mode() const - { - return this->inclusionMode(); - } - [[deprecated( - "Categories::Set::setMode has been replaced with Categories::Set::setInclusionMode")]] void - setMode(const Set::CombinationMode& newMode) - { - this->setInclusionMode(newMode); - } - [[deprecated("Categories::Set::categoryNames has been replaced with " - "Categories::Set::includedCategoryNames")]] const std::set& - categoryNames() const - { - return this->includedCategoryNames(); - } - [[deprecated( - "Categories::Set::set has been replaced with Categories::Set::setInclusions")]] void - set(const std::set& values, Set::CombinationMode mode) - { - this->setInclusions(values, mode); - } - [[deprecated( - "Categories::Set::insert has been replaced with Categories::Set::insertInclusion")]] void - insert(const std::string& val) - { - this->insertInclusion(val); - } - [[deprecated( - "Categories::Set::erase has been replaced with Categories::Set::eraseInclusion")]] void - erase(const std::string& val) - { - this->eraseInclusion(val); - } - [[deprecated( - "Categories::Set::size has been replaced with Categories::Set::inclusionSize")]] std::size_t - size() const - { - return this->inclusionSize(); - } - private: Set::CombinationMode m_includeMode{ CombinationMode::Any }, m_excludeMode{ CombinationMode::Any }, m_combinationMode{ CombinationMode::All }; diff --git a/smtk/attribute/ReferenceItem.cxx b/smtk/attribute/ReferenceItem.cxx index 5e3761820c..36dd7cc6f9 100644 --- a/smtk/attribute/ReferenceItem.cxx +++ b/smtk/attribute/ReferenceItem.cxx @@ -449,11 +449,6 @@ bool ReferenceItem::setObjectKey( return false; } -smtk::resource::PersistentObjectPtr ReferenceItem::objectValue(std::size_t i) const -{ - return this->value(i); -} - smtk::resource::PersistentObjectPtr ReferenceItem::value(std::size_t i) const { if (i >= static_cast(m_cache->size())) diff --git a/smtk/attribute/ReferenceItem.h b/smtk/attribute/ReferenceItem.h index c34c286027..29f2e1410b 100644 --- a/smtk/attribute/ReferenceItem.h +++ b/smtk/attribute/ReferenceItem.h @@ -222,13 +222,6 @@ public: { return std::dynamic_pointer_cast(this->value(i)); } - /** Return the \a i-th object stored in this item. - * \deprecated This method will go away in future versions of SMTK - * See instead value(std::size_t) - */ - [[deprecated( - "ReferenceItem::objectValue has been replaced with ReferenceItem::value")]] PersistentObjectPtr - objectValue(std::size_t i = 0) const; virtual bool isValueValid(std::size_t ii, const PersistentObjectPtr& entity) const; bool isValueValid(const PersistentObjectPtr& entity) const @@ -247,59 +240,12 @@ public: * Return the \a i-th object stored in this item. */ bool setValue(std::size_t i, const PersistentObjectPtr& val); - /**\brief Set the component stored with this item. - * - * This always sets the 0-th item and is a convenience method - * for cases where only 1 value is needed. - * \deprecated This method will go away in future versions of SMTK - * See instead setValue() - */ - [[deprecated( - "ReferenceItem::setObjectValue has been replaced with ReferenceItem::setValue")]] bool - setObjectValue(const PersistentObjectPtr& val) - { - return this - setValue(val); - } - /** Set the \a i-th value to the given item. This method does no checking to see if \a i is valid. - * bool setObjectValue(std::size_t i, const PersistentObjectPtr& val); - * Return the \a i-th object stored in this item. - * \deprecated This method will go away in future versions of SMTK - * See instead setValue(std::size_t, const PersistentObjectPtr&) - */ - [[deprecated( - "ReferenceItem::setObjectValue has been replaced with ReferenceItem::setValue")]] bool - setObjectValue(std::size_t i, const PersistentObjectPtr& val) - { - return this->setValue(i, val); - } - [[deprecated( - "ReferenceItem::appendObjectValue has been replaced with ReferenceItem::appendValue")]] bool - appendObjectValue(const PersistentObjectPtr& val) - { - return this->appendValue(val); - } template bool setValues(I vbegin, I vend, typename std::iterator_traits::difference_type offset = 0); template bool appendValues(I vbegin, I vend); - template - [[deprecated( - "ReferenceItem::setObjectValues has been replaced with ReferenceItem::setValues")]] bool - setObjectValues(I vbegin, I vend, typename std::iterator_traits::difference_type offset = 0) - { - return this->setValues(vbegin, vend, offset); - } - - template - [[deprecated( - "ReferenceItem::appendObjectValues has been replaced with ReferenceItem::appendValues")]] bool - appendObjectValues(I vbegin, I vend) - { - return this->appendValues(vbegin, vend); - } - template bool setValuesVia( I vbegin, diff --git a/smtk/attribute/pybind11/PybindCategories.h b/smtk/attribute/pybind11/PybindCategories.h index e7257566da..d7662a7370 100644 --- a/smtk/attribute/pybind11/PybindCategories.h +++ b/smtk/attribute/pybind11/PybindCategories.h @@ -61,14 +61,6 @@ inline py::class_< smtk::attribute::Categories > pybind11_init_smtk_attribute_Ca .def("reset", &smtk::attribute::Categories::Set::reset) .def("passes", (bool (smtk::attribute::Categories::Set::*)(const ::std::set<::std::string>&) const) &smtk::attribute::Categories::Set::passes, py::arg("categories")) .def("passes", (bool (smtk::attribute::Categories::Set::*)(const ::std::string&) const) &smtk::attribute::Categories::Set::passes, py::arg("category")) - - .def("mode", &smtk::attribute::Categories::Set::inclusionMode) - .def("setMode", &smtk::attribute::Categories::Set::setInclusionMode) - .def("categoryNames", &smtk::attribute::Categories::Set::includedCategoryNames) - .def("set", &smtk::attribute::Categories::Set::setInclusions) - .def("insert", &smtk::attribute::Categories::Set::insertInclusion) - .def("erase", &smtk::attribute::Categories::Set::eraseInclusion) - .def("size", &smtk::attribute::Categories::Set::inclusionSize) ; py::enum_(instance, "CombinationMode") .value("Any", smtk::attribute::Categories::Set::CombinationMode::Any) diff --git a/smtk/attribute/testing/python/basicAttributeXMLWriterTest.py b/smtk/attribute/testing/python/basicAttributeXMLWriterTest.py index d4f9825496..625a5c9805 100644 --- a/smtk/attribute/testing/python/basicAttributeXMLWriterTest.py +++ b/smtk/attribute/testing/python/basicAttributeXMLWriterTest.py @@ -85,11 +85,11 @@ if __name__ == '__main__': iitemdef.addDiscreteValue(2, 'Hours') iitemdef.addDiscreteValue(3, 'Days') iitemdef.setDefaultDiscreteIndex(0) - iitemdef.localCategories().insert('Time') + iitemdef.localCategories().insertInclusion('Time') iitemdef = smtk.attribute.IntItemDefinition.New('IntItem2') base.addItemDefinition(iitemdef) iitemdef.setDefaultValue(10) - iitemdef.localCategories().insert('Heat') + iitemdef.localCategories().insertInclusion('Heat') def1 = resource.createDefinition('Derived1', 'BaseDef') def1.setLocalAssociationMask( @@ -98,7 +98,7 @@ if __name__ == '__main__': ditemdef = smtk.attribute.DoubleItemDefinition.New('DoubleItem1') def1.addItemDefinition(ditemdef) # Allow this one to hold an expression - ditemdef.localCategories().insert('Veg') + ditemdef.localCategories().insertInclusion('Veg') ditemdef.setExpressionDefinition(expDef) # Check to make sure we can use expressions if not ditemdef.allowsExpressions(): @@ -109,7 +109,7 @@ if __name__ == '__main__': ditemdef.setDefaultValue(-35.2) ditemdef.setMinRange(-100, True) ditemdef.setMaxRange(125.0, False) - ditemdef.localCategories().insert('Constituent') + ditemdef.localCategories().insertInclusion('Constituent') vdef = smtk.attribute.VoidItemDefinition.New('VoidItem') def1.addItemDefinition(vdef) vdef.setIsOptional(True) @@ -121,18 +121,18 @@ if __name__ == '__main__': sitemdef = smtk.attribute.StringItemDefinition.New('StringItem1') def2.addItemDefinition(sitemdef) sitemdef.setIsMultiline(True) - sitemdef.localCategories().insert('Flow') + sitemdef.localCategories().insertInclusion('Flow') sitemdef = smtk.attribute.StringItemDefinition.New('StringItem2') def2.addItemDefinition(sitemdef) sitemdef.setDefaultValue('Default') - sitemdef.localCategories().insert('General') + sitemdef.localCategories().insertInclusion('General') uitemdef = smtk.attribute.ModelEntityItemDefinition.New('ModelEntityItem1') def2.addItemDefinition(uitemdef) - uitemdef.localCategories().insert('Flow') + uitemdef.localCategories().insertInclusion('Flow') uitemdef.setMembershipMask(int(smtk.model.FACE)) uitemdef = smtk.attribute.ModelEntityItemDefinition.New('ModelEntityItem2') def2.addItemDefinition(uitemdef) - uitemdef.localCategories().insert('General') + uitemdef.localCategories().insertInclusion('General') uitemdef.setMembershipMask( int(smtk.model.GROUP_ENTITY | smtk.model.HOMOGENOUS_GROUP)) dirdef = smtk.attribute.DirectoryItemDefinition.New('DirectoryItem') @@ -151,8 +151,8 @@ if __name__ == '__main__': sitemdef = smtk.attribute.StringItemDefinition.New('GroupString') gdef1.addItemDefinition(sitemdef) sitemdef.setDefaultValue('Something Cool') - sitemdef.localCategories().insert('General') - sitemdef.localCategories().insert('Flow') + sitemdef.localCategories().insertInclusion('General') + sitemdef.localCategories().insertInclusion('Flow') # Add in a Attribute definition with a reference to another attribute attcompdef = resource.createDefinition('AttributeComponentDef') diff --git a/smtk/attribute/testing/python/categoryTest.py b/smtk/attribute/testing/python/categoryTest.py index cb80267c79..c61c630452 100644 --- a/smtk/attribute/testing/python/categoryTest.py +++ b/smtk/attribute/testing/python/categoryTest.py @@ -42,18 +42,18 @@ if __name__ == '__main__': # Lets add some item definitions iitemdef = smtk.attribute.IntItemDefinition.New("IntItem1") base.addItemDefinition(iitemdef) - iitemdef.localCategories().insert("Flow") + iitemdef.localCategories().insertInclusion("Flow") iitemdef = smtk.attribute.IntItemDefinition.New("IntItem2") base.addItemDefinition(iitemdef) iitemdef.setDefaultValue(10) - iitemdef.localCategories().insert("Heat") + iitemdef.localCategories().insertInclusion("Heat") def1 = resource.createDefinition("Derived1", "BaseDef") # Lets add some item definitions ditemdef = smtk.attribute.DoubleItemDefinition.New("DoubleItem1") def1.addItemDefinition(ditemdef) # Allow this one to hold an expression - ditemdef.localCategories().insert("Veg") + ditemdef.localCategories().insertInclusion("Veg") ditemdef.setExpressionDefinition(expDef) # Check to make sure we can use expressions if not ditemdef.allowsExpressions(): @@ -62,17 +62,17 @@ if __name__ == '__main__': ditemdef = smtk.attribute.DoubleItemDefinition.New("DoubleItem2") def1.addItemDefinition(ditemdef) ditemdef.setDefaultValue(-35.2) - ditemdef.localCategories().insert("Constituent") + ditemdef.localCategories().insertInclusion("Constituent") def2 = resource.createDefinition("Derived2", "Derived1") # Lets add some item definitions sitemdef = smtk.attribute.StringItemDefinition.New("StringItem1") def2.addItemDefinition(sitemdef) - sitemdef.localCategories().insert("Flow") + sitemdef.localCategories().insertInclusion("Flow") sitemdef = smtk.attribute.StringItemDefinition.New("StringItem2") def2.addItemDefinition(sitemdef) sitemdef.setDefaultValue("Default") - sitemdef.localCategories().insert("General") + sitemdef.localCategories().insertInclusion("General") # Process Definition Information resource.finalizeDefinitions() diff --git a/smtk/view/PhraseModel.cxx b/smtk/view/PhraseModel.cxx index a2a0b41268..5a6cea6561 100644 --- a/smtk/view/PhraseModel.cxx +++ b/smtk/view/PhraseModel.cxx @@ -196,69 +196,6 @@ std::multimap PhraseModel::configureFilterStrings( return result; } -bool PhraseModel::addSource( - smtk::resource::ManagerPtr rsrcMgr, - smtk::operation::ManagerPtr operMgr, - smtk::view::ManagerPtr viewMgr, - smtk::view::SelectionPtr seln) -{ - for (const auto& source : m_sources) - { - if ( - ((!rsrcMgr && !source.m_managers.contains()) || - (source.m_managers.contains() && - source.m_managers.get() == rsrcMgr)) && - ((!operMgr && !source.m_managers.contains()) || - (source.m_managers.contains() && - source.m_managers.get() == operMgr)) && - ((!viewMgr && !source.m_managers.contains()) || - (source.m_managers.contains() && - source.m_managers.get() == viewMgr)) && - ((!seln && !source.m_managers.contains()) || - (source.m_managers.contains() && - source.m_managers.get() == seln))) - { - return false; // Do not add what we already have - } - } - std::ostringstream description; - description << "PhraseModel " << this << ": "; - auto rsrcHandle = rsrcMgr ? rsrcMgr->observers().insert( - [this](const Resource& rsrc, const resource::EventType& event) { - this->handleResourceEvent(rsrc, event); - return 0; - }, - 0, // assign a neutral priority - true, // observeImmediately - description.str() + "Update phrases when resources change.") - : smtk::resource::Observers::Key(); - auto operHandle = operMgr - ? operMgr->observers().insert( - [this](const Operation& op, operation::EventType event, const Operation::Result& res) { - this->handleOperationEvent(op, event, res); - return 0; - }, - description.str() + "Update phrases based on operation results.") - : smtk::operation::Observers::Key(); - auto selnHandle = seln ? seln->observers().insert( - [this](const std::string& src, smtk::view::SelectionPtr seln) { - this->handleSelectionEvent(src, seln); - }, - 0, // assign a neutral priority - true, // observeImmediately - description.str() + "Update phrases when selection changes.") - : smtk::view::SelectionObservers::Key(); - m_sources.emplace_back( - rsrcMgr, - operMgr, - viewMgr, - seln, - std::move(rsrcHandle), - std::move(operHandle), - std::move(selnHandle)); - return true; -} - bool PhraseModel::addSource(const smtk::common::TypeContainer& managers) { const auto& rsrcMgr = @@ -325,27 +262,6 @@ bool PhraseModel::addSource(const smtk::common::TypeContainer& managers) return true; } -bool PhraseModel::removeSource( - smtk::resource::ManagerPtr rsrcMgr, - smtk::operation::ManagerPtr operMgr, - smtk::view::ManagerPtr viewMgr, - smtk::view::SelectionPtr seln) -{ - for (auto it = m_sources.begin(); it != m_sources.end(); ++it) - { - if ( - it->m_managers.get() == rsrcMgr && - it->m_managers.get() == operMgr && - it->m_managers.get() == viewMgr && - it->m_managers.get() == seln) - { - m_sources.erase(it); - return true; - } - } - return false; -} - bool PhraseModel::removeSource(const smtk::common::TypeContainer& managers) { const auto& rsrcMgr = diff --git a/smtk/view/PhraseModel.h b/smtk/view/PhraseModel.h index 335a2b178d..7f3cb5af3d 100644 --- a/smtk/view/PhraseModel.h +++ b/smtk/view/PhraseModel.h @@ -98,21 +98,9 @@ public: * the phrase hierarcy as required. */ ///@{ - /// Indicate a resource and operation manager that should be monitored for changes. - [[deprecated("PhraseModel::addSource now accepts const smtk::common::TypeContainer&")]] bool - addSource( - smtk::resource::ManagerPtr rsrcMgr, - smtk::operation::ManagerPtr operMgr, - smtk::view::ManagerPtr viewMgr, - smtk::view::SelectionPtr seln); + /// Indicate the managers that should be monitored for changes. virtual bool addSource(const smtk::common::TypeContainer& managers); - /// Indicate a resource and operation manager that should no longer be monitored for changes. - [[deprecated("PhraseModel::removeSource now accepts const smtk::common::TypeContainer&")]] bool - removeSource( - smtk::resource::ManagerPtr rsrcMgr, - smtk::operation::ManagerPtr operMgr, - smtk::view::ManagerPtr viewMgr, - smtk::view::SelectionPtr seln); + /// Indicate managers that should no longer be monitored for changes. virtual bool removeSource(const smtk::common::TypeContainer& managers); /// Stop listening for changes from all sources. virtual bool resetSources(); -- GitLab From c1e57b0279419c8a79595a426b108e3fc6447e4f Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Wed, 2 Jun 2021 17:15:51 -0400 Subject: [PATCH 027/136] Rename test for clarity --- .../{TestProjectReadWrite3.cxx => TestProjectReadWriteEmpty.cxx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename smtk/project/testing/cxx/{TestProjectReadWrite3.cxx => TestProjectReadWriteEmpty.cxx} (100%) diff --git a/smtk/project/testing/cxx/TestProjectReadWrite3.cxx b/smtk/project/testing/cxx/TestProjectReadWriteEmpty.cxx similarity index 100% rename from smtk/project/testing/cxx/TestProjectReadWrite3.cxx rename to smtk/project/testing/cxx/TestProjectReadWriteEmpty.cxx -- GitLab From 16d4f2bf1d620d08eb29f11c5836c175e7593310 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Wed, 2 Jun 2021 17:17:55 -0400 Subject: [PATCH 028/136] Update to use renamed test --- smtk/project/testing/cxx/CMakeLists.txt | 2 +- smtk/project/testing/cxx/TestProjectReadWriteEmpty.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/smtk/project/testing/cxx/CMakeLists.txt b/smtk/project/testing/cxx/CMakeLists.txt index 8a00c9d3fa..48a42e8044 100644 --- a/smtk/project/testing/cxx/CMakeLists.txt +++ b/smtk/project/testing/cxx/CMakeLists.txt @@ -10,7 +10,7 @@ set(unit_tests set(unit_tests_which_require_data TestProjectReadWrite TestProjectReadWrite2 - TestProjectReadWrite3 + TestProjectReadWriteEmpty ) set(extra_libs) if (SMTK_ENABLE_VTK_SUPPORT) diff --git a/smtk/project/testing/cxx/TestProjectReadWriteEmpty.cxx b/smtk/project/testing/cxx/TestProjectReadWriteEmpty.cxx index 0062b19782..1bb3402262 100644 --- a/smtk/project/testing/cxx/TestProjectReadWriteEmpty.cxx +++ b/smtk/project/testing/cxx/TestProjectReadWriteEmpty.cxx @@ -48,7 +48,7 @@ void cleanup(const std::string& file_path) } } // namespace -int TestProjectReadWrite3(int /*unused*/, char** const /*unused*/) +int TestProjectReadWriteEmpty(int /*unused*/, char** const /*unused*/) { // Create smtk managers smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); -- GitLab From a1e01d6146507f7ab5967830a9d4ebf3d42896ac Mon Sep 17 00:00:00 2001 From: Corey Hart Date: Thu, 3 Jun 2021 10:24:06 -0500 Subject: [PATCH 029/136] Prevent race condition in attribute panel Prevent race conditon in attribute panel when multiple attribute resources are being created or read in that leads to a crash. --- .../paraview/appcomponents/pqSMTKAttributePanel.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.cxx b/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.cxx index 490e2ce365..821063539f 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.cxx +++ b/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.cxx @@ -55,10 +55,14 @@ pqSMTKAttributePanel::pqSMTKAttributePanel(QWidget* parent) &pqActiveObjects::instance(), SIGNAL(sourceChanged(pqPipelineSource*)), this, - SLOT(displayPipelineSource(pqPipelineSource*))); + SLOT(displayPipelineSource(pqPipelineSource*)), + Qt::QueuedConnection); QObject::connect( - &pqActiveObjects::instance(), SIGNAL(dataUpdated()), this, SLOT(updatePipeline())); - + &pqActiveObjects::instance(), + SIGNAL(dataUpdated()), + this, + SLOT(updatePipeline()), + Qt::QueuedConnection); auto* pqCore = pqApplicationCore::instance(); if (pqCore) { -- GitLab From ec7c56e033ed2787b59c51871cdeccb4a554ff14 Mon Sep 17 00:00:00 2001 From: Corey Hart Date: Thu, 3 Jun 2021 10:46:16 -0500 Subject: [PATCH 030/136] Fix crash when creating a UUID with an empty string Calling this constructor with an empty string caused a crash. Now we check the state of the input string and if it is not empty we generate a UUID. --- smtk/common/UUID.cxx | 9 +++++++-- smtk/common/testing/cxx/unitUUID.cxx | 9 ++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/smtk/common/UUID.cxx b/smtk/common/UUID.cxx index 414771223e..a971a17b1f 100644 --- a/smtk/common/UUID.cxx +++ b/smtk/common/UUID.cxx @@ -46,10 +46,15 @@ UUID::UUID(const_iterator inBegin, const_iterator inEnd) } /// Construct a UUID from a text string (36 characters long, including hyphens). +/// The UUID stays in its default state of nil if the input string is empty. UUID::UUID(const std::string& txt) + : m_data() { - boost::uuids::string_generator sgen; - m_data = sgen(txt); + if (!txt.empty()) + { + boost::uuids::string_generator sgen; + m_data = sgen(txt); + } } /// Construct a UUID from a boost UUID object. diff --git a/smtk/common/testing/cxx/unitUUID.cxx b/smtk/common/testing/cxx/unitUUID.cxx index 54a072a966..4295e88e5d 100644 --- a/smtk/common/testing/cxx/unitUUID.cxx +++ b/smtk/common/testing/cxx/unitUUID.cxx @@ -31,7 +31,14 @@ int main(int argc, char* argv[]) UUID fromRaw(data, data + 16); // String constructor - UUID fromStr("a3d75703-fc9b-4d99-a104-ee67cf6d11b9"); + std::string str = "a3d75703-fc9b-4d99-a104-ee67cf6d11b9"; + UUID fromStr(str); + test(fromStr.toString() == str, "String constructor must match its string input"); + + str = ""; + UUID fromEmptyStr(str); + test( + fromEmptyStr.isNull(), "String constructor with empty string as input must create a null UUID"); // Try the << operator std::ostringstream os; -- GitLab From 5ce2c0546ff2a7a3b3afb7c96ebaaa5e4056744e Mon Sep 17 00:00:00 2001 From: Corey Hart Date: Thu, 3 Jun 2021 11:05:31 -0500 Subject: [PATCH 031/136] Creating configs fails for nonexclusive analysis If the analysis model that the processor is working with does not have top level exclusive set to true it just exists. --- smtk/io/XmlDocV3Parser.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/smtk/io/XmlDocV3Parser.cxx b/smtk/io/XmlDocV3Parser.cxx index 0d6a68e811..cb02c51141 100644 --- a/smtk/io/XmlDocV3Parser.cxx +++ b/smtk/io/XmlDocV3Parser.cxx @@ -1164,15 +1164,15 @@ void XmlDocV3Parser::processConfigurations(pugi::xml_node& configurationsNode) break; } } - else if (!setAnalysisConfigurationHelper(configAtt, analysisNode, m_logger)) - { - smtkErrorMacro( - m_logger, - "Encountered problem constructing configuration: " << configAtt->name() - << " - configuration not built"); - m_resource->removeAttribute(configAtt); - break; - } + } + else if (!setAnalysisConfigurationHelper(configAtt, analysisNode, m_logger)) + { + smtkErrorMacro( + m_logger, + "Encountered problem constructing configuration: " << configAtt->name() + << " - configuration not built"); + m_resource->removeAttribute(configAtt); + break; } } } -- GitLab From ec6bc1025f40d180ae168f5d294675a8f9989eb7 Mon Sep 17 00:00:00 2001 From: Robert O'Bara Date: Fri, 4 Jun 2021 09:57:33 -0400 Subject: [PATCH 032/136] DOC: Updating ReadMe to refer to 21.05 release notes --- ReadMe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReadMe.md b/ReadMe.md index 0928744fcf..5383954b5c 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -62,7 +62,7 @@ See [CONTRIBUTING.md][] for instructions to contribute. Latest Release Notes ==================== -Can be found [here](doc/release/smtk-3.3.md). +Can be found [here](doc/release/smtk-21.05.rst). License ======= -- GitLab From 41ae210e83ebfa2c3add9457b7f530a0ff61c47f Mon Sep 17 00:00:00 2001 From: Corey Hart Date: Thu, 3 Jun 2021 12:09:39 -0500 Subject: [PATCH 033/136] Filter advance attribute definitions Filter advance attribute definitions from the attribute view. This enables the attribute view not to display itself if all of the defitions should be hiddent from the user (advanced) --- .../filter-advance-attribute-definitions.rst | 7 +++++ smtk/extension/qt/qtAttributeView.cxx | 26 +++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 doc/release/notes/filter-advance-attribute-definitions.rst diff --git a/doc/release/notes/filter-advance-attribute-definitions.rst b/doc/release/notes/filter-advance-attribute-definitions.rst new file mode 100644 index 0000000000..7f7fe5c777 --- /dev/null +++ b/doc/release/notes/filter-advance-attribute-definitions.rst @@ -0,0 +1,7 @@ +Filter advance attribute definitions +==================================== + +Attribute views will now hide any attribute definitions +that have an advance level that is higher than the user's +active advance level. This enables the Attribute View to hide +itself if all its definitions should be hidden from the user. diff --git a/smtk/extension/qt/qtAttributeView.cxx b/smtk/extension/qt/qtAttributeView.cxx index bcc3ee1577..d5ab4a78af 100644 --- a/smtk/extension/qt/qtAttributeView.cxx +++ b/smtk/extension/qt/qtAttributeView.cxx @@ -83,6 +83,22 @@ class qtAttributeViewInternals public: ~qtAttributeViewInternals() { delete this->CurrentAtt; } + // Return a list of defs from the input that pass the advance read level check + QList removeAdvancedDefs( + smtk::extension::qtUIManager* uiManager, + const QList& defs) const + { + QList allVisibleDefs; + for (const auto& def : defs) + { + if (uiManager->passAdvancedCheck(def->advanceLevel())) + { + allVisibleDefs.append(def); + } + } + return allVisibleDefs; + } + // Return a list of definitions based on the current settings // of the UI Manager and whether the View is to ignore // categories @@ -92,14 +108,14 @@ public: { if (ignoreCategories) { - return this->AllDefs; + return removeAdvancedDefs(uiManager, this->AllDefs); } auto attResource = uiManager->attResource(); if (!(attResource && attResource->activeCategoriesEnabled())) { // There are no active categories - return everything - return this->AllDefs; + return removeAdvancedDefs(uiManager, this->AllDefs); } if (attResource->activeCategories().size() == 1) @@ -107,9 +123,9 @@ public: std::string theCategory = *(attResource->activeCategories().begin()); if (this->AttDefMap.keys().contains(theCategory.c_str())) { - return this->AttDefMap[theCategory.c_str()]; + return removeAdvancedDefs(uiManager, this->AttDefMap[theCategory.c_str()]); } - return this->AllDefs; + return removeAdvancedDefs(uiManager, this->AllDefs); } QList defs; @@ -120,7 +136,7 @@ public: defs.push_back(attDef); } } - return defs; + return removeAdvancedDefs(uiManager, defs); } QTableView* ListTable; -- GitLab From 22af44ee74c4c557bb24f2e5e101d257b3fe4d55 Mon Sep 17 00:00:00 2001 From: Corey Hart Date: Thu, 3 Jun 2021 15:37:18 -0500 Subject: [PATCH 034/136] Ability to cache active tab attribute Ability to cache the active attribute in the attribute view, the active tab, and the active advance level. --- .../notes/cache-attribute-resource-views.rst | 13 ++++++++++ smtk/extension/qt/qtAttributeView.cxx | 26 ++++++++++++++++++- smtk/extension/qt/qtGroupView.cxx | 16 +++++++----- smtk/extension/qt/qtUIManager.cxx | 23 +++++----------- smtk/extension/qt/qtUIManager.h | 6 ++--- 5 files changed, 56 insertions(+), 28 deletions(-) create mode 100644 doc/release/notes/cache-attribute-resource-views.rst diff --git a/doc/release/notes/cache-attribute-resource-views.rst b/doc/release/notes/cache-attribute-resource-views.rst new file mode 100644 index 0000000000..6d1210b050 --- /dev/null +++ b/doc/release/notes/cache-attribute-resource-views.rst @@ -0,0 +1,13 @@ +Preserve State Information +========================== + +SMTK will now preserve state information that pertains to +Attribute Resource views. The information persists even +after the resource has been closed, assuming the resource +was saved before it was closed. + +Information Preserved: + +- The active advance level. +- The active attributes in attribute views. +- The active tab in a group views. diff --git a/smtk/extension/qt/qtAttributeView.cxx b/smtk/extension/qt/qtAttributeView.cxx index bcc3ee1577..92130f73ca 100644 --- a/smtk/extension/qt/qtAttributeView.cxx +++ b/smtk/extension/qt/qtAttributeView.cxx @@ -154,6 +154,7 @@ public: //Last selected attribute WeakAttributePtr selectedAttribute; + const std::string m_activeAttributeViewAttName = "ActiveAttribute"; // Model for filtering the attribute by combobox. QPointer checkableAttComboModel; @@ -637,6 +638,8 @@ void qtAttributeView::onListBoxSelectionChanged() if (dataItem) { + this->getObject()->details().setAttribute( + m_internals->m_activeAttributeViewAttName, dataItem->id().toString()); this->updateAssociationEnableState(dataItem); this->updateTableWithAttribute(dataItem); emit attributeSelected(dataItem); @@ -1027,7 +1030,28 @@ void qtAttributeView::onViewBy() if (m_internals->ListTableModel->rowCount() && !this->getSelectedItem()) { // so switch tabs would not reset selection - if (!m_internals->AssociationsWidget->hasSelectedItem()) + // get the active tab from the view config if it exists + std::string activeAttUuid = ""; + this->getObject()->details().attribute( + m_internals->m_activeAttributeViewAttName, activeAttUuid); + smtk::attribute::ConstAttributePtr activeAtt = + this->uiManager()->attResource()->findAttribute(smtk::common::UUID(activeAttUuid)); + + if (activeAtt) + { + auto items = this->m_internals->ListTableModel->findItems( + activeAtt->name().c_str(), Qt::MatchExactly, name_column); + if (!items.empty()) + { + auto activeItem = items.at(0); + // Select the newly created attribute + m_internals->ListTable->selectRow(activeItem->row()); + QModelIndex index = activeItem->index(); + QModelIndex mappedIndex = m_internals->ListTableProxyModel->mapFromSource(index); + m_internals->ListTable->setCurrentIndex(mappedIndex); + } + } + else if (!m_internals->AssociationsWidget->hasSelectedItem()) { // In this case there was no previous selection so lets select the // first attribute diff --git a/smtk/extension/qt/qtGroupView.cxx b/smtk/extension/qt/qtGroupView.cxx index b2d25898e3..4d34086fec 100644 --- a/smtk/extension/qt/qtGroupView.cxx +++ b/smtk/extension/qt/qtGroupView.cxx @@ -60,6 +60,7 @@ public: QTabWidget::TabPosition m_tabPosition{ QTabWidget::East }; std::string m_savedViewName; QIcon m_alertIcon; + const std::string m_activeTabViewAttNamee = "ActiveTab"; }; void qtGroupViewInternals::updateChildren(qtGroupView* gview, qtBaseViewMemFn mfunc) @@ -95,7 +96,8 @@ void qtGroupViewInternals::updateChildren(qtGroupView* gview, qtBaseViewMemFn mf } tabWidget->blockSignals(true); tabWidget->clear(); - std::string lastSavedViewName = gview->uiManager()->activeTabInfo(gview->getObject()->name()); + std::string lastSavedViewName = ""; + gview->getObject()->details().attribute(m_activeTabViewAttNamee, lastSavedViewName); m_TabbedViews.clear(); m_currentTabSelected = -1; int i, size = m_ChildViews.size(); @@ -204,13 +206,14 @@ void qtGroupView::updateCurrentTab(int ithTab) if (ithTab == -1) { //Clear the active tab info since nothing is selected - this->uiManager()->setActiveTabInfo(this->getObject()->name(), ""); + this->getObject()->details().setAttribute(m_internals->m_activeTabViewAttNamee, ""); return; } qtBaseView* currView = this->getChildView(ithTab); if (currView) { - this->uiManager()->setActiveTabInfo(this->getObject()->name(), currView->getObject()->name()); + this->getObject()->details().setAttribute( + m_internals->m_activeTabViewAttNamee, currView->getObject()->name()); currView->updateUI(); } } @@ -254,7 +257,8 @@ void qtGroupView::createWidget() QTabWidget* tab = new QTabWidget(this->parentWidget()); // If we have previously created a widget for this view // lets get the name of the last selected tab View name - m_internals->m_savedViewName = this->uiManager()->activeTabInfo(this->getObject()->name()); + this->getObject()->details().attribute( + m_internals->m_activeTabViewAttNamee, m_internals->m_savedViewName); tab->setUsesScrollButtons(true); this->Widget = tab; } @@ -321,9 +325,9 @@ void qtGroupView::createWidget() qtBaseView* currView = this->getChildView(m_internals->m_currentTabSelected); if (currView) { - this->uiManager()->setActiveTabInfo( - this->getObject()->name(), currView->getObject()->name()); m_internals->m_savedViewName = currView->getObject()->name(); + this->getObject()->details().setAttribute( + m_internals->m_activeTabViewAttNamee, m_internals->m_savedViewName); } } QObject::connect(tabWidget, &QTabWidget::currentChanged, this, &qtGroupView::updateCurrentTab); diff --git a/smtk/extension/qt/qtUIManager.cxx b/smtk/extension/qt/qtUIManager.cxx index 5e774c0dde..f2ae607ac4 100644 --- a/smtk/extension/qt/qtUIManager.cxx +++ b/smtk/extension/qt/qtUIManager.cxx @@ -232,6 +232,11 @@ void qtUIManager::initializeUI(QWidget* pWidget, bool useInternalFileBrowser) } if (m_topView) { + if (m_topView->getObject()->details().attribute(m_activeAdvLevelXmlAttName)) + { + m_topView->getObject()->details().attributeAsInt( + m_activeAdvLevelXmlAttName, m_currentAdvLevel); + } if (m_currentAdvLevel) // only build advanced level when needed) { m_topView->showAdvanceLevel(m_currentAdvLevel); @@ -442,6 +447,7 @@ void qtUIManager::setAdvanceLevel(int b) if (m_topView) { m_topView->showAdvanceLevel(b); + m_topView->getObject()->details().setAttribute(m_activeAdvLevelXmlAttName, std::to_string(b)); } } @@ -1132,23 +1138,6 @@ qtItem* qtUIManager::defaultItemConstructor(const qtAttributeItemInfo& info) return aItem; } -void qtUIManager::setActiveTabInfo( - const std::string& groupViewName, - const std::string& activeTabName) -{ - m_activeTabInfo[groupViewName] = activeTabName; -} - -std::string qtUIManager::activeTabInfo(const std::string& groupViewName) const -{ - auto it = m_activeTabInfo.find(groupViewName); - if (it == m_activeTabInfo.end()) - { - return ""; - } - return it->second; -} - void qtUIManager::setHighlightOnHover(bool val) { if (val == m_highlightOnHover) diff --git a/smtk/extension/qt/qtUIManager.h b/smtk/extension/qt/qtUIManager.h index 114a117b96..137d7098b0 100644 --- a/smtk/extension/qt/qtUIManager.h +++ b/smtk/extension/qt/qtUIManager.h @@ -259,10 +259,6 @@ public: int hoverBit() const { return m_hoverBit; } void setHoverBit(int val) { m_hoverBit = val; } - ///methods for saving/retrieving the active tab in a group view - void setActiveTabInfo(const std::string& groupViewName, const std::string& activeTabName); - std::string activeTabInfo(const std::string& groupViewName) const; - bool highlightOnHover() const { return m_highlightOnHover; } void setHighlightOnHover(bool val); @@ -361,6 +357,8 @@ private: std::map m_activeTabInfo; QPixmap m_alertPixmap; + const std::string m_activeAdvLevelXmlAttName = "ActiveAdvanceLevel"; + }; // class //A sublcass of QTextEdit to give initial sizehint -- GitLab From 272989b8b226bd28a88e829490a3ec688f9ad5b3 Mon Sep 17 00:00:00 2001 From: Ryan Krattiger Date: Tue, 18 May 2021 16:10:51 -0500 Subject: [PATCH 035/136] Allow project roles to be non-unique Add new API smtk::project::ResourceContainer::findByRole - Returns a set of Resources with a given role Deprecates old API smtk::project::ResourceContainer::getByRole - Behavior is fist Resource in set if the role exists, otherwise nullptr. This is consistent with the previous API. --- smtk/project/ResourceContainer.cxx | 37 +++++--- smtk/project/ResourceContainer.h | 87 +++++++++++++++---- smtk/project/json/jsonResourceContainer.cxx | 2 +- .../pybind11/PybindResourceContainer.h | 6 +- smtk/project/view/SubphraseGenerator.cxx | 2 +- 5 files changed, 102 insertions(+), 32 deletions(-) diff --git a/smtk/project/ResourceContainer.cxx b/smtk/project/ResourceContainer.cxx index 50dda442b9..faea200e71 100644 --- a/smtk/project/ResourceContainer.cxx +++ b/smtk/project/ResourceContainer.cxx @@ -220,34 +220,45 @@ smtk::resource::ConstResourcePtr ResourceContainer::get(const std::string& url) return smtk::resource::ConstResourcePtr(); } -smtk::resource::ResourcePtr ResourceContainer::getByRole(const std::string& role) +std::set ResourceContainer::findByRole(const std::string& role) { - // No type casting is required, so we simply find and return the resource by - // key. + std::set resource_set; + + // Get the resources by role typedef Container::index::type ResourcesByRole; ResourcesByRole& resources = m_resources.get(); ResourcesByRole::iterator resourceIt = resources.find(role); - if (resourceIt != resources.end()) + for (; resourceIt != resources.end(); ++resourceIt) { - return *resourceIt; + if (detail::role(*resourceIt) != role) + { + break; + } + resource_set.insert(*resourceIt); } - return smtk::resource::ResourcePtr(); + return resource_set; } -smtk::resource::ConstResourcePtr ResourceContainer::getByRole(const std::string& role) const +std::set ResourceContainer::findByRole( + const std::string& role) const { - // No type casting is required, so we simply find and return the resource by - // key. + std::set resource_set; + + // Get the resources by role typedef Container::index::type ResourcesByRole; const ResourcesByRole& resources = m_resources.get(); - ResourcesByRole::const_iterator resourceIt = resources.find(role); - if (resourceIt != resources.end()) + ResourcesByRole::iterator resourceIt = resources.find(role); + for (; resourceIt != resources.end(); ++resourceIt) { - return *resourceIt; + if (detail::role(*resourceIt) != role) + { + break; + } + resource_set.insert(*resourceIt); } - return smtk::resource::ConstResourcePtr(); + return resource_set; } std::set ResourceContainer::find(const std::string& typeName) const diff --git a/smtk/project/ResourceContainer.h b/smtk/project/ResourceContainer.h index 616988b913..66616b752d 100644 --- a/smtk/project/ResourceContainer.h +++ b/smtk/project/ResourceContainer.h @@ -67,7 +67,7 @@ public: const smtk::resource::ResourcePtr&, const std::string&, &smtk::resource::detail::location>>, - boost::multi_index::ordered_unique< + boost::multi_index::ordered_non_unique< boost::multi_index::tag, boost::multi_index::global_fun< const smtk::resource::ResourcePtr&, @@ -75,6 +75,9 @@ public: &smtk::project::detail::role>>>> Container; + using iterator = typename Container::iterator; + using const_iterator = typename Container::const_iterator; + /// A property key for accessing string-valued roles assigned to a resource /// held by a project. static constexpr const char* const role_name = "project_role"; @@ -118,12 +121,55 @@ public: /// Returns the resource that relates to the given role. If no association /// exists this will return a null pointer - smtk::resource::ResourcePtr getByRole(const std::string&); - smtk::resource::ConstResourcePtr getByRole(const std::string&) const; + [[deprecated("New API is findByRole and returns a std::set")]] smtk::resource::ResourcePtr + getByRole(const std::string& role) + { + auto resource_set = this->findByRole(role); + if (resource_set.empty()) + { + return smtk::resource::ResourcePtr(nullptr); + } + else + { + return *(resource_set.begin()); + } + } + + [[deprecated("New API is findByRole and returns a std::set")]] smtk::resource::ConstResourcePtr + getByRole(const std::string& role) const + { + auto resource_set = this->findByRole(role); + if (resource_set.empty()) + { + return smtk::resource::ConstResourcePtr(nullptr); + } + else + { + return *(resource_set.begin()); + } + } + + template + [[deprecated("New API is findByRole and returns a std::set")]] smtk::shared_ptr + getByRole(const std::string& role) + { + return std::dynamic_pointer_cast(this->getByRole(role)); + } + + template + [[deprecated( + "New API is findByRole and returns a std::set")]] smtk::shared_ptr + getByRole(const std::string& role) const + { + return std::dynamic_pointer_cast(this->getByRole(role)); + } + + std::set findByRole(const std::string&); + std::set findByRole(const std::string&) const; template - smtk::shared_ptr getByRole(const std::string&); + std::set> findByRole(const std::string&); template - smtk::shared_ptr getByRole(const std::string&) const; + std::set> findByRole(const std::string&) const; /// Returns a set of resources that have a given typename, type index or class /// type. @@ -152,17 +198,17 @@ public: const std::set& types() const { return m_types; } std::set& types() { return m_types; } - const Container& resources() const { return m_resources; } - Container& resources() { return m_resources; } + //const Container& resources() const { return m_resources; } + //Container& resources() { return m_resources; } std::shared_ptr manager() const { return m_manager.lock(); } void setManager(const std::weak_ptr& manager) { m_manager = manager; } - Container::const_iterator begin() const { return m_resources.begin(); } - Container::iterator begin() { return m_resources.begin(); } + const_iterator begin() const { return m_resources.begin(); } + iterator begin() { return m_resources.begin(); } - Container::const_iterator end() const { return m_resources.end(); } - Container::iterator end() { return m_resources.end(); } + const_iterator end() const { return m_resources.end(); } + iterator end() { return m_resources.end(); } bool empty() const { return m_resources.empty(); } std::size_t size() const { return m_resources.size(); } @@ -215,15 +261,26 @@ smtk::shared_ptr ResourceContainer::get(const std::string& u } template -smtk::shared_ptr ResourceContainer::getByRole(const std::string& role) +std::set> ResourceContainer::findByRole(const std::string& role) { - return smtk::static_pointer_cast(this->getByRole(role)); + std::set> cast_set; + for (auto resourceptr : this->findByRole(role)) + { + cast_set.insert(smtk::dynamic_pointer_cast(resourceptr)); + } + return cast_set; } template -smtk::shared_ptr ResourceContainer::getByRole(const std::string& role) const +std::set> ResourceContainer::findByRole( + const std::string& role) const { - return smtk::static_pointer_cast(this->getByRole(role)); + std::set> cast_set; + for (auto resourceptr : this->findByRole(role)) + { + cast_set.insert(smtk::dynamic_pointer_cast(resourceptr)); + } + return cast_set; } template diff --git a/smtk/project/json/jsonResourceContainer.cxx b/smtk/project/json/jsonResourceContainer.cxx index 45caec65d0..031a660061 100644 --- a/smtk/project/json/jsonResourceContainer.cxx +++ b/smtk/project/json/jsonResourceContainer.cxx @@ -21,7 +21,7 @@ void to_json(json& j, const ResourceContainer& resourceContainer) { j["types"] = resourceContainer.types(); j["resources"] = json::array(); - for (const auto& resource : resourceContainer.resources()) + for (const auto& resource : resourceContainer) { j["resources"].push_back(resource); } diff --git a/smtk/project/pybind11/PybindResourceContainer.h b/smtk/project/pybind11/PybindResourceContainer.h index 8f64840055..f2f9abccce 100644 --- a/smtk/project/pybind11/PybindResourceContainer.h +++ b/smtk/project/pybind11/PybindResourceContainer.h @@ -48,6 +48,8 @@ inline py::class_< smtk::project::ResourceContainer > pybind11_init_smtk_project .def("get", (smtk::resource::ConstResourcePtr (smtk::project::ResourceContainer::*)(::smtk::common::UUID const &) const) &smtk::project::ResourceContainer::get, py::arg("id")) .def("get", (smtk::resource::ResourcePtr (smtk::project::ResourceContainer::*)(::std::string const &)) &smtk::project::ResourceContainer::get, py::arg("arg0")) .def("get", (smtk::resource::ConstResourcePtr (smtk::project::ResourceContainer::*)(::std::string const &) const) &smtk::project::ResourceContainer::get, py::arg("arg0")) + .def("findByRole", (std::set (smtk::project::ResourceContainer::*)(::std::string const &)) &smtk::project::ResourceContainer::findByRole, py::arg("arg0")) + .def("findByRole", (std::set (smtk::project::ResourceContainer::*)(::std::string const &) const) &smtk::project::ResourceContainer::findByRole, py::arg("arg0")) .def("getByRole", (smtk::resource::ResourcePtr (smtk::project::ResourceContainer::*)(::std::string const &)) &smtk::project::ResourceContainer::getByRole, py::arg("arg0")) .def("getByRole", (smtk::resource::ConstResourcePtr (smtk::project::ResourceContainer::*)(::std::string const &) const) &smtk::project::ResourceContainer::getByRole, py::arg("arg0")) .def("manager", &smtk::project::ResourceContainer::manager) @@ -55,8 +57,8 @@ inline py::class_< smtk::project::ResourceContainer > pybind11_init_smtk_project .def("registerResource", (bool (smtk::project::ResourceContainer::*)(::smtk::resource::Resource::Index const &)) &smtk::project::ResourceContainer::registerResource, py::arg("arg0")) .def("registerResources", &smtk::project::ResourceContainer::registerResources, py::arg("arg0")) .def("remove", &smtk::project::ResourceContainer::remove, py::arg("arg0")) - .def("resources", (smtk::project::ResourceContainer::Container const & (smtk::project::ResourceContainer::*)() const) &smtk::project::ResourceContainer::resources) - .def("resources", (smtk::project::ResourceContainer::Container & (smtk::project::ResourceContainer::*)()) &smtk::project::ResourceContainer::resources) + //.def("resources", (smtk::project::ResourceContainer::Container const & (smtk::project::ResourceContainer::*)() const) &smtk::project::ResourceContainer::resources) + //.def("resources", (smtk::project::ResourceContainer::Container & (smtk::project::ResourceContainer::*)()) &smtk::project::ResourceContainer::resources) .def("setManager", &smtk::project::ResourceContainer::setManager, py::arg("manager")) .def("size", &smtk::project::ResourceContainer::size) .def("types", (std::set, std::less >, std::allocator > > const & (smtk::project::ResourceContainer::*)() const) &smtk::project::ResourceContainer::types) diff --git a/smtk/project/view/SubphraseGenerator.cxx b/smtk/project/view/SubphraseGenerator.cxx index 41da89af8b..19188d308e 100644 --- a/smtk/project/view/SubphraseGenerator.cxx +++ b/smtk/project/view/SubphraseGenerator.cxx @@ -53,7 +53,7 @@ void SubphraseGenerator::childrenOfProject( smtk::view::DescriptivePhrases& result) { constexpr int mutability = static_cast(smtk::view::PhraseContent::ContentType::TITLE); - for (const auto& resource : project->resources().resources()) + for (const auto& resource : project->resources()) { result.push_back(smtk::project::view::PhraseContent::createPhrase(resource, mutability, src)); } -- GitLab From 67afe01242e833e2b8ef11faa5eab2617fc4ee22 Mon Sep 17 00:00:00 2001 From: Ryan Krattiger Date: Tue, 8 Jun 2021 16:23:26 -0500 Subject: [PATCH 036/136] Include UUID in project resource file name --- smtk/project/operators/Write.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smtk/project/operators/Write.cxx b/smtk/project/operators/Write.cxx index 5fe995bbe5..56fc974bd1 100644 --- a/smtk/project/operators/Write.cxx +++ b/smtk/project/operators/Write.cxx @@ -100,7 +100,7 @@ Write::Result Write::operateInternal() if (resource->location().empty()) { - std::string filename = role + ".smtk"; + std::string filename = role + "-" + resource->id().toString() + ".smtk"; boost::filesystem::path location = resourcesFolderPath / filename; resource->setLocation(location.string()); } -- GitLab From 5f9d9a8f3a4ccd59ed6dd15a4ebe788395f08b2c Mon Sep 17 00:00:00 2001 From: Ryan Krattiger Date: Wed, 19 May 2021 16:39:11 -0500 Subject: [PATCH 037/136] Add deprecation macros for 21.06 Update ResourceContainer deprecations to use SMTK_DEPRECATED_IN_21_6 macro Update *_Deprecated tests to set the SMTK_DEPRECATION_LEVEL to 21.05 to disable warnings for tests using old APIs --- smtk/common/Deprecation.h | 65 ++++++++++++++++++++++++++++++++ smtk/common/VersionMacros.h | 20 ++++++++++ smtk/project/ResourceContainer.h | 21 +++++------ 3 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 smtk/common/Deprecation.h create mode 100644 smtk/common/VersionMacros.h diff --git a/smtk/common/Deprecation.h b/smtk/common/Deprecation.h new file mode 100644 index 0000000000..7a4f138dc1 --- /dev/null +++ b/smtk/common/Deprecation.h @@ -0,0 +1,65 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#ifndef smtk_common_Deprecation_h +#define smtk_common_Deprecation_h + +#include "smtk/common/VersionMacros.h" + +// The level at which warnings should be made. +#ifndef SMTK_DEPRECATION_LEVEL +// SMTK defaults to deprecation of its current version. +#define SMTK_DEPRECATION_LEVEL SMTK_VERSION_NUMBER +#endif + +// API deprecated before 21.4 have already been removed. +#define SMTK_MINIMUM_DEPRECATION_LEVEL SMTK_VERSION_CHECK(21, 4) + +// Force the deprecation level to be at least that of SMTK's build +// configuration. +#if SMTK_DEPRECATION_LEVEL < SMTK_MINIMUM_DEPRECATION_LEVEL +#undef SMTK_DEPRECATION_LEVEL +#define SMTK_DEPRECATION_LEVEL SMTK_MINIMUM_DEPRECATION_LEVEL +#endif + +#if 0 && __cplusplus >= 201402L +// This is currently hard-disabled because compilers do not mix C++ attributes +// and `__attribute__` extensions together well. +#define SMTK_DEPRECATION_II(reason) [[deprecated(reason)]] +#else +#if defined(_WIN32) || defined(_WIN64) +#define SMTK_DEPRECATION(reason) __declspec(deprecated(reason)) +#elif defined(__clang__) +#if __has_extension(attribute_deprecated_with_message) +#define SMTK_DEPRECATION(reason) __attribute__((__deprecated__(reason))) +#else +#define SMTK_DEPRECATION(reason) __attribute__((__deprecated__)) +#endif +#elif defined(__GNUC__) +#if (__GNUC__ >= 5) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) +#define SMTK_DEPRECATION(reason) __attribute__((__deprecated__(reason))) +#else +#define SMTK_DEPRECATION(reason) __attribute__((__deprecated__)) +#endif +#else +#define SMTK_DEPRECATION(reason) +#endif +#endif + +#define SMTK_DEPRECATION_REASON(version_major, version_minor, reason) \ + ("SMTK Deprecated in " #version_major "." #version_minor ": " #reason) + +#if SMTK_DEPRECATION_LEVEL >= SMTK_VERSION_CHECK(21, 6) +#define SMTK_DEPRECATED_IN_21_06(reason) SMTK_DEPRECATION(SMTK_DEPRECATION_REASON(21, 6, reason)) +#else +#define SMTK_DEPRECATED_IN_21_06(reason) +#endif + +#endif // smtk_common_Deprecation_h diff --git a/smtk/common/VersionMacros.h b/smtk/common/VersionMacros.h new file mode 100644 index 0000000000..503f5605fa --- /dev/null +++ b/smtk/common/VersionMacros.h @@ -0,0 +1,20 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#ifndef smtk_common_VersionMacros_h +#define smtk_common_VersionMacros_h + +#include "smtk/common/Version.h" + +#define SMTK_VERSION_CHECK(major, minor) (100ULL * major + minor) + +#define SMTK_VERSION_NUMBER SMTK_VERSION_CHECK(SMTK_VERSION_MAJOR, SMTK_VERSION_MINOR) + +#endif // smtk_common_VersionMacros_h diff --git a/smtk/project/ResourceContainer.h b/smtk/project/ResourceContainer.h index 66616b752d..6ba69471dc 100644 --- a/smtk/project/ResourceContainer.h +++ b/smtk/project/ResourceContainer.h @@ -14,6 +14,7 @@ #include "smtk/CoreExports.h" #include "smtk/PublicPointerDefs.h" +#include "smtk/common/Deprecation.h" #include "smtk/common/TypeName.h" #include "smtk/project/Tags.h" @@ -121,8 +122,8 @@ public: /// Returns the resource that relates to the given role. If no association /// exists this will return a null pointer - [[deprecated("New API is findByRole and returns a std::set")]] smtk::resource::ResourcePtr - getByRole(const std::string& role) + SMTK_DEPRECATED_IN_21_06("New API is findByRole and returns a std::set") + smtk::resource::ResourcePtr getByRole(const std::string& role) { auto resource_set = this->findByRole(role); if (resource_set.empty()) @@ -135,8 +136,8 @@ public: } } - [[deprecated("New API is findByRole and returns a std::set")]] smtk::resource::ConstResourcePtr - getByRole(const std::string& role) const + SMTK_DEPRECATED_IN_21_06("New API is findByRole and returns a std::set") + smtk::resource::ConstResourcePtr getByRole(const std::string& role) const { auto resource_set = this->findByRole(role); if (resource_set.empty()) @@ -150,16 +151,15 @@ public: } template - [[deprecated("New API is findByRole and returns a std::set")]] smtk::shared_ptr - getByRole(const std::string& role) + SMTK_DEPRECATED_IN_21_06("New API is findByRole and returns a std::set") + smtk::shared_ptr getByRole(const std::string& role) { return std::dynamic_pointer_cast(this->getByRole(role)); } template - [[deprecated( - "New API is findByRole and returns a std::set")]] smtk::shared_ptr - getByRole(const std::string& role) const + SMTK_DEPRECATED_IN_21_06("New API is findByRole and returns a std::set") + smtk::shared_ptr getByRole(const std::string& role) const { return std::dynamic_pointer_cast(this->getByRole(role)); } @@ -198,9 +198,6 @@ public: const std::set& types() const { return m_types; } std::set& types() { return m_types; } - //const Container& resources() const { return m_resources; } - //Container& resources() { return m_resources; } - std::shared_ptr manager() const { return m_manager.lock(); } void setManager(const std::weak_ptr& manager) { m_manager = manager; } -- GitLab From a373e5dbad68ece3e7db1dd22d3b24765eaaa9e7 Mon Sep 17 00:00:00 2001 From: Ryan Krattiger Date: Wed, 19 May 2021 15:47:20 -0500 Subject: [PATCH 038/136] Update tests to use ResourceContainer::findByRole Rename old tests that test the deprecated smtk::project::ResourceContainer::getByRole that assumes unique project roles. Update tests to use the new smtk::project::ResourceContainer::findByRole that assumes non-unique project roles. --- smtk/project/testing/cxx/CMakeLists.txt | 3 + .../testing/cxx/TestProjectLifeCycle.cxx | 6 +- .../cxx/TestProjectLifeCycle_Deprecated.cxx | 186 ++++++++++ .../testing/cxx/TestProjectReadWrite.cxx | 70 +++- .../testing/cxx/TestProjectReadWrite2.cxx | 25 +- .../cxx/TestProjectReadWrite2_Deprecated.cxx | 320 ++++++++++++++++++ .../cxx/TestProjectReadWrite_Deprecated.cxx | 261 ++++++++++++++ 7 files changed, 850 insertions(+), 21 deletions(-) create mode 100644 smtk/project/testing/cxx/TestProjectLifeCycle_Deprecated.cxx create mode 100644 smtk/project/testing/cxx/TestProjectReadWrite2_Deprecated.cxx create mode 100644 smtk/project/testing/cxx/TestProjectReadWrite_Deprecated.cxx diff --git a/smtk/project/testing/cxx/CMakeLists.txt b/smtk/project/testing/cxx/CMakeLists.txt index 48a42e8044..cc788d2e1b 100644 --- a/smtk/project/testing/cxx/CMakeLists.txt +++ b/smtk/project/testing/cxx/CMakeLists.txt @@ -5,11 +5,14 @@ set(unit_tests TestProject TestProjectAssociation TestProjectLifeCycle + TestProjectLifeCycle_Deprecated TestProjectResources ) set(unit_tests_which_require_data TestProjectReadWrite + TestProjectReadWrite_Deprecated TestProjectReadWrite2 + TestProjectReadWrite2_Deprecated TestProjectReadWriteEmpty ) set(extra_libs) diff --git a/smtk/project/testing/cxx/TestProjectLifeCycle.cxx b/smtk/project/testing/cxx/TestProjectLifeCycle.cxx index d003a154a5..a5cfc241b2 100644 --- a/smtk/project/testing/cxx/TestProjectLifeCycle.cxx +++ b/smtk/project/testing/cxx/TestProjectLifeCycle.cxx @@ -166,8 +166,8 @@ int TestProjectLifeCycle(int /*unused*/, char** const /*unused*/) smtkTest(res == nullptr, "resource manager contains project") smtkTest(resManager->size() == 1, "resource manager size not 1"); - auto attRes = project->resources().getByRole(ATT_ROLE_NAME); - smtkTest(attRes != nullptr, "project missing attribute resource"); + auto attRes = project->resources().findByRole(ATT_ROLE_NAME); + smtkTest(!attRes.empty(), "project missing attribute resource with role: " << ATT_ROLE_NAME); // Release the project, check that resource manager unchanged std::cout << "Removing project" << std::endl; @@ -175,7 +175,7 @@ int TestProjectLifeCycle(int /*unused*/, char** const /*unused*/) smtkTest(resManager->size() == 1, "resource manager size not 1"); // And remove the attribute resource - resManager->remove(attRes); + resManager->remove(*(attRes.begin())); smtkTest(resManager->empty(), "resource manager not empty"); } diff --git a/smtk/project/testing/cxx/TestProjectLifeCycle_Deprecated.cxx b/smtk/project/testing/cxx/TestProjectLifeCycle_Deprecated.cxx new file mode 100644 index 0000000000..0743644d01 --- /dev/null +++ b/smtk/project/testing/cxx/TestProjectLifeCycle_Deprecated.cxx @@ -0,0 +1,186 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#define SMTK_DEPRECATION_LEVEL 2105 + +#include "smtk/attribute/Attribute.h" +#include "smtk/attribute/IntItem.h" +#include "smtk/attribute/Registrar.h" +#include "smtk/attribute/Resource.h" +#include "smtk/attribute/ResourceItem.h" +#include "smtk/io/AttributeReader.h" +#include "smtk/io/Logger.h" +#include "smtk/operation/Manager.h" +#include "smtk/operation/Operation.h" +#include "smtk/operation/XMLOperation.h" +#include "smtk/project/Manager.h" +#include "smtk/project/Project.h" +#include "smtk/project/Registrar.h" +#include "smtk/project/operators/Create.h" + +#include "smtk/common/testing/cxx/helpers.h" + +#include + +#define ATT_ROLE_NAME "attributes" +#define OP_NAME "create-project-op" +#define PROJECT_TYPE "foo" + +// This test verifies that projects can be instantiated outside of the +// SMTK resource manager. + +namespace +{ +const int OP_SUCCEEDED = static_cast(smtk::operation::Operation::Outcome::SUCCEEDED); + +class CreateProjectOp : public smtk::operation::XMLOperation +{ +public: + smtkTypeMacro(CreateProjectOp); + smtkCreateMacro(CreateProjectOp); + smtkSharedFromThisMacro(smtk::operation::Operation); + + CreateProjectOp() = default; + ~CreateProjectOp() override = default; + + bool ableToOperate() override + { + if (m_projManager == nullptr) + { + smtkErrorMacro(this->log(), "Project Manager not set"); + return false; + } + return smtk::operation::XMLOperation::ableToOperate(); + } + + Result operateInternal() override + { + auto project = m_projManager->create(PROJECT_TYPE); + + auto attRes = m_projManager->resourceManager()->create(); + project->resources().add(attRes, ATT_ROLE_NAME); + + auto result = this->createResult(Outcome::SUCCEEDED); + result->findResource("resource")->setValue(project); + return result; + } + + const char* xmlDescription() const override; + + smtk::project::Manager::Ptr m_projManager; +}; + +const char CreateProjectOpXML[] = + "" + "" + " " + " " + " " + " " + " 0" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " 0" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; + +const char* CreateProjectOp::xmlDescription() const +{ + return CreateProjectOpXML; +} + +} // namespace + +int TestProjectLifeCycle_Deprecated(int /*unused*/, char** const /*unused*/) +{ + // Create managers + smtk::resource::ManagerPtr resManager = smtk::resource::Manager::create(); + smtk::attribute::Registrar::registerTo(resManager); + + smtk::operation::ManagerPtr opManager = smtk::operation::Manager::create(); + smtk::attribute::Registrar::registerTo(opManager); + +#if 0 + // This line changes behavior such that projects ARE stored in resource manager + opManager->registerResourceManager(resManager); +#endif + + opManager->registerOperation("CreateProjectOp"); + + smtk::project::ManagerPtr projManager = smtk::project::Manager::create(resManager, opManager); + smtk::project::Registrar::registerTo(projManager); + projManager->registerProject(PROJECT_TYPE); + + smtkTest(resManager->empty(), "resource manager size is " << resManager->size()); + + smtk::resource::Resource::Ptr resource; + smtk::project::Project::Ptr project; + { + std::cout << "Creating project" << std::endl; + + auto createOp = opManager->create(); + smtkTest(createOp != nullptr, "create operation not created") createOp->m_projManager = + projManager; // back door + + auto result = createOp->operate(); + int outcome = result->findInt("outcome")->value(); + smtkTest(outcome == OP_SUCCEEDED, "create operation failed"); + + auto res = result->findResource("resource")->value(); + project = std::dynamic_pointer_cast(res); + smtkTest(res != nullptr, "project not created"); + } + + { + // Is project contained by resource manager? + auto res = resManager->get(project->id()); + smtkTest(res == nullptr, "resource manager contains project") + smtkTest(resManager->size() == 1, "resource manager size not 1"); + + auto attRes = project->resources().getByRole(ATT_ROLE_NAME); + smtkTest(attRes != nullptr, "project missing attribute resource"); + + // Release the project, check that resource manager unchanged + std::cout << "Removing project" << std::endl; + projManager->remove(project); + smtkTest(resManager->size() == 1, "resource manager size not 1"); + + // And remove the attribute resource + resManager->remove(attRes); + smtkTest(resManager->empty(), "resource manager not empty"); + } + + std::cout << "Finis" << std::endl; + return 0; +} diff --git a/smtk/project/testing/cxx/TestProjectReadWrite.cxx b/smtk/project/testing/cxx/TestProjectReadWrite.cxx index da6519bded..0f85ac3e52 100644 --- a/smtk/project/testing/cxx/TestProjectReadWrite.cxx +++ b/smtk/project/testing/cxx/TestProjectReadWrite.cxx @@ -53,10 +53,10 @@ void cleanup(const std::string& file_path) { //first verify the file exists ::boost::filesystem::path path(file_path); - if (::boost::filesystem::is_regular_file(path)) + if (::boost::filesystem::exists(path)) { //remove the file_path if it exists. - ::boost::filesystem::remove(path); + ::boost::filesystem::remove_all(path); } } } // namespace @@ -67,6 +67,7 @@ int TestProjectReadWrite(int /*unused*/, char** const /*unused*/) smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); { + smtk::attribute::Registrar::registerTo(resourceManager); smtk::mesh::Registrar::registerTo(resourceManager); smtk::project::Registrar::registerTo(resourceManager); } @@ -75,6 +76,7 @@ int TestProjectReadWrite(int /*unused*/, char** const /*unused*/) smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); { + smtk::attribute::Registrar::registerTo(operationManager); smtk::mesh::Registrar::registerTo(operationManager); smtk::operation::Registrar::registerTo(operationManager); } @@ -95,6 +97,7 @@ int TestProjectReadWrite(int /*unused*/, char** const /*unused*/) projectManager->registerProject("foo"); // Create a project and write it to disk. + std::string projectDirectory = write_root + "/TestProjectReadWrite/"; std::string projectLocation; std::size_t numberOfMeshes; { @@ -139,18 +142,54 @@ int TestProjectReadWrite(int /*unused*/, char** const /*unused*/) project->resources().add( std::dynamic_pointer_cast(resourceItem->value()), "my mesh"); + + // Create resource with non-unique role + for (int i = 0; i < 2; i++) + { + auto resource = resourceManager->create("smtk::attribute::Resource"); + resource->setName("common" + std::to_string(i)); + project->resources().add(resource, "common"); + } + { + auto resource = resourceManager->create("smtk::attribute::Resource"); + resource->setName("common" + std::to_string(2)); + project->resources().add(resource, "uncommon"); + } } - if (project->resources().size() != 1) + if (project->resources().size() != 4) { std::cerr << "Failed to add a resource to the project\n"; return 1; } { - smtk::mesh::Resource::Ptr myMesh = - project->resources().getByRole("my mesh"); - numberOfMeshes = myMesh->meshes().size(); + std::set myMesh = + project->resources().findByRole("my mesh"); + numberOfMeshes = (*(myMesh.begin()))->meshes().size(); + } + + { + std::set commonResources = + project->resources().findByRole("common"); + smtkTest(commonResources.size() == 2, "Expected two(2) resources with the role \"common\""); + + // Make sure all and only the added resources with the common role exist in the project + std::map check_names{ { "common0", false }, { "common1", false } }; + for (auto& res : commonResources) + { + auto it = check_names.find(res->name()); + smtkTest( + it != check_names.end(), + "Found unexpected smtk::attribute::Resource with project_role \"common\""); + it->second = true; + } + for (auto& check : check_names) + { + smtkTest( + check.second, + "Did not find expected smtk::attribute::Resource with name: " << check.first); + } } { @@ -165,7 +204,7 @@ int TestProjectReadWrite(int /*unused*/, char** const /*unused*/) } // Set the file path - projectLocation = write_root + "/" + smtk::common::UUID::random().toString() + ".smtk"; + projectLocation = projectDirectory + smtk::common::UUID::random().toString() + ".smtk"; writeOp->parameters()->associate(project); writeOp->parameters()->findFile("filename")->setIsEnabled(true); @@ -243,15 +282,22 @@ int TestProjectReadWrite(int /*unused*/, char** const /*unused*/) } } - smtk::mesh::Resource::Ptr myMesh = - project->resources().getByRole("my mesh"); + std::set myMeshSet = + project->resources().findByRole("my mesh"); - if (!myMesh) + if (myMeshSet.empty()) { std::cerr << "Resulting project does not contain mesh resource\n"; return 1; } + if (myMeshSet.size() > 1) + { + std::cerr + << "Resulting project contains more than one(1) mesh resource with role \"my mesh\"\n"; + return 1; + } + smtk::mesh::Resource::Ptr myMesh = *(myMeshSet.begin()); if (myMesh->meshes().size() != numberOfMeshes) { std::cerr << "Resulting project's mesh resource was incorrectly transcribed\n"; @@ -275,7 +321,9 @@ int TestProjectReadWrite(int /*unused*/, char** const /*unused*/) std::cout << readOp->log().convertToString(); } - cleanup(projectLocation); +#ifdef NDEBUG + cleanup(projectDirectory); +#endif return 0; } diff --git a/smtk/project/testing/cxx/TestProjectReadWrite2.cxx b/smtk/project/testing/cxx/TestProjectReadWrite2.cxx index ad0cf4e7c8..38e5f997ba 100644 --- a/smtk/project/testing/cxx/TestProjectReadWrite2.cxx +++ b/smtk/project/testing/cxx/TestProjectReadWrite2.cxx @@ -59,8 +59,10 @@ void cleanup(const std::string& location) { //first verify the file exists ::boost::filesystem::path path(location); + printf("Removing: %s...\n", location.c_str()); if (::boost::filesystem::exists(path)) { + printf("Removing: %s...Success\n", location.c_str()); //remove the file_path if it exists. ::boost::filesystem::remove_all(path); } @@ -112,7 +114,7 @@ int TestProjectReadWrite2(int /*unused*/, char** const /*unused*/) projectManager->registerProject("foo"); // Create a project and write it to disk. - int numberOfResources = 0; + size_t numberOfResources = 0; { smtk::project::Project::Ptr project = projectManager->create("foo"); if (!project) @@ -189,9 +191,9 @@ int TestProjectReadWrite2(int /*unused*/, char** const /*unused*/) } { - smtk::attribute::Resource::Ptr myAtts = - project->resources().getByRole("my attributes"); - numberOfResources = myAtts == nullptr ? 0 : 1; + std::set myAtts = + project->resources().findByRole("my attributes"); + numberOfResources = myAtts.size(); } { @@ -274,15 +276,24 @@ int TestProjectReadWrite2(int /*unused*/, char** const /*unused*/) } } - smtk::attribute::Resource::Ptr myAtts = - project->resources().getByRole("my attributes"); + std::set myAttSet = + project->resources().findByRole("my attributes"); - if (myAtts == nullptr) + if (myAttSet.empty()) { std::cerr << "Resulting project does not contain attribute resource\n"; return 1; } + if (myAttSet.size() > 1) + { + std::cerr << "Resulting project contains more than one(1) attribute resource with role \"my " + "attributes\"\n"; + return 1; + } + + smtk::attribute::Resource::Ptr myAtts = *(myAttSet.begin()); + if (!myAtts->clean()) { std::cerr << "Attribute resource is marked modified\n"; diff --git a/smtk/project/testing/cxx/TestProjectReadWrite2_Deprecated.cxx b/smtk/project/testing/cxx/TestProjectReadWrite2_Deprecated.cxx new file mode 100644 index 0000000000..4515fe42c9 --- /dev/null +++ b/smtk/project/testing/cxx/TestProjectReadWrite2_Deprecated.cxx @@ -0,0 +1,320 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#define SMTK_DEPRECATION_LEVEL 2105 + +#include "smtk/attribute/Attribute.h" +#include "smtk/attribute/FileItem.h" +#include "smtk/attribute/IntItem.h" +#include "smtk/attribute/Registrar.h" +#include "smtk/attribute/Resource.h" +#include "smtk/attribute/ResourceItem.h" +#include "smtk/attribute/operators/Import.h" + +#include "smtk/common/UUIDGenerator.h" +#include "smtk/io/Logger.h" +#include "smtk/resource/Component.h" +#include "smtk/resource/DerivedFrom.h" +#include "smtk/resource/Manager.h" + +#include "smtk/operation/Manager.h" +#include "smtk/operation/Registrar.h" +#include "smtk/operation/operators/ImportResource.h" +#include "smtk/operation/operators/ReadResource.h" +#include "smtk/operation/operators/WriteResource.h" + +#include "smtk/project/Manager.h" +#include "smtk/project/Project.h" +#include "smtk/project/Registrar.h" +#include "smtk/project/operators/Define.h" + +#ifdef VTK_SUPPORT +#include "smtk/session/vtk/Registrar.h" +#endif + +#include "smtk/common/testing/cxx/helpers.h" + +//force to use filesystem version 3 +#define BOOST_FILESYSTEM_VERSION 3 +#include +using namespace boost::filesystem; + +// This test verifies that projects can be serialized to the file system +// and unserialized back. The test project contains an SMTK attribute +// resource plus (if vtk support is built) an SMTK vtk model resource. + +namespace +{ + +//SMTK_DATA_DIR is a define setup by cmake +std::string data_root = SMTK_DATA_DIR; +std::string write_root = SMTK_SCRATCH_DIR; + +void cleanup(const std::string& location) +{ + //first verify the file exists + ::boost::filesystem::path path(location); + if (::boost::filesystem::exists(path)) + { + //remove the file_path if it exists. + ::boost::filesystem::remove_all(path); + } +} +} // namespace + +int TestProjectReadWrite2_Deprecated(int /*unused*/, char** const /*unused*/) +{ + // Set the file path + std::string projectDirectory = write_root + "/TestProjectReadWrite2_Deprecated"; + cleanup(projectDirectory); + std::string projectFileLocation = projectDirectory + "/foo.smtk"; + + // Create a resource manager + smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); + + { + smtk::attribute::Registrar::registerTo(resourceManager); +#ifdef VTK_SUPPORT + smtk::session::vtk::Registrar::registerTo(resourceManager); +#endif + smtk::project::Registrar::registerTo(resourceManager); + } + + // Create an operation manager + smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); + + { + smtk::attribute::Registrar::registerTo(operationManager); +#ifdef VTK_SUPPORT + smtk::session::vtk::Registrar::registerTo(operationManager); +#endif + smtk::operation::Registrar::registerTo(operationManager); + } + + // Register the resource manager to the operation manager (newly created + // resources will be automatically registered to the resource manager). + operationManager->registerResourceManager(resourceManager); + + // Create a project manager + smtk::project::ManagerPtr projectManager = + smtk::project::Manager::create(resourceManager, operationManager); + + { + smtk::project::Registrar::registerTo(projectManager); + } + + // Register a new project type + projectManager->registerProject("foo"); + + // Create a project and write it to disk. + int numberOfResources = 0; + { + smtk::project::Project::Ptr project = projectManager->create("foo"); + if (!project) + { + std::cerr << "Failed to create a project\n"; + return 1; + } + + { + // Create an import operator + smtk::operation::Operation::Ptr importAnyOp = + operationManager->create(); + smtk::operation::Operation::Ptr importSBTOp = + operationManager->create(); + + if (!importSBTOp) + { + std::cerr << "No sbt import operator\n"; + return 1; + } + if (!importAnyOp) + { + std::cerr << "No any import operator\n"; + return 1; + } + + // Input data files + std::map importPaths = { + { "my attributes", "/attribute/attribute_collection/DoubleItemExample.sbt" } + }; +#ifdef VTK_SUPPORT + importPaths["my model"] = "/model/3d/genesis/casting-mesh1.gen"; +#endif + for (auto& keyval : importPaths) + { + auto role = keyval.first; + auto path = keyval.second; + + std::string importFilePath(data_root); + importFilePath += path; + std::string ext = boost::filesystem::path(importFilePath).extension().string(); + + smtk::operation::Operation::Result importOpResult; + if (ext == ".sbt") + { + importSBTOp->parameters()->findFile("filename")->setValue(importFilePath); + importOpResult = importSBTOp->operate(); + } + else + { + importAnyOp->parameters()->findFile("filename")->setValue(importFilePath); + importOpResult = importAnyOp->operate(); + } + + // Test for success + if ( + importOpResult->findInt("outcome")->value() != + static_cast(smtk::operation::Operation::Outcome::SUCCEEDED)) + { + std::cerr << "Import operation failed\n"; + return 1; + } + + auto resourceItem = importOpResult->findResource("resource"); + project->resources().add(resourceItem->value(), role); + ++numberOfResources; + } // for (path) + } + + if (project->resources().size() != numberOfResources) + { + std::cerr << "Failed to add a resource to the project\n"; + return 1; + } + + { + smtk::attribute::Resource::Ptr myAtts = + project->resources().getByRole("my attributes"); + numberOfResources = myAtts == nullptr ? 0 : 1; + } + + { + // Create a write operator + smtk::operation::WriteResource::Ptr writeOp = + operationManager->create(); + + if (!writeOp) + { + std::cerr << "No write operator\n"; + return 1; + } + + writeOp->parameters()->associate(project); + writeOp->parameters()->findFile("filename")->setIsEnabled(true); + writeOp->parameters()->findFile("filename")->setValue(projectFileLocation); + + if (!writeOp->ableToOperate()) + { + std::cerr << "Write operation unable to operate\n"; + return 1; + } + + // Execute the operation + smtk::operation::Operation::Result writeOpResult = writeOp->operate(); + + // Test for success + if ( + writeOpResult->findInt("outcome")->value() != + static_cast(smtk::operation::Operation::Outcome::SUCCEEDED)) + { + std::cerr << "Write operation failed\n"; + std::cerr << writeOp->log().convertToString(); + return 1; + } + } + projectManager->remove(project); + } + + // Read the project + smtk::project::Project::Ptr project; + { + // Create a read operator + smtk::operation::ReadResource::Ptr readOp = + operationManager->create(); + + if (!readOp) + { + std::cerr << "No read operator\n"; + return 1; + } + + readOp->parameters()->findFile("filename")->setValue(projectFileLocation); + + if (!readOp->ableToOperate()) + { + std::cerr << "Read operation unable to operate\n"; + return 1; + } + + // Execute the operation + smtk::operation::Operation::Result readOpResult = readOp->operate(); + + // Test for success + if ( + readOpResult->findInt("outcome")->value() != + static_cast(smtk::operation::Operation::Outcome::SUCCEEDED)) + { + std::cerr << "Read operation failed\n"; + std::cerr << readOp->log().convertToString(); + return 1; + } + + project = readOpResult->findResource("resource")->valueAs(); + + if (!project) + { + std::cerr << "Resulting project is invalid\n"; + return 1; + } + } + + smtk::attribute::Resource::Ptr myAtts = + project->resources().getByRole("my attributes"); + + if (myAtts == nullptr) + { + std::cerr << "Resulting project does not contain attribute resource\n"; + return 1; + } + + if (!myAtts->clean()) + { + std::cerr << "Attribute resource is marked modified\n"; + return 1; + } + + { + boost::filesystem::path myAttsPath(myAtts->location()); + boost::filesystem::path projectPath(projectDirectory); + boost::filesystem::path resourcesPath = projectPath / "resources"; + if (myAttsPath.parent_path().compare(resourcesPath) != 0) + { + std::cerr << "Wrong attribute resource location: " << myAtts->location() << "\n"; + return 1; + } + } + + { + std::vector defList; + myAtts->definitions(defList); + if (defList.size() != 2) + { + std::cerr << "Attribute resource missing definitions\n"; + return 1; + } + } + +#ifdef NDEBUG + cleanup(projectDirectory); +#endif + + return 0; +} diff --git a/smtk/project/testing/cxx/TestProjectReadWrite_Deprecated.cxx b/smtk/project/testing/cxx/TestProjectReadWrite_Deprecated.cxx new file mode 100644 index 0000000000..61b514e303 --- /dev/null +++ b/smtk/project/testing/cxx/TestProjectReadWrite_Deprecated.cxx @@ -0,0 +1,261 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#define SMTK_DEPRECATION_LEVEL 2105 + +#include "smtk/attribute/Attribute.h" +#include "smtk/attribute/FileItem.h" +#include "smtk/attribute/IntItem.h" +#include "smtk/attribute/ResourceItem.h" + +#include "smtk/common/UUIDGenerator.h" +#include "smtk/resource/Component.h" +#include "smtk/resource/DerivedFrom.h" +#include "smtk/resource/Manager.h" + +#include "smtk/mesh/core/Resource.h" +#include "smtk/mesh/resource/Registrar.h" + +#include "smtk/operation/Manager.h" +#include "smtk/operation/Registrar.h" +#include "smtk/operation/operators/ImportResource.h" +#include "smtk/operation/operators/ReadResource.h" +#include "smtk/operation/operators/WriteResource.h" + +#include "smtk/project/Manager.h" +#include "smtk/project/Project.h" +#include "smtk/project/Registrar.h" +#include "smtk/project/operators/Define.h" + +#include "smtk/common/testing/cxx/helpers.h" + +//force to use filesystem version 3 +#define BOOST_FILESYSTEM_VERSION 3 +#include +using namespace boost::filesystem; + +// This test verifies that projects can be serialized to the file system +// and unserialized back. The test project contains an SMTK mesh resource. + +namespace +{ + +//SMTK_DATA_DIR is a define setup by cmake +std::string data_root = SMTK_DATA_DIR; +std::string write_root = SMTK_SCRATCH_DIR; + +void cleanup(const std::string& file_path) +{ + //first verify the file exists + ::boost::filesystem::path path(file_path); + if (::boost::filesystem::exists(path)) + { + //remove the file_path if it exists. + ::boost::filesystem::remove_all(path); + } +} +} // namespace + +int TestProjectReadWrite_Deprecated(int /*unused*/, char** const /*unused*/) +{ + // Create a resource manager + smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); + + { + smtk::mesh::Registrar::registerTo(resourceManager); + smtk::project::Registrar::registerTo(resourceManager); + } + + // Create an operation manager + smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); + + { + smtk::mesh::Registrar::registerTo(operationManager); + smtk::operation::Registrar::registerTo(operationManager); + } + + // Register the resource manager to the operation manager (newly created + // resources will be automatically registered to the resource manager). + operationManager->registerResourceManager(resourceManager); + + // Create a project manager + smtk::project::ManagerPtr projectManager = + smtk::project::Manager::create(resourceManager, operationManager); + + { + smtk::project::Registrar::registerTo(projectManager); + } + + // Register a new project type + projectManager->registerProject("foo"); + + // Create a project and write it to disk. + std::string projectDirectory = write_root + "/TestProjectReadWrite_Deprecated/"; + std::string projectLocation; + std::size_t numberOfMeshes; + { + smtk::project::Project::Ptr project = projectManager->create("foo"); + if (!project) + { + std::cerr << "Failed to create a project\n"; + return 1; + } + + { + // Create an import operator + smtk::operation::ImportResource::Ptr importOp = + operationManager->create(); + if (!importOp) + { + std::cerr << "No import operator\n"; + return 1; + } + + // Set the file path + std::string importFilePath(data_root); + importFilePath += "/model/3d/exodus/SimpleReactorCore/SimpleReactorCore.exo"; + importOp->parameters()->findFile("filename")->setValue(importFilePath); + + // Execute the operation + smtk::operation::Operation::Result importOpResult = importOp->operate(); + + // Test for success + if ( + importOpResult->findInt("outcome")->value() != + static_cast(smtk::operation::Operation::Outcome::SUCCEEDED)) + { + std::cerr << "Import operation failed\n"; + return 1; + } + + // Add the mesh resource to the project + smtk::attribute::ResourceItemPtr resourceItem = + std::dynamic_pointer_cast( + importOpResult->findResource("resource")); + + project->resources().add( + std::dynamic_pointer_cast(resourceItem->value()), "my mesh"); + } + + if (project->resources().size() != 1) + { + std::cerr << "Failed to add a resource to the project\n"; + return 1; + } + + { + smtk::mesh::Resource::Ptr myMesh = + project->resources().getByRole("my mesh"); + numberOfMeshes = myMesh->meshes().size(); + } + + { + // Create a write operator + smtk::operation::WriteResource::Ptr writeOp = + operationManager->create(); + + if (!writeOp) + { + std::cerr << "No write operator\n"; + return 1; + } + + // Set the file path + projectLocation = projectDirectory + smtk::common::UUID::random().toString() + ".smtk"; + + writeOp->parameters()->associate(project); + writeOp->parameters()->findFile("filename")->setIsEnabled(true); + writeOp->parameters()->findFile("filename")->setValue(projectLocation); + + if (!writeOp->ableToOperate()) + { + std::cerr << "Write operation unable to operate\n"; + return 1; + } + + // Execute the operation + smtk::operation::Operation::Result writeOpResult = writeOp->operate(); + + // Test for success + if ( + writeOpResult->findInt("outcome")->value() != + static_cast(smtk::operation::Operation::Outcome::SUCCEEDED)) + { + std::cerr << "Write operation failed\n"; + std::cerr << writeOp->log().convertToString(); + return 1; + } + } + + projectManager->remove(project); + } + + // Read the project + smtk::project::Project::Ptr project; + { + // Create a read operator + smtk::operation::ReadResource::Ptr readOp = + operationManager->create(); + + if (!readOp) + { + std::cerr << "No read operator\n"; + return 1; + } + + readOp->parameters()->findFile("filename")->setValue(projectLocation); + + if (!readOp->ableToOperate()) + { + std::cerr << "Read operation unable to operate\n"; + return 1; + } + + // Execute the operation + smtk::operation::Operation::Result readOpResult = readOp->operate(); + + // Test for success + if ( + readOpResult->findInt("outcome")->value() != + static_cast(smtk::operation::Operation::Outcome::SUCCEEDED)) + { + std::cerr << "Read operation failed\n"; + std::cerr << readOp->log().convertToString(); + return 1; + } + + project = readOpResult->findResource("resource")->valueAs(); + + if (!project) + { + std::cerr << "Resulting project is invalid\n"; + return 1; + } + } + + smtk::mesh::Resource::Ptr myMesh = + project->resources().getByRole("my mesh"); + + if (!myMesh) + { + std::cerr << "Resulting project does not contain mesh resource\n"; + return 1; + } + + if (myMesh->meshes().size() != numberOfMeshes) + { + std::cerr << "Resulting project's mesh resource was incorrectly transcribed\n"; + return 1; + } + + cleanup(projectDirectory); + + return 0; +} -- GitLab From dc2e00d147eb0f9200836bcfe061a637cdd60c79 Mon Sep 17 00:00:00 2001 From: Ryan Krattiger Date: Wed, 19 May 2021 17:41:46 -0500 Subject: [PATCH 039/136] Add release note for non-unique Project Roles --- doc/release/notes/project-unique-roles.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 doc/release/notes/project-unique-roles.rst diff --git a/doc/release/notes/project-unique-roles.rst b/doc/release/notes/project-unique-roles.rst new file mode 100644 index 0000000000..d1bd667a07 --- /dev/null +++ b/doc/release/notes/project-unique-roles.rst @@ -0,0 +1,11 @@ +Changes to smtk::project::ResourceContainer API +============================ + +Changes to the ``smtk::project::ResourceContainer`` API to allow for non-unique roles +to be assigned to Resources in a project. + +Deprecated version >= 21.6 +``smtk::project::ResourceContainer::getByRole -> smtk::resource::ResourcePtr`` + +New API +``smtk::project::ResourceContainer::findByRole -> std::set`` -- GitLab From 02b5adcba1d7377739033a3a2a1e59d569237145 Mon Sep 17 00:00:00 2001 From: Ryan Krattiger Date: Wed, 9 Jun 2021 15:15:01 -0500 Subject: [PATCH 040/136] Fix clang-tidy issues ref. !2469 --- smtk/extension/qt/qtAttributeView.cxx | 4 ++-- smtk/extension/qt/qtGroupView.cxx | 2 +- smtk/project/testing/cxx/TestProjectReadWrite.cxx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/smtk/extension/qt/qtAttributeView.cxx b/smtk/extension/qt/qtAttributeView.cxx index c807ff763f..0e560be583 100644 --- a/smtk/extension/qt/qtAttributeView.cxx +++ b/smtk/extension/qt/qtAttributeView.cxx @@ -1047,7 +1047,7 @@ void qtAttributeView::onViewBy() { // so switch tabs would not reset selection // get the active tab from the view config if it exists - std::string activeAttUuid = ""; + std::string activeAttUuid; this->getObject()->details().attribute( m_internals->m_activeAttributeViewAttName, activeAttUuid); smtk::attribute::ConstAttributePtr activeAtt = @@ -1059,7 +1059,7 @@ void qtAttributeView::onViewBy() activeAtt->name().c_str(), Qt::MatchExactly, name_column); if (!items.empty()) { - auto activeItem = items.at(0); + auto* activeItem = items.at(0); // Select the newly created attribute m_internals->ListTable->selectRow(activeItem->row()); QModelIndex index = activeItem->index(); diff --git a/smtk/extension/qt/qtGroupView.cxx b/smtk/extension/qt/qtGroupView.cxx index 4d34086fec..3be1e46834 100644 --- a/smtk/extension/qt/qtGroupView.cxx +++ b/smtk/extension/qt/qtGroupView.cxx @@ -96,7 +96,7 @@ void qtGroupViewInternals::updateChildren(qtGroupView* gview, qtBaseViewMemFn mf } tabWidget->blockSignals(true); tabWidget->clear(); - std::string lastSavedViewName = ""; + std::string lastSavedViewName; gview->getObject()->details().attribute(m_activeTabViewAttNamee, lastSavedViewName); m_TabbedViews.clear(); m_currentTabSelected = -1; diff --git a/smtk/project/testing/cxx/TestProjectReadWrite.cxx b/smtk/project/testing/cxx/TestProjectReadWrite.cxx index 0f85ac3e52..b4ef9ef7e3 100644 --- a/smtk/project/testing/cxx/TestProjectReadWrite.cxx +++ b/smtk/project/testing/cxx/TestProjectReadWrite.cxx @@ -176,7 +176,7 @@ int TestProjectReadWrite(int /*unused*/, char** const /*unused*/) // Make sure all and only the added resources with the common role exist in the project std::map check_names{ { "common0", false }, { "common1", false } }; - for (auto& res : commonResources) + for (const auto& res : commonResources) { auto it = check_names.find(res->name()); smtkTest( @@ -184,7 +184,7 @@ int TestProjectReadWrite(int /*unused*/, char** const /*unused*/) "Found unexpected smtk::attribute::Resource with project_role \"common\""); it->second = true; } - for (auto& check : check_names) + for (const auto& check : check_names) { smtkTest( check.second, -- GitLab From 17b7eeb7f85d0c3a993d5a27306a85ab3beac989 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Thu, 10 Jun 2021 21:13:31 -0400 Subject: [PATCH 041/136] Reset selectedAttribute before rebuilding attribute list --- data/attribute/attribute_collection/attributeViewExample.sbt | 3 +++ smtk/extension/qt/qtAttributeView.cxx | 1 + 2 files changed, 4 insertions(+) create mode 100644 data/attribute/attribute_collection/attributeViewExample.sbt diff --git a/data/attribute/attribute_collection/attributeViewExample.sbt b/data/attribute/attribute_collection/attributeViewExample.sbt new file mode 100644 index 0000000000..83db9c87af --- /dev/null +++ b/data/attribute/attribute_collection/attributeViewExample.sbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38dedbf7c79e8a2e35b74db719437cbd5e2d5a087ca60617948416908863ccc1 +size 838 diff --git a/smtk/extension/qt/qtAttributeView.cxx b/smtk/extension/qt/qtAttributeView.cxx index 0e560be583..e73be73776 100644 --- a/smtk/extension/qt/qtAttributeView.cxx +++ b/smtk/extension/qt/qtAttributeView.cxx @@ -1080,6 +1080,7 @@ void qtAttributeView::onViewBy() } else { + m_internals->selectedAttribute.reset(); this->onListBoxSelectionChanged(); } frame->handle(1)->setEnabled(true); -- GitLab From cc1688e02948ae78acf790c02716f6c0e96f0428 Mon Sep 17 00:00:00 2001 From: Robert O'Bara Date: Fri, 11 Jun 2021 09:53:44 -0400 Subject: [PATCH 042/136] BUG: Fixing isValid() for an attribute's association item If an attribute had the following conditions: * Its association item set to have its NumberOfRequiredValues > 0 * Its Resource had active categories * All of its items where validity set with the exception of its association item Then its isValid() would mistakenly return true, due to the fact that its association item (which does not have categories set), would be excluded from the check. Now the association item is forced to be by turning off category checking for that item. By doing this, we are saying that if the attribute itself passes its category checks, then so does its association item. --- .../notes/fix_isValidAssociationCheck.rst | 11 +++++++ smtk/attribute/Attribute.cxx | 5 ++-- .../testing/cxx/unitAssociationTest.cxx | 30 +++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 doc/release/notes/fix_isValidAssociationCheck.rst diff --git a/doc/release/notes/fix_isValidAssociationCheck.rst b/doc/release/notes/fix_isValidAssociationCheck.rst new file mode 100644 index 0000000000..78260dfa8e --- /dev/null +++ b/doc/release/notes/fix_isValidAssociationCheck.rst @@ -0,0 +1,11 @@ +Fix isValid Check w/r to an Attribute's Associations +==================================== +If an attribute had the following conditions: + + * Its association item set to have its NumberOfRequiredValues > 0 + * Its Resource had active categories + * All of its items where validity set with the exception of its association item + +Then its isValid() would mistakenly return true, due to the fact that its association item (which does not have categories set), would be excluded from the check. + +Now the association item is forced to be by turning off category checking for that item. By doing this, we are saying that if the attribute itself passes its category checks, then so does its association item. diff --git a/smtk/attribute/Attribute.cxx b/smtk/attribute/Attribute.cxx index c85504cbdd..7658dd61cd 100644 --- a/smtk/attribute/Attribute.cxx +++ b/smtk/attribute/Attribute.cxx @@ -312,8 +312,9 @@ bool Attribute::isValid(const std::set& cats) const return false; } - // also check associations - return !(m_associatedObjects && !m_associatedObjects->isValid()); + // also check associations - make sure to turn active categories off + // since associations don't have them set + return !(m_associatedObjects && !m_associatedObjects->isValid(false)); } bool Attribute::isRelevant() const diff --git a/smtk/attribute/testing/cxx/unitAssociationTest.cxx b/smtk/attribute/testing/cxx/unitAssociationTest.cxx index 820602d851..8fc83c2ac5 100644 --- a/smtk/attribute/testing/cxx/unitAssociationTest.cxx +++ b/smtk/attribute/testing/cxx/unitAssociationTest.cxx @@ -31,8 +31,16 @@ int unitAssociationTest(int /*unused*/, char* /*unused*/[]) "smtk::attribute::Resource", "attribute[type='testDef']", true); associationRule->setNumberOfRequiredValues(0); associationRule->setIsExtensible(true); + DefinitionPtr B = attRes->createDefinition("B"); + auto associationRule1 = B->createLocalAssociationRule(); + associationRule1->setAcceptsEntries( + "smtk::attribute::Resource", "attribute[type='testDef']", true); + associationRule1->setNumberOfRequiredValues(1); + associationRule->setIsExtensible(true); + B->localCategories().insertInclusion("foo"); attRes->finalizeDefinitions(); auto a = attRes->createAttribute("a", A); + auto b = attRes->createAttribute("b", B); auto t = attRes->createAttribute("test", TestDef); // Let associate a to t @@ -53,5 +61,27 @@ int unitAssociationTest(int /*unused*/, char* /*unused*/[]) smtkTest( a->associatedObjects()->numberOfValues() == 0, "Incorrect number of associated objects returned - should be 0"); + + // Lets test validity based on categories + std::set cats1 = { "foo" }; + std::set cats2 = { "bar" }; + smtkTest( + !b->isValid(), + "b with no categories specified was considered valid but it should have been invalid"); + + // with foo set, the attribute will pass its category filtering process but the fact + // that the attribute's association fails its validity check should make it invalid + attRes->setActiveCategories(cats1); + attRes->setActiveCategoriesEnabled(true); + smtkTest( + !b->isValid(), "b with foo specified was considered valid but it should have been invalid"); + + // with bar set, the attribute will fail its category filtering process so it will be + // considered valid though its association is not + attRes->setActiveCategories(cats2); + attRes->setActiveCategoriesEnabled(true); + smtkTest( + b->isValid(), "b with bar specified was considered invalid but it should have been valid"); + return 0; } -- GitLab From ccab8f08078627912876d1085450475cb1c53967 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Mon, 26 Apr 2021 21:33:20 -0400 Subject: [PATCH 043/136] Start ImportPPG operation for creating models from simple text file input Requires file by default but can also load from string --- smtk/session/polygon/CMakeLists.txt | 1 + smtk/session/polygon/Registrar.cxx | 2 + smtk/session/polygon/operators/ImportPPG.cxx | 121 ++++++++++++++++++ smtk/session/polygon/operators/ImportPPG.h | 56 ++++++++ smtk/session/polygon/operators/ImportPPG.sbt | 35 +++++ .../polygon/testing/cxx/CMakeLists.txt | 3 +- .../testing/cxx/UnitTestPolygonImportPPG.cxx | 91 +++++++++++++ 7 files changed, 308 insertions(+), 1 deletion(-) create mode 100644 smtk/session/polygon/operators/ImportPPG.cxx create mode 100644 smtk/session/polygon/operators/ImportPPG.h create mode 100644 smtk/session/polygon/operators/ImportPPG.sbt create mode 100644 smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx diff --git a/smtk/session/polygon/CMakeLists.txt b/smtk/session/polygon/CMakeLists.txt index f16cb59ffe..c64eb60b52 100644 --- a/smtk/session/polygon/CMakeLists.txt +++ b/smtk/session/polygon/CMakeLists.txt @@ -59,6 +59,7 @@ set(polygonOperators Delete DemoteVertex ForceCreateFace + ImportPPG LegacyRead Read SplitEdge diff --git a/smtk/session/polygon/Registrar.cxx b/smtk/session/polygon/Registrar.cxx index 1ecafb83fa..c5ff04acd3 100644 --- a/smtk/session/polygon/Registrar.cxx +++ b/smtk/session/polygon/Registrar.cxx @@ -22,6 +22,7 @@ #include "smtk/session/polygon/operators/Delete.h" #include "smtk/session/polygon/operators/DemoteVertex.h" #include "smtk/session/polygon/operators/ForceCreateFace.h" +#include "smtk/session/polygon/operators/ImportPPG.h" #include "smtk/session/polygon/operators/LegacyRead.h" #include "smtk/session/polygon/operators/Read.h" #include "smtk/session/polygon/operators/SplitEdge.h" @@ -65,6 +66,7 @@ typedef std::tuple< ExtractContours, Import, #endif + ImportPPG, LegacyRead, Read, SplitEdge, diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx new file mode 100644 index 0000000000..5039cdaa00 --- /dev/null +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -0,0 +1,121 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#include "ImportPPG.h" + +#include "smtk/attribute/Attribute.h" +#include "smtk/attribute/FileItem.h" +#include "smtk/attribute/IntItem.h" +#include "smtk/attribute/ResourceItem.h" +#include "smtk/attribute/StringItem.h" + +#include "smtk/session/polygon/Resource.h" + +#include "smtk/session/polygon/ImportPPG_xml.h" + +#include +#include +#include +#include + +namespace +{ +struct PPGVertex +{ + double x; + double y; + + PPGVertex(double xval, double yval) + : x(xval) + , y(yval) + { + } +}; + +struct PPGFace +{ + std::vector vertices; + bool isHole; + + PPGFace(bool hole = false) + : isHole(hole) + { + } +}; + +} // namespace + +namespace smtk +{ +namespace session +{ +namespace polygon +{ + +smtk::operation::Operation::Result ImportPPG::operateInternal() +{ + std::stringstream ss; + + // Check for string input first + auto stringItem = this->parameters()->findString("string"); + if (stringItem->isEnabled()) + { + ss.str(stringItem->value()); + } + else + { + std::string filename = this->parameters()->findFile("filename")->value(); + std::ifstream infile(filename); + if (!infile.good()) + { + smtkErrorMacro(this->log(), "Unable to find or read input file: " << filename); + return this->createResult(smtk::operation::Operation::Outcome::FAILED); + } + + ss << infile.rdbuf(); + infile.close(); + } + + auto polySession = smtk::session::polygon::Session::create(); + auto resource = smtk::session::polygon::Resource::create(); + resource->setSession(polySession); + auto result = this->createResult(smtk::operation::Operation::Outcome::SUCCEEDED); + if (ss.rdbuf()->in_avail() > 0) + { + // Create list of vertex and face instances + std::vector vertexList; + std::vector faceList; + } + + result->findResource("resource")->setValue(resource); + + return result; +} + +bool ImportPPG::ableToOperate() +{ + // Check if filename is set + if (this->parameters()->findFile("filename")->isValid()) + { + return true; + } + + // If no filename, check for string item (advanced level) + auto stringItem = this->parameters()->findString("string"); + return stringItem->isEnabled() && stringItem->isSet(); +} + +const char* ImportPPG::xmlDescription() const +{ + return ImportPPG_xml; +} + +} // namespace polygon +} // namespace session +} // namespace smtk diff --git a/smtk/session/polygon/operators/ImportPPG.h b/smtk/session/polygon/operators/ImportPPG.h new file mode 100644 index 0000000000..264685a449 --- /dev/null +++ b/smtk/session/polygon/operators/ImportPPG.h @@ -0,0 +1,56 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#ifndef smtk_session_polygon_ImportPPG_h +#define smtk_session_polygon_ImportPPG_h + +#include "smtk/PublicPointerDefs.h" + +#include "smtk/operation/XMLOperation.h" +#include "smtk/session/polygon/Exports.h" + +namespace smtk +{ +namespace session +{ +namespace polygon +{ + +/**\brief Create a model resource from .ppg file input. + * + * SMTK supports a simple .ppg file format for specifying + * 2-D geometry. The file is used to specify a set of + * vertices as 2-D coordinates and a set of ploygon faces, + * each specified as a list of vertex indices. Model edges + * are internally created between adjacent vertices. + * Only convex polygons are supported. + * + */ +class SMTKPOLYGONSESSION_EXPORT ImportPPG : public smtk::operation::XMLOperation +{ +public: + smtkTypeMacro(smtk::session::polygon::ImportPPG); + smtkCreateMacro(ImportPPG); + smtkSharedFromThisMacro(smtk::operation::XMLOperation); + smtkSuperclassMacro(Operation); + + // Override ableToOperate() to support test mode + bool ableToOperate() override; + +protected: + smtk::operation::Operation::Result operateInternal() override; + const char* xmlDescription() const override; +}; + +} // namespace polygon +} // namespace session +} // namespace smtk + +#endif // smtk_session_polygon_ImportPPG_h diff --git a/smtk/session/polygon/operators/ImportPPG.sbt b/smtk/session/polygon/operators/ImportPPG.sbt new file mode 100644 index 0000000000..43166741e7 --- /dev/null +++ b/smtk/session/polygon/operators/ImportPPG.sbt @@ -0,0 +1,35 @@ + + + + + + + + + + + + + Intended for testing, overrides filename item + + + + + + + + + + + + + + + + + + + + diff --git a/smtk/session/polygon/testing/cxx/CMakeLists.txt b/smtk/session/polygon/testing/cxx/CMakeLists.txt index f4b16053df..30229400a0 100644 --- a/smtk/session/polygon/testing/cxx/CMakeLists.txt +++ b/smtk/session/polygon/testing/cxx/CMakeLists.txt @@ -17,7 +17,8 @@ set (unit_tests UnitTestPolygonCreateFacesFromEdges.cxx UnitTestPolygonDemoteVertex.cxx UnitTestPolygonFindOperationAttItems.cxx - UnitTestPolygonCleanGeometry.cxx) + UnitTestPolygonCleanGeometry.cxx + UnitTestPolygonImportPPG.cxx) if(SMTK_ENABLE_VTK_SUPPORT) set (unit_tests_which_require_data diff --git a/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx b/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx new file mode 100644 index 0000000000..22a7bbfee0 --- /dev/null +++ b/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx @@ -0,0 +1,91 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#include "smtk/attribute/Attribute.h" +#include "smtk/attribute/FileItem.h" +#include "smtk/attribute/IntItem.h" +#include "smtk/attribute/ResourceItem.h" +#include "smtk/attribute/StringItem.h" +#include "smtk/common/testing/cxx/helpers.h" +#include "smtk/model/Resource.h" +#include "smtk/model/SessionRef.h" +#include "smtk/operation/Manager.h" +#include "smtk/operation/operators/WriteResource.h" +#include "smtk/resource/Manager.h" +#include "smtk/session/polygon/Registrar.h" +#include "smtk/session/polygon/Resource.h" +#include "smtk/session/polygon/operators/ImportPPG.h" + +#include + +#include + +namespace +{ +const int OP_SUCCEEDED = static_cast(smtk::operation::Operation::Outcome::SUCCEEDED); +const std::string resourceFilename("import-ppg.smtk"); + +const std::string inputText = "v 0.0 0.0"; +} // namespace + +int UnitTestPolygonImportPPG(int /*argc*/, char* /*argv*/[]) +{ + // Delete existing file + boost::filesystem::path folderPath(SMTK_SCRATCH_DIR); + boost::filesystem::path smtkPath = folderPath / resourceFilename; + if (boost::filesystem::exists(smtkPath)) + { + boost::filesystem::remove(smtkPath); + } + + // Initialize managers + smtk::resource::ManagerPtr resManager = smtk::resource::Manager::create(); + smtk::session::polygon::Registrar::registerTo(resManager); + + smtk::operation::ManagerPtr opManager = smtk::operation::Manager::create(); + smtk::operation::Registrar::registerTo(opManager); + smtk::session::polygon::Registrar::registerTo(opManager); + opManager->registerResourceManager(resManager); + + // Create an "import" operation + auto importOp = opManager->create(); + test(importOp != nullptr, "No import operator"); + importOp->parameters()->findString("string")->setIsEnabled(true); + importOp->parameters()->findString("string")->setValue(inputText); + + // Run the operation + auto importResult = importOp->operate(); + int importOutcome = importResult->findInt("outcome")->value(); + smtkTest( + importOutcome == OP_SUCCEEDED, + "Import operation failed. Returned outcome " << std::to_string(importOutcome)); + + // Get the model resource + auto resourceItem = importResult->findResource("resource"); + auto resource = resourceItem->value(); + test(resource != nullptr, "Resource was not found."); + auto modelResource = std::dynamic_pointer_cast(resource); + test(modelResource != nullptr, "Model resource not found."); + + // Write model resource to file + std::cout << "Writing " << smtkPath << std::endl; + auto writeOp = opManager->create(); + test(writeOp != nullptr, "No write operator"); + writeOp->parameters()->associate(resource); + writeOp->parameters()->findFile("filename")->setIsEnabled(true); + writeOp->parameters()->findFile("filename")->setValue(smtkPath.string()); + auto writeResult = writeOp->operate(); + int writeOutcome = writeResult->findInt("outcome")->value(); + smtkTest( + writeOutcome == OP_SUCCEEDED, + "Write operation failed. Returned outcome " << std::to_string(writeOutcome)); + + return 0; +} -- GitLab From 30314f5f14755dd93c82d53a9c630984c18c5fee Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Tue, 27 Apr 2021 14:12:57 -0400 Subject: [PATCH 044/136] Add internal class with logic to parse input (.ppg) file --- smtk/session/polygon/operators/ImportPPG.cxx | 184 ++++++++++++++++-- smtk/session/polygon/operators/ImportPPG.h | 7 + .../testing/cxx/UnitTestPolygonImportPPG.cxx | 32 ++- 3 files changed, 203 insertions(+), 20 deletions(-) diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index 5039cdaa00..2618876245 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -14,7 +14,8 @@ #include "smtk/attribute/IntItem.h" #include "smtk/attribute/ResourceItem.h" #include "smtk/attribute/StringItem.h" - +#include "smtk/common/StringUtil.h" +#include "smtk/io/Logger.h" #include "smtk/session/polygon/Resource.h" #include "smtk/session/polygon/ImportPPG_xml.h" @@ -26,14 +27,30 @@ namespace { +// Macro for returning on error +#define errorMacro(msg) \ + do \ + { \ + smtkErrorMacro(this->log(), msg); \ + return this->createResult(smtk::operation::Operation::Outcome::FAILED); \ + } while (0) + +// Macro for returning error from Internal +#define errorMacroFalse(msg) \ + do \ + { \ + smtkErrorMacro(m_log, msg); \ + return false; \ + } while (0) + struct PPGVertex { double x; double y; - PPGVertex(double xval, double yval) - : x(xval) - , y(yval) + PPGVertex(double xcoord, double ycoord) + : x(xcoord) + , y(ycoord) { } }; @@ -43,12 +60,12 @@ struct PPGFace std::vector vertices; bool isHole; - PPGFace(bool hole = false) + PPGFace(const std::vector& inputVerts, bool hole = false) : isHole(hole) { + vertices = std::move(inputVerts); } }; - } // namespace namespace smtk @@ -57,9 +74,130 @@ namespace session { namespace polygon { +class ImportPPG::Internal +{ +public: + Internal(smtk::io::Logger& logger) + : m_log(logger) + { + } + ~Internal() = default; + + // Parse input line + bool parseInputLine(const std::string& line, unsigned lineNum); + bool parsePPGVertex(const std::vector& symbols, unsigned lineNum); + bool parsePPGFace(const std::vector& symbols, unsigned lineNum); + + smtk::io::Logger& m_log; + std::vector m_ppgVertexList; + std::vector m_ppgFaceList; +}; + +bool ImportPPG::Internal::parseInputLine(const std::string& line, unsigned lineNum) +{ + // std::cout << line << std::endl; + std::vector symbols = smtk::common::StringUtil::split(line, " ", true, true); + if (symbols.empty() || "#" == symbols[0]) + { + return true; + } + + else if ("v" == symbols[0]) + { + return this->parsePPGVertex(symbols, lineNum); + } + else if (("f" == symbols[0]) || ("h") == symbols[0]) + { + return this->parsePPGFace(symbols, lineNum); + } + else + { + errorMacroFalse("Unrecognized input line " << lineNum << ": " << line); + return false; + } + + return true; +} + +bool ImportPPG::Internal::parsePPGVertex(const std::vector& symbols, unsigned lineNum) +{ + if (symbols.size() < 3) + { + errorMacroFalse("Vertex on line " << lineNum << " not specified with x and y coords."); + } + + double x; + double y; + try + { + x = std::stod(symbols[1]); + y = std::stod(symbols[2]); + } + catch (const std::exception& e) + { + errorMacroFalse("Error parsing vertex on line " << lineNum); + } + + m_ppgVertexList.emplace(m_ppgVertexList.end(), x, y); + return true; +} + +bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, unsigned lineNum) +{ + if (symbols.size() < 2) + { + errorMacroFalse("Face on line " << lineNum << " not specified with any vertex indices."); + } + + std::vector vertices; + unsigned int index; + for (auto it = symbols.begin() + 1; it != symbols.end(); ++it) + { + std::string s = *it; + try + { + index = std::stoi(s); + } + catch (const std::exception& e) + { + errorMacroFalse("Error parsing index " << s << " in line " << lineNum); + } + + if (index == 0) + { + errorMacroFalse("Invalid index 0 on line " << lineNum << ". (Vertex indices starts at 1.)"); + } + else if (index > m_ppgVertexList.size()) + { + errorMacroFalse( + "Invalid index " << index << " on line " << lineNum + << ". Greater than number of vertices specified (" + << m_ppgVertexList.size() << ")."); + } + } // for (it) + + bool isHole = symbols[0] == "h"; + m_ppgFaceList.emplace(m_ppgFaceList.end(), vertices, isHole); + + // m_ppgVertexList.emplace(m_ppgVertexList.end(), x, y); + return true; +} + +ImportPPG::ImportPPG() +{ + m_internal = new Internal(this->log()); +} + +ImportPPG::~ImportPPG() +{ + delete m_internal; +} smtk::operation::Operation::Result ImportPPG::operateInternal() { + m_internal->m_ppgVertexList.clear(); + m_internal->m_ppgFaceList.clear(); + std::stringstream ss; // Check for string input first @@ -70,31 +208,45 @@ smtk::operation::Operation::Result ImportPPG::operateInternal() } else { + // Otherwise check for file input std::string filename = this->parameters()->findFile("filename")->value(); std::ifstream infile(filename); if (!infile.good()) { - smtkErrorMacro(this->log(), "Unable to find or read input file: " << filename); - return this->createResult(smtk::operation::Operation::Outcome::FAILED); + errorMacro("Unable to find or read input file: " << filename); } ss << infile.rdbuf(); infile.close(); } + // Traverse the input + if (ss.rdbuf()->in_avail() > 0) + { + std::string line; + unsigned int lineNum = 0; + while (std::getline(ss, line, '\n')) + { + ++lineNum; + if (!m_internal->parseInputLine(line, lineNum)) + { + return this->createResult(smtk::operation::Operation::Outcome::FAILED); + } + } // while + } // if + +#ifndef NDEBUG + std::cout << "PPG input vertex count: " << m_internal->m_ppgVertexList.size() << std::endl; + std::cout << "PPG input face count: " << m_internal->m_ppgFaceList.size() << std::endl; +#endif + + // Create the resource (note that polygon session is also required) auto polySession = smtk::session::polygon::Session::create(); auto resource = smtk::session::polygon::Resource::create(); resource->setSession(polySession); - auto result = this->createResult(smtk::operation::Operation::Outcome::SUCCEEDED); - if (ss.rdbuf()->in_avail() > 0) - { - // Create list of vertex and face instances - std::vector vertexList; - std::vector faceList; - } + auto result = this->createResult(smtk::operation::Operation::Outcome::SUCCEEDED); result->findResource("resource")->setValue(resource); - return result; } diff --git a/smtk/session/polygon/operators/ImportPPG.h b/smtk/session/polygon/operators/ImportPPG.h index 264685a449..3d280e3973 100644 --- a/smtk/session/polygon/operators/ImportPPG.h +++ b/smtk/session/polygon/operators/ImportPPG.h @@ -44,9 +44,16 @@ public: // Override ableToOperate() to support test mode bool ableToOperate() override; + virtual ~ImportPPG(); + protected: + ImportPPG(); smtk::operation::Operation::Result operateInternal() override; const char* xmlDescription() const override; + +private: + class Internal; + Internal* m_internal; }; } // namespace polygon diff --git a/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx b/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx index 22a7bbfee0..68425eb422 100644 --- a/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx +++ b/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx @@ -32,7 +32,29 @@ namespace const int OP_SUCCEEDED = static_cast(smtk::operation::Operation::Outcome::SUCCEEDED); const std::string resourceFilename("import-ppg.smtk"); -const std::string inputText = "v 0.0 0.0"; +const std::string ppgText = "# Test2D geometry\n" + "\n" + "# Vertices 1-8 for the outer polygon\n" + "v 0.0 2.0\n" + "v 1.0 0.0\n" + "v 9.0 0.0\n" + "v 9.0 2.0\n" + "v 8.0 4.0\n" + "v 6.0 5.0\n" + "v 3.0 5.0\n" + "v 1.0 4.0\n" + "\n" + "# Vertices 9-12 for the inner polygon (hole)\n" + "v 7.0 1.0\n" + "v 8.0 1.0\n" + "v 8.0 2.0\n" + "v 7.0 2.0\n" + "\n" + "# Outer polygon\n" + "f 1 2 3 4 5 6 7 8\n" + "\n" + "# Inner polygon (hole)\n" + "h 9 10 11 12\n"; } // namespace int UnitTestPolygonImportPPG(int /*argc*/, char* /*argv*/[]) @@ -58,14 +80,15 @@ int UnitTestPolygonImportPPG(int /*argc*/, char* /*argv*/[]) auto importOp = opManager->create(); test(importOp != nullptr, "No import operator"); importOp->parameters()->findString("string")->setIsEnabled(true); - importOp->parameters()->findString("string")->setValue(inputText); + importOp->parameters()->findString("string")->setValue(ppgText); // Run the operation auto importResult = importOp->operate(); int importOutcome = importResult->findInt("outcome")->value(); smtkTest( importOutcome == OP_SUCCEEDED, - "Import operation failed. Returned outcome " << std::to_string(importOutcome)); + "Import operation failed. Returned outcome " << std::to_string(importOutcome) << ". " + << importOp->log().convertToString()); // Get the model resource auto resourceItem = importResult->findResource("resource"); @@ -85,7 +108,8 @@ int UnitTestPolygonImportPPG(int /*argc*/, char* /*argv*/[]) int writeOutcome = writeResult->findInt("outcome")->value(); smtkTest( writeOutcome == OP_SUCCEEDED, - "Write operation failed. Returned outcome " << std::to_string(writeOutcome)); + "Write operation failed. Returned outcome " << std::to_string(writeOutcome) << ". " + << writeOp->log().convertToString()); return 0; } -- GitLab From 9625bdfedd0cded2a3ce273c215bc2d69c132907 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Tue, 27 Apr 2021 22:05:13 -0400 Subject: [PATCH 045/136] Add logic to create model vertices --- smtk/session/polygon/operators/ImportPPG.cxx | 172 +++++++++++++++++-- 1 file changed, 158 insertions(+), 14 deletions(-) diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index 2618876245..286098a89c 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -10,13 +10,30 @@ #include "ImportPPG.h" #include "smtk/attribute/Attribute.h" +#include "smtk/attribute/ComponentItem.h" +#include "smtk/attribute/DoubleItem.h" #include "smtk/attribute/FileItem.h" +#include "smtk/attribute/GroupItem.h" #include "smtk/attribute/IntItem.h" #include "smtk/attribute/ResourceItem.h" #include "smtk/attribute/StringItem.h" #include "smtk/common/StringUtil.h" +#include "smtk/common/UUID.h" #include "smtk/io/Logger.h" +#include "smtk/model/Entity.h" +#include "smtk/model/EntityRef.h" +#include "smtk/model/EntityTypeBits.h" +#include "smtk/model/Model.h" +#include "smtk/model/Resource.h" +#include "smtk/operation/Manager.h" +#include "smtk/operation/Operation.h" +#include "smtk/resource/Component.h" #include "smtk/session/polygon/Resource.h" +#include "smtk/session/polygon/operators/CreateEdgeFromVertices.h" +#include "smtk/session/polygon/operators/CreateFacesFromEdges.h" +#include "smtk/session/polygon/operators/CreateModel.h" +#include "smtk/session/polygon/operators/CreateVertices.h" +#include "smtk/session/polygon/operators/Delete.h" #include "smtk/session/polygon/ImportPPG_xml.h" @@ -27,6 +44,8 @@ namespace { +const int OP_SUCCEEDED = static_cast(smtk::operation::Operation::Outcome::SUCCEEDED); + // Macro for returning on error #define errorMacro(msg) \ do \ @@ -83,16 +102,125 @@ public: } ~Internal() = default; + void clear() + { + m_ppgFaceList.clear(); + m_ppgVertexList.clear(); + + m_resource.reset(); + m_modelEntity.reset(); + } + + // Build model entities + bool createModel(smtk::operation::ManagerPtr opManager); + bool createVertices(smtk::operation::ManagerPtr opManager); + bool createEdges(smtk::operation::ManagerPtr opManager); + bool createFaces(smtk::operation::ManagerPtr opManager); + // Parse input line bool parseInputLine(const std::string& line, unsigned lineNum); + + void print() const + { + std::cout << "PPG input vertex count: " << m_ppgVertexList.size() << std::endl; + std::cout << "PPG input face count: " << m_ppgFaceList.size() << std::endl; + } + + smtk::model::ResourcePtr resource() const { return m_resource; } + +protected: bool parsePPGVertex(const std::vector& symbols, unsigned lineNum); bool parsePPGFace(const std::vector& symbols, unsigned lineNum); smtk::io::Logger& m_log; - std::vector m_ppgVertexList; std::vector m_ppgFaceList; + std::vector m_ppgVertexList; + + std::vector m_newVertexList; + + smtk::model::ResourcePtr m_resource; + std::shared_ptr m_modelEntity; }; +bool ImportPPG::Internal::createModel(smtk::operation::ManagerPtr opManager) +{ + auto createOp = opManager->create(); + auto result = createOp->operate(); + int outcome = result->findInt("outcome")->value(); + if (outcome != OP_SUCCEEDED) + { + errorMacroFalse( + "CreateModel operation failed with outcome " << outcome << ". " + << createOp->log().convertToString()); + } + + auto resourceItem = result->findResource("resource"); + auto resource = resourceItem->value(); + m_resource = std::dynamic_pointer_cast(resource); + + smtk::attribute::ComponentItemPtr compItem = result->findComponent("model"); + m_modelEntity = compItem->value(); + return true; +} + +bool ImportPPG::Internal::createVertices(smtk::operation::ManagerPtr opManager) +{ + if (m_ppgVertexList.size() < 2) + { + return true; + } + auto vertsOp = opManager->create(); + bool associated = vertsOp->parameters()->associate(m_modelEntity); + + vertsOp->parameters()->findInt("point dimension")->setValue(2); + + auto pointsGroup = vertsOp->parameters()->findGroup("2d points"); + pointsGroup->setNumberOfGroups(m_ppgVertexList.size()); + + // Scan vertex list at 1 + for (std::size_t i = 0; i < m_ppgVertexList.size(); ++i) + { + auto v = m_ppgVertexList[i]; + auto pointItem = pointsGroup->findAs(i, "points"); + pointItem->setValue(0, v.x); + pointItem->setValue(1, v.y); + } + + auto result = vertsOp->operate(); + int outcome = result->findInt("outcome")->value(); + if (outcome != OP_SUCCEEDED) + { + errorMacroFalse( + "CreateVertices operation failed with outcome " << outcome << ". " + << vertsOp->log().convertToString()); + } + + auto createdItem = result->findComponent("created"); + std::stringstream ss; + for (std::size_t i = 0; i < createdItem->numberOfValues(); ++i) + { + auto entity = std::dynamic_pointer_cast(createdItem->value()); + smtk::model::EntityRef ref(entity); + ss.str(std::string()); + ss.clear(); + ss << "vertex " << (i + 1); + ref.setName(ss.str()); + m_newVertexList.push_back(entity); + } + + return true; +} + +bool ImportPPG::Internal::createEdges(smtk::operation::ManagerPtr opManager) +{ + return true; +} + +bool ImportPPG::Internal::createFaces(smtk::operation::ManagerPtr opManager) +{ + return true; +} + bool ImportPPG::Internal::parseInputLine(const std::string& line, unsigned lineNum) { // std::cout << line << std::endl; @@ -117,7 +245,7 @@ bool ImportPPG::Internal::parseInputLine(const std::string& line, unsigned lineN } return true; -} +} // parseInputLine() bool ImportPPG::Internal::parsePPGVertex(const std::vector& symbols, unsigned lineNum) { @@ -140,7 +268,7 @@ bool ImportPPG::Internal::parsePPGVertex(const std::vector& symbols m_ppgVertexList.emplace(m_ppgVertexList.end(), x, y); return true; -} +} // parsePPGVertex() bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, unsigned lineNum) { @@ -179,9 +307,8 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, bool isHole = symbols[0] == "h"; m_ppgFaceList.emplace(m_ppgFaceList.end(), vertices, isHole); - // m_ppgVertexList.emplace(m_ppgVertexList.end(), x, y); return true; -} +} // parsePPGFace() ImportPPG::ImportPPG() { @@ -195,8 +322,7 @@ ImportPPG::~ImportPPG() smtk::operation::Operation::Result ImportPPG::operateInternal() { - m_internal->m_ppgVertexList.clear(); - m_internal->m_ppgFaceList.clear(); + m_internal->clear(); std::stringstream ss; @@ -236,17 +362,35 @@ smtk::operation::Operation::Result ImportPPG::operateInternal() } // if #ifndef NDEBUG - std::cout << "PPG input vertex count: " << m_internal->m_ppgVertexList.size() << std::endl; - std::cout << "PPG input face count: " << m_internal->m_ppgFaceList.size() << std::endl; + m_internal->print(); #endif - // Create the resource (note that polygon session is also required) - auto polySession = smtk::session::polygon::Session::create(); - auto resource = smtk::session::polygon::Resource::create(); - resource->setSession(polySession); + this->log().reset(); + if (!m_internal->createModel(this->manager())) + { + return this->createResult(smtk::operation::Operation::Outcome::FAILED); + } + + this->log().reset(); + if (!m_internal->createVertices(this->manager())) + { + return this->createResult(smtk::operation::Operation::Outcome::FAILED); + } + + this->log().reset(); + if (!m_internal->createEdges(this->manager())) + { + return this->createResult(smtk::operation::Operation::Outcome::FAILED); + } + + this->log().reset(); + if (!m_internal->createFaces(this->manager())) + { + return this->createResult(smtk::operation::Operation::Outcome::FAILED); + } auto result = this->createResult(smtk::operation::Operation::Outcome::SUCCEEDED); - result->findResource("resource")->setValue(resource); + result->findResource("resource")->setValue(m_internal->resource()); return result; } -- GitLab From ed3fc3e74092da59093ae6ca3c877d20879a54ee Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Wed, 28 Apr 2021 08:25:22 -0400 Subject: [PATCH 046/136] Snapshot: this actually sorts vertices --- smtk/session/polygon/operators/ImportPPG.cxx | 83 ++++++++++++++++++-- 1 file changed, 78 insertions(+), 5 deletions(-) diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index 286098a89c..18cceb179a 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -25,6 +25,7 @@ #include "smtk/model/EntityTypeBits.h" #include "smtk/model/Model.h" #include "smtk/model/Resource.h" +#include "smtk/model/Vertex.h" #include "smtk/operation/Manager.h" #include "smtk/operation/Operation.h" #include "smtk/resource/Component.h" @@ -37,6 +38,7 @@ #include "smtk/session/polygon/ImportPPG_xml.h" +#include #include #include #include @@ -136,7 +138,7 @@ protected: std::vector m_ppgFaceList; std::vector m_ppgVertexList; - std::vector m_newVertexList; + std::vector m_newVertexList; smtk::model::ResourcePtr m_resource; std::shared_ptr m_modelEntity; @@ -195,17 +197,88 @@ bool ImportPPG::Internal::createVertices(smtk::operation::ManagerPtr opManager) << vertsOp->log().convertToString()); } + // Now gotta sort created vertices to match input order (never easy) + // First just copy the vertices into a std::set + std::set vertexSet; + std::vector vertexList; auto createdItem = result->findComponent("created"); std::stringstream ss; for (std::size_t i = 0; i < createdItem->numberOfValues(); ++i) { - auto entity = std::dynamic_pointer_cast(createdItem->value()); - smtk::model::EntityRef ref(entity); + // smtk::resource::PersistentObject pobj = createdItem->value(); + smtk::resource::ComponentPtr pcomp = createdItem->value(i); + // smtk::model::EntityRef ref(m_resource, pcomp->id()); + smtk::model::Vertex vref(m_resource, pcomp->id()); + vertexSet.insert(vref); + std::cout << __FILE__ << ":" << __LINE__ << " " << vertexSet.size() << std::endl; + vertexList.push_back(vref); + std::cout << __FILE__ << ":" << __LINE__ << " " << vertexList.size() << std::endl; + } + + // And the sorting by bruce force + // To reduce computation, the logic uses dx + dy in lieu of actual distance + // This requires that all points are at least 2*tol apart. + double tol = 1.0e-6; + m_newVertexList.clear(); + for (std::size_t i = 0; i < m_ppgVertexList.size(); ++i) + { + double x = m_ppgVertexList[i].x; + double y = m_ppgVertexList[i].y; + //std::shared_ptr matchVertex; + smtk::model::Vertex matchRef; + // matchRef.setEntity(smtk::common::UUID::null()); + + std::cout << __FILE__ << ":" << __LINE__ << " " << vertexSet.size() << std::endl; + for (const auto ref : vertexSet) + { + std::cout << __FILE__ << ":" << __LINE__ << " dim: " << ref.dimension() + << " flags: " << ref.flagSummary() << " is vertex: " << ref.isVertex() + << " coords: " << ref.coordinates()[0] << ", " << ref.coordinates()[1] << std::endl; +#if 0 + smtk::model::EntityPtr ent = ref.entityRecord(); + std::cout << __FILE__ << ":" << __LINE__ << " " << std::hex << ent.get() << std::dec << std::endl; + //auto vertex = std::dynamic_pointer_cast(ent); + const smtk::model::EntityRef* pref = &ref; + // smtk::model::EntityRef dref = const_cast(ref); + const smtk::model::Vertex* vertex = dynamic_cast(pref); + std::cout << __FILE__ << ":" << __LINE__ << " " << std::hex << vertex << std::dec << std::endl; +#else + +#endif + double dx2 = std::fabs(x - ref.coordinates()[0]); + std::cout << __FILE__ << ":" << __LINE__ << " " + << "dx2: " << dx2 << std::endl; + if (dx2 > tol) + { + continue; + } + double dy2 = std::fabs(y - ref.coordinates()[1]); + std::cout << __FILE__ << ":" << __LINE__ << " " + << "dy2: " << dy2 << std::endl; + if (dy2 < tol) + { + matchRef = ref; + std::cout << __FILE__ << ":" << __LINE__ << " " << ref.isValid() << std::endl; + std::cout << __FILE__ << ":" << __LINE__ << " " << matchRef.isValid() << std::endl; + break; + } + } // for (vertex) + + if (!matchRef.isValid()) + { + errorMacroFalse( + "CreateVertices unable to match input vertex " << (i + 1) << " at coords " << x << ", " + << y); + } + + // Now set name starting with vertex 1 (not 0) + // smtk::model::Vertex pv = matchRef.entityRecord(); + // smtk::model::EntityRef ref(*pv); ss.str(std::string()); ss.clear(); ss << "vertex " << (i + 1); - ref.setName(ss.str()); - m_newVertexList.push_back(entity); + matchRef.setName(ss.str()); + m_newVertexList.push_back(matchRef); } return true; -- GitLab From 7ade503a864c9838164f6e58e0cabd9d5a03b03e Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Wed, 28 Apr 2021 16:39:19 -0400 Subject: [PATCH 047/136] Replace create-vertex logic with simpler calls using internal namespace Sorting not required --- smtk/session/polygon/operators/ImportPPG.cxx | 135 +++++-------------- 1 file changed, 31 insertions(+), 104 deletions(-) diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index 18cceb179a..e131914d06 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -33,12 +33,13 @@ #include "smtk/session/polygon/operators/CreateEdgeFromVertices.h" #include "smtk/session/polygon/operators/CreateFacesFromEdges.h" #include "smtk/session/polygon/operators/CreateModel.h" -#include "smtk/session/polygon/operators/CreateVertices.h" #include "smtk/session/polygon/operators/Delete.h" +#include "smtk/session/polygon/internal/Model.h" +#include "smtk/session/polygon/internal/Model.txx" + #include "smtk/session/polygon/ImportPPG_xml.h" -#include #include #include #include @@ -115,7 +116,7 @@ public: // Build model entities bool createModel(smtk::operation::ManagerPtr opManager); - bool createVertices(smtk::operation::ManagerPtr opManager); + bool createVertices(); bool createEdges(smtk::operation::ManagerPtr opManager); bool createFaces(smtk::operation::ManagerPtr opManager); @@ -146,6 +147,11 @@ protected: bool ImportPPG::Internal::createModel(smtk::operation::ManagerPtr opManager) { +#ifndef NDEBUG + std::cout << "Creating Model..." << std::endl; +#endif + + // Initialize and run CreateModel operation. auto createOp = opManager->create(); auto result = createOp->operate(); int outcome = result->findInt("outcome")->value(); @@ -165,122 +171,43 @@ bool ImportPPG::Internal::createModel(smtk::operation::ManagerPtr opManager) return true; } -bool ImportPPG::Internal::createVertices(smtk::operation::ManagerPtr opManager) +bool ImportPPG::Internal::createVertices() { - if (m_ppgVertexList.size() < 2) + if (m_ppgVertexList.empty()) { + smtkWarningMacro(m_log, "No input vertices specified."); return true; } - auto vertsOp = opManager->create(); - bool associated = vertsOp->parameters()->associate(m_modelEntity); - - vertsOp->parameters()->findInt("point dimension")->setValue(2); - auto pointsGroup = vertsOp->parameters()->findGroup("2d points"); - pointsGroup->setNumberOfGroups(m_ppgVertexList.size()); +#ifndef NDEBUG + std::cout << "Creating Vertices..." << std::endl; +#endif - // Scan vertex list at 1 - for (std::size_t i = 0; i < m_ppgVertexList.size(); ++i) - { - auto v = m_ppgVertexList[i]; - auto pointItem = pointsGroup->findAs(i, "points"); - pointItem->setValue(0, v.x); - pointItem->setValue(1, v.y); - } + // Initialize new vertex list with one no-op vertex, because indices start with 1 + m_newVertexList.clear(); + m_newVertexList.emplace(m_newVertexList.end()); - auto result = vertsOp->operate(); - int outcome = result->findInt("outcome")->value(); - if (outcome != OP_SUCCEEDED) - { - errorMacroFalse( - "CreateVertices operation failed with outcome " << outcome << ". " - << vertsOp->log().convertToString()); - } + auto polyResource = std::dynamic_pointer_cast(m_resource); + internal::pmodel::Ptr storage = polyResource->findStorage(m_modelEntity->id()); - // Now gotta sort created vertices to match input order (never easy) - // First just copy the vertices into a std::set - std::set vertexSet; - std::vector vertexList; - auto createdItem = result->findComponent("created"); std::stringstream ss; - for (std::size_t i = 0; i < createdItem->numberOfValues(); ++i) - { - // smtk::resource::PersistentObject pobj = createdItem->value(); - smtk::resource::ComponentPtr pcomp = createdItem->value(i); - // smtk::model::EntityRef ref(m_resource, pcomp->id()); - smtk::model::Vertex vref(m_resource, pcomp->id()); - vertexSet.insert(vref); - std::cout << __FILE__ << ":" << __LINE__ << " " << vertexSet.size() << std::endl; - vertexList.push_back(vref); - std::cout << __FILE__ << ":" << __LINE__ << " " << vertexList.size() << std::endl; - } - - // And the sorting by bruce force - // To reduce computation, the logic uses dx + dy in lieu of actual distance - // This requires that all points are at least 2*tol apart. - double tol = 1.0e-6; - m_newVertexList.clear(); + std::vector coords(2); for (std::size_t i = 0; i < m_ppgVertexList.size(); ++i) { - double x = m_ppgVertexList[i].x; - double y = m_ppgVertexList[i].y; - //std::shared_ptr matchVertex; - smtk::model::Vertex matchRef; - // matchRef.setEntity(smtk::common::UUID::null()); - - std::cout << __FILE__ << ":" << __LINE__ << " " << vertexSet.size() << std::endl; - for (const auto ref : vertexSet) - { - std::cout << __FILE__ << ":" << __LINE__ << " dim: " << ref.dimension() - << " flags: " << ref.flagSummary() << " is vertex: " << ref.isVertex() - << " coords: " << ref.coordinates()[0] << ", " << ref.coordinates()[1] << std::endl; -#if 0 - smtk::model::EntityPtr ent = ref.entityRecord(); - std::cout << __FILE__ << ":" << __LINE__ << " " << std::hex << ent.get() << std::dec << std::endl; - //auto vertex = std::dynamic_pointer_cast(ent); - const smtk::model::EntityRef* pref = &ref; - // smtk::model::EntityRef dref = const_cast(ref); - const smtk::model::Vertex* vertex = dynamic_cast(pref); - std::cout << __FILE__ << ":" << __LINE__ << " " << std::hex << vertex << std::dec << std::endl; -#else - -#endif - double dx2 = std::fabs(x - ref.coordinates()[0]); - std::cout << __FILE__ << ":" << __LINE__ << " " - << "dx2: " << dx2 << std::endl; - if (dx2 > tol) - { - continue; - } - double dy2 = std::fabs(y - ref.coordinates()[1]); - std::cout << __FILE__ << ":" << __LINE__ << " " - << "dy2: " << dy2 << std::endl; - if (dy2 < tol) - { - matchRef = ref; - std::cout << __FILE__ << ":" << __LINE__ << " " << ref.isValid() << std::endl; - std::cout << __FILE__ << ":" << __LINE__ << " " << matchRef.isValid() << std::endl; - break; - } - } // for (vertex) - - if (!matchRef.isValid()) - { - errorMacroFalse( - "CreateVertices unable to match input vertex " << (i + 1) << " at coords " << x << ", " - << y); - } + auto v = m_ppgVertexList[i]; + coords[0] = v.x; + coords[1] = v.y; + smtk::session::polygon::internal::Point projected = + storage->projectPoint(coords.begin(), coords.begin() + 2); + smtk::model::Vertex newVertex = storage->addModelVertex(m_resource, projected); - // Now set name starting with vertex 1 (not 0) - // smtk::model::Vertex pv = matchRef.entityRecord(); - // smtk::model::EntityRef ref(*pv); + // Set the name starting with vertex 1 (not 0) ss.str(std::string()); ss.clear(); ss << "vertex " << (i + 1); - matchRef.setName(ss.str()); - m_newVertexList.push_back(matchRef); + newVertex.setName(ss.str()); + m_newVertexList.push_back(newVertex); } - return true; } @@ -445,7 +372,7 @@ smtk::operation::Operation::Result ImportPPG::operateInternal() } this->log().reset(); - if (!m_internal->createVertices(this->manager())) + if (!m_internal->createVertices()) { return this->createResult(smtk::operation::Operation::Outcome::FAILED); } -- GitLab From 9b2c5918819d3d2c356810ff86cd7e1c664877ce Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Wed, 28 Apr 2021 17:40:40 -0400 Subject: [PATCH 048/136] Add code to create model edges and faces; using operations Also prunes debug messages getting written to the console Still needs work - hole not getting created --- smtk/session/polygon/internal/Vertex.cxx | 2 +- .../session/polygon/operators/CreateFaces.cxx | 2 +- smtk/session/polygon/operators/ImportPPG.cxx | 163 ++++++++++++++++-- .../testing/cxx/UnitTestPolygonImportPPG.cxx | 8 + 4 files changed, 156 insertions(+), 19 deletions(-) diff --git a/smtk/session/polygon/internal/Vertex.cxx b/smtk/session/polygon/internal/Vertex.cxx index 6253315d32..00b6c419ef 100644 --- a/smtk/session/polygon/internal/Vertex.cxx +++ b/smtk/session/polygon/internal/Vertex.cxx @@ -214,7 +214,7 @@ bool vertex::setFaceAdjacency( { it->m_adjacentFace = adjacentFace; } - this->dump(); + // this->dump(); return true; } } diff --git a/smtk/session/polygon/operators/CreateFaces.cxx b/smtk/session/polygon/operators/CreateFaces.cxx index a4b980104c..7734e5d8e7 100644 --- a/smtk/session/polygon/operators/CreateFaces.cxx +++ b/smtk/session/polygon/operators/CreateFaces.cxx @@ -258,8 +258,8 @@ CreateFaces::Result CreateFaces::operateInternal() if (m_debugLevel > 0) { DumpEventQueue("Initial", eventQueue); + std::cout << "Bounds: " << xblo << " " << yblo << " " << xbhi << " " << ybhi << "\n"; } - std::cout << "Bounds: " << xblo << " " << yblo << " " << xbhi << " " << ybhi << "\n"; // The first event in eventQueue had better be a segment-start event. // So the first thing this event-loop should do is start processing edges. diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index e131914d06..7af103ab7e 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -20,9 +20,11 @@ #include "smtk/common/StringUtil.h" #include "smtk/common/UUID.h" #include "smtk/io/Logger.h" +#include "smtk/model/Edge.h" #include "smtk/model/Entity.h" #include "smtk/model/EntityRef.h" #include "smtk/model/EntityTypeBits.h" +#include "smtk/model/Face.h" #include "smtk/model/Model.h" #include "smtk/model/Resource.h" #include "smtk/model/Vertex.h" @@ -30,14 +32,13 @@ #include "smtk/operation/Operation.h" #include "smtk/resource/Component.h" #include "smtk/session/polygon/Resource.h" +#include "smtk/session/polygon/internal/Model.h" +#include "smtk/session/polygon/internal/Model.txx" #include "smtk/session/polygon/operators/CreateEdgeFromVertices.h" #include "smtk/session/polygon/operators/CreateFacesFromEdges.h" #include "smtk/session/polygon/operators/CreateModel.h" #include "smtk/session/polygon/operators/Delete.h" -#include "smtk/session/polygon/internal/Model.h" -#include "smtk/session/polygon/internal/Model.txx" - #include "smtk/session/polygon/ImportPPG_xml.h" #include @@ -79,13 +80,14 @@ struct PPGVertex struct PPGFace { - std::vector vertices; + std::vector vertexIds; // from input + std::vector edgeIds; // generated internally bool isHole; - PPGFace(const std::vector& inputVerts, bool hole = false) + PPGFace(const std::vector& inputVertexIds, bool hole = false) : isHole(hole) { - vertices = std::move(inputVerts); + vertexIds = std::move(inputVertexIds); } }; } // namespace @@ -140,6 +142,8 @@ protected: std::vector m_ppgVertexList; std::vector m_newVertexList; + std::vector m_newEdgeList; + std::vector m_newFaceList; smtk::model::ResourcePtr m_resource; std::shared_ptr m_modelEntity; @@ -168,6 +172,10 @@ bool ImportPPG::Internal::createModel(smtk::operation::ManagerPtr opManager) smtk::attribute::ComponentItemPtr compItem = result->findComponent("model"); m_modelEntity = compItem->value(); + + // Set name + smtk::model::Model modelRef(m_resource, m_modelEntity->id()); + modelRef.setName("model 1"); return true; } @@ -213,11 +221,130 @@ bool ImportPPG::Internal::createVertices() bool ImportPPG::Internal::createEdges(smtk::operation::ManagerPtr opManager) { +#ifndef NDEBUG + std::cout << "Creating Edges..." << std::endl; +#endif + + // Initialize new vertex list with one no-op vertex, because indices start with 1 + m_newEdgeList.clear(); + m_newEdgeList.emplace(m_newEdgeList.end()); + std::stringstream ss; + + // Initialize and run CreateEdgeFromVertices operation. + auto createOp = opManager->create(); + for (auto& ppgFace : m_ppgFaceList) + { + ppgFace.edgeIds.clear(); + std::vector& vertexIds(ppgFace.vertexIds); // shorthand + // Temporarily add first vertex to the end of the list + vertexIds.push_back(vertexIds.front()); + for (std::size_t i = 1; i < vertexIds.size(); ++i) + { + createOp->parameters()->removeAllAssociations(); + unsigned id1 = vertexIds[i - 1]; + unsigned id2 = vertexIds[i]; + + auto v1 = m_newVertexList[id1]; + auto v2 = m_newVertexList[id2]; + + createOp->parameters()->associateEntity(v1); + createOp->parameters()->associateEntity(v2); + auto result = createOp->operate(); + int outcome = result->findInt("outcome")->value(); + if (outcome != OP_SUCCEEDED) + { + errorMacroFalse("Failed to create edge from vertex " << (i - 1) << " to " << i); + } + + // Assign name + auto createdItem = result->findComponent("created"); + smtk::resource::ComponentPtr pcomp = createdItem->value(); + smtk::model::Edge edgeRef(m_resource, pcomp->id()); + std::size_t edgeId = m_newEdgeList.size(); + ppgFace.edgeIds.push_back(edgeId); + + ss.str(std::string()); + ss.clear(); + ss << "edge " << edgeId; + edgeRef.setName(ss.str()); + + m_newEdgeList.push_back(edgeRef); + } // for (i) + + // Remove temp vertex added to end of list + vertexIds.pop_back(); + } // for (ppgFace) + return true; } bool ImportPPG::Internal::createFaces(smtk::operation::ManagerPtr opManager) { +#ifndef NDEBUG + std::cout << "Creating Faces..." << std::endl; +#endif + + m_newFaceList.clear(); + m_newFaceList.emplace(m_newFaceList.end()); + std::vector facesToDelete; + std::stringstream ss; + + // Initialize and run CreateFacesFromEdges operation. + auto createOp = opManager->create(); + for (auto& ppgFace : m_ppgFaceList) + { + createOp->parameters()->removeAllAssociations(); + for (unsigned int id : ppgFace.edgeIds) + { + auto edgeRef = m_newEdgeList[id]; + createOp->parameters()->associateEntity(edgeRef); + } + + auto result = createOp->operate(); + int outcome = result->findInt("outcome")->value(); + if (outcome != OP_SUCCEEDED) + { + errorMacroFalse("Failed to create face " << m_newFaceList.size()); + } + + // Assign name + auto createdItem = result->findComponent("created"); + smtk::resource::ComponentPtr pcomp = createdItem->value(); + smtk::model::Face faceRef(m_resource, pcomp->id()); + std::size_t faceId = m_newFaceList.size(); + + ss.str(std::string()); + ss.clear(); + ss << "face " << faceId; + faceRef.setName(ss.str()); + + m_newFaceList.push_back(faceRef); + + if (ppgFace.isHole) + { + facesToDelete.push_back(faceRef); + } + } // for (ppgFace) + + if (!facesToDelete.empty()) + { +#ifndef NDEBUG + std::cout << "Deleting Faces (" << facesToDelete.size() << ")..." << std::endl; +#endif + // Initialize and run Delete operation. + auto deleteOp = opManager->create(); + for (auto& faceRef : facesToDelete) + { + deleteOp->parameters()->associateEntity(faceRef); + } + auto deleteResult = deleteOp->operate(); + int deleteOutcome = deleteResult->findInt("outcome")->value(); + if (deleteOutcome != OP_SUCCEEDED) + { + errorMacroFalse("Failed to delete face(s) " << m_newFaceList.size()); + } + } // if (facesToDelete) + return true; } @@ -277,35 +404,37 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, errorMacroFalse("Face on line " << lineNum << " not specified with any vertex indices."); } - std::vector vertices; - unsigned int index; + std::vector vertexIds; + unsigned int vertexId; for (auto it = symbols.begin() + 1; it != symbols.end(); ++it) { std::string s = *it; try { - index = std::stoi(s); + vertexId = std::stoi(s); } catch (const std::exception& e) { - errorMacroFalse("Error parsing index " << s << " in line " << lineNum); + errorMacroFalse("Error parsing vertex id " << s << " in line " << lineNum); } - if (index == 0) + if (vertexId == 0) { - errorMacroFalse("Invalid index 0 on line " << lineNum << ". (Vertex indices starts at 1.)"); + errorMacroFalse("Invalid vertex id 0 on line " << lineNum << ". (Vertex ids start at 1.)"); } - else if (index > m_ppgVertexList.size()) + else if (vertexId > m_ppgVertexList.size()) { errorMacroFalse( - "Invalid index " << index << " on line " << lineNum - << ". Greater than number of vertices specified (" - << m_ppgVertexList.size() << ")."); + "Invalid vertexId " << vertexId << " on line " << lineNum + << ". Greater than number of vertices specified (" + << m_ppgVertexList.size() << ")."); } + + vertexIds.push_back(vertexId); } // for (it) bool isHole = symbols[0] == "h"; - m_ppgFaceList.emplace(m_ppgFaceList.end(), vertices, isHole); + m_ppgFaceList.emplace(m_ppgFaceList.end(), vertexIds, isHole); return true; } // parsePPGFace() diff --git a/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx b/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx index 68425eb422..8c0f7f192b 100644 --- a/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx +++ b/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx @@ -97,6 +97,14 @@ int UnitTestPolygonImportPPG(int /*argc*/, char* /*argv*/[]) auto modelResource = std::dynamic_pointer_cast(resource); test(modelResource != nullptr, "Model resource not found."); + // Check entity counts + auto vList = modelResource->entitiesMatchingFlags(smtk::model::VERTEX); + smtkTest(vList.size() == 12, "Expected 12 model vertices not " << vList.size() << "."); + auto eList = modelResource->entitiesMatchingFlags(smtk::model::EDGE); + smtkTest(eList.size() == 12, "Expected 12 model edges not " << eList.size() << "."); + auto fList = modelResource->entitiesMatchingFlags(smtk::model::FACE); + smtkTest(fList.size() == 1, "Expected 2 model faces not " << fList.size() << "."); + // Write model resource to file std::cout << "Writing " << smtkPath << std::endl; auto writeOp = opManager->create(); -- GitLab From d297688bdf102cc328fc0b2678090587fe7cc891 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Fri, 30 Apr 2021 15:51:05 -0400 Subject: [PATCH 049/136] Switch to CreateFaces operation, which creates holes correctly * Requires new logic to match generated faces with input (ppg) faces. * Partial implementation - todo match face ids to input --- smtk/session/polygon/operators/ImportPPG.cxx | 246 ++++++++++++------ .../testing/cxx/UnitTestPolygonImportPPG.cxx | 16 +- 2 files changed, 179 insertions(+), 83 deletions(-) diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index 7af103ab7e..5e23fc6590 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -35,13 +35,16 @@ #include "smtk/session/polygon/internal/Model.h" #include "smtk/session/polygon/internal/Model.txx" #include "smtk/session/polygon/operators/CreateEdgeFromVertices.h" -#include "smtk/session/polygon/operators/CreateFacesFromEdges.h" +#include "smtk/session/polygon/operators/CreateFaces.h" #include "smtk/session/polygon/operators/CreateModel.h" #include "smtk/session/polygon/operators/Delete.h" #include "smtk/session/polygon/ImportPPG_xml.h" #include +#include +#include +#include #include #include #include @@ -68,27 +71,45 @@ const int OP_SUCCEEDED = static_cast(smtk::operation::Operation::Outcome::S struct PPGVertex { + std::size_t userId; double x; double y; - PPGVertex(double xcoord, double ycoord) - : x(xcoord) + PPGVertex(std::size_t inputId, double xcoord, double ycoord) + : userId(inputId) + , x(xcoord) , y(ycoord) { } + + void dump() const + { + std::cout << "PPGVertex userId: " << userId << ", x: " << x << ", y: " << y << std::endl; + } }; struct PPGFace { - std::vector vertexIds; // from input - std::vector edgeIds; // generated internally + std::size_t userId; + std::vector vertexIds; // from input bool isHole; - PPGFace(const std::vector& inputVertexIds, bool hole = false) - : isHole(hole) + PPGFace(std::size_t inputId, const std::vector& inputVertexIds, bool hole = false) + : userId(inputId) + , isHole(hole) { vertexIds = std::move(inputVertexIds); } + + void dump() const + { + std::cout << "PPGFace userId: " << userId << ", isHole: " << isHole << '\n' << "vertex ids:"; + for (auto vid : vertexIds) + { + std::cout << " " << vid; + } + std::cout << std::endl; + } }; } // namespace @@ -103,6 +124,7 @@ class ImportPPG::Internal public: Internal(smtk::io::Logger& logger) : m_log(logger) + , m_holeCount(0) { } ~Internal() = default; @@ -137,13 +159,20 @@ protected: bool parsePPGVertex(const std::vector& symbols, unsigned lineNum); bool parsePPGFace(const std::vector& symbols, unsigned lineNum); + bool createHoles(smtk::operation::ManagerPtr opManager); + smtk::io::Logger& m_log; std::vector m_ppgFaceList; std::vector m_ppgVertexList; + unsigned int m_holeCount; std::vector m_newVertexList; - std::vector m_newEdgeList; - std::vector m_newFaceList; + + // Map model vertex uuid to user id + std::map m_vertexIdMap; + + // Map face uuid to set of user's vertex ids + std::map> m_faceVertexIdMap; smtk::model::ResourcePtr m_resource; std::shared_ptr m_modelEntity; @@ -194,27 +223,31 @@ bool ImportPPG::Internal::createVertices() // Initialize new vertex list with one no-op vertex, because indices start with 1 m_newVertexList.clear(); m_newVertexList.emplace(m_newVertexList.end()); + m_vertexIdMap.clear(); auto polyResource = std::dynamic_pointer_cast(m_resource); internal::pmodel::Ptr storage = polyResource->findStorage(m_modelEntity->id()); std::stringstream ss; std::vector coords(2); - for (std::size_t i = 0; i < m_ppgVertexList.size(); ++i) + for (const auto& v : m_ppgVertexList) { - auto v = m_ppgVertexList[i]; coords[0] = v.x; coords[1] = v.y; smtk::session::polygon::internal::Point projected = storage->projectPoint(coords.begin(), coords.begin() + 2); smtk::model::Vertex newVertex = storage->addModelVertex(m_resource, projected); - // Set the name starting with vertex 1 (not 0) + // Set the vertex name ss.str(std::string()); ss.clear(); - ss << "vertex " << (i + 1); + ss << "vertex " << v.userId; newVertex.setName(ss.str()); + + // Update member data m_newVertexList.push_back(newVertex); + smtk::common::UUID uuid = newVertex.entity(); + m_vertexIdMap[uuid] = v.userId; } return true; } @@ -225,17 +258,14 @@ bool ImportPPG::Internal::createEdges(smtk::operation::ManagerPtr opManager) std::cout << "Creating Edges..." << std::endl; #endif - // Initialize new vertex list with one no-op vertex, because indices start with 1 - m_newEdgeList.clear(); - m_newEdgeList.emplace(m_newEdgeList.end()); + std::size_t edgeId = 0; std::stringstream ss; // Initialize and run CreateEdgeFromVertices operation. auto createOp = opManager->create(); for (auto& ppgFace : m_ppgFaceList) { - ppgFace.edgeIds.clear(); - std::vector& vertexIds(ppgFace.vertexIds); // shorthand + std::vector& vertexIds(ppgFace.vertexIds); // shorthand // Temporarily add first vertex to the end of the list vertexIds.push_back(vertexIds.front()); for (std::size_t i = 1; i < vertexIds.size(); ++i) @@ -256,19 +286,16 @@ bool ImportPPG::Internal::createEdges(smtk::operation::ManagerPtr opManager) errorMacroFalse("Failed to create edge from vertex " << (i - 1) << " to " << i); } - // Assign name + // Get the new edge and assign name auto createdItem = result->findComponent("created"); smtk::resource::ComponentPtr pcomp = createdItem->value(); smtk::model::Edge edgeRef(m_resource, pcomp->id()); - std::size_t edgeId = m_newEdgeList.size(); - ppgFace.edgeIds.push_back(edgeId); + ++edgeId; ss.str(std::string()); ss.clear(); ss << "edge " << edgeId; edgeRef.setName(ss.str()); - - m_newEdgeList.push_back(edgeRef); } // for (i) // Remove temp vertex added to end of list @@ -284,66 +311,63 @@ bool ImportPPG::Internal::createFaces(smtk::operation::ManagerPtr opManager) std::cout << "Creating Faces..." << std::endl; #endif - m_newFaceList.clear(); - m_newFaceList.emplace(m_newFaceList.end()); - std::vector facesToDelete; - std::stringstream ss; + // Initialize and run CreateFaces operation. + auto createOp = opManager->create(); + createOp->parameters()->associate(m_modelEntity); + auto result = createOp->operate(); + int outcome = result->findInt("outcome")->value(); + if (outcome != OP_SUCCEEDED) + { + errorMacroFalse("Failed to create model faces."); + } - // Initialize and run CreateFacesFromEdges operation. - auto createOp = opManager->create(); - for (auto& ppgFace : m_ppgFaceList) + // Build m_faceVertexIdMap for relating back to input spec + auto createdItem = result->findComponent("created"); + for (std::size_t i = 0; i < createdItem->numberOfValues(); ++i) { - createOp->parameters()->removeAllAssociations(); - for (unsigned int id : ppgFace.edgeIds) - { - auto edgeRef = m_newEdgeList[id]; - createOp->parameters()->associateEntity(edgeRef); - } + smtk::resource::ComponentPtr pcomp = createdItem->value(i); + smtk::model::Face faceRef(m_resource, pcomp->id()); - auto result = createOp->operate(); - int outcome = result->findInt("outcome")->value(); - if (outcome != OP_SUCCEEDED) + // Get the set of vertex uuids on this face + smtk::common::UUID faceUUID = faceRef.entity(); + std::set uuidList = m_resource->lowerDimensionalBoundaries(faceUUID, 0); + std::set vertexIds; + for (auto& uuid : uuidList) { - errorMacroFalse("Failed to create face " << m_newFaceList.size()); +#ifndef NDEBUG + if (m_vertexIdMap.count(uuid) == 0) + { + std::cout << "ERROR: uuid " << uuid << " is NOT in m_vertexIdMap" << std::endl; + continue; + } +#endif + vertexIds.insert(m_vertexIdMap[uuid]); } - // Assign name - auto createdItem = result->findComponent("created"); - smtk::resource::ComponentPtr pcomp = createdItem->value(); - smtk::model::Face faceRef(m_resource, pcomp->id()); - std::size_t faceId = m_newFaceList.size(); + m_faceVertexIdMap[faceUUID] = vertexIds; + } // for (i) + + // Now call createHoles, which prunes m_vertexIdMap and m_faceVertexIdMap + if (!this->createHoles(opManager)) + { + return false; + } + + // Use m_faceVertexIdList to match model faces with ppg faces. + // Todo replace interm logic here that just numbers faces sequentially + unsigned int faceId = 0; + std::stringstream ss; + for (auto it = m_faceVertexIdMap.begin(); it != m_faceVertexIdMap.end(); ++it) + { + auto uuid = it->first; + smtk::model::Face faceRef(m_resource, uuid); + ++faceId; ss.str(std::string()); ss.clear(); ss << "face " << faceId; faceRef.setName(ss.str()); - - m_newFaceList.push_back(faceRef); - - if (ppgFace.isHole) - { - facesToDelete.push_back(faceRef); - } - } // for (ppgFace) - - if (!facesToDelete.empty()) - { -#ifndef NDEBUG - std::cout << "Deleting Faces (" << facesToDelete.size() << ")..." << std::endl; -#endif - // Initialize and run Delete operation. - auto deleteOp = opManager->create(); - for (auto& faceRef : facesToDelete) - { - deleteOp->parameters()->associateEntity(faceRef); - } - auto deleteResult = deleteOp->operate(); - int deleteOutcome = deleteResult->findInt("outcome")->value(); - if (deleteOutcome != OP_SUCCEEDED) - { - errorMacroFalse("Failed to delete face(s) " << m_newFaceList.size()); - } - } // if (facesToDelete) + } return true; } @@ -393,7 +417,8 @@ bool ImportPPG::Internal::parsePPGVertex(const std::vector& symbols errorMacroFalse("Error parsing vertex on line " << lineNum); } - m_ppgVertexList.emplace(m_ppgVertexList.end(), x, y); + auto userId = 1 + m_ppgVertexList.size(); + m_ppgVertexList.emplace(m_ppgVertexList.end(), userId, x, y); return true; } // parsePPGVertex() @@ -404,7 +429,7 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, errorMacroFalse("Face on line " << lineNum << " not specified with any vertex indices."); } - std::vector vertexIds; + std::vector vertexIds; unsigned int vertexId; for (auto it = symbols.begin() + 1; it != symbols.end(); ++it) { @@ -433,12 +458,83 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, vertexIds.push_back(vertexId); } // for (it) + std::size_t inputId = 1 + m_ppgFaceList.size(); bool isHole = symbols[0] == "h"; - m_ppgFaceList.emplace(m_ppgFaceList.end(), vertexIds, isHole); + m_ppgFaceList.emplace(m_ppgFaceList.end(), inputId, vertexIds, isHole); + m_holeCount += isHole ? 1 : 0; return true; } // parsePPGFace() +bool ImportPPG::Internal::createHoles(smtk::operation::ManagerPtr opManager) +{ + // First check if any input faces are holes + if (m_holeCount == 0) + { + return true; + } + +#ifndef NDEBUG + std::cout << "Creating Holes..." << std::endl; +#endif + + // Initialize Delete operation. + auto deleteOp = opManager->create(); + + for (auto& ppgFace : m_ppgFaceList) + { + if (!ppgFace.isHole) + { + continue; + } + + // ppgFace.dump(); + // Find matching model face by matching vertices in m_faceVertexIdList + auto matchUUID = + smtk::common::UUID::null(); // for checking that we found the matching model face + for (auto it = m_faceVertexIdMap.begin(); it != m_faceVertexIdMap.end(); ++it) + { + auto faceUUID = it->first; + std::set vertexIds = it->second; + + std::set ppgFaceVertexIds(ppgFace.vertexIds.begin(), ppgFace.vertexIds.end()); + if (vertexIds == ppgFaceVertexIds) + { + matchUUID = faceUUID; + + // Add this face to the delete operator and remove from faceVertexIdMap + smtk::model::Face faceRef(m_resource, faceUUID); + deleteOp->parameters()->associateEntity(faceRef); + m_faceVertexIdMap.erase(it); + + // Also remove the matching vertices from m_vertexIdMap + std::set uuidList = m_resource->lowerDimensionalBoundaries(faceUUID, 0); + for (const auto& uuid : uuidList) + { + m_vertexIdMap.erase(uuid); + } + + break; + } + } // for + + if (matchUUID.isNull()) + { + errorMacroFalse("ERROR: matchUUID is NULL for some hole"); + } + } // for (ppgFace) + + // Apply the Delete operation + auto deleteResult = deleteOp->operate(); + int deleteOutcome = deleteResult->findInt("outcome")->value(); + if (deleteOutcome != OP_SUCCEEDED) + { + errorMacroFalse("Failed to delete face(s) "); + } + + return true; +} + ImportPPG::ImportPPG() { m_internal = new Internal(this->log()); diff --git a/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx b/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx index 8c0f7f192b..eed387485f 100644 --- a/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx +++ b/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx @@ -97,14 +97,6 @@ int UnitTestPolygonImportPPG(int /*argc*/, char* /*argv*/[]) auto modelResource = std::dynamic_pointer_cast(resource); test(modelResource != nullptr, "Model resource not found."); - // Check entity counts - auto vList = modelResource->entitiesMatchingFlags(smtk::model::VERTEX); - smtkTest(vList.size() == 12, "Expected 12 model vertices not " << vList.size() << "."); - auto eList = modelResource->entitiesMatchingFlags(smtk::model::EDGE); - smtkTest(eList.size() == 12, "Expected 12 model edges not " << eList.size() << "."); - auto fList = modelResource->entitiesMatchingFlags(smtk::model::FACE); - smtkTest(fList.size() == 1, "Expected 2 model faces not " << fList.size() << "."); - // Write model resource to file std::cout << "Writing " << smtkPath << std::endl; auto writeOp = opManager->create(); @@ -119,5 +111,13 @@ int UnitTestPolygonImportPPG(int /*argc*/, char* /*argv*/[]) "Write operation failed. Returned outcome " << std::to_string(writeOutcome) << ". " << writeOp->log().convertToString()); + // Check entity counts + auto vList = modelResource->entitiesMatchingFlags(smtk::model::VERTEX); + smtkTest(vList.size() == 12, "Expected 12 model vertices not " << vList.size() << "."); + auto eList = modelResource->entitiesMatchingFlags(smtk::model::EDGE); + smtkTest(eList.size() == 12, "Expected 12 model edges not " << eList.size() << "."); + auto fList = modelResource->entitiesMatchingFlags(smtk::model::FACE); + smtkTest(fList.size() == 1, "Expected 1 model face not " << fList.size() << "."); + return 0; } -- GitLab From 637327337a1db9986e7e5a5153783316e0d6576c Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Fri, 30 Apr 2021 17:40:27 -0400 Subject: [PATCH 050/136] Finish logic to match remaining faces to input * Refactor logic for matching faces by vertex ids --- smtk/session/polygon/operators/ImportPPG.cxx | 103 +++++++++++-------- 1 file changed, 61 insertions(+), 42 deletions(-) diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index 5e23fc6590..8281167603 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -41,6 +41,7 @@ #include "smtk/session/polygon/ImportPPG_xml.h" +#include #include #include #include @@ -150,7 +151,8 @@ public: void print() const { std::cout << "PPG input vertex count: " << m_ppgVertexList.size() << std::endl; - std::cout << "PPG input face count: " << m_ppgFaceList.size() << std::endl; + std::cout << "PPG input face count: " << m_ppgFaceList.size() - m_holeCount << std::endl; + std::cout << "PPG input hole count: " << m_holeCount << std::endl; } smtk::model::ResourcePtr resource() const { return m_resource; } @@ -159,8 +161,12 @@ protected: bool parsePPGVertex(const std::vector& symbols, unsigned lineNum); bool parsePPGFace(const std::vector& symbols, unsigned lineNum); + // Process holes and update member data (maps) bool createHoles(smtk::operation::ManagerPtr opManager); + // Locate model face by matching vertex ids; uses member data (maps) + smtk::common::UUID findMatchingModelFace(const PPGFace& ppgFace); + smtk::io::Logger& m_log; std::vector m_ppgFaceList; std::vector m_ppgVertexList; @@ -353,19 +359,25 @@ bool ImportPPG::Internal::createFaces(smtk::operation::ManagerPtr opManager) return false; } - // Use m_faceVertexIdList to match model faces with ppg faces. - // Todo replace interm logic here that just numbers faces sequentially - unsigned int faceId = 0; + // Use m_faceVertexIdList to match model faces to ppg faces. std::stringstream ss; - for (auto it = m_faceVertexIdMap.begin(); it != m_faceVertexIdMap.end(); ++it) + for (const auto& ppgFace : m_ppgFaceList) { - auto uuid = it->first; - smtk::model::Face faceRef(m_resource, uuid); + if (ppgFace.isHole) + { + continue; + } + + auto faceUUID = this->findMatchingModelFace(ppgFace); + if (faceUUID.isNull()) + { + errorMacroFalse("Failed to find match for ppgFace " << ppgFace.userId); + } - ++faceId; + smtk::model::Face faceRef(m_resource, faceUUID); ss.str(std::string()); ss.clear(); - ss << "face " << faceId; + ss << "face " << ppgFace.userId; faceRef.setName(ss.str()); } @@ -458,8 +470,8 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, vertexIds.push_back(vertexId); } // for (it) - std::size_t inputId = 1 + m_ppgFaceList.size(); bool isHole = symbols[0] == "h"; + std::size_t inputId = isHole ? 0 : 1 + m_ppgFaceList.size() - m_holeCount; m_ppgFaceList.emplace(m_ppgFaceList.end(), inputId, vertexIds, isHole); m_holeCount += isHole ? 1 : 0; @@ -483,45 +495,22 @@ bool ImportPPG::Internal::createHoles(smtk::operation::ManagerPtr opManager) for (auto& ppgFace : m_ppgFaceList) { + // Skip faces that aren't specified to be holes if (!ppgFace.isHole) { continue; } - // ppgFace.dump(); - // Find matching model face by matching vertices in m_faceVertexIdList - auto matchUUID = - smtk::common::UUID::null(); // for checking that we found the matching model face - for (auto it = m_faceVertexIdMap.begin(); it != m_faceVertexIdMap.end(); ++it) - { - auto faceUUID = it->first; - std::set vertexIds = it->second; - - std::set ppgFaceVertexIds(ppgFace.vertexIds.begin(), ppgFace.vertexIds.end()); - if (vertexIds == ppgFaceVertexIds) - { - matchUUID = faceUUID; - - // Add this face to the delete operator and remove from faceVertexIdMap - smtk::model::Face faceRef(m_resource, faceUUID); - deleteOp->parameters()->associateEntity(faceRef); - m_faceVertexIdMap.erase(it); - - // Also remove the matching vertices from m_vertexIdMap - std::set uuidList = m_resource->lowerDimensionalBoundaries(faceUUID, 0); - for (const auto& uuid : uuidList) - { - m_vertexIdMap.erase(uuid); - } - - break; - } - } // for - - if (matchUUID.isNull()) + // Find the corresponding model face + auto faceUUID = this->findMatchingModelFace(ppgFace); + if (faceUUID.isNull()) { - errorMacroFalse("ERROR: matchUUID is NULL for some hole"); + errorMacroFalse("ERROR: Unable to find matching face some hole"); } + + // Add this face to the delete operator + smtk::model::Face faceRef(m_resource, faceUUID); + deleteOp->parameters()->associateEntity(faceRef); } // for (ppgFace) // Apply the Delete operation @@ -535,6 +524,36 @@ bool ImportPPG::Internal::createHoles(smtk::operation::ManagerPtr opManager) return true; } +smtk::common::UUID ImportPPG::Internal::findMatchingModelFace(const PPGFace& ppgFace) +{ + // Important: + // * Only checks model faces in m_faceVertexIdMap + // * And removes the matching face from m_faceVertexIdMap + for (auto it = m_faceVertexIdMap.begin(); it != m_faceVertexIdMap.end(); ++it) + { + std::set vertexIds = it->second; + std::set ppgFaceVertexIds(ppgFace.vertexIds.begin(), ppgFace.vertexIds.end()); + // Matching logic is different for holes and faces + // - holes must be exact match + // - model faces may have more vertices than ppgFace specifies (because of holes) + bool match = ppgFace.isHole + ? vertexIds == ppgFaceVertexIds + : std::includes( + vertexIds.begin(), vertexIds.end(), ppgFaceVertexIds.begin(), ppgFaceVertexIds.end()); + if (match) + { + // Remove from the map + m_faceVertexIdMap.erase(it); + + auto faceUUID = it->first; + return faceUUID; + } + } // for + + // Return null if no match found + return smtk::common::UUID::null(); +} + ImportPPG::ImportPPG() { m_internal = new Internal(this->log()); -- GitLab From 2a8398fd84d9fdee9a8c8669ee5c45aac1112a59 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Fri, 30 Apr 2021 21:07:11 -0400 Subject: [PATCH 051/136] Add python bindings and test for ImportPPG Also remove operation manager from ImportPPG; was never needed --- smtk/session/polygon/operators/ImportPPG.cxx | 33 +++-- .../polygon/pybind11/PybindImportPPG.h | 35 +++++ .../polygon/pybind11/PybindPolygonSession.cxx | 2 + .../polygon/testing/python/CMakeLists.txt | 5 +- .../testing/python/polygonImportPPG.py | 121 ++++++++++++++++++ 5 files changed, 177 insertions(+), 19 deletions(-) create mode 100644 smtk/session/polygon/pybind11/PybindImportPPG.h create mode 100644 smtk/session/polygon/testing/python/polygonImportPPG.py diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index 8281167603..5c34098083 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -28,7 +28,6 @@ #include "smtk/model/Model.h" #include "smtk/model/Resource.h" #include "smtk/model/Vertex.h" -#include "smtk/operation/Manager.h" #include "smtk/operation/Operation.h" #include "smtk/resource/Component.h" #include "smtk/session/polygon/Resource.h" @@ -140,10 +139,10 @@ public: } // Build model entities - bool createModel(smtk::operation::ManagerPtr opManager); + bool createModel(); bool createVertices(); - bool createEdges(smtk::operation::ManagerPtr opManager); - bool createFaces(smtk::operation::ManagerPtr opManager); + bool createEdges(); + bool createFaces(); // Parse input line bool parseInputLine(const std::string& line, unsigned lineNum); @@ -162,7 +161,7 @@ protected: bool parsePPGFace(const std::vector& symbols, unsigned lineNum); // Process holes and update member data (maps) - bool createHoles(smtk::operation::ManagerPtr opManager); + bool createHoles(); // Locate model face by matching vertex ids; uses member data (maps) smtk::common::UUID findMatchingModelFace(const PPGFace& ppgFace); @@ -184,14 +183,14 @@ protected: std::shared_ptr m_modelEntity; }; -bool ImportPPG::Internal::createModel(smtk::operation::ManagerPtr opManager) +bool ImportPPG::Internal::createModel() { #ifndef NDEBUG std::cout << "Creating Model..." << std::endl; #endif // Initialize and run CreateModel operation. - auto createOp = opManager->create(); + auto createOp = smtk::session::polygon::CreateModel::create(); auto result = createOp->operate(); int outcome = result->findInt("outcome")->value(); if (outcome != OP_SUCCEEDED) @@ -258,7 +257,7 @@ bool ImportPPG::Internal::createVertices() return true; } -bool ImportPPG::Internal::createEdges(smtk::operation::ManagerPtr opManager) +bool ImportPPG::Internal::createEdges() { #ifndef NDEBUG std::cout << "Creating Edges..." << std::endl; @@ -268,7 +267,7 @@ bool ImportPPG::Internal::createEdges(smtk::operation::ManagerPtr opManager) std::stringstream ss; // Initialize and run CreateEdgeFromVertices operation. - auto createOp = opManager->create(); + auto createOp = smtk::session::polygon::CreateEdgeFromVertices::create(); for (auto& ppgFace : m_ppgFaceList) { std::vector& vertexIds(ppgFace.vertexIds); // shorthand @@ -311,14 +310,14 @@ bool ImportPPG::Internal::createEdges(smtk::operation::ManagerPtr opManager) return true; } -bool ImportPPG::Internal::createFaces(smtk::operation::ManagerPtr opManager) +bool ImportPPG::Internal::createFaces() { #ifndef NDEBUG std::cout << "Creating Faces..." << std::endl; #endif // Initialize and run CreateFaces operation. - auto createOp = opManager->create(); + auto createOp = smtk::session::polygon::CreateFaces::create(); createOp->parameters()->associate(m_modelEntity); auto result = createOp->operate(); int outcome = result->findInt("outcome")->value(); @@ -354,7 +353,7 @@ bool ImportPPG::Internal::createFaces(smtk::operation::ManagerPtr opManager) } // for (i) // Now call createHoles, which prunes m_vertexIdMap and m_faceVertexIdMap - if (!this->createHoles(opManager)) + if (!this->createHoles()) { return false; } @@ -478,7 +477,7 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, return true; } // parsePPGFace() -bool ImportPPG::Internal::createHoles(smtk::operation::ManagerPtr opManager) +bool ImportPPG::Internal::createHoles() { // First check if any input faces are holes if (m_holeCount == 0) @@ -491,7 +490,7 @@ bool ImportPPG::Internal::createHoles(smtk::operation::ManagerPtr opManager) #endif // Initialize Delete operation. - auto deleteOp = opManager->create(); + auto deleteOp = smtk::session::polygon::Delete::create(); for (auto& ppgFace : m_ppgFaceList) { @@ -610,7 +609,7 @@ smtk::operation::Operation::Result ImportPPG::operateInternal() #endif this->log().reset(); - if (!m_internal->createModel(this->manager())) + if (!m_internal->createModel()) { return this->createResult(smtk::operation::Operation::Outcome::FAILED); } @@ -622,13 +621,13 @@ smtk::operation::Operation::Result ImportPPG::operateInternal() } this->log().reset(); - if (!m_internal->createEdges(this->manager())) + if (!m_internal->createEdges()) { return this->createResult(smtk::operation::Operation::Outcome::FAILED); } this->log().reset(); - if (!m_internal->createFaces(this->manager())) + if (!m_internal->createFaces()) { return this->createResult(smtk::operation::Operation::Outcome::FAILED); } diff --git a/smtk/session/polygon/pybind11/PybindImportPPG.h b/smtk/session/polygon/pybind11/PybindImportPPG.h new file mode 100644 index 0000000000..f63664a3a7 --- /dev/null +++ b/smtk/session/polygon/pybind11/PybindImportPPG.h @@ -0,0 +1,35 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#ifndef pybind_smtk_session_polygon_operators_ImportPPG_h +#define pybind_smtk_session_polygon_operators_ImportPPG_h + +#include + +#include "smtk/session/polygon/operators/ImportPPG.h" + +namespace py = pybind11; + +PySharedPtrClass< smtk::session::polygon::ImportPPG > pybind11_init_smtk_session_polygon_ImportPPG(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +{ + PySharedPtrClass< smtk::session::polygon::ImportPPG > instance(m, "ImportPPG", parent); + instance + .def(py::init<::smtk::session::polygon::ImportPPG const &>()) + .def("deepcopy", (smtk::session::polygon::ImportPPG & (smtk::session::polygon::ImportPPG::*)(::smtk::session::polygon::ImportPPG const &)) &smtk::session::polygon::ImportPPG::operator=) + .def("ableToOperate", &smtk::session::polygon::ImportPPG::ableToOperate) + .def_static("create", (std::shared_ptr (*)()) &smtk::session::polygon::ImportPPG::create) + .def_static("create", (std::shared_ptr (*)(::std::shared_ptr &)) &smtk::session::polygon::ImportPPG::create, py::arg("ref")) + .def("shared_from_this", (std::shared_ptr (smtk::session::polygon::ImportPPG::*)() const) &smtk::session::polygon::ImportPPG::shared_from_this) + .def("shared_from_this", (std::shared_ptr (smtk::session::polygon::ImportPPG::*)()) &smtk::session::polygon::ImportPPG::shared_from_this) + ; + return instance; +} + +#endif diff --git a/smtk/session/polygon/pybind11/PybindPolygonSession.cxx b/smtk/session/polygon/pybind11/PybindPolygonSession.cxx index 0b48763011..65670e67cf 100644 --- a/smtk/session/polygon/pybind11/PybindPolygonSession.cxx +++ b/smtk/session/polygon/pybind11/PybindPolygonSession.cxx @@ -38,6 +38,7 @@ using PySharedPtrClass = py::class_, Args...>; #include "PybindDelete.h" #include "PybindDemoteVertex.h" #include "PybindForceCreateFace.h" +#include "PybindImportPPG.h" #include "PybindRead.h" #include "PybindLegacyRead.h" #include "PybindSplitEdge.h" @@ -73,6 +74,7 @@ PYBIND11_MODULE(_smtkPybindPolygonSession, polygon) PySharedPtrClass< smtk::session::polygon::Delete > smtk_session_polygon_Delete = pybind11_init_smtk_session_polygon_Delete(polygon, smtk_session_polygon_Operation); PySharedPtrClass< smtk::session::polygon::DemoteVertex > smtk_session_polygon_DemoteVertex = pybind11_init_smtk_session_polygon_DemoteVertex(polygon, smtk_session_polygon_Operation); PySharedPtrClass< smtk::session::polygon::ForceCreateFace > smtk_session_polygon_ForceCreateFace = pybind11_init_smtk_session_polygon_ForceCreateFace(polygon, smtk_session_polygon_Operation); + PySharedPtrClass< smtk::session::polygon::ImportPPG > smtk_session_polygon_ImportPPG = pybind11_init_smtk_session_polygon_ImportPPG(polygon, smtk_session_polygon_Operation); PySharedPtrClass< smtk::session::polygon::Read > smtk_session_polygon_Read = pybind11_init_smtk_session_polygon_Read(polygon, smtk_session_polygon_Operation); PySharedPtrClass< smtk::session::polygon::LegacyRead > smtk_session_polygon_LegacyRead = pybind11_init_smtk_session_polygon_LegacyRead(polygon, smtk_session_polygon_Operation); PySharedPtrClass< smtk::session::polygon::SplitEdge > smtk_session_polygon_SplitEdge = pybind11_init_smtk_session_polygon_SplitEdge(polygon, smtk_session_polygon_Operation); diff --git a/smtk/session/polygon/testing/python/CMakeLists.txt b/smtk/session/polygon/testing/python/CMakeLists.txt index f494e647ff..c275bda35e 100644 --- a/smtk/session/polygon/testing/python/CMakeLists.txt +++ b/smtk/session/polygon/testing/python/CMakeLists.txt @@ -1,4 +1,5 @@ set(smtkPolygonSessionPythonTests + polygonImportPPG ) # Additional tests that require SMTK_DATA_DIR @@ -12,12 +13,12 @@ set(smtkPolygonSessionPythonDataTests ) foreach (test ${smtkPolygonSessionPythonTests}) - smtk_add_test_python(${test}Py ${test}.py) + smtk_add_test_python(${test}Py ${test}.py --temp-dir=${CMAKE_BINARY_DIR}/Testing/Temporary) endforeach() if (SMTK_DATA_DIR) foreach (test ${smtkPolygonSessionPythonDataTests}) smtk_add_test_python(${test}Py ${test}.py - -D "${SMTK_DATA_DIR}") + --data-dir "${SMTK_DATA_DIR}" --temp-dir=${CMAKE_BINARY_DIR}/Testing/Temporary) endforeach() endif() diff --git a/smtk/session/polygon/testing/python/polygonImportPPG.py b/smtk/session/polygon/testing/python/polygonImportPPG.py new file mode 100644 index 0000000000..04db770bef --- /dev/null +++ b/smtk/session/polygon/testing/python/polygonImportPPG.py @@ -0,0 +1,121 @@ +# ============================================================================= +# +# Copyright (c) Kitware, Inc. +# All rights reserved. +# See LICENSE.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even +# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the above copyright notice for more information. +# +# ============================================================================= +import os + +import smtk +import smtk.model +import smtk.operation +import smtk.session.polygon +import smtk.io +import smtk.testing + +ppg_text = """ +# Example input (Kitware's "Test2D" geometry) +# Note that vertex indices start with 1 +# Vertices 1-8 for the outer polygon +v 0.0 2.0 +v 1.0 0.0 +v 9.0 0.0 +v 9.0 2.0 +v 8.0 4.0 +v 6.0 5.0 +v 3.0 5.0 +v 1.0 4.0 +# Vertices 9-12 for the inner polygon (hole) +v 7.0 1.0 +v 8.0 1.0 +v 8.0 2.0 +v 7.0 2.0 +# Outer polygon +f 1 2 3 4 5 6 7 8 +# Inner polygon (hole) +h 9 10 11 12 +""" + +OP_SUCCEEDED = int(smtk.operation.Operation.Outcome.SUCCEEDED) + + +class TestImportPPG(smtk.testing.TestCase): + def setUp(self): + # Set file system path for resource file + resource_filename = 'ppg2d.smtk' + self.resource_path = os.path.join( + smtk.testing.TEMP_DIR, resource_filename) + + # Delete file if one already exists + if os.path.isfile(self.resource_path): + os.remove(self.resource_path) + + def test_import_ppg(self): + model_resource = self.create_model() + self.check_model(model_resource) + self.write_model(model_resource) + + del(model_resource) + model_res2 = self.read_model(self.resource_path) + self.check_model(model_res2) + + def check_model(self, model_resource): + vlist = model_resource.entitiesMatchingFlags(smtk.model.VERTEX) + self.assertEqual(len(vlist), 12, 'Expected 12 model vertices') + elist = model_resource.entitiesMatchingFlags(smtk.model.EDGE) + self.assertEqual(len(elist), 12, 'Expected 12 model edges') + flist = model_resource.entitiesMatchingFlags(smtk.model.FACE) + self.assertEqual(len(flist), 1, 'Expected 1 model face') + + def create_model(self): + op = smtk.session.polygon.ImportPPG.create() + op.parameters().findString('string').setIsEnabled(True) + op.parameters().findString('string').setValue(ppg_text) + result = op.operate() + outcome = result.findInt('outcome').value() + self.assertEqual(outcome, OP_SUCCEEDED, + 'ImportPPG operation failed w/outcome {}'.format(outcome)) + + resource = result.findResource('resource').value() + model_resource = smtk.model.Resource.CastTo(resource) + return model_resource + + def read_model(self, path=None): + if path is None: + path = self.resource_path + op = smtk.session.polygon.Read.create() + op.parameters().findFile('filename').setValue(path) + result = op.operate() + outcome = result.findInt('outcome').value() + self.assertEqual(outcome, OP_SUCCEEDED, + 'Read operation failed w/outcome {}'.format(outcome)) + + resource = result.findResource('resource').value() + model_resource = smtk.model.Resource.CastTo(resource) + return model_resource + + def write_model(self, model_resource, path=None): + if path is None: + path = self.resource_path + # Note: no filename parameter, so set path on the resource directly + model_resource.setLocation(path) + op = smtk.session.polygon.Write.create() + op.parameters().associate(model_resource) + result = op.operate() + outcome = result.findInt('outcome').value() + self.assertEqual(outcome, OP_SUCCEEDED, + 'Write operation failed w/outcome {}'.format(outcome)) + + # Sanity check + self.assertTrue(os.path.isfile(path)) + print('Wrote file', path) + + +if __name__ == '__main__': + smtk.testing.process_arguments() + smtk.testing.main() -- GitLab From 55bcbfc5b9e55803f400c5b34da882ec7b2ab917 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Tue, 4 May 2021 14:32:55 -0400 Subject: [PATCH 052/136] Prevent creating duplicate model edges Also update test to generate 2 models --- smtk/session/polygon/operators/ImportPPG.cxx | 13 ++ .../testing/python/polygonImportPPG.py | 114 +++++++++++++----- 2 files changed, 95 insertions(+), 32 deletions(-) diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index 5c34098083..06cbe41865 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include namespace @@ -173,6 +174,9 @@ protected: std::vector m_newVertexList; + // Track vertex-pairs used to make edges, to avoid duplication + std::set> m_ppgVertexPairSet; + // Map model vertex uuid to user id std::map m_vertexIdMap; @@ -279,6 +283,15 @@ bool ImportPPG::Internal::createEdges() unsigned id1 = vertexIds[i - 1]; unsigned id2 = vertexIds[i]; + // Check for duplicate + auto pair1 = std::make_pair(id1, id2); + if (m_ppgVertexPairSet.count(pair1)) + { + continue; + } + m_ppgVertexPairSet.insert(pair1); + m_ppgVertexPairSet.insert(std::make_pair(id2, id1)); + auto v1 = m_newVertexList[id1]; auto v2 = m_newVertexList[id2]; diff --git a/smtk/session/polygon/testing/python/polygonImportPPG.py b/smtk/session/polygon/testing/python/polygonImportPPG.py index 04db770bef..a8d86260c5 100644 --- a/smtk/session/polygon/testing/python/polygonImportPPG.py +++ b/smtk/session/polygon/testing/python/polygonImportPPG.py @@ -18,7 +18,7 @@ import smtk.session.polygon import smtk.io import smtk.testing -ppg_text = """ +test2d = """ # Example input (Kitware's "Test2D" geometry) # Note that vertex indices start with 1 # Vertices 1-8 for the outer polygon @@ -41,41 +41,96 @@ f 1 2 3 4 5 6 7 8 h 9 10 11 12 """ +three_face = """ +v 0 0 +v 5 0 +v 5 4 +v 1 4 +v 0 4 +v 5 7 +v 1 7 + +v 3 1 +v 4 1 +v 3 3 + +v 2 5 +v 3 5 +v 4 6 +v 2 6 +f 1 2 3 4 5 +f 3 6 7 4 +h 8 9 10 +f 11 12 13 14 +""" + OP_SUCCEEDED = int(smtk.operation.Operation.Outcome.SUCCEEDED) class TestImportPPG(smtk.testing.TestCase): def setUp(self): - # Set file system path for resource file - resource_filename = 'ppg2d.smtk' - self.resource_path = os.path.join( - smtk.testing.TEMP_DIR, resource_filename) + pass + + def test_test2d(self): + path = os.path.join(smtk.testing.TEMP_DIR, 'test2d.smtk') + + # Remove existing file + if os.path.isfile(path): + os.remove(path) + + # Create model + model_resource = self.create_model(test2d) + self.check_model(model_resource, 12, 12, 1) - # Delete file if one already exists - if os.path.isfile(self.resource_path): - os.remove(self.resource_path) + # Write to file system + self.write_model(model_resource, path) + del(model_resource) + + # Read from file system + model_res2 = self.read_model(path) + self.check_model(model_res2, 12, 12, 1) + + def test_three_face(self): + path = os.path.join(smtk.testing.TEMP_DIR, 'three-face.smtk') - def test_import_ppg(self): - model_resource = self.create_model() - self.check_model(model_resource) - self.write_model(model_resource) + # Remove existing file + if os.path.isfile(path): + os.remove(path) + # Create model + model_resource = self.create_model(three_face) + self.check_model(model_resource, 14, 15, 3) + + # Write to file system + self.write_model(model_resource, path) del(model_resource) - model_res2 = self.read_model(self.resource_path) - self.check_model(model_res2) - - def check_model(self, model_resource): - vlist = model_resource.entitiesMatchingFlags(smtk.model.VERTEX) - self.assertEqual(len(vlist), 12, 'Expected 12 model vertices') - elist = model_resource.entitiesMatchingFlags(smtk.model.EDGE) - self.assertEqual(len(elist), 12, 'Expected 12 model edges') - flist = model_resource.entitiesMatchingFlags(smtk.model.FACE) - self.assertEqual(len(flist), 1, 'Expected 1 model face') - - def create_model(self): + + # Read from file system + model_res2 = self.read_model(path) + self.check_model(model_res2, 14, 15, 3) + + def check_model(self, model_resource, *expected): + """Check number of entities + + Arguments: + model_resource + expected: 3 args with expected numbers of vertices, edges, faces + """ + def check(model_resource, ent_type, expected, text): + """Internal function to check one dimension.""" + ent_list = model_resource.entitiesMatchingFlags(ent_type) + msg = 'Expected number of model {} {}, not {}'.format( + text, expected, len(ent_list)) + self.assertEqual(len(ent_list), expected, msg) + + check(model_resource, smtk.model.VERTEX, expected[0], 'vertices') + check(model_resource, smtk.model.EDGE, expected[1], 'edges') + check(model_resource, smtk.model.FACE, expected[2], 'faces') + + def create_model(self, input_ppg): op = smtk.session.polygon.ImportPPG.create() op.parameters().findString('string').setIsEnabled(True) - op.parameters().findString('string').setValue(ppg_text) + op.parameters().findString('string').setValue(input_ppg) result = op.operate() outcome = result.findInt('outcome').value() self.assertEqual(outcome, OP_SUCCEEDED, @@ -85,9 +140,7 @@ class TestImportPPG(smtk.testing.TestCase): model_resource = smtk.model.Resource.CastTo(resource) return model_resource - def read_model(self, path=None): - if path is None: - path = self.resource_path + def read_model(self, path): op = smtk.session.polygon.Read.create() op.parameters().findFile('filename').setValue(path) result = op.operate() @@ -99,10 +152,7 @@ class TestImportPPG(smtk.testing.TestCase): model_resource = smtk.model.Resource.CastTo(resource) return model_resource - def write_model(self, model_resource, path=None): - if path is None: - path = self.resource_path - # Note: no filename parameter, so set path on the resource directly + def write_model(self, model_resource, path): model_resource.setLocation(path) op = smtk.session.polygon.Write.create() op.parameters().associate(model_resource) -- GitLab From 0d067271b4ab8b8ce20ab48c39b4ac99ab8e6fca Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Mon, 7 Jun 2021 10:57:50 -0400 Subject: [PATCH 053/136] Expand ppgFace to store LoopType enum and list of model edges Towards more straightforward logic for creating faces --- smtk/session/polygon/operators/ImportPPG.cxx | 61 ++++++++++++++++---- 1 file changed, 50 insertions(+), 11 deletions(-) diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index 06cbe41865..4fd852088c 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -70,6 +70,13 @@ const int OP_SUCCEEDED = static_cast(smtk::operation::Operation::Outcome::S return false; \ } while (0) +enum class LoopType +{ + FACE = 0, // outer loop + EMBEDDED, // inner loop as embedded face + HOLE // inner loop as hole +}; + struct PPGVertex { std::size_t userId; @@ -93,18 +100,23 @@ struct PPGFace { std::size_t userId; std::vector vertexIds; // from input - bool isHole; + LoopType loopType; + std::size_t innerLoopCount; + std::vector edgeRefs; - PPGFace(std::size_t inputId, const std::vector& inputVertexIds, bool hole = false) + PPGFace(std::size_t inputId, const std::vector& inputVertexIds, LoopType lt) : userId(inputId) - , isHole(hole) + , loopType(lt) + , innerLoopCount(0) { vertexIds = std::move(inputVertexIds); } void dump() const { - std::cout << "PPGFace userId: " << userId << ", isHole: " << isHole << '\n' << "vertex ids:"; + std::cout << "PPGFace userId: " << userId << ", loop type: " << static_cast(loopType) + << ", inner loops: " << innerLoopCount << '\n' + << "vertex ids:"; for (auto vid : vertexIds) { std::cout << " " << vid; @@ -307,13 +319,15 @@ bool ImportPPG::Internal::createEdges() // Get the new edge and assign name auto createdItem = result->findComponent("created"); smtk::resource::ComponentPtr pcomp = createdItem->value(); - smtk::model::Edge edgeRef(m_resource, pcomp->id()); + smtk::model::EntityRef edgeRef(m_resource, pcomp->id()); ++edgeId; ss.str(std::string()); ss.clear(); ss << "edge " << edgeId; edgeRef.setName(ss.str()); + + ppgFace.edgeRefs.push_back(edgeRef); } // for (i) // Remove temp vertex added to end of list @@ -375,7 +389,7 @@ bool ImportPPG::Internal::createFaces() std::stringstream ss; for (const auto& ppgFace : m_ppgFaceList) { - if (ppgFace.isHole) + if (ppgFace.loopType == LoopType::HOLE) { continue; } @@ -409,7 +423,7 @@ bool ImportPPG::Internal::parseInputLine(const std::string& line, unsigned lineN { return this->parsePPGVertex(symbols, lineNum); } - else if (("f" == symbols[0]) || ("h") == symbols[0]) + else if (("f" == symbols[0]) || ("e" == symbols[0]) || ("h" == symbols[0])) { return this->parsePPGFace(symbols, lineNum); } @@ -455,6 +469,7 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, std::vector vertexIds; unsigned int vertexId; + std::size_t outerLoopIndex = 0; // for counting inner loops for (auto it = symbols.begin() + 1; it != symbols.end(); ++it) { std::string s = *it; @@ -482,9 +497,33 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, vertexIds.push_back(vertexId); } // for (it) - bool isHole = symbols[0] == "h"; + LoopType lt = LoopType::FACE; + lt = symbols[0] == "e" ? LoopType::EMBEDDED : lt; + lt = symbols[0] == "h" ? LoopType::HOLE : lt; + bool isHole = lt == LoopType::HOLE; + + // Sanity check + if (m_ppgFaceList.empty() && lt != LoopType::FACE) + { + errorMacroFalse("First model face is not type 'f', on line " << lineNum); + } + + // Capture inner loop info + if (lt == LoopType::FACE) + { + // Set the index for the current outer loop + outerLoopIndex = m_ppgFaceList.size(); + } + else + { + // Increment inner loop count for the outer loop + auto& outerLoop = m_ppgFaceList[outerLoopIndex]; + outerLoop.innerLoopCount += 1; + m_ppgFaceList[outerLoopIndex] = outerLoop; + } + std::size_t inputId = isHole ? 0 : 1 + m_ppgFaceList.size() - m_holeCount; - m_ppgFaceList.emplace(m_ppgFaceList.end(), inputId, vertexIds, isHole); + m_ppgFaceList.emplace(m_ppgFaceList.end(), inputId, vertexIds, lt); m_holeCount += isHole ? 1 : 0; return true; @@ -508,7 +547,7 @@ bool ImportPPG::Internal::createHoles() for (auto& ppgFace : m_ppgFaceList) { // Skip faces that aren't specified to be holes - if (!ppgFace.isHole) + if (ppgFace.loopType != LoopType::HOLE) { continue; } @@ -548,7 +587,7 @@ smtk::common::UUID ImportPPG::Internal::findMatchingModelFace(const PPGFace& ppg // Matching logic is different for holes and faces // - holes must be exact match // - model faces may have more vertices than ppgFace specifies (because of holes) - bool match = ppgFace.isHole + bool match = ppgFace.loopType == LoopType::HOLE ? vertexIds == ppgFaceVertexIds : std::includes( vertexIds.begin(), vertexIds.end(), ppgFaceVertexIds.begin(), ppgFaceVertexIds.end()); -- GitLab From c2a436f7766e282d614962c81cae79178918521f Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Mon, 7 Jun 2021 22:14:22 -0400 Subject: [PATCH 054/136] Revise logic to explicitly indicate embedded faces as well as holes --- smtk/session/polygon/operators/ImportPPG.cxx | 203 ++++++++++++------ .../testing/python/polygonImportPPG.py | 2 +- 2 files changed, 140 insertions(+), 65 deletions(-) diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index 4fd852088c..1abf33ce15 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -34,7 +34,7 @@ #include "smtk/session/polygon/internal/Model.h" #include "smtk/session/polygon/internal/Model.txx" #include "smtk/session/polygon/operators/CreateEdgeFromVertices.h" -#include "smtk/session/polygon/operators/CreateFaces.h" +#include "smtk/session/polygon/operators/CreateFacesFromEdges.h" #include "smtk/session/polygon/operators/CreateModel.h" #include "smtk/session/polygon/operators/Delete.h" @@ -52,7 +52,8 @@ namespace { -const int OP_SUCCEEDED = static_cast(smtk::operation::Operation::Outcome::SUCCEEDED); +constexpr std::size_t INVALID_INDEX = std::numeric_limits::max(); +constexpr int OP_SUCCEEDED = static_cast(smtk::operation::Operation::Outcome::SUCCEEDED); // Macro for returning on error #define errorMacro(msg) \ @@ -102,20 +103,28 @@ struct PPGFace std::vector vertexIds; // from input LoopType loopType; std::size_t innerLoopCount; - std::vector edgeRefs; - - PPGFace(std::size_t inputId, const std::vector& inputVertexIds, LoopType lt) + std::vector edges; + double center[2]; + + PPGFace( + std::size_t inputId, + const std::vector& inputVertexIds, + LoopType lt, + double centerCoords[2]) : userId(inputId) , loopType(lt) , innerLoopCount(0) { vertexIds = std::move(inputVertexIds); + center[0] = centerCoords[0]; + center[1] = centerCoords[1]; } void dump() const { std::cout << "PPGFace userId: " << userId << ", loop type: " << static_cast(loopType) - << ", inner loops: " << innerLoopCount << '\n' + << ", inner loops: " << innerLoopCount << ", center: " << center[0] << ", " + << center[1] << '\n' << "vertex ids:"; for (auto vid : vertexIds) { @@ -138,6 +147,7 @@ public: Internal(smtk::io::Logger& logger) : m_log(logger) , m_holeCount(0) + , m_outerLoopIndex(INVALID_INDEX) { } ~Internal() = default; @@ -157,6 +167,33 @@ public: bool createEdges(); bool createFaces(); + std::size_t findInnerLoop(smtk::model::EntityRef& faceRef, std::size_t outerIndex) const + { + const PPGFace& outerPPGFace = m_ppgFaceList[outerIndex]; + if (outerPPGFace.innerLoopCount < 1) + { + smtkErrorMacro(m_log, "Internal Error - PPGFace has no inner loops"); + return INVALID_INDEX; + } + + // Find which inner loop corresponds to this model face + // Uses the fact that faces are convex and don't intersect + std::vector bbox = faceRef.boundingBox(); + std::size_t index = outerIndex + 1; + for (int i = 0; i < outerPPGFace.innerLoopCount; ++i, ++index) + { + // Get xmean, ymean + const PPGFace& innerFace = m_ppgFaceList[index]; + double x = innerFace.center[0]; + double y = innerFace.center[1]; + if ((x >= bbox[0]) && (x <= bbox[1]) && (y >= bbox[2]) && (y <= bbox[3])) + { + return index; + } + } + return INVALID_INDEX; // not found + } + // Parse input line bool parseInputLine(const std::string& line, unsigned lineNum); @@ -165,6 +202,11 @@ public: std::cout << "PPG input vertex count: " << m_ppgVertexList.size() << std::endl; std::cout << "PPG input face count: " << m_ppgFaceList.size() - m_holeCount << std::endl; std::cout << "PPG input hole count: " << m_holeCount << std::endl; + + for (auto& ppgFace : m_ppgFaceList) + { + ppgFace.dump(); + } } smtk::model::ResourcePtr resource() const { return m_resource; } @@ -183,6 +225,7 @@ protected: std::vector m_ppgFaceList; std::vector m_ppgVertexList; unsigned int m_holeCount; + std::size_t m_outerLoopIndex; // used parsing input to store current outer edge loop std::vector m_newVertexList; @@ -327,7 +370,7 @@ bool ImportPPG::Internal::createEdges() ss << "edge " << edgeId; edgeRef.setName(ss.str()); - ppgFace.edgeRefs.push_back(edgeRef); + ppgFace.edges.push_back(edgeRef.entityRecord()); } // for (i) // Remove temp vertex added to end of list @@ -344,67 +387,92 @@ bool ImportPPG::Internal::createFaces() #endif // Initialize and run CreateFaces operation. - auto createOp = smtk::session::polygon::CreateFaces::create(); - createOp->parameters()->associate(m_modelEntity); - auto result = createOp->operate(); - int outcome = result->findInt("outcome")->value(); - if (outcome != OP_SUCCEEDED) + auto createOp = smtk::session::polygon::CreateFacesFromEdges::create(); + auto deleteOp = smtk::session::polygon::Delete::create(); + std::stringstream ss; + for (std::size_t i = 0; i < m_ppgFaceList.size(); ++i) { - errorMacroFalse("Failed to create model faces."); - } + createOp->parameters()->removeAllAssociations(); - // Build m_faceVertexIdMap for relating back to input spec - auto createdItem = result->findComponent("created"); - for (std::size_t i = 0; i < createdItem->numberOfValues(); ++i) - { - smtk::resource::ComponentPtr pcomp = createdItem->value(i); - smtk::model::Face faceRef(m_resource, pcomp->id()); + // Add the next face (outer loop) + auto& outerPPGFace = m_ppgFaceList[i]; + outerPPGFace.dump(); - // Get the set of vertex uuids on this face - smtk::common::UUID faceUUID = faceRef.entity(); - std::set uuidList = m_resource->lowerDimensionalBoundaries(faceUUID, 0); - std::set vertexIds; - for (auto& uuid : uuidList) + std::size_t outerPPGIndex = i; + for (auto& edge : outerPPGFace.edges) { -#ifndef NDEBUG - if (m_vertexIdMap.count(uuid) == 0) + createOp->parameters()->associate(edge); + } + + // Add inner edge loops + for (std::size_t n = 0; n < outerPPGFace.innerLoopCount; ++n) + { + ++i; + const auto& innerPPGFace = m_ppgFaceList[i]; + for (auto& edge : innerPPGFace.edges) { - std::cout << "ERROR: uuid " << uuid << " is NOT in m_vertexIdMap" << std::endl; - continue; + createOp->parameters()->associate(edge); } -#endif - vertexIds.insert(m_vertexIdMap[uuid]); } - m_faceVertexIdMap[faceUUID] = vertexIds; - } // for (i) - - // Now call createHoles, which prunes m_vertexIdMap and m_faceVertexIdMap - if (!this->createHoles()) - { - return false; - } - - // Use m_faceVertexIdList to match model faces to ppg faces. - std::stringstream ss; - for (const auto& ppgFace : m_ppgFaceList) - { - if (ppgFace.loopType == LoopType::HOLE) + auto result = createOp->operate(); + int outcome = result->findInt("outcome")->value(); + if (outcome != OP_SUCCEEDED) { - continue; + errorMacroFalse("Failed to create model faces."); } - auto faceUUID = this->findMatchingModelFace(ppgFace); - if (faceUUID.isNull()) + // Deal with inner edge loops + auto createdItem = result->findComponent("created"); + for (std::size_t n = 0; n < createdItem->numberOfValues(); ++n) { - errorMacroFalse("Failed to find match for ppgFace " << ppgFace.userId); - } + smtk::resource::ComponentPtr pcomp = createdItem->value(n); + smtk::model::EntityRef faceRef(m_resource, pcomp->id()); + if (n == 0) + { + // First face is the outer loop + ss.str(std::string()); + ss.clear(); + ss << "face " << outerPPGFace.userId; + faceRef.setName(ss.str()); - smtk::model::Face faceRef(m_resource, faceUUID); - ss.str(std::string()); - ss.clear(); - ss << "face " << ppgFace.userId; - faceRef.setName(ss.str()); + continue; + } + + // Find matching inner edge loop + std::size_t index = this->findInnerLoop(faceRef, outerPPGIndex); + if (index == INVALID_INDEX) + { + errorMacroFalse("Error: unabled to find inner face"); + } + + const auto& innerPPGFace = m_ppgFaceList[index]; + if (innerPPGFace.loopType == LoopType::HOLE) + { + deleteOp->parameters()->associate(faceRef.entityRecord()); + } + else + { + // First face is the outer loop + ss.str(std::string()); + ss.clear(); + ss << "face " << innerPPGFace.userId; + faceRef.setName(ss.str()); + } + } // for (n) + } // for (ppg faces) + + auto refItem = deleteOp->parameters()->associations(); + if (refItem->numberOfValues() == 0) + { + return true; + } + + auto deleteResult = deleteOp->operate(); + int deleteOutcome = deleteResult->findInt("outcome")->value(); + if (deleteOutcome != OP_SUCCEEDED) + { + errorMacroFalse("Failed to create model faces."); } return true; @@ -469,7 +537,8 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, std::vector vertexIds; unsigned int vertexId; - std::size_t outerLoopIndex = 0; // for counting inner loops + double xsum = 0.0; + double ysum = 0.0; for (auto it = symbols.begin() + 1; it != symbols.end(); ++it) { std::string s = *it; @@ -495,8 +564,14 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, } vertexIds.push_back(vertexId); + + xsum += m_ppgVertexList[vertexId - 1].x; + ysum += m_ppgVertexList[vertexId - 1].y; } // for (it) + double npoints = static_cast(vertexIds.size()); + double center[2] = { xsum / npoints, ysum / npoints }; + LoopType lt = LoopType::FACE; lt = symbols[0] == "e" ? LoopType::EMBEDDED : lt; lt = symbols[0] == "h" ? LoopType::HOLE : lt; @@ -508,24 +583,24 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, errorMacroFalse("First model face is not type 'f', on line " << lineNum); } - // Capture inner loop info + std::size_t inputId = isHole ? 0 : 1 + m_ppgFaceList.size() - m_holeCount; + m_ppgFaceList.emplace(m_ppgFaceList.end(), inputId, vertexIds, lt, center); + m_holeCount += isHole ? 1 : 0; + + // Handle outer and inner edge loops differently if (lt == LoopType::FACE) { // Set the index for the current outer loop - outerLoopIndex = m_ppgFaceList.size(); + m_outerLoopIndex = m_ppgFaceList.size() - 1; } else { // Increment inner loop count for the outer loop - auto& outerLoop = m_ppgFaceList[outerLoopIndex]; + auto& outerLoop = m_ppgFaceList[m_outerLoopIndex]; outerLoop.innerLoopCount += 1; - m_ppgFaceList[outerLoopIndex] = outerLoop; + m_ppgFaceList[m_outerLoopIndex] = outerLoop; } - std::size_t inputId = isHole ? 0 : 1 + m_ppgFaceList.size() - m_holeCount; - m_ppgFaceList.emplace(m_ppgFaceList.end(), inputId, vertexIds, lt); - m_holeCount += isHole ? 1 : 0; - return true; } // parsePPGFace() diff --git a/smtk/session/polygon/testing/python/polygonImportPPG.py b/smtk/session/polygon/testing/python/polygonImportPPG.py index a8d86260c5..520486ac82 100644 --- a/smtk/session/polygon/testing/python/polygonImportPPG.py +++ b/smtk/session/polygon/testing/python/polygonImportPPG.py @@ -61,7 +61,7 @@ v 2 6 f 1 2 3 4 5 f 3 6 7 4 h 8 9 10 -f 11 12 13 14 +e 11 12 13 14 """ OP_SUCCEEDED = int(smtk.operation.Operation.Outcome.SUCCEEDED) -- GitLab From 0e1b86629ab640e8d1cdd9730009164353cbbe79 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Mon, 7 Jun 2021 22:20:43 -0400 Subject: [PATCH 055/136] Take out now-unused logic --- smtk/session/polygon/operators/ImportPPG.cxx | 162 +++++-------------- 1 file changed, 39 insertions(+), 123 deletions(-) diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index 1abf33ce15..174dbdf978 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -167,32 +167,8 @@ public: bool createEdges(); bool createFaces(); - std::size_t findInnerLoop(smtk::model::EntityRef& faceRef, std::size_t outerIndex) const - { - const PPGFace& outerPPGFace = m_ppgFaceList[outerIndex]; - if (outerPPGFace.innerLoopCount < 1) - { - smtkErrorMacro(m_log, "Internal Error - PPGFace has no inner loops"); - return INVALID_INDEX; - } - - // Find which inner loop corresponds to this model face - // Uses the fact that faces are convex and don't intersect - std::vector bbox = faceRef.boundingBox(); - std::size_t index = outerIndex + 1; - for (int i = 0; i < outerPPGFace.innerLoopCount; ++i, ++index) - { - // Get xmean, ymean - const PPGFace& innerFace = m_ppgFaceList[index]; - double x = innerFace.center[0]; - double y = innerFace.center[1]; - if ((x >= bbox[0]) && (x <= bbox[1]) && (y >= bbox[2]) && (y <= bbox[3])) - { - return index; - } - } - return INVALID_INDEX; // not found - } + // Finds PPGFace index matching input model face + std::size_t findInnerLoop(smtk::model::EntityRef& faceRef, std::size_t outerIndex) const; // Parse input line bool parseInputLine(const std::string& line, unsigned lineNum); @@ -215,29 +191,18 @@ protected: bool parsePPGVertex(const std::vector& symbols, unsigned lineNum); bool parsePPGFace(const std::vector& symbols, unsigned lineNum); - // Process holes and update member data (maps) - bool createHoles(); - - // Locate model face by matching vertex ids; uses member data (maps) - smtk::common::UUID findMatchingModelFace(const PPGFace& ppgFace); - smtk::io::Logger& m_log; std::vector m_ppgFaceList; std::vector m_ppgVertexList; unsigned int m_holeCount; std::size_t m_outerLoopIndex; // used parsing input to store current outer edge loop - std::vector m_newVertexList; + // List of smtk vertices + std::vector m_smtkVertexList; // Track vertex-pairs used to make edges, to avoid duplication std::set> m_ppgVertexPairSet; - // Map model vertex uuid to user id - std::map m_vertexIdMap; - - // Map face uuid to set of user's vertex ids - std::map> m_faceVertexIdMap; - smtk::model::ResourcePtr m_resource; std::shared_ptr m_modelEntity; }; @@ -285,9 +250,8 @@ bool ImportPPG::Internal::createVertices() #endif // Initialize new vertex list with one no-op vertex, because indices start with 1 - m_newVertexList.clear(); - m_newVertexList.emplace(m_newVertexList.end()); - m_vertexIdMap.clear(); + m_smtkVertexList.clear(); + m_smtkVertexList.emplace(m_smtkVertexList.end()); auto polyResource = std::dynamic_pointer_cast(m_resource); internal::pmodel::Ptr storage = polyResource->findStorage(m_modelEntity->id()); @@ -309,9 +273,8 @@ bool ImportPPG::Internal::createVertices() newVertex.setName(ss.str()); // Update member data - m_newVertexList.push_back(newVertex); + m_smtkVertexList.push_back(newVertex); smtk::common::UUID uuid = newVertex.entity(); - m_vertexIdMap[uuid] = v.userId; } return true; } @@ -347,8 +310,8 @@ bool ImportPPG::Internal::createEdges() m_ppgVertexPairSet.insert(pair1); m_ppgVertexPairSet.insert(std::make_pair(id2, id1)); - auto v1 = m_newVertexList[id1]; - auto v2 = m_newVertexList[id2]; + auto v1 = m_smtkVertexList[id1]; + auto v2 = m_smtkVertexList[id2]; createOp->parameters()->associateEntity(v1); createOp->parameters()->associateEntity(v2); @@ -396,7 +359,7 @@ bool ImportPPG::Internal::createFaces() // Add the next face (outer loop) auto& outerPPGFace = m_ppgFaceList[i]; - outerPPGFace.dump(); + // outerPPGFace.dump(); std::size_t outerPPGIndex = i; for (auto& edge : outerPPGFace.edges) @@ -478,6 +441,35 @@ bool ImportPPG::Internal::createFaces() return true; } +std::size_t ImportPPG::Internal::findInnerLoop( + smtk::model::EntityRef& faceRef, + std::size_t outerIndex) const +{ + const PPGFace& outerPPGFace = m_ppgFaceList[outerIndex]; + if (outerPPGFace.innerLoopCount < 1) + { + smtkErrorMacro(m_log, "Internal Error - PPGFace has no inner loops"); + return INVALID_INDEX; + } + + // Find which inner loop corresponds to this model face + // Uses the fact that faces are convex and don't intersect + std::vector bbox = faceRef.boundingBox(); + std::size_t index = outerIndex + 1; + for (int i = 0; i < outerPPGFace.innerLoopCount; ++i, ++index) + { + // Get xmean, ymean + const PPGFace& innerFace = m_ppgFaceList[index]; + double x = innerFace.center[0]; + double y = innerFace.center[1]; + if ((x >= bbox[0]) && (x <= bbox[1]) && (y >= bbox[2]) && (y <= bbox[3])) + { + return index; + } + } + return INVALID_INDEX; // not found +} + bool ImportPPG::Internal::parseInputLine(const std::string& line, unsigned lineNum) { // std::cout << line << std::endl; @@ -604,82 +596,6 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, return true; } // parsePPGFace() -bool ImportPPG::Internal::createHoles() -{ - // First check if any input faces are holes - if (m_holeCount == 0) - { - return true; - } - -#ifndef NDEBUG - std::cout << "Creating Holes..." << std::endl; -#endif - - // Initialize Delete operation. - auto deleteOp = smtk::session::polygon::Delete::create(); - - for (auto& ppgFace : m_ppgFaceList) - { - // Skip faces that aren't specified to be holes - if (ppgFace.loopType != LoopType::HOLE) - { - continue; - } - - // Find the corresponding model face - auto faceUUID = this->findMatchingModelFace(ppgFace); - if (faceUUID.isNull()) - { - errorMacroFalse("ERROR: Unable to find matching face some hole"); - } - - // Add this face to the delete operator - smtk::model::Face faceRef(m_resource, faceUUID); - deleteOp->parameters()->associateEntity(faceRef); - } // for (ppgFace) - - // Apply the Delete operation - auto deleteResult = deleteOp->operate(); - int deleteOutcome = deleteResult->findInt("outcome")->value(); - if (deleteOutcome != OP_SUCCEEDED) - { - errorMacroFalse("Failed to delete face(s) "); - } - - return true; -} - -smtk::common::UUID ImportPPG::Internal::findMatchingModelFace(const PPGFace& ppgFace) -{ - // Important: - // * Only checks model faces in m_faceVertexIdMap - // * And removes the matching face from m_faceVertexIdMap - for (auto it = m_faceVertexIdMap.begin(); it != m_faceVertexIdMap.end(); ++it) - { - std::set vertexIds = it->second; - std::set ppgFaceVertexIds(ppgFace.vertexIds.begin(), ppgFace.vertexIds.end()); - // Matching logic is different for holes and faces - // - holes must be exact match - // - model faces may have more vertices than ppgFace specifies (because of holes) - bool match = ppgFace.loopType == LoopType::HOLE - ? vertexIds == ppgFaceVertexIds - : std::includes( - vertexIds.begin(), vertexIds.end(), ppgFaceVertexIds.begin(), ppgFaceVertexIds.end()); - if (match) - { - // Remove from the map - m_faceVertexIdMap.erase(it); - - auto faceUUID = it->first; - return faceUUID; - } - } // for - - // Return null if no match found - return smtk::common::UUID::null(); -} - ImportPPG::ImportPPG() { m_internal = new Internal(this->log()); -- GitLab From bd9def06173111241a73757d528582eb143b8de6 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Sat, 12 Jun 2021 11:42:46 -0400 Subject: [PATCH 056/136] Add ImportPPG to creator group & test in modelbuilder --- smtk/session/polygon/Registrar.cxx | 8 ++++++-- smtk/session/polygon/operators/ImportPPG.cxx | 5 +++++ smtk/session/polygon/operators/ImportPPG.sbt | 3 ++- .../polygon/testing/cxx/UnitTestPolygonImportPPG.cxx | 4 ++-- smtk/session/polygon/testing/python/polygonImportPPG.py | 8 ++++---- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/smtk/session/polygon/Registrar.cxx b/smtk/session/polygon/Registrar.cxx index c5ff04acd3..6d871c6c50 100644 --- a/smtk/session/polygon/Registrar.cxx +++ b/smtk/session/polygon/Registrar.cxx @@ -85,8 +85,10 @@ void Registrar::registerTo(const smtk::operation::Manager::Ptr& operationManager // Register operations operationManager->registerOperations(); + // smtk::operation::CreatorGroup(operationManager) + // .registerOperation(); smtk::operation::CreatorGroup(operationManager) - .registerOperation(); + .registerOperation(); #ifdef VTK_SUPPORT smtk::operation::ImporterGroup(operationManager) @@ -109,8 +111,10 @@ void Registrar::unregisterFrom(const smtk::resource::Manager::Ptr& resourceManag void Registrar::unregisterFrom(const smtk::operation::Manager::Ptr& operationManager) { + // smtk::operation::CreatorGroup(operationManager) + // .unregisterOperation(); smtk::operation::CreatorGroup(operationManager) - .unregisterOperation(); + .unregisterOperation(); #ifdef VTK_SUPPORT smtk::operation::ImporterGroup(operationManager) diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index 174dbdf978..d90afb5718 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -534,6 +534,11 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, for (auto it = symbols.begin() + 1; it != symbols.end(); ++it) { std::string s = *it; + if (s.at(0) == '#') + { + break; // comment at end of line + } + try { vertexId = std::stoi(s); diff --git a/smtk/session/polygon/operators/ImportPPG.sbt b/smtk/session/polygon/operators/ImportPPG.sbt index 43166741e7..df8284cb27 100644 --- a/smtk/session/polygon/operators/ImportPPG.sbt +++ b/smtk/session/polygon/operators/ImportPPG.sbt @@ -5,11 +5,12 @@ - + + Input file listing vertex and face specifications. Intended for testing, overrides filename item diff --git a/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx b/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx index eed387485f..fd5504e4e0 100644 --- a/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx +++ b/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx @@ -35,7 +35,7 @@ const std::string resourceFilename("import-ppg.smtk"); const std::string ppgText = "# Test2D geometry\n" "\n" "# Vertices 1-8 for the outer polygon\n" - "v 0.0 2.0\n" + "v 0.0 2.0 # first vertex 1\n" "v 1.0 0.0\n" "v 9.0 0.0\n" "v 9.0 2.0\n" @@ -51,7 +51,7 @@ const std::string ppgText = "# Test2D geometry\n" "v 7.0 2.0\n" "\n" "# Outer polygon\n" - "f 1 2 3 4 5 6 7 8\n" + "f 1 2 3 4 5 6 7 8 # first face\n" "\n" "# Inner polygon (hole)\n" "h 9 10 11 12\n"; diff --git a/smtk/session/polygon/testing/python/polygonImportPPG.py b/smtk/session/polygon/testing/python/polygonImportPPG.py index 520486ac82..79ad57e671 100644 --- a/smtk/session/polygon/testing/python/polygonImportPPG.py +++ b/smtk/session/polygon/testing/python/polygonImportPPG.py @@ -58,10 +58,10 @@ v 2 5 v 3 5 v 4 6 v 2 6 -f 1 2 3 4 5 -f 3 6 7 4 -h 8 9 10 -e 11 12 13 14 +f 1 2 3 4 5 # face 1 +f 3 6 7 4 # face 2 +h 8 9 10 # hole in face 2 +e 11 12 13 14 # face 3 embedded in face 2 """ OP_SUCCEEDED = int(smtk.operation.Operation.Outcome.SUCCEEDED) -- GitLab From b932f53167a0f45f77d8edbaa436ec2ab42c85c2 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Sat, 12 Jun 2021 11:47:13 -0400 Subject: [PATCH 057/136] Add documentation for ppg file format --- doc/userguide/figures/ppg-example1.png | 3 + doc/userguide/figures/ppg-example2.png | 3 + doc/userguide/model/example1.ppg | 26 +++++++ doc/userguide/model/example2.ppg | 11 +++ doc/userguide/model/ppg-file-format.rst | 75 ++++++++++++++++++++ doc/userguide/model/session-polygon.rst | 2 + smtk/session/polygon/operators/ImportPPG.cxx | 5 +- 7 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 doc/userguide/figures/ppg-example1.png create mode 100644 doc/userguide/figures/ppg-example2.png create mode 100644 doc/userguide/model/example1.ppg create mode 100644 doc/userguide/model/example2.ppg create mode 100644 doc/userguide/model/ppg-file-format.rst diff --git a/doc/userguide/figures/ppg-example1.png b/doc/userguide/figures/ppg-example1.png new file mode 100644 index 0000000000..890b0b979e --- /dev/null +++ b/doc/userguide/figures/ppg-example1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:38ec552771d48b74080b2083b3f4ab9472defeaebf15ff8974a3ea227255522e +size 6220 diff --git a/doc/userguide/figures/ppg-example2.png b/doc/userguide/figures/ppg-example2.png new file mode 100644 index 0000000000..1ee3ab6be7 --- /dev/null +++ b/doc/userguide/figures/ppg-example2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf00b9a0f255f4bb7da61923e212c0a4f104cba31f68decad6db07fb9dab7e80 +size 3935 diff --git a/doc/userguide/model/example1.ppg b/doc/userguide/model/example1.ppg new file mode 100644 index 0000000000..66aafba8a6 --- /dev/null +++ b/doc/userguide/model/example1.ppg @@ -0,0 +1,26 @@ +# example1.ppg +# Polygon domain with embedded face and hole +# Note that vertex indices start with 1 +# Vertices 1-8 for the outer polygon +v 0.0 2.0 +v 1.0 0.0 +v 9.0 0.0 +v 9.0 2.0 +v 8.0 4.0 +v 6.0 5.0 +v 3.0 5.0 +v 1.0 4.0 +# Vertices 9-12 for the embedded parallelogram +v 2.0 1.5 +v 4.0 1.5 +v 4.5 3.0 +v 2.5 3.0 +# Vertices 12-16 for the square hole +v 7.0 1.0 +v 8.0 1.0 +v 8.0 2.0 +v 7.0 2.0 +# Faces +f 1 2 3 4 5 6 7 8 # face 1 +e 9 10 11 12 # face 2 (embedded) +h 13 14 15 16 # hole diff --git a/doc/userguide/model/example2.ppg b/doc/userguide/model/example2.ppg new file mode 100644 index 0000000000..913cfb2199 --- /dev/null +++ b/doc/userguide/model/example2.ppg @@ -0,0 +1,11 @@ +# example2.ppg +# Two adjacent faces with common edge +v 0 0 +v 3 0 +v 3 1 +v 1 1 +v 0 1 +v 3 2 +v 1 2 +f 1 2 3 4 5 # face 1 +f 3 6 7 4 # face 2 diff --git a/doc/userguide/model/ppg-file-format.rst b/doc/userguide/model/ppg-file-format.rst new file mode 100644 index 0000000000..46101f2cf1 --- /dev/null +++ b/doc/userguide/model/ppg-file-format.rst @@ -0,0 +1,75 @@ +PPG File Format +--------------- + +The SMTK polygon session includes an ``ImportPPG`` operation for creating 2-D +models from text file input. The ``ImportPPG`` operation is provided as a +convenience for exploring CMB's many capabilities as well as for testing, +debug, and demonstration. +The file format is a simple data-format that specifies 2-D geometry as a +list of vertex positions and polygon face definitions, with vertices +connected by straight-line segments. + +.. include:: example1.ppg + :literal: + +This example produces a model with two faces, a parallelogram-shaped +face embedded in a polygon face that also contains a square hole. + +.. findfigure:: ppg-example1.png + +PPG Features +============ + +As a tool intended mainly for educational use, the supported feature set +is purposely limited. + +* Each polygon face must have simple geomety, specifically, polygons + cannot be self-intersecting, and polygons with more than four edges must + be convex. +* Polygons may share edges but cannot otherwise intersect or overlap. +* Polygons may include inner edge loops as either holes or embedded faces. + Inner edge loops may not share edges or vertices with other loops, and + embedded faces may not contain inner edge loops themselves. +* The ImportPPG operation has only syntactic checking, so users are + encouraged to check their input files carefully for geometric validity. + +File Format +=========== +A PPG file may contain comments, vertex data, and face elements. +Empty lines are ignored. + +**Comments** + +Anything following a hash character (#) is a comment. + +**Vertices** + +A model vertex is specified via a line starting with the letter +``v`` followed by the x and y coordinates. + +**Face Elements** + +Model faces are specified using a list of vertex indices. Vertex +indices start with 1. Each face is defined by three or more vertices. + +* An model face is specified with the letter ``f`` + followed by an ordered list of vertex indices. ImportPPG will + create a model edge between each pair of adjacent vertices in the + list, and between the last and first vertices, to form a polygon. +* Inner edge loops can be specified in the lines immediately following the + model face. +* Embedded faces are specified with the letter ``e`` followed by an + ordered list of vertices. +* Holes in the model face are specified with the letter ``h`` followed + by an ordered list of vertices. + +**Shared Edges** + +As noted above, model faces can be adjacent with a common internal edge +between them. Note that the vertices at either end of the common edge must +be included in the vertex list of each face. + +.. include:: example2.ppg + :literal: + +.. findfigure:: ppg-example2.png diff --git a/doc/userguide/model/session-polygon.rst b/doc/userguide/model/session-polygon.rst index 2aa112ad05..4fd45188dc 100644 --- a/doc/userguide/model/session-polygon.rst +++ b/doc/userguide/model/session-polygon.rst @@ -61,3 +61,5 @@ Boost polygonal models are conforming piecewise-linear cell complexes (PLCs), an may thus be meshed by any SMTK mesh worker that accepts models in this form. .. _Boost.polygon: http://www.boost.org/doc/libs/1_59_0/libs/polygon/doc/index.htm + +.. include:: ppg-file-format.rst diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index d90afb5718..886dcc1297 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -425,10 +425,9 @@ bool ImportPPG::Internal::createFaces() } // for (n) } // for (ppg faces) - auto refItem = deleteOp->parameters()->associations(); - if (refItem->numberOfValues() == 0) + if (!deleteOp->ableToOperate()) { - return true; + return true; // no faces to delete } auto deleteResult = deleteOp->operate(); -- GitLab From 80830c57dd8131908ab04b821ffd04ede7862855 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Sun, 13 Jun 2021 10:27:49 -0400 Subject: [PATCH 058/136] Add Deprecation.h to public header list --- smtk/common/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/smtk/common/CMakeLists.txt b/smtk/common/CMakeLists.txt index ae61f4bb4a..26cd1d9cf1 100644 --- a/smtk/common/CMakeLists.txt +++ b/smtk/common/CMakeLists.txt @@ -26,6 +26,7 @@ set(commonHeaders CompilerInformation.h DateTime.h DateTimeZonePair.h + Deprecation.h Environment.h Extension.h Factory.h -- GitLab From b0d4bc496aafcc36ca57eab090de3308a0eaed44 Mon Sep 17 00:00:00 2001 From: Corey Hart Date: Wed, 2 Jun 2021 17:16:36 -0500 Subject: [PATCH 059/136] Hide disabled attribute resources Provide a method to mark a resources as enabled/disabled so that we can hide it in certain contexts --- .../notes/hide-disabled-attr-rsrcs.rst | 9 +++ smtk/attribute/Resource.h | 8 ++ smtk/attribute/json/jsonResource.cxx | 7 ++ .../appcomponents/pqSMTKAttributePanel.cxx | 81 ++++++++++++------- .../appcomponents/pqSMTKAttributePanel.h | 6 ++ 5 files changed, 83 insertions(+), 28 deletions(-) create mode 100644 doc/release/notes/hide-disabled-attr-rsrcs.rst diff --git a/doc/release/notes/hide-disabled-attr-rsrcs.rst b/doc/release/notes/hide-disabled-attr-rsrcs.rst new file mode 100644 index 0000000000..d050aba90e --- /dev/null +++ b/doc/release/notes/hide-disabled-attr-rsrcs.rst @@ -0,0 +1,9 @@ +Hide disabled attribute resources +================================= + +The Attribute Editor panel will now first check to see if an +Attribute Resource is enabled before attempting to display it. +Telling the Attribute Editor panel to display a disabled Attribute +Resource will be the equivalent to telling the panel to display a +nullptr. The panel will be reset if it was currently display +any widgets. diff --git a/smtk/attribute/Resource.h b/smtk/attribute/Resource.h index 928c7bcf41..2431386691 100644 --- a/smtk/attribute/Resource.h +++ b/smtk/attribute/Resource.h @@ -104,6 +104,12 @@ public: // removed (external nodes). bool removeDefinition(smtk::attribute::DefinitionPtr def); + // Description: + // Provide a way to mark a resource enabled/disabled + // so that we can hide it in certain contexts + void setIsPrivate(bool isPrivateValue) { m_isPrivate = isPrivateValue; } + bool isPrivate() const { return m_isPrivate; }; + smtk::attribute::AttributePtr createAttribute(const std::string& name, const std::string& type); smtk::attribute::AttributePtr createAttribute(attribute::DefinitionPtr def); smtk::attribute::AttributePtr createAttribute(const std::string& type); @@ -404,6 +410,8 @@ protected: AssociationRules m_associationRules; + bool m_isPrivate = true; + EvaluatorFactory m_evaluatorFactory; private: diff --git a/smtk/attribute/json/jsonResource.cxx b/smtk/attribute/json/jsonResource.cxx index 4d9bec80b6..d879c9b7dc 100644 --- a/smtk/attribute/json/jsonResource.cxx +++ b/smtk/attribute/json/jsonResource.cxx @@ -37,6 +37,7 @@ SMTKCORE_EXPORT void to_json(json& j, const smtk::attribute::ResourcePtr& res) smtk::resource::to_json(j, smtk::static_pointer_cast(res)); // Set the version to 4.0 j["version"] = "4.0"; + j["IsPrivate"] = res->isPrivate(); // Write out the active category information if (!res->activeCategories().empty()) { @@ -326,6 +327,12 @@ SMTKCORE_EXPORT void from_json(const json& j, smtk::attribute::ResourcePtr& res) auto resource = std::static_pointer_cast(res); smtk::resource::from_json(j, resource); + // Set Private State + auto isPrivateResult = j.find("IsPrivate"); + // if we're reading in an older attribute resource, default value to true + bool isPrivateValue = isPrivateResult != j.end() ? isPrivateResult->get() : true; + res->setIsPrivate(isPrivateValue); + // Process Analysis Info auto result = j.find("Analyses"); if (result != j.end()) diff --git a/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.cxx b/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.cxx index 490e2ce365..9535e0368b 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.cxx +++ b/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.cxx @@ -46,7 +46,7 @@ pqSMTKAttributePanel::pqSMTKAttributePanel(QWidget* parent) : Superclass(parent) { this->setObjectName("attributeEditor"); - this->setWindowTitle("Attribute Editor"); + updateTitle(); QWidget* w = new QWidget(this); w->setObjectName("attributePanel"); this->setWidget(w); @@ -114,34 +114,59 @@ bool pqSMTKAttributePanel::displayPipelineSource(pqPipelineSource* psrc) return false; } -bool pqSMTKAttributePanel::displayResource(const smtk::attribute::ResourcePtr& rsrc) +void pqSMTKAttributePanel::resetPanel(smtk::resource::ManagerPtr rsrcMgr) { - bool didDisplay = false; - auto previousResource = m_rsrc.lock(); - if (!rsrc || rsrc == previousResource) - { - return didDisplay; - } - - if (previousResource) - { - auto rsrcMgr = previousResource->manager(); - if (rsrcMgr && m_observer.assigned()) - { - rsrcMgr->observers().erase(m_observer); - } - } - m_rsrc = rsrc; if (m_attrUIMgr) { m_propertyLinks.clear(); delete m_attrUIMgr; + m_attrUIMgr = nullptr; while (QWidget* w = this->widget()->findChild()) { delete w; } } + if (rsrcMgr && m_observer.assigned()) + { + rsrcMgr->observers().erase(m_observer); + } + + m_rsrc = std::weak_ptr(); +} + +bool pqSMTKAttributePanel::displayResource(const smtk::attribute::ResourcePtr& rsrc) +{ + bool didDisplay = false; + + if (rsrc) + { + auto previousResource = m_rsrc.lock(); + + if (rsrc->isPrivate() && rsrc != previousResource) + { + resetPanel(rsrc->manager()); + didDisplay = displayResourceInternal(rsrc); + } + else if (!rsrc->isPrivate() && rsrc == previousResource) + { + // the panel is displaying a resource that is now private + // stop displaying it + resetPanel(rsrc->manager()); + } + } + + this->updateTitle(); + + return didDisplay; +} + +bool pqSMTKAttributePanel::displayResourceInternal(const smtk::attribute::ResourcePtr& rsrc) +{ + bool didDisplay = false; + + m_rsrc = rsrc; + m_attrUIMgr = new smtk::extension::qtUIManager(rsrc); m_attrUIMgr->setOperationManager(m_opManager); // Assign the operation manager m_attrUIMgr->setViewManager(m_viewManager); @@ -213,17 +238,9 @@ bool pqSMTKAttributePanel::displayResource(const smtk::attribute::ResourcePtr& r { // The application is removing the attribute resource we are viewing. // Clear out the panel and unobserve the manager. - delete m_attrUIMgr; - m_attrUIMgr = nullptr; + this->resetPanel(weakResourceManager.lock()); + this->updateTitle(); m_seln = nullptr; - while (QWidget* w = this->widget()->findChild()) - { - delete w; - } - if (auto rsrcMgr = weakResourceManager.lock()) - { - rsrcMgr->observers().erase(m_observer); - } } }, "pqSMTKAttributePanel: Clear panel if a removed resource is being displayed."); @@ -290,3 +307,11 @@ void pqSMTKAttributePanel::updateSettings() auto* smtkSettings = vtkSMTKSettings::GetInstance(); m_attrUIMgr->setHighlightOnHover(smtkSettings->GetHighlightOnHover()); } + +void pqSMTKAttributePanel::updateTitle() +{ + auto rsrc = m_rsrc.lock(); + QString panelName = "Attribute Editor"; + QString title = rsrc ? (panelName + '(' + rsrc->name().c_str() + ')') : panelName; + this->setWindowTitle(title); +} diff --git a/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.h b/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.h index 62b5ecd014..d654e9e36b 100644 --- a/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.h +++ b/smtk/extension/paraview/appcomponents/pqSMTKAttributePanel.h @@ -83,6 +83,10 @@ public slots: * contents have changed). Re-render. */ virtual bool updatePipeline(); + /**\brief Clear panel widgets, unobserve displayed resource, + * and set the attribute resource pointer to null. + */ + virtual void resetPanel(smtk::resource::ManagerPtr rsrcMgr); protected slots: /**\brief Called when vtkSMTKSettings is modified, indicating user preferences have changed. @@ -96,6 +100,8 @@ protected slots: virtual void updateSettings(); protected: + virtual bool displayResourceInternal(const smtk::attribute::ResourcePtr& rsrc); + virtual void updateTitle(); smtk::extension::qtUIManager* m_attrUIMgr{ nullptr }; std::weak_ptr m_rsrc; smtk::view::SelectionPtr m_seln; -- GitLab From 46242849da11ab664e541dda3d1d90400ef50469 Mon Sep 17 00:00:00 2001 From: Corey Hart Date: Mon, 14 Jun 2021 14:02:27 -0500 Subject: [PATCH 060/136] Defaulted the move constructor for DerivedFrom This is to allow the compiler to determine which constructor should be called based on the type used with the template. Resolves compilation on MSVC. --- smtk/resource/DerivedFrom.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/smtk/resource/DerivedFrom.h b/smtk/resource/DerivedFrom.h index ba3ec8a6ac..f3b6e51e48 100644 --- a/smtk/resource/DerivedFrom.h +++ b/smtk/resource/DerivedFrom.h @@ -72,10 +72,7 @@ protected: { } - DerivedFrom(DerivedFrom&& rhs) noexcept - : Parent(std::move(rhs)) - { - } + DerivedFrom(DerivedFrom&& rhs) = default; }; template -- GitLab From 82e2f0489109eb32fc1e8134d9e7a616cc40f56d Mon Sep 17 00:00:00 2001 From: Ryan Krattiger Date: Tue, 15 Jun 2021 15:33:36 -0500 Subject: [PATCH 061/136] Add VersionMacros.h to public headers --- smtk/common/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/smtk/common/CMakeLists.txt b/smtk/common/CMakeLists.txt index 26cd1d9cf1..bd9cabb722 100644 --- a/smtk/common/CMakeLists.txt +++ b/smtk/common/CMakeLists.txt @@ -56,6 +56,7 @@ set(commonHeaders TypeContainer.h UUID.h UUIDGenerator.h + VersionMacros.h testing/cxx/helpers.h ${CMAKE_CURRENT_BINARY_DIR}/Version.h -- GitLab From 9046e14130d282267dc8a6d110152b78ae93bec1 Mon Sep 17 00:00:00 2001 From: Corey Hart Date: Wed, 16 Jun 2021 10:51:04 -0500 Subject: [PATCH 062/136] ResourcePhraseModel improperly filtering resources --- smtk/view/ResourcePhraseModel.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smtk/view/ResourcePhraseModel.cxx b/smtk/view/ResourcePhraseModel.cxx index 24c922b91f..779e9096da 100644 --- a/smtk/view/ResourcePhraseModel.cxx +++ b/smtk/view/ResourcePhraseModel.cxx @@ -73,7 +73,7 @@ bool ResourcePhraseModel::setResourceFilters( const std::multimap& resourceFilters) { auto filter = [resourceFilters](const smtk::resource::Resource& resource) -> bool { - bool acceptable = false; + bool acceptable = resourceFilters.empty(); for (const auto& filter : resourceFilters) { if (resource.isOfType(filter.first)) @@ -82,7 +82,7 @@ bool ResourcePhraseModel::setResourceFilters( break; } } - return !acceptable; + return acceptable; }; return setFilter(filter); } -- GitLab From 1c3a1bb7fdea4f332040c05dd7e43642372ac9fc Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 18 Jun 2021 13:22:24 -0400 Subject: [PATCH 063/136] Fixes for cmake policy CMP0115 and test-label uniformity. CMP0115 requires test names passed to `smtk_add_test` to include the filetype extension. The `smtk_add_test` macro was not properly escaping labels so if developers specified multiple labels they were not passed to `set_tests_properties(LABELS ...)` properly. A lot of test labels in SMTK were not consistently named (bad capitalization and other variations). --- CMake/SMTKTestingMacros.cmake | 4 +- doc/release/notes/cmake-policy.rst | 6 +++ smtk/attribute/testing/cxx/CMakeLists.txt | 38 +++++++++---------- smtk/common/testing/cxx/CMakeLists.txt | 18 ++++----- .../matplotlib/testing/cxx/CMakeLists.txt | 2 +- .../paraview/mesh/testing/xml/CMakeLists.txt | 2 +- .../widgets/testing/xml/CMakeLists.txt | 2 +- smtk/extension/qt/testing/cxx/CMakeLists.txt | 3 +- .../vtk/io/testing/cxx/CMakeLists.txt | 2 +- .../vtk/source/testing/python/CMakeLists.txt | 2 +- smtk/geometry/testing/cxx/CMakeLists.txt | 2 +- smtk/graph/testing/cxx/CMakeLists.txt | 2 +- smtk/model/testing/cxx/CMakeLists.txt | 2 +- smtk/operation/testing/cxx/CMakeLists.txt | 20 +++++----- smtk/plugin/testing/cxx/CMakeLists.txt | 4 +- smtk/plugin/testing/python/CMakeLists.txt | 4 +- smtk/project/plugin/CMakeLists.txt | 8 ++-- smtk/project/testing/cxx/CMakeLists.txt | 22 +++++------ smtk/resource/testing/cxx/CMakeLists.txt | 2 +- smtk/session/mesh/testing/xml/CMakeLists.txt | 2 +- .../oscillator/testing/cxx/CMakeLists.txt | 2 +- .../oscillator/testing/python/CMakeLists.txt | 2 +- smtk/view/testing/cxx/CMakeLists.txt | 2 +- smtk/workflow/testing/cxx/CMakeLists.txt | 2 +- 24 files changed, 82 insertions(+), 73 deletions(-) create mode 100644 doc/release/notes/cmake-policy.rst diff --git a/CMake/SMTKTestingMacros.cmake b/CMake/SMTKTestingMacros.cmake index f05157a219..d239783d6c 100644 --- a/CMake/SMTKTestingMacros.cmake +++ b/CMake/SMTKTestingMacros.cmake @@ -58,7 +58,7 @@ function(smtk_unit_tests) ) set_tests_properties(${tname} PROPERTIES TIMEOUT 120) if(SMTK_ut_LABEL) - set_tests_properties(${tname} PROPERTIES LABELS ${SMTK_ut_LABEL}) + set_tests_properties(${tname} PROPERTIES LABELS "${SMTK_ut_LABEL}") endif() endforeach(test) @@ -130,7 +130,7 @@ function(smtk_build_failure_tests) ) set_tests_properties(${tname} PROPERTIES TIMEOUT 120 WILL_FAIL TRUE) if(SMTK_ut_LABEL) - set_tests_properties(${tname} PROPERTIES LABELS ${SMTK_ut_LABEL}) + set_tests_properties(${tname} PROPERTIES LABELS "${SMTK_ut_LABEL}") endif() endforeach() # attempt endforeach() # source_idx diff --git a/doc/release/notes/cmake-policy.rst b/doc/release/notes/cmake-policy.rst new file mode 100644 index 0000000000..35bc86f77a --- /dev/null +++ b/doc/release/notes/cmake-policy.rst @@ -0,0 +1,6 @@ +CMake Policies +============== + +Because of CMake policy CMP0115 (source file extensions must be explicit), +when passing test names to the ``smtk_add_test`` macro, be sure to include +the filename extension (such as ``.cxx``). diff --git a/smtk/attribute/testing/cxx/CMakeLists.txt b/smtk/attribute/testing/cxx/CMakeLists.txt index 0f7162e7a5..3b433b5bf2 100644 --- a/smtk/attribute/testing/cxx/CMakeLists.txt +++ b/smtk/attribute/testing/cxx/CMakeLists.txt @@ -74,38 +74,38 @@ endif() ################################################################################ set(unit_tests - unitAdvanceLevelTest - unitAssociationRulesTest - unitAssociationTest - unitAttributeAnalysis - unitAttributeAssociation - unitAttributeAssociationConstraints - unitAttributeBasics - unitAttributeExclusiveAnalysis - unitReferenceItemChildrenTest - unitCategories + unitAdvanceLevelTest.cxx + unitAssociationRulesTest.cxx + unitAssociationTest.cxx + unitAttributeAnalysis.cxx + unitAttributeAssociation.cxx + unitAttributeAssociationConstraints.cxx + unitAttributeBasics.cxx + unitAttributeExclusiveAnalysis.cxx + unitReferenceItemChildrenTest.cxx + unitCategories.cxx unitComponentItem.cxx - unitComponentItemConstraints - unitCustomItem + unitComponentItemConstraints.cxx + unitCustomItem.cxx unitDateTimeItem.cxx - unitDefinitionTags + unitDefinitionTags.cxx unitDoubleItem.cxx unitEvaluatorFactory.cxx unitEvaluatorManager.cxx - unitExclusionCategories + unitExclusionCategories.cxx unitInfixExpressionEvaluator.cxx unitJsonItemDefinitions.cxx - unitOptionalItems - unitPassCategories + unitOptionalItems.cxx + unitPassCategories.cxx unitPathGrammar.cxx unitRegistrar.cxx unitSymbolDependencyStorage.cxx ) set(unit_tests_which_require_data - unitAnalysisConfigurations - unitConditionalGroup - unitItemBlocks + unitAnalysisConfigurations.cxx + unitConditionalGroup.cxx + unitItemBlocks.cxx ) set(extra_libs ${Boost_LIBRARIES}) diff --git a/smtk/common/testing/cxx/CMakeLists.txt b/smtk/common/testing/cxx/CMakeLists.txt index 131016cf48..0984851468 100644 --- a/smtk/common/testing/cxx/CMakeLists.txt +++ b/smtk/common/testing/cxx/CMakeLists.txt @@ -33,25 +33,25 @@ endif() set(unit_tests TestArchive.cxx - UnitTestDerivedThreadPool + UnitTestDerivedThreadPool.cxx UnitTestDateTime.cxx UnitTestDateTimeZonePair.cxx - UnitTestFactory + UnitTestFactory.cxx UnitTestInfixExpressionGrammar.cxx UnitTestInfixExpressionGrammarImpl.cxx - UnitTestLinks - UnitTestObservers - UnitTestThreadPool - UnitTestTypeContainer - UnitTestTypeMap - UnitTestTypeName + UnitTestLinks.cxx + UnitTestObservers.cxx + UnitTestThreadPool.cxx + UnitTestTypeContainer.cxx + UnitTestTypeMap.cxx + UnitTestTypeName.cxx ) set(unit_tests_which_require_data ) smtk_unit_tests( - Label "Common" + LABEL "Common" SOURCES ${unit_tests} SOURCES_REQUIRE_DATA ${unit_tests_which_require_data} LIBRARIES smtkCore ${Boost_LIBRARIES} Threads::Threads MOAB diff --git a/smtk/extension/matplotlib/testing/cxx/CMakeLists.txt b/smtk/extension/matplotlib/testing/cxx/CMakeLists.txt index 0458bbbf54..0e5a31a88b 100644 --- a/smtk/extension/matplotlib/testing/cxx/CMakeLists.txt +++ b/smtk/extension/matplotlib/testing/cxx/CMakeLists.txt @@ -24,7 +24,7 @@ if (SMTK_ENABLE_VTK_SUPPORT) endif() smtk_unit_tests( - LABEL "vtk" + LABEL "VTK" SOURCES ${unit_tests} SOURCES_REQUIRE_DATA ${unit_tests_which_require_data} EXTRA_SOURCES ${additional_sources} diff --git a/smtk/extension/paraview/mesh/testing/xml/CMakeLists.txt b/smtk/extension/paraview/mesh/testing/xml/CMakeLists.txt index c68e1d18fb..eacf06e624 100644 --- a/smtk/extension/paraview/mesh/testing/xml/CMakeLists.txt +++ b/smtk/extension/paraview/mesh/testing/xml/CMakeLists.txt @@ -9,7 +9,7 @@ set(MeshSelection_USES_DIRECT_DATA ON) if (SMTK_DATA_DIR) smtk_add_client_tests( -# LABEL "pv_meshsession" + #LABEL "MeshSession" TEST_SCRIPTS ${TESTS_WITH_BASELINES} LOAD_PLUGINS smtkResourcePlugin diff --git a/smtk/extension/paraview/widgets/testing/xml/CMakeLists.txt b/smtk/extension/paraview/widgets/testing/xml/CMakeLists.txt index 863c1e8c65..13e5d09e3b 100644 --- a/smtk/extension/paraview/widgets/testing/xml/CMakeLists.txt +++ b/smtk/extension/paraview/widgets/testing/xml/CMakeLists.txt @@ -21,7 +21,7 @@ set(SplineWidget_USES_DIRECT_DATA ON) if (SMTK_DATA_DIR) smtk_add_client_tests( -# LABEL "pv_meshsession" + #LABEL "MeshSession" TEST_SCRIPTS ${TESTS_WITH_BASELINES} LOAD_PLUGINS smtkResourcePlugin diff --git a/smtk/extension/qt/testing/cxx/CMakeLists.txt b/smtk/extension/qt/testing/cxx/CMakeLists.txt index 5157d2567f..4339486424 100644 --- a/smtk/extension/qt/testing/cxx/CMakeLists.txt +++ b/smtk/extension/qt/testing/cxx/CMakeLists.txt @@ -67,7 +67,8 @@ endif () set(CMAKE_AUTOMOC 1) -smtk_unit_tests(LABEL "qt" +smtk_unit_tests( + LABEL "Qt" SOURCES ${unit_tests} SOURCES_REQUIRE_DATA ${unit_tests_which_require_data} EXTRA_SOURCES ${unit_tests_headers} diff --git a/smtk/extension/vtk/io/testing/cxx/CMakeLists.txt b/smtk/extension/vtk/io/testing/cxx/CMakeLists.txt index 0a5b0b004f..bd8890b352 100644 --- a/smtk/extension/vtk/io/testing/cxx/CMakeLists.txt +++ b/smtk/extension/vtk/io/testing/cxx/CMakeLists.txt @@ -23,7 +23,7 @@ set(unit_tests_which_require_data set(unit_test_libs) -smtk_unit_tests(LABEL "vtk/io" +smtk_unit_tests(LABELS "VTK" SOURCES ${unit_tests} SOURCES_REQUIRE_DATA ${unit_tests_which_require_data} LIBRARIES smtkIOVTK smtkCoreModelTesting diff --git a/smtk/extension/vtk/source/testing/python/CMakeLists.txt b/smtk/extension/vtk/source/testing/python/CMakeLists.txt index 269ee9904c..0445f51470 100644 --- a/smtk/extension/vtk/source/testing/python/CMakeLists.txt +++ b/smtk/extension/vtk/source/testing/python/CMakeLists.txt @@ -18,6 +18,6 @@ if (SMTK_DATA_DIR) foreach(test ${smtkExtensionVTKSourcePythonDataTests}) smtk_add_test_python(${test}Py ${test}.py --data-dir=${SMTK_DATA_DIR} ) - set_tests_properties( ${test}Py PROPERTIES LABELS "Source" ) + set_tests_properties( ${test}Py PROPERTIES LABELS "VTK" ) endforeach() endif() diff --git a/smtk/geometry/testing/cxx/CMakeLists.txt b/smtk/geometry/testing/cxx/CMakeLists.txt index 624ef43243..8af763a539 100644 --- a/smtk/geometry/testing/cxx/CMakeLists.txt +++ b/smtk/geometry/testing/cxx/CMakeLists.txt @@ -7,7 +7,7 @@ set(unit_tests ) smtk_unit_tests( - Label "Geometry" + LABEL "Geometry" SOURCES ${unit_tests} LIBRARIES smtkCore ) diff --git a/smtk/graph/testing/cxx/CMakeLists.txt b/smtk/graph/testing/cxx/CMakeLists.txt index 371c09cd43..18197ac5b9 100644 --- a/smtk/graph/testing/cxx/CMakeLists.txt +++ b/smtk/graph/testing/cxx/CMakeLists.txt @@ -9,7 +9,7 @@ set(unit_tests ) smtk_unit_tests( - Label "GraphResource" + LABEL "Graph" SOURCES ${unit_tests} LIBRARIES smtkCore ) diff --git a/smtk/model/testing/cxx/CMakeLists.txt b/smtk/model/testing/cxx/CMakeLists.txt index 8643124771..9341652b0f 100644 --- a/smtk/model/testing/cxx/CMakeLists.txt +++ b/smtk/model/testing/cxx/CMakeLists.txt @@ -46,7 +46,7 @@ target_link_libraries(benchmarkModel smtkCore smtkCoreModelTesting) #add_test(NAME benchmarkModel COMMAND benchmarkModel) set(unit_tests - unitDeleterGroup + unitDeleterGroup.cxx ) ################################################################################ diff --git a/smtk/operation/testing/cxx/CMakeLists.txt b/smtk/operation/testing/cxx/CMakeLists.txt index 70eba066f9..b6103d2e69 100644 --- a/smtk/operation/testing/cxx/CMakeLists.txt +++ b/smtk/operation/testing/cxx/CMakeLists.txt @@ -1,19 +1,19 @@ set(unit_tests - TestAsyncOperation - TestAvailableOperations - TestMutexedOperation - unitOperation - unitNamingGroup - TestOperationGroup - TestOperationLauncher - TestRemoveResource - TestThreadSafeLazyEvaluation + TestAsyncOperation.cxx + TestAvailableOperations.cxx + TestMutexedOperation.cxx + unitOperation.cxx + unitNamingGroup.cxx + TestOperationGroup.cxx + TestOperationLauncher.cxx + TestRemoveResource.cxx + TestThreadSafeLazyEvaluation.cxx ) find_package(Threads REQUIRED) smtk_unit_tests( - Label "operation" + LABEL "Operation" SOURCES ${unit_tests} LIBRARIES smtkCore ) diff --git a/smtk/plugin/testing/cxx/CMakeLists.txt b/smtk/plugin/testing/cxx/CMakeLists.txt index 66f1dfa7ee..6aebf70357 100644 --- a/smtk/plugin/testing/cxx/CMakeLists.txt +++ b/smtk/plugin/testing/cxx/CMakeLists.txt @@ -1,12 +1,12 @@ set(unit_tests - UnitTestRegistry + UnitTestRegistry.cxx ) set(unit_tests_which_require_data ) smtk_unit_tests( - Label "Plugin" + LABEL "Plugin" SOURCES ${unit_tests} SOURCES_REQUIRE_DATA ${unit_tests_which_require_data} LIBRARIES smtkCore diff --git a/smtk/plugin/testing/python/CMakeLists.txt b/smtk/plugin/testing/python/CMakeLists.txt index b2b775524a..851c070180 100644 --- a/smtk/plugin/testing/python/CMakeLists.txt +++ b/smtk/plugin/testing/python/CMakeLists.txt @@ -30,7 +30,7 @@ foreach(test ${smtkPVPluginSupportPythonTests}) else() smtk_add_test_python(${test}Py ${testfile}) endif() - set_tests_properties( ${test}Py PROPERTIES LABELS "PVPluginSupport" ) + set_tests_properties( ${test}Py PROPERTIES LABELS "Plugin" ) endforeach() if (SMTK_DATA_DIR) @@ -45,6 +45,6 @@ if (SMTK_DATA_DIR) smtk_add_test_python(${test}Py ${test}.py --data-dir=${SMTK_DATA_DIR} ) endif() - set_tests_properties( ${test}Py PROPERTIES LABELS "PVPluginSupport" ) + set_tests_properties( ${test}Py PROPERTIES LABELS "Plugin" ) endforeach() endif() diff --git a/smtk/project/plugin/CMakeLists.txt b/smtk/project/plugin/CMakeLists.txt index 501c0056d4..e02adc5404 100644 --- a/smtk/project/plugin/CMakeLists.txt +++ b/smtk/project/plugin/CMakeLists.txt @@ -1,5 +1,5 @@ if (SMTK_ENABLE_PROJECT_UI) - set(ui_classes + set(uiClasses AutoStart pqSMTKProjectBrowser pqSMTKProjectMenu @@ -7,6 +7,9 @@ if (SMTK_ENABLE_PROJECT_UI) ) set(uiFiles) + foreach(class ${uiClasses}) + list(APPEND uiFiles ${class}.cxx) + endforeach() smtk_encode_file("${CMAKE_CURRENT_SOURCE_DIR}/ProjectPanelConfiguration.json" TYPE "_json" @@ -42,7 +45,6 @@ endif () smtk_add_plugin(smtkProjectPlugin REGISTRAR smtk::project::plugin::Registrar - REGISTRAR_HEADER smtk/project/plugin/Registrar.h MANAGERS smtk::common::Managers smtk::operation::Manager @@ -52,7 +54,7 @@ smtk_add_plugin(smtkProjectPlugin PARAVIEW_PLUGIN_ARGS VERSION 1.0 SOURCES - Registrar + Registrar.cxx ${ui_classes} ${plugin_ui_srcs} UI_INTERFACES diff --git a/smtk/project/testing/cxx/CMakeLists.txt b/smtk/project/testing/cxx/CMakeLists.txt index cc788d2e1b..f075c73d8c 100644 --- a/smtk/project/testing/cxx/CMakeLists.txt +++ b/smtk/project/testing/cxx/CMakeLists.txt @@ -1,19 +1,19 @@ # Using smtk test harness set(unit_tests - TestDefineOp - TestProject - TestProjectAssociation - TestProjectLifeCycle - TestProjectLifeCycle_Deprecated - TestProjectResources + TestDefineOp.cxx + TestProject.cxx + TestProjectAssociation.cxx + TestProjectLifeCycle.cxx + TestProjectLifeCycle_Deprecated.cxx + TestProjectResources.cxx ) set(unit_tests_which_require_data - TestProjectReadWrite - TestProjectReadWrite_Deprecated - TestProjectReadWrite2 - TestProjectReadWrite2_Deprecated - TestProjectReadWriteEmpty + TestProjectReadWrite.cxx + TestProjectReadWrite_Deprecated.cxx + TestProjectReadWrite2.cxx + TestProjectReadWrite2_Deprecated.cxx + TestProjectReadWriteEmpty.cxx ) set(extra_libs) if (SMTK_ENABLE_VTK_SUPPORT) diff --git a/smtk/resource/testing/cxx/CMakeLists.txt b/smtk/resource/testing/cxx/CMakeLists.txt index 4413c274b1..ef666a1993 100644 --- a/smtk/resource/testing/cxx/CMakeLists.txt +++ b/smtk/resource/testing/cxx/CMakeLists.txt @@ -21,7 +21,7 @@ set(unit_tests ) smtk_unit_tests( - Label "Resource" + LABEL "Resource" SOURCES ${unit_tests} LIBRARIES smtkCore ) diff --git a/smtk/session/mesh/testing/xml/CMakeLists.txt b/smtk/session/mesh/testing/xml/CMakeLists.txt index 611602bd04..4952669d1a 100644 --- a/smtk/session/mesh/testing/xml/CMakeLists.txt +++ b/smtk/session/mesh/testing/xml/CMakeLists.txt @@ -8,7 +8,7 @@ set(OpenExodusFile_USES_DIRECT_DATA ON) if (SMTK_DATA_DIR) smtk_add_client_tests( -# LABEL "pv_meshsession" + #LABEL "MeshSession" TEST_SCRIPTS ${TESTS_WITH_BASELINES} LOAD_PLUGINS smtkResourcePlugin diff --git a/smtk/session/oscillator/testing/cxx/CMakeLists.txt b/smtk/session/oscillator/testing/cxx/CMakeLists.txt index 917a1ecc70..56686977b2 100644 --- a/smtk/session/oscillator/testing/cxx/CMakeLists.txt +++ b/smtk/session/oscillator/testing/cxx/CMakeLists.txt @@ -15,7 +15,7 @@ # set (unit_tests_which_require_data) # # smtk_unit_tests( -# LABEL "oscillator session" +# LABEL "OscillatorSession" # SOURCES ${unit_tests} # SOURCES_REQUIRE_DATA ${unit_tests_which_require_data} # LIBRARIES smtkCore smtkOscillatorSession) diff --git a/smtk/session/oscillator/testing/python/CMakeLists.txt b/smtk/session/oscillator/testing/python/CMakeLists.txt index 7bfda5d9ca..ba43be250e 100644 --- a/smtk/session/oscillator/testing/python/CMakeLists.txt +++ b/smtk/session/oscillator/testing/python/CMakeLists.txt @@ -6,6 +6,6 @@ # foreach (test ${smtkOscillatorPythonDataTests}) # smtk_add_test_python(${test}Py ${test}.py # --data-dir=${SMTK_DATA_DIR} ) -# set_tests_properties( ${test}Py PROPERTIES LABELS "oscillator session" ) +# set_tests_properties( ${test}Py PROPERTIES LABELS "OscillatorSession" ) # endforeach() # endif() diff --git a/smtk/view/testing/cxx/CMakeLists.txt b/smtk/view/testing/cxx/CMakeLists.txt index 62c4a711a8..d5b0856006 100644 --- a/smtk/view/testing/cxx/CMakeLists.txt +++ b/smtk/view/testing/cxx/CMakeLists.txt @@ -17,7 +17,7 @@ set(helper_srcs if (SMTK_ENABLE_POLYGON_SESSION) smtk_unit_tests( - Label "View" + LABEL "View" SOURCES ${unit_tests} SOURCES_REQUIRE_DATA ${unit_tests_which_require_data} EXTRA_SOURCES ${helper_srcs} diff --git a/smtk/workflow/testing/cxx/CMakeLists.txt b/smtk/workflow/testing/cxx/CMakeLists.txt index a4a1e434e3..5dab0340e8 100644 --- a/smtk/workflow/testing/cxx/CMakeLists.txt +++ b/smtk/workflow/testing/cxx/CMakeLists.txt @@ -7,7 +7,7 @@ set(unit_tests_which_require_data if (SMTK_ENABLE_POLYGON_SESSION) smtk_unit_tests( - Label "workflow" + LABEL "Workflow" SOURCES ${unit_tests} SOURCES_REQUIRE_DATA ${unit_tests_which_require_data} LIBRARIES -- GitLab From 367a0313ef603270338f2227c521a2ac735479a9 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 5 Jun 2021 09:23:42 -0400 Subject: [PATCH 064/136] Fix macos/clang warnings. --- smtk/attribute/InfixExpressionEvaluator.cxx | 2 +- smtk/project/Metadata.h | 4 ++-- smtk/project/Registrar.cxx | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/smtk/attribute/InfixExpressionEvaluator.cxx b/smtk/attribute/InfixExpressionEvaluator.cxx index 68044b4aa0..1191f54fbd 100644 --- a/smtk/attribute/InfixExpressionEvaluator.cxx +++ b/smtk/attribute/InfixExpressionEvaluator.cxx @@ -203,7 +203,7 @@ bool smtk::attribute::InfixExpressionEvaluator::doesEvaluate(std::size_t element bool smtk::attribute::InfixExpressionEvaluator::doesEvaluate() { - for (int i = 0; i < numberOfEvaluatableElements(); ++i) + for (std::size_t i = 0; i < numberOfEvaluatableElements(); ++i) { if (!doesEvaluate(i)) return false; diff --git a/smtk/project/Metadata.h b/smtk/project/Metadata.h index 65e95083fc..233771e236 100644 --- a/smtk/project/Metadata.h +++ b/smtk/project/Metadata.h @@ -41,9 +41,9 @@ public: const std::set& resources = std::set(), const std::set& operations = std::set(), const std::string& version = "0.0.0") - : m_typeName(typeName) + : create(createFunctor) + , m_typeName(typeName) , m_index(index) - , create(createFunctor) , m_resources(resources) , m_operations(operations) , m_version(version) diff --git a/smtk/project/Registrar.cxx b/smtk/project/Registrar.cxx index d57a7b9db8..761925db0e 100644 --- a/smtk/project/Registrar.cxx +++ b/smtk/project/Registrar.cxx @@ -69,11 +69,15 @@ void Registrar::unregisterFrom(const smtk::common::Managers::Ptr& managers) void Registrar::registerTo(const smtk::operation::Manager::Ptr& operationManager) { + (void)operationManager; /// Defer the registration of project operations until there is a project /// manager available. } -void Registrar::unregisterFrom(const smtk::operation::Manager::Ptr& operationManager) {} +void Registrar::unregisterFrom(const smtk::operation::Manager::Ptr& operationManager) +{ + (void)operationManager; +} void Registrar::registerTo(const smtk::project::Manager::Ptr& projectManager) { -- GitLab From 43c5c5a3e9cb7cbd93d01cd6bdb6394ced61e68d Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 5 Jun 2021 10:08:08 -0400 Subject: [PATCH 065/136] Fix more warnings. --- smtk/project/plugin/Registrar.cxx | 2 ++ smtk/session/mesh/operators/Write.cxx | 14 -------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/smtk/project/plugin/Registrar.cxx b/smtk/project/plugin/Registrar.cxx index ee18bcb5fa..33824bd98e 100644 --- a/smtk/project/plugin/Registrar.cxx +++ b/smtk/project/plugin/Registrar.cxx @@ -31,6 +31,7 @@ void Registrar::unregisterFrom(const smtk::project::Manager::Ptr& projectManager void Registrar::registerTo(const smtk::view::Manager::Ptr& viewManager) { + (void)viewManager; #ifdef ENABLE_PROJECT_UI viewManager->viewWidgetFactory().registerType(); #endif @@ -38,6 +39,7 @@ void Registrar::registerTo(const smtk::view::Manager::Ptr& viewManager) void Registrar::unregisterFrom(const smtk::view::Manager::Ptr& viewManager) { + (void)viewManager; #ifdef ENABLE_PROJECT_UI viewManager->viewWidgetFactory().unregisterType(); #endif diff --git a/smtk/session/mesh/operators/Write.cxx b/smtk/session/mesh/operators/Write.cxx index d5eb2d5248..8bb79bca3f 100644 --- a/smtk/session/mesh/operators/Write.cxx +++ b/smtk/session/mesh/operators/Write.cxx @@ -38,20 +38,6 @@ SMTK_THIRDPARTY_POST_INCLUDE using namespace smtk::model; -namespace -{ -void cleanup(const std::string& file_path) -{ - //first verify the file exists - ::boost::filesystem::path path(file_path); - if (::boost::filesystem::is_regular_file(path)) - { - //remove the file_path if it exists. - ::boost::filesystem::remove(path); - } -} -} // namespace - namespace smtk { namespace session -- GitLab From 3a82423b8419882b723110e0284aee339664cd38 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 5 Jun 2021 15:26:14 -0400 Subject: [PATCH 066/136] Fix a typo. --- smtk/common/Factory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smtk/common/Factory.h b/smtk/common/Factory.h index 1bdfa3ee4b..44746751bd 100644 --- a/smtk/common/Factory.h +++ b/smtk/common/Factory.h @@ -139,7 +139,7 @@ class SMTK_ALWAYS_EXPORT Factory } }; - // A Metdata class that holds the create methods for a spcecific construction + // A Metdata class that holds the create methods for a specific construction // signature (InputType, defined at class-template scope) and derived type to // create (Type, defined explicitly using the class's constructor). This class // is the composing element for the factory's Metadata instance. -- GitLab From 45ad8c55059aa96b7563c19f54b10d80fb90ccfc Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 5 Jun 2021 15:26:45 -0400 Subject: [PATCH 067/136] Fix warnings. --- smtk/io/testing/cxx/groupItemCSVTest.cxx | 2 +- smtk/io/testing/cxx/groupItemDoubleFileTest.cxx | 2 +- smtk/project/testing/cxx/TestProjectReadWrite2.cxx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/smtk/io/testing/cxx/groupItemCSVTest.cxx b/smtk/io/testing/cxx/groupItemCSVTest.cxx index fab1821df4..9873bf94a4 100644 --- a/smtk/io/testing/cxx/groupItemCSVTest.cxx +++ b/smtk/io/testing/cxx/groupItemCSVTest.cxx @@ -32,7 +32,7 @@ namespace { bool checkGroupItem(GroupItemPtr gitem, int numGroups) { - if (gitem->numberOfGroups() != numGroups) + if (gitem->numberOfGroups() != static_cast(numGroups)) { std::cerr << "Group has " << gitem->numberOfGroups() << " instead of " << numGroups << std::endl; diff --git a/smtk/io/testing/cxx/groupItemDoubleFileTest.cxx b/smtk/io/testing/cxx/groupItemDoubleFileTest.cxx index 68e82d637f..38d01ba45d 100644 --- a/smtk/io/testing/cxx/groupItemDoubleFileTest.cxx +++ b/smtk/io/testing/cxx/groupItemDoubleFileTest.cxx @@ -32,7 +32,7 @@ namespace { bool checkGroupItem(GroupItemPtr gitem, int numGroups) { - if (gitem->numberOfGroups() != numGroups) + if (gitem->numberOfGroups() != static_cast(numGroups)) { std::cerr << "Group has " << gitem->numberOfGroups() << " instead of " << numGroups << std::endl; diff --git a/smtk/project/testing/cxx/TestProjectReadWrite2.cxx b/smtk/project/testing/cxx/TestProjectReadWrite2.cxx index 38e5f997ba..941ec9b9fe 100644 --- a/smtk/project/testing/cxx/TestProjectReadWrite2.cxx +++ b/smtk/project/testing/cxx/TestProjectReadWrite2.cxx @@ -184,7 +184,7 @@ int TestProjectReadWrite2(int /*unused*/, char** const /*unused*/) } // for (path) } - if (project->resources().size() != numberOfResources) + if (project->resources().size() != static_cast(numberOfResources)) { std::cerr << "Failed to add a resource to the project\n"; return 1; -- GitLab From 02e727779f78fe6bf5a08d4b3475a570f3462e4a Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 10 Jun 2021 15:38:28 -0400 Subject: [PATCH 068/136] Generate python that makes clang-tidy happy. --- utilities/python/cpp_to_pybind11.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utilities/python/cpp_to_pybind11.py b/utilities/python/cpp_to_pybind11.py index 35dc235586..dc2ad10533 100644 --- a/utilities/python/cpp_to_pybind11.py +++ b/utilities/python/cpp_to_pybind11.py @@ -339,7 +339,7 @@ def parse_free_enumeration(enum, stream): Write bindings for a free enumeration """ init_function_name = "pybind11_init_" + mangled_name(enum) - stream("void %s(py::module &m)" % init_function_name) + stream("inline void %s(py::module &m)" % init_function_name) stream("{") full_enum_name = full_class_name(enum) stream(" py::enum_<%s>(m, \"%s\")" % @@ -358,7 +358,7 @@ def parse_free_function(func, overloaded, stream): """ init_function_name = "pybind11_init_" + \ (func.mangled if overloaded else mangled_name(func)) - stream("void %s(py::module &m)" % init_function_name) + stream("inline void %s(py::module &m)" % init_function_name) stream("{") if overloaded: stream(" m.def(\"%s\", (%s (*)(%s)) &%s, \"\", %s);" % @@ -409,8 +409,8 @@ def parse_class(class_, stream, top_level=True): init_function_name = "pybind11_init_" + mangled_name(class_) if top_level: - stream("%s %s(py::module &m)" % (bind_class_name(class_), - init_function_name)) + stream("inline %s %s(py::module &m)" % (bind_class_name(class_), + init_function_name)) stream("{") stream(" %s instance(m, \"%s\");" % (bind_class_name(class_), -- GitLab From 197a8907803900fe7824196b658ec8127da2572b Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 5 Jun 2021 09:57:57 -0400 Subject: [PATCH 069/136] Add the concept of a task. --- doc/release/notes/task-system.rst | 7 + doc/userguide/index.rst | 1 + doc/userguide/task/classes.rst | 73 +++++ doc/userguide/task/concepts.rst | 39 +++ doc/userguide/task/index.rst | 15 ++ smtk/CMakeLists.txt | 5 + smtk/pybind11/__init__.py.in | 2 +- smtk/task/CMakeLists.txt | 30 +++ smtk/task/Factory.h | 85 ++++++ smtk/task/Manager.cxx | 22 ++ smtk/task/Manager.h | 64 +++++ smtk/task/Registrar.cxx | 65 +++++ smtk/task/Registrar.h | 41 +++ smtk/task/State.h | 81 ++++++ smtk/task/Task.cxx | 253 ++++++++++++++++++ smtk/task/Task.h | 252 +++++++++++++++++ smtk/task/TaskNeedsResources.cxx | 208 ++++++++++++++ smtk/task/TaskNeedsResources.h | 87 ++++++ smtk/task/plugin/CMakeLists.txt | 7 + smtk/task/plugin/paraview.plugin | 4 + smtk/task/pybind11/CMakeLists.txt | 30 +++ smtk/task/pybind11/PybindFactory.h | 58 ++++ smtk/task/pybind11/PybindManager.h | 40 +++ smtk/task/pybind11/PybindRegistrar.h | 37 +++ smtk/task/pybind11/PybindState.h | 40 +++ smtk/task/pybind11/PybindTask.cxx | 48 ++++ smtk/task/pybind11/PybindTask.h | 47 ++++ smtk/task/pybind11/PybindTaskNeedsResources.h | 49 ++++ smtk/task/pybind11/__init__.py | 13 + smtk/task/testing/CMakeLists.txt | 5 + smtk/task/testing/cxx/CMakeLists.txt | 11 + smtk/task/testing/cxx/TestTask.cxx | 242 +++++++++++++++++ 32 files changed, 1960 insertions(+), 1 deletion(-) create mode 100644 doc/release/notes/task-system.rst create mode 100644 doc/userguide/task/classes.rst create mode 100644 doc/userguide/task/concepts.rst create mode 100644 doc/userguide/task/index.rst create mode 100644 smtk/task/CMakeLists.txt create mode 100644 smtk/task/Factory.h create mode 100644 smtk/task/Manager.cxx create mode 100644 smtk/task/Manager.h create mode 100644 smtk/task/Registrar.cxx create mode 100644 smtk/task/Registrar.h create mode 100644 smtk/task/State.h create mode 100644 smtk/task/Task.cxx create mode 100644 smtk/task/Task.h create mode 100644 smtk/task/TaskNeedsResources.cxx create mode 100644 smtk/task/TaskNeedsResources.h create mode 100644 smtk/task/plugin/CMakeLists.txt create mode 100644 smtk/task/plugin/paraview.plugin create mode 100644 smtk/task/pybind11/CMakeLists.txt create mode 100644 smtk/task/pybind11/PybindFactory.h create mode 100644 smtk/task/pybind11/PybindManager.h create mode 100644 smtk/task/pybind11/PybindRegistrar.h create mode 100644 smtk/task/pybind11/PybindState.h create mode 100644 smtk/task/pybind11/PybindTask.cxx create mode 100644 smtk/task/pybind11/PybindTask.h create mode 100644 smtk/task/pybind11/PybindTaskNeedsResources.h create mode 100644 smtk/task/pybind11/__init__.py create mode 100644 smtk/task/testing/CMakeLists.txt create mode 100644 smtk/task/testing/cxx/CMakeLists.txt create mode 100644 smtk/task/testing/cxx/TestTask.cxx diff --git a/doc/release/notes/task-system.rst b/doc/release/notes/task-system.rst new file mode 100644 index 0000000000..9861560bb0 --- /dev/null +++ b/doc/release/notes/task-system.rst @@ -0,0 +1,7 @@ +Task subsystem +============== + +SMTK now provides a task subsystem for representing user-actionable tasks in a workflow. +See the `task-system documentation`_ for more information about how to use this subsystem. + +.. _task-system documentation: https://smtk.readthedocs.io/en/latest/userguide/task/index.html diff --git a/doc/userguide/index.rst b/doc/userguide/index.rst index 552f76f88a..bcd785c261 100644 --- a/doc/userguide/index.rst +++ b/doc/userguide/index.rst @@ -47,6 +47,7 @@ simulation domain. simulation/index.rst view/index.rst extension/index.rst + task/index.rst workflow/index.rst bindings/index.rst plugin/index.rst diff --git a/doc/userguide/task/classes.rst b/doc/userguide/task/classes.rst new file mode 100644 index 0000000000..b574b380dc --- /dev/null +++ b/doc/userguide/task/classes.rst @@ -0,0 +1,73 @@ +.. _smtk-task-classes: + +Guide to task classes +===================== + +The following sections describe the different task subclasses that +exist for use in your workflows, the use cases that motivate them, +and how to configure them. + +Task +---- + +The :smtk:`base Task class` does not monitor +anything on its own but can be used to collect dependencies. +It is Completable by default. +The following JSON can be used to configure it: + +* ``title``: an optional string value holding instructions to users. +* ``completed``: an optional boolean value indicating whether the + user has marked the task complete or not. + +Example: + +.. code:: json + + { + "type": "smtk::task::Task", + "title": "Instructions to users.", + "completed": false + } + +TaskNeedsResources +------------------ + +The :smtk:`TaskNeedsResources ` class monitors +a resource manager and is incomplete until its configured list of required +resources is acceptable, at which time it transitions to completable. +It is Incomplete by default unless unconfigured (in which case it is Completable). +It accepts all the JSON configuration that the base Task class does, plus: + +* ``resources``: a JSON array of required resources, organized by role. + Each array entry must be a JSON object holding: + + * ``role``: an optional string holding a resource role name. If omitted, any role is allowed. + * ``type``: an optional string holding a resource typename. If omitted, any resource type is allowed. + * ``min``: an optional integer specifying the number of resources with the given role and type that must be present. + Only non-negative values are accepted. + It defaults to 1, which makes the requirement mandatory. + If set to 0, the requirement is optional. + * ``max``: an optional integer specifying the maximum number of resources with the given role and type allowed. + Negative values indicate that there is no maximum. + It defaults to -1. + It is possible to set this to 0 to indicate that resources of a given role/type are disallowed. + +Example: + +.. code:: json + + { + "type": "smtk::task::TaskNeedsResources", + "title": "Load a geometric model (or models) and a simulation template.", + "resources": [ + { + "role": "model geometry", + "type": "smtk::model::Resource" + }, + { + "role": "simulation attribute", + "type": "smtk::attribute::Resource", + "max": 1 + } + ] + } diff --git a/doc/userguide/task/concepts.rst b/doc/userguide/task/concepts.rst new file mode 100644 index 0000000000..fad4e6378f --- /dev/null +++ b/doc/userguide/task/concepts.rst @@ -0,0 +1,39 @@ +Key Concepts +============ + +The graph of tasks (with dependencies as arcs) indicates what tasks a user may +work on, what tasks are incomplete, and what tasks cannot be performed because of +unmet dependencies. + +A task becomes active when its dependencies are met and the user +chooses to focus on the task. +An application can compute the set of tasks which users +are allowed to focus on (make active) by cutting the graph along arcs +that connect completed tasks to incomplete tasks. + +:smtk:`State ` + is an enumeration of the states a task may take on. + Tasks are unavailable until dependencies are met; then they are + incomplete until the task's condition is met; then they are + completable (but not completed) until the user marks the task + as complete. + +:smtk:`Task ` + instances have dependent tasks and a flag to store whether the user has + marked a given task as complete. + You may observe task state transitions. + You should subclass this to implement logic that determines whether + your task is unavailable, incomplete, or completable; the base class + is unavailable until its dependencies are met, at which time it + will transition straight to completable. + +:smtk:`Factory ` + is used to create instances of registered task classes. + Any plugins that provide new task subclasses should + register those classes with the factory in their registrar + (see :ref:`smtk-plugin-sys`). + +:smtk:`Manager ` + is an object applications can create to hold a task factory and + the set of tasks the factory has created. + It acts as a clearinghouse for information on task state transitions. diff --git a/doc/userguide/task/index.rst b/doc/userguide/task/index.rst new file mode 100644 index 0000000000..c4b9aaa2ae --- /dev/null +++ b/doc/userguide/task/index.rst @@ -0,0 +1,15 @@ +.. _smtk-task-sys: + +-------------- +Workflow tasks +-------------- + +SMTK provides tools to guide users through the process of preparing a simulation description. +A workflow consists of a series of tasks that may have dependencies. +These tasks form a graph with dependencies as arcs. + +.. toctree:: + :maxdepth: 3 + + concepts.rst + classes.rst diff --git a/smtk/CMakeLists.txt b/smtk/CMakeLists.txt index 8508992b8f..81e31d9877 100644 --- a/smtk/CMakeLists.txt +++ b/smtk/CMakeLists.txt @@ -33,6 +33,9 @@ smtk_source_group(model) add_subdirectory(simulation) smtk_source_group(simulation) +add_subdirectory(task) +smtk_source_group(task) + add_subdirectory(io) smtk_source_group(io) @@ -59,6 +62,7 @@ set(smtk_headers ${workflowHeaders} ${pluginHeaders} ${simulationHeaders} + ${taskHeaders} ${ioHeaders} ) set(smtk_srcs @@ -75,6 +79,7 @@ set(smtk_srcs ${workflowSrcs} ${pluginSrcs} ${simulationSrcs} + ${taskSrcs} ${ioSrcs} ) diff --git a/smtk/pybind11/__init__.py.in b/smtk/pybind11/__init__.py.in index 1149716635..2769a99ad8 100644 --- a/smtk/pybind11/__init__.py.in +++ b/smtk/pybind11/__init__.py.in @@ -18,7 +18,7 @@ import site import sys __all__ = ('common', 'attribute', 'extension', 'model', - 'mesh', 'io', 'project', 'session', 'simulation') + 'mesh', 'io', 'project', 'session', 'simulation', 'task') def _windows_dll_path(): diff --git a/smtk/task/CMakeLists.txt b/smtk/task/CMakeLists.txt new file mode 100644 index 0000000000..f8db573d6a --- /dev/null +++ b/smtk/task/CMakeLists.txt @@ -0,0 +1,30 @@ +set(taskSrcs + Manager.cxx + Registrar.cxx + Task.cxx + TaskNeedsResources.cxx +) + +set(taskHeaders + Factory.h + Manager.h + Registrar.h + Task.h + TaskNeedsResources.h +) + +if (SMTK_ENABLE_PYTHON_WRAPPING) + add_subdirectory(pybind11) +endif() + +#install the headers +smtk_public_headers(smtkCore ${taskHeaders}) + +if (SMTK_ENABLE_PARAVIEW_SUPPORT) + set_property(GLOBAL APPEND + PROPERTY _smtk_plugin_files "${CMAKE_CURRENT_SOURCE_DIR}/plugin/paraview.plugin") +endif() + +if (SMTK_ENABLE_TESTING) + add_subdirectory(testing) +endif() diff --git a/smtk/task/Factory.h b/smtk/task/Factory.h new file mode 100644 index 0000000000..f32e143490 --- /dev/null +++ b/smtk/task/Factory.h @@ -0,0 +1,85 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#ifndef smtk_task_Factory_h +#define smtk_task_Factory_h + +#include "smtk/task/Task.h" + +#include "smtk/common/Factory.h" +#include "smtk/common/TypeName.h" + +#include +#include +#include + +namespace smtk +{ +namespace task +{ + +using ParentFactory = smtk::common::Factory< + Task, + void, + smtk::common::factory::Inputs, + smtk::common::factory::Inputs< + Task::Configuration&, + smtk::task::Task::PassedDependencies, + smtk::common::Managers::Ptr>>; +/**\brief A factory for tasks that compose a workflow. + * + * A task factory creates tasks for use in workflows. + * + * To register a Task subclass, it must have a default constructor + * and constructors that take (1) configuration information, + * (2) references to dependencies and (3) managers. + * + * This class overrides the base-class create methods with + * versions that return shared pointers so that observers + * of the factory can be passed shared (rather than unique) + * pointers. + */ +class SMTKCORE_EXPORT Factory : public ParentFactory +{ +public: + using BaseType = smtk::task::Task; + + /// Create an instance of a Task. + /// + /// Unlike smtk::common::Factory, this returns a shared pointer. + template + std::shared_ptr create(Args&&... args) const + { + std::shared_ptr shared = + this->ParentFactory::createFromIndex(typeid(Type).hash_code(), std::forward(args)...); + return std::static_pointer_cast(shared); + } + + /// Create an instance of a Task using its type name. + /// + /// Unlike smtk::common::Factory, this returns a shared pointer. + template + std::shared_ptr createFromName(const std::string& typeName, Args&&... args) const + { + return this->ParentFactory::createFromName(typeName, std::forward(args)...); + } + + /// Create an instance of a Task using its type name. + /// + /// Unlike smtk::common::Factory, this returns a shared pointer. + template + std::shared_ptr createFromIndex(const std::size_t& typeIndex, Args&&... args) const + { + return this->ParentFactory::createFromIndex(typeIndex, std::forward(args)...); + } +}; +} // namespace task +} // namespace smtk + +#endif diff --git a/smtk/task/Manager.cxx b/smtk/task/Manager.cxx new file mode 100644 index 0000000000..1c760a8006 --- /dev/null +++ b/smtk/task/Manager.cxx @@ -0,0 +1,22 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#include "smtk/task/Manager.h" + +namespace smtk +{ +namespace task +{ + +Manager::Manager() = default; +Manager::~Manager() = default; + +} // namespace task +} // namespace smtk diff --git a/smtk/task/Manager.h b/smtk/task/Manager.h new file mode 100644 index 0000000000..a1f7520258 --- /dev/null +++ b/smtk/task/Manager.h @@ -0,0 +1,64 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#ifndef smtk_task_Manager_h +#define smtk_task_Manager_h + +#include "smtk/CoreExports.h" +#include "smtk/PublicPointerDefs.h" +#include "smtk/SharedFromThis.h" + +#include "smtk/common/Managers.h" +#include "smtk/common/TypeName.h" + +#include "smtk/task/Factory.h" + +#include +#include +#include +#include +#include + +namespace smtk +{ +namespace task +{ + +/// A task manager is responsible for creating new tasks. +/// +/// Eventually, the task manager will also hold an inventory +/// of created tasks and be a clearinghouse for task state transitions. +class SMTKCORE_EXPORT Manager : smtkEnableSharedPtr(Manager) +{ +public: + smtkTypeMacroBase(smtk::task::Manager); + smtkCreateMacro(smtk::task::Manager); + + virtual ~Manager(); + + /// Return a factory object used to register task types and create tasks. + Factory& taskFactory() { return m_taskFactory; } + const Factory& taskFactory() const { return m_taskFactory; } + + /// Return the managers instance that contains this manager, if it exists. + smtk::common::Managers::Ptr managers() const { return m_managers.lock(); } + void setManagers(const smtk::common::Managers::Ptr& managers) { m_managers = managers; } + +private: + Factory m_taskFactory; + std::weak_ptr m_managers; + +protected: + Manager(); +}; +} // namespace task +} // namespace smtk + +#endif // smtk_task_Manager_h diff --git a/smtk/task/Registrar.cxx b/smtk/task/Registrar.cxx new file mode 100644 index 0000000000..2597162305 --- /dev/null +++ b/smtk/task/Registrar.cxx @@ -0,0 +1,65 @@ +//============================================================================= +// +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +//============================================================================= +#include "smtk/task/Registrar.h" +#include "smtk/task/Task.h" +#include "smtk/task/TaskNeedsResources.h" + +#include "smtk/plugin/Manager.h" + +#include + +namespace smtk +{ +namespace task +{ + +using TaskList = std::tuple; + +void Registrar::registerTo(const smtk::common::Managers::Ptr& managers) +{ + if (managers->insert(smtk::task::Manager::create())) + { + managers->get()->setManagers(managers); + + smtk::plugin::Manager::instance()->registerPluginsTo(managers->get()); + } +} + +void Registrar::unregisterFrom(const smtk::common::Managers::Ptr& managers) +{ + managers->erase(); +} + +void Registrar::registerTo(const smtk::resource::Manager::Ptr& resourceManager) +{ + (void)resourceManager; +} + +void Registrar::unregisterFrom(const smtk::resource::Manager::Ptr& resourceManager) +{ + (void)resourceManager; +} + +void Registrar::registerTo(const smtk::task::Manager::Ptr& taskManager) +{ + auto& factory = taskManager->taskFactory(); + factory.registerTypes(); +} + +void Registrar::unregisterFrom(const smtk::task::Manager::Ptr& taskManager) +{ + auto& factory = taskManager->taskFactory(); + factory.unregisterTypes(); +} + +} // namespace task +} // namespace smtk diff --git a/smtk/task/Registrar.h b/smtk/task/Registrar.h new file mode 100644 index 0000000000..31b18dcffd --- /dev/null +++ b/smtk/task/Registrar.h @@ -0,0 +1,41 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#ifndef smtk_task_Registrar_h +#define smtk_task_Registrar_h + +#include "smtk/CoreExports.h" + +#include "smtk/common/Managers.h" +#include "smtk/resource/Manager.h" +#include "smtk/resource/Registrar.h" +#include "smtk/task/Manager.h" + +namespace smtk +{ +namespace task +{ +class SMTKCORE_EXPORT Registrar +{ +public: + using Dependencies = std::tuple; + + static void registerTo(const smtk::common::Managers::Ptr&); + static void unregisterFrom(const smtk::common::Managers::Ptr&); + + static void registerTo(const smtk::resource::Manager::Ptr&); + static void unregisterFrom(const smtk::resource::Manager::Ptr&); + + static void registerTo(const smtk::task::Manager::Ptr&); + static void unregisterFrom(const smtk::task::Manager::Ptr&); +}; +} // namespace task +} // namespace smtk + +#endif // smtk_task_Registrar_h diff --git a/smtk/task/State.h b/smtk/task/State.h new file mode 100644 index 0000000000..182b373bbb --- /dev/null +++ b/smtk/task/State.h @@ -0,0 +1,81 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#ifndef smtk_task_State_h +#define smtk_task_State_h + +#include "smtk/CoreExports.h" +#include "smtk/SharedFromThis.h" + +#include +#include +#include +#include +#include + +namespace smtk +{ +namespace task +{ + +/// The set of states that a task may take on. +enum class State +{ + Unavailable, //!< The task's dependencies are unmet. + Incomplete, //!< The task is available but its objective is not accomplished. + Completable, //!< The task is available and accomplished but has not been marked complete. + Completed //!< The task has been marked completed by the user. +}; + +/// A type-conversion operation to cast enumerants to strings. +inline std::string stateName(const State& s) +{ + static std::array names{ + { "unavailable", "incomplete", "completable", "completed" } + }; + return names[static_cast(s)]; +} + +/// A type-conversion operation to cast strings to enumerants. +inline State stateEnum(const std::string& s) +{ + std::string stateName(s); + std::transform(stateName.begin(), stateName.end(), stateName.begin(), [](unsigned char c) { + return std::tolower(c); + }); + if (stateName.substr(0, 7) == "state::") + { + stateName = stateName.substr(7); + } + if (stateName == "incomplete") + { + return State::Incomplete; + } + if (stateName == "completable") + { + return State::Completable; + } + if (stateName == "completed") + { + return State::Completed; + } + return State::Unavailable; +} + +/// States may be appended to streams. +inline std::ostream& operator<<(std::ostream& os, const State& s) +{ + os << stateName(s); + return os; +} + +} // namespace task +} // namespace smtk + +#endif // smtk_task_State_h diff --git a/smtk/task/Task.cxx b/smtk/task/Task.cxx new file mode 100644 index 0000000000..d710b9bade --- /dev/null +++ b/smtk/task/Task.cxx @@ -0,0 +1,253 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#include "smtk/task/Task.h" + +#include + +namespace smtk +{ +namespace task +{ + +Task::Task() = default; + +Task::Task(const Configuration& config, const std::shared_ptr& managers) +{ + (void)managers; + this->configure(config); +} + +Task::Task( + const Configuration& config, + const PassedDependencies& dependencies, + const std::shared_ptr& managers) +{ + (void)managers; + this->configure(config); + for (const auto& dependency : dependencies) + { + m_dependencies.insert(std::make_pair( + (const std::weak_ptr)(dependency), + dependency->observers().insert([this](Task& dependency, State prev, State next) { + bool didChange = this->updateState(dependency, prev, next); + (void)didChange; + }))); + } +} + +void Task::configure(const Configuration& config) +{ + if (!config.is_object()) + { + throw std::logic_error("Invalid configuration passed to Task constructor."); + } + if (config.contains("title")) + { + m_title = config.at("title").get(); + } + if (config.contains("completed")) + { + m_completed = config.at("completed").get(); + } +} + +void Task::setTitle(const std::string& title) +{ + m_title = title; +} + +State Task::state() const +{ + State s = m_internalState; + for (const auto& dd : m_dependencies) + { + const auto& dependency(dd.first.lock()); + switch (dependency->state()) + { + case State::Unavailable: + case State::Incomplete: + s = State::Unavailable; + break; + case State::Completable: + case State::Completed: + break; + } + if (s == State::Unavailable) + { + break; + } + } + if (s == State::Completable && m_completed) + { + s = State::Completed; + } + return s; +} + +bool Task::markCompleted(bool completed) +{ + switch (this->state()) + { + case State::Unavailable: // fall through + case State::Incomplete: + return false; + case State::Completable: + if (!completed) + { + return false; + } + this->changeState(State::Completable, State::Completed); + break; + case State::Completed: + if (completed) + { + return false; + } + this->changeState(State::Completed, State::Completable); + } + return true; +} + +Task::PassedDependencies Task::dependencies() const +{ + PassedDependencies result; + for (const auto& dependency : m_dependencies) + { + if (auto task = dependency.first.lock()) + { + result.insert(task); + } + } + return result; +} + +bool Task::addDependency(const std::shared_ptr& dependency) +{ + if (!dependency) + { + return false; + } + auto it = m_dependencies.find(dependency); + if (it != m_dependencies.end()) + { + return false; + } + State prev = this->state(); + m_dependencies.insert(std::make_pair( + (const std::weak_ptr)(dependency), + dependency->observers().insert([this](Task& dependency, State prev, State next) { + bool didChange = this->updateState(dependency, prev, next); + (void)didChange; + }))); + // Now determine if this dependency changed the state. + State next = this->state(); + if (prev != next) + { + bool didChange = this->changeState(prev, next); + (void)didChange; + } + return true; +} + +bool Task::removeDependency(const std::shared_ptr& dependency) +{ + State prev = this->state(); + bool didRemove = m_dependencies.erase(dependency) > 0; + if (didRemove) + { + State next = this->state(); + if (prev != next) + { + this->changeState(prev, next); + } + return true; + } + return false; +} + +bool Task::changeState(State previous, State next) +{ + if (previous == next) + { + return false; + } + m_completed = next == State::Completed; + m_observers(*this, previous, next); + return true; +} + +bool Task::updateState(Task& dependency, State prev, State next) +{ + // If a dependent task becomes blocking or non-blocking, + // check other tasks and see if we should change our state + bool dependencyNowUnblocked = (prev < State::Completable && next > State::Incomplete); + bool dependencyNowBlocking = (prev > State::Incomplete && next < State::Completable); + + // No significant change to our dependency. + if (!dependencyNowUnblocked && !dependencyNowBlocking) + { + return false; + } + + if (dependencyNowUnblocked && dependencyNowBlocking) + { + throw std::logic_error("Impossible state."); + } + + bool remainingDepsUnblocked = true; + for (const auto& entry : m_dependencies) + { + if (auto remainingDep = entry.first.lock()) + { + if (remainingDep.get() == &dependency) + { + continue; + } + remainingDepsUnblocked &= remainingDep->state() > State::Incomplete; + } + } + if (!remainingDepsUnblocked) + { + // The dependent task would have caused a change, but other dependencies + // keep us in our current state. + return false; + } + if (dependencyNowUnblocked) + { + // All other tasks are also unblocked, we changed from Unavailable to Completable or Complete. + this->changeState(State::Unavailable, m_completed ? State::Completed : State::Completable); + } + else if (dependencyNowBlocking) + { + // All other tasks are also unblocked, we changed from Completable or Complete to Unavailable. + this->changeState(m_completed ? State::Completed : State::Completable, State::Unavailable); + } + return true; +} + +bool Task::internalStateChanged(State next) +{ + if (m_internalState == next) + { + return false; + } + State previousFinalState = this->state(); + m_internalState = next; + State nextFinalState = this->state(); + if (previousFinalState != nextFinalState) + { + this->changeState(previousFinalState, nextFinalState); + return true; + } + return false; +} + +} // namespace task +} // namespace smtk diff --git a/smtk/task/Task.h b/smtk/task/Task.h new file mode 100644 index 0000000000..5f31dd6ad7 --- /dev/null +++ b/smtk/task/Task.h @@ -0,0 +1,252 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#ifndef smtk_task_Task_h +#define smtk_task_Task_h + +#include "smtk/CoreExports.h" +#include "smtk/SharedFromThis.h" +#include "smtk/SystemConfig.h" +#include "smtk/common/Managers.h" +#include "smtk/common/Observers.h" +#include "smtk/task/State.h" + +#include "nlohmann/json.hpp" + +#include +#include +#include +#include + +namespace smtk +{ +namespace task +{ + +/**\brief Task is a base class for all SMTK tasks. + * + * SMTK tasks are nodes in a graph whose arcs connect them to dependencies. + * The state of each task and its dependencies determine the set of available + * (or reachable) tasks. + * An application's user interface typically gets reconfigured when the active + * task changes to help direct users through a workflow, although tasks should + * not attempt to modify the user interface themselves. Instead, tasks should + * be solely focused on determining whether conditions are met for them to be + * (a) accessible to users and (b) marked completed by users. + * Once the first set of conditions is met, users are allowed to undertake the + * task. Once the second set of conditions is met, users are allowed to mark + * the task complete and thus gain access to those tasks which depend on it. + * + * Subclasses of Task are responsible for monitoring the application's state; + * the base class provides no methods to aid in this other than access to the + * application's managers at construction. + * Once the subclass has determined conditions are met, it should call + * the `internalStateChanged()` method. + * The base class will determine if this results in a state transition or not + * (based on dependencies blocking the change) and notify observers as needed. + */ +class SMTKCORE_EXPORT Task : smtkEnableSharedPtr(Task) +{ +public: + smtkTypeMacroBase(smtk::task::Task); + smtkCreateMacro(smtk::task::Task); + + /// A task's state changes may be observed. + using Observer = std::function; + /// The collection of all observers of this task instance. + using Observers = smtk::common::Observers; + /// A task's dependencies are other tasks stored as weak pointers. + using Dependencies = std::map>; + /// A task's dependencies are other tasks passed as shared pointers. + using PassedDependencies = std::set; + /// Tasks are configured with arbitrary JSON objects, though this may change. + using Configuration = nlohmann::json; + + Task(); + Task( + const Configuration& config, + const std::shared_ptr& managers = nullptr); + Task( + const Configuration& config, + const PassedDependencies& dependencies, + const std::shared_ptr& managers = nullptr); + + virtual ~Task() = default; + + /// A method called by all constructors passed Configuration information. + /// + /// In general, this method should set member variables directly + /// instead of calling set/get methods since those may invoke observers + /// with an uninitialized object. + /// + /// Depedendencies (if they were provided) will already have been added + /// when this method is called. + void configure(const Configuration& config); + + /// Return the title of the task (if one was provided). + const std::string& title() const { return m_title; } + + /// Set the title of the task to be presented to users. + /// This is not intended to be a unique identifier. + void setTitle(const std::string& title); + + /// Get the state. + /// + /// This state is a composition of \a m_internalState – updated by subclasses as + /// needed – and the state of any dependencies. + /// Because \a m_internalState is initialized to State::Completable, + /// the default behavior is to become Completable once all dependencies are met + /// (i.e., Completable or Completed) and Completed only if dependencies are met + /// **and** markCompleted(true) has been called. + /// Thus, the implementation in this base class will never return Incomplete. + /// If a subclass marks the internal state as Incomplete, then this method may + /// return Incomplete. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + ///
State "truth table" given internal and dependency states
Dependencies/
Internal
UnavailableIncomplete CompletableCompleted
User has not marked task completed
Unavailable UnavailableUnavailableUnavailableUnavailable
Incomplete Unavailable IncompleteIncomplete Incomplete
Completable Unavailable IncompleteCompletableCompletable
User has marked task completed
Unavailable UnavailableUnavailableUnavailableUnavailable
Incomplete Unavailable IncompleteIncomplete Incomplete
Completable Unavailable IncompleteCompletableCompleted
+ /// + /// Note that the internal state does not include State::Completed; only the user may mark a task + /// completed and the base class implements a method to handle user input. + /// A subclass that wishes to autocomplete might invoke the base-class method although this could + /// frustrate users. + virtual State state() const; + + /// This public method allows user-interface components to indicate + /// when the user marks a task complete (or unmarks it). + /// + /// This method has no effect and returns false if the task's current state + /// is unavailable or incomplete. + /// Returns true if the task's current state changes (from Completable to Completed + /// if \a completed is true or Completed to Completable if \a completed is false). + /// If true is returned, this method invoked its observers. + /// + /// Be aware that if this task transitions from State::Completed + /// to State::Incomplete or State::Unavailable, `m_completed` + /// will be reset to false and this method must be invoked again. + bool markCompleted(bool completed); + + /// Return the tasks which this task depends upon. + /// WARNING: The returned set is read-only (modifying it does not modify + /// this Task); however, modifying tasks in the returned set can affect + /// this Task's state. + PassedDependencies dependencies() const; + + /// Add a dependency. + /// + /// Returns true if the \a dependency was added, false if it already existed or is null. + /// This method will invoke observers if adding the dependency changes this task's state. + bool addDependency(const std::shared_ptr& dependency); + + /// Add a container of task-pointers as dependencies. + /// + /// Returns true if all \a dependencies were added, false if any already existed or were null. + /// This method will invoke observers if adding the dependencies changes this task's state. + template + bool addDependencies(const Container& tasks); + + /// Remove a dependency. + /// + /// Returns true if the \a dependency was removed, false if not. + /// This method will invoke observers if removing the dependency changes this task's state. + bool removeDependency(const std::shared_ptr& dependency); + + /// Remove a container of task-pointers as dependencies. + /// + /// Returns true if all \a dependencies were removed, false otherwise. + /// This method will invoke observers if removing the dependencies changes this task's state. + template + bool removeDependencies(const Container& tasks); + + /// Return this object's observers so other classes may insert themselves. + Observers& observers() { return m_observers; } + + /// Return the internal state of the task. + /// + /// This should not generally be used; instead, call `state()`. + /// This state does not include dependencies or user-completion; + /// it only reports whether the application has met conditions + /// inherent for the task itself. + State internalState() const { return m_internalState; } + +protected: + /// Indicate the state has changed. + /// This method invokes observers if and only if \a previous and \a next are different. + /// It will also update m_completed to match the new state. + /// + /// It returns false if \a previous == \a next and true otherwise. + bool changeState(State previous, State next); + + /// Update our state because a dependent task has changed state or + /// a subclass has marked the internal state as changed. + /// + /// Returns true if this task's state changed and false otherwise. + /// This method will invoke observers if it returns true. + virtual bool updateState(Task& dependency, State prev, State next); + + /// Update the internal state, possibly transitioning the task's final state. + /// + /// This method returns true if the task's final state changed and + /// false otherwise. + /// If true is returned, observers have been invoked. + bool internalStateChanged(State next); + + /// A task name to present to the user. + std::string m_title; + /// Whether the user has marked the task completed or not. + bool m_completed = false; + /// A set of dependent tasks and the keys used to observe their + /// state so that this task can update its state in response. + std::map> m_dependencies; + /// The set of observers of *this* task's state. + Observers m_observers; + +private: + /// The internal state of the task as provided by subclasses. + /// This is private so subclasses cannot alter it directly; + /// instead they should invoke `internalStateChanged()` so that + /// the Task's final state can be updated and observers invoked. + State m_internalState = State::Completable; +}; + +template +bool Task::addDependencies(const Container& tasks) +{ + bool addedAll = true; + for (const auto& task : tasks) + { + addedAll &= this->addDependency(task); + } + return addedAll; +} + +template +bool Task::removeDependencies(const Container& tasks) +{ + bool removedAll = true; + for (const auto& task : tasks) + { + removedAll &= this->removeDependency(task); + } + return removedAll; +} + +} // namespace task +} // namespace smtk + +#endif // smtk_task_Task_h diff --git a/smtk/task/TaskNeedsResources.cxx b/smtk/task/TaskNeedsResources.cxx new file mode 100644 index 0000000000..2ea5e98e11 --- /dev/null +++ b/smtk/task/TaskNeedsResources.cxx @@ -0,0 +1,208 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#include "smtk/task/TaskNeedsResources.h" + +#include "smtk/operation/Manager.h" +#include "smtk/operation/SpecificationOps.h" +#include "smtk/project/ResourceContainer.h" + +#include + +namespace smtk +{ +namespace task +{ + +void to_json(json& j, const TaskNeedsResources::Predicate& p) +{ + j = json{ { "role", p.m_role }, { "type", p.m_type } }; + if (p.m_minimumCount == 0 && p.m_maximumCount < 0) + { + // skip counts; any number of resources are allowed. + } + else + { + j["min"] = p.m_minimumCount; + j["max"] = p.m_maximumCount; + } + if (p.m_validator) + { + j["validator"] = "Cannot serialize validators yet."; + } +} + +void from_json(const json& j, TaskNeedsResources::Predicate& p) +{ + if (j.contains("role")) + { + j.at("role").get_to(p.m_role); + } + if (j.contains("type")) + { + j.at("type").get_to(p.m_type); + } + if (j.contains("min")) + { + j.at("min").get_to(p.m_minimumCount); + } + else + { + p.m_minimumCount = 1; + } + if (j.contains("max")) + { + j.at("max").get_to(p.m_maximumCount); + } + else + { + p.m_maximumCount = -1; + } + if (j.contains("validator")) + { + throw std::logic_error("todo"); // TODO + } + else + { + // Accept any resource + p.m_validator = nullptr; + /* + [](const smtk::resource::Resource&, const TaskNeedsResource::Predicate&) + { return true; }; + */ + } +} + +TaskNeedsResources::TaskNeedsResources() {} + +TaskNeedsResources::TaskNeedsResources( + const Configuration& config, + const smtk::common::Managers::Ptr& managers) + : Task(config, managers) + , m_managers(managers) +{ + this->configure(config); +} + +TaskNeedsResources::TaskNeedsResources( + const Configuration& config, + const PassedDependencies& dependencies, + const smtk::common::Managers::Ptr& managers) + : Task(config, dependencies, managers) + , m_managers(managers) +{ + this->configure(config); +} + +void TaskNeedsResources::configure(const Configuration& config) +{ + if (config.contains("resources")) + { + auto rsrcSpecs = config.at("resources"); + if (rsrcSpecs.is_array()) + { + for (const auto& spec : rsrcSpecs) + { + if (!spec.contains("role")) + { + continue; + } + + Predicate predicate; + spec.get_to(predicate); + m_resourcesByRole[predicate.m_role] = spec.get(); + } + } + } + if (m_managers) + { + if (auto resourceManager = m_managers->get()) + { + m_observer = resourceManager->observers().insert( + [this](const smtk::resource::Resource& resource, smtk::resource::EventType event) { + this->updateResources(const_cast(resource), event); + }, + /* priority */ 0, + /* initialize */ true, + "TaskNeedsResources monitors results for resources and their roles."); + } + } + if (!m_resourcesByRole.empty()) + { + this->internalStateChanged(this->computeInternalState()); + } +} + +void TaskNeedsResources::updateResources( + smtk::resource::Resource& resource, + smtk::resource::EventType event) +{ + bool predicatesUpdated = false; + auto resourcePtr = resource.shared_from_this(); + switch (event) + { + case smtk::resource::EventType::ADDED: + { + // Add the resource to the appropriate entry: + std::string role = smtk::project::detail::role(resourcePtr); + auto it = m_resourcesByRole.find(role); + if (it != m_resourcesByRole.end()) + { + if (!it->second.m_validator || it->second.m_validator(resource, it->second)) + { + it->second.m_resources.insert(resourcePtr); + predicatesUpdated = true; + } + } + } + break; + case smtk::resource::EventType::REMOVED: + { + // Remove the resource from the appropriate entry. + std::string role = smtk::project::detail::role(resourcePtr); + auto it = m_resourcesByRole.find(role); + if (it != m_resourcesByRole.end()) + { + predicatesUpdated = it->second.m_resources.erase(resourcePtr) > 0; + } + } + break; + case smtk::resource::EventType::MODIFIED: + // TODO + break; + } + if (predicatesUpdated) + { + this->internalStateChanged(this->computeInternalState()); + } +} + +State TaskNeedsResources::computeInternalState() const +{ + State s = State::Completable; + for (const auto& entry : m_resourcesByRole) + { + const auto& predicate(entry.second); + if (predicate.m_resources.size() < static_cast(predicate.m_minimumCount)) + { + s = State::Incomplete; + } + else if ( + predicate.m_maximumCount >= 0 && + predicate.m_resources.size() > static_cast(predicate.m_maximumCount)) + { + s = State::Incomplete; + } + } + return s; +} + +} // namespace task +} // namespace smtk diff --git a/smtk/task/TaskNeedsResources.h b/smtk/task/TaskNeedsResources.h new file mode 100644 index 0000000000..65f8056cc1 --- /dev/null +++ b/smtk/task/TaskNeedsResources.h @@ -0,0 +1,87 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#ifndef smtk_task_TaskNeedsResources_h +#define smtk_task_TaskNeedsResources_h + +#include "smtk/resource/Manager.h" +#include "smtk/resource/Observer.h" +#include "smtk/resource/Resource.h" +#include "smtk/task/Task.h" + +namespace smtk +{ +namespace task +{ + +/**\brief TaskNeedsResources is a task that requires resources from a resource manager. + * + * Tasks of this type observe a resource manager for resources to be added and marked + * with a Role as specified (at construction time). When all the required resources + * are present with the required roles, then the task becomes completable. + */ +class SMTKCORE_EXPORT TaskNeedsResources : public Task +{ +public: + smtkTypeMacro(smtk::task::TaskNeedsResources); + smtkSuperclassMacro(smtk::task::Task); + smtkCreateMacro(smtk::task::Task); + + /// A predicate used to collect resources that fit a given role. + struct Predicate + { + using Entry = std::weak_ptr; + /// The required role. If empty, any role is allowed. + std::string m_role; + /// The minimum number of resources that must be collected to satisfy the requirement. + /// + /// If 0, then resources selected by the validator are not required (but *may* be accepted). + unsigned int m_minimumCount; + /// The maximum number of resources that can be collected while still satisfying the requirement. + /// + /// Note that if 0, the predicate is forcing the task to reject all resources + /// that the validator selects (i.e., no resources of the given type are allowed). + /// If negative, then there is no maximum number of validated resources. + int m_maximumCount; + /// The resource typename regex; typically just a resource typename. + std::string m_type; + /// A lambda used to determine whether the given resource is acceptable. + std::function m_validator; + /// The set of resources being managed that are selected by the validator. + std::set> m_resources; + }; + + TaskNeedsResources(); + TaskNeedsResources( + const Configuration& config, + const smtk::common::Managers::Ptr& managers = nullptr); + TaskNeedsResources( + const Configuration& config, + const PassedDependencies& dependencies, + const smtk::common::Managers::Ptr& managers = nullptr); + + virtual ~TaskNeedsResources() = default; + + void configure(const Configuration& config); + +protected: + /// Respond to resource changes that may change task state. + void updateResources(smtk::resource::Resource& resource, smtk::resource::EventType event); + + /// Check m_resourcesByRole to see if all requirements are met. + State computeInternalState() const; + + smtk::common::Managers::Ptr m_managers; + smtk::resource::Observers::Key m_observer; + std::map m_resourcesByRole; +}; +} // namespace task +} // namespace smtk + +#endif // smtk_task_TaskNeedsResources_h diff --git a/smtk/task/plugin/CMakeLists.txt b/smtk/task/plugin/CMakeLists.txt new file mode 100644 index 0000000000..2579d1a698 --- /dev/null +++ b/smtk/task/plugin/CMakeLists.txt @@ -0,0 +1,7 @@ +smtk_add_plugin(smtkTaskPlugin + REGISTRAR smtk::task::Registrar + MANAGERS smtk::common::Managers + smtk::task::Manager + PARAVIEW_PLUGIN_ARGS + VERSION 1.0 +) diff --git a/smtk/task/plugin/paraview.plugin b/smtk/task/plugin/paraview.plugin new file mode 100644 index 0000000000..df07972f9c --- /dev/null +++ b/smtk/task/plugin/paraview.plugin @@ -0,0 +1,4 @@ +NAME + smtkTaskPlugin +DESCRIPTION + SMTK task plugin for ParaView diff --git a/smtk/task/pybind11/CMakeLists.txt b/smtk/task/pybind11/CMakeLists.txt new file mode 100644 index 0000000000..2075b7054c --- /dev/null +++ b/smtk/task/pybind11/CMakeLists.txt @@ -0,0 +1,30 @@ +set(library_name "_smtkPybindTask") +set(module_path "task") +set(build_path "${CMAKE_BINARY_DIR}/${SMTK_PYTHON_MODULEDIR}/smtk/${module_path}") +set(install_path "${SMTK_PYTHON_MODULEDIR}/smtk/${module_path}") + +pybind11_add_module(${library_name} PybindTask.cxx) +target_include_directories(${library_name} PUBLIC + $ +) +target_link_libraries(${library_name} LINK_PUBLIC smtkCore) +set_target_properties(${library_name} + PROPERTIES + CXX_VISIBILITY_PRESET hidden + COMPILE_FLAGS ${SMTK_PYBIND11_FLAGS} + LIBRARY_OUTPUT_DIRECTORY "${build_path}" +) + +# Install library +install(TARGETS ${library_name} DESTINATION "${install_path}") + +# Create and install module __init__.py +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/__init__.py" + "${build_path}/__init__.py" @ONLY +) + +install( + FILES "${build_path}/__init__.py" + DESTINATION "${install_path}" +) diff --git a/smtk/task/pybind11/PybindFactory.h b/smtk/task/pybind11/PybindFactory.h new file mode 100644 index 0000000000..ead11b88d4 --- /dev/null +++ b/smtk/task/pybind11/PybindFactory.h @@ -0,0 +1,58 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#ifndef pybind_smtk_task_Factory_h +#define pybind_smtk_task_Factory_h + +#include + +#include "smtk/task/Factory.h" + +namespace py = pybind11; + +inline py::class_< + smtk::task::Factory + // , smtk::common::Factory< + // smtk::task::Task, + // void, + // std::tuple >, + // std::tuple>, std::shared_ptr > + // > +> pybind11_init_smtk_task_Factory(py::module &m) +{ + py::class_< + smtk::task::Factory + // , smtk::common::Factory< + // smtk::task::Task, + // void, + // std::tuple >, + // std::tuple>, std::shared_ptr > + // > + > instance(m, "Factory"); + instance + .def(py::init<>()) + .def(py::init<::smtk::task::Factory const &>()) + .def("deepcopy", (smtk::task::Factory & (smtk::task::Factory::*)(::smtk::task::Factory const &)) &smtk::task::Factory::operator=) + .def("createFromName", [](const smtk::task::Factory& factory, const std::string& name) { + std::shared_ptr object(factory.createFromName(name)); + return object; + }) + /* + .def("createFromName", [](const smtk::task::Factory& factory, const std::string& name, const std::string& json, const std::shared_ptr& managers) { + smtk::task::Task::Configuration config(json); + std::shared_ptr object = factory.createFromName(name, config, managers); + return object; + }) + */ + ; + return instance; +} + +#endif diff --git a/smtk/task/pybind11/PybindManager.h b/smtk/task/pybind11/PybindManager.h new file mode 100644 index 0000000000..15c0b9c9c8 --- /dev/null +++ b/smtk/task/pybind11/PybindManager.h @@ -0,0 +1,40 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#ifndef pybind_smtk_task_Manager_h +#define pybind_smtk_task_Manager_h + +#include + +#include "smtk/task/Manager.h" + +#include "smtk/task/Factory.h" + +namespace py = pybind11; + +inline PySharedPtrClass< smtk::task::Manager > pybind11_init_smtk_task_Manager(py::module &m) +{ + PySharedPtrClass< smtk::task::Manager > instance(m, "Manager"); + instance + .def(py::init<::smtk::task::Manager const &>()) + .def("deepcopy", (smtk::task::Manager & (smtk::task::Manager::*)(::smtk::task::Manager const &)) &smtk::task::Manager::operator=) + .def_static("create", (std::shared_ptr (*)()) &smtk::task::Manager::create) + .def_static("create", (std::shared_ptr (*)(::std::shared_ptr &)) &smtk::task::Manager::create, py::arg("ref")) + .def("managers", &smtk::task::Manager::managers) + .def("setManagers", &smtk::task::Manager::setManagers, py::arg("managers")) + .def("taskFactory", (smtk::task::Factory & (smtk::task::Manager::*)()) &smtk::task::Manager::taskFactory) + .def("taskFactory", (smtk::task::Factory const & (smtk::task::Manager::*)() const) &smtk::task::Manager::taskFactory) + .def("typeName", &smtk::task::Manager::typeName) + .def_readonly_static("type_name", &smtk::task::Manager::type_name) + ; + return instance; +} + +#endif diff --git a/smtk/task/pybind11/PybindRegistrar.h b/smtk/task/pybind11/PybindRegistrar.h new file mode 100644 index 0000000000..d7503d2624 --- /dev/null +++ b/smtk/task/pybind11/PybindRegistrar.h @@ -0,0 +1,37 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#ifndef pybind_smtk_task_Registrar_h +#define pybind_smtk_task_Registrar_h + +#include + +#include "smtk/task/Registrar.h" + +namespace py = pybind11; + +inline py::class_< smtk::task::Registrar > pybind11_init_smtk_task_Registrar(py::module &m) +{ + py::class_< smtk::task::Registrar > instance(m, "Registrar"); + instance + .def(py::init<>()) + .def(py::init<::smtk::task::Registrar const &>()) + .def("deepcopy", (smtk::task::Registrar & (smtk::task::Registrar::*)(::smtk::task::Registrar const &)) &smtk::task::Registrar::operator=) + .def_static("registerTo", (void (*)(::smtk::common::Managers::Ptr const &)) &smtk::task::Registrar::registerTo, py::arg("arg0")) + .def_static("registerTo", (void (*)(::smtk::resource::Manager::Ptr const &)) &smtk::task::Registrar::registerTo, py::arg("arg0")) + .def_static("registerTo", (void (*)(::smtk::task::Manager::Ptr const &)) &smtk::task::Registrar::registerTo, py::arg("arg0")) + .def_static("unregisterFrom", (void (*)(::smtk::common::Managers::Ptr const &)) &smtk::task::Registrar::unregisterFrom, py::arg("arg0")) + .def_static("unregisterFrom", (void (*)(::smtk::resource::Manager::Ptr const &)) &smtk::task::Registrar::unregisterFrom, py::arg("arg0")) + .def_static("unregisterFrom", (void (*)(::smtk::task::Manager::Ptr const &)) &smtk::task::Registrar::unregisterFrom, py::arg("arg0")) + ; + return instance; +} + +#endif diff --git a/smtk/task/pybind11/PybindState.h b/smtk/task/pybind11/PybindState.h new file mode 100644 index 0000000000..61a2bf020a --- /dev/null +++ b/smtk/task/pybind11/PybindState.h @@ -0,0 +1,40 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#ifndef pybind_smtk_task_State_h +#define pybind_smtk_task_State_h + +#include + +#include "smtk/task/State.h" + +namespace py = pybind11; + +inline void pybind11_init_smtk_task_State(py::module &m) +{ + py::enum_(m, "State") + .value("Unavailable", smtk::task::State::Unavailable) + .value("Incomplete", smtk::task::State::Incomplete) + .value("Completable", smtk::task::State::Completable) + .value("Completed", smtk::task::State::Completed) + .export_values(); +} + +inline void pybind11_init_smtk_task_stateName(py::module &m) +{ + m.def("stateName", &smtk::task::stateName, "", py::arg("s")); +} + +inline void pybind11_init_smtk_task_stateEnum(py::module &m) +{ + m.def("stateEnum", &smtk::task::stateEnum, "", py::arg("s")); +} + +#endif diff --git a/smtk/task/pybind11/PybindTask.cxx b/smtk/task/pybind11/PybindTask.cxx new file mode 100644 index 0000000000..0b5e9e5c55 --- /dev/null +++ b/smtk/task/pybind11/PybindTask.cxx @@ -0,0 +1,48 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#include +#include + +#include "nlohmann/json.hpp" + +namespace py = pybind11; + +template +using PySharedPtrClass = py::class_, Args...>; + +using namespace nlohmann; + +#include "PybindFactory.h" +#include "PybindTaskNeedsResources.h" +#include "PybindTask.h" +#include "PybindManager.h" +#include "PybindRegistrar.h" +#include "PybindState.h" + +PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr); + +PYBIND11_MODULE(task, m) +{ + m.doc() = "SMTK tasks are portions of a workflow."; + py::module smtk = m.def_submodule("smtk", ""); + py::module task = smtk.def_submodule("task", ""); + + // The order of these function calls is important! It was determined by + // comparing the dependencies of each of the wrapped objects. + auto smtk_task_Manager = pybind11_init_smtk_task_Manager(task); + auto smtk_task_Registrar = pybind11_init_smtk_task_Registrar(task); + auto smtk_task_Task = pybind11_init_smtk_task_Task(task); + pybind11_init_smtk_task_State(task); + pybind11_init_smtk_task_stateEnum(task); + pybind11_init_smtk_task_stateName(task); + auto smtk_task_TaskNeedsResources = pybind11_init_smtk_task_TaskNeedsResources(task); + auto smtk_task_Factory = pybind11_init_smtk_task_Factory(task); +} diff --git a/smtk/task/pybind11/PybindTask.h b/smtk/task/pybind11/PybindTask.h new file mode 100644 index 0000000000..95cf400b7f --- /dev/null +++ b/smtk/task/pybind11/PybindTask.h @@ -0,0 +1,47 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#ifndef pybind_smtk_task_Task_h +#define pybind_smtk_task_Task_h + +#include + +#include "smtk/task/Task.h" + +#include "smtk/task/State.h" + +namespace py = pybind11; + +inline PySharedPtrClass< smtk::task::Task > pybind11_init_smtk_task_Task(py::module &m) +{ + PySharedPtrClass< smtk::task::Task > instance(m, "Task"); + instance + .def(py::init<>()) + .def(py::init<::smtk::task::Task::Configuration const &, ::std::shared_ptr const &>()) + .def(py::init<::smtk::task::Task::Configuration const &, ::smtk::task::Task::PassedDependencies const &, ::std::shared_ptr const &>()) + .def("typeName", &smtk::task::Task::typeName) + .def_static("create", (std::shared_ptr (*)()) &smtk::task::Task::create) + .def_static("create", (std::shared_ptr (*)(::std::shared_ptr &)) &smtk::task::Task::create, py::arg("ref")) + .def("configure", &smtk::task::Task::configure, py::arg("config")) + .def("title", &smtk::task::Task::title) + .def("setTitle", &smtk::task::Task::setTitle, py::arg("title")) + .def("state", &smtk::task::Task::state) + .def("markCompleted", &smtk::task::Task::markCompleted, py::arg("completed")) + .def("dependencies", &smtk::task::Task::dependencies) + .def("addDependency", &smtk::task::Task::addDependency, py::arg("dependency")) + .def("removeDependency", &smtk::task::Task::removeDependency, py::arg("dependency")) + .def("observers", &smtk::task::Task::observers) + .def("internalState", &smtk::task::Task::internalState) + .def_readonly_static("type_name", &smtk::task::Task::type_name) + ; + return instance; +} + +#endif diff --git a/smtk/task/pybind11/PybindTaskNeedsResources.h b/smtk/task/pybind11/PybindTaskNeedsResources.h new file mode 100644 index 0000000000..2a76509d5e --- /dev/null +++ b/smtk/task/pybind11/PybindTaskNeedsResources.h @@ -0,0 +1,49 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#ifndef pybind_smtk_task_TaskNeedsResources_h +#define pybind_smtk_task_TaskNeedsResources_h + +#include + +#include "smtk/task/TaskNeedsResources.h" + +#include "smtk/task/Task.h" + +namespace py = pybind11; + +inline PySharedPtrClass< smtk::task::TaskNeedsResources, smtk::task::Task > pybind11_init_smtk_task_TaskNeedsResources(py::module &m) +{ + PySharedPtrClass< smtk::task::TaskNeedsResources, smtk::task::Task > instance(m, "TaskNeedsResources"); + instance + .def(py::init<>()) + .def(py::init<::smtk::task::Task::Configuration const &, ::smtk::common::Managers::Ptr const &>()) + .def(py::init<::smtk::task::Task::Configuration const &, ::smtk::task::Task::PassedDependencies const &, ::smtk::common::Managers::Ptr const &>()) + .def("configure", &smtk::task::TaskNeedsResources::configure, py::arg("config")) + .def_static("create", (std::shared_ptr (*)()) &smtk::task::TaskNeedsResources::create) + .def_static("create", (std::shared_ptr (*)(::std::shared_ptr &)) &smtk::task::TaskNeedsResources::create, py::arg("ref")) + .def("typeName", &smtk::task::TaskNeedsResources::typeName) + .def_readonly_static("type_name", &smtk::task::TaskNeedsResources::type_name) + ; + py::class_< smtk::task::TaskNeedsResources::Predicate >(instance, "Predicate") + .def(py::init<::smtk::task::TaskNeedsResources::Predicate const &>()) + .def(py::init<>()) + .def("deepcopy", (smtk::task::TaskNeedsResources::Predicate & (smtk::task::TaskNeedsResources::Predicate::*)(::smtk::task::TaskNeedsResources::Predicate const &)) &smtk::task::TaskNeedsResources::Predicate::operator=) + .def_readwrite("m_role", &smtk::task::TaskNeedsResources::Predicate::m_role) + .def_readwrite("m_minimumCount", &smtk::task::TaskNeedsResources::Predicate::m_minimumCount) + .def_readwrite("m_maximumCount", &smtk::task::TaskNeedsResources::Predicate::m_maximumCount) + .def_readwrite("m_type", &smtk::task::TaskNeedsResources::Predicate::m_type) + .def_readwrite("m_validator", &smtk::task::TaskNeedsResources::Predicate::m_validator) + .def_readwrite("m_resources", &smtk::task::TaskNeedsResources::Predicate::m_resources) + ; + return instance; +} + +#endif diff --git a/smtk/task/pybind11/__init__.py b/smtk/task/pybind11/__init__.py new file mode 100644 index 0000000000..197de08efb --- /dev/null +++ b/smtk/task/pybind11/__init__.py @@ -0,0 +1,13 @@ +# ============================================================================= +# +# Copyright (c) Kitware, Inc. +# All rights reserved. +# See LICENSE.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even +# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the above copyright notice for more information. +# +# ============================================================================= + +from ._smtkPybindTask import * diff --git a/smtk/task/testing/CMakeLists.txt b/smtk/task/testing/CMakeLists.txt new file mode 100644 index 0000000000..2941d367a3 --- /dev/null +++ b/smtk/task/testing/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(cxx) + +# if(SMTK_ENABLE_PYTHON_WRAPPING) +# add_subdirectory(python) +# endif() diff --git a/smtk/task/testing/cxx/CMakeLists.txt b/smtk/task/testing/cxx/CMakeLists.txt new file mode 100644 index 0000000000..95610e968a --- /dev/null +++ b/smtk/task/testing/cxx/CMakeLists.txt @@ -0,0 +1,11 @@ +set(unit_tests + TestTask +) + +find_package(Threads REQUIRED) + +smtk_unit_tests( + Label "task" + SOURCES ${unit_tests} + LIBRARIES smtkCore +) diff --git a/smtk/task/testing/cxx/TestTask.cxx b/smtk/task/testing/cxx/TestTask.cxx new file mode 100644 index 0000000000..b1125ffc26 --- /dev/null +++ b/smtk/task/testing/cxx/TestTask.cxx @@ -0,0 +1,242 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#include "smtk/attribute/Registrar.h" +#include "smtk/attribute/Resource.h" +#include "smtk/common/Managers.h" +#include "smtk/model/Registrar.h" +#include "smtk/model/Resource.h" +#include "smtk/operation/Manager.h" +#include "smtk/operation/Registrar.h" +#include "smtk/resource/Manager.h" +#include "smtk/resource/Registrar.h" +#include "smtk/task/Manager.h" +#include "smtk/task/Registrar.h" +#include "smtk/task/Task.h" +#include "smtk/task/TaskNeedsResources.h" + +#include "smtk/common/testing/cxx/helpers.h" + +namespace test_task +{ + +using namespace smtk::task; + +class UnavailableTask : public Task +{ +public: + smtkTypeMacro(test_task::UnavailableTask); + smtkCreateMacro(smtk::task::Task); + UnavailableTask() = default; + UnavailableTask( + const Configuration& config, + const smtk::common::Managers::Ptr& managers = nullptr) + : Task(config, managers) + { + } + UnavailableTask( + const Configuration& config, + const Task::PassedDependencies& deps, + const smtk::common::Managers::Ptr& managers = nullptr) + : Task(config, deps, managers) + { + } + State state() const override { return State::Unavailable; } +}; + +} // namespace test_task + +int TestTask(int, char*[]) +{ + using smtk::task::State; + using smtk::task::Task; + using test_task::UnavailableTask; + + // Create managers + auto managers = smtk::common::Managers::create(); + { + smtk::resource::Registrar::registerTo(managers); + smtk::attribute::Registrar::registerTo(managers); + smtk::operation::Registrar::registerTo(managers); + smtk::task::Registrar::registerTo(managers); + } + + auto resourceManager = managers->get(); + auto operationManager = managers->get(); + auto taskManager = managers->get(); + + { + smtk::attribute::Registrar::registerTo(resourceManager); + smtk::model::Registrar::registerTo(resourceManager); + smtk::task::Registrar::registerTo(taskManager); + } + + taskManager->taskFactory().registerType(); + smtk::task::Task::PassedDependencies empty; + + std::shared_ptr t1 = + taskManager->taskFactory().create(Task::Configuration{ { "title", "Task 1" } }, managers); + test(!!t1, "Expecting to create a non-null task."); + test(t1->state() == State::Completable, "Expected task without dependencies to be completable."); + + State from; + State to; + int called = 0; + auto callback = [&from, &to, &called](Task& task, State prev, State next) { + (void)task; + ++called; + from = prev; + to = next; + std::cout << " " << task.title() << " transitioned: " << prev << " ⟶ " << next << "\n"; + }; + auto okey = t1->observers().insert(callback); + + bool success = t1->markCompleted(true); + test(success, "Expected completion to be accepted."); + test(called == 1, "Expected observer to be invoked."); + test( + from == State::Completable && to == State::Completed, + "Expected state transition completable⟶completed."); + + called = 0; + success = t1->markCompleted(true); + test(!success, "Expected completion to be rejected on double-complete."); + test(called == 0, "Expected observer to be skipped on double-complete."); + + called = 0; + success = t1->markCompleted(false); + test(success, "Expected uncompletion to be accepted."); + test(called == 1, "Expected observer to be invoked."); + test( + from == State::Completed && to == State::Completable, + "Expected state transition completed⟶completable."); + + // Now add a dependent task that is unavailable. + std::shared_ptr t2 = taskManager->taskFactory().create( + Task::Configuration{ { "title", "Task 2" } }, managers); + called = 0; + success = t1->addDependency(t2); + test(success, "Expected to add dependency to task."); + test(called == 1, "Expected observer to be invoked upon dependency insertion."); + test( + from == State::Completable && to == State::Unavailable, + "Expected state transition completable⟶unavailable."); + success = t1->addDependency(t2); + test(!success, "Expected failure when adding redundant dependency to task."); + + // Test construction with dependencies + Task::Configuration c3{ { "title", "Task 3" }, { "completed", true } }; + auto t3 = taskManager->taskFactory().create( + c3, std::set>{ { t1, t2 } }, managers); + + // Test dependency removal and notification. + auto dokey = t3->observers().insert(callback); + called = 0; + success = t3->removeDependency(t2); + test(success, "Expected to remove dependency from Task 3."); + test(called == 0, "Did not expect state to change when removing first dependency."); + success = t1->removeDependency(t2); + test(success, "Expected to remove dependency from Task 1."); + test(called == 2, "Expected 2 tasks to change state."); + test( + from == State::Unavailable && to == State::Completed, + "Expected state transition unavailable⟶completed."); + success = t1->removeDependency(t2); + test(!success, "Expected removal of non-existent dependency to fail."); + + // Test TaskNeedsResources + // I. Construction w/ configuration. + // The task is incomplete unless 1 or 2 model geometry resources + // and 1 or more simulation attribute resources are held by the + // resource manager. + Task::Configuration c4{ + { "title", "Task 4" }, + { "resources", + { { { "role", "model geometry" }, { "type", "smtk::model::Resource" }, { "max", 2 } }, + { { "role", "simulation attribute" }, { "type", "smtk::attribute::Resource" } } } } + }; + auto t4 = taskManager->taskFactory().create(c4, managers); + test(!!t4, "Could not create TaskNeedsResources."); + test(t4->state() == State::Incomplete, "Task with no resources should be incomplete."); + auto hokey = t4->observers().insert(callback); + + // II. State transitions + called = 0; + bool didAdd; + // Add 3 resources. Addition of the last should cause transition. + auto model1 = smtk::model::Resource::create(); + model1->properties().get()["project_role"] = "model geometry"; + didAdd = resourceManager->add(model1); + test(didAdd, "Expected to add model1 resource."); + test(called == 0, "Did not expect state to change when adding first model."); + auto model2 = smtk::model::Resource::create(); + model2->properties().get()["project_role"] = "model geometry"; + didAdd = resourceManager->add(model2); + test(didAdd, "Expected to add model2 resource."); + test(called == 0, "Did not expect state to change when adding first model."); + auto attr1 = smtk::attribute::Resource::create(); + attr1->properties().get()["project_role"] = "simulation attribute"; + didAdd = resourceManager->add(attr1); + test(didAdd, "Expected to add attr1 resource."); + test(called == 1, "Expected state to change when required resources present."); + test( + from == State::Incomplete && to == State::Completable, + "Expected state transition incomplete⟶completable."); + + t4->markCompleted(true); // We'll test below that completion is reset. + test(called == 2, "Expected state to change when user marks completed."); + test( + from == State::Completable && to == State::Completed, + "Expected state transition completable⟶completed."); + + called = 0; + bool didRemove; + // Remove 2 resources. Removal of the last should cause a transition. + didRemove = resourceManager->remove(model1); + test(didRemove, "Expected to remove model1 resource."); + test(called == 0, "Did not expect state to change when removing model1."); + didRemove = resourceManager->remove(attr1); + test(didRemove, "Expected to remove attr1 resource."); + test(called == 1, "Expected state to change when removing attr1 model."); + test( + from == State::Completed && to == State::Incomplete, + "Expected state transition completed⟶incomplete."); + + // Test that user completion is reset by transitions "below" Completeable and back. + called = 0; + didAdd = resourceManager->add(attr1); + test(didAdd, "Expected to add attr1 resource."); + test(called == 1, "Expected state to change when required resources present."); + test( + from == State::Incomplete && to == State::Completable, + "Expected state transition incomplete⟶completable."); + + // III. Verify that an empty role is allowed, as are empty resource types. + // This should also test initialization of TaskNeedsResources when + // resource manager is not empty. + Task::Configuration c5{ { "title", "Task 5" }, + { "resources", + { { { "type", "smtk::model::Resource" } }, + { { "role", "simulation attribute" } } } } }; + auto t5 = + taskManager->taskFactory().createFromName("smtk::task::TaskNeedsResources", c5, managers); + test(!!t5, "Could not create TaskNeedsResources."); + auto pokey = t5->observers().insert(callback); + test(t5->state() == State::Completable, "Task 5 should be completable initially."); + called = 0; + didRemove = resourceManager->remove(attr1); + test(didRemove, "Expected to remove attr1 resource."); + // NB: called == 2 since both task 4 and 5 should transition: + test(called == 2, "Expected state to change when removing attr1 model."); + test( + from == State::Completable && to == State::Incomplete, + "Expected state transition completable⟶incomplete."); + + return 0; +} -- GitLab From 8c0c860695d9cabff154b91ec0bb4e3c99791a89 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 15 Jun 2021 02:58:49 -0400 Subject: [PATCH 070/136] Add smtk::common::Instances and use it to manage Tasks. --- doc/userguide/common/factory.rst | 31 ++- smtk/common/CMakeLists.txt | 2 + smtk/common/Instances.h | 202 ++++++++++++++++ smtk/common/Visit.h | 28 +++ smtk/task/CMakeLists.txt | 1 - smtk/task/Factory.h | 85 ------- smtk/task/Manager.h | 23 +- smtk/task/Registrar.cxx | 8 +- smtk/task/TaskNeedsResources.cxx | 6 +- smtk/task/pybind11/PybindFactory.h | 58 ----- smtk/task/pybind11/PybindManager.h | 8 +- smtk/task/pybind11/PybindTask.cxx | 2 - smtk/task/testing/cxx/TestTask.cxx | 373 ++++++++++++++++------------- 13 files changed, 501 insertions(+), 326 deletions(-) create mode 100644 smtk/common/Instances.h create mode 100644 smtk/common/Visit.h delete mode 100644 smtk/task/Factory.h delete mode 100644 smtk/task/pybind11/PybindFactory.h diff --git a/doc/userguide/common/factory.rst b/doc/userguide/common/factory.rst index 020ddbc965..686d1d2ad2 100644 --- a/doc/userguide/common/factory.rst +++ b/doc/userguide/common/factory.rst @@ -3,7 +3,7 @@ Factory SMTK's factory pattern (:smtk:`Factory `) allows consuming code to register types that share a common base class -with the factory insetance at runtime and subsequently construct +with a factory instance at runtime and subsequently construct instances of these types using the type (`Type`), type name (`smtk::common::typeName()`), or type index (`typeid(Type).hash_code()`). Upon declaration, a factory takes as @@ -12,5 +12,32 @@ passed to the generated classes upon construction. As a convenience, each of the above construction modes has an associated Interface to provide a uniform API when constructing objects. +Factories return unique pointers to objects they construct. +Because shared pointers can be constructed from unique pointers, +the factory pattern can be used in both cases where single and +shared ownership are needed. + An example that demonstrates the prinicples and API of this pattern -can be found at `smtk/comon/testing/cxx/UnitTestFactory.cxx`. +can be found at `smtk/common/testing/cxx/UnitTestFactory.cxx`. + +Instances +========= + +As an extension to the Factory pattern, SMTK also provides +a templated :smtk:`Instances ` class. +The Instances class not only tracks types that can be constructed +but also manages instances that have been constructed by holding +a shared pointer to each object it creates. + +The Instances class can be instructed to release any shared pointer +it owns which — assuming no other shared pointers reference the same +object — will delete the object. + +Upon construction and release of objects its manages, the Instances +object invokes Observers (covered later in this section). +Observing the construction and imminent deletion of objects allows +user interfaces an opportunity to present summaries of the system +state. + +Instances takes the same set of template parameters as the Factory: +the common base type and signatures used to construct instances. diff --git a/smtk/common/CMakeLists.txt b/smtk/common/CMakeLists.txt index bd9cabb722..0b3fa7a89e 100644 --- a/smtk/common/CMakeLists.txt +++ b/smtk/common/CMakeLists.txt @@ -37,6 +37,7 @@ set(commonHeaders InfixExpressionEvaluation.h InfixExpressionGrammar.h InfixExpressionGrammarImpl.h + Instances.h json/jsonLinks.h json/jsonTypeMap.h json/jsonUUID.h @@ -57,6 +58,7 @@ set(commonHeaders UUID.h UUIDGenerator.h VersionMacros.h + Visit.h testing/cxx/helpers.h ${CMAKE_CURRENT_BINARY_DIR}/Version.h diff --git a/smtk/common/Instances.h b/smtk/common/Instances.h new file mode 100644 index 0000000000..3932bf5696 --- /dev/null +++ b/smtk/common/Instances.h @@ -0,0 +1,202 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#ifndef smtk_common_Instances_h +#define smtk_common_Instances_h + +#include "smtk/common/Factory.h" +#include "smtk/common/Observers.h" +#include "smtk/common/Visit.h" + +namespace smtk +{ +namespace common +{ + +/// Events that an instance-manager can observe. +enum class InstanceEvent +{ + Managed, //!< An instance of a managed class was added to the instance manager. + Unmanaged //!< An instance of a managed class was removed from the instance manager. +}; + +/// The Instances class is used to manage instances of objects which +/// share an inherited base type (the BaseType template parameter). +/// It owns references to the instances, which keeps them alive. +/// It provides methods to observe when instances are managed (added +/// to Instances) and unmanaged (removed from Instances — at which +/// point their destructor is usually called, although destruction +/// only occurs if no other shared pointers to the object exist). +/// +/// Instances are created via smtk::common::Factory, which this class +/// inherits, and observers are invoked via smtk::common::Observers. +/// The Instances class mutates the signature of its parent Factory +/// class's creation methods so that they return shared pointers. +template +class SMTK_ALWAYS_EXPORT Instances : public Factory +{ +public: + /// An alias for the inherited parent class. + using Superclass = smtk::common::Factory; + /// The signature of observers watching managed instance lifecycle events. + using Observer = std::function&)>; + /// Access to the set of observers of instances. + using Observers = smtk::common::Observers; + /// The signature used to visit managed instances of objects. + using Visitor = std::function&)>; + + /// Construct a manager of object instances. + Instances() + : m_observers([this](Observer& observer) { + for (const auto& instance : m_instances) + { + observer(InstanceEvent::Managed, instance); + } + }) + { + } + + /// Delete copy constructor and assignment operator. + Instances(const Instances&) = delete; + void operator=(const Instances&) = delete; + + /// Unregister a Type using its type name. + using Superclass::unregisterType; // (const std::string&); + + /// Determine whether or not a Type is available using its type name. + using Superclass::contains; // (const std::string&) const; + + /// Create an instance of the given \a Type and manage it. + template + std::shared_ptr create(Args&&... args) + { + std::shared_ptr instance = this->Superclass::createFromIndex( + typeid(Type).hash_code(), std::forward(args)...); // .release(); + if (instance) + { + m_instances.insert(instance); + m_observers(InstanceEvent::Managed, instance); + } + return std::static_pointer_cast(instance); + } + + /// Create and manage an instance of \a Type using its type-name. + template + std::shared_ptr createFromName(const std::string& typeName, Args&&... args) + { + std::shared_ptr instance = + this->Superclass::createFromName(typeName, std::forward(args)...); + if (instance) + { + m_instances.insert(instance); + m_observers(InstanceEvent::Managed, instance); + } + return instance; + } + + /// Create and manage an instance of a Type using its type-index. + template + std::shared_ptr createFromIndex(const std::size_t& typeIndex, Args&&... args) + { + std::shared_ptr instance = + this->Superclass::createFromIndex(typeIndex, std::forward(args)...); + if (instance) + { + m_instances.insert(instance); + m_observers(InstanceEvent::Managed, instance); + } + return instance; + } + + /// Manage an already-created instance of a class. + /// + /// This returns true if the instance was added and + /// false otherwise (which can occur if passed a null + /// pointer or an already-managed instance). + bool manage(const std::shared_ptr& instance) + { + if (!instance) + { + return false; + } + bool didManage = m_instances.insert(instance).second; + if (didManage) + { + m_observers(InstanceEvent::Managed, instance); + } + return didManage; + } + + /// Unmanage (drop the reference to) an \a instance. + /// + /// This may result in the destruction of \a instance + /// but is not guaranteed to do so (i.e., when other + /// shared-pointers to \a instance exist). + bool unmanage(const std::shared_ptr& instance) + { + if (!instance) + { + return false; + } + auto it = m_instances.find(instance); + if (it == m_instances.end()) + { + return false; + } + m_instances.erase(it); + m_observers(InstanceEvent::Unmanaged, instance); + return true; + } + + /// Determine whether \a instance is managed or not. + bool contains(const std::shared_ptr& instance) + { + return m_instances.find(instance) != m_instances.end(); + } + + /// Unmanage all instances. + void clear() + { + for (const auto& instance : m_instances) + { + m_observers(InstanceEvent::Unmanaged, instance); + } + m_instances.clear(); + } + + /// Return the set of observers of instances (so that you can insert an observer). + Observers& observers() { return m_observers; } + + /// Iterate over the collection of instances, invoking a visitor on each. + /// + /// The return value indicates whether iteration was terminated early or not. + smtk::common::Visit visit(Visitor visitor) + { + for (const auto& instance : m_instances) + { + if (visitor(instance) == smtk::common::Visit::Halt) + { + return smtk::common::Visit::Halt; + } + } + return smtk::common::Visit::Continue; + } + +private: + /// The container that owns managed instances. + using Container = std::set>; + /// The container of instances. + Container m_instances; + /// Observers of changes to m_instances. + Observers m_observers; +}; +} // namespace common +} // namespace smtk + +#endif diff --git a/smtk/common/Visit.h b/smtk/common/Visit.h new file mode 100644 index 0000000000..29e63abafa --- /dev/null +++ b/smtk/common/Visit.h @@ -0,0 +1,28 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#ifndef smtk_common_Visit_h +#define smtk_common_Visit_h + +namespace smtk +{ +namespace common +{ + +/// Return values common to most visitor methods. +enum class Visit +{ + Continue, //!< Continue to visit items. + Halt //!< Stop visiting items immediately. +}; + +} // namespace common +} // namespace smtk + +#endif // smtk_common_Visit_h diff --git a/smtk/task/CMakeLists.txt b/smtk/task/CMakeLists.txt index f8db573d6a..e38180d14f 100644 --- a/smtk/task/CMakeLists.txt +++ b/smtk/task/CMakeLists.txt @@ -6,7 +6,6 @@ set(taskSrcs ) set(taskHeaders - Factory.h Manager.h Registrar.h Task.h diff --git a/smtk/task/Factory.h b/smtk/task/Factory.h deleted file mode 100644 index f32e143490..0000000000 --- a/smtk/task/Factory.h +++ /dev/null @@ -1,85 +0,0 @@ -//========================================================================= -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -//========================================================================= -#ifndef smtk_task_Factory_h -#define smtk_task_Factory_h - -#include "smtk/task/Task.h" - -#include "smtk/common/Factory.h" -#include "smtk/common/TypeName.h" - -#include -#include -#include - -namespace smtk -{ -namespace task -{ - -using ParentFactory = smtk::common::Factory< - Task, - void, - smtk::common::factory::Inputs, - smtk::common::factory::Inputs< - Task::Configuration&, - smtk::task::Task::PassedDependencies, - smtk::common::Managers::Ptr>>; -/**\brief A factory for tasks that compose a workflow. - * - * A task factory creates tasks for use in workflows. - * - * To register a Task subclass, it must have a default constructor - * and constructors that take (1) configuration information, - * (2) references to dependencies and (3) managers. - * - * This class overrides the base-class create methods with - * versions that return shared pointers so that observers - * of the factory can be passed shared (rather than unique) - * pointers. - */ -class SMTKCORE_EXPORT Factory : public ParentFactory -{ -public: - using BaseType = smtk::task::Task; - - /// Create an instance of a Task. - /// - /// Unlike smtk::common::Factory, this returns a shared pointer. - template - std::shared_ptr create(Args&&... args) const - { - std::shared_ptr shared = - this->ParentFactory::createFromIndex(typeid(Type).hash_code(), std::forward(args)...); - return std::static_pointer_cast(shared); - } - - /// Create an instance of a Task using its type name. - /// - /// Unlike smtk::common::Factory, this returns a shared pointer. - template - std::shared_ptr createFromName(const std::string& typeName, Args&&... args) const - { - return this->ParentFactory::createFromName(typeName, std::forward(args)...); - } - - /// Create an instance of a Task using its type name. - /// - /// Unlike smtk::common::Factory, this returns a shared pointer. - template - std::shared_ptr createFromIndex(const std::size_t& typeIndex, Args&&... args) const - { - return this->ParentFactory::createFromIndex(typeIndex, std::forward(args)...); - } -}; -} // namespace task -} // namespace smtk - -#endif diff --git a/smtk/task/Manager.h b/smtk/task/Manager.h index a1f7520258..1aeeec9aee 100644 --- a/smtk/task/Manager.h +++ b/smtk/task/Manager.h @@ -15,10 +15,11 @@ #include "smtk/PublicPointerDefs.h" #include "smtk/SharedFromThis.h" +#include "smtk/common/Instances.h" #include "smtk/common/Managers.h" #include "smtk/common/TypeName.h" -#include "smtk/task/Factory.h" +#include "smtk/task/Task.h" #include #include @@ -43,16 +44,28 @@ public: virtual ~Manager(); - /// Return a factory object used to register task types and create tasks. - Factory& taskFactory() { return m_taskFactory; } - const Factory& taskFactory() const { return m_taskFactory; } + /// Managed instances of Task objects (and a registry of Task classes). + using Instances = smtk::common::Instances< + smtk::task::Task, + void, + std::tuple>, + std::tuple< + smtk::task::Task::Configuration&, + smtk::task::Task::PassedDependencies, + std::shared_ptr>>; + + /// Return the set of managed task instances. + /// + /// This class also acts as a registrar for Task subclasses. + Instances& instances() { return m_instances; } + const Instances& instances() const { return m_instances; } /// Return the managers instance that contains this manager, if it exists. smtk::common::Managers::Ptr managers() const { return m_managers.lock(); } void setManagers(const smtk::common::Managers::Ptr& managers) { m_managers = managers; } private: - Factory m_taskFactory; + Instances m_instances; std::weak_ptr m_managers; protected: diff --git a/smtk/task/Registrar.cxx b/smtk/task/Registrar.cxx index 2597162305..7786ea78f6 100644 --- a/smtk/task/Registrar.cxx +++ b/smtk/task/Registrar.cxx @@ -51,14 +51,14 @@ void Registrar::unregisterFrom(const smtk::resource::Manager::Ptr& resourceManag void Registrar::registerTo(const smtk::task::Manager::Ptr& taskManager) { - auto& factory = taskManager->taskFactory(); - factory.registerTypes(); + auto& instances = taskManager->instances(); + instances.registerTypes(); } void Registrar::unregisterFrom(const smtk::task::Manager::Ptr& taskManager) { - auto& factory = taskManager->taskFactory(); - factory.unregisterTypes(); + auto& instances = taskManager->instances(); + instances.unregisterTypes(); } } // namespace task diff --git a/smtk/task/TaskNeedsResources.cxx b/smtk/task/TaskNeedsResources.cxx index 2ea5e98e11..4310d8d484 100644 --- a/smtk/task/TaskNeedsResources.cxx +++ b/smtk/task/TaskNeedsResources.cxx @@ -80,7 +80,7 @@ void from_json(const json& j, TaskNeedsResources::Predicate& p) } } -TaskNeedsResources::TaskNeedsResources() {} +TaskNeedsResources::TaskNeedsResources() = default; TaskNeedsResources::TaskNeedsResources( const Configuration& config, @@ -151,7 +151,7 @@ void TaskNeedsResources::updateResources( case smtk::resource::EventType::ADDED: { // Add the resource to the appropriate entry: - std::string role = smtk::project::detail::role(resourcePtr); + const std::string& role = smtk::project::detail::role(resourcePtr); auto it = m_resourcesByRole.find(role); if (it != m_resourcesByRole.end()) { @@ -166,7 +166,7 @@ void TaskNeedsResources::updateResources( case smtk::resource::EventType::REMOVED: { // Remove the resource from the appropriate entry. - std::string role = smtk::project::detail::role(resourcePtr); + const std::string& role = smtk::project::detail::role(resourcePtr); auto it = m_resourcesByRole.find(role); if (it != m_resourcesByRole.end()) { diff --git a/smtk/task/pybind11/PybindFactory.h b/smtk/task/pybind11/PybindFactory.h deleted file mode 100644 index ead11b88d4..0000000000 --- a/smtk/task/pybind11/PybindFactory.h +++ /dev/null @@ -1,58 +0,0 @@ -//========================================================================= -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -//========================================================================= - -#ifndef pybind_smtk_task_Factory_h -#define pybind_smtk_task_Factory_h - -#include - -#include "smtk/task/Factory.h" - -namespace py = pybind11; - -inline py::class_< - smtk::task::Factory - // , smtk::common::Factory< - // smtk::task::Task, - // void, - // std::tuple >, - // std::tuple>, std::shared_ptr > - // > -> pybind11_init_smtk_task_Factory(py::module &m) -{ - py::class_< - smtk::task::Factory - // , smtk::common::Factory< - // smtk::task::Task, - // void, - // std::tuple >, - // std::tuple>, std::shared_ptr > - // > - > instance(m, "Factory"); - instance - .def(py::init<>()) - .def(py::init<::smtk::task::Factory const &>()) - .def("deepcopy", (smtk::task::Factory & (smtk::task::Factory::*)(::smtk::task::Factory const &)) &smtk::task::Factory::operator=) - .def("createFromName", [](const smtk::task::Factory& factory, const std::string& name) { - std::shared_ptr object(factory.createFromName(name)); - return object; - }) - /* - .def("createFromName", [](const smtk::task::Factory& factory, const std::string& name, const std::string& json, const std::shared_ptr& managers) { - smtk::task::Task::Configuration config(json); - std::shared_ptr object = factory.createFromName(name, config, managers); - return object; - }) - */ - ; - return instance; -} - -#endif diff --git a/smtk/task/pybind11/PybindManager.h b/smtk/task/pybind11/PybindManager.h index 15c0b9c9c8..b276ddb0f7 100644 --- a/smtk/task/pybind11/PybindManager.h +++ b/smtk/task/pybind11/PybindManager.h @@ -15,22 +15,18 @@ #include "smtk/task/Manager.h" -#include "smtk/task/Factory.h" - namespace py = pybind11; inline PySharedPtrClass< smtk::task::Manager > pybind11_init_smtk_task_Manager(py::module &m) { PySharedPtrClass< smtk::task::Manager > instance(m, "Manager"); instance - .def(py::init<::smtk::task::Manager const &>()) - .def("deepcopy", (smtk::task::Manager & (smtk::task::Manager::*)(::smtk::task::Manager const &)) &smtk::task::Manager::operator=) .def_static("create", (std::shared_ptr (*)()) &smtk::task::Manager::create) .def_static("create", (std::shared_ptr (*)(::std::shared_ptr &)) &smtk::task::Manager::create, py::arg("ref")) .def("managers", &smtk::task::Manager::managers) .def("setManagers", &smtk::task::Manager::setManagers, py::arg("managers")) - .def("taskFactory", (smtk::task::Factory & (smtk::task::Manager::*)()) &smtk::task::Manager::taskFactory) - .def("taskFactory", (smtk::task::Factory const & (smtk::task::Manager::*)() const) &smtk::task::Manager::taskFactory) + .def("instances", (smtk::task::Manager::Instances & (smtk::task::Manager::*)()) &smtk::task::Manager::instances) + .def("instances", (smtk::task::Manager::Instances const & (smtk::task::Manager::*)() const) &smtk::task::Manager::instances) .def("typeName", &smtk::task::Manager::typeName) .def_readonly_static("type_name", &smtk::task::Manager::type_name) ; diff --git a/smtk/task/pybind11/PybindTask.cxx b/smtk/task/pybind11/PybindTask.cxx index 0b5e9e5c55..660f1096b8 100644 --- a/smtk/task/pybind11/PybindTask.cxx +++ b/smtk/task/pybind11/PybindTask.cxx @@ -20,7 +20,6 @@ using PySharedPtrClass = py::class_, Args...>; using namespace nlohmann; -#include "PybindFactory.h" #include "PybindTaskNeedsResources.h" #include "PybindTask.h" #include "PybindManager.h" @@ -44,5 +43,4 @@ PYBIND11_MODULE(task, m) pybind11_init_smtk_task_stateEnum(task); pybind11_init_smtk_task_stateName(task); auto smtk_task_TaskNeedsResources = pybind11_init_smtk_task_TaskNeedsResources(task); - auto smtk_task_Factory = pybind11_init_smtk_task_Factory(task); } diff --git a/smtk/task/testing/cxx/TestTask.cxx b/smtk/task/testing/cxx/TestTask.cxx index b1125ffc26..42cd9b213f 100644 --- a/smtk/task/testing/cxx/TestTask.cxx +++ b/smtk/task/testing/cxx/TestTask.cxx @@ -28,6 +28,8 @@ namespace test_task using namespace smtk::task; +static bool taskDestroyed = false; + class UnavailableTask : public Task { public: @@ -39,6 +41,7 @@ public: const smtk::common::Managers::Ptr& managers = nullptr) : Task(config, managers) { + this->internalStateChanged(State::Unavailable); } UnavailableTask( const Configuration& config, @@ -46,8 +49,13 @@ public: const smtk::common::Managers::Ptr& managers = nullptr) : Task(config, deps, managers) { + this->internalStateChanged(State::Unavailable); + } + ~UnavailableTask() override + { + std::cout << "Destroying " << this->title() << "\n"; + taskDestroyed = true; } - State state() const override { return State::Unavailable; } }; } // namespace test_task @@ -77,166 +85,211 @@ int TestTask(int, char*[]) smtk::task::Registrar::registerTo(taskManager); } - taskManager->taskFactory().registerType(); - smtk::task::Task::PassedDependencies empty; - - std::shared_ptr t1 = - taskManager->taskFactory().create(Task::Configuration{ { "title", "Task 1" } }, managers); - test(!!t1, "Expecting to create a non-null task."); - test(t1->state() == State::Completable, "Expected task without dependencies to be completable."); - - State from; - State to; - int called = 0; - auto callback = [&from, &to, &called](Task& task, State prev, State next) { - (void)task; - ++called; - from = prev; - to = next; - std::cout << " " << task.title() << " transitioned: " << prev << " ⟶ " << next << "\n"; - }; - auto okey = t1->observers().insert(callback); - - bool success = t1->markCompleted(true); - test(success, "Expected completion to be accepted."); - test(called == 1, "Expected observer to be invoked."); - test( - from == State::Completable && to == State::Completed, - "Expected state transition completable⟶completed."); - - called = 0; - success = t1->markCompleted(true); - test(!success, "Expected completion to be rejected on double-complete."); - test(called == 0, "Expected observer to be skipped on double-complete."); - - called = 0; - success = t1->markCompleted(false); - test(success, "Expected uncompletion to be accepted."); - test(called == 1, "Expected observer to be invoked."); - test( - from == State::Completed && to == State::Completable, - "Expected state transition completed⟶completable."); - - // Now add a dependent task that is unavailable. - std::shared_ptr t2 = taskManager->taskFactory().create( - Task::Configuration{ { "title", "Task 2" } }, managers); - called = 0; - success = t1->addDependency(t2); - test(success, "Expected to add dependency to task."); - test(called == 1, "Expected observer to be invoked upon dependency insertion."); - test( - from == State::Completable && to == State::Unavailable, - "Expected state transition completable⟶unavailable."); - success = t1->addDependency(t2); - test(!success, "Expected failure when adding redundant dependency to task."); - - // Test construction with dependencies - Task::Configuration c3{ { "title", "Task 3" }, { "completed", true } }; - auto t3 = taskManager->taskFactory().create( - c3, std::set>{ { t1, t2 } }, managers); - - // Test dependency removal and notification. - auto dokey = t3->observers().insert(callback); - called = 0; - success = t3->removeDependency(t2); - test(success, "Expected to remove dependency from Task 3."); - test(called == 0, "Did not expect state to change when removing first dependency."); - success = t1->removeDependency(t2); - test(success, "Expected to remove dependency from Task 1."); - test(called == 2, "Expected 2 tasks to change state."); - test( - from == State::Unavailable && to == State::Completed, - "Expected state transition unavailable⟶completed."); - success = t1->removeDependency(t2); - test(!success, "Expected removal of non-existent dependency to fail."); - - // Test TaskNeedsResources - // I. Construction w/ configuration. - // The task is incomplete unless 1 or 2 model geometry resources - // and 1 or more simulation attribute resources are held by the - // resource manager. - Task::Configuration c4{ - { "title", "Task 4" }, - { "resources", - { { { "role", "model geometry" }, { "type", "smtk::model::Resource" }, { "max", 2 } }, - { { "role", "simulation attribute" }, { "type", "smtk::attribute::Resource" } } } } + taskManager->instances().registerType(); + + auto ikey = taskManager->instances().observers().insert( + [](smtk::common::InstanceEvent event, const smtk::task::Task::Ptr& task) { + std::cout << (event == smtk::common::InstanceEvent::Managed ? "Manage" : "Unmanage") << " " + << task->title() << "\n"; + }); + + int count = 0; + auto countInstances = [&count](const std::shared_ptr& task) { + ++count; + std::cout << " " << task->title() << " " << task->state() << "\n"; + return smtk::common::Visit::Continue; }; - auto t4 = taskManager->taskFactory().create(c4, managers); - test(!!t4, "Could not create TaskNeedsResources."); - test(t4->state() == State::Incomplete, "Task with no resources should be incomplete."); - auto hokey = t4->observers().insert(callback); - - // II. State transitions - called = 0; - bool didAdd; - // Add 3 resources. Addition of the last should cause transition. - auto model1 = smtk::model::Resource::create(); - model1->properties().get()["project_role"] = "model geometry"; - didAdd = resourceManager->add(model1); - test(didAdd, "Expected to add model1 resource."); - test(called == 0, "Did not expect state to change when adding first model."); - auto model2 = smtk::model::Resource::create(); - model2->properties().get()["project_role"] = "model geometry"; - didAdd = resourceManager->add(model2); - test(didAdd, "Expected to add model2 resource."); - test(called == 0, "Did not expect state to change when adding first model."); - auto attr1 = smtk::attribute::Resource::create(); - attr1->properties().get()["project_role"] = "simulation attribute"; - didAdd = resourceManager->add(attr1); - test(didAdd, "Expected to add attr1 resource."); - test(called == 1, "Expected state to change when required resources present."); - test( - from == State::Incomplete && to == State::Completable, - "Expected state transition incomplete⟶completable."); - - t4->markCompleted(true); // We'll test below that completion is reset. - test(called == 2, "Expected state to change when user marks completed."); - test( - from == State::Completable && to == State::Completed, - "Expected state transition completable⟶completed."); - - called = 0; - bool didRemove; - // Remove 2 resources. Removal of the last should cause a transition. - didRemove = resourceManager->remove(model1); - test(didRemove, "Expected to remove model1 resource."); - test(called == 0, "Did not expect state to change when removing model1."); - didRemove = resourceManager->remove(attr1); - test(didRemove, "Expected to remove attr1 resource."); - test(called == 1, "Expected state to change when removing attr1 model."); - test( - from == State::Completed && to == State::Incomplete, - "Expected state transition completed⟶incomplete."); - - // Test that user completion is reset by transitions "below" Completeable and back. - called = 0; - didAdd = resourceManager->add(attr1); - test(didAdd, "Expected to add attr1 resource."); - test(called == 1, "Expected state to change when required resources present."); - test( - from == State::Incomplete && to == State::Completable, - "Expected state transition incomplete⟶completable."); - - // III. Verify that an empty role is allowed, as are empty resource types. - // This should also test initialization of TaskNeedsResources when - // resource manager is not empty. - Task::Configuration c5{ { "title", "Task 5" }, - { "resources", - { { { "type", "smtk::model::Resource" } }, - { { "role", "simulation attribute" } } } } }; - auto t5 = - taskManager->taskFactory().createFromName("smtk::task::TaskNeedsResources", c5, managers); - test(!!t5, "Could not create TaskNeedsResources."); - auto pokey = t5->observers().insert(callback); - test(t5->state() == State::Completable, "Task 5 should be completable initially."); - called = 0; - didRemove = resourceManager->remove(attr1); - test(didRemove, "Expected to remove attr1 resource."); - // NB: called == 2 since both task 4 and 5 should transition: - test(called == 2, "Expected state to change when removing attr1 model."); - test( - from == State::Completable && to == State::Incomplete, - "Expected state transition completable⟶incomplete."); + + { + std::shared_ptr t1 = + taskManager->instances().create(Task::Configuration{ { "title", "Task 1" } }, managers); + test(!!t1, "Expecting to create a non-null task."); + test( + t1->state() == State::Completable, "Expected task without dependencies to be completable."); + + State from; + State to; + int called = 0; + auto callback = [&from, &to, &called](Task& task, State prev, State next) { + (void)task; + ++called; + from = prev; + to = next; + std::cout << " " << task.title() << " transitioned: " << prev << " ⟶ " << next << "\n"; + }; + auto okey = t1->observers().insert(callback); + + bool success = t1->markCompleted(true); + test(success, "Expected completion to be accepted."); + test(called == 1, "Expected observer to be invoked."); + test( + from == State::Completable && to == State::Completed, + "Expected state transition completable⟶completed."); + + called = 0; + success = t1->markCompleted(true); + test(!success, "Expected completion to be rejected on double-complete."); + test(called == 0, "Expected observer to be skipped on double-complete."); + + called = 0; + success = t1->markCompleted(false); + test(success, "Expected uncompletion to be accepted."); + test(called == 1, "Expected observer to be invoked."); + test( + from == State::Completed && to == State::Completable, + "Expected state transition completed⟶completable."); + + // Now add a dependent task that is unavailable. + test( + taskManager->instances().contains(), + "Expected UnavailableTask to be registered."); + std::shared_ptr t2 = taskManager->instances().create( + Task::Configuration{ { "title", "Task 2" } }, managers); + called = 0; + success = t1->addDependency(t2); + test(success, "Expected to add dependency to task."); + test(called == 1, "Expected observer to be invoked upon dependency insertion."); + test( + from == State::Completable && to == State::Unavailable, + "Expected state transition completable⟶unavailable."); + success = t1->addDependency(t2); + test(!success, "Expected failure when adding redundant dependency to task."); + + // Test construction with dependencies + Task::Configuration c3{ { "title", "Task 3" }, { "completed", true } }; + auto t3 = taskManager->instances().create( + c3, std::set>{ { t1, t2 } }, managers); + + // Test dependency removal and notification. + auto dokey = t3->observers().insert(callback); + called = 0; + success = t3->removeDependency(t2); + test(success, "Expected to remove dependency from Task 3."); + test(called == 0, "Did not expect state to change when removing first dependency."); + success = t1->removeDependency(t2); + test(success, "Expected to remove dependency from Task 1."); + test(called == 2, "Expected 2 tasks to change state."); + test( + from == State::Unavailable && to == State::Completed, + "Expected state transition unavailable⟶completed."); + success = t1->removeDependency(t2); + test(!success, "Expected removal of non-existent dependency to fail."); + + // Test TaskNeedsResources + // I. Construction w/ configuration. + // The task is incomplete unless 1 or 2 model geometry resources + // and 1 or more simulation attribute resources are held by the + // resource manager. + Task::Configuration c4{ + { "title", "Task 4" }, + { "resources", + { { { "role", "model geometry" }, { "type", "smtk::model::Resource" }, { "max", 2 } }, + { { "role", "simulation attribute" }, { "type", "smtk::attribute::Resource" } } } } + }; + auto t4 = taskManager->instances().create(c4, managers); + test(!!t4, "Could not create TaskNeedsResources."); + test(t4->state() == State::Incomplete, "Task with no resources should be incomplete."); + auto hokey = t4->observers().insert(callback); + + // II. State transitions + called = 0; + bool didAdd; + // Add 3 resources. Addition of the last should cause transition. + auto model1 = smtk::model::Resource::create(); + model1->properties().get()["project_role"] = "model geometry"; + didAdd = resourceManager->add(model1); + test(didAdd, "Expected to add model1 resource."); + test(called == 0, "Did not expect state to change when adding first model."); + auto model2 = smtk::model::Resource::create(); + model2->properties().get()["project_role"] = "model geometry"; + didAdd = resourceManager->add(model2); + test(didAdd, "Expected to add model2 resource."); + test(called == 0, "Did not expect state to change when adding first model."); + auto attr1 = smtk::attribute::Resource::create(); + attr1->properties().get()["project_role"] = "simulation attribute"; + didAdd = resourceManager->add(attr1); + test(didAdd, "Expected to add attr1 resource."); + test(called == 1, "Expected state to change when required resources present."); + test( + from == State::Incomplete && to == State::Completable, + "Expected state transition incomplete⟶completable."); + + t4->markCompleted(true); // We'll test below that completion is reset. + test(called == 2, "Expected state to change when user marks completed."); + test( + from == State::Completable && to == State::Completed, + "Expected state transition completable⟶completed."); + + called = 0; + bool didRemove; + // Remove 2 resources. Removal of the last should cause a transition. + didRemove = resourceManager->remove(model1); + test(didRemove, "Expected to remove model1 resource."); + test(called == 0, "Did not expect state to change when removing model1."); + didRemove = resourceManager->remove(attr1); + test(didRemove, "Expected to remove attr1 resource."); + test(called == 1, "Expected state to change when removing attr1 model."); + test( + from == State::Completed && to == State::Incomplete, + "Expected state transition completed⟶incomplete."); + + // Test that user completion is reset by transitions "below" Completeable and back. + called = 0; + didAdd = resourceManager->add(attr1); + test(didAdd, "Expected to add attr1 resource."); + test(called == 1, "Expected state to change when required resources present."); + test( + from == State::Incomplete && to == State::Completable, + "Expected state transition incomplete⟶completable."); + + // III. Verify that an empty role is allowed, as are empty resource types. + // This should also test initialization of TaskNeedsResources when + // resource manager is not empty. + Task::Configuration c5{ { "title", "Task 5" }, + { "resources", + { { { "type", "smtk::model::Resource" } }, + { { "role", "simulation attribute" } } } } }; + auto t5 = + taskManager->instances().createFromName("smtk::task::TaskNeedsResources", c5, managers); + test(!!t5, "Could not create TaskNeedsResources."); + auto pokey = t5->observers().insert(callback); + test(t5->state() == State::Completable, "Task 5 should be completable initially."); + called = 0; + didRemove = resourceManager->remove(attr1); + test(didRemove, "Expected to remove attr1 resource."); + // NB: called == 2 since both task 4 and 5 should transition: + test(called == 2, "Expected state to change when removing attr1 model."); + test( + from == State::Completable && to == State::Incomplete, + "Expected state transition completable⟶incomplete."); + + // Test task Instances methods: + + // Verify double-add fails. + didAdd = taskManager->instances().manage(t5); + test(!didAdd, "Should not return true when duplicate instance managed."); + + // Test visit() + std::cout << "Tasks:\n"; + taskManager->instances().visit(countInstances); + test(count == 5, "Expected 5 tasks."); + + // Test removal and addition. + didRemove = taskManager->instances().unmanage(t5); + test(didRemove, "Expected to unmanage task 5."); + test(!taskManager->instances().contains(t5), "Expected task 5 to be absent."); + didAdd = taskManager->instances().manage(t5); + test(didAdd, "Expected to manage task 5."); + test(taskManager->instances().contains(t5), "Expected task 5 to be present."); + + taskManager->instances().clear(); + test(!test_task::taskDestroyed, "Task 2 should still be alive while t2 in scope."); + } + test(test_task::taskDestroyed, "Task 2 should be dead once t2 is out of scope."); + + count = 0; + taskManager->instances().visit(countInstances); + test(count == 0, "Expected 0 tasks."); return 0; } -- GitLab From 49702ecf231c9122a695b59f2e1fb3882cde12f0 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 18 Jun 2021 02:50:38 -0400 Subject: [PATCH 071/136] Add the concept of an active task. --- doc/release/notes/common-visit.rst | 12 ++ doc/smtk.doxyfile.in | 2 + doc/userguide/task/concepts.rst | 15 ++- smtk/common/Visit.h | 1 + smtk/task/Active.cxx | 89 ++++++++++++++ smtk/task/Active.h | 76 ++++++++++++ smtk/task/CMakeLists.txt | 3 + smtk/task/Instances.h | 38 ++++++ smtk/task/Manager.cxx | 6 +- smtk/task/Manager.h | 17 ++- smtk/task/State.h | 1 + smtk/task/testing/cxx/CMakeLists.txt | 5 +- smtk/task/testing/cxx/TestActive.cxx | 170 +++++++++++++++++++++++++++ 13 files changed, 420 insertions(+), 15 deletions(-) create mode 100644 doc/release/notes/common-visit.rst create mode 100644 smtk/task/Active.cxx create mode 100644 smtk/task/Active.h create mode 100644 smtk/task/Instances.h create mode 100644 smtk/task/testing/cxx/TestActive.cxx diff --git a/doc/release/notes/common-visit.rst b/doc/release/notes/common-visit.rst new file mode 100644 index 0000000000..4ae7cacb6d --- /dev/null +++ b/doc/release/notes/common-visit.rst @@ -0,0 +1,12 @@ +Visitors +======== + +SMTK now provides an enumeration, ``smtk::common::Visit``, that visitor lambdas +may return to indicate whether visitation should continue (``smtk::common::Visit::Continue``) +or stop (``smtk::common::Visit::Halt``). +This enum is much easier to use than simply returning a ``bool`` as developers +frequently have trouble remembering which value (true or false) corresponds to +which iteration behaviour. + +This is currently only used by ``smtk::task::Task::visit()``, but will be +used more widely in the future. diff --git a/doc/smtk.doxyfile.in b/doc/smtk.doxyfile.in index c9bd082c4c..8f8467ace6 100644 --- a/doc/smtk.doxyfile.in +++ b/doc/smtk.doxyfile.in @@ -734,6 +734,7 @@ INPUT = \ "@smtk_SOURCE_DIR@/smtk/simulation" \ "@smtk_SOURCE_DIR@/smtk/project" \ "@smtk_SOURCE_DIR@/smtk/common" \ + "@smtk_SOURCE_DIR@/smtk/task" \ "@smtk_SOURCE_DIR@/smtk/workflow" \ "@smtk_SOURCE_DIR@/smtk/model" \ "@smtk_SOURCE_DIR@/smtk/model/operators" \ @@ -829,6 +830,7 @@ INPUT = \ "@smtk_BINARY_DIR@/smtk/simulation" \ "@smtk_BINARY_DIR@/smtk/project" \ "@smtk_BINARY_DIR@/smtk/common" \ + "@smtk_BINARY_DIR@/smtk/task" \ "@smtk_BINARY_DIR@/smtk/workflow" \ "@smtk_BINARY_DIR@/smtk/model" \ "@smtk_BINARY_DIR@/smtk/model/operators" \ diff --git a/doc/userguide/task/concepts.rst b/doc/userguide/task/concepts.rst index fad4e6378f..bb933e14b2 100644 --- a/doc/userguide/task/concepts.rst +++ b/doc/userguide/task/concepts.rst @@ -27,13 +27,22 @@ that connect completed tasks to incomplete tasks. is unavailable until its dependencies are met, at which time it will transition straight to completable. -:smtk:`Factory ` +:smtk:`Instances ` is used to create instances of registered task classes. Any plugins that provide new task subclasses should register those classes with the factory in their registrar (see :ref:`smtk-plugin-sys`). +:smtk:`Active ` + is used to get the currently active task or switch to a different task. + There can only be one active task at a time, although there may be + no active task. + Active tasks must be managed instances so that there is some + indication before deletion that the task will be destroyed and + thus should not be active. + This object can be observed for changes to the active task. + :smtk:`Manager ` is an object applications can create to hold a task factory and - the set of tasks the factory has created. - It acts as a clearinghouse for information on task state transitions. + the set of task instances the factory has created. + It also holds the active task tracker. diff --git a/smtk/common/Visit.h b/smtk/common/Visit.h index 29e63abafa..92b750a130 100644 --- a/smtk/common/Visit.h +++ b/smtk/common/Visit.h @@ -7,6 +7,7 @@ // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notice for more information. //========================================================================= +/*! \file */ #ifndef smtk_common_Visit_h #define smtk_common_Visit_h diff --git a/smtk/task/Active.cxx b/smtk/task/Active.cxx new file mode 100644 index 0000000000..a5ce79d2fa --- /dev/null +++ b/smtk/task/Active.cxx @@ -0,0 +1,89 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#include "smtk/task/Active.h" + +namespace smtk +{ +namespace task +{ + +Active::Active(smtk::task::Instances* instances) + : m_instances(instances) + , m_observers(/* initializer */ + [this](Observer& observer) { + auto active = m_active.lock(); + // Ony initialization will ever call an observer with the same value for both parameters. + observer(active.get(), active.get()); + }) +{ + if (m_instances) + { + m_instancesObserver = m_instances->observers().insert( + [this](smtk::common::InstanceEvent event, const std::shared_ptr& task) { + if (event == smtk::common::InstanceEvent::Unmanaged && task && task == m_active.lock()) + { + m_observers(task.get(), nullptr); + m_active.reset(); + } + }, + /* priority */ 0, + /* initialize */ false, + "Observe task deletion for task::Active"); + } +} + +Active::~Active() = default; + +smtk::task::Task* Active::task() const +{ + return m_active.lock().get(); +} + +bool Active::switchTo(smtk::task::Task* task) +{ + auto current = m_active.lock(); + if (current.get() == task) + { + return false; + } + if (!task) + { + if (current) + { + m_observers(current.get(), nullptr); + m_active.reset(); + m_activeObserver.release(); + return true; + } + return false; + } + if (task->state() == State::Unavailable) + { + return false; + } + auto sharedTask = task->shared_from_this(); + if (m_instances && !m_instances->contains(sharedTask)) + { + // Only managed tasks can be active if we have instances tracked. + return false; + } + m_observers(current.get(), task); + m_active = sharedTask; + m_activeObserver = task->observers().insert([this](Task&, State, State next) { + if (next == State::Unavailable) + { + this->switchTo(nullptr); + } + }); + return true; +} + +} // namespace task +} // namespace smtk diff --git a/smtk/task/Active.h b/smtk/task/Active.h new file mode 100644 index 0000000000..7e2f5cdf1e --- /dev/null +++ b/smtk/task/Active.h @@ -0,0 +1,76 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#ifndef smtk_task_Active_h +#define smtk_task_Active_h + +#include "smtk/task/Instances.h" +#include "smtk/task/Task.h" + +namespace smtk +{ +namespace task +{ + +/// This object provides applications a way to change and observe the active task. +/// +/// If passed an smtk::task::Manager::Instances object at construction, +/// only managed tasks may be active. +/// This ensures that before a task is destroyed this object +/// can notify observers the active task is becoming inactive. +/// +/// If not passed an smtk::task::Manager::Instances object at construction, +/// any task may become active but +/// unmanaged tasks might be deleted without any notification that the active +/// task changed. +/// You are strongly encouraged to pass Instances to the constructor. +class SMTKCORE_EXPORT Active +{ +public: + smtkTypeMacroBase(smtk::task::Active); + + /// The signature for observers of the active task. + /// Observers are passed the previously-active task and the soon-to-be-active task. + /// + /// Note that either task may be null (i.e., it is possible to have no active task). + using Observer = std::function; + /// The container for registered observers. + using Observers = smtk::common::Observers; + + /// Construct an active-task tracker. + Active(smtk::task::Instances* instances = nullptr); + virtual ~Active(); + + /// Return the active task (or nullptr if no task is active). + smtk::task::Task* task() const; + + /// Change the active task (or abandon the currently-active task by passing nullptr). + /// + /// This method returns true if the active task changed and false otherwise. + /// Passing a task that is not managed by \a instances passed to the constructor + /// will always return false. + /// Passing a task that is already active or unavailable will return false. + bool switchTo(smtk::task::Task*); + + /// Return the set of active-task observers (so you can insert yourself). + Observers& observers() { return m_observers; } + const Observers& observers() const { return m_observers; } + +private: + smtk::task::Instances* m_instances; + smtk::task::Instances::Observers::Key m_instancesObserver; + std::weak_ptr m_active; + smtk::task::Task::Observers::Key m_activeObserver; + Observers m_observers; +}; +} // namespace task +} // namespace smtk + +#endif // smtk_task_Active_h diff --git a/smtk/task/CMakeLists.txt b/smtk/task/CMakeLists.txt index e38180d14f..f6096393c2 100644 --- a/smtk/task/CMakeLists.txt +++ b/smtk/task/CMakeLists.txt @@ -1,4 +1,5 @@ set(taskSrcs + Active.cxx Manager.cxx Registrar.cxx Task.cxx @@ -6,6 +7,8 @@ set(taskSrcs ) set(taskHeaders + Active.h + Instances.h Manager.h Registrar.h Task.h diff --git a/smtk/task/Instances.h b/smtk/task/Instances.h new file mode 100644 index 0000000000..5f362cd949 --- /dev/null +++ b/smtk/task/Instances.h @@ -0,0 +1,38 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +/*! \file */ +#ifndef smtk_task_Instances_h +#define smtk_task_Instances_h + +#include "smtk/common/Instances.h" +#include "smtk/common/Managers.h" +#include "smtk/common/TypeName.h" + +#include "smtk/task/Task.h" + +namespace smtk +{ +namespace task +{ + +/// Track smtk::task::Task objects with smtk::common::Instances. +using Instances = smtk::common::Instances< + smtk::task::Task, + void, + std::tuple>, + std::tuple< + smtk::task::Task::Configuration&, + smtk::task::Task::PassedDependencies, + std::shared_ptr>>; + +} // namespace task +} // namespace smtk + +#endif // smtk_task_Instances_h diff --git a/smtk/task/Manager.cxx b/smtk/task/Manager.cxx index 1c760a8006..f4ed4c6c28 100644 --- a/smtk/task/Manager.cxx +++ b/smtk/task/Manager.cxx @@ -15,7 +15,11 @@ namespace smtk namespace task { -Manager::Manager() = default; +Manager::Manager() + : m_active(&m_instances) +{ +} + Manager::~Manager() = default; } // namespace task diff --git a/smtk/task/Manager.h b/smtk/task/Manager.h index 1aeeec9aee..7e46c7aea7 100644 --- a/smtk/task/Manager.h +++ b/smtk/task/Manager.h @@ -15,10 +15,11 @@ #include "smtk/PublicPointerDefs.h" #include "smtk/SharedFromThis.h" -#include "smtk/common/Instances.h" #include "smtk/common/Managers.h" #include "smtk/common/TypeName.h" +#include "smtk/task/Active.h" +#include "smtk/task/Instances.h" #include "smtk/task/Task.h" #include @@ -45,14 +46,7 @@ public: virtual ~Manager(); /// Managed instances of Task objects (and a registry of Task classes). - using Instances = smtk::common::Instances< - smtk::task::Task, - void, - std::tuple>, - std::tuple< - smtk::task::Task::Configuration&, - smtk::task::Task::PassedDependencies, - std::shared_ptr>>; + using Instances = smtk::task::Instances; /// Return the set of managed task instances. /// @@ -60,12 +54,17 @@ public: Instances& instances() { return m_instances; } const Instances& instances() const { return m_instances; } + /// Return a tracker for the active task. + Active& active() { return m_active; } + const Active& active() const { return m_active; } + /// Return the managers instance that contains this manager, if it exists. smtk::common::Managers::Ptr managers() const { return m_managers.lock(); } void setManagers(const smtk::common::Managers::Ptr& managers) { m_managers = managers; } private: Instances m_instances; + Active m_active; std::weak_ptr m_managers; protected: diff --git a/smtk/task/State.h b/smtk/task/State.h index 182b373bbb..2cd73a0d88 100644 --- a/smtk/task/State.h +++ b/smtk/task/State.h @@ -7,6 +7,7 @@ // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notice for more information. //========================================================================= +/*! \file */ #ifndef smtk_task_State_h #define smtk_task_State_h diff --git a/smtk/task/testing/cxx/CMakeLists.txt b/smtk/task/testing/cxx/CMakeLists.txt index 95610e968a..c2628128fd 100644 --- a/smtk/task/testing/cxx/CMakeLists.txt +++ b/smtk/task/testing/cxx/CMakeLists.txt @@ -1,11 +1,12 @@ set(unit_tests - TestTask + TestActive.cxx + TestTask.cxx ) find_package(Threads REQUIRED) smtk_unit_tests( - Label "task" + LABEL "Task" SOURCES ${unit_tests} LIBRARIES smtkCore ) diff --git a/smtk/task/testing/cxx/TestActive.cxx b/smtk/task/testing/cxx/TestActive.cxx new file mode 100644 index 0000000000..7aa59718c3 --- /dev/null +++ b/smtk/task/testing/cxx/TestActive.cxx @@ -0,0 +1,170 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#include "smtk/attribute/Registrar.h" +#include "smtk/attribute/Resource.h" +#include "smtk/common/Managers.h" +#include "smtk/model/Registrar.h" +#include "smtk/model/Resource.h" +#include "smtk/operation/Manager.h" +#include "smtk/operation/Registrar.h" +#include "smtk/resource/Manager.h" +#include "smtk/resource/Registrar.h" +#include "smtk/task/Manager.h" +#include "smtk/task/Registrar.h" +#include "smtk/task/Task.h" +#include "smtk/task/TaskNeedsResources.h" + +#include "smtk/common/testing/cxx/helpers.h" + +namespace test_task +{ + +using namespace smtk::task; + +} // namespace test_task + +int TestActive(int, char*[]) +{ + using smtk::task::State; + using smtk::task::Task; + + // Create managers + auto managers = smtk::common::Managers::create(); + { + smtk::resource::Registrar::registerTo(managers); + smtk::attribute::Registrar::registerTo(managers); + smtk::operation::Registrar::registerTo(managers); + smtk::task::Registrar::registerTo(managers); + } + + auto resourceManager = managers->get(); + auto operationManager = managers->get(); + auto taskManager = managers->get(); + + { + smtk::attribute::Registrar::registerTo(resourceManager); + smtk::model::Registrar::registerTo(resourceManager); + smtk::task::Registrar::registerTo(taskManager); + } + + std::cout << "Observing changes to active task\n"; + int count = 0; + smtk::task::Task* previousTask = nullptr; + smtk::task::Task* nextTask = nullptr; + auto ikey = taskManager->active().observers().insert( + [&count, &previousTask, &nextTask](smtk::task::Task* prev, smtk::task::Task* next) { + std::cout << " Active task switched " << (prev ? prev->title() : "(none)") << " ⟶ " + << (next ? next->title() : "(none)") << "\n"; + ++count; + previousTask = prev; + nextTask = next; + }, + /* priority */ 0, + /* initialize */ true, + "Observe active task for test"); + test(count == 1, "Expected observer to be initialized upon registration."); + test(previousTask == nullptr && nextTask == nullptr, "Unexpected initialization."); + + { + std::shared_ptr t1 = + taskManager->instances().create(Task::Configuration{ { "title", "Task 1" } }, managers); + std::cout << "Attempting to set active task:\n"; + taskManager->active().switchTo(t1.get()); + test(count == 2, "Expected to switch active task."); + test(previousTask == nullptr && nextTask == t1.get(), "Expected active switch null ⟶ t1."); + + { + std::cout << "Ensuring unmanaged tasks cannot become active.\n"; + std::shared_ptr tmp = Task::create(); + test(!!tmp, "Expected to create unmanaged task."); + tmp->configure(Task::Configuration{ { "title", "Unmanaged Task" } }); + taskManager->active().switchTo(tmp.get()); + test(count == 2, "Should not be able to switch to an unmanaged task."); + } + + bool success = t1->markCompleted(true); + test(count == 2, "Change in task state does not imply active task switch."); + success = t1->markCompleted(false); + + // Now add a task and switch to it. + std::shared_ptr t2 = + taskManager->instances().create(Task::Configuration{ { "title", "Task 2" } }, managers); + success = t1->addDependency(t2); + std::cout << "Switching to task 2:\n"; + taskManager->active().switchTo(t2.get()); + + // Test TaskNeedsResources + // I. Construction w/ configuration. + // The task is incomplete unless 1 or 2 model geometry resources + // and 1 or more simulation attribute resources are held by the + // resource manager. + Task::Configuration c4{ + { "title", "Task 4" }, + { "resources", + { { { "role", "model geometry" }, { "type", "smtk::model::Resource" }, { "max", 2 } }, + { { "role", "simulation attribute" }, { "type", "smtk::attribute::Resource" } } } } + }; + auto t4 = taskManager->instances().create(c4, managers); + t1->addDependency(t4); + std::cout << "Ensuring switches to unavailable tasks fail.\n"; + bool didSwitch = taskManager->active().switchTo(t1.get()); + test(!didSwitch, "Expected to fail switching to an unavailable task."); + test(count == 3, "Did not expect switch to unavailable task."); + + // II. State transitions + bool didAdd; + // Add 3 resources. Addition of the last should cause transition. + auto model1 = smtk::model::Resource::create(); + model1->properties().get()["project_role"] = "model geometry"; + didAdd = resourceManager->add(model1); + test(didAdd, "Expected to add model1 resource."); + auto model2 = smtk::model::Resource::create(); + model2->properties().get()["project_role"] = "model geometry"; + didAdd = resourceManager->add(model2); + test(didAdd, "Expected to add model2 resource."); + auto attr1 = smtk::attribute::Resource::create(); + attr1->properties().get()["project_role"] = "simulation attribute"; + didAdd = resourceManager->add(attr1); + test(didAdd, "Expected to add attr1 resource."); + + t4->markCompleted(true); // We'll test below that completion is reset. + + std::cout << "Ensuring switches to newly-available tasks succeed:\n"; + didSwitch = taskManager->active().switchTo(t1.get()); + test(didSwitch, "Expected to fail switching to an unavailable task."); + test(count == 4, "Expected switch to now-available task."); + test(previousTask == t2.get() && nextTask == t1.get(), "Expected active switch t2 ⟶ t1."); + + bool didRemove; + // Remove 2 resources. Removal of the last should cause active task to reset. + std::cout << "An active task becoming unavailable should reset the active task:\n"; + didRemove = resourceManager->remove(model1); + test(didRemove, "Expected to remove model resource."); + didRemove = resourceManager->remove(attr1); + test(didRemove, "Expected to remove attribute resource."); + test(count == 5, "Expected switch to null task when active task becomes unavailable."); + test(previousTask == t1.get() && nextTask == nullptr, "Expected active switch t1 ⟶ (none)."); + + // Test that user completion is reset by transitions "below" Completeable and back. + std::cout << "Switching to a now-available t1:\n"; + didAdd = resourceManager->add(attr1); + didSwitch = taskManager->active().switchTo(t1.get()); + test(didAdd && didSwitch, "Expected to succeed switching to a now-available task."); + test(count == 6, "Expected switch to now-available task."); + test(previousTask == nullptr && nextTask == t1.get(), "Expected active switch (none) ⟶ t1."); + + std::cout << "Unmanaging the active task should reset the active task:\n"; + taskManager->instances().clear(); + test(count == 7, "Expected switch to null task when a task is dropped from manager."); + test(previousTask == t1.get() && nextTask == nullptr, "Expected active switch t1 ⟶ (none)."); + } + + return 0; +} -- GitLab From 818189fa33aaab44de3b764e41e033d18cc8fce5 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Mon, 14 Jun 2021 09:51:02 -0400 Subject: [PATCH 072/136] Add release note and fix clang-tidy issues --- doc/release/notes/importppg-operation.rst | 16 ++++++++++++++++ doc/userguide/model/ppg-file-format.rst | 7 ++++--- smtk/session/polygon/Registrar.cxx | 8 ++++---- smtk/session/polygon/operators/ImportPPG.cxx | 17 +++++++++-------- smtk/session/polygon/operators/ImportPPG.h | 2 +- smtk/session/polygon/operators/ImportPPG.sbt | 4 ++-- smtk/session/polygon/pybind11/PybindImportPPG.h | 2 +- 7 files changed, 37 insertions(+), 19 deletions(-) create mode 100644 doc/release/notes/importppg-operation.rst diff --git a/doc/release/notes/importppg-operation.rst b/doc/release/notes/importppg-operation.rst new file mode 100644 index 0000000000..83441fb715 --- /dev/null +++ b/doc/release/notes/importppg-operation.rst @@ -0,0 +1,16 @@ +ImportPPG Operation +=================== + +An ``ImportPPG`` operation has been added to the polygon session +for creating model resources from a simple text file input. +The "ppg" (Planar PolyGon) file format is a simple data format +that specifies 2-D geometry as a list of vertex coordinates and +polygon face definitions, with vertices connected implicitly by +straight-line model edges. Documentation is in the "Session: Polygon" +section of the SMTK user guide. + +The ``ImportPPG`` operation is provided as a convenience for exploring +CMB's many capabilities as well as for testing, debug, and demonstration. +To use this feature from modelbuilder, the "File -> New Resource" menu +item now includes an option "Polygon -> Planar Polygon Model from PPG +File". diff --git a/doc/userguide/model/ppg-file-format.rst b/doc/userguide/model/ppg-file-format.rst index 46101f2cf1..dad4a1f05e 100644 --- a/doc/userguide/model/ppg-file-format.rst +++ b/doc/userguide/model/ppg-file-format.rst @@ -5,9 +5,10 @@ The SMTK polygon session includes an ``ImportPPG`` operation for creating 2-D models from text file input. The ``ImportPPG`` operation is provided as a convenience for exploring CMB's many capabilities as well as for testing, debug, and demonstration. -The file format is a simple data-format that specifies 2-D geometry as a -list of vertex positions and polygon face definitions, with vertices -connected by straight-line segments. +The "ppg" (Planar PolyGon) file format is a simple data format +that specifies 2-D geometry as a list of vertex coordinates and +polygon face definitions, with vertices connected implicitly by +straight-line model edges. .. include:: example1.ppg :literal: diff --git a/smtk/session/polygon/Registrar.cxx b/smtk/session/polygon/Registrar.cxx index 6d871c6c50..fc2cf92c5b 100644 --- a/smtk/session/polygon/Registrar.cxx +++ b/smtk/session/polygon/Registrar.cxx @@ -85,8 +85,8 @@ void Registrar::registerTo(const smtk::operation::Manager::Ptr& operationManager // Register operations operationManager->registerOperations(); - // smtk::operation::CreatorGroup(operationManager) - // .registerOperation(); + smtk::operation::CreatorGroup(operationManager) + .registerOperation(); smtk::operation::CreatorGroup(operationManager) .registerOperation(); @@ -111,8 +111,8 @@ void Registrar::unregisterFrom(const smtk::resource::Manager::Ptr& resourceManag void Registrar::unregisterFrom(const smtk::operation::Manager::Ptr& operationManager) { - // smtk::operation::CreatorGroup(operationManager) - // .unregisterOperation(); + smtk::operation::CreatorGroup(operationManager) + .unregisterOperation(); smtk::operation::CreatorGroup(operationManager) .unregisterOperation(); diff --git a/smtk/session/polygon/operators/ImportPPG.cxx b/smtk/session/polygon/operators/ImportPPG.cxx index 886dcc1297..6e1108dc21 100644 --- a/smtk/session/polygon/operators/ImportPPG.cxx +++ b/smtk/session/polygon/operators/ImportPPG.cxx @@ -179,7 +179,7 @@ public: std::cout << "PPG input face count: " << m_ppgFaceList.size() - m_holeCount << std::endl; std::cout << "PPG input hole count: " << m_holeCount << std::endl; - for (auto& ppgFace : m_ppgFaceList) + for (const auto& ppgFace : m_ppgFaceList) { ppgFace.dump(); } @@ -201,7 +201,7 @@ protected: std::vector m_smtkVertexList; // Track vertex-pairs used to make edges, to avoid duplication - std::set> m_ppgVertexPairSet; + std::set> m_ppgVertexPairSet; smtk::model::ResourcePtr m_resource; std::shared_ptr m_modelEntity; @@ -298,8 +298,8 @@ bool ImportPPG::Internal::createEdges() for (std::size_t i = 1; i < vertexIds.size(); ++i) { createOp->parameters()->removeAllAssociations(); - unsigned id1 = vertexIds[i - 1]; - unsigned id2 = vertexIds[i]; + std::size_t id1 = vertexIds[i - 1]; + std::size_t id2 = vertexIds[i]; // Check for duplicate auto pair1 = std::make_pair(id1, id2); @@ -372,7 +372,7 @@ bool ImportPPG::Internal::createFaces() { ++i; const auto& innerPPGFace = m_ppgFaceList[i]; - for (auto& edge : innerPPGFace.edges) + for (const auto& edge : innerPPGFace.edges) { createOp->parameters()->associate(edge); } @@ -511,7 +511,7 @@ bool ImportPPG::Internal::parsePPGVertex(const std::vector& symbols } catch (const std::exception& e) { - errorMacroFalse("Error parsing vertex on line " << lineNum); + errorMacroFalse("Error parsing vertex on line " << lineNum << ": " << e.what()); } auto userId = 1 + m_ppgVertexList.size(); @@ -527,7 +527,7 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, } std::vector vertexIds; - unsigned int vertexId; + std::size_t vertexId; double xsum = 0.0; double ysum = 0.0; for (auto it = symbols.begin() + 1; it != symbols.end(); ++it) @@ -544,7 +544,8 @@ bool ImportPPG::Internal::parsePPGFace(const std::vector& symbols, } catch (const std::exception& e) { - errorMacroFalse("Error parsing vertex id " << s << " in line " << lineNum); + errorMacroFalse( + "Error parsing vertex id " << s << " in line " << lineNum << ": " << e.what()); } if (vertexId == 0) diff --git a/smtk/session/polygon/operators/ImportPPG.h b/smtk/session/polygon/operators/ImportPPG.h index 3d280e3973..3bfdb388c4 100644 --- a/smtk/session/polygon/operators/ImportPPG.h +++ b/smtk/session/polygon/operators/ImportPPG.h @@ -44,7 +44,7 @@ public: // Override ableToOperate() to support test mode bool ableToOperate() override; - virtual ~ImportPPG(); + ~ImportPPG() override; protected: ImportPPG(); diff --git a/smtk/session/polygon/operators/ImportPPG.sbt b/smtk/session/polygon/operators/ImportPPG.sbt index df8284cb27..f2302b6914 100644 --- a/smtk/session/polygon/operators/ImportPPG.sbt +++ b/smtk/session/polygon/operators/ImportPPG.sbt @@ -5,11 +5,11 @@ - + + FileFilters="Planar Polygon Files (*.ppg)"> Input file listing vertex and face specifications. diff --git a/smtk/session/polygon/pybind11/PybindImportPPG.h b/smtk/session/polygon/pybind11/PybindImportPPG.h index f63664a3a7..4ff34a6652 100644 --- a/smtk/session/polygon/pybind11/PybindImportPPG.h +++ b/smtk/session/polygon/pybind11/PybindImportPPG.h @@ -17,7 +17,7 @@ namespace py = pybind11; -PySharedPtrClass< smtk::session::polygon::ImportPPG > pybind11_init_smtk_session_polygon_ImportPPG(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) +inline PySharedPtrClass< smtk::session::polygon::ImportPPG > pybind11_init_smtk_session_polygon_ImportPPG(py::module &m, PySharedPtrClass< smtk::session::polygon::Operation, smtk::operation::XMLOperation >& parent) { PySharedPtrClass< smtk::session::polygon::ImportPPG > instance(m, "ImportPPG", parent); instance -- GitLab From dd314171eaf6d7638317214e5fc8208a4e4140f8 Mon Sep 17 00:00:00 2001 From: Corey Hart Date: Mon, 21 Jun 2021 15:39:59 -0500 Subject: [PATCH 073/136] Check if there is a mainwindow to prevent crash Fixes a crash that occurs when SMTK is initialized without creating a main window. This is mostly applicable when creating unit tests. --- .../plugin/pqSMTKCloseResourceBehavior.cxx | 7 +++++++ .../plugin/pqSMTKExportSimulationBehavior.cxx | 7 +++++++ .../plugin/pqSMTKImportIntoResourceBehavior.cxx | 7 +++++++ .../plugin/pqSMTKImportOperationBehavior.cxx | 7 +++++++ .../plugin/pqSMTKNewResourceBehavior.cxx | 14 ++++++++++++++ .../plugin/pqSMTKSaveResourceBehavior.cxx | 7 +++++++ 6 files changed, 49 insertions(+) diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.cxx index 3226351d15..0038f41cbf 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.cxx @@ -220,6 +220,13 @@ pqSMTKCloseResourceBehavior::pqSMTKCloseResourceBehavior(QObject* parent) QMainWindow* mainWindow = qobject_cast(pqCoreUtilities::mainWidget()); + // Stop here if main window does not exist + // This is typically the case for certain unit tests. + if (!mainWindow) + { + return; + } + QList menuBarActions = mainWindow->menuBar()->actions(); QMenu* menu = nullptr; diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKExportSimulationBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKExportSimulationBehavior.cxx index 0fcf97c7e0..b8119951ae 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKExportSimulationBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKExportSimulationBehavior.cxx @@ -223,6 +223,13 @@ pqSMTKExportSimulationBehavior::pqSMTKExportSimulationBehavior(QObject* parent) QMainWindow* mainWindow = qobject_cast(pqCoreUtilities::mainWidget()); + // Stop here if main window does not exist + // This is typically the case for certain unit tests. + if (!mainWindow) + { + return; + } + QList menuBarActions = mainWindow->menuBar()->actions(); QMenu* menu = nullptr; diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportIntoResourceBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportIntoResourceBehavior.cxx index b725ff43bc..54f2003518 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportIntoResourceBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportIntoResourceBehavior.cxx @@ -218,6 +218,13 @@ pqSMTKImportIntoResourceBehavior::pqSMTKImportIntoResourceBehavior(QObject* pare QMainWindow* mainWindow = qobject_cast(pqCoreUtilities::mainWidget()); + // Stop here if main window does not exist + // This is typically the case for certain unit tests. + if (!mainWindow) + { + return; + } + QList menuBarActions = mainWindow->menuBar()->actions(); QMenu* menu = nullptr; diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportOperationBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportOperationBehavior.cxx index 0ae5817049..521a574738 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportOperationBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportOperationBehavior.cxx @@ -147,6 +147,13 @@ pqSMTKImportOperationBehavior::pqSMTKImportOperationBehavior(QObject* parent) QMainWindow* mainWindow = qobject_cast(pqCoreUtilities::mainWidget()); + // Stop here if main window does not exist + // This is typically the case for certain unit tests. + if (!mainWindow) + { + return; + } + QList menuBarActions = mainWindow->menuBar()->actions(); QMenu* menu = nullptr; diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.cxx index 96e3aad5d0..e2d6bce02b 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.cxx @@ -164,6 +164,13 @@ pqSMTKNewResourceBehavior::pqSMTKNewResourceBehavior(QObject* parent) { QMenu* fileMenu = this->fileMenu(); + // If no main window exists, then there would be no + // file menu. Stop here if this is the case. + if (fileMenu == nullptr) + { + return; + } + // We want to defer the creation of the menu actions as much as possible // so the File menu will already be populated by the time we add our // custom actions. If our actions are inserted first, there is no way to @@ -213,6 +220,13 @@ QMenu* pqSMTKNewResourceBehavior::fileMenu() { QMainWindow* mainWindow = qobject_cast(pqCoreUtilities::mainWidget()); + // Stop here if main window does not exist + // This is typically the case for certain unit tests. + if (!mainWindow) + { + return nullptr; + } + QList menuBarActions = mainWindow->menuBar()->actions(); QMenu* menu = nullptr; diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKSaveResourceBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKSaveResourceBehavior.cxx index 6c3d8b1750..de9c73dfb1 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKSaveResourceBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKSaveResourceBehavior.cxx @@ -296,6 +296,13 @@ pqSMTKSaveResourceBehavior::pqSMTKSaveResourceBehavior(QObject* parent) QMainWindow* mainWindow = qobject_cast(pqCoreUtilities::mainWidget()); + // Stop here if main window does not exist + // This is typically the case for certain unit tests. + if (!mainWindow) + { + return; + } + QList menuBarActions = mainWindow->menuBar()->actions(); QMenu* menu = nullptr; -- GitLab From b934ebebfc1faffa13f1300c33ce10d1e3712799 Mon Sep 17 00:00:00 2001 From: Ryan Krattiger Date: Wed, 23 Jun 2021 14:20:44 -0500 Subject: [PATCH 074/136] Fix warning when compiling query test --- smtk/resource/testing/cxx/TestQuery.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/smtk/resource/testing/cxx/TestQuery.cxx b/smtk/resource/testing/cxx/TestQuery.cxx index 8fa20eb3a3..93c22f6729 100644 --- a/smtk/resource/testing/cxx/TestQuery.cxx +++ b/smtk/resource/testing/cxx/TestQuery.cxx @@ -50,7 +50,7 @@ int TestQuery(int /*unused*/, char** const /*unused*/) test(factory.registerQuery(), "Could not register QueryA"); { std::unique_ptr queryA = factory.create(); - test(fabs(queryA->foo() - QueryA().foo()) < EPSILON, "Unexpected query result"); + test(std::abs(queryA->foo() - QueryA().foo()) < EPSILON, "Unexpected query result"); } test(factory.unregisterQuery(), "Could not unregister QueryA"); @@ -64,26 +64,26 @@ int TestQuery(int /*unused*/, char** const /*unused*/) { std::unique_ptr queryB = factory.create(); test(queryB != nullptr, "Could not create an instance of QueryB"); - test(fabs(queryB->foo() - QueryB().foo()) < EPSILON, "Unexpected query result"); - test(fabs(queryB->bar() - QueryB().bar()) < EPSILON, "Unexpected query result"); + test(std::abs(queryB->foo() - QueryB().foo()) < EPSILON, "Unexpected query result"); + test(std::abs(queryB->bar() - QueryB().bar()) < EPSILON, "Unexpected query result"); } test(factory.registerQuery(), "Could not register QueryA"); { std::unique_ptr queryA = factory.create(); - test(fabs(queryA->foo() - QueryA().foo()) < EPSILON, "Unexpected query result"); + test(std::abs(queryA->foo() - QueryA().foo()) < EPSILON, "Unexpected query result"); } test(factory.registerQuery(), "Could not register QueryC"); { std::unique_ptr queryC = factory.create(); - test(fabs(queryC->foo() - QueryC().foo()) < EPSILON, "Unexpected query result"); + test(std::abs(queryC->foo() - QueryC().foo()) < EPSILON, "Unexpected query result"); } test(factory.registerQuery(), "Could not register QueryD"); { std::unique_ptr queryD = factory.create(); - test(fabs(queryD->foo() - QueryD().foo()) < EPSILON, "Unexpected query result"); + test(std::abs(queryD->foo() - QueryD().foo()) < EPSILON, "Unexpected query result"); } return 0; -- GitLab From 04b7c9693dad856f00fd89bc803f615fcdfe9870 Mon Sep 17 00:00:00 2001 From: Ryan Krattiger Date: Fri, 25 Jun 2021 10:50:23 -0500 Subject: [PATCH 075/136] doc: convert python 2to3 --- doc/conf.py | 26 +++++++++---------- .../python_first_steps/first_steps.py | 8 +++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 754eb561f8..4042d9b271 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -11,7 +11,7 @@ # # All configuration values have a default; values that are commented out # serve to show the default. -from __future__ import print_function + import sys import os @@ -161,9 +161,9 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'SMTK' +project = 'SMTK' year = datetime.datetime.now().year -copyright = u'%d, Kitware, Inc.' % year +copyright = '%d, Kitware, Inc.' % year def readVersionInfo(srcdir): @@ -314,7 +314,7 @@ else: # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". # html_title = None -html_title = u'SMTK: Simulation Modeling Tool Kit, v1.0' +html_title = 'SMTK: Simulation Modeling Tool Kit, v1.0' # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None @@ -400,8 +400,8 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'SMTK.tex', u'SMTK Documentation', - u'Kitware, Inc.', 'manual'), + ('index', 'SMTK.tex', 'SMTK Documentation', + 'Kitware, Inc.', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -430,8 +430,8 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'smtk', u'SMTK Documentation', - [u'Kitware, Inc.'], 1) + ('index', 'smtk', 'SMTK Documentation', + ['Kitware, Inc.'], 1) ] # If true, show URL addresses after external links. @@ -444,8 +444,8 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'SMTK', u'SMTK Documentation', - u'Kitware, Inc.', 'SMTK', 'One line description of project.', + ('index', 'SMTK', 'SMTK Documentation', + 'Kitware, Inc.', 'SMTK', 'One line description of project.', 'Miscellaneous'), ] @@ -464,9 +464,9 @@ texinfo_documents = [ # -- Options for Epub output ---------------------------------------------- # Bibliographic Dublin Core info. -epub_title = u'SMTK: Simulation Modeling Tool Kit' -epub_author = u'Kitware, Inc.' -epub_publisher = u'Kitware, Inc.' +epub_title = 'SMTK: Simulation Modeling Tool Kit' +epub_author = 'Kitware, Inc.' +epub_publisher = 'Kitware, Inc.' epub_copyright = copyright # The basename for the epub file. It defaults to the project name. diff --git a/doc/tutorials/python_first_steps/first_steps.py b/doc/tutorials/python_first_steps/first_steps.py index e2efa08530..85228be2a1 100755 --- a/doc/tutorials/python_first_steps/first_steps.py +++ b/doc/tutorials/python_first_steps/first_steps.py @@ -101,10 +101,10 @@ models = mmgr.findEntitiesByProperty('name', 'Test Model') model = smtk.model.Model(models[0]) groups = model.groups() if groups and len(groups): - wallGroup = (g for g in groups if g.name() == 'wall').next() - inletGroup = (g for g in groups if g.name() == 'inlet').next() - outletGroup = (g for g in groups if g.name() == 'outlet').next() - fluidGroup = (g for g in groups if g.name() == 'fluid').next() + wallGroup = next((g for g in groups if g.name() == 'wall')) + inletGroup = next((g for g in groups if g.name() == 'inlet')) + outletGroup = next((g for g in groups if g.name() == 'outlet')) + fluidGroup = next((g for g in groups if g.name() == 'fluid')) fluidIC.associateEntity(fluidGroup) outletBC.associateEntity(outletGroup) -- GitLab From 498a989352fb96ded01740faf60f1db6f8e7e5ec Mon Sep 17 00:00:00 2001 From: Robert O'Bara Date: Wed, 23 Jun 2021 18:01:25 -0400 Subject: [PATCH 076/136] ENH: Added the ability to do non-unique appends to a ReferenceItem The instance also now tracks the location of the first unset value. --- .../notes/referenceItemAppendBehavior.rst | 5 ++ smtk/attribute/ReferenceItem.cxx | 73 +++++++++++++++---- smtk/attribute/ReferenceItem.h | 35 ++++++++- smtk/attribute/pybind11/PybindReferenceItem.h | 6 +- 4 files changed, 96 insertions(+), 23 deletions(-) create mode 100644 doc/release/notes/referenceItemAppendBehavior.rst diff --git a/doc/release/notes/referenceItemAppendBehavior.rst b/doc/release/notes/referenceItemAppendBehavior.rst new file mode 100644 index 0000000000..a22efec8e2 --- /dev/null +++ b/doc/release/notes/referenceItemAppendBehavior.rst @@ -0,0 +1,5 @@ +Changing ReferenceItem::AppendValue to Support Append Non-Unique +============================================ +* Added a nonUnique parameter that defaults to false +* This avoids unnecessarily having to scan the entire item when duplicates are allowed +* Item now also tracks the location of the first unset value in order to speed up the append process diff --git a/smtk/attribute/ReferenceItem.cxx b/smtk/attribute/ReferenceItem.cxx index 36dd7cc6f9..c080179c3e 100644 --- a/smtk/attribute/ReferenceItem.cxx +++ b/smtk/attribute/ReferenceItem.cxx @@ -212,6 +212,7 @@ ReferenceItem::ReferenceItem(Attribute* owningAttribute, int itemPosition) , m_referencedAttribute(owningAttribute->shared_from_this()) , m_cache(new Cache()) , m_currentConditional(ReferenceItemDefinition::s_invalidIndex) + , m_nextUnsetPos(-1) { } @@ -221,6 +222,7 @@ ReferenceItem::ReferenceItem(Item* inOwningItem, int itemPosition, int mySubGrou , m_referencedAttribute(inOwningItem->attribute()) , m_cache(new Cache()) , m_currentConditional(ReferenceItemDefinition::s_invalidIndex) + , m_nextUnsetPos(-1) { } @@ -229,6 +231,7 @@ ReferenceItem::ReferenceItem(const ReferenceItem& referenceItem) , m_referencedAttribute(referenceItem.m_referencedAttribute) , m_cache(new Cache(*referenceItem.m_cache)) , m_currentConditional(ReferenceItemDefinition::s_invalidIndex) + , m_nextUnsetPos(-1) { } @@ -237,6 +240,7 @@ ReferenceItem& ReferenceItem::operator=(const ReferenceItem& referenceItem) Item::operator=(referenceItem); m_referencedAttribute = referenceItem.m_referencedAttribute; m_cache.reset(new ReferenceItem::Cache(*(referenceItem.m_cache))); + m_nextUnsetPos = referenceItem.m_nextUnsetPos; return *this; } @@ -315,7 +319,8 @@ std::size_t ReferenceItem::numberOfValues() const bool ReferenceItem::setNumberOfValues(std::size_t newSize) { // If the current size is the same just return - if (this->numberOfValues() == newSize) + std::size_t currentSize = this->numberOfValues(); + if (currentSize == newSize) { return true; } @@ -334,6 +339,11 @@ bool ReferenceItem::setNumberOfValues(std::size_t newSize) if (n > 0 && newSize > n) return false; // The number of values requested is too large. + // Are we introducing any unset values? + if ((currentSize < newSize) && (m_nextUnsetPos > (currentSize + 1))) + { + m_nextUnsetPos = currentSize + 1; + } m_keys.resize(newSize); m_cache->resize(newSize); return true; @@ -570,6 +580,25 @@ bool ReferenceItem::setValue(std::size_t i, const PersistentObjectPtr& val) } assignToCache(i, val); + // Did we set a Null Value? + if ((val == nullptr) && (m_nextUnsetPos > i)) + { + m_nextUnsetPos = i; + } + else if ((val != nullptr) && (i == m_nextUnsetPos)) + { + // We need to scan for the next unset value + m_nextUnsetPos = -1; + std::size_t numVals = this->numberOfValues(); + for (size_t j = i + 1; j < numVals; j++) + { + if (!this->isSet(j)) + { + m_nextUnsetPos = j; + break; + } + } + } // Update the active children if this is a single value item if ((!def->isExtensible()) && (def->numberOfRequiredValues() == 1)) { @@ -578,7 +607,7 @@ bool ReferenceItem::setValue(std::size_t i, const PersistentObjectPtr& val) return true; } -bool ReferenceItem::appendValue(const PersistentObjectPtr& val) +bool ReferenceItem::appendValue(const PersistentObjectPtr& val, bool allowDuplicates) { // First - is this value valid? const auto* def = static_cast(this->definition().get()); @@ -587,26 +616,25 @@ bool ReferenceItem::appendValue(const PersistentObjectPtr& val) return false; } - // Second - is the value already in the item? - std::size_t emptyIndex, n = this->numberOfValues(); - bool foundEmpty = false; - for (std::size_t i = 0; i < n; ++i) + // Next - are we doing an append unique? + if (!allowDuplicates) { - if (this->isSet(i) && (this->value(i) == val)) - { - return true; - } - if (!this->isSet(i)) + std::size_t n = this->numberOfValues(); + for (std::size_t i = 0; i < n; ++i) { - foundEmpty = true; - emptyIndex = i; + if (this->isSet(i) && (this->value(i) == val)) + { + return true; + } } } - // If not, was there a space available? - if (foundEmpty) + + // Do we have an unset value location? + if (m_nextUnsetPos < std::size_t(-1)) { - return this->setValue(emptyIndex, val); + return this->setValue(m_nextUnsetPos, val); } + // Finally - are we allowed to change the number of values? if ( (def->isExtensible() && def->maxNumberOfValues() && @@ -641,6 +669,13 @@ bool ReferenceItem::removeValue(std::size_t i) { return false; // i can't be greater than the number of values } + + // Will removing this value shift the next unset value position? + if ((m_nextUnsetPos < std::size_t(-1)) && (m_nextUnsetPos > i)) + { + --m_nextUnsetPos; + } + myAtt->guardedLinks()->removeLink(m_keys[i]); m_keys.erase(m_keys.begin() + i); (*m_cache).erase((*m_cache).begin() + i); @@ -691,6 +726,11 @@ void ReferenceItem::reset() { m_keys.resize(this->numberOfRequiredValues()); (*m_cache).resize(this->numberOfRequiredValues()); + m_nextUnsetPos = 0; + } + else + { + m_nextUnsetPos = -1; } } @@ -860,6 +900,7 @@ bool ReferenceItem::setDefinition(smtk::attribute::ConstItemDefinitionPtr adef) { m_keys.resize(n); m_cache->resize(n); + m_nextUnsetPos = 0; } // Build the item's children def->buildChildrenItems(this); diff --git a/smtk/attribute/ReferenceItem.h b/smtk/attribute/ReferenceItem.h index 29f2e1410b..3e4068bea3 100644 --- a/smtk/attribute/ReferenceItem.h +++ b/smtk/attribute/ReferenceItem.h @@ -255,7 +255,8 @@ public: template bool appendValuesVia(I vbegin, I vend, const T& converter); - /**\brief Add \a val if it is allowed and \a val is not already present in the item. + /**\brief Add \a val if it is allowed and \a val is not already present in the item + * unless allowDuplicates is true. * * This will **not** enable the item if it is disabled. * @@ -263,7 +264,7 @@ public: * if there is an unset value anywhere in the allocated array, that will * be preferred to reallocation. */ - bool appendValue(const PersistentObjectPtr& val); + bool appendValue(const PersistentObjectPtr& val, bool allowDuplicates = false); /**\brief Remove the value at the \a i-th location. * * If the number of values may not be changed, then the \a i-th @@ -433,6 +434,9 @@ private: std::vector m_activeChildrenItems; /// Index of the current active conditional std::size_t m_currentConditional; + /// Indicates where the next Null location is. If set to -1 then + /// there are no null locations in the item. + std::size_t m_nextUnsetPos; }; template<> @@ -450,20 +454,34 @@ bool ReferenceItem::setValues( if (this->setNumberOfValues(num)) { ok = true; + std::size_t firstUnsetPos = -1; std::size_t i = 0; for (I it = vbegin; it != vend; ++it, ++i) { if (!iteratorIsSet(it)) { + if (firstUnsetPos > (offset + i)) + { + firstUnsetPos = offset + i; + } continue; } if (!this->setValue(offset + i, *it)) { + // This value is also now unset + if (firstUnsetPos > (offset + i)) + { + firstUnsetPos = offset + i; + } ok = false; break; } } + if (m_nextUnsetPos > firstUnsetPos) + { + m_nextUnsetPos = firstUnsetPos; + } } // Enable or disable the item if it is optional. if (ok) @@ -492,19 +510,32 @@ bool ReferenceItem::setValuesVia( { ok = true; std::size_t i = 0; + std::size_t firstUnsetPos = -1; for (I it = vbegin; it != vend; ++it, ++i) { if (!iteratorIsSet(it)) { + if (firstUnsetPos > (offset + i)) + { + firstUnsetPos = offset + i; + } continue; } if (!this->setValue(offset + i, converter(*it))) { + if (firstUnsetPos > (offset + i)) + { + firstUnsetPos = offset + i; + } ok = false; break; } } + if (m_nextUnsetPos > firstUnsetPos) + { + m_nextUnsetPos = firstUnsetPos; + } } // Enable or disable the item if it is optional. if (ok) diff --git a/smtk/attribute/pybind11/PybindReferenceItem.h b/smtk/attribute/pybind11/PybindReferenceItem.h index 589fa20d54..7db3db0b20 100644 --- a/smtk/attribute/pybind11/PybindReferenceItem.h +++ b/smtk/attribute/pybind11/PybindReferenceItem.h @@ -24,8 +24,7 @@ inline PySharedPtrClass< smtk::attribute::ReferenceItem, smtk::attribute::Item > .def(py::init<::smtk::attribute::ReferenceItem const &>()) .def("deepcopy", (smtk::attribute::ReferenceItem & (smtk::attribute::ReferenceItem::*)(::smtk::attribute::ReferenceItem const &)) &smtk::attribute::ReferenceItem::operator=) .def("_activeChildItem", &smtk::attribute::ReferenceItem::activeChildItem, py::arg("i")) - .def("appendValue", &smtk::attribute::ReferenceItem::appendValue, py::arg("val")) - .def("appendObjectValue", &smtk::attribute::ReferenceItem::appendValue, py::arg("val")) + .def("appendValue", &smtk::attribute::ReferenceItem::appendValue, py::arg("val"), py::arg("allowDuplicates") = true) .def("assign", &smtk::attribute::ReferenceItem::assign, py::arg("sourceItem"), py::arg("options") = 0) .def("begin", &smtk::attribute::ReferenceItem::begin) .def("childrenItems", &smtk::attribute::ReferenceItem::childrenItems) @@ -48,13 +47,10 @@ inline PySharedPtrClass< smtk::attribute::ReferenceItem, smtk::attribute::Item > .def("numberOfChildrenItems", &smtk::attribute::ReferenceItem::numberOfChildrenItems) .def("numberOfRequiredValues", &smtk::attribute::ReferenceItem::numberOfRequiredValues) .def("numberOfValues", &smtk::attribute::ReferenceItem::numberOfValues) - .def("objectValue", (smtk::resource::PersistentObjectPtr (smtk::attribute::ReferenceItem::*)(std::size_t) const) &smtk::attribute::ReferenceItem::value, py::arg("i") = 0) .def("value", (smtk::resource::PersistentObjectPtr (smtk::attribute::ReferenceItem::*)(std::size_t) const) &smtk::attribute::ReferenceItem::value, py::arg("i") = 0) .def("removeValue", &smtk::attribute::ReferenceItem::removeValue, py::arg("i")) .def("reset", &smtk::attribute::ReferenceItem::reset) .def("setNumberOfValues", &smtk::attribute::ReferenceItem::setNumberOfValues, py::arg("newSize")) - .def("setObjectValue", (bool (smtk::attribute::ReferenceItem::*)(const ::smtk::resource::PersistentObjectPtr&)) &smtk::attribute::ReferenceItem::setValue, py::arg("val")) - .def("setObjectValue", (bool (smtk::attribute::ReferenceItem::*)(::size_t, const ::smtk::resource::PersistentObjectPtr&)) &smtk::attribute::ReferenceItem::setValue, py::arg("i"), py::arg("val")) .def("setValue", (bool (smtk::attribute::ReferenceItem::*)(const ::smtk::resource::PersistentObjectPtr&)) &smtk::attribute::ReferenceItem::setValue, py::arg("val")) .def("setValue", (bool (smtk::attribute::ReferenceItem::*)(::size_t, const ::smtk::resource::PersistentObjectPtr&)) &smtk::attribute::ReferenceItem::setValue, py::arg("i"), py::arg("val")) .def("type", &smtk::attribute::ReferenceItem::type) -- GitLab From d284b9a19241fe8d5ff1d7f0c3e6fa6afcfcb4bc Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 29 Jun 2021 16:28:16 -0400 Subject: [PATCH 077/136] cmake: remove unused files These are no longer used in the new SMTK build (since it was ported to use the new VTK module system). --- CMake/InitializePlugins.cxx.in | 83 ---------------------------------- CMake/InitializePlugins.h.in | 27 ----------- CMake/plugins.xml.in | 4 -- CMakeLists.txt | 3 -- 4 files changed, 117 deletions(-) delete mode 100644 CMake/InitializePlugins.cxx.in delete mode 100644 CMake/InitializePlugins.h.in delete mode 100644 CMake/plugins.xml.in diff --git a/CMake/InitializePlugins.cxx.in b/CMake/InitializePlugins.cxx.in deleted file mode 100644 index c86e9c30e6..0000000000 --- a/CMake/InitializePlugins.cxx.in +++ /dev/null @@ -1,83 +0,0 @@ -//========================================================================= -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -//========================================================================= - -#include "Initialize@PLUGIN_LIBRARY_TARGET@.h" - -#include "vtkPVPlugin.h" -#include "vtkPVPluginLoader.h" - -#include "vtkPVPluginTracker.h" - -#include - -@SMTK_PLUGIN_IMPORT_INIT@ - -namespace -{ -bool queryPlugins(const char* name, bool load); - -bool loadPlugins(const char* name) -{ - return queryPlugins(name, true); -} - -bool searchPlugins(const char* name) -{ - return queryPlugins(name, false); -} -} - -namespace smtk -{ -namespace extension -{ -namespace paraview -{ -void initialize@PLUGIN_LIBRARY_TARGET@() -{ - vtkPVPluginLoader::RegisterLoadPluginCallback(loadPlugins); - vtkPVPluginTracker::SetStaticPluginSearchFunction(searchPlugins); -} - -void load@PLUGIN_LIBRARY_TARGET@() -{ -@SMTK_PLUGIN_IMPORT@ -} -} -} -} - -namespace -{ -bool queryPlugins(const char* name, bool load) -{ - std::string sname = name; - -#define queryPlugin(plugin_name) \ - if (sname == #plugin_name) \ - { \ - if (load) \ - { \ - static bool loaded = false; \ - if (!loaded) \ - { \ - loaded = PV_PLUGIN_IMPORT(plugin_name); \ - } \ - } \ - return true; \ - } - -@SMTK_PLUGIN_QUERY@ - -#undef queryPlugin - - return false; -} -} diff --git a/CMake/InitializePlugins.h.in b/CMake/InitializePlugins.h.in deleted file mode 100644 index d95795dfb7..0000000000 --- a/CMake/InitializePlugins.h.in +++ /dev/null @@ -1,27 +0,0 @@ -//========================================================================= -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -//========================================================================= -#ifndef __smtk_@PLUGIN_LIBRARY_TARGET@_InitializePlugins_h -#define __smtk_@PLUGIN_LIBRARY_TARGET@_InitializePlugins_h - -#include "@PLUGIN_LIBRARY_TARGET@Export.h" - -namespace smtk -{ -namespace extension -{ -namespace paraview -{ -@SMTK_PLUGIN_LIBRARY_EXPORT@ void initialize@PLUGIN_LIBRARY_TARGET@(); -@SMTK_PLUGIN_LIBRARY_EXPORT@ void load@PLUGIN_LIBRARY_TARGET@(); -} -} -} - -#endif diff --git a/CMake/plugins.xml.in b/CMake/plugins.xml.in deleted file mode 100644 index 00f51f3ae6..0000000000 --- a/CMake/plugins.xml.in +++ /dev/null @@ -1,4 +0,0 @@ - - - @SMTK_PLUGINS_FILE_CONTENTS@ - diff --git a/CMakeLists.txt b/CMakeLists.txt index b4f900a27a..62910de680 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -615,9 +615,6 @@ install( FILES ${PROJECT_SOURCE_DIR}/CMake/SMTKMacros.cmake ${PROJECT_SOURCE_DIR}/CMake/EncodeStringFunctions.cmake - ${PROJECT_SOURCE_DIR}/CMake/InitializePlugins.cxx.in - ${PROJECT_SOURCE_DIR}/CMake/InitializePlugins.h.in - ${PROJECT_SOURCE_DIR}/CMake/plugins.xml.in ${PROJECT_SOURCE_DIR}/CMake/SMTKOperationXML.cmake ${PROJECT_SOURCE_DIR}/CMake/SMTKPluginMacros.cmake ${PROJECT_SOURCE_DIR}/CMake/serverSource.cxx.in -- GitLab From 8b1e0a5bf4b9a085bc8944a4643c751a27d03308 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 29 Jun 2021 16:28:48 -0400 Subject: [PATCH 078/136] cmake: remove duplicate install rules All of these files are handled in `CMake/SMTKInstallCMakePackage.cmake` now. --- CMakeLists.txt | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 62910de680..7ccb997f82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -599,29 +599,6 @@ install (FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}/Options.h DESTINATION include/${PROJECT_NAME}/${SMTK_VERSION}/smtk) -################################################################################ -# Install Related Settings -################################################################################ - -# Copy file needed by SMTKPluginMacros.cmake into the build directory so -# consuming projects can build against SMTK's build tree -configure_file( - ${PROJECT_SOURCE_DIR}/CMake/serverSource.cxx.in - ${PROJECT_BINARY_DIR}/serverSource.cxx.in - COPYONLY) - -# Install rules for SMTK macros usable by external packages: -install( - FILES - ${PROJECT_SOURCE_DIR}/CMake/SMTKMacros.cmake - ${PROJECT_SOURCE_DIR}/CMake/EncodeStringFunctions.cmake - ${PROJECT_SOURCE_DIR}/CMake/SMTKOperationXML.cmake - ${PROJECT_SOURCE_DIR}/CMake/SMTKPluginMacros.cmake - ${PROJECT_SOURCE_DIR}/CMake/serverSource.cxx.in - DESTINATION - ${SMTK_INSTALL_CONFIG_DIR} -) - ################################################################################ # Include Dirs Settings ################################################################################ -- GitLab From 64268d5fcddca7e01e1163f4051016261ada3173 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 29 Jun 2021 17:55:52 -0400 Subject: [PATCH 079/136] paraview: replace timers with handlers for application startup ParaView now sends out a signal once it has set up the client environment enough for plugins to start poking around in the main window and adding any widgets or connections that are necessary for their usage. --- .../plugin/pqSMTKCloseResourceBehavior.cxx | 14 ++++++-------- .../pqSMTKCloseWithActiveOperationBehavior.cxx | 15 ++++++--------- .../plugin/pqSMTKExportSimulationBehavior.cxx | 14 ++++++-------- .../plugin/pqSMTKImportIntoResourceBehavior.cxx | 14 ++++++-------- .../plugin/pqSMTKImportOperationBehavior.cxx | 14 ++++++-------- .../plugin/pqSMTKNewResourceBehavior.cxx | 14 ++++++-------- .../pqSMTKSaveOnCloseResourceBehavior.cxx | 17 ++++++----------- .../plugin/pqSMTKSaveResourceBehavior.cxx | 17 ++++++----------- smtk/project/plugin/pqSMTKProjectMenu.cxx | 14 ++++++-------- 9 files changed, 54 insertions(+), 79 deletions(-) diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.cxx index 0038f41cbf..ba4541df94 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseResourceBehavior.cxx @@ -207,12 +207,10 @@ pqSMTKCloseResourceBehavior::pqSMTKCloseResourceBehavior(QObject* parent) { initCloseResourceBehaviorResources(); - // Wait until the event loop starts, ensuring that the main window will be - // accessible. - QTimer::singleShot(0, this, [this]() { - auto* pqCore = pqApplicationCore::instance(); - if (pqCore) - { + auto* pqCore = pqApplicationCore::instance(); + if (pqCore) + { + QObject::connect(pqCore, &pqApplicationCore::clientEnvironmentDone, [this]() { QAction* closeResourceAction = new QAction(QPixmap(":/CloseResourceBehavior/Close22.png"), tr("&Close Resource"), this); closeResourceAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W)); @@ -277,8 +275,8 @@ pqSMTKCloseResourceBehavior::pqSMTKCloseResourceBehavior(QObject* parent) mainWindow->menuBar()->insertMenu(::findHelpMenuAction(mainWindow->menuBar()), menu); } new pqCloseResourceReaction(closeResourceAction); - } - }); + }); + } } pqSMTKCloseResourceBehavior* pqSMTKCloseResourceBehavior::instance(QObject* parent) diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseWithActiveOperationBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseWithActiveOperationBehavior.cxx index 17cb13cbd2..721a8b3fac 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseWithActiveOperationBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKCloseWithActiveOperationBehavior.cxx @@ -60,13 +60,10 @@ pqSMTKCloseWithActiveOperationBehavior::pqSMTKCloseWithActiveOperationBehavior(Q // Wait until the event loop starts, ensuring that the main window will be // accessible. - QTimer::singleShot(0, this, []() { - // Blech: pqApplicationCore doesn't have the selection manager yet, - // so wait until we hear that the server is ready to make the connection. - // We can't have a selection before the first connection, anyway. - auto* pqCore = pqApplicationCore::instance(); - if (pqCore) - { + auto* pqCore = pqApplicationCore::instance(); + if (pqCore) + { + QObject::connect(pqCore, &pqApplicationCore::clientEnvironmentDone, [this]() { // This functor is connected to the main window's "close" signal, and // it allows the user to cancel the close if there is an active operation. QObject::connect( @@ -83,8 +80,8 @@ pqSMTKCloseWithActiveOperationBehavior::pqSMTKCloseWithActiveOperationBehavior(Q closeEvent->ignore(); } }); - } - }); + }); + } } void pqSMTKCloseWithActiveOperationBehavior::trackActiveOperations( diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKExportSimulationBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKExportSimulationBehavior.cxx index b8119951ae..10e0baed71 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKExportSimulationBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKExportSimulationBehavior.cxx @@ -213,12 +213,10 @@ static pqSMTKExportSimulationBehavior* g_instance = nullptr; pqSMTKExportSimulationBehavior::pqSMTKExportSimulationBehavior(QObject* parent) : Superclass(parent) { - // Wait until the event loop starts, ensuring that the main window will be - // accessible. - QTimer::singleShot(0, this, [this]() { - auto* pqCore = pqApplicationCore::instance(); - if (pqCore) - { + auto* pqCore = pqApplicationCore::instance(); + if (pqCore) + { + QObject::connect(pqCore, &pqApplicationCore::clientEnvironmentDone, [this]() { QAction* exportSimulationAction = new QAction(tr("&Export Simulation..."), this); QMainWindow* mainWindow = qobject_cast(pqCoreUtilities::mainWidget()); @@ -288,8 +286,8 @@ pqSMTKExportSimulationBehavior::pqSMTKExportSimulationBehavior(QObject* parent) mainWindow->menuBar()->insertMenu(::findHelpMenuAction(mainWindow->menuBar()), menu); } new pqExportSimulationReaction(exportSimulationAction); - } - }); + }); + } } pqSMTKExportSimulationBehavior* pqSMTKExportSimulationBehavior::instance(QObject* parent) diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportIntoResourceBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportIntoResourceBehavior.cxx index 54f2003518..81b3747f9f 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportIntoResourceBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportIntoResourceBehavior.cxx @@ -207,12 +207,10 @@ static pqSMTKImportIntoResourceBehavior* g_instance = nullptr; pqSMTKImportIntoResourceBehavior::pqSMTKImportIntoResourceBehavior(QObject* parent) : Superclass(parent) { - // Wait until the event loop starts, ensuring that the main window will be - // accessible. - QTimer::singleShot(0, this, [this]() { - auto* pqCore = pqApplicationCore::instance(); - if (pqCore) - { + auto* pqCore = pqApplicationCore::instance(); + if (pqCore) + { + QObject::connect(pqCore, &pqApplicationCore::clientEnvironmentDone, [this]() { QAction* importIntoResourceAction = new QAction(tr("&Import Into Resource..."), this); importIntoResourceAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I)); @@ -275,8 +273,8 @@ pqSMTKImportIntoResourceBehavior::pqSMTKImportIntoResourceBehavior(QObject* pare mainWindow->menuBar()->insertMenu(::findHelpMenuAction(mainWindow->menuBar()), menu); } new pqImportIntoResourceReaction(importIntoResourceAction); - } - }); + }); + } } pqSMTKImportIntoResourceBehavior* pqSMTKImportIntoResourceBehavior::instance(QObject* parent) diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportOperationBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportOperationBehavior.cxx index 521a574738..dbf658b24b 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportOperationBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKImportOperationBehavior.cxx @@ -136,12 +136,10 @@ pqSMTKImportOperationBehavior::pqSMTKImportOperationBehavior(QObject* parent) { initImportOperationBehaviorResources(); - // Wait until the event loop starts, ensuring that the main window will be - // accessible. - QTimer::singleShot(0, this, [this]() { - auto* pqCore = pqApplicationCore::instance(); - if (pqCore) - { + auto* pqCore = pqApplicationCore::instance(); + if (pqCore) + { + QObject::connect(pqCore, &pqApplicationCore::clientEnvironmentDone, [this]() { QAction* importOperationAction = new QAction( QPixmap(":/ImportOperationBehavior/python-28x28.png"), tr("&Import Operation..."), this); @@ -212,8 +210,8 @@ pqSMTKImportOperationBehavior::pqSMTKImportOperationBehavior(QObject* parent) mainWindow->menuBar()->insertMenu(::findHelpMenuAction(mainWindow->menuBar()), menu); } new pqImportOperationReaction(importOperationAction); - } - }); + }); + } } pqSMTKImportOperationBehavior* pqSMTKImportOperationBehavior::instance(QObject* parent) diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.cxx index e2d6bce02b..d1119d1afd 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKNewResourceBehavior.cxx @@ -156,12 +156,10 @@ static pqSMTKNewResourceBehavior* g_instance = nullptr; pqSMTKNewResourceBehavior::pqSMTKNewResourceBehavior(QObject* parent) : Superclass(parent) { - // Wait until the event loop starts, ensuring that the main window will be - // accessible. - QTimer::singleShot(0, this, [this]() { - auto* pqCore = pqApplicationCore::instance(); - if (pqCore) - { + auto* pqCore = pqApplicationCore::instance(); + if (pqCore) + { + QObject::connect(pqCore, &pqApplicationCore::clientEnvironmentDone, [this]() { QMenu* fileMenu = this->fileMenu(); // If no main window exists, then there would be no @@ -212,8 +210,8 @@ pqSMTKNewResourceBehavior::pqSMTKNewResourceBehavior(QObject* parent) // Access the creator group. auto creatorGroup = smtk::operation::CreatorGroup(wrapper->smtkOperationManager()); } - } - }); + }); + } } QMenu* pqSMTKNewResourceBehavior::fileMenu() diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKSaveOnCloseResourceBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKSaveOnCloseResourceBehavior.cxx index 94e4a1c663..9f7322475c 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKSaveOnCloseResourceBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKSaveOnCloseResourceBehavior.cxx @@ -48,15 +48,10 @@ static pqSMTKSaveOnCloseResourceBehavior* g_instance = nullptr; pqSMTKSaveOnCloseResourceBehavior::pqSMTKSaveOnCloseResourceBehavior(QObject* parent) : Superclass(parent) { - // Wait until the event loop starts, ensuring that the main window will be - // accessible. - QTimer::singleShot(0, this, []() { - // Blech: pqApplicationCore doesn't have the selection manager yet, - // so wait until we hear that the server is ready to make the connection. - // We can't have a selection before the first connection, anyway. - auto* pqCore = pqApplicationCore::instance(); - if (pqCore) - { + auto* pqCore = pqApplicationCore::instance(); + if (pqCore) + { + QObject::connect(pqCore, &pqApplicationCore::clientEnvironmentDone, [this, pqCore]() { // The first functor listens to the object builder's "destroying" signal // to identify pqPipelineSources that are being removed in order to give // the user a chance to save resources before they are destroyed. ParaView @@ -204,8 +199,8 @@ pqSMTKSaveOnCloseResourceBehavior::pqSMTKSaveOnCloseResourceBehavior(QObject* pa } closeEvent->setAccepted(ret != QMessageBox::Cancel); }); - } - }); + }); + } } int pqSMTKSaveOnCloseResourceBehavior::showDialog( diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKSaveResourceBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKSaveResourceBehavior.cxx index de9c73dfb1..84e8ba3f5c 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKSaveResourceBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKSaveResourceBehavior.cxx @@ -278,15 +278,10 @@ pqSMTKSaveResourceBehavior::pqSMTKSaveResourceBehavior(QObject* parent) { initSaveResourceBehaviorResources(); - // Wait until the event loop starts, ensuring that the main window will be - // accessible. - QTimer::singleShot(0, this, [this]() { - // Blech: pqApplicationCore doesn't have the selection manager yet, - // so wait until we hear that the server is ready to make the connection. - // We can't have a selection before the first connection, anyway. - auto* pqCore = pqApplicationCore::instance(); - if (pqCore) - { + auto* pqCore = pqApplicationCore::instance(); + if (pqCore) + { + QObject::connect(pqCore, &pqApplicationCore::clientEnvironmentDone, [this]() { QAction* saveResourceAction = new QAction(QPixmap(":/SaveResourceBehavior/Save24.png"), tr("&Save Resource"), this); saveResourceAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S)); @@ -354,8 +349,8 @@ pqSMTKSaveResourceBehavior::pqSMTKSaveResourceBehavior(QObject* parent) } new pqSaveResourceReaction(saveResourceAction); new pqSaveResourceAsReaction(saveResourceAsAction); - } - }); + }); + } } pqSMTKSaveResourceBehavior* pqSMTKSaveResourceBehavior::instance(QObject* parent) diff --git a/smtk/project/plugin/pqSMTKProjectMenu.cxx b/smtk/project/plugin/pqSMTKProjectMenu.cxx index 47a605365d..a2394ea020 100644 --- a/smtk/project/plugin/pqSMTKProjectMenu.cxx +++ b/smtk/project/plugin/pqSMTKProjectMenu.cxx @@ -155,12 +155,10 @@ static pqSMTKProjectMenu* g_instance = nullptr; pqSMTKProjectMenu::pqSMTKProjectMenu(QObject* parent) : Superclass(parent) { - // Wait until the event loop starts, ensuring that the main window will be - // accessible. - QTimer::singleShot(10, this, [this]() { - auto* pqCore = pqApplicationCore::instance(); - if (pqCore) - { + auto* pqCore = pqApplicationCore::instance(); + if (pqCore) + { + QObject::connect(pqCore, &pqApplicationCore::clientEnvironmentDone, [this]() { QMainWindow* mainWindow = qobject_cast(pqCoreUtilities::mainWidget()); QList menuBarActions = mainWindow->menuBar()->actions(); @@ -231,8 +229,8 @@ pqSMTKProjectMenu::pqSMTKProjectMenu(QObject* parent) mainWindow->menuBar()->insertMenu(::findHelpMenuAction(mainWindow->menuBar()), menu); } new pqNewProjectReaction(newProjectAction); - } - }); + }); + } } pqSMTKProjectMenu* pqSMTKProjectMenu::instance(QObject* parent) -- GitLab From 4ea248ab9a69e87698f789dc4c13ccc82e4216e6 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 28 Jun 2021 15:33:02 -0400 Subject: [PATCH 080/136] SMTKPluginMacros: clean up CMake foreach loop style nits --- CMake/SMTKPluginMacros.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMake/SMTKPluginMacros.cmake b/CMake/SMTKPluginMacros.cmake index 75362aa2c2..51f1d94dee 100644 --- a/CMake/SMTKPluginMacros.cmake +++ b/CMake/SMTKPluginMacros.cmake @@ -58,7 +58,7 @@ function (smtk_add_plugin name) endif () if (DEFINED _smtk_plugin_REGISTRARS) # Additional registrars, must have a unique generated filename. - foreach(_smtk_plugin_REGISTRAR ${_smtk_plugin_REGISTRARS}) + foreach (_smtk_plugin_REGISTRAR IN LISTS _smtk_plugin_REGISTRARS) string(REPLACE "::" "/" _smtk_plugin_header_path "${_smtk_plugin_REGISTRAR}") string(REPLACE "::" "_" _smtk_plugin_header_name "${_smtk_plugin_REGISTRAR}") set(_smtk_plugin_REGISTRAR_HEADER "${_smtk_plugin_header_path}.h") @@ -69,7 +69,7 @@ function (smtk_add_plugin name) "${_smtk_plugin_filename}" @ONLY) list(APPEND _smtk_plugin_sources "${_smtk_plugin_filename}") - endforeach(_smtk_plugin_REGISTRAR) + endforeach () endif () # FIXME: This shouldn't really be necessary. Instead, SMTK should have its -- GitLab From cc8205f549187cdcd361c2db6f5757eb8d6dc9bf Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 28 Jun 2021 15:33:24 -0400 Subject: [PATCH 081/136] SMTKPVTestingMacros: fix the genex syntax in _smtk_paraview_add_tests --- CMake/SMTKPVTestingMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMake/SMTKPVTestingMacros.cmake b/CMake/SMTKPVTestingMacros.cmake index d3c33d2b61..957106e058 100644 --- a/CMake/SMTKPVTestingMacros.cmake +++ b/CMake/SMTKPVTestingMacros.cmake @@ -1,7 +1,7 @@ function (_smtk_paraview_add_tests test_function) _paraview_add_tests("${test_function}" LOAD_PLUGINS smtkPQComponentsPlugin - PLUGIN_PATHS $ ${ARGN}) endfunction () -- GitLab From 9e6a7120b111c16d2f0b97ce83e9fa6be45ad121 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 28 Jun 2021 15:34:38 -0400 Subject: [PATCH 082/136] mesh/testing: load the Attribute ParaView plugin too --- smtk/extension/paraview/mesh/testing/xml/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/smtk/extension/paraview/mesh/testing/xml/CMakeLists.txt b/smtk/extension/paraview/mesh/testing/xml/CMakeLists.txt index eacf06e624..d8d317938c 100644 --- a/smtk/extension/paraview/mesh/testing/xml/CMakeLists.txt +++ b/smtk/extension/paraview/mesh/testing/xml/CMakeLists.txt @@ -12,6 +12,7 @@ smtk_add_client_tests( #LABEL "MeshSession" TEST_SCRIPTS ${TESTS_WITH_BASELINES} LOAD_PLUGINS + smtkAttributePlugin smtkResourcePlugin smtkOperationPlugin smtkGeometryPlugin @@ -22,6 +23,7 @@ smtk_add_client_tests( smtkPQComponentsPlugin smtkPVMeshExtPlugin PLUGIN_PATHS + $/.. $/.. $/.. $/.. -- GitLab From 8acf95593b12840eae3cab46a170725efd403702 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 29 Jun 2021 16:24:15 -0400 Subject: [PATCH 083/136] SMTKPluginMacros: use ParaView's auto_start to register managers This is more reliable than global static `shared_ptr` variables hanging out in a TU. --- CMake/SMTKInstallCMakePackage.cmake | 3 +- CMake/SMTKPluginMacros.cmake | 45 ++++++++++++++++++++++++----- CMake/pqSMTKAutoStart.cxx.in | 40 +++++++++++++++++++++++++ CMake/pqSMTKAutoStart.h.in | 30 +++++++++++++++++++ CMake/serverSource.cxx.in | 26 ----------------- 5 files changed, 109 insertions(+), 35 deletions(-) create mode 100644 CMake/pqSMTKAutoStart.cxx.in create mode 100644 CMake/pqSMTKAutoStart.h.in delete mode 100644 CMake/serverSource.cxx.in diff --git a/CMake/SMTKInstallCMakePackage.cmake b/CMake/SMTKInstallCMakePackage.cmake index 4b0d7b2a16..e460c1150a 100644 --- a/CMake/SMTKInstallCMakePackage.cmake +++ b/CMake/SMTKInstallCMakePackage.cmake @@ -41,7 +41,8 @@ set(smtk_cmake_module_files SMTKMacros.cmake SMTKOperationXML.cmake SMTKPluginMacros.cmake - serverSource.cxx.in) + pqSMTKAutoStart.h.in + pqSMTKAutoStart.cxx.in) set(smtk_cmake_files_to_install "${prefix_file}") diff --git a/CMake/SMTKPluginMacros.cmake b/CMake/SMTKPluginMacros.cmake index 51f1d94dee..697bd37a65 100644 --- a/CMake/SMTKPluginMacros.cmake +++ b/CMake/SMTKPluginMacros.cmake @@ -41,8 +41,9 @@ function (smtk_add_plugin name) string(TOLOWER "${_smtk_plugin__SKIP_DEPENDENCIES}" _smtk_plugin__SKIP_DEPENDENCIES) + set(_smtk_plugin_interfaces "") set(_smtk_plugin_sources "") - string(REPLACE ";" ", " _smtk_plugin_managers "${_smtk_plugin_MANAGERS}") + string(REPLACE ";" "\n , " _smtk_plugin_managers "${_smtk_plugin_MANAGERS}") if (DEFINED _smtk_plugin_REGISTRAR) if (NOT DEFINED _smtk_plugin_REGISTRAR_HEADER) @@ -50,11 +51,25 @@ function (smtk_add_plugin name) set(_smtk_plugin_REGISTRAR_HEADER "${_smtk_plugin_header_path}.h") endif () + set(_smtk_plugin_autostart_name "${_smtk_plugin_name}") configure_file( - "${_smtk_cmake_dir}/serverSource.cxx.in" - "${CMAKE_CURRENT_BINARY_DIR}/serverSource.cxx" + "${_smtk_cmake_dir}/pqSMTKAutoStart.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/pqSMTKAutoStart${_smtk_plugin_autostart_name}.h" @ONLY) - list(APPEND _smtk_plugin_sources "${CMAKE_CURRENT_BINARY_DIR}/serverSource.cxx") + configure_file( + "${_smtk_cmake_dir}/pqSMTKAutoStart.cxx.in" + "${CMAKE_CURRENT_BINARY_DIR}/pqSMTKAutoStart${_smtk_plugin_autostart_name}.cxx" + @ONLY) + paraview_plugin_add_auto_start( + CLASS_NAME "pqSMTKAutoStart${_smtk_plugin_autostart_name}" + INTERFACES _smtk_plugin_autostart_interface + SOURCES _smtk_plugin_autostart_sources) + list(APPEND _smtk_plugin_interfaces + ${_smtk_plugin_autostart_interface}) + list(APPEND _smtk_plugin_sources + "${CMAKE_CURRENT_BINARY_DIR}/pqSMTKAutoStart${_smtk_plugin_autostart_name}.h" + "${CMAKE_CURRENT_BINARY_DIR}/pqSMTKAutoStart${_smtk_plugin_autostart_name}.cxx" + ${_smtk_plugin_autostart_sources}) endif () if (DEFINED _smtk_plugin_REGISTRARS) # Additional registrars, must have a unique generated filename. @@ -62,13 +77,26 @@ function (smtk_add_plugin name) string(REPLACE "::" "/" _smtk_plugin_header_path "${_smtk_plugin_REGISTRAR}") string(REPLACE "::" "_" _smtk_plugin_header_name "${_smtk_plugin_REGISTRAR}") set(_smtk_plugin_REGISTRAR_HEADER "${_smtk_plugin_header_path}.h") - set(_smtk_plugin_filename "${CMAKE_CURRENT_BINARY_DIR}/serverSource_${_smtk_plugin_header_name}.cxx") + set(_smtk_plugin_autostart_name "${_smtk_plugin_header_name}") + configure_file( + "${_smtk_cmake_dir}/pqSMTKAutoStart.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/pqSMTKAutoStart${_smtk_plugin_autostart_name}.h" + @ONLY) configure_file( - "${_smtk_cmake_dir}/serverSource.cxx.in" - "${_smtk_plugin_filename}" + "${_smtk_cmake_dir}/pqSMTKAutoStart.cxx.in" + "${CMAKE_CURRENT_BINARY_DIR}/pqSMTKAutoStart${_smtk_plugin_autostart_name}.cxx" @ONLY) - list(APPEND _smtk_plugin_sources "${_smtk_plugin_filename}") + paraview_plugin_add_auto_start( + CLASS_NAME "pqSMTKAutoStart${_smtk_plugin_autostart_name}" + INTERFACES _smtk_plugin_autostart_interface + SOURCES _smtk_plugin_autostart_sources) + list(APPEND _smtk_plugin_interfaces + ${_smtk_plugin_autostart_interface}) + list(APPEND _smtk_plugin_sources + "${CMAKE_CURRENT_BINARY_DIR}/pqSMTKAutoStart${_smtk_plugin_autostart_name}.h" + "${CMAKE_CURRENT_BINARY_DIR}/pqSMTKAutoStart${_smtk_plugin_autostart_name}.cxx" + ${_smtk_plugin_autostart_sources}) endforeach () endif () @@ -78,6 +106,7 @@ function (smtk_add_plugin name) # as well. paraview_add_plugin("${_smtk_plugin_name}" SOURCES ${_smtk_plugin_sources} + UI_INTERFACES ${_smtk_plugin_interfaces} ${_smtk_plugin_PARAVIEW_PLUGIN_ARGS}) target_link_libraries("${_smtk_plugin_name}" PRIVATE diff --git a/CMake/pqSMTKAutoStart.cxx.in b/CMake/pqSMTKAutoStart.cxx.in new file mode 100644 index 0000000000..7879437ca1 --- /dev/null +++ b/CMake/pqSMTKAutoStart.cxx.in @@ -0,0 +1,40 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#include "pqSMTKAutoStart@_smtk_plugin_autostart_name@.h" + +#include "@_smtk_plugin_REGISTRAR_HEADER@" + +#include "smtk/plugin/Client.txx" + +#include + +pqSMTKAutoStart@_smtk_plugin_autostart_name@::pqSMTKAutoStart@_smtk_plugin_autostart_name@(QObject* parent) + : QObject(parent) +{ +} + +pqSMTKAutoStart@_smtk_plugin_autostart_name@::~pqSMTKAutoStart@_smtk_plugin_autostart_name@() = default; + +typedef smtk::plugin::Client<@_smtk_plugin_REGISTRAR@ + , @_smtk_plugin_managers@ + > Client; + +static std::shared_ptr myClient; + +void pqSMTKAutoStart@_smtk_plugin_autostart_name@::startup() +{ + myClient = std::dynamic_pointer_cast(Client::create()); +} + +void pqSMTKAutoStart@_smtk_plugin_autostart_name@::shutdown() +{ + myClient = nullptr; +} diff --git a/CMake/pqSMTKAutoStart.h.in b/CMake/pqSMTKAutoStart.h.in new file mode 100644 index 0000000000..4a5f13b4d0 --- /dev/null +++ b/CMake/pqSMTKAutoStart.h.in @@ -0,0 +1,30 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= + +#ifndef pqSMTKAutoStart@_smtk_plugin_autostart_name@_h +#define pqSMTKAutoStart@_smtk_plugin_autostart_name@_h + +#include + +class pqSMTKAutoStart@_smtk_plugin_autostart_name@ : public QObject +{ + Q_OBJECT + typedef QObject Superclass; + Q_DISABLE_COPY(pqSMTKAutoStart@_smtk_plugin_autostart_name@) + +public: + pqSMTKAutoStart@_smtk_plugin_autostart_name@(QObject* parent = nullptr); + ~pqSMTKAutoStart@_smtk_plugin_autostart_name@() override; + + void startup(); + void shutdown(); +}; + +#endif diff --git a/CMake/serverSource.cxx.in b/CMake/serverSource.cxx.in deleted file mode 100644 index 107617e644..0000000000 --- a/CMake/serverSource.cxx.in +++ /dev/null @@ -1,26 +0,0 @@ -/// Generated file. Do not edit. - -//========================================================================= -// Copyright (c) Kitware, Inc. -// All rights reserved. -// See LICENSE.txt for details. -// -// This software is distributed WITHOUT ANY WARRANTY; without even -// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -// PURPOSE. See the above copyright notice for more information. -//========================================================================= - -#include "@_smtk_plugin_REGISTRAR_HEADER@" - -#include "smtk/plugin/Client.txx" - -#include "vtkNew.h" -#include "vtkPVPluginLoader.h" - -#include - -typedef smtk::plugin::Client<@_smtk_plugin_REGISTRAR@, @_smtk_plugin_managers@> - @_smtk_plugin_name@Client; - -static std::shared_ptr<@_smtk_plugin_name@Client> my@_smtk_plugin_name@Client = - std::dynamic_pointer_cast<@_smtk_plugin_name@Client>(@_smtk_plugin_name@Client::create()); -- GitLab From 28510e45cfa26bee7f2ab3e6eb634f4caa2a71bf Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 29 Jun 2021 18:48:17 -0400 Subject: [PATCH 084/136] CTestCustom: ignore more warnings from ParaView generated code --- CMake/CTestCustom.cmake.in | 1 + 1 file changed, 1 insertion(+) diff --git a/CMake/CTestCustom.cmake.in b/CMake/CTestCustom.cmake.in index 78809199e9..35c985df3c 100644 --- a/CMake/CTestCustom.cmake.in +++ b/CMake/CTestCustom.cmake.in @@ -19,6 +19,7 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION # ParaView generated code (paraview/paraview!4957) "AutoStartImplementation.*modernize-use-nullptr" + "pqSMTKAutoStart.*Implementation.*modernize-use-nullptr" ) ##------------------------------------------------------------------------------ -- GitLab From 6477b2563322ba1c95283f720aa05aafb99e1fca Mon Sep 17 00:00:00 2001 From: Corey Hart Date: Wed, 30 Jun 2021 10:12:50 -0500 Subject: [PATCH 085/136] make PathComp struct and PhraseDeltas class public This enables developers to implement their own handleExpundged() method when using a custom PhraseModel. --- smtk/view/PhraseModel.cxx | 35 ----------------------------------- smtk/view/PhraseModel.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/smtk/view/PhraseModel.cxx b/smtk/view/PhraseModel.cxx index 5a6cea6561..80e6aa2458 100644 --- a/smtk/view/PhraseModel.cxx +++ b/smtk/view/PhraseModel.cxx @@ -34,37 +34,6 @@ namespace view namespace { -// Sort paths from deepest to shallowest, then rear-most to front-most. -// Doing these things keeps us from invalidating paths when items are removed. -struct PathComp -{ - bool operator()(const std::vector& a, const std::vector& b) const - { - if (a.size() < b.size()) - { - return false; - } - else if (a.size() > b.size()) - { - return true; - } - std::size_t ii = 0; - for (auto ai : a) - { - if (ai < b[ii]) - { - return false; - } - else if (ai > b[ii]) - { - return true; - } - ++ii; - } - return false; // a == b... neither is less than other. - } -}; - void notifyRecursive( PhraseModel::Observer obs, DescriptivePhrasePtr parent, @@ -96,10 +65,6 @@ void notify(PhraseModel::Observer obs, DescriptivePhrasePtr parent) } } // namespace -class PhraseDeltas : public std::set, PathComp> -{ -}; - // Returns the operation manager - right now it assumes the first source // TODO: figure out the proper behavior when there is more // than one source diff --git a/smtk/view/PhraseModel.h b/smtk/view/PhraseModel.h index 7f3cb5af3d..8850fa8e22 100644 --- a/smtk/view/PhraseModel.h +++ b/smtk/view/PhraseModel.h @@ -36,6 +36,41 @@ namespace smtk namespace view { +// Sort paths from deepest to shallowest, then rear-most to front-most. +// Doing these things keeps us from invalidating paths when items are removed. +struct PathComp +{ + bool operator()(const std::vector& a, const std::vector& b) const + { + if (a.size() < b.size()) + { + return false; + } + else if (a.size() > b.size()) + { + return true; + } + std::size_t ii = 0; + for (auto ai : a) + { + if (ai < b[ii]) + { + return false; + } + else if (ai > b[ii]) + { + return true; + } + ++ii; + } + return false; // a == b... neither is less than other. + } +}; + +class PhraseDeltas : public std::set, PathComp> +{ +}; + /**\brief Hold and maintain a descriptive phrase hierarchy. * * This class holds the root descriptive phrase in a hierarchy and -- GitLab From e2b9c6849d450727611b398ec1ddb60318cf928a Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Wed, 30 Jun 2021 11:53:33 -0400 Subject: [PATCH 086/136] Reset ReferenceItem after removing associations --- smtk/attribute/Attribute.cxx | 1 + smtk/attribute/testing/cxx/unitAttributeAssociation.cxx | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/smtk/attribute/Attribute.cxx b/smtk/attribute/Attribute.cxx index 7658dd61cd..08a8a1eb85 100644 --- a/smtk/attribute/Attribute.cxx +++ b/smtk/attribute/Attribute.cxx @@ -443,6 +443,7 @@ bool Attribute::removeAllAssociations(bool partialRemovalOk) } } m_associatedObjects->detachOwningResource(); + m_associatedObjects->reset(); return true; } diff --git a/smtk/attribute/testing/cxx/unitAttributeAssociation.cxx b/smtk/attribute/testing/cxx/unitAttributeAssociation.cxx index 3c4bb020a1..7649a4b28e 100644 --- a/smtk/attribute/testing/cxx/unitAttributeAssociation.cxx +++ b/smtk/attribute/testing/cxx/unitAttributeAssociation.cxx @@ -94,6 +94,13 @@ int unitAttributeAssociation(int /*unused*/, char* /*unused*/[]) e0.associateAttribute(att->attributeResource(), att->id()) == false, "Should not have been able to associate entity of wrong type."); + att->removeAllAssociations(); + att->associateEntity(v2); + auto assocObj = att->associations()->value(0); + smtkTest( + assocObj->id() == v2.entity(), + "Associated to wrong entity. Should be " << v2.entity() << " not " << assocObj->id()); + { auto associateOperation = smtk::attribute::Associate::create(); -- GitLab From c112eb624f204881d330d552e491656961192707 Mon Sep 17 00:00:00 2001 From: Robert O'Bara Date: Wed, 23 Jun 2021 18:59:27 -0400 Subject: [PATCH 087/136] ENH:Improving UI handling of Signal Operations Originally the qtAttributeView and InstanceView classes would ignore the Signal Operation since typically it would be the only Qt UI element that would be creating, removing, and changing the Attributes it is displaying. However, this prevented the UI designer from having AttributeViews/InstanceViews that displayed the same information from being used in Selector Views or have different qtViews overlap their contents (for example one View could be displaying Fluid Boundary Conditions, while another was displaying all Boundary Conditions) This change now encodes the address of the View that initiated the change so that we can avoid a View from being updated via a Signal Operation that it itself initiated. qtAttributeView/qtInstanceView have now been updated to only ignore Signal Operations that it triggered. --- .../notes/qtBaseAttributeViewSignalChange.rst | 7 ++ smtk/attribute/operators/Signal.sbt | 9 +- smtk/extension/qt/qtAttributeView.cxx | 8 +- smtk/extension/qt/qtBaseAttributeView.cxx | 112 ++++++++---------- smtk/extension/qt/qtBaseAttributeView.h | 1 + smtk/extension/qt/qtInstancedView.cxx | 8 +- 6 files changed, 74 insertions(+), 71 deletions(-) create mode 100644 doc/release/notes/qtBaseAttributeViewSignalChange.rst diff --git a/doc/release/notes/qtBaseAttributeViewSignalChange.rst b/doc/release/notes/qtBaseAttributeViewSignalChange.rst new file mode 100644 index 0000000000..f88493da00 --- /dev/null +++ b/doc/release/notes/qtBaseAttributeViewSignalChange.rst @@ -0,0 +1,7 @@ +Improving UI handling of Signal Operations +===================================== +Originally the qtAttributeView class would ignore the Signal Operation since typically it would be the only Qt UI element that would be creating, removing, and changing the Attributes it is displaying. However, this prevented the UI designer from having AttributeViews that displayed the same information from being used in Selector Views or have different AttributeViews overlap their contents (for example one View could be displaying Fluid Boundary Conditions, while another was displaying all Boundary Conditions) + +This change now encodes the address of the View that initiated the change so that we can avoid a View from being updated via a Signal Operation that it itself initiated. + +qtAttributeView has now been updated to only ignore Signal Operations that it triggered. diff --git a/smtk/attribute/operators/Signal.sbt b/smtk/attribute/operators/Signal.sbt index eed2e7c8b8..cb96254f2a 100644 --- a/smtk/attribute/operators/Signal.sbt +++ b/smtk/attribute/operators/Signal.sbt @@ -17,12 +17,15 @@ - + + + + - + @@ -31,7 +34,7 @@ - + diff --git a/smtk/extension/qt/qtAttributeView.cxx b/smtk/extension/qt/qtAttributeView.cxx index e73be73776..de374867b0 100644 --- a/smtk/extension/qt/qtAttributeView.cxx +++ b/smtk/extension/qt/qtAttributeView.cxx @@ -28,6 +28,7 @@ #include "smtk/attribute/GroupItemDefinition.h" #include "smtk/attribute/ItemDefinition.h" #include "smtk/attribute/Resource.h" +#include "smtk/attribute/StringItem.h" #include "smtk/attribute/ValueItem.h" #include "smtk/attribute/ValueItemDefinition.h" #include "smtk/attribute/VoidItem.h" @@ -1460,9 +1461,12 @@ int qtAttributeView::handleOperationEvent( } // Since the Signal Operation originates from a Qt Signal - // being fired we can ignore this - if (op.typeName() == smtk::common::typeName()) + // being fired we need to see if this view is one that triggered it + if ( + (op.typeName() == smtk::common::typeName()) && + (op.parameters()->findString("source")->value() == m_addressString)) { + // We can ignore this operation since we initiated it return 0; } diff --git a/smtk/extension/qt/qtBaseAttributeView.cxx b/smtk/extension/qt/qtBaseAttributeView.cxx index 6fa5bca6a5..f4d32e19e6 100644 --- a/smtk/extension/qt/qtBaseAttributeView.cxx +++ b/smtk/extension/qt/qtBaseAttributeView.cxx @@ -40,6 +40,8 @@ #include #include +#include + using namespace smtk::extension; class qtBaseAttributeViewInternals @@ -82,6 +84,12 @@ qtBaseAttributeView::qtBaseAttributeView(const smtk::view::Information& info) m_fixedLabelWidth = m_viewInfo.m_UIManager->maxValueLabelLength(); m_topLevelInitialized = false; m_ignoreCategories = m_viewInfo.m_view->details().attributeAsBool("IgnoreCategories"); + // We need to be able to determine within the a Signal Operation, which View caused + // the change in order to avoid infinite loops. To do this, each View will have an addressString + // set to its address. This string is then passed to the signalAttribute function when needed. + std::stringstream me; + me << std::hex << (void const*)this << std::dec; + m_addressString = me.str(); } qtBaseAttributeView::~qtBaseAttributeView() @@ -190,7 +198,8 @@ void signalAttribute( smtk::extension::qtUIManager* uiManager, const smtk::attribute::AttributePtr& attr, const char* itemName, - std::vector items = std::vector()) + std::vector items, + const std::string& source = "") { if (attr && uiManager && itemName && itemName[0]) { @@ -202,6 +211,7 @@ void signalAttribute( auto signalOp = opManager->create(); if (signalOp) { + signalOp->parameters()->findString("source")->setValue(source); signalOp->parameters()->findComponent(itemName)->appendValue(attr); signalOp->parameters()->findString("items")->setValues(items.begin(), items.end()); opManager->launchers()(signalOp); @@ -223,35 +233,25 @@ void qtBaseAttributeView::attributeCreated(const smtk::attribute::AttributePtr& return; } - // Let the toplevel view process attribute creation - if (!this->isTopLevel()) - { - auto* topView = dynamic_cast(this->uiManager()->topView()); - if (topView) - { - topView->attributeCreated(attr); - return; - } - } - + qtBaseAttributeView* topView = dynamic_cast(this->uiManager()->topView()); // If the toplevel view is using analysis configuration we need // to check to see if the attribute is an analysis configuration - if (this->Internals->m_configurationCombo != nullptr) + if (topView && topView->Internals->m_configurationCombo != nullptr) { - smtk::attribute::DefinitionPtr def = m_topLevelConfigurationDef.lock(); + smtk::attribute::DefinitionPtr def = topView->m_topLevelConfigurationDef.lock(); if (attr->definition()->isA(def)) { // if the combobox allows creation of configurations, the number // of existing configurations is 1 less. - int n = this->Internals->m_configurationCombo->count(); - if (m_topLevelCanCreateConfigurations) + int n = topView->Internals->m_configurationCombo->count(); + if (topView->m_topLevelCanCreateConfigurations) { --n; } // If there are no configurations in the combobox just prep it if (!n) { - this->prepConfigurationComboBox(attr->name()); + topView->prepConfigurationComboBox(attr->name()); } else { @@ -259,21 +259,21 @@ void qtBaseAttributeView::attributeCreated(const smtk::attribute::AttributePtr& bool needToInsert = true; for (int i = 0; (i < n) && needToInsert; i++) { - if (this->Internals->m_configurationCombo->itemText(i).toStdString() > attr->name()) + if (topView->Internals->m_configurationCombo->itemText(i).toStdString() > attr->name()) { - this->Internals->m_configurationCombo->insertItem(i, attr->name().c_str()); + topView->Internals->m_configurationCombo->insertItem(i, attr->name().c_str()); needToInsert = false; } } if (needToInsert) { - this->Internals->m_configurationCombo->insertItem(n, attr->name().c_str()); + topView->Internals->m_configurationCombo->insertItem(n, attr->name().c_str()); } } } } - //Let observers know the attribute was created - signalAttribute(this->uiManager(), attr, "created"); + //Let observers know the attribute was created and who created it + signalAttribute(this->uiManager(), attr, "created", std::vector(), m_addressString); } void qtBaseAttributeView::attributeChanged( @@ -285,30 +285,20 @@ void qtBaseAttributeView::attributeChanged( return; } - // Let the toplevel view process attribute modification - if (!this->isTopLevel()) - { - auto* topView = dynamic_cast(this->uiManager()->topView()); - if (topView) - { - topView->attributeChanged(attr, items); - return; - } - } - + qtBaseAttributeView* topView = dynamic_cast(this->uiManager()->topView()); // If the toplevel view is using analysis configuration we need // to check to see if the attribute is an analysis configuration - if (this->Internals->m_configurationCombo != nullptr) + if (topView && topView->Internals->m_configurationCombo != nullptr) { - smtk::attribute::DefinitionPtr def = m_topLevelConfigurationDef.lock(); + smtk::attribute::DefinitionPtr def = topView->m_topLevelConfigurationDef.lock(); if (attr->definition()->isA(def)) { // We only need to refresh the combobox - this->prepConfigurationComboBox(""); + topView->prepConfigurationComboBox(""); } } - //Let observers know the attribute was modified - signalAttribute(this->uiManager(), attr, "modified", items); + //Let observers know the attribute was modified and which view modified it + signalAttribute(this->uiManager(), attr, "modified", items, m_addressString); } void qtBaseAttributeView::attributeRemoved(const smtk::attribute::AttributePtr& attr) @@ -318,31 +308,21 @@ void qtBaseAttributeView::attributeRemoved(const smtk::attribute::AttributePtr& return; } - // Let the toplevel view process attribute removal - if (!this->isTopLevel()) - { - auto* topView = dynamic_cast(this->uiManager()->topView()); - if (topView) - { - topView->attributeRemoved(attr); - return; - } - } - + qtBaseAttributeView* topView = dynamic_cast(this->uiManager()->topView()); // If the toplevel view is using analysis configuration we need // to check to see if the attribute is an analysis configuration - if (this->Internals->m_configurationCombo != nullptr) + if (topView && topView->Internals->m_configurationCombo != nullptr) { - smtk::attribute::DefinitionPtr def = m_topLevelConfigurationDef.lock(); + smtk::attribute::DefinitionPtr def = topView->m_topLevelConfigurationDef.lock(); if (attr->definition()->isA(def)) { // See if we can find the attribute - int n = this->Internals->m_configurationCombo->findText(attr->name().c_str()); + int n = topView->Internals->m_configurationCombo->findText(attr->name().c_str()); if (n != -1) { - this->Internals->m_configurationCombo->blockSignals(true); - int currentIndex = this->Internals->m_configurationCombo->currentIndex(); + topView->Internals->m_configurationCombo->blockSignals(true); + int currentIndex = topView->Internals->m_configurationCombo->currentIndex(); // If the attribute being removed the selected one? If it is then select the // select another configuration first if (n == currentIndex) @@ -353,22 +333,22 @@ void qtBaseAttributeView::attributeRemoved(const smtk::attribute::AttributePtr& { // Else we will select the first one in the list if one // exists. - int count = this->Internals->m_configurationCombo->count(); - if (m_topLevelCanCreateConfigurations) + int count = topView->Internals->m_configurationCombo->count(); + if (topView->m_topLevelCanCreateConfigurations) { --count; } newSelection = (count > 1) ? 0 : -1; } - this->Internals->m_configurationCombo->removeItem(n); - this->Internals->m_configurationCombo->setCurrentIndex(newSelection); + topView->Internals->m_configurationCombo->removeItem(n); + topView->Internals->m_configurationCombo->setCurrentIndex(newSelection); } else { // This is the case where the attribute is not currently selected. - this->Internals->m_configurationCombo->removeItem(n); + topView->Internals->m_configurationCombo->removeItem(n); } - this->Internals->m_configurationCombo->blockSignals(false); + topView->Internals->m_configurationCombo->blockSignals(false); } } } @@ -377,9 +357,12 @@ void qtBaseAttributeView::attributeRemoved(const smtk::attribute::AttributePtr& // the case of an attribute being referenced by a Reference Item // - See SMTK Issue 415) // so we need to update the UI. - this->updateUI(); - //Let observers know the attribute was removed - signalAttribute(this->uiManager(), attr, "expunged"); + if (topView) + { + topView->updateUI(); + } + //Let observers know the attribute was removed and which view removed it + signalAttribute(this->uiManager(), attr, "expunged", std::vector(), m_addressString); } bool qtBaseAttributeView::setFixedLabelWidth(int w) @@ -845,7 +828,8 @@ void qtBaseAttributeView::prepConfigurationComboBox(const std::string& newConfig att->properties().get()["_selectedConfiguration"] = 1; attRes->analyses().getAnalysisAttributeCategories(att, cats); //Let observers know the attribute was modified - signalAttribute(this->uiManager(), att, "modified", std::vector()); + signalAttribute( + this->uiManager(), att, "modified", std::vector(), m_addressString); } } diff --git a/smtk/extension/qt/qtBaseAttributeView.h b/smtk/extension/qt/qtBaseAttributeView.h index ddef0df211..e45ff38513 100644 --- a/smtk/extension/qt/qtBaseAttributeView.h +++ b/smtk/extension/qt/qtBaseAttributeView.h @@ -120,6 +120,7 @@ protected: bool m_topLevelCanCreateConfigurations; smtk::attribute::WeakDefinitionPtr m_topLevelConfigurationDef; bool m_ignoreCategories; + std::string m_addressString; private: int m_fixedLabelWidth; diff --git a/smtk/extension/qt/qtInstancedView.cxx b/smtk/extension/qt/qtInstancedView.cxx index 596e6fa870..908e8b1ec8 100644 --- a/smtk/extension/qt/qtInstancedView.cxx +++ b/smtk/extension/qt/qtInstancedView.cxx @@ -12,6 +12,7 @@ #include "smtk/attribute/Attribute.h" #include "smtk/attribute/ComponentItem.h" +#include "smtk/attribute/StringItem.h" #include "smtk/attribute/operators/Signal.h" #include "smtk/extension/qt/qtAttribute.h" #include "smtk/extension/qt/qtUIManager.h" @@ -292,9 +293,12 @@ int qtInstancedView::handleOperationEvent( } // Since the Signal Operation originates from a Qt Signal - // being fired we can ignore this - if (op.typeName() == smtk::common::typeName()) + // being fired we need to see if this view is one that triggered it + if ( + (op.typeName() == smtk::common::typeName()) && + (op.parameters()->findString("source")->value() == m_addressString)) { + // We can ignore this operation since we initiated it return 0; } -- GitLab From 6e63c51bb562d7a64fd773802304503368d66942 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Wed, 19 May 2021 21:10:29 -0400 Subject: [PATCH 088/136] Load operation view into QScrollArea Need to set min for reasonable display --- smtk/extension/qt/qtOperationDialog.cxx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/smtk/extension/qt/qtOperationDialog.cxx b/smtk/extension/qt/qtOperationDialog.cxx index c703b413a9..8551920005 100644 --- a/smtk/extension/qt/qtOperationDialog.cxx +++ b/smtk/extension/qt/qtOperationDialog.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,7 @@ void qtOperationDialog::buildUI( smtk::operation::OperationPtr op, QSharedPointer uiManager) { + this->setObjectName("ExportDialog"); m_internals = new qtOperationDialogInternals(); m_internals->m_uiManager = uiManager; m_internals->m_operation = op; @@ -76,16 +78,19 @@ void qtOperationDialog::buildUI( m_internals->m_tabWidget->setStyleSheet("QTabBar::tab { min-width: 100px; }"); // 1. Create the editor tab - QWidget* editorWidget = new QWidget(this); - QVBoxLayout* editorLayout = new QVBoxLayout(editorWidget); + // Make contents scrollable. + QScrollArea* scroll = new QScrollArea(); + QWidget* viewport = new QWidget(); + scroll->setWidget(viewport); + scroll->setWidgetResizable(true); + QVBoxLayout* viewportLayout = new QVBoxLayout(viewport); + viewport->setLayout(viewportLayout); // Create the SMTK view auto viewConfig = m_internals->m_uiManager->findOrCreateOperationView(); - auto* qtView = m_internals->m_uiManager->setSMTKView(viewConfig, editorWidget); + auto* qtView = m_internals->m_uiManager->setSMTKView(viewConfig, viewport); m_internals->m_smtkView = dynamic_cast(qtView); - - editorWidget->setLayout(editorLayout); - m_internals->m_tabWidget->addTab(editorWidget, "Parameters"); + m_internals->m_tabWidget->addTab(scroll, "Parameters"); // 2. Create the info tab QTextEdit* infoWidget = new QTextEdit(this); @@ -125,6 +130,9 @@ void qtOperationDialog::buildUI( // 4. And the window title std::string title = viewConfig->label(); this->setWindowTitle(title.c_str()); + + // Set default size + this->setMinimumSize(480, 320); } qtOperationDialog::~qtOperationDialog() -- GitLab From c49944135d5b0eda193fc186efca2d9277534a1d Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Wed, 19 May 2021 21:51:37 -0400 Subject: [PATCH 089/136] Add constructor with scrollable option Qt's layout is better when QScrollArea not used, make scrolling an option that should only be used when needed to constrain the vertical display space. --- smtk/extension/qt/qtOperationDialog.cxx | 59 ++++++++++++++++++------- smtk/extension/qt/qtOperationDialog.h | 15 ++++++- 2 files changed, 57 insertions(+), 17 deletions(-) diff --git a/smtk/extension/qt/qtOperationDialog.cxx b/smtk/extension/qt/qtOperationDialog.cxx index 8551920005..11c5331699 100644 --- a/smtk/extension/qt/qtOperationDialog.cxx +++ b/smtk/extension/qt/qtOperationDialog.cxx @@ -64,9 +64,23 @@ qtOperationDialog::qtOperationDialog( this->buildUI(op, uiManager); } +qtOperationDialog::qtOperationDialog( + smtk::operation::OperationPtr op, + smtk::resource::ManagerPtr resManager, + smtk::view::ManagerPtr viewManager, + bool scrollable, + QWidget* parentWidget) + : QDialog(parentWidget) +{ + auto uiManager = QSharedPointer( + new smtk::extension::qtUIManager(op, resManager, viewManager)); + this->buildUI(op, uiManager, scrollable); +} + void qtOperationDialog::buildUI( smtk::operation::OperationPtr op, - QSharedPointer uiManager) + QSharedPointer uiManager, + bool scrollable) { this->setObjectName("ExportDialog"); m_internals = new qtOperationDialogInternals(); @@ -78,19 +92,30 @@ void qtOperationDialog::buildUI( m_internals->m_tabWidget->setStyleSheet("QTabBar::tab { min-width: 100px; }"); // 1. Create the editor tab - // Make contents scrollable. - QScrollArea* scroll = new QScrollArea(); - QWidget* viewport = new QWidget(); - scroll->setWidget(viewport); - scroll->setWidgetResizable(true); - QVBoxLayout* viewportLayout = new QVBoxLayout(viewport); - viewport->setLayout(viewportLayout); - - // Create the SMTK view auto viewConfig = m_internals->m_uiManager->findOrCreateOperationView(); - auto* qtView = m_internals->m_uiManager->setSMTKView(viewConfig, viewport); - m_internals->m_smtkView = dynamic_cast(qtView); - m_internals->m_tabWidget->addTab(scroll, "Parameters"); + if (scrollable) + { + QScrollArea* scroll = new QScrollArea(); + QWidget* viewport = new QWidget(); + scroll->setWidget(viewport); + scroll->setWidgetResizable(true); + QVBoxLayout* viewportLayout = new QVBoxLayout(viewport); + viewport->setLayout(viewportLayout); + + // Create the SMTK view + auto* qtView = m_internals->m_uiManager->setSMTKView(viewConfig, viewport); + m_internals->m_smtkView = dynamic_cast(qtView); + m_internals->m_tabWidget->addTab(scroll, "Parameters"); + } + else + { + QWidget* editorWidget = new QWidget(this); + QVBoxLayout* editorLayout = new QVBoxLayout(editorWidget); + auto* qtView = m_internals->m_uiManager->setSMTKView(viewConfig, editorWidget); + editorWidget->setLayout(editorLayout); + m_internals->m_smtkView = dynamic_cast(qtView); + m_internals->m_tabWidget->addTab(editorWidget, "Parameters"); + } // 2. Create the info tab QTextEdit* infoWidget = new QTextEdit(this); @@ -131,8 +156,12 @@ void qtOperationDialog::buildUI( std::string title = viewConfig->label(); this->setWindowTitle(title.c_str()); - // Set default size - this->setMinimumSize(480, 320); + if (scrollable) + { + // Set min size for reasonable display + // Application can always override this + this->setMinimumSize(480, 320); + } } qtOperationDialog::~qtOperationDialog() diff --git a/smtk/extension/qt/qtOperationDialog.h b/smtk/extension/qt/qtOperationDialog.h index e112900130..9780f733c0 100644 --- a/smtk/extension/qt/qtOperationDialog.h +++ b/smtk/extension/qt/qtOperationDialog.h @@ -55,7 +55,17 @@ public: smtk::resource::ManagerPtr resourceManager, smtk::view::ManagerPtr viewManager, QWidget* parentWidget = nullptr); - ~qtOperationDialog() override; + + // Use this constructor to include a scrolling area in the opertion + // view. Only set this flag if the operation parameters are + // lengthy and take up alot of vertical display space. + qtOperationDialog( + smtk::operation::OperationPtr operation, + smtk::resource::ManagerPtr resourceManager, + smtk::view::ManagerPtr viewManager, + bool scrollable, + QWidget* parentWidget = nullptr); + virtual ~qtOperationDialog(); signals: void operationExecuted(const smtk::operation::Operation::Result& result); @@ -68,7 +78,8 @@ protected slots: protected: void buildUI( smtk::operation::OperationPtr op, - QSharedPointer uiMManager); + QSharedPointer uiMManager, + bool scrollable = false); // Override showEvent() in order to fix Qt sizing issue void showEvent(QShowEvent* event) override; -- GitLab From 41642f355a95520bf05250f1bf19b9fd6eb92d0f Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Thu, 20 May 2021 15:28:52 -0400 Subject: [PATCH 090/136] Subclass QScrollArea to only require vertical scrolling Sets min width on resize events --- .../qt/examples/cxx/qtOperationPreview.cxx | 6 +-- smtk/extension/qt/qtOperationDialog.cxx | 37 +++++++++++++++++-- smtk/extension/qt/qtOperationDialog.h | 9 +++-- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/smtk/extension/qt/examples/cxx/qtOperationPreview.cxx b/smtk/extension/qt/examples/cxx/qtOperationPreview.cxx index f22b85ab86..04a5fa2ce3 100644 --- a/smtk/extension/qt/examples/cxx/qtOperationPreview.cxx +++ b/smtk/extension/qt/examples/cxx/qtOperationPreview.cxx @@ -11,7 +11,6 @@ #include "smtk/attribute/Registrar.h" #include "smtk/extension/qt/qtOperationDialog.h" -#include "smtk/extension/qt/qtUIManager.h" #include "smtk/extension/qt/qtViewRegistrar.h" #include "smtk/model/Registrar.h" #include "smtk/operation/Manager.h" @@ -119,11 +118,8 @@ int main(int argc, char* argv[]) smtk::view::Registrar::registerTo(viewManager); smtk::extension::qtViewRegistrar::registerTo(viewManager); - auto uiManager = QSharedPointer( - new smtk::extension::qtUIManager(op, resManager, viewManager)); - // Initialize dialog - smtk::extension::qtOperationDialog dialog(op, uiManager, nullptr); + smtk::extension::qtOperationDialog dialog(op, resManager, viewManager, false, nullptr); int retcode = dialog.exec(); return retcode; } diff --git a/smtk/extension/qt/qtOperationDialog.cxx b/smtk/extension/qt/qtOperationDialog.cxx index 11c5331699..16fb5b5780 100644 --- a/smtk/extension/qt/qtOperationDialog.cxx +++ b/smtk/extension/qt/qtOperationDialog.cxx @@ -19,15 +19,45 @@ #include #include +#include +#include #include #include +#include #include #include #include #include +#include using namespace smtk::extension; +namespace +{ +// Internal class for constraining QScrollArea to vertical direction +class qtVerticalScrollArea : public QScrollArea +{ +public: + qtVerticalScrollArea(QWidget* parent = nullptr) + : QScrollArea(parent) + { + } + +protected: + // Override eventFilter on resize events to set width + bool eventFilter(QObject* obj, QEvent* event) override + { + if (obj && obj == this->widget() && event->type() == QEvent::Resize) + { + int w = this->widget()->minimumSizeHint().width() + this->verticalScrollBar()->width(); + this->setMinimumWidth(w); + } + return QScrollArea::eventFilter(obj, event); + } +}; + +} // namespace + class qtOperationDialogInternals { public: @@ -95,10 +125,11 @@ void qtOperationDialog::buildUI( auto viewConfig = m_internals->m_uiManager->findOrCreateOperationView(); if (scrollable) { - QScrollArea* scroll = new QScrollArea(); + qtVerticalScrollArea* scroll = new qtVerticalScrollArea(); QWidget* viewport = new QWidget(); scroll->setWidget(viewport); scroll->setWidgetResizable(true); + QVBoxLayout* viewportLayout = new QVBoxLayout(viewport); viewport->setLayout(viewportLayout); @@ -158,9 +189,9 @@ void qtOperationDialog::buildUI( if (scrollable) { - // Set min size for reasonable display + // Set min height for reasonable display // Application can always override this - this->setMinimumSize(480, 320); + this->setMinimumHeight(480); } } diff --git a/smtk/extension/qt/qtOperationDialog.h b/smtk/extension/qt/qtOperationDialog.h index 9780f733c0..08f1e21be5 100644 --- a/smtk/extension/qt/qtOperationDialog.h +++ b/smtk/extension/qt/qtOperationDialog.h @@ -56,9 +56,12 @@ public: smtk::view::ManagerPtr viewManager, QWidget* parentWidget = nullptr); - // Use this constructor to include a scrolling area in the opertion - // view. Only set this flag if the operation parameters are - // lengthy and take up alot of vertical display space. + // Use this constructor to display the operation view in a + // vertically-scrolling area. You would generally only need + // this option if the operation parameters are lengthy and + // take up a significant amount of vertical display space. + // When setting the scrollable option, you would generally + // also want to call this class' setMinimumHeight() method. qtOperationDialog( smtk::operation::OperationPtr operation, smtk::resource::ManagerPtr resourceManager, -- GitLab From cc3e8fa5ebfbfb05b0930e8f950194aa65d009d2 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Thu, 27 May 2021 12:14:23 -0400 Subject: [PATCH 091/136] Update paraview plugin to use qtOperationDialog Also add logic to only expand horizontally if the contents are less than 1/2 screen wide. --- .../plugin/pqSMTKExportSimulationBehavior.cxx | 48 +++++-------------- smtk/extension/qt/qtOperationDialog.cxx | 24 +++++++++- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/smtk/extension/paraview/appcomponents/plugin/pqSMTKExportSimulationBehavior.cxx b/smtk/extension/paraview/appcomponents/plugin/pqSMTKExportSimulationBehavior.cxx index 10e0baed71..b20e4efc14 100644 --- a/smtk/extension/paraview/appcomponents/plugin/pqSMTKExportSimulationBehavior.cxx +++ b/smtk/extension/paraview/appcomponents/plugin/pqSMTKExportSimulationBehavior.cxx @@ -22,8 +22,7 @@ #include "smtk/attribute/StringItem.h" #include "smtk/extension/paraview/appcomponents/pqSMTKBehavior.h" #include "smtk/extension/paraview/appcomponents/pqSMTKWrapper.h" -#include "smtk/extension/qt/qtOperationView.h" -#include "smtk/extension/qt/qtUIManager.h" +#include "smtk/extension/qt/qtOperationDialog.h" #include "smtk/io/Logger.h" #include "smtk/operation/Manager.h" #include "smtk/operation/operators/ImportPythonOperation.h" @@ -31,12 +30,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include pqExportSimulationReaction::pqExportSimulationReaction(QAction* parentObject) @@ -114,34 +115,21 @@ void pqExportSimulationReaction::exportSimulation() auto exportOp = wrapper->smtkOperationManager()->create(result->findString("unique_name")->value()); - // Construct a modal dialog for the operation. - QSharedPointer exportDialog = QSharedPointer(new QDialog()); + // Construct a modal dialog for the operation spec + auto exportDialog = + QSharedPointer(new smtk::extension::qtOperationDialog( + exportOp, + wrapper->smtkResourceManager(), + wrapper->smtkViewManager(), + pqCoreUtilities::mainWidget())); exportDialog->setObjectName("SimulationExportDialog"); exportDialog->setWindowTitle("Simulation Export Dialog"); - exportDialog->setLayout(new QVBoxLayout(exportDialog.data())); - // TODO: the dialog size should not be set this way. It should auto-expand - // to accommodate the contained opView. Either Qt is being coy, or smtk's - // qtBaseView logic for resizing doesn't inform the containing parent of its - // decisions. - exportDialog->resize(600, 300); - - // Create a new UI for the dialog. - QSharedPointer uiManager = - QSharedPointer(new smtk::extension::qtUIManager( - exportOp, wrapper->smtkResourceManager(), wrapper->smtkViewManager())); - - // Create an operation view for the operation. - smtk::view::ConfigurationPtr view = uiManager->findOrCreateOperationView(); - smtk::extension::qtOperationView* opView = dynamic_cast( - uiManager->setSMTKView(view, exportDialog.data())); - - exportDialog->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // Alert the user if the operation fails. Close the dialog if the operation // succeeds. - connect( - opView, - &smtk::extension::qtOperationView::operationExecuted, + QObject::connect( + exportDialog.get(), + &smtk::extension::qtOperationDialog::operationExecuted, [=](const smtk::operation::Operation::Result& result) { if ( result->findInt("outcome")->value() != @@ -156,18 +144,8 @@ void pqExportSimulationReaction::exportSimulation() QGridLayout* layout = (QGridLayout*)msgBox.layout(); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); msgBox.exec(); - - // Once the user has accepted that their export failed, they are - // free to try again without changing any options. - opView->onModifiedParameters(); - } - else - { - exportDialog->done(QDialog::Accepted); } }); - - // Launch the modal dialog and wait for the operation to succeed. exportDialog->exec(); // Remove the export operation from the operation manager. diff --git a/smtk/extension/qt/qtOperationDialog.cxx b/smtk/extension/qt/qtOperationDialog.cxx index 16fb5b5780..ad498cac16 100644 --- a/smtk/extension/qt/qtOperationDialog.cxx +++ b/smtk/extension/qt/qtOperationDialog.cxx @@ -17,11 +17,15 @@ #include "smtk/model/Registrar.h" #include "smtk/view/Manager.h" +#include #include +#include #include #include #include #include +#include +#include #include #include #include @@ -29,6 +33,7 @@ #include #include #include +#include using namespace smtk::extension; @@ -49,8 +54,23 @@ protected: { if (obj && obj == this->widget() && event->type() == QEvent::Resize) { - int w = this->widget()->minimumSizeHint().width() + this->verticalScrollBar()->width(); - this->setMinimumWidth(w); + // Get width of contents + int contentsWidth = + this->widget()->minimumSizeHint().width() + this->verticalScrollBar()->width(); + + // Get width of screen +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + const QRect screenRect = QApplication::desktop()->screenGeometry(this->widget()); + int screenWidth = screenRect.width(); +#else + int screenWidth = this->widget()->screen()->size().width(); +#endif + // If contents width is less than 1/2 screen width, expand + // so that horizontal scrolling is not needed. + if (contentsWidth < screenWidth / 2) + { + this->setMinimumWidth(contentsWidth); + } } return QScrollArea::eventFilter(obj, event); } -- GitLab From 06c579a47cfe88c577c7e5aedd10ffccc445747b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 1 Jul 2021 12:59:50 -0400 Subject: [PATCH 092/136] data: remove discrete baseline images The discrete session was removed long ago and these are no longer necessary. --- data/baseline/smtk/discrete/createedges-SimpleBox.png | 3 --- data/baseline/smtk/discrete/createedges-hybridModelOneCube.png | 3 --- data/baseline/smtk/discrete/edge-split-test2D.png | 3 --- data/baseline/smtk/discrete/edgeOp2dm.png | 3 --- data/baseline/smtk/discrete/edgeOp2dm_1.png | 3 --- data/baseline/smtk/discrete/edgeOp2dm_2.png | 3 --- data/baseline/smtk/discrete/edgeOp2dm_3.png | 3 --- data/baseline/smtk/discrete/hybridModelOneCube.png | 3 --- data/baseline/smtk/discrete/import2dm.png | 3 --- data/baseline/smtk/discrete/import2dm_1.png | 3 --- data/baseline/smtk/discrete/import2dm_2.png | 3 --- data/baseline/smtk/discrete/pmdc.png | 3 --- data/baseline/smtk/discrete/smtkModelfrom2dm.png | 3 --- data/baseline/smtk/discrete/smtkModelfrom2dm_1.png | 3 --- data/baseline/smtk/discrete/smtkModelfrom2dm_2.png | 3 --- data/baseline/smtk/discrete/smtkModelfrom2dm_3.png | 3 --- 16 files changed, 48 deletions(-) delete mode 100644 data/baseline/smtk/discrete/createedges-SimpleBox.png delete mode 100644 data/baseline/smtk/discrete/createedges-hybridModelOneCube.png delete mode 100644 data/baseline/smtk/discrete/edge-split-test2D.png delete mode 100644 data/baseline/smtk/discrete/edgeOp2dm.png delete mode 100644 data/baseline/smtk/discrete/edgeOp2dm_1.png delete mode 100644 data/baseline/smtk/discrete/edgeOp2dm_2.png delete mode 100644 data/baseline/smtk/discrete/edgeOp2dm_3.png delete mode 100644 data/baseline/smtk/discrete/hybridModelOneCube.png delete mode 100644 data/baseline/smtk/discrete/import2dm.png delete mode 100644 data/baseline/smtk/discrete/import2dm_1.png delete mode 100644 data/baseline/smtk/discrete/import2dm_2.png delete mode 100644 data/baseline/smtk/discrete/pmdc.png delete mode 100644 data/baseline/smtk/discrete/smtkModelfrom2dm.png delete mode 100644 data/baseline/smtk/discrete/smtkModelfrom2dm_1.png delete mode 100644 data/baseline/smtk/discrete/smtkModelfrom2dm_2.png delete mode 100644 data/baseline/smtk/discrete/smtkModelfrom2dm_3.png diff --git a/data/baseline/smtk/discrete/createedges-SimpleBox.png b/data/baseline/smtk/discrete/createedges-SimpleBox.png deleted file mode 100644 index b94e763284..0000000000 --- a/data/baseline/smtk/discrete/createedges-SimpleBox.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7b82e97f8bb02470f809f3e9fc7402722a4811701e49ae7bb9131aea3a762ca1 -size 11170 diff --git a/data/baseline/smtk/discrete/createedges-hybridModelOneCube.png b/data/baseline/smtk/discrete/createedges-hybridModelOneCube.png deleted file mode 100644 index 6d55e036c7..0000000000 --- a/data/baseline/smtk/discrete/createedges-hybridModelOneCube.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:05a84647b48e465588479e8bbc06c904bc6f1e773377ba1c6cf3001489c4945c -size 2188 diff --git a/data/baseline/smtk/discrete/edge-split-test2D.png b/data/baseline/smtk/discrete/edge-split-test2D.png deleted file mode 100644 index 2f602232be..0000000000 --- a/data/baseline/smtk/discrete/edge-split-test2D.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7d91aabff49c48a07cd99206e5535b792e70eece4615158c8ea2fa0174a004a5 -size 1958 diff --git a/data/baseline/smtk/discrete/edgeOp2dm.png b/data/baseline/smtk/discrete/edgeOp2dm.png deleted file mode 100644 index ea99edea8f..0000000000 --- a/data/baseline/smtk/discrete/edgeOp2dm.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a50f5eea8368afefeaa2b2057f66639009a358e05c6ece99550202eacdf47d31 -size 10112 diff --git a/data/baseline/smtk/discrete/edgeOp2dm_1.png b/data/baseline/smtk/discrete/edgeOp2dm_1.png deleted file mode 100644 index 3043bc0fb4..0000000000 --- a/data/baseline/smtk/discrete/edgeOp2dm_1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:75bd5d0a683c98331f79c4819165367884b3c70b454abcc0dc62bac9a2d0182a -size 9209 diff --git a/data/baseline/smtk/discrete/edgeOp2dm_2.png b/data/baseline/smtk/discrete/edgeOp2dm_2.png deleted file mode 100644 index 623b73cf9b..0000000000 --- a/data/baseline/smtk/discrete/edgeOp2dm_2.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b8aba55ac754354b1c4c0a635fba8786724817c7eb5346ff428c1c7b5e1c5cd7 -size 38215 diff --git a/data/baseline/smtk/discrete/edgeOp2dm_3.png b/data/baseline/smtk/discrete/edgeOp2dm_3.png deleted file mode 100644 index ce6a82052c..0000000000 --- a/data/baseline/smtk/discrete/edgeOp2dm_3.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:140e33692731c609649ffd86178ede7715ea6d00a329f3d89a0c82ca35211500 -size 38193 diff --git a/data/baseline/smtk/discrete/hybridModelOneCube.png b/data/baseline/smtk/discrete/hybridModelOneCube.png deleted file mode 100644 index b93ef891ad..0000000000 --- a/data/baseline/smtk/discrete/hybridModelOneCube.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0d02d13a20d5bbfe70ea7dd93efd8b5f77a90f216c56aad8a364c05eb1077814 -size 1865 diff --git a/data/baseline/smtk/discrete/import2dm.png b/data/baseline/smtk/discrete/import2dm.png deleted file mode 100644 index 434115cfc0..0000000000 --- a/data/baseline/smtk/discrete/import2dm.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:44eeaeb3814db9a0cabd06a95db5cd3a3cf4c44faf2d98703bdeda4a9dc1eee7 -size 9964 diff --git a/data/baseline/smtk/discrete/import2dm_1.png b/data/baseline/smtk/discrete/import2dm_1.png deleted file mode 100644 index cddae1c6a3..0000000000 --- a/data/baseline/smtk/discrete/import2dm_1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e92ed67ffa57514d97011c8d231a8bb7d678d95b01a5f323a20faccd4adde0bd -size 39085 diff --git a/data/baseline/smtk/discrete/import2dm_2.png b/data/baseline/smtk/discrete/import2dm_2.png deleted file mode 100644 index 00b79ea21e..0000000000 --- a/data/baseline/smtk/discrete/import2dm_2.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:877270a81106a9bf402925fa3c672a9e479465d89d60e61013b8e3fb213223a2 -size 37271 diff --git a/data/baseline/smtk/discrete/pmdc.png b/data/baseline/smtk/discrete/pmdc.png deleted file mode 100644 index e208d5725a..0000000000 --- a/data/baseline/smtk/discrete/pmdc.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:12bc6bf453481cd42f54404f408e8340d649f79e2a6477763ff94b7664fdda07 -size 8199 diff --git a/data/baseline/smtk/discrete/smtkModelfrom2dm.png b/data/baseline/smtk/discrete/smtkModelfrom2dm.png deleted file mode 100644 index 2d6dc9dab8..0000000000 --- a/data/baseline/smtk/discrete/smtkModelfrom2dm.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cdbae873b6b9e7c01766964642183c273767fcca9c153d6bb261a017c06b2e03 -size 9332 diff --git a/data/baseline/smtk/discrete/smtkModelfrom2dm_1.png b/data/baseline/smtk/discrete/smtkModelfrom2dm_1.png deleted file mode 100644 index e243ce24f3..0000000000 --- a/data/baseline/smtk/discrete/smtkModelfrom2dm_1.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:88891c0a9b3ed9b3e3c6f7dd5fb4def8f27a20822c6d735e1d4aa1bdf5aa29bb -size 37141 diff --git a/data/baseline/smtk/discrete/smtkModelfrom2dm_2.png b/data/baseline/smtk/discrete/smtkModelfrom2dm_2.png deleted file mode 100644 index 81c798ad64..0000000000 --- a/data/baseline/smtk/discrete/smtkModelfrom2dm_2.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3feef7de810964b0bd76b5618a3e4a092d3b6ebdea8c5d78336002be30978c00 -size 38873 diff --git a/data/baseline/smtk/discrete/smtkModelfrom2dm_3.png b/data/baseline/smtk/discrete/smtkModelfrom2dm_3.png deleted file mode 100644 index 8fb223acd9..0000000000 --- a/data/baseline/smtk/discrete/smtkModelfrom2dm_3.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:454771220c3d193d875251db1092e0e829c31b89b9fbb9493c8a1c95c3729731 -size 9274 -- GitLab From 45adcffac61b57227bb9989e39ea6fa90c582f09 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 1 Jul 2021 13:03:36 -0400 Subject: [PATCH 093/136] data: remove testing data referenced only from discrete --- data/model/3d/cmb/simplebox.cmb | 3 --- data/model/3d/cmb/smooth_surface.cmb | 3 --- 2 files changed, 6 deletions(-) delete mode 100644 data/model/3d/cmb/simplebox.cmb delete mode 100644 data/model/3d/cmb/smooth_surface.cmb diff --git a/data/model/3d/cmb/simplebox.cmb b/data/model/3d/cmb/simplebox.cmb deleted file mode 100644 index 73ecebbf31..0000000000 --- a/data/model/3d/cmb/simplebox.cmb +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5b72a7123794bd9627db766a298002058dfa804b6a4a157fdb7486c86c0d4ab0 -size 42683 diff --git a/data/model/3d/cmb/smooth_surface.cmb b/data/model/3d/cmb/smooth_surface.cmb deleted file mode 100644 index 21b014ae23..0000000000 --- a/data/model/3d/cmb/smooth_surface.cmb +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f9dc6391c6f347cf7868528d3a59a14533ebbad3fc18d0946a8256cca85db7c4 -size 1652193 -- GitLab From dc8c3fd8ffb8db93d3c6ea0d03fed25dfd93b300 Mon Sep 17 00:00:00 2001 From: Ryan Krattiger Date: Tue, 6 Jul 2021 12:52:34 -0500 Subject: [PATCH 094/136] CI: Add XMS Mesher dependency to CI container --- .gitlab/ci/docker/fedora33-paraview/install_superbuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/ci/docker/fedora33-paraview/install_superbuild.sh b/.gitlab/ci/docker/fedora33-paraview/install_superbuild.sh index bd3df49bcd..96f9a77836 100755 --- a/.gitlab/ci/docker/fedora33-paraview/install_superbuild.sh +++ b/.gitlab/ci/docker/fedora33-paraview/install_superbuild.sh @@ -27,12 +27,12 @@ cmake -GNinja \ -DDEVELOPER_MODE_smtk:BOOL=ON \ -DENABLE_cmb:BOOL=OFF \ -DENABLE_cmbusersguide:BOOL=OFF \ - -DENABLE_smtkprojectmanager:BOOL=OFF \ -DENABLE_smtkresourcemanagerstate:BOOL=OFF \ -DENABLE_paraview:BOOL=ON \ -DENABLE_python3:BOOL=ON \ -DSUPPRESS_szip_OUTPUT:BOOL=OFF \ -DUSE_SYSTEM_qt5:BOOL=ON \ + -DENABLE_xmsmesher:BOOL=ON \ $sccache_settings \ "-D__BUILDBOT_INSTALL_LOCATION:PATH=$SUPERBUILD_PREFIX" \ "$workdir" -- GitLab From 4436d17bc52f120667b5179d2b5889852fa0c51f Mon Sep 17 00:00:00 2001 From: Ryan Krattiger Date: Tue, 6 Jul 2021 16:17:49 -0500 Subject: [PATCH 095/136] Update deprecation version 20.[06->07] --- smtk/common/Deprecation.h | 6 +++--- smtk/project/ResourceContainer.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/smtk/common/Deprecation.h b/smtk/common/Deprecation.h index 7a4f138dc1..210336fe07 100644 --- a/smtk/common/Deprecation.h +++ b/smtk/common/Deprecation.h @@ -56,10 +56,10 @@ #define SMTK_DEPRECATION_REASON(version_major, version_minor, reason) \ ("SMTK Deprecated in " #version_major "." #version_minor ": " #reason) -#if SMTK_DEPRECATION_LEVEL >= SMTK_VERSION_CHECK(21, 6) -#define SMTK_DEPRECATED_IN_21_06(reason) SMTK_DEPRECATION(SMTK_DEPRECATION_REASON(21, 6, reason)) +#if SMTK_DEPRECATION_LEVEL >= SMTK_VERSION_CHECK(21, 7) +#define SMTK_DEPRECATED_IN_21_07(reason) SMTK_DEPRECATION(SMTK_DEPRECATION_REASON(21, 7, reason)) #else -#define SMTK_DEPRECATED_IN_21_06(reason) +#define SMTK_DEPRECATED_IN_21_07(reason) #endif #endif // smtk_common_Deprecation_h diff --git a/smtk/project/ResourceContainer.h b/smtk/project/ResourceContainer.h index 6ba69471dc..e0d46b579e 100644 --- a/smtk/project/ResourceContainer.h +++ b/smtk/project/ResourceContainer.h @@ -122,7 +122,7 @@ public: /// Returns the resource that relates to the given role. If no association /// exists this will return a null pointer - SMTK_DEPRECATED_IN_21_06("New API is findByRole and returns a std::set") + SMTK_DEPRECATED_IN_21_07("New API is findByRole and returns a std::set") smtk::resource::ResourcePtr getByRole(const std::string& role) { auto resource_set = this->findByRole(role); @@ -136,7 +136,7 @@ public: } } - SMTK_DEPRECATED_IN_21_06("New API is findByRole and returns a std::set") + SMTK_DEPRECATED_IN_21_07("New API is findByRole and returns a std::set") smtk::resource::ConstResourcePtr getByRole(const std::string& role) const { auto resource_set = this->findByRole(role); @@ -151,14 +151,14 @@ public: } template - SMTK_DEPRECATED_IN_21_06("New API is findByRole and returns a std::set") + SMTK_DEPRECATED_IN_21_07("New API is findByRole and returns a std::set") smtk::shared_ptr getByRole(const std::string& role) { return std::dynamic_pointer_cast(this->getByRole(role)); } template - SMTK_DEPRECATED_IN_21_06("New API is findByRole and returns a std::set") + SMTK_DEPRECATED_IN_21_07("New API is findByRole and returns a std::set") smtk::shared_ptr getByRole(const std::string& role) const { return std::dynamic_pointer_cast(this->getByRole(role)); -- GitLab From 7018e0d2917a138ed8f5ce8a8a95bcbdb71d8cee Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 7 Jul 2021 08:32:29 -0400 Subject: [PATCH 096/136] ci: error out if installations fail --- .gitlab/ci/docker/fedora33-paraview/install_deps.sh | 2 ++ .gitlab/ci/docker/fedora33-vtk/install_deps.sh | 2 ++ .gitlab/ci/docker/fedora33/install_deps.sh | 2 ++ 3 files changed, 6 insertions(+) diff --git a/.gitlab/ci/docker/fedora33-paraview/install_deps.sh b/.gitlab/ci/docker/fedora33-paraview/install_deps.sh index a62c1b7b51..3a6c5837d8 100755 --- a/.gitlab/ci/docker/fedora33-paraview/install_deps.sh +++ b/.gitlab/ci/docker/fedora33-paraview/install_deps.sh @@ -1,5 +1,7 @@ #!/bin/sh +set -e + # Install build requirements. dnf install -y \ zlib-devel libcurl-devel python-devel python-unversioned-command \ diff --git a/.gitlab/ci/docker/fedora33-vtk/install_deps.sh b/.gitlab/ci/docker/fedora33-vtk/install_deps.sh index be06541b2c..4734424c62 100755 --- a/.gitlab/ci/docker/fedora33-vtk/install_deps.sh +++ b/.gitlab/ci/docker/fedora33-vtk/install_deps.sh @@ -1,5 +1,7 @@ #!/bin/sh +set -e + # Install build requirements. dnf install -y \ zlib-devel libcurl-devel python-devel \ diff --git a/.gitlab/ci/docker/fedora33/install_deps.sh b/.gitlab/ci/docker/fedora33/install_deps.sh index be06541b2c..4734424c62 100755 --- a/.gitlab/ci/docker/fedora33/install_deps.sh +++ b/.gitlab/ci/docker/fedora33/install_deps.sh @@ -1,5 +1,7 @@ #!/bin/sh +set -e + # Install build requirements. dnf install -y \ zlib-devel libcurl-devel python-devel \ -- GitLab From 2417d2e4bc09d77b0615ba819d9ae1eb2d997a73 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 7 Jul 2021 08:32:45 -0400 Subject: [PATCH 097/136] ci: avoid installing weak dependencies These should be explicitly listed if they're necessary. --- .gitlab/ci/docker/fedora33-paraview/install_deps.sh | 4 ++-- .gitlab/ci/docker/fedora33-vtk/install_deps.sh | 4 ++-- .gitlab/ci/docker/fedora33/install_deps.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitlab/ci/docker/fedora33-paraview/install_deps.sh b/.gitlab/ci/docker/fedora33-paraview/install_deps.sh index 3a6c5837d8..fddc9133a9 100755 --- a/.gitlab/ci/docker/fedora33-paraview/install_deps.sh +++ b/.gitlab/ci/docker/fedora33-paraview/install_deps.sh @@ -3,14 +3,14 @@ set -e # Install build requirements. -dnf install -y \ +dnf install -y --setopt=install_weak_deps=False \ zlib-devel libcurl-devel python-devel python-unversioned-command \ freeglut-devel glew-devel graphviz-devel libpng-devel mesa-dri-drivers \ libxcb libxcb-devel libXt-devel xcb-util xcb-util-devel mesa-libGL-devel \ libxkbcommon-devel diffutils hostname file # Install development tools -dnf install -y \ +dnf install -y --setopt=install_weak_deps=False \ gcc-c++ \ qt5-qtbase-devel \ qt5-qtsvg-devel \ diff --git a/.gitlab/ci/docker/fedora33-vtk/install_deps.sh b/.gitlab/ci/docker/fedora33-vtk/install_deps.sh index 4734424c62..06e8580678 100755 --- a/.gitlab/ci/docker/fedora33-vtk/install_deps.sh +++ b/.gitlab/ci/docker/fedora33-vtk/install_deps.sh @@ -3,14 +3,14 @@ set -e # Install build requirements. -dnf install -y \ +dnf install -y --setopt=install_weak_deps=False \ zlib-devel libcurl-devel python-devel \ freeglut-devel glew-devel graphviz-devel libpng-devel mesa-dri-drivers \ libxcb libxcb-devel libXt-devel xcb-util xcb-util-devel mesa-libGL-devel \ libxkbcommon-devel diffutils hostname file # Install development tools -dnf install -y \ +dnf install -y --setopt=install_weak_deps=False \ gcc-c++ \ qt5-qtbase-devel \ qt5-qtsvg-devel \ diff --git a/.gitlab/ci/docker/fedora33/install_deps.sh b/.gitlab/ci/docker/fedora33/install_deps.sh index 4734424c62..06e8580678 100755 --- a/.gitlab/ci/docker/fedora33/install_deps.sh +++ b/.gitlab/ci/docker/fedora33/install_deps.sh @@ -3,14 +3,14 @@ set -e # Install build requirements. -dnf install -y \ +dnf install -y --setopt=install_weak_deps=False \ zlib-devel libcurl-devel python-devel \ freeglut-devel glew-devel graphviz-devel libpng-devel mesa-dri-drivers \ libxcb libxcb-devel libXt-devel xcb-util xcb-util-devel mesa-libGL-devel \ libxkbcommon-devel diffutils hostname file # Install development tools -dnf install -y \ +dnf install -y --setopt=install_weak_deps=False \ gcc-c++ \ qt5-qtbase-devel \ qt5-qtsvg-devel \ -- GitLab From 9d8b041b2098f2ef1d7517dedd3ec2103fd0a049 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 7 Jul 2021 08:33:02 -0400 Subject: [PATCH 098/136] ci: install clang-tools-extra in the CI image --- .gitlab/ci/docker/fedora33-paraview/install_deps.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab/ci/docker/fedora33-paraview/install_deps.sh b/.gitlab/ci/docker/fedora33-paraview/install_deps.sh index fddc9133a9..a7f1c8b5b8 100755 --- a/.gitlab/ci/docker/fedora33-paraview/install_deps.sh +++ b/.gitlab/ci/docker/fedora33-paraview/install_deps.sh @@ -24,6 +24,10 @@ dnf install -y --setopt=install_weak_deps=False \ make \ chrpath +# Install static analysis tools +dnf install -y --setopt=install_weak_deps=False \ + clang-tools-extra + # Install memcheck tools dnf install -y \ libasan \ -- GitLab From 91e0e7924bba3d9b47abdf148131ed1aeff2b248 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 7 Jul 2021 08:33:25 -0400 Subject: [PATCH 099/136] gitlab-ci: make Linux builds verbose Just like the macOS and Windows builds. --- .gitlab/os-linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index fff8f7aa98..7bfe2363d4 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -119,7 +119,7 @@ - sccache --start-server - sccache --show-stats - "$LAUNCHER ctest -V -S .gitlab/ci/ctest_configure.cmake" - - "$LAUNCHER ctest -V -S .gitlab/ci/ctest_build.cmake" + - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake" - sccache --show-stats interruptible: true @@ -133,7 +133,7 @@ - sccache --start-server - sccache --show-stats - "$LAUNCHER ctest -V -S .gitlab/ci/ctest_configure.cmake" - - "$LAUNCHER ctest -V -S .gitlab/ci/ctest_build.cmake" + - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake" - sccache --show-stats interruptible: true -- GitLab From 24d70dcfb67d5abd8662d36ff873c3436c70966f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 7 Jul 2021 08:35:49 -0400 Subject: [PATCH 100/136] ci: exclude ParaView tests on Windows These tests need SMTK libraries added to `PATH` in order to work. --- .gitlab/ci/ctest_exclusions.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitlab/ci/ctest_exclusions.cmake b/.gitlab/ci/ctest_exclusions.cmake index 46ba589bae..1bb08da9b7 100644 --- a/.gitlab/ci/ctest_exclusions.cmake +++ b/.gitlab/ci/ctest_exclusions.cmake @@ -2,6 +2,15 @@ set(test_exclusions pv.MeshSelection ) +if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "windows") + list(APPEND test_exclusions + # PATH setup is needed for these to work. See: + # https://gitlab.kitware.com/paraview/paraview/-/merge_requests/5036 and + # https://gitlab.kitware.com/cmake/cmake/-/merge_requests/6299 + "^pv\\." + ) +endif () + if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "fedora") list(APPEND test_exclusions # VTK lighting seems to be wrong. -- GitLab From f6190b1c3b986c81d471cc896e5eb0c345a4d0d7 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 6 Jul 2021 16:03:06 -0400 Subject: [PATCH 101/136] testing/registrars: fix `registerTo` and `unregisterFrom` in examples With registration intended to be performed by RAII objects only, these example registrars need to adapt to the expected interface which includes: - using `const&` for the manager pointers - adding `unregisterFrom` methods --- smtk/project/examples/cxx/browseProject.cxx | 14 ++++++++++++-- smtk/project/testing/cxx/TestDefineOp.cxx | 14 ++++++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/smtk/project/examples/cxx/browseProject.cxx b/smtk/project/examples/cxx/browseProject.cxx index 18636d6bf6..1e5fe1c957 100644 --- a/smtk/project/examples/cxx/browseProject.cxx +++ b/smtk/project/examples/cxx/browseProject.cxx @@ -76,15 +76,25 @@ protected: struct Registrar { - static void registerTo(smtk::resource::Manager::Ptr& resourceManager) + static void registerTo(const smtk::resource::Manager::Ptr& resourceManager) { resourceManager->registerResource(); } - static void registerTo(smtk::project::Manager::Ptr& projectManager) + static void unregisterFrom(const smtk::resource::Manager::Ptr& resourceManager) + { + resourceManager->unregisterResource(); + } + + static void registerTo(const smtk::project::Manager::Ptr& projectManager) { projectManager->registerProject("MyProject", { "MyResource" }, {}); } + + static void unregisterFrom(const smtk::project::Manager::Ptr& projectManager) + { + // projectManager->unregisterProject("MyProject"); + } }; } // namespace diff --git a/smtk/project/testing/cxx/TestDefineOp.cxx b/smtk/project/testing/cxx/TestDefineOp.cxx index 6d9791e6ef..cecc4225df 100644 --- a/smtk/project/testing/cxx/TestDefineOp.cxx +++ b/smtk/project/testing/cxx/TestDefineOp.cxx @@ -59,15 +59,25 @@ protected: struct Registrar { - static void registerTo(smtk::resource::Manager::Ptr& resourceManager) + static void registerTo(const smtk::resource::Manager::Ptr& resourceManager) { resourceManager->registerResource(); } - static void registerTo(smtk::project::Manager::Ptr& projectManager) + static void unregisterFrom(const smtk::resource::Manager::Ptr& resourceManager) + { + resourceManager->unregisterResource(); + } + + static void registerTo(const smtk::project::Manager::Ptr& projectManager) { projectManager->registerProject("MyProject", { "MyResource" }, {}); } + + static void unregisterFrom(const smtk::project::Manager::Ptr& projectManager) + { + // projectManager->unregisterProject("MyProject"); + } }; } // namespace -- GitLab From 09157a57efa481273963a0a87278f00c0f4ba507 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 7 Jul 2021 13:16:12 -0400 Subject: [PATCH 102/136] Registry: add an `addToManagers` function This free function helps with calling `Registry` reliably without having to manually spell out the manager types for the `Registry` constructor. --- smtk/plugin/Registry.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/smtk/plugin/Registry.h b/smtk/plugin/Registry.h index e56e8d3e05..807ec3727f 100644 --- a/smtk/plugin/Registry.h +++ b/smtk/plugin/Registry.h @@ -430,6 +430,13 @@ public: }; #endif + +template +static Registry addToManagers(const std::shared_ptr&... manager) +{ + return Registry(manager...); +} + } // namespace plugin } // namespace smtk -- GitLab From 62868250cdbb93a4123c698922096fdaff484738 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 6 Jul 2021 17:20:05 -0400 Subject: [PATCH 103/136] registrars: use the new `addToManagers` methods This ensures that registrars are properly unregistered from the managers within a scope. --- applications/ModelViewer/main.cxx | 19 ++++-------- .../notes/manager-registry-tracking.rst | 9 ++++++ smtk/attribute/testing/cxx/unitCustomItem.cxx | 13 ++++---- .../testing/cxx/unitEvaluatorManager.cxx | 4 ++- smtk/attribute/testing/cxx/unitRegistrar.cxx | 26 +++++++++------- .../matplotlib/testing/cxx/RenderMesh.cxx | 8 ++--- .../extension/qt/examples/cxx/browseModel.cxx | 8 +++-- .../qt/examples/cxx/qtAttributePreview.cxx | 9 ++++-- .../qt/examples/cxx/qtOperationPreview.cxx | 12 ++++---- .../testing/cxx/UnitTestForceRequiredItem.cxx | 5 ++-- .../qt/testing/cxx/unitQtComponentItem.cxx | 7 ++--- .../operators/testing/cxx/DeleteSmtkCell.cxx | 16 +++++----- .../operators/testing/cxx/DeleteSmtkCell2.cxx | 16 +++++----- .../testing/cxx/displayAuxiliaryGeometry.cxx | 16 ++++------ .../testing/cxx/TestSelectionFootprint.cxx | 10 ++++--- smtk/model/testing/cxx/unitDeleterGroup.cxx | 6 ++-- smtk/model/testing/cxx/unitEntity.cxx | 12 ++++---- .../testing/cxx/TestRemoveResource.cxx | 11 +++---- smtk/project/examples/cxx/browseProject.cxx | 25 +++++++--------- smtk/project/testing/cxx/TestDefineOp.cxx | 6 ++-- .../testing/cxx/TestProjectAssociation.cxx | 5 ++-- .../testing/cxx/TestProjectLifeCycle.cxx | 8 ++--- .../cxx/TestProjectLifeCycle_Deprecated.cxx | 8 ++--- .../testing/cxx/TestProjectReadWrite.cxx | 24 +++++++-------- .../testing/cxx/TestProjectReadWrite2.cxx | 30 +++++++------------ .../cxx/TestProjectReadWrite2_Deprecated.cxx | 25 ++++++---------- .../testing/cxx/TestProjectReadWriteEmpty.cxx | 8 +++-- .../cxx/TestProjectReadWrite_Deprecated.cxx | 19 +++++------- smtk/resource/testing/cxx/helpers.cxx | 4 ++- .../testing/cxx/TestCreateUniformGridOp.cxx | 26 +++++----------- smtk/session/mesh/testing/cxx/TestMergeOp.cxx | 14 ++++----- .../testing/cxx/TestMeshSessionReadWrite.cxx | 13 ++++---- .../mesh/testing/cxx/TestTransformOp.cxx | 14 ++++----- .../testing/cxx/UnitTestPolygonImportPPG.cxx | 10 ++++--- .../testing/cxx/UnitTestPolygonReadWrite.cxx | 14 ++++----- smtk/task/testing/cxx/TestActive.cxx | 20 ++++++------- smtk/task/testing/cxx/TestTask.cxx | 20 ++++++------- smtk/view/testing/cxx/unitBadge.cxx | 4 ++- smtk/view/testing/cxx/unitOperationIcon.cxx | 8 +++-- smtk/view/testing/cxx/unitPhraseModel.cxx | 4 ++- smtk/view/testing/cxx/utility.cxx | 7 ++--- 41 files changed, 245 insertions(+), 278 deletions(-) create mode 100644 doc/release/notes/manager-registry-tracking.rst diff --git a/applications/ModelViewer/main.cxx b/applications/ModelViewer/main.cxx index 340ff72611..3caa6a49b2 100644 --- a/applications/ModelViewer/main.cxx +++ b/applications/ModelViewer/main.cxx @@ -36,6 +36,8 @@ #include "smtk/operation/Manager.h" +#include "smtk/plugin/Registry.h" + #include #include #include @@ -67,26 +69,15 @@ int main(int argc, char* argv[]) // Create a resource manager smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - // Register mesh resources to the resource manager - { - smtk::session::mesh::Registrar::registerTo(resourceManager); - } - // Create an operation manager smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - // Register mesh operators to the operation manager - { - smtk::session::mesh::Registrar::registerTo(operationManager); - } - // Create a geometry manager smtk::geometry::Manager::Ptr geometryManager = smtk::geometry::Manager::create(); - // Register mesh geometry to the geometry manager - { - smtk::session::mesh::Registrar::registerTo(geometryManager); - } + // Register mesh resources to the resource, operation, and geomety managers. + auto registry = smtk::plugin::addToManagers( + resourceManager, operationManager, geometryManager); // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). diff --git a/doc/release/notes/manager-registry-tracking.rst b/doc/release/notes/manager-registry-tracking.rst new file mode 100644 index 0000000000..d7f10a5005 --- /dev/null +++ b/doc/release/notes/manager-registry-tracking.rst @@ -0,0 +1,9 @@ +Manager/registry tracking +========================= + +Tracking of registrations between registrars and managers should now only be +done through a held ``Registry`` instance as returned by the +``Registrar::addToManagers`` method. In the future, direct access to +``Registrar::registerTo`` and ``Registrar::unregisterFrom`` will be disabled +and the ``Registry`` RAII object will be the only way to manage registrations. +This ensures that registrations are accurately tracked. diff --git a/smtk/attribute/testing/cxx/unitCustomItem.cxx b/smtk/attribute/testing/cxx/unitCustomItem.cxx index 54c1505c93..40d06ee6b6 100644 --- a/smtk/attribute/testing/cxx/unitCustomItem.cxx +++ b/smtk/attribute/testing/cxx/unitCustomItem.cxx @@ -36,6 +36,8 @@ #include "smtk/operation/Manager.h" #include "smtk/operation/Registrar.h" +#include "smtk/plugin/Registry.h" + #include "smtk/io/AttributeReader.h" #include "smtk/io/AttributeWriter.h" #include "smtk/io/Logger.h" @@ -242,11 +244,9 @@ int unitCustomItem(int /*unused*/, char* /*unused*/[]) auto managers = smtk::common::Managers::create(); // Construct smtk managers - { - smtk::resource::Registrar::registerTo(managers); - smtk::operation::Registrar::registerTo(managers); - smtk::attribute::Registrar::registerTo(managers); - } + auto resourceRegistry = smtk::plugin::addToManagers(managers); + auto operationRegistry = smtk::plugin::addToManagers(managers); + auto attributeRegistry = smtk::plugin::addToManagers(managers); // access smtk managers auto resourceManager = managers->get(); @@ -254,8 +254,9 @@ int unitCustomItem(int /*unused*/, char* /*unused*/[]) auto itemDefinitionManager = managers->get(); // Initialize smtk managers + auto attributeOpRegistry = + smtk::plugin::addToManagers(operationManager); { - smtk::attribute::Registrar::registerTo(operationManager); operationManager->registerResourceManager(resourceManager); itemDefinitionManager->registerDefinitions(); } diff --git a/smtk/attribute/testing/cxx/unitEvaluatorManager.cxx b/smtk/attribute/testing/cxx/unitEvaluatorManager.cxx index b2c9fdd77e..ab26434c1d 100644 --- a/smtk/attribute/testing/cxx/unitEvaluatorManager.cxx +++ b/smtk/attribute/testing/cxx/unitEvaluatorManager.cxx @@ -17,6 +17,8 @@ #include "smtk/common/testing/cxx/helpers.h" +#include "smtk/plugin/Registry.h" + #include "smtk/resource/Manager.h" class FooEvaluator : public smtk::attribute::Evaluator @@ -52,7 +54,7 @@ int unitEvaluatorManager(int /*argc*/, char** const /*argv*/) auto resourceManager = smtk::resource::Manager::create(); evaluatorManager->registerResourceManager(resourceManager); - smtk::attribute::Registrar::registerTo(resourceManager); + auto attributeRegistry = smtk::plugin::addToManagers(resourceManager); smtkTest( evaluatorManager->registerEvaluator("FooEvaluator"), diff --git a/smtk/attribute/testing/cxx/unitRegistrar.cxx b/smtk/attribute/testing/cxx/unitRegistrar.cxx index 8bafaf8555..3bc2db3b5c 100644 --- a/smtk/attribute/testing/cxx/unitRegistrar.cxx +++ b/smtk/attribute/testing/cxx/unitRegistrar.cxx @@ -14,6 +14,8 @@ #include "smtk/common/Managers.h" #include "smtk/common/testing/cxx/helpers.h" +#include "smtk/plugin/Registry.h" + #include "smtk/resource/Manager.h" #include "smtk/resource/Registrar.h" @@ -22,25 +24,27 @@ void testDefaultEvaluatorRegistration() { auto managers = smtk::common::Managers::create(); - smtk::resource::Registrar::registerTo(managers); - smtk::attribute::Registrar::registerTo(managers); + auto resourceRegistry = smtk::plugin::addToManagers(managers); + auto attributeRegistry = smtk::plugin::addToManagers(managers); auto resourceManager = managers->get(); auto evaluatorManager = managers->get(); - smtk::attribute::Registrar::registerTo(evaluatorManager); + auto attributeResourceRegistry = + smtk::plugin::addToManagers(resourceManager); - smtk::attribute::Registrar::registerTo(resourceManager); auto attRes = resourceManager->create(); auto infixDefinition = attRes->createDefinition("infixExpression"); - smtkTest( - attRes->evaluatorFactory().addDefinitionForEvaluator( - "InfixExpressionEvaluator", infixDefinition->type()) == true, - "Expected to be able to add definition for InfixExpressionEvaluator because " - "Registrar already registered InfixExpressionEvaluator.") - - smtk::attribute::Registrar::unregisterFrom(evaluatorManager); + { + auto attributeEvalRegistry = + smtk::plugin::addToManagers(evaluatorManager); + smtkTest( + attRes->evaluatorFactory().addDefinitionForEvaluator( + "InfixExpressionEvaluator", infixDefinition->type()) == true, + "Expected to be able to add definition for InfixExpressionEvaluator because " + "Registrar already registered InfixExpressionEvaluator."); + } auto fooDefinition = attRes->createDefinition("fooExpression"); diff --git a/smtk/extension/matplotlib/testing/cxx/RenderMesh.cxx b/smtk/extension/matplotlib/testing/cxx/RenderMesh.cxx index e9a76f5c09..72d8ea3fbe 100644 --- a/smtk/extension/matplotlib/testing/cxx/RenderMesh.cxx +++ b/smtk/extension/matplotlib/testing/cxx/RenderMesh.cxx @@ -24,6 +24,8 @@ #include "smtk/operation/Operation.h" +#include "smtk/plugin/Registry.h" + #include #include @@ -68,10 +70,8 @@ int RenderMesh(int argc, char* argv[]) smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); // Register matplotlib operators to the operation manager - { - smtk::extension::matplotlib::Registrar registrar; - registrar.registerTo(operationManager); - } + auto registry = + smtk::plugin::addToManagers(operationManager); // Access a 2-dimensional mesh with interesting z-features from the // data directory diff --git a/smtk/extension/qt/examples/cxx/browseModel.cxx b/smtk/extension/qt/examples/cxx/browseModel.cxx index 2f036765c8..6cf1609838 100644 --- a/smtk/extension/qt/examples/cxx/browseModel.cxx +++ b/smtk/extension/qt/examples/cxx/browseModel.cxx @@ -31,6 +31,8 @@ #include "smtk/common/testing/cxx/helpers.h" #include "smtk/model/testing/cxx/helpers.h" +#include "smtk/plugin/Registry.h" + #include #include #include @@ -67,9 +69,9 @@ int main(int argc, char* argv[]) auto operationManager = smtk::operation::Manager::create(); auto resourceManager = smtk::resource::Manager::create(); auto viewManager = smtk::view::Manager::create(); - smtk::view::Registrar::registerTo(viewManager); - smtk::model::Registrar::registerTo(resourceManager); - smtk::attribute::Registrar::registerTo(resourceManager); + auto viewRegistry = smtk::plugin::addToManagers(viewManager); + auto modelRegistry = smtk::plugin::addToManagers(resourceManager); + auto attributeRegistry = smtk::plugin::addToManagers(resourceManager); nlohmann::json jconfig; if (configname) diff --git a/smtk/extension/qt/examples/cxx/qtAttributePreview.cxx b/smtk/extension/qt/examples/cxx/qtAttributePreview.cxx index ce8e738f46..2d7bb7966a 100644 --- a/smtk/extension/qt/examples/cxx/qtAttributePreview.cxx +++ b/smtk/extension/qt/examples/cxx/qtAttributePreview.cxx @@ -43,6 +43,8 @@ // SMTK build tree includes #include "smtk/operation/Operation_xml.h" +#include "smtk/plugin/Registry.h" + // Qt includes #include #include @@ -288,10 +290,11 @@ int main(int argc, char* argv[]) // Initialize operation manager and view manager auto operationManager = smtk::operation::Manager::create(); - smtk::attribute::Registrar::registerTo(operationManager); + auto attributeRegistry = + smtk::plugin::addToManagers(operationManager); auto viewManager = smtk::view::Manager::create(); - smtk::view::Registrar::registerTo(viewManager); - smtk::extension::qtViewRegistrar::registerTo(viewManager); + auto viewRegistry = smtk::plugin::addToManagers(viewManager); + auto qtViewRegistry = smtk::plugin::addToManagers(viewManager); // Instantiate smtk's qtUIManager smtk::extension::qtUIManager* uiManager = new smtk::extension::qtUIManager(attResource); diff --git a/smtk/extension/qt/examples/cxx/qtOperationPreview.cxx b/smtk/extension/qt/examples/cxx/qtOperationPreview.cxx index 04a5fa2ce3..c693faa6a1 100644 --- a/smtk/extension/qt/examples/cxx/qtOperationPreview.cxx +++ b/smtk/extension/qt/examples/cxx/qtOperationPreview.cxx @@ -15,6 +15,7 @@ #include "smtk/model/Registrar.h" #include "smtk/operation/Manager.h" #include "smtk/operation/Registrar.h" +#include "smtk/plugin/Registry.h" #include "smtk/resource/Manager.h" #include "smtk/view/Manager.h" @@ -59,13 +60,12 @@ int main(int argc, char* argv[]) // Initialize smtk managers auto resManager = smtk::resource::Manager::create(); - smtk::attribute::Registrar::registerTo(resManager); - smtk::model::Registrar::registerTo(resManager); auto opManager = smtk::operation::Manager::create(); opManager->registerResourceManager(resManager); - smtk::attribute::Registrar::registerTo(opManager); - smtk::model::Registrar::registerTo(opManager); + auto attributeRegistry = + smtk::plugin::addToManagers(resManager, opManager); + auto modelRegistry = smtk::plugin::addToManagers(resManager, opManager); // Process command line QCommandLineParser parser; @@ -115,8 +115,8 @@ int main(int argc, char* argv[]) // Initialize and register managers auto viewManager = smtk::view::Manager::create(); - smtk::view::Registrar::registerTo(viewManager); - smtk::extension::qtViewRegistrar::registerTo(viewManager); + auto viewRegistry = smtk::plugin::addToManagers(viewManager); + auto qtViewRegistry = smtk::plugin::addToManagers(viewManager); // Initialize dialog smtk::extension::qtOperationDialog dialog(op, resManager, viewManager, false, nullptr); diff --git a/smtk/extension/qt/testing/cxx/UnitTestForceRequiredItem.cxx b/smtk/extension/qt/testing/cxx/UnitTestForceRequiredItem.cxx index 2c20eda35a..ec9b230b2e 100644 --- a/smtk/extension/qt/testing/cxx/UnitTestForceRequiredItem.cxx +++ b/smtk/extension/qt/testing/cxx/UnitTestForceRequiredItem.cxx @@ -16,6 +16,7 @@ #include "smtk/extension/qt/qtViewRegistrar.h" #include "smtk/io/AttributeReader.h" #include "smtk/io/Logger.h" +#include "smtk/plugin/Registry.h" #include "smtk/view/Manager.h" #include "smtk/view/Registrar.h" @@ -69,8 +70,8 @@ int UnitTestForceRequiredItem(int argc, char** const argv) // Initialize view and UI managers auto viewManager = smtk::view::Manager::create(); - smtk::view::Registrar::registerTo(viewManager); - smtk::extension::qtViewRegistrar::registerTo(viewManager); + auto viewRegistry = smtk::plugin::addToManagers(viewManager); + auto qtViewRegistry = smtk::plugin::addToManagers(viewManager); smtk::extension::qtUIManager* uiManager = new smtk::extension::qtUIManager(attResource); uiManager->setViewManager(viewManager); diff --git a/smtk/extension/qt/testing/cxx/unitQtComponentItem.cxx b/smtk/extension/qt/testing/cxx/unitQtComponentItem.cxx index b90b887ccb..b4e2c4ca9b 100644 --- a/smtk/extension/qt/testing/cxx/unitQtComponentItem.cxx +++ b/smtk/extension/qt/testing/cxx/unitQtComponentItem.cxx @@ -177,10 +177,9 @@ int unitQtComponentItem(int argc, char* argv[]) // those resources registered with rsrcMgr: operMgr->registerResourceManager(rsrcMgr); - auto registry = smtk::plugin:: - Registry( - rsrcMgr, operMgr); - smtk::view::Registrar::registerTo(viewMgr); + auto polygonRegistry = + smtk::plugin::addToManagers(rsrcMgr, operMgr); + auto viewRegistry = smtk::plugin::addToManagers(viewMgr); // Constructing the PhraseModel with a View properly initializes the SubphraseGenerator // to point back to the model (thus ensuring subphrases are decorated). This is required diff --git a/smtk/extension/vtk/operators/testing/cxx/DeleteSmtkCell.cxx b/smtk/extension/vtk/operators/testing/cxx/DeleteSmtkCell.cxx index 5bc2295d94..82cf1cc832 100644 --- a/smtk/extension/vtk/operators/testing/cxx/DeleteSmtkCell.cxx +++ b/smtk/extension/vtk/operators/testing/cxx/DeleteSmtkCell.cxx @@ -34,6 +34,8 @@ #include "smtk/operation/Registrar.h" #include "smtk/operation/operators/ReadResource.h" +#include "smtk/plugin/Registry.h" + #include "smtk/session/polygon/Registrar.h" #include "smtk/session/polygon/Resource.h" #include "smtk/session/polygon/operators/Delete.h" @@ -69,18 +71,14 @@ int main(int argc, char* argv[]) // Create a resource manager smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - { - smtk::session::polygon::Registrar::registerTo(resourceManager); - } - // Create an operation manager smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - { - smtk::operation::Registrar::registerTo(operationManager); - smtk::model::Registrar::registerTo(operationManager); - smtk::session::polygon::Registrar::registerTo(operationManager); - } + auto operationRegistry = + smtk::plugin::addToManagers(operationManager); + auto modelRegistry = smtk::plugin::addToManagers(operationManager); + auto polygonRegistry = smtk::plugin::addToManagers( + resourceManager, operationManager); // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). diff --git a/smtk/extension/vtk/operators/testing/cxx/DeleteSmtkCell2.cxx b/smtk/extension/vtk/operators/testing/cxx/DeleteSmtkCell2.cxx index 99f7f79e55..d13c762bf2 100644 --- a/smtk/extension/vtk/operators/testing/cxx/DeleteSmtkCell2.cxx +++ b/smtk/extension/vtk/operators/testing/cxx/DeleteSmtkCell2.cxx @@ -32,6 +32,8 @@ #include "smtk/operation/Registrar.h" #include "smtk/operation/operators/ReadResource.h" +#include "smtk/plugin/Registry.h" + #include "smtk/session/polygon/Registrar.h" #include "smtk/session/polygon/Resource.h" #include "smtk/session/polygon/operators/Delete.h" @@ -68,18 +70,14 @@ int main(int argc, char* argv[]) // Create a resource manager smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - { - smtk::session::polygon::Registrar::registerTo(resourceManager); - } - // Create an operation manager smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - { - smtk::operation::Registrar::registerTo(operationManager); - smtk::model::Registrar::registerTo(operationManager); - smtk::session::polygon::Registrar::registerTo(operationManager); - } + auto operationRegistry = + smtk::plugin::addToManagers(operationManager); + auto modelRegistry = smtk::plugin::addToManagers(operationManager); + auto polygonRegistry = smtk::plugin::addToManagers( + resourceManager, operationManager); // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). diff --git a/smtk/extension/vtk/source/testing/cxx/displayAuxiliaryGeometry.cxx b/smtk/extension/vtk/source/testing/cxx/displayAuxiliaryGeometry.cxx index dc01b3cce5..40dae6fd97 100644 --- a/smtk/extension/vtk/source/testing/cxx/displayAuxiliaryGeometry.cxx +++ b/smtk/extension/vtk/source/testing/cxx/displayAuxiliaryGeometry.cxx @@ -34,6 +34,8 @@ #include "smtk/operation/Manager.h" +#include "smtk/plugin/Registry.h" + #include "smtk/extension/vtk/source/vtkModelMultiBlockSource.h" #include "vtkActor.h" @@ -125,19 +127,13 @@ int main(int argc, char* argv[]) // Create a resource manager smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - // Register mesh resources to the resource manager - { - smtk::session::mesh::Registrar::registerTo(resourceManager); - } - // Create an operation manager smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - // Register model and mesh operators to the operation manager - { - smtk::model::Registrar::registerTo(operationManager); - smtk::session::mesh::Registrar::registerTo(operationManager); - } + // Register model and mesh operators to the managers + auto modelRegistry = smtk::plugin::addToManagers(operationManager); + auto meshRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). diff --git a/smtk/geometry/testing/cxx/TestSelectionFootprint.cxx b/smtk/geometry/testing/cxx/TestSelectionFootprint.cxx index 120756470c..baeb72c29a 100644 --- a/smtk/geometry/testing/cxx/TestSelectionFootprint.cxx +++ b/smtk/geometry/testing/cxx/TestSelectionFootprint.cxx @@ -34,6 +34,8 @@ #include "smtk/resource/DerivedFrom.h" #include "smtk/resource/Manager.h" +#include "smtk/plugin/Registry.h" + #include "smtk/common/testing/cxx/helpers.h" #include @@ -185,11 +187,11 @@ int TestSelectionFootprint(int /*unused*/, char** const /*unused*/) geometryManager->registerBackend(); RegisterBackend::registerClass(); - smtk::model::Registrar::registerTo(resourceManager); - smtk::model::Registrar::registerTo(operationManager); + auto modelRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); - smtk::attribute::Registrar::registerTo(resourceManager); - smtk::attribute::Registrar::registerTo(operationManager); + auto attributeRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); // Create a new model resource type auto modelRsrc = resourceManager->create(); diff --git a/smtk/model/testing/cxx/unitDeleterGroup.cxx b/smtk/model/testing/cxx/unitDeleterGroup.cxx index 057bc04f34..3af67a26b4 100644 --- a/smtk/model/testing/cxx/unitDeleterGroup.cxx +++ b/smtk/model/testing/cxx/unitDeleterGroup.cxx @@ -20,6 +20,8 @@ #include "smtk/resource/Manager.h" +#include "smtk/plugin/Registry.h" + #include "smtk/common/testing/cxx/helpers.h" #include "smtk/model/testing/cxx/helpers.h" @@ -30,8 +32,8 @@ int unitDeleterGroup(int argc, char* argv[]) auto resourceManager = smtk::resource::Manager::create(); auto operationManager = smtk::operation::Manager::create(); - smtk::model::Registrar::registerTo(resourceManager); - smtk::model::Registrar::registerTo(operationManager); + auto modelRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); smtk::operation::DeleterGroup deleters(operationManager); diff --git a/smtk/model/testing/cxx/unitEntity.cxx b/smtk/model/testing/cxx/unitEntity.cxx index bcd0f62e9a..372d495c3d 100644 --- a/smtk/model/testing/cxx/unitEntity.cxx +++ b/smtk/model/testing/cxx/unitEntity.cxx @@ -21,6 +21,8 @@ #include "smtk/common/testing/cxx/helpers.h" +#include "smtk/plugin/Registry.h" + #include "smtk/session/polygon/Registrar.h" #include "smtk/session/polygon/Resource.h" @@ -491,14 +493,10 @@ int TestEntityQueryFunctor() std::cout << "\nTesting Entity::filterStringToQueryFunctor()\n\n"; // I. Load in a test model smtk::resource::Manager::Ptr rsrcMgr = smtk::resource::Manager::create(); - { - smtk::session::polygon::Registrar::registerTo(rsrcMgr); - } smtk::operation::Manager::Ptr operMgr = smtk::operation::Manager::create(); - { - smtk::operation::Registrar::registerTo(operMgr); - smtk::session::polygon::Registrar::registerTo(operMgr); - } + auto polygonRegistry = + smtk::plugin::addToManagers(rsrcMgr, operMgr); + auto operationRegistry = smtk::plugin::addToManagers(operMgr); // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). operMgr->registerResourceManager(rsrcMgr); diff --git a/smtk/operation/testing/cxx/TestRemoveResource.cxx b/smtk/operation/testing/cxx/TestRemoveResource.cxx index ca24e711fd..a12e8a8f48 100644 --- a/smtk/operation/testing/cxx/TestRemoveResource.cxx +++ b/smtk/operation/testing/cxx/TestRemoveResource.cxx @@ -17,6 +17,8 @@ #include "smtk/operation/Registrar.h" #include "smtk/operation/operators/RemoveResource.h" +#include "smtk/plugin/Registry.h" + #include "smtk/resource/Component.h" #include "smtk/resource/DerivedFrom.h" #include "smtk/resource/Manager.h" @@ -58,18 +60,17 @@ int TestRemoveResource(int /*unused*/, char** const /*unused*/) auto managers = smtk::common::Managers::create(); // Construct smtk managers - { - smtk::resource::Registrar::registerTo(managers); - smtk::operation::Registrar::registerTo(managers); - } + auto resourceRegistry = smtk::plugin::addToManagers(managers); + auto operationRegistry = smtk::plugin::addToManagers(managers); // access smtk managers auto resourceManager = managers->get(); auto operationManager = managers->get(); // Initialize smtk managers + auto operationOpRegistry = + smtk::plugin::addToManagers(operationManager); { - smtk::operation::Registrar::registerTo(operationManager); operationManager->registerResourceManager(resourceManager); } diff --git a/smtk/project/examples/cxx/browseProject.cxx b/smtk/project/examples/cxx/browseProject.cxx index 1e5fe1c957..806e1e0115 100644 --- a/smtk/project/examples/cxx/browseProject.cxx +++ b/smtk/project/examples/cxx/browseProject.cxx @@ -24,6 +24,8 @@ #include "smtk/attribute/Registrar.h" +#include "smtk/plugin/Registry.h" + #include "smtk/project/examples/cxx/ProjectBrowser.h" #include "smtk/project/Manager.h" @@ -115,24 +117,19 @@ int main(int argc, char* argv[]) // Create a resource manager smtk::resource::ManagerPtr resourceManager = smtk::resource::Manager::create(); - // Register project resources with the resource manager - smtk::project::Registrar::registerTo(resourceManager); - - // Register MyResource - ::Registrar::registerTo(resourceManager); - // Create an operation manager smtk::operation::ManagerPtr operationManager = smtk::operation::Manager::create(); - // Register project operations with the operation manager - smtk::project::Registrar::registerTo(operationManager); + // Register project resources and operations with their managers + auto projectRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); // Create a project manager smtk::project::ManagerPtr projectManager = smtk::project::Manager::create(resourceManager, operationManager); - // Register our not-so-custom Project with the manager. - ::Registrar::registerTo(projectManager); + // Register MyResource our not-so-custom Project with the manager. + auto registry = smtk::plugin::addToManagers<::Registrar>(resourceManager, projectManager); // Create an instance of smtk::project::Project auto project = projectManager->create("MyProject"); @@ -145,10 +142,10 @@ int main(int argc, char* argv[]) project->resources().add(myResource); auto viewManager = smtk::view::Manager::create(); - smtk::view::Registrar::registerTo(viewManager); - smtk::model::Registrar::registerTo(resourceManager); - smtk::attribute::Registrar::registerTo(resourceManager); - smtk::project::Registrar::registerTo(viewManager); + auto viewRegistry = smtk::plugin::addToManagers(viewManager); + auto modelRegistry = smtk::plugin::addToManagers(resourceManager); + auto attributeRegistry = smtk::plugin::addToManagers(resourceManager); + auto projectViewRegistry = smtk::plugin::addToManagers(viewManager); nlohmann::json jconfig; if (configname) diff --git a/smtk/project/testing/cxx/TestDefineOp.cxx b/smtk/project/testing/cxx/TestDefineOp.cxx index cecc4225df..97c17f895e 100644 --- a/smtk/project/testing/cxx/TestDefineOp.cxx +++ b/smtk/project/testing/cxx/TestDefineOp.cxx @@ -20,6 +20,8 @@ #include "smtk/project/Registrar.h" #include "smtk/project/operators/Define.h" +#include "smtk/plugin/Registry.h" + #include "smtk/common/testing/cxx/helpers.h" // This test registers a project type ("MyProject") with a resource whitelist with @@ -90,7 +92,7 @@ int TestDefineOp(int /*unused*/, char** const /*unused*/) smtkTest(resourceManager->empty(), "New resource manager should have no resources."); // Register MyResource - ::Registrar::registerTo(resourceManager); + auto registry = smtk::plugin::addToManagers<::Registrar>(resourceManager); smtkTest( resourceManager->metadata().size() == 1, "Resource manager should have registered a type."); @@ -102,7 +104,7 @@ int TestDefineOp(int /*unused*/, char** const /*unused*/) smtk::project::Manager::create(resourceManager, operationManager); // Register project operations with the project manager - smtk::project::Registrar::registerTo(projectManager); + auto projectRegistry = smtk::plugin::addToManagers(projectManager); auto createProjectTypeOp = operationManager->create(); diff --git a/smtk/project/testing/cxx/TestProjectAssociation.cxx b/smtk/project/testing/cxx/TestProjectAssociation.cxx index 0bde21581c..ccd60c301d 100644 --- a/smtk/project/testing/cxx/TestProjectAssociation.cxx +++ b/smtk/project/testing/cxx/TestProjectAssociation.cxx @@ -13,6 +13,7 @@ #include "smtk/attribute/Resource.h" #include "smtk/io/AttributeReader.h" #include "smtk/io/Logger.h" +#include "smtk/plugin/Registry.h" #include "smtk/project/Manager.h" #include "smtk/project/Project.h" #include "smtk/project/Registrar.h" @@ -44,10 +45,10 @@ int TestProjectAssociation(int /*unused*/, char** const /*unused*/) std::cout << templateString << std::endl; // Create managers smtk::resource::ManagerPtr resManager = smtk::resource::Manager::create(); - smtk::attribute::Registrar::registerTo(resManager); + auto attributeRegistry = smtk::plugin::addToManagers(resManager); smtk::operation::ManagerPtr opManager = smtk::operation::Manager::create(); smtk::project::ManagerPtr prjManager = smtk::project::Manager::create(resManager, opManager); - smtk::project::Registrar::registerTo(prjManager); + auto projectRegistry = smtk::plugin::addToManagers(prjManager); // Register and create test project // The process of registering our foo project also registers a resource with the same name. diff --git a/smtk/project/testing/cxx/TestProjectLifeCycle.cxx b/smtk/project/testing/cxx/TestProjectLifeCycle.cxx index a5cfc241b2..eba0f8d3f8 100644 --- a/smtk/project/testing/cxx/TestProjectLifeCycle.cxx +++ b/smtk/project/testing/cxx/TestProjectLifeCycle.cxx @@ -18,6 +18,7 @@ #include "smtk/operation/Manager.h" #include "smtk/operation/Operation.h" #include "smtk/operation/XMLOperation.h" +#include "smtk/plugin/Registry.h" #include "smtk/project/Manager.h" #include "smtk/project/Project.h" #include "smtk/project/Registrar.h" @@ -124,10 +125,9 @@ int TestProjectLifeCycle(int /*unused*/, char** const /*unused*/) { // Create managers smtk::resource::ManagerPtr resManager = smtk::resource::Manager::create(); - smtk::attribute::Registrar::registerTo(resManager); - smtk::operation::ManagerPtr opManager = smtk::operation::Manager::create(); - smtk::attribute::Registrar::registerTo(opManager); + auto attributeRegistry = + smtk::plugin::addToManagers(resManager, opManager); #if 0 // This line changes behavior such that projects ARE stored in resource manager @@ -137,7 +137,7 @@ int TestProjectLifeCycle(int /*unused*/, char** const /*unused*/) opManager->registerOperation("CreateProjectOp"); smtk::project::ManagerPtr projManager = smtk::project::Manager::create(resManager, opManager); - smtk::project::Registrar::registerTo(projManager); + auto projectRegistry = smtk::plugin::addToManagers(projManager); projManager->registerProject(PROJECT_TYPE); smtkTest(resManager->empty(), "resource manager size is " << resManager->size()); diff --git a/smtk/project/testing/cxx/TestProjectLifeCycle_Deprecated.cxx b/smtk/project/testing/cxx/TestProjectLifeCycle_Deprecated.cxx index 0743644d01..27fd9c728a 100644 --- a/smtk/project/testing/cxx/TestProjectLifeCycle_Deprecated.cxx +++ b/smtk/project/testing/cxx/TestProjectLifeCycle_Deprecated.cxx @@ -20,6 +20,7 @@ #include "smtk/operation/Manager.h" #include "smtk/operation/Operation.h" #include "smtk/operation/XMLOperation.h" +#include "smtk/plugin/Registry.h" #include "smtk/project/Manager.h" #include "smtk/project/Project.h" #include "smtk/project/Registrar.h" @@ -126,10 +127,9 @@ int TestProjectLifeCycle_Deprecated(int /*unused*/, char** const /*unused*/) { // Create managers smtk::resource::ManagerPtr resManager = smtk::resource::Manager::create(); - smtk::attribute::Registrar::registerTo(resManager); - smtk::operation::ManagerPtr opManager = smtk::operation::Manager::create(); - smtk::attribute::Registrar::registerTo(opManager); + auto attributeRegistry = + smtk::plugin::addToManagers(resManager, opManager); #if 0 // This line changes behavior such that projects ARE stored in resource manager @@ -139,7 +139,7 @@ int TestProjectLifeCycle_Deprecated(int /*unused*/, char** const /*unused*/) opManager->registerOperation("CreateProjectOp"); smtk::project::ManagerPtr projManager = smtk::project::Manager::create(resManager, opManager); - smtk::project::Registrar::registerTo(projManager); + auto projectRegistry = smtk::plugin::addToManagers(projManager); projManager->registerProject(PROJECT_TYPE); smtkTest(resManager->empty(), "resource manager size is " << resManager->size()); diff --git a/smtk/project/testing/cxx/TestProjectReadWrite.cxx b/smtk/project/testing/cxx/TestProjectReadWrite.cxx index b4ef9ef7e3..2ba2ac80e6 100644 --- a/smtk/project/testing/cxx/TestProjectReadWrite.cxx +++ b/smtk/project/testing/cxx/TestProjectReadWrite.cxx @@ -27,6 +27,8 @@ #include "smtk/operation/operators/ReadResource.h" #include "smtk/operation/operators/WriteResource.h" +#include "smtk/plugin/Registry.h" + #include "smtk/project/Manager.h" #include "smtk/project/Project.h" #include "smtk/project/Registrar.h" @@ -66,20 +68,15 @@ int TestProjectReadWrite(int /*unused*/, char** const /*unused*/) // Create a resource manager smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - { - smtk::attribute::Registrar::registerTo(resourceManager); - smtk::mesh::Registrar::registerTo(resourceManager); - smtk::project::Registrar::registerTo(resourceManager); - } - // Create an operation manager smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - { - smtk::attribute::Registrar::registerTo(operationManager); - smtk::mesh::Registrar::registerTo(operationManager); - smtk::operation::Registrar::registerTo(operationManager); - } + auto attributeRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); + auto meshRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); + auto operationRegistry = + smtk::plugin::addToManagers(operationManager); // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). @@ -89,9 +86,8 @@ int TestProjectReadWrite(int /*unused*/, char** const /*unused*/) smtk::project::ManagerPtr projectManager = smtk::project::Manager::create(resourceManager, operationManager); - { - smtk::project::Registrar::registerTo(projectManager); - } + auto projectRegistry = + smtk::plugin::addToManagers(resourceManager, projectManager); // Register a new project type projectManager->registerProject("foo"); diff --git a/smtk/project/testing/cxx/TestProjectReadWrite2.cxx b/smtk/project/testing/cxx/TestProjectReadWrite2.cxx index 941ec9b9fe..f947dabd40 100644 --- a/smtk/project/testing/cxx/TestProjectReadWrite2.cxx +++ b/smtk/project/testing/cxx/TestProjectReadWrite2.cxx @@ -28,6 +28,8 @@ #include "smtk/operation/operators/ReadResource.h" #include "smtk/operation/operators/WriteResource.h" +#include "smtk/plugin/Registry.h" + #include "smtk/project/Manager.h" #include "smtk/project/Project.h" #include "smtk/project/Registrar.h" @@ -79,25 +81,9 @@ int TestProjectReadWrite2(int /*unused*/, char** const /*unused*/) // Create a resource manager smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - { - smtk::attribute::Registrar::registerTo(resourceManager); -#ifdef VTK_SUPPORT - smtk::session::vtk::Registrar::registerTo(resourceManager); -#endif - smtk::project::Registrar::registerTo(resourceManager); - } - // Create an operation manager smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - { - smtk::attribute::Registrar::registerTo(operationManager); -#ifdef VTK_SUPPORT - smtk::session::vtk::Registrar::registerTo(operationManager); -#endif - smtk::operation::Registrar::registerTo(operationManager); - } - // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). operationManager->registerResourceManager(resourceManager); @@ -106,9 +92,15 @@ int TestProjectReadWrite2(int /*unused*/, char** const /*unused*/) smtk::project::ManagerPtr projectManager = smtk::project::Manager::create(resourceManager, operationManager); - { - smtk::project::Registrar::registerTo(projectManager); - } + auto attributeRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); +#ifdef VTK_SUPPORT + auto vtkRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); +#endif + auto operationRegistry = smtk::plugin::addToManagers(operationManager); + auto projectRegistry = + smtk::plugin::addToManagers(resourceManager, projectManager); // Register a new project type projectManager->registerProject("foo"); diff --git a/smtk/project/testing/cxx/TestProjectReadWrite2_Deprecated.cxx b/smtk/project/testing/cxx/TestProjectReadWrite2_Deprecated.cxx index 4515fe42c9..f2bfff7cd4 100644 --- a/smtk/project/testing/cxx/TestProjectReadWrite2_Deprecated.cxx +++ b/smtk/project/testing/cxx/TestProjectReadWrite2_Deprecated.cxx @@ -30,6 +30,8 @@ #include "smtk/operation/operators/ReadResource.h" #include "smtk/operation/operators/WriteResource.h" +#include "smtk/plugin/Registry.h" + #include "smtk/project/Manager.h" #include "smtk/project/Project.h" #include "smtk/project/Registrar.h" @@ -79,24 +81,16 @@ int TestProjectReadWrite2_Deprecated(int /*unused*/, char** const /*unused*/) // Create a resource manager smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - { - smtk::attribute::Registrar::registerTo(resourceManager); -#ifdef VTK_SUPPORT - smtk::session::vtk::Registrar::registerTo(resourceManager); -#endif - smtk::project::Registrar::registerTo(resourceManager); - } - // Create an operation manager smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - { - smtk::attribute::Registrar::registerTo(operationManager); + auto attributeRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); #ifdef VTK_SUPPORT - smtk::session::vtk::Registrar::registerTo(operationManager); + auto vtkRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); #endif - smtk::operation::Registrar::registerTo(operationManager); - } + auto operationRegistry = smtk::plugin::addToManagers(operationManager); // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). @@ -106,9 +100,8 @@ int TestProjectReadWrite2_Deprecated(int /*unused*/, char** const /*unused*/) smtk::project::ManagerPtr projectManager = smtk::project::Manager::create(resourceManager, operationManager); - { - smtk::project::Registrar::registerTo(projectManager); - } + auto projectRegistry = + smtk::plugin::addToManagers(resourceManager, projectManager); // Register a new project type projectManager->registerProject("foo"); diff --git a/smtk/project/testing/cxx/TestProjectReadWriteEmpty.cxx b/smtk/project/testing/cxx/TestProjectReadWriteEmpty.cxx index 1bb3402262..245d7306f3 100644 --- a/smtk/project/testing/cxx/TestProjectReadWriteEmpty.cxx +++ b/smtk/project/testing/cxx/TestProjectReadWriteEmpty.cxx @@ -18,6 +18,7 @@ #include "smtk/operation/Registrar.h" #include "smtk/operation/operators/ReadResource.h" #include "smtk/operation/operators/WriteResource.h" +#include "smtk/plugin/Registry.h" #include "smtk/project/Manager.h" #include "smtk/project/Project.h" #include "smtk/project/Registrar.h" @@ -52,15 +53,16 @@ int TestProjectReadWriteEmpty(int /*unused*/, char** const /*unused*/) { // Create smtk managers smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - smtk::project::Registrar::registerTo(resourceManager); smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - smtk::operation::Registrar::registerTo(operationManager); + auto operationRegistry = + smtk::plugin::addToManagers(operationManager); operationManager->registerResourceManager(resourceManager); smtk::project::ManagerPtr projectManager = smtk::project::Manager::create(resourceManager, operationManager); - smtk::project::Registrar::registerTo(projectManager); + auto projectRegistry = + smtk::plugin::addToManagers(resourceManager, projectManager); projectManager->registerProject("foo"); std::string projectLocation = write_root + "/empty-project.smtk"; diff --git a/smtk/project/testing/cxx/TestProjectReadWrite_Deprecated.cxx b/smtk/project/testing/cxx/TestProjectReadWrite_Deprecated.cxx index 61b514e303..149671f5de 100644 --- a/smtk/project/testing/cxx/TestProjectReadWrite_Deprecated.cxx +++ b/smtk/project/testing/cxx/TestProjectReadWrite_Deprecated.cxx @@ -29,6 +29,8 @@ #include "smtk/operation/operators/ReadResource.h" #include "smtk/operation/operators/WriteResource.h" +#include "smtk/plugin/Registry.h" + #include "smtk/project/Manager.h" #include "smtk/project/Project.h" #include "smtk/project/Registrar.h" @@ -68,18 +70,12 @@ int TestProjectReadWrite_Deprecated(int /*unused*/, char** const /*unused*/) // Create a resource manager smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - { - smtk::mesh::Registrar::registerTo(resourceManager); - smtk::project::Registrar::registerTo(resourceManager); - } - // Create an operation manager smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - { - smtk::mesh::Registrar::registerTo(operationManager); - smtk::operation::Registrar::registerTo(operationManager); - } + auto meshRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); + auto operationRegistry = smtk::plugin::addToManagers(operationManager); // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). @@ -89,9 +85,8 @@ int TestProjectReadWrite_Deprecated(int /*unused*/, char** const /*unused*/) smtk::project::ManagerPtr projectManager = smtk::project::Manager::create(resourceManager, operationManager); - { - smtk::project::Registrar::registerTo(projectManager); - } + auto projectRegistry = + smtk::plugin::addToManagers(resourceManager, projectManager); // Register a new project type projectManager->registerProject("foo"); diff --git a/smtk/resource/testing/cxx/helpers.cxx b/smtk/resource/testing/cxx/helpers.cxx index 5030082007..5c27d90144 100644 --- a/smtk/resource/testing/cxx/helpers.cxx +++ b/smtk/resource/testing/cxx/helpers.cxx @@ -19,6 +19,8 @@ #include "smtk/operation/operators/ReadResource.h" +#include "smtk/plugin/Registry.h" + #include "smtk/resource/Metadata.h" namespace smtk @@ -31,7 +33,7 @@ namespace testing ResourceArray loadTestResources(smtk::resource::Manager::Ptr resourceManager, int argc, char* argv[]) { - smtk::model::Registrar::registerTo(resourceManager); + auto registry = smtk::plugin::addToManagers(resourceManager); ResourceArray result; if (argc < 2) diff --git a/smtk/session/mesh/testing/cxx/TestCreateUniformGridOp.cxx b/smtk/session/mesh/testing/cxx/TestCreateUniformGridOp.cxx index 0ea3b75ded..0da7e22511 100644 --- a/smtk/session/mesh/testing/cxx/TestCreateUniformGridOp.cxx +++ b/smtk/session/mesh/testing/cxx/TestCreateUniformGridOp.cxx @@ -32,6 +32,8 @@ #include "smtk/operation/Manager.h" +#include "smtk/plugin/Registry.h" + #ifdef SMTK_ENABLE_VTK_SUPPORT #include "smtk/extension/vtk/source/vtkModelMultiBlockSource.h" @@ -142,18 +144,12 @@ smtkComponentInitMacro(smtk_extension_vtk_io_mesh_MeshIOVTK) // Create a resource manager smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - // Register mesh resources to the resource manager - { - smtk::session::mesh::Registrar::registerTo(resourceManager); - } - // Create an operation manager smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - // Register mesh operators to the operation manager - { - smtk::session::mesh::Registrar::registerTo(operationManager); - } + // Register mesh operators to the resource and operation managers + auto meshRegistry = smtk::plugin::addToManagers( + resourceManager, operationManager); // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). @@ -219,18 +215,12 @@ smtkComponentInitMacro(smtk_extension_vtk_io_mesh_MeshIOVTK) // Create a resource manager smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - // Register mesh resources to the resource manager - { - smtk::session::mesh::Registrar::registerTo(resourceManager); - } - // Create an operation manager smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - // Register mesh operators to the operation manager - { - smtk::session::mesh::Registrar::registerTo(operationManager); - } + // Register mesh operators to the resource and operation managers + auto meshRegistry = smtk::plugin::addToManagers( + resourceManager, operationManager); // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). diff --git a/smtk/session/mesh/testing/cxx/TestMergeOp.cxx b/smtk/session/mesh/testing/cxx/TestMergeOp.cxx index 40eab75081..790e48acc1 100644 --- a/smtk/session/mesh/testing/cxx/TestMergeOp.cxx +++ b/smtk/session/mesh/testing/cxx/TestMergeOp.cxx @@ -31,6 +31,8 @@ #include "smtk/model/Group.h" #include "smtk/model/Resource.h" +#include "smtk/plugin/Registry.h" + #include "smtk/resource/Manager.h" #include "smtk/operation/Manager.h" @@ -151,18 +153,12 @@ int TestMergeOp(int argc, char* argv[]) // Create a resource manager smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - // Register mesh resources to the resource manager - { - smtk::session::mesh::Registrar::registerTo(resourceManager); - } - // Create an operation manager smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - // Register mesh operators to the operation manager - { - smtk::session::mesh::Registrar::registerTo(operationManager); - } + // Register mesh operators to the resource and operation managers + auto meshRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). diff --git a/smtk/session/mesh/testing/cxx/TestMeshSessionReadWrite.cxx b/smtk/session/mesh/testing/cxx/TestMeshSessionReadWrite.cxx index 113fc9b1fe..e9e1f2e2fe 100644 --- a/smtk/session/mesh/testing/cxx/TestMeshSessionReadWrite.cxx +++ b/smtk/session/mesh/testing/cxx/TestMeshSessionReadWrite.cxx @@ -25,6 +25,8 @@ #include "smtk/operation/operators/ReadResource.h" #include "smtk/operation/operators/WriteResource.h" +#include "smtk/plugin/Registry.h" + #include "smtk/session/mesh/Registrar.h" #include "smtk/session/mesh/Resource.h" @@ -115,17 +117,12 @@ int TestMeshSessionReadWrite(int argc, char* argv[]) // Create a resource manager smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - { - smtk::session::mesh::Registrar::registerTo(resourceManager); - } - // Create an operation manager smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - { - smtk::operation::Registrar::registerTo(operationManager); - smtk::session::mesh::Registrar::registerTo(operationManager); - } + auto meshRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); + auto modelRegistry = smtk::plugin::addToManagers(operationManager); // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). diff --git a/smtk/session/mesh/testing/cxx/TestTransformOp.cxx b/smtk/session/mesh/testing/cxx/TestTransformOp.cxx index c23892f0e7..1a9f69d282 100644 --- a/smtk/session/mesh/testing/cxx/TestTransformOp.cxx +++ b/smtk/session/mesh/testing/cxx/TestTransformOp.cxx @@ -33,6 +33,8 @@ #include "smtk/model/Group.h" #include "smtk/model/Resource.h" +#include "smtk/plugin/Registry.h" + #include "smtk/resource/Manager.h" #include "smtk/operation/Manager.h" @@ -50,18 +52,12 @@ int TestTransformOp(int argc, char* argv[]) // Create a resource manager smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - // Register mesh resources to the resource manager - { - smtk::session::mesh::Registrar::registerTo(resourceManager); - } - // Create an operation manager smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - // Register mesh operators to the operation manager - { - smtk::session::mesh::Registrar::registerTo(operationManager); - } + // Register mesh operators to the resource and operation managers + auto meshRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). diff --git a/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx b/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx index fd5504e4e0..35d604059e 100644 --- a/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx +++ b/smtk/session/polygon/testing/cxx/UnitTestPolygonImportPPG.cxx @@ -18,6 +18,7 @@ #include "smtk/model/SessionRef.h" #include "smtk/operation/Manager.h" #include "smtk/operation/operators/WriteResource.h" +#include "smtk/plugin/Registry.h" #include "smtk/resource/Manager.h" #include "smtk/session/polygon/Registrar.h" #include "smtk/session/polygon/Resource.h" @@ -69,11 +70,12 @@ int UnitTestPolygonImportPPG(int /*argc*/, char* /*argv*/[]) // Initialize managers smtk::resource::ManagerPtr resManager = smtk::resource::Manager::create(); - smtk::session::polygon::Registrar::registerTo(resManager); - smtk::operation::ManagerPtr opManager = smtk::operation::Manager::create(); - smtk::operation::Registrar::registerTo(opManager); - smtk::session::polygon::Registrar::registerTo(opManager); + + auto polygonRegistry = + smtk::plugin::addToManagers(resManager, opManager); + auto operationRegistry = smtk::plugin::addToManagers(opManager); + opManager->registerResourceManager(resManager); // Create an "import" operation diff --git a/smtk/session/polygon/testing/cxx/UnitTestPolygonReadWrite.cxx b/smtk/session/polygon/testing/cxx/UnitTestPolygonReadWrite.cxx index beb66341c9..866e911261 100644 --- a/smtk/session/polygon/testing/cxx/UnitTestPolygonReadWrite.cxx +++ b/smtk/session/polygon/testing/cxx/UnitTestPolygonReadWrite.cxx @@ -25,6 +25,8 @@ #include "smtk/operation/operators/ReadResource.h" #include "smtk/operation/operators/WriteResource.h" +#include "smtk/plugin/Registry.h" + #include "smtk/session/polygon/Registrar.h" #include "smtk/session/polygon/Resource.h" @@ -117,17 +119,13 @@ int UnitTestPolygonReadWrite(int argc, char* argv[]) // Create a resource manager smtk::resource::Manager::Ptr resourceManager = smtk::resource::Manager::create(); - { - smtk::session::polygon::Registrar::registerTo(resourceManager); - } - // Create an operation manager smtk::operation::Manager::Ptr operationManager = smtk::operation::Manager::create(); - { - smtk::operation::Registrar::registerTo(operationManager); - smtk::session::polygon::Registrar::registerTo(operationManager); - } + auto polygonRegistry = smtk::plugin::addToManagers( + resourceManager, operationManager); + auto operationRegistry = + smtk::plugin::addToManagers(operationManager); // Register the resource manager to the operation manager (newly created // resources will be automatically registered to the resource manager). diff --git a/smtk/task/testing/cxx/TestActive.cxx b/smtk/task/testing/cxx/TestActive.cxx index 7aa59718c3..9cea1a72e3 100644 --- a/smtk/task/testing/cxx/TestActive.cxx +++ b/smtk/task/testing/cxx/TestActive.cxx @@ -14,6 +14,7 @@ #include "smtk/model/Resource.h" #include "smtk/operation/Manager.h" #include "smtk/operation/Registrar.h" +#include "smtk/plugin/Registry.h" #include "smtk/resource/Manager.h" #include "smtk/resource/Registrar.h" #include "smtk/task/Manager.h" @@ -37,22 +38,19 @@ int TestActive(int, char*[]) // Create managers auto managers = smtk::common::Managers::create(); - { - smtk::resource::Registrar::registerTo(managers); - smtk::attribute::Registrar::registerTo(managers); - smtk::operation::Registrar::registerTo(managers); - smtk::task::Registrar::registerTo(managers); - } + auto attributeRegistry = smtk::plugin::addToManagers(managers); + auto resourceRegistry = smtk::plugin::addToManagers(managers); + auto operationRegistry = smtk::plugin::addToManagers(managers); + auto taskRegistry = smtk::plugin::addToManagers(managers); auto resourceManager = managers->get(); auto operationManager = managers->get(); auto taskManager = managers->get(); - { - smtk::attribute::Registrar::registerTo(resourceManager); - smtk::model::Registrar::registerTo(resourceManager); - smtk::task::Registrar::registerTo(taskManager); - } + auto attributeResourceRegistry = + smtk::plugin::addToManagers(resourceManager); + auto modelRegistry = smtk::plugin::addToManagers(resourceManager); + auto taskTaskRegistry = smtk::plugin::addToManagers(taskManager); std::cout << "Observing changes to active task\n"; int count = 0; diff --git a/smtk/task/testing/cxx/TestTask.cxx b/smtk/task/testing/cxx/TestTask.cxx index 42cd9b213f..04f0277c02 100644 --- a/smtk/task/testing/cxx/TestTask.cxx +++ b/smtk/task/testing/cxx/TestTask.cxx @@ -14,6 +14,7 @@ #include "smtk/model/Resource.h" #include "smtk/operation/Manager.h" #include "smtk/operation/Registrar.h" +#include "smtk/plugin/Registry.h" #include "smtk/resource/Manager.h" #include "smtk/resource/Registrar.h" #include "smtk/task/Manager.h" @@ -68,22 +69,19 @@ int TestTask(int, char*[]) // Create managers auto managers = smtk::common::Managers::create(); - { - smtk::resource::Registrar::registerTo(managers); - smtk::attribute::Registrar::registerTo(managers); - smtk::operation::Registrar::registerTo(managers); - smtk::task::Registrar::registerTo(managers); - } + auto attributeRegistry = smtk::plugin::addToManagers(managers); + auto resourceRegistry = smtk::plugin::addToManagers(managers); + auto operationRegistry = smtk::plugin::addToManagers(managers); + auto taskRegistry = smtk::plugin::addToManagers(managers); auto resourceManager = managers->get(); auto operationManager = managers->get(); auto taskManager = managers->get(); - { - smtk::attribute::Registrar::registerTo(resourceManager); - smtk::model::Registrar::registerTo(resourceManager); - smtk::task::Registrar::registerTo(taskManager); - } + auto attributeResourceRegistry = + smtk::plugin::addToManagers(resourceManager); + auto modelRegistry = smtk::plugin::addToManagers(resourceManager); + auto taskTaskRegistry = smtk::plugin::addToManagers(taskManager); taskManager->instances().registerType(); diff --git a/smtk/view/testing/cxx/unitBadge.cxx b/smtk/view/testing/cxx/unitBadge.cxx index d693abb206..99857d3a50 100644 --- a/smtk/view/testing/cxx/unitBadge.cxx +++ b/smtk/view/testing/cxx/unitBadge.cxx @@ -27,6 +27,8 @@ #include "smtk/io/Logger.h" +#include "smtk/plugin/Registry.h" + #include "smtk/view/json/jsonView.h" #include "smtk/common/testing/cxx/helpers.h" @@ -154,7 +156,7 @@ int unitBadge(int argc, char* argv[]) // badgeSet.configure(viewConfig, viewManager); auto resource = phraseModel->root()->subphrases()[0]->relatedResource(); auto resourceManager = resource->manager(); - smtk::attribute::Registrar::registerTo(resourceManager); + auto registry = smtk::plugin::addToManagers(resourceManager); auto attRsrc = resourceManager->create(); auto defBC = attRsrc->createDefinition("BoundaryCondition"); auto assoc = defBC->createLocalAssociationRule(); diff --git a/smtk/view/testing/cxx/unitOperationIcon.cxx b/smtk/view/testing/cxx/unitOperationIcon.cxx index 8e2ee49109..fde1de7ee9 100644 --- a/smtk/view/testing/cxx/unitOperationIcon.cxx +++ b/smtk/view/testing/cxx/unitOperationIcon.cxx @@ -21,6 +21,8 @@ #include "smtk/operation/Metadata.h" #include "smtk/operation/MetadataContainer.h" +#include "smtk/plugin/Registry.h" + #include "smtk/io/Logger.h" #include "smtk/common/testing/cxx/helpers.h" @@ -32,9 +34,9 @@ int unitOperationIcon(int, char*[]) auto viewManager = smtk::view::Manager::create(); auto resourceManager = smtk::resource::Manager::create(); auto operationManager = smtk::operation::Manager::create(); - smtk::attribute::Registrar::registerTo(resourceManager); - smtk::attribute::Registrar::registerTo(operationManager); - smtk::view::Registrar::registerTo(viewManager); + auto attributeRegistry = + smtk::plugin::addToManagers(resourceManager, operationManager); + auto viewRegistry = smtk::plugin::addToManagers(viewManager); std::string color = "dark"; // Create some "icon constructor" functors that really just increment counters: diff --git a/smtk/view/testing/cxx/unitPhraseModel.cxx b/smtk/view/testing/cxx/unitPhraseModel.cxx index 2d90e40662..1890287da3 100644 --- a/smtk/view/testing/cxx/unitPhraseModel.cxx +++ b/smtk/view/testing/cxx/unitPhraseModel.cxx @@ -21,6 +21,8 @@ #include "smtk/model/SessionRef.h" +#include "smtk/plugin/Registry.h" + #include "smtk/operation/Manager.h" #include "smtk/resource/Manager.h" @@ -213,7 +215,7 @@ int unitPhraseModel(int argc, char* argv[]) { { { "Name", "SubphraseGenerator" }, { "Attributes", { { "Type", "default" } } } } } } } } } } } }; auto viewManager = smtk::view::Manager::create(); - smtk::view::Registrar::registerTo(viewManager); + auto registry = smtk::plugin::addToManagers(viewManager); viewManager->phraseModelFactory().registerType(); smtk::view::ConfigurationPtr viewConfig = j; auto phraseModel = viewManager->phraseModelFactory().createFromConfiguration(viewConfig.get()); diff --git a/smtk/view/testing/cxx/utility.cxx b/smtk/view/testing/cxx/utility.cxx index 4fcdbf8557..892b1deb8e 100644 --- a/smtk/view/testing/cxx/utility.cxx +++ b/smtk/view/testing/cxx/utility.cxx @@ -64,10 +64,9 @@ PhraseModel::Ptr loadTestData( auto operMgr = smtk::operation::Manager::create(); operMgr->registerResourceManager(rsrcMgr); - auto registry = smtk::plugin:: - Registry( - rsrcMgr, operMgr); - smtk::view::Registrar::registerTo(viewManager); + auto polygonRegistry = + smtk::plugin::addToManagers(rsrcMgr, operMgr); + auto viewRegistry = smtk::plugin::addToManagers(viewManager); auto phraseModel = viewManager->phraseModelFactory().createFromConfiguration(&viewConfig); // auto phraseModel = smtk::view::ResourcePhraseModel::create(); phraseModel->addSource({ rsrcMgr, operMgr }); -- GitLab From 18107ced235a7b586c31750a42a59b6146437e1e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 6 Jul 2021 23:09:57 -0400 Subject: [PATCH 104/136] Registry: hold a strong reference to managers Now that all registrations occur through this class, a strong reference should be kept to ensure that if a registration has happened, it is unregistered before the manager can be destructed. This is necessary because the `void*` tracking can become confused if a manager is allocated to the same memory location as an older one that was deallocated. --- smtk/plugin/Registry.h | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/smtk/plugin/Registry.h b/smtk/plugin/Registry.h index 807ec3727f..3def3b3dbc 100644 --- a/smtk/plugin/Registry.h +++ b/smtk/plugin/Registry.h @@ -145,16 +145,16 @@ public: { if (ManagerCount::instance().operator[](manager.get())++ == 0) { - Registrar().registerTo(manager); + Registrar().registerTo(m_Manager); } } ~MaybeRegister() { - std::shared_ptr manager = m_Manager.lock(); - if (manager && --ManagerCount::instance().operator[](manager.get()) == 0) + if ( + m_Manager && --ManagerCount::instance().operator[](m_Manager.get()) == 0) { - Registrar().unregisterFrom(manager); + Registrar().unregisterFrom(m_Manager); } } @@ -164,14 +164,10 @@ public: return false; } - bool contains(const std::shared_ptr& manager) const - { - auto m = m_Manager.lock(); - return m && m == manager; - } + bool contains(const std::shared_ptr& manager) const { return manager == m_Manager; } private: - std::weak_ptr m_Manager; + std::shared_ptr m_Manager; }; /// Registrars may declare dependencies to other Registrars by defining a type -- GitLab From f775d2a8282250b07529afe006cedc5984842ffa Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 7 Jul 2021 14:29:14 -0400 Subject: [PATCH 105/136] sanitizer: use `LD_PRELOAD` to load libasan This is now controlled through a function which can apply to any test rather than just working for the Python tests. --- CMake/SMTKSanitize.cmake | 26 +++++++++++++++++++ CMakeLists.txt | 19 +------------- .../widgets/testing/xml/CMakeLists.txt | 6 +++++ 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/CMake/SMTKSanitize.cmake b/CMake/SMTKSanitize.cmake index f5b9be45da..32a0681f20 100644 --- a/CMake/SMTKSanitize.cmake +++ b/CMake/SMTKSanitize.cmake @@ -32,3 +32,29 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=${SMTK_SANITIZER}") endif() endif() + +function (smtk_test_apply_sanitizer) + # Do nothing if we're not building under a sanitizer. + if (NOT SMTK_ENABLE_SANITIZER OR NOT SMTK_SANITIZER STREQUAL "address") + return () + endif () + + # Bail on non-Unix or macOS. + if (NOT UNIX OR APPLE) + return () + endif () + + find_library(LIBASAN_LIBRARY NAMES asan libasan.so.6 libasan.so.5) + mark_as_advanced(LIBASAN_LIBRARY) + + # Bail if we can't find `libasan`. + if (NOT LIBASAN_LIBRARY) + return () + endif () + + set_property(TEST ${ARGN} APPEND + PROPERTY + # XXX(cmake-3.22): use `ENVIRONMENT_MODIFICATION`. + # ENVIRONMENT_MODIFICATION "LD_PRELOAD=path_list_prepend:${LIBASAN_LIBRARY}") + ENVIRONMENT "LD_PRELOAD=${LIBASAN_LIBRARY}") +endfunction () diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ccb997f82..587c1f83a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -509,24 +509,6 @@ if(SMTK_ENABLE_PYTHON_WRAPPING) set(smtk_python_test_environment "PYTHONPATH=${smtk_pythonpath_env}") - if (SMTK_ENABLE_SANITIZER) - set(preload_libraries) - if (SMTK_SANITIZER MATCHES "address") - find_library(SMTK_ASAN_LIBRARY NAMES libasan.so.5 DOC "ASan library") - mark_as_advanced(SMTK_ASAN_LIBRARY) - - list(APPEND preload_libraries - "${SMTK_ASAN_LIBRARY}") - endif () - - if (preload_libraries) - if (UNIX AND NOT APPLE) - list(APPEND smtk_python_test_environment - "LD_PRELOAD=${preload_libraries}") - endif () - endif () - endif () - if (libpath_envvar AND smtk_libpath_env) list(APPEND smtk_python_test_environment "${libpath_envvar}=${smtk_libpath_env}") @@ -543,6 +525,7 @@ if(SMTK_ENABLE_PYTHON_WRAPPING) set_tests_properties("${name}" PROPERTIES ENVIRONMENT "${smtk_python_test_environment}") + smtk_test_apply_sanitizer("${name}") endfunction () endif() endif() diff --git a/smtk/extension/paraview/widgets/testing/xml/CMakeLists.txt b/smtk/extension/paraview/widgets/testing/xml/CMakeLists.txt index 13e5d09e3b..4f3b04da29 100644 --- a/smtk/extension/paraview/widgets/testing/xml/CMakeLists.txt +++ b/smtk/extension/paraview/widgets/testing/xml/CMakeLists.txt @@ -42,4 +42,10 @@ smtk_add_client_tests( DATA_DIRECTORY ${PROJECT_SOURCE_DIR}/data BASELINE_DIR ${PROJECT_SOURCE_DIR}/data/baseline/smtk/widgets ) +set(pv_tests) +foreach (test_file IN LISTS TESTS_WITH_BASELINES) + get_filename_component(test_basename "${test_file}" NAME_WE) + list(APPEND pv_tests "pv.${test_basename}") +endforeach () +smtk_test_apply_sanitizer(${pv_tests}) endif() -- GitLab From de41844f6072f6d5b2ecd4f9bcff107e6e27fb96 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 8 Jul 2021 19:17:12 -0400 Subject: [PATCH 106/136] displayMultiBlockModel-test2D: add a baseline for macOS arm64 There are some line rendering differences on macOS arm64. See: vtk/vtk#18229 --- data/baseline/smtk/vtk/test2D-with-colors_1.png | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 data/baseline/smtk/vtk/test2D-with-colors_1.png diff --git a/data/baseline/smtk/vtk/test2D-with-colors_1.png b/data/baseline/smtk/vtk/test2D-with-colors_1.png new file mode 100644 index 0000000000..ae035f43a6 --- /dev/null +++ b/data/baseline/smtk/vtk/test2D-with-colors_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5c4b39b5c0175b394142f73cb1f4ffd875ba4b630c2ce1a834560897ed584e3 +size 1178 -- GitLab From 2173773a176a82ce92ee31cc76038542e5922c6f Mon Sep 17 00:00:00 2001 From: Ryan Krattiger Date: Tue, 13 Jul 2021 12:05:58 -0500 Subject: [PATCH 107/136] Put project python source behind python check --- smtk/project/CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/smtk/project/CMakeLists.txt b/smtk/project/CMakeLists.txt index 0f8654f73b..c531f335b3 100644 --- a/smtk/project/CMakeLists.txt +++ b/smtk/project/CMakeLists.txt @@ -3,7 +3,6 @@ set(projectSrcs Operation.cxx OperationFactory.cxx Project.cxx - RegisterPythonProject.cxx Registrar.cxx ResourceContainer.cxx @@ -27,7 +26,6 @@ set(projectHeaders Operation.h OperationFactory.h Project.h - RegisterPythonProject.h Registrar.h ResourceContainer.h Tags.h @@ -52,7 +50,7 @@ foreach (iconFile ${iconFiles}) get_filename_component(genFileBase "${iconFile}" NAME_WE) set(genFile "${CMAKE_CURRENT_BINARY_DIR}/view/icons/${genFileBase}_svg.h") configureFileAsCVariable("${CMAKE_CURRENT_SOURCE_DIR}/${iconFile}" "${genFile}" "${genFileBase}_svg" "") -endforeach() +endforeach () set(projectOperators Add @@ -70,7 +68,7 @@ foreach (operator ${projectOperators}) list(APPEND projectSrcs operators/${operator}.cxx) list(APPEND projectHeaders operators/${operator}.h) list(APPEND _projectDependencies ${headerName}) -endforeach() +endforeach () add_custom_target(projectGenHeaders DEPENDS ${_projectDependencies}) set(projectDependencies ${_projectDependencies} PARENT_SCOPE) @@ -87,6 +85,10 @@ if(SMTK_ENABLE_PARAVIEW_SUPPORT) endif() if (SMTK_ENABLE_PYTHON_WRAPPING) + list(APPEND projectSrcs + RegisterPythonProject.cxx) + list(APPEND projectHeaders + RegisterPythonProject.h) add_subdirectory(pybind11) endif() -- GitLab From 2ba527f58d1a48a344de39a13340f2f0608c4f3a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 08:51:12 -0400 Subject: [PATCH 108/136] coverage: exclude plugin header files --- CMake/CTestCustom.cmake.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMake/CTestCustom.cmake.in b/CMake/CTestCustom.cmake.in index 35c985df3c..dd69bdd3b7 100644 --- a/CMake/CTestCustom.cmake.in +++ b/CMake/CTestCustom.cmake.in @@ -39,5 +39,8 @@ if(@SMTK_COVERAGE_ENABLED@) "qt" "autogen" "CMakeFiles" + + # ParaView-generated sources. + "plugin/.*Plugin\.h" ) endif() -- GitLab From 7f6498ccb4d98bd39383a97886a0a0df240b003d Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 08:55:45 -0400 Subject: [PATCH 109/136] Revert "Merge topic 'add_xmsmesher_to_ci_container'" The xms build does not actually seem to work yet due to pybind11 confusion. This was introduced in !2498. This reverts commit 56045e46efdfee1c0afddd31d647fa4d92fa328b, reversing changes made to 36bbbf202d196adf19718ea3cd66cf9a99960642. --- .gitlab/ci/docker/fedora33-paraview/install_superbuild.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab/ci/docker/fedora33-paraview/install_superbuild.sh b/.gitlab/ci/docker/fedora33-paraview/install_superbuild.sh index 96f9a77836..bd3df49bcd 100755 --- a/.gitlab/ci/docker/fedora33-paraview/install_superbuild.sh +++ b/.gitlab/ci/docker/fedora33-paraview/install_superbuild.sh @@ -27,12 +27,12 @@ cmake -GNinja \ -DDEVELOPER_MODE_smtk:BOOL=ON \ -DENABLE_cmb:BOOL=OFF \ -DENABLE_cmbusersguide:BOOL=OFF \ + -DENABLE_smtkprojectmanager:BOOL=OFF \ -DENABLE_smtkresourcemanagerstate:BOOL=OFF \ -DENABLE_paraview:BOOL=ON \ -DENABLE_python3:BOOL=ON \ -DSUPPRESS_szip_OUTPUT:BOOL=OFF \ -DUSE_SYSTEM_qt5:BOOL=ON \ - -DENABLE_xmsmesher:BOOL=ON \ $sccache_settings \ "-D__BUILDBOT_INSTALL_LOCATION:PATH=$SUPERBUILD_PREFIX" \ "$workdir" -- GitLab From e46309207e2f8ba3c60a833c89ace37a2707a18c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 11:17:04 -0400 Subject: [PATCH 110/136] gitlab-ci: update superbuild snapshots --- .gitlab-ci.yml | 2 +- .gitlab/ci/download_superbuild.cmake | 13 ++++++++----- .gitlab/os-linux.yml | 20 +++----------------- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 052942a26d..e0784f342e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -152,7 +152,7 @@ test:fedora33-ubsan: build:fedora33-tidy: extends: - .fedora33_tidy - - .cmake_build_linux_tidy + - .cmake_build_linux - .cmake_build_artifacts - .linux_builder_tags - .run_automatically diff --git a/.gitlab/ci/download_superbuild.cmake b/.gitlab/ci/download_superbuild.cmake index 3b22be935b..ac06e0356a 100644 --- a/.gitlab/ci/download_superbuild.cmake +++ b/.gitlab/ci/download_superbuild.cmake @@ -10,11 +10,14 @@ set(data_host "https://data.kitware.com") # Determine the tarball to download. ci-smtk-ci-developer-{date}-{git-sha}.tar.gz # 20210420 if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "vs2019") - set(file_item "607f0ddb2fa25629b9f66898") - set(file_hash "c324884ec8f7832b450c948f57e6767735c88fc9a5930675891437b22b6abeb2b40fbb9cb1b498559f648693daaa71b3501e413caceccf88e714d784e9f8e75f") -elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos") - set(file_item "607f0db12fa25629b9f6684f") - set(file_hash "96f7c03cb4da0091b7ded0d680ace228b72b617471d99272d28c4e0bcd42c584a34b700ac81d1ae4a9cc4e0942bf299234a00b4f6193ff8a590b6d8f7713e39a") + set(file_item "60eeffb52fa25629b96abfa2") + set(file_hash "c5e74138f82bf540dda882e73a067fd2aa94d494f1ba8e13881484f412abccb8e8baa7948b806ed016b5754dd29bcc26b439a39ad53b03ce5cc8a1d292e3fefe") +elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos_x86_64") + set(file_item "60eefdaf2fa25629b96abef4") + set(file_hash "5c0d64ed1b26a39e890f7c8fab68cdfc52b1b9c3ad360dfd06de7dc9772e0a44643e093071adea5d04f45d18cf2bc21ae660c6a597d6d61c35208d0b897ca27a") +elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos_arm64") + set(file_item "60eeff952fa25629b96abf71") + set(file_hash "58d95aef71a4b89061202c8ea8a4bef5e55df71527747d8b71692d1f1494b263df6edcee77c768f3f98a0e680ca461e50ddb34363ac30451c16dbf1d113bd724") else () message(FATAL_ERROR "Unknown build to use for the superbuild") diff --git a/.gitlab/os-linux.yml b/.gitlab/os-linux.yml index 7bfe2363d4..ad137a44e7 100644 --- a/.gitlab/os-linux.yml +++ b/.gitlab/os-linux.yml @@ -5,7 +5,7 @@ ### Fedora .fedora33: - image: "kitware/cmb:ci-smtk-fedora33-20210420" + image: "kitware/cmb:ci-smtk-fedora33-20210714" variables: GIT_SUBMODULE_STRATEGY: recursive @@ -65,14 +65,14 @@ .fedora33_vtk_python3: extends: .fedora33 - image: "kitware/cmb:ci-smtk-fedora33-vtk-20210420" + image: "kitware/cmb:ci-smtk-fedora33-vtk-20210714" variables: CMAKE_CONFIGURATION: fedora33_vtk_python3 .fedora33_paraview: extends: .fedora33_vtk_python3 - image: "kitware/cmb:ci-smtk-fedora33-paraview-20210420" + image: "kitware/cmb:ci-smtk-fedora33-paraview-20210714" variables: CMAKE_CONFIGURATION: fedora33_paraview @@ -123,20 +123,6 @@ - sccache --show-stats interruptible: true -.cmake_build_linux_tidy: - stage: build - - script: - - *before_script_linux - - dnf install -y --setopt=install_weak_deps=False clang-tools-extra - - .gitlab/ci/sccache.sh - - sccache --start-server - - sccache --show-stats - - "$LAUNCHER ctest -V -S .gitlab/ci/ctest_configure.cmake" - - "$LAUNCHER ctest -VV -S .gitlab/ci/ctest_build.cmake" - - sccache --show-stats - interruptible: true - .cmake_test_linux: stage: test -- GitLab From fe9e61343699229b9bc9f96e3a8ccfb3e00c4fcf Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 11:46:44 -0400 Subject: [PATCH 111/136] ci: update to ninja 1.10.2 Also updates the macOS binary to be universal to avoid turning everything into an x86_64 process tree. --- .gitlab/ci/ninja.ps1 | 4 ++-- .gitlab/ci/ninja.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab/ci/ninja.ps1 b/.gitlab/ci/ninja.ps1 index 697d3afda1..9f42d1daa6 100755 --- a/.gitlab/ci/ninja.ps1 +++ b/.gitlab/ci/ninja.ps1 @@ -1,7 +1,7 @@ $erroractionpreference = "stop" -$version = "1.10.0" -$sha256sum = "919FD158C16BF135E8A850BB4046EC1CE28A7439EE08B977CD0B7F6B3463D178" +$version = "1.10.2" +$sha256sum = "BBDE850D247D2737C5764C927D1071CBB1F1957DCABDA4A130FA8547C12C695F" $filename = "ninja-win" $tarball = "$filename.zip" diff --git a/.gitlab/ci/ninja.sh b/.gitlab/ci/ninja.sh index 93c1ee9573..9011bbcf5e 100755 --- a/.gitlab/ci/ninja.sh +++ b/.gitlab/ci/ninja.sh @@ -2,17 +2,17 @@ set -e -readonly version="1.10.0" +readonly version="1.10.2" case "$( uname -s )" in Linux) shatool="sha256sum" - sha256sum="6566836ddf3d72ca06685b34814e0c6fa0f0943542d651d0dab3150f10307c82" + sha256sum="763464859c7ef2ea3a0a10f4df40d2025d3bb9438fcb1228404640410c0ec22d" platform="linux" ;; Darwin) shatool="shasum -a 256" - sha256sum="2ee405c0e205d55666c60cc9c0d8d04c8ede06d3ef2e2c2aabe08fd81c17d22e" + sha256sum="6fa359f491fac7e5185273c6421a000eea6a2f0febf0ac03ac900bd4d80ed2a5" platform="mac" ;; *) -- GitLab From 95af86ab4a674b3b6c37701174dfe3b4f5b17305 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 11:52:24 -0400 Subject: [PATCH 112/136] ci: use a macOS arm64-compatible sccache build --- .gitlab/ci/sccache.sh | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/.gitlab/ci/sccache.sh b/.gitlab/ci/sccache.sh index af24710406..c941ecdf8f 100755 --- a/.gitlab/ci/sccache.sh +++ b/.gitlab/ci/sccache.sh @@ -2,43 +2,37 @@ set -e +readonly version="0.2.15-background-init" +readonly build_date="20210602.0" + case "$( uname -s )" in Linux) - version="0.2.13" shatool="sha256sum" - sha256sum="28a5499e340865b08b632306b435913beb590fbd7b49a3f887a623b459fabdeb" + sha256sum="34d62d30eae1a4145f00d62b01ad21c3456e28f11f8246c936b00cccf4855016" platform="x86_64-unknown-linux-musl" ;; Darwin) - version="gfe63078" shatool="shasum -a 256" - sha256sum="60a0302b1d7227f7ef56abd82266353f570d27c6e850c56c6448bf62def38888" - platform="x86_64-apple-darwin" + sha256sum="2fa396e98cc8d07e39429b187a77386db63d35409902251d462080bdd0087c22" + platform="universal-apple-darwin" ;; *) echo "Unrecognized platform $( uname -s )" exit 1 ;; esac -readonly version readonly shatool readonly sha256sum readonly platform -readonly filename="sccache-$version-$platform" -readonly tarball="$filename.tar.gz" +readonly filename="sccache-v$version-$platform" -if [ "$( uname -s )" = "Darwin" ]; then - url="https://paraview.org/files/dependencies" -else - url="https://github.com/mozilla/sccache/releases/download/$version" -fi -readonly url +readonly url="https://gitlab.kitware.com/api/v4/projects/6955/packages/generic/sccache/v$version-$build_date/" cd .gitlab -echo "$sha256sum $tarball" > sccache.sha256sum -curl -OL "$url/$tarball" +echo "$sha256sum $filename" > sccache.sha256sum +curl -OL "$url/$filename" $shatool --check sccache.sha256sum -tar xf "$tarball" -mv "$filename/sccache" . +mv "$filename" sccache +chmod +x sccache -- GitLab From be6d66cf75e4d05459da3e24dfdebc7bf90915ed Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 12:44:39 -0400 Subject: [PATCH 113/136] ci: update to Qt 5.15.2 Also get a macOS arm64-compatible build. --- .gitlab/ci/download_qt.cmake | 22 +++++++++++----- .gitlab/ci/download_qt_hashes.cmake | 40 ++++++++++++++--------------- 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/.gitlab/ci/download_qt.cmake b/.gitlab/ci/download_qt.cmake index 33cbea6967..0ceafce955 100644 --- a/.gitlab/ci/download_qt.cmake +++ b/.gitlab/ci/download_qt.cmake @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.12) # Input variables. set(qt_version_major "5") set(qt_version_minor "15") -set(qt_version_patch "1") +set(qt_version_patch "2") # This URL is only visible inside of Kitware's network. Please use your own Qt # Account to obtain these files. set(qt_url_root "https://paraview.org/files/dependencies/internal/qt") @@ -18,7 +18,9 @@ elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "vs2017" OR set(qt_platform "windows_x86") set(msvc_year "2019") set(qt_abi "win64_msvc${msvc_year}_64") -elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos") +elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos_arm64") + set(qt_platform "mac_arm64") +elseif ("$ENV{CMAKE_CONFIGURATION}" MATCHES "macos_x86_64") set(qt_platform "mac_x64") set(qt_abi "clang_64") else () @@ -33,8 +35,7 @@ set(qt_version_nodot "${qt_version_major}${qt_version_minor}${qt_version_patch}" # Files needed to download. set(qt_files) if (qt_platform STREQUAL "windows_x86") - set(qt_build_stamp "202009071110") - + set(qt_build_stamp "202011130602") set(qt_file_name_prefix "${qt_version}-0-${qt_build_stamp}") list(APPEND qt_files "${qt_file_name_prefix}d3dcompiler_47-x64.7z" @@ -47,7 +48,7 @@ if (qt_platform STREQUAL "windows_x86") set(qt_subdir "${qt_version}/msvc${msvc_year}_64") elseif (qt_platform STREQUAL "mac_x64") - set(qt_build_stamp "202009071110") + set(qt_build_stamp "202011130601") set(qt_file_name_prefix "${qt_version}-0-${qt_build_stamp}") foreach (qt_component IN ITEMS qtbase qtsvg qttools qtxmlpatterns) @@ -56,6 +57,11 @@ elseif (qt_platform STREQUAL "mac_x64") endforeach () set(qt_subdir "${qt_version}/clang_64") +elseif (qt_platform STREQUAL "mac_arm64") + set(qt_subdir "qt-${qt_version}-macosx11.0-arm64") + set(qt_files "${qt_subdir}.tar.xz") + set("${qt_files}_hash" "e80d2647de461370bb65db60bc657148d196348b7393a2975d4a54bfba1b217f") + set(qt_url_prefix "https://gitlab.kitware.com/api/v4/projects/6955/packages/generic/qt/v${qt_version}-20210519.0") # XXX: see below else () message(FATAL_ERROR "Unknown files for ${qt_platform}") @@ -68,8 +74,10 @@ if (NOT qt_subdir) endif () # Build up the path to the file to download. -set(qt_url_path "${qt_platform}/desktop/qt5_${qt_version_nodot}/qt.qt5.${qt_version_nodot}.${qt_abi}") -set(qt_url_prefix "${qt_url_root}/${qt_url_path}") +if (NOT qt_url_prefix) # XXX: Replace this when Qt ships official arm64 binaries. + set(qt_url_path "${qt_platform}/desktop/qt5_${qt_version_nodot}/qt.qt5.${qt_version_nodot}.${qt_abi}") + set(qt_url_prefix "${qt_url_root}/${qt_url_path}") +endif () # Include the file containing the hashes of the files that matter. include("${CMAKE_CURRENT_LIST_DIR}/download_qt_hashes.cmake") diff --git a/.gitlab/ci/download_qt_hashes.cmake b/.gitlab/ci/download_qt_hashes.cmake index b9e4177c18..59738cccf5 100644 --- a/.gitlab/ci/download_qt_hashes.cmake +++ b/.gitlab/ci/download_qt_hashes.cmake @@ -2,25 +2,25 @@ # # sha256sum $files | awk '{ print "set(\"" $2 "_hash\" " $1 ")" }' >> $thisfile -if (msvc_year STREQUAL "2015") - set("5.15.1-0-202009071110d3dcompiler_47-x64.7z_hash" a55cb8e4ef0a8271fd9937ca5d6305aa3994b178c675f4f39ecf0ee85b027d9d) - set("5.15.1-0-202009071110opengl32sw-64-mesa_12_0_rc2.7z_hash" 3408f3bc754a51835171ace18be3b0b71a5384c29f03917daef59b939e11a728) -else () - set("5.15.1-0-202009071110d3dcompiler_47-x64.7z_hash" 76defcbef78e29832a5fca39607deac58419d49963fda3d1d61fd5a76c5de78b) - set("5.15.1-0-202009071110opengl32sw-64-mesa_12_0_rc2.7z_hash" f4697dbe90fd5302a48558e22f4c9ce657d93c00247c24a1edb6d425303a0d80) -endif () - -set("5.15.1-0-202009071110qtbase-Windows-Windows_10-MSVC2015-Windows-Windows_10-X86_64.7z_hash" 5d0d2e71e3b00cf88ac4c616b4b314a7e73871f325512821f53c464cdfee961f) -set("5.15.1-0-202009071110qtsvg-Windows-Windows_10-MSVC2015-Windows-Windows_10-X86_64.7z_hash" 427e891531f775541b38f7fca3cdcb281af9ad4ef82b1b483a802b5ed211ea38) -set("5.15.1-0-202009071110qttools-Windows-Windows_10-MSVC2015-Windows-Windows_10-X86_64.7z_hash" 393630ea20cc5fa29e7987df21526586bcac23c3499fb9889d980758942f942e) -set("5.15.1-0-202009071110qtxmlpatterns-Windows-Windows_10-MSVC2015-Windows-Windows_10-X86_64.7z_hash" fc8c0b5776dee01fee943d13154400806acaef84d5b90ad682e3dcae967106ea) +set("5.15.2-0-202011130602qtbase-Windows-Windows_10-MSVC2015-Windows-Windows_10-X86_64.7z_hash" 7d06f93329b79de466aba37109c2aa850ddd74ac03a054b545aeff272a716851) +set("5.15.2-0-202011130602qtsvg-Windows-Windows_10-MSVC2015-Windows-Windows_10-X86_64.7z_hash" af204df1e149a862a9f9b2ebe9542a913275a2b3c54435857dd0c42b18ce5e0d) +set("5.15.2-0-202011130602qttools-Windows-Windows_10-MSVC2015-Windows-Windows_10-X86_64.7z_hash" 210ad3e88ffbc2bda58371a227f0dcbb06719bd5acbd19d44e7da4f5b2d2af4b) +set("5.15.2-0-202011130602qtxmlpatterns-Windows-Windows_10-MSVC2015-Windows-Windows_10-X86_64.7z_hash" f6ae775677ce96a28ab6df8e6cee138e9fcb69e45e4d6485b6d8a26e1de857dc) -set("5.15.1-0-202009071110qtbase-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z_hash" a5635124a135f383d9fb92bf628b018cff9f781addfd388926a367cda5b7cd38) -set("5.15.1-0-202009071110qtsvg-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z_hash" 9f344dafb9d00fadef4801a89e2e9d6f1599c8b25d3afd290a6c42f73ea16ed1) -set("5.15.1-0-202009071110qttools-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z_hash" 45b3debfc317f875d327e4506c0d211dc82ec92c1e9aa60e17b1a747ada22811) -set("5.15.1-0-202009071110qtxmlpatterns-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z_hash" dffcaf8a2028adb6621eb86ade6aa0bc8daa8961653a4a82841091b5165040ca) +# There's a filename conflict here. +if (msvc_year STREQUAL "2019") + set("5.15.2-0-202011130602d3dcompiler_47-x64.7z_hash" 0dc63ca9bb91cb204d479356edb89b30e3599f1c0bce469b1dd5a339134f25e2) + set("5.15.2-0-202011130602opengl32sw-64-mesa_12_0_rc2.7z_hash" 4e43bc46665f31e12e528f01105310b07d3b8c0ff914668e3b77969d672fcc14) +elseif (msvc_year STREQUAL "2015") + set("5.15.2-0-202011130602d3dcompiler_47-x64.7z_hash" 9ba5998b18974f43c8bad4e9ba1fbef0642dcb40ede2f3c7d01d4634f6296f1a) + set("5.15.2-0-202011130602opengl32sw-64-mesa_12_0_rc2.7z_hash" d4f11612346a0e2c23e2752f27f440c33adc42405faae7b7eb49bef74e33f2f7) +endif () +set("5.15.2-0-202011130602qtbase-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z_hash" e563de40230295841c2eece26e347de709edc4bf035515cc239cae3c994c9af6) +set("5.15.2-0-202011130602qtsvg-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z_hash" 22daa63531f2eed8aeec02e047b73641739fa9d0288a5d2db4da25baf3a005a7) +set("5.15.2-0-202011130602qttools-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z_hash" babb583bbbac0e946ad25a2a687b4a3349779d750b1f3de1c4dadbf1c343c3ea) +set("5.15.2-0-202011130602qtxmlpatterns-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z_hash" cc295d93f74c38277cb5fa2c56cbc1dfd8594a5228a82000c901fe42332e1c69) -set("5.15.1-0-202009071110qtbase-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z_hash" df2813ce7c6cb4287abd7956cd1cb9d08312e4ac1208b6cb57af4df11b8ebba1) -set("5.15.1-0-202009071110qtsvg-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z_hash" 5e624dd519dc67ef80ea60f83162dd49e9a0e912122ad049a0a83af914a97ea2) -set("5.15.1-0-202009071110qttools-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z_hash" 94c5e98afa548bf56c7ccc29bccf727b75e2e90df98e83d22575d07f64359cda) -set("5.15.1-0-202009071110qtxmlpatterns-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z_hash" fe01c55dfb073064fe24e1e77564951ccfa21042b91ff8bd3d629854d0b8a7b7) +set("5.15.2-0-202011130601qtbase-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z_hash" a6b225c8ae4eed1b5de1109b27c9c85ea779f56cdeea44ec48d136f32370c6e3) +set("5.15.2-0-202011130601qtsvg-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z_hash" 94f1c25eba441c97870597140c9b5db7e8b6d75865875be6ceca929ebd44c2f8) +set("5.15.2-0-202011130601qttools-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z_hash" 96f46f690845184ea5a99010c7b59e14443ca0fa4b91f0ea37a2d25af1a3de55) +set("5.15.2-0-202011130601qtxmlpatterns-MacOS-MacOS_10_13-Clang-MacOS-MacOS_10_13-X86_64.7z_hash" 1a98346e84937f9e87d0b5375a90e18f70568b880bc70b141dc7f3cafac8c154) -- GitLab From a0d47916dce7eb87b2684efc8a72eb133a30f24c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 11:19:11 -0400 Subject: [PATCH 114/136] gitlab-ci: add macOS arm64 builds Includes: - renaming the existing build - updating to Xcode 12.4 --- .gitlab-ci.yml | 31 +++++++++++++++---- .gitlab/ci/cdash-groups.json | 7 ++++- ...lain.cmake => configure_macos_arm64.cmake} | 0 .gitlab/ci/configure_macos_x86_64.cmake | 1 + .gitlab/os-macos.yml | 23 +++++++++++--- 5 files changed, 51 insertions(+), 11 deletions(-) rename .gitlab/ci/{configure_macos_plain.cmake => configure_macos_arm64.cmake} (100%) create mode 100644 .gitlab/ci/configure_macos_x86_64.cmake diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e0784f342e..a563d5de6c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -192,24 +192,43 @@ analyze:fedora33-coverage: ## Build and test -build:macos-plain: +build:macos-arm64: extends: - - .macos_plain + - .macos_arm64 + - .cmake_build_macos + - .cmake_build_artifacts + - .macos_arm64_builder_tags + - .run_automatically + +test:macos-arm64: + extends: + - .macos_arm64 + - .cmake_test_macos + - .macos_arm64_builder_tags + - .run_automatically + dependencies: + - build:macos-arm64 + needs: + - build:macos-arm64 + +build:macos-x86_64: + extends: + - .macos_x86_64 - .cmake_build_macos - .cmake_build_artifacts - .macos_builder_tags - .run_automatically -test:macos-plain: +test:macos-x86_64: extends: - - .macos_plain + - .macos_x86_64 - .cmake_test_macos - .macos_builder_tags - .run_automatically dependencies: - - build:macos-plain + - build:macos-x86_64 needs: - - build:macos-plain + - build:macos-x86_64 # Windows diff --git a/.gitlab/ci/cdash-groups.json b/.gitlab/ci/cdash-groups.json index ab19ce7e31..25147edd2f 100644 --- a/.gitlab/ci/cdash-groups.json +++ b/.gitlab/ci/cdash-groups.json @@ -43,7 +43,12 @@ { "group": "master", "site": "gitlab-ci", - "buildname": "macos_plain" + "buildname": "macos_arm64" + }, + { + "group": "master", + "site": "gitlab-ci", + "buildname": "macos_x86_64" }, { "group": "master", diff --git a/.gitlab/ci/configure_macos_plain.cmake b/.gitlab/ci/configure_macos_arm64.cmake similarity index 100% rename from .gitlab/ci/configure_macos_plain.cmake rename to .gitlab/ci/configure_macos_arm64.cmake diff --git a/.gitlab/ci/configure_macos_x86_64.cmake b/.gitlab/ci/configure_macos_x86_64.cmake new file mode 100644 index 0000000000..0a31ef8689 --- /dev/null +++ b/.gitlab/ci/configure_macos_x86_64.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/configure_macos.cmake") diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml index 6b33c6dd22..7cb8f5030c 100644 --- a/.gitlab/os-macos.yml +++ b/.gitlab/os-macos.yml @@ -8,7 +8,7 @@ GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmb-ci-ext/$CI_CONCURRENT_ID" # TODO: Factor this out so that each job selects the Xcode version to # use so that different versions can be tested in a single pipeline. - DEVELOPER_DIR: "/Applications/Xcode-11.5.app/Contents/Developer" + DEVELOPER_DIR: "/Applications/Xcode-12.4.app/Contents/Developer" # Avoid conflicting with other projects running on the same machine. SCCACHE_SERVER_PORT: 4231 @@ -25,11 +25,18 @@ # could run at the same time, so we drop it. GIT_CLONE_PATH: "$CI_BUILDS_DIR/cmb-ci" -.macos_plain: +.macos_arm64: extends: .macos_build variables: - CMAKE_CONFIGURATION: macos_plain + CMAKE_CONFIGURATION: macos_arm64 + CTEST_NO_WARNINGS_ALLOWED: 1 + +.macos_x86_64: + extends: .macos_build + + variables: + CMAKE_CONFIGURATION: macos_x86_64 CTEST_NO_WARNINGS_ALLOWED: 1 ## Tags @@ -39,7 +46,15 @@ - cmb - macos - shell - - xcode-11.5 + - xcode-12.4 + - nonconcurrent + +.macos_arm64_builder_tags: + tags: + - cmb + - macos-arm64 + - shell + - xcode-12.4 - nonconcurrent ## macOS-specific scripts -- GitLab From 826f6ec36443c3a923cb419f0cb89f36e81789d8 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 16:43:47 -0400 Subject: [PATCH 115/136] clang-tidy: fix `performance-noexcept-move-constructor` lints --- smtk/resource/DerivedFrom.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smtk/resource/DerivedFrom.h b/smtk/resource/DerivedFrom.h index f3b6e51e48..9639bc0b15 100644 --- a/smtk/resource/DerivedFrom.h +++ b/smtk/resource/DerivedFrom.h @@ -72,7 +72,7 @@ protected: { } - DerivedFrom(DerivedFrom&& rhs) = default; + DerivedFrom(DerivedFrom&& rhs) noexcept = default; }; template -- GitLab From 4a466e5941bcc6fd5ef8a55cdbd90df85d51d4b5 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 16:44:40 -0400 Subject: [PATCH 116/136] clang-tidy: fix `bugprone-macro-parentheses` lints --- smtk/common/VersionMacros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smtk/common/VersionMacros.h b/smtk/common/VersionMacros.h index 503f5605fa..d125be56c3 100644 --- a/smtk/common/VersionMacros.h +++ b/smtk/common/VersionMacros.h @@ -13,7 +13,7 @@ #include "smtk/common/Version.h" -#define SMTK_VERSION_CHECK(major, minor) (100ULL * major + minor) +#define SMTK_VERSION_CHECK(major, minor) (100ULL * (major) + (minor)) #define SMTK_VERSION_NUMBER SMTK_VERSION_CHECK(SMTK_VERSION_MAJOR, SMTK_VERSION_MINOR) -- GitLab From f241546a79b36713ee898be08514c5b92dc7007f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 16:50:28 -0400 Subject: [PATCH 117/136] clang-tidy: fix `modernize-use-override` lints --- smtk/extension/qt/qtOperationDialog.h | 2 +- smtk/task/TaskNeedsResources.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/smtk/extension/qt/qtOperationDialog.h b/smtk/extension/qt/qtOperationDialog.h index 08f1e21be5..acbdea3ac5 100644 --- a/smtk/extension/qt/qtOperationDialog.h +++ b/smtk/extension/qt/qtOperationDialog.h @@ -68,7 +68,7 @@ public: smtk::view::ManagerPtr viewManager, bool scrollable, QWidget* parentWidget = nullptr); - virtual ~qtOperationDialog(); + ~qtOperationDialog() override; signals: void operationExecuted(const smtk::operation::Operation::Result& result); diff --git a/smtk/task/TaskNeedsResources.h b/smtk/task/TaskNeedsResources.h index 65f8056cc1..06d261101e 100644 --- a/smtk/task/TaskNeedsResources.h +++ b/smtk/task/TaskNeedsResources.h @@ -66,7 +66,7 @@ public: const PassedDependencies& dependencies, const smtk::common::Managers::Ptr& managers = nullptr); - virtual ~TaskNeedsResources() = default; + ~TaskNeedsResources() override = default; void configure(const Configuration& config); -- GitLab From 63707a68039e10f97cc9f81e3793737dd209ddea Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 18:07:46 -0400 Subject: [PATCH 118/136] ResourceContainer: fix `performance-for-range-copy` lint --- smtk/project/ResourceContainer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smtk/project/ResourceContainer.h b/smtk/project/ResourceContainer.h index e0d46b579e..5b4eef13c5 100644 --- a/smtk/project/ResourceContainer.h +++ b/smtk/project/ResourceContainer.h @@ -261,7 +261,7 @@ template std::set> ResourceContainer::findByRole(const std::string& role) { std::set> cast_set; - for (auto resourceptr : this->findByRole(role)) + for (const auto& resourceptr : this->findByRole(role)) { cast_set.insert(smtk::dynamic_pointer_cast(resourceptr)); } -- GitLab From fa61dbf7bb45a05d0fe5a95b3be3a0f20ee66bde Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 18:08:04 -0400 Subject: [PATCH 119/136] pqSMTKProjectPanel: use member initialization --- smtk/project/plugin/pqSMTKProjectPanel.cxx | 2 -- smtk/project/plugin/pqSMTKProjectPanel.h | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/smtk/project/plugin/pqSMTKProjectPanel.cxx b/smtk/project/plugin/pqSMTKProjectPanel.cxx index f1668e4a0f..c9203d80a1 100644 --- a/smtk/project/plugin/pqSMTKProjectPanel.cxx +++ b/smtk/project/plugin/pqSMTKProjectPanel.cxx @@ -23,8 +23,6 @@ pqSMTKProjectPanel::pqSMTKProjectPanel(QWidget* parent) : Superclass(parent) - , m_browser(nullptr) - , m_viewUIMgr(nullptr) { // Parse a json representation of our default config, save it. nlohmann::json j = nlohmann::json::parse(pqSMTKProjectBrowser::getJSONConfiguration()); diff --git a/smtk/project/plugin/pqSMTKProjectPanel.h b/smtk/project/plugin/pqSMTKProjectPanel.h index 52012e9edc..f22cb70a7d 100644 --- a/smtk/project/plugin/pqSMTKProjectPanel.h +++ b/smtk/project/plugin/pqSMTKProjectPanel.h @@ -35,9 +35,9 @@ protected slots: virtual void sourceRemoved(pqSMTKWrapper* mgr, pqServer* server); protected: - pqSMTKProjectBrowser* m_browser; + pqSMTKProjectBrowser* m_browser{ nullptr }; smtk::view::ConfigurationPtr m_view; - smtk::extension::qtUIManager* m_viewUIMgr; + smtk::extension::qtUIManager* m_viewUIMgr{ nullptr }; }; #endif -- GitLab From 24d391bf9f9a755e30a356beaf83a90647bf8d4a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 16:50:07 -0400 Subject: [PATCH 120/136] CTestCustom: ignore clang-tidy lints from CMake's unit test template --- CMake/CTestCustom.cmake.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMake/CTestCustom.cmake.in b/CMake/CTestCustom.cmake.in index dd69bdd3b7..073efd2768 100644 --- a/CMake/CTestCustom.cmake.in +++ b/CMake/CTestCustom.cmake.in @@ -20,6 +20,9 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION # ParaView generated code (paraview/paraview!4957) "AutoStartImplementation.*modernize-use-nullptr" "pqSMTKAutoStart.*Implementation.*modernize-use-nullptr" + + # CMake-generated sources. (cmake/cmake!6352) + "UnitTests_smtk_" ) ##------------------------------------------------------------------------------ -- GitLab From de17622952b93b758596a8c47de8ea2eb2073691 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 18:08:19 -0400 Subject: [PATCH 121/136] CTestCustom: ignore warnings from delaunay --- CMake/CTestCustom.cmake.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMake/CTestCustom.cmake.in b/CMake/CTestCustom.cmake.in index 073efd2768..6cd072e226 100644 --- a/CMake/CTestCustom.cmake.in +++ b/CMake/CTestCustom.cmake.in @@ -23,6 +23,9 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION # CMake-generated sources. (cmake/cmake!6352) "UnitTests_smtk_" + + # Warnings from the delaunay submodule. + "thirdparty/delaunay" ) ##------------------------------------------------------------------------------ -- GitLab From 440598b5c35de69ef843962bd8d543e0ff9ab461 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 18:08:28 -0400 Subject: [PATCH 122/136] CTestCustom: ignore more warnings from ParaView-generated code --- CMake/CTestCustom.cmake.in | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CMake/CTestCustom.cmake.in b/CMake/CTestCustom.cmake.in index 6cd072e226..a2ad18fc40 100644 --- a/CMake/CTestCustom.cmake.in +++ b/CMake/CTestCustom.cmake.in @@ -20,6 +20,19 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION # ParaView generated code (paraview/paraview!4957) "AutoStartImplementation.*modernize-use-nullptr" "pqSMTKAutoStart.*Implementation.*modernize-use-nullptr" + # Fixes from paraview/paraview!5058 + "_server_manager\\.h.*misc-definitions-in-headers" + "_server_manager\\.h.*modernize-use-emplace" + "_server_manager_modules\\.h.*misc-definitions-in-headers" + "_server_manager_modules\\.h.*modernize-use-emplace" + "_client_server\\.h.*misc-definitions-in-headers" + "_qch\\.h.*modernize-deprecated-headers" + "_qch\\.h.*misc-definitions-in-headers" + "_server_manager_modules_data\\.h.*misc-definitions-in-headers" + "_server_manager_modules_data\\.h.*modernize-deprecated-headers" + "_server_manager_data\\.h.*misc-definitions-in-headers" + "_server_manager_data\\.h.*modernize-deprecated-headers" + "note: make as 'inline'" # CMake-generated sources. (cmake/cmake!6352) "UnitTests_smtk_" -- GitLab From 82f6ae5e94c713df037004751713faa20cba4325 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 16:07:26 -0400 Subject: [PATCH 123/136] ModelViewer: fix indentation and `if` nesting in install code --- applications/ModelViewer/CMakeLists.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/applications/ModelViewer/CMakeLists.txt b/applications/ModelViewer/CMakeLists.txt index 026a662b9e..faeac2dc81 100644 --- a/applications/ModelViewer/CMakeLists.txt +++ b/applications/ModelViewer/CMakeLists.txt @@ -264,14 +264,13 @@ install(CODE if (match) set(add_to_list ON) if (ignore_items) - if (\${conflicting_dep} NOT IN_LIST ignore_items) - set(add_to_list OFF) - endif() - endif() - if (add_to_list) + if (\${conflicting_dep} NOT IN_LIST ignore_items) + set(add_to_list OFF) + endif() + endif() + if (add_to_list) list(GET conflicting_deps_\${conflicting_dep} 0 dep) list(APPEND conflicting_deps \${dep}) - endif() endif() endif() endforeach() -- GitLab From 40efe0d30fd1ac8661155397c7a5efe1a73c9915 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 15:16:07 -0400 Subject: [PATCH 124/136] ci: update to CMake 3.21.0 --- .gitlab/ci/cmake.ps1 | 8 ++++---- .gitlab/ci/cmake.sh | 15 ++++++--------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.gitlab/ci/cmake.ps1 b/.gitlab/ci/cmake.ps1 index 6b50863125..5d01e3f9e3 100755 --- a/.gitlab/ci/cmake.ps1 +++ b/.gitlab/ci/cmake.ps1 @@ -1,13 +1,13 @@ $erroractionpreference = "stop" -$version = "3.19.4" -$sha256sum = "24B03DAF75CE59B542DA38C829FE6944D3BF7CF99AFAA8225CF29F7876823899" -$filename = "cmake-$version-win64-x64" +$version = "3.21.0" +$sha256sum = "C7B88C907A753F4EC86E43DDC89F91F70BF1B011859142F7F29E6D51EA4ABB3C" +$filename = "cmake-$version-windows-x86_64" $tarball = "$filename.zip" $outdir = $pwd.Path $outdir = "$outdir\.gitlab" -$ProgressPreference = "SilentlyContinue" +$ProgressPreference = 'SilentlyContinue' Invoke-WebRequest -Uri "https://github.com/Kitware/CMake/releases/download/v$version/$tarball" -OutFile "$outdir\$tarball" $hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256 if ($hash.Hash -ne $sha256sum) { diff --git a/.gitlab/ci/cmake.sh b/.gitlab/ci/cmake.sh index be09d14a0b..1547e30aa2 100755 --- a/.gitlab/ci/cmake.sh +++ b/.gitlab/ci/cmake.sh @@ -2,20 +2,18 @@ set -e -readonly version="3.19.4" +readonly version="3.21.0" case "$( uname -s )" in Linux) shatool="sha256sum" - sha256sum="ff23e1f53c53e8ef1fa87568345031d86c504e53efb52fa487db0b8e0ee4d3ff" - platform="Linux" - arch="x86_64" + sha256sum="d54ef6909f519740bc85cec07ff54574cd1e061f9f17357d9ace69f61c6291ce" + platform="linux-x86_64" ;; Darwin) shatool="shasum -a 256" - sha256sum="eb1f52996632c1e71a1051c9e2c30cc8df869fb5a213b1a0d3b202744c6c5758" - platform="macos" - arch="universal" + sha256sum="c1c6f19dfc9c658a48b5aed22806595b2337bb3aedb71ab826552f74f568719f" + platform="macos-universal" ;; *) echo "Unrecognized platform $( uname -s )" @@ -25,9 +23,8 @@ esac readonly shatool readonly sha256sum readonly platform -readonly arch -readonly filename="cmake-$version-$platform-$arch" +readonly filename="cmake-$version-$platform" readonly tarball="$filename.tar.gz" cd .gitlab -- GitLab From 26fb6ea998fb2fcaf2462f5fce1cfc453a4d6348 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 14 Jul 2021 15:31:47 -0400 Subject: [PATCH 125/136] gitlab-ci: upload JUnit reports for tests --- .gitlab-ci.yml | 9 +++++++++ .gitlab/artifacts.yml | 10 ++++++++++ .gitlab/ci/ctest_memcheck.cmake | 1 + .gitlab/ci/ctest_test.cmake | 3 ++- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a563d5de6c..5a092893ae 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -45,6 +45,7 @@ test:fedora33: extends: - .fedora33 - .cmake_test_linux + - .cmake_test_artifacts - .linux_test_tags - .run_automatically dependencies: @@ -64,6 +65,7 @@ test:fedora33-vtk-python3: extends: - .fedora33_vtk_python3 - .cmake_test_linux + - .cmake_test_artifacts - .linux_test_tags - .run_automatically dependencies: @@ -83,6 +85,7 @@ test:fedora33-paraview: extends: - .fedora33_paraview - .cmake_test_linux + - .cmake_test_artifacts - .linux_test_tags - .run_automatically dependencies: @@ -102,6 +105,7 @@ test:fedora33-nodata: extends: - .fedora33_nodata - .cmake_test_linux + - .cmake_test_artifacts - .linux_test_tags - .run_automatically dependencies: @@ -123,6 +127,7 @@ test:fedora33-asan: extends: - .fedora33_asan - .cmake_memcheck_linux + - .cmake_test_artifacts - .linux_test_priv_tags - .run_automatically dependencies: @@ -142,6 +147,7 @@ test:fedora33-ubsan: extends: - .fedora33_ubsan - .cmake_memcheck_linux + - .cmake_test_artifacts - .linux_test_priv_tags - .run_automatically dependencies: @@ -204,6 +210,7 @@ test:macos-arm64: extends: - .macos_arm64 - .cmake_test_macos + - .cmake_test_artifacts - .macos_arm64_builder_tags - .run_automatically dependencies: @@ -223,6 +230,7 @@ test:macos-x86_64: extends: - .macos_x86_64 - .cmake_test_macos + - .cmake_test_artifacts - .macos_builder_tags - .run_automatically dependencies: @@ -246,6 +254,7 @@ test:windows-vs2019-ninja: extends: - .windows_vs2019_ninja - .cmake_test_windows + - .cmake_test_artifacts - .windows_builder_tags - .run_automatically dependencies: diff --git a/.gitlab/artifacts.yml b/.gitlab/artifacts.yml index 664ed3610d..a7c3c45852 100644 --- a/.gitlab/artifacts.yml +++ b/.gitlab/artifacts.yml @@ -58,9 +58,19 @@ # CDash files. - build/DartConfiguration.tcl +.cmake_test_artifacts: + artifacts: + expire_in: 1d + reports: + junit: + - build/junit.xml + .cmake_coverage_artifacts: artifacts: expire_in: 1d + reports: + junit: + - build/junit.xml paths: # Generated headers. # XXX(globbing): Can be simplified with support from diff --git a/.gitlab/ci/ctest_memcheck.cmake b/.gitlab/ci/ctest_memcheck.cmake index 65b585bd4a..40c09ff64e 100644 --- a/.gitlab/ci/ctest_memcheck.cmake +++ b/.gitlab/ci/ctest_memcheck.cmake @@ -20,6 +20,7 @@ ctest_memcheck( PARALLEL_LEVEL "${nproc}" RETURN_VALUE test_result EXCLUDE "${test_exclusions}" + OUTPUT_JUNIT "${CTEST_BINARY_DIRECTORY}/junit.xml" DEFECT_COUNT defects) ctest_submit_multi(PARTS Test) ctest_submit_multi(PARTS Memcheck) diff --git a/.gitlab/ci/ctest_test.cmake b/.gitlab/ci/ctest_test.cmake index 721766cb47..25f5d2b4a7 100644 --- a/.gitlab/ci/ctest_test.cmake +++ b/.gitlab/ci/ctest_test.cmake @@ -16,7 +16,8 @@ include("${CMAKE_CURRENT_LIST_DIR}/ctest_exclusions.cmake") ctest_test( PARALLEL_LEVEL "${nproc}" RETURN_VALUE test_result - EXCLUDE "${test_exclusions}") + EXCLUDE "${test_exclusions}" + OUTPUT_JUNIT "${CTEST_BINARY_DIRECTORY}/junit.xml") file(GLOB packages "${CTEST_BINARY_DIRECTORY}/PluginTests/*/build/plugin/build/*.tar.gz") -- GitLab From 34cb9e3cd3ceaece897a708683476a1817af2d06 Mon Sep 17 00:00:00 2001 From: Robert O'Bara Date: Thu, 15 Jul 2021 17:27:00 -0400 Subject: [PATCH 126/136] ENH: Adding the ability to ignore items Also added the following: * Ability to indicate that an Attribute's name should not be editable via the bool Property: smtk.extensions.attribute_view.name_read_only * qtGroupItem will not display it's children frame if it have no relevant children * Modified Attribute/Item isRelevant methods to optional test for read access * Expanded Resource/Component Properties to include bool, int, vector of bools and vector of ints * Added example of a sbt file where group items have no relevant children * Added a test for new isRelevant and isIgnored functionality Closes #438 #431 #436 --- .../emptyGroupItemExample.sbt | 3 + doc/release/notes/changesToQtGroupItem.rst | 3 + .../notes/expandingDefaultProperties.rst | 3 + doc/release/notes/isRelevantChanges.rst | 37 +++ doc/release/notes/readOnlyAttributeNames.rst | 7 + smtk/attribute/Attribute.cxx | 21 +- smtk/attribute/Attribute.h | 12 +- smtk/attribute/GroupItem.cxx | 15 ++ smtk/attribute/GroupItem.h | 3 + smtk/attribute/Item.cxx | 17 +- smtk/attribute/Item.h | 33 ++- smtk/attribute/json/jsonItem.cxx | 9 + smtk/attribute/pybind11/PybindAttribute.h | 2 +- smtk/attribute/pybind11/PybindGroupItem.h | 1 + smtk/attribute/pybind11/PybindItem.h | 4 +- smtk/attribute/testing/cxx/CMakeLists.txt | 1 + smtk/attribute/testing/cxx/unitIsRelevant.cxx | 217 ++++++++++++++++++ smtk/extension/qt/qtAttributeView.cxx | 129 ++++++++--- smtk/extension/qt/qtAttributeView.h | 2 + smtk/extension/qt/qtGroupItem.cxx | 11 +- smtk/io/XmlDocV4Parser.cxx | 5 + smtk/io/XmlV2StringWriter.cxx | 4 + smtk/resource/Properties.h | 4 + 23 files changed, 488 insertions(+), 55 deletions(-) create mode 100644 data/attribute/attribute_collection/emptyGroupItemExample.sbt create mode 100644 doc/release/notes/changesToQtGroupItem.rst create mode 100644 doc/release/notes/expandingDefaultProperties.rst create mode 100644 doc/release/notes/isRelevantChanges.rst create mode 100644 doc/release/notes/readOnlyAttributeNames.rst create mode 100644 smtk/attribute/testing/cxx/unitIsRelevant.cxx diff --git a/data/attribute/attribute_collection/emptyGroupItemExample.sbt b/data/attribute/attribute_collection/emptyGroupItemExample.sbt new file mode 100644 index 0000000000..55c36e757c --- /dev/null +++ b/data/attribute/attribute_collection/emptyGroupItemExample.sbt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:176f76ba094b878ac0e027a2fcfe71cff66899285cd3754009e811517ae15c66 +size 1224 diff --git a/doc/release/notes/changesToQtGroupItem.rst b/doc/release/notes/changesToQtGroupItem.rst new file mode 100644 index 0000000000..e726d3f1b4 --- /dev/null +++ b/doc/release/notes/changesToQtGroupItem.rst @@ -0,0 +1,3 @@ +Removing Empty Frames in qtGroupItem +==================================== +Using GroupItem's hasRelevantChildren method, qtGroupItem will now hide it's frame if there are no children to be displayed. diff --git a/doc/release/notes/expandingDefaultProperties.rst b/doc/release/notes/expandingDefaultProperties.rst new file mode 100644 index 0000000000..28f1ef598c --- /dev/null +++ b/doc/release/notes/expandingDefaultProperties.rst @@ -0,0 +1,3 @@ +Expanding Default Property Types on SMTK Resources/Components +============================================================= +The default set of Properties now include int, bool, std::vector and std::vector. diff --git a/doc/release/notes/isRelevantChanges.rst b/doc/release/notes/isRelevantChanges.rst new file mode 100644 index 0000000000..1f6960f376 --- /dev/null +++ b/doc/release/notes/isRelevantChanges.rst @@ -0,0 +1,37 @@ +.. highlight::cpp + +Added the ability to ignore an item +=================================== +There are times when a workflow may consider an item no longer relevant based on choices the user has made. In order model this behavior two methods have been added to Item: + +.. code-block:: c++ + + void setIsIgnored(bool val); + bool isIgnored() const; + + +If setIsIgnored is passed true, then the item's isRelevant() method will return false, regardless of any other facts. +This value is persistent and is supported in both JSON and XML formats. + +Changes to Attribute and Item isRelevant Methods +================================================ + +Both Attribute::isRelevant and Item::isRelevant have been modified to optional do advance level checking. + +.. code-block:: c++ + + bool isRelevant(bool includeReadAccess = false, int readAccessLevel = 0) const; + +If includeReadAccess is set to true then an Attribute is relevant iff at least one of it's children has a read access level <= readAccessLevel as well as passing the existing category checks. + +In the case of an Item, if includeReadAccess is true then it must pass both category checks and have it's read access level <= readAccessLevel + +Note that this modification does not require any code change in order to preserve previous functionality. + +Added hasRelevantChildren method to GroupItem +============================================= +GroupItem now has a method to test if at least on of its children items passes their category checks (and optionally their advance level checks). + +.. code-block:: c++ + + bool hasRelevantChildren(bool includeReadAccess = false, int readAccessLevel = 0) const; diff --git a/doc/release/notes/readOnlyAttributeNames.rst b/doc/release/notes/readOnlyAttributeNames.rst new file mode 100644 index 0000000000..b05f5e5cf4 --- /dev/null +++ b/doc/release/notes/readOnlyAttributeNames.rst @@ -0,0 +1,7 @@ +Supporting smtk.extensions.attribute_view.name_read_only in qtAttributeViews +============================================================================ +You can now indicate that an Attribute's name should not be modified by creating a bool Property on the Attribute called: smtk.extensions.attribute_view.name_read_only and setting its value to true. + +Observing Operations +==================== +qtAttributeView will now properly examine modified attributes to see if they have smtk.extensions.attribute_view.name_read_only property or if their names had been changed. diff --git a/smtk/attribute/Attribute.cxx b/smtk/attribute/Attribute.cxx index 08a8a1eb85..a361a60f91 100644 --- a/smtk/attribute/Attribute.cxx +++ b/smtk/attribute/Attribute.cxx @@ -317,14 +317,29 @@ bool Attribute::isValid(const std::set& cats) const return !(m_associatedObjects && !m_associatedObjects->isValid(false)); } -bool Attribute::isRelevant() const +bool Attribute::isRelevant(bool includeReadAccess, int readAccessLevel) const { auto aResource = this->attributeResource(); if (aResource && aResource->activeCategoriesEnabled()) { - return this->categories().passes(aResource->activeCategories()); + if (!this->categories().passes(aResource->activeCategories())) + { + return false; + } } - return true; + if (!includeReadAccess) + { + return true; + } + + // Lets see if at least one of the attribute's items is relevant. + if (std::any_of(m_items.begin(), m_items.end(), [=](const ItemPtr& item) { + return item->isRelevant(includeReadAccess, readAccessLevel); + })) + { + return true; + } + return false; } ResourcePtr Attribute::attributeResource() const diff --git a/smtk/attribute/Attribute.h b/smtk/attribute/Attribute.h index 019e7d2ca1..7a0d397fa9 100644 --- a/smtk/attribute/Attribute.h +++ b/smtk/attribute/Attribute.h @@ -321,11 +321,15 @@ public: bool isValid(bool useActiveCategories = true) const; bool isValid(const std::set& categories) const; - ///\brief Returns true if the attribute is relevant based on the resource's - /// active categories. If the Resource does not have active categories enabled or - /// if the attribute passes its category check, this method will return true; else + ///\brief Returns true if the attribute is relevant. + /// + /// If includeReadAccess is false then if the Resource does not have active categories enabled or + /// if the attribute passes its category check this method will return true; else /// it will return false - bool isRelevant() const; + /// + /// If includeReadAccess is true, then a subset of the attribute's items must have their + /// read access <= readAccessLevel in addition to passing the category checks. + bool isRelevant(bool includeReadAccess = false, int readAccessLevel = 0) const; smtk::attribute::ResourcePtr attributeResource() const; const smtk::resource::ResourcePtr resource() const override; diff --git a/smtk/attribute/GroupItem.cxx b/smtk/attribute/GroupItem.cxx index 89f13f97ad..b980cf34a3 100644 --- a/smtk/attribute/GroupItem.cxx +++ b/smtk/attribute/GroupItem.cxx @@ -499,3 +499,18 @@ bool GroupItem::assign(ConstItemPtr& sourceItem, unsigned int options) } return Item::assign(sourceItem, options); } + +bool GroupItem::hasRelevantChildren(bool includeReadAccess, int readAccessLevel) const +{ + for (size_t elementIndex = 0; elementIndex < this->numberOfGroups(); elementIndex++) + { + for (size_t valueIndex = 0; valueIndex < this->numberOfItemsPerGroup(); valueIndex++) + { + if (this->item(elementIndex, valueIndex)->isRelevant(includeReadAccess, readAccessLevel)) + { + return true; + } + } + } + return false; +} diff --git a/smtk/attribute/GroupItem.h b/smtk/attribute/GroupItem.h index db7aeeeca0..1bd972e2df 100644 --- a/smtk/attribute/GroupItem.h +++ b/smtk/attribute/GroupItem.h @@ -168,6 +168,9 @@ public: /// See Items.h for a description of these options. bool assign(smtk::attribute::ConstItemPtr& sourceItem, unsigned int options = 0) override; + ///\brief Returns true if the group item has relevant children. + bool hasRelevantChildren(bool includeReadAccess = false, int readAccessLevel = 0) const; + protected: GroupItem(Attribute* owningAttribute, int itemPosition); GroupItem(Item* owningItem, int myPosition, int mySubGroupPosition); diff --git a/smtk/attribute/Item.cxx b/smtk/attribute/Item.cxx index fab9307ca5..6e517f070a 100644 --- a/smtk/attribute/Item.cxx +++ b/smtk/attribute/Item.cxx @@ -24,6 +24,7 @@ Item::Item(Attribute* owningAttribute, int itemPosition) , m_position(itemPosition) , m_isEnabled(true) , m_forceRequired(false) + , m_isIgnored(false) { m_hasLocalAdvanceLevelInfo[0] = false; m_hasLocalAdvanceLevelInfo[1] = false; @@ -37,6 +38,7 @@ Item::Item(Item* inOwningItem, int itemPosition, int inSubGroupPosition) , m_subGroupPosition(inSubGroupPosition) , m_isEnabled(true) , m_forceRequired(false) + , m_isIgnored(false) { m_hasLocalAdvanceLevelInfo[0] = false; m_hasLocalAdvanceLevelInfo[1] = false; @@ -78,18 +80,27 @@ bool Item::isValid(bool useActiveCategories) const return this->isValidInternal(false, cats); } -bool Item::isRelevant() const +bool Item::isRelevant(bool includeReadAccess, unsigned int readAccessLevel) const { + if (m_isIgnored) + { + return false; // Item has been marked to be ignored + } + auto myAttribute = this->attribute(); if (myAttribute) { auto aResource = myAttribute->attributeResource(); if (aResource && aResource->activeCategoriesEnabled()) { - return this->categories().passes(aResource->activeCategories()); + if (!this->categories().passes(aResource->activeCategories())) + { + return false; + } } } - return true; + + return (includeReadAccess ? (this->advanceLevel() <= readAccessLevel) : true); } std::string Item::name() const diff --git a/smtk/attribute/Item.h b/smtk/attribute/Item.h index d4cf2d222f..05e1ba123b 100644 --- a/smtk/attribute/Item.h +++ b/smtk/attribute/Item.h @@ -96,11 +96,15 @@ public: } /// @} - ///\brief Returns true if the item is relevant based on the resource's - /// active categories. If the Resource does not have active categories enabled or - /// if the item passes its category check, this method will return true; else - /// it will return false - bool isRelevant() const; + ///\brief Returns true if the item is relevant. + /// + /// If includeReadAccess is false then if the Resource does not have active categories enabled or + /// if the item passes its category check this method will return true; else + /// it will return false. + /// + /// If includeReadAccess is true, then the item's + /// advanceLevel must also be <= readAccessLevel in addition to passing the category checks in order to pass. + virtual bool isRelevant(bool includeReadAccess = false, unsigned int readAccessLevel = 0) const; /// @{ /// \brief return a child item that matches name and satisfies the SearchStyle @@ -186,7 +190,7 @@ public: /// /// if mode is 1 then the write access level is returned; /// else the read access level is returned - /// The information can either be specificied directly to the item + /// The information can either be specified directly to the item /// using setLocalAdvanceLevel() or from the item's definition. /// If this item is not owned by another item or attribute the value /// is simply returned. Else the max of the value and that of its @@ -219,7 +223,7 @@ public: virtual void reset(); - /// Rotate internal data. Implementation to be added in subclasses. + /// Rotate internal data. Implementation to be added in sub-classes. /// Default behavior here is no-op (returns false). virtual bool rotate(std::size_t fromPosition, std::size_t toPosition); @@ -233,9 +237,21 @@ public: void detachOwningItem() { m_owningItem = nullptr; } /// Assigns this item to be equivalent to another. Options are processed by derived item classes - /// Returns true if success and false if a problem occured + /// Returns true if success and false if a problem occurred virtual bool assign(smtk::attribute::ConstItemPtr& sourceItem, unsigned int options = 0); + ///@{ + /// \brief Controls if an item should be ignored. + /// + /// There are cases within a work-flow when an item may not be currently relevant and should be ignored. + /// When setIgnored is passed true, the item::isRelevant will return false regardless of category or + /// advance property checks + /// By default isIgnored() will return false. + void setIsIgnored(bool val) { m_isIgnored = val; } + + bool isIgnored() const { return m_isIgnored; } + ///@} + static std::string type2String(Item::Type t); static Item::Type string2Type(const std::string& s); @@ -259,6 +275,7 @@ protected: int m_position; int m_subGroupPosition; bool m_isEnabled; + bool m_isIgnored; smtk::attribute::ConstItemDefinitionPtr m_definition; std::map m_userData; diff --git a/smtk/attribute/json/jsonItem.cxx b/smtk/attribute/json/jsonItem.cxx index 571ecb70c8..45fd99f920 100644 --- a/smtk/attribute/json/jsonItem.cxx +++ b/smtk/attribute/json/jsonItem.cxx @@ -42,6 +42,10 @@ SMTKCORE_EXPORT void to_json(json& j, const smtk::attribute::ItemPtr& itemPtr) { j["AdvanceWriteLevel"] = itemPtr->localAdvanceLevel(1); } + if (itemPtr->isIgnored()) + { + j["IsIgnored"] = true; + } } SMTKCORE_EXPORT void from_json(const json& j, smtk::attribute::ItemPtr& itemPtr) @@ -75,6 +79,11 @@ SMTKCORE_EXPORT void from_json(const json& j, smtk::attribute::ItemPtr& itemPtr) { itemPtr->setLocalAdvanceLevel(1, *result); } + result = j.find("IsIgnored"); + if (result != j.end()) + { + itemPtr->setIsIgnored(*result); + } } } // namespace attribute } // namespace smtk diff --git a/smtk/attribute/pybind11/PybindAttribute.h b/smtk/attribute/pybind11/PybindAttribute.h index 4e433ceb6b..08cf82e292 100644 --- a/smtk/attribute/pybind11/PybindAttribute.h +++ b/smtk/attribute/pybind11/PybindAttribute.h @@ -97,7 +97,7 @@ inline PySharedPtrClass< smtk::attribute::Attribute > pybind11_init_smtk_attribu .def("isObjectAssociated", (bool (smtk::attribute::Attribute::*)(::smtk::resource::PersistentObjectPtr const &) const) &smtk::attribute::Attribute::isObjectAssociated, py::arg("componentPtr")) .def("isEntityAssociated", (bool (smtk::attribute::Attribute::*)(::smtk::common::UUID const &) const) &smtk::attribute::Attribute::isEntityAssociated, py::arg("entity")) .def("isEntityAssociated", (bool (smtk::attribute::Attribute::*)(::smtk::model::EntityRef const &) const) &smtk::attribute::Attribute::isEntityAssociated, py::arg("entityref")) - .def("isRelevant", &smtk::attribute::Attribute::isRelevant) + .def("isRelevant", &smtk::attribute::Attribute::isRelevant, py::arg("includeReadAccess"), py::arg("readAccessLevel")) .def("isValid", (bool (smtk::attribute::Attribute::*)(bool) const) &smtk::attribute::Attribute::isValid, py::arg("useActiveCategories") = true) .def("isValid", (bool (smtk::attribute::Attribute::*)(std::set const &) const) &smtk::attribute::Attribute::isValid, py::arg("categories")) .def("items", &smtk::attribute::Attribute::items) diff --git a/smtk/attribute/pybind11/PybindGroupItem.h b/smtk/attribute/pybind11/PybindGroupItem.h index a4d966ea14..1f1f9528d1 100644 --- a/smtk/attribute/pybind11/PybindGroupItem.h +++ b/smtk/attribute/pybind11/PybindGroupItem.h @@ -38,6 +38,7 @@ inline PySharedPtrClass< smtk::attribute::GroupItem, smtk::attribute::Item > pyb .def("isExtensible", &smtk::attribute::GroupItem::isExtensible) .def("item", (smtk::attribute::ItemPtr (smtk::attribute::GroupItem::*)(::size_t) const) &smtk::attribute::GroupItem::item, py::arg("ith")) .def("item", (smtk::attribute::ItemPtr (smtk::attribute::GroupItem::*)(::size_t, ::size_t) const) &smtk::attribute::GroupItem::item, py::arg("element"), py::arg("ith")) + .def("hasRelevantChildren", &smtk::attribute::GroupItem::insertGroups, py::arg("includeReadAccess"), py::arg("readAccessLevel")) .def("maxNumberOfChoices", &smtk::attribute::GroupItem::maxNumberOfChoices) .def("maxNumberOfGroups", &smtk::attribute::GroupItem::maxNumberOfGroups) .def("minNumberOfChoices", &smtk::attribute::GroupItem::minNumberOfChoices) diff --git a/smtk/attribute/pybind11/PybindItem.h b/smtk/attribute/pybind11/PybindItem.h index c8c443813b..8f22e845d6 100644 --- a/smtk/attribute/pybind11/PybindItem.h +++ b/smtk/attribute/pybind11/PybindItem.h @@ -30,7 +30,7 @@ inline PySharedPtrClass< smtk::attribute::Item > pybind11_init_smtk_attribute_It .def("name", &smtk::attribute::Item::name) .def("label", &smtk::attribute::Item::label) .def("type", &smtk::attribute::Item::type) - .def("isRelevant", &smtk::attribute::Item::isRelevant) + .def("isRelevant", &smtk::attribute::Item::isRelevant, py::arg("includeReadAccess"), py::arg("readAccessLevel")) .def("isValid", (bool (smtk::attribute::Item::*)(bool) const) &smtk::attribute::Item::isValid, py::arg("useActiveCategories") = true) .def("isValid", (bool (smtk::attribute::Item::*)(std::set const &) const) &smtk::attribute::Item::isValid, py::arg("categories")) .def("definition", &smtk::attribute::Item::definition) @@ -44,6 +44,8 @@ inline PySharedPtrClass< smtk::attribute::Item > pybind11_init_smtk_attribute_It .def("localEnabledState", &smtk::attribute::Item::localEnabledState) .def("setForceRequired", &smtk::attribute::Item::setForceRequired, py::arg("forceRequiredMode")) .def("forceRequired", &smtk::attribute::Item::forceRequired) + .def("setIsIgnored", &smtk::attribute::Item::setIsIgnored, py::arg("isIgnoredValue")) + .def("isIgnored", &smtk::attribute::Item::isIgnored) // NOTE that the Python form of this method is returning a copy since Python // doesn't support const references .def("categories", &smtk::attribute::Item::categories) diff --git a/smtk/attribute/testing/cxx/CMakeLists.txt b/smtk/attribute/testing/cxx/CMakeLists.txt index 3b433b5bf2..b25842714b 100644 --- a/smtk/attribute/testing/cxx/CMakeLists.txt +++ b/smtk/attribute/testing/cxx/CMakeLists.txt @@ -94,6 +94,7 @@ set(unit_tests unitEvaluatorManager.cxx unitExclusionCategories.cxx unitInfixExpressionEvaluator.cxx + unitIsRelevant.cxx unitJsonItemDefinitions.cxx unitOptionalItems.cxx unitPassCategories.cxx diff --git a/smtk/attribute/testing/cxx/unitIsRelevant.cxx b/smtk/attribute/testing/cxx/unitIsRelevant.cxx new file mode 100644 index 0000000000..7a1d2d874d --- /dev/null +++ b/smtk/attribute/testing/cxx/unitIsRelevant.cxx @@ -0,0 +1,217 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#include "smtk/attribute/Definition.h" +#include "smtk/attribute/FileItem.h" +#include "smtk/attribute/GroupItemDefinition.h" +#include "smtk/attribute/IntItem.h" +#include "smtk/attribute/ReferenceItem.h" +#include "smtk/attribute/Resource.h" +#include "smtk/attribute/ResourceItem.h" +#include "smtk/attribute/StringItemDefinition.h" +#include "smtk/attribute/VoidItemDefinition.h" +#include "smtk/attribute/operators/Read.h" +#include "smtk/attribute/operators/Write.h" +#include "smtk/io/AttributeReader.h" +#include "smtk/io/AttributeWriter.h" +#include "smtk/io/Logger.h" + +#include "smtk/common/testing/cxx/helpers.h" + +using namespace smtk::attribute; +using namespace smtk::common; +using namespace smtk; + +namespace +{ +bool testAttriubuteResource( + const attribute::ResourcePtr& attRes, + bool checkAdvanceLevel, + unsigned int readAccessLevel, + bool attRelevance, + std::vector itemRelevances) +{ + bool result = true; + const attribute::AttributePtr& att = attRes->findAttribute("a"); + if (att == nullptr) + { + std::cerr << "Could not find attribute a\n"; + return false; + } + if (att->isRelevant(checkAdvanceLevel, readAccessLevel) != attRelevance) + { + std::cerr << "\t Attribute: " << att->name() << " had incorrect relevance! Should have been " + << attRelevance << std::endl; + result = false; + } + int n = (int)itemRelevances.size(); + for (int i = 0; i < n; i++) + { + if (att->item(i)->isRelevant(checkAdvanceLevel, readAccessLevel) != itemRelevances[i]) + { + std::cerr << "\t Attribute: " << att->name() << "'s Item: " << att->item(i)->name() + << " had incorrect relevance! Should have been " << itemRelevances[i] << std::endl; + result = false; + } + } + return result; +} + +bool runTests(const attribute::ResourcePtr& attRes, const std::string& prefix) +{ + bool result = true; + // First lets test not using advance levels but active categories set to A + // Lets define what the categories should be for this resource + std::set cats; + cats.insert("A"); + attRes->setActiveCategories(cats); + attRes->setActiveCategoriesEnabled(true); + // in this case the attribute should be relevant and all but the first item + // which is set to be ignored + std::vector test1 = { false, true, true }; + if (testAttriubuteResource(attRes, false, 0, true, test1)) + { + std::cerr << prefix << " Test 1 - Passed\n"; + } + else + { + std::cerr << prefix << " Test 1 - Failed\n"; + result = false; + } + // Second - same thing but with advance level testing on and access = 0 + // In this case everyone should fail since the only access level 0 item + // is set to be ignored + std::vector test2 = { false, false, false }; + if (testAttriubuteResource(attRes, true, 0, false, test2)) + { + std::cerr << prefix << " Test 2 - Passed\n"; + } + else + { + std::cerr << prefix << " Test 2 - Failed\n"; + result = false; + } + // Third - same thing but with advance level testing on and access = 1 + // In this case the attribute and second item should pass + std::vector test3 = { false, true, false }; + if (testAttriubuteResource(attRes, true, 1, true, test3)) + { + std::cerr << prefix << " Test 3 - Passed\n"; + } + else + { + std::cerr << prefix << " Test 3 - Failed\n"; + result = false; + } + // Fourth - same thing but with advance level testing on and access = 2 + // In this case the attribute and second and third items should pass + std::vector test4 = { false, true, true }; + if (testAttriubuteResource(attRes, true, 2, true, test4)) + { + std::cerr << prefix << " Test 4 - Passed\n"; + } + else + { + std::cerr << prefix << " Test 4 - Failed\n"; + result = false; + } + // Finally lets change the active categories to B - in this case all should fail + cats.clear(); + cats.insert("B"); + attRes->setActiveCategories(cats); + std::vector test5 = { false, false, false }; + if (testAttriubuteResource(attRes, false, 0, false, test5)) + { + std::cerr << prefix << " Test 5 - Passed\n"; + } + else + { + std::cerr << prefix << " Test 5 - Failed\n"; + result = false; + } + return result; +} +void setupAttributeResource(attribute::ResourcePtr& attRes) +{ + DefinitionPtr A = attRes->createDefinition("A"); + A->localCategories().insertInclusion("A"); + // Lets create 3 items of read access levels 0, 1, 2 respectively + VoidItemDefinitionPtr vItemDef = A->addItemDefinition("i0"); + vItemDef = A->addItemDefinition("i1"); + vItemDef->setLocalAdvanceLevel(1); + vItemDef = A->addItemDefinition("i2"); + vItemDef->setLocalAdvanceLevel(2); + + attRes->finalizeDefinitions(); + + auto att = attRes->createAttribute("a", "A"); + // Lets set the first item to be ignored + att->item(0)->setIsIgnored(true); +} +} // namespace + +int unitIsRelevant(int /*unused*/, char* /*unused*/[]) +{ + std::cerr << std::boolalpha; // To print out booleans + // + // I. Let's create an attribute resource and some definitions + attribute::ResourcePtr attRes = attribute::Resource::create(); + setupAttributeResource(attRes); + + smtkTest(runTests(attRes, "First Pass - "), "Failed isRelevant Tests in First Pass"); + io::AttributeWriter writer; + io::AttributeReader reader; + io::Logger logger; + std::string writeRroot(SMTK_SCRATCH_DIR); + std::string fname = writeRroot + "/unitIsRelevantTest.sbi"; + std::string rname = writeRroot + "/unitIsRelevantTest.smtk"; + + //Test JSON File I/O + attRes->setLocation(rname); + smtk::attribute::Write::Ptr writeOp = smtk::attribute::Write::create(); + writeOp->parameters()->associate(attRes); + auto opresult = writeOp->operate(); + + smtkTest( + opresult->findInt("outcome")->value() == + static_cast(smtk::operation::Operation::Outcome::SUCCEEDED), + "JSON Write operation failed\n" + << writeOp->log().convertToString()); + attRes = nullptr; + smtk::attribute::Read::Ptr readOp = smtk::attribute::Read::create(); + readOp->parameters()->findFile("filename")->setValue(rname); + opresult = readOp->operate(); + smtkTest( + opresult->findInt("outcome")->value() == + static_cast(smtk::operation::Operation::Outcome::SUCCEEDED), + "JSON Read operation failed\n" + << writeOp->log().convertToString()); + attRes = std::dynamic_pointer_cast( + opresult->findResource("resource")->value()); + //Test the resource created using JSON + smtkTest(runTests(attRes, "JSON Pass - "), "Failed isRelevant Tests in JSON Pass"); + + //Test XML File I/O + writer.write(attRes, fname, logger); + smtkTest( + !logger.hasErrors(), + "Error Generated when XML writing file (" << fname << "):\n" + << logger.convertToString()); + + attRes = attribute::Resource::create(); + reader.read(attRes, fname, logger); + smtkTest( + !logger.hasErrors(), + "Error Generated when XML reading file (" << fname << "):\n" + << logger.convertToString()); + //Test the resource created using XML + smtkTest(runTests(attRes, "XML Pass - "), "Failed isRelevant Tests in XML Pass"); + + return 0; +} diff --git a/smtk/extension/qt/qtAttributeView.cxx b/smtk/extension/qt/qtAttributeView.cxx index de374867b0..d6701a4467 100644 --- a/smtk/extension/qt/qtAttributeView.cxx +++ b/smtk/extension/qt/qtAttributeView.cxx @@ -267,7 +267,7 @@ void qtAttributeView::createWidget() // m_internals->AttDefMap has to be initialized before getAllDefinitions() // since the getAllDefinitions() call needs the categories list in AttDefMap - // Create a map for all catagories so we can cluster the definitions + // Create a map for all categories so we can cluster the definitions m_internals->AttDefMap.clear(); const ResourcePtr attResource = this->uiManager()->attResource(); std::set::const_iterator it; @@ -548,6 +548,20 @@ smtk::attribute::Attribute* qtAttributeView::getRawAttributeFromItem(const QStan return (item ? static_cast(item->data(Qt::UserRole).value()) : nullptr); } +smtk::attribute::Attribute* qtAttributeView::getRawAttributeFromIndex(const QModelIndex& index) +{ + if (!index.isValid()) + { + return nullptr; + } + + QModelIndex attIndex = index.sibling(index.row(), name_column); + smtk::attribute::Attribute* raw = + static_cast(attIndex.data(Qt::UserRole).value()); + + return raw; +} + smtk::attribute::AttributePtr qtAttributeView::getAttributeFromItem(const QStandardItem* item) { smtk::attribute::Attribute* raw = this->getRawAttributeFromItem(item); @@ -561,20 +575,22 @@ smtk::attribute::AttributePtr qtAttributeView::getAttributeFromItem(const QStand smtk::attribute::AttributePtr qtAttributeView::getAttributeFromIndex(const QModelIndex& index) { - if (!index.isValid()) - { - return smtk::attribute::AttributePtr(); - } + smtk::attribute::Attribute* raw = this->getRawAttributeFromIndex(index); + return (raw ? raw->shared_from_this() : smtk::attribute::AttributePtr()); +} - QModelIndex attIndex = index.sibling(index.row(), name_column); - smtk::attribute::Attribute* raw = - static_cast(attIndex.data(Qt::UserRole).value()); - if (raw == nullptr) +QStandardItem* qtAttributeView::getItemFromAttribute(smtk::attribute::Attribute* attribute) +{ + int n = m_internals->ListTableModel->rowCount(); + for (int i = 0; i < n; i++) { - return smtk::attribute::AttributePtr(); + QStandardItem* item = m_internals->ListTableModel->item(i); + if (this->getRawAttributeFromItem(item) == attribute) + { + return item; + } } - - return raw->shared_from_this(); + return nullptr; } // The selected item will always refer to the item that has the attribute data assigned to @@ -941,8 +957,13 @@ QStandardItem* qtAttributeView::addAttributeListItem(smtk::attribute::AttributeP { QStandardItem* item = new QStandardItem(QString::fromUtf8(childData->name().c_str())); Qt::ItemFlags nonEditableFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); - Qt::ItemFlags itemFlags( - nonEditableFlags | (this->attributeNamesConstant() ? 0x0 : Qt::ItemIsEditable)); + + //Can the attribute name be changed? + bool nameIsConstant = this->attributeNamesConstant() || + (childData->properties().contains("smtk.extensions.attribute_view.name_read_only") && + childData->properties().at("smtk.extensions.attribute_view.name_read_only")); + + Qt::ItemFlags itemFlags(nonEditableFlags | (nameIsConstant ? 0x0 : Qt::ItemIsEditable)); QVariant vdata; vdata.setValue(static_cast(childData.get())); item->setData(vdata, Qt::UserRole); @@ -1474,13 +1495,34 @@ int qtAttributeView::handleOperationEvent( // current attribute being displayed smtk::attribute::ComponentItemPtr compItem; std::size_t i, n; - if (m_internals->CurrentAtt != nullptr) + smtk::attribute::DefinitionPtr currentDef = this->getCurrentDef(); + + if (currentDef == nullptr) { - compItem = result->findComponent("modified"); - n = compItem->numberOfValues(); - for (i = 0; i < n; i++) + // There is nothing being displayed so nothing needs to be updated + return 0; + } + + compItem = result->findComponent("modified"); + n = compItem->numberOfValues(); + for (i = 0; i < n; i++) + { + // We need to make sure the attribute's name and name edit-ability are properly set + if (!compItem->isSet(i)) + { + continue; + } + + auto att = dynamic_pointer_cast(compItem->value(i)); + if (att == nullptr) + { + continue; + } + smtk::attribute::DefinitionPtr attDef = att->definition(); + if (attDef->isA(currentDef)) { - if (compItem->isSet(i) && (compItem->value(i) == m_internals->CurrentAtt->attribute())) + // Is this the current attribute being displayed? + if (att == m_internals->CurrentAtt->attribute()) { // Update the attribute's items auto items = m_internals->CurrentAtt->items(); @@ -1488,7 +1530,28 @@ int qtAttributeView::handleOperationEvent( { item->updateItemData(); } - break; // we don't have to keep looking for this ComponentPtr + } + // Need to update the item's name and edit ability + auto* item = this->getItemFromAttribute(att.get()); + if (item) + { + item->setText(QString::fromUtf8(att->name().c_str())); + if (!this->attributeNamesConstant()) + { + // Need to see if the name is editable + if ( + att->properties().contains("smtk.extensions.attribute_view.name_read_only") && + att->properties().at("smtk.extensions.attribute_view.name_read_only")) + { + Qt::ItemFlags itemFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); + item->setFlags(itemFlags); + } + else + { + Qt::ItemFlags itemFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable); + item->setFlags(itemFlags); + } + } } } } @@ -1501,14 +1564,26 @@ int qtAttributeView::handleOperationEvent( { for (i = 0; i < n; i++) { - if (compItem->isSet(i)) + if (!compItem->isSet(i)) + { + continue; + } + + auto att = dynamic_pointer_cast(compItem->value(i)); + if (att == nullptr) + { + continue; + } + smtk::attribute::DefinitionPtr attDef = att->definition(); + // Is this type of attribute being displayed? + if (attDef->isA(currentDef)) { int row, numRows = m_internals->ListTableModel->rowCount(); for (row = 0; row < numRows; ++row) { QStandardItem* item = m_internals->ListTableModel->item(row, name_column); - smtk::attribute::Attribute* att = this->getRawAttributeFromItem(item); - if (compItem->value(i).get() == att) + smtk::attribute::Attribute* itemAtt = this->getRawAttributeFromItem(item); + if (att.get() == itemAtt) { m_internals->ListTableModel->removeRow(row); break; @@ -1518,14 +1593,6 @@ int qtAttributeView::handleOperationEvent( } } - // In the case of created components we need to see if anything would - // cause us to reset the list view - smtk::attribute::DefinitionPtr currentDef = this->getCurrentDef(); - if (currentDef == nullptr) - { - return 0; // nothing to do - } - compItem = result->findComponent("created"); n = compItem->numberOfValues(); for (i = 0; i < n; i++) diff --git a/smtk/extension/qt/qtAttributeView.h b/smtk/extension/qt/qtAttributeView.h index c06581c643..c957c2cb46 100644 --- a/smtk/extension/qt/qtAttributeView.h +++ b/smtk/extension/qt/qtAttributeView.h @@ -123,6 +123,8 @@ protected: smtk::attribute::AttributePtr getAttributeFromItem(const QStandardItem* item); smtk::attribute::AttributePtr getAttributeFromIndex(const QModelIndex& index); smtk::attribute::Attribute* getRawAttributeFromItem(const QStandardItem* item); + smtk::attribute::Attribute* getRawAttributeFromIndex(const QModelIndex& index); + QStandardItem* getItemFromAttribute(smtk::attribute::Attribute* attribute); ///\brief Method used to delete an attribute from its resource virtual bool deleteAttribute(smtk::attribute::AttributePtr att); diff --git a/smtk/extension/qt/qtGroupItem.cxx b/smtk/extension/qt/qtGroupItem.cxx index c6ba7ba352..c18195d1ba 100644 --- a/smtk/extension/qt/qtGroupItem.cxx +++ b/smtk/extension/qt/qtGroupItem.cxx @@ -201,7 +201,9 @@ void qtGroupItem::createWidget() { m_internals->m_titleCheckbox->setVisible(true); m_internals->m_titleCheckbox->setChecked(item->localEnabledState()); - m_internals->m_contentsFrame->setVisible(item->localEnabledState()); + m_internals->m_contentsFrame->setVisible( + item->localEnabledState() && + item->hasRelevantChildren(true, this->uiManager()->advanceLevel())); } else { @@ -211,14 +213,15 @@ void qtGroupItem::createWidget() void qtGroupItem::setEnabledState(int state) { - bool enabled = (state == Qt::Checked); - m_internals->m_contentsFrame->setVisible(enabled); - auto item = m_itemInfo.item(); + auto item = m_itemInfo.itemAs(); if (item == nullptr) { return; } + bool enabled = (state == Qt::Checked); + m_internals->m_contentsFrame->setVisible( + enabled && item->hasRelevantChildren(true, this->uiManager()->advanceLevel())); if (enabled != item->localEnabledState()) { item->setIsEnabled(enabled); diff --git a/smtk/io/XmlDocV4Parser.cxx b/smtk/io/XmlDocV4Parser.cxx index 720e60e578..2dd61b9f39 100644 --- a/smtk/io/XmlDocV4Parser.cxx +++ b/smtk/io/XmlDocV4Parser.cxx @@ -201,6 +201,11 @@ void XmlDocV4Parser::processItem(pugi::xml_node& node, smtk::attribute::ItemPtr { item->setForceRequired(xatt.as_bool()); } + xatt = node.attribute("IsIgnored"); + if (xatt) + { + item->setIsIgnored(xatt.as_bool()); + } } void XmlDocV4Parser::processViews(xml_node& root) diff --git a/smtk/io/XmlV2StringWriter.cxx b/smtk/io/XmlV2StringWriter.cxx index d6d9a1dd88..91b57192d2 100644 --- a/smtk/io/XmlV2StringWriter.cxx +++ b/smtk/io/XmlV2StringWriter.cxx @@ -1154,6 +1154,10 @@ void XmlV2StringWriter::processItemAttributes(xml_node& node, ItemPtr item) { node.append_attribute("AdvanceWriteLevel") = item->localAdvanceLevel(1); } + if (item->isIgnored()) + { + node.append_attribute("IsIgnored").set_value(item->isIgnored()); + } } void XmlV2StringWriter::processItemType(xml_node& node, ItemPtr item) diff --git a/smtk/resource/Properties.h b/smtk/resource/Properties.h index 90c6c876c8..bb61d26937 100644 --- a/smtk/resource/Properties.h +++ b/smtk/resource/Properties.h @@ -412,9 +412,13 @@ class SMTKCORE_EXPORT ResourceProperties : public smtk::resource::Properties /// The default value types for all resources and components are int, double, /// string, and vectors of these types. typedef std::tuple< + Indexed, + Indexed, Indexed, Indexed, Indexed, + Indexed>, + Indexed>, Indexed>, Indexed>, Indexed>> -- GitLab From db07581623423004ed59928d73b2ebbe1e61ead7 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 20 Jul 2021 13:35:37 -0400 Subject: [PATCH 127/136] Turn RTD off epub, pdf(latex) formats. --- .readthedocs.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 561e9075c1..39595f77e0 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,6 +1,7 @@ version: 2 -formats: all +formats: + - htmlzip python: version: 3.7 -- GitLab From 8f0ce28851ca95488f00f9ab0287c7222286b102 Mon Sep 17 00:00:00 2001 From: Robert O'Bara Date: Tue, 20 Jul 2021 17:49:05 -0400 Subject: [PATCH 128/136] BUG: Fixing Regression introduced by !2514 The issue is that GroupItem::hasRelevantChildren was always checking against the set of active categories, but in the case of an Analysis Attribute, we ignore categories all together. The fix was to provide an option to skip the category check in the method. This also required isRelevant to have the same change. Also noticed that isIgnore was not being taken into consideration via the isValid method. Since this test should be done when isEnbaled is being checked I noticed that the isEnabled check was being done in isValidInternal (which meant each Item class was copying the same code fragment) and that it was being done after the category check which is more expensive. This has been refactored to the isValid is doing the isIgnored and isEnabled tests. Also update unitIsRelevant test to include a test for hasRelevantChildren. --- doc/release/notes/isRelevantChanges.rst | 13 ++-- smtk/attribute/Attribute.cxx | 16 +++-- smtk/attribute/Attribute.h | 16 +++-- smtk/attribute/DateTimeItem.cxx | 8 +-- smtk/attribute/FileItemDefinition.cxx | 2 +- smtk/attribute/FileSystemItem.cxx | 7 +- smtk/attribute/GroupItem.cxx | 37 ++++++---- smtk/attribute/GroupItem.h | 12 ++-- smtk/attribute/Item.cxx | 25 +++++-- smtk/attribute/Item.h | 15 ++-- smtk/attribute/ReferenceItem.cxx | 4 -- smtk/attribute/ValueItem.cxx | 8 +-- smtk/attribute/pybind11/PybindAttribute.h | 2 +- smtk/attribute/pybind11/PybindGroupItem.h | 2 +- smtk/attribute/pybind11/PybindItem.h | 2 +- smtk/attribute/testing/cxx/unitIsRelevant.cxx | 70 ++++++++++++++----- smtk/extension/qt/qtGroupItem.cxx | 10 ++- 17 files changed, 153 insertions(+), 96 deletions(-) diff --git a/doc/release/notes/isRelevantChanges.rst b/doc/release/notes/isRelevantChanges.rst index 1f6960f376..b87ba0c87f 100644 --- a/doc/release/notes/isRelevantChanges.rst +++ b/doc/release/notes/isRelevantChanges.rst @@ -20,18 +20,21 @@ Both Attribute::isRelevant and Item::isRelevant have been modified to optional d .. code-block:: c++ - bool isRelevant(bool includeReadAccess = false, int readAccessLevel = 0) const; + bool isRelevant(bool includeCategoryChecks = true, bool includeReadAccess = false, int readAccessLevel = 0) const; -If includeReadAccess is set to true then an Attribute is relevant iff at least one of it's children has a read access level <= readAccessLevel as well as passing the existing category checks. +If includeCategoryChecks is set to true, then the Attribute or Item must pass their category checks based on the +resource's Active Category Settings. -In the case of an Item, if includeReadAccess is true then it must pass both category checks and have it's read access level <= readAccessLevel +If includeReadAccess is set to true then an Attribute is relevant iff at least one of it's children has a read access level <= readAccessLevel. + +In the case of an Item, if includeReadAccess is true then it must have it's read access level <= readAccessLevel Note that this modification does not require any code change in order to preserve previous functionality. Added hasRelevantChildren method to GroupItem ============================================= -GroupItem now has a method to test if at least on of its children items passes their category checks (and optionally their advance level checks). +GroupItem now has a method to test if at least on of its children items passes their category checks and read access checks passed on the caller's requirements. .. code-block:: c++ - bool hasRelevantChildren(bool includeReadAccess = false, int readAccessLevel = 0) const; + bool hasRelevantChildren(bool includeCategoryChecks = true, bool includeReadAccess = false, int readAccessLevel = 0) const; diff --git a/smtk/attribute/Attribute.cxx b/smtk/attribute/Attribute.cxx index a361a60f91..7cfeb8d710 100644 --- a/smtk/attribute/Attribute.cxx +++ b/smtk/attribute/Attribute.cxx @@ -317,14 +317,18 @@ bool Attribute::isValid(const std::set& cats) const return !(m_associatedObjects && !m_associatedObjects->isValid(false)); } -bool Attribute::isRelevant(bool includeReadAccess, int readAccessLevel) const +bool Attribute::isRelevant(bool includeCategoryCheck, bool includeReadAccess, int readAccessLevel) + const { - auto aResource = this->attributeResource(); - if (aResource && aResource->activeCategoriesEnabled()) + if (includeCategoryCheck) { - if (!this->categories().passes(aResource->activeCategories())) + auto aResource = this->attributeResource(); + if (aResource && aResource->activeCategoriesEnabled()) { - return false; + if (!this->categories().passes(aResource->activeCategories())) + { + return false; + } } } if (!includeReadAccess) @@ -334,7 +338,7 @@ bool Attribute::isRelevant(bool includeReadAccess, int readAccessLevel) const // Lets see if at least one of the attribute's items is relevant. if (std::any_of(m_items.begin(), m_items.end(), [=](const ItemPtr& item) { - return item->isRelevant(includeReadAccess, readAccessLevel); + return item->isRelevant(includeCategoryCheck, includeReadAccess, readAccessLevel); })) { return true; diff --git a/smtk/attribute/Attribute.h b/smtk/attribute/Attribute.h index 7a0d397fa9..0542053b2a 100644 --- a/smtk/attribute/Attribute.h +++ b/smtk/attribute/Attribute.h @@ -323,13 +323,15 @@ public: ///\brief Returns true if the attribute is relevant. /// - /// If includeReadAccess is false then if the Resource does not have active categories enabled or - /// if the attribute passes its category check this method will return true; else - /// it will return false - /// - /// If includeReadAccess is true, then a subset of the attribute's items must have their - /// read access <= readAccessLevel in addition to passing the category checks. - bool isRelevant(bool includeReadAccess = false, int readAccessLevel = 0) const; + /// If includeCatagories is true and the attribute does not pass it's category checks with respects + /// to the resource's active category settings then return false, + /// If includeReadAccess is true, and if all of the items in the attribute have their + /// advanceLevel > readAccessLevel then return false. + /// Else return true. + bool isRelevant( + bool includeCategories = true, + bool includeReadAccess = false, + int readAccessLevel = 0) const; smtk::attribute::ResourcePtr attributeResource() const; const smtk::resource::ResourcePtr resource() const override; diff --git a/smtk/attribute/DateTimeItem.cxx b/smtk/attribute/DateTimeItem.cxx index 7e46cb1d0a..bc2cffc56b 100644 --- a/smtk/attribute/DateTimeItem.cxx +++ b/smtk/attribute/DateTimeItem.cxx @@ -45,12 +45,8 @@ bool DateTimeItem::isValidInternal(bool useCategories, const std::setisEnabled()) - { - return true; - } + + // Check to see if all of its values are set for (auto it = m_isSet.begin(); it != m_isSet.end(); ++it) { if (!(*it)) diff --git a/smtk/attribute/FileItemDefinition.cxx b/smtk/attribute/FileItemDefinition.cxx index be269c8793..30bbdf8eae 100644 --- a/smtk/attribute/FileItemDefinition.cxx +++ b/smtk/attribute/FileItemDefinition.cxx @@ -153,7 +153,7 @@ bool FileItemDefinition::isValueValid(const std::string& val) const return false; } - // If file filters are provided, we check if the value has an acceptible + // If file filters are provided, we check if the value has an acceptable // suffix. if (getFileFilters().empty()) { diff --git a/smtk/attribute/FileSystemItem.cxx b/smtk/attribute/FileSystemItem.cxx index 7a7b798778..9d249bd028 100644 --- a/smtk/attribute/FileSystemItem.cxx +++ b/smtk/attribute/FileSystemItem.cxx @@ -72,12 +72,7 @@ bool FileSystemItem::isValidInternal(bool useCategories, const std::setisEnabled()) - { - return true; - } + // Check to see if all of its values are set for (auto it = m_isSet.begin(); it != m_isSet.end(); ++it) { if (!(*it)) diff --git a/smtk/attribute/GroupItem.cxx b/smtk/attribute/GroupItem.cxx index b980cf34a3..3eb7640bcf 100644 --- a/smtk/attribute/GroupItem.cxx +++ b/smtk/attribute/GroupItem.cxx @@ -62,7 +62,7 @@ bool GroupItem::isConditional() const return def->isConditional(); } -bool GroupItem::conditionalsSatisfied() const +bool GroupItem::conditionalsSatisfied(bool useActiveCategories) const { if (!this->isConditional()) { @@ -74,7 +74,7 @@ bool GroupItem::conditionalsSatisfied() const unsigned int numChoices = 0; for (auto it1 = (*it).begin(); it1 != (*it).end(); ++it1) { - if (*it1 && (*it1)->isRelevant() && (*it1)->isEnabled()) + if (*it1 && (*it1)->isRelevant(useActiveCategories) && (*it1)->isEnabled()) { numChoices++; } @@ -91,17 +91,14 @@ bool GroupItem::conditionalsSatisfied() const bool GroupItem::isValidInternal(bool useCategories, const std::set& categories) const { - // First lets see if the group itself would be filtered out based on the categories + // Lets see if the group itself would be filtered out based on the categories if (useCategories && !this->categories().passes(categories)) { return true; } - // If the item is not enabled or if all of its values are set then it is valid - // else it is enabled and contains unset values making it invalid - if (!this->isEnabled()) - { - return true; - } + + // Finally, if all of its values are set then it is valid + // else it is invalid unsigned int numChoices = 0; for (auto it = m_items.begin(); it != m_items.end(); ++it) { @@ -130,8 +127,20 @@ bool GroupItem::isValidInternal(bool useCategories, const std::set& } } } + + // Ideally we could just call GroupItem::conditionalsSatisfied but that method + // assumes we are testing against active categories, while this method is passed + // in the set of categories to be checked. So we do our own check. + if ( + this->isConditional() && + ((numChoices < m_minNumberOfChoices) || + ((m_maxNumberOfChoices != 0) && (numChoices > m_maxNumberOfChoices)))) + { + return false; + } } - return this->conditionalsSatisfied(); + + return true; } bool GroupItem::setDefinition(smtk::attribute::ConstItemDefinitionPtr gdef) @@ -500,13 +509,17 @@ bool GroupItem::assign(ConstItemPtr& sourceItem, unsigned int options) return Item::assign(sourceItem, options); } -bool GroupItem::hasRelevantChildren(bool includeReadAccess, int readAccessLevel) const +bool GroupItem::hasRelevantChildren( + bool includeCategories, + bool includeReadAccess, + int readAccessLevel) const { for (size_t elementIndex = 0; elementIndex < this->numberOfGroups(); elementIndex++) { for (size_t valueIndex = 0; valueIndex < this->numberOfItemsPerGroup(); valueIndex++) { - if (this->item(elementIndex, valueIndex)->isRelevant(includeReadAccess, readAccessLevel)) + if (this->item(elementIndex, valueIndex) + ->isRelevant(includeCategories, includeReadAccess, readAccessLevel)) { return true; } diff --git a/smtk/attribute/GroupItem.h b/smtk/attribute/GroupItem.h index 1bd972e2df..d2be10b888 100644 --- a/smtk/attribute/GroupItem.h +++ b/smtk/attribute/GroupItem.h @@ -135,9 +135,10 @@ public: /// \brief Returns true if the GroupItem satisfies its conditional requirements. /// /// Requirements are met if the item is not conditional, or if it have the appropriate - /// number of enabled items that are relevant w/r to the resource's active set of - /// categories - bool conditionalsSatisfied() const; + /// number of enabled items that are relevant. If useActiveCategories is true, then + /// category checking using the resource's active + /// categories is performed, else no category checking is done. + bool conditionalsSatisfied(bool useActiveCategories = true) const; ///@{ /// \brief Returns or sets the minimum number of choices that must be set for the @@ -169,7 +170,10 @@ public: bool assign(smtk::attribute::ConstItemPtr& sourceItem, unsigned int options = 0) override; ///\brief Returns true if the group item has relevant children. - bool hasRelevantChildren(bool includeReadAccess = false, int readAccessLevel = 0) const; + bool hasRelevantChildren( + bool includeCategories = true, + bool includeReadAccess = false, + int readAccessLevel = 0) const; protected: GroupItem(Attribute* owningAttribute, int itemPosition); diff --git a/smtk/attribute/Item.cxx b/smtk/attribute/Item.cxx index 6e517f070a..f690a35cd1 100644 --- a/smtk/attribute/Item.cxx +++ b/smtk/attribute/Item.cxx @@ -62,6 +62,13 @@ AttributePtr Item::attribute() const bool Item::isValid(bool useActiveCategories) const { + // If the item is not enabled, or marked to be ignored, then return true since the item + // is not going to have an effect + if ((!this->isEnabled()) || this->isIgnored()) + { + return true; + } + // If the resource has active categories enabled, use them if (useActiveCategories) { @@ -80,22 +87,26 @@ bool Item::isValid(bool useActiveCategories) const return this->isValidInternal(false, cats); } -bool Item::isRelevant(bool includeReadAccess, unsigned int readAccessLevel) const +bool Item::isRelevant(bool includeCategories, bool includeReadAccess, unsigned int readAccessLevel) + const { if (m_isIgnored) { return false; // Item has been marked to be ignored } - auto myAttribute = this->attribute(); - if (myAttribute) + if (includeCategories) { - auto aResource = myAttribute->attributeResource(); - if (aResource && aResource->activeCategoriesEnabled()) + auto myAttribute = this->attribute(); + if (myAttribute) { - if (!this->categories().passes(aResource->activeCategories())) + auto aResource = myAttribute->attributeResource(); + if (aResource && aResource->activeCategoriesEnabled()) { - return false; + if (!this->categories().passes(aResource->activeCategories())) + { + return false; + } } } } diff --git a/smtk/attribute/Item.h b/smtk/attribute/Item.h index 05e1ba123b..4b9c749852 100644 --- a/smtk/attribute/Item.h +++ b/smtk/attribute/Item.h @@ -98,13 +98,14 @@ public: ///\brief Returns true if the item is relevant. /// - /// If includeReadAccess is false then if the Resource does not have active categories enabled or - /// if the item passes its category check this method will return true; else - /// it will return false. - /// - /// If includeReadAccess is true, then the item's - /// advanceLevel must also be <= readAccessLevel in addition to passing the category checks in order to pass. - virtual bool isRelevant(bool includeReadAccess = false, unsigned int readAccessLevel = 0) const; + /// If the item is marked ignored then return false. + /// If includeCatagories is true and the item does not pass it's category checks, then return false, + /// If includeReadAccess is true, and the item's advanceLevel is > readAccessLevel then return false. + /// Else return true. + virtual bool isRelevant( + bool includeCatagories = true, + bool includeReadAccess = false, + unsigned int readAccessLevel = 0) const; /// @{ /// \brief return a child item that matches name and satisfies the SearchStyle diff --git a/smtk/attribute/ReferenceItem.cxx b/smtk/attribute/ReferenceItem.cxx index c080179c3e..e57d803202 100644 --- a/smtk/attribute/ReferenceItem.cxx +++ b/smtk/attribute/ReferenceItem.cxx @@ -273,10 +273,6 @@ bool ReferenceItem::isValidInternal(bool useCategories, const std::setisEnabled()) - { - return true; - } // Do we have at least the number of required values present? if (this->numberOfValues() < this->numberOfRequiredValues()) { diff --git a/smtk/attribute/ValueItem.cxx b/smtk/attribute/ValueItem.cxx index 7c1644ad3d..c7d44d16c8 100644 --- a/smtk/attribute/ValueItem.cxx +++ b/smtk/attribute/ValueItem.cxx @@ -123,13 +123,6 @@ bool ValueItem::isValidInternal(bool useCategories, const std::set& return true; } - // If the item is not enabled or if all of its values are set then it is valid - // else it is enabled and contains unset values making it invalid - if (!this->isEnabled()) - { - return true; - } - // Are we using an expression? Note that if we have an expression we // are not discrete and don't have children if (this->allowsExpressions() && (m_expression->value() != nullptr)) @@ -157,6 +150,7 @@ bool ValueItem::isValidInternal(bool useCategories, const std::set& return true; } + // Let check to make sure all of the values are set for (std::size_t i = 0; i < m_isSet.size(); ++i) { if (!m_isSet[i]) diff --git a/smtk/attribute/pybind11/PybindAttribute.h b/smtk/attribute/pybind11/PybindAttribute.h index 08cf82e292..08bafa23e8 100644 --- a/smtk/attribute/pybind11/PybindAttribute.h +++ b/smtk/attribute/pybind11/PybindAttribute.h @@ -97,7 +97,7 @@ inline PySharedPtrClass< smtk::attribute::Attribute > pybind11_init_smtk_attribu .def("isObjectAssociated", (bool (smtk::attribute::Attribute::*)(::smtk::resource::PersistentObjectPtr const &) const) &smtk::attribute::Attribute::isObjectAssociated, py::arg("componentPtr")) .def("isEntityAssociated", (bool (smtk::attribute::Attribute::*)(::smtk::common::UUID const &) const) &smtk::attribute::Attribute::isEntityAssociated, py::arg("entity")) .def("isEntityAssociated", (bool (smtk::attribute::Attribute::*)(::smtk::model::EntityRef const &) const) &smtk::attribute::Attribute::isEntityAssociated, py::arg("entityref")) - .def("isRelevant", &smtk::attribute::Attribute::isRelevant, py::arg("includeReadAccess"), py::arg("readAccessLevel")) + .def("isRelevant", &smtk::attribute::Attribute::isRelevant, py::arg("includeCategoryCheck") = true, py::arg("includeReadAccess") = false, py::arg("readAccessLevel") = 0) .def("isValid", (bool (smtk::attribute::Attribute::*)(bool) const) &smtk::attribute::Attribute::isValid, py::arg("useActiveCategories") = true) .def("isValid", (bool (smtk::attribute::Attribute::*)(std::set const &) const) &smtk::attribute::Attribute::isValid, py::arg("categories")) .def("items", &smtk::attribute::Attribute::items) diff --git a/smtk/attribute/pybind11/PybindGroupItem.h b/smtk/attribute/pybind11/PybindGroupItem.h index 1f1f9528d1..19ba012450 100644 --- a/smtk/attribute/pybind11/PybindGroupItem.h +++ b/smtk/attribute/pybind11/PybindGroupItem.h @@ -28,7 +28,7 @@ inline PySharedPtrClass< smtk::attribute::GroupItem, smtk::attribute::Item > pyb .def("appendGroup", &smtk::attribute::GroupItem::appendGroup) .def("assign", &smtk::attribute::GroupItem::assign, py::arg("sourceItem"), py::arg("options") = 0) .def("begin", &smtk::attribute::GroupItem::begin) - .def("conditionalsSatisfied", &smtk::attribute::GroupItem::conditionalsSatisfied) + .def("conditionalsSatisfied", &smtk::attribute::GroupItem::conditionalsSatisfied, py::arg("useActiveCategories") = true) .def("end", &smtk::attribute::GroupItem::end) .def("_find", (smtk::attribute::ItemPtr (smtk::attribute::GroupItem::*)(::std::string const &, ::smtk::attribute::SearchStyle)) &smtk::attribute::GroupItem::find, py::arg("name"), py::arg("style") = ::smtk::attribute::SearchStyle::IMMEDIATE) .def("_find", (smtk::attribute::ItemPtr (smtk::attribute::GroupItem::*)(::size_t, ::std::string const &, ::smtk::attribute::SearchStyle)) &smtk::attribute::GroupItem::find, py::arg("element"), py::arg("name"), py::arg("style") = ::smtk::attribute::SearchStyle::IMMEDIATE) diff --git a/smtk/attribute/pybind11/PybindItem.h b/smtk/attribute/pybind11/PybindItem.h index 8f22e845d6..0913273a41 100644 --- a/smtk/attribute/pybind11/PybindItem.h +++ b/smtk/attribute/pybind11/PybindItem.h @@ -30,7 +30,7 @@ inline PySharedPtrClass< smtk::attribute::Item > pybind11_init_smtk_attribute_It .def("name", &smtk::attribute::Item::name) .def("label", &smtk::attribute::Item::label) .def("type", &smtk::attribute::Item::type) - .def("isRelevant", &smtk::attribute::Item::isRelevant, py::arg("includeReadAccess"), py::arg("readAccessLevel")) + .def("isRelevant", &smtk::attribute::Item::isRelevant, py::arg("includeCategoryChecking") = true, py::arg("includeReadAccess") = true, py::arg("readAccessLevel") = 0) .def("isValid", (bool (smtk::attribute::Item::*)(bool) const) &smtk::attribute::Item::isValid, py::arg("useActiveCategories") = true) .def("isValid", (bool (smtk::attribute::Item::*)(std::set const &) const) &smtk::attribute::Item::isValid, py::arg("categories")) .def("definition", &smtk::attribute::Item::definition) diff --git a/smtk/attribute/testing/cxx/unitIsRelevant.cxx b/smtk/attribute/testing/cxx/unitIsRelevant.cxx index 7a1d2d874d..bc59abb943 100644 --- a/smtk/attribute/testing/cxx/unitIsRelevant.cxx +++ b/smtk/attribute/testing/cxx/unitIsRelevant.cxx @@ -9,6 +9,7 @@ //========================================================================= #include "smtk/attribute/Definition.h" #include "smtk/attribute/FileItem.h" +#include "smtk/attribute/GroupItem.h" #include "smtk/attribute/GroupItemDefinition.h" #include "smtk/attribute/IntItem.h" #include "smtk/attribute/ReferenceItem.h" @@ -32,10 +33,12 @@ namespace { bool testAttriubuteResource( const attribute::ResourcePtr& attRes, + bool checkCategories, bool checkAdvanceLevel, unsigned int readAccessLevel, bool attRelevance, - std::vector itemRelevances) + std::vector itemRelevances, + bool hasRelevantChildrenAnswer) { bool result = true; const attribute::AttributePtr& att = attRes->findAttribute("a"); @@ -44,7 +47,7 @@ bool testAttriubuteResource( std::cerr << "Could not find attribute a\n"; return false; } - if (att->isRelevant(checkAdvanceLevel, readAccessLevel) != attRelevance) + if (att->isRelevant(checkCategories, checkAdvanceLevel, readAccessLevel) != attRelevance) { std::cerr << "\t Attribute: " << att->name() << " had incorrect relevance! Should have been " << attRelevance << std::endl; @@ -53,12 +56,25 @@ bool testAttriubuteResource( int n = (int)itemRelevances.size(); for (int i = 0; i < n; i++) { - if (att->item(i)->isRelevant(checkAdvanceLevel, readAccessLevel) != itemRelevances[i]) + if ( + att->item(i)->isRelevant(checkCategories, checkAdvanceLevel, readAccessLevel) != + itemRelevances[i]) { std::cerr << "\t Attribute: " << att->name() << "'s Item: " << att->item(i)->name() << " had incorrect relevance! Should have been " << itemRelevances[i] << std::endl; result = false; } + auto groupItem = std::dynamic_pointer_cast(att->item(i)); + if ( + groupItem && + (groupItem->hasRelevantChildren(checkCategories, checkAdvanceLevel, readAccessLevel) != + hasRelevantChildrenAnswer)) + { + std::cerr << "\t Attribute: " << att->name() << "'s Item: " << att->item(i)->name() + << " had incorrect hasRelevantChildren response! Should have been " + << hasRelevantChildrenAnswer << std::endl; + result = false; + } } return result; } @@ -73,9 +89,9 @@ bool runTests(const attribute::ResourcePtr& attRes, const std::string& prefix) attRes->setActiveCategories(cats); attRes->setActiveCategoriesEnabled(true); // in this case the attribute should be relevant and all but the first item - // which is set to be ignored - std::vector test1 = { false, true, true }; - if (testAttriubuteResource(attRes, false, 0, true, test1)) + // which is set to be ignored and the groupItem which has no categories (hence it has no relevant children) + std::vector test1 = { false, true, true, false }; + if (testAttriubuteResource(attRes, true, false, 0, true, test1, false)) { std::cerr << prefix << " Test 1 - Passed\n"; } @@ -85,10 +101,10 @@ bool runTests(const attribute::ResourcePtr& attRes, const std::string& prefix) result = false; } // Second - same thing but with advance level testing on and access = 0 - // In this case everyone should fail since the only access level 0 item - // is set to be ignored - std::vector test2 = { false, false, false }; - if (testAttriubuteResource(attRes, true, 0, false, test2)) + // In this case everyone should fail since the only access level 0 items are the + // item is set to be ignored and the groupItem which has no categories + std::vector test2 = { false, false, false, false }; + if (testAttriubuteResource(attRes, true, true, 0, false, test2, false)) { std::cerr << prefix << " Test 2 - Passed\n"; } @@ -99,8 +115,8 @@ bool runTests(const attribute::ResourcePtr& attRes, const std::string& prefix) } // Third - same thing but with advance level testing on and access = 1 // In this case the attribute and second item should pass - std::vector test3 = { false, true, false }; - if (testAttriubuteResource(attRes, true, 1, true, test3)) + std::vector test3 = { false, true, false, false }; + if (testAttriubuteResource(attRes, true, true, 1, true, test3, false)) { std::cerr << prefix << " Test 3 - Passed\n"; } @@ -111,8 +127,8 @@ bool runTests(const attribute::ResourcePtr& attRes, const std::string& prefix) } // Fourth - same thing but with advance level testing on and access = 2 // In this case the attribute and second and third items should pass - std::vector test4 = { false, true, true }; - if (testAttriubuteResource(attRes, true, 2, true, test4)) + std::vector test4 = { false, true, true, false }; + if (testAttriubuteResource(attRes, true, true, 2, true, test4, false)) { std::cerr << prefix << " Test 4 - Passed\n"; } @@ -125,8 +141,8 @@ bool runTests(const attribute::ResourcePtr& attRes, const std::string& prefix) cats.clear(); cats.insert("B"); attRes->setActiveCategories(cats); - std::vector test5 = { false, false, false }; - if (testAttriubuteResource(attRes, false, 0, false, test5)) + std::vector test5 = { false, false, false, false }; + if (testAttriubuteResource(attRes, true, false, 0, false, test5, false)) { std::cerr << prefix << " Test 5 - Passed\n"; } @@ -135,6 +151,20 @@ bool runTests(const attribute::ResourcePtr& attRes, const std::string& prefix) std::cerr << prefix << " Test 5 - Failed\n"; result = false; } + + // Finally lets turn off category filtering and test with advance level = 0 + // In this case only the groupItem should pass and it should have relevant children + std::vector test6 = { false, false, false, true }; + if (testAttriubuteResource(attRes, false, true, 0, true, test6, true)) + { + std::cerr << prefix << " Test 6 - Passed\n"; + } + else + { + std::cerr << prefix << " Test 6 - Failed\n"; + result = false; + } + return result; } void setupAttributeResource(attribute::ResourcePtr& attRes) @@ -142,12 +172,16 @@ void setupAttributeResource(attribute::ResourcePtr& attRes) DefinitionPtr A = attRes->createDefinition("A"); A->localCategories().insertInclusion("A"); // Lets create 3 items of read access levels 0, 1, 2 respectively - VoidItemDefinitionPtr vItemDef = A->addItemDefinition("i0"); + // and a group item that has no categories + auto vItemDef = A->addItemDefinition("i0"); vItemDef = A->addItemDefinition("i1"); vItemDef->setLocalAdvanceLevel(1); vItemDef = A->addItemDefinition("i2"); vItemDef->setLocalAdvanceLevel(2); - + auto gItemDef = A->addItemDefinition("g3"); + // let make sure this group has no categories + gItemDef->setIsOkToInherit(false); + vItemDef = gItemDef->addItemDefinition("g0i0"); attRes->finalizeDefinitions(); auto att = attRes->createAttribute("a", "A"); diff --git a/smtk/extension/qt/qtGroupItem.cxx b/smtk/extension/qt/qtGroupItem.cxx index c18195d1ba..c0854c2f17 100644 --- a/smtk/extension/qt/qtGroupItem.cxx +++ b/smtk/extension/qt/qtGroupItem.cxx @@ -201,9 +201,11 @@ void qtGroupItem::createWidget() { m_internals->m_titleCheckbox->setVisible(true); m_internals->m_titleCheckbox->setChecked(item->localEnabledState()); + auto* iview = m_itemInfo.baseView(); + bool enforceCategories = (iview) ? (!iview->ignoreCategories()) : true; m_internals->m_contentsFrame->setVisible( item->localEnabledState() && - item->hasRelevantChildren(true, this->uiManager()->advanceLevel())); + item->hasRelevantChildren(enforceCategories, true, this->uiManager()->advanceLevel())); } else { @@ -219,14 +221,16 @@ void qtGroupItem::setEnabledState(int state) return; } + auto* iview = m_itemInfo.baseView(); bool enabled = (state == Qt::Checked); + bool enforceCategories = (iview) ? (!iview->ignoreCategories()) : true; m_internals->m_contentsFrame->setVisible( - enabled && item->hasRelevantChildren(true, this->uiManager()->advanceLevel())); + enabled && + item->hasRelevantChildren(enforceCategories, true, this->uiManager()->advanceLevel())); if (enabled != item->localEnabledState()) { item->setIsEnabled(enabled); emit this->modified(); - auto* iview = m_itemInfo.baseView(); if (iview) { iview->valueChanged(item); -- GitLab From e95511ab2860470374ecb0f0af962b8ffbebb3df Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 22 Jul 2021 19:11:38 -0400 Subject: [PATCH 129/136] CDash: disable submission to the private CDash for now It isn't used for anything right now, so avoid causing failing dashboards while there's a misconfiguration. --- CTestConfig.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CTestConfig.cmake b/CTestConfig.cmake index f44a82eda3..1dcdb9b5fd 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -7,7 +7,8 @@ set(CTEST_PROJECT_NAME "SuperBuild-ConceptualModelBuilder") set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") -set(drop_sites kitware) +#set(drop_sites kitware) +set(drop_sites) set(CTEST_DROP_METHOD_kitware "https") set(CTEST_DROP_SITE_kitware "www.kitware.com/CDash") -- GitLab From fe19f720825435e39887f043e48193debf352287 Mon Sep 17 00:00:00 2001 From: John Tourtellott Date: Thu, 22 Jul 2021 23:32:18 -0400 Subject: [PATCH 130/136] Update Item::isValid() w/categories to check enabled & ignored states --- smtk/attribute/Item.h | 2 +- smtk/attribute/testing/cxx/CMakeLists.txt | 1 + smtk/attribute/testing/cxx/unitIsValid.cxx | 101 +++++++++++++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 smtk/attribute/testing/cxx/unitIsValid.cxx diff --git a/smtk/attribute/Item.h b/smtk/attribute/Item.h index 4b9c749852..007886fce3 100644 --- a/smtk/attribute/Item.h +++ b/smtk/attribute/Item.h @@ -92,7 +92,7 @@ public: bool isValid(bool useActiveCategories = true) const; bool isValid(const std::set& categories) const { - return this->isValidInternal(true, categories); + return (!this->isEnabled()) || this->isIgnored() || this->isValidInternal(true, categories); } /// @} diff --git a/smtk/attribute/testing/cxx/CMakeLists.txt b/smtk/attribute/testing/cxx/CMakeLists.txt index b25842714b..800643329a 100644 --- a/smtk/attribute/testing/cxx/CMakeLists.txt +++ b/smtk/attribute/testing/cxx/CMakeLists.txt @@ -95,6 +95,7 @@ set(unit_tests unitExclusionCategories.cxx unitInfixExpressionEvaluator.cxx unitIsRelevant.cxx + unitIsValid.cxx unitJsonItemDefinitions.cxx unitOptionalItems.cxx unitPassCategories.cxx diff --git a/smtk/attribute/testing/cxx/unitIsValid.cxx b/smtk/attribute/testing/cxx/unitIsValid.cxx new file mode 100644 index 0000000000..96294ff193 --- /dev/null +++ b/smtk/attribute/testing/cxx/unitIsValid.cxx @@ -0,0 +1,101 @@ +//========================================================================= +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +//========================================================================= +#include "smtk/attribute/Definition.h" +#include "smtk/attribute/GroupItem.h" +#include "smtk/attribute/Resource.h" +#include "smtk/attribute/StringItem.h" +#include "smtk/io/AttributeReader.h" +#include "smtk/io/Logger.h" + +#include "smtk/common/testing/cxx/helpers.h" + +#include +#include + +const std::string attTemplate = + "\n" + " \n" + " Flow\n" + " \n" + " \n" + " \n" + " \n" + " Flow\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " " + " \n" + "\n"; + +/* This test verifies that Attribute::isValid() accounts for categories, + * enabled state, and ignored state of items. + */ + +int unitIsValid(int /*unused*/, char* /*unused*/[]) +{ + auto attResource = smtk::attribute::Resource::create(); + smtk::io::AttributeReader reader; + auto logger = smtk::io::Logger::instance(); + bool err = reader.readContents(attResource, attTemplate, logger); + smtkTest(!err, "Error reading template."); + + auto att = attResource->findAttribute("Test1"); + smtkTest(att != nullptr, "Test1 attribute not found"); + auto sitem = att->findString("String Item"); + smtkTest(sitem != nullptr, "String Item not found"); + + // Test with no categories + sitem->setIsEnabled(false); + smtkTest(att->isValid(), "No-categories Test1 should be valid when string item disabled."); + + sitem->setIsEnabled(true); + smtkTest(!att->isValid(), "No-categories Test1 should be invalid when string item enabled."); + + sitem->setIsIgnored(true); + smtkTest(att->isValid(), "No-categories Test1 should be valid when string item ignored."); + sitem->setIsIgnored(false); + + // Test with categories passed in + std::set categories = { "Flow" }; + + sitem->setIsEnabled(false); + smtkTest( + att->isValid(categories), "With-categories Test1 should be valid when string item disabled."); + + sitem->setIsEnabled(true); + smtkTest( + !att->isValid(categories), "With-categories Test1 should be invalid when string item enabled."); + + sitem->setIsIgnored(true); + smtkTest( + att->isValid(categories), "With-categories Test1 should be valid when string item ignored."); + sitem->setIsIgnored(false); + + // Test with categories set on resource + attResource->setActiveCategoriesEnabled(true); + attResource->setActiveCategories(categories); + + sitem->setIsEnabled(false); + smtkTest(att->isValid(), "Active-categories Test1 should be valid when string item disabled."); + + sitem->setIsEnabled(true); + smtkTest(!att->isValid(), "Active-categories Test1 should be invalid when string item enabled."); + + sitem->setIsIgnored(true); + smtkTest(att->isValid(), "Active-categories Test1 should be valid when string item ignored."); + sitem->setIsIgnored(false); + + return 0; +} -- GitLab From 164a349c3e6ffa5393a61210441323cc5a656506 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 23 Jul 2021 16:55:35 -0400 Subject: [PATCH 131/136] Deprecation: remove extra parentheses from the reason These end up breaking MSVC because it ends up seeing `__declspec(deprecated(("reason")))` which is not supported. --- smtk/common/Deprecation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smtk/common/Deprecation.h b/smtk/common/Deprecation.h index 210336fe07..36f0a1091e 100644 --- a/smtk/common/Deprecation.h +++ b/smtk/common/Deprecation.h @@ -54,7 +54,7 @@ #endif #define SMTK_DEPRECATION_REASON(version_major, version_minor, reason) \ - ("SMTK Deprecated in " #version_major "." #version_minor ": " #reason) + "SMTK Deprecated in " #version_major "." #version_minor ": " #reason #if SMTK_DEPRECATION_LEVEL >= SMTK_VERSION_CHECK(21, 7) #define SMTK_DEPRECATED_IN_21_07(reason) SMTK_DEPRECATION(SMTK_DEPRECATION_REASON(21, 7, reason)) -- GitLab From 0b3b228ff74519a47f5388b0cf64748609f20a64 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 23 Jul 2021 17:48:22 -0400 Subject: [PATCH 132/136] Deprecation: show `21.07` rather than `21.7` in warnings --- smtk/common/Deprecation.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/smtk/common/Deprecation.h b/smtk/common/Deprecation.h index 36f0a1091e..9911f88284 100644 --- a/smtk/common/Deprecation.h +++ b/smtk/common/Deprecation.h @@ -56,8 +56,8 @@ #define SMTK_DEPRECATION_REASON(version_major, version_minor, reason) \ "SMTK Deprecated in " #version_major "." #version_minor ": " #reason -#if SMTK_DEPRECATION_LEVEL >= SMTK_VERSION_CHECK(21, 7) -#define SMTK_DEPRECATED_IN_21_07(reason) SMTK_DEPRECATION(SMTK_DEPRECATION_REASON(21, 7, reason)) +#if SMTK_DEPRECATION_LEVEL >= SMTK_VERSION_CHECK(21, 07) +#define SMTK_DEPRECATED_IN_21_07(reason) SMTK_DEPRECATION(SMTK_DEPRECATION_REASON(21, 07, reason)) #else #define SMTK_DEPRECATED_IN_21_07(reason) #endif -- GitLab From 58772a63b888f7a1e8ec8fda5698890c414b21b8 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 23 Jul 2021 18:27:12 -0400 Subject: [PATCH 133/136] PybindProject: ignore deprecation warnings It's known and the methods should still be exposed. --- smtk/project/pybind11/PybindProject.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/smtk/project/pybind11/PybindProject.cxx b/smtk/project/pybind11/PybindProject.cxx index d8f79b602c..47c577ee1c 100644 --- a/smtk/project/pybind11/PybindProject.cxx +++ b/smtk/project/pybind11/PybindProject.cxx @@ -8,6 +8,8 @@ // PURPOSE. See the above copyright notice for more information. //========================================================================= +#define SMTK_DEPRECATION_LEVEL 0 + #include "smtk/common/CompilerInformation.h" SMTK_THIRDPARTY_PRE_INCLUDE -- GitLab From c11432974c1d68afa9e7e12437ff3d671fb115d9 Mon Sep 17 00:00:00 2001 From: Robert O'Bara Date: Tue, 20 Jul 2021 12:58:40 -0400 Subject: [PATCH 134/136] DOC: Adding Release Notes for 21.07 Also updated the example release note format and made sure that 21-05 was following it --- doc/release/notes/00-example.rst | 6 +- .../notes/cache-attribute-resource-views.rst | 13 - doc/release/notes/changesToQtGroupItem.rst | 3 - doc/release/notes/cmake-policy.rst | 6 - doc/release/notes/common-visit.rst | 12 - .../notes/expandingDefaultProperties.rst | 3 - .../filter-advance-attribute-definitions.rst | 7 - .../notes/fix_isValidAssociationCheck.rst | 11 - .../notes/hide-disabled-attr-rsrcs.rst | 9 - doc/release/notes/importppg-operation.rst | 16 -- doc/release/notes/isRelevantChanges.rst | 40 --- .../notes/manager-registry-tracking.rst | 9 - doc/release/notes/model-transcription.rst | 16 -- doc/release/notes/project-unique-roles.rst | 11 - doc/release/notes/python2-deprecation.rst | 5 - .../notes/qtBaseAttributeViewSignalChange.rst | 7 - doc/release/notes/readOnlyAttributeNames.rst | 7 - .../notes/referenceItemAppendBehavior.rst | 5 - doc/release/notes/removedMethods.rst | 18 -- doc/release/notes/task-system.rst | 7 - doc/release/smtk-21.05.rst | 21 +- doc/release/smtk-21.07.rst | 256 ++++++++++++++++++ 22 files changed, 273 insertions(+), 215 deletions(-) delete mode 100644 doc/release/notes/cache-attribute-resource-views.rst delete mode 100644 doc/release/notes/changesToQtGroupItem.rst delete mode 100644 doc/release/notes/cmake-policy.rst delete mode 100644 doc/release/notes/common-visit.rst delete mode 100644 doc/release/notes/expandingDefaultProperties.rst delete mode 100644 doc/release/notes/filter-advance-attribute-definitions.rst delete mode 100644 doc/release/notes/fix_isValidAssociationCheck.rst delete mode 100644 doc/release/notes/hide-disabled-attr-rsrcs.rst delete mode 100644 doc/release/notes/importppg-operation.rst delete mode 100644 doc/release/notes/isRelevantChanges.rst delete mode 100644 doc/release/notes/manager-registry-tracking.rst delete mode 100644 doc/release/notes/model-transcription.rst delete mode 100644 doc/release/notes/project-unique-roles.rst delete mode 100644 doc/release/notes/python2-deprecation.rst delete mode 100644 doc/release/notes/qtBaseAttributeViewSignalChange.rst delete mode 100644 doc/release/notes/readOnlyAttributeNames.rst delete mode 100644 doc/release/notes/referenceItemAppendBehavior.rst delete mode 100644 doc/release/notes/removedMethods.rst delete mode 100644 doc/release/notes/task-system.rst create mode 100644 doc/release/smtk-21.07.rst diff --git a/doc/release/notes/00-example.rst b/doc/release/notes/00-example.rst index f5a0602c61..2266da755f 100644 --- a/doc/release/notes/00-example.rst +++ b/doc/release/notes/00-example.rst @@ -1,12 +1,12 @@ Example merge request note -========================== +-------------------------- Summarize the changes your merge request makes that are of interest to other developers. If your change will also affect users of SMTK-based applications, please consider splitting the note into two sections like so: Developer changes ------------------ +~~~~~~~~~~~~~~~~~~ Describe how your changes impact future developers. Remember this is for the release notes; @@ -18,7 +18,7 @@ it is not meant to describe internal changes but rather * changes to the build, test, installation, or packaging system. User-facing changes -------------------- +~~~~~~~~~~~~~~~~~~~ Describe changes to new and existing users of SMTK applications here. Do not assume users know obscure terminology or are already familiar with SMTK. diff --git a/doc/release/notes/cache-attribute-resource-views.rst b/doc/release/notes/cache-attribute-resource-views.rst deleted file mode 100644 index 6d1210b050..0000000000 --- a/doc/release/notes/cache-attribute-resource-views.rst +++ /dev/null @@ -1,13 +0,0 @@ -Preserve State Information -========================== - -SMTK will now preserve state information that pertains to -Attribute Resource views. The information persists even -after the resource has been closed, assuming the resource -was saved before it was closed. - -Information Preserved: - -- The active advance level. -- The active attributes in attribute views. -- The active tab in a group views. diff --git a/doc/release/notes/changesToQtGroupItem.rst b/doc/release/notes/changesToQtGroupItem.rst deleted file mode 100644 index e726d3f1b4..0000000000 --- a/doc/release/notes/changesToQtGroupItem.rst +++ /dev/null @@ -1,3 +0,0 @@ -Removing Empty Frames in qtGroupItem -==================================== -Using GroupItem's hasRelevantChildren method, qtGroupItem will now hide it's frame if there are no children to be displayed. diff --git a/doc/release/notes/cmake-policy.rst b/doc/release/notes/cmake-policy.rst deleted file mode 100644 index 35bc86f77a..0000000000 --- a/doc/release/notes/cmake-policy.rst +++ /dev/null @@ -1,6 +0,0 @@ -CMake Policies -============== - -Because of CMake policy CMP0115 (source file extensions must be explicit), -when passing test names to the ``smtk_add_test`` macro, be sure to include -the filename extension (such as ``.cxx``). diff --git a/doc/release/notes/common-visit.rst b/doc/release/notes/common-visit.rst deleted file mode 100644 index 4ae7cacb6d..0000000000 --- a/doc/release/notes/common-visit.rst +++ /dev/null @@ -1,12 +0,0 @@ -Visitors -======== - -SMTK now provides an enumeration, ``smtk::common::Visit``, that visitor lambdas -may return to indicate whether visitation should continue (``smtk::common::Visit::Continue``) -or stop (``smtk::common::Visit::Halt``). -This enum is much easier to use than simply returning a ``bool`` as developers -frequently have trouble remembering which value (true or false) corresponds to -which iteration behaviour. - -This is currently only used by ``smtk::task::Task::visit()``, but will be -used more widely in the future. diff --git a/doc/release/notes/expandingDefaultProperties.rst b/doc/release/notes/expandingDefaultProperties.rst deleted file mode 100644 index 28f1ef598c..0000000000 --- a/doc/release/notes/expandingDefaultProperties.rst +++ /dev/null @@ -1,3 +0,0 @@ -Expanding Default Property Types on SMTK Resources/Components -============================================================= -The default set of Properties now include int, bool, std::vector and std::vector. diff --git a/doc/release/notes/filter-advance-attribute-definitions.rst b/doc/release/notes/filter-advance-attribute-definitions.rst deleted file mode 100644 index 7f7fe5c777..0000000000 --- a/doc/release/notes/filter-advance-attribute-definitions.rst +++ /dev/null @@ -1,7 +0,0 @@ -Filter advance attribute definitions -==================================== - -Attribute views will now hide any attribute definitions -that have an advance level that is higher than the user's -active advance level. This enables the Attribute View to hide -itself if all its definitions should be hidden from the user. diff --git a/doc/release/notes/fix_isValidAssociationCheck.rst b/doc/release/notes/fix_isValidAssociationCheck.rst deleted file mode 100644 index 78260dfa8e..0000000000 --- a/doc/release/notes/fix_isValidAssociationCheck.rst +++ /dev/null @@ -1,11 +0,0 @@ -Fix isValid Check w/r to an Attribute's Associations -==================================== -If an attribute had the following conditions: - - * Its association item set to have its NumberOfRequiredValues > 0 - * Its Resource had active categories - * All of its items where validity set with the exception of its association item - -Then its isValid() would mistakenly return true, due to the fact that its association item (which does not have categories set), would be excluded from the check. - -Now the association item is forced to be by turning off category checking for that item. By doing this, we are saying that if the attribute itself passes its category checks, then so does its association item. diff --git a/doc/release/notes/hide-disabled-attr-rsrcs.rst b/doc/release/notes/hide-disabled-attr-rsrcs.rst deleted file mode 100644 index d050aba90e..0000000000 --- a/doc/release/notes/hide-disabled-attr-rsrcs.rst +++ /dev/null @@ -1,9 +0,0 @@ -Hide disabled attribute resources -================================= - -The Attribute Editor panel will now first check to see if an -Attribute Resource is enabled before attempting to display it. -Telling the Attribute Editor panel to display a disabled Attribute -Resource will be the equivalent to telling the panel to display a -nullptr. The panel will be reset if it was currently display -any widgets. diff --git a/doc/release/notes/importppg-operation.rst b/doc/release/notes/importppg-operation.rst deleted file mode 100644 index 83441fb715..0000000000 --- a/doc/release/notes/importppg-operation.rst +++ /dev/null @@ -1,16 +0,0 @@ -ImportPPG Operation -=================== - -An ``ImportPPG`` operation has been added to the polygon session -for creating model resources from a simple text file input. -The "ppg" (Planar PolyGon) file format is a simple data format -that specifies 2-D geometry as a list of vertex coordinates and -polygon face definitions, with vertices connected implicitly by -straight-line model edges. Documentation is in the "Session: Polygon" -section of the SMTK user guide. - -The ``ImportPPG`` operation is provided as a convenience for exploring -CMB's many capabilities as well as for testing, debug, and demonstration. -To use this feature from modelbuilder, the "File -> New Resource" menu -item now includes an option "Polygon -> Planar Polygon Model from PPG -File". diff --git a/doc/release/notes/isRelevantChanges.rst b/doc/release/notes/isRelevantChanges.rst deleted file mode 100644 index b87ba0c87f..0000000000 --- a/doc/release/notes/isRelevantChanges.rst +++ /dev/null @@ -1,40 +0,0 @@ -.. highlight::cpp - -Added the ability to ignore an item -=================================== -There are times when a workflow may consider an item no longer relevant based on choices the user has made. In order model this behavior two methods have been added to Item: - -.. code-block:: c++ - - void setIsIgnored(bool val); - bool isIgnored() const; - - -If setIsIgnored is passed true, then the item's isRelevant() method will return false, regardless of any other facts. -This value is persistent and is supported in both JSON and XML formats. - -Changes to Attribute and Item isRelevant Methods -================================================ - -Both Attribute::isRelevant and Item::isRelevant have been modified to optional do advance level checking. - -.. code-block:: c++ - - bool isRelevant(bool includeCategoryChecks = true, bool includeReadAccess = false, int readAccessLevel = 0) const; - -If includeCategoryChecks is set to true, then the Attribute or Item must pass their category checks based on the -resource's Active Category Settings. - -If includeReadAccess is set to true then an Attribute is relevant iff at least one of it's children has a read access level <= readAccessLevel. - -In the case of an Item, if includeReadAccess is true then it must have it's read access level <= readAccessLevel - -Note that this modification does not require any code change in order to preserve previous functionality. - -Added hasRelevantChildren method to GroupItem -============================================= -GroupItem now has a method to test if at least on of its children items passes their category checks and read access checks passed on the caller's requirements. - -.. code-block:: c++ - - bool hasRelevantChildren(bool includeCategoryChecks = true, bool includeReadAccess = false, int readAccessLevel = 0) const; diff --git a/doc/release/notes/manager-registry-tracking.rst b/doc/release/notes/manager-registry-tracking.rst deleted file mode 100644 index d7f10a5005..0000000000 --- a/doc/release/notes/manager-registry-tracking.rst +++ /dev/null @@ -1,9 +0,0 @@ -Manager/registry tracking -========================= - -Tracking of registrations between registrars and managers should now only be -done through a held ``Registry`` instance as returned by the -``Registrar::addToManagers`` method. In the future, direct access to -``Registrar::registerTo`` and ``Registrar::unregisterFrom`` will be disabled -and the ``Registry`` RAII object will be the only way to manage registrations. -This ensures that registrations are accurately tracked. diff --git a/doc/release/notes/model-transcription.rst b/doc/release/notes/model-transcription.rst deleted file mode 100644 index 63353dc967..0000000000 --- a/doc/release/notes/model-transcription.rst +++ /dev/null @@ -1,16 +0,0 @@ -Model resource transcription -============================ - -SMTK now provides a way to avoid an O(n^2) performance -issue when embedding many cells into a model; -previously, each insertion would perform a linear search -of pre-existing relationships. However, many operations -(especially those in the importer group) will not attempt -to re-insert existing relationships. The ``Model::addCell()`` -and ``EntityRefArrangementOps::addSimpleRelationship()`` -methods now accept a boolean indicating whether to bypass -the linear-time check. - -The VTK session provides a static method, -``Session::setEnableTranscriptionChecks()``, for operations -to enable/disable this behavior during transcription. diff --git a/doc/release/notes/project-unique-roles.rst b/doc/release/notes/project-unique-roles.rst deleted file mode 100644 index d1bd667a07..0000000000 --- a/doc/release/notes/project-unique-roles.rst +++ /dev/null @@ -1,11 +0,0 @@ -Changes to smtk::project::ResourceContainer API -============================ - -Changes to the ``smtk::project::ResourceContainer`` API to allow for non-unique roles -to be assigned to Resources in a project. - -Deprecated version >= 21.6 -``smtk::project::ResourceContainer::getByRole -> smtk::resource::ResourcePtr`` - -New API -``smtk::project::ResourceContainer::findByRole -> std::set`` diff --git a/doc/release/notes/python2-deprecation.rst b/doc/release/notes/python2-deprecation.rst deleted file mode 100644 index 7ea8c737ab..0000000000 --- a/doc/release/notes/python2-deprecation.rst +++ /dev/null @@ -1,5 +0,0 @@ -Deprecate Python 2.x support -============================ - -Python 2.x reached its end of life in January 2020. SMTK has deprecated its -Python 2 support and will remove it in a future release. diff --git a/doc/release/notes/qtBaseAttributeViewSignalChange.rst b/doc/release/notes/qtBaseAttributeViewSignalChange.rst deleted file mode 100644 index f88493da00..0000000000 --- a/doc/release/notes/qtBaseAttributeViewSignalChange.rst +++ /dev/null @@ -1,7 +0,0 @@ -Improving UI handling of Signal Operations -===================================== -Originally the qtAttributeView class would ignore the Signal Operation since typically it would be the only Qt UI element that would be creating, removing, and changing the Attributes it is displaying. However, this prevented the UI designer from having AttributeViews that displayed the same information from being used in Selector Views or have different AttributeViews overlap their contents (for example one View could be displaying Fluid Boundary Conditions, while another was displaying all Boundary Conditions) - -This change now encodes the address of the View that initiated the change so that we can avoid a View from being updated via a Signal Operation that it itself initiated. - -qtAttributeView has now been updated to only ignore Signal Operations that it triggered. diff --git a/doc/release/notes/readOnlyAttributeNames.rst b/doc/release/notes/readOnlyAttributeNames.rst deleted file mode 100644 index b05f5e5cf4..0000000000 --- a/doc/release/notes/readOnlyAttributeNames.rst +++ /dev/null @@ -1,7 +0,0 @@ -Supporting smtk.extensions.attribute_view.name_read_only in qtAttributeViews -============================================================================ -You can now indicate that an Attribute's name should not be modified by creating a bool Property on the Attribute called: smtk.extensions.attribute_view.name_read_only and setting its value to true. - -Observing Operations -==================== -qtAttributeView will now properly examine modified attributes to see if they have smtk.extensions.attribute_view.name_read_only property or if their names had been changed. diff --git a/doc/release/notes/referenceItemAppendBehavior.rst b/doc/release/notes/referenceItemAppendBehavior.rst deleted file mode 100644 index a22efec8e2..0000000000 --- a/doc/release/notes/referenceItemAppendBehavior.rst +++ /dev/null @@ -1,5 +0,0 @@ -Changing ReferenceItem::AppendValue to Support Append Non-Unique -============================================ -* Added a nonUnique parameter that defaults to false -* This avoids unnecessarily having to scan the entire item when duplicates are allowed -* Item now also tracks the location of the first unset value in order to speed up the append process diff --git a/doc/release/notes/removedMethods.rst b/doc/release/notes/removedMethods.rst deleted file mode 100644 index d270f7cec8..0000000000 --- a/doc/release/notes/removedMethods.rst +++ /dev/null @@ -1,18 +0,0 @@ -Removed Deprecated API -==== -The following deprecated methods have been removed: - -* Categories::Set::mode has been replaced with Categories::Set::inclusionMode -* Categories::Set::setMode has been replaced with Categories::Set::setInclusionMode -* Categories::Set::categoryNames has been replaced with Categories::Set::includedCategoryNames -* Categories::Set::set has been replaced with Categories::Set::setInclusions -* Categories::Set::insert has been replaced with Categories::Set::insertInclusion -* Categories::Set::erase has been replaced with Categories::Set::eraseInclusion -* Categories::Set::size has been replaced with Categories::Set::inclusionSize -* ReferenceItem::objectValue has been replaced with ReferenceItem::value -* ReferenceItem::setObjectValue has been replaced with ReferenceItem::setValue -* ReferenceItem::appendObjectValue has been replaced with ReferenceItem::appendValue -* ReferenceItem::setObjectValues has been replaced with ReferenceItem::setValues -* ReferenceItem::appendObjectValues has been replaced with ReferenceItem::appendValues -* PhraseModel::addSource now accepts const smtk::common::TypeContainer& -* PhraseModel::removeSource now accepts const smtk::common::TypeContainer& diff --git a/doc/release/notes/task-system.rst b/doc/release/notes/task-system.rst deleted file mode 100644 index 9861560bb0..0000000000 --- a/doc/release/notes/task-system.rst +++ /dev/null @@ -1,7 +0,0 @@ -Task subsystem -============== - -SMTK now provides a task subsystem for representing user-actionable tasks in a workflow. -See the `task-system documentation`_ for more information about how to use this subsystem. - -.. _task-system documentation: https://smtk.readthedocs.io/en/latest/userguide/task/index.html diff --git a/doc/release/smtk-21.05.rst b/doc/release/smtk-21.05.rst index 0082fdeb83..e93039cf4a 100644 --- a/doc/release/smtk-21.05.rst +++ b/doc/release/smtk-21.05.rst @@ -1,6 +1,7 @@ +======================== SMTK 21.05 Release Notes -========= +======================== See also `SMTK 21.04 Release Notes`_ for previous changes. @@ -8,7 +9,7 @@ See also `SMTK 21.04 Release Notes`_ for previous changes. Changes to Project Subsystem ------- +============================= A major revision was undertaken to the ``smtk::project`` namespace that is not backward compatible. The previous Project class was hard-coded to a use single @@ -23,8 +24,10 @@ easier to implement custom project types for different solvers. More information is available in the SMTK user guide and there is also a new `create_a_project tutorial `_. +ParaView Related Changes +======================== ParaView-extension pipeline-creation changes ------ +-------------------------------------------- We have moved responsibility for creating pqSMTKResource proxies (which are ParaView pqPipelineSource subclasses) from consumers @@ -48,22 +51,24 @@ Finally, because resource proxies may be re-assigned a (different) SMTK resource, we monitor each proxy and update the lookup map as needed. External-facing changes -~~~~ +~~~~~~~~~~~~~~~~~~~~~~~ If you have code external to SMTK that invokes :cxx:`pqSMTKRenderResourceBehavior::instance()->createPipelineSource()`, you should eliminate it, but be aware that you cannot rely on the pipeline source being present or initialized at the time many observers are invoked. +Graph Resource Changes +====================== Graph-resource ArcMap ------- +--------------------- The graph resource now provides a custom subclass of TypeMap named smtk::graph::ArcMap. This subclass deletes the copy and assignment constructors to prevent modifications to accidental copies of arcs rather than to the resource's arc container. External changes -~~~~~~~~~ +~~~~~~~~~~~~~~~~ smtk::graph::ResourceBase::ArcSet type-alias was removed and the ArcMap class can now be used directly. @@ -72,8 +77,10 @@ If you maintain external code that depends on smtk::graph::Resource, you will need to replace the ResourceBase::ArcSet type-alias with ArcMap (which lives in smtk::graph not smtk::graph::ResourceBase). +Software Process Changes +======================== CMake package directory ------ +----------------------- The CMake package directory for SMTK is now in a location that CMake searches by default. This removes the need to do ``-Dsmtk_DIR`` and instead the install diff --git a/doc/release/smtk-21.07.rst b/doc/release/smtk-21.07.rst new file mode 100644 index 0000000000..a1bde93c36 --- /dev/null +++ b/doc/release/smtk-21.07.rst @@ -0,0 +1,256 @@ +========================= +SMTK 21.07 Release Notes +========================= + +See also `SMTK 21.05 Release Notes`_ for previous changes. + +.. _`SMTK 21.05 Release Notes`: smtk-21.05.md + +Registration Changes +==================== +Manager/registry tracking +------------------------- + +Tracking of registrations between registrars and managers should now only be +done through a held ``Registry`` instance as returned by the +``Registrar::addToManagers`` method. In the future, direct access to +``Registrar::registerTo`` and ``Registrar::unregisterFrom`` will be disabled +and the ``Registry`` RAII object will be the only way to manage registrations. +This ensures that registrations are accurately tracked. + +SMTK Resource and Component Changes +=================================== + +Expanding Default Property Types on SMTK Resources/Components +------------------------------------------------------------- +The default set of Properties now include int, bool, std::vector and std::vector. + +Attribute Resource Changes +========================== +Preserve State Information +-------------------------- + +SMTK will now preserve state information that pertains to +Attribute Resource views. The information persists even +after the resource has been closed, assuming the resource +was saved before it was closed. + +Information Preserved: + +- The active advance level. +- The active attributes in attribute views. +- The active tab in a group views. + +Fix isValid Check w/r to an Attribute's Associations +---------------------------------------------------- + +If an attribute had the following conditions: + +- Its association item set to have its NumberOfRequiredValues > 0 +- Its Resource had active categories +- All of its items where validity set with the exception of its association item + +Then its isValid() would mistakenly return true, due to the fact that its association item (which does not have categories set), would be excluded from the check. + +Now the association item is forced to be by turning off category checking for that item. By doing this, we are saying that if the attribute itself passes its category checks, then so does its association item. + +.. highlight::cpp + +.. highlight::cpp + +Added the ability to ignore an item +=================================== +There are times when a workflow may consider an item no longer relevant based on choices the user has made. In order model this behavior two methods have been added to Item: + +.. code-block:: c++ + + void setIsIgnored(bool val); + bool isIgnored() const; + + +If setIsIgnored is passed true, then the item's isRelevant() method will return false, regardless of any other facts. +This value is persistent and is supported in both JSON and XML formats. + +Changes to Attribute and Item isRelevant Methods +------------------------------------------------ + +Both Attribute::isRelevant and Item::isRelevant have been modified to optional do advance level checking. + +.. code-block:: c++ + + bool isRelevant(bool includeCategoryChecks = true, bool includeReadAccess = false, + int readAccessLevel = 0) const; + +If includeCategoryChecks is set to true, then the Attribute or Item must pass their category checks based on the +resource's Active Category Settings. + +If includeReadAccess is set to true then an Attribute is relevant iff at least one of it's children has a read access level <= readAccessLevel. + +In the case of an Item, if includeReadAccess is true then it must have it's read access level <= readAccessLevel + +Note that this modification does not require any code change in order to preserve previous functionality. + +Added hasRelevantChildren method to GroupItem +--------------------------------------------- +GroupItem now has a method to test if at least on of its children items passes their category checks and read access checks passed on the caller's requirements. + +.. code-block:: c++ + + bool hasRelevantChildren(bool includeCategoryChecks = true, bool includeReadAccess = false, + int readAccessLevel = 0) const; + +Changing ReferenceItem::AppendValue to Support Append Non-Unique +---------------------------------------------------------------- +* Added a nonUnique parameter that defaults to false +* This avoids unnecessarily having to scan the entire item when duplicates are allowed +* Item now also tracks the location of the first unset value in order to speed up the append process + +Model Resource Changes +====================== +Model resource transcription +---------------------------- + +SMTK now provides a way to avoid an O(n^2) performance +issue when embedding many cells into a model; +previously, each insertion would perform a linear search +of pre-existing relationships. However, many operations +(especially those in the importer group) will not attempt +to re-insert existing relationships. The ``Model::addCell()`` +and ``EntityRefArrangementOps::addSimpleRelationship()`` +methods now accept a boolean indicating whether to bypass +the linear-time check. + +The VTK session provides a static method, +``Session::setEnableTranscriptionChecks()``, for operations +to enable/disable this behavior during transcription. + +SMTK Project Changes +==================== +Changes to smtk::project::ResourceContainer API +----------------------------------------------- + +Changes to the ``smtk::project::ResourceContainer`` API to allow for non-unique roles +to be assigned to Resources in a project. + +Deprecated version >= 21.6 +~~~~~~~~~~~~~~~~~~~~~~~~~~ +``smtk::project::ResourceContainer::getByRole -> smtk::resource::ResourcePtr`` + +New API +~~~~~~~ +``smtk::project::ResourceContainer::findByRole -> std::set`` + +Other SMTK Core Changes +======================= +Visitors +-------- + +SMTK now provides an enumeration, ``smtk::common::Visit``, that visitor lambdas +may return to indicate whether visitation should continue (``smtk::common::Visit::Continue``) +or stop (``smtk::common::Visit::Halt``). +This enum is much easier to use than simply returning a ``bool`` as developers +frequently have trouble remembering which value (true or false) corresponds to +which iteration behaviour. + +This is currently only used by ``smtk::task::Task::visit()``, but will be +used more widely in the future. + +Task subsystem +-------------- + +SMTK now provides a task subsystem for representing user-actionable tasks in a workflow. +See the `task-system documentation`_ for more information about how to use this subsystem. + +.. _task-system documentation: https://smtk.readthedocs.io/en/latest/userguide/task/index.html +Qt UI Changes +============= +Removing Empty Frames in qtGroupItem +------------------------------------ +Using GroupItem's hasRelevantChildren method, qtGroupItem will now hide it's frame if there are no children to be displayed. + +Filter Advance Attribute Definitions +------------------------------------ + +Attribute views will now hide any attribute definitions +that have an advance level that is higher than the user's +active advance level. This enables the Attribute View to hide +itself if all its definitions should be hidden from the user. + +Hide disabled attribute resources +--------------------------------- + +The Attribute Editor panel will now first check to see if an +Attribute Resource is enabled before attempting to display it. +Telling the Attribute Editor panel to display a disabled Attribute +Resource will be the equivalent to telling the panel to display a +nullptr. The panel will be reset if it was currently display +any widgets. + +Improving UI handling of Signal Operations +------------------------------------------ +Originally the qtAttributeView class would ignore the Signal Operation since typically it would be the only Qt UI element that would be creating, removing, and changing the Attributes it is displaying. However, this prevented the UI designer from having AttributeViews that displayed the same information from being used in Selector Views or have different AttributeViews overlap their contents (for example one View could be displaying Fluid Boundary Conditions, while another was displaying all Boundary Conditions) + +This change now encodes the address of the View that initiated the change so that we can avoid a View from being updated via a Signal Operation that it itself initiated. + +qtAttributeView has now been updated to only ignore Signal Operations that it triggered. + +Supporting smtk.extensions.attribute_view.name_read_only in qtAttributeViews +---------------------------------------------------------------------------- +You can now indicate that an Attribute's name should not be modified by creating a bool Property on the Attribute called: **smtk.extensions.attribute_view.name_read_only** and setting its value to true. + +Observing Operations +-------------------- +qtAttributeView will now properly examine modified attributes to see if they have smtk.extensions.attribute_view.name_read_only property or if their names had been changed. + +Changes to Polygon Session +========================== +ImportPPG Operation +------------------- + +An ``ImportPPG`` operation has been added to the polygon session +for creating model resources from a simple text file input. +The "ppg" (Planar PolyGon) file format is a simple data format +that specifies 2-D geometry as a list of vertex coordinates and +polygon face definitions, with vertices connected implicitly by +straight-line model edges. Documentation is in the "Session: Polygon" +section of the SMTK user guide. + +The ``ImportPPG`` operation is provided as a convenience for exploring +CMB's many capabilities as well as for testing, debug, and demonstration. +To use this feature from modelbuilder, the "File -> New Resource" menu +item now includes an option "Polygon -> Planar Polygon Model from PPG +File". + +Removed Previously Deprecated API +================================= +The following deprecated methods have been removed: + +* Categories::Set::mode has been replaced with Categories::Set::inclusionMode +* Categories::Set::setMode has been replaced with Categories::Set::setInclusionMode +* Categories::Set::categoryNames has been replaced with Categories::Set::includedCategoryNames +* Categories::Set::set has been replaced with Categories::Set::setInclusions +* Categories::Set::insert has been replaced with Categories::Set::insertInclusion +* Categories::Set::erase has been replaced with Categories::Set::eraseInclusion +* Categories::Set::size has been replaced with Categories::Set::inclusionSize +* ReferenceItem::objectValue has been replaced with ReferenceItem::value +* ReferenceItem::setObjectValue has been replaced with ReferenceItem::setValue +* ReferenceItem::appendObjectValue has been replaced with ReferenceItem::appendValue +* ReferenceItem::setObjectValues has been replaced with ReferenceItem::setValues +* ReferenceItem::appendObjectValues has been replaced with ReferenceItem::appendValues +* PhraseModel::addSource now accepts const smtk::common::TypeContainer& +* PhraseModel::removeSource now accepts const smtk::common::TypeContainer& + +Software Process Changes +======================== +CMake Policies +-------------- + +Because of CMake policy CMP0115 (source file extensions must be explicit), +when passing test names to the ``smtk_add_test`` macro, be sure to include +the filename extension (such as ``.cxx``). + +Deprecate Python 2.x support +---------------------------- + +Python 2.x reached its end of life in January 2020. SMTK has deprecated its +Python 2 support and will remove it in a future release. -- GitLab From a9159609cfb2d53995ff511b15a8a6b21c031a55 Mon Sep 17 00:00:00 2001 From: Robert O'Bara Date: Thu, 22 Jul 2021 11:06:11 -0400 Subject: [PATCH 135/136] Update version number to 21.07.0 --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 2b2dbfd3c8..16406cd4a7 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -21.05.0 +21.07.0 -- GitLab From 7359780f492af56dac5def5e64b9e60cf21432d4 Mon Sep 17 00:00:00 2001 From: Robert O'Bara Date: Thu, 22 Jul 2021 11:08:20 -0400 Subject: [PATCH 136/136] SP: CI Changes to target release for 21.07.0 --- .gitlab/ci/cdash-groups.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.gitlab/ci/cdash-groups.json b/.gitlab/ci/cdash-groups.json index 25147edd2f..8907e88fae 100644 --- a/.gitlab/ci/cdash-groups.json +++ b/.gitlab/ci/cdash-groups.json @@ -1,57 +1,57 @@ { - "latest-master": [ + "latest-release": [ { - "group": "master", + "group": "release", "site": "gitlab-ci", "buildname": "fedora33_asan" }, { - "group": "master", + "group": "release", "site": "gitlab-ci", "buildname": "fedora33_coverage" }, { - "group": "master", + "group": "release", "site": "gitlab-ci", "buildname": "fedora33_nodata" }, { - "group": "master", + "group": "release", "site": "gitlab-ci", "buildname": "fedora33_paraview" }, { - "group": "master", + "group": "release", "site": "gitlab-ci", "buildname": "fedora33_plain" }, { - "group": "master", + "group": "release", "site": "gitlab-ci", "buildname": "fedora33_tidy" }, { - "group": "master", + "group": "release", "site": "gitlab-ci", "buildname": "fedora33_ubsan" }, { - "group": "master", + "group": "release", "site": "gitlab-ci", "buildname": "fedora33_vtk_python3" }, { - "group": "master", + "group": "release", "site": "gitlab-ci", "buildname": "macos_arm64" }, { - "group": "master", + "group": "release", "site": "gitlab-ci", "buildname": "macos_x86_64" }, { - "group": "master", + "group": "release", "site": "gitlab-ci", "buildname": "windows_vs2019_ninja" } -- GitLab