CTestRelativeEnergyIncr.hGo 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.2 $ 00022 // $Date: 2005/12/15 00:19:28 $ 00023 // $Source: /usr/local/cvs/OpenSees/SRC/convergenceTest/CTestRelativeEnergyIncr.h,v $ 00024 00025 // Written: fmk 00026 // Date: 02/02 00027 // Modified: 05/05 ahs 00028 // 00029 // Purpose: This file contains the class definition for CTestRelativeEnergyIncr. 00030 // A CTestRelativeNormEnergyIncr object tests for convergence using the ratio of the 00031 // current norm to the initial norm (the norm when start is invoked) of the 00032 // which is 0.5 times the absolute value of the product of the rhs and 00033 // the solution vector of the LinearSOE. 00034 00035 #ifndef CTestRelativeEnergyIncr_h 00036 #define CTestRelativeEnergyIncr_h 00037 00038 #include <ConvergenceTest.h> 00039 #include <bool.h> 00040 class EquiSolnAlgo; 00041 class LinearSOE; 00042 00043 class CTestRelativeEnergyIncr: public ConvergenceTest 00044 { 00045 public: 00046 // constructors 00047 CTestRelativeEnergyIncr(); 00048 CTestRelativeEnergyIncr(double tol, int maxNumIter, int printFlag, int normType=2); 00049 00050 // destructor 00051 ~CTestRelativeEnergyIncr(); 00052 00053 ConvergenceTest *getCopy(int iterations); 00054 00055 void setTolerance(double newTol); 00056 int setEquiSolnAlgo(EquiSolnAlgo &theAlgo); 00057 00058 int test(void); 00059 int start(void); 00060 00061 int getNumTests(void); 00062 int getMaxNumTests(void); 00063 double getRatioNumToMax(void); 00064 const Vector &getNorms(void); 00065 00066 int sendSelf(int commitTag, Channel &theChannel); 00067 int recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker); 00068 00069 protected: 00070 00071 private: 00072 LinearSOE *theSOE; 00073 double tol; // the tol on the energy used to test for convergence 00074 00075 int maxNumIter; // max number of iterations 00076 int currentIter; // number of times test() has been invokes since last start() 00077 int printFlag; // a flag indicating if to print on test 00078 int nType; // type of norm to use (1-norm, 2-norm, p-norm, max-norm) 00079 00080 Vector norms; // vector to hold the norms 00081 double norm0; // norm at first iteration of each step 00082 }; 00083 00084 #endif |