limited volume meshing to boundary layer only
[engrid-github.git] / src / libengrid / guicreatevolumemesh.cpp
blob3c7b5fd01c383377d5d456f27cd037b5f3037cb7
1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 // + +
3 // + This file is part of enGrid. +
4 // + +
5 // + Copyright 2008-2014 enGits GmbH +
6 // + +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
11 // + +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
16 // + +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
19 // + +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 #include "guicreatevolumemesh.h"
23 #include "createvolumemesh.h"
24 #include "guimainwindow.h"
26 GuiCreateVolumeMesh::GuiCreateVolumeMesh()
30 void GuiCreateVolumeMesh::before()
32 GuiMainWindow::pointer()->createDefaultVol();
33 populateVolumes(m_Ui.m_ListWidgetVolumes);
36 void GuiCreateVolumeMesh::operate()
38 QString volume_name = getSelectedVolume(m_Ui.m_ListWidgetVolumes);
39 VolumeDefinition V = mainWindow()->getVol(volume_name);
41 CreateVolumeMesh mesh_volume;
42 EG_VTKSP(vtkUnstructuredGrid, part_grid);
43 EG_VTKSP(vtkUnstructuredGrid, rest_grid);
45 MeshPartition part(volume_name);
46 part.setVolumeOrientation();
47 part.extractToVtkGrid(part_grid);
48 MeshPartition rest(m_Grid);
49 rest.setRemainder(part);
50 rest.extractToVtkGrid(rest_grid);
52 mesh_volume.setGrid(part_grid);
53 if (m_Ui.m_CheckBoxBoundaryLayer->isChecked()) {
54 mesh_volume.setBoundaryLayerOn();
56 if (m_Ui.m_CheckBoxDebug->isChecked()) {
57 mesh_volume.debugOn();
59 mesh_volume();
60 EG_VTKDCC(vtkIntArray, cell_code, part_grid, "cell_code");
61 for (vtkIdType id_cell = 0; id_cell < part_grid->GetNumberOfCells(); ++id_cell) {
62 if (isVolume(id_cell, part_grid)) {
63 cell_code->SetValue(id_cell, V.getVC());
66 makeCopy(part_grid, m_Grid);
68 MeshPartition part(m_Grid, true);
69 MeshPartition rest(rest_grid, true);
70 part.addPartition(rest);
72 GuiMainWindow::pointer()->updateBoundaryCodes(true);
73 resetOrientation(m_Grid);
74 createIndices(m_Grid);