00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <stdlib.h>
00035
00036 #include <OPS_Globals.h>
00037 #include <Timer.h>
00038 #include <FileDatastore.h>
00039 #include <Node.h>
00040 #include <NodeIter.h>
00041 #include <Element.h>
00042 #include <ElementIter.h>
00043
00044 #include <Domain.h>
00045 #include <ID.h>
00046 #include <Vector.h>
00047 #include <Matrix.h>
00048 #include <FEM_ObjectBroker.h>
00049 #include <bool.h>
00050
00051 double ops_Dt;
00052 Domain * ops_TheActiveDomain;
00053 #include <StandardStream.h>
00054 StandardStream sserr;
00055 OPS_Stream *opserrPtr = &sserr;
00056
00057 int main(int argc, char **argv)
00058 {
00059 bool fail = false;
00060
00061
00062
00063
00064
00065 FEM_ObjectBroker theBroker;
00066 Domain *theDomain = new Domain();
00067
00068 FileDatastore *theDatabase
00069 = new FileDatastore("/tmp/database/test1",*theDomain,theBroker);
00070 FileDatastore &theDb = *theDatabase;
00071
00072 opserr << "TESTING IDs: \n";
00073
00074 ID id1(2);
00075 id1(0) = 1; id1(1) = 1;
00076 ID id0(2);
00077 id0(0) = 0; id0(1) = 0;
00078 ID id2(2);
00079 id2(0) = 2; id2(1) = 2;
00080 ID id3(2);
00081 id3(0) = 3; id3(1) = 3;
00082 ID id4(2);
00083 id4(0) = 4; id4(1) = 4;
00084 ID id5(2);
00085 id5(0) = 5; id5(1) = 5;
00086 ID id6(2);
00087 id6(0) = 6; id6(1) = 6;
00088
00089
00090 theDb.sendID(1,1,id1);
00091 theDb.sendID(1,2,id2);
00092 theDb.sendID(2,1,id3);
00093 theDb.sendID(2,2,id4);
00094
00095 opserr << "RESULTS\n";
00096 ID recvID(2);
00097 theDb.recvID(1,1,recvID);
00098 opserr << "1: " << recvID;
00099 theDb.recvID(1,2,recvID);
00100 opserr << "2: " << recvID;
00101 theDb.recvID(2,1,recvID);
00102 opserr << "3: " << recvID;
00103 theDb.recvID(2,2,recvID);
00104 opserr << "4: " << recvID;
00105
00106 theDb.sendID(1,1,id1);
00107 theDb.sendID(3,1,id3);
00108 theDb.sendID(2,1,id2);
00109
00110
00111 theDb.sendID(0,1,id0);
00112 theDb.sendID(1,2,id1);
00113 theDb.sendID(2,2,id2);
00114 theDb.sendID(3,1,id3);
00115 theDb.sendID(5,1,id5);
00116 theDb.sendID(4,1,id4);
00117 theDb.sendID(1,1,id1);
00118
00119
00120
00121
00122 theDb.recvID(3,1,id5);
00123 opserr << "3: " << id5;
00124 theDb.recvID(1,1,id5);
00125 opserr << "1: " << id5;
00126 theDb.recvID(2,1,id5);
00127
00128 opserr << "2: " << id5;
00129 theDb.recvID(1,2,id5);
00130 opserr << "1: " << id5;
00131 theDb.recvID(2,2,id5);
00132
00133 opserr << "3: " << id5;
00134 theDb.recvID(3,1,id5);
00135 opserr << "3: " << id5;
00136
00137 theDb.recvID(4,1,id5);
00138 opserr << "4: " << id5;
00139 theDb.recvID(5,1,id5);
00140 opserr << "5: " << id5;
00141
00142 opserr << "FAILURE: " << theDb.recvID(6,1,id5) << " returned\n";
00143 opserr << "FAILURE " << theDb.recvID(6,1,id5) << " returned\n";
00144
00145 theDb.recvID(0,1,id5);
00146 opserr << "0: " << id5;
00147 theDb.recvID(5,1,id5);
00148 opserr << "5: " << id5;
00149
00150 ID id64(4);
00151 id64(0) = 6; id64(1) = 6; id64(2) = 6; id64(3) = 6;
00152 theDb.sendID(6,1,id64);
00153 theDb.recvID(6,1,id64);
00154 opserr << id64;
00155
00156
00157 opserr << "TESTING MATRICES: \n";
00158
00159 Matrix mat1(2,2);
00160 mat1(0,0) = 1.1; mat1(0,1) = 11.1;
00161 mat1(1,0) = 111.1; mat1(1,1) = 1111.1;
00162
00163 Matrix mat2(2,2);
00164 mat2(0,0) = 2.2; mat2(0,1) = 22.2;
00165 mat2(1,0) = 222.2; mat2(1,1) = 2222.2;
00166
00167 theDb.sendMatrix(2,1,mat2);
00168 theDb.sendMatrix(1,1,mat1);
00169 theDb.sendMatrix(3,2,mat2);
00170 theDb.sendMatrix(3,1,mat1);
00171
00172 Matrix mat3(2,2);
00173 theDb.recvMatrix(1,1,mat3);
00174 opserr << mat1 << mat3 << endln;
00175 theDb.recvMatrix(2,1,mat3);
00176 opserr << mat2 << mat3 << endln;
00177 theDb.recvMatrix(3,2,mat3);
00178 opserr << mat2 << mat3 << endln;
00179 theDb.recvMatrix(3,1,mat3);
00180 opserr << mat1 << mat3 << endln;
00181
00182
00183 theDb.recvMatrix(2,1,mat3);
00184 opserr << mat2 << mat3;
00185
00186
00187
00188 opserr << "TESTING VECTORS: \n";
00189
00190 Vector vect1(2);
00191 vect1(0) = 1.1; vect1(1) = 2.22;
00192
00193 Vector vect2(2);
00194 vect2(0) = 3; vect2(1) = 4.2;
00195
00196 Vector vect3(2);
00197 vect3(0) = 5; vect3(1) = 6;
00198
00199 Vector vect4(2);
00200 vect4(0) = 7; vect4(1) = 8.8e12;
00201
00202 theDb.sendVector(1,1,vect1);
00203 theDb.sendVector(1,2,vect2);
00204 theDb.sendVector(2,1,vect3);
00205 theDb.sendVector(2,2,vect4);
00206
00207 opserr << "RESULTS\n";
00208 Vector vect5(2);
00209 theDb.recvVector(1,1,vect5);
00210 opserr << vect1 << vect5 << endln;
00211 theDb.recvVector(1,2,vect5);
00212 opserr << vect2 << vect5 << endln;
00213 theDb.recvVector(2,1,vect5);
00214 opserr << vect3 << vect5 << endln;
00215 theDb.recvVector(2,2,vect5);
00216 opserr << vect4 << vect5 << endln;
00217
00218 theDb.sendVector(2,2,vect1);
00219 theDb.sendVector(2,1,vect2);
00220 theDb.sendVector(1,2,vect3);
00221 theDb.sendVector(1,1,vect4);
00222
00223 theDb.recvVector(1,1,vect5);
00224 opserr << vect4 << vect5 << endln;
00225 theDb.recvVector(1,2,vect5);
00226 opserr << vect3 << vect5 << endln;
00227 theDb.recvVector(2,1,vect5);
00228 opserr << vect2 << vect5 << endln;
00229 theDb.recvVector(2,2,vect5);
00230 opserr << vect1 << vect5 << endln;
00231
00232
00233 theDb.sendVector(4,4,vect5);
00234 theDb.recvVector(4,4,vect5);
00235 opserr << vect5 << vect5 << endln;
00236
00237 theDb.recvVector(5,5,vect5);
00238 opserr << "FAIL\n";
00239
00240 theDatabase->commitState(0);
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293 delete theDatabase;
00294
00295 exit(0);
00296 }
00297