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

rename MarchingCubes to Contour

parent fea2ccac
......@@ -153,7 +153,7 @@ inputData.GetPointField(fieldName).GetRange(&range);
vtkm::Float64 isovalue = range.Center();
// Create an isosurface filter
vtkm::filter::MarchingCubes filter;
vtkm::filter::Contour filter;
filter.SetIsoValue(0, isovalue);
filter.SetActiveField(fieldName);
vtkm::cont::DataSet outputData = filter.Execute(inputData);
......
......@@ -30,10 +30,10 @@
#include <vtkm/cont/internal/OptionParser.h>
#include <vtkm/filter/CellAverage.h>
#include <vtkm/filter/Contour.h>
#include <vtkm/filter/ExternalFaces.h>
#include <vtkm/filter/FieldSelection.h>
#include <vtkm/filter/Gradient.h>
#include <vtkm/filter/MarchingCubes.h>
#include <vtkm/filter/PointAverage.h>
#include <vtkm/filter/PolicyBase.h>
#include <vtkm/filter/Tetrahedralize.h>
......
......@@ -22,7 +22,7 @@
#include <vtkm/io/reader/VTKDataSetReader.h>
#include <vtkm/cont/DataSetFieldAdd.h>
#include <vtkm/filter/MarchingCubes.h>
#include <vtkm/filter/Contour.h>
#include <iostream>
......@@ -64,7 +64,7 @@ int main(int argc, char* argv[])
}
else
{
std::cout << "using: " << argv[1] << " as MarchingCubes input file" << std::endl;
std::cout << "using: " << argv[1] << " as Contour input file" << std::endl;
vtkm::io::reader::VTKDataSetReader reader(argv[1]);
inputData = reader.ReadDataSet();
isovalue = static_cast<vtkm::Float32>(atof(argv[2]));
......@@ -110,14 +110,14 @@ int main(int argc, char* argv[])
view.SaveAs("demo_input.pnm");
// Create an isosurface filter
vtkm::filter::MarchingCubes filter;
vtkm::filter::Contour filter;
filter.SetGenerateNormals(false);
filter.SetMergeDuplicatePoints(false);
filter.SetIsoValue(0, isovalue);
filter.SetActiveField(fieldName);
vtkm::cont::DataSet outputData = filter.Execute(inputData);
// Render a separate image with the output isosurface
std::cout << "about to render the results of the MarchingCubes filter" << std::endl;
std::cout << "about to render the results of the Contour filter" << std::endl;
vtkm::rendering::Scene scene2;
makeScene(outputData, colorTable, fieldName, scene2);
......
......@@ -8,7 +8,7 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/filter/MarchingCubes.h>
#include <vtkm/filter/Contour.h>
#include <vtkm/filter/Tetrahedralize.h>
#include <vtkm/worklet/DispatcherMapField.h>
......@@ -236,7 +236,7 @@ int main(int argc, char* argv[])
vtkm::filter::Tetrahedralize tetrahedralize;
vtkm::cont::DataSet tetra = tetrahedralize.Execute(dataSet);
vtkm::filter::MarchingCubes filter;
vtkm::filter::Contour filter;
filter.SetGenerateNormals(true);
filter.SetMergeDuplicatePoints(false);
filter.SetIsoValue(0, 0.1);
......
......@@ -8,7 +8,7 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/filter/MarchingCubes.h>
#include <vtkm/filter/Contour.h>
#include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/Math.h>
......@@ -232,7 +232,7 @@ int main(int argc, char* argv[])
vtkm::cont::DataSet dataSet = MakeIsosurfaceTestDataSet(dims);
vtkm::filter::MarchingCubes filter;
vtkm::filter::Contour filter;
filter.SetGenerateNormals(true);
filter.SetMergeDuplicatePoints(false);
filter.SetIsoValue(0, 0.1);
......
......@@ -9,7 +9,7 @@
//============================================================================
#include <vtkm/filter/ClipWithImplicitFunction.h>
#include <vtkm/filter/MarchingCubes.h>
#include <vtkm/filter/Contour.h>
#include <vtkm/io/writer/VTKDataSetWriter.h>
#include <vtkm/worklet/DispatcherMapField.h>
......@@ -239,7 +239,7 @@ int main(int argc, char* argv[])
clip.SetImplicitFunction(vtkm::cont::make_ImplicitFunctionHandle(plane));
vtkm::cont::DataSet clipped = clip.Execute(dataSet);
vtkm::filter::MarchingCubes filter;
vtkm::filter::Contour filter;
filter.SetGenerateNormals(true);
filter.SetMergeDuplicatePoints(false);
filter.SetIsoValue(0, 0.5);
......
......@@ -7,7 +7,7 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/filter/MarchingCubes.h>
#include <vtkm/filter/Contour.h>
#include <vtkm/io/reader/VTKDataSetReader.h>
#include <vtkm/io/writer/VTKDataSetWriter.h>
#include <vtkm/worklet/DispatcherMapField.h>
......
......@@ -11,7 +11,7 @@
#include <vtkm/cont/ArrayHandleStreaming.h>
#include <vtkm/cont/Initialize.h>
#include <vtkm/cont/Logging.h> //for GetHumanReadableSize
#include <vtkm/filter/MarchingCubes.h>
#include <vtkm/filter/Contour.h>
#include <vtkm/worklet/DispatcherMapField.h>
#include <vtkm/worklet/DispatcherStreamingMapField.h>
......
......@@ -40,7 +40,7 @@ set(headers
Histogram.h
ImageConnectivity.h
Lagrangian.h
MarchingCubes.h
Contour.h
Mask.h
MaskPoints.h
MeshQuality.h
......@@ -103,7 +103,7 @@ set(header_template_sources
Histogram.hxx
ImageConnectivity.hxx
Lagrangian.hxx
MarchingCubes.hxx
Contour.hxx
Mask.hxx
MaskPoints.hxx
MeshQuality.hxx
......
......@@ -8,11 +8,11 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_filter_MarchingCubes_h
#define vtk_m_filter_MarchingCubes_h
#ifndef vtk_m_filter_Contour_h
#define vtk_m_filter_Contour_h
#include <vtkm/filter/FilterDataSetWithField.h>
#include <vtkm/worklet/MarchingCubes.h>
#include <vtkm/worklet/Contour.h>
namespace vtkm
{
......@@ -25,11 +25,11 @@ namespace filter
/// Multiple contour values must be specified to generate the isosurfaces.
/// @warning
/// This filter is currently only supports 3D volumes.
class MarchingCubes : public vtkm::filter::FilterDataSetWithField<MarchingCubes>
class Contour : public vtkm::filter::FilterDataSetWithField<Contour>
{
public:
VTKM_CONT
MarchingCubes();
Contour();
VTKM_CONT
void SetNumberOfIsoValues(vtkm::Id num);
......@@ -115,11 +115,11 @@ private:
bool ComputeFastNormalsForStructured;
bool ComputeFastNormalsForUnstructured;
std::string NormalArrayName;
vtkm::worklet::MarchingCubes Worklet;
vtkm::worklet::Contour Worklet;
};
template <>
class FilterTraits<MarchingCubes>
class FilterTraits<Contour>
{
public:
struct TypeListTagMCScalars
......@@ -131,6 +131,6 @@ public:
}
} // namespace vtkm::filter
#include <vtkm/filter/MarchingCubes.hxx>
#include <vtkm/filter/Contour.hxx>
#endif // vtk_m_filter_MarchingCubes_h
#endif // vtk_m_filter_Contour_h
......@@ -40,8 +40,8 @@ bool IsCellSetStructured(const vtkm::cont::DynamicCellSetBase<CellSetList>& cell
} // anonymous namespace
//-----------------------------------------------------------------------------
inline VTKM_CONT MarchingCubes::MarchingCubes()
: vtkm::filter::FilterDataSetWithField<MarchingCubes>()
inline VTKM_CONT Contour::Contour()
: vtkm::filter::FilterDataSetWithField<Contour>()
, IsoValues()
, GenerateNormals(false)
, ComputeFastNormalsForStructured(false)
......@@ -53,7 +53,7 @@ inline VTKM_CONT MarchingCubes::MarchingCubes()
}
//-----------------------------------------------------------------------------
inline void MarchingCubes::SetNumberOfIsoValues(vtkm::Id num)
inline void Contour::SetNumberOfIsoValues(vtkm::Id num)
{
if (num >= 0)
{
......@@ -62,13 +62,13 @@ inline void MarchingCubes::SetNumberOfIsoValues(vtkm::Id num)
}
//-----------------------------------------------------------------------------
inline vtkm::Id MarchingCubes::GetNumberOfIsoValues() const
inline vtkm::Id Contour::GetNumberOfIsoValues() const
{
return static_cast<vtkm::Id>(this->IsoValues.size());
}
//-----------------------------------------------------------------------------
inline void MarchingCubes::SetIsoValue(vtkm::Id index, vtkm::Float64 v)
inline void Contour::SetIsoValue(vtkm::Id index, vtkm::Float64 v)
{
std::size_t i = static_cast<std::size_t>(index);
if (i >= this->IsoValues.size())
......@@ -79,20 +79,20 @@ inline void MarchingCubes::SetIsoValue(vtkm::Id index, vtkm::Float64 v)
}
//-----------------------------------------------------------------------------
inline void MarchingCubes::SetIsoValues(const std::vector<vtkm::Float64>& values)
inline void Contour::SetIsoValues(const std::vector<vtkm::Float64>& values)
{
this->IsoValues = values;
}
//-----------------------------------------------------------------------------
inline vtkm::Float64 MarchingCubes::GetIsoValue(vtkm::Id index) const
inline vtkm::Float64 Contour::GetIsoValue(vtkm::Id index) const
{
return this->IsoValues[static_cast<std::size_t>(index)];
}
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy>
inline VTKM_CONT vtkm::cont::DataSet MarchingCubes::DoExecute(
inline VTKM_CONT vtkm::cont::DataSet Contour::DoExecute(
const vtkm::cont::DataSet& input,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata& fieldMeta,
......@@ -203,11 +203,10 @@ inline VTKM_CONT vtkm::cont::DataSet MarchingCubes::DoExecute(
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy>
inline VTKM_CONT bool MarchingCubes::DoMapField(
vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<T, StorageType>& input,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
inline VTKM_CONT bool Contour::DoMapField(vtkm::cont::DataSet& result,
const vtkm::cont::ArrayHandle<T, StorageType>& input,
const vtkm::filter::FieldMetadata& fieldMeta,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
vtkm::cont::ArrayHandle<T> fieldArray;
......
......@@ -12,7 +12,7 @@
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/filter/CellSetConnectivity.h>
#include <vtkm/filter/MarchingCubes.h>
#include <vtkm/filter/Contour.h>
namespace
{
......@@ -119,7 +119,7 @@ public:
vtkm::Id3 dims(4, 4, 4);
vtkm::cont::DataSet dataSet = MakeIsosurfaceTestDataSet(dims);
vtkm::filter::MarchingCubes filter;
vtkm::filter::Contour filter;
filter.SetGenerateNormals(true);
filter.SetMergeDuplicatePoints(true);
filter.SetIsoValue(0, 0.1);
......
......@@ -10,7 +10,7 @@
#include <vtkm/filter/CleanGrid.h>
#include <vtkm/filter/MarchingCubes.h>
#include <vtkm/filter/Contour.h>
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
......@@ -72,7 +72,7 @@ void TestPointMerging()
vtkm::cont::testing::MakeTestDataSet makeDataSet;
vtkm::cont::DataSet baseData = makeDataSet.Make3DUniformDataSet3(vtkm::Id3(4, 4, 4));
vtkm::filter::MarchingCubes marchingCubes;
vtkm::filter::Contour marchingCubes;
marchingCubes.SetIsoValue(0.05);
marchingCubes.SetMergeDuplicatePoints(false);
marchingCubes.SetActiveField("pointvar");
......
......@@ -17,7 +17,7 @@
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/filter/CleanGrid.h>
#include <vtkm/filter/MarchingCubes.h>
#include <vtkm/filter/Contour.h>
namespace vtkm_ut_mc_filter
{
......@@ -270,12 +270,12 @@ inline vtkm::cont::DataSet MakeRadiantDataSet::Make3DRadiantDataSet(vtkm::IdComp
void TestMarchingCubesUniformGrid()
{
std::cout << "Testing MarchingCubes filter on a uniform grid" << std::endl;
std::cout << "Testing Contour filter on a uniform grid" << std::endl;
vtkm::Id3 dims(4, 4, 4);
vtkm::cont::DataSet dataSet = MakeIsosurfaceTestDataSet(dims);
vtkm::filter::MarchingCubes mc;
vtkm::filter::Contour mc;
mc.SetGenerateNormals(true);
mc.SetIsoValue(0, 0.5);
......@@ -336,7 +336,7 @@ void TestMarchingCubesUniformGrid()
void TestMarchingCubesCustomPolicy()
{
std::cout << "Testing MarchingCubes filter with custom field and cellset" << std::endl;
std::cout << "Testing Contour filter with custom field and cellset" << std::endl;
using DataSetGenerator = MakeRadiantDataSet;
DataSetGenerator dataSetGenerator;
......@@ -344,7 +344,7 @@ void TestMarchingCubesCustomPolicy()
const vtkm::IdComponent Dimension = 10;
vtkm::cont::DataSet dataSet = dataSetGenerator.Make3DRadiantDataSet(Dimension);
vtkm::filter::MarchingCubes mc;
vtkm::filter::Contour mc;
mc.SetGenerateNormals(false);
mc.SetIsoValue(0, 0.45);
......@@ -435,7 +435,7 @@ void TestNormals(const vtkm::cont::DataSet& dataset, bool structured)
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::FloatDefault, 3>> normals;
vtkm::filter::MarchingCubes mc;
vtkm::filter::Contour mc;
mc.SetIsoValue(0, 200);
mc.SetGenerateNormals(true);
......@@ -483,7 +483,7 @@ void TestNormals(const vtkm::cont::DataSet& dataset, bool structured)
void TestMarchingCubesNormals()
{
std::cout << "Testing MarchingCubes normals generation" << std::endl;
std::cout << "Testing Contour normals generation" << std::endl;
std::cout << "\tStructured dataset\n";
vtkm::cont::DataSet dataset = MakeNormalsTestDataSet();
......
......@@ -8,7 +8,7 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/filter/CellAverage.h>
#include <vtkm/filter/MarchingCubes.h>
#include <vtkm/filter/Contour.h>
#include <vtkm/filter/SplitSharpEdges.h>
#include <vtkm/filter/SurfaceNormals.h>
......@@ -239,7 +239,7 @@ void TestWithStructuredData()
vtkm::cont::DataSet dataSet = Make3DWavelet();
// Cut a contour:
vtkm::filter::MarchingCubes contour;
vtkm::filter::Contour contour;
contour.SetActiveField("scalars", vtkm::cont::Field::Association::POINTS);
contour.SetNumberOfIsoValues(1);
contour.SetIsoValue(192);
......
......@@ -38,7 +38,7 @@ set(headers
KernelSplatter.h
Keys.h
Magnitude.h
MarchingCubes.h
Contour.h
Mask.h
MaskIndices.h
MaskNone.h
......
......@@ -8,8 +8,8 @@
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_worklet_MarchingCubes_h
#define vtk_m_worklet_MarchingCubes_h
#ifndef vtk_m_worklet_Contour_h
#define vtk_m_worklet_Contour_h
#include <vtkm/BinaryPredicates.h>
#include <vtkm/VectorAnalysis.h>
......@@ -50,7 +50,7 @@ namespace vtkm
namespace worklet
{
namespace marchingcubes
namespace contour
{
// -----------------------------------------------------------------------------
......@@ -420,7 +420,7 @@ void MergeDuplicates(const vtkm::cont::ArrayHandle<KeyType, KeyStorage>& origina
//need to build the new connectivity
auto uniqueKeys = keys.GetUniqueKeys();
vtkm::cont::Algorithm::LowerBounds(
uniqueKeys, original_keys, connectivity, marchingcubes::MultiContourLess());
uniqueKeys, original_keys, connectivity, contour::MultiContourLess());
//update the edge ids
vtkm::worklet::DispatcherMapField<CopyEdgeIds> edgeDispatcher;
......@@ -620,12 +620,12 @@ struct GenerateNormalsDeduced
vtkm::worklet::DispatcherMapTopology<NormalsWorkletPass1> dispatcherNormalsPass1(
NormalsWorkletPass1::MakeScatter(*edges));
dispatcherNormalsPass1.Invoke(
*cellset, *cellset, coordinates, marchingcubes::make_ScalarField(*field), *normals);
*cellset, *cellset, coordinates, contour::make_ScalarField(*field), *normals);
vtkm::worklet::DispatcherMapTopology<NormalsWorkletPass2> dispatcherNormalsPass2(
NormalsWorkletPass2::MakeScatter(*edges));
dispatcherNormalsPass2.Invoke(
*cellset, *cellset, coordinates, marchingcubes::make_ScalarField(*field), *weights, *normals);
*cellset, *cellset, coordinates, contour::make_ScalarField(*field), *weights, *normals);
}
};
......@@ -654,11 +654,11 @@ void GenerateNormals(vtkm::cont::ArrayHandle<vtkm::Vec<NormalCType, 3>>& normals
}
/// \brief Compute the isosurface for a uniform grid data set
class MarchingCubes
class Contour
{
public:
//----------------------------------------------------------------------------
MarchingCubes(bool mergeDuplicates = true)
Contour(bool mergeDuplicates = true)
: MergeDuplicatePoints(mergeDuplicates)
, InterpolationWeights()
, InterpolationEdgeIds()
......@@ -717,7 +717,7 @@ public:
vtkm::cont::ArrayHandle<ValueType> ProcessPointField(
const vtkm::cont::ArrayHandle<ValueType, StorageType>& input) const
{
using vtkm::worklet::marchingcubes::MapPointField;
using vtkm::worklet::contour::MapPointField;
MapPointField applyToField;
vtkm::worklet::DispatcherMapField<MapPointField> applyFieldDispatcher(applyToField);
......@@ -755,7 +755,7 @@ private:
typename NormalType>
struct DeduceCellType
{
MarchingCubes* MC = nullptr;
Contour* MC = nullptr;
const ValueType* isovalues = nullptr;
const vtkm::Id* numIsoValues = nullptr;
const CoordinateSystem* coordinateSystem = nullptr;
......@@ -845,10 +845,10 @@ private:
vtkm::cont::ArrayHandle<vtkm::Vec<NormalType, 3>, StorageTagNormals> normals,
bool withNormals)
{
using vtkm::worklet::marchingcubes::ClassifyCell;
using vtkm::worklet::marchingcubes::EdgeWeightGenerate;
using vtkm::worklet::marchingcubes::EdgeWeightGenerateMetaData;
using vtkm::worklet::marchingcubes::MapPointField;
using vtkm::worklet::contour::ClassifyCell;
using vtkm::worklet::contour::EdgeWeightGenerate;
using vtkm::worklet::contour::EdgeWeightGenerateMetaData;
using vtkm::worklet::contour::MapPointField;
// Setup the Dispatcher Typedefs
using ClassifyDispatcher = vtkm::worklet::DispatcherMapTopology<ClassifyCell<ValueType>>;
......@@ -862,7 +862,7 @@ private:
// for each cell, and the number of vertices to be generated
vtkm::cont::ArrayHandle<vtkm::IdComponent> numOutputTrisPerCell;
{
marchingcubes::ClassifyCell<ValueType> classifyCell;
contour::ClassifyCell<ValueType> classifyCell;
ClassifyDispatcher dispatcher(classifyCell);
dispatcher.Invoke(isoValuesHandle, inputField, cells, numOutputTrisPerCell, this->classTable);
}
......@@ -909,15 +909,15 @@ private:
// output. But for InterpolationEdgeIds we need to do it manually once done
if (numIsoValues == 1)
{
marchingcubes::MergeDuplicates(this->InterpolationEdgeIds, //keys
this->InterpolationWeights, //values
this->InterpolationEdgeIds, //values
originalCellIdsForPoints, //values
connectivity); // computed using lower bounds
contour::MergeDuplicates(this->InterpolationEdgeIds, //keys
this->InterpolationWeights, //values
this->InterpolationEdgeIds, //values
originalCellIdsForPoints, //values
connectivity); // computed using lower bounds
}
else if (numIsoValues > 1)
{
marchingcubes::MergeDuplicates(
contour::MergeDuplicates(
vtkm::cont::make_ArrayHandleZip(contourIds, this->InterpolationEdgeIds), //keys
this->InterpolationWeights, //values
this->InterpolationEdgeIds, //values
......@@ -948,12 +948,12 @@ private:
//now that the vertices have been generated we can generate the normals
if (withNormals)
{
marchingcubes::GenerateNormals(normals,
inputField,
cells,
coordinateSystem,
this->InterpolationEdgeIds,
this->InterpolationWeights);
contour::GenerateNormals(normals,
inputField,
cells,
coordinateSystem,
this->InterpolationEdgeIds,
this->InterpolationWeights);
}
return outputCells;
......@@ -971,4 +971,4 @@ private:
}
} // namespace vtkm::worklet
#endif // vtk_m_worklet_MarchingCubes_h
#endif // vtk_m_worklet_Contour_h
......@@ -7,8 +7,8 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_CellClassification_h
#define vtk_m_CellClassification_h
#ifndef vtk_m_ContourTable_h
#define vtk_m_ContourTable_h
#include <vtkm/CellShape.h>
#include <vtkm/Types.h>
......@@ -624,4 +624,4 @@ private:
}
}
}
#endif // vtk_m_CellClassification_h
#endif // vtk_m_ContourTable_h
......@@ -7,7 +7,7 @@
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#include <vtkm/filter/MarchingCubes.h>
#include <vtkm/filter/Contour.h>
#include <vtkm/cont/ArrayCopy.h>
......
......@@ -9,7 +9,7 @@
//============================================================================
#include <vtkm/cont/testing/MakeTestDataSet.h>
#include <vtkm/cont/testing/Testing.h>
#include <vtkm/filter/MarchingCubes.h>
#include <vtkm/filter/Contour.h>
#include <vtkm/worklet/connectivities/CellSetDualGraph.h>
......
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