Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

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.1.1.1 $
00022 // $Date: 2000/09/15 08:23:16 $
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 <iostream.h>    
00046 #include <Vector.h>
00047 #include <Channel.h>
00048 #include <FEM_ObjectBroker.h>
00049 #include <ConvergenceTest.h>
00050 
00051 #include <Timer.h>
00052 // Constructor
00053 Linear::Linear()
00054 :EquiSolnAlgo(EquiALGORITHM_TAGS_Linear)
00055 {
00056 
00057 }
00058 
00059 // Destructor
00060 Linear::~Linear()
00061 {
00062 
00063 }
00064 
00065 // int run(void)
00066 //    Performs the linear solution algorithm.
00067 
00068 int 
00069 Linear::solveCurrentStep(void)
00070 {
00071     // set up some pointers and check they are valid
00072     // NOTE this could be taken away if we set Ptrs as protecetd in superclass
00073 
00074     AnalysisModel *theAnalysisModel = this->getAnalysisModelPtr(); 
00075     LinearSOE  *theSOE = this->getLinearSOEptr();
00076     IncrementalIntegrator  *theIncIntegrator = 
00077  this->getIncrementalIntegratorPtr(); 
00078 
00079     if ((theAnalysisModel == 0) || (theIncIntegrator ==0 ) || (theSOE == 0)){
00080  cerr << "WARNING Linear::solveCurrentStep() -";
00081  cerr << "setLinks() has not been called.\n";
00082  return -5;
00083     }
00084 
00085     if (theIncIntegrator->formTangent() < 0) {
00086  cerr << "WARNING Linear::solveCurrentStep() -";
00087  cerr << "the Integrator failed in formTangent()\n";
00088  return -1;
00089     } 
00090 
00091     
00092     if (theIncIntegrator->formUnbalance() < 0) {
00093  cerr << "WARNING Linear::solveCurrentStep() -";
00094  cerr << "the Integrator failed in formUnbalance()\n"; 
00095  return -2;
00096     }
00097 
00098     if (theSOE->solve() < 0) {
00099  cerr << "WARNING Linear::solveCurrentStep() -";
00100  cerr << "the LinearSOE failed in solve()\n"; 
00101  return -3;
00102     }
00103 
00104     const Vector &deltaU = theSOE->getX();
00105 
00106     if (theIncIntegrator->update(deltaU) < 0) {
00107  cerr << "WARNING Linear::solveCurrentStep() -";
00108  cerr << "the Integrator failed in update()\n"; 
00109  return -4;
00110     }
00111 
00112     return 0;
00113 }
00114 
00115 void
00116 Linear::setTest(ConvergenceTest &theNewTest)
00117 {
00118   cerr << " WARNINGLinear::setTest() - linear algorithm does";
00119   cerr << " not use a ConvergenceTest\n"; 
00120 }
00121 
00122 int
00123 Linear::sendSelf(int cTag, Channel &theChannel)
00124 {
00125     return 0;
00126 }
00127 
00128 int
00129 Linear::recvSelf(int cTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
00130 {
00131     return 0;
00132 }
00133 
00134 
00135 void
00136 Linear::Print(ostream &s, int flag)
00137 {
00138     s << "\t Linear algorithm";
00139 }
Copyright Contact Us