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

Commit

Permalink
Tet and tri (#186)
Browse files Browse the repository at this point in the history
* adding new filters

* adding the corresponding vtkh filters
  • Loading branch information
mclarsen authored Nov 20, 2020
1 parent d0564ec commit d2d0c74
Show file tree
Hide file tree
Showing 10 changed files with 232 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/vtkh/filters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ set(vtkh_filters_headers
PointAverage.hpp
PointTransform.hpp
Recenter.hpp
Tetrahedralize.hpp
Threshold.hpp
Triangulate.hpp
Statistics.hpp
Slice.hpp
VectorComponent.hpp
Expand Down Expand Up @@ -64,7 +66,9 @@ set(vtkh_filters_sources
PointAverage.cpp
PointTransform.cpp
Recenter.cpp
Tetrahedralize.cpp
Threshold.cpp
Triangulate.cpp
Slice.cpp
Statistics.cpp
VectorComponent.cpp
Expand Down
51 changes: 51 additions & 0 deletions src/vtkh/filters/Tetrahedralize.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include <vtkh/filters/Tetrahedralize.hpp>
#include <vtkh/vtkm_filters/vtkmTetrahedralize.hpp>

namespace vtkh
{

Tetrahedralize::Tetrahedralize()
{

}

Tetrahedralize::~Tetrahedralize()
{

}

void Tetrahedralize::PreExecute()
{
Filter::PreExecute();
}

void Tetrahedralize::PostExecute()
{
Filter::PostExecute();
}

void Tetrahedralize::DoExecute()
{
this->m_output = new DataSet();
const int num_domains = this->m_input->GetNumberOfDomains();

for(int i = 0; i < num_domains; ++i)
{
vtkm::Id domain_id;
vtkm::cont::DataSet dom;
this->m_input->GetDomain(i, dom, domain_id);
vtkmTetrahedralize tetter;
// insert interesting stuff
auto dataset = tetter.Run(dom, this->GetFieldSelection());

m_output->AddDomain(dataset, domain_id);
}
}

std::string
Tetrahedralize::GetName() const
{
return "vtkh::Tetrahedralize";
}

} // namespace vtkh
26 changes: 26 additions & 0 deletions src/vtkh/filters/Tetrahedralize.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef VTK_H_TETRAHEDRALIZE_HPP
#define VTK_H_TETRAHEDRALIZE_HPP

#include <vtkh/vtkh_exports.h>
#include <vtkh/vtkh.hpp>
#include <vtkh/filters/Filter.hpp>
#include <vtkh/DataSet.hpp>

namespace vtkh
{

class VTKH_API Tetrahedralize : public Filter
{
public:
Tetrahedralize();
virtual ~Tetrahedralize();
std::string GetName() const override;

protected:
void PreExecute() override;
void PostExecute() override;
void DoExecute() override;
};

} //namespace vtkh
#endif
51 changes: 51 additions & 0 deletions src/vtkh/filters/Triangulate.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include <vtkh/filters/Triangulate.hpp>
#include <vtkh/vtkm_filters/vtkmTriangulate.hpp>

namespace vtkh
{

Triangulate::Triangulate()
{

}

Triangulate::~Triangulate()
{

}

void Triangulate::PreExecute()
{
Filter::PreExecute();
}

void Triangulate::PostExecute()
{
Filter::PostExecute();
}

void Triangulate::DoExecute()
{
this->m_output = new DataSet();
const int num_domains = this->m_input->GetNumberOfDomains();

for(int i = 0; i < num_domains; ++i)
{
vtkm::Id domain_id;
vtkm::cont::DataSet dom;
this->m_input->GetDomain(i, dom, domain_id);
vtkmTriangulate tetter;
// insert interesting stuff
auto dataset = tetter.Run(dom, this->GetFieldSelection());

m_output->AddDomain(dataset, domain_id);
}
}

std::string
Triangulate::GetName() const
{
return "vtkh::Triangulate";
}

} // namespace vtkh
26 changes: 26 additions & 0 deletions src/vtkh/filters/Triangulate.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef VTK_H_TRIANGULATE_HPP
#define VTK_H_TRIANGULATE_HPP

#include <vtkh/vtkh_exports.h>
#include <vtkh/vtkh.hpp>
#include <vtkh/filters/Filter.hpp>
#include <vtkh/DataSet.hpp>

namespace vtkh
{

class VTKH_API Triangulate : public Filter
{
public:
Triangulate();
virtual ~Triangulate();
std::string GetName() const override;

protected:
void PreExecute() override;
void PostExecute() override;
void DoExecute() override;
};

} //namespace vtkh
#endif
4 changes: 4 additions & 0 deletions src/vtkh/vtkm_filters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ set(vtkm_filters_headers
vtkmMarchingCubes.hpp
vtkmPointAverage.hpp
vtkmPointTransform.hpp
vtkmTetrahedralize.hpp
vtkmTriangulate.hpp
vtkmThreshold.hpp
vtkmVectorMagnitude.hpp
GradientParameters.hpp
Expand All @@ -29,6 +31,8 @@ set(vtkm_filters_sources
vtkmMarchingCubes.cpp
vtkmPointAverage.cpp
vtkmPointTransform.cpp
vtkmTetrahedralize.cpp
vtkmTriangulate.cpp
vtkmThreshold.cpp
vtkmVectorMagnitude.cpp
)
Expand Down
18 changes: 18 additions & 0 deletions src/vtkh/vtkm_filters/vtkmTetrahedralize.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "vtkmTetrahedralize.hpp"

#include <vtkm/filter/Tetrahedralize.h>

namespace vtkh
{

vtkm::cont::DataSet
vtkmTetrahedralize::Run(vtkm::cont::DataSet &input,
vtkm::filter::FieldSelection map_fields)
{
vtkm::filter::Tetrahedralize tet;
tet.SetFieldsToPass(map_fields);
auto output = tet.Execute(input);
return output;
}

} // namespace vtkh
17 changes: 17 additions & 0 deletions src/vtkh/vtkm_filters/vtkmTetrahedralize.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef VTK_H_VTKM_TETRAHEDRALIZE_HPP
#define VTK_H_VTKM_TETRAHEDRALIZE_HPP

#include <vtkm/cont/DataSet.h>
#include <vtkm/filter/FieldSelection.h>

namespace vtkh
{

class vtkmTetrahedralize
{
public:
vtkm::cont::DataSet Run(vtkm::cont::DataSet &input,
vtkm::filter::FieldSelection map_fields);
};
}
#endif
18 changes: 18 additions & 0 deletions src/vtkh/vtkm_filters/vtkmTriangulate.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "vtkmTriangulate.hpp"

#include <vtkm/filter/Triangulate.h>

namespace vtkh
{

vtkm::cont::DataSet
vtkmTriangulate::Run(vtkm::cont::DataSet &input,
vtkm::filter::FieldSelection map_fields)
{
vtkm::filter::Triangulate tri;
tri.SetFieldsToPass(map_fields);
auto output = tri.Execute(input);
return output;
}

} // namespace vtkh
17 changes: 17 additions & 0 deletions src/vtkh/vtkm_filters/vtkmTriangulate.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef VTK_H_VTKM_TRIANGULATE_HPP
#define VTK_H_VTKM_TRIANGULATE_HPP

#include <vtkm/cont/DataSet.h>
#include <vtkm/filter/FieldSelection.h>

namespace vtkh
{

class vtkmTriangulate
{
public:
vtkm::cont::DataSet Run(vtkm::cont::DataSet &input,
vtkm::filter::FieldSelection map_fields);
};
}
#endif

0 comments on commit d2d0c74

Please sign in to comment.