| [0b990d] | 1 | //
 | 
|---|
 | 2 | // blkiter.cc
 | 
|---|
 | 3 | //
 | 
|---|
 | 4 | // Copyright (C) 1996 Limit Point Systems, Inc.
 | 
|---|
 | 5 | //
 | 
|---|
 | 6 | // Author: Curtis Janssen <cljanss@limitpt.com>
 | 
|---|
 | 7 | // Maintainer: LPS
 | 
|---|
 | 8 | //
 | 
|---|
 | 9 | // This file is part of the SC Toolkit.
 | 
|---|
 | 10 | //
 | 
|---|
 | 11 | // The SC Toolkit is free software; you can redistribute it and/or modify
 | 
|---|
 | 12 | // it under the terms of the GNU Library General Public License as published by
 | 
|---|
 | 13 | // the Free Software Foundation; either version 2, or (at your option)
 | 
|---|
 | 14 | // any later version.
 | 
|---|
 | 15 | //
 | 
|---|
 | 16 | // The SC Toolkit is distributed in the hope that it will be useful,
 | 
|---|
 | 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
 | 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
 | 19 | // GNU Library General Public License for more details.
 | 
|---|
 | 20 | //
 | 
|---|
 | 21 | // You should have received a copy of the GNU Library General Public License
 | 
|---|
 | 22 | // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
 | 
|---|
 | 23 | // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 | 
|---|
 | 24 | //
 | 
|---|
 | 25 | // The U.S. Government is granted a limited license as per AL 91-7.
 | 
|---|
 | 26 | //
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 | #ifdef __GNUC__
 | 
|---|
 | 29 | #pragma implementation
 | 
|---|
 | 30 | #endif
 | 
|---|
 | 31 | 
 | 
|---|
 | 32 | #include <util/misc/formio.h>
 | 
|---|
 | 33 | #include <math/scmat/blkiter.h>
 | 
|---|
 | 34 | #include <math/scmat/block.h>
 | 
|---|
 | 35 | 
 | 
|---|
 | 36 | using namespace sc;
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 39 | // SCMatrixBlockIter member functions
 | 
|---|
 | 40 | 
 | 
|---|
 | 41 | SCMatrixBlockIter::~SCMatrixBlockIter()
 | 
|---|
 | 42 | {
 | 
|---|
 | 43 | }
 | 
|---|
 | 44 | 
 | 
|---|
 | 45 | void
 | 
|---|
 | 46 | SCMatrixBlockIter::accum(double a)
 | 
|---|
 | 47 | {
 | 
|---|
 | 48 |   set(get()+a);
 | 
|---|
 | 49 | }
 | 
|---|
 | 50 | 
 | 
|---|
 | 51 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 52 | // SCMatrixRectBlockIter member functions
 | 
|---|
 | 53 | 
 | 
|---|
 | 54 | SCMatrixRectBlockIter::SCMatrixRectBlockIter(SCMatrixRectBlock*a):
 | 
|---|
 | 55 |   block(a)
 | 
|---|
 | 56 | {
 | 
|---|
 | 57 |   reset();
 | 
|---|
 | 58 | }
 | 
|---|
 | 59 | 
 | 
|---|
 | 60 | void
 | 
|---|
 | 61 | SCMatrixRectBlockIter::reset()
 | 
|---|
 | 62 | {
 | 
|---|
 | 63 |   block_index = 0;
 | 
|---|
 | 64 |   i_ = block->istart;
 | 
|---|
 | 65 |   j_ = block->jstart;
 | 
|---|
 | 66 | }
 | 
|---|
 | 67 | 
 | 
|---|
 | 68 | SCMatrixRectBlockIter::~SCMatrixRectBlockIter()
 | 
|---|
 | 69 | {
 | 
|---|
 | 70 | }
 | 
|---|
 | 71 | 
 | 
|---|
 | 72 | int
 | 
|---|
 | 73 | SCMatrixRectBlockIter::i()
 | 
|---|
 | 74 | {
 | 
|---|
 | 75 |   return i_;
 | 
|---|
 | 76 | }
 | 
|---|
 | 77 | 
 | 
|---|
 | 78 | int
 | 
