Merge branch 'master' of ssh://swordfish/srv/www/htdocs/git/engrid
[engrid.git] / src / guicreatevolumemesh.cpp
blob70ab16b91f7df5ceec7a1299914860a737ba7965
1 //
2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + +
4 // + This file is part of enGrid. +
5 // + +
6 // + Copyright 2008,2009 Oliver Gloth +
7 // + +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
12 // + +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
17 // + +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // + +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
24 #include "guicreatevolumemesh.h"
25 #include "createvolumemesh.h"
26 #include "guimainwindow.h"
28 GuiCreateVolumeMesh::GuiCreateVolumeMesh()
32 void GuiCreateVolumeMesh::before()
34 GuiMainWindow::pointer()->createDefaultVol();
35 populateVolumes(ui.listWidget);
38 void GuiCreateVolumeMesh::operate()
40 QString volume_name = getSelectedVolume(ui.listWidget);
41 VolumeDefinition V = mainWindow()->getVol(volume_name);
42 CreateVolumeMesh mesh_volume;
43 EG_VTKSP(vtkUnstructuredGrid, part_grid);
44 EG_VTKSP(vtkUnstructuredGrid, rest_grid);
46 MeshPartition part(volume_name);
47 part.setVolumeOrientation();
48 part.extractToVtkGrid(part_grid);
49 MeshPartition rest(m_Grid);
50 rest.setRemainder(part);
51 rest.extractToVtkGrid(rest_grid);
53 mesh_volume.setGrid(part_grid);
54 mesh_volume();
55 EG_VTKDCC(vtkIntArray, cell_code, part_grid, "cell_code");
56 for (vtkIdType id_cell = 0; id_cell < part_grid->GetNumberOfCells(); ++id_cell) {
57 if (isVolume(id_cell, part_grid)) {
58 cell_code->SetValue(id_cell, V.getVC());
61 makeCopy(part_grid, m_Grid);
63 MeshPartition part(m_Grid, true);
64 MeshPartition rest(rest_grid, true);
65 part.addPartition(rest);
67 resetOrientation(m_Grid);
68 createIndices(m_Grid);