XC Open source finite element analysis program
profmatr.h
1 //----------------------------------------------------------------------------
2 // XC program; finite element analysis code
3 // for structural analysis and design.
4 //
5 // Copyright (C) Luis Claudio Pérez Tato
6 //
7 // This program derives from OpenSees <http://opensees.berkeley.edu>
8 // developed by the «Pacific earthquake engineering research center».
9 //
10 // Except for the restrictions that may arise from the copyright
11 // of the original program (see copyright_opensees.txt)
12 // XC is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // This software is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program.
25 // If not, see <http://www.gnu.org/licenses/>.
26 //----------------------------------------------------------------------------
27 //#############################################################################
28 // #
29 // #
30 // /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/~~\ #
31 // | |____| #
32 // | | #
33 // | | #
34 // | | #
35 // | | #
36 // | B A S E C L A S S E S | #
37 // | | #
38 // | | #
39 // | | #
40 // | | #
41 // | C + + H E A D E R | #
42 // | | #
43 // | | #
44 // | | #
45 // | | #
46 // /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/ | #
47 // \_________________________________________\__/ #
48 // #
49 // #
50 //##############################################################################
51 //# COPYRIGHT (C): :-)) #
52 //# PROJECT: Object Oriented Finite Element Program #
53 //# PURPOSE: #
54 //# CLASS: profilematrix #
55 //# #
56 //# VERSION: #
57 //# LANGUAGE: C++.ver >= 2.0 ( Borland C++ ver=3.10, SUN C++ ver=2.1 )#
58 //# TARGET OS: DOS || UNIX || . . . #
59 //# PROGRAMMER(S): Boris Jeremic #
60 //# #
61 //# #
62 //# DATE: September 13 '94 Unsymmetric Solver -> profile solver #
63 //# ( see FEM4ed by O.Z. and R.T.) #
64 //# #
65 //# UPDATE HISTORY: September 27 '94 profile solver for symmetric and #
66 //# Nonsymmetric systems works! #
67 //# (from FEM4ed by O.Z. and R.T.) #
68 //# #
69 //# #
70 //##############################################################################
71 // Profile Sparse Matrix Class
72 // this one is based on Zienkiewicz's and Taylor's book!
73 
74 #ifndef PROFMATR_HH
75 #define PROFMATR_HH
76 
77 //tempout#include <femdata.h>
78 //tempout#include <brick3d.h>
79 //tempout#include <node.h>
80 //tempout#include <stifmat.h>
81 
82 #include <algorithm>
83 #include <string>
84 
85 namespace XC {
86  class BJvector;
87 
89  {
90  public:
91  friend class profilematrix;
92  private:
93  double *al; // lower triangular part of matrix
94  double *au; // upper triangular part of matrix
95  double *ad; // diagonals of triangular of matrix
96  //double max_element; // max ele. of matrix
97  //double min_element; // min ele. of matrix
98 
99  int *jp; // pointers to bottom of columns of al and au arrays
100 
101  int * columnheight; // pointers to the height of each column may be replaced by jp __Zhaohui
102 
103  int neq; // dimension of a system ( as square matrix )
104 
105  int total_numb; // total nubmer of elements in al and/or au
106 
107  char flag; // if flag=='S' symmetric; if flag=='N' NON(un)symmetric
108 
109  int n; // reference count
110 
111  public:
112 // overloading operator new and delete in profilematrix_rep class ########
113  void * operator new(size_t s); // see C++ reference manual by
114  void operator delete(void *); // by ELLIS and STROUSTRUP page 283.
115  // and ECKEL page 529.
116  };
117 
119  {
120  private:
121  profilematrix_rep * pc_profilematrix_rep;
122  public:
123 // I don't need default constructor, this is not a very common data type!!!!!!!!!!!
124 // profilematrix(int matrix_order=1, double init_value=0.0 ); // default constructor
125 // this constructor just for testing purposes!
126 
127 //tempout profilematrix(FEModelData & FEMD,
128 //tempout Brick3D * b3d,
129 //tempout Node * node);
130 
131  profilematrix(int matrix_order,
132  int *jp_init,
133  char flag_init,
134  double *au_init_val,
135  double *al_init_val,
136  double *ad_init_val);
137 // The real constructor. This one will be initialized to the original size
138 // with the init_val values and then in stiffness matrix class those
139 // default inti_val values will be altered ( to the right stiffness ).
140  profilematrix(int matrix_order,
141  int *jp_init,
142  char flag_init,
143  double au_init_val,
144  double al_init_val,
145  double ad_init_val);
146 // skymatrix(char *flag, int dimension ); // create an ident skymatrix
147  profilematrix(const profilematrix & x); // copy-initializer
148  ~profilematrix();
149 
150 
151  int dimension_of_profile_M(void ) const; // dimension of profile matrix
152  int *get_jp(void) const; // get pointer to array of
153  // Locations of Diagonals
154  profilematrix &operator=(const profilematrix &rval); // profilematrix assignment
155 
156 //....// This is from JOOP May/June 1990 after ARKoenig
157  profilematrix& operator +=(const profilematrix & ); // profilematrix addition
158  friend profilematrix operator+(const profilematrix & , const profilematrix & ); // profilematrix addition
159 //....// This is from JOOP May/June 1990 after ARKoenig
160  profilematrix& operator -=(const profilematrix & ); // profilematrix subtraction
161  friend profilematrix operator-(const profilematrix & , const profilematrix & ); // profilematrix subtraction
162 
163  profilematrix operator+(const double &rval); // scalar addition
164  profilematrix operator-(const double &rval); // scalar subtraction
165  profilematrix operator*(const double &rval); // scalar multiplication
166  double * operator*(const BJvector &arg); // profile multiplied by vector__Zhaohui
167 
168 
169 // int operator==( profilematrix & rval); // profilematrix comparisson
170 // // returns 1 if they are same
171 // // returns 0 if they are not
172 
173  double & val(int row, int col); // element selection;
174  double cval(int row, int col) const; // element selection;
175 // can be used to read or write an element.
176  double mmin( ); // find minimum element in the skymatrix
177  double mmax( ); // find maximum element in the skymatrix
178  double mean( ); // average all the elements of the skymatrix
179  double get_max(void); // get max element
180  //double get_min(void); // get max element
181  //void set_mm(void); // set max and min element
182 
183  //Zhaohui added to set the max-element in diagonal of eqn_no_shake!
184  void set_penalty_element(int *eqn_no_shake, int no_of_shake, double max_element);
185 
186  void lower_print(char *msg = ""); // print lower part of
187  // skymatrix with a message
188  void upper_print(char *msg = ""); // print upper part of
189  // skymatrix with a message
190 
191 // void profile_init( FEModelData & FEMD); // initialize profile
192 // This sub has been merged with initializor No.1 //Zhaohui added
193 
194  void profile_jp_print( ); // print jp vector
195  //Zhaohui added
196 
197  void profile_ad_print( void );
198  void profile_al_print( ); // print al vector
199  //Zhaohui added
200 
201  void full_print(char *msg = ""); // print sky matrix
202  // as a full matrix with a message
203 
204 //tempout profilematrix & AssembleBricksInProfMatrix(stiffness_matrix & Ke,
205 //tempout Brick3D * b3d,
206 //tempout Node * node,
207 //tempout FEModelData & FEMD,
208 //tempout float scale // used to add damping matrix C to Kbar Zhaohui
209 //tempout );
210 //tempout
211 
212  private:
213  void error(const std::string &msg1,const std::string &msg2= "") const;
214 // this one is the same as mval except that it is more convinient
215 // to overload operator (row,col).
216  double &operator( )(int , int ) const;
217  double & mval(int , int ) const;
218 // full_val inline function allows you to treat profilematrix as if it is full
219 // float matrix. The function will calculate position inside sky matrix
220 // and return appropriate number if row and col are bellow skyline or
221 // return zero (0) if row and col are above sky line
222  double full_val (int , int ) const;
223 
224  private:
225 //.. double* data(void) const;
226 //.. void set_data_pointer(double* );
227 // int rank(void) const;
228 // void rank(int );
229  long int total_number(void) const ;
230  void total_number(int );
231 // int* dim(void) const ;
232 // int& get_dim_pointer(void) const ;
233 // void set_dim_pointer(int* );
234 // int dim(int which) const;
235  int reference_count(int );
236  void set_reference_count(int );
237 
238 // profile solvers !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
239 
240  public:
241 // void datri(); // triangular decomposition of profile symmetric/unsymmetric matrix!
242  profilematrix & datri(void); // triangular decomposition of profile symmetric/unsymmetric matrix!
243  double * dasol(double *); // backsubstitution of profile symmetric/unsymmetric matrix!
244  double datest(double* , int );
245  double dot(double* , double* , int );
246  void dredu(double* , double* , double* , int , char , double* );
247  void saxpb(double* , double* , double , int , double* );
248 
249 
250 
251  };
252 
253 } // end of XC namespace
254 
255 #endif
Definition: profmatr.h:118
Definition: BJvector.h:100
Definition: profmatr.h:88
================================================================================
Definition: ContinuaReprComponent.h:34