|---|
 | 79 | SCMatrixRectBlockIter::j()
 | 
|---|
 | 80 | {
 | 
|---|
 | 81 |   return j_;
 | 
|---|
 | 82 | }
 | 
|---|
 | 83 | 
 | 
|---|
 | 84 | double
 | 
|---|
 | 85 | SCMatrixRectBlockIter::get()
 | 
|---|
 | 86 | {
 | 
|---|
 | 87 |   return block->data[block_index];
 | 
|---|
 | 88 | }
 | 
|---|
 | 89 | 
 | 
|---|
 | 90 | void
 | 
|---|
 | 91 | SCMatrixRectBlockIter::set(double a)
 | 
|---|
 | 92 | {
 | 
|---|
 | 93 |   block->data[block_index] = a;
 | 
|---|
 | 94 | }
 | 
|---|
 | 95 | 
 | 
|---|
 | 96 | SCMatrixRectBlockIter::operator int()
 | 
|---|
 | 97 | {
 | 
|---|
 | 98 |   return (i_ < block->iend && j_ < block->jend);
 | 
|---|
 | 99 | }
 | 
|---|
 | 100 | 
 | 
|---|
 | 101 | void
 | 
|---|
 | 102 | SCMatrixRectBlockIter::operator ++()
 | 
|---|
 | 103 | {
 | 
|---|
 | 104 |   j_++;
 | 
|---|
 | 105 |   if (j_ >= block->jend) {
 | 
|---|
 | 106 |       j_ = block->jstart;
 | 
|---|
 | 107 |       i_++;
 | 
|---|
 | 108 |     }
 | 
|---|
 | 109 |   block_index++;
 | 
|---|
 | 110 | }
 | 
|---|
 | 111 | 
 | 
|---|
 | 112 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 113 | // SCMatrixRectSubBlockIter member functions
 | 
|---|
 | 114 | 
 | 
|---|
 | 115 | SCMatrixRectSubBlockIter::SCMatrixRectSubBlockIter(SCMatrixRectSubBlock*a):
 | 
|---|
 | 116 |   block(a)
 | 
|---|
 | 117 | {
 | 
|---|
 | 118 |   reset();
 | 
|---|
 | 119 | }
 | 
|---|
 | 120 | 
 | 
|---|
 | 121 | void
 | 
|---|
 | 122 | SCMatrixRectSubBlockIter::reset()
 | 
|---|
 | 123 | {
 | 
|---|
 | 124 |   i_ = block->istart;
 | 
|---|
 | 125 |   j_ = block->jstart;
 | 
|---|
 | 126 |   block_index = i_ * block->istride + j_;
 | 
|---|
 | 127 | }
 | 
|---|
 | 128 | 
 | 
|---|
 | 129 | SCMatrixRectSubBlockIter::~SCMatrixRectSubBlockIter()
 | 
|---|
 | 130 | {
 | 
|---|
 | 131 | }
 | 
|---|
 | 132 | 
 | 
|---|
 | 133 | int
 | 
|---|
 | 134 | SCMatrixRectSubBlockIter::i()
 | 
|---|
 | 135 | {
 | 
|---|
 | 136 |   return i_;
 | 
|---|
 | 137 | }
 | 
|---|
 | 138 | 
 | 
|---|
 | 139 | int
 | 
|---|
 | 140 | SCMatrixRectSubBlockIter::j()
 | 
|---|
 | 141 | {
 | 
|---|
 | 142 |   return j_;
 | 
|---|
 | 143 | }
 | 
|---|
 | 144 | 
 | 
|---|
 | 145 | double
 | 
|---|
 | 146 | SCMatrixRectSubBlockIter::get()
 | 
|---|
 | 147 | {
 | 
|---|
 | 148 |   return block->data[block_index];
 | 
|---|
 | 149 | }
 | 
|---|
 | 150 | 
 | 
|---|
 | 151 | void
 | 
|---|
 | 152 | SCMatrixRectSubBlockIter::set(double a)
 | 
|---|
 | 153 | {
 | 
|---|
 | 154 |   block->data[block_index] = a;
 | 
|---|
 | 155 | }
 | 
