limited volume meshing to boundary layer only
[engrid-github.git] / src / libengrid / polydatareader.cpp
blob03b108fc34919d89ed67a9a3a5919fd818b7a5c8
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 "polydatareader.h"
22 #include "vtkEgPolyDataToUnstructuredGridFilter.h"
24 #include <vtkXMLPolyDataReader.h>
26 #include "guimainwindow.h"
28 PolyDataReader::PolyDataReader()
30 setFormat("VTK poly data files(*.vtp)");
31 setExtension(".vtp");
34 void PolyDataReader::operate()
36 try {
37 QFileInfo file_info(GuiMainWindow::pointer()->getFilename());
38 readInputFileName(file_info.completeBaseName() + ".vtp");
39 if (isValid()) {
40 EG_VTKSP(vtkXMLPolyDataReader,vtp);
41 EG_VTKSP(vtkEgPolyDataToUnstructuredGridFilter,pd2ug);
42 vtp->SetFileName(qPrintable(getFileName()));
43 pd2ug->SetInputConnection(vtp->GetOutputPort());
44 pd2ug->Update();
45 m_Grid->DeepCopy(pd2ug->GetOutput());
46 createBasicFields(m_Grid, m_Grid->GetNumberOfCells(), m_Grid->GetNumberOfPoints());
47 updateNodeIndex(m_Grid);
48 updateCellIndex(m_Grid);
49 EG_VTKDCC(vtkIntArray, bc, m_Grid, "cell_code");
50 for (vtkIdType id_cell = 0; id_cell < m_Grid->GetNumberOfPoints(); ++id_cell) {
51 bc->SetValue(id_cell,99);
54 } catch (Error err) {
55 err.display();