limited volume meshing to boundary layer only
[engrid-github.git] / src / libengrid / showinfo.cpp
blob77c8376623bbab1223f19c27b86f50d72eb4fa5a
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 "showinfo.h"
23 #include "engrid.h"
24 #include "insertpoints.h"
26 #include "guimainwindow.h"
28 #include "geometrytools.h"
29 using namespace GeometryTools;
31 #include <vtkSignedCharArray.h>
33 ShowInfo::ShowInfo(bool b, vtkIdType P, vtkIdType C) : SurfaceOperation()
35 CellInfo = b;
36 PickedPoint = P;
37 PickedCell = C;
40 void ShowInfo::operate()
42 l2g_t nodes = getPartNodes();
43 g2l_t _nodes = getPartLocalNodes();
44 l2g_t cells = getPartCells();
45 g2l_t _cells = getPartLocalCells();
46 l2l_t c2c = getPartC2C();
47 l2l_t n2n = getPartN2N();
48 l2l_t n2c = getPartN2C();
50 int N_cells=m_Grid->GetNumberOfCells();
51 int N_points=m_Grid->GetNumberOfPoints();
52 if(CellInfo) {
53 if(PickedCell>=0 && PickedCell<N_cells) {
54 cout<<"=== INFO ON CELL "<<PickedCell<<" ==="<<endl;
55 QVector<vtkIdType> absolute_c2c;
56 foreach(int i, c2c[_cells[PickedCell]]) {
57 if(i!=-1) absolute_c2c.push_back(cells[i]);
60 cout<<"absolute_c2c(PickedCell)="<<absolute_c2c<<endl;
61 EG_GET_CELL(PickedCell, m_Grid);
62 cout<<"pts=";
63 for (int i = 0; i < num_pts; i++)
64 cout << pts[i] << " ";
65 cout<<endl;
66 cout<<"coords:"<<endl;
67 for (int i = 0; i < num_pts; i++) {
68 vec3_t X;
69 m_Grid->GetPoint(pts[i],X.data());
70 cout<<"pts["<<i<<"]="<<X<<endl;
72 cout<<"area="<<cellVA(m_Grid,PickedCell)<<endl;
73 //cout<<"Q_L("<<PickedCell<<")="<<Q_L(PickedCell)<<endl;
74 cout<<"====================================="<<endl;
75 } else {
76 cout<<"Invalid cell"<<endl;
78 } else {
79 if(PickedPoint>=0 && PickedPoint<N_points) {
80 cout<<"=== INFO ON POINT "<<PickedPoint<<" ==="<<endl;
82 QSet<vtkIdType> absolute_n2n;
83 foreach(int i, n2n[_nodes[PickedPoint]]) {
84 if(i!=-1) absolute_n2n.insert(nodes[i]);
86 cout<<"absolute_n2n(PickedPoint)="<<absolute_n2n<<endl;
88 QSet<vtkIdType> absolute_n2c;
89 foreach(int i, n2c[_nodes[PickedPoint]]) {
90 if(i!=-1) absolute_n2c.insert(cells[i]);
92 cout<<"absolute_n2c(PickedPoint)="<<absolute_n2c<<endl;
94 EG_VTKDCN(vtkCharArray_t, node_type, m_Grid, "node_type");//node type
95 cout<<"node_type="<<VertexType2Str(node_type->GetValue(PickedPoint))<<endl;
96 vec3_t X;
97 m_Grid->GetPoint(PickedPoint,X.data());
98 cout<<"X="<<X<<endl;
99 cout<<"desiredEdgeLength("<<PickedPoint<<")="<<desiredEdgeLength(PickedPoint)<<endl;
100 //cout<<"Q_L1("<<PickedPoint<<")="<<Q_L1(PickedPoint)<<endl;
101 //cout<<"Q_L2("<<PickedPoint<<")="<<Q_L2(PickedPoint)<<endl;
102 cout<<"currentVertexAvgDist("<<PickedPoint<<")="<<currentVertexAvgDist(PickedPoint)<<endl;
104 setBoundaryCodes(GuiMainWindow::pointer()->getAllBoundaryCodes());
105 updateNodeInfo();
106 QVector <vtkIdType> PSP_vector = getPotentialSnapPoints( PickedPoint );
107 qDebug()<<"PSP_vector="<<PSP_vector;
109 cout<<"====================================="<<endl;
110 } else {
111 cout<<"Invalid point"<<endl;