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
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
00046
00047
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
00059 }
00060
00061 int
00062 FE_Datastore::isDatastore(void)
00063 {
00064 return 1;
00065 }
00066
00067
00068
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
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
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 }