xc
CrossSectionKR.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // XC program; finite element analysis code
4 // for structural analysis and design.
5 //
6 // Copyright (C) Luis C. Pérez Tato
7 //
8 // This program derives from OpenSees <http://opensees.berkeley.edu>
9 // developed by the «Pacific earthquake engineering research center».
10 //
11 // Except for the restrictions that may arise from the copyright
12 // of the original program (see copyright_opensees.txt)
13 // XC is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // This software is distributed in the hope that it will be useful, but
19 // WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program.
26 // If not, see <http://www.gnu.org/licenses/>.
27 //----------------------------------------------------------------------------
28 //CrossSectionKR.h
29 
30 #ifndef CROSS_SECTION_KR_H
31 #define CROSS_SECTION_KR_H
32 
33 #include "utility/matrix/Vector.h"
34 #include "utility/matrix/Matrix.h"
35 #include "utility/actor/actor/MovableObject.h"
36 
37 namespace XC {
38 
40 //
43  {
44  friend class FiberPtrDeque;
45  double rData[4];
46  Vector *R;
47  double kData[16];
48  Matrix *K;
49 
50  static double value,vas1,vas2,vas1as2;//Para guardar resultados parciales.
51  protected:
52  void free_mem(void);
53  void alloc(const size_t &dim);
54  void copy(const CrossSectionKR &other);
55 
56  int sendData(Communicator &);
57  int recvData(const Communicator &);
58 
59  inline void updateNMz(const double &f,const double &y)
60  {
61  rData[0]+= f; //N.
62  rData[1]+= f*y; //Mz.
63  }
64  inline void updateNMzMy(const double &f,const double &y,const double &z)
65  {
66  updateNMz(f,y);
67  rData[2]+= f*z; //My.
68  }
69  static inline void updateK2d(double k[],const double &fiberArea,const double &y,const double &tangent)
70  {
71  value= tangent*fiberArea;
72  vas1= y*value;
73 
74  k[0]+= value; //Axial stiffness
75  k[1]+= vas1;
76  k[3]+= vas1 * y; //Bending stiffness.
77  }
78  inline void updateK2d(const double &fiberArea,const double &y,const double &tangent)
79  { updateK2d(kData,fiberArea,y,tangent); }
80  static inline void updateK3d(double k[],const double &fiberArea,const double &y,const double &z,const double &tangent)
81  {
82  value= tangent * fiberArea;
83  vas1= y*value;
84  vas2= z*value;
85  vas1as2= vas1*z;
86 
87  k[0]+= value; //Axial stiffness
88  k[1]+= vas1;
89  k[2]+= vas2;
90 
91  k[4]+= vas1 * y;
92  k[5]+= vas1as2;
93 
94  k[8]+= vas2 * z;
95  }
96  inline void updateK3d(const double &fiberArea,const double &y,const double &z,const double &tangent)
97  { updateK3d(kData,fiberArea,y,z,tangent); }
98  static inline void updateKGJ(double k[],const double &fiberArea,const double &y,const double &z,const double &tangent)
99  {
100  value= tangent * fiberArea;
101  vas1= y*value;
102  vas2= z*value;
103  vas1as2= vas1*z;
104 
105  k[0]+= value; //(0,0)->0
106  k[1]+= vas1; //(0,1)->4 y (1,0)->1
107  k[2]+= vas2; //(0,2)->8 y (2,0)->2
108 
109  k[5]+= vas1 * y; //(1,1)->5
110  k[6]+= vas1as2; //(1,2)->9 y (2,1)->6
111 
112  k[10]+= vas2 * z; //(2,2)->10
113  }
114  inline void updateKGJ(const double &fiberArea,const double &y,const double &z,const double &tangent)
115  { updateKGJ(kData,fiberArea,y,z,tangent); }
116 
117  public:
118  CrossSectionKR(const size_t &dim);
119  CrossSectionKR(const CrossSectionKR &other);
121  virtual ~CrossSectionKR(void);
122 
123  void zero(void);
124  inline size_t dim(void) const
125  { return ((R) ? R->Size():0); }
126 
127  inline const Vector &getResultant(void) const
128  { return *R; }
129  inline Vector &getResultant(void)
130  { return *R; }
131  inline const Matrix &Stiffness(void) const
132  { return *K; }
133  inline Matrix &Stiffness(void)
134  { return *K; }
135 
136  int sendSelf(Communicator &);
137  int recvSelf(const Communicator &);
138  };
139 
140 } // end of XC namespace
141 
142 #endif
CrossSectionKR(const size_t &dim)
Constructor.
Definition: CrossSectionKR.cc:86
Float vector abstraction.
Definition: Vector.h:94
void alloc(const size_t &dim)
Allocate memory.
Definition: CrossSectionKR.cc:52
Communication parameters between processes.
Definition: Communicator.h:66
Object that can move between processes.
Definition: MovableObject.h:100
int Size(void) const
Returns the size of the Vector.
Definition: Vector.h:235
Stiffness matrix and resultant vector for a section.
Definition: CrossSectionKR.h:42
Fiber pointers container.
Definition: FiberPtrDeque.h:68
Objet that can execute python scripts.
Definition: CommandEntity.h:40
int recvData(const Communicator &)
Receive data through the communicator argument.
Definition: CrossSectionKR.cc:126
int sendData(Communicator &)
Send data through the communicator argument.
Definition: CrossSectionKR.cc:114
int recvSelf(const Communicator &)
Receive the object.
Definition: CrossSectionKR.cc:151
virtual ~CrossSectionKR(void)
Destructor.
Definition: CrossSectionKR.cc:108
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
int sendSelf(Communicator &)
Send the object.
Definition: CrossSectionKR.cc:136
Matrix of floats.
Definition: Matrix.h:111
CrossSectionKR & operator=(const CrossSectionKR &)
Assignment operator.
Definition: CrossSectionKR.cc:101
void free_mem(void)
Release allocated memory.
Definition: CrossSectionKR.cc:37
void copy(const CrossSectionKR &other)
Copy data.
Definition: CrossSectionKR.cc:60