-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstripe.cpp
More file actions
715 lines (675 loc) · 18.6 KB
/
stripe.cpp
File metadata and controls
715 lines (675 loc) · 18.6 KB
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
#include "stripe.h"
#include <mpi.h>
void Stripe::ComputeOffsets()
{
if (isRowMajor){
colOffset=0;
rowOffset=0;
}
else{
rowOffset=0;
colOffset=stripeIndex*stripeSize;
}
}
float Stripe::asFloat(int row, int col)
{
return pDemStripe->asFloat(rowOffset+row, colOffset+col);
}
int Stripe::is_NoData(int row, int col)
{
return pDemStripe->is_NoData(rowOffset+row, colOffset+col);
}
//code that is different from the OpenMP version
int Stripe::is_InDEM(int row, int col){
int rOffset, cOffset;
if (isRowMajor){
cOffset=0;
rOffset=stripeIndex*stripeSize;
}
else{
rOffset=0;
cOffset=stripeIndex*stripeSize;
}
if (rOffset+row>=0 && rOffset+row<totalHeight && cOffset+col>=0 && cOffset+col<totalWidth)
return true;
return false;
// return pDem->is_InGrid(cOffset+row, cOffset+col);
}
int Stripe::is_InStrip(int row, int col)
{
if (row>=0 && row<height && col>=0 && col<width) return true;
return false;
}
void Stripe::SetData(int row, int col,float val)
{
pDemStripe->Set_Value(rowOffset+row, colOffset+col,val);
}
int Stripe::isCellOnInterStripBorder(int row, int col,int& cellIndex,int& borderIndex, float& spill)
{
if (isRowMajor) {
if (row==height-1) {
borderIndex=2;
cellIndex=col;
spill=border2.arrBorderNodes[cellIndex].spill;
return true;
}
else if (row==0)
{
borderIndex=1;
cellIndex=col;
spill=border1.arrBorderNodes[cellIndex].spill;
return true;
}
return false;
}
else {
if (col==width-1) {
cellIndex=row;
borderIndex=2;
spill=border2.arrBorderNodes[cellIndex].spill;
return true;
}
else if (col==0)
{
cellIndex=row;
borderIndex=1;
spill=border1.arrBorderNodes[cellIndex].spill;
return true;
}
return false;
}
}
void Stripe::AddCellToBorderDCList(int cellIndex,int borderIndex,float spill)
{
if (borderIndex==1){
border1.arrSpillChangedNodeIndex.push_back(cellIndex);
border1.arrBorderNodes[cellIndex].spill=spill;
border1.arrBorderNodes[cellIndex].isDepressionCell=true;
}
else
{
border2.arrSpillChangedNodeIndex.push_back(cellIndex);
border2.arrBorderNodes[cellIndex].spill=spill;
border2.arrBorderNodes[cellIndex].isDepressionCell=true;
}
}
void Stripe::Initialize()
{
ComputeOffsets();
mainFlag.Init(width,height);
depressionFlag.Init(width,height);
int size,i;
if (isRowMajor)
size=width;
else
size=height;
//allocate space for border cell arrays
border1.Init(size);
border2.Init(size);
borderInNeighborStrip1.Init(size);
borderInNeighborStrip2.Init(size);
//
if (isRowMajor){
if (stripeIndex>0) {
for(i=0;i<size; i++)
border1.arrBorderNodes[i].spill=asFloat(0,i);
}
if (stripeIndex<stripeNumber-1){
for(i=0;i<size; i++)
border2.arrBorderNodes[i].spill=asFloat(height-1,i);
}
}
else {
if (stripeIndex>0) {
for(i=0;i<size; i++)
border1.arrBorderNodes[i].spill=asFloat(i,0);
}
if (stripeIndex<stripeNumber-1){
for(i=0;i<size; i++)
border2.arrBorderNodes[i].spill=asFloat(i,width-1);
}
}
}
void Stripe::PushBorderCellsIntoPQ()
{
Node tmpNode;
int row, col,iRow, iCol,i;
int isBorder=false;
//Push real border cells of original DEM to PQ
for ( row = 0; row <height; row++)
{
for (col = 0; col <width; col++)
{
//is the cell a NoData cell
if (!is_NoData(row, col))
{
//iterate its eight neighbors
for (i = 0; i < 8; i++)
{
iRow = Get_rowTo(i, row);
iCol = Get_colTo(i, col);
//if its neighbor is outside DEM (not this stripe) or NODATA cell
//it is on the real border of original DEM
if (!is_InDEM(iRow, iCol))
isBorder=true;
else if (is_NoData(iRow, iCol))
isBorder=true;
else isBorder=false;
if (isBorder)
{
//push into PQ
tmpNode.col = col;
tmpNode.row = row;
tmpNode.spill = asFloat(row, col);
priorityQueue.push(tmpNode);
mainFlag.SetFlag(row,col);
break;
}
}
}
else{
mainFlag.SetFlag(row,col); //mark NO_DATA cell as processed
}
}
}
}
//process slope cells using zhou's one-pass algorithm
void Stripe::ProcessSlopeCells(int isFirstTime)
{
int iRow, iCol,i;
float iSpill,val;
int cellIndex, borderIndex;
Node N,node,headNode;
int total=0,nPSC=0;
bool bInPQ=false;
bool isBoundary;
int j,jRow,jCol;
while (!traceQueue.empty())
{
node = traceQueue.front();
traceQueue.pop();
bInPQ=false;
if (!isFirstTime) {
if (isCellOnInterStripBorder(node.row, node.col,cellIndex,borderIndex,val)){
AddSlopeCellToListWithLowerSpillEle(cellIndex,borderIndex,node.spill);
}
}
for (i = 0; i < 8; i++)
{
iRow = Get_rowTo(i, node.row);
iCol = Get_colTo(i, node.col);
if (mainFlag.IsProcessed(iRow,iCol) || depressionFlag.IsProcessed(iRow,iCol)) continue;
iSpill =asFloat(iRow, iCol);
if (iSpill <= node.spill) {
if (!bInPQ) {
//decide whether (iRow, iCol) is a real slope border cell
//whetehr i can flow to a flagged j
isBoundary=true;
for (j = 0; j < 8; j++)
{
jRow = Get_rowTo(j, iRow);
jCol = Get_colTo(j, iCol);
if (!is_InStrip(jRow,jCol))continue; //Note: this is different from the non-parallel method;
if ((mainFlag.IsProcessedDirect(jRow,jCol)|| depressionFlag.IsProcessedDirect(jRow,jCol)) && asFloat(jRow,jCol)<iSpill)
//i flows to j; i is not a slope border cell
{
isBoundary=false;
break;
}
}
if (isBoundary) {
priorityQueue.push(node);
bInPQ=true;
}
}
continue; //i is lower than current node; current node is not pushed to the tracequeue
}
//N is unflagged and N>C
//N is puhsed to traceque
N.col = iCol;
N.row = iRow;
N.spill = iSpill;
traceQueue.push(N);
mainFlag.SetFlag(iRow,iCol); //set processed flag
}
}
}
void Stripe::ProcessDepressionCells()
{
int iRow, iCol,i;
float iSpill,val;
Node N;
Node node,frontNode;
int borderDCNum=0; //border depression cell number
int borderIndex,cellIndex;
frontNode=depressionQue.front();
while (!depressionQue.empty())
{
node= depressionQue.front();
depressionQue.pop();
//process stripe border cells in the depression
if (isCellOnInterStripBorder(node.row, node.col,cellIndex,borderIndex,val)){
borderDCNum++;
//update the spill elevation values of the border cell
AddCellToBorderDCList(cellIndex,borderIndex,node.spill);
}
for (i = 0; i < 8; i++)
{
iRow = Get_rowTo(i, node.row);
iCol = Get_colTo(i, node.col);
if (!is_InStrip(iRow,iCol))continue;
if (depressionFlag.IsProcessedDirect(iRow,iCol) || mainFlag.IsProcessedDirect(iRow,iCol)) continue;
iSpill = asFloat(iRow, iCol);
N.row = iRow;
N.col = iCol;
if (iSpill > node.spill)
{ //not in the depression, should be pushed to the traceQ
mainFlag.SetFlag(iRow,iCol);
N.spill = iSpill;
traceQueue.push(N);
continue;
}
//lower than spill cell and is a depression cell
//mark the cell
depressionFlag.SetFlag(iRow,iCol);
N.spill = node.spill;
depressionQue.push(N);
}
}
if (borderDCNum>0) return;
//Otherwise,the final spill cell has been found, fill the depression
FillDepression(frontNode);
}
void Stripe::FillDepression(Node node)
{
//depressionQue should be empty now
int row, col,iRow, iCol,i;
float iSpill;
Node N;
depressionQue.push(node);
mainFlag.SetFlag(node.row, node.col);
while (!depressionQue.empty())
{
node= depressionQue.front();
depressionQue.pop();
SetData(node.row, node.col,node.spill);
//depressionFlag.RemoveFlag(node.row, node.col);
for (i = 0; i < 8; i++)
{
iRow = Get_rowTo(i, node.row);
iCol = Get_colTo(i, node.col);
if (mainFlag.IsProcessed(iRow,iCol)) continue;
mainFlag.SetFlag(iRow,iCol);
N.row = iRow;
N.col = iCol;
N.spill=node.spill;
iSpill=asFloat(iRow,iCol);
if (iSpill<=node.spill) {
depressionQue.push(N);
}
}
}
}
void Stripe::PriorityFlood(int isFirstTime)
{
Node node, N;
int iRow, iCol,i,row, col;
int cellIndex,borderIndex;
float iSpill, spill,val;
if (!isFirstTime) {
//clear depression cell state
depressionFlag.ClearAllFlags();
border1.arrSpillChangedNodeIndex.clear();
border2.arrSpillChangedNodeIndex.clear();
}
while (!priorityQueue.empty()){
node=priorityQueue.top();
priorityQueue.pop();
for (i = 0; i < 8; i++)
{
iRow = Get_rowTo(i, node.row);
iCol = Get_colTo(i, node.col);
//check both flags
if (!is_InStrip(iRow,iCol))continue;
//not first time
if (!isFirstTime) {
if (isCellOnInterStripBorder(iRow,iCol,cellIndex,borderIndex,val)){
if (val<node.spill) continue; //no need to process iCell because iCell's spill is lower
}
}
if (mainFlag.IsProcessedDirect(iRow,iCol) || depressionFlag.IsProcessedDirect(iRow,iCol))
continue;
iSpill = asFloat(iRow, iCol);
N.row = iRow;
N.col = iCol;
if (iSpill <= node.spill)
{
// it is a depression cell
depressionFlag.SetFlag(iRow,iCol);
N.spill = node.spill;
depressionQue.push(N);
ProcessDepressionCells();
}
else {
//it is a slope cell, mask it in the main mask
mainFlag.SetFlag(iRow,iCol);
N.spill = iSpill;
traceQueue.push(N);
}
ProcessSlopeCells(isFirstTime);
}
}
}
int Stripe::PushCellIntoPQ_FirstTime(StripeBorder& border, StripeBorder& borderInNeighboringStrip, int borderIndex)
{
unsigned int index;
float spill,ispill;
int i;
int findLowerSpillElevation;
int row,col;
int total=0;
int offset=0;
for (index=0;index<border.arrSpillChangedNodeIndex.size(); index++){
i=border.arrSpillChangedNodeIndex[index];
spill=border.arrBorderNodes[i].spill;
findLowerSpillElevation=false;
//check the three neighboring cells
if (i>0) {
ispill=borderInNeighboringStrip.arrBorderNodes[i-1].spill;
if (fabs(NO_DATA_VALUE-ispill)>0.001) {
if (ispill<spill) {
spill=ispill;
findLowerSpillElevation=true;
offset=-1;
}
}
}
ispill=borderInNeighboringStrip.arrBorderNodes[i].spill;
if (fabs(NO_DATA_VALUE-ispill)>0.001) {
if (ispill<spill) {
spill=ispill;
findLowerSpillElevation=true;
offset=0;
}
}
if (i+1<border.arrBorderNodes.size()) {
ispill=borderInNeighboringStrip.arrBorderNodes[i+1].spill;
if (fabs(NO_DATA_VALUE-ispill)>0.001) {
if (ispill<spill) {
spill=ispill;
findLowerSpillElevation=true;
offset=1;
}
}
}
if (findLowerSpillElevation){
if (borderInNeighboringStrip.arrBorderNodes[i+offset].isPushedToPQAlready) continue;
borderInNeighboringStrip.arrBorderNodes[i+offset].isPushedToPQAlready=true;
if (isRowMajor) {
col=i+offset;
if (borderIndex==1)
{
row=-1;
}
else {
row=height;
}
}
else {
row=i+offset;
if (borderIndex==1)
{
col=-1;
}
else {
col=width;
}
}
priorityQueue.push(Node(row,col,spill));
total++;
}
}
return total;
}
void Stripe::PackBorder(int isFirstTime,StripeBorder& border, unsigned char*& pBuff, int& byteCount)
{
int i;
//for the first time, no need to pack arrSpillChangedNodeIndex because it is not used in neighboring stripe
if (isFirstTime){
byteCount=border.arrBorderNodes.size()*sizeof(float);
delete[] pBuff;
pBuff=new unsigned char[byteCount];
float* pFloat=(float*)pBuff;
for (i=0; i<border.arrBorderNodes.size(); i++){
pFloat[i]=border.arrBorderNodes[i].spill;
}
}
else {
//for other times, need to pack arrSpillChangedNodeIndex because it is used in neighboring stripe
byteCount=border.arrBorderNodes.size()*sizeof(float)+sizeof(int)+sizeof(int)*border.arrSpillChangedNodeIndex.size();
delete[] pBuff;
pBuff=new unsigned char[byteCount];
float* pFloat=(float*)pBuff;
for (i=0; i<border.arrBorderNodes.size(); i++){
pFloat[i]=border.arrBorderNodes[i].spill;
}
int* pIndexSize=(int*)(pFloat+border.arrBorderNodes.size());
*pIndexSize=border.arrSpillChangedNodeIndex.size();
int *pInt=pIndexSize+1;
for (i=0; i<border.arrSpillChangedNodeIndex.size(); i++){
pInt[i]=border.arrSpillChangedNodeIndex[i];
}
}
}
void Stripe::UnpackBorder(int isFirstTime,StripeBorder& border, unsigned char* pBuff)
{
int i;
if (isFirstTime){
float* pFloat=(float*)pBuff;
for (i=0; i<border.arrBorderNodes.size(); i++){
border.arrBorderNodes[i].spill=pFloat[i];
}
}
else {
float* pFloat=(float*)pBuff;
for (i=0; i<border.arrBorderNodes.size(); i++){
border.arrBorderNodes[i].spill=pFloat[i];
}
int* pIndexSize=(int*)(pFloat+border.arrBorderNodes.size());
int *pInt=pIndexSize+1;
border.arrSpillChangedNodeIndex.clear();//first clear
for (i=0; i<*pIndexSize; i++){
border.arrSpillChangedNodeIndex.push_back(pInt[i]);
}
}
}
void Stripe::Share(int isFirstTime)
{
if(this->stripeNumber<=1) return; //no need to share data between stripes
MPI_Status status;
int byteCount;
unsigned char* border_buffer_1=NULL;
unsigned char* border_buffer_2=NULL;
unsigned char* borderNeighbor1=NULL;
unsigned char* borderNeighbor2=NULL;
int maxbyte=width*(sizeof(float)+sizeof(int))+sizeof(int);
if(stripeIndex<stripeNumber-1){
//pack border info of this stripe and send to neighbor 2
PackBorder(isFirstTime,this->border2,border_buffer_2,byteCount);
MPI_Send(border_buffer_2, byteCount,MPI_UNSIGNED_CHAR,stripeIndex+1, 0, MPI_COMM_WORLD);
}
if(stripeIndex >0) {
//receive border info of neighbor1
borderNeighbor1=new unsigned char[maxbyte];
MPI_Recv(borderNeighbor1,maxbyte , MPI_UNSIGNED_CHAR, stripeIndex-1, 0, MPI_COMM_WORLD, &status);
//unpack data
UnpackBorder(isFirstTime,this->borderInNeighborStrip1,borderNeighbor1);
}
if(stripeIndex>0){
//pack border info of this stripe and send to neighbor 1
PackBorder(isFirstTime,this->border1,border_buffer_1,byteCount);
MPI_Send(border_buffer_1, byteCount,MPI_UNSIGNED_CHAR,stripeIndex-1, 0, MPI_COMM_WORLD);
}
if(stripeIndex<stripeNumber-1)
{
//receive border info of neighbor2
borderNeighbor2=new unsigned char[maxbyte];
MPI_Recv(borderNeighbor2, maxbyte, MPI_UNSIGNED_CHAR, stripeIndex+1, 0, MPI_COMM_WORLD, &status);
//unpack data
UnpackBorder(isFirstTime,this->borderInNeighborStrip2,borderNeighbor2);
}
delete[] borderNeighbor1;
delete[] borderNeighbor2;
delete[] border_buffer_1;
delete[] border_buffer_2;
}
int Stripe::UpdatePotentialSpillandPushToPQ_FirstTime(Stripe* pStrip)
{
Share(true);
int total=0;
if(stripeIndex>0) {
total+=PushCellIntoPQ_FirstTime(border1,borderInNeighborStrip1,1);
}
if (stripeIndex<stripeNumber-1){
total+=PushCellIntoPQ_FirstTime(border2,borderInNeighborStrip2,2);
}
return total;
}
//the following section process cells at other times
/*****************************************************************************************/
void Stripe::AddSlopeCellToListWithLowerSpillEle(int cellIndex,int borderIndex,float spill)
{
if (borderIndex==1){
border1.arrSpillChangedNodeIndex.push_back(cellIndex);
border1.arrBorderNodes[cellIndex].spill=spill;
border1.arrBorderNodes[cellIndex].isDepressionCell=false;
}
else
{
border2.arrSpillChangedNodeIndex.push_back(cellIndex);
border2.arrBorderNodes[cellIndex].spill=spill;
border2.arrBorderNodes[cellIndex].isDepressionCell=false;
}
}
int Stripe::UpdatePotentialSpillandPushToPQ_OtherTimes(Stripe* pStrip)
{
Share(false);
int total=0;
if(stripeIndex>0) {
total+=PushCellIntoPQ_OtherTimes(border1,borderInNeighborStrip1,1);
}
if (stripeIndex<stripeNumber-1){
total+=PushCellIntoPQ_OtherTimes(border2,borderInNeighborStrip2,2);
}
return total;
}
int Stripe::PushCellIntoPQ_OtherTimes(StripeBorder& border, StripeBorder& borderInNeighboringStrip, int borderIndex)
{
unsigned int index;
float spill,ispill;
int i;
int findDCWithHigherSpillElevation;
int row,col;
int total=0;
for (index=0;index<borderInNeighboringStrip.arrSpillChangedNodeIndex.size(); index++){
i=borderInNeighboringStrip.arrSpillChangedNodeIndex[index];
spill=borderInNeighboringStrip.arrBorderNodes[i].spill; //find the changed cell in neighboring cell
findDCWithHigherSpillElevation=false;
if (i>0) {
if (border.arrBorderNodes[i-1].isDepressionCell) {
ispill=border.arrBorderNodes[i-1].spill;
if (fabs(NO_DATA_VALUE-ispill)>0.001) {
if (spill<ispill) {
findDCWithHigherSpillElevation=true;
}
}
}
}
if (!findDCWithHigherSpillElevation) {
if (border.arrBorderNodes[i].isDepressionCell) {
ispill=border.arrBorderNodes[i].spill;
if (fabs(NO_DATA_VALUE-ispill)>0.001) {
if (spill<ispill) {
findDCWithHigherSpillElevation=true;
}
}
}
}
if (!findDCWithHigherSpillElevation) {
if (border.arrBorderNodes[i+1].isDepressionCell) {
if (i+1<border.arrBorderNodes.size()) {
ispill=border.arrBorderNodes[i+1].spill;
if (fabs(NO_DATA_VALUE-ispill)>0.001) {
if (spill<ispill) {
findDCWithHigherSpillElevation=true;
}
}
}
}
}
if (findDCWithHigherSpillElevation){
if (isRowMajor) {
col=i;
if (borderIndex==1)
{
row=-1;
}
else {
row=height;
}
}
else {
row=i;
if (borderIndex==1)
{
col=-1;
}
else {
col=width;
}
}
priorityQueue.push(Node(row,col,spill));
total++;
}
}
return total;
}
void Stripe::FillDepressionFromStripBorder(){
int size,i;
if (isRowMajor)
size=width;
else
size=height;
if (isRowMajor) {
if (stripeIndex>0) {
for (i=0; i<size; i++){
if (border1.arrBorderNodes[i].isDepressionCell && !mainFlag.IsProcessed(0,i)){
FillDepression(Node(0,i,border1.arrBorderNodes[i].spill));
}
}
}
if (stripeIndex<stripeNumber-1) {
for (i=0; i<size; i++){
if (border2.arrBorderNodes[i].isDepressionCell && !mainFlag.IsProcessed(height-1,i)){
FillDepression(Node(height-1,i,border2.arrBorderNodes[i].spill));
}
}
}
}
else {
if (stripeIndex>0) {
for (i=0; i<size; i++){
if (border1.arrBorderNodes[i].isDepressionCell && !mainFlag.IsProcessed(i,0)){
FillDepression(Node(i,0,border1.arrBorderNodes[i].spill));
}
}
}
if (stripeIndex<stripeNumber-1) {
for (i=0; i<size; i++){
if (border2.arrBorderNodes[i].isDepressionCell && !mainFlag.IsProcessed(i,width-1)){
FillDepression(Node(i,width-1,border2.arrBorderNodes[i].spill));
}
}
}
}
}