|---|
 | 156 | 
 | 
|---|
 | 157 | SCMatrixRectSubBlockIter::operator int()
 | 
|---|
 | 158 | {
 | 
|---|
 | 159 |   return (i_ < block->iend && j_ < block->jend);
 | 
|---|
 | 160 | }
 | 
|---|
 | 161 | 
 | 
|---|
 | 162 | void
 | 
|---|
 | 163 | SCMatrixRectSubBlockIter::operator ++()
 | 
|---|
 | 164 | {
 | 
|---|
 | 165 |   j_++;
 | 
|---|
 | 166 |   block_index++;
 | 
|---|
 | 167 |   if (j_ >= block->jend) {
 | 
|---|
 | 168 |       j_ = block->jstart;
 | 
|---|
 | 169 |       i_++;
 | 
|---|
 | 170 |       block_index += block->istride - (block->jend - block->jstart);
 | 
|---|
 | 171 |     }
 | 
|---|
 | 172 | }
 | 
|---|
 | 173 | 
 | 
|---|
 | 174 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 175 | // SCMatrixLTriBlockIter member functions
 | 
|---|
 | 176 | 
 | 
|---|
 | 177 | SCMatrixLTriBlockIter::SCMatrixLTriBlockIter(SCMatrixLTriBlock*a):
 | 
|---|
 | 178 |   block(a)
 | 
|---|
 | 179 | {
 | 
|---|
 | 180 |   reset();
 | 
|---|
 | 181 | }
 | 
|---|
 | 182 | 
 | 
|---|
 | 183 | void
 | 
|---|
 | 184 | SCMatrixLTriBlockIter::reset()
 | 
|---|
 | 185 | {
 | 
|---|
 | 186 |   block_index = 0;
 | 
|---|
 | 187 |   i_ = block->start;
 | 
|---|
 | 188 |   j_ = block->start;
 | 
|---|
 | 189 | }
 | 
|---|
 | 190 | 
 | 
|---|
 | 191 | SCMatrixLTriBlockIter::~SCMatrixLTriBlockIter()
 | 
|---|
 | 192 | {
 | 
|---|
 | 193 | }
 | 
|---|
 | 194 | 
 | 
|---|
 | 195 | int
 | 
|---|
 | 196 | SCMatrixLTriBlockIter::i()
 | 
|---|
 | 197 | {
 | 
|---|
 | 198 |   return i_;
 | 
|---|
 | 199 | }
 | 
|---|
 | 200 | 
 | 
|---|
 | 201 | int
 | 
|---|
 | 202 | SCMatrixLTriBlockIter::j()
 | 
|---|
 | 203 | {
 | 
|---|
 | 204 |   return j_;
 | 
|---|
 | 205 | }
 | 
|---|
 | 206 | 
 | 
|---|
 | 207 | double
 | 
|---|
 | 208 | SCMatrixLTriBlockIter::get()
 | 
|---|
 | 209 | {
 | 
|---|
 | 210 |   return block->data[block_index];
 | 
|---|
 | 211 | }
 | 
|---|
 | 212 | 
 | 
|---|
 | 213 | void
 | 
|---|
 | 214 | SCMatrixLTriBlockIter::set(double a)
 | 
|---|
 | 215 | {
 | 
|---|
 | 216 |   block->data[block_index] = a;
 | 
|---|
 | 217 | }
 | 
|---|
 | 218 | 
 | 
|---|
 | 219 | SCMatrixLTriBlockIter::operator int()
 | 
|---|
 | 220 | {
 | 
|---|
 | 221 |   return (i_ < block->end);
 | 
|---|
 | 222 | }
 | 
|---|
 | 223 | 
 | 
|---|
 | 224 | void
 | 
|---|
 | 225 | SCMatrixLTriBlockIter::operator ++()
 | 
|---|
 | 226 | {
 | 
|---|
 | 227 |   j_++;
 | 
|---|
 | 228 |   if (j_ > i_) {
 | 
|---|
 | 229 |       j_ = block->start;
 | 
|---|
 | 230 |       i_++;
 | 
|---|
 | 231 |     }
 | 
|---|
 | 232 |   block_index++;
 | 
|---|
 | 233 | }
 | 
