FE_Datastore.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.8 $
00022 // $Date: 2005/11/07 23:53:45 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/database/FE_Datastore.cpp,v $
00024                                                                         
00025 // Written: fmk 
00026 // Created: 10/98
00027 // Revision: A
00028 //
00029 // Description: This file contains the class implementation for FE_Datastore.
00030 // FE_Datastore is an abstract base class. An FE_Datastore object is used
00031 // in the program to store/restore the geometry and state information in
00032 // a domain at a particular instance in the analysis.
00033 //
00034 // What: "@(#) FE_Datastore.C, revA"
00035 
00036 #include "FE_Datastore.h"
00037 #include <FEM_ObjectBroker.h>
00038 #include <MovableObject.h>
00039 #include <Domain.h>
00040 #include <OPS_Globals.h>
00041 #include <ID.h>
00042 
00043 int FE_Datastore::lastDbTag(0);
00044 
00045 // FE_Datastore(int tag, int noExtNodes);
00046 //      constructor that takes the FE_Datastore's unique tag and the number
00047 //      of external nodes for the FE_Datastore.
00048 
00049 FE_Datastore::FE_Datastore(Domain &thDomain, FEM_ObjectBroker &theBroker) 
00050   :theObjectBroker(&theBroker), theDomain(&thDomain)
00051 {
00052 
00053 }
00054 
00055 
00056 FE_Datastore::~FE_Datastore() 
00057 {
00058     // does nothing
00059 }
00060 
00061 int
00062 FE_Datastore::isDatastore(void)
00063 {
00064   return 1;
00065 }
00066 
00067 /********************************************************************
00068  *                   CHANNEL METHODS  THAT DO NOTHING               *
00069  ********************************************************************/
00070 
00071 char *
00072 FE_Datastore::addToProgram(void)
00073 {
00074   return 0;
00075 }
00076 
00077 int 
00078 FE_Datastore::setUpConnection(void)
00079 {
00080   return 0;
00081 }
00082 
00083 int 
00084 FE_Datastore::setNextAddress(const ChannelAddress &otherChannelAddress)
00085 {
00086   return 0;
00087 }
00088 
00089 
00090 ChannelAddress *
00091 FE_Datastore::getLastSendersAddress(void)
00092 {
00093   return 0;
00094 }
00095 
00096 
00097 int 
00098 FE_Datastore::sendObj(int commitTag,
00099                       MovableObject &theObject, 
00100                       ChannelAddress *theAddress)
00101 {
00102   return theObject.sendSelf(commitTag, *this);
00103 }
00104 
00105 int 
00106 FE_Datastore::recvObj(int commitTag,
00107                       MovableObject &theObject, 
00108                       FEM_ObjectBroker &theNewBroker,
00109                       ChannelAddress *theAddress)
00110 {
00111   return theObject.recvSelf(commitTag, *this, theNewBroker);
00112 }
00113 
00114                 
00115 
00116 
00117 int
00118 FE_Datastore::commitState(int commitTag)
00119 {
00120   // invoke sendSelf on the domain object with this as an arg
00121   int res = 0;
00122   if (theDomain != 0) {
00123     res = theDomain->sendSelf(commitTag, *this);
00124     if (res < 0) {
00125       opserr << "FE_Datastore::commitState - domain failed to sendSelf\n";
00126       return res;
00127     }
00128     ID maxlastDbTag(1);
00129     maxlastDbTag(0) = lastDbTag;
00130     if (this->sendID(0,0,maxlastDbTag) < 0) {
00131       opserr << "FE_Datastore::commitState - failed to get max lastDbTag data from database - problems may ariise\n";
00132     }
00133   }
00134   
00135   return res;
00136 }
00137 
00138 
00139 
00140 int
00141 FE_Datastore::restoreState(int commitTag)
00142 {
00143   // invoke sendSelf on the domain object with this as an arg
00144   int res = 0;
00145   if (theDomain != 0) {
00146     res = theDomain->recvSelf(commitTag, *this, *theObjectBroker);
00147     if (res < 0) {
00148       opserr << "FE_Datastore::restoreState - domain failed to recvSelf\n";
00149     }
00150     ID maxlastDbTag(1);
00151     if (this->recvID(0,0,maxlastDbTag) < 0) {
00152       opserr << "FE_Datastore::restoreState - failed to get max lastDbTag data from database - problems may ariise\n";
00153     } else
00154       lastDbTag = maxlastDbTag(0);
00155 
00156   }
00157     
00158   return res;
00159 }
00160 
00161 
00162 
00163 
00164 int 
00165 FE_Datastore::createTable(const char*table, int numColumns, char *columns[])
00166 {
00167   opserr << "FE_Datastore::createTable - not yet implemented\n";
00168   return -1;
00169 }
00170 
00171 
00172 int 
00173 FE_Datastore::insertData(const char *tableName, char *columns[], 
00174                         int commitTag, const Vector &data)
00175 {
00176   opserr << "FE_Datastore::insertData - not yet implemented\n";
00177   return -1;
00178 }
00179 
00180 
00181 int 
00182 FE_Datastore::getData(const char *table, char *column[], int commitTag, Vector &data)
00183 {
00184   opserr << "FE_Datastore::getData - not yet implemented\n";
00185   return -1;
00186 }
00187 
00188 int
00189 FE_Datastore::getDbTag(void)
00190 {
00191   lastDbTag++;
00192   return lastDbTag;
00193 }

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