1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228 |
#include "FacetEntity.hpp"
#include "CubitFacet.hpp"
#include "CubitPoint.hpp"
#include "CubitFacetEdge.hpp"
#include "GfxDebug.hpp"
#include "CubitBox.hpp"
#include "ChollaSurface.hpp"
#include "CubitMessage.hpp"
#include "ChollaDebug.hpp"
static int fg_color = CUBIT_MAGENTA_INDEX;
void dcolor(int icol)
{
fg_color = icol;
}
void ddraw( FacetEntity *facet_ptr )<--- The function 'ddraw' is never used.
{
facet_ptr->debug_draw( fg_color );
}
void dfdraw( CubitFacet *facet_ptr )
{
facet_ptr->debug_draw( fg_color );
}
void dedraw( CubitFacetEdge *facet_ptr )
{
facet_ptr->debug_draw( fg_color );
}
void dpdraw( CubitPoint *facet_ptr )
{
facet_ptr->debug_draw( fg_color );
}
void dview()
{
GfxDebug::flush();
GfxDebug::mouse_xforms();
}
void dzoom(CubitBox &box)
{
GfxDebug::zoom(box);
}
void dsurfdraw( ChollaSurface *surf)<--- The function 'dsurfdraw' is never used.
{
DLIList<FacetEntity*> surface_facets;
surf->get_facets(surface_facets);
dldraw(surface_facets);
}
void dldraw( DLIList<FacetEntity *> &facet_list )
{
FacetEntity *facet_ptr;<--- The scope of the variable 'facet_ptr' can be reduced. [+]The scope of the variable 'facet_ptr' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x)
{
int i = 0;
if (x) {
// it's safe to move 'int i = 0;' here
for (int n = 0; n < 10; ++n) {
// it is possible but not safe to move 'int i = 0;' here
do_something(&i);
}
}
}
When you see this message it is always safe to reduce the variable scope 1 level.
for (int ii=0; ii<facet_list.size(); ii++)
{
facet_ptr = facet_list.get_and_step();
facet_ptr->debug_draw( fg_color, 0 );
}
GfxDebug::flush();
}
void dfldraw( DLIList<CubitFacet *> &facet_list )
{
CubitFacet *facet_ptr;<--- The scope of the variable 'facet_ptr' can be reduced. [+]The scope of the variable 'facet_ptr' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x)
{
int i = 0;
if (x) {
// it's safe to move 'int i = 0;' here
for (int n = 0; n < 10; ++n) {
// it is possible but not safe to move 'int i = 0;' here
do_something(&i);
}
}
}
When you see this message it is always safe to reduce the variable scope 1 level.
for (int ii=0; ii<facet_list.size(); ii++)
{
facet_ptr = facet_list.get_and_step();
facet_ptr->debug_draw( fg_color, 0 );
}
GfxDebug::flush();
}
void deldraw( DLIList<CubitFacetEdge *> &edge_list )
{
CubitFacetEdge *edge_ptr;<--- The scope of the variable 'edge_ptr' can be reduced. [+]The scope of the variable 'edge_ptr' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x)
{
int i = 0;
if (x) {
// it's safe to move 'int i = 0;' here
for (int n = 0; n < 10; ++n) {
// it is possible but not safe to move 'int i = 0;' here
do_something(&i);
}
}
}
When you see this message it is always safe to reduce the variable scope 1 level.
for (int ii=0; ii<edge_list.size(); ii++)
{
edge_ptr = edge_list.get_and_step();
edge_ptr->debug_draw( fg_color, 0 );
}
GfxDebug::flush();
}
void dpldraw( DLIList<CubitPoint *> &point_list )
{
CubitPoint *point_ptr;<--- The scope of the variable 'point_ptr' can be reduced. [+]The scope of the variable 'point_ptr' can be reduced. Warning: Be careful when fixing this message, especially when there are inner loops. Here is an example where cppcheck will write that the scope for 'i' can be reduced:
void f(int x)
{
int i = 0;
if (x) {
// it's safe to move 'int i = 0;' here
for (int n = 0; n < 10; ++n) {
// it is possible but not safe to move 'int i = 0;' here
do_something(&i);
}
}
}
When you see this message it is always safe to reduce the variable scope 1 level.
for (int ii=0; ii<point_list.size(); ii++)
{
point_ptr = point_list.get_and_step();
point_ptr->debug_draw( fg_color, 0 );
}
GfxDebug::flush();
}
int dflcheck( DLIList<CubitFacet *> &facet_list )<--- The function 'dflcheck' is never used.
{
int ii;
int ier = 0;
for (ii=0; ii<facet_list.size(); ii++)
{
CubitFacet *facet_ptr = facet_list.get_and_step();
ier += dfcheck( facet_ptr );
}
return ier;
}
int dcheck( DLIList<FacetEntity *> &facet_list )<--- The function 'dcheck' is never used.
{
int ii;
int ier = 0;
for (ii=0; ii<facet_list.size(); ii++)
{
CubitFacet *facet_ptr = (CubitFacet *)facet_list.get_and_step();
ier += dfcheck( facet_ptr );
}
return ier;
}
int dfcheck( CubitFacet *facet_ptr )
{
int ier = 0;
// check edges
int ii, jj;
for (ii=0; ii<3; ii++)
{
CubitFacetEdge *edge_ptr = facet_ptr->edge( ii );
DLIList <CubitFacet *> facet_list;
edge_ptr->facets( facet_list );
int found = 0;
for (jj=0; jj<facet_list.size() && !found; jj++)
{
CubitFacet *f = facet_list.get_and_step();
if (f == facet_ptr)
{
found = 1;
}
}
if (!found)
{
PRINT_ERROR( "Facet %d is not in Edge %d adjacency list\n",
facet_ptr->id(), edge_ptr->id() );
ier++;
}
// check the edge's orientation on the facet
CubitPoint *ep0, *ep1;
int use = facet_ptr->edge_use( ii );
if (use > 0)
{
ep0 = edge_ptr->point( 0 );
ep1 = edge_ptr->point( 1 );
}
else
{
ep1 = edge_ptr->point( 0 );
ep0 = edge_ptr->point( 1 );
}
CubitPoint *fp0 = facet_ptr->point( (ii+1)%3 );
CubitPoint *fp1 = facet_ptr->point( (ii+2)%3 );
if (fp0 != ep0 || fp1 != ep1)
{
PRINT_ERROR( "Edge %d on Facet %d is not oriented with points %d and %d correctly\n",
edge_ptr->id(), facet_ptr->id(), fp0->id(), fp1->id() );
ier++;
}
}
// check nodes
for (ii=0; ii<3; ii++)
{
CubitPoint *point_ptr = facet_ptr->point( ii );
DLIList <CubitFacet *> facet_list;
point_ptr->facets( facet_list );
int found = 0;
for (jj=0; jj<facet_list.size() && !found; jj++)
{
CubitFacet *f = facet_list.get_and_step();
if (f == facet_ptr)
{
found = 1;
}
}
if (!found)
{
PRINT_ERROR( "Facet %d is not in Point %d adjacency list\n",
facet_ptr->id(), point_ptr->id() );
ier++;
}
}
return ier;
}
// draw a vector
void dray( const CubitVector &start, const CubitVector &vec, double length )
{
CubitVector end = start+length*vec;
GfxDebug::draw_vector(end, start, fg_color );
GfxDebug::flush();
}
// draw a point
void dpoint( const CubitVector &pt )
{
GfxDebug::draw_point(pt, fg_color);
GfxDebug::flush();
}
int get_color()
{
return fg_color;
}
//EOF
|