main.cpp

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.5 $
00022 // $Date: 2005/12/23 02:15:20 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/database/main.cpp,v $
00024                                                                         
00025                                                                         
00026 // Written: fmk 12/95
00027 // Revised:
00028 //
00029 // Purpose: This file is a driver to create a 2d plane-frame
00030 // model and to perform a linear static analysis on that model.
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   //    now create a domain and a modelbuilder
00063   //  and build the model
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   //    theDb.sendMatrix(2,1,mat1);
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     theDb.sendID(2,2,id1);
00246     theDb.sendID(2,1,id2);
00247     theDb.sendID(1,2,id3);
00248     theDb.sendID(1,1,id4);
00249 
00250     theDb.recvID(1,1,id5);
00251     opserr << id5;
00252     theDb.recvID(1,2,id5);
00253     opserr << id5;
00254     theDb.recvID(2,1,id5);
00255     opserr << id5;
00256     theDb.recvID(2,2,id5);
00257     opserr << id5;
00258 
00259     theDb.sendID(4,4,id5);
00260     theDb.recvID(4,4,id5);
00261     opserr << id5;
00262 
00263     theDb.recvID(5,5,id5);
00264     opserr << id5;
00265     */
00266   
00267     /**************************
00268 
00269     **************************/
00270     /*
00271 
00272     */
00273 
00274 //  theModelBuilder->buildFE_Model();
00275 //  theDb.commitState(0);
00276 //  theDb.restoreState(0);
00277 
00278 
00279     // theDb.restoreElements(0);
00280 
00281     /*
00282     theDb.restoreNode(1,0);
00283     theDb.restoreNode(2,0);
00284     theDb.restoreNode(3,0);
00285     theDb.restoreNode(4,0);
00286     theDb.restoreElement(0,0);
00287     theDb.restoreElement(1,0);
00288     theDb.restoreElement(2,0);
00289     */
00290 
00291     //  opserr << *theDomain;
00292 
00293     delete theDatabase;
00294 
00295     exit(0);
00296 }       
00297         

Generated on Mon Oct 23 15:05:00 2006 for OpenSees by doxygen 1.5.0