1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + This file is part of enGrid. +
5 // + Copyright 2008-2014 enGits GmbH +
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. +
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. +
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/>. +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
23 #include "insertpoints.h"
25 #include "guimainwindow.h"
27 #include "geometrytools.h"
28 using namespace GeometryTools
;
30 #include <vtkCharArray.h>
32 ShowInfo::ShowInfo(bool b
, vtkIdType P
, vtkIdType C
) : SurfaceOperation()
39 void ShowInfo::operate()
41 l2g_t nodes
= getPartNodes();
42 g2l_t _nodes
= getPartLocalNodes();
43 l2g_t cells
= getPartCells();
44 g2l_t _cells
= getPartLocalCells();
45 l2l_t c2c
= getPartC2C();
46 l2l_t n2n
= getPartN2N();
47 l2l_t n2c
= getPartN2C();
49 int N_cells
=m_Grid
->GetNumberOfCells();
50 int N_points
=m_Grid
->GetNumberOfPoints();
52 if(PickedCell
>=0 && PickedCell
<N_cells
) {
53 cout
<<"=== INFO ON CELL "<<PickedCell
<<" ==="<<endl
;
54 QVector
<vtkIdType
> absolute_c2c
;
55 foreach(int i
, c2c
[_cells
[PickedCell
]]) {
56 if(i
!=-1) absolute_c2c
.push_back(cells
[i
]);
59 cout
<<"absolute_c2c(PickedCell)="<<absolute_c2c
<<endl
;
60 vtkIdType
*pts
, N_pts
;
61 m_Grid
->GetCellPoints(PickedCell
, N_pts
, pts
);
63 for(int i
=0;i
<N_pts
;i
++) cout
<<pts
[i
]<<" ";
65 cout
<<"coords:"<<endl
;
66 for(int i
=0;i
<N_pts
;i
++) {
68 m_Grid
->GetPoint(pts
[i
],X
.data());
69 cout
<<"pts["<<i
<<"]="<<X
<<endl
;
71 cout
<<"area="<<cellVA(m_Grid
,PickedCell
)<<endl
;
72 //cout<<"Q_L("<<PickedCell<<")="<<Q_L(PickedCell)<<endl;
73 cout
<<"====================================="<<endl
;
75 cout
<<"Invalid cell"<<endl
;
78 if(PickedPoint
>=0 && PickedPoint
<N_points
) {
79 cout
<<"=== INFO ON POINT "<<PickedPoint
<<" ==="<<endl
;
81 QSet
<vtkIdType
> absolute_n2n
;
82 foreach(int i
, n2n
[_nodes
[PickedPoint
]]) {
83 if(i
!=-1) absolute_n2n
.insert(nodes
[i
]);
85 cout
<<"absolute_n2n(PickedPoint)="<<absolute_n2n
<<endl
;
87 QSet
<vtkIdType
> absolute_n2c
;
88 foreach(int i
, n2c
[_nodes
[PickedPoint
]]) {
89 if(i
!=-1) absolute_n2c
.insert(cells
[i
]);
91 cout
<<"absolute_n2c(PickedPoint)="<<absolute_n2c
<<endl
;
93 EG_VTKDCN(vtkCharArray
, node_type
, m_Grid
, "node_type");//node type
94 cout
<<"node_type="<<VertexType2Str(node_type
->GetValue(PickedPoint
))<<endl
;
96 m_Grid
->GetPoint(PickedPoint
,X
.data());
98 cout
<<"desiredEdgeLength("<<PickedPoint
<<")="<<desiredEdgeLength(PickedPoint
)<<endl
;
99 //cout<<"Q_L1("<<PickedPoint<<")="<<Q_L1(PickedPoint)<<endl;
100 //cout<<"Q_L2("<<PickedPoint<<")="<<Q_L2(PickedPoint)<<endl;
101 cout
<<"currentVertexAvgDist("<<PickedPoint
<<")="<<currentVertexAvgDist(PickedPoint
)<<endl
;
103 setBoundaryCodes(GuiMainWindow::pointer()->getAllBoundaryCodes());
105 QVector
<vtkIdType
> PSP_vector
= getPotentialSnapPoints( PickedPoint
);
106 qDebug()<<"PSP_vector="<<PSP_vector
;
108 cout
<<"====================================="<<endl
;
110 cout
<<"Invalid point"<<endl
;