2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008,2009 Oliver Gloth +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
25 #include "insertpoints.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
=grid
->GetNumberOfCells();
50 int N_points
=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 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 grid
->GetPoint(pts
[i
],X
.data());
69 cout
<<"pts["<<i
<<"]="<<X
<<endl
;
71 cout
<<"area="<<cellVA(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
, grid
, "node_type");//node type
94 cout
<<"node_type="<<VertexType2Str(node_type
->GetValue(PickedPoint
))<<endl
;
96 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
;
102 cout
<<"====================================="<<endl
;
104 cout
<<"Invalid point"<<endl
;