|---|
 | 234 | 
 | 
|---|
 | 235 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 236 | // SCMatrixLTriSubBlockIter member functions
 | 
|---|
 | 237 | 
 | 
|---|
 | 238 | SCMatrixLTriSubBlockIter::SCMatrixLTriSubBlockIter(
 | 
|---|
 | 239 |     SCMatrixLTriSubBlock*a):
 | 
|---|
 | 240 |   block(a)
 | 
|---|
 | 241 | {
 | 
|---|
 | 242 |   reset();
 | 
|---|
 | 243 | }
 | 
|---|
 | 244 | 
 | 
|---|
 | 245 | void
 | 
|---|
 | 246 | SCMatrixLTriSubBlockIter::reset()
 | 
|---|
 | 247 | {
 | 
|---|
 | 248 |   i_ = block->istart;
 | 
|---|
 | 249 |   j_ = block->jstart;
 | 
|---|
 | 250 |   block_index = (i_*(i_+1)>>1) + j_;
 | 
|---|
 | 251 | }
 | 
|---|
 | 252 | 
 | 
|---|
 | 253 | SCMatrixLTriSubBlockIter::~SCMatrixLTriSubBlockIter()
 | 
|---|
 | 254 | {
 | 
|---|
 | 255 | }
 | 
|---|
 | 256 | 
 | 
|---|
 | 257 | int
 | 
|---|
 | 258 | SCMatrixLTriSubBlockIter::i()
 | 
|---|
 | 259 | {
 | 
|---|
 | 260 |   return i_;
 | 
|---|
 | 261 | }
 | 
|---|
 | 262 | 
 | 
|---|
 | 263 | int
 | 
|---|
 | 264 | SCMatrixLTriSubBlockIter::j()
 | 
|---|
 | 265 | {
 | 
|---|
 | 266 |   return j_;
 | 
|---|
 | 267 | }
 | 
|---|
 | 268 | 
 | 
|---|
 | 269 | double
 | 
|---|
 | 270 | SCMatrixLTriSubBlockIter::get()
 | 
|---|
 | 271 | {
 | 
|---|
 | 272 |   return block->data[block_index];
 | 
|---|
 | 273 | }
 | 
|---|
 | 274 | 
 | 
|---|
 | 275 | void
 | 
|---|
 | 276 | SCMatrixLTriSubBlockIter::set(double a)
 | 
|---|
 | 277 | {
 | 
|---|
 | 278 |   block->data[block_index] = a;
 | 
|---|
 | 279 | }
 | 
|---|
 | 280 | 
 | 
|---|
 | 281 | SCMatrixLTriSubBlockIter::operator int()
 | 
|---|
 | 282 | {
 | 
|---|
 | 283 |   return (i_ < block->iend);
 | 
|---|
 | 284 | }
 | 
|---|
 | 285 | 
 | 
|---|
 | 286 | void
 | 
|---|
 | 287 | SCMatrixLTriSubBlockIter::operator ++()
 | 
|---|
 | 288 | {
 | 
|---|
 | 289 |   j_++;
 | 
|---|
 | 290 |   block_index++;
 | 
|---|
 | 291 |   if (j_ > i_) {
 | 
|---|
 | 292 |       j_ = block->jstart;
 | 
|---|
 | 293 |       i_++;
 | 
|---|
 | 294 |       block_index += block->istart;
 | 
|---|
 | 295 |     }
 | 
|---|
 | 296 |   else if (j_ >= block->jend) {
 | 
|---|
 | 297 |       j_ = block->jstart;
 | 
|---|
 | 298 |       i_++;
 | 
|---|
 | 299 |       block_index += i_ + block->jstart - block->jend;
 | 
|---|
 | 300 |     }
 | 
|---|
 | 301 | }
 | 
|---|
 | 302 | 
 | 
|---|
 | 303 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 304 | // SCMatrixDiagBlockIter member functions
 | 
|---|
 | 305 | 
 | 
|---|
 | 306 | SCMatrixDiagBlockIter::SCMatrixDiagBlockIter(SCMatrixDiagBlock*a):
 | 
