Skip to content

Commit

Permalink
#3: Remove deprecated files and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrepebay committed May 30, 2023
1 parent ac2164f commit 86eb679
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 345 deletions.
18 changes: 0 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,44 +61,26 @@ nanobind_build_library(nanobind SHARED)

# Compile an extension library
add_library(my_ext MODULE ${CMAKE_CURRENT_SOURCE_DIR}/circle.cc)
add_library(visualizer MODULE ${CMAKE_CURRENT_SOURCE_DIR}/visualizer.cc)
add_library(block MODULE ${CMAKE_CURRENT_SOURCE_DIR}/block.cc)

# .. and link it against the nanobind parts
message(STATUS "vtk libraries: ${VTK_LIBRARIES}")
target_link_libraries(my_ext PUBLIC ${VTK_LIBRARIES})
target_link_libraries(my_ext PRIVATE nanobind)
target_link_libraries(visualizer PUBLIC ${VTK_LIBRARIES})
target_link_libraries(visualizer PRIVATE nanobind)
target_link_libraries(block PUBLIC ${VTK_LIBRARIES})
target_link_libraries(block PRIVATE nanobind)

# .. enable size optimizations
nanobind_opt_size(my_ext)
nanobind_opt_size(visualizer)
nanobind_opt_size(block)

# .. enable link time optimization
nanobind_lto(my_ext)
nanobind_lto(visualizer)
nanobind_lto(block)

# .. disable the stack protector
nanobind_disable_stack_protector(my_ext)
nanobind_disable_stack_protector(visualizer)
nanobind_disable_stack_protector(block)

# .. set the Python extension suffix
nanobind_extension(my_ext)
nanobind_extension(visualizer)
nanobind_extension(block)

# .. set important compilation flags
nanobind_compile_options(my_ext)
nanobind_compile_options(visualizer)
nanobind_compile_options(block)

# .. set important linker flags
nanobind_link_options(my_ext)
nanobind_link_options(visualizer)
nanobind_link_options(block)
53 changes: 0 additions & 53 deletions block.cc

This file was deleted.

84 changes: 0 additions & 84 deletions block.h

This file was deleted.

72 changes: 0 additions & 72 deletions src/vt-tv/render/render.cc
Original file line number Diff line number Diff line change
Expand Up @@ -668,78 +668,6 @@ vtkNew<vtkPolyData> Render::create_object_mesh_(PhaseWork phase) {
renderer->AddActor(rank_actor);
renderer->AddActor2D(qoi_actor);

// vtkNew<vtkLookupTable> bw_lut;
// bw_lut->SetTableRange((0.0, self.__max_object_volume));
// bw_lut->SetSaturationRange(0, 0);
// bw_lut->SetHueRange(0, 0);
// bw_lut->SetValueRange(1, 0);
// bw_lut->SetNanColor(1.0, 1.0, 1.0, 0.0);
// bw_lut->Build();

vtkNew<vtkArrayCalculator> sqrtT;
sqrtT->SetInputData(object_mesh);
sqrtT->AddScalarArrayName("Load");
char const* sqrtT_str = "sqrt(Load)";
sqrtT->SetFunction(sqrtT_str);
sqrtT->SetResultArrayName(sqrtT_str);
sqrtT->Update();
auto sqrtT_out = sqrtT->GetDataSetOutput();
sqrtT_out->GetPointData()->SetActiveScalars("Migratable");

std::vector<std::tuple<double, std::string>> items{{0.0, "Square"}, {1.0, "Circle"}};
vtkPolyDataMapper* glyph_mapper_out = nullptr;
for (auto&& [k,v] : items) {
vtkNew<vtkThresholdPoints> thresh;
thresh->SetInputData(sqrtT_out);
thresh->ThresholdBetween(k, k);
thresh->Update();
auto thresh_out = thresh->GetOutput();
if (not thresh_out->GetNumberOfPoints())
continue;
thresh_out->GetPointData()->SetActiveScalars(sqrtT_str);

// Glyph by square root of object loads
vtkNew<vtkGlyphSource2D> glyph;
if (v == "Square") {
glyph->SetGlyphTypeToSquare();
} else {
glyph->SetGlyphTypeToCircle();
}
glyph->SetResolution(32);
glyph->SetScale(1.0);
glyph->FilledOn();
glyph->CrossOff();
vtkNew<vtkGlyph3D> glypher;
glypher->SetSourceConnection(glyph->GetOutputPort());
glypher->SetInputData(thresh_out);
glypher->SetScaleModeToScaleByScalar();
glypher->SetScaleFactor(0.5);
glypher->Update();
glypher->GetOutput()->GetPointData()->SetActiveScalars("Load");

// Raise glyphs slightly for visibility
vtkNew<vtkTransform> z_raise;
z_raise->Translate(0.0, 0.0, 0.01);
vtkNew<vtkTransformPolyDataFilter> trans;
trans->SetTransform(z_raise);
trans->SetInputData(glypher->GetOutput());

// Create mapper and actor for glyphs
vtkNew<vtkPolyDataMapper> glyph_mapper;
glyph_mapper_out = glyph_mapper;
glyph_mapper->SetInputConnection(trans->GetOutputPort());
// glyph_mapper->SetLookupTable(createColorTransferFunction({0,0.01}, 0, BlueToRed));
// glyph_mapper->SetScalarRange({0,0.01});
vtkNew<vtkActor> glyph_actor;
glyph_actor->SetMapper(glyph_mapper);
renderer->AddActor(glyph_actor);
}

if (glyph_mapper_out) {
auto load_actor = createScalarBarActor(glyph_mapper_out, "Object Load", 0.55, 0.55);
renderer->AddActor2D(load_actor);
}

renderer->ResetCamera();
vtkNew<vtkRenderWindow> render_window;
render_window->AddRenderer(renderer);
Expand Down
42 changes: 0 additions & 42 deletions visualizer.cc

This file was deleted.

76 changes: 0 additions & 76 deletions visualizer.h

This file was deleted.

0 comments on commit 86eb679

Please sign in to comment.