質問編集履歴
1
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,9 +46,85 @@
|
|
46
46
|
|
47
47
|
|
48
48
|
|
49
|
+
### 該当すると思われるプログラム
|
50
|
+
|
51
|
+
プログラムが長く、また複数のファイルに及ぶので、エラーが出た辺りのコードのみを載せます。
|
52
|
+
|
53
|
+
```c++
|
54
|
+
|
55
|
+
maxx = minx + ( numcols - 1 ) * delgrid;
|
56
|
+
|
57
|
+
maxy = miny + ( numrows - 1 ) * delgrid;
|
58
|
+
|
59
|
+
dx = maxx - minx;
|
60
|
+
|
61
|
+
dy = maxy - miny;
|
62
|
+
|
63
|
+
di = numcols;
|
64
|
+
|
65
|
+
dj = numrows;
|
66
|
+
|
67
|
+
// create matrix from input file:
|
68
|
+
|
69
|
+
tMatrix< double > elev( numrows, numcols );
|
70
|
+
|
71
|
+
for( j=0; j<numrows; j++ )
|
72
|
+
|
73
|
+
{
|
74
|
+
|
75
|
+
for( i=0; i<numcols; i++ )
|
76
|
+
|
77
|
+
{
|
78
|
+
|
79
|
+
if( gridfile.eof() )
|
80
|
+
|
81
|
+
ReportFatalError( "Reached end-of-file while reading points." );
|
82
|
+
|
83
|
+
gridfile >> elev( j, i );
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
gridfile.close();
|
90
|
+
|
91
|
+
std::cout << "finished reading file," << gridfile << std::endl;
|
92
|
+
|
93
|
+
// Create the 3 nodes that form the supertriangle and place them on the
|
94
|
+
|
95
|
+
// node list in counter-clockwise order. (Note that the base and height
|
96
|
+
|
97
|
+
// of the supertriangle are 5 times the
|
98
|
+
|
99
|
+
// width and height, respectively, of the rectangle that encloses the
|
100
|
+
|
101
|
+
// points.) Assigning the IDs allows us to retrieve and delete these
|
102
|
+
|
103
|
+
// nodes when we're done creating the mesh.
|
104
|
+
|
105
|
+
tempnode.set3DCoords( minx-2*dx, miny-2*dy, 0.0 );
|
106
|
+
|
107
|
+
tempnode.setBoundaryFlag( kClosedBoundary );
|
108
|
+
|
109
|
+
tempnode.setID( -3 );
|
110
|
+
|
111
|
+
nodeList.insertAtBack( tempnode );
|
112
|
+
|
113
|
+
tempnode.set3DCoords( maxx+2*dx, miny-2*dy, 0.0 );
|
114
|
+
|
115
|
+
tempnode.setID( -2 );
|
116
|
+
|
117
|
+
nodeList.insertAtBack( tempnode );
|
118
|
+
|
119
|
+
tempnode.set3DCoords( minx+0.5*dx, maxy+2*dy, 0.0 );
|
120
|
+
|
121
|
+
tempnode.setID( -1 );
|
122
|
+
|
123
|
+
nodeList.insertAtBack( tempnode );
|
49
124
|
|
50
125
|
|
51
126
|
|
127
|
+
```
|
52
128
|
|
53
129
|
|
54
130
|
|