|---|
 | 307 |   block(a)
 | 
|---|
 | 308 | {
 | 
|---|
 | 309 |   reset();
 | 
|---|
 | 310 | }
 | 
|---|
 | 311 | 
 | 
|---|
 | 312 | void
 | 
|---|
 | 313 | SCMatrixDiagBlockIter::reset()
 | 
|---|
 | 314 | {
 | 
|---|
 | 315 |   block_index = 0;
 | 
|---|
 | 316 |   i_ = block->istart;
 | 
|---|
 | 317 | }
 | 
|---|
 | 318 | 
 | 
|---|
 | 319 | SCMatrixDiagBlockIter::~SCMatrixDiagBlockIter()
 | 
|---|
 | 320 | {
 | 
|---|
 | 321 | }
 | 
|---|
 | 322 | 
 | 
|---|
 | 323 | int
 | 
|---|
 | 324 | SCMatrixDiagBlockIter::i()
 | 
|---|
 | 325 | {
 | 
|---|
 | 326 |   return i_;
 | 
|---|
 | 327 | }
 | 
|---|
 | 328 | 
 | 
|---|
 | 329 | int
 | 
|---|
 | 330 | SCMatrixDiagBlockIter::j()
 | 
|---|
 | 331 | {
 | 
|---|
 | 332 |   return i_ + block->jstart - block->istart;
 | 
|---|
 | 333 | }
 | 
|---|
 | 334 | 
 | 
|---|
 | 335 | double
 | 
|---|
 | 336 | SCMatrixDiagBlockIter::get()
 | 
|---|
 | 337 | {
 | 
|---|
 | 338 |   return block->data[block_index];
 | 
|---|
 | 339 | }
 | 
|---|
 | 340 | 
 | 
|---|
 | 341 | void
 | 
|---|
 | 342 | SCMatrixDiagBlockIter::set(double a)
 | 
|---|
 | 343 | {
 | 
|---|
 | 344 |   block->data[block_index] = a;
 | 
|---|
 | 345 | }
 | 
|---|
 | 346 | 
 | 
|---|
 | 347 | SCMatrixDiagBlockIter::operator int()
 | 
|---|
 | 348 | {
 | 
|---|
 | 349 |   return (i_ < block->iend);
 | 
|---|
 | 350 | }
 | 
|---|
 | 351 | 
 | 
|---|
 | 352 | void
 | 
|---|
 | 353 | SCMatrixDiagBlockIter::operator ++()
 | 
|---|
 | 354 | {
 | 
|---|
 | 355 |   i_++;
 | 
|---|
 | 356 |   block_index++;
 | 
|---|
 | 357 | }
 | 
|---|
 | 358 | 
 | 
|---|
 | 359 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 360 | // SCMatrixDiagSubBlockIter member functions
 | 
|---|
 | 361 | 
 | 
|---|
 | 362 | SCMatrixDiagSubBlockIter::SCMatrixDiagSubBlockIter(SCMatrixDiagSubBlock*a):
 | 
|---|
 | 363 |   block(a)
 | 
|---|
 | 364 | {
 | 
|---|
 | 365 |   reset();
 | 
|---|
 | 366 | }
 | 
|---|
 | 367 | 
 | 
|---|
 | 368 | void
 | 
|---|
 | 369 | SCMatrixDiagSubBlockIter::reset()
 | 
|---|
 | 370 | {
 | 
|---|
 | 371 |   block_index = block->offset;
 | 
|---|
 | 372 |   i_ = block->istart;
 | 
|---|
 | 373 | }
 | 
|---|
 | 374 | 
 | 
|---|
 | 375 | SCMatrixDiagSubBlockIter::~SCMatrixDiagSubBlockIter()
 | 
|---|
 | 376 | {
 | 
|---|
 | 377 | }
 | 
|---|
 | 378 | 
 | 
|---|
 | 379 | int
 | 
|---|
 | 380 | SCMatrixDiagSubBlockIter::i()
 | 
|---|
 | 381 | {
 | 
|---|
 | 382 |   return i_;
 | 
|---|
 | 383 | }
 | 
|---|
 | 384 | 
 | 
|---|
 | 385 | int
 | 
