Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Update agasint vtkm v1.8 #238

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/vtkh/DataSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ DataSet::AddConstantPointField(const vtkm::Float32 value, const std::string fiel
vtkm::Id num_points = m_domains[i].GetCoordinateSystem().GetData().GetNumberOfValues();
vtkm::cont::ArrayHandle<vtkm::Float32> array;
detail::MemSet(array, value, num_points);
vtkm::cont::Field field(fieldname, vtkm::cont::Field::Association::POINTS, array);
vtkm::cont::Field field(fieldname, vtkm::cont::Field::Association::Points, array);
m_domains[i].AddField(field);
}
}
Expand Down Expand Up @@ -734,7 +734,7 @@ DataSet::GetFieldAssociation(const std::string field_name, bool &valid_field) co
if(!this->GlobalFieldExists(field_name))
{
valid_field = false;
return vtkm::cont::Field::Association::ANY;
return vtkm::cont::Field::Association::Any;
}

int assoc_id = -1;
Expand All @@ -750,19 +750,19 @@ DataSet::GetFieldAssociation(const std::string field_name, bool &valid_field) co
if(dom.HasField(field_name))
{
local_assoc = dom.GetField(field_name).GetAssociation();
if(local_assoc == vtkm::cont::Field::Association::ANY)
if(local_assoc == vtkm::cont::Field::Association::Any)
{
assoc_id = 0;
}
else if ( local_assoc == vtkm::cont::Field::Association::WHOLE_MESH)
else if ( local_assoc == vtkm::cont::Field::Association::WholeMesh)
{
assoc_id = 1;
}
else if ( local_assoc == vtkm::cont::Field::Association::POINTS)
else if ( local_assoc == vtkm::cont::Field::Association::Points)
{
assoc_id = 2;
}
else if ( local_assoc == vtkm::cont::Field::Association::CELL_SET)
else if ( local_assoc == vtkm::cont::Field::Association::Cells)
{
assoc_id = 3;
}
Expand Down Expand Up @@ -813,19 +813,19 @@ DataSet::GetFieldAssociation(const std::string field_name, bool &valid_field) co

if(assoc_id == 0)
{
assoc = vtkm::cont::Field::Association::ANY;
assoc = vtkm::cont::Field::Association::Any;
}
else if ( assoc_id == 1)
{
assoc = vtkm::cont::Field::Association::WHOLE_MESH;
assoc = vtkm::cont::Field::Association::WholeMesh;
}
else if ( assoc_id == 2)
{
assoc = vtkm::cont::Field::Association::POINTS;
assoc = vtkm::cont::Field::Association::Points;
}
else if ( assoc_id == 3)
{
assoc = vtkm::cont::Field::Association::CELL_SET;
assoc = vtkm::cont::Field::Association::Cells;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/vtkh/filters/Clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ void Clip::DoExecute()
.Invoke(dom.GetCoordinateSystem().GetData(), clip_field);

dom.AddField(vtkm::cont::Field(fname,
vtkm::cont::Field::Association::POINTS,
vtkm::cont::Field::Association::Points,
clip_field));
} // each domain

Expand Down
4 changes: 2 additions & 2 deletions src/vtkh/filters/ClipField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ void ClipField::DoExecute()

bool valid_field = false;
bool is_cell_assoc = m_input->GetFieldAssociation(m_field_name, valid_field) ==
vtkm::cont::Field::Association::CELL_SET;
vtkm::cont::Field::Association::Cells;
bool delete_input = false;
if(valid_field && is_cell_assoc)
{
Recenter recenter;
recenter.SetInput(m_input);
recenter.SetField(m_field_name);
recenter.SetResultAssoc(vtkm::cont::Field::Association::POINTS);
recenter.SetResultAssoc(vtkm::cont::Field::Association::Points);
recenter.Update();
this->m_input = recenter.GetOutput();
delete_input = true;
Expand Down
8 changes: 4 additions & 4 deletions src/vtkh/filters/CompositeVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ namespace detail
std::string to_string(vtkm::cont::Field::Association assoc)
{
std::string res = "unknown";
if(assoc == vtkm::cont::Field::Association::WHOLE_MESH)
if(assoc == vtkm::cont::Field::Association::WholeMesh)
{
res = "whole mesh";
}
else if(assoc == vtkm::cont::Field::Association::ANY)
else if(assoc == vtkm::cont::Field::Association::Any)
{
res = "any";
}
else if(assoc == vtkm::cont::Field::Association::POINTS)
else if(assoc == vtkm::cont::Field::Association::Points)
{
res = "points";
}
else if(assoc == vtkm::cont::Field::Association::CELL_SET)
else if(assoc == vtkm::cont::Field::Association::Cells)
{
res = "cell set";
}
Expand Down
8 changes: 4 additions & 4 deletions src/vtkh/filters/GhostStripper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ bool StructuredStrip(vtkm::cont::DataSet &dataset,
bool &should_strip)
{
VTKH_DATA_OPEN("structured_strip");
vtkm::cont::DynamicCellSet cell_set = dataset.GetCellSet();
vtkm::cont::UnknownCellSet cell_set = dataset.GetCellSet();
int dims[3];
VTKMDataSetInfo::GetPointDims(cell_set, dims);
vtkm::Vec<vtkm::Id,3> cell_dims(0,0,0);
Expand All @@ -293,7 +293,7 @@ bool StructuredStrip(vtkm::cont::DataSet &dataset,
bool can_strip = false;
vtkm::Id size = 0;
should_strip = false;
if(cell_set.IsSameType(vtkm::cont::CellSetStructured<1>()))
if(cell_set.CanConvert<vtkm::cont::CellSetStructured<1>>())
{
cell_dims[0] = dims[0] - 1;
size = cell_dims[0];
Expand All @@ -307,7 +307,7 @@ bool StructuredStrip(vtkm::cont::DataSet &dataset,
size,
should_strip);
}
else if(cell_set.IsSameType(vtkm::cont::CellSetStructured<2>()))
else if(cell_set.CanConvert<vtkm::cont::CellSetStructured<2>>())
{
cell_dims[0] = dims[0] - 1;
cell_dims[1] = dims[1] - 1;
Expand All @@ -322,7 +322,7 @@ bool StructuredStrip(vtkm::cont::DataSet &dataset,
size,
should_strip);
}
else if(cell_set.IsSameType(vtkm::cont::CellSetStructured<3>()))
else if(cell_set.CanConvert<vtkm::cont::CellSetStructured<3>>())
{
cell_dims[0] = dims[0] - 1;
cell_dims[1] = dims[1] - 1;
Expand Down
4 changes: 2 additions & 2 deletions src/vtkh/filters/Gradient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ void Gradient::DoExecute()
// make sure we have a node-centered field
bool valid_field = false;
bool is_cell_assoc = m_input->GetFieldAssociation(m_field_name, valid_field) ==
vtkm::cont::Field::Association::CELL_SET;
vtkm::cont::Field::Association::Cells;
bool delete_input = false;

if(valid_field && is_cell_assoc)
{
Recenter recenter;
recenter.SetInput(m_input);
recenter.SetField(m_field_name);
recenter.SetResultAssoc(vtkm::cont::Field::Association::POINTS);
recenter.SetResultAssoc(vtkm::cont::Field::Association::Points);
recenter.Update();
m_input = recenter.GetOutput();
delete_input = true;
Expand Down
2 changes: 1 addition & 1 deletion src/vtkh/filters/HistSampling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ void HistSampling::DoExecute()
vtkm::cont::ArrayHandle <vtkm::Float32> output;
vtkm::cont::Algorithm ::Copy(stencilBool , output );

if(assoc == vtkm::cont::Field::Association::POINTS)
if(assoc == vtkm::cont::Field::Association::Points)
{
dom.AddPointField("valSampled", output);
}
Expand Down
5 changes: 4 additions & 1 deletion src/vtkh/filters/Histogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
#include <vtkh/Logger.hpp>
#include <vtkh/utils/vtkm_array_utils.hpp>

#include <vtkm/worklet/FieldHistogram.h>
//TODO: Header for new Histogram filter
//#include <vtkm/filter/density_estimate/Histogram.h>
#include <vtkm/filter/density_estimate/worklet/FieldHistogram.h>

#ifdef VTKH_PARALLEL
#include <mpi.h>
Expand Down Expand Up @@ -31,6 +33,7 @@ struct HistoFunctor
T min_range = static_cast<T>(m_range.Min);
T max_range = static_cast<T>(m_range.Max);

//TODO:Rewrite using vtkm::filter::density_estimate::Histogram
vtkm::worklet::FieldHistogram worklet;
worklet.Run(array,m_num_bins,min_range,max_range,bin_delta,m_bins);
m_bin_delta = static_cast<vtkm::Float64>(bin_delta);
Expand Down
4 changes: 2 additions & 2 deletions src/vtkh/filters/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ void Log::DoExecute()
}

vtkm::cont::Field::Association in_assoc = dom.GetField(m_field_name).GetAssociation();
bool is_cell_assoc = in_assoc == vtkm::cont::Field::Association::CELL_SET;
bool is_point_assoc = in_assoc == vtkm::cont::Field::Association::POINTS;
bool is_cell_assoc = in_assoc == vtkm::cont::Field::Association::Cells;
bool is_point_assoc = in_assoc == vtkm::cont::Field::Association::Points;

if(!is_cell_assoc && !is_point_assoc)
{
Expand Down
4 changes: 2 additions & 2 deletions src/vtkh/filters/MarchingCubes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ void MarchingCubes::DoExecute()
// make sure we have a node-centered field
bool valid_field = false;
bool is_cell_assoc = m_input->GetFieldAssociation(m_field_name, valid_field) ==
vtkm::cont::Field::Association::CELL_SET;
vtkm::cont::Field::Association::Cells;
bool delete_input = false;
if(valid_field && is_cell_assoc)
{
Recenter recenter;
recenter.SetInput(m_input);
recenter.SetField(m_field_name);
recenter.SetResultAssoc(vtkm::cont::Field::Association::POINTS);
recenter.SetResultAssoc(vtkm::cont::Field::Association::Points);
recenter.Update();
m_input = recenter.GetOutput();
delete_input = true;
Expand Down
4 changes: 2 additions & 2 deletions src/vtkh/filters/MeshQuality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace vtkh
{

MeshQuality::MeshQuality()
: m_metric(vtkm::filter::CellMetric::VOLUME)
: m_metric(vtkm::filter::mesh_info::CellMetric::Volume)
{

}
Expand All @@ -17,7 +17,7 @@ MeshQuality::~MeshQuality()

}

void MeshQuality::cell_metric(vtkm::filter::CellMetric metric)
void MeshQuality::cell_metric(vtkm::filter::mesh_info::CellMetric metric)
{
m_metric = metric;
}
Expand Down
6 changes: 3 additions & 3 deletions src/vtkh/filters/MeshQuality.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <vtkh/vtkh.hpp>
#include <vtkh/filters/Filter.hpp>
#include <vtkh/DataSet.hpp>
#include <vtkm/filter/MeshQuality.h>
#include <vtkm/filter/mesh_info/MeshQuality.h>

namespace vtkh
{
Expand All @@ -17,13 +17,13 @@ class VTKH_API MeshQuality: public Filter
virtual ~MeshQuality();
std::string GetName() const override;

void cell_metric(vtkm::filter::CellMetric metric);
void cell_metric(vtkm::filter::mesh_info::CellMetric metric);

protected:
void PreExecute() override;
void PostExecute() override;
void DoExecute() override;
vtkm::filter::CellMetric m_metric;
vtkm::filter::mesh_info::CellMetric m_metric;
};

} //namespace vtkh
Expand Down
5 changes: 4 additions & 1 deletion src/vtkh/filters/ParticleMerging.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include <vtkm/worklet/PointMerge.h>
#include <vtkm/filter/clean_grid/worklet/PointMerge.h>
//TODO: Header for wrapped filter
//#include <vtkm/filter/clean_grid/CleanGrid.h>
#include <vtkh/Error.hpp>
#include <vtkh/filters/ParticleMerging.hpp>

Expand Down Expand Up @@ -68,6 +70,7 @@ void ParticleMerging::DoExecute()
vtkm::Bounds bounds = dom.GetCoordinateSystem().GetBounds();

bool fast_merge = true;
//TODO:Rewrite using vtkm::filter::clean_grid::CleanGrid
vtkm::worklet::PointMerge merger;
merger.Run(m_radius * 2. , fast_merge, bounds, coords);
vtkm::cont::CoordinateSystem mcoords = vtkm::cont::CoordinateSystem(coords_name, coords);
Expand Down
2 changes: 1 addition & 1 deletion src/vtkh/filters/PointAverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void PointAverage::DoExecute()
continue;
}

vtkm::filter::PointAverage avg;
vtkm::filter::field_conversion::PointAverage avg;
avg.SetOutputFieldName(m_output_field_name);
avg.SetActiveField(m_field_name);
avg.SetFieldsToPass(this->GetFieldSelection());
Expand Down
14 changes: 7 additions & 7 deletions src/vtkh/filters/Recenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace vtkh
{

Recenter::Recenter()
: m_assoc(vtkm::cont::Field::Association::POINTS)
: m_assoc(vtkm::cont::Field::Association::Points)
{

}
Expand Down Expand Up @@ -38,8 +38,8 @@ void Recenter::PostExecute()
void Recenter::SetResultAssoc(vtkm::cont::Field::Association assoc)
{

if(assoc != vtkm::cont::Field::Association::CELL_SET &&
assoc != vtkm::cont::Field::Association::POINTS)
if(assoc != vtkm::cont::Field::Association::Cells &&
assoc != vtkm::cont::Field::Association::Points)
{
throw Error("Recenter can only recenter zonal and nodal fields");
}
Expand Down Expand Up @@ -86,15 +86,15 @@ void Recenter::DoExecute()
temp.AddCoordinateSystem(coords);
}

vtkm::cont::DynamicCellSet cellset = dom.GetCellSet();
vtkm::cont::UnknownCellSet cellset = dom.GetCellSet();
out_data.SetCellSet(cellset);
temp.SetCellSet(cellset);

if(temp.HasField(m_field_name))
{
vtkm::cont::Field::Association in_assoc = temp.GetField(m_field_name).GetAssociation();
bool is_cell_assoc = in_assoc == vtkm::cont::Field::Association::CELL_SET;
bool is_point_assoc = in_assoc == vtkm::cont::Field::Association::POINTS;
bool is_cell_assoc = in_assoc == vtkm::cont::Field::Association::Cells;
bool is_point_assoc = in_assoc == vtkm::cont::Field::Association::Points;

if(!is_cell_assoc && !is_point_assoc)
{
Expand All @@ -114,7 +114,7 @@ void Recenter::DoExecute()
}
else
{
vtkm::filter::CellAverage avg;
vtkm::filter::field_conversion::CellAverage avg;
avg.SetOutputFieldName(out_name);
avg.SetActiveField(m_field_name);
dataset = avg.Execute(dom);
Expand Down
18 changes: 9 additions & 9 deletions src/vtkh/filters/Slice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ class MergeContours
{
//check to see if this is a supported field ;
const vtkm::cont::Field &scalar_field = m_in_data_sets[0].GetField(m_field_index);
bool is_supported = (scalar_field.GetAssociation() == vtkm::cont::Field::Association::POINTS ||
scalar_field.GetAssociation() == vtkm::cont::Field::Association::CELL_SET);
bool is_supported = (scalar_field.GetAssociation() == vtkm::cont::Field::Association::Points ||
scalar_field.GetAssociation() == vtkm::cont::Field::Association::Cells);

if(!is_supported) return;

bool assoc_points = scalar_field.GetAssociation() == vtkm::cont::Field::Association::POINTS;
bool assoc_points = scalar_field.GetAssociation() == vtkm::cont::Field::Association::Points;
vtkm::cont::ArrayHandle<T> out;
if(assoc_points)
{
Expand Down Expand Up @@ -221,8 +221,8 @@ class MergeContours
// of contour is now explicit cell set,but we can still assume that
// this output will be all triangles.
// this becomes more complicated if we want to support mixed types
//if(!cell_set.IsSameType(vtkm::cont::CellSetSingleType<>())) continue;
if(!cell_set.IsSameType(vtkm::cont::CellSetExplicit<>()))
//if(!cell_set.CanConvert(vtkm::cont::CellSetSingleType<>())) continue;
if(!cell_set.CanConvert<vtkm::cont::CellSetExplicit<>>())
{
std::cout<<"expected explicit cell set as the result of contour\n";

Expand Down Expand Up @@ -255,8 +255,8 @@ class MergeContours
{
auto cell_set = doms[dom].GetCellSet();

//if(!cell_set.IsSameType(vtkm::cont::CellSetSingleType<>())) continue;
if(!cell_set.IsSameType(vtkm::cont::CellSetExplicit<>()))
//if(!cell_set.CanConvert(vtkm::cont::CellSetSingleType<>())) continue;
if(!cell_set.CanConvert<vtkm::cont::CellSetExplicit<>>())
{
std::cout<<"expected explicit cell set as the result of contour\n";
continue;
Expand All @@ -265,7 +265,7 @@ class MergeContours
// grab the connectivity and copy it into the larger array
//vtkm::cont::CellSetSingleType<> single_type = cell_set.Cast<vtkm::cont::CellSetSingleType<>>();
vtkm::cont::CellSetExplicit<> single_type =
cell_set.Cast<vtkm::cont::CellSetExplicit<>>();
cell_set.AsCellSet<vtkm::cont::CellSetExplicit<>>();
const vtkm::cont::ArrayHandle<vtkm::Id> dconn = single_type.GetConnectivityArray(
vtkm::TopologyElementTagCell(),
vtkm::TopologyElementTagPoint());
Expand Down Expand Up @@ -412,7 +412,7 @@ Slice::DoExecute()
.Invoke(dom.GetCoordinateSystem().GetData(), slice_field);

dom.AddField(vtkm::cont::Field(fname,
vtkm::cont::Field::Association::POINTS,
vtkm::cont::Field::Association::Points,
slice_field));
} // each domain

Expand Down
Loading