PageRenderTime 50ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/opensees-websocket/SRC/database/FileDatastore.tex

https://code.google.com/
LaTeX | 252 lines | 219 code | 31 blank | 2 comment | 0 complexity | 4da08c1534acbd1daa01e4d53b158450 MD5 | raw file
  1. %File: ~/database/FileDatastore.tex
  2. %What: "@(#) FileDatastore.tex, revA"
  3. \noindent {\bf Files} \\
  4. \indent \#include $<\tilde{ }$/database/FileDatastore.h$>$ \\
  5. \noindent {\bf Class Declaration} \\
  6. \indent class FileDatastore: public FE\_Datastore \\
  7. \noindent {\bf Class Hierarchy} \\
  8. \indent ModelBuilder \\
  9. \indent Channel \\
  10. \indent\indent FE\_Datastore \\
  11. \indent\indent\indent {\bf FileDatastore} \\
  12. \noindent {\bf Description} \\
  13. \indent FileDatastore is a concrete class. An FileDatastore object is
  14. used in the program to store/restore the geometry and state information
  15. in the domain at particular instances. This information is stored in
  16. binary form in files. As no standard format is used for the storage of
  17. integers and double values, files used to store the data on one type
  18. of machine, may not be read by a FileDatastore object on another type
  19. of machine where the storage of integers and doubles is different. \\
  20. For each of the base relations, i.e. Domain, Nodes, Elements,
  21. SP\_Constraints, MP\_Constraints, NodalLoads and ElementalLoads, a
  22. separate file is used to store the information. Files are also used
  23. for each size of ID, Vector and Matrix stored. At present, Messages
  24. are not stored, only ID and Vector objects of size $<= 200$ can be
  25. stored, the max $noRows * noCols$ of Matrices that can be stored
  26. is $<= 2000$, and only a single relation is created for Matrices which
  27. have similar sizes but differing dimensions. The data is stored in the
  28. files following the schema outlined previously.\\
  29. \noindent {\bf Class Interface} \\
  30. \indent // Constructor \\
  31. \indent {\em FileDatastore(char *name, Domain \&theDomain, FEM\_ObjectBroker \&theBroker);} \\ \\
  32. \indent // Destructor \\
  33. \indent {\em $\tilde{ }$FileDatastore();}\\ \\
  34. \indent // Public Methods inherited from the ModelBuilder Class \\
  35. \indent {\em int buildFE\_Model(void);}\\ \\
  36. \indent // Public Methods inherited from the FE\_Datastore Class \\
  37. \indent {\em int getDbTag(void);}\\
  38. \indent {\em int validateBaseRelationsWrite(int commitTag); }\\
  39. \indent {\em int validateBaseRelationsRead(int commitTag); }\\ \\
  40. \indent// Public Methods inherited from the Channel Class \\
  41. \indent {\em char *addToProgram(void); }\\
  42. \indent {\em int setUpShadow(void);}\\
  43. \indent {\em int setUpActor(void);}\\
  44. \indent {\em int setNextAddress(const ChannelAddress \&otherChannelAddress);}\\
  45. \indent {\em ChannelAddress *getLastSendersAddress(void);}\\
  46. \indent {\em int sendObj(int commitTag, \\
  47. \indent\indent\indent\indent\indent MovableObject \&theObject, \\
  48. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  49. \indent {\em int recvObj(int commitTag, \\
  50. \indent\indent\indent\indent\indent MovableObject \&theObject, \\
  51. \indent\indent\indent\indent\indent FEM\_ObjectBroker \&theBroker, \\
  52. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  53. \indent {\em int sendMsg(int dbTag, int commitTag, \\
  54. \indent\indent\indent\indent\indent const Message \&, \\
  55. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  56. \indent {\em int recvMsg(int dbTag, int commitTag, \\
  57. \indent\indent\indent\indent\indent Message \&, \\
  58. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  59. \indent {\em int sendMatrix(int dbTag, int commitTag, \\
  60. \indent\indent\indent\indent\indent const Matrix \&theMatrix, \\
  61. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  62. \indent {\em int recvMatrix(int dbTag, int commitTag, \\
  63. \indent\indent\indent\indent\indent Matrix \&theMatrix, \\
  64. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  65. \indent {\em int sendVector(int dbTag, int commitTag, \\
  66. \indent\indent\indent\indent\indent const Vector \&theVector, \\
  67. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  68. \indent {\em int recvVector(int dbTag, int commitTag, \\
  69. \indent\indent\indent\indent\indent Vector \&theVector, \\
  70. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  71. \indent {\em int sendID(int dbTag, int commitTag, \\
  72. \indent\indent\indent\indent\indent const ID \&theID, \\
  73. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  74. \indent {\em int recvID(int dbTag, int commitTag, \\
  75. \indent\indent\indent\indent\indent ID \&theID, \\
  76. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  77. \noindent {\bf Constructor} \\
  78. \indent {\em FileDatastore(char *name, Domain \&theDomain, FEM\_ObjectBroker \&theBroker);} \\
  79. Opens the files for the domain and base component relations, files have names {\em
  80. name.relation}, and stores the end of file locations. Creates three arrays
  81. of file pointers for the ID, Vector and Matrix files and then zeros
  82. these arrays. If the files could not be opened, or there is not enough
  83. memory for the arrays an error message is printed and the program
  84. is terminated. \\
  85. \noindent {\bf Destructor} \\
  86. \indent {\em virtual~ $\tilde{}$FileDatastore();}\\
  87. Each file that is opened is closed and the arrays of file pointers
  88. obtained from the heap in the constructor are returned to the heap. \\
  89. \noindent {\bf Public Methods } \\
  90. \indent {\em int buildFE\_Model(void);}\\
  91. To build the finite element model from data in the database. It does
  92. this by invoking {\em restor(0)} on itself. \\
  93. \indent {\em int getDbTag(void);}\\
  94. Increments the integer containing the current dbTag and returns this
  95. integer. \\
  96. \indent {\em int validateBaseRelationsWrite(int commitTag); }\\
  97. The object first checks to see if the Domain has already been
  98. committed to the database with a similar {\em commitTag}. If it has, a
  99. check is made to ensure that the current domain stamp and the one at
  100. the time of this last commit are the same. If they are different, an
  101. error message is printed and $-1$ is returned. A check is then made to
  102. see if the component base relations have been updated for this current domain
  103. stamp. If they have not been the base relations are updated, and each
  104. domain component is asked to send its data to the database. Finally
  105. the Domain relation is updated with the current time, load factor and
  106. domain stamp. Returns $1$ if the component base relations needed to be updated
  107. and the component information sent, $0$ if just the Domain relation
  108. needed to be updated. A warning message and a negative number is
  109. printed if an error occurs. \\
  110. \indent {\em int validateBaseRelationsRead(int commitTag); }\\
  111. The object first obtains from the Domain relation the information for
  112. {\em commitTag}. If no information exists, an error message is printed
  113. and a $-1$ is returned. A check is then made to see if the domain
  114. stamp for this entity and the Domain objects current stamp are the
  115. same. If different, {\em clearAll()} is invoked on the Domain, and
  116. from the component base relations new domain components are created,
  117. are asked to {\em recvSelf()} from {\em *this} and these new
  118. components are added to the Domain. Finally the current time, domain
  119. stamp and load factor are set using the information in the entity.
  120. Returns $1$ if the domain needed to be cleared and new component
  121. objects created, $0$ if just the Domain object needed to be updated
  122. with current time and load factor. A warning message and a negative
  123. number is printed if an error occurs. \\
  124. \indent {\em char *addToProgram(void); }\\
  125. Returns $0$. \\
  126. \indent {\em int setUpShadow(void);}\\
  127. Returns $0$. \\
  128. \indent {\em int setUpActor(void);}\\
  129. Returns $0$. \\
  130. \indent {\em int setNextAddress(const ChannelAddress \&otherChannelAddress);}\\
  131. Returns $0$. \\
  132. \indent {\em ChannelAddress *getLastSendersAddress(void);}\\
  133. Returns $0$. \\
  134. \indent {\em int sendObj(int commitTag, \\
  135. \indent\indent\indent\indent\indent MovableObject \&theObject, \\
  136. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  137. Returns the result of invoking {\em sendSelf(commitTag, *this)} on
  138. {\em theObject}. \\
  139. \indent {\em int recvObj(int commitTag, \\
  140. \indent\indent\indent\indent\indent MovableObject \&theObject, \\
  141. \indent\indent\indent\indent\indent FEM\_ObjectBroker \&theBroker, \\
  142. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  143. Returns the result of invoking {\em recvSelf(commitTag, *this, theBroker)} on
  144. {\em theObject}. \\
  145. \indent {\em int sendMsg(int dbTag, int commitTag, \\
  146. \indent\indent\indent\indent\indent const Message \&, \\
  147. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  148. Prints an error message and returns $-1$ as not yet implemented. \\
  149. \indent {\em int recvMsg(int dbTag, int commitTag, \\
  150. \indent\indent\indent\indent\indent Message \&, \\
  151. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  152. Prints an error message and returns $-1$ as not yet implemented. \\
  153. \indent {\em int sendMatrix(int dbTag, int commitTag, \\
  154. \indent\indent\indent\indent\indent const Matrix \&theMatrix, \\
  155. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  156. First determines the size of the matrix, $noRows * noCols$. If a files
  157. for matrices of this size has not yet been created, one is created now
  158. and the cell in the array of file pointers is set. If file can not be
  159. created a warning message is printed and program is terminated. A sequential search
  160. is made in the file to see if information is already stored for a Matrix with
  161. this {\em dbTag} and {\em commitTag}. The data is then written at this
  162. location, or eof if no location was found. The end of file location
  163. for Matrices of this size is updated. If successful $0$ is
  164. returned. A warning message and a negative number is returned if the
  165. operation fails: $-1$ if Matrix size is too large. \\
  166. \indent {\em int recvMatrix(int dbTag, int commitTag, \\
  167. \indent\indent\indent\indent\indent Matrix \&theMatrix, \\
  168. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  169. First determines the size of the matrix, $noRows * noCols$. If a files
  170. for matrices of this size has not yet been created, an error message
  171. is printed and $-1$ is returned. A sequential search
  172. is made in the file to see if information is already stored for a Matrix with
  173. this {\em dbTag} and {\em commitTag}. If no information is stored a
  174. $-1$ is returned. If information is stored, the information is
  175. retrieved and the data in the Matrix is set. returns $0$ if
  176. successful. \\
  177. \indent {\em int sendVector(int dbTag, int commitTag, \\
  178. \indent\indent\indent\indent\indent const Vector \&theVector, \\
  179. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  180. If a file
  181. for Vectors of this size has not yet been created, one is created now
  182. and the cell in the array of file pointers is set. If file can not be
  183. created a warning message is printed and program is terminated. A sequential search
  184. is made in the file to see if information is already stored for a Vector with
  185. this {\em dbTag} and {\em commitTag}. The data is then written at this
  186. location, or eof if no location was found. The end of file location
  187. for Vectors of this size is updated. If successful $0$ is
  188. returned. A warning message and a negative number is returned if the
  189. operation fails: $-1$ if Vector size is too large. \\
  190. \indent {\em int recvVector(int dbTag, int commitTag, \\
  191. \indent\indent\indent\indent\indent Vector \&theVector, \\
  192. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  193. If a file for Vectors of this size has not yet been created, an error message
  194. is printed and $-1$ is returned. A sequential search
  195. is made in the file to see if information is already stored for a Vector with
  196. this {\em dbTag} and {\em commitTag}. If no information is stored a
  197. $-1$ is returned. If information is stored, the information is
  198. retrieved and the data in the Vector is set. Returns $0$ if
  199. successful. \\
  200. \indent {\em int sendID(int dbTag, int commitTag, \\
  201. \indent\indent\indent\indent\indent const ID \&theID, \\
  202. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  203. If a file
  204. for IDs of this size has not yet been created, one is created now
  205. and the cell in the array of file pointers is set. If file can not be
  206. created a warning message is printed and program is terminated. A sequential search
  207. is made in the file to see if information is already stored for a ID with
  208. this {\em dbTag} and {\em commitTag}. The data is then written at this
  209. location, or eof if no location was found. The end of file location
  210. for IDss of this size is updated. If successful $0$ is
  211. returned. A warning message and a negative number is returned if the
  212. operation fails: $-1$ if ID size is too large. \\
  213. \indent {\em int recvID(int dbTag, int commitTag, \\
  214. \indent\indent\indent\indent\indent ID \&theID, \\
  215. \indent\indent\indent\indent\indent ChannelAddress *theAddress =0);}\\
  216. If a file for IDs of this size has not yet been created, an error message
  217. is printed and $-1$ is returned. A sequential search
  218. is made in the file to see if information is already stored for a ID with
  219. this {\em dbTag} and {\em commitTag}. If no information is stored a
  220. $-1$ is returned. If information is stored, the information is
  221. retrieved and the data in the ID is set. Returns $0$ if successful.