| 96 | // --------------------------------------------------------------------- |
| 97 | |
| 98 | unique_ptr<AbstractRD> MakeNewGeodesicSphere(const bool is_opencl_available, const int opencl_platform, const int opencl_device, Properties& render_settings) |
| 99 | { |
| 100 | // perhaps at some point we will want this to be determined by the user |
| 101 | const int data_type = VTK_FLOAT; |
| 102 | |
| 103 | int divs; |
| 104 | { |
| 105 | const int N_CHOICES = 6; |
| 106 | int div_choices[N_CHOICES] = { 2,3,4,5,6,7 }; |
| 107 | wxString div_descriptions[N_CHOICES]; |
| 108 | for (int i = 0; i<N_CHOICES; i++) |
| 109 | div_descriptions[i] = wxString::Format("%d subdivisions - %d cells", div_choices[i], 20 << (div_choices[i] * 2)); |
| 110 | wxSingleChoiceDialog dlg(NULL, _("Select the number of subdivisions:"), _("Geodesic sphere options"), N_CHOICES, div_descriptions); |
| 111 | dlg.SetSelection(0); // default selection |
| 112 | dlg.SetSize(wxDefaultCoord, 130 + N_CHOICES * 20); // increase dlg height so we see all choices without having to scroll |
| 113 | if (dlg.ShowModal() != wxID_OK) { |
| 114 | return NULL; |
| 115 | } |
| 116 | divs = div_choices[dlg.GetSelection()]; |
| 117 | } |
| 118 | wxBusyCursor busy; |
| 119 | vtkSmartPointer<vtkUnstructuredGrid> mesh = vtkSmartPointer<vtkUnstructuredGrid>::New(); |
| 120 | MeshGenerators::GetGeodesicSphere(divs, mesh, 2, data_type); |
| 121 | unique_ptr<MeshRD> mesh_sys; |
| 122 | if (is_opencl_available) |
| 123 | mesh_sys = make_unique<FormulaOpenCLMeshRD>(opencl_platform, opencl_device, data_type); |
| 124 | else |
| 125 | mesh_sys = make_unique<GrayScottMeshRD>(); |
| 126 | mesh_sys->CopyFromMesh(mesh); |
| 127 | render_settings.GetProperty("slice_3D").SetBool(false); |
| 128 | render_settings.GetProperty("active_chemical").SetChemical("b"); |
| 129 | return mesh_sys; |
| 130 | } |
| 131 | |
| 132 | // --------------------------------------------------------------------- |
| 133 |
no test coverage detected