SolutionAlgorithm.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.4 $
00022 // $Date: 2004/11/13 08:08:14 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/analysis/algorithm/SolutionAlgorithm.cpp,v $
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 

Generated on Mon Oct 23 15:04:57 2006 for OpenSees by doxygen 1.5.0