Commit 6a465e8b authored by Li-Ta Lo's avatar Li-Ta Lo
Browse files

tidy-up language usage

parent e48cc867
Pipeline #266349 passed with stage
in 0 seconds
......@@ -175,7 +175,7 @@ vtkm::cont::DataSet CleanGrid::GenerateOutput(const vtkm::cont::DataSet& inData,
//
// For filters that do not need to do interpolation for mapping fields, we provide an overload
// that does not take the extra arguments and just AddField.
auto mapper = [&, this](auto& outDataSet, const auto& f) {
auto mapper = [&](auto& outDataSet, const auto& f) {
DoMapField(outDataSet, f, *this, worklets);
};
return this->CreateResult(inData, outputCellSet, outputCoordinateSystems, mapper);
......
......@@ -332,7 +332,8 @@ private:
bool fastCheck, // If true, approximate distances are used
const BinLocator& binLocator, // Used to find nearby points
vtkm::cont::ArrayHandle<vtkm::Vec<T, 3>>& points, // coordinates, modified to merge close
vtkm::cont::ArrayHandle<vtkm::Id> indexNeighborMap) // identifies each neighbor group, updated
const vtkm::cont::ArrayHandle<vtkm::Id>&
indexNeighborMap) // identifies each neighbor group, updated
{
vtkm::cont::Invoker invoker;
......
......@@ -76,10 +76,10 @@ public:
public:
VTKM_CONT
RemoveUnusedPoints() {}
RemoveUnusedPoints() = default;
template <typename ShapeStorage, typename ConnectivityStorage, typename OffsetsStorage>
VTKM_CONT RemoveUnusedPoints(
VTKM_CONT explicit RemoveUnusedPoints(
const vtkm::cont::CellSetExplicit<ShapeStorage, ConnectivityStorage, OffsetsStorage>& inCellSet)
{
this->FindPointsStart();
......@@ -305,10 +305,7 @@ public:
VTKM_DEPRECATED_SUPPRESS_END
///@}
const vtkm::worklet::ScatterCounting& GetPointScatter() const
{
return *this->PointScatter.get();
}
const vtkm::worklet::ScatterCounting& GetPointScatter() const { return *this->PointScatter; }
private:
vtkm::cont::ArrayHandle<vtkm::IdComponent> MaskArray;
......
......@@ -36,8 +36,6 @@ public:
private:
VTKM_CONT
vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input) override;
std::string OutputFieldName;
};
}
}
......
......@@ -32,8 +32,7 @@ VTKM_CONT vtkm::cont::DataSet ImageConnectivity::DoExecute(const vtkm::cont::Dat
auto resolveType = [&](const auto& concrete) {
vtkm::worklet::connectivity::ImageConnectivity().Run(input.GetCellSet(), concrete, component);
};
const auto& fieldArray = field.GetData();
this->CastAndCallScalarField(fieldArray, resolveType);
this->CastAndCallScalarField(field, resolveType);
return this->CreateResultFieldPoint(input, this->GetOutputFieldName(), component);
}
......
......@@ -22,7 +22,7 @@ namespace
class TestCellSetConnectivity
{
public:
void TestTangleIsosurface() const
static void TestTangleIsosurface()
{
vtkm::Id3 dims(4, 4, 4);
vtkm::source::Tangle tangle(dims);
......@@ -49,7 +49,7 @@ public:
"Wrong number of connected components");
}
void TestExplicitDataSet() const
static void TestExplicitDataSet()
{
vtkm::cont::DataSet dataSet = vtkm::cont::testing::MakeTestDataSet().Make3DExplicitDataSet5();
......@@ -67,7 +67,7 @@ public:
"Wrong number of connected components");
}
void TestUniformDataSet() const
static void TestUniformDataSet()
{
vtkm::cont::DataSet dataSet = vtkm::cont::testing::MakeTestDataSet().Make3DUniformDataSet1();
vtkm::filter::connected_components::CellSetConnectivity connectivity;
......@@ -86,9 +86,9 @@ public:
void operator()() const
{
this->TestTangleIsosurface();
this->TestExplicitDataSet();
this->TestUniformDataSet();
TestCellSetConnectivity::TestTangleIsosurface();
TestCellSetConnectivity::TestExplicitDataSet();
TestCellSetConnectivity::TestUniformDataSet();
}
};
}
......
......@@ -27,8 +27,7 @@ vtkm::cont::DataSet MakeTestDataSet()
0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0,
};
vtkm::cont::DataSetBuilderUniform builder;
vtkm::cont::DataSet dataSet = builder.Create(vtkm::Id3(8, 8, 1));
vtkm::cont::DataSet dataSet = vtkm::cont::DataSetBuilderUniform::Create(vtkm::Id3(8, 8, 1));
dataSet.AddPointField("color", pixels);
......
......@@ -51,9 +51,9 @@ bool DoMapField(vtkm::cont::DataSet& result,
result.AddPointField(field.GetName(), outputArray);
};
auto inputArray = field.GetData();
inputArray.CastAndCallForTypesWithFloatFallback<vtkm::TypeListField, VTKM_DEFAULT_STORAGE_LIST>(
resolve);
field.GetData()
.CastAndCallForTypesWithFloatFallback<vtkm::TypeListField, VTKM_DEFAULT_STORAGE_LIST>(
resolve);
return true;
}
else if (field.IsFieldCell())
......@@ -77,7 +77,7 @@ bool DoMapField(vtkm::cont::DataSet& result,
//-----------------------------------------------------------------------------
vtkm::cont::DataSet ClipWithField::DoExecute(const vtkm::cont::DataSet& input)
{
auto field = this->GetFieldFromDataSet(input);
const auto& field = this->GetFieldFromDataSet(input);
if (!field.IsFieldPoint())
{
throw vtkm::cont::ErrorFilterExecution("Point field expected.");
......@@ -88,7 +88,7 @@ vtkm::cont::DataSet ClipWithField::DoExecute(const vtkm::cont::DataSet& input)
const vtkm::cont::UnknownCellSet& inputCellSet = input.GetCellSet();
vtkm::cont::CellSetExplicit<> outputCellSet;
auto resolveFieldType = [&, this](const auto& concrete) {
auto resolveFieldType = [&](const auto& concrete) {
outputCellSet = worklet.Run(inputCellSet, concrete, this->ClipValue, this->Invert);
};
this->CastAndCallScalarField(this->GetFieldFromDataSet(input).GetData(), resolveFieldType);
......
......@@ -51,9 +51,9 @@ bool DoMapField(vtkm::cont::DataSet& result,
result.AddPointField(field.GetName(), outputArray);
};
auto inputArray = field.GetData();
inputArray.CastAndCallForTypesWithFloatFallback<vtkm::TypeListField, VTKM_DEFAULT_STORAGE_LIST>(
resolve);
field.GetData()
.CastAndCallForTypesWithFloatFallback<vtkm::TypeListField, VTKM_DEFAULT_STORAGE_LIST>(
resolve);
return true;
}
else if (field.IsFieldCell())
......
......@@ -46,14 +46,13 @@ VTKM_CONT bool DoMapField(vtkm::cont::DataSet& result,
{
if (field.IsFieldPoint())
{
auto array = field.GetData();
auto functor = [&](const auto& concrete) {
auto fieldArray = worklet.ProcessPointField(concrete);
result.AddPointField(field.GetName(), fieldArray);
};
array.CastAndCallForTypesWithFloatFallback<vtkm::TypeListField, VTKM_DEFAULT_STORAGE_LIST>(
functor);
field.GetData()
.CastAndCallForTypesWithFloatFallback<vtkm::TypeListField, VTKM_DEFAULT_STORAGE_LIST>(
functor);
return true;
}
else if (field.IsFieldCell())
......@@ -110,8 +109,6 @@ vtkm::cont::DataSet Contour::DoExecute(const vtkm::cont::DataSet& inDataSet)
const vtkm::cont::CoordinateSystem& inputCoords =
inDataSet.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
const auto& fieldArray = this->GetFieldFromDataSet(inDataSet).GetData();
using Vec3HandleType = vtkm::cont::ArrayHandle<vtkm::Vec3f>;
Vec3HandleType vertices;
Vec3HandleType normals;
......@@ -122,7 +119,7 @@ vtkm::cont::DataSet Contour::DoExecute(const vtkm::cont::DataSet& inDataSet)
? !this->ComputeFastNormalsForStructured
: !this->ComputeFastNormalsForUnstructured;
auto resolveFieldType = [&, this](const auto& concrete) {
auto resolveFieldType = [&](const auto& concrete) {
// use std::decay to remove const ref from the decltype of concrete.
using T = typename std::decay_t<decltype(concrete)>::ValueType;
std::vector<T> ivalues(this->IsoValues.size());
......@@ -142,8 +139,10 @@ vtkm::cont::DataSet Contour::DoExecute(const vtkm::cont::DataSet& inDataSet)
}
};
fieldArray.CastAndCallForTypesWithFloatFallback<SupportedTypes, VTKM_DEFAULT_STORAGE_LIST>(
resolveFieldType);
this->GetFieldFromDataSet(inDataSet)
.GetData()
.CastAndCallForTypesWithFloatFallback<SupportedTypes, VTKM_DEFAULT_STORAGE_LIST>(
resolveFieldType);
auto mapper = [&](auto& result, const auto& f) { DoMapField(result, f, worklet); };
vtkm::cont::DataSet output = this->CreateResult(
......
......@@ -29,10 +29,9 @@ vtkm::cont::DataSet Slice::DoExecute(const vtkm::cont::DataSet& input)
vtkm::cont::make_ArrayHandleTransform(coords.GetDataAsMultiplexer(), impFuncEval);
vtkm::cont::ArrayHandle<vtkm::FloatDefault> sliceScalars;
vtkm::cont::ArrayCopyDevice(coordTransform, sliceScalars);
auto field = vtkm::cont::make_FieldPoint("sliceScalars", sliceScalars);
// input is a const, we can not AddField to it.
vtkm::cont::DataSet clone = input;
clone.AddField(field);
clone.AddField(vtkm::cont::make_FieldPoint("sliceScalars", sliceScalars));
this->Contour::SetIsoValue(0.0);
this->Contour::SetActiveField("sliceScalars");
......
......@@ -10,24 +10,25 @@
set(headers
Clip.h
CommonState.h
contour/CommonState.h
Contour.h
FieldPropagation.h
FlyingEdges.h
FlyingEdgesHelpers.h
FlyingEdgesPass1.h
FlyingEdgesPass2.h
FlyingEdgesPass4.h
FlyingEdgesPass4Common.h
FlyingEdgesPass4X.h
FlyingEdgesPass4XWithNormals.h
FlyingEdgesPass4Y.h
FlyingEdgesTables.h
MarchingCellTables.h
MarchingCells.h
contour/FieldPropagation.h
contour/FlyingEdges.h
contour/FlyingEdgesHelpers.h
contour/FlyingEdgesPass1.h
contour/FlyingEdgesPass2.h
contour/FlyingEdgesPass4.h
contour/FlyingEdgesPass4Common.h
contour/FlyingEdgesPass4X.h
contour/FlyingEdgesPass4XWithNormals.h
contour/FlyingEdgesPass4Y.h
contour/FlyingEdgesTables.h
contour/MarchingCellTables.h
contour/MarchingCells.h
)
add_subdirectory(clip)
add_subdirectory(contour)
#-----------------------------------------------------------------------------
vtkm_declare_headers(${headers})
......@@ -15,10 +15,10 @@
#include <vtkm/cont/ArrayHandlePermutation.h>
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
#include <vtkm/filter/contour/worklet/CommonState.h>
#include <vtkm/filter/contour/worklet/FieldPropagation.h>
#include <vtkm/filter/contour/worklet/FlyingEdges.h>
#include <vtkm/filter/contour/worklet/MarchingCells.h>
#include <vtkm/filter/contour/worklet/contour/CommonState.h>
#include <vtkm/filter/contour/worklet/contour/FieldPropagation.h>
#include <vtkm/filter/contour/worklet/contour/FlyingEdges.h>
#include <vtkm/filter/contour/worklet/contour/MarchingCells.h>
namespace vtkm
......
##============================================================================
## 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(headers
CommonState.h
FieldPropagation.h
FlyingEdges.h
FlyingEdgesHelpers.h
FlyingEdgesPass1.h
FlyingEdgesPass2.h
FlyingEdgesPass4.h
FlyingEdgesPass4Common.h
FlyingEdgesPass4X.h
FlyingEdgesPass4XWithNormals.h
FlyingEdgesPass4Y.h
FlyingEdgesTables.h
MarchingCellTables.h
MarchingCells.h
)
#-----------------------------------------------------------------------------
vtkm_declare_headers(${headers})
......@@ -12,10 +12,10 @@
#ifndef vtk_m_worklet_contour_flyingedges_h
#define vtk_m_worklet_contour_flyingedges_h
#include <vtkm/filter/contour/worklet/FlyingEdgesHelpers.h>
#include <vtkm/filter/contour/worklet/FlyingEdgesPass1.h>
#include <vtkm/filter/contour/worklet/FlyingEdgesPass2.h>
#include <vtkm/filter/contour/worklet/FlyingEdgesPass4.h>
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesHelpers.h>
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesPass1.h>
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesPass2.h>
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesPass4.h>
#include <vtkm/cont/Algorithm.h>
#include <vtkm/cont/ArrayHandleGroupVec.h>
......
......@@ -13,7 +13,7 @@
#ifndef vtk_m_worklet_contour_flyingedges_pass1_h
#define vtk_m_worklet_contour_flyingedges_pass1_h
#include <vtkm/filter/contour/worklet/FlyingEdgesHelpers.h>
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesHelpers.h>
#include <vtkm/worklet/WorkletMapTopology.h>
namespace vtkm
......
......@@ -13,8 +13,8 @@
#ifndef vtk_m_worklet_contour_flyingedges_pass2_h
#define vtk_m_worklet_contour_flyingedges_pass2_h
#include <vtkm/filter/contour/worklet/FlyingEdgesHelpers.h>
#include <vtkm/filter/contour/worklet/FlyingEdgesTables.h>
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesHelpers.h>
#include <vtkm/filter/contour/worklet/contour/FlyingEdgesTables.h>
namespace vtkm
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment