diff --git a/.clang-tidy b/.clang-tidy index 217aeba3a41444fbf627eb49bd6cec4717d0cc1f..c33a20a24d6771544dc7b798592d625877a63358 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,14 +1,19 @@ --- Checks: "-*,\ boost-*,\ +-boost-use-ranges,\ bugprone-*,\ -bugprone-argument-comment,\ +-bugprone-assignment-in-if-condition,\ -bugprone-branch-clone,\ -bugprone-easily-swappable-parameters,\ +-bugprone-empty-catch,\ -bugprone-implicit-widening-of-multiplication-result,\ +-bugprone-inc-dec-in-conditions,\ -bugprone-incorrect-roundings,\ -bugprone-macro-parentheses,\ -bugprone-misplaced-widening-cast,\ +-bugprone-multi-level-implicit-pointer-conversion,\ -bugprone-narrowing-conversions,\ -bugprone-not-null-terminated-result,\ -bugprone-parent-virtual-call,\ @@ -18,8 +23,11 @@ bugprone-*,\ -bugprone-string-constructor,\ -bugprone-suspicious-enum-usage,\ -bugprone-suspicious-include,\ +-bugprone-swapped-arguments,\ +-bugprone-switch-missing-default-case,\ -bugprone-throw-keyword-missing,\ -bugprone-unhandled-self-assignment,\ +-bugprone-unsafe-functions,\ clang-analyzer-*,\ -clang-analyzer-core.CallAndMessage,\ -clang-analyzer-core.DivideZero,\ @@ -35,6 +43,7 @@ clang-analyzer-*,\ -clang-analyzer-cplusplus.NewDelete,\ -clang-analyzer-cplusplus.NewDeleteLeaks,\ -clang-analyzer-deadcode.DeadStores,\ +-clang-analyzer-optin.core.EnumCastOutOfRange,\ -clang-analyzer-optin.cplusplus.UninitializedObject,\ -clang-analyzer-optin.cplusplus.VirtualCall,\ -clang-analyzer-security.FloatLoopCounter,\ @@ -43,13 +52,18 @@ clang-analyzer-*,\ -clang-analyzer-unix.Malloc,\ -clang-analyzer-unix.MismatchedDeallocator,\ misc-*,\ +-misc-const-correctness,\ +-misc-header-include-cycle,\ +-misc-include-cleaner,\ -misc-no-recursion,\ -misc-non-private-member-variables-in-classes,\ -misc-redundant-expression,\ -misc-unconventional-assign-operator,\ +-misc-use-anonymous-namespace,\ modernize-*,\ -modernize-avoid-c-arrays,\ -modernize-loop-convert,\ +-modernize-macro-to-enum,\ -modernize-make-unique,\ -modernize-pass-by-value,\ -modernize-raw-string-literal,\ @@ -62,12 +76,15 @@ modernize-*,\ -modernize-use-default-member-init,\ -modernize-use-emplace,\ -modernize-use-equals-delete,\ +-modernize-use-nodiscard,\ -modernize-use-trailing-return-type,\ -modernize-use-using,\ -modernize-use-transparent-functors,\ mpi-*,\ openmp-*,\ performance-*,\ +-performance-avoid-endl,\ +-performance-enum-size,\ -performance-for-range-copy,\ -performance-inefficient-string-concatenation,\ -performance-inefficient-vector-operation,\ @@ -79,16 +96,21 @@ performance-*,\ -performance-unnecessary-value-param,\ portability-*,\ readability-*,\ +-readability-avoid-nested-conditional-operator,\ +-readability-avoid-unconditional-preprocessor-if,\ -readability-braces-around-statements,\ +-readability-container-data-pointer,\ -readability-convert-member-functions-to-static,\ -readability-else-after-return,\ -readability-function-cognitive-complexity,\ -readability-function-size,\ +-readability-identifier-length,\ -readability-implicit-bool-conversion,\ -readability-inconsistent-declaration-parameter-name,\ -readability-isolate-declaration,\ -readability-magic-numbers,\ -readability-make-member-function-const,\ +-readability-math-missing-parentheses,\ -readability-named-parameter,\ -readability-non-const-parameter,\ -readability-qualified-auto,\ diff --git a/CMake/CTestCustom.cmake.in b/CMake/CTestCustom.cmake.in index 8ec658e28ea51405b201e11014df60439d1c470b..553c36716bdfe0cd12a3bc15ce4ce9ba263d610c 100644 --- a/CMake/CTestCustom.cmake.in +++ b/CMake/CTestCustom.cmake.in @@ -48,6 +48,34 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION "note: declared here" ) +# CI-specific warning suppressions. +# +# Some of our CI ends up generating warnings that don't really matter. Of +# particular interest are warnings which have different behavior in older +# compilers than modern ones. It's not really all that important to cater to +# old, broken warning implementations when newer compilers tell us when we +# aren't doing things properly. +if (NOT "$ENV{CI}" STREQUAL "") + # For some reason, warning flags aren't working here. + if ("$ENV{CMAKE_CONFIGURATION}" MATCHES "fedora40") + list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION + "Wstringop-overflow=" + "note: destination object allocated here" + "note: destination object '.*' of size .*" + "note: destination object of size .* allocated by 'operator new'" + + "Wstringop-overread" + "note: source object '.*' of size .*" + "note: at offset .* into source object '.*' of size .*" + + # Seems to fire for the destructor of `std::vector`? Ignoring all + # instances is sad, but it's not clear what to do about it otherwise. + "Wfree-nonheap-object" + "note: returned from 'void\\* operator new\\(std::size_t\\)'" + ) + endif () +endif () + list(APPEND CTEST_CUSTOM_ERROR_EXCEPTION # Xcb error does not seem to cause errors in generated test images "qt.qpa.xcb: internal error" diff --git a/Clients/Catalyst/Testing/Cxx/AdaptorDriver.cxx b/Clients/Catalyst/Testing/Cxx/AdaptorDriver.cxx index ad2d4a4fca20fbf27c35940d5e73790a395ce7cd..28feae2c9f01a565abfccaf2ea0dac259275005b 100644 --- a/Clients/Catalyst/Testing/Cxx/AdaptorDriver.cxx +++ b/Clients/Catalyst/Testing/Cxx/AdaptorDriver.cxx @@ -7,7 +7,7 @@ #include "vtkCPTestDriver.h" #include "vtkCustomUnstructuredGridBuilder.h" -int AdaptorDriver(int, char*[]) +extern int AdaptorDriver(int, char*[]) { // Set the type of grid we are building. vtkCustomUnstructuredGridBuilder* gridBuilder = vtkCustomUnstructuredGridBuilder::New(); diff --git a/Clients/Catalyst/Testing/Cxx/CPXMLPWriterPipeline.cxx b/Clients/Catalyst/Testing/Cxx/CPXMLPWriterPipeline.cxx index c47e94c798ba938a65a7fb3a20f3d169dd5dbe9c..1ed778d0258e016abd2d74cac26095d711001331 100644 --- a/Clients/Catalyst/Testing/Cxx/CPXMLPWriterPipeline.cxx +++ b/Clients/Catalyst/Testing/Cxx/CPXMLPWriterPipeline.cxx @@ -20,7 +20,7 @@ #include "vtkXMLStructuredGridReader.h" #include -int CPXMLPWriterPipeline(int argc, char* argv[]) +extern int CPXMLPWriterPipeline(int argc, char* argv[]) { vtkNew dd; dd->SetTimeData(10, 10); diff --git a/Clients/Catalyst/Testing/Cxx/CoProcessingTestOutputs.cxx b/Clients/Catalyst/Testing/Cxx/CoProcessingTestOutputs.cxx index 41ccc62575780c273212d907e89206857c511590..d005f0fc284b4862c173c34bef2dc39adebbea22 100644 --- a/Clients/Catalyst/Testing/Cxx/CoProcessingTestOutputs.cxx +++ b/Clients/Catalyst/Testing/Cxx/CoProcessingTestOutputs.cxx @@ -98,7 +98,7 @@ private: vtkStandardNewMacro(vtkCPTestPipeline); } -int CoProcessingTestOutputs(int, char*[]) +extern int CoProcessingTestOutputs(int, char*[]) { vtkSmartPointer processor = vtkSmartPointer::New(); processor->Initialize(); diff --git a/Clients/Catalyst/Testing/Cxx/LoadVTKmFilterPluginDriver.cxx b/Clients/Catalyst/Testing/Cxx/LoadVTKmFilterPluginDriver.cxx index 3b6cadb8a33a3403e26ea2aabe18c8d491c95a31..623deffc782651b32a9b01193dde25f19930019c 100644 --- a/Clients/Catalyst/Testing/Cxx/LoadVTKmFilterPluginDriver.cxx +++ b/Clients/Catalyst/Testing/Cxx/LoadVTKmFilterPluginDriver.cxx @@ -25,7 +25,7 @@ def RequestDataDescription(datadescription): datadescription.GetInputDescriptionByName('input').GenerateMeshOn() )=="; -int LoadVTKmFilterPluginDriver(int argc, char* argv[]) +extern int LoadVTKmFilterPluginDriver(int argc, char* argv[]) { vtkNew processor; processor->Initialize(); diff --git a/Clients/Catalyst/Testing/Cxx/SimpleDriver.cxx b/Clients/Catalyst/Testing/Cxx/SimpleDriver.cxx index 31a15af4c9c58b37f552ca397c101a6e44fb2563..6df899ddf894a66030f299a26b7ee0727ac50b69 100644 --- a/Clients/Catalyst/Testing/Cxx/SimpleDriver.cxx +++ b/Clients/Catalyst/Testing/Cxx/SimpleDriver.cxx @@ -8,7 +8,7 @@ #include "vtkCPTestDriver.h" #include "vtkCPUniformGridBuilder.h" -int SimpleDriver(int, char*[]) +extern int SimpleDriver(int, char*[]) { // Specify how the field varies over space and time. vtkCPLinearScalarFieldFunction* fieldFunction = vtkCPLinearScalarFieldFunction::New(); diff --git a/Clients/Catalyst/Testing/Cxx/SimpleDriver2.cxx b/Clients/Catalyst/Testing/Cxx/SimpleDriver2.cxx index fe4608b09532cb927686a359b78594d446fa59a8..5f2d0d330161334740b16ab3ea44fc69acb84b83 100644 --- a/Clients/Catalyst/Testing/Cxx/SimpleDriver2.cxx +++ b/Clients/Catalyst/Testing/Cxx/SimpleDriver2.cxx @@ -9,7 +9,7 @@ #include "vtkCPUniformGridBuilder.h" #include "vtkObjectFactory.h" -class VTK_EXPORT vtkCPImplementedTestDriver : public vtkCPTestDriver +class vtkCPImplementedTestDriver : public vtkCPTestDriver { public: static vtkCPImplementedTestDriver* New(); @@ -58,7 +58,7 @@ private: vtkStandardNewMacro(vtkCPImplementedTestDriver); -int SimpleDriver2(int, char*[]) +extern int SimpleDriver2(int, char*[]) { vtkCPImplementedTestDriver* testDriver = vtkCPImplementedTestDriver::New(); testDriver->SetNumberOfTimeSteps(100); diff --git a/Clients/Catalyst/Testing/Cxx/SubController.cxx b/Clients/Catalyst/Testing/Cxx/SubController.cxx index 4c710eb150e30ee46ed10fdb81537939b9f2bdf7..110ab5af145fd9a113e5b2968429b88b4e73076a 100644 --- a/Clients/Catalyst/Testing/Cxx/SubController.cxx +++ b/Clients/Catalyst/Testing/Cxx/SubController.cxx @@ -20,7 +20,7 @@ void SubCommunicatorDriver(MPI_Comm* handle) processor->Finalize(); } -int SubController(int argc, char* argv[]) +extern int SubController(int argc, char* argv[]) { MPI_Init(&argc, &argv); int myrank, numprocs; diff --git a/Clients/Catalyst/Testing/Cxx/vtkCustomUnstructuredGridBuilder.h b/Clients/Catalyst/Testing/Cxx/vtkCustomUnstructuredGridBuilder.h index bc7460611deb968f20e2705b67187bd501a5fcb9..d10934307a86d258bdee20ad84bbbfa63dbb5e24 100644 --- a/Clients/Catalyst/Testing/Cxx/vtkCustomUnstructuredGridBuilder.h +++ b/Clients/Catalyst/Testing/Cxx/vtkCustomUnstructuredGridBuilder.h @@ -20,7 +20,7 @@ class vtkIdList; class vtkPoints; class vtkUnstructuredGrid; -class VTK_EXPORT vtkCustomUnstructuredGridBuilder : public vtkCPUnstructuredGridBuilder +class vtkCustomUnstructuredGridBuilder : public vtkCPUnstructuredGridBuilder { public: static vtkCustomUnstructuredGridBuilder* New(); diff --git a/Clients/Catalyst/vtkCPAdaptorAPI.cxx b/Clients/Catalyst/vtkCPAdaptorAPI.cxx index 224db749d0c173626eb58af14209fb263df6e304..7d534ce9dde149f55d0dc646c414c70f3c92f139 100644 --- a/Clients/Catalyst/vtkCPAdaptorAPI.cxx +++ b/Clients/Catalyst/vtkCPAdaptorAPI.cxx @@ -14,7 +14,7 @@ #include // This code is meant as an API for Fortran and C simulation codes. -namespace ParaViewCoProcessing +namespace { /// Clear all of the field data from the grids. @@ -125,7 +125,7 @@ void vtkCPAdaptorAPI::NeedToCreateGrid(int* needGrid) if (vtkDataSet* grid = vtkDataSet::SafeDownCast( vtkCPAdaptorAPI::CoProcessorData->GetInputDescriptionByName("input")->GetGrid())) { - ParaViewCoProcessing::ClearFieldDataFromGrid(grid); + ::ClearFieldDataFromGrid(grid); } else { @@ -137,8 +137,7 @@ void vtkCPAdaptorAPI::NeedToCreateGrid(int* needGrid) iter->InitTraversal(); for (iter->GoToFirstItem(); !iter->IsDoneWithTraversal(); iter->GoToNextItem()) { - ParaViewCoProcessing::ClearFieldDataFromGrid( - vtkDataSet::SafeDownCast(iter->GetCurrentDataObject())); + ::ClearFieldDataFromGrid(vtkDataSet::SafeDownCast(iter->GetCurrentDataObject())); } iter->Delete(); } diff --git a/Clients/InSitu/catalyst/ParaViewCatalyst.cxx b/Clients/InSitu/catalyst/ParaViewCatalyst.cxx index 429fdc843e3ede9f0af49dd9dec91d7efabba02a..24e9b4c32e80bc199aa9c21a359e4a2b89b35345 100644 --- a/Clients/InSitu/catalyst/ParaViewCatalyst.cxx +++ b/Clients/InSitu/catalyst/ParaViewCatalyst.cxx @@ -240,6 +240,7 @@ enum catalyst_status catalyst_initialize_paraview(const conduit_node* params) { vtkLogF( ERROR, "invalid 'catalyst' node passed to 'catalyst_initialize'. Initialization failed."); + // NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange) return pvcatalyst_err(invalid_node); } @@ -347,6 +348,7 @@ enum catalyst_status catalyst_execute_paraview(const conduit_node* params) if (!cpp_params.has_path("catalyst")) { vtkVLogF(PARAVIEW_LOG_CATALYST_VERBOSITY(), "Path 'catalyst' is not provided. Skipping."); + // NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange) return pvcatalyst_err(invalid_node); } @@ -354,6 +356,7 @@ enum catalyst_status catalyst_execute_paraview(const conduit_node* params) if (!vtkCatalystBlueprint::Verify("execute", root)) { vtkLogF(ERROR, "invalid 'catalyst' node passed to 'catalyst_execute'. Execution failed."); + // NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange) return pvcatalyst_err(invalid_node); } @@ -577,5 +580,6 @@ enum catalyst_status catalyst_results_paraview(conduit_node* params) vtkInSituInitializationHelper::GetResultsFromPipelines(params); + // NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange) return is_success ? catalyst_status_ok : pvcatalyst_err(results); } diff --git a/Clients/InSitu/vtkInSituInitializationHelper.cxx b/Clients/InSitu/vtkInSituInitializationHelper.cxx index e6108bb3eeb48b064a31a9ad05fc344265da03c7..eb2ac011896663be4b283d51e08f948378b144ec 100644 --- a/Clients/InSitu/vtkInSituInitializationHelper.cxx +++ b/Clients/InSitu/vtkInSituInitializationHelper.cxx @@ -106,6 +106,8 @@ struct PropertyCopier } }; +namespace +{ template void SetPropertyValue(T* prop, vtkDataArray* array) { @@ -117,6 +119,7 @@ void SetPropertyValue(T* prop, vtkDataArray* array) copier(array); } } +} int vtkInSituInitializationHelper::WasInitializedOnce; int vtkInSituInitializationHelper::WasFinalizedOnce; @@ -696,15 +699,15 @@ void vtkInSituInitializationHelper::UpdateSteerableProxies() { if (auto dp = vtkSMDoubleVectorProperty::SafeDownCast(property)) { - SetPropertyValue(dp, array); + ::SetPropertyValue(dp, array); } else if (auto ip = vtkSMIntVectorProperty::SafeDownCast(property)) { - SetPropertyValue(ip, array); + ::SetPropertyValue(ip, array); } else if (auto idp = vtkSMIdTypeVectorProperty::SafeDownCast(property)) { - SetPropertyValue(idp, array); + ::SetPropertyValue(idp, array); } else { diff --git a/Clients/InSitu/vtkInSituPipelineIO.cxx b/Clients/InSitu/vtkInSituPipelineIO.cxx index e29c7879c41a9c3260f552ebad44246f799ea1c7..cde6148a8263aa006dafc91c7df54c536e2fca99 100644 --- a/Clients/InSitu/vtkInSituPipelineIO.cxx +++ b/Clients/InSitu/vtkInSituPipelineIO.cxx @@ -16,7 +16,7 @@ #include -namespace detail +namespace { vtkSmartPointer CreateWriter( vtkInSituPipelineIO* self, vtkSMSourceProxy* producer) @@ -84,7 +84,7 @@ bool vtkInSituPipelineIO::Execute(int timestep, double time) auto producer = vtkInSituInitializationHelper::GetProducer(this->ChannelName); assert(producer != nullptr); - this->Writer = detail::CreateWriter(this, producer); + this->Writer = ::CreateWriter(this, producer); if (!this->Writer) { vtkErrorMacro("Failed to create writer on channel '" << this->ChannelName << "' for file '" diff --git a/Clients/Web/Testing/Cxx/TestDataEncoder.cxx b/Clients/Web/Testing/Cxx/TestDataEncoder.cxx index abfcd9aeaf6091a2d621cac339946f1f2b72ea98..dac1a8fe0788a7ba996e7b85c33eb7493877822b 100644 --- a/Clients/Web/Testing/Cxx/TestDataEncoder.cxx +++ b/Clients/Web/Testing/Cxx/TestDataEncoder.cxx @@ -13,7 +13,7 @@ #include // returns 0 on success. -int TestDataEncoder(int argc, char* argv[]) +extern int TestDataEncoder(int argc, char* argv[]) { char* dataroot = vtkTestUtilities::GetDataRoot(argc, argv); if (!dataroot) diff --git a/Plugins/AnalyzeNIfTIReaderWriter/NIfTIIO/ThirdParty/.clang-tidy b/Plugins/AnalyzeNIfTIReaderWriter/NIfTIIO/ThirdParty/.clang-tidy index 1804b54679225ef36ee029490ea99d10129abacb..1c2632a9d285b8f34c5553709e322f2a2df1fef3 100644 --- a/Plugins/AnalyzeNIfTIReaderWriter/NIfTIIO/ThirdParty/.clang-tidy +++ b/Plugins/AnalyzeNIfTIReaderWriter/NIfTIIO/ThirdParty/.clang-tidy @@ -7,11 +7,13 @@ bugprone-*,\ -bugprone-branch-clone,\ -bugprone-easily-swappable-parameters,\ -bugprone-implicit-widening-of-multiplication-result,\ +-bugprone-multi-level-implicit-pointer-conversion,\ -bugprone-narrowing-conversions,\ -bugprone-not-null-terminated-result,\ -bugprone-reserved-identifier,\ -bugprone-signed-char-misuse,\ -bugprone-suspicious-realloc-usage,\ +-bugprone-switch-missing-default-case,\ -bugprone-unsafe-functions,\ " ... diff --git a/Plugins/CFSReader/Reader/hdf5Reader.h b/Plugins/CFSReader/Reader/hdf5Reader.h index db67f1bc5157f032e4bef06a388f698b48a8c53a..d1163265bdb9199f1367dcb1f867e387e0ba879b 100644 --- a/Plugins/CFSReader/Reader/hdf5Reader.h +++ b/Plugins/CFSReader/Reader/hdf5Reader.h @@ -26,7 +26,7 @@ namespace H5CFS * Class for handling the reading of mesh and simulation data from * HDF5 files. */ -class VTK_EXPORT Hdf5Reader +class Hdf5Reader { public: Hdf5Reader() = default; diff --git a/Plugins/DSP/DataModel/Testing/Cxx/TestDSPIterator.cxx b/Plugins/DSP/DataModel/Testing/Cxx/TestDSPIterator.cxx index 21b7df05396058e719742a7c3b191782761ddf73..2d696d90bd88ee0a61820acd41623fe5e3c3deee 100644 --- a/Plugins/DSP/DataModel/Testing/Cxx/TestDSPIterator.cxx +++ b/Plugins/DSP/DataModel/Testing/Cxx/TestDSPIterator.cxx @@ -102,7 +102,7 @@ bool CheckDSPIteratorWithObject(vtkDataObject* object) } //----------------------------------------------------------------------------- -int TestDSPIterator(int argc, char* argv[]) +extern int TestDSPIterator(int argc, char* argv[]) { // Read temporal dataset char* fname = diff --git a/Plugins/DSP/DataModel/Testing/Cxx/TestDSPIteratorIntegration.cxx b/Plugins/DSP/DataModel/Testing/Cxx/TestDSPIteratorIntegration.cxx index 47a2c7af46029f5fbf7b079e6f97121ff17343ff..42d6d11034ebb4839060a4ce4aff2e4a67e25f10 100644 --- a/Plugins/DSP/DataModel/Testing/Cxx/TestDSPIteratorIntegration.cxx +++ b/Plugins/DSP/DataModel/Testing/Cxx/TestDSPIteratorIntegration.cxx @@ -95,7 +95,7 @@ private: vtkStandardNewMacro(vtkIteratorTestFilter); //----------------------------------------------------------------------------- -int TestDSPIteratorIntegration(int argc, char* argv[]) +extern int TestDSPIteratorIntegration(int argc, char* argv[]) { // Read temporal dataset char* fname = diff --git a/Plugins/DSP/DataModel/Testing/Cxx/TestMultiDimensionalArray.cxx b/Plugins/DSP/DataModel/Testing/Cxx/TestMultiDimensionalArray.cxx index fb9582536496a6c8230525a6d28a8ffa6cc5540f..32e173ba15f2ad0d1809a91ce253e4b34037b5b9 100644 --- a/Plugins/DSP/DataModel/Testing/Cxx/TestMultiDimensionalArray.cxx +++ b/Plugins/DSP/DataModel/Testing/Cxx/TestMultiDimensionalArray.cxx @@ -36,7 +36,7 @@ DataContainerInt generateIntArrayVector(int nbOfArrays, int nbOfTuples, int nbOf } //----------------------------------------------------------------------------- -int TestMultiDimensionalArray(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) +extern int TestMultiDimensionalArray(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) { constexpr vtkIdType nbOfArrays = 3; constexpr vtkIdType nbOfTuples = 3; diff --git a/Plugins/DSP/DataModel/Testing/Cxx/TestMultiDimensionalImplicitBackend.cxx b/Plugins/DSP/DataModel/Testing/Cxx/TestMultiDimensionalImplicitBackend.cxx index 00426463c5e81750123a16ee07269bad358b5342..afbce40b8001d7656364d6a11e6ea6be3be204e2 100644 --- a/Plugins/DSP/DataModel/Testing/Cxx/TestMultiDimensionalImplicitBackend.cxx +++ b/Plugins/DSP/DataModel/Testing/Cxx/TestMultiDimensionalImplicitBackend.cxx @@ -32,7 +32,7 @@ DataContainerInt generateIntArrayVector(int nbOfArrays, int nbOfTuples, int nbOf } //----------------------------------------------------------------------------- -int TestMultiDimensionalImplicitBackend(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) +extern int TestMultiDimensionalImplicitBackend(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) { constexpr vtkIdType nbOfArrays = 3; constexpr vtkIdType nbOfTuples = 3; diff --git a/Plugins/DSP/DataModel/Testing/Cxx/TestTemporalDataToMultiDimensionalArray.cxx b/Plugins/DSP/DataModel/Testing/Cxx/TestTemporalDataToMultiDimensionalArray.cxx index de15ba9aa5162b110e65929238e61b7827bac4d8..b2ad7e562a52fccce505efccb67b4e3ef24ac4e9 100644 --- a/Plugins/DSP/DataModel/Testing/Cxx/TestTemporalDataToMultiDimensionalArray.cxx +++ b/Plugins/DSP/DataModel/Testing/Cxx/TestTemporalDataToMultiDimensionalArray.cxx @@ -24,7 +24,7 @@ namespace using DataContainerDouble = typename vtkMultiDimensionalImplicitBackend::DataContainerT; } -int TestTemporalDataToMultiDimensionalArray(int argc, char* argv[]) +extern int TestTemporalDataToMultiDimensionalArray(int argc, char* argv[]) { // Read can.ex2 using ioss reader char* fileNameC = vtkTestUtilities::ExpandDataFileName(argc, argv, "Testing/Data/can.ex2"); diff --git a/Plugins/DSP/Testing/Cxx/TestBandFiltering.cxx b/Plugins/DSP/Testing/Cxx/TestBandFiltering.cxx index f340ec628a3921946cb3f5e74251e8dc7ba826c0..5b636e17e07366559772d393427a46dcf681ee44 100644 --- a/Plugins/DSP/Testing/Cxx/TestBandFiltering.cxx +++ b/Plugins/DSP/Testing/Cxx/TestBandFiltering.cxx @@ -72,7 +72,7 @@ int CheckArray(vtkDataArray* array, std::array expected) } // ---------------------------------------------------------------------------- -int TestBandFiltering(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) +extern int TestBandFiltering(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) { constexpr int N_ELEMENTS = 1000; diff --git a/Plugins/DSP/Testing/Cxx/TestDSPTableFFT.cxx b/Plugins/DSP/Testing/Cxx/TestDSPTableFFT.cxx index 7829536c30c890b6d6085d23bbfc09e75fe6d325..0df33754765a992acd92c732b16a62ab6317e20a 100644 --- a/Plugins/DSP/Testing/Cxx/TestDSPTableFFT.cxx +++ b/Plugins/DSP/Testing/Cxx/TestDSPTableFFT.cxx @@ -90,7 +90,7 @@ bool TableEq(vtkTable* lhs, vtkTable* rhs) } -int TestDSPTableFFT(int, char*[]) +extern int TestDSPTableFFT(int, char*[]) { vtkNew source; diff --git a/Plugins/DSP/Testing/Cxx/TestTemporalMultiplexing.cxx b/Plugins/DSP/Testing/Cxx/TestTemporalMultiplexing.cxx index a309f68112ffd1127b71ffe4efc5f3eec7a2da99..fc8ef7e4ccd2e6c5fb83c5b3b001f13da8bff70d 100644 --- a/Plugins/DSP/Testing/Cxx/TestTemporalMultiplexing.cxx +++ b/Plugins/DSP/Testing/Cxx/TestTemporalMultiplexing.cxx @@ -15,7 +15,7 @@ #include "vtkDataArraySelection.h" //----------------------------------------------------------------------------- -int TestTemporalMultiplexing(int argc, char* argv[]) +extern int TestTemporalMultiplexing(int argc, char* argv[]) { // Read temporal dataset char* fname = diff --git a/Plugins/pvNVIDIAIndeX/src/vtknvindex_irregular_volume_mapper.cxx b/Plugins/pvNVIDIAIndeX/src/vtknvindex_irregular_volume_mapper.cxx index f1e3907cdaf0b7a71fa53f1dbcba748533ca0e0d..d00d8ec63fa28c5ef67943fcff2999b5350c5781 100644 --- a/Plugins/pvNVIDIAIndeX/src/vtknvindex_irregular_volume_mapper.cxx +++ b/Plugins/pvNVIDIAIndeX/src/vtknvindex_irregular_volume_mapper.cxx @@ -27,6 +27,7 @@ // SPDX-FileCopyrightText: Copyright 2023 NVIDIA Corporation // SPDX-License-Identifier: BSD-3-Clause +#include #include #include #include @@ -328,11 +329,8 @@ bool vtknvindex_irregular_volume_mapper::initialize_mapper(vtkRenderer* /*ren*/, unstructured_grid->GetPoint(cell_point_ids[TET_EDGES[i][1]], p2); mi::Float64 size2 = vtkMath::Distance2BetweenPoints(p1, p2); - if (size2 > max_cell_edge_size2) - max_cell_edge_size2 = size2; - - if (size2 < min_cell_edge_size2) - min_cell_edge_size2 = size2; + max_cell_edge_size2 = std::max(max_cell_edge_size2, size2); + min_cell_edge_size2 = std::min(min_cell_edge_size2, size2); avg_edge_size2 += size2; } diff --git a/Plugins/pvNVIDIAIndeX/src/vtknvindex_scene.cxx b/Plugins/pvNVIDIAIndeX/src/vtknvindex_scene.cxx index bb5b0764630325f7d469782d80faf20916ccb7a7..6dc2356c0adbe6580dd57d67579be091a615985b 100644 --- a/Plugins/pvNVIDIAIndeX/src/vtknvindex_scene.cxx +++ b/Plugins/pvNVIDIAIndeX/src/vtknvindex_scene.cxx @@ -232,8 +232,6 @@ unsigned int get_number_of_physical_cpus() return physical_cpus; } -} // namespace - //------------------------------------------------------------------------------------------------- void update_slice_planes(nv::index::IPlane* plane, const vtknvindex_slice_params& slice_params, const mi::math::Vector_struct& volume_size) @@ -279,6 +277,8 @@ void update_slice_planes(nv::index::IPlane* plane, const vtknvindex_slice_params plane->set_extent(extent); } +} // namespace + //------------------------------------------------------------------------------------------------- vtknvindex_scene::vtknvindex_scene() : m_scene_created(false) diff --git a/Plugins/pvNVIDIAIndeX/src/vtknvindex_sparse_volume_importer.cxx b/Plugins/pvNVIDIAIndeX/src/vtknvindex_sparse_volume_importer.cxx index 71c8f4309c45b15aac9d6f7cd1956bbe700c0f8d..ea9d7261d69b5a45a46fed9a1bc70b722eb1f1e3 100644 --- a/Plugins/pvNVIDIAIndeX/src/vtknvindex_sparse_volume_importer.cxx +++ b/Plugins/pvNVIDIAIndeX/src/vtknvindex_sparse_volume_importer.cxx @@ -27,6 +27,7 @@ // SPDX-FileCopyrightText: Copyright 2023 NVIDIA Corporation // SPDX-License-Identifier: BSD-3-Clause +#include #include #include "vtkMultiProcessController.h" @@ -38,6 +39,8 @@ static const std::string LOG_svol_rvol_prefix = "Sparse volume importer: "; +namespace +{ //------------------------------------------------------------------------------------------------- inline nv::index::Sparse_volume_voxel_format match_volume_format(const std::string& fmt_string) { @@ -98,6 +101,7 @@ inline mi::Size volume_format_size(const nv::index::Sparse_volume_voxel_format f return 0; } } +} //------------------------------------------------------------------------------------------------- vtknvindex_import_bricks::vtknvindex_import_bricks( @@ -126,8 +130,7 @@ vtknvindex_import_bricks::vtknvindex_import_bricks( m_nb_fragments = DEFAULT_NB_FRAGMENTS; } - if (m_nb_fragments > m_nb_bricks) - m_nb_fragments = m_nb_bricks; + m_nb_fragments = std::min(m_nb_fragments, m_nb_bricks); } namespace @@ -287,8 +290,7 @@ void vtknvindex_import_bricks::execute_fragment( mi::Uint32 min_brick_idx = static_cast(index * nb_bricks_per_index); mi::Uint32 max_brick_idx = static_cast((index + 1) * nb_bricks_per_index); - if (max_brick_idx > m_nb_bricks) - max_brick_idx = m_nb_bricks; + max_brick_idx = std::min(max_brick_idx, m_nb_bricks); for (mi::Uint32 brick_idx = min_brick_idx; brick_idx < max_brick_idx; brick_idx++) { @@ -632,7 +634,7 @@ nv::index::IDistributed_data_subset* vtknvindex_sparse_volume_importer::create( const mi::Uint32 svol_attrib_index_0 = 0u; ISparse_volume_attribute_set_descriptor::Attribute_parameters svol_attrib_param_0; - svol_attrib_param_0.format = match_volume_format(m_scalar_type); + svol_attrib_param_0.format = ::match_volume_format(m_scalar_type); if (svol_attrib_param_0.format == nv::index::SPARSE_VOLUME_VOXEL_FORMAT_COUNT) { @@ -653,7 +655,7 @@ nv::index::IDistributed_data_subset* vtknvindex_sparse_volume_importer::create( } const nv::index::Sparse_volume_voxel_format vol_fmt = svol_attrib_param_0.format; - const mi::Size vol_fmt_size = volume_format_size(vol_fmt); + const mi::Size vol_fmt_size = ::volume_format_size(vol_fmt); // Input the required data-bricks into the subset Handle svol_subset_desc( diff --git a/Plugins/pvNVIDIAIndeX/src/vtknvindex_volume_compute.cxx b/Plugins/pvNVIDIAIndeX/src/vtknvindex_volume_compute.cxx index 7a0a0ff851d140798f4579dc866cf0182c8be611..50b0457184856fceeba43f956f2517631ff05d2d 100644 --- a/Plugins/pvNVIDIAIndeX/src/vtknvindex_volume_compute.cxx +++ b/Plugins/pvNVIDIAIndeX/src/vtknvindex_volume_compute.cxx @@ -33,6 +33,8 @@ #include "vtknvindex_sparse_volume_importer.h" #include "vtknvindex_utilities.h" +namespace +{ inline mi::Sint32 volume_format_size(const nv::index::Sparse_volume_voxel_format fmt) { switch (fmt) @@ -51,6 +53,7 @@ inline mi::Sint32 volume_format_size(const nv::index::Sparse_volume_voxel_format return 0; } } +} //------------------------------------------------------------------------------------------------- vtknvindex_volume_compute::vtknvindex_volume_compute() diff --git a/Qt/ApplicationComponents/pqAutoLoadPluginXMLBehavior.cxx b/Qt/ApplicationComponents/pqAutoLoadPluginXMLBehavior.cxx index 71d136c623f302bea524b36a793495042ccffb6d..dc398e8ac40cd30f8adae802614ccce7490a5fdf 100644 --- a/Qt/ApplicationComponents/pqAutoLoadPluginXMLBehavior.cxx +++ b/Qt/ApplicationComponents/pqAutoLoadPluginXMLBehavior.cxx @@ -12,6 +12,8 @@ #include "vtkObject.h" #include +namespace +{ void getAllParaViewResourcesDirs(const QString& prefix, QSet& set) { QDir dir(prefix); @@ -31,9 +33,10 @@ void getAllParaViewResourcesDirs(const QString& prefix, QSet& set) QStringList contents = dir.entryList(QDir::AllDirs); Q_FOREACH (QString sub_dir, contents) { - getAllParaViewResourcesDirs(prefix + "/" + sub_dir, set); + ::getAllParaViewResourcesDirs(prefix + "/" + sub_dir, set); } } +} //----------------------------------------------------------------------------- pqAutoLoadPluginXMLBehavior::pqAutoLoadPluginXMLBehavior(QObject* parentObject) diff --git a/Qt/ApplicationComponents/pqBackgroundEditorWidget.cxx b/Qt/ApplicationComponents/pqBackgroundEditorWidget.cxx index ffe955276a08d47ffae8d48a5ffe8ed4db9639c7..dc619070d4a024fa83af3b41c68702f1398445ea 100644 --- a/Qt/ApplicationComponents/pqBackgroundEditorWidget.cxx +++ b/Qt/ApplicationComponents/pqBackgroundEditorWidget.cxx @@ -26,6 +26,8 @@ using pqCheckState = Qt::CheckState; using pqCheckState = int; #endif +namespace +{ const char* COLOR_PROPERTY = "Background"; const char* COLOR2_PROPERTY = "Background2"; const char* GRADIENT_BACKGROUND_PROPERTY = "UseGradientBackground"; @@ -47,11 +49,12 @@ enum BackgroundType IMAGE_TYPE, SKYBOX_TYPE }; +} class pqBackgroundEditorWidget::pqInternal : public Ui::BackgroundEditorWidget { public: - enum BackgroundType PreviousType; + enum ::BackgroundType PreviousType; pqTextureSelectorPropertyWidget* TextureSelector = nullptr; // whether the widget is customized for Environmental background settings or @@ -97,23 +100,23 @@ pqBackgroundEditorWidget::pqBackgroundEditorWidget( if (!this->Internal->ForEnvironment) { - this->addPropertyLink(ui.Color, COLOR_PROPERTY); - this->addPropertyLink(ui.Color2, COLOR2_PROPERTY); + this->addPropertyLink(ui.Color, ::COLOR_PROPERTY); + this->addPropertyLink(ui.Color2, ::COLOR2_PROPERTY); } else { - this->addPropertyLink(ui.Color, ENV_COLOR_PROPERTY); - this->addPropertyLink(ui.Color2, ENV_COLOR2_PROPERTY); + this->addPropertyLink(ui.Color, ::ENV_COLOR_PROPERTY); + this->addPropertyLink(ui.Color2, ::ENV_COLOR2_PROPERTY); } vtkSMProperty* smProperty; if (!this->Internal->ForEnvironment) { - smProperty = smGroup->GetProperty(GRADIENT_BACKGROUND_PROPERTY); + smProperty = smGroup->GetProperty(::GRADIENT_BACKGROUND_PROPERTY); } else { - smProperty = smGroup->GetProperty(ENV_GRADIENT_BACKGROUND_PROPERTY); + smProperty = smGroup->GetProperty(::ENV_GRADIENT_BACKGROUND_PROPERTY); } if (smProperty) { @@ -127,11 +130,11 @@ pqBackgroundEditorWidget::pqBackgroundEditorWidget( if (!this->Internal->ForEnvironment) { - smProperty = smGroup->GetProperty(IMAGE_BACKGROUND_PROPERTY); + smProperty = smGroup->GetProperty(::IMAGE_BACKGROUND_PROPERTY); } else { - smProperty = smGroup->GetProperty(ENV_IMAGE_BACKGROUND_PROPERTY); + smProperty = smGroup->GetProperty(::ENV_IMAGE_BACKGROUND_PROPERTY); } if (smProperty) { @@ -142,7 +145,7 @@ pqBackgroundEditorWidget::pqBackgroundEditorWidget( ui.BackgroundType->hide(); } - smProperty = smGroup->GetProperty(SKYBOX_BACKGROUND_PROPERTY); + smProperty = smGroup->GetProperty(::SKYBOX_BACKGROUND_PROPERTY); if (smProperty) { this->addPropertyLink(this, "skyboxBackground", SIGNAL(skyboxBackgroundChanged()), smProperty); @@ -155,7 +158,7 @@ pqBackgroundEditorWidget::pqBackgroundEditorWidget( } } - smProperty = smGroup->GetProperty(ENV_LIGHTING_PROPERTY); + smProperty = smGroup->GetProperty(::ENV_LIGHTING_PROPERTY); if (smProperty) { this->addPropertyLink( @@ -176,11 +179,11 @@ pqBackgroundEditorWidget::pqBackgroundEditorWidget( if (!this->Internal->ForEnvironment) { - smProperty = smGroup->GetProperty(IMAGE_PROPERTY); + smProperty = smGroup->GetProperty(::IMAGE_PROPERTY); } else { - smProperty = smGroup->GetProperty(ENV_IMAGE_PROPERTY); + smProperty = smGroup->GetProperty(::ENV_IMAGE_PROPERTY); } if (smProperty) { @@ -227,7 +230,7 @@ void pqBackgroundEditorWidget::currentIndexChangedBackgroundType(int type) ui.stackedWidget->setCurrentIndex(currentPage[type]); ui.Color->setText(colorButtonName[type]); fireGradientAndImageChanged(this->Internal->PreviousType, type); - this->Internal->PreviousType = BackgroundType(type); + this->Internal->PreviousType = ::BackgroundType(type); } bool pqBackgroundEditorWidget::gradientBackground() const @@ -237,7 +240,7 @@ bool pqBackgroundEditorWidget::gradientBackground() const void pqBackgroundEditorWidget::setGradientBackground(bool gradientValue) { - enum BackgroundType typeFunction[4][2] = { { SINGLE_COLOR_TYPE, GRADIENT_TYPE }, + enum ::BackgroundType typeFunction[4][2] = { { SINGLE_COLOR_TYPE, GRADIENT_TYPE }, { SINGLE_COLOR_TYPE, GRADIENT_TYPE }, { IMAGE_TYPE, GRADIENT_TYPE }, { SKYBOX_TYPE, GRADIENT_TYPE } }; int newType = typeFunction[this->Internal->PreviousType][gradientValue]; @@ -252,10 +255,10 @@ bool pqBackgroundEditorWidget::imageBackground() const void pqBackgroundEditorWidget::setImageBackground(bool imageValue) { - enum BackgroundType typeFunction[4][2] = { { SINGLE_COLOR_TYPE, IMAGE_TYPE }, + enum ::BackgroundType typeFunction[4][2] = { { SINGLE_COLOR_TYPE, IMAGE_TYPE }, { GRADIENT_TYPE, GRADIENT_TYPE }, // gradient has precedence over image { SINGLE_COLOR_TYPE, IMAGE_TYPE }, { SKYBOX_TYPE, IMAGE_TYPE } }; - enum BackgroundType newType = typeFunction[this->Internal->PreviousType][imageValue]; + enum ::BackgroundType newType = typeFunction[this->Internal->PreviousType][imageValue]; fireGradientAndImageChanged(this->Internal->PreviousType, newType); this->Internal->BackgroundType->setCurrentIndex(newType); } @@ -267,11 +270,11 @@ bool pqBackgroundEditorWidget::skyboxBackground() const void pqBackgroundEditorWidget::setSkyboxBackground(bool skyboxValue) { - enum BackgroundType typeFunction[4][2] = { { SINGLE_COLOR_TYPE, SKYBOX_TYPE }, + enum ::BackgroundType typeFunction[4][2] = { { SINGLE_COLOR_TYPE, SKYBOX_TYPE }, { GRADIENT_TYPE, GRADIENT_TYPE }, // gradient has precedence over skybox { IMAGE_TYPE, IMAGE_TYPE }, // image has precedence over skybox { SINGLE_COLOR_TYPE, SKYBOX_TYPE } }; - enum BackgroundType newType = typeFunction[this->Internal->PreviousType][skyboxValue]; + enum ::BackgroundType newType = typeFunction[this->Internal->PreviousType][skyboxValue]; fireGradientAndImageChanged(this->Internal->PreviousType, newType); this->Internal->BackgroundType->setCurrentIndex(newType); } @@ -309,11 +312,11 @@ void pqBackgroundEditorWidget::clickedRestoreDefaultColor() { if (!this->Internal->ForEnvironment) { - this->changeColor(COLOR_PROPERTY); + this->changeColor(::COLOR_PROPERTY); } else { - this->changeColor(ENV_COLOR_PROPERTY); + this->changeColor(::ENV_COLOR_PROPERTY); } } @@ -321,11 +324,11 @@ void pqBackgroundEditorWidget::clickedRestoreDefaultColor2() { if (!this->Internal->ForEnvironment) { - this->changeColor(COLOR2_PROPERTY); + this->changeColor(::COLOR2_PROPERTY); } else { - this->changeColor(ENV_COLOR2_PROPERTY); + this->changeColor(::ENV_COLOR2_PROPERTY); } } diff --git a/Qt/ApplicationComponents/pqChartSelectionReaction.cxx b/Qt/ApplicationComponents/pqChartSelectionReaction.cxx index c8047d297c45ff751acca3fef6c1e1852fea28b4..a3bc0e679aa3b0f6dfb773c6228a067c7bd05e84 100644 --- a/Qt/ApplicationComponents/pqChartSelectionReaction.cxx +++ b/Qt/ApplicationComponents/pqChartSelectionReaction.cxx @@ -49,6 +49,8 @@ pqChartSelectionReaction::pqChartSelectionReaction( } //----------------------------------------------------------------------------- +namespace +{ inline void setChartParameters(pqContextView* view, int selectionType, bool update_type, int selectionModifier, bool update_modifier) { @@ -86,6 +88,7 @@ inline void setChartParameters(pqContextView* view, int selectionType, bool upda } } } +} //----------------------------------------------------------------------------- void pqChartSelectionReaction::startSelection( diff --git a/Qt/ApplicationComponents/pqModelTransformSupportBehavior.cxx b/Qt/ApplicationComponents/pqModelTransformSupportBehavior.cxx index ba414af12d1fb1a5c1ac0a539f0d87f449afaf5b..db277945f883ff71da1daf58ac1343f045c711ab 100644 --- a/Qt/ApplicationComponents/pqModelTransformSupportBehavior.cxx +++ b/Qt/ApplicationComponents/pqModelTransformSupportBehavior.cxx @@ -107,7 +107,7 @@ void pqModelTransformSupportBehavior::viewUpdated() // Check if there is any data source visible in the view that has a // ChangeOfBasisMatrix and BoundingBoxInModelCoordinates specified. - if (vtkSMSourceProxy* producer = FindVisibleProducerWithChangeOfBasisMatrix(view)) + if (vtkSMSourceProxy* producer = ::FindVisibleProducerWithChangeOfBasisMatrix(view)) { this->enableModelTransform(view, producer); } @@ -134,16 +134,16 @@ void pqModelTransformSupportBehavior::enableModelTransform(pqView* view, vtkSMSo if (are_titles_valid) { - SafeSetAxisTitle(gridAxes3DActor, "XTitle", titles[0].c_str()); - SafeSetAxisTitle(gridAxes3DActor, "YTitle", titles[1].c_str()); - SafeSetAxisTitle(gridAxes3DActor, "ZTitle", titles[2].c_str()); + ::SafeSetAxisTitle(gridAxes3DActor, "XTitle", titles[0].c_str()); + ::SafeSetAxisTitle(gridAxes3DActor, "YTitle", titles[1].c_str()); + ::SafeSetAxisTitle(gridAxes3DActor, "ZTitle", titles[2].c_str()); } else { // clear data-dependent axis titles. - SafeSetAxisTitle(gridAxes3DActor, "XTitle", nullptr); - SafeSetAxisTitle(gridAxes3DActor, "YTitle", nullptr); - SafeSetAxisTitle(gridAxes3DActor, "ZTitle", nullptr); + ::SafeSetAxisTitle(gridAxes3DActor, "XTitle", nullptr); + ::SafeSetAxisTitle(gridAxes3DActor, "YTitle", nullptr); + ::SafeSetAxisTitle(gridAxes3DActor, "ZTitle", nullptr); } gridAxes3DActor->UpdateVTKObjects(); } @@ -169,14 +169,16 @@ void pqModelTransformSupportBehavior::disableModelTransform(pqView* view) { helper.Set(0); } - SafeSetAxisTitle(gridAxes3DActor, "XTitle", nullptr); - SafeSetAxisTitle(gridAxes3DActor, "YTitle", nullptr); - SafeSetAxisTitle(gridAxes3DActor, "ZTitle", nullptr); + ::SafeSetAxisTitle(gridAxes3DActor, "XTitle", nullptr); + ::SafeSetAxisTitle(gridAxes3DActor, "YTitle", nullptr); + ::SafeSetAxisTitle(gridAxes3DActor, "ZTitle", nullptr); gridAxes3DActor->UpdateVTKObjects(); } } //----------------------------------------------------------------------------- +namespace +{ template vtkTuple GetValues(const char* aname, vtkSMSourceProxy* producer, int port, bool* pisvalid) { @@ -200,6 +202,7 @@ vtkTuple GetValues(const char* aname, vtkSMSourceProxy* producer, int p } return value; } +} //----------------------------------------------------------------------------- vtkTuple pqModelTransformSupportBehavior::getChangeOfBasisMatrix( diff --git a/Qt/ApplicationComponents/pqSourcesMenuReaction.cxx b/Qt/ApplicationComponents/pqSourcesMenuReaction.cxx index 3732e02886a4526e6f432d8e7ab4edbd46d9e87c..ee42e1e94107de16fe6ace32058279ec2aea8a7f 100644 --- a/Qt/ApplicationComponents/pqSourcesMenuReaction.cxx +++ b/Qt/ApplicationComponents/pqSourcesMenuReaction.cxx @@ -23,6 +23,8 @@ #include +#include + //----------------------------------------------------------------------------- pqSourcesMenuReaction::pqSourcesMenuReaction(pqProxyGroupMenuManager* menuManager) : Superclass(menuManager) @@ -116,10 +118,7 @@ bool pqSourcesMenuReaction::warnOnCreate( continue; } long long remainingMemory = hostMemoryAvailable - hostMemoryUse; - if (remainingMemory < worstRemainingMemory) - { - worstRemainingMemory = remainingMemory; - } + worstRemainingMemory = std::min(remainingMemory, worstRemainingMemory); } // Compare with the input size diff --git a/Qt/Components/Testing/Cxx/TabbedMultiViewWidgetFilteringApp.cxx b/Qt/Components/Testing/Cxx/TabbedMultiViewWidgetFilteringApp.cxx index e7b6a0ff33f9792b80d1e8f8d97208fc120a3700..98c212420d7fa29d13827e69d46dca1c15089026 100644 --- a/Qt/Components/Testing/Cxx/TabbedMultiViewWidgetFilteringApp.cxx +++ b/Qt/Components/Testing/Cxx/TabbedMultiViewWidgetFilteringApp.cxx @@ -125,7 +125,7 @@ private: } // end of namespace -int TabbedMultiViewWidgetFilteringApp(int argc, char* argv[]) +extern int TabbedMultiViewWidgetFilteringApp(int argc, char* argv[]) { QApplication app(argc, argv); pqApplicationCore appCore(argc, argv); diff --git a/Qt/Components/pqAboutDialog.cxx b/Qt/Components/pqAboutDialog.cxx index b164e63bd44b8cd9bc253b91dea4bc875ee3e11c..e74f1e6a3fb03bade7b84fdb12526d6298447317 100644 --- a/Qt/Components/pqAboutDialog.cxx +++ b/Qt/Components/pqAboutDialog.cxx @@ -67,6 +67,8 @@ pqAboutDialog::~pqAboutDialog() } //----------------------------------------------------------------------------- +namespace +{ inline void addItem(QTreeWidget* tree, const QString& key, const QString& value) { QTreeWidgetItem* item = new QTreeWidgetItem(tree); @@ -77,6 +79,7 @@ inline void addItem(QTreeWidget* tree, const QString& key, int value) { ::addItem(tree, key, QString("%1").arg(value)); } +} //----------------------------------------------------------------------------- void pqAboutDialog::AddClientInformation() diff --git a/Qt/Components/pqComparativeVisPanel.cxx b/Qt/Components/pqComparativeVisPanel.cxx index bbf87074c635153e6712f9a1560736c05432ebfc..015072674d2fc02c616ca1037daecbd4e31b23ce 100644 --- a/Qt/Components/pqComparativeVisPanel.cxx +++ b/Qt/Components/pqComparativeVisPanel.cxx @@ -43,7 +43,7 @@ public: pqPropertyLinks Links; }; -namespace pqComparativeVisPanelNS +namespace { enum { @@ -296,9 +296,8 @@ void pqComparativeVisPanel::updateParametersList() vtkSMPropertyHelper(cues.GetAsProxy(cc), "AnimatedPropertyName").GetAsString(); int pindex = vtkSMPropertyHelper(cues.GetAsProxy(cc), "AnimatedElement").GetAsInt(); - QTableWidgetItem* item = pqComparativeVisPanelNS::newItem(curProxy, pname, pindex); - item->setData(pqComparativeVisPanelNS::CUE_PROXY, - QVariant::fromValue(pqSMProxy(cues.GetAsProxy(cc)))); + QTableWidgetItem* item = ::newItem(curProxy, pname, pindex); + item->setData(::CUE_PROXY, QVariant::fromValue(pqSMProxy(cues.GetAsProxy(cc)))); this->Internal->activeParameters->setItem(static_cast(cc), 0, item); QTableWidgetItem* headerItem = @@ -334,10 +333,9 @@ void pqComparativeVisPanel::addParameter() if (realProxy) { - BEGIN_UNDO_SET( - tr("Add parameter %1 : %2") - .arg(pqComparativeVisPanelNS::getName(realProxy)) - .arg(pqComparativeVisPanelNS::getName(realProxy, pname.toUtf8().data(), pindex))); + BEGIN_UNDO_SET(tr("Add parameter %1 : %2") + .arg(::getName(realProxy)) + .arg(::getName(realProxy, pname.toUtf8().data(), pindex))); } else { @@ -345,7 +343,7 @@ void pqComparativeVisPanel::addParameter() } // Add new cue. - vtkSMProxy* cueProxy = pqComparativeVisPanelNS::newCue(realProxy, pname.toUtf8().data(), pindex); + vtkSMProxy* cueProxy = ::newCue(realProxy, pname.toUtf8().data(), pindex); vtkSMPropertyHelper(this->view()->getProxy(), "Cues").Add(cueProxy); cueProxy->Delete(); this->view()->getProxy()->UpdateVTKObjects(); @@ -361,10 +359,8 @@ int pqComparativeVisPanel::findRow( for (int cc = 0; cc < this->Internal->activeParameters->rowCount(); cc++) { QTableWidgetItem* item = this->Internal->activeParameters->item(cc, 0); - if (item->data(pqComparativeVisPanelNS::PROXY).value().GetPointer() == - animatedProxy && - item->data(pqComparativeVisPanelNS::PROPERTY_NAME) == animatedPName && - item->data(pqComparativeVisPanelNS::PROPERTY_INDEX) == animatedIndex) + if (item->data(::PROXY).value().GetPointer() == animatedProxy && + item->data(::PROPERTY_NAME) == animatedPName && item->data(::PROPERTY_INDEX) == animatedIndex) { return cc; } @@ -378,8 +374,7 @@ void pqComparativeVisPanel::parameterSelectionChanged() QTableWidgetItem* activeItem = this->Internal->activeParameters->currentItem(); if (activeItem) { - vtkSMProxy* cue = - activeItem->data(pqComparativeVisPanelNS::CUE_PROXY).value().GetPointer(); + vtkSMProxy* cue = activeItem->data(::CUE_PROXY).value().GetPointer(); this->Internal->cueGroup->setTitle(activeItem->text()); this->Internal->cueWidget->setCue(cue); this->Internal->multivalueHint->setVisible(this->Internal->cueWidget->acceptsMultipleValues()); @@ -416,8 +411,7 @@ void pqComparativeVisPanel::removeParameter(int index) BEGIN_UNDO_SET(tr("Remove Parameter")); vtkSMSessionProxyManager* pxm = this->view()->proxyManager(); - vtkSmartPointer cue = - item->data(pqComparativeVisPanelNS::CUE_PROXY).value().GetPointer(); + vtkSmartPointer cue = item->data(::CUE_PROXY).value().GetPointer(); item = nullptr; vtkSMPropertyHelper(this->view()->getProxy(), "Cues").Remove(cue); diff --git a/Qt/Components/pqCustomFilterDefinitionModel.cxx b/Qt/Components/pqCustomFilterDefinitionModel.cxx index 0273dcf7119c468877ee6ba6b48ff8e3d36be2a1..6ee8bb094c7b9ecfb5bc07c2670747287c2ca437 100644 --- a/Qt/Components/pqCustomFilterDefinitionModel.cxx +++ b/Qt/Components/pqCustomFilterDefinitionModel.cxx @@ -156,28 +156,31 @@ pqPipelineSource* pqCustomFilterDefinitionModelLink::GetPipelineSource() const //----------------------------------------------------------------------------- pqCustomFilterDefinitionModel::pqCustomFilterDefinitionModel(QObject* parentObject) : QAbstractItemModel(parentObject) +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + , PixmapList(pqCustomFilterDefinitionModel::LastType + 1) +#endif { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + for (int i = pqCustomFilterDefinitionModel::Source; i <= pqCustomFilterDefinitionModel::LastType; + ++i) + { + this->PixmapList.append(QPixmap()); + } +#endif + this->Root = new pqCustomFilterDefinitionModelItem(); // Initialize the pixmap list. - this->PixmapList = new QPixmap[pqCustomFilterDefinitionModel::LastType + 1]; - if (this->PixmapList) - { - this->PixmapList[pqCustomFilterDefinitionModel::Source].load( - ":/pqWidgets/Icons/pqSource16.png"); - this->PixmapList[pqCustomFilterDefinitionModel::Filter].load( - ":/pqWidgets/Icons/pqFilter16.png"); - this->PixmapList[pqCustomFilterDefinitionModel::CustomFilter].load( - ":/pqWidgets/Icons/pqBundle16.png"); - this->PixmapList[pqCustomFilterDefinitionModel::Link].load( - ":/pqWidgets/Icons/pqLinkBack16.png"); - } + this->PixmapList[pqCustomFilterDefinitionModel::Source].load(":/pqWidgets/Icons/pqSource16.png"); + this->PixmapList[pqCustomFilterDefinitionModel::Filter].load(":/pqWidgets/Icons/pqFilter16.png"); + this->PixmapList[pqCustomFilterDefinitionModel::CustomFilter].load( + ":/pqWidgets/Icons/pqBundle16.png"); + this->PixmapList[pqCustomFilterDefinitionModel::Link].load(":/pqWidgets/Icons/pqLinkBack16.png"); } pqCustomFilterDefinitionModel::~pqCustomFilterDefinitionModel() { delete this->Root; - delete[] this->PixmapList; } int pqCustomFilterDefinitionModel::rowCount(const QModelIndex& parentIndex) const @@ -246,8 +249,7 @@ QVariant pqCustomFilterDefinitionModel::data(const QModelIndex& idx, int role) c } case Qt::DecorationRole: { - if (idx.column() == 0 && this->PixmapList && - item->Type != pqCustomFilterDefinitionModel::Invalid) + if (idx.column() == 0 && item->Type != pqCustomFilterDefinitionModel::Invalid) { return QVariant(this->PixmapList[item->Type]); } diff --git a/Qt/Components/pqCustomFilterDefinitionModel.h b/Qt/Components/pqCustomFilterDefinitionModel.h index aeee07b6864dae63a27260e529d8b091e6a2be51..5a3975ac0f5f508fed6df1174202fb9166685de7 100644 --- a/Qt/Components/pqCustomFilterDefinitionModel.h +++ b/Qt/Components/pqCustomFilterDefinitionModel.h @@ -171,7 +171,7 @@ private: pqCustomFilterDefinitionModelItem* getNextItem(pqCustomFilterDefinitionModelItem* item) const; pqCustomFilterDefinitionModelItem* Root; ///< The root of the model tree. - QPixmap* PixmapList; ///< Stores the item icons. + QList PixmapList; ///< Stores the item icons. }; #endif diff --git a/Qt/Components/pqCustomFilterDefinitionWizard.cxx b/Qt/Components/pqCustomFilterDefinitionWizard.cxx index acd7bd99e19017a5557a41c4585586b39e5ffc58..3bf204de525c099770c1cf222081d0bc921f2591 100644 --- a/Qt/Components/pqCustomFilterDefinitionWizard.cxx +++ b/Qt/Components/pqCustomFilterDefinitionWizard.cxx @@ -30,6 +30,8 @@ #include "vtkSMSessionProxyManager.h" #include "vtkSmartPointer.h" +#include + class pqCustomFilterDefinitionWizardForm : public Ui::pqCustomFilterDefinitionWizard { public: @@ -640,10 +642,7 @@ void pqCustomFilterDefinitionWizard::removeInput() QString key = QString("INPUT:%1.%2").arg(item->text(0)).arg(item->text(1)); this->Form->ToExposeNames.removeAll(key); delete item; - if (row < 0) - { - row = 0; - } + row = std::max(row, 0); item = this->Form->InputPorts->topLevelItem(row); if (item) @@ -793,10 +792,7 @@ void pqCustomFilterDefinitionWizard::removeOutput() QString key = QString("OUTPUT:%1 (%2)").arg(source->getSMName()).arg(port->getPortNumber()); this->Form->ToExposeNames.removeAll(key); delete item; - if (row < 0) - { - row = 0; - } + row = std::max(row, 0); item = this->Form->OutputPorts->topLevelItem(row); if (item) @@ -928,10 +924,7 @@ void pqCustomFilterDefinitionWizard::removeProperty() QString key = QString("INPUT:%1.%2").arg(item->text(0)).arg(item->text(1)); this->Form->ToExposeNames.removeAll(key); delete item; - if (row < 0) - { - row = 0; - } + row = std::max(row, 0); item = this->Form->PropertyList->topLevelItem(row); if (item) diff --git a/Qt/Components/pqPluginTreeWidgetEventPlayer.cxx b/Qt/Components/pqPluginTreeWidgetEventPlayer.cxx index ae00cfc7ad6d294dd3a8ba66f54d7b4b683412c2..4acb78b1e287944b645013dd3fb963516ee3a3fa 100644 --- a/Qt/Components/pqPluginTreeWidgetEventPlayer.cxx +++ b/Qt/Components/pqPluginTreeWidgetEventPlayer.cxx @@ -20,6 +20,8 @@ pqPluginTreeWidgetEventPlayer::pqPluginTreeWidgetEventPlayer(QObject* parentObje //----------------------------------------------------------------------------- pqPluginTreeWidgetEventPlayer::~pqPluginTreeWidgetEventPlayer() = default; +namespace +{ //----------------------------------------------------------------------------- QModelIndex pqPluginTreeWidgetEventPlayerGetIndex( const QString& str_index, QTreeView* treeView, bool& error) @@ -61,6 +63,7 @@ QModelIndex pqTreeViewEventPlayerGetIndexByColumnValue( qCritical() << "ERROR: Failed to find column with data '" << columnValue << "'"; return QModelIndex(); } +} //-----------------------------------------------------------------------------0000000 bool pqPluginTreeWidgetEventPlayer::playEvent( diff --git a/Qt/Components/pqRecentFilesMenu.cxx b/Qt/Components/pqRecentFilesMenu.cxx index b1bbab3dee38738d351bcf3158ef439bc5571640..ac559ffe2092caffdfbe69038444b472a8f382fc 100644 --- a/Qt/Components/pqRecentFilesMenu.cxx +++ b/Qt/Components/pqRecentFilesMenu.cxx @@ -24,23 +24,8 @@ #include //============================================================================= -namespace rfm +namespace { -bool canLoad( - const QList& ifaces, const pqServerResource& resource) -{ - // using Q_FOREACH here was causing failures on VS - for (int cc = 0, max = ifaces.size(); cc < max; ++cc) - { - pqRecentlyUsedResourceLoaderInterface* iface = ifaces[cc]; - if (iface->canLoad(resource)) - { - return true; - } - } - return false; -} - bool iconAndLabel(const QList& ifaces, const pqServerResource& resource, QIcon& icon, QString& label) { @@ -161,7 +146,7 @@ void pqRecentFilesMenu::buildMenu() const pqServerResource& item = criter.value()[kk]; QString label; QIcon icon; - if (rfm::iconAndLabel(ifaces, item, icon, label)) + if (::iconAndLabel(ifaces, item, icon, label)) { QAction* const act = new QAction(label, this->Menu); act->setData(item.serializeString()); @@ -235,7 +220,7 @@ bool pqRecentFilesMenu::open(pqServer* server, const pqServerResource& resource) pqInterfaceTracker* itk = pqApplicationCore::instance()->interfaceTracker(); QList ifaces = itk->interfaces(); - if (rfm::load(ifaces, resource, server)) + if (::load(ifaces, resource, server)) { pqRecentlyUsedResourcesList& mruList = pqApplicationCore::instance()->recentlyUsedResources(); mruList.add(resource); diff --git a/Qt/Components/pqRemoteCommandDialog.cxx b/Qt/Components/pqRemoteCommandDialog.cxx index 08f0a675abe509b9c24e5866fa5faee089b0c3a0..6ae0af3373f2fece9560849070ffdda77c44c5cc 100644 --- a/Qt/Components/pqRemoteCommandDialog.cxx +++ b/Qt/Components/pqRemoteCommandDialog.cxx @@ -36,6 +36,8 @@ class pqRemoteCommandDialogUI : public Ui::pqRemoteCommandDialogForm { }; +namespace +{ // command token map, the following tokens may be provided by // the user to be substituted into the selected command template // at run time. @@ -52,6 +54,7 @@ enum const char* tokens[] = { "$TERM_EXEC$", "$TERM_OPTS$", "$SSH_EXEC$", "$FE_URL$", "$PV_HOST$", "$PV_PID$" }; +} // a command set is selected based on host system types. // client | server | descr @@ -262,7 +265,7 @@ pqRemoteCommandDialog::pqRemoteCommandDialog( this->Tokens.resize(N_TOKENS); for (int i = 0; i < N_TOKENS; ++i) { - this->Tokens[i] = tokens[i]; + this->Tokens[i] = ::tokens[i]; } this->TokenValues.resize(N_TOKENS); @@ -402,11 +405,11 @@ void pqRemoteCommandDialog::SetActivePid(string pid) void pqRemoteCommandDialog::AddCommandTemplate() { // remind the user of the available tokens. - QString toks(tokens[0]); + QString toks(::tokens[0]); for (int i = 1; i < N_TOKENS; ++i) { toks += " "; - toks += tokens[i]; + toks += ::tokens[i]; } pqRemoteCommandTemplateDialog dialog(this, Qt::WindowFlags{}); diff --git a/Qt/Components/pqSignalAdaptorSelectionTreeWidget.cxx b/Qt/Components/pqSignalAdaptorSelectionTreeWidget.cxx index 7aa3d1561aeba2da55786246ef739ba1d4cf1b97..61eb86be49116c7b80ed9d344fa3bf32406558d6 100644 --- a/Qt/Components/pqSignalAdaptorSelectionTreeWidget.cxx +++ b/Qt/Components/pqSignalAdaptorSelectionTreeWidget.cxx @@ -17,6 +17,8 @@ #include "pqSMAdaptor.h" +#include + //----------------------------------------------------------------------------- class pqSignalAdaptorSelectionTreeWidget::pqInternal { @@ -105,10 +107,7 @@ void pqSignalAdaptorSelectionTreeWidget::setValues(const QList>& bool old_bs = this->blockSignals(true); int max = this->Internal->TreeWidget->topLevelItemCount(); - if (new_values.size() < max) - { - max = new_values.size(); - } + max = std::min(new_values.size(), max); bool changed = false; for (int cc = 0; cc < max; cc++) diff --git a/Qt/Core/Testing/Cxx/LogViewerWidget.cxx b/Qt/Core/Testing/Cxx/LogViewerWidget.cxx index ed55467ccccd13af9b23cbc74fbf6d736c9b2ea6..7962340e65d693bc27ced2ac5983b30927f89663 100644 --- a/Qt/Core/Testing/Cxx/LogViewerWidget.cxx +++ b/Qt/Core/Testing/Cxx/LogViewerWidget.cxx @@ -338,7 +338,7 @@ void LogViewerWidgetTester::basic() } } -int LogViewerWidget(int argc, char* argv[]) +extern int LogViewerWidget(int argc, char* argv[]) { QApplication app(argc, argv); LogViewerWidgetTester tester; diff --git a/Qt/Core/pqCoreTestUtility.cxx b/Qt/Core/pqCoreTestUtility.cxx index 7df2623ef0351b48519ff0e1f79f5247d3d4e45a..ba0d965f8c116664782131baa362b9df74956c06 100644 --- a/Qt/Core/pqCoreTestUtility.cxx +++ b/Qt/Core/pqCoreTestUtility.cxx @@ -75,7 +75,9 @@ const char* pqCoreTestUtility::PQ_COMPAREVIEW_PROPERTY_NAME = "PQ_COMPAREVIEW_PROPERTY_NAME"; -static constexpr const char* DASHBOARD_MODE_ENV_VAR = "DASHBOARD_TEST_FROM_CTEST"; +namespace +{ +constexpr const char* DASHBOARD_MODE_ENV_VAR = "DASHBOARD_TEST_FROM_CTEST"; template bool saveImage(vtkWindowToImageFilter* Capture, const QFileInfo& File) @@ -89,6 +91,7 @@ bool saveImage(vtkWindowToImageFilter* Capture, const QFileInfo& File) return result; } +} ///////////////////////////////////////////////////////////////////////////// // pqCoreTestUtility @@ -127,7 +130,7 @@ pqCoreTestUtility::pqCoreTestUtility(QObject* p) //----------------------------------------------------------------------------- void pqCoreTestUtility::updatePlayers() { - if (vtksys::SystemTools::HasEnv(DASHBOARD_MODE_ENV_VAR)) + if (vtksys::SystemTools::HasEnv(::DASHBOARD_MODE_ENV_VAR)) { // Safe to add multiple times this->eventPlayer()->addWidgetEventPlayer(new pqFileDialogEventPlayer(this)); @@ -141,7 +144,7 @@ void pqCoreTestUtility::updatePlayers() //----------------------------------------------------------------------------- void pqCoreTestUtility::updateTranslators() { - if (vtksys::SystemTools::HasEnv(DASHBOARD_MODE_ENV_VAR)) + if (vtksys::SystemTools::HasEnv(::DASHBOARD_MODE_ENV_VAR)) { // Safe to add multiple times this->eventTranslator()->addWidgetEventTranslator(new pqFileDialogEventTranslator(this)); @@ -227,15 +230,15 @@ bool pqCoreTestUtility::SaveScreenshot(vtkRenderWindow* RenderWindow, const QStr const QFileInfo file(File); if (file.completeSuffix() == "bmp") - success = saveImage(capture, file); + success = ::saveImage(capture, file); else if (file.completeSuffix() == "tif") - success = saveImage(capture, file); + success = ::saveImage(capture, file); else if (file.completeSuffix() == "ppm") - success = saveImage(capture, file); + success = ::saveImage(capture, file); else if (file.completeSuffix() == "png") - success = saveImage(capture, file); + success = ::saveImage(capture, file); else if (file.completeSuffix() == "jpg") - success = saveImage(capture, file); + success = ::saveImage(capture, file); capture->Delete(); @@ -483,11 +486,11 @@ void pqCoreTestUtility::setDashboardMode(bool value) { if (value) { - qputenv(DASHBOARD_MODE_ENV_VAR, "1"); + qputenv(::DASHBOARD_MODE_ENV_VAR, "1"); } else { - qunsetenv(DASHBOARD_MODE_ENV_VAR); + qunsetenv(::DASHBOARD_MODE_ENV_VAR); } this->updatePlayers(); this->updateTranslators(); diff --git a/Qt/Core/pqKeyEventFilter.cxx b/Qt/Core/pqKeyEventFilter.cxx index 407f0d8b4cf3151dec0cf562551cce3e2f75143f..84f907b8fb353b3e1210c6b583a5ccf6a6a78217 100644 --- a/Qt/Core/pqKeyEventFilter.cxx +++ b/Qt/Core/pqKeyEventFilter.cxx @@ -6,7 +6,7 @@ #include #include -namespace constant +namespace { QList AcceptList = { Qt::Key_Enter, Qt::Key_Return }; QList RejectList = { Qt::Key_Escape }; @@ -60,13 +60,13 @@ bool pqKeyEventFilter::shouldHandle(QObject* monitored, int type) //----------------------------------------------------------------------------- bool pqKeyEventFilter::isAcceptType(int key) { - return constant::AcceptList.contains(key); + return ::AcceptList.contains(key); } //----------------------------------------------------------------------------- bool pqKeyEventFilter::isRejectType(int key) { - return constant::RejectList.contains(key); + return ::RejectList.contains(key); } //----------------------------------------------------------------------------- @@ -78,7 +78,7 @@ bool pqKeyEventFilter::isTextUpdateType(QChar key) //----------------------------------------------------------------------------- bool pqKeyEventFilter::isMotionType(int key) { - return constant::MotionList.contains(key); + return ::MotionList.contains(key); } //----------------------------------------------------------------------------- diff --git a/Qt/Core/pqObjectBuilder.cxx b/Qt/Core/pqObjectBuilder.cxx index 25e87b68a3493f3fbbeadae0be400603dc84ba63..b0f513f59b74232c5ab4b347a795f5ed7e46b990 100644 --- a/Qt/Core/pqObjectBuilder.cxx +++ b/Qt/Core/pqObjectBuilder.cxx @@ -59,10 +59,10 @@ #include #include -namespace pqObjectBuilderNS +namespace { -static bool ContinueWaiting = true; -static bool processEvents() +bool ContinueWaiting = true; +bool processEvents() { QApplication::processEvents(); return ContinueWaiting; @@ -147,13 +147,13 @@ pqPipelineSource* pqObjectBuilder::createSource( vtkSMSessionProxyManager* pxm = server->proxyManager(); vtkSmartPointer proxy; proxy.TakeReference(pxm->NewProxy(sm_group.toUtf8().data(), sm_name.toUtf8().data())); - if (!pqObjectBuilderNS::preCreatePipelineProxy(controller, proxy)) + if (!::preCreatePipelineProxy(controller, proxy)) { return nullptr; } - pqPipelineSource* source = pqObjectBuilderNS::postCreatePipelineProxy( - controller, proxy, server, pqObjectBuilderNS::recoverRegistrationName(proxy)); + pqPipelineSource* source = + ::postCreatePipelineProxy(controller, proxy, server, ::recoverRegistrationName(proxy)); Q_EMIT this->sourceCreated(source); Q_EMIT this->proxyCreated(source); return source; @@ -167,7 +167,7 @@ pqPipelineSource* pqObjectBuilder::createFilter(const QString& sm_group, const Q vtkSMSessionProxyManager* pxm = server->proxyManager(); vtkSmartPointer proxy; proxy.TakeReference(pxm->NewProxy(sm_group.toUtf8().data(), sm_name.toUtf8().data())); - if (!pqObjectBuilderNS::preCreatePipelineProxy(controller, proxy)) + if (!::preCreatePipelineProxy(controller, proxy)) { return nullptr; } @@ -193,8 +193,8 @@ pqPipelineSource* pqObjectBuilder::createFilter(const QString& sm_group, const Q } } - pqPipelineSource* filter = pqObjectBuilderNS::postCreatePipelineProxy( - controller, proxy, server, pqObjectBuilderNS::recoverRegistrationName(proxy)); + pqPipelineSource* filter = + ::postCreatePipelineProxy(controller, proxy, server, ::recoverRegistrationName(proxy)); Q_EMIT this->filterCreated(filter); Q_EMIT this->proxyCreated(filter); return filter; @@ -213,6 +213,8 @@ pqPipelineSource* pqObjectBuilder::createFilter( } //----------------------------------------------------------------------------- +namespace +{ inline QString pqObjectBuilderGetPath(const QString& filename, bool use_dir) { if (use_dir) @@ -221,6 +223,7 @@ inline QString pqObjectBuilderGetPath(const QString& filename, bool use_dir) } return filename; } +} //----------------------------------------------------------------------------- pqPipelineSource* pqObjectBuilder::createReader( @@ -240,7 +243,7 @@ pqPipelineSource* pqObjectBuilder::createReader( vtkSMSessionProxyManager* pxm = server->proxyManager(); vtkSmartPointer proxy; proxy.TakeReference(pxm->NewProxy(sm_group.toUtf8().data(), sm_name.toUtf8().data())); - if (!pqObjectBuilderNS::preCreatePipelineProxy(controller, proxy)) + if (!::preCreatePipelineProxy(controller, proxy)) { return nullptr; } @@ -265,28 +268,27 @@ pqPipelineSource* pqObjectBuilder::createReader( if (files.size() == 1 || !prop->GetRepeatCommand()) { - pqSMAdaptor::setElementProperty(prop, pqObjectBuilderGetPath(files[0], use_dir)); + pqSMAdaptor::setElementProperty(prop, ::pqObjectBuilderGetPath(files[0], use_dir)); } else { QList values; Q_FOREACH (QString file, files) { - values.push_back(pqObjectBuilderGetPath(file, use_dir)); + values.push_back(::pqObjectBuilderGetPath(file, use_dir)); } pqSMAdaptor::setMultipleElementProperty(prop, values); } proxy->UpdateVTKObjects(); } - QString regName = pqObjectBuilderNS::recoverRegistrationName(proxy); + QString regName = ::recoverRegistrationName(proxy); if (regName.isEmpty()) { regName = fileRegName; } - pqPipelineSource* reader = - pqObjectBuilderNS::postCreatePipelineProxy(controller, proxy, server, regName); + pqPipelineSource* reader = ::postCreatePipelineProxy(controller, proxy, server, regName); Q_EMIT this->readerCreated(reader, files[0]); Q_EMIT this->readerCreated(reader, files); Q_EMIT this->sourceCreated(reader); @@ -336,7 +338,7 @@ pqView* pqObjectBuilder::createView(const QString& type, pqServer* server) // this by setting up layouts, etc. Q_EMIT this->aboutToCreateView(server); - QString regName = pqObjectBuilderNS::recoverRegistrationName(proxy); + QString regName = ::recoverRegistrationName(proxy); vtkNew controller; controller->PreInitializeProxy(proxy); @@ -423,7 +425,7 @@ pqDataRepresentation* pqObjectBuilder::createDataRepresentation( vtkNew controller; controller->PreInitializeProxy(reprProxy); - QString regName = pqObjectBuilderNS::recoverRegistrationName(reprProxy); + QString regName = ::recoverRegistrationName(reprProxy); // Set the reprProxy's input. pqSMAdaptor::setInputProperty( @@ -477,8 +479,8 @@ vtkSMProxy* pqObjectBuilder::createProxy( proxy->SetPrototype(true); } - pxm->RegisterProxy(reg_group.toUtf8().data(), - pqObjectBuilderNS::recoverRegistrationName(proxy).toUtf8().data(), proxy); + pxm->RegisterProxy( + reg_group.toUtf8().data(), ::recoverRegistrationName(proxy).toUtf8().data(), proxy); return proxy; } @@ -617,7 +619,7 @@ bool pqObjectBuilder::forceWaitingForConnection(bool force) //----------------------------------------------------------------------------- void pqObjectBuilder::abortPendingConnections() { - pqObjectBuilderNS::ContinueWaiting = false; + ::ContinueWaiting = false; } //----------------------------------------------------------------------------- @@ -633,7 +635,7 @@ pqServer* pqObjectBuilder::createServer(const pqServerResource& resource, int co SCOPED_UNDO_EXCLUDE(); - pqObjectBuilderNS::ContinueWaiting = true; + ::ContinueWaiting = true; pqServerManagerModel* smModel = pqApplicationCore::instance()->getServerManagerModel(); @@ -684,25 +686,23 @@ pqServer* pqObjectBuilder::createServer(const pqServerResource& resource, int co else if (resource.scheme() == "cs") { id = vtkSMSession::ConnectToRemote(resource.host().toUtf8().data(), resource.port(11111), - connectionTimeout, &pqObjectBuilderNS::processEvents, result); + connectionTimeout, &::processEvents, result); } else if (resource.scheme() == "csrc") { id = vtkSMSession::ReverseConnectToRemote( - resource.port(11111), connectionTimeout, &pqObjectBuilderNS::processEvents, result); + resource.port(11111), connectionTimeout, &::processEvents, result); } else if (resource.scheme() == "cdsrs") { id = vtkSMSession::ConnectToRemote(resource.dataServerHost().toUtf8().data(), resource.dataServerPort(11111), resource.renderServerHost().toUtf8().data(), - resource.renderServerPort(22221), connectionTimeout, &pqObjectBuilderNS::processEvents, - result); + resource.renderServerPort(22221), connectionTimeout, &::processEvents, result); } else if (resource.scheme() == "cdsrsrc") { id = vtkSMSession::ReverseConnectToRemote(resource.dataServerPort(11111), - resource.renderServerPort(22221), connectionTimeout, &pqObjectBuilderNS::processEvents, - result); + resource.renderServerPort(22221), connectionTimeout, &::processEvents, result); } else if (resource.scheme() == "catalyst") { diff --git a/Qt/Core/pqPipelineFilter.cxx b/Qt/Core/pqPipelineFilter.cxx index 8b27dd4dc3c1bfb66bfe402901cc2450c34e973c..1c595bb0717cda9b3da8c8b925b46c9688988dce 100644 --- a/Qt/Core/pqPipelineFilter.cxx +++ b/Qt/Core/pqPipelineFilter.cxx @@ -31,11 +31,6 @@ #include "pqOutputPort.h" #include "pqServerManagerModel.h" -uint qHash(QPair, int> arg) -{ - return qHash(static_cast(arg.first)) + qHash(arg.second); -} - //----------------------------------------------------------------------------- class pqPipelineFilter::pqInternal { diff --git a/Qt/Core/pqSpreadSheetViewModel.cxx b/Qt/Core/pqSpreadSheetViewModel.cxx index 784acc5bd51a05d2fd14bd0d7cf29d57f407d4ea..b2b9c16a87b47239bb870043f7ae42594c57603a 100644 --- a/Qt/Core/pqSpreadSheetViewModel.cxx +++ b/Qt/Core/pqSpreadSheetViewModel.cxx @@ -39,6 +39,7 @@ #include "pqPipelineSource.h" #include "pqTimer.h" +#include #include static uint qHash(pqSpreadSheetViewModel::vtkIndex index) @@ -238,10 +239,7 @@ void pqSpreadSheetViewModel::onDataFetched(vtkObject*, unsigned long, void*, voi // visible viewport is always updated. vtkIdType rowMin = blockSize * block - 1; vtkIdType rowMax = blockSize * (block + 1); - if (rowMin < 0) - { - rowMin = 0; - } + rowMin = std::max(rowMin, 0); if (rowMax >= this->rowCount()) { diff --git a/Qt/Core/pqView.cxx b/Qt/Core/pqView.cxx index 43899fb89dba8705e80af14ae60424438419f1b5..aa0503d1d87992f15652e6afd59559dc6972c228 100644 --- a/Qt/Core/pqView.cxx +++ b/Qt/Core/pqView.cxx @@ -41,11 +41,14 @@ #include +namespace +{ template inline uint qHash(QPointer p) { return qHash(static_cast(p)); } +} class pqViewInternal { diff --git a/Qt/Python/pqPythonEditorActions.cxx b/Qt/Python/pqPythonEditorActions.cxx index 3a3533d311c875837666dd1b29aa3ef88a282628..7d24c4d8ba81cc4982755e42e2977277bf5c2467 100644 --- a/Qt/Python/pqPythonEditorActions.cxx +++ b/Qt/Python/pqPythonEditorActions.cxx @@ -20,7 +20,7 @@ #include #include -namespace details +namespace { QStringList ListFiles(const QString& directory) { @@ -129,7 +129,7 @@ pqPythonEditorActions::pqPythonEditorActions() //----------------------------------------------------------------------------- void pqPythonEditorActions::updateScriptsList(pqPythonManager* python_mgr) { - auto scripts = details::ListFiles(pqPythonScriptEditor::getScriptsDir()); + auto scripts = ::ListFiles(pqPythonScriptEditor::getScriptsDir()); this->ScriptActions.clear(); this->ScriptActions.reserve(scripts.size()); diff --git a/Qt/Python/pqPythonFileIO.cxx b/Qt/Python/pqPythonFileIO.cxx index 46717b4a7b60e2508e632e8e50fb2ec57ada9b5c..1cd313e4639d9f4712d05bcdf1e04f8a5fe781f3 100644 --- a/Qt/Python/pqPythonFileIO.cxx +++ b/Qt/Python/pqPythonFileIO.cxx @@ -22,7 +22,7 @@ #include #include -namespace details +namespace { //----------------------------------------------------------------------------- QString GetSwapDir() @@ -82,7 +82,7 @@ bool pqPythonFileIO::PythonFile::writeToFile() const return false; } - return details::Write(this->Name, this->Location, this->Text->toPlainText()); + return ::Write(this->Name, this->Location, this->Text->toPlainText()); } //----------------------------------------------------------------------------- @@ -96,7 +96,7 @@ bool pqPythonFileIO::PythonFile::readFromFile(QString& str) const return false; } - const QString swapFilename = details::GetSwapFilename(this->Name); + const QString swapFilename = ::GetSwapFilename(this->Name); if (QFileInfo::exists(swapFilename)) { const auto userAnswer = pqCoreUtilities::promptUserGeneric(tr("Script Editor"), @@ -106,8 +106,8 @@ bool pqPythonFileIO::PythonFile::readFromFile(QString& str) const { case QMessageBox::Yes: { - const auto contents = details::Read(swapFilename, vtkPVSession::CLIENT); - details::Write(this->Name, this->Location, contents); + const auto contents = ::Read(swapFilename, vtkPVSession::CLIENT); + ::Write(this->Name, this->Location, contents); QFile::remove(swapFilename); break; } @@ -123,7 +123,7 @@ bool pqPythonFileIO::PythonFile::readFromFile(QString& str) const { pqScopedOverrideCursor scopedWaitCursor(Qt::WaitCursor); - str = details::Read(this->Name, this->Location); + str = ::Read(this->Name, this->Location); } pqPythonScriptEditor::bringFront(); @@ -137,10 +137,10 @@ void pqPythonFileIO::PythonFile::start() QObject::connect(this->Text, &QTextEdit::textChanged, [this]() { if (this->Text) { - const QString swapFilename = details::GetSwapFilename(this->Name); + const QString swapFilename = ::GetSwapFilename(this->Name); if (!swapFilename.isEmpty()) { - details::Write(swapFilename, vtkPVSession::CLIENT, this->Text->toPlainText()); + ::Write(swapFilename, vtkPVSession::CLIENT, this->Text->toPlainText()); } } }); @@ -149,7 +149,7 @@ void pqPythonFileIO::PythonFile::start() //----------------------------------------------------------------------------- void pqPythonFileIO::PythonFile::removeSwap() const { - const QString swapFilename = details::GetSwapFilename(this->Name); + const QString swapFilename = ::GetSwapFilename(this->Name); if (QFile::exists(swapFilename)) { QFile::remove(swapFilename); diff --git a/Qt/Python/pqPythonLineNumberArea.cxx b/Qt/Python/pqPythonLineNumberArea.cxx index 4092180e75502da27db8d0b4b1b1654fe7b58a13..3724e099ef28188fa075c4f1bfdbd331d31f3aa7 100644 --- a/Qt/Python/pqPythonLineNumberArea.cxx +++ b/Qt/Python/pqPythonLineNumberArea.cxx @@ -14,10 +14,10 @@ #include #include -namespace details +namespace { //----------------------------------------------------------------------------- -inline std::uint32_t getNumberOfDigits(std::uint32_t i) +inline static std::uint32_t getNumberOfDigits(std::uint32_t i) { return i > 0 ? static_cast(std::log10(static_cast(i)) + 1) : 1; } @@ -27,7 +27,7 @@ inline std::uint32_t getNumberOfDigits(std::uint32_t i) QSize pqPythonLineNumberArea::sizeHint() const { const std::uint32_t numberOfDigits = - details::getNumberOfDigits(std::max(1, this->TextEdit.document()->blockCount())); + ::getNumberOfDigits(std::max(1, this->TextEdit.document()->blockCount())); const std::int32_t space = 2 * this->TextEdit.fontMetrics().horizontalAdvance(' ') + numberOfDigits * this->TextEdit.fontMetrics().horizontalAdvance(QLatin1Char('9')); diff --git a/Qt/Python/pqPythonScriptEditor.cxx b/Qt/Python/pqPythonScriptEditor.cxx index fbaa732d8b4248266278eb890dd84e804fd10e8b..d4d28bf368694d6788fdc62372c15b0ac9f5716f 100644 --- a/Qt/Python/pqPythonScriptEditor.cxx +++ b/Qt/Python/pqPythonScriptEditor.cxx @@ -24,18 +24,6 @@ #include -namespace details -{ -void FillMenu(QMenu* menu, std::vector& actions) -{ - menu->clear(); - for (auto const& action : actions) - { - menu->addAction(action); - } -} -} - pqPythonScriptEditor* pqPythonScriptEditor::UniqueInstance = nullptr; //----------------------------------------------------------------------------- diff --git a/Qt/Widgets/Testing/Cxx/DoubleLineEdit.cxx b/Qt/Widgets/Testing/Cxx/DoubleLineEdit.cxx index 45b01c6276f505bd4a39d3030797eb78ccd2ae13..db72483681df75948af424e673238529b21f51ad 100644 --- a/Qt/Widgets/Testing/Cxx/DoubleLineEdit.cxx +++ b/Qt/Widgets/Testing/Cxx/DoubleLineEdit.cxx @@ -98,7 +98,7 @@ void DoubleLineEditTester::useGlobalPrecision() QCOMPARE(e1.simplifiedText(), simplifiedText); } -int DoubleLineEdit(int argc, char* argv[]) +extern int DoubleLineEdit(int argc, char* argv[]) { QApplication app(argc, argv); DoubleLineEditTester tester; diff --git a/Qt/Widgets/Testing/Cxx/FlatTreeView.cxx b/Qt/Widgets/Testing/Cxx/FlatTreeView.cxx index 39eb7acaf7e17ada198a05a72c5b86551fd7ad01..cc06867a8b0d4267a1ed7b69d3c421a049393cf6 100644 --- a/Qt/Widgets/Testing/Cxx/FlatTreeView.cxx +++ b/Qt/Widgets/Testing/Cxx/FlatTreeView.cxx @@ -17,7 +17,7 @@ qWarning("case failed at line " TOSTRING(__LINE__) " :\n\t" TOSTRING(a)); \ } -void FlatTreeViewTests(pqFlatTreeView* w) +static void FlatTreeViewTests(pqFlatTreeView* w) { QTestApp::keyClick(w, Qt::Key_Down, Qt::NoModifier, 20); VERIFY(w->getSelectionModel()->currentIndex() == w->getModel()->index(0, 0)); @@ -75,7 +75,7 @@ void FlatTreeViewTests(pqFlatTreeView* w) QTestApp::mouseDClick(w->viewport(), QPoint(31, 62), Qt::LeftButton, Qt::NoModifier, 20); } -int FlatTreeView(int argc, char* argv[]) +extern int FlatTreeView(int argc, char* argv[]) { QTestApp app(argc, argv); diff --git a/Qt/Widgets/Testing/Cxx/HeaderViewCheckState.cxx b/Qt/Widgets/Testing/Cxx/HeaderViewCheckState.cxx index 3b331afdb22ba27322462d2c66c6d446ca86215b..9a26040d0d449fbcf6ef4e594262d7aaf2e513af 100644 --- a/Qt/Widgets/Testing/Cxx/HeaderViewCheckState.cxx +++ b/Qt/Widgets/Testing/Cxx/HeaderViewCheckState.cxx @@ -27,7 +27,7 @@ * with model that respects Qt::CheckStateRole for setHeaderData and headerData * calls. */ -int HeaderViewCheckState(int argc, char* argv[]) +extern int HeaderViewCheckState(int argc, char* argv[]) { QApplication app(argc, argv); diff --git a/Qt/Widgets/Testing/Cxx/HierarchicalGridLayout.cxx b/Qt/Widgets/Testing/Cxx/HierarchicalGridLayout.cxx index b7464e8d336932ea50acf681ddba17274f7dac49..3dc5e6bdcf0341794dfb5c9d61a02f8b420fb91f 100644 --- a/Qt/Widgets/Testing/Cxx/HierarchicalGridLayout.cxx +++ b/Qt/Widgets/Testing/Cxx/HierarchicalGridLayout.cxx @@ -190,7 +190,7 @@ void HierarchicalGridLayoutTester::interactiveResize() QTest::qWait(250); } -int HierarchicalGridLayout(int argc, char* argv[]) +extern int HierarchicalGridLayout(int argc, char* argv[]) { QApplication app(argc, argv); HierarchicalGridLayoutTester tester; diff --git a/Qt/Widgets/Testing/Cxx/TreeViewSelectionAndCheckState.cxx b/Qt/Widgets/Testing/Cxx/TreeViewSelectionAndCheckState.cxx index 1591de10cd831812577705ea49d538eb06fc2b5e..0e10d0e381732e06e5fea7db958c2fe223ca1e3b 100644 --- a/Qt/Widgets/Testing/Cxx/TreeViewSelectionAndCheckState.cxx +++ b/Qt/Widgets/Testing/Cxx/TreeViewSelectionAndCheckState.cxx @@ -52,7 +52,7 @@ QSet checkedItemNames(const QList& items) } } -int TreeViewSelectionAndCheckState(int argc, char* argv[]) +extern int TreeViewSelectionAndCheckState(int argc, char* argv[]) { QTestApp app(argc, argv); diff --git a/Qt/Widgets/Testing/Cxx/pqTextEditTest.cxx b/Qt/Widgets/Testing/Cxx/pqTextEditTest.cxx index b726667dd91617f7b815569f3bfa0c7b18fdb334..b5fdc06367ceb88f229335e08cd0311df7e11d5c 100644 --- a/Qt/Widgets/Testing/Cxx/pqTextEditTest.cxx +++ b/Qt/Widgets/Testing/Cxx/pqTextEditTest.cxx @@ -396,7 +396,7 @@ void pqTextEditTester::testReTypeText_data() } // -------------------------------------------------------------------------- -int pqTextEditTest(int argc, char* argv[]) +extern int pqTextEditTest(int argc, char* argv[]) { QApplication app(argc, argv); pqTextEditTester test1; diff --git a/Qt/Widgets/pqColorChooserButton.cxx b/Qt/Widgets/pqColorChooserButton.cxx index 48d6d91b919a04fc24fecfeca1007cff924e7628..a71756ac28b1d2a289c92a1377fd7a0ee0934512 100644 --- a/Qt/Widgets/pqColorChooserButton.cxx +++ b/Qt/Widgets/pqColorChooserButton.cxx @@ -5,7 +5,8 @@ // self includes #include "pqColorChooserButton.h" -#include "cassert" +#include +#include // Qt includes #include @@ -114,10 +115,7 @@ void pqColorChooserButton::setChosenColorRgbaF(const QVariantList& val) QIcon pqColorChooserButton::renderColorSwatch(const QColor& color) { int radius = qRound(this->height() * this->IconRadiusHeightRatio); - if (radius <= 10) - { - radius = 10; - } + radius = std::max(radius, 10); QPixmap pix(radius, radius); pix.fill(QColor(0, 0, 0, 0)); diff --git a/Qt/Widgets/pqExpandableTableView.cxx b/Qt/Widgets/pqExpandableTableView.cxx index 0e28a3025249ccd861174d28ba863a505b7e38ef..1da8db1ed1ccd140a2551fba959eeb8da76ebb2b 100644 --- a/Qt/Widgets/pqExpandableTableView.cxx +++ b/Qt/Widgets/pqExpandableTableView.cxx @@ -107,13 +107,13 @@ void pqExpandableTableView::keyPressEvent(QKeyEvent* e) // Split the lines in the text QString text = mimeData->text(); QStringList lines = text.split("\n", PV_QT_SKIP_EMPTY_PARTS); - for (qsizetype row = 0; row < std::min((qsizetype)lines.size(), numModelRows); ++row) + for (qsizetype row = 0; row < std::min(lines.size(), numModelRows); ++row) { // Split within each line QStringList items = lines[row].split(QRegularExpression("\\s+")); // Set the data in the table - for (qsizetype column = 0; column < std::min((qsizetype)items.size(), numModelColumns); + for (qsizetype column = 0; column < std::min(items.size(), numModelColumns); ++column) { QVariant value(items[column]); diff --git a/Qt/Widgets/pqFlatTreeView.cxx b/Qt/Widgets/pqFlatTreeView.cxx index 4864b52f169572da965c13fd4e075cc193de68fc..794386d1c1795c62099a7278d0d7aeddd9ad2316 100644 --- a/Qt/Widgets/pqFlatTreeView.cxx +++ b/Qt/Widgets/pqFlatTreeView.cxx @@ -26,6 +26,8 @@ #include #include +#include + class pqFlatTreeViewColumn { public: @@ -1498,10 +1500,7 @@ void pqFlatTreeView::updateData(const QModelIndex& topLeft, const QModelIndex& b else { int updateWidth = this->viewport()->width(); - if (this->ContentsWidth > updateWidth) - { - updateWidth = this->ContentsWidth; - } + updateWidth = std::max(this->ContentsWidth, updateWidth); QRect area(0, startPoint, updateWidth, point - startPoint); area.translate(-this->horizontalOffset(), -this->verticalOffset()); @@ -1886,10 +1885,7 @@ void pqFlatTreeView::keyPressEvent(QKeyEvent* e) if (this->Behavior == pqFlatTreeView::SelectColumns) { column = this->Model->columnCount() - 1; - if (column < 0) - { - column = 0; - } + column = std::max(column, 0); } item = this->getLastVisibleItem(); @@ -2436,10 +2432,7 @@ void pqFlatTreeView::paintEvent(QPaintEvent* e) // Draw the column selection first so it is behind the text. int columnWidth = 0; int totalHeight = this->viewport()->height(); - if (this->ContentsHeight > totalHeight) - { - totalHeight = this->ContentsHeight; - } + totalHeight = std::max(this->ContentsHeight, totalHeight); for (i = 0; i < this->Root->Cells.size(); i++) { @@ -2471,10 +2464,7 @@ void pqFlatTreeView::paintEvent(QPaintEvent* e) if (item->RowSelected) { itemWidth = this->viewport()->width(); - if (this->ContentsWidth > itemWidth) - { - itemWidth = this->ContentsWidth; - } + itemWidth = std::max(this->ContentsWidth, itemWidth); painter.fillRect(0, item->ContentsY + pqFlatTreeView::PipeLength, itemWidth, itemHeight, options.palette.highlight()); @@ -2503,10 +2493,7 @@ void pqFlatTreeView::paintEvent(QPaintEvent* e) ox = itemWidth - item->Cells[i].Width - this->DoubleTextMargin; } - if (itemWidth > columnWidth) - { - itemWidth = columnWidth; - } + itemWidth = std::min(itemWidth, columnWidth); // Add a little length to the highlight rectangle to see // the text better. @@ -2569,10 +2556,7 @@ void pqFlatTreeView::paintEvent(QPaintEvent* e) index.parent() == item->Index.parent()) { itemWidth = this->viewport()->width(); - if (this->ContentsWidth > itemWidth) - { - itemWidth = this->ContentsWidth; - } + itemWidth = std::max(this->ContentsWidth, itemWidth); QRect rowRect(0, py, itemWidth, itemHeight); this->drawFocus(painter, rowRect, options, item->RowSelected); @@ -2751,10 +2735,7 @@ void pqFlatTreeView::changeSelection( int cy = 0; int totalHeight = 0; int totalWidth = this->viewport()->width(); - if (totalWidth < this->ContentsWidth) - { - totalWidth = this->ContentsWidth; - } + totalWidth = std::max(totalWidth, this->ContentsWidth); // Start with the deselected items. pqFlatTreeViewItem* parentItem = nullptr; @@ -2932,10 +2913,7 @@ void pqFlatTreeView::layoutEditor() { // Add some extra space to the editor. editWidth += this->DoubleTextMargin; - if (editWidth > columnWidth) - { - editWidth = columnWidth; - } + editWidth = std::min(editWidth, columnWidth); } // Figure out how much space is taken up by decoration. @@ -2964,10 +2942,7 @@ void pqFlatTreeView::layoutItems() // The minimum indent width should be 18 to fit the +/- icon. QStyleOptionViewItem options = this->getViewOptions(); this->IndentWidth = options.decorationSize.height() + 2; - if (this->IndentWidth < 18) - { - this->IndentWidth = 18; - } + this->IndentWidth = std::max(this->IndentWidth, 18); // If the header is shown, adjust the starting point of the // item layout. @@ -3042,10 +3017,7 @@ void pqFlatTreeView::layoutItem(pqFlatTreeViewItem* item, int& point, const QFon { QFontMetrics indexFont(qvariant_cast(value)); item->Cells[i].Width = this->getDataWidth(index, indexFont); - if (indexFont.height() > preferredHeight) - { - preferredHeight = indexFont.height(); - } + preferredHeight = std::max(indexFont.height(), preferredHeight); } else { @@ -3056,10 +3028,7 @@ void pqFlatTreeView::layoutItem(pqFlatTreeViewItem* item, int& point, const QFon // The text width, the indent, the icon width, and the padding // between the icon and the item all factor into the desired width. preferredWidth = this->getWidthSum(item, i); - if (preferredWidth > this->Root->Cells[i].Width) - { - this->Root->Cells[i].Width = preferredWidth; - } + this->Root->Cells[i].Width = std::max(preferredWidth, this->Root->Cells[i].Width); } // Save the preferred height for the item. @@ -3141,10 +3110,7 @@ bool pqFlatTreeView::updateContentsWidth() { oldWidth = this->HeaderView->sectionSize(i); newWidth = this->HeaderView->sectionSizeHint(i); - if (newWidth < this->Root->Cells[i].Width) - { - newWidth = this->Root->Cells[i].Width; - } + newWidth = std::max(newWidth, this->Root->Cells[i].Width); if (newWidth != oldWidth) { diff --git a/Qt/Widgets/pqTableView.cxx b/Qt/Widgets/pqTableView.cxx index a9b794f9d6b2ce2f9ec39603719f485cd7bf691c..c51d968eed6fa2e62c9dd326f8e4d0884fa9c793 100644 --- a/Qt/Widgets/pqTableView.cxx +++ b/Qt/Widgets/pqTableView.cxx @@ -3,7 +3,8 @@ // SPDX-License-Identifier: BSD-3-Clause #include "pqTableView.h" -#include "cassert" +#include +#include #include #include @@ -135,10 +136,7 @@ QSize pqTableView::sizeHint() const } rows += qMax(0, this->Padding); - if (rows > this->MaximumRowCountBeforeScrolling) - { - rows = this->MaximumRowCountBeforeScrolling; - } + rows = std::min(rows, this->MaximumRowCountBeforeScrolling); // rows can't be negative. assert(rows >= 0); diff --git a/Remoting/Animation/Testing/Cxx/ParaViewCoreAnimationPrintSelf.cxx b/Remoting/Animation/Testing/Cxx/ParaViewCoreAnimationPrintSelf.cxx index 967d00bc8d75237cc48132b404e71ed8519951c0..3f4d09602f75cf5f72886f515bdb2d6dae42265b 100644 --- a/Remoting/Animation/Testing/Cxx/ParaViewCoreAnimationPrintSelf.cxx +++ b/Remoting/Animation/Testing/Cxx/ParaViewCoreAnimationPrintSelf.cxx @@ -26,7 +26,7 @@ #include "vtkTimestepsAnimationPlayer.h" #include "vtkXMLPVAnimationWriter.h" -int ParaViewCoreAnimationPrintSelf(int, char*[]) +extern int ParaViewCoreAnimationPrintSelf(int, char*[]) { vtkObject* c; PRINT_SELF(vtkCompositeAnimationPlayer); diff --git a/Remoting/Animation/vtkPVKeyFrameAnimationCueForProxies.cxx b/Remoting/Animation/vtkPVKeyFrameAnimationCueForProxies.cxx index 8d02b9cd3bc1b5d83591fc17c7df0c30656c4f8e..c16c3c3b084b102a4b3a981c986e9e45bcb1a71d 100644 --- a/Remoting/Animation/vtkPVKeyFrameAnimationCueForProxies.cxx +++ b/Remoting/Animation/vtkPVKeyFrameAnimationCueForProxies.cxx @@ -10,6 +10,8 @@ #include "vtkSMVectorProperty.h" #include "vtkSmartPointer.h" +#include + vtkStandardNewMacro(vtkPVKeyFrameAnimationCueForProxies); vtkCxxSetObjectMacro(vtkPVKeyFrameAnimationCueForProxies, AnimatedProxy, vtkSMProxy); //---------------------------------------------------------------------------- @@ -94,10 +96,7 @@ void vtkPVKeyFrameAnimationCueForProxies::SetAnimationValue(int index, double va vtkSMPropertyHelper(property).Set(index, value); } - if (this->ValueIndexMax < index) - { - this->ValueIndexMax = index; - } + this->ValueIndexMax = std::max(this->ValueIndexMax, index); } //---------------------------------------------------------------------------- diff --git a/Remoting/Application/Testing/Cxx/TestExecutableRunner.cxx b/Remoting/Application/Testing/Cxx/TestExecutableRunner.cxx index d19d4c228a94ec5561451088aaa9dd9017c8307e..a747eaace10c1e2dfa17b32b1707fb7d50eea220 100644 --- a/Remoting/Application/Testing/Cxx/TestExecutableRunner.cxx +++ b/Remoting/Application/Testing/Cxx/TestExecutableRunner.cxx @@ -13,7 +13,7 @@ #include -int TestExecutableRunner(int, char* argv[]) +extern int TestExecutableRunner(int, char* argv[]) { vtkInitializationHelper::SetApplicationName("TestExecutableRunner"); vtkInitializationHelper::SetOrganizationName("Humanity"); diff --git a/Remoting/ClientServerStream/Testing/Cxx/TestSimple.cxx b/Remoting/ClientServerStream/Testing/Cxx/TestSimple.cxx index f1d3c5c775b749970f7fe9a657933778715b98bb..44e7abd8471c169504d0a262cd8091748dcd3858 100644 --- a/Remoting/ClientServerStream/Testing/Cxx/TestSimple.cxx +++ b/Remoting/ClientServerStream/Testing/Cxx/TestSimple.cxx @@ -120,7 +120,7 @@ void ClientManager::RunTests() server->ProcessMessage(data, len); } -int TestSimple(int, char**) +extern int TestSimple(int, char**) { Server server; ClientManager cmgr; diff --git a/Remoting/ClientServerStream/Testing/Cxx/TestSphere.cxx b/Remoting/ClientServerStream/Testing/Cxx/TestSphere.cxx index 0a7e1d027f21885c2c8498250616fa6ddd0d3563..86196971ef2d0df4c4c125aacbdc01d48df8da95 100644 --- a/Remoting/ClientServerStream/Testing/Cxx/TestSphere.cxx +++ b/Remoting/ClientServerStream/Testing/Cxx/TestSphere.cxx @@ -18,7 +18,7 @@ extern "C" void vtkGraphicsCS_Initialize(vtkClientServerInterpreter*); extern "C" void vtkIOCS_Initialize(vtkClientServerInterpreter*); extern "C" void vtkRenderingCS_Initialize(vtkClientServerInterpreter*); -int TestSphere(int, char**) +extern int TestSphere(int, char**) { vtkClientServerInterpreter* interp = vtkClientServerInterpreter::New(); interp->SetLogStream(&cout); diff --git a/Remoting/ClientServerStream/Testing/Cxx/coverClientServer.cxx b/Remoting/ClientServerStream/Testing/Cxx/coverClientServer.cxx index 84b1a8128e72fccc3f79bb2d00784d037dd1b725..7f5203db8e7bfce06ce998d4c94d98c50bdd904e 100644 --- a/Remoting/ClientServerStream/Testing/Cxx/coverClientServer.cxx +++ b/Remoting/ClientServerStream/Testing/Cxx/coverClientServer.cxx @@ -46,7 +46,7 @@ struct Help }; // Store a bunch of values in a stream. -void do_store(vtkClientServerStream& css) +static void do_store(vtkClientServerStream& css) { vtkClientServerID id(123); css.Reserve(64); @@ -122,7 +122,7 @@ void do_store(vtkClientServerStream& css) } // Check stored values in a stream. -bool do_check(vtkClientServerStream& css) +static bool do_check(vtkClientServerStream& css) { if (css.GetNumberOfMessages() != 1) { @@ -282,7 +282,7 @@ bool do_check(vtkClientServerStream& css) return true; } -bool do_test() +static bool do_test() { // Construct a stream and store values. vtkClientServerStream css1; @@ -347,7 +347,7 @@ bool do_test() return true; } -int coverClientServer(int, char*[]) +extern int coverClientServer(int, char*[]) { return do_test() ? 0 : 1; } diff --git a/Remoting/ClientServerStream/vtkClientServerStream.cxx b/Remoting/ClientServerStream/vtkClientServerStream.cxx index b05d97da34058f7cc8971ceddb1fa02326a71f2d..16f755b11f1560fde56d33c90e50724cece6fd9a 100644 --- a/Remoting/ClientServerStream/vtkClientServerStream.cxx +++ b/Remoting/ClientServerStream/vtkClientServerStream.cxx @@ -473,6 +473,8 @@ vtkClientServerStream& vtkClientServerStream::operator<<(const vtkStdString& val } //---------------------------------------------------------------------------- +namespace +{ template void vtkClientServerPutArrayVariant(vtkClientServerStream& css, iterT* it) { @@ -482,6 +484,7 @@ void vtkClientServerPutArrayVariant(vtkClientServerStream& css, iterT* it) css << it->GetValue(i); } } +} //---------------------------------------------------------------------------- vtkClientServerStream& vtkClientServerStream::operator<<(const vtkVariant& val) @@ -513,7 +516,7 @@ vtkClientServerStream& vtkClientServerStream::operator<<(const vtkVariant& val) switch (array->GetDataType()) { vtkExtendedArrayIteratorTemplateMacro( - vtkClientServerPutArrayVariant(*this, static_cast(iter))); + ::vtkClientServerPutArrayVariant(*this, static_cast(iter))); } iter->Delete(); } @@ -535,6 +538,8 @@ vtkClientServerStream& vtkClientServerStream::operator<<(bool x) //---------------------------------------------------------------------------- // Template and macro to implement all insertion operators in the same way. +namespace +{ template vtkClientServerStream& vtkClientServerStreamOperatorSL(vtkClientServerStream* self, T x) { @@ -543,11 +548,12 @@ vtkClientServerStream& vtkClientServerStreamOperatorSL(vtkClientServerStream* se *self << vtkClientServerTypeTraits::Value(); return vtkClientServerStreamInternals::Write(*self, &x, sizeof(x)); } +} #define VTK_CLIENT_SERVER_OPERATOR(type) \ vtkClientServerStream& vtkClientServerStream::operator<<(type x) \ { \ - return vtkClientServerStreamOperatorSL(this, x); \ + return ::vtkClientServerStreamOperatorSL(this, x); \ } VTK_CLIENT_SERVER_OPERATOR(char) VTK_CLIENT_SERVER_OPERATOR(int) @@ -596,6 +602,8 @@ vtkClientServerStream::Array vtkClientServerStream::InsertString(const char* beg //---------------------------------------------------------------------------- // Template and macro to implement all InsertArray methods in the same way. +namespace +{ template vtkClientServerStream::Array vtkClientServerStreamInsertArray(const T* data, int length) { @@ -605,11 +613,12 @@ vtkClientServerStream::Array vtkClientServerStreamInsertArray(const T* data, int static_cast(length), static_cast(sizeof(Type) * length), data }; return a; } +} #define VTK_CLIENT_SERVER_INSERT_ARRAY(type) \ vtkClientServerStream::Array vtkClientServerStream::InsertArray(const type* data, int length) \ { \ - return vtkClientServerStreamInsertArray(data, length); \ + return ::vtkClientServerStreamInsertArray(data, length); \ } VTK_CLIENT_SERVER_INSERT_ARRAY(char) VTK_CLIENT_SERVER_INSERT_ARRAY(short) @@ -632,6 +641,8 @@ VTK_CLIENT_SERVER_INSERT_ARRAY(double) // the proper overload when more than one of these functions otherwise // looks the same after template instantiation. This works around the // lack of partial ordering of templates in VS6. +namespace +{ template void vtkClientServerStreamGetArgumentCase( SourceType*, const unsigned char* src, T* dest, long, long, long) @@ -666,15 +677,18 @@ void vtkClientServerStreamGetArgumentCase( memcpy(&value, src, sizeof(value)); *dest = value ? true : false; } +} #define VTK_CSS_GET_ARGUMENT_CASE(TypeId, SourceType) \ case vtkClientServerStream::TypeId: \ { \ SourceType* T = 0; \ - vtkClientServerStreamGetArgumentCase(T, src, dest, 1, 1, 1); \ + ::vtkClientServerStreamGetArgumentCase(T, src, dest, 1, 1, 1); \ } \ break +namespace +{ int vtkClientServerStreamGetArgument( vtkClientServerStream::Types type, const unsigned char* src, vtkTypeInt8* dest) { @@ -937,11 +951,14 @@ int vtkClientServerStreamGetArgument( }; return 1; } +} #undef VTK_CSS_GET_ARGUMENT_CASE //---------------------------------------------------------------------------- // Template and macro to implement value GetArgument methods in the same way. +namespace +{ template int vtkClientServerStreamGetArgumentValue( const vtkClientServerStream* self, int midx, int argument, T* value, long) @@ -956,7 +973,7 @@ int vtkClientServerStreamGetArgumentValue( data += sizeof(tp); // Call the type conversion function for this type. - return vtkClientServerStreamGetArgument( + return ::vtkClientServerStreamGetArgument( static_cast(tp), data, reinterpret_cast(value)); } return 0; @@ -973,11 +990,12 @@ int vtkClientServerStreamGetArgumentValue( data += sizeof(tp); // Call the type conversion function for this type. - return vtkClientServerStreamGetArgument( + return ::vtkClientServerStreamGetArgument( static_cast(tp), data, value); } return 0; } +} #define VTK_CSS_GET_ARGUMENT(type) \ int vtkClientServerStream::GetArgument(int message, int argument, type* value) const \ @@ -1000,6 +1018,8 @@ VTK_CSS_GET_ARGUMENT(long long) VTK_CSS_GET_ARGUMENT(unsigned long long) #undef VTK_CSS_GET_ARGUMENT +namespace +{ template int vtkClientServerStreamGetArgumentArrayCase( const unsigned char* src, DestType* dest, vtkTypeUInt32 length) @@ -1019,15 +1039,18 @@ int vtkClientServerStreamGetArgumentArrayCase( return 0; } +} #define VTK_CSS_GET_ARGUMENT_ARRAY_CASE(TypeId, SourceType) \ case vtkClientServerStream::TypeId: \ { \ - return vtkClientServerStreamGetArgumentArrayCase(data, value, length); \ + return ::vtkClientServerStreamGetArgumentArrayCase(data, value, length); \ } //---------------------------------------------------------------------------- // Template and macro to implement array GetArgument methods in the same way. +namespace +{ template int vtkClientServerStreamGetArgumentArray( const vtkClientServerStream* self, int midx, int argument, T* value, vtkTypeUInt32 length) @@ -1091,12 +1114,13 @@ int vtkClientServerStreamGetArgumentArray( } return 0; } +} #define VTK_CSS_GET_ARGUMENT_ARRAY(type) \ int vtkClientServerStream::GetArgument( \ int message, int argument, type* value, vtkTypeUInt32 length) const \ { \ - return vtkClientServerStreamGetArgumentArray(this, message, argument, value, length); \ + return ::vtkClientServerStreamGetArgumentArray(this, message, argument, value, length); \ } VTK_CSS_GET_ARGUMENT_ARRAY(signed char) VTK_CSS_GET_ARGUMENT_ARRAY(char) @@ -1229,6 +1253,8 @@ int vtkClientServerStream::GetArgument(int message, int argument, vtkClientServe } //---------------------------------------------------------------------------- +namespace +{ // Template to implement GetArgument zero-to-nullptr-pointer conversions. template int vtkClientServerStreamGetArgumentPointer( @@ -1246,6 +1272,7 @@ int vtkClientServerStreamGetArgumentPointer( } return 0; } +} int vtkClientServerStream::GetArgument(int message, int argument, vtkObjectBase** value) const { @@ -1262,7 +1289,7 @@ int vtkClientServerStream::GetArgument(int message, int argument, vtkObjectBase* switch (static_cast(tp)) { VTK_CSS_TEMPLATE_MACRO( - value, result = vtkClientServerStreamGetArgumentPointer(T, data, value)); + value, result = ::vtkClientServerStreamGetArgumentPointer(T, data, value)); case vtkClientServerStream::vtk_object_pointer: { // Copy the value out of the stream. @@ -1291,6 +1318,8 @@ int vtkClientServerStream::GetArgument(int message, int argument, vtkObjectBase* return result; } +namespace +{ template int vtkClientServerGetVariant( const vtkClientServerStream* self, int message, int& argument, vtkVariant& out) @@ -1330,6 +1359,7 @@ int vtkClientServerGetArrayVariant( } return result; } +} int vtkClientServerStream::GetArgument(int message, int& argument, vtkVariant* value) const { @@ -1349,7 +1379,8 @@ int vtkClientServerStream::GetArgument(int message, int& argument, vtkVariant* v switch (variantType) { - vtkExtendedTemplateMacro(vtkClientServerGetVariant(this, message, argument, *value)); + vtkExtendedTemplateMacro( + ::vtkClientServerGetVariant(this, message, argument, *value)); case VTK_OBJECT: { // Only vtkAbstractArray subclasses are supported, and only their raw values are encoded (no @@ -1377,7 +1408,7 @@ int vtkClientServerStream::GetArgument(int message, int& argument, vtkVariant* v switch (arrayType) { vtkExtraExtendedTemplateMacro( - vtkClientServerGetArrayVariant(this, message, argument, array)); + ::vtkClientServerGetArrayVariant(this, message, argument, array)); } *value = array.GetPointer(); } @@ -1850,6 +1881,8 @@ const unsigned char* vtkClientServerStream::GetValue(int message, int value) con } //---------------------------------------------------------------------------- +namespace +{ // Templates to find argument size within a stream. template size_t vtkClientServerStreamValueSize(T*) @@ -1864,6 +1897,7 @@ size_t vtkClientServerStreamArraySize(const unsigned char* data, T*) memcpy(&len, data, sizeof(len)); return sizeof(len) + len * sizeof(T); } +} vtkClientServerStream::Argument vtkClientServerStream::GetArgument(int message, int argument) const { @@ -1884,9 +1918,9 @@ vtkClientServerStream::Argument vtkClientServerStream::GetArgument(int message, // Find the length of the argument's data based on its type. switch (tp) { - VTK_CSS_TEMPLATE_MACRO(value, result.Size = sizeof(tp) + vtkClientServerStreamValueSize(T)); + VTK_CSS_TEMPLATE_MACRO(value, result.Size = sizeof(tp) + ::vtkClientServerStreamValueSize(T)); VTK_CSS_TEMPLATE_MACRO( - array, result.Size = sizeof(tp) + vtkClientServerStreamArraySize(data, T)); + array, result.Size = sizeof(tp) + ::vtkClientServerStreamArraySize(data, T)); case vtkClientServerStream::id_value: { result.Size = sizeof(tp) + sizeof(vtkClientServerID().ID); @@ -1901,7 +1935,7 @@ vtkClientServerStream::Argument vtkClientServerStream::GetArgument(int message, { // A string is represented as an array of 1 byte values. vtkTypeUInt8* T = nullptr; - result.Size = sizeof(tp) + vtkClientServerStreamArraySize(data, T); + result.Size = sizeof(tp) + ::vtkClientServerStreamArraySize(data, T); } break; case vtkClientServerStream::vtk_object_pointer: @@ -1913,7 +1947,7 @@ vtkClientServerStream::Argument vtkClientServerStream::GetArgument(int message, { // A stream is represented as an array of 1 byte values. vtkTypeUInt8* T = nullptr; - result.Size = sizeof(tp) + vtkClientServerStreamArraySize(data, T); + result.Size = sizeof(tp) + ::vtkClientServerStreamArraySize(data, T); } break; case vtkClientServerStream::LastResult: @@ -2168,6 +2202,8 @@ void vtkClientServerStream::PrintArgumentValue(ostream& os, int message, int arg } //---------------------------------------------------------------------------- +namespace +{ // Function to convert a value to a string. template void vtkClientServerStreamValueToString( @@ -2218,7 +2254,7 @@ void vtkClientServerStreamPrintValue( vtkClientServerStream::Types type = self->GetArgumentType(m, a); os << indent << "Argument " << a << " = " << self->GetStringFromType(type) << " {"; } - vtkClientServerStreamValueToString(self, os, m, a, tt); + ::vtkClientServerStreamValueToString(self, os, m, a, tt); if (t) { os << "}\n"; @@ -2236,12 +2272,13 @@ void vtkClientServerStreamPrintArray( vtkClientServerStream::Types type = self->GetArgumentType(m, a); os << indent << "Argument " << a << " = " << self->GetStringFromType(type) << " {"; } - vtkClientServerStreamArrayToString(self, os, m, a, tt); + ::vtkClientServerStreamArrayToString(self, os, m, a, tt); if (t) { os << "}\n"; } } +} //---------------------------------------------------------------------------- void vtkClientServerStream::PrintArgumentInternal( @@ -2250,9 +2287,9 @@ void vtkClientServerStream::PrintArgumentInternal( switch (this->GetArgumentType(message, argument)) { VTK_CSS_TEMPLATE_MACRO( - value, vtkClientServerStreamPrintValue(this, os, indent, message, argument, annotate, T)); + value, ::vtkClientServerStreamPrintValue(this, os, indent, message, argument, annotate, T)); VTK_CSS_TEMPLATE_MACRO( - array, vtkClientServerStreamPrintArray(this, os, indent, message, argument, annotate, T)); + array, ::vtkClientServerStreamPrintArray(this, os, indent, message, argument, annotate, T)); case vtkClientServerStream::bool_value: { bool arg; @@ -2463,8 +2500,8 @@ void vtkClientServerStream::ArgumentValueToString(ostream& os, int m, int a, vtk { switch (this->GetArgumentType(m, a)) { - VTK_CSS_TEMPLATE_MACRO(value, vtkClientServerStreamValueToString(this, os, m, a, T)); - VTK_CSS_TEMPLATE_MACRO(array, vtkClientServerStreamArrayToString(this, os, m, a, T)); + VTK_CSS_TEMPLATE_MACRO(value, ::vtkClientServerStreamValueToString(this, os, m, a, T)); + VTK_CSS_TEMPLATE_MACRO(array, ::vtkClientServerStreamArrayToString(this, os, m, a, T)); case vtkClientServerStream::bool_value: { bool arg; @@ -2658,6 +2695,8 @@ int vtkClientServerStream::AddMessageFromString( } //---------------------------------------------------------------------------- +namespace +{ int vtkClientServerStreamPointerFromString( const char* begin, const char* end, vtkObjectBase** value) { @@ -2844,7 +2883,7 @@ int vtkClientServerStreamArrayFromString( } // Parse this value. - if (!vtkClientServerStreamValueFromString(valueBegin, valueEnd, ptr + index)) + if (!::vtkClientServerStreamValueFromString(valueBegin, valueEnd, ptr + index)) { result = 0; } @@ -2882,6 +2921,7 @@ int vtkClientServerStreamArrayFromString( return result; } +} //---------------------------------------------------------------------------- int vtkClientServerStream::AddArgumentFromString( @@ -3063,14 +3103,14 @@ int vtkClientServerStream::AddArgumentFromString( switch (type) { VTK_CSS_TEMPLATE_MACRO( - value, result = vtkClientServerStreamValueFromString(this, valueBegin, valueEnd, T)); + value, result = ::vtkClientServerStreamValueFromString(this, valueBegin, valueEnd, T)); VTK_CSS_TEMPLATE_MACRO( - array, result = vtkClientServerStreamArrayFromString(this, valueBegin, valueEnd, T)); + array, result = ::vtkClientServerStreamArrayFromString(this, valueBegin, valueEnd, T)); case vtkClientServerStream::bool_value: { // Convert the bool value from a string. bool arg; - result = vtkClientServerStreamBoolFromString(valueBegin, valueEnd, &arg); + result = ::vtkClientServerStreamBoolFromString(valueBegin, valueEnd, &arg); if (result) { *this << arg; @@ -3132,7 +3172,7 @@ int vtkClientServerStream::AddArgumentFromString( { // Convert the ID value from a string. vtkClientServerID arg; - result = vtkClientServerStreamValueFromString(valueBegin, valueEnd, &arg.ID); + result = ::vtkClientServerStreamValueFromString(valueBegin, valueEnd, &arg.ID); if (result) { *this << arg; @@ -3142,7 +3182,7 @@ int vtkClientServerStream::AddArgumentFromString( case vtkClientServerStream::vtk_object_pointer: { vtkObjectBase* arg; - result = vtkClientServerStreamPointerFromString(valueBegin, valueEnd, &arg); + result = ::vtkClientServerStreamPointerFromString(valueBegin, valueEnd, &arg); if (result) { *this << arg; diff --git a/Remoting/Core/Testing/Cxx/TestPVArrayInformation.cxx b/Remoting/Core/Testing/Cxx/TestPVArrayInformation.cxx index feaf8d6c36408f38b65ac1b95f164e41975a135f..b91c739bc10318af483cf705272a4c17922d36e5 100644 --- a/Remoting/Core/Testing/Cxx/TestPVArrayInformation.cxx +++ b/Remoting/Core/Testing/Cxx/TestPVArrayInformation.cxx @@ -10,7 +10,7 @@ #include -vtkSmartPointer GetPolyData() +static vtkSmartPointer GetPolyData() { vtkIdType numPts = 101; vtkSmartPointer array = vtkSmartPointer::New(); @@ -24,7 +24,7 @@ vtkSmartPointer GetPolyData() return array; } -bool AreArrayInformationsEqual(vtkPVArrayInformation* lhs, vtkPVArrayInformation* rhs) +static bool AreArrayInformationsEqual(vtkPVArrayInformation* lhs, vtkPVArrayInformation* rhs) { bool equal = true; equal &= lhs->GetIsPartial() == rhs->GetIsPartial(); @@ -53,7 +53,7 @@ bool AreArrayInformationsEqual(vtkPVArrayInformation* lhs, vtkPVArrayInformation return equal; } -int TestPVArrayInformation(int, char*[]) +extern int TestPVArrayInformation(int, char*[]) { vtkSmartPointer array = GetPolyData(); diff --git a/Remoting/Core/Testing/Cxx/TestPartialArraysInformation.cxx b/Remoting/Core/Testing/Cxx/TestPartialArraysInformation.cxx index a8c7ab32fcc6fc65add4f5a61936ff6256309068..9bf7ab764d5a1648e0b99d8a87f948b6674c511d 100644 --- a/Remoting/Core/Testing/Cxx/TestPartialArraysInformation.cxx +++ b/Remoting/Core/Testing/Cxx/TestPartialArraysInformation.cxx @@ -11,7 +11,7 @@ #include "vtkSmartPointer.h" #include "vtkSphereSource.h" -vtkSmartPointer GetPolyData( +static vtkSmartPointer GetPolyData( const char** parrays = nullptr, const char** carrays = nullptr) { vtkNew sphere; @@ -42,7 +42,7 @@ vtkSmartPointer GetPolyData( return pd; } -int TestPartialArraysInformation(int, char*[]) +extern int TestPartialArraysInformation(int, char*[]) { vtkNew data; diff --git a/Remoting/Core/Testing/Cxx/TestSpecialDirectories.cxx b/Remoting/Core/Testing/Cxx/TestSpecialDirectories.cxx index 5f92d2f4423dea9cfab113c0cb9a35d80b553bb7..2187ed4b87b9c85c02d26cdf981748a370d4beea 100644 --- a/Remoting/Core/Testing/Cxx/TestSpecialDirectories.cxx +++ b/Remoting/Core/Testing/Cxx/TestSpecialDirectories.cxx @@ -6,7 +6,7 @@ #include -int TestSpecialDirectories(int, char*[]) +extern int TestSpecialDirectories(int, char*[]) { vtkPVFileInformationHelper* helper = vtkPVFileInformationHelper::New(); vtkPVFileInformation* info = vtkPVFileInformation::New(); diff --git a/Remoting/Core/vtkPVArrayInformation.cxx b/Remoting/Core/vtkPVArrayInformation.cxx index c63b8240de14bd777963281eb7545575d0d137aa..e27d0679bd25f48eceb28e87c1410fce4e3b4012 100644 --- a/Remoting/Core/vtkPVArrayInformation.cxx +++ b/Remoting/Core/vtkPVArrayInformation.cxx @@ -383,9 +383,12 @@ void vtkPVArrayInformation::CopyFromArray(vtkAbstractArray* array, vtkFieldData* { int arrayIdx = -1; fieldData->GetAbstractArray(array->GetName(), arrayIdx); - return this->CopyFromArray(fieldData, arrayIdx); + this->CopyFromArray(fieldData, arrayIdx); + } + else + { + this->CopyFromArray(array); } - return this->CopyFromArray(array); } //---------------------------------------------------------------------------- diff --git a/Remoting/Core/vtkPVFileInformation.cxx b/Remoting/Core/vtkPVFileInformation.cxx index d53ac40092ffe5c32f4f2f07915974e880bd1861..7f4cedc7bf10aec30134c97f134bb6e739ef30d5 100644 --- a/Remoting/Core/vtkPVFileInformation.cxx +++ b/Remoting/Core/vtkPVFileInformation.cxx @@ -47,6 +47,8 @@ vtkStandardNewMacro(vtkPVFileInformation); +namespace +{ inline void vtkPVFileInformationAddTerminatingSlash(std::string& name) { if (!name.empty()) @@ -62,6 +64,7 @@ inline void vtkPVFileInformationAddTerminatingSlash(std::string& name) } } } +} #if defined(_WIN32) @@ -325,6 +328,8 @@ static std::string vtkPVFileInformationResolveLink(const std::string& fname, WIN } #endif +namespace +{ std::string MakeAbsolutePath(const std::string& path, const std::string& working_dir) { std::string ret = path; @@ -336,6 +341,7 @@ std::string MakeAbsolutePath(const std::string& path, const std::string& working } return ret; } +} //----------------------------------------------------------------------------- class vtkPVFileInformationSet : public std::set> @@ -752,7 +758,7 @@ void vtkPVFileInformation::FetchWindowsDirectoryListing() // Search for all files in the given directory. std::string prefix = this->FullPath; - vtkPVFileInformationAddTerminatingSlash(prefix); + ::vtkPVFileInformationAddTerminatingSlash(prefix); std::wstring pattern = vtksys::Encoding::ToWide(prefix) + L"*"; WIN32_FIND_DATAW data; HANDLE handle = FindFirstFileW(pattern.c_str(), &data); @@ -876,7 +882,7 @@ void vtkPVFileInformation::FetchUnixDirectoryListing() vtkPVFileInformationSet info_set; std::string prefix = this->FullPath; - vtkPVFileInformationAddTerminatingSlash(prefix); + ::vtkPVFileInformationAddTerminatingSlash(prefix); // Open the directory and make sure it exists. DIR* dir = opendir(this->FullPath); @@ -1051,7 +1057,7 @@ void vtkPVFileInformation::OrganizeCollection(vtkPVFileInformationSet& info_set) MapOfStringToInfo fileGroups; std::string prefix = this->FullPath; - vtkPVFileInformationAddTerminatingSlash(prefix); + ::vtkPVFileInformationAddTerminatingSlash(prefix); if (this->GroupFileSequences) { diff --git a/Remoting/Core/vtkPVProgressHandler.cxx b/Remoting/Core/vtkPVProgressHandler.cxx index 17d7eec87185c60fe5f9fabda419bdb5d3a189a8..45045ac70e0c7bba8b9c4ea033337f098d7b28d6 100644 --- a/Remoting/Core/vtkPVProgressHandler.cxx +++ b/Remoting/Core/vtkPVProgressHandler.cxx @@ -29,6 +29,8 @@ return; \ } +namespace +{ inline const char* vtkGetProgressText(vtkObjectBase* o) { vtkAlgorithm* alg = vtkAlgorithm::SafeDownCast(o); @@ -39,6 +41,7 @@ inline const char* vtkGetProgressText(vtkObjectBase* o) return o->GetClassName(); } +} class vtkPVProgressHandler::RMICallback { diff --git a/Remoting/Core/vtkPVServerInformation.cxx b/Remoting/Core/vtkPVServerInformation.cxx index d39c25919a3c4a26373be3dabfb5dba7240a6e80..63e59aa40485ab24a4184f8b57c18023b75cc006 100644 --- a/Remoting/Core/vtkPVServerInformation.cxx +++ b/Remoting/Core/vtkPVServerInformation.cxx @@ -16,6 +16,8 @@ #include #endif +#include + // ------------------------ // NOTE for OGVSupport // ------------------------ @@ -207,19 +209,10 @@ void vtkPVServerInformation::AddInformation(vtkPVInformation* info) // IceT either is there or is not. this->UseIceT = serverInfo->GetUseIceT(); - if (this->NumberOfProcesses < serverInfo->NumberOfProcesses) - { - this->NumberOfProcesses = serverInfo->NumberOfProcesses; - } + this->NumberOfProcesses = std::max(this->NumberOfProcesses, serverInfo->NumberOfProcesses); this->MPIInitialized = serverInfo->MPIInitialized; - if (this->MultiClientsEnable < serverInfo->MultiClientsEnable) - { - this->MultiClientsEnable = serverInfo->MultiClientsEnable; - } - if (this->ClientId < serverInfo->ClientId) - { - this->ClientId = serverInfo->ClientId; - } + this->MultiClientsEnable = std::max(this->MultiClientsEnable, serverInfo->MultiClientsEnable); + this->ClientId = std::max(this->ClientId, serverInfo->ClientId); this->SMPBackendName = serverInfo->GetSMPBackendName(); this->SMPMaxNumberOfThreads = serverInfo->GetSMPMaxNumberOfThreads(); this->SetIdTypeSize(serverInfo->GetIdTypeSize()); diff --git a/Remoting/Live/Testing/Cxx/TestSteeringDataGenerator.cxx b/Remoting/Live/Testing/Cxx/TestSteeringDataGenerator.cxx index d2e99f10e189e3309ad793f7d956908f971b1668..681dbbd9244b74287cc070dc9be55fa6a1df864f 100644 --- a/Remoting/Live/Testing/Cxx/TestSteeringDataGenerator.cxx +++ b/Remoting/Live/Testing/Cxx/TestSteeringDataGenerator.cxx @@ -25,7 +25,7 @@ #include // for std::iota -const char* test_xml = R"( +static const char* test_xml = R"( @@ -90,7 +90,7 @@ const char* test_xml = R"( )"; //---------------------------------------------------------------------------- -int TestSteeringDataGenerator(int argc, char* argv[]) +extern int TestSteeringDataGenerator(int argc, char* argv[]) { vtkInitializationHelper::Initialize(argc, argv, vtkProcessModule::PROCESS_CLIENT); diff --git a/Remoting/ServerManager/Testing/Cxx/TestAdjustRange.cxx b/Remoting/ServerManager/Testing/Cxx/TestAdjustRange.cxx index 1f6f345ba0bb9a4e84583848afc5674dbd6ee288..05364edeaf7a46f0cdc4052575e57276b83b3113 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestAdjustRange.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestAdjustRange.cxx @@ -64,7 +64,7 @@ bool valid_range(double range[2]) } } -int TestAdjustRange(int argc, char* argv[]) +extern int TestAdjustRange(int argc, char* argv[]) { (void)argc; (void)argv; diff --git a/Remoting/ServerManager/Testing/Cxx/TestMultiplexerSourceProxy.cxx b/Remoting/ServerManager/Testing/Cxx/TestMultiplexerSourceProxy.cxx index 2d667ea6d22b21dad4b6fc1a28a2eeb8df41fc39..18b5ff91f0f81f8a77f67409613c0887a961467b 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestMultiplexerSourceProxy.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestMultiplexerSourceProxy.cxx @@ -161,7 +161,7 @@ static bool ValidateWavelet(vtkSMProxy* mux) return true; } -int TestMultiplexerSourceProxy(int argc, char* argv[]) +extern int TestMultiplexerSourceProxy(int argc, char* argv[]) { vtkNew testing; testing->Initialize(argc, argv); diff --git a/Remoting/ServerManager/Testing/Cxx/TestProxyAnnotation.cxx b/Remoting/ServerManager/Testing/Cxx/TestProxyAnnotation.cxx index a074cec1c7e4b49c5b9b5999f233c1a0fd128dd7..9408a34f439f242c19dbff55e8ed6e0280443e93 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestProxyAnnotation.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestProxyAnnotation.cxx @@ -16,7 +16,7 @@ #include //---------------------------------------------------------------------------- -int TestProxyAnnotation(int argc, char* argv[]) +extern int TestProxyAnnotation(int argc, char* argv[]) { int ret_val = EXIT_SUCCESS; bool success = true; diff --git a/Remoting/ServerManager/Testing/Cxx/TestRecreateVTKObjects.cxx b/Remoting/ServerManager/Testing/Cxx/TestRecreateVTKObjects.cxx index efa9f4b06561ec1ddc2ffbd423d7a0e1e75e0b9e..08cfea83bf632929f16c98f8f1dbd19e18b7d4df 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestRecreateVTKObjects.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestRecreateVTKObjects.cxx @@ -12,7 +12,7 @@ #include "vtkSphereSource.h" #include "vtkWeakPointer.h" -int TestRecreateVTKObjects(int argc, char* argv[]) +extern int TestRecreateVTKObjects(int argc, char* argv[]) { (void)argc; diff --git a/Remoting/ServerManager/Testing/Cxx/TestRemotingCoreConfiguration.cxx b/Remoting/ServerManager/Testing/Cxx/TestRemotingCoreConfiguration.cxx index 981b3f4eba345dd10d11d6ed569176b29042efcc..a099e804e18c0e3b23ac1b36e37147de518325ab 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestRemotingCoreConfiguration.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestRemotingCoreConfiguration.cxx @@ -6,7 +6,7 @@ #include "vtkProcessModuleConfiguration.h" #include "vtkRemotingCoreConfiguration.h" -int TestRemotingCoreConfiguration(int argc, char* argv[]) +extern int TestRemotingCoreConfiguration(int argc, char* argv[]) { vtkNew options; options->SetName("TestRemotingCoreConfiguration"); diff --git a/Remoting/ServerManager/Testing/Cxx/TestSMDoubleVectorProperty.cxx b/Remoting/ServerManager/Testing/Cxx/TestSMDoubleVectorProperty.cxx index 97610b1eef6bf9ab487a9f8e94ff7661440d5b46..c50cef912165e069dcc3cacf9d21dad29ea1ef36 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestSMDoubleVectorProperty.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestSMDoubleVectorProperty.cxx @@ -5,7 +5,7 @@ #include "vtkInitializationHelper.h" #include "vtkProcessModule.h" -int TestSMDoubleVectorProperty(int argc, char* argv[]) +extern int TestSMDoubleVectorProperty(int argc, char* argv[]) { vtkInitializationHelper::Initialize(argc, argv, vtkProcessModule::PROCESS_CLIENT); vtkSMDoubleVectorPropertyTest test; diff --git a/Remoting/ServerManager/Testing/Cxx/TestSMIntVectorProperty.cxx b/Remoting/ServerManager/Testing/Cxx/TestSMIntVectorProperty.cxx index 75ad8affea80026d90f21462e70eaf0fee3ab9d4..34b7c175a99ded67964b5f4949ddf2d5db399846 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestSMIntVectorProperty.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestSMIntVectorProperty.cxx @@ -5,7 +5,7 @@ #include "vtkInitializationHelper.h" #include "vtkProcessModule.h" -int TestSMIntVectorProperty(int argc, char* argv[]) +extern int TestSMIntVectorProperty(int argc, char* argv[]) { vtkInitializationHelper::Initialize(argc, argv, vtkProcessModule::PROCESS_CLIENT); vtkSMIntVectorPropertyTest test; diff --git a/Remoting/ServerManager/Testing/Cxx/TestSMPrettyLabel.cxx b/Remoting/ServerManager/Testing/Cxx/TestSMPrettyLabel.cxx index dc692029d0a82a64ea17cbc8b3331907a63dce35..8e737bf18403dfe4721c3e71a1f05fe8040f5a4c 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestSMPrettyLabel.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestSMPrettyLabel.cxx @@ -6,7 +6,7 @@ #include #include -bool CheckStringEquivalent(const std::string& tested, const std::string& reference) +static bool CheckStringEquivalent(const std::string& tested, const std::string& reference) { if (tested != reference) { @@ -16,7 +16,7 @@ bool CheckStringEquivalent(const std::string& tested, const std::string& referen return true; } -int TestSMPrettyLabel(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) +extern int TestSMPrettyLabel(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) { if (!CheckStringEquivalent(vtkSMObject::CreatePrettyLabel("MYSpace"), "MY Space")) { diff --git a/Remoting/ServerManager/Testing/Cxx/TestSMPropertyHelper.cxx b/Remoting/ServerManager/Testing/Cxx/TestSMPropertyHelper.cxx index e77cab39b4d15a1e917fadda7e6a1316f8bc473c..3d092b4611a1486110a8d434a94599cb6299167e 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestSMPropertyHelper.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestSMPropertyHelper.cxx @@ -6,7 +6,7 @@ #include "vtkInitializationHelper.h" #include "vtkProcessModule.h" -int TestSMPropertyHelper(int argc, char* argv[]) +extern int TestSMPropertyHelper(int argc, char* argv[]) { vtkInitializationHelper::Initialize(argc, argv, vtkProcessModule::PROCESS_CLIENT); vtkSMPropertyHelperTest test; diff --git a/Remoting/ServerManager/Testing/Cxx/TestSMProxy.cxx b/Remoting/ServerManager/Testing/Cxx/TestSMProxy.cxx index 892fd3a235c1c9fdb511ab2cc55a44777a2126ff..752489e0cec9ab9bd3d939874181813de42e7432 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestSMProxy.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestSMProxy.cxx @@ -5,7 +5,7 @@ #include "vtkInitializationHelper.h" #include "vtkProcessModule.h" -int TestSMProxy(int argc, char* argv[]) +extern int TestSMProxy(int argc, char* argv[]) { vtkInitializationHelper::Initialize(argc, argv, vtkProcessModule::PROCESS_CLIENT); vtkSMProxyTest test; diff --git a/Remoting/ServerManager/Testing/Cxx/TestSMProxyLink.cxx b/Remoting/ServerManager/Testing/Cxx/TestSMProxyLink.cxx index c8c70d7b0c57e1e951a813805d591ab915ffa0f6..408354d45c1999ae54fb63e1f8261599ff7d4314 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestSMProxyLink.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestSMProxyLink.cxx @@ -5,7 +5,7 @@ #include "vtkInitializationHelper.h" #include "vtkProcessModule.h" -int TestSMProxyLink(int argc, char* argv[]) +extern int TestSMProxyLink(int argc, char* argv[]) { vtkInitializationHelper::Initialize(argc, argv, vtkProcessModule::PROCESS_CLIENT); vtkSMProxyLinkTest test; diff --git a/Remoting/ServerManager/Testing/Cxx/TestSMStringVectorProperty.cxx b/Remoting/ServerManager/Testing/Cxx/TestSMStringVectorProperty.cxx index fa691570eb412e3140e4ad733583fd40dcb597e1..be9c18f182c2521f29225d8fdf29d3b469db3827 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestSMStringVectorProperty.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestSMStringVectorProperty.cxx @@ -5,7 +5,7 @@ #include "vtkInitializationHelper.h" #include "vtkProcessModule.h" -int TestSMStringVectorProperty(int argc, char* argv[]) +extern int TestSMStringVectorProperty(int argc, char* argv[]) { vtkInitializationHelper::Initialize(argc, argv, vtkProcessModule::PROCESS_CLIENT); vtkSMStringVectorPropertyTest test; diff --git a/Remoting/ServerManager/Testing/Cxx/TestSMUndoStack.cxx b/Remoting/ServerManager/Testing/Cxx/TestSMUndoStack.cxx index 1182c2016522d473295e75b2fe984cd47593fde1..e6cb31007a0fac638dee7212ed75c9c364081b33 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestSMUndoStack.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestSMUndoStack.cxx @@ -5,7 +5,7 @@ #include "vtkInitializationHelper.h" #include "vtkProcessModule.h" -int TestSMUndoStack(int argc, char* argv[]) +extern int TestSMUndoStack(int argc, char* argv[]) { vtkInitializationHelper::Initialize(argc, argv, vtkProcessModule::PROCESS_CLIENT); vtkSMUndoStackTest test; diff --git a/Remoting/ServerManager/Testing/Cxx/TestSelfGeneratingSourceProxy.cxx b/Remoting/ServerManager/Testing/Cxx/TestSelfGeneratingSourceProxy.cxx index def4ad752dba4d09a04f772944c1247623ee9122..e76715565ba933cc39b0dffd056e339ab698ddab 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestSelfGeneratingSourceProxy.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestSelfGeneratingSourceProxy.cxx @@ -16,7 +16,7 @@ #include #include -const char* testdefinition = +static const char* testdefinition = "" " " " "; -const char* extension = " " - " " - " " - " " - " "; - -int TestSelfGeneratingSourceProxy(int argc, char* argv[]) +static const char* extension = " " + " " + " " + " " + " "; + +extern int TestSelfGeneratingSourceProxy(int argc, char* argv[]) { (void)argc; vtkInitializationHelper::Initialize(argv[0], vtkProcessModule::PROCESS_CLIENT); diff --git a/Remoting/ServerManager/Testing/Cxx/TestSessionProxyManager.cxx b/Remoting/ServerManager/Testing/Cxx/TestSessionProxyManager.cxx index 6e6efe406c8605a1727fcdd6acb358d26335b743..6e3e8ab4f08b3b19262cf504df26d8931c8503a2 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestSessionProxyManager.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestSessionProxyManager.cxx @@ -10,7 +10,7 @@ #include "vtkSMSessionProxyManager.h" #include "vtkSmartPointer.h" -int TestSessionProxyManager(int argc, char* argv[]) +extern int TestSessionProxyManager(int argc, char* argv[]) { (void)argc; diff --git a/Remoting/ServerManager/Testing/Cxx/TestSettings.cxx b/Remoting/ServerManager/Testing/Cxx/TestSettings.cxx index f1730260af9c2d03534ac220d8226b88e0c12b19..851be3aed57e42059b4768dc900dce42851f4b8e 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestSettings.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestSettings.cxx @@ -17,7 +17,7 @@ #include #include #include -int TestSettings(int argc, char* argv[]) +extern int TestSettings(int argc, char* argv[]) { (void)argc; vtkInitializationHelper::Initialize(argv[0], vtkProcessModule::PROCESS_CLIENT); diff --git a/Remoting/ServerManager/Testing/Cxx/TestValidateProxies.cxx b/Remoting/ServerManager/Testing/Cxx/TestValidateProxies.cxx index c607470aaab3b71653a74dd82a44fa8b4fc43a2f..26d40b434d063be70084fb5650f39d1bc56fc48b 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestValidateProxies.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestValidateProxies.cxx @@ -21,7 +21,7 @@ #include #include -int TestValidateProxies(int argc, char* argv[]) +extern int TestValidateProxies(int argc, char* argv[]) { vtkNew contr; contr->Initialize(&argc, &argv); diff --git a/Remoting/ServerManager/Testing/Cxx/TestXMLSaveLoadState.cxx b/Remoting/ServerManager/Testing/Cxx/TestXMLSaveLoadState.cxx index 582bbe351e15556283b65d150da73cde4a45ebc1..13fa8c8ca851bb994c61f9077507baf3219e72e1 100644 --- a/Remoting/ServerManager/Testing/Cxx/TestXMLSaveLoadState.cxx +++ b/Remoting/ServerManager/Testing/Cxx/TestXMLSaveLoadState.cxx @@ -12,7 +12,7 @@ #include "vtkPVXMLElement.h" //---------------------------------------------------------------------------- -int TestXMLSaveLoadState(int argc, char* argv[]) +extern int TestXMLSaveLoadState(int argc, char* argv[]) { vtkInitializationHelper::Initialize(argc, argv, vtkProcessModule::PROCESS_CLIENT); diff --git a/Remoting/ServerManager/vtkPVMultiClientsInformation.cxx b/Remoting/ServerManager/vtkPVMultiClientsInformation.cxx index 35c9296459cb3f268a829427621ffbe9bcfad078..51fd81324b7ac5317fe15dcc4bd610a775c32a18 100644 --- a/Remoting/ServerManager/vtkPVMultiClientsInformation.cxx +++ b/Remoting/ServerManager/vtkPVMultiClientsInformation.cxx @@ -10,6 +10,8 @@ #include "vtkProcessModule.h" #include "vtkRemotingCoreConfiguration.h" +#include + vtkStandardNewMacro(vtkPVMultiClientsInformation); //---------------------------------------------------------------------------- @@ -122,18 +124,9 @@ void vtkPVMultiClientsInformation::AddInformation(vtkPVInformation* info) serverInfo = vtkPVMultiClientsInformation::SafeDownCast(info); if (serverInfo) { - if (this->NumberOfClients < serverInfo->NumberOfClients) - { - this->NumberOfClients = serverInfo->NumberOfClients; - } - if (this->ClientId < serverInfo->ClientId) - { - this->ClientId = serverInfo->ClientId; - } - if (this->MasterId < serverInfo->MasterId) - { - this->MasterId = serverInfo->MasterId; - } + this->NumberOfClients = std::max(this->NumberOfClients, serverInfo->NumberOfClients); + this->ClientId = std::max(this->ClientId, serverInfo->ClientId); + this->MasterId = std::max(this->MasterId, serverInfo->MasterId); if (this->ClientIds == nullptr && serverInfo->ClientIds) { this->ClientIds = new int[serverInfo->NumberOfClients]; diff --git a/Remoting/ServerManager/vtkSMBoundsDomain.cxx b/Remoting/ServerManager/vtkSMBoundsDomain.cxx index d3a134f29e8f0bad4fea6f87ccb5f499128c5d24..f06302713bc76d25078bc5af8f07423dd7cf19bc 100644 --- a/Remoting/ServerManager/vtkSMBoundsDomain.cxx +++ b/Remoting/ServerManager/vtkSMBoundsDomain.cxx @@ -13,6 +13,7 @@ #include "vtkSMSourceProxy.h" #include "vtkSMUncheckedPropertyHelper.h" +#include #include vtkStandardNewMacro(vtkSMBoundsDomain); @@ -179,14 +180,8 @@ void vtkSMBoundsDomain::UpdateOriented() double min = dist[0], max = dist[0]; for (i = 1; i < 8; i++) { - if (dist[i] < min) - { - min = dist[i]; - } - if (dist[i] > max) - { - max = dist[i]; - } + min = std::min(min, dist[i]); + max = std::max(max, dist[i]); } std::vector entries; diff --git a/Remoting/ServerManager/vtkSMSettings.cxx b/Remoting/ServerManager/vtkSMSettings.cxx index 68f4ebf679677e72c8da4f7d695244b2f204c9b0..0ac07e815e2bc762ab5422c71a7db40fdc919441 100644 --- a/Remoting/ServerManager/vtkSMSettings.cxx +++ b/Remoting/ServerManager/vtkSMSettings.cxx @@ -66,7 +66,7 @@ void TransformJSON(std::string& settingsJSON) class vtkSMSettings::vtkSMSettingsInternal { public: - std::vector SettingCollections; + std::vector<::SettingsCollection> SettingCollections; bool SettingCollectionsAreSorted; bool IsModified; @@ -79,7 +79,7 @@ public: { // Sort the settings roots by priority (highest to lowest) std::stable_sort( - this->SettingCollections.begin(), this->SettingCollections.end(), SortByPriority); + this->SettingCollections.begin(), this->SettingCollections.end(), ::SortByPriority); this->SettingCollectionsAreSorted = true; } @@ -940,7 +940,7 @@ public: { if (this->SettingCollections.empty()) { - SettingsCollection newCollection; + ::SettingsCollection newCollection; newCollection.Priority = VTK_DOUBLE_MAX; this->SettingCollections.push_back(newCollection); this->IsModified = true; @@ -1000,7 +1000,7 @@ vtkSMSettings* vtkSMSettings::GetInstance() //---------------------------------------------------------------------------- bool vtkSMSettings::AddCollectionFromString(const std::string& settings, double priority) { - SettingsCollection collection; + ::SettingsCollection collection; collection.Priority = priority; vtkVLogF( @@ -1015,7 +1015,7 @@ bool vtkSMSettings::AddCollectionFromString(const std::string& settings, double } // Take care of any backwards compatibility issues - TransformJSON(processedSettings); + ::TransformJSON(processedSettings); Json::CharReaderBuilder builder; builder["collectComments"] = true; @@ -1443,6 +1443,8 @@ void vtkSMSettings::SetSettingDescription(const char* settingName, const char* d } //---------------------------------------------------------------------------- +namespace +{ template Json::Value vtkConvertXMLElementToJSON( vtkSMVectorProperty* vp, const std::vector>& elements) @@ -1525,6 +1527,7 @@ Json::Value vtkConvertXMLElementToJSON( } return value; } +} //--------------------------------------------------------------------------- Json::Value vtkSMSettings::SerializeAsJSON( @@ -1569,7 +1572,7 @@ Json::Value vtkSMSettings::SerializeAsJSON( } } vtkSMVectorPropertyTemplateMacro(prop, - root[pname] = vtkConvertXMLElementToJSON( + root[pname] = ::vtkConvertXMLElementToJSON( vtkSMVectorProperty::SafeDownCast(prop), valueElements);); } } diff --git a/Remoting/Views/Testing/Cxx/TestComparativeAnimationCueProxy.cxx b/Remoting/Views/Testing/Cxx/TestComparativeAnimationCueProxy.cxx index 6f097ea55cbcb91f4807462f25cc9fa7c112a72a..74ce2d4004eab7046ba2075a48409738747d8b12 100644 --- a/Remoting/Views/Testing/Cxx/TestComparativeAnimationCueProxy.cxx +++ b/Remoting/Views/Testing/Cxx/TestComparativeAnimationCueProxy.cxx @@ -19,7 +19,7 @@ cerr << "ERROR: " msg << endl; \ return 1; -int TestComparativeAnimationCueProxy(int argc, char* argv[]) +extern int TestComparativeAnimationCueProxy(int argc, char* argv[]) { // Initialization vtkInitializationHelper::Initialize(argc, argv, vtkProcessModule::PROCESS_CLIENT); diff --git a/Remoting/Views/Testing/Cxx/TestImageScaleFactors.cxx b/Remoting/Views/Testing/Cxx/TestImageScaleFactors.cxx index d4d854962b26d9bd7d7b9764ceb609ac79c5f362..1cb8e78f63b64e2a27f47dbc3cb11290c298b9a2 100644 --- a/Remoting/Views/Testing/Cxx/TestImageScaleFactors.cxx +++ b/Remoting/Views/Testing/Cxx/TestImageScaleFactors.cxx @@ -27,7 +27,7 @@ void Test(const vtkVector2i& target, const vtkVector2i& maxsize, bool expect_app // Tests code in vtkSMSaveScreenshotProxy to compute scale factors when saving // images at target resolution. -int TestImageScaleFactors(int, char*[]) +extern int TestImageScaleFactors(int, char*[]) { try { diff --git a/Remoting/Views/Testing/Cxx/TestParaViewPipelineController.cxx b/Remoting/Views/Testing/Cxx/TestParaViewPipelineController.cxx index 2f8264096b8cd015734109d17e555a734444e82f..16b094dd933bac821521449abb4407c1442e41cd 100644 --- a/Remoting/Views/Testing/Cxx/TestParaViewPipelineController.cxx +++ b/Remoting/Views/Testing/Cxx/TestParaViewPipelineController.cxx @@ -15,7 +15,7 @@ #include #include -int TestParaViewPipelineController(int argc, char* argv[]) +extern int TestParaViewPipelineController(int argc, char* argv[]) { (void)argc; vtkInitializationHelper::Initialize(argv[0], vtkProcessModule::PROCESS_CLIENT); diff --git a/Remoting/Views/Testing/Cxx/TestParaViewPipelineControllerWithRendering.cxx b/Remoting/Views/Testing/Cxx/TestParaViewPipelineControllerWithRendering.cxx index 97cd1818c534cc7a07a58ffb7fb759dbcebc291a..a964e0a56f02100900a210ff42b68652b5e37e18 100644 --- a/Remoting/Views/Testing/Cxx/TestParaViewPipelineControllerWithRendering.cxx +++ b/Remoting/Views/Testing/Cxx/TestParaViewPipelineControllerWithRendering.cxx @@ -76,7 +76,7 @@ vtkSMSourceProxy* CreatePipelineProxy( } } -int TestParaViewPipelineControllerWithRendering(int argc, char* argv[]) +extern int TestParaViewPipelineControllerWithRendering(int argc, char* argv[]) { vtkInitializationHelper::SetApplicationName("TestParaViewPipelineControllerWithRendering"); vtkInitializationHelper::SetOrganizationName("Humanity"); diff --git a/Remoting/Views/Testing/Cxx/TestProxyManagerUtilities.cxx b/Remoting/Views/Testing/Cxx/TestProxyManagerUtilities.cxx index 1f9e6d44efcfef097d91524ee19133ae2ec4ce94..36cf246dcf66b37331f1f1098ad1c35c610e7b33 100644 --- a/Remoting/Views/Testing/Cxx/TestProxyManagerUtilities.cxx +++ b/Remoting/Views/Testing/Cxx/TestProxyManagerUtilities.cxx @@ -166,7 +166,7 @@ std::set CreatePipeline( } } -int TestProxyManagerUtilities(int, char* argv[]) +extern int TestProxyManagerUtilities(int, char* argv[]) { vtkInitializationHelper::SetApplicationName("TestParaViewPipelineControllerWithRendering"); vtkInitializationHelper::SetOrganizationName("Humanity"); diff --git a/Remoting/Views/Testing/Cxx/TestScalarBarPlacement.cxx b/Remoting/Views/Testing/Cxx/TestScalarBarPlacement.cxx index 8c5988ebdf7a706eac91b181cb4ddc4dd22b3b8f..d14f866c26c6993e7914716a8a6b9348f1a1c7fe 100644 --- a/Remoting/Views/Testing/Cxx/TestScalarBarPlacement.cxx +++ b/Remoting/Views/Testing/Cxx/TestScalarBarPlacement.cxx @@ -82,7 +82,7 @@ vtkSMSourceProxy* CreatePipelineProxy( } } -int TestScalarBarPlacement(int argc, char* argv[]) +extern int TestScalarBarPlacement(int argc, char* argv[]) { (void)argc; // setup a basic application without Qt for views/interaction diff --git a/Remoting/Views/Testing/Cxx/TestSystemCaps.cxx b/Remoting/Views/Testing/Cxx/TestSystemCaps.cxx index d49877454e0198b1fb3ac11948b2e889aef0a958..e1e0ef32109a38e0dd106626311946ce6f6ff9a9 100644 --- a/Remoting/Views/Testing/Cxx/TestSystemCaps.cxx +++ b/Remoting/Views/Testing/Cxx/TestSystemCaps.cxx @@ -24,7 +24,7 @@ using std::string; // Description: // Get python version #if VTK_MODULE_ENABLE_VTK_Python -string GetPythonVersion() +static string GetPythonVersion() { ostringstream oss; #if defined(PY_VERSION) @@ -40,7 +40,7 @@ string GetPythonVersion() // Get the version of the standard implemented by this // MPI #if VTK_MODULE_ENABLE_VTK_ParallelMPI -string GetMPIVersion() +static string GetMPIVersion() { ostringstream oss; int major = -1, minor = -1; @@ -54,12 +54,10 @@ string GetMPIVersion() oss << major << "." << minor; return oss.str(); } -#endif // Description: // Get the implementor name and release info -#if VTK_MODULE_ENABLE_VTK_ParallelMPI -string GetMPILibraryVersion() +static string GetMPILibraryVersion() { ostringstream oss; #if defined(MPI_VERSION) && (MPI_VERSION >= 3) @@ -99,7 +97,7 @@ string GetMPILibraryVersion() #define safes(arg) ((arg) ? ((const char*)(arg)) : "") -string GetOpenGLInfo() +static string GetOpenGLInfo() { ostringstream oss; vtkNew rwin; @@ -111,7 +109,7 @@ string GetOpenGLInfo() return oss.str(); } -int TestSystemCaps(int argc, char* argv[]) +extern int TestSystemCaps(int argc, char* argv[]) { (void)argc; (void)argv; @@ -129,13 +127,13 @@ int TestSystemCaps(int argc, char* argv[]) << "CPU = " << sysinfo.GetCPUDescription() << endl << "RAM = " << sysinfo.GetMemoryDescription() << endl << endl -#if defined(TEST_MPI_CAPS) +#if VTK_MODULE_ENABLE_VTK_ParallelMPI << "MPI:" << endl << "Version = " << GetMPIVersion() << endl << "Library = " << GetMPILibraryVersion() << endl << endl #endif -#if defined(TEST_PY_CAPS) +#if VTK_MODULE_ENABLE_VTK_Python << "Python:" << endl << "Version = " << GetPythonVersion() << endl << endl diff --git a/Remoting/Views/Testing/Cxx/TestTransferFunctionManager.cxx b/Remoting/Views/Testing/Cxx/TestTransferFunctionManager.cxx index 8ec3a001b31d974c8317a666edfec88153eeed09..8180f9e063c8257870fff88e79497940b0cdc509 100644 --- a/Remoting/Views/Testing/Cxx/TestTransferFunctionManager.cxx +++ b/Remoting/Views/Testing/Cxx/TestTransferFunctionManager.cxx @@ -13,7 +13,7 @@ #include #include -int TestTransferFunctionManager(int argc, char* argv[]) +extern int TestTransferFunctionManager(int argc, char* argv[]) { (void)argc; vtkInitializationHelper::Initialize(argv[0], vtkProcessModule::PROCESS_CLIENT); diff --git a/Remoting/Views/Testing/Cxx/TestTransferFunctionPresets.cxx b/Remoting/Views/Testing/Cxx/TestTransferFunctionPresets.cxx index 446208ad00a6c06e0f348d6acbd0bcd5900e3e97..b22767d79c430067073b588c95f3f3ab5601820c 100644 --- a/Remoting/Views/Testing/Cxx/TestTransferFunctionPresets.cxx +++ b/Remoting/Views/Testing/Cxx/TestTransferFunctionPresets.cxx @@ -24,7 +24,7 @@ return EXIT_FAILURE; \ } -int TestTransferFunctionPresets(int argc, char* argv[]) +extern int TestTransferFunctionPresets(int argc, char* argv[]) { (void)argc; diff --git a/Remoting/Views/vtkPVAxesWidget.cxx b/Remoting/Views/vtkPVAxesWidget.cxx index ee068b38b37dbed8a17dbe06ecf9ce645cf89ea3..3af3c82801e7b83839f27b2d62bdb5b294c094ad 100644 --- a/Remoting/Views/vtkPVAxesWidget.cxx +++ b/Remoting/Views/vtkPVAxesWidget.cxx @@ -17,6 +17,7 @@ #include "vtkRenderWindowInteractor.h" #include "vtkRenderer.h" +#include #include vtkStandardNewMacro(vtkPVAxesWidget); @@ -454,19 +455,13 @@ void vtkPVAxesWidget::ResizeTopLeft() this->StartPosition[0] = 0; newPos[0] = 0; } - if (newPos[0] >= newPos[2] - 0.01) - { - newPos[0] = newPos[2] - 0.01; - } + newPos[0] = std::min(newPos[0], newPos[2] - 0.01); if (newPos[3] > 1) { this->StartPosition[1] = size[1]; newPos[3] = 1; } - if (newPos[3] <= newPos[1] + 0.01) - { - newPos[3] = newPos[1] + 0.01; - } + newPos[3] = std::max(newPos[3], newPos[1] + 0.01); this->Renderer->SetViewport(newPos); this->Interactor->Render(); @@ -514,19 +509,13 @@ void vtkPVAxesWidget::ResizeTopRight() this->StartPosition[0] = size[0]; newPos[2] = 1; } - if (newPos[2] <= newPos[0] + 0.01) - { - newPos[2] = newPos[0] + 0.01; - } + newPos[2] = std::max(newPos[2], newPos[0] + 0.01); if (newPos[3] > 1) { this->StartPosition[1] = size[1]; newPos[3] = 1; } - if (newPos[3] <= newPos[1] + 0.01) - { - newPos[3] = newPos[1] + 0.01; - } + newPos[3] = std::max(newPos[3], newPos[1] + 0.01); this->Renderer->SetViewport(newPos); this->Interactor->Render(); @@ -573,19 +562,13 @@ void vtkPVAxesWidget::ResizeBottomLeft() this->StartPosition[0] = 0; newPos[0] = 0; } - if (newPos[0] >= newPos[2] - 0.01) - { - newPos[0] = newPos[2] - 0.01; - } + newPos[0] = std::min(newPos[0], newPos[2] - 0.01); if (newPos[1] < 0) { this->StartPosition[1] = 0; newPos[1] = 0; } - if (newPos[1] >= newPos[3] - 0.01) - { - newPos[1] = newPos[3] - 0.01; - } + newPos[1] = std::min(newPos[1], newPos[3] - 0.01); this->Renderer->SetViewport(newPos); this->Interactor->Render(); @@ -636,19 +619,13 @@ void vtkPVAxesWidget::ResizeBottomRight() this->StartPosition[0] = size[0]; newPos[2] = 1; } - if (newPos[2] <= newPos[0] + 0.01) - { - newPos[2] = newPos[0] + 0.01; - } + newPos[2] = std::max(newPos[2], newPos[0] + 0.01); if (newPos[1] < 0) { this->StartPosition[1] = 0; newPos[1] = 0; } - if (newPos[1] >= newPos[3] - 0.01) - { - newPos[1] = newPos[3] - 0.01; - } + newPos[1] = std::min(newPos[1], newPos[3] - 0.01); this->Renderer->SetViewport(newPos); this->Interactor->Render(); diff --git a/Remoting/Views/vtkPVLODActor.cxx b/Remoting/Views/vtkPVLODActor.cxx index 38178754bbf9bccde8038afee2f9936c6d41f0e3..dc1fed3c170df7beaac5e7d20d85538515df520f 100644 --- a/Remoting/Views/vtkPVLODActor.cxx +++ b/Remoting/Views/vtkPVLODActor.cxx @@ -15,6 +15,7 @@ #include "vtkTimerLog.h" #include "vtkTransform.h" +#include #include #if VTK_MODULE_ENABLE_VTK_RenderingRayTracing @@ -268,14 +269,8 @@ double* vtkPVLODActor::GetBounds() { for (n = 0; n < 3; n++) { - if (bbox[i * 3 + n] < this->Bounds[n * 2]) - { - this->Bounds[n * 2] = bbox[i * 3 + n]; - } - if (bbox[i * 3 + n] > this->Bounds[n * 2 + 1]) - { - this->Bounds[n * 2 + 1] = bbox[i * 3 + n]; - } + this->Bounds[n * 2] = std::min(this->Bounds[n * 2], bbox[i * 3 + n]); + this->Bounds[n * 2 + 1] = std::max(this->Bounds[n * 2 + 1], bbox[i * 3 + n]); } } this->BoundsMTime.Modified(); diff --git a/Remoting/Views/vtkPVLODVolume.cxx b/Remoting/Views/vtkPVLODVolume.cxx index c8f1808e0484d52934f9c1cdee84401a118ad59e..309ccdc4f08278494c23a9723ecdfc9540cc9318 100644 --- a/Remoting/Views/vtkPVLODVolume.cxx +++ b/Remoting/Views/vtkPVLODVolume.cxx @@ -17,6 +17,7 @@ #include "vtkVolumeMapper.h" #include "vtkVolumeProperty.h" +#include #include //----------------------------------------------------------------------------- @@ -260,14 +261,8 @@ double* vtkPVLODVolume::GetBounds() { for (n = 0; n < 3; n++) { - if (bbox[i * 3 + n] < this->Bounds[n * 2]) - { - this->Bounds[n * 2] = bbox[i * 3 + n]; - } - if (bbox[i * 3 + n] > this->Bounds[n * 2 + 1]) - { - this->Bounds[n * 2 + 1] = bbox[i * 3 + n]; - } + this->Bounds[n * 2] = std::min(this->Bounds[n * 2], bbox[i * 3 + n]); + this->Bounds[n * 2 + 1] = std::max(this->Bounds[n * 2 + 1], bbox[i * 3 + n]); } } this->BoundsMTime.Modified(); diff --git a/Remoting/Views/vtkPVRenderView.cxx b/Remoting/Views/vtkPVRenderView.cxx index 97d98b3a6a8ed5ef2c2b1a8fe6970660049841ee..eb7d7d0538f013b0559248ff16926ae8d36f20ea 100644 --- a/Remoting/Views/vtkPVRenderView.cxx +++ b/Remoting/Views/vtkPVRenderView.cxx @@ -2989,6 +2989,8 @@ void vtkPVRenderView::SetStereoRender(int val) } //---------------------------------------------------------------------------- +namespace +{ inline int vtkGetNumberOfRendersPerFrame(int stereoMode) { switch (stereoMode) @@ -3011,6 +3013,7 @@ inline int vtkGetNumberOfRendersPerFrame(int stereoMode) return 1; } } +} //---------------------------------------------------------------------------- void vtkPVRenderView::UpdateStereoProperties() @@ -3042,9 +3045,10 @@ void vtkPVRenderView::UpdateStereoProperties() // in this mode, the render server processes are showing results to the user // and the stereo mode is more relevant on the server side than the client // side since the client is merely a driver. - if (vtkGetNumberOfRendersPerFrame(server_type) != vtkGetNumberOfRendersPerFrame(client_type)) + if (::vtkGetNumberOfRendersPerFrame(server_type) != + ::vtkGetNumberOfRendersPerFrame(client_type)) { - if (vtkGetNumberOfRendersPerFrame(server_type) == 2) + if (::vtkGetNumberOfRendersPerFrame(server_type) == 2) { client_type = VTK_STEREO_EMULATE; } @@ -3059,7 +3063,7 @@ void vtkPVRenderView::UpdateStereoProperties() // the client is the main viewport for the user, the server side processes // are not showing final results to the user. The server never needs any 2 // pass mode except VTK_STEREO_EMULATE. - if (vtkGetNumberOfRendersPerFrame(client_type) == 2) + if (::vtkGetNumberOfRendersPerFrame(client_type) == 2) { server_type = VTK_STEREO_EMULATE; } diff --git a/Remoting/Views/vtkPVScalarBarActor.cxx b/Remoting/Views/vtkPVScalarBarActor.cxx index 3355d0a60c84a99c7880cc43c58488c3d45e2bef..5e05fda375ea7c60a81808497c6b5cd5fcb1ab69 100644 --- a/Remoting/Views/vtkPVScalarBarActor.cxx +++ b/Remoting/Views/vtkPVScalarBarActor.cxx @@ -669,10 +669,7 @@ void vtkPVScalarBarActor::ConfigureTicks() double tsize[2]; dummyActor->GetSize(this->P->Viewport, tsize); - if (tsize[1] < targetHeight) - { - targetHeight = tsize[1]; - } + targetHeight = std::min(targetHeight, tsize[1]); } bool precede = this->TextPosition == vtkScalarBarActor::PrecedeScalarBar; @@ -694,10 +691,7 @@ void vtkPVScalarBarActor::ConfigureTicks() vtkTextActor* textActor = this->P->TextActors[labelIdx]; int labelFontSize = textActor->GetTextProperty()->GetFontSize(); - if (labelFontSize < minimumFontSize) - { - minimumFontSize = labelFontSize; - } + minimumFontSize = std::min(minimumFontSize, labelFontSize); } // Now place the label actors diff --git a/Remoting/Views/vtkSMCinemaVolumetricImageExtractWriterProxy.cxx b/Remoting/Views/vtkSMCinemaVolumetricImageExtractWriterProxy.cxx index 1cb45f62894a954630c58961428ef7a627db0102..6cc7639c36819af39dc0b24f45e71531f8bef778 100644 --- a/Remoting/Views/vtkSMCinemaVolumetricImageExtractWriterProxy.cxx +++ b/Remoting/Views/vtkSMCinemaVolumetricImageExtractWriterProxy.cxx @@ -315,10 +315,7 @@ bool vtkSMCinemaVolumetricImageExtractWriterProxy::WriteInternal( // for when number_of_opacity_levels is greater than 1 that adds number_of_opacity_levels**r // for each combination // of functions - if (maximum_number_of_functions > number_of_functions) - { - maximum_number_of_functions = number_of_functions; - } + maximum_number_of_functions = std::min(maximum_number_of_functions, number_of_functions); int sum = 0; for (int r = 1; r < maximum_number_of_functions; r++) { diff --git a/Remoting/Views/vtkSMRenderViewProxy.cxx b/Remoting/Views/vtkSMRenderViewProxy.cxx index 57f1f50b3d8e3473800b240ab70d5d7afa12b614..7f88436c5ff350d24e73807bf85809b39bf691e0 100644 --- a/Remoting/Views/vtkSMRenderViewProxy.cxx +++ b/Remoting/Views/vtkSMRenderViewProxy.cxx @@ -54,6 +54,7 @@ #include "vtkSmartPointer.h" #include "vtkTransform.h" +#include #include #include @@ -1404,14 +1405,8 @@ bool vtkSMRenderViewProxy::ComputeVisibleScalarRange( double tempRange[2]; vtkSMPropertyHelper(rangeExtractor, "Range").Get(tempRange, 2); - if (tempRange[0] < range[0]) - { - range[0] = tempRange[0]; - } - if (tempRange[1] > range[1]) - { - range[1] = tempRange[1]; - } + range[0] = std::min(range[0], tempRange[0]); + range[1] = std::max(range[1], tempRange[1]); } return (range[1] >= range[0]); diff --git a/Remoting/Views/vtkSMSaveScreenshotProxy.cxx b/Remoting/Views/vtkSMSaveScreenshotProxy.cxx index ca24d296f9c5752faacbd09d4fa854056f4d5405..9e08a95acc5fb7e9aa462185ce4ed55b9fb0b896 100644 --- a/Remoting/Views/vtkSMSaveScreenshotProxy.cxx +++ b/Remoting/Views/vtkSMSaveScreenshotProxy.cxx @@ -36,6 +36,8 @@ #include #include +namespace +{ template T SymmetricReturnCode(const T& ref) { @@ -64,6 +66,7 @@ bool SymmetricReturnCode(const bool& ref) int val = ref ? 1 : 0; return SymmetricReturnCode(val) != 0; } +} //============================================================================ /** @@ -949,7 +952,7 @@ vtkSmartPointer vtkSMSaveScreenshotProxy::CaptureImage( return shProxy->CaptureImage(); } -namespace detail +namespace { std::pair> GetFormatOptions(vtkSMProxy* proxy) { @@ -977,7 +980,7 @@ std::string vtkSMSaveScreenshotProxy::GetFileFormatFilters() if (auto formatProxy = pxm->GetPrototypeProxy(proxyType.GroupName.c_str(), proxyType.ProxyName.c_str())) { - const auto options = detail::GetFormatOptions(formatProxy); + const auto options = ::GetFormatOptions(formatProxy); if (options.second.empty()) { continue; @@ -1019,7 +1022,7 @@ vtkSMProxy* vtkSMSaveScreenshotProxy::GetFormatProxy(const std::string& filename if (auto formatProxy = pxm->GetPrototypeProxy(proxyType.GroupName.c_str(), proxyType.ProxyName.c_str())) { - const auto options = detail::GetFormatOptions(formatProxy); + const auto options = ::GetFormatOptions(formatProxy); if (!options.second.empty()) { const auto& exts = options.second; diff --git a/Remoting/Views/vtkSMScalarBarWidgetRepresentationProxy.cxx b/Remoting/Views/vtkSMScalarBarWidgetRepresentationProxy.cxx index 70470cb517f6db7f74c13267de4d31665268251c..e229fba0d288bed2d5602bbf7a438e8481fd2594 100644 --- a/Remoting/Views/vtkSMScalarBarWidgetRepresentationProxy.cxx +++ b/Remoting/Views/vtkSMScalarBarWidgetRepresentationProxy.cxx @@ -98,22 +98,10 @@ void vtkSMScalarBarWidgetRepresentationProxy::ExecuteEvent(unsigned long event) double position[2]; position[0] = repr->GetPosition()[0]; position[1] = repr->GetPosition()[1]; - if (position[0] < 0.0) - { - position[0] = 0.0; - } - if (position[0] > 0.97) - { - position[0] = 0.97; - } - if (position[1] < 0.0) - { - position[1] = 0.0; - } - if (position[1] > 0.97) - { - position[1] = 0.97; - } + position[0] = std::max(position[0], 0.0); + position[0] = std::min(position[0], 0.97); + position[1] = std::max(position[1], 0.0); + position[1] = std::min(position[1], 0.97); repr->SetPosition(position); } // user interacted. lock the position. diff --git a/Remoting/Views/vtkSMViewLayoutProxy.cxx b/Remoting/Views/vtkSMViewLayoutProxy.cxx index bf5292de06abc434c97dff60eeeeeffbda74d408..9b03e7903cbfdd89d6ade425b59745946f09fecd 100644 --- a/Remoting/Views/vtkSMViewLayoutProxy.cxx +++ b/Remoting/Views/vtkSMViewLayoutProxy.cxx @@ -670,10 +670,7 @@ int vtkSMViewLayoutProxy::AssignViewToAnyCell(vtkSMViewProxy* view, int location return cur_location; } - if (location_hint < 0) - { - location_hint = 0; - } + location_hint = std::max(location_hint, 0); // If location_hint refers to an empty cell, use it. if (this->Internals->IsCellValid(location_hint)) diff --git a/Remoting/Views/vtkSMViewProxy.cxx b/Remoting/Views/vtkSMViewProxy.cxx index fcad15ffdd0e43af0728c8b81961c159ca2d6da3..212b172899eed23ecaf79ef5758f23a2775a1f54 100644 --- a/Remoting/Views/vtkSMViewProxy.cxx +++ b/Remoting/Views/vtkSMViewProxy.cxx @@ -40,7 +40,7 @@ #include -namespace vtkSMViewProxyNS +namespace { const char* GetRepresentationNameFromHints(const char* viewType, vtkPVXMLElement* hints, int port) { @@ -84,7 +84,10 @@ const char* GetRepresentationNameFromHints(const char* viewType, vtkPVXMLElement } return nullptr; } +} +namespace vtkSMViewProxyNS +{ /** * Extends vtkWindowToImageFilter to call * `vtkSMViewProxy::RenderForImageCapture()` when the filter wants to request a @@ -538,8 +541,8 @@ const char* vtkSMViewProxy::GetRepresentationType(vtkSMSourceProxy* producer, in // Process producer hints to see if indicates what type of representation // to create for this view. - if (const char* reprName = vtkSMViewProxyNS::GetRepresentationNameFromHints( - this->GetXMLName(), producer->GetHints(), outputPort)) + if (const char* reprName = + ::GetRepresentationNameFromHints(this->GetXMLName(), producer->GetHints(), outputPort)) { return reprName; } diff --git a/Utilities/Versioning/vtkPVVersionQuick.h.in b/Utilities/Versioning/vtkPVVersionQuick.h.in index ee6ff43259b6d0acd2074d58006ed7e02f1e94e6..b5ee640617377833d49e8f48baa57aec28c586a4 100644 --- a/Utilities/Versioning/vtkPVVersionQuick.h.in +++ b/Utilities/Versioning/vtkPVVersionQuick.h.in @@ -10,7 +10,7 @@ #define PARAVIEW_VERSION "@PARAVIEW_VERSION@" #define PARAVIEW_VERSION_CHECK(major, minor, build) \ - (10000000000ULL * major + 100000000ULL * minor + build) + ((10000000000ULL * (major)) + (100000000ULL * (minor)) + (build)) #define PARAVIEW_VERSION_NUMBER_QUICK \ PARAVIEW_VERSION_CHECK(PARAVIEW_VERSION_MAJOR, PARAVIEW_VERSION_MINOR, PARAVIEW_VERSION_EPOCH) diff --git a/Utilities/WrapClientServer/vtkWrapClientServer.c b/Utilities/WrapClientServer/vtkWrapClientServer.c index 34c7d98ad06445527cc348f05d428546f853eec1..5e6c2082968b3c260611197db2f92625332c22a4 100644 --- a/Utilities/WrapClientServer/vtkWrapClientServer.c +++ b/Utilities/WrapClientServer/vtkWrapClientServer.c @@ -1359,7 +1359,7 @@ int main(int argc, char* argv[]) } if (!data->IsAbstract) { - fprintf(fp, "\nvtkObjectBase *%sClientServerNewCommand(void* /*ctx*/)\n{\n", data->Name); + fprintf(fp, "\nstatic vtkObjectBase *%sClientServerNewCommand(void* /*ctx*/)\n{\n", data->Name); fprintf(fp, " return %s::New();\n}\n\n", data->Name); } diff --git a/VTKExtensions/AMR/vtkAMRConnectivity.cxx b/VTKExtensions/AMR/vtkAMRConnectivity.cxx index 97c12daf48de8c2947abcf4ded8d38b8a01b4269..814e94a3fe62473e07042d9ff333f659bb977281 100644 --- a/VTKExtensions/AMR/vtkAMRConnectivity.cxx +++ b/VTKExtensions/AMR/vtkAMRConnectivity.cxx @@ -31,6 +31,7 @@ #include "vtkMPIController.h" #endif +#include #include #include @@ -412,10 +413,7 @@ int vtkAMRConnectivity::DoRequestData(vtkNonOverlappingAMR* volume, const char* for (int blockId = 0; blockId < this->Helper->GetNumberOfBlocksInLevel(level); blockId++) { vtkAMRDualGridHelperBlock* block = this->Helper->GetBlock(level, blockId); - if (block->BlockId > maxId) - { - maxId = block->BlockId; - } + maxId = std::max(maxId, block->BlockId); } this->NeighborList[level].resize(maxId + 1); for (int blockId = 0; blockId < maxId; blockId++) diff --git a/VTKExtensions/AMR/vtkAMRDualClip.cxx b/VTKExtensions/AMR/vtkAMRDualClip.cxx index 2e2a6e119241aa49bab6089c27f11b9ed3bc4ada..b2b162705008afe205d2f2ee7e3ff9408f0f2205 100644 --- a/VTKExtensions/AMR/vtkAMRDualClip.cxx +++ b/VTKExtensions/AMR/vtkAMRDualClip.cxx @@ -33,6 +33,8 @@ #include "vtkUniformGrid.h" #include "vtkUnsignedCharArray.h" #include "vtkUnstructuredGrid.h" + +#include #include #include @@ -169,6 +171,8 @@ unsigned char* vtkAMRDualClipLocator::GetLevelMaskPointer() return this->LevelMaskArray->GetPointer(0); } +namespace +{ //---------------------------------------------------------------------------- vtkAMRDualClipLocator* vtkAMRDualClipGetBlockLocator(vtkAMRDualGridHelperBlock* block) { @@ -238,6 +242,7 @@ void vtkDualGridClipInitializeLevelMask( scalarPtr += 2 * dims[0]; } } +} //---------------------------------------------------------------------------- // Initializes the center region of the level mask. @@ -257,7 +262,7 @@ void vtkAMRDualClipLocator::ComputeLevelMask(vtkDataArray* scalars, double isoVa switch (scalars->GetDataType()) { - vtkTemplateMacro(vtkDualGridClipInitializeLevelMask( + vtkTemplateMacro(::vtkDualGridClipInitializeLevelMask( (VTK_TT*)(scalars->GetVoidPointer(0)), isoValue, this->GetLevelMaskPointer(), dims)); default: vtkGenericWarningMacro("Execute: Unknown ScalarType"); @@ -465,7 +470,7 @@ void vtkAMRDualClipLocator::CopyNeighborLevelMask( { return; } - vtkAMRDualClipLocator* neighborLocator = vtkAMRDualClipGetBlockLocator(neighborBlock); + vtkAMRDualClipLocator* neighborLocator = ::vtkAMRDualClipGetBlockLocator(neighborBlock); if (neighborLocator == nullptr) { // Figuring out logic for parallel case. return; @@ -500,30 +505,12 @@ void vtkAMRDualClipLocator::CopyNeighborLevelMask( sourceExt[5] = ((sourceExt[5] + 1) << levelDiff) - 1; // Take the intersection to find the destination extent. - if (destExt[0] < sourceExt[0]) - { - destExt[0] = sourceExt[0]; - } - if (destExt[1] > sourceExt[1]) - { - destExt[1] = sourceExt[1]; - } - if (destExt[2] < sourceExt[2]) - { - destExt[2] = sourceExt[2]; - } - if (destExt[3] > sourceExt[3]) - { - destExt[3] = sourceExt[3]; - } - if (destExt[4] < sourceExt[4]) - { - destExt[4] = sourceExt[4]; - } - if (destExt[5] > sourceExt[5]) - { - destExt[5] = sourceExt[5]; - } + destExt[0] = std::max(destExt[0], sourceExt[0]); + destExt[1] = std::min(destExt[1], sourceExt[1]); + destExt[2] = std::max(destExt[2], sourceExt[2]); + destExt[3] = std::min(destExt[3], sourceExt[3]); + destExt[4] = std::max(destExt[4], sourceExt[4]); + destExt[5] = std::min(destExt[5], sourceExt[5]); // Loop over the extent. unsigned char* sourcePtr = neighborLocator->GetLevelMaskPointer(); @@ -730,22 +717,13 @@ vtkIdType* vtkAMRDualClipLocator::GetCornerPointer( // It looks like we need to know the origin of the block. xCell += blockOrigin[0]; xCell = ((xCell >> diff) << diff) - blockOrigin[0]; - if (xCell < 0) - { - xCell = 0; - } + xCell = std::max(xCell, 0); yCell += blockOrigin[1]; yCell = ((yCell >> diff) << diff) - blockOrigin[1]; - if (yCell < 0) - { - yCell = 0; - } + yCell = std::max(yCell, 0); zCell += blockOrigin[2]; zCell = ((zCell >> diff) << diff) - blockOrigin[2]; - if (zCell < 0) - { - zCell = 0; - } + zCell = std::max(zCell, 0); } return this->Corners + (xCell + (yCell * this->YIncrement) + (zCell * this->ZIncrement)); @@ -851,8 +829,8 @@ void vtkAMRDualClipLocator::SharePointIdsWithNeighbor( void vtkAMRDualClipLocator::ShareBlockLocatorWithNeighbor( vtkAMRDualGridHelperBlock* block, vtkAMRDualGridHelperBlock* neighbor) { - vtkAMRDualClipLocator* blockLocator = vtkAMRDualClipGetBlockLocator(block); - vtkAMRDualClipLocator* neighborLocator = vtkAMRDualClipGetBlockLocator(neighbor); + vtkAMRDualClipLocator* blockLocator = ::vtkAMRDualClipGetBlockLocator(block); + vtkAMRDualClipLocator* neighborLocator = ::vtkAMRDualClipGetBlockLocator(neighbor); // Working on the logic to parallelize level mask. if (blockLocator == nullptr || neighborLocator == nullptr) @@ -891,54 +869,18 @@ void vtkAMRDualClipLocator::ShareBlockLocatorWithNeighbor( ext[4] = (ext[4] >> levelDiff) - block->OriginIndex[2]; ext[5] = (ext[5] >> levelDiff) - block->OriginIndex[2]; // Intersect with in (source) low level block. - if (ext[0] < 0) - { - ext[0] = 0; - } - if (ext[0] > blockLocator->DualCellDimensions[0]) - { - ext[0] = blockLocator->DualCellDimensions[0]; - } - if (ext[1] < 0) - { - ext[1] = 0; - } - if (ext[1] > blockLocator->DualCellDimensions[0]) - { - ext[1] = blockLocator->DualCellDimensions[0]; - } - if (ext[2] < 0) - { - ext[2] = 0; - } - if (ext[2] > blockLocator->DualCellDimensions[1]) - { - ext[2] = blockLocator->DualCellDimensions[1]; - } - if (ext[3] < 0) - { - ext[3] = 0; - } - if (ext[3] > blockLocator->DualCellDimensions[1]) - { - ext[3] = blockLocator->DualCellDimensions[1]; - } - if (ext[4] < 0) - { - ext[4] = 0; - } - if (ext[4] > blockLocator->DualCellDimensions[2]) - { - ext[4] = blockLocator->DualCellDimensions[2]; - } - if (ext[5] < 0) - { - ext[5] = 0; - } - if (ext[5] > blockLocator->DualCellDimensions[2]) - { - ext[5] = blockLocator->DualCellDimensions[2]; - } + ext[0] = std::max(ext[0], 0); + ext[0] = std::min(ext[0], blockLocator->DualCellDimensions[0]); + ext[1] = std::max(ext[1], 0); + ext[1] = std::min(ext[1], blockLocator->DualCellDimensions[0]); + ext[2] = std::max(ext[2], 0); + ext[2] = std::min(ext[2], blockLocator->DualCellDimensions[1]); + ext[3] = std::max(ext[3], 0); + ext[3] = std::min(ext[3], blockLocator->DualCellDimensions[1]); + ext[4] = std::max(ext[4], 0); + ext[4] = std::min(ext[4], blockLocator->DualCellDimensions[2]); + ext[5] = std::max(ext[5], 0); + ext[5] = std::min(ext[5], blockLocator->DualCellDimensions[2]); vtkIdType pointId; int xOut, yOut, zOut; @@ -951,27 +893,18 @@ void vtkAMRDualClipLocator::ShareBlockLocatorWithNeighbor( // Like the other places this locator indexconversion is done, // The min ghost index is shifted to fit into the locator array. zOut = ((zIn + block->OriginIndex[2]) << levelDiff) - neighbor->OriginIndex[2]; - if (zOut < 0) - { - zOut = 0; - } + zOut = std::max(zOut, 0); outOffsetZ = zOut * neighborLocator->ZIncrement; for (int yIn = ext[2]; yIn <= ext[3]; ++yIn) { inOffsetX = inOffsetY; yOut = ((yIn + block->OriginIndex[1]) << levelDiff) - neighbor->OriginIndex[1]; - if (yOut < 0) - { - yOut = 0; - } + yOut = std::max(yOut, 0); outOffsetY = outOffsetZ + yOut * neighborLocator->YIncrement; for (int xIn = ext[0]; xIn <= ext[1]; ++xIn) { xOut = ((xIn + block->OriginIndex[0]) << levelDiff) - neighbor->OriginIndex[0]; - if (xOut < 0) - { - xOut = 0; - } + xOut = std::max(xOut, 0); outOffsetX = outOffsetY + xOut; pointId = blockLocator->XEdges[inOffsetX]; @@ -1229,6 +1162,8 @@ vtkMultiBlockDataSet* vtkAMRDualClip::DoRequestData( //---------------------------------------------------------------------------- // The only data specific stuff we need to do for the contour. //---------------------------------------------------------------------------- +namespace +{ template void vtkDualGridContourCastCornerValues(T* ptr, vtkIdType offsets[8], double values[8]) { @@ -1241,6 +1176,7 @@ void vtkDualGridContourCastCornerValues(T* ptr, vtkIdType offsets[8], double val values[6] = (double)(ptr[offsets[6]]); values[7] = (double)(ptr[offsets[7]]); } +} //---------------------------------------------------------------------------- void vtkAMRDualClip::ShareBlockLocatorWithNeighbors(vtkAMRDualGridHelperBlock* block) @@ -1279,7 +1215,7 @@ void vtkAMRDualClip::ShareBlockLocatorWithNeighbors(vtkAMRDualGridHelperBlock* b // The unused center flag is used as a flag to indicate if (neighbor && neighbor->Image && neighbor->RegionBits[1][1][1]) { - vtkAMRDualClipLocator* blockLocator = vtkAMRDualClipGetBlockLocator(block); + vtkAMRDualClipLocator* blockLocator = ::vtkAMRDualClipGetBlockLocator(block); blockLocator->ShareBlockLocatorWithNeighbor(block, neighbor); } } @@ -1301,7 +1237,7 @@ void vtkAMRDualClip::InitializeLevelMask(vtkAMRDualGridHelperBlock* block) } vtkDataArray* volumeFractionArray = image->GetCellData()->GetArray(this->Helper->GetArrayName()); - vtkAMRDualClipLocator* locator = vtkAMRDualClipGetBlockLocator(block); + vtkAMRDualClipLocator* locator = ::vtkAMRDualClipGetBlockLocator(block); locator->ComputeLevelMask(volumeFractionArray, this->IsoValue, this->EnableInternalDecimation); vtkAMRDualGridHelperBlock* neighbor; @@ -1343,7 +1279,7 @@ void vtkAMRDualClip::InitializeLevelMask(vtkAMRDualGridHelperBlock* block) // was copied to this block already. if (neighbor && neighbor->RegionBits[1][1][1] != 0) { - neighborLocator = vtkAMRDualClipGetBlockLocator(neighbor); + neighborLocator = ::vtkAMRDualClipGetBlockLocator(neighbor); image = neighbor->Image; if (image) { @@ -1431,7 +1367,7 @@ void vtkAMRDualClip::ShareLevelMask(vtkAMRDualGridHelperBlock* block) // was copied to this block already. if (neighbor && neighbor->Image && neighbor->RegionBits[1][1][1] != 0) { - neighborLocator = vtkAMRDualClipGetBlockLocator(neighbor); + neighborLocator = ::vtkAMRDualClipGetBlockLocator(neighbor); // NOLINTNEXTLINE(readability-suspicious-call-argument) neighborLocator->CopyNeighborLevelMask(neighbor, block); } @@ -1477,7 +1413,7 @@ void vtkAMRDualClip::ProcessBlock( if (this->EnableMergePoints) { this->InitializeLevelMask(block); - this->BlockLocator = vtkAMRDualClipGetBlockLocator(block); + this->BlockLocator = ::vtkAMRDualClipGetBlockLocator(block); } else { // Shared locator. @@ -2004,7 +1940,7 @@ void vtkAMRDualClip::DistributeLevelMasks() if (block->Image) { scalars = block->Image->GetCellData()->GetArray(arrayName); - vtkAMRDualClipLocator* blockLocator = vtkAMRDualClipGetBlockLocator(block); + vtkAMRDualClipLocator* blockLocator = ::vtkAMRDualClipGetBlockLocator(block); blockLocator->ComputeLevelMask( scalars, this->IsoValue, this->EnableInternalDecimation); blockLevelMaskArray = blockLocator->GetLevelMaskArray(); @@ -2013,7 +1949,7 @@ void vtkAMRDualClip::DistributeLevelMasks() { scalars = neighborBlock->Image->GetCellData()->GetArray(arrayName); vtkAMRDualClipLocator* neighborLocator = - vtkAMRDualClipGetBlockLocator(neighborBlock); + ::vtkAMRDualClipGetBlockLocator(neighborBlock); neighborLocator->ComputeLevelMask( scalars, this->IsoValue, this->EnableInternalDecimation); neighborLevelMaskArray = neighborLocator->GetLevelMaskArray(); diff --git a/VTKExtensions/AMR/vtkAMRDualContour.cxx b/VTKExtensions/AMR/vtkAMRDualContour.cxx index b21b79d7b41526e1e9a8f524af873132f37cc6b0..11d4e2943199365717ca0317bbc45d5fb6a72166 100644 --- a/VTKExtensions/AMR/vtkAMRDualContour.cxx +++ b/VTKExtensions/AMR/vtkAMRDualContour.cxx @@ -33,6 +33,8 @@ #include "vtkUniformGrid.h" #include "vtkUnsignedCharArray.h" #include "vtkUnstructuredGrid.h" + +#include #include #include @@ -307,10 +309,7 @@ vtkIdType* vtkAMRDualContourEdgeLocator::GetEdgePointer( } diff1 = this->RegionLevelDifference[rx1][ry1][rz1]; // Take the minimum diff because one unique point makes a unique edge. - if (diff1 < diff0) - { - diff0 = diff1; - } + diff0 = std::min(diff0, diff1); // Is does not matter what we do with edges that collase to a point // because the isosurface will never split the two. if (diff0) @@ -421,6 +420,8 @@ vtkIdType* vtkAMRDualContourEdgeLocator::GetCornerPointer( } //---------------------------------------------------------------------------- +namespace +{ vtkAMRDualContourEdgeLocator* vtkAMRDualContourGetBlockLocator(vtkAMRDualGridHelperBlock* block) { if (block->UserData == nullptr) @@ -445,14 +446,15 @@ vtkAMRDualContourEdgeLocator* vtkAMRDualContourGetBlockLocator(vtkAMRDualGridHel } return (vtkAMRDualContourEdgeLocator*)(block->UserData); } +} //---------------------------------------------------------------------------- // This version works with higher level neighbor blocks. void vtkAMRDualContourEdgeLocator::ShareBlockLocatorWithNeighbor( vtkAMRDualGridHelperBlock* block, vtkAMRDualGridHelperBlock* neighbor) { - vtkAMRDualContourEdgeLocator* blockLocator = vtkAMRDualContourGetBlockLocator(block); - vtkAMRDualContourEdgeLocator* neighborLocator = vtkAMRDualContourGetBlockLocator(neighbor); + vtkAMRDualContourEdgeLocator* blockLocator = ::vtkAMRDualContourGetBlockLocator(block); + vtkAMRDualContourEdgeLocator* neighborLocator = ::vtkAMRDualContourGetBlockLocator(neighbor); // Compute the extent of the locator to copy. // Moving too many will not hurt, so do not worry about which block owns the region. @@ -485,54 +487,18 @@ void vtkAMRDualContourEdgeLocator::ShareBlockLocatorWithNeighbor( ext[4] = (ext[4] >> levelDiff) - block->OriginIndex[2]; ext[5] = (ext[5] >> levelDiff) - block->OriginIndex[2]; // Intersect with in (source) low level block. - if (ext[0] < 0) - { - ext[0] = 0; - } - if (ext[0] > blockLocator->DualCellDimensions[0]) - { - ext[0] = blockLocator->DualCellDimensions[0]; - } - if (ext[1] < 0) - { - ext[1] = 0; - } - if (ext[1] > blockLocator->DualCellDimensions[0]) - { - ext[1] = blockLocator->DualCellDimensions[0]; - } - if (ext[2] < 0) - { - ext[2] = 0; - } - if (ext[2] > blockLocator->DualCellDimensions[1]) - { - ext[2] = blockLocator->DualCellDimensions[1]; - } - if (ext[3] < 0) - { - ext[3] = 0; - } - if (ext[3] > blockLocator->DualCellDimensions[1]) - { - ext[3] = blockLocator->DualCellDimensions[1]; - } - if (ext[4] < 0) - { - ext[4] = 0; - } - if (ext[4] > blockLocator->DualCellDimensions[2]) - { - ext[4] = blockLocator->DualCellDimensions[2]; - } - if (ext[5] < 0) - { - ext[5] = 0; - } - if (ext[5] > blockLocator->DualCellDimensions[2]) - { - ext[5] = blockLocator->DualCellDimensions[2]; - } + ext[0] = std::max(ext[0], 0); + ext[0] = std::min(ext[0], blockLocator->DualCellDimensions[0]); + ext[1] = std::max(ext[1], 0); + ext[1] = std::min(ext[1], blockLocator->DualCellDimensions[0]); + ext[2] = std::max(ext[2], 0); + ext[2] = std::min(ext[2], blockLocator->DualCellDimensions[1]); + ext[3] = std::max(ext[3], 0); + ext[3] = std::min(ext[3], blockLocator->DualCellDimensions[1]); + ext[4] = std::max(ext[4], 0); + ext[4] = std::min(ext[4], blockLocator->DualCellDimensions[2]); + ext[5] = std::max(ext[5], 0); + ext[5] = std::min(ext[5], blockLocator->DualCellDimensions[2]); vtkIdType pointId; int xOut, yOut, zOut; @@ -545,27 +511,18 @@ void vtkAMRDualContourEdgeLocator::ShareBlockLocatorWithNeighbor( // Like the other places this locator indexconversion is done, // The min ghost index is shifted to fit into the locator array. zOut = ((zIn + block->OriginIndex[2]) << levelDiff) - neighbor->OriginIndex[2]; - if (zOut < 0) - { - zOut = 0; - } + zOut = std::max(zOut, 0); outOffsetZ = zOut * neighborLocator->ZIncrement; for (int yIn = ext[2]; yIn <= ext[3]; ++yIn) { inOffsetX = inOffsetY; yOut = ((yIn + block->OriginIndex[1]) << levelDiff) - neighbor->OriginIndex[1]; - if (yOut < 0) - { - yOut = 0; - } + yOut = std::max(yOut, 0); outOffsetY = outOffsetZ + yOut * neighborLocator->YIncrement; for (int xIn = ext[0]; xIn <= ext[1]; ++xIn) { xOut = ((xIn + block->OriginIndex[0]) << levelDiff) - neighbor->OriginIndex[0]; - if (xOut < 0) - { - xOut = 0; - } + xOut = std::max(xOut, 0); outOffsetX = outOffsetY + xOut; pointId = blockLocator->XEdges[inOffsetX]; @@ -862,7 +819,8 @@ void vtkAMRDualContour::ShareBlockLocatorWithNeighbors(vtkAMRDualGridHelperBlock // The unused center flag is used as a flag to indicate if (neighbor && neighbor->Image && neighbor->RegionBits[1][1][1]) { - vtkAMRDualContourEdgeLocator* blockLocator = vtkAMRDualContourGetBlockLocator(block); + vtkAMRDualContourEdgeLocator* blockLocator = + ::vtkAMRDualContourGetBlockLocator(block); blockLocator->ShareBlockLocatorWithNeighbor(block, neighbor); } } @@ -905,7 +863,7 @@ void vtkAMRDualContour::ProcessBlock( // Input the dimensions of the dual cells with ghosts. if (this->EnableMergePoints) { - this->BlockLocator = vtkAMRDualContourGetBlockLocator(block); + this->BlockLocator = ::vtkAMRDualContourGetBlockLocator(block); } else { // Shared locator. @@ -1024,6 +982,8 @@ void vtkAMRDualContour::ProcessBlock( } //---------------------------------------------------------------------------- +namespace +{ template void vtkDualGridContourCastCornerValues(T* ptr, vtkIdType offsets[8], double values[8]) { @@ -1036,6 +996,7 @@ void vtkDualGridContourCastCornerValues(T* ptr, vtkIdType offsets[8], double val values[6] = (double)(ptr[offsets[6]]); values[7] = (double)(ptr[offsets[7]]); } +} // Generic table for clipping a square. // We can have two polygons. @@ -1095,7 +1056,7 @@ void vtkAMRDualContour::ProcessDualCell(vtkAMRDualGridHelperBlock* block, int bl double cornerValues[8]; switch (dataType) { - vtkTemplateMacro(vtkDualGridContourCastCornerValues( + vtkTemplateMacro(::vtkDualGridContourCastCornerValues( (VTK_TT*)(volumeFractionPtr), cornerOffsets, cornerValues)); default: vtkGenericWarningMacro("Execute: Unknown ScalarType"); @@ -1670,15 +1631,6 @@ void vtkAMRDualContour::CapCell( } } -//---------------------------------------------------------------------------- -// Note that the out attribute arrays must be preallocated to correct size. -template -double vtkDualGridContourInterpolateAttribute(T* inPtr, vtkIdType inId0, vtkIdType inId1, double k) -{ - double in0 = (double)(inPtr[inId0]); - return in0 * (1.0 - k) + k * (double)(inPtr[inId1]); -} - //============================================================================ // Stuff for using input cell attributes to add output point attributes. // I am not using the built in Attribute methods for duing this, although diff --git a/VTKExtensions/AMR/vtkAMRDualGridHelper.cxx b/VTKExtensions/AMR/vtkAMRDualGridHelper.cxx index fa910cb07ec797fc3fc9f3ddffc20179e39767d7..ae54015a9ef636367d76524c03aa4fdbe011e871 100644 --- a/VTKExtensions/AMR/vtkAMRDualGridHelper.cxx +++ b/VTKExtensions/AMR/vtkAMRDualGridHelper.cxx @@ -22,6 +22,7 @@ #include "vtkSmartPointer.h" #define VTK_CREATE(type, name) vtkSmartPointer name = vtkSmartPointer::New() +#include #include #include @@ -451,6 +452,8 @@ void vtkAMRDualGridHelperBlock::ResetRegionBits() } //---------------------------------------------------------------------------- +namespace +{ void vtkAMRDualGridHelperAddBackGhostValues( vtkDataArray* inPtr, int inDim[3], vtkDataArray* outPtr, int outDim[3], int offset[3]) { @@ -499,6 +502,7 @@ void vtkAMRDualGridHelperAddBackGhostValues( } } } +} //---------------------------------------------------------------------------- void vtkAMRDualGridHelperBlock::AddBackGhostLevels(int standardBlockDimensions[3]) { @@ -569,7 +573,7 @@ void vtkAMRDualGridHelperBlock::AddBackGhostLevels(int standardBlockDimensions[3 copyArray->SetNumberOfComponents(da->GetNumberOfComponents()); copyArray->SetNumberOfTuples(newSize); copyArray->SetName(da->GetName()); - vtkAMRDualGridHelperAddBackGhostValues(da, inDim, copyArray, outDim, offset); + ::vtkAMRDualGridHelperAddBackGhostValues(da, inDim, copyArray, outDim, offset); copy->GetCellData()->AddArray(copyArray); copyArray->Delete(); } @@ -1441,6 +1445,8 @@ void vtkAMRDualGridHelper::DegenerateRegionMessageSize( // always go through an intermediate buffer (as if is were remote). // This should not add much overhead to the copy. +namespace +{ void vtkDualGridHelperCopyBlockToBlock(vtkDataArray* ptr, vtkDataArray* lowerPtr, int ext[6], int levelDiff, int yInc, int zInc, int highResBlockOriginIndex[3], int lowResBlockOriginIndex[3]) { @@ -1478,6 +1484,7 @@ void vtkDualGridHelperCopyBlockToBlock(vtkDataArray* ptr, vtkDataArray* lowerPtr zIndex += zInc; } } +} // Ghost volume fraction values are not consistent across levels. // We need the degenerate high-res volume fractions // to match corresponding values in low res-blocks. @@ -1566,13 +1573,15 @@ void vtkAMRDualGridHelper::CopyDegenerateRegionBlockToBlock(int regionX, int reg vtkDualGridHelperSkipGhostCopy = this->SkipGhostCopy; // Assume all blocks have the same extent. - vtkDualGridHelperCopyBlockToBlock(highResArray, lowResArray, ext, levelDiff, yInc, zInc, + ::vtkDualGridHelperCopyBlockToBlock(highResArray, lowResArray, ext, levelDiff, yInc, zInc, highResBlock->OriginIndex, lowResBlock->OriginIndex); } // Ghost volume fraction values are not consistent across levels. // We need the degenerate high-res volume fractions // to match corresponding values in low res-blocks. // This method copies low-res values to high-res ghost blocks. +namespace +{ template void* vtkDualGridHelperCopyBlockToMessage( T* messagePtr, vtkDataArray* lowerPtr, int ext[6], int yInc, int zInc) @@ -1591,6 +1600,7 @@ void* vtkDualGridHelperCopyBlockToMessage( } return messagePtr; } +} void* vtkAMRDualGridHelper::CopyDegenerateRegionBlockToMessage( const vtkAMRDualGridHelperDegenerateRegion& region, void* messagePtr) { @@ -1691,7 +1701,7 @@ void* vtkAMRDualGridHelper::CopyDegenerateRegionBlockToMessage( // Assume all blocks have the same extent. switch (daType) { - vtkTemplateMacro(messagePtr = vtkDualGridHelperCopyBlockToMessage( + vtkTemplateMacro(messagePtr = ::vtkDualGridHelperCopyBlockToMessage( static_cast(messagePtr), region.SourceArray, ext, yInc, zInc)); default: vtkGenericWarningMacro("Execute: Unknown ScalarType"); @@ -1702,6 +1712,8 @@ void* vtkAMRDualGridHelper::CopyDegenerateRegionBlockToMessage( } // Take the low res message and copy to the high res block. +namespace +{ template const void* vtkDualGridHelperCopyMessageToBlock(vtkDataArray* ptr, const T* messagePtr, int ext[6], int messageExt[6], int levelDiff, int yInc, int zInc, int highResBlockOriginIndex[3], @@ -1746,6 +1758,7 @@ const void* vtkDualGridHelperCopyMessageToBlock(vtkDataArray* ptr, const T* mess } return messagePtr + (messageIncZ * (messageExt[5] - messageExt[4] + 1)); } +} const void* vtkAMRDualGridHelper::CopyDegenerateRegionMessageToBlock( const vtkAMRDualGridHelperDegenerateRegion& region, const void* messagePtr, @@ -1845,7 +1858,7 @@ const void* vtkAMRDualGridHelper::CopyDegenerateRegionMessageToBlock( switch (daType) { - vtkTemplateMacro(messagePtr = vtkDualGridHelperCopyMessageToBlock(region.ReceivingArray, + vtkTemplateMacro(messagePtr = ::vtkDualGridHelperCopyMessageToBlock(region.ReceivingArray, static_cast(messagePtr), ext, messageExt, levelDiff, yInc, zInc, highResBlock->OriginIndex, lowResBlock->OriginIndex, hackLevelFlag)); default: @@ -2270,10 +2283,7 @@ int vtkAMRDualGridHelper::Initialize(vtkNonOverlappingAMR* input) this->StandardBlockDimensions[1] = standardBoxSizeIa->GetValue(1) - 2; this->StandardBlockDimensions[2] = standardBoxSizeIa->GetValue(2) - 2; // For 2d case - if (this->StandardBlockDimensions[2] < 1) - { - this->StandardBlockDimensions[2] = 1; - } + this->StandardBlockDimensions[2] = std::max(this->StandardBlockDimensions[2], 1); int lowestLevel = minLevelIa->GetValue(0); this->RootSpacing[0] = minLevelSpacingDa->GetValue(0) * (1 << (lowestLevel)); this->RootSpacing[1] = minLevelSpacingDa->GetValue(1) * (1 << (lowestLevel)); @@ -2657,21 +2667,12 @@ class vtkReduceMeta : public vtkCommunicator::Operation // // dmsgB[19] = dmsgA[19]; // lowestDims 1 // dmsgB[20] = dmsgA[20]; // lowestDims 2 } - if (dmsgB[8] > dmsgA[8]) - { - dmsgB[8] = dmsgA[8]; - } // globalBounds 0 - // if (dmsgB[22] < dmsgA[22]) { dmsgB[22] = dmsgA[22]; } // globalBounds 1 - if (dmsgB[9] > dmsgA[9]) - { - dmsgB[9] = dmsgA[9]; - } // globalBounds 2 - // if (dmsgB[24] < dmsgA[24]) { dmsgB[24] = dmsgA[24]; } // globalBounds 3 - if (dmsgB[10] > dmsgA[10]) - { - dmsgB[10] = dmsgA[10]; - } // globalBounds 4 - // if (dmsgB[26] < dmsgA[26]) { dmsgB[26] = dmsgA[26]; } // globalBounds 5 + dmsgB[8] = std::min(dmsgB[8], dmsgA[8]); // globalBounds 0 + // dmsgB[22] = std::max(dmsgB[22], dmsgA[22]); // globalBounds 1 + dmsgB[9] = std::min(dmsgB[9], dmsgA[9]); // globalBounds 2 + // dmsgB[24] = std::max(dmsgB[24], dmsgA[24]); // globalBounds 3 + dmsgB[10] = std::min(dmsgB[10], dmsgA[10]); // globalBounds 4 + // dmsgB[26] = std::max(dmsgB[26], dmsgA[26]); // globalBounds 5 } int Commutative() override { return 1; } }; @@ -2738,30 +2739,12 @@ void vtkAMRDualGridHelper::ComputeGlobalMetaData(vtkNonOverlappingAMR* input) ++this->NumberOfBlocksInThisProcess; image->GetBounds(bounds); // Compute globalBounds. - if (globalBounds[0] > bounds[0]) - { - globalBounds[0] = bounds[0]; - } - if (globalBounds[1] < bounds[1]) - { - globalBounds[1] = bounds[1]; - } - if (globalBounds[2] > bounds[2]) - { - globalBounds[2] = bounds[2]; - } - if (globalBounds[3] < bounds[3]) - { - globalBounds[3] = bounds[3]; - } - if (globalBounds[4] > bounds[4]) - { - globalBounds[4] = bounds[4]; - } - if (globalBounds[5] < bounds[5]) - { - globalBounds[5] = bounds[5]; - } + globalBounds[0] = std::min(globalBounds[0], bounds[0]); + globalBounds[1] = std::max(globalBounds[1], bounds[1]); + globalBounds[2] = std::min(globalBounds[2], bounds[2]); + globalBounds[3] = std::max(globalBounds[3], bounds[3]); + globalBounds[4] = std::min(globalBounds[4], bounds[4]); + globalBounds[5] = std::max(globalBounds[5], bounds[5]); image->GetExtent(ext); cellDims[0] = ext[1] - ext[0]; // ext is point extent. cellDims[1] = ext[3] - ext[2]; @@ -2829,7 +2812,7 @@ void vtkAMRDualGridHelper::ComputeGlobalMetaData(vtkNonOverlappingAMR* input) dMsg[10] = globalBounds[4]; // dMsg[26] = globalBounds[5]; - vtkReduceMeta operation; + ::vtkReduceMeta operation; if (!this->Controller->AllReduce(dMsg, dRcv, REDUCE_MESSAGE_SIZE, &operation)) { vtkErrorMacro("AllReduce failed"); @@ -2867,10 +2850,7 @@ void vtkAMRDualGridHelper::ComputeGlobalMetaData(vtkNonOverlappingAMR* input) this->StandardBlockDimensions[1] = largestDims[1] - 2; this->StandardBlockDimensions[2] = largestDims[2] - 2; // For 2d case - if (this->StandardBlockDimensions[2] < 1) - { - this->StandardBlockDimensions[2] = 1; - } + this->StandardBlockDimensions[2] = std::max(this->StandardBlockDimensions[2], 1); this->RootSpacing[0] = lowestSpacing[0] * (1 << (lowestLevel)); this->RootSpacing[1] = lowestSpacing[1] * (1 << (lowestLevel)); this->RootSpacing[2] = lowestSpacing[2] * (1 << (lowestLevel)); diff --git a/VTKExtensions/Core/Testing/Cxx/TestDataUtilities.cxx b/VTKExtensions/Core/Testing/Cxx/TestDataUtilities.cxx index 1c60cf8778b4069cda5097d28ada57f5966acf69..41463a2d18f6777039a30a7a776d3214365ee6c1 100644 --- a/VTKExtensions/Core/Testing/Cxx/TestDataUtilities.cxx +++ b/VTKExtensions/Core/Testing/Cxx/TestDataUtilities.cxx @@ -9,7 +9,7 @@ #include #include -int TestDataUtilities(int, char*[]) +extern int TestDataUtilities(int, char*[]) { vtkNew pdcSource; pdcSource->SetNumberOfShapes(2); diff --git a/VTKExtensions/Core/Testing/Cxx/TestDistributedTrivialProducer.cxx b/VTKExtensions/Core/Testing/Cxx/TestDistributedTrivialProducer.cxx index 123ca4509275a898ce0fa1beb1ffa3ff637128f3..5c6708140c55ab5e28476ae176cbbd9c86829281 100644 --- a/VTKExtensions/Core/Testing/Cxx/TestDistributedTrivialProducer.cxx +++ b/VTKExtensions/Core/Testing/Cxx/TestDistributedTrivialProducer.cxx @@ -7,7 +7,7 @@ #include -int TestDistributedTrivialProducer(int, char*[]) +extern int TestDistributedTrivialProducer(int, char*[]) { vtkNew sourceData; sourceData->Update(); diff --git a/VTKExtensions/Core/Testing/Cxx/TestFileSequenceParser.cxx b/VTKExtensions/Core/Testing/Cxx/TestFileSequenceParser.cxx index 1387b5eeb6f1f5590886291d48e09f2dad470399..5f0f249fcaa536f818504e6bbaecc0c9fed4842d 100644 --- a/VTKExtensions/Core/Testing/Cxx/TestFileSequenceParser.cxx +++ b/VTKExtensions/Core/Testing/Cxx/TestFileSequenceParser.cxx @@ -3,7 +3,7 @@ #include #include -bool check_group(vtkFileSequenceParser* parser, const char* fname, const char* seqname) +static bool check_group(vtkFileSequenceParser* parser, const char* fname, const char* seqname) { if (!parser->ParseFileSequence(fname)) { @@ -20,7 +20,7 @@ bool check_group(vtkFileSequenceParser* parser, const char* fname, const char* s return true; } -bool check_no_group(vtkFileSequenceParser* parser, const char* fname) +static bool check_no_group(vtkFileSequenceParser* parser, const char* fname) { if (parser->ParseFileSequence(fname)) { @@ -30,7 +30,7 @@ bool check_no_group(vtkFileSequenceParser* parser, const char* fname) return true; } -int TestFileSequenceParser(int, char* argv[]) +extern int TestFileSequenceParser(int, char* argv[]) { (void)argv; vtkNew seqParser; diff --git a/VTKExtensions/Core/Testing/Cxx/TestTrivialProducer.cxx b/VTKExtensions/Core/Testing/Cxx/TestTrivialProducer.cxx index e66fb382fbba6890b5a96f186a0e274299de0e79..4c2e233846d01e82d14ad71831883cd262b39172 100644 --- a/VTKExtensions/Core/Testing/Cxx/TestTrivialProducer.cxx +++ b/VTKExtensions/Core/Testing/Cxx/TestTrivialProducer.cxx @@ -22,7 +22,7 @@ void verifyOutput(vtkInformation* info, int size, double last) } }; -int TestTrivialProducer(int, char*[]) +extern int TestTrivialProducer(int, char*[]) { vtkNew sourceData; sourceData->Update(); diff --git a/VTKExtensions/Core/vtkPVXMLElement.cxx b/VTKExtensions/Core/vtkPVXMLElement.cxx index 792c30ff7639be408ff0cb85180edd52bfe7f786..55b53fa982489af537ed1161b28c6c08647ad982 100644 --- a/VTKExtensions/Core/vtkPVXMLElement.cxx +++ b/VTKExtensions/Core/vtkPVXMLElement.cxx @@ -468,6 +468,8 @@ int vtkPVXMLElement::GetScalarAttribute(const char* name, vtkIdType* value) #endif //---------------------------------------------------------------------------- +namespace +{ template int vtkPVXMLVectorAttributeParse(const char* str, int length, T* data) { @@ -488,49 +490,50 @@ int vtkPVXMLVectorAttributeParse(const char* str, int length, T* data) } return length; } +} //---------------------------------------------------------------------------- int vtkPVXMLElement::GetVectorAttribute(const char* name, int length, int* data) { - return vtkPVXMLVectorAttributeParse(this->GetAttribute(name), length, data); + return ::vtkPVXMLVectorAttributeParse(this->GetAttribute(name), length, data); } //---------------------------------------------------------------------------- int vtkPVXMLElement::GetVectorAttribute(const char* name, int length, float* data) { - return vtkPVXMLVectorAttributeParse(this->GetAttribute(name), length, data); + return ::vtkPVXMLVectorAttributeParse(this->GetAttribute(name), length, data); } //---------------------------------------------------------------------------- int vtkPVXMLElement::GetVectorAttribute(const char* name, int length, double* data) { - return vtkPVXMLVectorAttributeParse(this->GetAttribute(name), length, data); + return ::vtkPVXMLVectorAttributeParse(this->GetAttribute(name), length, data); } #if defined(VTK_USE_64BIT_IDS) //---------------------------------------------------------------------------- int vtkPVXMLElement::GetVectorAttribute(const char* name, int length, vtkIdType* data) { - return vtkPVXMLVectorAttributeParse(this->GetAttribute(name), length, data); + return ::vtkPVXMLVectorAttributeParse(this->GetAttribute(name), length, data); } #endif //---------------------------------------------------------------------------- int vtkPVXMLElement::GetCharacterDataAsVector(int length, int* data) { - return vtkPVXMLVectorAttributeParse(this->GetCharacterData(), length, data); + return ::vtkPVXMLVectorAttributeParse(this->GetCharacterData(), length, data); } //---------------------------------------------------------------------------- int vtkPVXMLElement::GetCharacterDataAsVector(int length, float* data) { - return vtkPVXMLVectorAttributeParse(this->GetCharacterData(), length, data); + return ::vtkPVXMLVectorAttributeParse(this->GetCharacterData(), length, data); } //---------------------------------------------------------------------------- int vtkPVXMLElement::GetCharacterDataAsVector(int length, double* data) { - return vtkPVXMLVectorAttributeParse(this->GetCharacterData(), length, data); + return ::vtkPVXMLVectorAttributeParse(this->GetCharacterData(), length, data); } //---------------------------------------------------------------------------- diff --git a/VTKExtensions/CosmoTools/Testing/Cxx/TestHaloFinder.cxx b/VTKExtensions/CosmoTools/Testing/Cxx/TestHaloFinder.cxx index d0f67da500e8c0f93db9a7f2e8f7fe7d18bd055e..efa4dcebbd664036013d03b869ae3947fd31aad6 100644 --- a/VTKExtensions/CosmoTools/Testing/Cxx/TestHaloFinder.cxx +++ b/VTKExtensions/CosmoTools/Testing/Cxx/TestHaloFinder.cxx @@ -41,7 +41,7 @@ int runHaloFinderTest1(int argc, char* argv[]) } } -int TestHaloFinder(int argc, char* argv[]) +extern int TestHaloFinder(int argc, char* argv[]) { MPI_Init(&argc, &argv); diff --git a/VTKExtensions/CosmoTools/Testing/Cxx/TestHaloFinderSubhaloFinding.cxx b/VTKExtensions/CosmoTools/Testing/Cxx/TestHaloFinderSubhaloFinding.cxx index 0748387ca6c5544d30160c06e109f164929f2367..7c2f5f1626e4dd74f6bad0a4bc054131431c5f67 100644 --- a/VTKExtensions/CosmoTools/Testing/Cxx/TestHaloFinderSubhaloFinding.cxx +++ b/VTKExtensions/CosmoTools/Testing/Cxx/TestHaloFinderSubhaloFinding.cxx @@ -96,7 +96,7 @@ int runHaloFinderTest(int argc, char* argv[]) } } -int TestHaloFinderSubhaloFinding(int argc, char* argv[]) +extern int TestHaloFinderSubhaloFinding(int argc, char* argv[]) { MPI_Init(&argc, &argv); diff --git a/VTKExtensions/CosmoTools/Testing/Cxx/TestHaloFinderSummaryInfo.cxx b/VTKExtensions/CosmoTools/Testing/Cxx/TestHaloFinderSummaryInfo.cxx index d55272c4a618a2c5e22405d369b4f70147a7c534..39e353a41199b8083d2747ec64960a58df413393 100644 --- a/VTKExtensions/CosmoTools/Testing/Cxx/TestHaloFinderSummaryInfo.cxx +++ b/VTKExtensions/CosmoTools/Testing/Cxx/TestHaloFinderSummaryInfo.cxx @@ -68,7 +68,7 @@ int runHaloFinderTest(int argc, char* argv[]) } } -int TestHaloFinderSummaryInfo(int argc, char* argv[]) +extern int TestHaloFinderSummaryInfo(int argc, char* argv[]) { MPI_Init(&argc, &argv); diff --git a/VTKExtensions/CosmoTools/Testing/Cxx/TestSubhaloFinder.cxx b/VTKExtensions/CosmoTools/Testing/Cxx/TestSubhaloFinder.cxx index e15f367922c7e41c1e42278d59454e6b5e85446f..da1569fdf4eee5a75b8eec1a93a49e8e10cc5092 100644 --- a/VTKExtensions/CosmoTools/Testing/Cxx/TestSubhaloFinder.cxx +++ b/VTKExtensions/CosmoTools/Testing/Cxx/TestSubhaloFinder.cxx @@ -121,7 +121,7 @@ int runSubhaloFinderTest(int argc, char* argv[]) } } -int TestSubhaloFinder(int argc, char* argv[]) +extern int TestSubhaloFinder(int argc, char* argv[]) { MPI_Init(&argc, &argv); diff --git a/VTKExtensions/Extraction/vtkExtractSelectionRange.cxx b/VTKExtensions/Extraction/vtkExtractSelectionRange.cxx index 90950e62f87c6558f0ccaf6ff32da5d594508d4e..81fe84b920af469a667ab02b026c248f309799c9 100644 --- a/VTKExtensions/Extraction/vtkExtractSelectionRange.cxx +++ b/VTKExtensions/Extraction/vtkExtractSelectionRange.cxx @@ -21,6 +21,7 @@ #include "vtkStreamingDemandDrivenPipeline.h" #include "vtkTable.h" +#include #include #include #include @@ -169,10 +170,7 @@ int vtkExtractSelectionRange::RequestData(vtkInformation* vtkNotUsed(request), for (vtkIdType i = 0; i < idList->GetNumberOfTuples(); i++) { vtkIdType id = idList->GetTuple1(i); - if (id > idmax) - { - idmax = id; - } + idmax = std::max(idmax, id); } if (idmax > dataArray->GetNumberOfTuples()) { @@ -196,24 +194,12 @@ int vtkExtractSelectionRange::RequestData(vtkInformation* vtkNotUsed(request), value = values[this->Component]; } - if (value < tempRange[0]) - { - tempRange[0] = value; - } - if (value > tempRange[1]) - { - tempRange[1] = value; - } + tempRange[0] = std::min(tempRange[0], value); + tempRange[1] = std::max(tempRange[1], value); } - if (tempRange[0] < this->Range[0]) - { - this->Range[0] = tempRange[0]; - } - if (tempRange[1] > this->Range[1]) - { - this->Range[1] = tempRange[1]; - } + this->Range[0] = std::min(this->Range[0], tempRange[0]); + this->Range[1] = std::max(this->Range[1], tempRange[1]); vtkDebugMacro(<< "Current range " << this->Range[0] << " " << this->Range[1]); } diff --git a/VTKExtensions/Extraction/vtkPVSelectionSource.cxx b/VTKExtensions/Extraction/vtkPVSelectionSource.cxx index d45c3cb766e5bad0240e7421fb1a023713e99411..ec7c91d98489f9027dd48ec826cf9440511805be 100644 --- a/VTKExtensions/Extraction/vtkPVSelectionSource.cxx +++ b/VTKExtensions/Extraction/vtkPVSelectionSource.cxx @@ -11,6 +11,7 @@ #include "vtkStreamingDemandDrivenPipeline.h" #include "vtkStringArray.h" +#include #include #include #include @@ -160,10 +161,7 @@ void vtkPVSelectionSource::RemoveAllPedigreeStringIDs() //---------------------------------------------------------------------------- void vtkPVSelectionSource::AddID(vtkIdType piece, vtkIdType id) { - if (piece < -1) - { - piece = -1; - } + piece = std::max(piece, -1); this->Mode = ID; this->Internal->IDs.insert(vtkInternal::PieceIdType(piece, id)); this->Modified(); @@ -180,10 +178,7 @@ void vtkPVSelectionSource::RemoveAllIDs() //---------------------------------------------------------------------------- void vtkPVSelectionSource::AddValue(vtkIdType piece, vtkIdType value) { - if (piece < -1) - { - piece = -1; - } + piece = std::max(piece, -1); this->Mode = VALUES; this->Internal->Values.insert(vtkInternal::PieceIdType(piece, value)); this->Modified(); @@ -201,10 +196,7 @@ void vtkPVSelectionSource::RemoveAllValues() void vtkPVSelectionSource::AddCompositeID( unsigned int composite_index, vtkIdType piece, vtkIdType id) { - if (piece < -1) - { - piece = -1; - } + piece = std::max(piece, -1); this->Mode = COMPOSITEID; this->Internal->CompositeIDs[composite_index].insert(vtkInternal::PieceIdType(piece, id)); diff --git a/VTKExtensions/FiltersGeneral/Testing/Cxx/TestHyperTreeGridGradient.cxx b/VTKExtensions/FiltersGeneral/Testing/Cxx/TestHyperTreeGridGradient.cxx index c0205a6ce319782e4e93301a7ef0075e313ac371..1b8e1c279c8fe5cb7886693a2455a21ca5f9d9ed 100644 --- a/VTKExtensions/FiltersGeneral/Testing/Cxx/TestHyperTreeGridGradient.cxx +++ b/VTKExtensions/FiltersGeneral/Testing/Cxx/TestHyperTreeGridGradient.cxx @@ -56,7 +56,7 @@ public: } }; -int TestHyperTreeGridGradient(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) +extern int TestHyperTreeGridGradient(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) { // test is inside class such that friend declaration in // filter can work diff --git a/VTKExtensions/FiltersGeneral/Testing/Cxx/TestPolyhedralToSimpleCellsFilter.cxx b/VTKExtensions/FiltersGeneral/Testing/Cxx/TestPolyhedralToSimpleCellsFilter.cxx index 319fee9c21a7a72eadc3d6d938cb401176a61533..23f96f0b31496553d80bef7334b6b8ef436f03bb 100644 --- a/VTKExtensions/FiltersGeneral/Testing/Cxx/TestPolyhedralToSimpleCellsFilter.cxx +++ b/VTKExtensions/FiltersGeneral/Testing/Cxx/TestPolyhedralToSimpleCellsFilter.cxx @@ -180,7 +180,7 @@ public: } }; -int TestPolyhedralToSimpleCellsFilter(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) +extern int TestPolyhedralToSimpleCellsFilter(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) { // test is inside class such that friend declaration in // filter can work diff --git a/VTKExtensions/FiltersGeneral/vtkFlashContour.cxx b/VTKExtensions/FiltersGeneral/vtkFlashContour.cxx index 8a0354896fe8fd1a7919722dbd2e8042ea636c3a..8116d0e02460dce33191ab9939b96b61a140123a 100644 --- a/VTKExtensions/FiltersGeneral/vtkFlashContour.cxx +++ b/VTKExtensions/FiltersGeneral/vtkFlashContour.cxx @@ -18,6 +18,8 @@ #include "vtkPolyData.h" #include "vtkUnsignedCharArray.h" +#include + vtkStandardNewMacro(vtkFlashContour); // How do we find edge/corner neighbors and neighbors in different levels. @@ -442,10 +444,7 @@ unsigned char vtkFlashContour::ComputeBranchDepth(int globalBlockId) for (int i = 0; i < 8; ++i) { unsigned char tmp = this->ComputeBranchDepth(children[i]); - if (tmp > max) - { - max = tmp; - } + max = std::max(max, tmp); } return max + 1; } diff --git a/VTKExtensions/FiltersGeneral/vtkHierarchicalFractal.cxx b/VTKExtensions/FiltersGeneral/vtkHierarchicalFractal.cxx index b377db1d1bb72f80df11de0bfc3b7aadee59d55e..d54c1ccccd9d0c08f542c385122daa0b5b6a4ee1 100644 --- a/VTKExtensions/FiltersGeneral/vtkHierarchicalFractal.cxx +++ b/VTKExtensions/FiltersGeneral/vtkHierarchicalFractal.cxx @@ -24,6 +24,7 @@ #include "vtkUniformGrid.h" #include "vtkUnsignedCharArray.h" +#include #include vtkStandardNewMacro(vtkHierarchicalFractal); @@ -101,10 +102,7 @@ public: double* gridOrigin = grid->GetOrigin(); for (int d = 0; d < 3; d++) { - if (gridOrigin[d] < origin[d]) - { - origin[d] = gridOrigin[d]; - } + origin[d] = std::min(origin[d], gridOrigin[d]); } } for (unsigned int j = static_cast(blocksPerLevel.size()); j <= level; j++) @@ -1304,10 +1302,7 @@ void vtkHierarchicalFractal::AddGhostLevelArray(vtkDataSet* grid, int dim[3], in { tmp = k - dims[2] + 1 + this->GhostLevels; } - if (tmp > kLevel) - { - kLevel = tmp; - } + kLevel = std::max(kLevel, tmp); if (this->TwoDimensional) { kLevel = 0; @@ -1323,10 +1318,7 @@ void vtkHierarchicalFractal::AddGhostLevelArray(vtkDataSet* grid, int dim[3], in { tmp = this->GhostLevels - j; } - if (tmp > jLevel) - { - jLevel = tmp; - } + jLevel = std::max(jLevel, tmp); if (onFace[3]) { tmp = j - dims[1] + 1 + this->GhostLevels - 1; @@ -1335,10 +1327,7 @@ void vtkHierarchicalFractal::AddGhostLevelArray(vtkDataSet* grid, int dim[3], in { tmp = j - dims[1] + 1 + this->GhostLevels; } - if (tmp > jLevel) - { - jLevel = tmp; - } + jLevel = std::max(tmp, jLevel); for (i = 0; i < dims[0]; ++i) { iLevel = jLevel; @@ -1350,10 +1339,7 @@ void vtkHierarchicalFractal::AddGhostLevelArray(vtkDataSet* grid, int dim[3], in { tmp = this->GhostLevels - i; } - if (tmp > iLevel) - { - iLevel = tmp; - } + iLevel = std::max(iLevel, tmp); if (onFace[1]) { tmp = i - dims[0] + 1 + this->GhostLevels - 1; @@ -1362,10 +1348,7 @@ void vtkHierarchicalFractal::AddGhostLevelArray(vtkDataSet* grid, int dim[3], in { tmp = i - dims[0] + 1 + this->GhostLevels; } - if (tmp > iLevel) - { - iLevel = tmp; - } + iLevel = std::max(iLevel, tmp); if (iLevel <= 0) { diff --git a/VTKExtensions/FiltersGeneral/vtkPVExtractVOI.cxx b/VTKExtensions/FiltersGeneral/vtkPVExtractVOI.cxx index 544dd7dcbe4c0fa38480cfa3cc670ab2ba0667b0..95315b2982d845acded9e7f115a49b36ca33e6c3 100644 --- a/VTKExtensions/FiltersGeneral/vtkPVExtractVOI.cxx +++ b/VTKExtensions/FiltersGeneral/vtkPVExtractVOI.cxx @@ -65,6 +65,8 @@ vtkPVExtractVOI::~vtkPVExtractVOI() } //---------------------------------------------------------------------------- +namespace +{ template void vtkPVExtractVOIProcessRequest(FilterType* filter, vtkPVExtractVOI* self, vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) @@ -73,6 +75,7 @@ void vtkPVExtractVOIProcessRequest(FilterType* filter, vtkPVExtractVOI* self, filter->SetSampleRate(self->GetSampleRate()); filter->ProcessRequest(request, inputVector, outputVector); } +} //---------------------------------------------------------------------------- int vtkPVExtractVOI::RequestUpdateExtent( @@ -83,15 +86,15 @@ int vtkPVExtractVOI::RequestUpdateExtent( if (output->GetDataObjectType() == VTK_IMAGE_DATA) { - vtkPVExtractVOIProcessRequest(this->ExtractVOI, this, request, inputVector, outputVector); + ::vtkPVExtractVOIProcessRequest(this->ExtractVOI, this, request, inputVector, outputVector); } else if (output->GetDataObjectType() == VTK_STRUCTURED_GRID) { - vtkPVExtractVOIProcessRequest(this->ExtractGrid, this, request, inputVector, outputVector); + ::vtkPVExtractVOIProcessRequest(this->ExtractGrid, this, request, inputVector, outputVector); } else if (output->GetDataObjectType() == VTK_RECTILINEAR_GRID) { - vtkPVExtractVOIProcessRequest(this->ExtractRG, this, request, inputVector, outputVector); + ::vtkPVExtractVOIProcessRequest(this->ExtractRG, this, request, inputVector, outputVector); } // We can handle anything. @@ -110,17 +113,17 @@ int vtkPVExtractVOI::RequestInformation( if (output->GetDataObjectType() == VTK_IMAGE_DATA) { - vtkPVExtractVOIProcessRequest(this->ExtractVOI, this, request, inputVector, outputVector); + ::vtkPVExtractVOIProcessRequest(this->ExtractVOI, this, request, inputVector, outputVector); } else if (output->GetDataObjectType() == VTK_STRUCTURED_GRID) { this->ExtractGrid->SetIncludeBoundary(this->IncludeBoundary); - vtkPVExtractVOIProcessRequest(this->ExtractGrid, this, request, inputVector, outputVector); + ::vtkPVExtractVOIProcessRequest(this->ExtractGrid, this, request, inputVector, outputVector); } else if (output->GetDataObjectType() == VTK_RECTILINEAR_GRID) { this->ExtractRG->SetIncludeBoundary(this->IncludeBoundary); - vtkPVExtractVOIProcessRequest(this->ExtractRG, this, request, inputVector, outputVector); + ::vtkPVExtractVOIProcessRequest(this->ExtractRG, this, request, inputVector, outputVector); } return 1; @@ -147,17 +150,17 @@ int vtkPVExtractVOI::RequestData( if (output->GetDataObjectType() == VTK_IMAGE_DATA) { - vtkPVExtractVOIProcessRequest(this->ExtractVOI, this, request, inputVector, outputVector); + ::vtkPVExtractVOIProcessRequest(this->ExtractVOI, this, request, inputVector, outputVector); } else if (output->GetDataObjectType() == VTK_STRUCTURED_GRID) { this->ExtractGrid->SetIncludeBoundary(this->IncludeBoundary); - vtkPVExtractVOIProcessRequest(this->ExtractGrid, this, request, inputVector, outputVector); + ::vtkPVExtractVOIProcessRequest(this->ExtractGrid, this, request, inputVector, outputVector); } else if (output->GetDataObjectType() == VTK_RECTILINEAR_GRID) { this->ExtractRG->SetIncludeBoundary(this->IncludeBoundary); - vtkPVExtractVOIProcessRequest(this->ExtractRG, this, request, inputVector, outputVector); + ::vtkPVExtractVOIProcessRequest(this->ExtractRG, this, request, inputVector, outputVector); } return 1; diff --git a/VTKExtensions/FiltersGeneral/vtkRectilinearGridConnectivity.cxx b/VTKExtensions/FiltersGeneral/vtkRectilinearGridConnectivity.cxx index e3a163f7c2c2f92818e0fc317431830a0bc86b64..a52ef74978bcdc9ef0b6dc15be954148b75ccea1 100644 --- a/VTKExtensions/FiltersGeneral/vtkRectilinearGridConnectivity.cxx +++ b/VTKExtensions/FiltersGeneral/vtkRectilinearGridConnectivity.cxx @@ -22,6 +22,7 @@ #include "vtkObjectFactory.h" #include "vtkUnsignedCharArray.h" +#include #include #include #include @@ -2386,16 +2387,14 @@ void vtkRectilinearGridConnectivity::AddPolygonsToFaceHash(int blockIdx, vtkPoly } // keep track of the smallest fragment id to use for this volume - if (minIndex > hashFace->FragmentId) // --- case A - { - // The first face (certainly internal, since hashFace->FragmentId - // > 0 holds above) of this volume is guaranteed to come here. In - // addition, non-first internal faces (of this volume) that are - // shared by new volumes also come here. In either case, minIndex - // is updated below to reflect the smallest fragment Id so far and - // will be assigned to those subsequent new faces of this volume. - minIndex = hashFace->FragmentId; - } + // --- case A + // The first face (certainly internal, since hashFace->FragmentId + // > 0 holds above) of this volume is guaranteed to come here. In + // addition, non-first internal faces (of this volume) that are + // shared by new volumes also come here. In either case, minIndex + // is updated below to reflect the smallest fragment Id so far and + // will be assigned to those subsequent new faces of this volume. + minIndex = std::min(minIndex, hashFace->FragmentId); } else { @@ -3079,17 +3078,15 @@ void vtkRectilinearGridConnectivity::AddPolygonsToFaceHash( } // keep track of the smallest fragment id to use for this 'macro' volume - if (minIndex > hashFace->FragmentId) // --- case A - { - // The first face (certainly internal, since hashFace->FragmentId - // > 0 holds above) of this 'macro' volume is guaranteed to come here. - // In addition, non-first internal faces (of this 'macro' volume) that - // are shared by new 'macro' volumes also come here. In either case, - // minIndex is updated below to reflect the smallest fragment Id so - // far and will be assigned to those subsequent new faces of this - // 'macro' volume. - minIndex = hashFace->FragmentId; - } + // --- case A + // The first face (certainly internal, since hashFace->FragmentId + // > 0 holds above) of this 'macro' volume is guaranteed to come here. + // In addition, non-first internal faces (of this 'macro' volume) that + // are shared by new 'macro' volumes also come here. In either case, + // minIndex is updated below to reflect the smallest fragment Id so + // far and will be assigned to those subsequent new faces of this + // 'macro' volume. + minIndex = std::min(minIndex, hashFace->FragmentId); } else { @@ -3753,17 +3750,15 @@ void vtkRectilinearGridConnectivity::AddInterProcessPolygonsToFaceHash( } // keep track of the smallest fragment id to use for this 'macro' volume - if (minIndex > hashFace->FragmentId) // --- case A - { - // The first face (certainly internal, since hashFace->FragmentId - // > 0 holds above) of this 'macro' volume is guaranteed to come here. - // In addition, non-first internal faces (of this 'macro' volume) that - // are shared by new 'macro' volumes also come here. In either case, - // minIndex is updated below to reflect the smallest fragment Id so - // far and will be assigned to those subsequent new faces of this - // 'macro' volume. - minIndex = hashFace->FragmentId; - } + // --- case A + // The first face (certainly internal, since hashFace->FragmentId + // > 0 holds above) of this 'macro' volume is guaranteed to come here. + // In addition, non-first internal faces (of this 'macro' volume) that + // are shared by new 'macro' volumes also come here. In either case, + // minIndex is updated below to reflect the smallest fragment Id so + // far and will be assigned to those subsequent new faces of this + // 'macro' volume. + minIndex = std::min(minIndex, hashFace->FragmentId); } else { diff --git a/VTKExtensions/FiltersGeneral/vtkTimeToTextConvertor.cxx b/VTKExtensions/FiltersGeneral/vtkTimeToTextConvertor.cxx index 7c96087608dc47bd475e83894bba3678e806329b..fc1772fb1a6a36e18d02cca25e282abd1903021f 100644 --- a/VTKExtensions/FiltersGeneral/vtkTimeToTextConvertor.cxx +++ b/VTKExtensions/FiltersGeneral/vtkTimeToTextConvertor.cxx @@ -53,10 +53,13 @@ int vtkTimeToTextConvertor::RequestInformation( return 1; } //---------------------------------------------------------------------------- +namespace +{ inline double vtkTimeToTextConvertor_ForwardConvert(double T0, double shift, double scale) { return T0 * scale + shift; } +} //---------------------------------------------------------------------------- int vtkTimeToTextConvertor::RequestData(vtkInformation* vtkNotUsed(request), vtkInformationVector** inputVector, vtkInformationVector* outputVector) @@ -74,7 +77,7 @@ int vtkTimeToTextConvertor::RequestData(vtkInformation* vtkNotUsed(request), { timeArgumentPushed = true; double time = inputInfo->Get(vtkDataObject::DATA_TIME_STEP()); - time = vtkTimeToTextConvertor_ForwardConvert(time, this->Shift, this->Scale); + time = ::vtkTimeToTextConvertor_ForwardConvert(time, this->Shift, this->Scale); vtkPVStringFormatter::PushScope("TEXT", fmt::arg("time", time)); } else if (outputInfo && outputInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()) && @@ -82,7 +85,7 @@ int vtkTimeToTextConvertor::RequestData(vtkInformation* vtkNotUsed(request), { timeArgumentPushed = true; double time = outputInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()); - time = vtkTimeToTextConvertor_ForwardConvert(time, this->Shift, this->Scale); + time = ::vtkTimeToTextConvertor_ForwardConvert(time, this->Shift, this->Scale); vtkPVStringFormatter::PushScope("TEXT", fmt::arg("time", time)); } diff --git a/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfaceCommBuffer.cxx b/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfaceCommBuffer.cxx index 131d436ebb0c22020cb8038987847b650f8fdfc0..bbf502432c4ac71d82fff80124c3cf303a5e8643 100644 --- a/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfaceCommBuffer.cxx +++ b/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfaceCommBuffer.cxx @@ -328,29 +328,3 @@ void vtkMaterialInterfaceCommBuffer::SizeHeader( buffers[bufferId].SizeHeader(nBlocks); } } -//---------------------------------------------------------------------------- -ostream& operator<<(ostream& sout, const vtkMaterialInterfaceCommBuffer& fcb) -{ - int hs = fcb.GetHeaderSize(); - sout << "Header size:" << hs << endl; - int bs = fcb.GetBufferSize(); - sout << "Buffer size:" << bs << endl; - sout << "EOD:" << fcb.GetEOD() << endl; - sout << "Header:{"; - const vtkIdType* header = fcb.GetHeader(); - for (int i = 0; i < hs; ++i) - { - sout << header[i] << ","; - } - sout << (char)0x08 << "}" << endl; - sout << "Buffer:{"; - const int* buffer = reinterpret_cast(fcb.GetBuffer()); - bs /= sizeof(int); - for (int i = 0; i < bs; ++i) - { - sout << buffer[i] << ","; - } - sout << (char)0x08 << "}" << endl; - - return sout; -} diff --git a/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfaceCommBuffer.h b/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfaceCommBuffer.h index f00c91a42d10c29c23e729748ce220ea21cc97de..42d59800778e1143b6035a60b2e3618efb4be32b 100644 --- a/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfaceCommBuffer.h +++ b/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfaceCommBuffer.h @@ -11,8 +11,6 @@ class vtkDoubleArray; class vtkFloatArray; -// class vtkMaterialInterfaceCommBuffer; -// ostream &operator<<(ostream &sout,const vtkMaterialInterfaceCommBuffer &fcb); //============================================================================ // Description: diff --git a/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfaceFilter.cxx b/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfaceFilter.cxx index a556cfd5df62e819c39b3eef438474b58cc7f278..797436bc234f020004449d36a9490230d18e88ae 100644 --- a/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfaceFilter.cxx +++ b/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfaceFilter.cxx @@ -67,7 +67,7 @@ using std::ostringstream; using std::vector; #include using std::string; -#include "algorithm" +#include // ansi c #include #include @@ -1917,30 +1917,12 @@ int vtkMaterialInterfaceFilter::InitializeBlocks(vtkNonOverlappingAMR* input, const int* ext; ext = block->GetBaseCellExtent(); // We need the cumulative extent to determine the grid extent. - if (cumulativeExt[0] > ext[0]) - { - cumulativeExt[0] = ext[0]; - } - if (cumulativeExt[1] < ext[1]) - { - cumulativeExt[1] = ext[1]; - } - if (cumulativeExt[2] > ext[2]) - { - cumulativeExt[2] = ext[2]; - } - if (cumulativeExt[3] < ext[3]) - { - cumulativeExt[3] = ext[3]; - } - if (cumulativeExt[4] > ext[4]) - { - cumulativeExt[4] = ext[4]; - } - if (cumulativeExt[5] < ext[5]) - { - cumulativeExt[5] = ext[5]; - } + cumulativeExt[0] = std::min(cumulativeExt[0], ext[0]); + cumulativeExt[1] = std::max(cumulativeExt[1], ext[1]); + cumulativeExt[2] = std::min(cumulativeExt[2], ext[2]); + cumulativeExt[3] = std::max(cumulativeExt[3], ext[3]); + cumulativeExt[4] = std::min(cumulativeExt[4], ext[4]); + cumulativeExt[5] = std::max(cumulativeExt[5], ext[5]); } } @@ -1965,30 +1947,12 @@ int vtkMaterialInterfaceFilter::InitializeBlocks(vtkNonOverlappingAMR* input, for (int ii = 1; ii < numProcs; ++ii) { this->Controller->Receive(tmp, 6, ii, 212130); - if (cumulativeExt[0] > tmp[0]) - { - cumulativeExt[0] = tmp[0]; - } - if (cumulativeExt[1] < tmp[1]) - { - cumulativeExt[1] = tmp[1]; - } - if (cumulativeExt[2] > tmp[2]) - { - cumulativeExt[2] = tmp[2]; - } - if (cumulativeExt[3] < tmp[3]) - { - cumulativeExt[3] = tmp[3]; - } - if (cumulativeExt[4] > tmp[4]) - { - cumulativeExt[4] = tmp[4]; - } - if (cumulativeExt[5] < tmp[5]) - { - cumulativeExt[5] = tmp[5]; - } + cumulativeExt[0] = std::min(cumulativeExt[0], tmp[0]); + cumulativeExt[1] = std::max(cumulativeExt[1], tmp[1]); + cumulativeExt[2] = std::min(cumulativeExt[2], tmp[2]); + cumulativeExt[3] = std::max(cumulativeExt[3], tmp[3]); + cumulativeExt[4] = std::min(cumulativeExt[4], tmp[4]); + cumulativeExt[5] = std::max(cumulativeExt[5], tmp[5]); } // Redistribute the global grid extent for (int ii = 1; ii < numProcs; ++ii) @@ -2575,30 +2539,12 @@ int vtkMaterialInterfaceFilter::ComputeOriginAndRootSpacingOld(vtkNonOverlapping ++totalNumberOfBlocksInThisProcess; image->GetBounds(bounds); // Compute globalBounds. - if (globalBounds[0] > bounds[0]) - { - globalBounds[0] = bounds[0]; - } - if (globalBounds[1] < bounds[1]) - { - globalBounds[1] = bounds[1]; - } - if (globalBounds[2] > bounds[2]) - { - globalBounds[2] = bounds[2]; - } - if (globalBounds[3] < bounds[3]) - { - globalBounds[3] = bounds[3]; - } - if (globalBounds[4] > bounds[4]) - { - globalBounds[4] = bounds[4]; - } - if (globalBounds[5] < bounds[5]) - { - globalBounds[5] = bounds[5]; - } + globalBounds[0] = std::min(globalBounds[0], bounds[0]); + globalBounds[1] = std::max(globalBounds[1], bounds[1]); + globalBounds[2] = std::min(globalBounds[2], bounds[2]); + globalBounds[3] = std::max(globalBounds[3], bounds[3]); + globalBounds[4] = std::min(globalBounds[4], bounds[4]); + globalBounds[5] = std::max(globalBounds[5], bounds[5]); image->GetExtent(ext); cellDims[0] = ext[1] - ext[0]; // ext is point extent. cellDims[1] = ext[3] - ext[2]; @@ -2701,30 +2647,12 @@ int vtkMaterialInterfaceFilter::ComputeOriginAndRootSpacingOld(vtkNonOverlapping lowestDims[1] = iMsg[7]; lowestDims[2] = iMsg[8]; } - if (globalBounds[0] > dMsg[9]) - { - globalBounds[0] = dMsg[9]; - } - if (globalBounds[1] < dMsg[10]) - { - globalBounds[1] = dMsg[10]; - } - if (globalBounds[2] > dMsg[11]) - { - globalBounds[2] = dMsg[11]; - } - if (globalBounds[3] < dMsg[12]) - { - globalBounds[3] = dMsg[12]; - } - if (globalBounds[4] > dMsg[13]) - { - globalBounds[4] = dMsg[13]; - } - if (globalBounds[5] < dMsg[14]) - { - globalBounds[5] = dMsg[14]; - } + globalBounds[0] = std::min(globalBounds[0], dMsg[9]); + globalBounds[1] = std::max(globalBounds[1], dMsg[10]); + globalBounds[1] = std::max(globalBounds[1], dMsg[10]); + globalBounds[3] = std::max(globalBounds[3], dMsg[12]); + globalBounds[4] = std::min(globalBounds[4], dMsg[13]); + globalBounds[5] = std::max(globalBounds[5], dMsg[14]); } } } @@ -2735,10 +2663,7 @@ int vtkMaterialInterfaceFilter::ComputeOriginAndRootSpacingOld(vtkNonOverlapping this->StandardBlockDimensions[1] = largestDims[1] - 1 - static_cast(this->BlockGhostLevel); this->StandardBlockDimensions[2] = largestDims[2] - 1 - static_cast(this->BlockGhostLevel); // For 2d case - if (this->StandardBlockDimensions[2] < 1) - { - this->StandardBlockDimensions[2] = 1; - } + this->StandardBlockDimensions[2] = std::max(this->StandardBlockDimensions[2], 1); this->RootSpacing[0] = lowestSpacing[0] * (1 << (lowestLevel)); this->RootSpacing[1] = lowestSpacing[1] * (1 << (lowestLevel)); this->RootSpacing[2] = lowestSpacing[2] * (1 << (lowestLevel)); @@ -3091,30 +3016,12 @@ int vtkMaterialInterfaceFilter::ComputeRequiredGhostExtent( remoteLayerExt[4] = remoteLayerExt[5]; } // Take the union of all blocks. - if (neededExt[0] > remoteLayerExt[0]) - { - neededExt[0] = remoteLayerExt[0]; - } - if (neededExt[1] < remoteLayerExt[1]) - { - neededExt[1] = remoteLayerExt[1]; - } - if (neededExt[2] > remoteLayerExt[2]) - { - neededExt[2] = remoteLayerExt[2]; - } - if (neededExt[3] < remoteLayerExt[3]) - { - neededExt[3] = remoteLayerExt[3]; - } - if (neededExt[4] > remoteLayerExt[4]) - { - neededExt[4] = remoteLayerExt[4]; - } - if (neededExt[5] < remoteLayerExt[5]) - { - neededExt[5] = remoteLayerExt[5]; - } + neededExt[0] = std::min(neededExt[0], remoteLayerExt[0]); + neededExt[1] = std::max(neededExt[1], remoteLayerExt[1]); + neededExt[2] = std::min(neededExt[2], remoteLayerExt[2]); + neededExt[3] = std::max(neededExt[3], remoteLayerExt[3]); + neededExt[4] = std::min(neededExt[4], remoteLayerExt[4]); + neededExt[5] = std::max(neededExt[5], remoteLayerExt[5]); } } } @@ -4141,15 +4048,9 @@ int vtkMaterialInterfaceFilter::ComputeDisplacementFactors( // of a unit cube. double max = fabs(g[0]); double tmp = fabs(g[1]); - if (tmp > max) - { - max = tmp; - } + max = std::max(tmp, max); tmp = fabs(g[2]); - if (tmp > max) - { - max = tmp; - } + max = std::max(tmp, max); tmp = 0.5 / max; g[0] *= tmp; g[1] *= tmp; @@ -4192,14 +4093,8 @@ int vtkMaterialInterfaceFilter::ComputeDisplacementFactors( // We could also keep clean from creating non manifold surfaces. // I do not generate the surface in a second pass (when we have // the fragment ids) because it would be too expensive. - if (k < 0.0) - { - k = 0.0; - } - if (k > 1.0) - { - k = 1.0; - } + k = std::max(k, 0.0); + k = std::min(k, 1.0); // This should give us decent displacement factors. k *= 2.0; @@ -4272,14 +4167,8 @@ int vtkMaterialInterfaceFilter::SubVoxelPositionCorner(double* point, projection = (point[0] - this->ClipCenter[0]) * this->ClipPlaneNormal[0]; projection += (point[1] - this->ClipCenter[1]) * this->ClipPlaneNormal[1]; projection += (point[2] - this->ClipCenter[2]) * this->ClipPlaneNormal[2]; - if (this->ClipDepthMax < projection) - { - this->ClipDepthMax = projection; - } - if (this->ClipDepthMin > projection) - { - this->ClipDepthMin = projection; - } + this->ClipDepthMax = std::max(this->ClipDepthMax, projection); + this->ClipDepthMin = std::min(this->ClipDepthMin, projection); } return retVal; @@ -5112,30 +5001,12 @@ void vtkMaterialInterfaceFilter::FindNeighbor(int faceIdx[3], int faceLevel, // We have a block // clamp the neighbor index to pad the volume - if (refIdx[0] < refExt[0]) - { - refIdx[0] = refExt[0]; - } - if (refIdx[0] > refExt[1]) - { - refIdx[0] = refExt[1]; - } - if (refIdx[1] < refExt[2]) - { - refIdx[1] = refExt[2]; - } - if (refIdx[1] > refExt[3]) - { - refIdx[1] = refExt[3]; - } - if (refIdx[2] < refExt[4]) - { - refIdx[2] = refExt[4]; - } - if (refIdx[2] > refExt[5]) - { - refIdx[2] = refExt[5]; - } + refIdx[0] = std::max(refIdx[0], refExt[0]); + refIdx[0] = std::min(refIdx[0], refExt[1]); + refIdx[1] = std::max(refIdx[1], refExt[2]); + refIdx[1] = std::min(refIdx[1], refExt[3]); + refIdx[2] = std::max(refIdx[2], refExt[4]); + refIdx[2] = std::min(refIdx[2], refExt[5]); neighbor->Block = refBlock; neighbor->Index[0] = refIdx[0]; @@ -9993,10 +9864,7 @@ double vtkMaterialInterfaceFilterHalfSphere::EvaluateHalfSpherePoint(double pt[3 double combined; // Take the maximum (union) for inversion. combined = planeDot; - if (combined < sphereDist) - { - combined = sphereDist; - } + combined = std::max(combined, sphereDist); return combined; } diff --git a/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfacePieceLoading.cxx b/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfacePieceLoading.cxx index 895ae8c7fb777dc265e33d92077c8426fe35c7f8..294a3ea117c58f547c951764a3edb6272d331631 100644 --- a/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfacePieceLoading.cxx +++ b/VTKExtensions/FiltersMaterialInterface/vtkMaterialInterfacePieceLoading.cxx @@ -3,6 +3,7 @@ // SPDX-License-Identifier: BSD-3-Clause #include "vtkMaterialInterfacePieceLoading.h" #include "vtkMaterialInterfaceUtilities.h" +#include #include using std::cerr; using std::endl; @@ -17,22 +18,6 @@ ostream& operator<<(ostream& sout, const vtkMaterialInterfacePieceLoading& fp) return sout; } // -ostream& operator<<(ostream& sout, vector>& pla) -{ - size_t nProcs = pla.size(); - for (size_t procId = 0; procId < nProcs; ++procId) - { - cerr << "Fragment loading on process " << procId << ":" << endl; - size_t nLocalFragments = pla[procId].size(); - for (size_t fragmentIdx = 0; fragmentIdx < nLocalFragments; ++fragmentIdx) - { - sout << pla[procId][fragmentIdx] << ", "; - } - sout << endl; - } - return sout; -} -// void PrintPieceLoadingHistogram(vector>& pla) { // cerr << "loading array:" <>& pla) { minLoading = loading; } - if (maxLoading < loading) - { - maxLoading = loading; - } + maxLoading = std::max(maxLoading, loading); } } // generate histogram diff --git a/VTKExtensions/FiltersRendering/Testing/Cxx/TestDataTabulator.cxx b/VTKExtensions/FiltersRendering/Testing/Cxx/TestDataTabulator.cxx index a6ec77bfe63627895cc8fc4d0765c0c483d37b1b..8dac65736599b1ab902cb731e0df715df9f83b84 100644 --- a/VTKExtensions/FiltersRendering/Testing/Cxx/TestDataTabulator.cxx +++ b/VTKExtensions/FiltersRendering/Testing/Cxx/TestDataTabulator.cxx @@ -88,7 +88,7 @@ bool TestNonMultiblockFieldData() } } -int TestDataTabulator(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) +extern int TestDataTabulator(int vtkNotUsed(argc), char* vtkNotUsed(argv)[]) { return TestMultiblockFieldData() && TestNonMultiblockFieldData() ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/VTKExtensions/FiltersRendering/Testing/Cxx/TestImageCompressors.cxx b/VTKExtensions/FiltersRendering/Testing/Cxx/TestImageCompressors.cxx index bcc1e992dcc38bb7d9da76ddc8667bb2fcb82ab5..7bdfff62d15792c7799d3f458e6a2e7fdc1e7434 100644 --- a/VTKExtensions/FiltersRendering/Testing/Cxx/TestImageCompressors.cxx +++ b/VTKExtensions/FiltersRendering/Testing/Cxx/TestImageCompressors.cxx @@ -36,6 +36,8 @@ public: }; typedef std::map MapType; +namespace +{ bool DoTest(Data& data, vtkImageCompressor* compressor, vtkUnsignedCharArray* input) { vtkNew outputCompressed; @@ -68,8 +70,9 @@ bool DoTest(Data& data, vtkImageCompressor* compressor, vtkUnsignedCharArray* in outputCompressed->GetNumberOfTuples() * outputCompressed->GetNumberOfComponents(); return true; } +} -int TestImageCompressors(int argc, char* argv[]) +extern int TestImageCompressors(int argc, char* argv[]) { int max_count = 10; bool test_lossy = true; diff --git a/VTKExtensions/FiltersRendering/Testing/Cxx/TestJpegNetworkImageSource.cxx b/VTKExtensions/FiltersRendering/Testing/Cxx/TestJpegNetworkImageSource.cxx index fefc94a4760b325e11765877f796b04014f40917..d57cdfe0be15cb9099508818e70745d5cd0f411b 100644 --- a/VTKExtensions/FiltersRendering/Testing/Cxx/TestJpegNetworkImageSource.cxx +++ b/VTKExtensions/FiltersRendering/Testing/Cxx/TestJpegNetworkImageSource.cxx @@ -6,7 +6,7 @@ #include "vtkProcessModule.h" #include "vtkTestUtilities.h" -int TestJpegNetworkImageSource(int argc, char* argv[]) +extern int TestJpegNetworkImageSource(int argc, char* argv[]) { auto fileName = vtkTestUtilities::ExpandDataFileName(argc, argv, "Testing/Data/clouds.jpeg"); diff --git a/VTKExtensions/FiltersRendering/Testing/Cxx/TestResampledAMRImageSource.cxx b/VTKExtensions/FiltersRendering/Testing/Cxx/TestResampledAMRImageSource.cxx index 9daf3e002a5c9ce5bd36fa30428b1ed184477ec8..5a7a2ff86227b06855875349a699e0b8bd9e0a17 100644 --- a/VTKExtensions/FiltersRendering/Testing/Cxx/TestResampledAMRImageSource.cxx +++ b/VTKExtensions/FiltersRendering/Testing/Cxx/TestResampledAMRImageSource.cxx @@ -25,7 +25,7 @@ return TEST_FAILED; \ } -int TestResampledAMRImageSource(int argc, char* argv[]) +extern int TestResampledAMRImageSource(int argc, char* argv[]) { vtkNew testing; testing->AddArguments(argc, (const char**)(argv)); diff --git a/VTKExtensions/FiltersRendering/Testing/Cxx/TestResampledAMRImageSourceWithPointData.cxx b/VTKExtensions/FiltersRendering/Testing/Cxx/TestResampledAMRImageSourceWithPointData.cxx index a18de554bfa9baf4d0b9c70f984001e81d40de02..87b01ae3f8aaf99ac513c8f733918a245ceae066 100644 --- a/VTKExtensions/FiltersRendering/Testing/Cxx/TestResampledAMRImageSourceWithPointData.cxx +++ b/VTKExtensions/FiltersRendering/Testing/Cxx/TestResampledAMRImageSourceWithPointData.cxx @@ -25,7 +25,7 @@ return TEST_FAILED; \ } -int TestResampledAMRImageSourceWithPointData(int argc, char* argv[]) +extern int TestResampledAMRImageSourceWithPointData(int argc, char* argv[]) { vtkNew testing; testing->AddArguments(argc, (const char**)(argv)); diff --git a/VTKExtensions/FiltersRendering/vtkAllToNRedistributePolyData.cxx b/VTKExtensions/FiltersRendering/vtkAllToNRedistributePolyData.cxx index 5b18f9b3fb1671479743c0553b09f6be9abfeb40..3bab751b300d2224ec372b00a9ed9e4c1c27df5e 100644 --- a/VTKExtensions/FiltersRendering/vtkAllToNRedistributePolyData.cxx +++ b/VTKExtensions/FiltersRendering/vtkAllToNRedistributePolyData.cxx @@ -7,6 +7,8 @@ #include "vtkMultiProcessController.h" #include "vtkObjectFactory.h" +#include + //---------------------------------------------------------------------------- vtkStandardNewMacro(vtkAllToNRedistributePolyData); @@ -53,10 +55,7 @@ void vtkAllToNRedistributePolyData::MakeSchedule(vtkPolyData* input, vtkCommSche { numberOfValidProcesses = numProcs; } - if (numberOfValidProcesses > numProcs) - { - numberOfValidProcesses = numProcs; - } + numberOfValidProcesses = std::min(numberOfValidProcesses, numProcs); this->SetWeights(0, numberOfValidProcesses - 1, 1.); if (numberOfValidProcesses < numProcs) diff --git a/VTKExtensions/FiltersRendering/vtkPVGeometryFilter.cxx b/VTKExtensions/FiltersRendering/vtkPVGeometryFilter.cxx index c4c70d6bd5b670671fc37d9401e3925d6f5dc255..1130e932ad635c6007f2c6acc6319c213d311aad 100644 --- a/VTKExtensions/FiltersRendering/vtkPVGeometryFilter.cxx +++ b/VTKExtensions/FiltersRendering/vtkPVGeometryFilter.cxx @@ -68,7 +68,7 @@ #include #include -namespace details +namespace { static constexpr const char* ORIGINAL_FACE_IDS = "RecoverWireframeOriginalFaceIds"; static constexpr const char* TEMP_ORIGINAL_IDS = "__original_ids__"; @@ -79,7 +79,7 @@ void AddOriginalIds(vtkDataSetAttributes* attributes, vtkIdType size) vtkNew> ids; ids->SetBackend(std::make_shared>(1, 0)); ids->SetNumberOfTuples(size); - ids->SetName(details::TEMP_ORIGINAL_IDS); + ids->SetName(::TEMP_ORIGINAL_IDS); attributes->AddArray(ids); } @@ -102,15 +102,15 @@ void AddTemporaryOriginalIdsArrays(vtkDataObject* object) auto leafDataSet = vtkDataSet::SafeDownCast(dataLeaf); if (leafDataSet) { - details::AddOriginalIds(leafDataSet->GetPointData(), leafDataSet->GetNumberOfPoints()); - details::AddOriginalIds(leafDataSet->GetCellData(), leafDataSet->GetNumberOfCells()); + ::AddOriginalIds(leafDataSet->GetPointData(), leafDataSet->GetNumberOfPoints()); + ::AddOriginalIds(leafDataSet->GetCellData(), leafDataSet->GetNumberOfCells()); } } } else if (dataSet) { - details::AddOriginalIds(dataSet->GetPointData(), dataSet->GetNumberOfPoints()); - details::AddOriginalIds(dataSet->GetCellData(), dataSet->GetNumberOfCells()); + ::AddOriginalIds(dataSet->GetPointData(), dataSet->GetNumberOfPoints()); + ::AddOriginalIds(dataSet->GetCellData(), dataSet->GetNumberOfCells()); } } @@ -133,20 +133,22 @@ void CleanupTemporaryOriginalIds(vtkDataObject* object) auto leafDataSet = vtkDataSet::SafeDownCast(dataLeaf); if (leafDataSet) { - leafDataSet->GetPointData()->RemoveArray(details::TEMP_ORIGINAL_IDS); - leafDataSet->GetCellData()->RemoveArray(details::TEMP_ORIGINAL_IDS); + leafDataSet->GetPointData()->RemoveArray(::TEMP_ORIGINAL_IDS); + leafDataSet->GetCellData()->RemoveArray(::TEMP_ORIGINAL_IDS); } } } else if (dataSet) { - dataSet->GetPointData()->RemoveArray(details::TEMP_ORIGINAL_IDS); - dataSet->GetCellData()->RemoveArray(details::TEMP_ORIGINAL_IDS); + dataSet->GetPointData()->RemoveArray(::TEMP_ORIGINAL_IDS); + dataSet->GetCellData()->RemoveArray(::TEMP_ORIGINAL_IDS); } } }; +namespace +{ template void GetValidWholeExtent(T* ds, const int wholeExt[6], int validWholeExt[6]) { @@ -159,6 +161,7 @@ void GetValidWholeExtent(T* ds, const int wholeExt[6], int validWholeExt[6]) ds->GetExtent(validWholeExt); } } +} //---------------------------------------------------------------------------- vtkStandardNewMacro(vtkPVGeometryFilter); @@ -238,8 +241,8 @@ vtkPVGeometryFilter::vtkPVGeometryFilter() this->UseNonOverlappingAMRMetaDataForOutlines = true; this->MeshCache->SetConsumer(this); - this->MeshCache->AddOriginalIds(vtkDataObject::POINT, details::TEMP_ORIGINAL_IDS); - this->MeshCache->AddOriginalIds(vtkDataObject::CELL, details::TEMP_ORIGINAL_IDS); + this->MeshCache->AddOriginalIds(vtkDataObject::POINT, ::TEMP_ORIGINAL_IDS); + this->MeshCache->AddOriginalIds(vtkDataObject::CELL, ::TEMP_ORIGINAL_IDS); } //---------------------------------------------------------------------------- @@ -465,20 +468,20 @@ void vtkPVGeometryFilter::ExecuteBlock(vtkDataObject* input, vtkPolyData* output void vtkPVGeometryFilter::UpdateCache(vtkDataObject* output) { this->MeshCache->UpdateCache(output); - details::CleanupTemporaryOriginalIds(output); + ::CleanupTemporaryOriginalIds(output); } //---------------------------------------------------------------------------- bool vtkPVGeometryFilter::UseCacheIfPossible(vtkDataObject* input, vtkDataObject* output) { - details::AddTemporaryOriginalIdsArrays(input); + ::AddTemporaryOriginalIdsArrays(input); this->MeshCache->SetOriginalDataObject(input); vtkDataObjectMeshCache::Status status = this->MeshCache->GetStatus(); if (status.enabled()) { this->MeshCache->CopyCacheToDataObject(output); - details::CleanupTemporaryOriginalIds(output); + ::CleanupTemporaryOriginalIds(output); return true; } @@ -825,7 +828,7 @@ vtkSmartPointer vtkPVGeometryFilter::GetDataObjectTreeInput( tempInput->ShallowCopy(converter->GetOutput()); } - details::AddTemporaryOriginalIdsArrays(tempInput); + ::AddTemporaryOriginalIdsArrays(tempInput); vtkTimerLog::MarkStartEvent("vtkPVGeometryFilter::CheckAttributes"); if (this->CheckAttributes(tempInput)) @@ -1435,7 +1438,7 @@ void vtkPVGeometryFilter::UnstructuredGridExecute( // UnstructuredGridGeometryFilter, the ids will represent the faces rather // than the original cells, which is important. this->GeometryFilter->PassThroughCellIdsOn(); - this->GeometryFilter->SetOriginalCellIdsName(details::ORIGINAL_FACE_IDS); + this->GeometryFilter->SetOriginalCellIdsName(::ORIGINAL_FACE_IDS); if (this->PassThroughPointIds) { @@ -1477,7 +1480,7 @@ void vtkPVGeometryFilter::UnstructuredGridExecute( vtkNew nextStageInput; nextStageInput->ShallowCopy(output); // Yes output is correct. this->RecoverWireframeFilter->SetInputData(nextStageInput.Get()); - this->RecoverWireframeFilter->SetCellIdsAttribute(details::ORIGINAL_FACE_IDS); + this->RecoverWireframeFilter->SetCellIdsAttribute(::ORIGINAL_FACE_IDS); this->RecoverWireframeFilter->Update(); this->RecoverWireframeFilter->SetInputData(nullptr); @@ -1515,7 +1518,7 @@ void vtkPVGeometryFilter::UnstructuredGridExecute( } } - output->GetCellData()->RemoveArray(details::ORIGINAL_FACE_IDS); + output->GetCellData()->RemoveArray(::ORIGINAL_FACE_IDS); return; } @@ -1538,7 +1541,7 @@ void vtkPVGeometryFilter::PolyDataExecute( originalCellIds->SetName("vtkOriginalCellIds"); originalCellIds->SetNumberOfComponents(1); vtkNew originalFaceIds; - originalFaceIds->SetName(details::ORIGINAL_FACE_IDS); + originalFaceIds->SetName(::ORIGINAL_FACE_IDS); originalFaceIds->SetNumberOfComponents(1); vtkCellData* outputCD = output->GetCellData(); outputCD->AddArray(originalCellIds.Get()); @@ -1580,7 +1583,7 @@ void vtkPVGeometryFilter::PolyDataExecute( // Get what should be the final output. output->ShallowCopy(this->RecoverWireframeFilter->GetOutput()); - output->GetCellData()->RemoveArray(details::ORIGINAL_FACE_IDS); + output->GetCellData()->RemoveArray(::ORIGINAL_FACE_IDS); } return; } diff --git a/VTKExtensions/FiltersRendering/vtkRedistributePolyData.cxx b/VTKExtensions/FiltersRendering/vtkRedistributePolyData.cxx index 29fb3a28297bcb41b8addfc917d6e0265d0ad8c0..338d4a650eb980a3acb1583abb277d951cc1dca1 100644 --- a/VTKExtensions/FiltersRendering/vtkRedistributePolyData.cxx +++ b/VTKExtensions/FiltersRendering/vtkRedistributePolyData.cxx @@ -30,6 +30,8 @@ #include "vtkUnsignedLongArray.h" #include "vtkUnsignedShortArray.h" +#include + vtkStandardNewMacro(vtkRedistributePolyData); vtkCxxSetObjectMacro(vtkRedistributePolyData, Controller, vtkMultiProcessController); @@ -37,12 +39,17 @@ vtkCxxSetObjectMacro(vtkRedistributePolyData, Controller, vtkMultiProcessControl #define VTK_REDIST_DO_TIMING 0 #define NUM_CELL_TYPES 4 +#if VTK_REDIST_DO_TIMING +namespace +{ typedef struct { vtkTimerLog* timer; float time; } _TimerInfo; _TimerInfo timerInfo8; +} +#endif vtkRedistributePolyData::vtkRedistributePolyData() { @@ -62,10 +69,10 @@ int vtkRedistributePolyData::RequestData(vtkInformation* vtkNotUsed(request), { #if VTK_REDIST_DO_TIMING vtkTimerLog* timer8 = vtkTimerLog::New(); - timerInfo8.timer = timer8; + ::timerInfo8.timer = timer8; - // timerInfo8.time = 0.; - timerInfo8.timer->StartTimer(); + // ::timerInfo8.time = 0.; + ::timerInfo8.timer->StartTimer(); #endif vtkPolyData* tmp = vtkPolyData::GetData(inputVector[0]); @@ -100,13 +107,13 @@ int vtkRedistributePolyData::RequestData(vtkInformation* vtkNotUsed(request), this->Controller->Barrier(); #if VTK_REDIST_DO_TIMING - timerInfo8.Timer->StopTimer(); - timerInfo8.Time += timerInfo8.Timer->GetElapsedTime(); + ::timerInfo8.Timer->StopTimer(); + ::timerInfo8.Time += ::timerInfo8.Timer->GetElapsedTime(); if (myId == 0) { - vtkDebugMacro("barrier bef sched time = " << timerInfo8.Time); + vtkDebugMacro("barrier bef sched time = " << ::timerInfo8.Time); } - timerInfo8.Timer->StartTimer(); + ::timerInfo8.Timer->StartTimer(); #endif vtkCommSched localSched; @@ -124,13 +131,13 @@ int vtkRedistributePolyData::RequestData(vtkInformation* vtkNotUsed(request), vtkIdType* numCells = localSched.NumberOfCells; #if VTK_REDIST_DO_TIMING - timerInfo8.timer->StopTimer(); - timerInfo8.time += timerInfo8.timer->GetElapsedTime(); + ::timerInfo8.timer->StopTimer(); + ::timerInfo8.time += ::timerInfo8.timer->GetElapsedTime(); if (myId == 0) { - vtkDebugMacro(<< "schedule time = " << timerInfo8.time); + vtkDebugMacro(<< "schedule time = " << ::timerInfo8.time); } - timerInfo8.timer->StartTimer(); + ::timerInfo8.timer->StartTimer(); #endif // beginning of turned of bounds section (not needed) @@ -140,13 +147,13 @@ int vtkRedistributePolyData::RequestData(vtkInformation* vtkNotUsed(request), this->Controller->Barrier(); #if VTK_REDIST_DO_TIMING - timerInfo8.timer->StopTimer(); - timerInfo8.time += timerInfo8.timer->GetElapsedTime(); + ::timerInfo8.timer->StopTimer(); + ::timerInfo8.time += ::timerInfo8.timer->GetElapsedTime(); if (myId==0) { - vtkDegugMacro(<<"barrier bef bounds time = "< u; u->Initialize(argc, argv); diff --git a/VTKExtensions/IOCGNS/Testing/Cxx/TestMappedUnstructuredGrid.cxx b/VTKExtensions/IOCGNS/Testing/Cxx/TestMappedUnstructuredGrid.cxx index 15fb53f6788ba311460ffe3697a6ba53f35cb429..4d22c0793bf13014ecb5e66a0dc1260aadcfa58c 100644 --- a/VTKExtensions/IOCGNS/Testing/Cxx/TestMappedUnstructuredGrid.cxx +++ b/VTKExtensions/IOCGNS/Testing/Cxx/TestMappedUnstructuredGrid.cxx @@ -15,7 +15,7 @@ #include "vtkPointData.h" #include "vtkUnstructuredGrid.h" -int TestMappedUnstructuredGrid(int argc, char* argv[]) +extern int TestMappedUnstructuredGrid(int argc, char* argv[]) { vtkUnstructuredGridBase* ug; vtkMappedUnstructuredGridGenerator::GenerateMappedUnstructuredGrid(&ug); diff --git a/VTKExtensions/IOCGNS/Testing/Cxx/TestMultiBlockDataSet.cxx b/VTKExtensions/IOCGNS/Testing/Cxx/TestMultiBlockDataSet.cxx index ca45e041006e3637bedd5847f7a35f3c8c3ade84..21c77ff62f4079321f592feb85ef95811886475d 100644 --- a/VTKExtensions/IOCGNS/Testing/Cxx/TestMultiBlockDataSet.cxx +++ b/VTKExtensions/IOCGNS/Testing/Cxx/TestMultiBlockDataSet.cxx @@ -14,7 +14,7 @@ #include "vtkUnstructuredGrid.h" int MultiBlockTest(vtkMultiBlockDataSet*); -int TestMultiBlockDataSet(int argc, char* argv[]) +extern int TestMultiBlockDataSet(int argc, char* argv[]) { vtkNew ug; Create(ug, 10); diff --git a/VTKExtensions/IOCGNS/Testing/Cxx/TestPartitionedDataSet.cxx b/VTKExtensions/IOCGNS/Testing/Cxx/TestPartitionedDataSet.cxx index 522b0962da4114f0901db975fd22d35de59d6157..479de8c6f544f85b5a6461569576b9cc5512709f 100644 --- a/VTKExtensions/IOCGNS/Testing/Cxx/TestPartitionedDataSet.cxx +++ b/VTKExtensions/IOCGNS/Testing/Cxx/TestPartitionedDataSet.cxx @@ -17,7 +17,7 @@ #include "vtksys/SystemTools.hxx" -int TestPartitionedDataSet(int argc, char* argv[]) +extern int TestPartitionedDataSet(int argc, char* argv[]) { vtkNew partitioned; partitioned->SetNumberOfPartitions(4); diff --git a/VTKExtensions/IOCGNS/Testing/Cxx/TestPartitionedDataSetCollection.cxx b/VTKExtensions/IOCGNS/Testing/Cxx/TestPartitionedDataSetCollection.cxx index 2f2662573acda669e57ed720e8624021bb64703c..8391bd5264cbe0a3eb1973b4b7324bf19d15a9cb 100644 --- a/VTKExtensions/IOCGNS/Testing/Cxx/TestPartitionedDataSetCollection.cxx +++ b/VTKExtensions/IOCGNS/Testing/Cxx/TestPartitionedDataSetCollection.cxx @@ -17,7 +17,7 @@ #include "vtksys/SystemTools.hxx" -int TestPartitionedDataSetCollection(int argc, char* argv[]) +extern int TestPartitionedDataSetCollection(int argc, char* argv[]) { int result(0); diff --git a/VTKExtensions/IOCGNS/Testing/Cxx/TestPartitionedDataSetCollection2.cxx b/VTKExtensions/IOCGNS/Testing/Cxx/TestPartitionedDataSetCollection2.cxx index 755db48e5d869d645d863f4da5614747222de157..4bdd0a02141534a4ffaca4c1551c680669aea620 100644 --- a/VTKExtensions/IOCGNS/Testing/Cxx/TestPartitionedDataSetCollection2.cxx +++ b/VTKExtensions/IOCGNS/Testing/Cxx/TestPartitionedDataSetCollection2.cxx @@ -16,7 +16,7 @@ #include -int TestPartitionedDataSetCollection2(int argc, char* argv[]) +extern int TestPartitionedDataSetCollection2(int argc, char* argv[]) { // read can.ex2 using ioss reader char* fileNameC = vtkTestUtilities::ExpandDataFileName(argc, argv, "Testing/Data/can.ex2"); diff --git a/VTKExtensions/IOCGNS/Testing/Cxx/TestPolydata.cxx b/VTKExtensions/IOCGNS/Testing/Cxx/TestPolydata.cxx index e5fe787fd18bd26078aacf3ac69a2f3f3c81a058..24163601792651908cc341e92f96ae9a9c98410d 100644 --- a/VTKExtensions/IOCGNS/Testing/Cxx/TestPolydata.cxx +++ b/VTKExtensions/IOCGNS/Testing/Cxx/TestPolydata.cxx @@ -16,7 +16,7 @@ #include "vtkPolyData.h" #include "vtkUnstructuredGrid.h" -int TestPolydata(int argc, char* argv[]) +extern int TestPolydata(int argc, char* argv[]) { vtkNew pd; Create(pd); diff --git a/VTKExtensions/IOCGNS/Testing/Cxx/TestPolyhedral.cxx b/VTKExtensions/IOCGNS/Testing/Cxx/TestPolyhedral.cxx index a8279e10e49e9e84aebb4c526538209a7a8810e8..8487a6ca9fe2aa16d0d1c82b7c09defc3a7f8d47 100644 --- a/VTKExtensions/IOCGNS/Testing/Cxx/TestPolyhedral.cxx +++ b/VTKExtensions/IOCGNS/Testing/Cxx/TestPolyhedral.cxx @@ -15,7 +15,7 @@ #include "vtkPointData.h" #include "vtkUnstructuredGrid.h" -int TestPolyhedral(int argc, char* argv[]) +extern int TestPolyhedral(int argc, char* argv[]) { vtkNew ph; CreatePolyhedral(ph); diff --git a/VTKExtensions/IOCGNS/Testing/Cxx/TestRectilinearGrid.cxx b/VTKExtensions/IOCGNS/Testing/Cxx/TestRectilinearGrid.cxx index 80e76a2ca05d05b84e58fc63f874ca4d8e3335ba..95e0349326241ead4bdb873c82a80a012e4e5460 100644 --- a/VTKExtensions/IOCGNS/Testing/Cxx/TestRectilinearGrid.cxx +++ b/VTKExtensions/IOCGNS/Testing/Cxx/TestRectilinearGrid.cxx @@ -12,7 +12,7 @@ #include "vtkPointData.h" #include "vtkRectilinearGrid.h" -int TestRectilinearGrid(int argc, char* argv[]) +extern int TestRectilinearGrid(int argc, char* argv[]) { vtkNew u; u->Initialize(argc, argv); diff --git a/VTKExtensions/IOCGNS/Testing/Cxx/TestStructuredGrid.cxx b/VTKExtensions/IOCGNS/Testing/Cxx/TestStructuredGrid.cxx index dfe129a053f6133ed72b61ddceef3d07bfab7721..c25d9d8805fa10a112a2bad25572f9f3a8ea9092 100644 --- a/VTKExtensions/IOCGNS/Testing/Cxx/TestStructuredGrid.cxx +++ b/VTKExtensions/IOCGNS/Testing/Cxx/TestStructuredGrid.cxx @@ -13,7 +13,7 @@ #include "vtkPointData.h" #include "vtkStructuredGrid.h" -int TestStructuredGrid(int argc, char* argv[]) +extern int TestStructuredGrid(int argc, char* argv[]) { vtkNew u; u->Initialize(argc, argv); diff --git a/VTKExtensions/IOCGNS/Testing/Cxx/TestTimeWriting.cxx b/VTKExtensions/IOCGNS/Testing/Cxx/TestTimeWriting.cxx index fd087053e0fcf1109ae0f08ec43bc7c621e49963..c638fc9e925f1a51aeb68e757f965e8d415ef6f4 100644 --- a/VTKExtensions/IOCGNS/Testing/Cxx/TestTimeWriting.cxx +++ b/VTKExtensions/IOCGNS/Testing/Cxx/TestTimeWriting.cxx @@ -16,7 +16,7 @@ #include "vtkStreamingDemandDrivenPipeline.h" #include "vtkUnstructuredGrid.h" -int TestTimeWriting(int argc, char* argv[]) +extern int TestTimeWriting(int argc, char* argv[]) { vtkNew ug; Create(ug.GetPointer(), 10); diff --git a/VTKExtensions/IOCGNS/Testing/Cxx/TestUnstructuredGrid.cxx b/VTKExtensions/IOCGNS/Testing/Cxx/TestUnstructuredGrid.cxx index 5b62eb878838c644749f8d3d7de16f279cbf1f7f..df5661d2e0a4f27428d8133d4335fe8802e66ad7 100644 --- a/VTKExtensions/IOCGNS/Testing/Cxx/TestUnstructuredGrid.cxx +++ b/VTKExtensions/IOCGNS/Testing/Cxx/TestUnstructuredGrid.cxx @@ -15,7 +15,7 @@ #include "vtkPointData.h" #include "vtkUnstructuredGrid.h" -int TestUnstructuredGrid(int argc, char* argv[]) +extern int TestUnstructuredGrid(int argc, char* argv[]) { vtkNew ug; Create(ug.GetPointer(), 10); diff --git a/VTKExtensions/IOCGNS/vtkCGNSWriter.cxx b/VTKExtensions/IOCGNS/vtkCGNSWriter.cxx index 4f4c2312d736736ce27d6bba2b082c9e224bf0d2..748b1e5f9c7ee325c5b921ce721a6da2d50aafff 100644 --- a/VTKExtensions/IOCGNS/vtkCGNSWriter.cxx +++ b/VTKExtensions/IOCGNS/vtkCGNSWriter.cxx @@ -35,6 +35,7 @@ #include VTK_CGNS(cgnslib.h) // clang-format on +#include #include #include #include @@ -478,10 +479,7 @@ bool vtkCGNSWriter::vtkPrivate::WritePointSet( { vtkCell* cell = grid->GetCell(i); int cellDim = cell->GetCellDimension(); - if (info.CellDim < cellDim) - { - info.CellDim = cellDim; - } + info.CellDim = std::max(info.CellDim, cellDim); } } @@ -502,6 +500,8 @@ bool vtkCGNSWriter::vtkPrivate::WritePointSet( } //------------------------------------------------------------------------------ +namespace +{ /** * This function assigns the correct order of data elements for cases where * multiple element types are written in different sections in a CGNS zone. @@ -529,6 +529,7 @@ void ReorderData( temp[i] = reordered[i]; } } +} //------------------------------------------------------------------------------ // writes a field array to a new solution @@ -827,10 +828,7 @@ int vtkCGNSWriter::vtkPrivate::DetermineCellDimension(vtkPointSet* pointSet) { vtkCell* cell = unstructuredGrid->GetCell(n); int curCellDim = cell->GetCellDimension(); - if (CellDim < curCellDim) - { - CellDim = curCellDim; - } + CellDim = std::max(CellDim, curCellDim); } } } diff --git a/VTKExtensions/IOCore/Testing/Cxx/TestCSVWriter.cxx b/VTKExtensions/IOCore/Testing/Cxx/TestCSVWriter.cxx index 33069b9805e4d38e4f21bc5f1ce54812a1c58947..4eccb22e88bb2e5c6255f52753d38323a9edf827 100644 --- a/VTKExtensions/IOCore/Testing/Cxx/TestCSVWriter.cxx +++ b/VTKExtensions/IOCore/Testing/Cxx/TestCSVWriter.cxx @@ -115,7 +115,7 @@ bool ReadAndVerifyCSV(const std::string& fname, int rank, int numRanks) } // end of namespace -int TestCSVWriter(int argc, char* argv[]) +extern int TestCSVWriter(int argc, char* argv[]) { vtkMPIController* contr = vtkMPIController::New(); contr->Initialize(&argc, &argv); diff --git a/VTKExtensions/IOCore/Testing/Cxx/TestPVDArraySelection.cxx b/VTKExtensions/IOCore/Testing/Cxx/TestPVDArraySelection.cxx index 11a194f69619033863a5d4591bc6e36c73653b34..92565cd591e58fb795b9db0652a4bcf83fafb7d5 100644 --- a/VTKExtensions/IOCore/Testing/Cxx/TestPVDArraySelection.cxx +++ b/VTKExtensions/IOCore/Testing/Cxx/TestPVDArraySelection.cxx @@ -16,7 +16,7 @@ return EXIT_FAILURE; \ } -bool HasArray(vtkDataObject* dobj, int association, const char* aname) +static bool HasArray(vtkDataObject* dobj, int association, const char* aname) { if (auto cd = vtkCompositeDataSet::SafeDownCast(dobj)) { @@ -35,7 +35,7 @@ bool HasArray(vtkDataObject* dobj, int association, const char* aname) } } -int TestPVDArraySelection(int argc, char* argv[]) +extern int TestPVDArraySelection(int argc, char* argv[]) { vtkNew reader; diff --git a/VTKExtensions/IOCore/vtkFileSeriesWriter.cxx b/VTKExtensions/IOCore/vtkFileSeriesWriter.cxx index 2a9a3c83b9922ca5affaf883314dc5593f3e080e..b00049e7f0e8ab68a00e325bb2b9087d1afbac53 100644 --- a/VTKExtensions/IOCore/vtkFileSeriesWriter.cxx +++ b/VTKExtensions/IOCore/vtkFileSeriesWriter.cxx @@ -18,6 +18,7 @@ #include "vtk_jsoncpp.h" +#include #include #include @@ -122,10 +123,7 @@ int vtkFileSeriesWriter::RequestUpdateExtent(vtkInformation* vtkNotUsed(request) inputVector[0]->GetInformationObject(0)->Get(vtkStreamingDemandDrivenPipeline::TIME_STEPS()); if (inTimes && this->WriteAllTimeSteps) { - if (this->CurrentTimeIndex < this->MinTimeStep) - { - this->CurrentTimeIndex = this->MinTimeStep; - } + this->CurrentTimeIndex = std::max(this->CurrentTimeIndex, this->MinTimeStep); double timeReq = inTimes[this->CurrentTimeIndex]; inputVector[0]->GetInformationObject(0)->Set( vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP(), timeReq); diff --git a/VTKExtensions/IOEnSight/Testing/Cxx/TestPEnSightBinaryGoldReader.cxx b/VTKExtensions/IOEnSight/Testing/Cxx/TestPEnSightBinaryGoldReader.cxx index 58ac7fd5272852159cb12e4ff2e3f97d3a3536be..494491e65bf445a665db1c0cdc4e5d5eb1b8a5e1 100644 --- a/VTKExtensions/IOEnSight/Testing/Cxx/TestPEnSightBinaryGoldReader.cxx +++ b/VTKExtensions/IOEnSight/Testing/Cxx/TestPEnSightBinaryGoldReader.cxx @@ -7,7 +7,7 @@ #include "vtkTestUtilities.h" #include "vtkUnstructuredGrid.h" -int TestPEnSightBinaryGoldReader(int argc, char* argv[]) +extern int TestPEnSightBinaryGoldReader(int argc, char* argv[]) { char* fname = vtkTestUtilities::ExpandDataFileName(argc, argv, "Testing/Data/EnSight/TEST_bin.case"); diff --git a/VTKExtensions/IOEnSight/vtkPEnSightReader.cxx b/VTKExtensions/IOEnSight/vtkPEnSightReader.cxx index 00cff62bbbd62fa61a4c1308fc485afd308dbb9b..12ece7b977e234aa001f9497cefcb4cc69a1473a 100644 --- a/VTKExtensions/IOEnSight/vtkPEnSightReader.cxx +++ b/VTKExtensions/IOEnSight/vtkPEnSightReader.cxx @@ -2446,11 +2446,9 @@ void vtkPEnSightReader::PrepareStructuredDimensionsForDistribution(int partId, i int realPointEnd = pointEndIndex; cellBeginIndex -= ghostLevel; - if (cellBeginIndex < 0) - cellBeginIndex = 0; + cellBeginIndex = std::max(cellBeginIndex, 0); cellEndIndex += ghostLevel; - if (cellEndIndex > oldCellDimension) - cellEndIndex = oldCellDimension; + cellEndIndex = std::min(cellEndIndex, oldCellDimension); newCellDimension = cellEndIndex - cellBeginIndex; newPointDimension = newCellDimension + 1; diff --git a/VTKExtensions/IOEnSight/vtkPVEnSightMasterServerReader.cxx b/VTKExtensions/IOEnSight/vtkPVEnSightMasterServerReader.cxx index c1e1373d3fdd0f994588dc7943b1c102dfc83a70..189b5af89dcb4f63fbd016a7087cf845bad04cbe 100644 --- a/VTKExtensions/IOEnSight/vtkPVEnSightMasterServerReader.cxx +++ b/VTKExtensions/IOEnSight/vtkPVEnSightMasterServerReader.cxx @@ -78,6 +78,8 @@ void vtkPVEnSightMasterServerReader::PrintSelf(ostream& os, vtkIndent indent) } //---------------------------------------------------------------------------- +namespace +{ #if VTK_MODULE_ENABLE_VTK_ParallelMPI template int vtkPVEnSightMasterServerReaderSyncValues( @@ -149,6 +151,7 @@ int vtkPVEnSightMasterServerReaderSyncValues(T*, int, int, vtkMultiProcessContro return VTK_OK; } #endif +} //---------------------------------------------------------------------------- int vtkPVEnSightMasterServerReader::RequestInformation( @@ -174,7 +177,7 @@ int vtkPVEnSightMasterServerReader::RequestInformation( // Make sure all nodes could parse the file and agree on the number // of pieces. - if ((vtkPVEnSightMasterServerReaderSyncValues( + if ((::vtkPVEnSightMasterServerReaderSyncValues( parseResults, 2, this->Controller->GetNumberOfProcesses(), this->Controller) != VTK_OK) || (parseResults[0] != VTK_OK)) { @@ -192,7 +195,7 @@ int vtkPVEnSightMasterServerReader::RequestInformation( this->SuperclassExecuteInformation(request, inputVector, outputVector); this->Internal->EnSightVersion = this->EnSightVersion; } - if (vtkPVEnSightMasterServerReaderSyncValues( + if (::vtkPVEnSightMasterServerReaderSyncValues( &this->Internal->EnSightVersion, 1, this->NumberOfPieces, this->Controller) != VTK_OK) { vtkErrorMacro("EnSight version mismatch across nodes."); @@ -211,7 +214,7 @@ int vtkPVEnSightMasterServerReader::RequestInformation( // Compare number of time sets. vtkDataArrayCollection* timeSets = this->GetTimeSets(); this->Internal->NumberOfTimeSets = timeSets ? timeSets->GetNumberOfItems() : 0; - if (vtkPVEnSightMasterServerReaderSyncValues( + if (::vtkPVEnSightMasterServerReaderSyncValues( &this->Internal->NumberOfTimeSets, 1, this->NumberOfPieces, this->Controller) != VTK_OK) { vtkErrorMacro("Number of time sets not equal on all nodes."); @@ -230,7 +233,7 @@ int vtkPVEnSightMasterServerReader::RequestInformation( (this->Internal->CumulativeTimeSetSizes[i] + timeSets->GetItem(i)->GetNumberOfTuples()); } } - if (vtkPVEnSightMasterServerReaderSyncValues(&*this->Internal->CumulativeTimeSetSizes.begin(), + if (::vtkPVEnSightMasterServerReaderSyncValues(&*this->Internal->CumulativeTimeSetSizes.begin(), this->Internal->NumberOfTimeSets + 1, this->NumberOfPieces, this->Controller) != VTK_OK) { vtkErrorMacro("Time set sizes not equal on all nodes."); @@ -263,7 +266,7 @@ int vtkPVEnSightMasterServerReader::RequestInformation( this->Internal->TimeSetValues.resize( this->Internal->CumulativeTimeSetSizes[this->Internal->NumberOfTimeSets]); } - if (vtkPVEnSightMasterServerReaderSyncValues(&*this->Internal->TimeSetValues.begin(), + if (::vtkPVEnSightMasterServerReaderSyncValues(&*this->Internal->TimeSetValues.begin(), static_cast(this->Internal->TimeSetValues.size()), this->NumberOfPieces, this->Controller) != VTK_OK) { @@ -292,7 +295,7 @@ int vtkPVEnSightMasterServerReader::RequestData( // Let the superclass read the data and setup the outputs. this->SuperclassExecuteData(request, inputVector, outputVector); } - if (vtkPVEnSightMasterServerReaderSyncValues( + if (::vtkPVEnSightMasterServerReaderSyncValues( &this->Internal->NumberOfOutputs, 1, this->NumberOfPieces, this->Controller) != VTK_OK) { vtkErrorMacro("Number of outputs does not match on all nodes."); diff --git a/VTKExtensions/IOEnSight/vtkPVEnSightMasterServerReader2.cxx b/VTKExtensions/IOEnSight/vtkPVEnSightMasterServerReader2.cxx index b13d6017d24754fde652de54eefd12928cc5cd49..c5843a73877895c0e1305973304c2556cc5ecfe8 100644 --- a/VTKExtensions/IOEnSight/vtkPVEnSightMasterServerReader2.cxx +++ b/VTKExtensions/IOEnSight/vtkPVEnSightMasterServerReader2.cxx @@ -84,6 +84,8 @@ void vtkPVEnSightMasterServerReader2::PrintSelf(ostream& os, vtkIndent indent) } //---------------------------------------------------------------------------- +namespace +{ #if VTK_MODULE_ENABLE_VTK_ParallelMPI template int vtkPVEnSightMasterServerReader2SyncValues( @@ -162,6 +164,7 @@ int vtkPVEnSightMasterServerReader2SyncValues(T*, int, int, vtkMultiProcessContr return VTK_OK; } #endif +} //---------------------------------------------------------------------------- int vtkPVEnSightMasterServerReader2::RequestInformation(vtkInformation* vtkNotUsed(request), @@ -187,7 +190,7 @@ int vtkPVEnSightMasterServerReader2::RequestInformation(vtkInformation* vtkNotUs // Make sure all nodes could parse the file and agree on the number // of pieces. - if ((vtkPVEnSightMasterServerReader2SyncValues( + if ((::vtkPVEnSightMasterServerReader2SyncValues( parseResults, 2, this->Controller->GetNumberOfProcesses(), this->Controller) != VTK_OK) || (parseResults[0] != VTK_OK)) { @@ -221,7 +224,7 @@ int vtkPVEnSightMasterServerReader2::RequestInformation(vtkInformation* vtkNotUs // Across nodes. this->Internal->EnSightVersion = this->Internal->RealReaders[0]->GetEnSightVersion(); - if (vtkPVEnSightMasterServerReader2SyncValues(&this->Internal->EnSightVersion, 1, + if (::vtkPVEnSightMasterServerReader2SyncValues(&this->Internal->EnSightVersion, 1, this->Controller->GetNumberOfProcesses(), this->Controller) != VTK_OK) { vtkErrorMacro("EnSight version mismatch across nodes."); @@ -254,7 +257,7 @@ int vtkPVEnSightMasterServerReader2::RequestInformation(vtkInformation* vtkNotUs } // Across nodes. this->Internal->NumberOfTimeSets = (timeSets ? timeSets->GetNumberOfItems() : 0); - if (vtkPVEnSightMasterServerReader2SyncValues(&this->Internal->NumberOfTimeSets, 1, + if (::vtkPVEnSightMasterServerReader2SyncValues(&this->Internal->NumberOfTimeSets, 1, this->Controller->GetNumberOfProcesses(), this->Controller) != VTK_OK) { this->InformationError = 1; @@ -285,7 +288,7 @@ int vtkPVEnSightMasterServerReader2::RequestInformation(vtkInformation* vtkNotUs (this->Internal->CumulativeTimeSetSizes[i] + timeSets->GetItem(i)->GetNumberOfTuples()); } - if (vtkPVEnSightMasterServerReader2SyncValues(&this->Internal->CumulativeTimeSetSizes.at(0), + if (::vtkPVEnSightMasterServerReader2SyncValues(&this->Internal->CumulativeTimeSetSizes.at(0), this->Internal->NumberOfTimeSets + 1, this->Controller->GetNumberOfProcesses(), this->Controller) != VTK_OK) { @@ -333,7 +336,7 @@ int vtkPVEnSightMasterServerReader2::RequestInformation(vtkInformation* vtkNotUs if (!this->Internal->TimeSetValues.empty()) { - if (vtkPVEnSightMasterServerReader2SyncValues(&this->Internal->TimeSetValues.at(0), + if (::vtkPVEnSightMasterServerReader2SyncValues(&this->Internal->TimeSetValues.at(0), static_cast(this->Internal->TimeSetValues.size()), this->Controller->GetNumberOfProcesses(), this->Controller) != VTK_OK) { diff --git a/VTKExtensions/IOGeneral/vtkNastranBDFReader.cxx b/VTKExtensions/IOGeneral/vtkNastranBDFReader.cxx index e263fc3e4df98d1977d0aec0726e499e52536117..d793dd1f05ef8771e8a732d0f828a763d4aeeec1 100644 --- a/VTKExtensions/IOGeneral/vtkNastranBDFReader.cxx +++ b/VTKExtensions/IOGeneral/vtkNastranBDFReader.cxx @@ -20,18 +20,18 @@ vtkStandardNewMacro(vtkNastranBDFReader); -static const std::string COMMENT_KEY = "$"; -static const std::vector IGNORED_KEYS = { COMMENT_KEY, "BEGIN BULK", "ENDDATA", - "PSHELL", "MAT1" }; +namespace +{ +const std::string COMMENT_KEY = "$"; +const std::vector IGNORED_KEYS = { COMMENT_KEY, "BEGIN BULK", "ENDDATA", "PSHELL", + "MAT1" }; -static const std::string CTRIA3_KEY = "CTRIA3"; -static const std::string GRID_KEY = "GRID"; -static const std::string PLOAD2_KEY = "PLOAD2"; -static const std::string TIME_KEY = "TIME"; -static const std::string TITLE_KEY = "TITLE"; +const std::string CTRIA3_KEY = "CTRIA3"; +const std::string GRID_KEY = "GRID"; +const std::string PLOAD2_KEY = "PLOAD2"; +const std::string TIME_KEY = "TIME"; +const std::string TITLE_KEY = "TITLE"; -namespace utils -{ // Returns if `line` starts with the string `keyword` bool StartsWith(const std::string& line, const std::string& keyword) { @@ -66,12 +66,12 @@ void TrimTrailingComment(std::string& line) std::vector ParseArgs(const std::string& line, const std::string& keyword) { std::vector arguments; - if (keyword == TITLE_KEY) + if (keyword == ::TITLE_KEY) { // remove `TITLE` keyword and the `=` char arguments.push_back(line.substr(line.find(keyword) + keyword.size() + 1)); } - else if (keyword == TIME_KEY) + else if (keyword == ::TIME_KEY) { arguments.push_back(line.substr(line.find(keyword) + keyword.size())); } @@ -110,7 +110,7 @@ vtkIdType vtkNastranBDFReader::GetVTKPointId(const std::string& arg) bool vtkNastranBDFReader::AddTitle(const std::vector& args) { vtkNew data; - data->SetName(TITLE_KEY.c_str()); + data->SetName(::TITLE_KEY.c_str()); data->InsertNextValue(args[0]); this->GetOutput()->GetFieldData()->AddArray(data); return true; @@ -120,7 +120,7 @@ bool vtkNastranBDFReader::AddTitle(const std::vector& args) bool vtkNastranBDFReader::AddTimeInfo(const std::vector& args) { vtkNew data; - data->SetName(TIME_KEY.c_str()); + data->SetName(::TIME_KEY.c_str()); data->InsertNextValue(std::stod(args[0])); this->GetOutput()->GetFieldData()->AddArray(data); return true; @@ -216,7 +216,7 @@ bool vtkNastranBDFReader::AddPload2Data(const std::vector& args) { this->Pload2 = vtkSmartPointer::New(); this->Pload2->SetNumberOfTuples(this->Cells->GetNumberOfCells()); - this->Pload2->SetName(PLOAD2_KEY.c_str()); + this->Pload2->SetName(::PLOAD2_KEY.c_str()); } this->Pload2->InsertValue(this->CellsIds[std::stol(args[2])], std::stod(args[1])); @@ -245,36 +245,36 @@ int vtkNastranBDFReader::RequestData(vtkInformation*, vtkInformationVector**, vt while (vtksys::SystemTools::GetLineFromStream(filestream, line) && success) { // skip blank and comments - if (line.empty() || utils::IsIgnored(line)) + if (line.empty() || ::IsIgnored(line)) { continue; } - utils::TrimTrailingComment(line); + ::TrimTrailingComment(line); // we parse values with std::sto[ild] that may raise exception. Catch them. try { // parse line depending on keyword - if (utils::StartsWith(line, TITLE_KEY)) + if (::StartsWith(line, ::TITLE_KEY)) { - success = this->AddTitle(utils::ParseArgs(line, TITLE_KEY)); + success = this->AddTitle(ParseArgs(line, ::TITLE_KEY)); } - else if (utils::StartsWith(line, TIME_KEY)) + else if (::StartsWith(line, ::TIME_KEY)) { - success = this->AddTimeInfo(utils::ParseArgs(line, TITLE_KEY)); + success = this->AddTimeInfo(::ParseArgs(line, TITLE_KEY)); } - else if (utils::StartsWith(line, GRID_KEY)) + else if (::StartsWith(line, ::GRID_KEY)) { - success = this->AddPoint(utils::ParseArgs(line, GRID_KEY)); + success = this->AddPoint(::ParseArgs(line, ::GRID_KEY)); } - else if (utils::StartsWith(line, CTRIA3_KEY)) + else if (::StartsWith(line, ::CTRIA3_KEY)) { - success = this->AddTriangle(utils::ParseArgs(line, CTRIA3_KEY)); + success = this->AddTriangle(::ParseArgs(line, ::CTRIA3_KEY)); } - else if (utils::StartsWith(line, PLOAD2_KEY)) + else if (::StartsWith(line, ::PLOAD2_KEY)) { - success = this->AddPload2Data(utils::ParseArgs(line, PLOAD2_KEY)); + success = this->AddPload2Data(::ParseArgs(line, ::PLOAD2_KEY)); } // store unsupported keyword for summary reporting. else diff --git a/VTKExtensions/IOGeneral/vtkPPhastaReader.cxx b/VTKExtensions/IOGeneral/vtkPPhastaReader.cxx index b228f983b20d1c8767204732edb49f637c1fc729..96cf6371b6e576df4e0bb0a093960549780bc594 100644 --- a/VTKExtensions/IOGeneral/vtkPPhastaReader.cxx +++ b/VTKExtensions/IOGeneral/vtkPPhastaReader.cxx @@ -20,6 +20,7 @@ #include +#include #include #include @@ -411,10 +412,7 @@ int vtkPPhastaReader::RequestInformation( int index; if (nested2->GetScalarAttribute("index", &index)) { - if ((index + 1) > numTimeSteps) - { - numTimeSteps = index + 1; - } + numTimeSteps = std::max(numTimeSteps, index + 1); vtkPPhastaReaderInternal::TimeStepInfo& info = this->Internal->TimeStepInfoMap[index]; int gIdx; if (nested2->GetScalarAttribute("geometry_index", &gIdx)) @@ -503,10 +501,7 @@ int vtkPPhastaReader::RequestInformation( } } - if (numberOfFields < numberOfFields2) - { - numberOfFields = numberOfFields2; - } + numberOfFields = std::max(numberOfFields, numberOfFields2); break; } diff --git a/VTKExtensions/IOGeneral/vtkPhastaReader.cxx b/VTKExtensions/IOGeneral/vtkPhastaReader.cxx index a3d17985c023ab5614158070608e9e2885d625ea..44a91e1a1cdf89e742ece5a4907eb4fce3828417 100644 --- a/VTKExtensions/IOGeneral/vtkPhastaReader.cxx +++ b/VTKExtensions/IOGeneral/vtkPhastaReader.cxx @@ -54,15 +54,17 @@ struct vtkPhastaReaderInternal // Begin of copy from phastaIO +namespace +{ std::map LastHeaderKey; std::vector fileArray; std::vector byte_order; std::vector header_type; -int DataSize = 0; int LastHeaderNotFound = 0; int Wrong_Endian = 0; int Strict_Error = 0; int binary_format = 0; +} // the caller has the responsibility to delete the returned string char* vtkPhastaReader::StringStripper(const char istring[]) @@ -122,11 +124,11 @@ void vtkPhastaReader::isBinary(const char iotype[]) char* fname = StringStripper(iotype); if (cscompare(fname, "binary")) { - binary_format = 1; + ::binary_format = 1; } else { - binary_format = 0; + ::binary_format = 0; } delete[] fname; } @@ -197,8 +199,11 @@ int vtkPhastaReader::readHeader(FILE* fileObject, const char phrase[], int* para if (!fgets(Line, 1024, fileObject) && feof(fileObject)) { - rewind(fileObject); - clearerr(fileObject); + if (fseek(fileObject, 0, SEEK_SET)) + { + vtkErrorWithObjectMacro(nullptr, << "Failed to rewind input: " << strerror(errno) << endl); + return 1; + } rewind_count++; xfgets(Line, 1024, fileObject); @@ -229,13 +234,13 @@ int vtkPhastaReader::readHeader(FILE* fileObject, const char phrase[], int* para } else if (cscompare(token, "byteorder magic number")) { - if (binary_format) + if (::binary_format) { xfread((void*)&integer_value, sizeof(int), 1, fileObject); xfread(&junk, sizeof(char), 1, fileObject); if (362436 != integer_value) { - Wrong_Endian = 1; + ::Wrong_Endian = 1; } } else @@ -248,7 +253,7 @@ int vtkPhastaReader::readHeader(FILE* fileObject, const char phrase[], int* para /* some other header, so just skip over */ token = strtok(nullptr, " ,;<>"); skip_size = atoi(token); - if (binary_format) + if (::binary_format) { fseek(fileObject, skip_size, SEEK_CUR); } @@ -267,7 +272,12 @@ int vtkPhastaReader::readHeader(FILE* fileObject, const char phrase[], int* para { if (!fgets(Line, 1024, fileObject) && feof(fileObject)) { - rewind(fileObject); + if (fseek(fileObject, 0, SEEK_SET)) + { + vtkErrorWithObjectMacro( + nullptr, << "Failed to rewind input: " << strerror(errno) << endl); + return 1; + } clearerr(fileObject); rewind_count++; xfgets(Line, 1024, fileObject); @@ -329,10 +339,10 @@ void vtkPhastaReader::openfile(const char filename[], const char mode[], int* fi } else { - fileArray.push_back(file); - byte_order.push_back(0); - header_type.push_back(sizeof(int)); - *fileDescriptor = static_cast(fileArray.size()); + ::fileArray.push_back(file); + ::byte_order.push_back(0); + ::header_type.push_back(sizeof(int)); + *fileDescriptor = static_cast(::fileArray.size()); } delete[] imode; } @@ -343,10 +353,10 @@ void vtkPhastaReader::closefile(int* fileDescriptor, const char mode[]) if (cscompare("write", imode) || cscompare("append", imode)) { - fflush(fileArray[*fileDescriptor - 1]); + fflush(::fileArray[*fileDescriptor - 1]); } - fclose(fileArray[*fileDescriptor - 1]); + fclose(::fileArray[*fileDescriptor - 1]); delete[] imode; } @@ -357,7 +367,7 @@ void vtkPhastaReader::readheader(int* fileDescriptor, const char keyphrase[], vo FILE* fileObject; int* valueListInt; - if (*fileDescriptor < 1 || *fileDescriptor > (int)fileArray.size()) + if (*fileDescriptor < 1 || *fileDescriptor > (int)::fileArray.size()) { vtkGenericWarningMacro(<< "No file associated with Descriptor " << *fileDescriptor << "\n" << "openfile function has to be called before \n" @@ -366,11 +376,11 @@ void vtkPhastaReader::readheader(int* fileDescriptor, const char keyphrase[], vo return; } - LastHeaderKey[filePtr] = const_cast(keyphrase); - LastHeaderNotFound = 0; + ::LastHeaderKey[filePtr] = const_cast(keyphrase); + ::LastHeaderNotFound = 0; - fileObject = fileArray[filePtr]; - Wrong_Endian = byte_order[filePtr]; + fileObject = ::fileArray[filePtr]; + ::Wrong_Endian = ::byte_order[filePtr]; isBinary(iotype); typeSize(datatype); // redundant call, just avoid a compiler warning. @@ -381,11 +391,11 @@ void vtkPhastaReader::readheader(int* fileDescriptor, const char keyphrase[], vo valueListInt = static_cast(valueArray); int ierr = readHeader(fileObject, keyphrase, valueListInt, *nItems); - byte_order[filePtr] = Wrong_Endian; + ::byte_order[filePtr] = ::Wrong_Endian; if (ierr) { - LastHeaderNotFound = 1; + ::LastHeaderNotFound = 1; } } @@ -396,7 +406,7 @@ void vtkPhastaReader::readdatablock(int* fileDescriptor, const char keyphrase[], FILE* fileObject; char junk; - if (*fileDescriptor < 1 || *fileDescriptor > (int)fileArray.size()) + if (*fileDescriptor < 1 || *fileDescriptor > (int)::fileArray.size()) { vtkGenericWarningMacro(<< "No file associated with Descriptor " << *fileDescriptor << "\n" << "openfile function has to be called before \n" @@ -409,36 +419,36 @@ void vtkPhastaReader::readdatablock(int* fileDescriptor, const char keyphrase[], // since we require that a consistent header always precede the data block // let us check to see that it is actually the case. - if (!cscompare(LastHeaderKey[filePtr], keyphrase)) + if (!cscompare(::LastHeaderKey[filePtr], keyphrase)) { vtkGenericWarningMacro(<< "Header not consistent with data block\n" - << "Header: " << LastHeaderKey[filePtr] << "\n" + << "Header: " << ::LastHeaderKey[filePtr] << "\n" << "DataBlock: " << keyphrase << "\n" << "Please recheck read sequence \n"); - if (Strict_Error) + if (::Strict_Error) { vtkGenericWarningMacro(<< "fatal error: cannot continue, returning out of call\n"); return; } } - if (LastHeaderNotFound) + if (::LastHeaderNotFound) { return; } - fileObject = fileArray[filePtr]; - Wrong_Endian = byte_order[filePtr]; + fileObject = ::fileArray[filePtr]; + ::Wrong_Endian = ::byte_order[filePtr]; size_t type_size = typeSize(datatype); int nUnits = *nItems; isBinary(iotype); - if (binary_format) + if (::binary_format) { xfread(valueArray, type_size, nUnits, fileObject); xfread(&junk, sizeof(char), 1, fileObject); - if (Wrong_Endian) + if (::Wrong_Endian) { SwapArrayByteOrder(valueArray, static_cast(type_size), nUnits); } diff --git a/VTKExtensions/IOGeneral/vtkVRMLSource.cxx b/VTKExtensions/IOGeneral/vtkVRMLSource.cxx index 041f310e9ad4c63608301a7f081bdda3648b4e32..a959c1072d0bc90b0839b518137b76443919e97a 100644 --- a/VTKExtensions/IOGeneral/vtkVRMLSource.cxx +++ b/VTKExtensions/IOGeneral/vtkVRMLSource.cxx @@ -56,6 +56,7 @@ int vtkVRMLSource::CanReadFile(const char* filename) char header[128]; if (fgets(header, 128, fd) == nullptr) { + fclose(fd); return 0; } diff --git a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestMultiBlockData.cxx b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestMultiBlockData.cxx index 8762ae2d28ff1fbb4fa7b79f8eadd2312d8d8772..5710096584d8bcfa08f7e0992ffa66100b3c2061 100644 --- a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestMultiBlockData.cxx +++ b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestMultiBlockData.cxx @@ -17,7 +17,7 @@ #include "vtksys/SystemTools.hxx" -int TestMultiBlockData(int argc, char* argv[]) +extern int TestMultiBlockData(int argc, char* argv[]) { MPI_Init(&argc, &argv); vtkObject::GlobalWarningDisplayOff(); diff --git a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPartialData.cxx b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPartialData.cxx index 3c64fdade1da86cf5aa7fb8f22e3e6f4125832c8..cf9a8812b0065de492ea48d3267331cfb68c57ff 100644 --- a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPartialData.cxx +++ b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPartialData.cxx @@ -16,7 +16,7 @@ #include "vtkUnstructuredGrid.h" #include "vtksys/SystemTools.hxx" -int TestPartialData(int argc, char* argv[]) +extern int TestPartialData(int argc, char* argv[]) { MPI_Init(&argc, &argv); vtkNew mpiController; diff --git a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPartitionedDataSet.cxx b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPartitionedDataSet.cxx index 1873ee5118313d000a644fe857c33464d71bd407..ef85ec9c761ac32fa514eddc13a08cb66dc39798 100644 --- a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPartitionedDataSet.cxx +++ b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPartitionedDataSet.cxx @@ -17,7 +17,7 @@ #include "vtksys/SystemTools.hxx" -int TestPartitionedDataSet(int argc, char* argv[]) +extern int TestPartitionedDataSet(int argc, char* argv[]) { MPI_Init(&argc, &argv); vtkObject::GlobalWarningDisplayOff(); diff --git a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPartitionedDataSetCollection.cxx b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPartitionedDataSetCollection.cxx index d479372c0de13e488b71f345fb22a127c758d1ff..d83761765e7e5be3ec812f6466484d3db5f6ea75 100644 --- a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPartitionedDataSetCollection.cxx +++ b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPartitionedDataSetCollection.cxx @@ -20,7 +20,7 @@ #include "vtksys/SystemTools.hxx" -int TestPartitionedDataSetCollection(int argc, char* argv[]) +extern int TestPartitionedDataSetCollection(int argc, char* argv[]) { MPI_Init(&argc, &argv); vtkObject::GlobalWarningDisplayOff(); diff --git a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPolyData.cxx b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPolyData.cxx index 9e3090880098162eb01ab784178372b4e195cd87..af1ecc4f9a03a42aa67d53637ed16450edb15c6f 100644 --- a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPolyData.cxx +++ b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPolyData.cxx @@ -15,7 +15,7 @@ #include "vtkUnstructuredGrid.h" #include "vtksys/SystemTools.hxx" -int TestPolyData(int argc, char* argv[]) +extern int TestPolyData(int argc, char* argv[]) { MPI_Init(&argc, &argv); vtkNew mpiController; diff --git a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPolygonalData.cxx b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPolygonalData.cxx index 3fc6410aaa635cfaa7f7ed5c9da5b0ad02038db0..0b66ed78c48684e9e5c39163e6ed9d9f3e344491 100644 --- a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPolygonalData.cxx +++ b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPolygonalData.cxx @@ -15,7 +15,7 @@ #include "vtkUnstructuredGrid.h" #include "vtksys/SystemTools.hxx" -int TestPolygonalData(int argc, char* argv[]) +extern int TestPolygonalData(int argc, char* argv[]) { MPI_Init(&argc, &argv); vtkNew mpiController; diff --git a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPolyhedralGrid.cxx b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPolyhedralGrid.cxx index 08317fd80181204e591633b4525895904bf7554c..f6315ba44023a4a966acb44239dd74520e7fa159 100644 --- a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPolyhedralGrid.cxx +++ b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestPolyhedralGrid.cxx @@ -14,7 +14,7 @@ #include "vtkUnstructuredGrid.h" #include "vtksys/SystemTools.hxx" -int TestPolyhedralGrid(int argc, char* argv[]) +extern int TestPolyhedralGrid(int argc, char* argv[]) { MPI_Init(&argc, &argv); vtkNew mpiController; diff --git a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestUnstructuredGrid.cxx b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestUnstructuredGrid.cxx index 1a9fec1b53c28eaad9b9554e074fa6d55c865a99..18b3a6a196ca72bcf3fa7490405105ec3648dffa 100644 --- a/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestUnstructuredGrid.cxx +++ b/VTKExtensions/IOParallelCGNS/Testing/Cxx/TestUnstructuredGrid.cxx @@ -16,7 +16,7 @@ #include "vtkUnstructuredGrid.h" #include "vtksys/SystemTools.hxx" -int TestUnstructuredGrid(int argc, char* argv[]) +extern int TestUnstructuredGrid(int argc, char* argv[]) { MPI_Init(&argc, &argv); vtkObject::GlobalWarningDisplayOff(); diff --git a/VTKExtensions/IOSPCTH/vtkSpyPlotReader.cxx b/VTKExtensions/IOSPCTH/vtkSpyPlotReader.cxx index ed1e06d668db64c440f6222b2ef6c3d5232a7864..7396e867dd6deee673d6e4bd6961336b71fbd6cb 100644 --- a/VTKExtensions/IOSPCTH/vtkSpyPlotReader.cxx +++ b/VTKExtensions/IOSPCTH/vtkSpyPlotReader.cxx @@ -42,6 +42,7 @@ #include "vtksys/FStream.hxx" #include "vtksys/SystemTools.hxx" +#include #include #include #include @@ -50,8 +51,6 @@ #include #include -#define vtkMIN(x, y) (((x) < (y)) ? (x) : (y)) - #define coutVector6(x) \ (x)[0] << " " << (x)[1] << " " << (x)[2] << " " << (x)[3] << " " << (x)[4] << " " << (x)[5] #define coutVector3(x) (x)[0] << " " << (x)[1] << " " << (x)[2] @@ -413,6 +412,8 @@ enum VTK_MSG_SPY_READER_GLOBAL_DATASETS_INDEX }; +namespace +{ template int vtkSpyPlotRemoveBadGhostCells(DataType* dataType, vtkDataArray* dataArray, int realExtents[6], int realDims[3], int ptDims[3], int realPtDims[3]) @@ -467,6 +468,7 @@ int vtkSpyPlotRemoveBadGhostCells(DataType* dataType, vtkDataArray* dataArray, i dataArray->SetNumberOfTuples(realDims[0] * realDims[1] * realDims[2]); return 1; } +} //----------------------------------------------------------------------------- int vtkSpyPlotReader::UpdateTimeStep( vtkInformation* requestInfo, vtkInformationVector* outputInfoVec, vtkCompositeDataSet* outputData) @@ -1064,6 +1066,8 @@ void vtkSpyPlotReader::MergeVectors(vtkDataSetAttributes* da) } //----------------------------------------------------------------------------- +namespace +{ // The templated execute function handles all the data types. template void vtkMergeVectorComponents(vtkIdType length, T* p1, T* p2, T* p3, T* po) @@ -1088,6 +1092,7 @@ void vtkMergeVectorComponents(vtkIdType length, T* p1, T* p2, T* p3, T* po) } } } +} //----------------------------------------------------------------------------- int vtkSpyPlotReader::MergeVectors( @@ -1163,7 +1168,7 @@ int vtkSpyPlotReader::MergeVectors( switch (a1->GetDataType()) { vtkTemplateMacro( - vtkMergeVectorComponents(length, (VTK_TT*)p1, (VTK_TT*)p2, (VTK_TT*)p3, (VTK_TT*)pn)); + ::vtkMergeVectorComponents(length, (VTK_TT*)p1, (VTK_TT*)p2, (VTK_TT*)p3, (VTK_TT*)pn)); default: vtkErrorMacro(<< "Execute: Unknown ScalarType"); return 0; @@ -1255,7 +1260,7 @@ int vtkSpyPlotReader::MergeVectors(vtkDataSetAttributes* da, vtkDataArray* a1, v switch (a1->GetDataType()) { vtkTemplateMacro( - vtkMergeVectorComponents(length, (VTK_TT*)p1, (VTK_TT*)p2, (VTK_TT*)nullptr, (VTK_TT*)pn)); + ::vtkMergeVectorComponents(length, (VTK_TT*)p1, (VTK_TT*)p2, (VTK_TT*)nullptr, (VTK_TT*)pn)); default: vtkErrorMacro(<< "Execute: Unknown ScalarType"); return 0; @@ -2257,10 +2262,7 @@ void vtkSpyPlotReader::SetGlobalLevels(vtkCompositeDataSet* composite) // Grab the number of levels from left child this->GlobalController->Receive( &ulintMsgValue, 1, left, VTK_MSG_SPY_READER_LOCAL_NUMBER_OF_LEVELS); - if (numberOfLevels < ulintMsgValue) - { - numberOfLevels = ulintMsgValue; - } + numberOfLevels = std::max(numberOfLevels, ulintMsgValue); } if (right < numProcessors) { @@ -2269,10 +2271,7 @@ void vtkSpyPlotReader::SetGlobalLevels(vtkCompositeDataSet* composite) // Grab the number of levels from right child this->GlobalController->Receive( &ulintMsgValue, 1, right, VTK_MSG_SPY_READER_LOCAL_NUMBER_OF_LEVELS); - if (numberOfLevels < ulintMsgValue) - { - numberOfLevels = ulintMsgValue; - } + numberOfLevels = std::max(numberOfLevels, ulintMsgValue); } } } diff --git a/VTKExtensions/IOSPCTH/vtkSpyPlotUniReader.cxx b/VTKExtensions/IOSPCTH/vtkSpyPlotUniReader.cxx index a5af541f8f7fb39424ef524ee15ec37c9db08dff..c7c16ef15a8df4e55541660be73c43df202c3233 100644 --- a/VTKExtensions/IOSPCTH/vtkSpyPlotUniReader.cxx +++ b/VTKExtensions/IOSPCTH/vtkSpyPlotUniReader.cxx @@ -36,12 +36,15 @@ public: size_t Length; }; +namespace +{ inline ostream& operator<<(ostream& os, const vtkSpyPlotWriteString& c) { os.write(c.Data, c.Length); os.flush(); return os; } +} //----------------------------------------------------------------------------- vtkSpyPlotUniReader::vtkSpyPlotUniReader() @@ -667,6 +670,8 @@ void vtkSpyPlotUniReader::PrintInformation() n bytes long. */ //----------------------------------------------------------------------------- +namespace +{ template int vtkSpyPlotUniReaderRunLengthDataDecode( vtkSpyPlotUniReader* self, const unsigned char* in, int inSize, t* out, int outSize, t scale = 1) @@ -726,6 +731,7 @@ int vtkSpyPlotUniReaderRunLengthDataDecode( return 1; } +} //----------------------------------------------------------------------------- int vtkSpyPlotUniReader::RunLengthDataDecode( diff --git a/VTKExtensions/InteractionStyle/vtkPVJoystickFly.cxx b/VTKExtensions/InteractionStyle/vtkPVJoystickFly.cxx index 747df46b7f6504b0cdb5b4669ae402938ccc0623..3e19441c4b7c074372e6502c3c0495b62e9ff2e2 100644 --- a/VTKExtensions/InteractionStyle/vtkPVJoystickFly.cxx +++ b/VTKExtensions/InteractionStyle/vtkPVJoystickFly.cxx @@ -11,6 +11,8 @@ #include "vtkRenderer.h" #include "vtkTimerLog.h" +#include + //------------------------------------------------------------------------- vtkPVJoystickFly::vtkPVJoystickFly() { @@ -112,10 +114,7 @@ void vtkPVJoystickFly::Fly(vtkRenderer* ren, vtkRenderWindowInteractor* rwi, dou this->LastRenderTime = timer->GetElapsedTime(); // Limit length of render time because we do not want such large jumps // when rendering takes more than 1 second. - if (this->LastRenderTime > 1.0) - { - this->LastRenderTime = 1.0; - } + this->LastRenderTime = std::min(this->LastRenderTime, 1.0); } first = 0; diff --git a/VTKExtensions/Misc/Testing/Cxx/TestMergeTablesMultiBlock.cxx b/VTKExtensions/Misc/Testing/Cxx/TestMergeTablesMultiBlock.cxx index e1e7ccb5ff8ed5701fadbb8c5ff47fe93c3ca31a..f8673fd0b036009b9fecfa16d1ea52466d43f19a 100644 --- a/VTKExtensions/Misc/Testing/Cxx/TestMergeTablesMultiBlock.cxx +++ b/VTKExtensions/Misc/Testing/Cxx/TestMergeTablesMultiBlock.cxx @@ -30,7 +30,7 @@ vtkSmartPointer ReadAsTable(const char* fname) } } -int TestMergeTablesMultiBlock(int argc, char* argv[]) +extern int TestMergeTablesMultiBlock(int argc, char* argv[]) { char* fname0 = vtkTestUtilities::ExpandDataFileName(argc, argv, "Testing/Data/table_0.vtt"); auto data0 = ReadAsTable(fname0); diff --git a/VTKExtensions/Misc/Testing/Cxx/TestPVExtractHistogram2D.cxx b/VTKExtensions/Misc/Testing/Cxx/TestPVExtractHistogram2D.cxx index faa27d9793f5229bd241d6fa98394ddd38f6402d..94344b394d18b46baa02e01a6a21e9f62f5ca688 100644 --- a/VTKExtensions/Misc/Testing/Cxx/TestPVExtractHistogram2D.cxx +++ b/VTKExtensions/Misc/Testing/Cxx/TestPVExtractHistogram2D.cxx @@ -6,7 +6,7 @@ #include "vtkPointDataToCellData.h" #include "vtkSphereSource.h" -int TestPVExtractHistogram2D(int, char*[]) +extern int TestPVExtractHistogram2D(int, char*[]) { vtkNew sphere; sphere->SetThetaResolution(100); diff --git a/VTKExtensions/Misc/vtkAttributeDataReductionFilter.cxx b/VTKExtensions/Misc/vtkAttributeDataReductionFilter.cxx index 22472364b674c712d228c043795973a23b87cffc..d876c533fa9b595802033ce92202e9979b2e18e6 100644 --- a/VTKExtensions/Misc/vtkAttributeDataReductionFilter.cxx +++ b/VTKExtensions/Misc/vtkAttributeDataReductionFilter.cxx @@ -67,6 +67,8 @@ int vtkAttributeDataReductionFilter::RequestDataObject( } //----------------------------------------------------------------------------- +namespace +{ template void vtkAttributeDataReductionFilterReduce(vtkAttributeDataReductionFilter* self, iterT* toIter, iterT* fromIter, double progress_offset, double progress_factor) @@ -119,7 +121,7 @@ void vtkAttributeDataReductionFilterReduce( } //----------------------------------------------------------------------------- -static void vtkAttributeDataReductionFilterReduce(vtkDataSetAttributes* output, +void vtkAttributeDataReductionFilterReduce(vtkDataSetAttributes* output, std::vector inputs, vtkAttributeDataReductionFilter* self) { int numInputs = static_cast(inputs.size()); @@ -169,7 +171,7 @@ static void vtkAttributeDataReductionFilterReduce(vtkDataSetAttributes* output, switch (toDA->GetDataType()) { vtkArrayIteratorTemplateMacro( - vtkAttributeDataReductionFilterReduce(self, static_cast(toIter.GetPointer()), + ::vtkAttributeDataReductionFilterReduce(self, static_cast(toIter.GetPointer()), static_cast(fromIter.GetPointer()), progress_offset, progress_factor)); default: vtkGenericWarningMacro("Cannot reduce arrays of type: " << toDA->GetDataTypeAsString()); @@ -182,6 +184,7 @@ static void vtkAttributeDataReductionFilterReduce(vtkDataSetAttributes* output, progress_offset += progress_factor; } } +} //----------------------------------------------------------------------------- int vtkAttributeDataReductionFilter::RequestData(vtkInformation* vtkNotUsed(request), diff --git a/VTKExtensions/Misc/vtkMinMax.cxx b/VTKExtensions/Misc/vtkMinMax.cxx index 62101b8c4592ad5749ba57a7262272b5d6c01d61..96a4bd2262350a3e117720fafdbfb220e53dee7d 100644 --- a/VTKExtensions/Misc/vtkMinMax.cxx +++ b/VTKExtensions/Misc/vtkMinMax.cxx @@ -22,8 +22,11 @@ vtkStandardNewMacro(vtkMinMax); +namespace +{ template void vtkMinMaxExecute(vtkMinMax* self, int numComp, int compIdx, T* idata, T* odata); +} //----------------------------------------------------------------------------- vtkMinMax::vtkMinMax() @@ -292,7 +295,7 @@ void vtkMinMax::OperateOnArray(vtkAbstractArray* ia, vtkAbstractArray* oa) // perform odata[jdx] = operation(idata[jdx],odata[jdx]) switch (datatype) { - vtkTemplateMacro(vtkMinMaxExecute(this, numComp, this->ComponentIdx, + vtkTemplateMacro(::vtkMinMaxExecute(this, numComp, this->ComponentIdx, static_cast(idata), static_cast(odata))); // if you can make an operator for things like strings etc, @@ -307,6 +310,8 @@ void vtkMinMax::OperateOnArray(vtkAbstractArray* ia, vtkAbstractArray* oa) //----------------------------------------------------------------------------- // This templated function performs the operation on any type of data. +namespace +{ template void vtkMinMaxExecute(vtkMinMax* self, int numComp, int compIdx, T* idata, T* odata) { @@ -353,6 +358,7 @@ void vtkMinMaxExecute(vtkMinMax* self, int numComp, int compIdx, T* idata, T* od } } } +} //----------------------------------------------------------------------------- void vtkMinMax::PrintSelf(ostream& os, vtkIndent indent) diff --git a/VTKExtensions/Misc/vtkSelectionSerializer.cxx b/VTKExtensions/Misc/vtkSelectionSerializer.cxx index 4dd1f2a94045801aa1853f061e91ee34fb185211..00f3b6a5661517fa017091fd7de2cc8cec59b6a8 100644 --- a/VTKExtensions/Misc/vtkSelectionSerializer.cxx +++ b/VTKExtensions/Misc/vtkSelectionSerializer.cxx @@ -94,6 +94,8 @@ void vtkSelectionSerializer::PrintXML( } //---------------------------------------------------------------------------- +namespace +{ template void vtkSelectionSerializerWriteSelectionList( ostream& os, vtkIndent indent, vtkIdType numElems, T* dataPtr) @@ -105,6 +107,7 @@ void vtkSelectionSerializerWriteSelectionList( } os << endl; } +} //---------------------------------------------------------------------------- // Serializes the selection list data array @@ -127,7 +130,7 @@ void vtkSelectionSerializer::WriteSelectionData( void* dataPtr = list->GetVoidPointer(0); switch (list->GetDataType()) { - vtkTemplateMacro(vtkSelectionSerializerWriteSelectionList( + vtkTemplateMacro(::vtkSelectionSerializerWriteSelectionList( os, indent, numTuples * numComps, (VTK_TT*)(dataPtr))); } os << indent << "" << endl; diff --git a/Wrapping/Python/paraview/smtesting.py b/Wrapping/Python/paraview/smtesting.py index bfdef92255520c3f9055959927bc5ad828e88977..5aac33dabdcb8816d4a484fbe036879d3cfd7c7a 100644 --- a/Wrapping/Python/paraview/smtesting.py +++ b/Wrapping/Python/paraview/smtesting.py @@ -90,7 +90,7 @@ def LoadServerManagerState(filename): except: return Error("Failed to open state file %s" % filename) - regExp = re.compile("\${DataDir}") + regExp = re.compile(r"\${DataDir}") data = regExp.sub(DataDir, data) if not parser.Parse(data): return Error("Failed to parse")