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
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
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
00053 Linear::Linear()
00054 :EquiSolnAlgo(EquiALGORITHM_TAGS_Linear)
00055 {
00056
00057 }
00058
00059
00060 Linear::~Linear()
00061 {
00062
00063 }
00064
00065
00066
00067
00068 int
00069 Linear::solveCurrentStep(void)
00070 {
00071
00072
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 }