00001 // 00002 // blkiter.h 00003 // 00004 // Copyright (C) 1996 Limit Point Systems, Inc. 00005 // 00006 // Author: Curtis Janssen <cljanss@limitpt.com> 00007 // Maintainer: LPS 00008 // 00009 // This file is part of the SC Toolkit. 00010 // 00011 // The SC Toolkit is free software; you can redistribute it and/or modify 00012 // it under the terms of the GNU Library General Public License as published by 00013 // the Free Software Foundation; either version 2, or (at your option) 00014 // any later version. 00015 // 00016 // The SC Toolkit is distributed in the hope that it will be useful, 00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 // GNU Library General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Library General Public License 00022 // along with the SC Toolkit; see the file COPYING.LIB. If not, write to 00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 00024 // 00025 // The U.S. Government is granted a limited license as per AL 91-7. 00026 // 00027 00028 #ifndef _math_scmat_blkiter_h 00029 #define _math_scmat_blkiter_h 00030 00031 #ifdef __GNUC__ 00032 #pragma interface 00033 #endif 00034 00035 #include <math/scmat/block.h> 00036 00037 class SCMatrixRectBlock; 00038 class SCMatrixLTriBlock; 00039 class SCMatrixDiagBlock; 00040 class SCVectorSimpleBlock; 00041 00042 class SCElementOp; 00043 class SCElementOp2; 00044 class SCElementOp3; 00045 00048 class SCMatrixBlockIter { 00049 public: 00050 SCMatrixBlockIter() {} 00051 virtual ~SCMatrixBlockIter(); 00053 virtual int i() = 0; 00055 virtual int j() = 0; 00057 virtual void set(double val) = 0; 00059 virtual void accum(double val); 00061 virtual double get() = 0; 00063 virtual operator int() = 0; 00065 virtual void operator++() = 0; // prefix ++ 00066 void operator++(int) { operator++(); } 00068 virtual void reset() = 0; 00069 }; 00070 00071 class SCMatrixRectBlockIter: public SCMatrixBlockIter { 00072 private: 00073 SCMatrixRectBlock* block; 00074 int i_; 00075 int block_index; 00076 int j_; 00077 public: 00078 SCMatrixRectBlockIter(SCMatrixRectBlock*); 00079 virtual ~SCMatrixRectBlockIter(); 00080 int i(); 00081 int j(); 00082 double get(); 00083 void set(double); 00084 operator int(); 00085 void operator++(); 00086 void reset(); 00087 }; 00088 00089 class SCMatrixRectSubBlockIter: public SCMatrixBlockIter { 00090 private: 00091 SCMatrixRectSubBlock* block; 00092 int i_; 00093 int block_index; 00094 int j_; 00095 public: 00096 SCMatrixRectSubBlockIter(SCMatrixRectSubBlock*); 00097 virtual ~SCMatrixRectSubBlockIter(); 00098 int i(); 00099 int j(); 00100 double get(); 00101 void set(double); 00102 operator int(); 00103 void operator++(); 00104 void reset(); 00105 }; 00106 00107 class SCMatrixLTriBlockIter: public SCMatrixBlockIter { 00108 private: 00109 SCMatrixLTriBlock* block; 00110 int block_index; 00111 int i_; 00112 int j_; 00113 public: 00114 SCMatrixLTriBlockIter(SCMatrixLTriBlock*); 00115 virtual ~SCMatrixLTriBlockIter(); 00116 int i(); 00117 int j(); 00118 double get(); 00119 void set(double); 00120 operator int(); 00121 void operator++(); 00122 void reset(); 00123 }; 00124 00125 class SCMatrixLTriSubBlockIter: public SCMatrixBlockIter { 00126 private: 00127 SCMatrixLTriSubBlock* block; 00128 int block_index; 00129 int i_; 00130 int j_; 00131 public: 00132 SCMatrixLTriSubBlockIter(SCMatrixLTriSubBlock*); 00133 virtual ~SCMatrixLTriSubBlockIter(); 00134 int i(); 00135 int j(); 00136 double get(); 00137 void set(double); 00138 operator int(); 00139 void operator++(); 00140 void reset(); 00141 }; 00142 00143 class SCMatrixDiagBlockIter: public SCMatrixBlockIter { 00144 private: 00145 SCMatrixDiagBlock* block; 00146 int block_index; 00147 int i_; 00148 public: 00149 SCMatrixDiagBlockIter(SCMatrixDiagBlock*); 00150 virtual ~SCMatrixDiagBlockIter(); 00151 int i(); 00152 int j(); 00153 double get(); 00154 void set(double); 00155 operator int(); 00156 void operator++(); 00157 void reset(); 00158 }; 00159 00160 class SCMatrixDiagSubBlockIter: public SCMatrixBlockIter { 00161 private: 00162 SCMatrixDiagSubBlock* block; 00163 int block_index; 00164 int i_; 00165 public: 00166 SCMatrixDiagSubBlockIter(SCMatrixDiagSubBlock*); 00167 virtual ~SCMatrixDiagSubBlockIter(); 00168 int i(); 00169 int j(); 00170 double get(); 00171 void set(double); 00172 operator int(); 00173 void operator++(); 00174 void reset(); 00175 }; 00176 00177 class SCVectorSimpleBlockIter: public SCMatrixBlockIter { 00178 private: 00179 SCVectorSimpleBlock* block; 00180 int block_index; 00181 int i_; 00182 public: 00183 SCVectorSimpleBlockIter(SCVectorSimpleBlock*); 00184 virtual ~SCVectorSimpleBlockIter(); 00185 int i(); 00186 int j(); 00187 double get(); 00188 void set(double); 00189 operator int(); 00190 void operator++(); 00191 void reset(); 00192 }; 00193 00194 class SCVectorSimpleSubBlockIter: public SCMatrixBlockIter { 00195 private: 00196 SCVectorSimpleSubBlock* block; 00197 int block_index; 00198 int i_; 00199 public: 00200 SCVectorSimpleSubBlockIter(SCVectorSimpleSubBlock*); 00201 virtual ~SCVectorSimpleSubBlockIter(); 00202 int i(); 00203 int j(); 00204 double get(); 00205 void set(double); 00206 operator int(); 00207 void operator++(); 00208 void reset(); 00209 }; 00210 00211 #endif 00212 00213 // Local Variables: 00214 // mode: c++ 00215 // c-file-style: "CLJ" 00216 // End: