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 #include <SolutionAlgorithm.h>
00027 #include <Recorder.h>
00028 #include <stdlib.h>
00029 #include <OPS_Globals.h>
00030
00031 SolutionAlgorithm::SolutionAlgorithm(int clasTag)
00032 :MovableObject(clasTag), theRecorders(0), numRecorders(0)
00033 {
00034
00035 }
00036
00037 SolutionAlgorithm::~SolutionAlgorithm()
00038 {
00039 for (int i=0; i<numRecorders; i++)
00040 delete theRecorders[i];
00041
00042 if (theRecorders != 0) {
00043 free((void *)theRecorders);
00044 }
00045 }
00046
00047 int
00048 SolutionAlgorithm::domainChanged()
00049 {
00050 return 0;
00051 }
00052
00053 int
00054 SolutionAlgorithm::addRecorder(Recorder &theRecorder)
00055 {
00056 Recorder **newRecorders = (Recorder **)malloc((numRecorders+1)*sizeof(Recorder *));
00057 if (newRecorders == 0) {
00058 opserr << "SolutionAlgorithm::addRecorder - ran out of memory\n";
00059 return -1;
00060 }
00061
00062 for (int i=0; i<numRecorders; i++)
00063 newRecorders[i] = theRecorders[i];
00064 newRecorders[numRecorders] = &theRecorder;
00065
00066 if (theRecorders != 0)
00067 free((void *)theRecorders);
00068
00069 theRecorders = newRecorders;
00070 numRecorders++;
00071 return 0;
00072 }
00073
00074
00075 int
00076 SolutionAlgorithm::record(int cTag)
00077 {
00078 for (int i=0; i<numRecorders; i++)
00079 theRecorders[i]->record(cTag, 0.0);
00080 return 0;
00081 }
00082