mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-08 03:18:58 +00:00
Merge topic 'ah-xgc-updates'
40185ee44 attempting to fix various build and linking errors 5336fea02 add XGC storage tags to DefaultTypesVTK a5689ec84 testing array range for xgc coords e73a0bccb update ArrayRangeCompute to handle ArrayHandleXGC* 46155daaa removing ArrayHandleExtrude* a9711bffb update XGC ArrayHandles to new buffer style Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Kenneth Moreland <kmorel@sandia.gov> Merge-request: !2359
This commit is contained in:
commit
d8dc8f98d8
@ -1,151 +0,0 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_cont_ArrayHandleExtrudeCoords_h
|
||||
#define vtk_m_cont_ArrayHandleExtrudeCoords_h
|
||||
|
||||
#include <vtkm/cont/StorageExtrude.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
|
||||
#include <vtkm/cont/internal/ArrayHandleDeprecated.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
VTKM_ARRAY_HANDLE_DEPRECATED(VTKM_PASS_COMMAS(vtkm::Vec<T, 3>),
|
||||
vtkm::cont::internal::StorageTagExtrude);
|
||||
|
||||
template <typename T>
|
||||
class VTKM_ALWAYS_EXPORT ArrayHandleExtrudeCoords
|
||||
: public vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, internal::StorageTagExtrude>
|
||||
{
|
||||
|
||||
using StorageType = vtkm::cont::internal::Storage<vtkm::Vec<T, 3>, internal::StorageTagExtrude>;
|
||||
|
||||
public:
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(
|
||||
ArrayHandleExtrudeCoords,
|
||||
(ArrayHandleExtrudeCoords<T>),
|
||||
(vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, internal::StorageTagExtrude>));
|
||||
|
||||
ArrayHandleExtrudeCoords(const StorageType& storage)
|
||||
: Superclass(storage)
|
||||
{
|
||||
}
|
||||
|
||||
vtkm::Id GetNumberOfPointsPerPlane() const { return (this->GetStorage().GetLength() / 2); }
|
||||
vtkm::Int32 GetNumberOfPlanes() const { return this->GetStorage().GetNumberOfPlanes(); }
|
||||
bool GetUseCylindrical() const { return this->GetStorage().GetUseCylindrical(); }
|
||||
const vtkm::cont::ArrayHandle<T>& GetArray() const { return this->GetStorage().Array; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
vtkm::cont::ArrayHandleExtrudeCoords<T> make_ArrayHandleExtrudeCoords(
|
||||
const vtkm::cont::ArrayHandle<T> arrHandle,
|
||||
vtkm::Int32 numberOfPlanes,
|
||||
bool cylindrical)
|
||||
{
|
||||
using StorageType = vtkm::cont::internal::Storage<vtkm::Vec<T, 3>, internal::StorageTagExtrude>;
|
||||
auto storage = StorageType(arrHandle, numberOfPlanes, cylindrical);
|
||||
return ArrayHandleExtrudeCoords<T>(storage);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
vtkm::cont::ArrayHandleExtrudeCoords<T> make_ArrayHandleExtrudeCoords(
|
||||
const T* array,
|
||||
vtkm::Id length,
|
||||
vtkm::Int32 numberOfPlanes,
|
||||
bool cylindrical,
|
||||
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
|
||||
{
|
||||
using StorageType = vtkm::cont::internal::Storage<vtkm::Vec<T, 3>, internal::StorageTagExtrude>;
|
||||
return ArrayHandleExtrudeCoords<T>(
|
||||
StorageType(vtkm::cont::make_ArrayHandle(array, length, copy), numberOfPlanes, cylindrical));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
vtkm::cont::ArrayHandleExtrudeCoords<T> make_ArrayHandleExtrudeCoords(
|
||||
const std::vector<T>& array,
|
||||
vtkm::Int32 numberOfPlanes,
|
||||
bool cylindrical,
|
||||
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
|
||||
{
|
||||
if (!array.empty())
|
||||
{
|
||||
return make_ArrayHandleExtrudeCoords(
|
||||
array.data(), static_cast<vtkm::Id>(array.size()), numberOfPlanes, cylindrical, copy);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Vector empty. Just return an empty array handle.
|
||||
return ArrayHandleExtrudeCoords<T>();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end namespace vtkm::cont
|
||||
|
||||
//=============================================================================
|
||||
// Specializations of serialization related classes
|
||||
/// @cond SERIALIZATION
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct SerializableTypeString<vtkm::cont::ArrayHandleExtrudeCoords<T>>
|
||||
{
|
||||
static VTKM_CONT const std::string& Get()
|
||||
{
|
||||
static std::string name = "AH_ExtrudeCoords<" + SerializableTypeString<T>::Get() + ">";
|
||||
return name;
|
||||
}
|
||||
};
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct Serialization<vtkm::cont::ArrayHandleExtrudeCoords<T>>
|
||||
{
|
||||
private:
|
||||
using Type = vtkm::cont::ArrayHandleExtrudeCoords<T>;
|
||||
|
||||
public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const Type& ah)
|
||||
{
|
||||
vtkmdiy::save(bb, ah.GetNumberOfPlanes());
|
||||
vtkmdiy::save(bb, ah.GetUseCylindrical());
|
||||
vtkmdiy::save(bb, ah.GetArray());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, Type& ah)
|
||||
{
|
||||
vtkm::Int32 numberOfPlanes;
|
||||
bool isCylindrical;
|
||||
vtkm::cont::ArrayHandle<T> array;
|
||||
|
||||
vtkmdiy::load(bb, numberOfPlanes);
|
||||
vtkmdiy::load(bb, isCylindrical);
|
||||
vtkmdiy::load(bb, array);
|
||||
|
||||
ah = vtkm::cont::make_ArrayHandleExtrudeCoords(array, numberOfPlanes, isCylindrical);
|
||||
}
|
||||
};
|
||||
|
||||
} // diy
|
||||
/// @endcond SERIALIZATION
|
||||
|
||||
#endif
|
@ -1,152 +0,0 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_cont_ArrayHandleExtrudeField_h
|
||||
#define vtk_m_cont_ArrayHandleExtrudeField_h
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/StorageExtrude.h>
|
||||
|
||||
#include <vtkm/cont/internal/ArrayHandleDeprecated.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
VTKM_ARRAY_HANDLE_DEPRECATED(T, vtkm::cont::internal::StorageTagExtrude);
|
||||
|
||||
template <typename T>
|
||||
class VTKM_ALWAYS_EXPORT ArrayHandleExtrudeField
|
||||
: public vtkm::cont::ArrayHandle<T, internal::StorageTagExtrude>
|
||||
{
|
||||
using StorageType = vtkm::cont::internal::Storage<T, internal::StorageTagExtrude>;
|
||||
|
||||
public:
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(ArrayHandleExtrudeField,
|
||||
(ArrayHandleExtrudeField<T>),
|
||||
(vtkm::cont::ArrayHandle<T, internal::StorageTagExtrude>));
|
||||
|
||||
ArrayHandleExtrudeField(const StorageType& storage)
|
||||
: Superclass(storage)
|
||||
{
|
||||
}
|
||||
|
||||
vtkm::Int32 GetNumberOfValuesPerPlane() const
|
||||
{
|
||||
return this->GetStorage().GetNumberOfValuesPerPlane();
|
||||
}
|
||||
|
||||
vtkm::Int32 GetNumberOfPlanes() const { return this->GetStorage().GetNumberOfPlanes(); }
|
||||
bool GetUseCylindrical() const { return this->GetStorage().GetUseCylindrical(); }
|
||||
const vtkm::cont::ArrayHandle<T>& GetArray() const { return this->GetStorage().Array; }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
vtkm::cont::ArrayHandleExtrudeField<T> make_ArrayHandleExtrudeField(
|
||||
const vtkm::cont::ArrayHandle<T>& array,
|
||||
vtkm::Int32 numberOfPlanes,
|
||||
bool cylindrical)
|
||||
{
|
||||
using StorageType = vtkm::cont::internal::Storage<T, internal::StorageTagExtrude>;
|
||||
auto storage = StorageType{ array, numberOfPlanes, cylindrical };
|
||||
return ArrayHandleExtrudeField<T>(storage);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
vtkm::cont::ArrayHandleExtrudeField<T> make_ArrayHandleExtrudeField(
|
||||
const T* array,
|
||||
vtkm::Id length,
|
||||
vtkm::Int32 numberOfPlanes,
|
||||
bool cylindrical,
|
||||
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
|
||||
{
|
||||
using StorageType = vtkm::cont::internal::Storage<T, internal::StorageTagExtrude>;
|
||||
auto storage =
|
||||
StorageType(vtkm::cont::make_ArrayHandle(array, length, copy), numberOfPlanes, cylindrical);
|
||||
return ArrayHandleExtrudeField<T>(storage);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
vtkm::cont::ArrayHandleExtrudeField<T> make_ArrayHandleExtrudeField(
|
||||
const std::vector<T>& array,
|
||||
vtkm::Int32 numberOfPlanes,
|
||||
bool cylindrical,
|
||||
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
|
||||
{
|
||||
if (!array.empty())
|
||||
{
|
||||
return make_ArrayHandleExtrudeField(
|
||||
array.data(), static_cast<vtkm::Id>(array.size()), numberOfPlanes, cylindrical, copy);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Vector empty. Just return an empty array handle.
|
||||
return ArrayHandleExtrudeField<T>();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
//=============================================================================
|
||||
// Specializations of serialization related classes
|
||||
/// @cond SERIALIZATION
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct SerializableTypeString<vtkm::cont::ArrayHandleExtrudeField<T>>
|
||||
{
|
||||
static VTKM_CONT const std::string& Get()
|
||||
{
|
||||
static std::string name = "AH_ExtrudeField<" + SerializableTypeString<T>::Get() + ">";
|
||||
return name;
|
||||
}
|
||||
};
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct Serialization<vtkm::cont::ArrayHandleExtrudeField<T>>
|
||||
{
|
||||
private:
|
||||
using Type = vtkm::cont::ArrayHandleExtrudeField<T>;
|
||||
|
||||
public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const Type& ah)
|
||||
{
|
||||
vtkmdiy::save(bb, ah.GetNumberOfPlanes());
|
||||
vtkmdiy::save(bb, ah.GetUseCylindrical());
|
||||
vtkmdiy::save(bb, ah.GetArray());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, Type& ah)
|
||||
{
|
||||
vtkm::Int32 numberOfPlanes;
|
||||
bool isCylindrical;
|
||||
vtkm::cont::ArrayHandle<T> array;
|
||||
|
||||
vtkmdiy::load(bb, numberOfPlanes);
|
||||
vtkmdiy::load(bb, isCylindrical);
|
||||
vtkmdiy::load(bb, array);
|
||||
|
||||
ah = vtkm::cont::make_ArrayHandleExtrudeField(array, numberOfPlanes, isCylindrical);
|
||||
}
|
||||
};
|
||||
|
||||
} // diy
|
||||
/// @endcond SERIALIZATION
|
||||
|
||||
#endif
|
484
vtkm/cont/ArrayHandleXGCCoordinates.h
Normal file
484
vtkm/cont/ArrayHandleXGCCoordinates.h
Normal file
@ -0,0 +1,484 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_cont_ArrayHandleXGCCoordinates_h
|
||||
#define vtk_m_cont_ArrayHandleXGCCoordinates_h
|
||||
|
||||
#include <vtkm/Math.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ErrorBadType.h>
|
||||
|
||||
#include <vtkm/internal/IndicesExtrude.h>
|
||||
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
|
||||
template <typename PortalType>
|
||||
struct VTKM_ALWAYS_EXPORT ArrayPortalXGCCoordinates
|
||||
{
|
||||
using ValueType = vtkm::Vec<typename PortalType::ValueType, 3>;
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
ArrayPortalXGCCoordinates()
|
||||
: Portal()
|
||||
, NumberOfPointsPerPlane(0)
|
||||
, NumberOfPlanes(0)
|
||||
, NumberOfPlanesOwned(0)
|
||||
, PlaneStartId(0)
|
||||
, UseCylindrical(false){};
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
ArrayPortalXGCCoordinates(const PortalType& p,
|
||||
vtkm::Id numOfPlanes,
|
||||
vtkm::Id numOfPlanesOwned,
|
||||
vtkm::Id planeStartId,
|
||||
bool cylindrical = false)
|
||||
: Portal(p)
|
||||
, NumberOfPlanes(numOfPlanes)
|
||||
, NumberOfPlanesOwned(numOfPlanesOwned)
|
||||
, PlaneStartId(planeStartId)
|
||||
, UseCylindrical(cylindrical)
|
||||
{
|
||||
this->NumberOfPointsPerPlane = this->Portal.GetNumberOfValues() / 2;
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
vtkm::Id GetNumberOfValues() const
|
||||
{
|
||||
return (this->NumberOfPointsPerPlane * static_cast<vtkm::Id>(NumberOfPlanesOwned));
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
ValueType Get(vtkm::Id index) const
|
||||
{
|
||||
const vtkm::Id realIdx = ((index * 2) % this->Portal.GetNumberOfValues()) / 2;
|
||||
const vtkm::Id whichPlane = (index * 2) / this->Portal.GetNumberOfValues() + this->PlaneStartId;
|
||||
return this->Get(vtkm::Id2(realIdx, whichPlane));
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
ValueType Get(vtkm::Id2 index) const
|
||||
{
|
||||
using CompType = typename ValueType::ComponentType;
|
||||
|
||||
const vtkm::Id realIdx = (index[0] * 2);
|
||||
const vtkm::Id whichPlane = index[1];
|
||||
const auto phi = static_cast<CompType>(whichPlane * (vtkm::TwoPi() / this->NumberOfPlanes));
|
||||
|
||||
auto r = this->Portal.Get(realIdx);
|
||||
auto z = this->Portal.Get(realIdx + 1);
|
||||
if (this->UseCylindrical)
|
||||
{
|
||||
return ValueType(r, phi, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ValueType(r * vtkm::Cos(phi), r * vtkm::Sin(phi), z);
|
||||
}
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
vtkm::Vec<ValueType, 6> GetWedge(const exec::IndicesExtrude& index) const
|
||||
{
|
||||
using CompType = typename ValueType::ComponentType;
|
||||
|
||||
vtkm::Vec<ValueType, 6> result;
|
||||
for (int j = 0; j < 2; ++j)
|
||||
{
|
||||
const auto phi =
|
||||
static_cast<CompType>(index.Planes[j] * (vtkm::TwoPi() / this->NumberOfPlanes));
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
const vtkm::Id realIdx = index.PointIds[j][i] * 2;
|
||||
auto r = this->Portal.Get(realIdx);
|
||||
auto z = this->Portal.Get(realIdx + 1);
|
||||
result[3 * j + i] = this->UseCylindrical
|
||||
? ValueType(r, phi, z)
|
||||
: ValueType(r * vtkm::Cos(phi), r * vtkm::Sin(phi), z);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
PortalType Portal;
|
||||
vtkm::Id NumberOfPointsPerPlane;
|
||||
vtkm::Id NumberOfPlanes;
|
||||
vtkm::Id NumberOfPlanesOwned;
|
||||
vtkm::Id PlaneStartId;
|
||||
bool UseCylindrical;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace vtkm::internal
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagXGCCoordinates
|
||||
{
|
||||
};
|
||||
|
||||
namespace internal
|
||||
{
|
||||
|
||||
struct XGCCoordinatesMetaData
|
||||
{
|
||||
vtkm::Id NumberOfPlanes = 0;
|
||||
vtkm::Id NumberOfPlanesOwned = 0;
|
||||
vtkm::Id PlaneStartId = -1;
|
||||
bool UseCylindrical = false;
|
||||
|
||||
XGCCoordinatesMetaData() = default;
|
||||
|
||||
XGCCoordinatesMetaData(vtkm::Id numberOfPlanes,
|
||||
vtkm::Id numberOfPlanesOwned,
|
||||
vtkm::Id planeStartId,
|
||||
bool useCylindrical)
|
||||
: NumberOfPlanes(numberOfPlanes)
|
||||
, NumberOfPlanesOwned(numberOfPlanesOwned)
|
||||
, PlaneStartId(planeStartId)
|
||||
, UseCylindrical(useCylindrical)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
class XGCCoordinatesStorageImpl
|
||||
{
|
||||
using SourceStorage = Storage<T, StorageTagBasic>; // only allow input AH to use StorageTagBasic
|
||||
using MetaData = XGCCoordinatesMetaData;
|
||||
|
||||
static MetaData& GetMetaData(const vtkm::cont::internal::Buffer* buffers)
|
||||
{
|
||||
return buffers[0].GetMetaData<MetaData>();
|
||||
}
|
||||
|
||||
// Used to skip the metadata buffer and return only actual data buffers
|
||||
template <typename Buffs>
|
||||
VTKM_CONT constexpr static Buffs* SourceBuffers(Buffs* buffers)
|
||||
{
|
||||
return buffers + 1;
|
||||
}
|
||||
|
||||
public:
|
||||
using ReadPortalType =
|
||||
vtkm::internal::ArrayPortalXGCCoordinates<typename SourceStorage::ReadPortalType>;
|
||||
|
||||
VTKM_CONT constexpr static vtkm::IdComponent GetNumberOfBuffers()
|
||||
{
|
||||
return SourceStorage::GetNumberOfBuffers() + 1; // To account for metadata
|
||||
}
|
||||
|
||||
VTKM_CONT static vtkm::Id GetNumberOfValues(const vtkm::cont::internal::Buffer* buffers)
|
||||
{
|
||||
return GetNumberOfValuesPerPlane(buffers) * GetNumberOfPlanesOwned(buffers);
|
||||
}
|
||||
|
||||
VTKM_CONT static vtkm::Id GetNumberOfValuesPerPlane(const vtkm::cont::internal::Buffer* buffers)
|
||||
{
|
||||
return SourceStorage::GetNumberOfValues(SourceBuffers(buffers)) / 2;
|
||||
}
|
||||
|
||||
VTKM_CONT static vtkm::Id GetNumberOfPlanes(const vtkm::cont::internal::Buffer* buffers)
|
||||
{
|
||||
return GetMetaData(buffers).NumberOfPlanes;
|
||||
}
|
||||
|
||||
VTKM_CONT static vtkm::Id GetNumberOfPlanesOwned(const vtkm::cont::internal::Buffer* buffers)
|
||||
{
|
||||
return GetMetaData(buffers).NumberOfPlanesOwned;
|
||||
}
|
||||
|
||||
VTKM_CONT static vtkm::Id GetPlaneStartId(const vtkm::cont::internal::Buffer* buffers)
|
||||
{
|
||||
return GetMetaData(buffers).PlaneStartId;
|
||||
}
|
||||
|
||||
VTKM_CONT static bool GetUseCylindrical(const vtkm::cont::internal::Buffer* buffers)
|
||||
{
|
||||
return GetMetaData(buffers).UseCylindrical;
|
||||
}
|
||||
|
||||
VTKM_CONT static ReadPortalType CreateReadPortal(const vtkm::cont::internal::Buffer* buffers,
|
||||
vtkm::cont::DeviceAdapterId device,
|
||||
vtkm::cont::Token& token)
|
||||
{
|
||||
return ReadPortalType(SourceStorage::CreateReadPortal(SourceBuffers(buffers), device, token),
|
||||
GetNumberOfPlanes(buffers),
|
||||
GetNumberOfPlanesOwned(buffers),
|
||||
GetPlaneStartId(buffers),
|
||||
GetUseCylindrical(buffers));
|
||||
}
|
||||
|
||||
VTKM_CONT static std::vector<vtkm::cont::internal::Buffer> CreateBuffers(
|
||||
vtkm::cont::ArrayHandle<T> array,
|
||||
vtkm::Id numberOfPlanes,
|
||||
vtkm::Id numberOfPlanesOwned,
|
||||
vtkm::Id planeStartId,
|
||||
bool useCylindrical)
|
||||
{
|
||||
return vtkm::cont::internal::CreateBuffers(
|
||||
MetaData(numberOfPlanes, numberOfPlanesOwned, planeStartId, useCylindrical), array);
|
||||
}
|
||||
|
||||
VTKM_CONT static vtkm::cont::ArrayHandle<T> GetArrayHandle(
|
||||
const vtkm::cont::internal::Buffer* buffers)
|
||||
{
|
||||
return vtkm::cont::ArrayHandle<T>(SourceBuffers(buffers));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <>
|
||||
class Storage<vtkm::Vec3f_32, vtkm::cont::StorageTagXGCCoordinates>
|
||||
: public detail::XGCCoordinatesStorageImpl<vtkm::Float32>
|
||||
{
|
||||
public:
|
||||
VTKM_STORAGE_NO_RESIZE;
|
||||
VTKM_STORAGE_NO_WRITE_PORTAL;
|
||||
};
|
||||
|
||||
template <>
|
||||
class Storage<vtkm::Vec3f_64, vtkm::cont::StorageTagXGCCoordinates>
|
||||
: public detail::XGCCoordinatesStorageImpl<vtkm::Float64>
|
||||
{
|
||||
public:
|
||||
VTKM_STORAGE_NO_RESIZE;
|
||||
VTKM_STORAGE_NO_WRITE_PORTAL;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
||||
template <typename T>
|
||||
class VTKM_ALWAYS_EXPORT ArrayHandleXGCCoordinates
|
||||
: public vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, vtkm::cont::StorageTagXGCCoordinates>
|
||||
{
|
||||
using AHandleType = vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>>;
|
||||
using OriginalType = vtkm::cont::ArrayHandle<T>;
|
||||
|
||||
public:
|
||||
VTKM_ARRAY_HANDLE_SUBCLASS(
|
||||
ArrayHandleXGCCoordinates,
|
||||
(ArrayHandleXGCCoordinates<T>),
|
||||
(vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, vtkm::cont::StorageTagXGCCoordinates>));
|
||||
|
||||
private:
|
||||
using StorageType = vtkm::cont::internal::Storage<ValueType, StorageTag>;
|
||||
|
||||
public:
|
||||
VTKM_CONT
|
||||
ArrayHandleXGCCoordinates(const OriginalType& array,
|
||||
vtkm::Id numberOfPlanes,
|
||||
vtkm::Id numberOfPlanesOwned,
|
||||
vtkm::Id planeStartId,
|
||||
bool cylindrical)
|
||||
: Superclass(StorageType::CreateBuffers(array,
|
||||
numberOfPlanes,
|
||||
numberOfPlanesOwned,
|
||||
planeStartId,
|
||||
cylindrical))
|
||||
{
|
||||
}
|
||||
|
||||
~ArrayHandleXGCCoordinates() {}
|
||||
|
||||
VTKM_CONT vtkm::Id GetNumberOfPlanes() const
|
||||
{
|
||||
return StorageType::GetNumberOfPlanes(this->GetBuffers());
|
||||
}
|
||||
|
||||
VTKM_CONT vtkm::Id GetNumberOfPlanesOwned() const
|
||||
{
|
||||
return StorageType::GetNumberOfPlanesOwned(this->GetBuffers());
|
||||
}
|
||||
|
||||
VTKM_CONT vtkm::Id GetPlaneStartId() const
|
||||
{
|
||||
return StorageType::GetPlaneStartId(this->GetBuffers());
|
||||
}
|
||||
|
||||
VTKM_CONT bool GetUseCylindrical() const
|
||||
{
|
||||
return StorageType::GetUseCylindrical(this->GetBuffers());
|
||||
}
|
||||
|
||||
VTKM_CONT vtkm::Id GetNumberOfPointsPerPlane() const
|
||||
{
|
||||
return StorageType::GetNumberOfValuesPerPlane(this->GetBuffers());
|
||||
}
|
||||
|
||||
VTKM_CONT OriginalType GetArray() const
|
||||
{
|
||||
return StorageType::GetArrayHandle(this->GetBuffers());
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
vtkm::cont::ArrayHandleXGCCoordinates<T> make_ArrayHandleXGCCoordinates(
|
||||
const vtkm::cont::ArrayHandle<T>& arrHandle,
|
||||
vtkm::Id numberOfPlanesOwned,
|
||||
bool cylindrical,
|
||||
vtkm::Id numberOfPlanes = -1,
|
||||
vtkm::Id planeStartId = 0)
|
||||
{
|
||||
if (numberOfPlanes == -1)
|
||||
{
|
||||
numberOfPlanes = numberOfPlanesOwned;
|
||||
}
|
||||
return ArrayHandleXGCCoordinates<T>(
|
||||
arrHandle, numberOfPlanes, numberOfPlanesOwned, planeStartId, cylindrical);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
vtkm::cont::ArrayHandleXGCCoordinates<T> make_ArrayHandleXGCCoordinates(
|
||||
const T* array,
|
||||
vtkm::Id length,
|
||||
vtkm::Id numberOfPlanesOwned,
|
||||
bool cylindrical,
|
||||
vtkm::Id numberOfPlanes = -1,
|
||||
vtkm::Id planeStartId = 0,
|
||||
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
|
||||
{
|
||||
if (numberOfPlanes == -1)
|
||||
{
|
||||
numberOfPlanes = numberOfPlanesOwned;
|
||||
}
|
||||
return ArrayHandleXGCCoordinates<T>(vtkm::cont::make_ArrayHandle(array, length, copy),
|
||||
numberOfPlanes,
|
||||
numberOfPlanesOwned,
|
||||
planeStartId,
|
||||
cylindrical);
|
||||
}
|
||||
|
||||
// if all planes belong to a single partition, then numberOfPlanes and planeStartId not needed
|
||||
template <typename T>
|
||||
vtkm::cont::ArrayHandleXGCCoordinates<T> make_ArrayHandleXGCCoordinates(
|
||||
const std::vector<T>& array,
|
||||
vtkm::Id numberOfPlanesOwned,
|
||||
bool cylindrical,
|
||||
vtkm::Id numberOfPlanes = -1,
|
||||
vtkm::Id planeStartId = 0,
|
||||
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
|
||||
{
|
||||
if (!array.empty())
|
||||
{
|
||||
if (numberOfPlanes == -1)
|
||||
{
|
||||
numberOfPlanes = numberOfPlanesOwned;
|
||||
}
|
||||
return make_ArrayHandleXGCCoordinates<T>(&array.front(),
|
||||
static_cast<vtkm::Id>(array.size()),
|
||||
numberOfPlanesOwned,
|
||||
cylindrical,
|
||||
numberOfPlanes,
|
||||
planeStartId,
|
||||
copy);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Vector empty. Just return an empty array handle.
|
||||
return ArrayHandleXGCCoordinates<T>();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // end namespace vtkm::cont
|
||||
|
||||
//=============================================================================
|
||||
// Specializations of serialization related classes
|
||||
/// @cond SERIALIZATION
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct SerializableTypeString<vtkm::cont::ArrayHandleXGCCoordinates<T>>
|
||||
{
|
||||
static VTKM_CONT const std::string& Get()
|
||||
{
|
||||
static std::string name = "AH_XGCCoordinates<" + SerializableTypeString<T>::Get() + ">";
|
||||
return name;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct SerializableTypeString<
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, vtkm::cont::StorageTagXGCCoordinates>>
|
||||
: SerializableTypeString<vtkm::cont::ArrayHandleXGCCoordinates<T>>
|
||||
{
|
||||
};
|
||||
}
|
||||
} // vtkm::cont
|
||||
|
||||
namespace mangled_diy_namespace
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
struct Serialization<vtkm::cont::ArrayHandleXGCCoordinates<T>>
|
||||
{
|
||||
private:
|
||||
using Type = vtkm::cont::ArrayHandleXGCCoordinates<T>;
|
||||
using BaseType = vtkm::cont::ArrayHandle<typename Type::ValueType, typename Type::StorageTag>;
|
||||
|
||||
public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const BaseType& obj)
|
||||
{
|
||||
Type ah = obj;
|
||||
vtkmdiy::save(bb, ah.GetNumberOfPlanes());
|
||||
vtkmdiy::save(bb, ah.GetNumberOfPlanesOwned());
|
||||
vtkmdiy::save(bb, ah.GetPlaneStartId());
|
||||
vtkmdiy::save(bb, ah.GetUseCylindrical());
|
||||
vtkmdiy::save(bb, ah.GetArray());
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, BaseType& ah)
|
||||
{
|
||||
vtkm::Id numberOfPlanes;
|
||||
vtkm::Id numberOfPlanesOwned;
|
||||
vtkm::Id planeStartId;
|
||||
bool isCylindrical;
|
||||
vtkm::cont::ArrayHandle<T> array;
|
||||
|
||||
vtkmdiy::load(bb, numberOfPlanes);
|
||||
vtkmdiy::load(bb, numberOfPlanesOwned);
|
||||
vtkmdiy::load(bb, planeStartId);
|
||||
vtkmdiy::load(bb, isCylindrical);
|
||||
vtkmdiy::load(bb, array);
|
||||
|
||||
ah = vtkm::cont::make_ArrayHandleXGCCoordinates(
|
||||
array, numberOfPlanes, numberOfPlanesOwned, planeStartId, isCylindrical);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct Serialization<vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, vtkm::cont::StorageTagXGCCoordinates>>
|
||||
: Serialization<vtkm::cont::ArrayHandleXGCCoordinates<T>>
|
||||
{
|
||||
};
|
||||
} // diy
|
||||
/// @endcond SERIALIZATION
|
||||
#endif
|
@ -78,6 +78,9 @@ VTKM_ARRAY_RANGE_COMPUTE_IMPL_ALL_VEC(2, vtkm::cont::StorageTagSOA);
|
||||
VTKM_ARRAY_RANGE_COMPUTE_IMPL_ALL_VEC(3, vtkm::cont::StorageTagSOA);
|
||||
VTKM_ARRAY_RANGE_COMPUTE_IMPL_ALL_VEC(4, vtkm::cont::StorageTagSOA);
|
||||
|
||||
VTKM_ARRAY_RANGE_COMPUTE_IMPL_VEC(vtkm::Float32, 3, vtkm::cont::StorageTagXGCCoordinates);
|
||||
VTKM_ARRAY_RANGE_COMPUTE_IMPL_VEC(vtkm::Float64, 3, vtkm::cont::StorageTagXGCCoordinates);
|
||||
|
||||
#undef VTKM_ARRAY_RANGE_COMPUTE_IMPL_T
|
||||
#undef VTKM_ARRAY_RANGE_COMPUTE_IMPL_VEC
|
||||
#undef VTKM_ARRAY_RANGE_COMPUTE_IMPL_ALL_SCALAR_T
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <vtkm/cont/ArrayHandleIndex.h>
|
||||
#include <vtkm/cont/ArrayHandleSOA.h>
|
||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||
#include <vtkm/cont/ArrayHandleXGCCoordinates.h>
|
||||
#include <vtkm/cont/DeviceAdapterTag.h>
|
||||
|
||||
namespace vtkm
|
||||
@ -103,6 +104,9 @@ VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_ALL_VEC(2, vtkm::cont::StorageTagSOA);
|
||||
VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_ALL_VEC(3, vtkm::cont::StorageTagSOA);
|
||||
VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_ALL_VEC(4, vtkm::cont::StorageTagSOA);
|
||||
|
||||
VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::Float32, 3, vtkm::cont::StorageTagXGCCoordinates);
|
||||
VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC(vtkm::Float64, 3, vtkm::cont::StorageTagXGCCoordinates);
|
||||
|
||||
#undef VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_T
|
||||
#undef VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_VEC
|
||||
#undef VTK_M_ARRAY_RANGE_COMPUTE_EXPORT_ALL_SCALAR_T
|
||||
|
@ -25,8 +25,6 @@ set(headers
|
||||
ArrayHandleDecorator.h
|
||||
ArrayHandleDiscard.h
|
||||
ArrayHandleExtractComponent.h
|
||||
ArrayHandleExtrudeCoords.h
|
||||
ArrayHandleExtrudeField.h
|
||||
ArrayHandleGroupVec.h
|
||||
ArrayHandleGroupVecVariable.h
|
||||
ArrayHandleImplicit.h
|
||||
@ -44,6 +42,7 @@ set(headers
|
||||
ArrayHandleTransform.h
|
||||
ArrayHandleUniformPointCoordinates.h
|
||||
ArrayHandleView.h
|
||||
ArrayHandleXGCCoordinates.h
|
||||
ArrayHandleZip.h
|
||||
ArrayPortal.h
|
||||
ArrayPortalToIterators.h
|
||||
@ -112,7 +111,6 @@ set(headers
|
||||
RuntimeDeviceTracker.h
|
||||
Serialization.h
|
||||
Storage.h
|
||||
StorageExtrude.h
|
||||
StorageImplicit.h # Deprecated, rolled into ArrayHandleImplicit.h
|
||||
StorageList.h
|
||||
StorageListTag.h
|
||||
@ -222,6 +220,11 @@ vtkm_option(VTKm_USE_DEFAULT_TYPES_FOR_VTK
|
||||
)
|
||||
if (VTKm_USE_DEFAULT_TYPES_FOR_VTK)
|
||||
set(VTKm_DEFAULT_TYPES_HEADER "internal/DefaultTypesVTK.h.in")
|
||||
vtkm_option(VTKm_ADD_XGC_TO_DEFAULT_TYPES_VTK "Add XGC types to default VTK types." OFF)
|
||||
mark_as_advanced(VTKm_ADD_XGC_TO_DEFAULT_TYPES_VTK)
|
||||
if (VTKm_ADD_XGC_TO_DEFAULT_TYPES_VTK)
|
||||
set(VTKM_ADD_XGC_DEFAULT_TYPES TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
vtkm_option(VTKm_USE_DEFAULT_TYPES_FOR_ASCENT
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <vtkm/TopologyElementTag.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||
#include <vtkm/cont/ArrayHandleExtrudeCoords.h>
|
||||
#include <vtkm/cont/ArrayHandleXGCCoordinates.h>
|
||||
#include <vtkm/cont/CellSet.h>
|
||||
#include <vtkm/cont/Invoker.h>
|
||||
#include <vtkm/exec/ConnectivityExtrude.h>
|
||||
@ -164,7 +164,7 @@ private:
|
||||
|
||||
template <typename T>
|
||||
CellSetExtrude make_CellSetExtrude(const vtkm::cont::ArrayHandle<vtkm::Int32>& conn,
|
||||
const vtkm::cont::ArrayHandleExtrudeCoords<T>& coords,
|
||||
const vtkm::cont::ArrayHandleXGCCoordinates<T>& coords,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Int32>& nextNode,
|
||||
bool periodic = true)
|
||||
{
|
||||
@ -175,26 +175,26 @@ CellSetExtrude make_CellSetExtrude(const vtkm::cont::ArrayHandle<vtkm::Int32>& c
|
||||
|
||||
template <typename T>
|
||||
CellSetExtrude make_CellSetExtrude(const std::vector<vtkm::Int32>& conn,
|
||||
const vtkm::cont::ArrayHandleExtrudeCoords<T>& coords,
|
||||
const vtkm::cont::ArrayHandleXGCCoordinates<T>& coords,
|
||||
const std::vector<vtkm::Int32>& nextNode,
|
||||
bool periodic = true)
|
||||
{
|
||||
return CellSetExtrude{ vtkm::cont::make_ArrayHandle(conn, vtkm::CopyFlag::On),
|
||||
static_cast<vtkm::Int32>(coords.GetNumberOfPointsPerPlane()),
|
||||
coords.GetNumberOfPlanes(),
|
||||
static_cast<vtkm::Int32>(coords.GetNumberOfPlanes()),
|
||||
vtkm::cont::make_ArrayHandle(nextNode, vtkm::CopyFlag::On),
|
||||
periodic };
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
CellSetExtrude make_CellSetExtrude(std::vector<vtkm::Int32>&& conn,
|
||||
const vtkm::cont::ArrayHandleExtrudeCoords<T>& coords,
|
||||
const vtkm::cont::ArrayHandleXGCCoordinates<T>& coords,
|
||||
std::vector<vtkm::Int32>&& nextNode,
|
||||
bool periodic = true)
|
||||
{
|
||||
return CellSetExtrude{ vtkm::cont::make_ArrayHandleMove(std::move(conn)),
|
||||
static_cast<vtkm::Int32>(coords.GetNumberOfPointsPerPlane()),
|
||||
coords.GetNumberOfPlanes(),
|
||||
static_cast<vtkm::Int32>(coords.GetNumberOfPlanes()),
|
||||
vtkm::cont::make_ArrayHandleMove(std::move(nextNode)),
|
||||
periodic };
|
||||
}
|
||||
|
@ -1,541 +0,0 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#ifndef vtkm_internal_StorageExtrude_h
|
||||
#define vtkm_internal_StorageExtrude_h
|
||||
|
||||
#include <vtkm/internal/IndicesExtrude.h>
|
||||
|
||||
#include <vtkm/VecTraits.h>
|
||||
|
||||
#include <vtkm/cont/ErrorBadType.h>
|
||||
|
||||
#include <vtkm/cont/internal/ArrayTransfer.h>
|
||||
#include <vtkm/cont/internal/StorageDeprecated.h>
|
||||
|
||||
#include <vtkm/cont/serial/DeviceAdapterSerial.h>
|
||||
#include <vtkm/cont/tbb/DeviceAdapterTBB.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace exec
|
||||
{
|
||||
|
||||
template <typename PortalType>
|
||||
struct VTKM_ALWAYS_EXPORT ArrayPortalExtrudePlane
|
||||
{
|
||||
using ValueType = typename PortalType::ValueType;
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
ArrayPortalExtrudePlane()
|
||||
: Portal()
|
||||
, NumberOfPlanes(0)
|
||||
{
|
||||
}
|
||||
|
||||
ArrayPortalExtrudePlane(const PortalType& p, vtkm::Int32 numOfPlanes)
|
||||
: Portal(p)
|
||||
, NumberOfPlanes(numOfPlanes)
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
vtkm::Id GetNumberOfValues() const
|
||||
{
|
||||
return this->Portal.GetNumberOfValues() * static_cast<vtkm::Id>(NumberOfPlanes);
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
ValueType Get(vtkm::Id index) const { return this->Portal.Get(index % this->NumberOfPlanes); }
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
ValueType Get(vtkm::Id2 index) const { return this->Portal.Get(index[0]); }
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
vtkm::Vec<ValueType, 6> GetWedge(const IndicesExtrude& index) const
|
||||
{
|
||||
vtkm::Vec<ValueType, 6> result;
|
||||
result[0] = this->Portal.Get(index.PointIds[0][0]);
|
||||
result[1] = this->Portal.Get(index.PointIds[0][1]);
|
||||
result[2] = this->Portal.Get(index.PointIds[0][2]);
|
||||
result[3] = this->Portal.Get(index.PointIds[1][0]);
|
||||
result[4] = this->Portal.Get(index.PointIds[1][1]);
|
||||
result[5] = this->Portal.Get(index.PointIds[1][2]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
PortalType Portal;
|
||||
vtkm::Int32 NumberOfPlanes;
|
||||
};
|
||||
}
|
||||
} // vtkm::exec
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagExtrudePlane
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class VTKM_ALWAYS_EXPORT Storage<T, internal::StorageTagExtrudePlane>
|
||||
{
|
||||
using HandleType = vtkm::cont::ArrayHandle<T>;
|
||||
|
||||
public:
|
||||
using ValueType = T;
|
||||
|
||||
using PortalConstType = vtkm::exec::ArrayPortalExtrudePlane<typename HandleType::ReadPortalType>;
|
||||
|
||||
// Note that this array is read only, so you really should only be getting the const
|
||||
// version of the portal. If you actually try to write to this portal, you will
|
||||
// get an error.
|
||||
using PortalType = PortalConstType;
|
||||
|
||||
Storage()
|
||||
: Array()
|
||||
, NumberOfPlanes(0)
|
||||
{
|
||||
}
|
||||
|
||||
Storage(const HandleType& array, vtkm::Int32 numberOfPlanes)
|
||||
: Array(array)
|
||||
, NumberOfPlanes(numberOfPlanes)
|
||||
{
|
||||
}
|
||||
|
||||
PortalType GetPortal()
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType(
|
||||
"Extrude ArrayHandles are read only. Cannot get writable portal.");
|
||||
}
|
||||
|
||||
PortalConstType GetPortalConst() const
|
||||
{
|
||||
return PortalConstType(this->Array.ReadPortal(), this->NumberOfPlanes);
|
||||
}
|
||||
|
||||
vtkm::Id GetNumberOfValues() const
|
||||
{
|
||||
return this->Array.GetNumberOfValues() * static_cast<vtkm::Id>(this->NumberOfPlanes);
|
||||
}
|
||||
|
||||
vtkm::Int32 GetNumberOfValuesPerPlane() const
|
||||
{
|
||||
return static_cast<vtkm::Int32>(this->Array->GetNumberOfValues());
|
||||
}
|
||||
|
||||
vtkm::Int32 GetNumberOfPlanes() const { return this->NumberOfPlanes; }
|
||||
|
||||
void Allocate(vtkm::Id vtkmNotUsed(numberOfValues))
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane is read only. It cannot be allocated.");
|
||||
}
|
||||
|
||||
void Shrink(vtkm::Id vtkmNotUsed(numberOfValues))
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane is read only. It cannot shrink.");
|
||||
}
|
||||
|
||||
void ReleaseResources()
|
||||
{
|
||||
// This request is ignored since we don't own the memory that was past
|
||||
// to us
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::cont::ArrayHandle<T> Array;
|
||||
vtkm::Int32 NumberOfPlanes;
|
||||
|
||||
VTKM_STORAGE_OLD_STYLE;
|
||||
};
|
||||
|
||||
template <typename T, typename Device>
|
||||
class VTKM_ALWAYS_EXPORT ArrayTransfer<T, internal::StorageTagExtrudePlane, Device>
|
||||
{
|
||||
public:
|
||||
using ValueType = T;
|
||||
using StorageType = vtkm::cont::internal::Storage<T, internal::StorageTagExtrudePlane>;
|
||||
|
||||
using PortalControl = typename StorageType::PortalType;
|
||||
using PortalConstControl = typename StorageType::PortalConstType;
|
||||
|
||||
//meant to be an invalid writeable execution portal
|
||||
using PortalExecution = typename StorageType::PortalType;
|
||||
using PortalConstExecution = vtkm::exec::ArrayPortalExtrudePlane<decltype(
|
||||
vtkm::cont::ArrayHandle<T>{}.PrepareForInput(Device{}))>;
|
||||
|
||||
VTKM_CONT
|
||||
ArrayTransfer(StorageType* storage)
|
||||
: ControlData(storage)
|
||||
{
|
||||
}
|
||||
|
||||
vtkm::Id GetNumberOfValues() const { return this->ControlData->GetNumberOfValues(); }
|
||||
|
||||
VTKM_CONT
|
||||
PortalConstExecution PrepareForInput(bool vtkmNotUsed(updateData))
|
||||
{
|
||||
return PortalConstExecution(this->ControlData->Array.PrepareForInput(Device()),
|
||||
this->ControlData->NumberOfPlanes);
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
PortalExecution PrepareForInPlace(bool& vtkmNotUsed(updateData))
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane read only. "
|
||||
"Cannot be used for in-place operations.");
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
PortalExecution PrepareForOutput(vtkm::Id vtkmNotUsed(numberOfValues))
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane read only. Cannot be used as output.");
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
void RetrieveOutputData(StorageType* vtkmNotUsed(storage)) const
|
||||
{
|
||||
throw vtkm::cont::ErrorInternal(
|
||||
"ArrayPortalExtrudePlane read only. "
|
||||
"There should be no occurance of the ArrayHandle trying to pull "
|
||||
"data from the execution environment.");
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
void Shrink(vtkm::Id vtkmNotUsed(numberOfValues))
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType("ArrayPortalExtrudePlane read only. Cannot shrink.");
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
void ReleaseResources()
|
||||
{
|
||||
// This request is ignored since we don't own the memory that was past
|
||||
// to us
|
||||
}
|
||||
|
||||
private:
|
||||
const StorageType* const ControlData;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // vtkm::cont::internal
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace exec
|
||||
{
|
||||
|
||||
template <typename PortalType>
|
||||
struct VTKM_ALWAYS_EXPORT ArrayPortalExtrude
|
||||
{
|
||||
using ValueType = vtkm::Vec<typename PortalType::ValueType, 3>;
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
ArrayPortalExtrude()
|
||||
: Portal()
|
||||
, NumberOfValues(0)
|
||||
, NumberOfPlanes(0)
|
||||
, UseCylindrical(false)
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
ArrayPortalExtrude(const PortalType& p,
|
||||
vtkm::Int32 numOfValues,
|
||||
vtkm::Int32 numOfPlanes,
|
||||
bool cylindrical = false)
|
||||
: Portal(p)
|
||||
, NumberOfValues(numOfValues)
|
||||
, NumberOfPlanes(numOfPlanes)
|
||||
, UseCylindrical(cylindrical)
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
vtkm::Id GetNumberOfValues() const
|
||||
{
|
||||
return ((NumberOfValues / 2) * static_cast<vtkm::Id>(NumberOfPlanes));
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
ValueType Get(vtkm::Id index) const;
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
ValueType Get(vtkm::Id2 index) const;
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
VTKM_EXEC_CONT
|
||||
vtkm::Vec<ValueType, 6> GetWedge(const IndicesExtrude& index) const;
|
||||
|
||||
PortalType Portal;
|
||||
vtkm::Int32 NumberOfValues;
|
||||
vtkm::Int32 NumberOfPlanes;
|
||||
bool UseCylindrical;
|
||||
};
|
||||
|
||||
template <typename PortalType>
|
||||
VTKM_EXEC_CONT typename ArrayPortalExtrude<PortalType>::ValueType
|
||||
ArrayPortalExtrude<PortalType>::Get(vtkm::Id index) const
|
||||
{
|
||||
using CompType = typename ValueType::ComponentType;
|
||||
|
||||
const vtkm::Id realIdx = (index * 2) % this->NumberOfValues;
|
||||
const vtkm::Id whichPlane = (index * 2) / this->NumberOfValues;
|
||||
const auto phi = static_cast<CompType>(whichPlane * (vtkm::TwoPi() / this->NumberOfPlanes));
|
||||
|
||||
auto r = this->Portal.Get(realIdx);
|
||||
auto z = this->Portal.Get(realIdx + 1);
|
||||
if (this->UseCylindrical)
|
||||
{
|
||||
return ValueType(r, phi, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ValueType(r * vtkm::Cos(phi), r * vtkm::Sin(phi), z);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename PortalType>
|
||||
VTKM_EXEC_CONT typename ArrayPortalExtrude<PortalType>::ValueType
|
||||
ArrayPortalExtrude<PortalType>::Get(vtkm::Id2 index) const
|
||||
{
|
||||
using CompType = typename ValueType::ComponentType;
|
||||
|
||||
const vtkm::Id realIdx = (index[0] * 2);
|
||||
const vtkm::Id whichPlane = index[1];
|
||||
const auto phi = static_cast<CompType>(whichPlane * (vtkm::TwoPi() / this->NumberOfPlanes));
|
||||
|
||||
auto r = this->Portal.Get(realIdx);
|
||||
auto z = this->Portal.Get(realIdx + 1);
|
||||
if (this->UseCylindrical)
|
||||
{
|
||||
return ValueType(r, phi, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ValueType(r * vtkm::Cos(phi), r * vtkm::Sin(phi), z);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename PortalType>
|
||||
VTKM_EXEC_CONT vtkm::Vec<typename ArrayPortalExtrude<PortalType>::ValueType, 6>
|
||||
ArrayPortalExtrude<PortalType>::GetWedge(const IndicesExtrude& index) const
|
||||
{
|
||||
using CompType = typename ValueType::ComponentType;
|
||||
|
||||
vtkm::Vec<ValueType, 6> result;
|
||||
for (int j = 0; j < 2; ++j)
|
||||
{
|
||||
const auto phi =
|
||||
static_cast<CompType>(index.Planes[j] * (vtkm::TwoPi() / this->NumberOfPlanes));
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
const vtkm::Id realIdx = index.PointIds[j][i] * 2;
|
||||
auto r = this->Portal.Get(realIdx);
|
||||
auto z = this->Portal.Get(realIdx + 1);
|
||||
result[3 * j + i] = this->UseCylindrical
|
||||
? ValueType(r, phi, z)
|
||||
: ValueType(r * vtkm::Cos(phi), r * vtkm::Sin(phi), z);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace cont
|
||||
{
|
||||
namespace internal
|
||||
{
|
||||
struct VTKM_ALWAYS_EXPORT StorageTagExtrude
|
||||
{
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class Storage<T, internal::StorageTagExtrude>
|
||||
{
|
||||
using BaseT = typename VecTraits<T>::BaseComponentType;
|
||||
using HandleType = vtkm::cont::ArrayHandle<BaseT>;
|
||||
using TPortalType = typename HandleType::ReadPortalType;
|
||||
|
||||
public:
|
||||
using ValueType = T;
|
||||
|
||||
using PortalConstType = exec::ArrayPortalExtrude<TPortalType>;
|
||||
|
||||
// Note that this array is read only, so you really should only be getting the const
|
||||
// version of the portal. If you actually try to write to this portal, you will
|
||||
// get an error.
|
||||
using PortalType = PortalConstType;
|
||||
|
||||
Storage()
|
||||
: Array()
|
||||
, NumberOfPlanes(0)
|
||||
{
|
||||
}
|
||||
|
||||
Storage(const HandleType& array, vtkm::Int32 numberOfPlanes, bool cylindrical)
|
||||
: Array(array)
|
||||
, NumberOfPlanes(numberOfPlanes)
|
||||
, UseCylindrical(cylindrical)
|
||||
{
|
||||
VTKM_ASSERT(this->Array.GetNumberOfValues() >= 0);
|
||||
}
|
||||
|
||||
PortalType GetPortal()
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType(
|
||||
"Extrude ArrayHandles are read only. Cannot get writable portal.");
|
||||
}
|
||||
|
||||
PortalConstType GetPortalConst() const
|
||||
{
|
||||
VTKM_ASSERT(this->Array.GetNumberOfValues() >= 0);
|
||||
return PortalConstType(this->Array.ReadPortal(),
|
||||
static_cast<vtkm::Int32>(this->Array.GetNumberOfValues()),
|
||||
this->NumberOfPlanes,
|
||||
this->UseCylindrical);
|
||||
}
|
||||
|
||||
vtkm::Id GetNumberOfValues() const
|
||||
{
|
||||
VTKM_ASSERT(this->Array.GetNumberOfValues() >= 0);
|
||||
return (this->Array.GetNumberOfValues() / 2) * static_cast<vtkm::Id>(this->NumberOfPlanes);
|
||||
}
|
||||
|
||||
vtkm::Id GetLength() const { return this->Array.GetNumberOfValues(); }
|
||||
|
||||
vtkm::Int32 GetNumberOfPlanes() const { return NumberOfPlanes; }
|
||||
|
||||
bool GetUseCylindrical() const { return UseCylindrical; }
|
||||
void Allocate(vtkm::Id vtkmNotUsed(numberOfValues))
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType("StorageTagExtrude is read only. It cannot be allocated.");
|
||||
}
|
||||
|
||||
void Shrink(vtkm::Id vtkmNotUsed(numberOfValues))
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType("StoraageTagExtrue is read only. It cannot shrink.");
|
||||
}
|
||||
|
||||
void ReleaseResources()
|
||||
{
|
||||
// This request is ignored since we don't own the memory that was past
|
||||
// to us
|
||||
}
|
||||
|
||||
|
||||
vtkm::cont::ArrayHandle<BaseT> Array;
|
||||
|
||||
private:
|
||||
vtkm::Int32 NumberOfPlanes;
|
||||
bool UseCylindrical;
|
||||
|
||||
VTKM_STORAGE_OLD_STYLE;
|
||||
};
|
||||
|
||||
template <typename T, typename Device>
|
||||
class VTKM_ALWAYS_EXPORT ArrayTransfer<T, internal::StorageTagExtrude, Device>
|
||||
{
|
||||
using BaseT = typename VecTraits<T>::BaseComponentType;
|
||||
using TPortalType = decltype(
|
||||
vtkm::cont::ArrayHandle<BaseT>{}.PrepareForInput(Device{}, std::declval<vtkm::cont::Token&>()));
|
||||
|
||||
public:
|
||||
using ValueType = T;
|
||||
using StorageType = vtkm::cont::internal::Storage<T, internal::StorageTagExtrude>;
|
||||
|
||||
using PortalControl = typename StorageType::PortalType;
|
||||
using PortalConstControl = typename StorageType::PortalConstType;
|
||||
|
||||
//meant to be an invalid writeable execution portal
|
||||
using PortalExecution = vtkm::exec::ArrayPortalExtrude<TPortalType>;
|
||||
|
||||
using PortalConstExecution = vtkm::exec::ArrayPortalExtrude<TPortalType>;
|
||||
|
||||
VTKM_CONT
|
||||
ArrayTransfer(StorageType* storage)
|
||||
: ControlData(storage)
|
||||
{
|
||||
}
|
||||
vtkm::Id GetNumberOfValues() const { return this->ControlData->GetNumberOfValues(); }
|
||||
|
||||
VTKM_CONT
|
||||
PortalConstExecution PrepareForInput(bool vtkmNotUsed(updateData), vtkm::cont::Token& token)
|
||||
{
|
||||
return PortalConstExecution(
|
||||
this->ControlData->Array.PrepareForInput(Device(), token),
|
||||
static_cast<vtkm::Int32>(this->ControlData->Array.GetNumberOfValues()),
|
||||
this->ControlData->GetNumberOfPlanes(),
|
||||
this->ControlData->GetUseCylindrical());
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
PortalExecution PrepareForInPlace(bool& vtkmNotUsed(updateData), vtkm::cont::Token&)
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType("StorageExtrude read only. "
|
||||
"Cannot be used for in-place operations.");
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
PortalExecution PrepareForOutput(vtkm::Id vtkmNotUsed(numberOfValues), vtkm::cont::Token&)
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType("StorageExtrude read only. Cannot be used as output.");
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
void RetrieveOutputData(StorageType* vtkmNotUsed(storage)) const
|
||||
{
|
||||
throw vtkm::cont::ErrorInternal(
|
||||
"ArrayHandleExrPointCoordinates read only. "
|
||||
"There should be no occurance of the ArrayHandle trying to pull "
|
||||
"data from the execution environment.");
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
void Shrink(vtkm::Id vtkmNotUsed(numberOfValues))
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType("StorageExtrude read only. Cannot shrink.");
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
void ReleaseResources()
|
||||
{
|
||||
// This request is ignored since we don't own the memory that was past
|
||||
// to us
|
||||
}
|
||||
|
||||
private:
|
||||
const StorageType* const ControlData;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -17,6 +17,15 @@
|
||||
|
||||
#include <vtkm/cont/CellSetList.h>
|
||||
|
||||
#cmakedefine VTKM_ADD_XGC_DEFAULT_TYPES
|
||||
|
||||
#ifdef VTKM_ADD_XGC_DEFAULT_TYPES
|
||||
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
|
||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||
#include <vtkm/cont/ArrayHandleXGCCoordinates.h>
|
||||
#include <vtkm/cont/StorageList.h>
|
||||
#endif
|
||||
|
||||
namespace tovtkm
|
||||
{
|
||||
|
||||
@ -99,10 +108,29 @@ using CellListUnstructuredOutVTK = vtkm::List< //
|
||||
using CellListAllInVTK = vtkm::ListAppend<CellListStructuredInVTK, CellListUnstructuredInVTK>;
|
||||
using CellListAllOutVTK = vtkm::ListAppend<CellListStructuredOutVTK, CellListUnstructuredOutVTK>;
|
||||
|
||||
#ifdef VTKM_ADD_XGC_DEFAULT_TYPES
|
||||
using StorageListField = vtkm::ListAppend<
|
||||
vtkm::cont::StorageListBasic,
|
||||
vtkm::List<
|
||||
vtkm::cont::ArrayHandleUniformPointCoordinates::StorageTag,
|
||||
vtkm::cont::ArrayHandleCartesianProduct<vtkm::cont::ArrayHandle<vtkm::Float32>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32>>::StorageTag,
|
||||
vtkm::cont::ArrayHandleCartesianProduct<vtkm::cont::ArrayHandle<vtkm::Float64>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64>,
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64>>::StorageTag,
|
||||
vtkm::cont::StorageTagXGCCoordinates
|
||||
>>;
|
||||
#endif
|
||||
|
||||
} // end namespace tovtkm
|
||||
|
||||
#define VTKM_DEFAULT_TYPE_LIST ::tovtkm::FieldTypeInVTK
|
||||
#define VTKM_DEFAULT_CELL_SET_LIST_STRUCTURED ::tovtkm::CellListStructuredInVTK
|
||||
#define VTKM_DEFAULT_CELL_SET_LIST_UNSTRUCTURED ::tovtkm::CellListUnstructuredInVTK
|
||||
|
||||
#ifdef VTKM_ADD_XGC_DEFAULT_TYPES
|
||||
#define VTKM_DEFAULT_STORAGE_LIST ::tovtkm::StorageListField
|
||||
#endif
|
||||
|
||||
#endif //vtk_m_cont_internal_DefaultTypesVTK_h
|
||||
|
@ -41,7 +41,6 @@ set(unit_tests
|
||||
UnitTestArrayHandleDecorator.cxx
|
||||
UnitTestArrayHandleDiscard.cxx
|
||||
UnitTestArrayHandleExtractComponent.cxx
|
||||
UnitTestArrayHandleExtrude.cxx
|
||||
UnitTestArrayHandleImplicit.cxx
|
||||
UnitTestArrayHandleIndex.cxx
|
||||
UnitTestArrayHandleReverse.cxx
|
||||
@ -54,6 +53,7 @@ set(unit_tests
|
||||
UnitTestArrayHandleTransform.cxx
|
||||
UnitTestArrayHandleUniformPointCoordinates.cxx
|
||||
UnitTestArrayHandleVirtual.cxx
|
||||
UnitTestArrayHandleXGCCoordinates.cxx
|
||||
UnitTestArrayPortalToIterators.cxx
|
||||
UnitTestCellLocatorGeneral.cxx
|
||||
UnitTestCellSet.cxx
|
||||
|
@ -13,9 +13,11 @@
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandleExtrudeCoords.h>
|
||||
#include <vtkm/cont/ArrayHandleXGCCoordinates.h>
|
||||
#include <vtkm/cont/ArrayRangeCompute.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -90,12 +92,28 @@ void verify_results(vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>, S> const& handle)
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void test_range(const vtkm::cont::ArrayHandleXGCCoordinates<T>& handle)
|
||||
{
|
||||
auto x_result = std::minmax_element(correct_x_coords.begin(), correct_x_coords.end());
|
||||
auto y_result = std::minmax_element(correct_y_coords.begin(), correct_y_coords.end());
|
||||
auto z_result = std::minmax_element(correct_z_coords.begin(), correct_z_coords.end());
|
||||
|
||||
int TestArrayHandleExtrude()
|
||||
auto range = vtkm::cont::ArrayRangeCompute(handle);
|
||||
auto rangePortal = range.ReadPortal();
|
||||
VTKM_TEST_ASSERT(test_equal(rangePortal.Get(0).Min, *x_result.first), "incorrect min for x");
|
||||
VTKM_TEST_ASSERT(test_equal(rangePortal.Get(0).Max, *x_result.second), "incorrect max for x");
|
||||
VTKM_TEST_ASSERT(test_equal(rangePortal.Get(1).Min, *y_result.first), "incorrect min for y");
|
||||
VTKM_TEST_ASSERT(test_equal(rangePortal.Get(1).Max, *y_result.second), "incorrect max for y");
|
||||
VTKM_TEST_ASSERT(test_equal(rangePortal.Get(2).Min, *z_result.first), "incorrect min for z");
|
||||
VTKM_TEST_ASSERT(test_equal(rangePortal.Get(2).Max, *z_result.second), "incorrect max for z");
|
||||
}
|
||||
|
||||
int TestArrayHandleXGCCoordinates()
|
||||
{
|
||||
const int numPlanes = 8;
|
||||
|
||||
auto coords = vtkm::cont::make_ArrayHandleExtrudeCoords(
|
||||
auto coords = vtkm::cont::make_ArrayHandleXGCCoordinates(
|
||||
vtkm::cont::make_ArrayHandle(points_rz, vtkm::CopyFlag::Off), numPlanes, false);
|
||||
|
||||
VTKM_TEST_ASSERT(coords.GetNumberOfValues() ==
|
||||
@ -111,13 +129,15 @@ int TestArrayHandleExtrude()
|
||||
dispatcher.Invoke(coords, output1D);
|
||||
verify_results(output1D);
|
||||
|
||||
test_range(coords);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // end namespace anonymous
|
||||
|
||||
int UnitTestArrayHandleExtrude(int argc, char* argv[])
|
||||
int UnitTestArrayHandleXGCCoordinates(int argc, char* argv[])
|
||||
{
|
||||
vtkm::cont::GetRuntimeDeviceTracker().ForceDevice(vtkm::cont::DeviceAdapterTagSerial{});
|
||||
return vtkm::cont::testing::Testing::Run(TestArrayHandleExtrude, argc, argv);
|
||||
return vtkm::cont::testing::Testing::Run(TestArrayHandleXGCCoordinates, argc, argv);
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandleExtrudeCoords.h>
|
||||
#include <vtkm/cont/ArrayHandleXGCCoordinates.h>
|
||||
#include <vtkm/cont/CellSetExtrude.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
@ -112,7 +112,7 @@ int TestCellSetExtrude()
|
||||
{
|
||||
const std::size_t numPlanes = 8;
|
||||
|
||||
auto coords = vtkm::cont::make_ArrayHandleExtrudeCoords(points_rz, numPlanes, false);
|
||||
auto coords = vtkm::cont::make_ArrayHandleXGCCoordinates(points_rz, numPlanes, false);
|
||||
auto cells = vtkm::cont::make_CellSetExtrude(topology, coords, nextNode);
|
||||
VTKM_TEST_ASSERT(cells.GetNumberOfPoints() == coords.GetNumberOfValues(),
|
||||
"number of points don't match between cells and coordinates");
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <vtkm/exec/arg/FetchTagArrayTopologyMapIn.h>
|
||||
#include <vtkm/exec/arg/IncidentElementIndices.h>
|
||||
|
||||
//optimized fetches for ArrayPortalExtrude for
|
||||
//optimized fetches for ArrayPortalXGCCoordinates for
|
||||
// - 3D Scheduling
|
||||
// - WorkletNeighboorhood
|
||||
namespace vtkm
|
||||
@ -70,47 +70,40 @@ struct Fetch<FetchType, vtkm::exec::arg::AspectTagIncidentElementIndices, ExecOb
|
||||
template <typename T>
|
||||
struct Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
|
||||
vtkm::exec::arg::AspectTagDefault,
|
||||
vtkm::exec::ArrayPortalExtrude<T>>
|
||||
vtkm::internal::ArrayPortalXGCCoordinates<T>>
|
||||
|
||||
{
|
||||
//Optimized fetch for point arrays when iterating the cells ConnectivityExtrude
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template <typename ThreadIndicesType>
|
||||
VTKM_EXEC auto Load(const ThreadIndicesType& indices,
|
||||
const vtkm::exec::ArrayPortalExtrude<T>& points)
|
||||
-> decltype(points.GetWedge(indices.GetIndicesIncident()))
|
||||
{
|
||||
// std::cout << "opimized fetch for point coordinates" << std::endl;
|
||||
return points.GetWedge(indices.GetIndicesIncident());
|
||||
}
|
||||
|
||||
template <typename ThreadIndicesType, typename ValueType>
|
||||
VTKM_EXEC void Store(const ThreadIndicesType&,
|
||||
const vtkm::exec::ArrayPortalExtrude<T>&,
|
||||
const ValueType&) const
|
||||
{
|
||||
// Store is a no-op for this fetch.
|
||||
}
|
||||
};
|
||||
|
||||
//Optimized fetch for point coordinates when iterating the cells of ConnectivityExtrude
|
||||
template <typename T>
|
||||
struct Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
|
||||
vtkm::exec::arg::AspectTagDefault,
|
||||
vtkm::exec::ArrayPortalExtrudePlane<T>>
|
||||
{
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template <typename ThreadIndicesType>
|
||||
VTKM_EXEC auto Load(const ThreadIndicesType& indices,
|
||||
const vtkm::exec::ArrayPortalExtrudePlane<T>& portal)
|
||||
template <typename ScatterAndMaskMode>
|
||||
VTKM_EXEC auto Load(
|
||||
const vtkm::exec::arg::ThreadIndicesTopologyMap<vtkm::exec::ConnectivityExtrude,
|
||||
ScatterAndMaskMode>& indices,
|
||||
const vtkm::internal::ArrayPortalXGCCoordinates<T>& portal)
|
||||
-> decltype(portal.GetWedge(indices.GetIndicesIncident()))
|
||||
{
|
||||
// std::cout << "opimized fetch for point coordinates" << std::endl;
|
||||
return portal.GetWedge(indices.GetIndicesIncident());
|
||||
}
|
||||
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template <typename ThreadIndicesType>
|
||||
VTKM_EXEC auto Load(const ThreadIndicesType& indices,
|
||||
const vtkm::internal::ArrayPortalXGCCoordinates<T>& field) const
|
||||
-> decltype(
|
||||
detail::FetchArrayTopologyMapInImplementation<typename ThreadIndicesType::Connectivity,
|
||||
vtkm::internal::ArrayPortalXGCCoordinates<T>,
|
||||
ThreadIndicesType>::Load(indices, field))
|
||||
{
|
||||
using Implementation =
|
||||
detail::FetchArrayTopologyMapInImplementation<typename ThreadIndicesType::Connectivity,
|
||||
vtkm::internal::ArrayPortalXGCCoordinates<T>,
|
||||
ThreadIndicesType>;
|
||||
return Implementation::Load(indices, field);
|
||||
}
|
||||
|
||||
template <typename ThreadIndicesType, typename ValueType>
|
||||
VTKM_EXEC void Store(const ThreadIndicesType&,
|
||||
const vtkm::exec::ArrayPortalExtrudePlane<T>&,
|
||||
const vtkm::internal::ArrayPortalXGCCoordinates<T>&,
|
||||
const ValueType&) const
|
||||
{
|
||||
// Store is a no-op for this fetch.
|
||||
@ -121,13 +114,13 @@ struct Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
|
||||
template <typename T>
|
||||
struct Fetch<vtkm::exec::arg::FetchTagArrayDirectIn,
|
||||
vtkm::exec::arg::AspectTagDefault,
|
||||
vtkm::exec::ArrayPortalExtrude<T>>
|
||||
vtkm::internal::ArrayPortalXGCCoordinates<T>>
|
||||
|
||||
{
|
||||
VTKM_SUPPRESS_EXEC_WARNINGS
|
||||
template <typename ThreadIndicesType>
|
||||
VTKM_EXEC auto Load(const ThreadIndicesType& indices,
|
||||
const vtkm::exec::ArrayPortalExtrude<T>& points)
|
||||
const vtkm::internal::ArrayPortalXGCCoordinates<T>& points)
|
||||
-> decltype(points.Get(indices.GetInputIndex()))
|
||||
{
|
||||
// std::cout << "optimized fetch for point coordinates" << std::endl;
|
||||
@ -139,7 +132,7 @@ struct Fetch<vtkm::exec::arg::FetchTagArrayDirectIn,
|
||||
VTKM_EXEC auto Load(
|
||||
const vtkm::exec::arg::ThreadIndicesTopologyMap<vtkm::exec::ReverseConnectivityExtrude,
|
||||
ScatterAndMaskMode>& indices,
|
||||
const vtkm::exec::ArrayPortalExtrude<T>& points)
|
||||
const vtkm::internal::ArrayPortalXGCCoordinates<T>& points)
|
||||
-> decltype(points.Get(indices.GetIndexLogical()))
|
||||
{
|
||||
// std::cout << "optimized fetch for point coordinates" << std::endl;
|
||||
@ -148,7 +141,7 @@ struct Fetch<vtkm::exec::arg::FetchTagArrayDirectIn,
|
||||
|
||||
template <typename ThreadIndicesType, typename ValueType>
|
||||
VTKM_EXEC void Store(const ThreadIndicesType&,
|
||||
const vtkm::exec::ArrayPortalExtrude<T>&,
|
||||
const vtkm::internal::ArrayPortalXGCCoordinates<T>&,
|
||||
const ValueType&) const
|
||||
{
|
||||
// Store is a no-op for this fetch.
|
||||
|
@ -26,7 +26,6 @@ set(common_headers
|
||||
MapFieldPermutation.h
|
||||
PolicyBase.h
|
||||
PolicyDefault.h
|
||||
PolicyExtrude.h
|
||||
Threshold.h
|
||||
ThresholdPoints.h
|
||||
)
|
||||
@ -207,6 +206,10 @@ set(gradient_sources_device
|
||||
GradientVector.cxx
|
||||
)
|
||||
|
||||
if (VTKm_ADD_XGC_TO_DEFAULT_TYPES_VTK)
|
||||
list(APPEND gradient_sources_device GradientXGCPoints.cxx)
|
||||
endif()
|
||||
|
||||
vtkm_pyexpander_generated_file(ClipWithFieldSkipInstantiations.hxx)
|
||||
vtkm_pyexpander_generated_file(ClipWithImplicitFunctionSkipInstantiations.hxx)
|
||||
vtkm_pyexpander_generated_file(ClipWithFieldSignedInteger.cxx)
|
||||
|
@ -213,6 +213,20 @@ extern template VTKM_FILTER_GRADIENT_TEMPLATE_EXPORT vtkm::cont::DataSet Gradien
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
|
||||
|
||||
#ifdef VTKM_ADD_XGC_DEFAULT_TYPES
|
||||
extern template VTKM_FILTER_GRADIENT_TEMPLATE_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
|
||||
const vtkm::cont::DataSet&,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<float, 3>, vtkm::cont::StorageTagXGCCoordinates>&,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
|
||||
|
||||
extern template VTKM_FILTER_GRADIENT_TEMPLATE_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
|
||||
const vtkm::cont::DataSet&,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<double, 3>, vtkm::cont::StorageTagXGCCoordinates>&,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
|
||||
#endif
|
||||
|
||||
#endif //vtkm_filter_Gradient_cxx
|
||||
}
|
||||
} // namespace vtkm::filter
|
||||
|
35
vtkm/filter/GradientXGCPoints.cxx
Normal file
35
vtkm/filter/GradientXGCPoints.cxx
Normal file
@ -0,0 +1,35 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_Gradient_XGC_cxx
|
||||
#define vtk_m_filter_Gradient_XGC_cxx
|
||||
|
||||
#include <vtkm/filter/Gradient.h>
|
||||
#include <vtkm/filter/Gradient.hxx>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
template VTKM_FILTER_GRADIENT_TEMPLATE_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
|
||||
const vtkm::cont::DataSet&,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<float, 3>, vtkm::cont::StorageTagXGCCoordinates>&,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
|
||||
|
||||
template VTKM_FILTER_GRADIENT_TEMPLATE_EXPORT vtkm::cont::DataSet Gradient::DoExecute(
|
||||
const vtkm::cont::DataSet&,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<double, 3>, vtkm::cont::StorageTagXGCCoordinates>&,
|
||||
const vtkm::filter::FieldMetadata&,
|
||||
vtkm::filter::PolicyBase<vtkm::filter::PolicyDefault>);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -38,7 +38,7 @@ public:
|
||||
vtkm::filter::PolicyBase<DerivedPolicy> policy);
|
||||
|
||||
// PointAverage is a simple filter that is used to test custom filter types.
|
||||
using AdditionalFieldStorage = vtkm::List<vtkm::cont::internal::StorageTagExtrude>;
|
||||
using AdditionalFieldStorage = vtkm::List<vtkm::cont::StorageTagXGCCoordinates>;
|
||||
using SupportedCellSets =
|
||||
vtkm::ListAppend<vtkm::List<vtkm::cont::CellSetExtrude>, VTKM_DEFAULT_CELL_SET_LIST>;
|
||||
|
||||
|
@ -153,6 +153,19 @@ struct AllCastArraysForStorageImpl<TargetT,
|
||||
using type = vtkm::ListEmpty;
|
||||
};
|
||||
|
||||
#ifdef VTKM_ADD_XGC_DEFAULT_TYPES
|
||||
template <typename T>
|
||||
struct AllCastArraysForStorageImpl<vtkm::Vec<T, 3>, vtkm::cont::StorageTagXGCCoordinates, true>
|
||||
{
|
||||
using type = vtkm::List<vtkm::cont::ArrayHandleXGCCoordinates<T>>;
|
||||
};
|
||||
template <typename TargetT>
|
||||
struct AllCastArraysForStorageImpl<TargetT, vtkm::cont::StorageTagXGCCoordinates, false>
|
||||
{
|
||||
using type = vtkm::ListEmpty;
|
||||
};
|
||||
#endif
|
||||
|
||||
// Given a target type and storage of an array handle, provides a list this array handle plus all
|
||||
// array handles that can be cast to the target type wrapped in an ArrayHandleCast that does so.
|
||||
template <typename TargetT, typename Storage>
|
||||
|
@ -1,43 +0,0 @@
|
||||
//=============================================================================
|
||||
//
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//
|
||||
// Copyright 2012 Sandia Corporation.
|
||||
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
||||
// the U.S. Government retains certain rights in this software.
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
#ifndef vtk_m_filter_PolicyExtrude_h
|
||||
#define vtk_m_filter_PolicyExtrude_h
|
||||
|
||||
#include <vtkm/cont/ArrayHandleExtrudeCoords.h>
|
||||
#include <vtkm/cont/CellSetExtrude.h>
|
||||
|
||||
#include <vtkm/List.h>
|
||||
#include <vtkm/filter/PolicyDefault.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace filter
|
||||
{
|
||||
|
||||
struct VTKM_ALWAYS_EXPORT PolicyExtrude : vtkm::filter::PolicyBase<PolicyExtrude>
|
||||
{
|
||||
public:
|
||||
using UnstructuredCellSetList = vtkm::List<vtkm::cont::CellSetExtrude>;
|
||||
using AllCellSetList = vtkm::List<vtkm::cont::CellSetExtrude>;
|
||||
//Todo: add in Cylinder storage tag when it is written
|
||||
using CoordinateStorageList =
|
||||
vtkm::List<vtkm::cont::StorageTagBasic, vtkm::cont::internal::StorageTagExtrude>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -10,7 +10,7 @@
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
#include <vtkm/worklet/WorkletMapTopology.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandleExtrudeCoords.h>
|
||||
#include <vtkm/cont/ArrayHandleXGCCoordinates.h>
|
||||
#include <vtkm/cont/CellSetExtrude.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
@ -27,7 +27,7 @@ int TestCellSetExtrude()
|
||||
{
|
||||
const std::size_t numPlanes = 8;
|
||||
|
||||
auto coords = vtkm::cont::make_ArrayHandleExtrudeCoords(points_rz, numPlanes, false);
|
||||
auto coords = vtkm::cont::make_ArrayHandleXGCCoordinates(points_rz, numPlanes, false);
|
||||
auto cells = vtkm::cont::make_CellSetExtrude(topology, coords, nextNode);
|
||||
VTKM_TEST_ASSERT(cells.GetNumberOfPoints() == coords.GetNumberOfValues(),
|
||||
"number of points don't match between cells and coordinates");
|
||||
|
@ -97,6 +97,19 @@ struct CheckSameCoordinateSystem
|
||||
VTKM_TEST_ASSERT(
|
||||
test_equal_portals(originalPortal.GetThirdPortal(), filePortal.GetThirdPortal()));
|
||||
}
|
||||
|
||||
#ifdef VTKM_ADD_XGC_DEFAULT_TYPES
|
||||
// Just added to fix compilation errors when building with XGC types added to default types
|
||||
// An XGC data set wouldn't be directly written out to a VTK file, it should be converted
|
||||
// to an explicit grid first and then written out.
|
||||
template <typename T>
|
||||
void operator()(const vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagXGCCoordinates>&,
|
||||
const vtkm::cont::CoordinateSystem&) const
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType("UnitTestVTKDataSetWriter::CheckSameCoordinateSystem() shouldn't"
|
||||
" be called on ArrayHandleXGCCoordinates");
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
void CheckWrittenReadData(const vtkm::cont::DataSet& originalData,
|
||||
|
Loading…
Reference in New Issue
Block a user