-
Notifications
You must be signed in to change notification settings - Fork 2
/
gridrender_experimental.h
41 lines (35 loc) · 1.61 KB
/
gridrender_experimental.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include "meridionalsolvercase_experiemental.h"
namespace yams
{
template<typename T>
void plot_vtkStructuredGrid(const SolverCaseSet<T> &set,const char* name,bool edges_on = false, bool countour_on = false)
{
// Create a renderer, render window, and interactor
vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow(renderWindow);
vtkSmartPointer<vtkInteractorStyleTrackballCamera> style =
vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New(); //like paraview
std::for_each(
set.cases().begin(), set.cases().end(),
[&renderer, name, edges_on, countour_on](const auto &p_solver_case)
{
const auto &solver_case = *p_solver_case;
auto structuredGrid = make_vtk_grid<T>(*(solver_case.gi->g));
add_grid_to_renderer(renderer, structuredGrid, name, edges_on, countour_on);
add_blades_to_renderer(renderer, solver_case);
}
);
renderer->SetBackground(0.7, 0.7, 0.7); // Background color green
renderWindowInteractor->SetInteractorStyle(style);
// Render and interact
renderWindow->Render();
renderWindowInteractor->Start();
}
}