skymatr.h

Go to the documentation of this file.
00001 //#############################################################################
00002 //                                                                            #
00003 //                                                                            #
00004 //             /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/~~\                #
00005 //            |                                          |____|               #
00006 //            |                                          |                    #
00007 //            |                                          |                    #
00008 //            |                                          |                    #
00009 //            |                                          |                    #
00010 //            |        B A S E   C L A S S E S           |                    #
00011 //            |                                          |                    #
00012 //            |                                          |                    #
00013 //            |                                          |                    #
00014 //            |                                          |                    #
00015 //            |          C + +     H E A D E R           |                    #
00016 //            |                                          |                    #
00017 //            |                                          |                    #
00018 //            |                                          |                    #
00019 //            |                                          |                    #
00020 //         /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/   |                    #
00021 //         \_________________________________________\__/                     #
00022 //                                                                            #
00023 //                                                                            #
00024 //#############################################################################
00025 //#############################################################################
00026 //##############################################################################
00027 //# COPYRIGHT (C):     :-))                                                    #
00028 //# PROJECT:           Object Oriented Finite Element Program                  #
00029 //# PURPOSE:                                                                   #
00030 //# CLASS:             skymatrix                                               #
00031 //#                                                                            #
00032 //# VERSION:                                                                   #
00033 //# LANGUAGE:          C++.ver >= 2.0 ( Borland C++ ver=3.10, SUN C++ ver=2.1 )#
00034 //# TARGET OS:         DOS || UNIX || . . .                                    #
00035 //# PROGRAMMER(S):     Boris Jeremic                                           #
00036 //#                                                                            #
00037 //#                                                                            #
00038 //# DATE:              November '92                                            #
00039 //# UPDATE HISTORY:    05 - __ avgust '93.  redefined as derived class from    #
00040 //#                                 nDarray class                              #
00041 //#                    August 22-29 '94 choped to separate files and worked on #
00042 //#                                   const and & issues                       #
00043 //#                    August 30-31 '94 added use_def_dim to full the CC       #
00044 //#                                   resolved problem with temoraries for     #
00045 //#                                   operators + and - ( +=, -= )             #
00046 //#                                                                            #
00047 //#                    September 09 '94 starting to rewrite things after a talk#
00048 //#                    by Stephen Jonson " Objecting the Objects". The point is#
00049 //#                    to forget about inheriting skymatrix from nDarray and   #
00050 //#                    start from separate branch!                             #
00051 //#                                                                            #
00052 //#                    September 11 '94 it works                               #
00053 //#                    September 12-13 '94 looking for the solver for symmetric#
00054 //#                                        and unsymmetric sparse matrices.    #
00055 //#                                        One solution is Taylor's profile    #
00056 //#                                        solver ( see FEM4ed by O.Z. and R.T.#
00057 //#                    September 27 '94 profile solver for symmetric and       #
00058 //#                                     Nonsymmetric systems works!            #
00059 //#                                     (from FEM4ed by O.Z. and R.T.)         #
00060 //#                                                                            #
00061 //#                                                                            #
00062 //##############################################################################
00063 
00064 #ifndef SKYMATRIX_HH
00065 #define SKYMATRIX_HH
00066 
00067 #include <basics.h>
00068 
00069 
00070 //#include <femdata.h>
00071 //#include <brick3d.h>
00072 //#include <node.h>
00073 //#include <stifmat.h>
00074 
00075 
00076 //outOLD// SKYMATRIX_CC Skyline Sparse Matrix Class
00077 //outOLD// this one is based on Bathe's book!
00078 //outOLDclass skymatrix_rep
00079 //outOLD  {
00080 //outOLD    public:
00081 //outOLD      friend class skymatrix;
00082 //outOLD    private:
00083 //outOLD      double *pd_nDdata;   // skymatrix as 1D array
00084 //outOLD
00085 //outOLD      int *p_maxa;         // array of diagonal location pointers (MAXA)
00086 //outOLD
00087 //outOLD      long int total_numb;      // total nubmer of elements in skymatrix
00088 //outOLD
00089 //outOLD      int square_dim;      // dimension of a system ( as square matrix )
00090 //outOLD
00091 //outOLD      int n;               // reference count
00092 //outOLD
00093 //outOLD    public:
00094 //outOLD// overloading operator new and delete in skymatrix_rep class  ########
00095 //outOLD      void * operator new(size_t s); // see C++ reference manual by
00096 //outOLD      void operator delete(void *);  // by ELLIS and STROUSTRUP page 283.
00097 //outOLD                                   // and ECKEL page 529.
00098 //outOLD  };
00099 
00100 
00101 class skymatrix
00102   {
00103 //    private:
00104       struct skymatrix_rep
00105         {
00106           int * columnheight;
00107           int * maxa;
00108           double * data;
00109           int square_dim;
00110         } *pc_skymatrix_rep;
00111 //outOLD      skymatrix_rep * pc_skymatrix_rep;
00112     public:
00113 //..       skymatrix(int matrix_order=1, double init_value=0.0 ); // default constructor
00114 //tempout      skymatrix(FEModelData & FEMD );
00115       skymatrix(int order_n, int *maxa, double *initval);
00116 //outOLD//      skymatrix(char *flag, int dimension ); // create an ident skymatrix
00117 //outOLD      skymatrix(const skymatrix & x); // copy-initializer
00118 //tempout      skymatrix(FEModelData & FEMD, Brick3D * b3d, Node * node);
00119 //      skymatrix(FEModelData & FEMD, Finite_Element & );
00120       ~skymatrix();
00121 
00122 
00123 //outOLD//      void ColumnHeights(Brick3D * b3d, Node * node, FEModelData & FEMD);
00124 //outOLD//      void create_MAXA(FEModelData  & );
00125 //outOLD
00126       int dimension_of_sky_M(void ) const; // dimension of  sky matrix
00127       int *get_MAXA(void) const; // get pointer to array of
00128 //outOLD                              // Locations of Diagonals
00129 //outOLD//outOLD      skymatrix & operator=(const skymatrix & rval); // skymatrix assignment
00130 //outOLD
00131 //outOLD//....// This is from JOOP May/June 1990 after ARKoenig
00132 //outOLD      skymatrix& operator +=( const skymatrix & ); // skymatrix addition
00133 //outOLD      friend skymatrix operator+(const skymatrix & , const skymatrix & ); // skymatrix addition
00134 //outOLD//....// This is from JOOP May/June 1990 after ARKoenig
00135 //outOLD      skymatrix& operator -=( const skymatrix & ); // skymatrix subtraction
00136 //outOLD      friend skymatrix operator-(const skymatrix & , const skymatrix & ); // skymatrix subtraction
00137 //outOLD
00138 //outOLD      skymatrix operator+( double   rval);  // scalar addition
00139 //outOLD      skymatrix operator-( double   rval);  // scalar subtraction
00140 //outOLD      skymatrix operator*( double   rval);  // scalar multiplication
00141 //outOLD
00142 //outOLD//......    nDarray deep_copy( ); // make an image
00143 //outOLD
00144 //outOLD//      int operator==( skymatrix & rval);  // skymatrix comparisson
00145 //outOLD//                                             // returns 1 if they are same
00146 //outOLD//                                             // returns 0 if they are not
00147 //outOLD
00148       double & val(int row,  int col); // element selection;
00149       double cval(int row,  int col) const; // element selection;
00150 //outOLD// can be used to read or write an element.
00151       double mmin( ); // find minimum element in the skymatrix
00152       double mmax( ); // find maximum element in the skymatrix
00153 //outOLD      double mean( );  // average all the elements of the skymatrix
00154       void lower_print(char *msg = ""); // print lower part of
00155                                         // skymatrix with a message
00156       void upper_print(char *msg = ""); // print upper part of
00157                                         // skymatrix with a message
00158       void full_print(char *msg =  ""); // print sky matrix
00159                                         // as a full matrix with a message
00160 
00161 
00162 
00163 //tempout      skymatrix  & AssembleBricksInSkyMatrix(stiffness_matrix   & Ke,  
00164 //tempout                                             Brick3D            * b3d,
00165 //tempout                                             Node               * node
00166 //tempout                                            );
00167 
00168       skymatrix & v_ldl_factorize( ); // ldl factorizing sky matrix
00169       double * d_reduce_r_h_s_l_v ( double * );
00170       double * d_back_substitute ( double * );
00171 
00172 
00173     private:
00174       void error(char *msg1, char *msg2 = "") const; // private function
00175 //outOLD// this one is the same as mval except that it is more convinient
00176 //outOLD// to overload operator (row,col).
00177 //outOLD      double & operator( )(int , int ) const;
00178       double & mval(int , int ) const;
00179 // full_val inline function allows you to treat skymatrix as if it is full
00180 // float matrix. The function will calculate position inside sky matrix
00181 // and return appropriate number if row and col are bellow skyline or
00182 // return zero (0) if row and col are above sky line
00183       double full_val (int , int ) const;
00184 
00185   private:
00186 //outOLD    double* data(void) const;
00187 //outOLD    void set_data_pointer(double* );
00188 //outOLD//    int rank(void) const;
00189 //outOLD//    void rank(int );
00190 //outOLD    long int total_number(void) const ;
00191 //outOLD    void total_number(long int );
00192 //outOLD//    int* dim(void) const ;
00193 //outOLD//    int& get_dim_pointer(void) const ;
00194 //outOLD//    void set_dim_pointer(int* );
00195 //outOLD//    int dim(int which) const;
00196 //outOLD    int reference_count(int );
00197 //outOLD    void set_reference_count(int );
00198 
00199   };
00200 
00201 
00202 #endif

Generated on Mon Oct 23 15:05:28 2006 for OpenSees by doxygen 1.5.0