|---|
 | 386 | SCMatrixDiagSubBlockIter::j()
 | 
|---|
 | 387 | {
 | 
|---|
 | 388 |   return i_ + block->jstart - block->istart;
 | 
|---|
 | 389 | }
 | 
|---|
 | 390 | 
 | 
|---|
 | 391 | double
 | 
|---|
 | 392 | SCMatrixDiagSubBlockIter::get()
 | 
|---|
 | 393 | {
 | 
|---|
 | 394 |   return block->data[block_index];
 | 
|---|
 | 395 | }
 | 
|---|
 | 396 | 
 | 
|---|
 | 397 | void
 | 
|---|
 | 398 | SCMatrixDiagSubBlockIter::set(double a)
 | 
|---|
 | 399 | {
 | 
|---|
 | 400 |   block->data[block_index] = a;
 | 
|---|
 | 401 | }
 | 
|---|
 | 402 | 
 | 
|---|
 | 403 | SCMatrixDiagSubBlockIter::operator int()
 | 
|---|
 | 404 | {
 | 
|---|
 | 405 |   return (i_ < block->iend);
 | 
|---|
 | 406 | }
 | 
|---|
 | 407 | 
 | 
|---|
 | 408 | void
 | 
|---|
 | 409 | SCMatrixDiagSubBlockIter::operator ++()
 | 
|---|
 | 410 | {
 | 
|---|
 | 411 |   i_++;
 | 
|---|
 | 412 |   block_index++;
 | 
|---|
 | 413 | }
 | 
|---|
 | 414 | 
 | 
|---|
 | 415 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 416 | // SCVectorSimpleBlockIter member functions
 | 
|---|
 | 417 | 
 | 
|---|
 | 418 | SCVectorSimpleBlockIter::SCVectorSimpleBlockIter(SCVectorSimpleBlock*a):
 | 
|---|
 | 419 |   block(a)
 | 
|---|
 | 420 | {
 | 
|---|
 | 421 |   reset();
 | 
|---|
 | 422 | }
 | 
|---|
 | 423 | 
 | 
|---|
 | 424 | void
 | 
|---|
 | 425 | SCVectorSimpleBlockIter::reset()
 | 
|---|
 | 426 | {
 | 
|---|
 | 427 |   block_index = 0;
 | 
|---|
 | 428 |   i_ = block->istart;
 | 
|---|
 | 429 | }
 | 
|---|
 | 430 | 
 | 
|---|
 | 431 | SCVectorSimpleBlockIter::~SCVectorSimpleBlockIter()
 | 
|---|
 | 432 | {
 | 
|---|
 | 433 | }
 | 
|---|
 | 434 | 
 | 
|---|
 | 435 | int
 | 
|---|
 | 436 | SCVectorSimpleBlockIter::i()
 | 
|---|
 | 437 | {
 | 
|---|
 | 438 |   return i_;
 | 
|---|
 | 439 | }
 | 
|---|
 | 440 | 
 | 
|---|
 | 441 | int
 | 
|---|
 | 442 | SCVectorSimpleBlockIter::j()
 | 
|---|
 | 443 | {
 | 
|---|
 | 444 |   ExEnv::errn() << indent << "SCVectorSimpleBlockIter::j() attempted to find j value\n";
 | 
|---|
 | 445 |   abort();
 | 
|---|
 | 446 |   return 0;
 | 
|---|
 | 447 | }
 | 
|---|
 | 448 | 
 | 
|---|
 | 449 | double
 | 
|---|
 | 450 | SCVectorSimpleBlockIter::get()
 | 
|---|
 | 451 | {
 | 
|---|
 | 452 |   return block->data[block_index];
 | 
|---|
 | 453 | }
 | 
|---|
 | 454 | 
 | 
|---|
 | 455 | void
 | 
|---|
 | 456 | SCVectorSimpleBlockIter::set(double a)
 | 
|---|
 | 457 | {
 | 
|---|
 | 458 |   block->data[block_index] = a;
 | 
|---|
 | 459 | }
 | 
|---|
 | 460 | 
 | 
|---|
 | 461 | SCVectorSimpleBlockIter::operator int()
 | 
