migrate AmrArray filter

This commit is contained in:
Li-Ta Lo 2022-05-20 15:07:34 -06:00
parent ebfbeabc8a
commit 99d17b30a0
10 changed files with 159 additions and 84 deletions

@ -10,77 +10,23 @@
#ifndef vtk_m_filter_AmrArrays_h
#define vtk_m_filter_AmrArrays_h
#include <vtkm/filter/FilterDataSet.h>
#include <vtkm/Deprecated.h>
#include <vtkm/filter/multi_block/AmrArrays.h>
namespace vtkm
{
namespace filter
{
class AmrArrays : public vtkm::filter::FilterDataSet<AmrArrays>
VTKM_DEPRECATED(1.8, "Use vtkm/filter/multi_block/AmrArrays.h instead of vtkm/filter/AmrArrays.h.")
inline void AmrArrays_deprecated() {}
inline void AmrArrays_deprecated_warning()
{
public:
using SupportedTypes = vtkm::List<vtkm::UInt8>;
AmrArrays_deprecated();
}
VTKM_CONT
AmrArrays();
template <typename DerivedPolicy>
vtkm::cont::PartitionedDataSet PrepareForExecution(
const vtkm::cont::PartitionedDataSet& input,
const vtkm::filter::PolicyBase<DerivedPolicy>&);
template <typename DerivedPolicy>
VTKM_CONT bool MapFieldOntoOutput(vtkm::cont::DataSet& result,
const vtkm::cont::Field& field,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
result.AddField(field);
return true;
}
private:
/// the list of ids contains all amrIds of the level above/below that have an overlap
VTKM_CONT
void GenerateParentChildInformation();
/// the corresponding template function based on the dimension of this dataset
VTKM_CONT
template <vtkm::IdComponent Dim>
void ComputeGenerateParentChildInformation();
/// generate the vtkGhostType array based on the overlap analogously to vtk
/// blanked cells: 8 normal cells: 0
VTKM_CONT
void GenerateGhostType();
/// the corresponding template function based on the dimension of this dataset
VTKM_CONT
template <vtkm::IdComponent Dim>
void ComputeGenerateGhostType();
/// Add helper arrays like in ParaView
VTKM_CONT
void GenerateIndexArrays();
/// the input partitioned dataset
vtkm::cont::PartitionedDataSet AmrDataSet;
/// per level
/// contains the partitionIds of each level and blockId
std::vector<std::vector<vtkm::Id>> PartitionIds;
/// per partitionId
/// contains all PartitonIds of the level above that have an overlap
std::vector<std::vector<vtkm::Id>> ParentsIdsVector;
/// per partitionId
/// contains all PartitonIds of the level below that have an overlap
std::vector<std::vector<vtkm::Id>> ChildrenIdsVector;
};
}
} // namespace vtkm::filter
#include <vtkm/filter/AmrArrays.hxx>
#endif //vtk_m_filter_AmrArrays_h

