00001 #include "mtglvec.h" 00002 #include "vector.h" 00003 00004 00005 00006 /** 00007 Default constructor initializes data members 00008 to the default values. 00009 00010 Created by Tomas Koudelka, 11.2011 00011 */ 00012 mt_glob_vec::mt_glob_vec() 00013 { 00014 istep = 0; 00015 r = f = dr = fp = fl = fi = fb = lhsb = NULL; 00016 } 00017 00018 00019 00020 /** 00021 The function allocates vectors dr, fp, fl, fi, fb and lhsb 00022 with length n. Vectors r and f remains unallocated because 00023 they are used as pointers to the right and left hand sides 00024 that are allocated separately. 00025 00026 @param n - length of vectors allocated i.e. total number of unknowns 00027 00028 @return The function does not return anything. 00029 00030 Created by Tomas Koudelka, 11.2011 00031 */ 00032 void mt_glob_vec::alloc(long n) 00033 { 00034 // vector of increments of nodal displacements 00035 dr = new double [n]; 00036 nullv (dr,n); 00037 // vector of prescribed forces from the previous step 00038 fp = new double [n]; 00039 nullv (fp,n); 00040 // vector of prescribed force loads, it does not contain forces caused by temperature, etc 00041 fl = new double [n]; 00042 nullv (fl,n); 00043 // vector of internal forces 00044 fi = new double [n]; 00045 nullv (fi,n); 00046 // auxiliary force vector 00047 fb = new double [n]; 00048 nullv (fb,n); 00049 // backup of the nodal displacements 00050 lhsb = new double [n]; 00051 nullv (lhsb,n); 00052 } 00053 00054 00055 00056 /** 00057 The function deallocates vectors dr, fp, fl, fi, fb and lhsb. 00058 */ 00059 void mt_glob_vec::dealloc() 00060 { 00061 delete [] fi; 00062 delete [] fb; 00063 delete [] fp; 00064 delete [] dr; 00065 delete [] fl; 00066 delete [] lhsb; 00067 } 00068 00069 00070 00071 /** 00072 Destructor deallocates vectors dr, fp, fl, fi, fb and lhsb. 00073 00074 Created by Tomas Koudelka, 11.2011 00075 */ 00076 mt_glob_vec::~mt_glob_vec() 00077 { 00078 dealloc(); 00079 }