fixed edge display for volume cells
[engrid-github.git] / src / libengrid / guicreatehexibmesh.cpp
blob315617c62a6f71832b665c1a2178c2205f835b70
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 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #include "guicreatehexibmesh.h"
22 #include "geometrytools.h"
24 GuiCreateHexIbMesh::GuiCreateHexIbMesh()
28 void GuiCreateHexIbMesh::before()
30 vec3_t x_centre(0,0,0);
31 double A = 0;
32 for (vtkIdType id_cell = 0; id_cell < m_Grid->GetNumberOfCells(); ++id_cell) {
33 if (isSurface(id_cell, m_Grid)) {
34 double A_cell = GeometryTools::cellVA(m_Grid, id_cell);
35 x_centre += A_cell*cellCentre(m_Grid, id_cell);
36 A += A_cell;
39 x_centre *= 1.0/A;
40 setVector(x_centre, m_Ui.m_LineEditCentre);
43 void GuiCreateHexIbMesh::operate()
45 m_CreateMesh.setMinNumLayersWithRequiredResolution(m_Ui.m_SpinBoxMinNumLayers->value());
46 m_CreateMesh.setMinDim(m_Ui.m_SpinBoxMinDim->value());
47 vec3_t x_centre = getVector(m_Ui.m_LineEditCentre);
48 m_CreateMesh.setInsidePosition(x_centre);
49 m_CreateMesh();