|---|
 | 462 | {
 | 
|---|
 | 463 |   return (i_ < block->iend);
 | 
|---|
 | 464 | }
 | 
|---|
 | 465 | 
 | 
|---|
 | 466 | void
 | 
|---|
 | 467 | SCVectorSimpleBlockIter::operator ++()
 | 
|---|
 | 468 | {
 | 
|---|
 | 469 |   i_++;
 | 
|---|
 | 470 |   block_index++;
 | 
|---|
 | 471 | }
 | 
|---|
 | 472 | 
 | 
|---|
 | 473 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 474 | // SCVectorSimpleSubBlockIter member functions
 | 
|---|
 | 475 | 
 | 
|---|
 | 476 | SCVectorSimpleSubBlockIter::SCVectorSimpleSubBlockIter(
 | 
|---|
 | 477 |     SCVectorSimpleSubBlock*a):
 | 
|---|
 | 478 |   block(a)
 | 
|---|
 | 479 | {
 | 
|---|
 | 480 |   reset();
 | 
|---|
 | 481 | }
 | 
|---|
 | 482 | 
 | 
|---|
 | 483 | void
 | 
|---|
 | 484 | SCVectorSimpleSubBlockIter::reset()
 | 
|---|
 | 485 | {
 | 
|---|
 | 486 |   block_index = block->offset;
 | 
|---|
 | 487 |   i_ = block->istart;
 | 
|---|
 | 488 | }
 | 
|---|
 | 489 | 
 | 
|---|
 | 490 | SCVectorSimpleSubBlockIter::~SCVectorSimpleSubBlockIter()
 | 
|---|
 | 491 | {
 | 
|---|
 | 492 | }
 | 
|---|
 | 493 | 
 | 
|---|
 | 494 | int
 | 
|---|
 | 495 | SCVectorSimpleSubBlockIter::i()
 | 
|---|
 | 496 | {
 | 
|---|
 | 497 |   return i_;
 | 
|---|
 | 498 | }
 | 
|---|
 | 499 | 
 | 
|---|
 | 500 | int
 | 
|---|
 | 501 | SCVectorSimpleSubBlockIter::j()
 | 
|---|
 | 502 | {
 | 
|---|
 | 503 |   ExEnv::errn() << indent
 | 
|---|
 | 504 |        << "SCVectorSimpleSubBlockIter::j(): attempted to find j value\n";
 | 
|---|
 | 505 |   abort();
 | 
|---|
 | 506 |   return 0;
 | 
|---|
 | 507 | }
 | 
|---|
 | 508 | 
 | 
|---|
 | 509 | double
 | 
|---|
 | 510 | SCVectorSimpleSubBlockIter::get()
 | 
|---|
 | 511 | {
 | 
|---|
 | 512 |   return block->data[block_index];
 | 
|---|
 | 513 | }
 | 
|---|
 | 514 | 
 | 
|---|
 | 515 | void
 | 
|---|
 | 516 | SCVectorSimpleSubBlockIter::set(double a)
 | 
|---|
 | 517 | {
 | 
|---|
 | 518 |   block->data[block_index] = a;
 | 
|---|
 | 519 | }
 | 
|---|
 | 520 | 
 | 
|---|
 | 521 | SCVectorSimpleSubBlockIter::operator int()
 | 
|---|
 | 522 | {
 | 
|---|
 | 523 |   return (i_ < block->iend);
 | 
|---|
 | 524 | }
 | 
|---|
 | 525 | 
 | 
|---|
 | 526 | void
 | 
|---|
 | 527 | SCVectorSimpleSubBlockIter::operator ++()
 | 
|---|
 | 528 | {
 | 
|---|
 | 529 |   i_++;
 | 
|---|
 | 530 |   block_index++;
 | 
|---|
 | 531 | }
 | 
|---|
 | 532 | 
 | 
|---|
 | 533 | /////////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 534 | 
 | 
|---|
 | 535 | // Local Variables:
 | 
|---|
 | 536 | // mode: c++
 | 
|---|
 | 537 | // c-file-style: "CLJ"
 | 
|---|
 | 538 | // End:
 | 
|---|