mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Store constant AMR arrays with less memory
The `AmrArrays` filter generates some cell fields that specify information about the hierarchy, which are constant across all cells in a partition. These were previously stored as an array with the same value throughout. Now, the field is stored as an `ArrayHandleConstant`, which does not require any real storage. Recent changes to VTK-m allow code to extract the array as a component efficiently without knowing the storage type. Fixes #794
This commit is contained in:
parent
bd7ac82411
commit
7992e1b6bf
8
docs/changelog/constant-amr-arrays.md
Normal file
8
docs/changelog/constant-amr-arrays.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Store constant AMR arrays with less memory
|
||||
|
||||
The `AmrArrays` filter generates some cell fields that specify information
|
||||
about the hierarchy, which are constant across all cells in a partition.
|
||||
These were previously stored as an array with the same value throughout.
|
||||
Now, the field is stored as an `ArrayHandleConstant`, which does not
|
||||
require any real storage. Recent changes to VTK-m allow code to extract the
|
||||
array as a component efficiently without knowing the storage type.
|
@ -274,21 +274,15 @@ void AmrArrays::GenerateIndexArrays()
|
||||
{
|
||||
vtkm::cont::DataSet partition = this->AmrDataSet.GetPartition(this->PartitionIds.at(l).at(b));
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> fieldAmrLevel;
|
||||
vtkm::cont::ArrayCopy(
|
||||
vtkm::cont::ArrayHandleConstant<vtkm::Id>(l, partition.GetNumberOfCells()), fieldAmrLevel);
|
||||
partition.AddCellField("vtkAmrLevel", fieldAmrLevel);
|
||||
partition.AddCellField(
|
||||
"vtkAmrLevel", vtkm::cont::ArrayHandleConstant<vtkm::Id>(l, partition.GetNumberOfCells()));
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> fieldBlockId;
|
||||
vtkm::cont::ArrayCopy(
|
||||
vtkm::cont::ArrayHandleConstant<vtkm::Id>(b, partition.GetNumberOfCells()), fieldBlockId);
|
||||
partition.AddCellField("vtkAmrIndex", fieldBlockId);
|
||||
partition.AddCellField(
|
||||
"vtkAmrIndex", vtkm::cont::ArrayHandleConstant<vtkm::Id>(b, partition.GetNumberOfCells()));
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Id> fieldPartitionIndex;
|
||||
vtkm::cont::ArrayCopy(vtkm::cont::ArrayHandleConstant<vtkm::Id>(
|
||||
this->PartitionIds.at(l).at(b), partition.GetNumberOfCells()),
|
||||
fieldPartitionIndex);
|
||||
partition.AddCellField("vtkCompositeIndex", fieldPartitionIndex);
|
||||
partition.AddCellField("vtkCompositeIndex",
|
||||
vtkm::cont::ArrayHandleConstant<vtkm::Id>(
|
||||
this->PartitionIds.at(l).at(b), partition.GetNumberOfCells()));
|
||||
|
||||
this->AmrDataSet.ReplacePartition(this->PartitionIds.at(l).at(b), partition);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user