2015-08-11 18:42:34 +00:00
|
|
|
//============================================================================
|
|
|
|
// Copyright (c) Kitware, Inc.
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE.txt for details.
|
2019-04-15 23:24:21 +00:00
|
|
|
//
|
2015-08-11 18:42:34 +00:00
|
|
|
// 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_internal_ConnectivityExplicitInternals_h
|
|
|
|
#define vtk_m_cont_internal_ConnectivityExplicitInternals_h
|
|
|
|
|
2017-07-21 16:15:54 +00:00
|
|
|
#include <vtkm/CellShape.h>
|
2015-08-11 18:42:34 +00:00
|
|
|
#include <vtkm/cont/ArrayHandle.h>
|
2015-09-24 14:15:44 +00:00
|
|
|
#include <vtkm/cont/ArrayHandleCast.h>
|
2017-07-21 16:15:54 +00:00
|
|
|
#include <vtkm/cont/ArrayHandleConstant.h>
|
|
|
|
#include <vtkm/cont/ArrayHandleCounting.h>
|
2015-08-11 18:42:34 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace cont
|
|
|
|
{
|
|
|
|
namespace internal
|
|
|
|
{
|
|
|
|
|
2019-08-30 17:04:17 +00:00
|
|
|
template <typename ShapesStorageTag = VTKM_DEFAULT_STORAGE_TAG,
|
2017-05-18 14:29:41 +00:00
|
|
|
typename ConnectivityStorageTag = VTKM_DEFAULT_STORAGE_TAG,
|
2019-08-30 17:04:17 +00:00
|
|
|
typename OffsetsStorageTag = VTKM_DEFAULT_STORAGE_TAG>
|
2015-08-11 18:42:34 +00:00
|
|
|
struct ConnectivityExplicitInternals
|
|
|
|
{
|
2019-08-30 17:04:17 +00:00
|
|
|
using ShapesArrayType = vtkm::cont::ArrayHandle<vtkm::UInt8, ShapesStorageTag>;
|
2017-08-10 19:26:05 +00:00
|
|
|
using ConnectivityArrayType = vtkm::cont::ArrayHandle<vtkm::Id, ConnectivityStorageTag>;
|
2019-08-30 17:04:17 +00:00
|
|
|
using OffsetsArrayType = vtkm::cont::ArrayHandle<vtkm::Id, OffsetsStorageTag>;
|
2015-08-11 18:42:34 +00:00
|
|
|
|
2019-08-30 17:04:17 +00:00
|
|
|
ShapesArrayType Shapes;
|
2015-08-11 18:42:34 +00:00
|
|
|
ConnectivityArrayType Connectivity;
|
2019-08-30 17:04:17 +00:00
|
|
|
OffsetsArrayType Offsets;
|
2015-08-11 18:42:34 +00:00
|
|
|
|
|
|
|
bool ElementsValid;
|
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_CONT
|
2015-08-11 18:42:34 +00:00
|
|
|
ConnectivityExplicitInternals()
|
2017-05-18 14:29:41 +00:00
|
|
|
: ElementsValid(false)
|
|
|
|
{
|
|
|
|
}
|
2015-08-11 18:42:34 +00:00
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
vtkm::Id GetNumberOfElements() const
|
|
|
|
{
|
2017-02-15 22:07:50 +00:00
|
|
|
VTKM_ASSERT(this->ElementsValid);
|
|
|
|
|
2015-08-11 18:42:34 +00:00
|
|
|
return this->Shapes.GetNumberOfValues();
|
|
|
|
}
|
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
void ReleaseResourcesExecution()
|
|
|
|
{
|
2015-08-11 18:42:34 +00:00
|
|
|
this->Shapes.ReleaseResourcesExecution();
|
|
|
|
this->Connectivity.ReleaseResourcesExecution();
|
2019-08-30 17:04:17 +00:00
|
|
|
this->Offsets.ReleaseResourcesExecution();
|
2016-06-23 23:34:01 +00:00
|
|
|
}
|
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_CONT
|
2017-05-18 14:29:41 +00:00
|
|
|
void PrintSummary(std::ostream& out) const
|
2015-08-11 18:42:34 +00:00
|
|
|
{
|
2017-02-15 22:07:50 +00:00
|
|
|
if (this->ElementsValid)
|
|
|
|
{
|
|
|
|
out << " Shapes: ";
|
|
|
|
vtkm::cont::printSummary_ArrayHandle(this->Shapes, out);
|
|
|
|
out << " Connectivity: ";
|
|
|
|
vtkm::cont::printSummary_ArrayHandle(this->Connectivity, out);
|
2019-08-30 17:04:17 +00:00
|
|
|
out << " Offsets: ";
|
|
|
|
vtkm::cont::printSummary_ArrayHandle(this->Offsets, out);
|
2017-02-15 22:07:50 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
out << " Not Allocated" << std::endl;
|
|
|
|
}
|
2015-08-11 18:42:34 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // namespace vtkm::cont::internal
|
|
|
|
|
|
|
|
#endif //vtk_m_cont_internal_ConnectivityExplicitInternals_h
|