| 209 | // --------------------------------------------------------------------- |
| 210 | |
| 211 | unique_ptr<AbstractRD> MakeNewHexagonalMesh(const bool is_opencl_available, const int opencl_platform, const int opencl_device, Properties& render_settings) |
| 212 | { |
| 213 | // perhaps at some point we will want this to be determined by the user |
| 214 | const int data_type = VTK_FLOAT; |
| 215 | |
| 216 | int n; |
| 217 | { |
| 218 | const int N_CHOICES = 4; |
| 219 | int choices[N_CHOICES] = { 100,150,200,500 }; |
| 220 | int cells[N_CHOICES] = { 3185,7326,13068,82668 }; |
| 221 | wxString div_descriptions[N_CHOICES]; |
| 222 | for (int i = 0; i<N_CHOICES; i++) |
| 223 | div_descriptions[i] = wxString::Format("%d cells", cells[i]); |
| 224 | wxSingleChoiceDialog dlg(NULL, _("Select the grid size:"), _("Hexagonal mesh options"), N_CHOICES, div_descriptions); |
| 225 | dlg.SetSelection(0); // default selection |
| 226 | dlg.SetSize(wxDefaultCoord, 130 + N_CHOICES * 20); // increase dlg height so we see all choices without having to scroll |
| 227 | if (dlg.ShowModal() != wxID_OK) { |
| 228 | return NULL; |
| 229 | } |
| 230 | n = choices[dlg.GetSelection()]; |
| 231 | } |
| 232 | wxBusyCursor busy; |
| 233 | vtkSmartPointer<vtkUnstructuredGrid> mesh = vtkSmartPointer<vtkUnstructuredGrid>::New(); |
| 234 | MeshGenerators::GetHexagonalMesh(n, n, mesh, 2, data_type); |
| 235 | unique_ptr<MeshRD> mesh_sys; |
| 236 | if (is_opencl_available) |
| 237 | mesh_sys = make_unique<FormulaOpenCLMeshRD>(opencl_platform, opencl_device, data_type); |
| 238 | else |
| 239 | mesh_sys = make_unique<GrayScottMeshRD>(); |
| 240 | mesh_sys->CopyFromMesh(mesh); |
| 241 | render_settings.GetProperty("active_chemical").SetChemical("b"); |
| 242 | render_settings.GetProperty("slice_3D").SetBool(false); |
| 243 | render_settings.GetProperty("show_cell_edges").SetBool(n<200); |
| 244 | render_settings.GetProperty("use_image_interpolation").SetBool(false); |
| 245 | return mesh_sys; |
| 246 | } |
| 247 | |
| 248 | // --------------------------------------------------------------------- |
| 249 |
no test coverage detected