Linear.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: 2006/09/05 23:02:11 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/analysis/algorithm/equiSolnAlgo/Linear.cpp,v $
00024                                                                         
00025                                                                         
00026 // File: ~/OOP/analysis/algorithm/Linear.C 
00027 // 
00028 // Written: fmk 
00029 // Created: Sun Sept 15 15:06:47: 1996 
00030 // Revision: A 
00031 //
00032 
00033 // Description: This file contains the class definition for 
00034 // Linear. Linear is a class which performs a linear solution algorihm
00035 // to solve the equations. No member functions are declared as virtual as 
00036 // it is not expected that this class will be subclassed.
00037 // 
00038 // What: "@(#)Linear.C, revA"
00039 
00040 #include <Linear.h>
00041 #include <AnalysisModel.h>
00042 #include <StaticAnalysis.h>
00043 #include <StaticIntegrator.h>
00044 #include <LinearSOE.h>
00045 #include <Vector.h>
00046 #include <Channel.h>
00047 #include <FEM_ObjectBroker.h>
00048 #include <ConvergenceTest.h>
00049 
00050 #include <Timer.h>
00051 // Constructor
00052 Linear::Linear(int theTangent)
00053   :EquiSolnAlgo(EquiALGORITHM_TAGS_Linear), incrTangent(theTangent)
00054 {
00055 
00056 }
00057 
00058 // Destructor
00059 Linear::~Linear()
00060 {
00061 
00062 }
00063 
00064 // int run(void)
00065 //    Performs the linear solution algorithm.
00066 
00067 int 
00068 Linear::solveCurrentStep(void)
00069 {
00070     // set up some pointers and check they are valid
00071     // NOTE this could be taken away if we set Ptrs as protecetd in superclass
00072 
00073     AnalysisModel *theAnalysisModel = this->getAnalysisModelPtr(); 
00074     LinearSOE  *theSOE = this->getLinearSOEptr();
00075     IncrementalIntegrator  *theIncIntegrator = 
00076         this->getIncrementalIntegratorPtr(); 
00077 
00078     if ((theAnalysisModel == 0) || (theIncIntegrator ==0 ) || (theSOE == 0)){
00079         opserr << "WARNING Linear::solveCurrentStep() -";
00080         opserr << "setLinks() has not been called.\n";
00081         return -5;
00082     }
00083 
00084     if (theIncIntegrator->formTangent(incrTangent) < 0) {
00085         opserr << "WARNING Linear::solveCurrentStep() -";
00086         opserr << "the Integrator failed in formTangent()\n";
00087         return -1;
00088     }   
00089 
00090     
00091     if (theIncIntegrator->formUnbalance() < 0) {
00092         opserr << "WARNING Linear::solveCurrentStep() -";
00093         opserr << "the Integrator failed in formUnbalance()\n"; 
00094         return -2;
00095     }
00096 
00097     if (theSOE->solve() < 0) {
00098         opserr << "WARNING Linear::solveCurrentStep() -";
00099         opserr << "the LinearSOE failed in solve()\n";  
00100         return -3;
00101     }
00102 
00103     const Vector &deltaU = theSOE->getX();
00104 
00105     if (theIncIntegrator->update(deltaU) < 0) {
00106         opserr << "WARNING Linear::solveCurrentStep() -";
00107         opserr << "the Integrator failed in update()\n";        
00108         return -4;
00109     }
00110 
00111     return 0;
00112 }
00113 
00114 int
00115 Linear::setConvergenceTest(ConvergenceTest *theNewTest)
00116 {
00117   return 0;
00118 }
00119 
00120 int
00121 Linear::sendSelf(int cTag, Channel &theChannel)
00122 {
00123     return 0;
00124 }
00125 
00126 int
00127 Linear::recvSelf(int cTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
00128 {
00129     return 0;
00130 }
00131 
00132 
00133 void
00134 Linear::Print(OPS_Stream &s, int flag)
00135 {
00136     s << "\t Linear algorithm";
00137 }

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