@ -9,6 +9,7 @@
##============================================================================
set(deprecated_headers
# AmrArrays.h
CellAverage.h
CellMeasures.h
CellSetConnectivity.h
@ -98,7 +99,6 @@ set(common_header_template_sources
vtkm_declare_headers(${common_header_template_sources})
set(extra_headers
AmrArrays.h
ContourTreeUniformAugmented.h
ContourTreeUniformDistributed.h
ContourTreeUniform.h
@ -112,7 +112,6 @@ set(extra_headers
)
set(extra_header_template_sources
AmrArrays.hxx
ContourTreeUniformAugmented.hxx
ContourTreeUniformDistributed.hxx
ContourTreeUniform.hxx
@ -198,6 +197,7 @@ add_subdirectory(field_conversion)
add_subdirectory(field_transform)
add_subdirectory(geometry_refinement)
add_subdirectory(mesh_info)
add_subdirectory(multi_block)
add_subdirectory(resampling)
add_subdirectory(vector_analysis)
add_subdirectory(zfp)

@ -7,13 +7,8 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_filter_AmrArrays_hxx
#define vtk_m_filter_AmrArrays_hxx
#include <vtkm/CellClassification.h>
#include <vtkm/RangeId.h>
#include <vtkm/RangeId2.h>
#include <vtkm/RangeId3.h>
#include <vtkm/Types.h>
#include <vtkm/cont/ArrayCopy.h>
#include <vtkm/cont/ArrayHandle.h>
@ -21,6 +16,7 @@
#include <vtkm/worklet/WorkletMapField.h>
#include <vtkm/worklet/WorkletMapTopology.h>
#include <vtkm/filter/multi_block/AmrArrays.h>
namespace vtkm
{
@ -84,9 +80,8 @@ namespace vtkm
{
namespace filter
{
inline VTKM_CONT AmrArrays::AmrArrays() {}
namespace multi_block
{
VTKM_CONT
void AmrArrays::GenerateParentChildInformation()
{
@ -300,10 +295,8 @@ void AmrArrays::GenerateIndexArrays()
}
}
template <typename DerivedPolicy>
vtkm::cont::PartitionedDataSet AmrArrays::PrepareForExecution(
const vtkm::cont::PartitionedDataSet& input,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
vtkm::cont::PartitionedDataSet AmrArrays::DoExecutePartitions(
const vtkm::cont::PartitionedDataSet& input)
{
this->AmrDataSet = input;
this->GenerateParentChildInformation();
@ -311,7 +304,6 @@ vtkm::cont::PartitionedDataSet AmrArrays::PrepareForExecution(
this->GenerateIndexArrays();
return this->AmrDataSet;
}
}
}
#endif
} // namespace multi_block
} // namespace filter
} // namespace vtkm

@ -0,0 +1,84 @@
//============================================================================
// 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_multi_block_AmrArrays_h
#define vtk_m_filter_multi_block_AmrArrays_h
#include <vtkm/cont/ErrorFilterExecution.h>
#include <vtkm/filter/NewFilter.h>
#include <vtkm/filter/multi_block/vtkm_filter_multi_block_export.h>
namespace vtkm
{
namespace filter
{
namespace multi_block
{
class VTKM_FILTER_MULTI_BLOCK_EXPORT AmrArrays : public vtkm::filter::NewFilter
{
private:
vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet&) override
{
throw vtkm::cont::ErrorFilterExecution("AmrArray only works for a PartitionedDataSet");
}
vtkm::cont::PartitionedDataSet DoExecutePartitions(
const vtkm::cont::PartitionedDataSet& input) override;
/// the list of ids contains all amrIds of the level above/below that have an overlap
VTKM_CONT
void GenerateParentChildInformation();
/// the corresponding template function based on the dimension of this dataset
VTKM_CONT
template <vtkm::IdComponent Dim>
void ComputeGenerateParentChildInformation();
/// generate the vtkGhostType array based on the overlap analogously to vtk
/// blanked cells: 8 normal cells: 0
VTKM_CONT
void GenerateGhostType();
/// the corresponding template function based on the dimension of this dataset
VTKM_CONT
template <vtkm::IdComponent Dim>
void ComputeGenerateGhostType();
/// Add helper arrays like in ParaView
VTKM_CONT
void GenerateIndexArrays();
/// the input partitioned dataset
vtkm::cont::PartitionedDataSet AmrDataSet;
/// per level
/// contains the partitionIds of each level and blockId
std::vector<std::vector<vtkm::Id>> PartitionIds;
/// per partitionId
/// contains all PartitonIds of the level above that have an overlap
std::vector<std::vector<vtkm::Id>> ParentsIdsVector;
/// per partitionId
/// contains all PartitonIds of the level below that have an overlap
std::vector<std::vector<vtkm::Id>> ChildrenIdsVector;
};
} // namespace multi_block
class VTKM_DEPRECATED(1.8, "Use vtkm::filter::multi_block::AmrArrays.") AmrArrays
: public vtkm::filter::multi_block::AmrArrays
{
using multi_block::AmrArrays::AmrArrays;
};
} // namesapce filter
} // namespace vtkm
#endif //vtk_m_filter_multi_block_AmrArrays_h

@ -0,0 +1,31 @@
##============================================================================
## 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.
##============================================================================
set(multi_block_headers
AmrArrays.h
)
set(multi_block_sources
AmrArrays.cxx
)
vtkm_library(
NAME vtkm_filter_multi_block
HEADERS ${multi_block_headers}
DEVICE_SOURCES ${multi_block_sources}
USE_VTKM_JOB_POOL
)
target_link_libraries(vtkm_filter_multi_block PUBLIC vtkm_worklet vtkm_filter_core)
target_link_libraries(vtkm_filter PUBLIC INTERFACE vtkm_filter_multi_block)
#-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
if (VTKm_ENABLE_TESTING)
add_subdirectory(testing)
endif ()

@ -0,0 +1,23 @@
##============================================================================
## 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.
##============================================================================
if (VTKm_ENABLE_RENDERING)
list(APPEND libraries vtkm_filter_multi_block vtkm_source vtkm_rendering vtkm_rendering_testing)
list(APPEND unit_tests
RenderTestAmrArrays.cxx
)
vtkm_unit_tests(
SOURCES ${unit_tests}
LIBRARIES ${libraries}
USE_VTKM_JOB_POOL
)
endif()

@ -38,7 +38,6 @@ if (VTKm_ENABLE_RENDERING)
list(APPEND libraries vtkm_rendering vtkm_rendering_testing)
list(APPEND unit_tests
RenderTestAmrArrays.cxx
RenderTestStreamline.cxx
)
endif()

@ -10,8 +10,8 @@
#include <vtkm/cont/PartitionedDataSet.h>
#include <vtkm/filter/AmrArrays.h>
#include <vtkm/filter/field_conversion/CellAverage.h>
#include <vtkm/filter/multi_block/AmrArrays.h>
#include <vtkm/source/Amr.h>
#include <vtkm/source/Wavelet.h>
@ -101,7 +101,7 @@ vtkm::cont::PartitionedDataSet Amr::Execute() const
}
// Generate helper arrays
vtkm::filter::AmrArrays amrArrays;
vtkm::filter::multi_block::AmrArrays amrArrays;
amrDataSet = amrArrays.Execute(amrDataSet);
return amrDataSet;

@ -32,7 +32,7 @@ vtkm_library(NAME vtkm_source
HEADERS ${headers}
)
target_link_libraries(vtkm_source PUBLIC vtkm_cont vtkm_filter_field_conversion)
target_link_libraries(vtkm_source PUBLIC vtkm_cont vtkm_filter_field_conversion vtkm_filter_multi_block)
#-----------------------------------------------------------------------------
if (VTKm_ENABLE_TESTING)