diff --git a/examples/lagrangian_structures/CMakeLists.txt b/examples/lagrangian_structures/CMakeLists.txt index 59cb04f72..93d8351ea 100644 --- a/examples/lagrangian_structures/CMakeLists.txt +++ b/examples/lagrangian_structures/CMakeLists.txt @@ -1,3 +1,14 @@ +##============================================================================= +## +## Copyright (c) Kitware, Inc. +## All rights reserved. +## See LICENSE.txt for details. +## +## This software is distributed WITHOUT ANY WARRANTY; without even +## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +## PURPOSE. See the above copyright notice for more information. +## +##============================================================================= cmake_minimum_required(VERSION 3.8...3.14 FATAL_ERROR) project(ParticleAdvection CXX) diff --git a/examples/lagrangian_structures/LagrangianStructures.cxx b/examples/lagrangian_structures/LagrangianStructures.cxx index ebef3da11..ef6016e52 100644 --- a/examples/lagrangian_structures/LagrangianStructures.cxx +++ b/examples/lagrangian_structures/LagrangianStructures.cxx @@ -1,3 +1,15 @@ +//============================================================================= +// +// Copyright (c) Kitware, Inc. +// All rights reserved. +// See LICENSE.txt for details. +// +// This software is distributed WITHOUT ANY WARRANTY; without even +// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +// PURPOSE. See the above copyright notice for more information. +// +//============================================================================= + #include #include #include diff --git a/vtkm/worklet/LagrangianStructures.h b/vtkm/worklet/LagrangianStructures.h index 078f4684c..f6e73efce 100644 --- a/vtkm/worklet/LagrangianStructures.h +++ b/vtkm/worklet/LagrangianStructures.h @@ -66,24 +66,25 @@ public: } VTKM_EXEC - void GetNeighborIndices(const vtkm::Id index, vtkm::Vec& indices) const + const vtkm::Vec GetNeighborIndices(const vtkm::Id index) const { + vtkm::Vec indices; vtkm::Id3 logicalIndex; GetLogicalIndex(index, logicalIndex); // For differentials w.r.t delta in x indices[0] = (logicalIndex[0] == 0) ? index : index - 1; indices[1] = (logicalIndex[0] == Dims[0] - 1) ? index : index + 1; - // For differentials w.r.t delta in y indices[2] = (logicalIndex[1] == 0) ? index : index - RowSize; indices[3] = (logicalIndex[1] == Dims[1] - 1) ? index : index + RowSize; - - if (this->cellSet2D) - return; - // For differentials w.r.t delta in z - indices[4] = (logicalIndex[2] == 0) ? index : index - PlaneSize; - indices[5] = (logicalIndex[2] == Dims[2] - 1) ? index : index + PlaneSize; + if (!this->cellSet2D) + { + // For differentials w.r.t delta in z + indices[4] = (logicalIndex[2] == 0) ? index : index - PlaneSize; + indices[5] = (logicalIndex[2] == Dims[2] - 1) ? index : index + PlaneSize; + } + return indices; } private: @@ -122,8 +123,7 @@ public: { using Point = typename PointArray::ValueType; - vtkm::Vec neighborIndices; - this->GridData.GetNeighborIndices(index, neighborIndices); + const vtkm::Vec neighborIndices = this->GridData.GetNeighborIndices(index); // Calculate Stretching / Squeezing Point xin1 = input.Get(neighborIndices[0]); @@ -205,8 +205,7 @@ public: { using Point = typename PointArray::ValueType; - vtkm::Vec neighborIndices; - this->GridData.GetNeighborIndices(index, neighborIndices); + const vtkm::Vec neighborIndices = this->GridData.GetNeighborIndices(index); Point xin1 = input.Get(neighborIndices[0]); Point xin2 = input.Get(neighborIndices[1]); diff --git a/vtkm/worklet/lcs/LagrangianStructureHelpers.h b/vtkm/worklet/lcs/LagrangianStructureHelpers.h index f1c162eca..299656f1c 100644 --- a/vtkm/worklet/lcs/LagrangianStructureHelpers.h +++ b/vtkm/worklet/lcs/LagrangianStructureHelpers.h @@ -171,7 +171,7 @@ VTKM_EXEC_CONT void Jacobi(vtkm::Matrix tensor, vtkm::Vec& eigen) phi = vtkm::ATan(vtkm::Sqrt(D) / q) / 3.0f; if (phi < 0) - phi += static_cast(M_PI); + phi += static_cast(vtkm::Pi()); } const T sqrt3 = vtkm::Sqrt(3.0f);