XC Open source finite element analysis program
Spring.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 ** OpenSees - Open System for Earthquake Engineering Simulation **
29 ** Pacific Earthquake Engineering Research Center **
30 ** **
31 ** **
32 ** (C) Copyright 1999, The Regents of the University of California **
33 ** All Rights Reserved. **
34 ** **
35 ** Commercial use of this program without express permission of the **
36 ** University of California, Berkeley, is strictly prohibited. See **
37 ** file 'COPYRIGHT' in main directory for information on usage and **
38 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. **
39 ** **
40 ** Developed by: **
41 ** Frank McKenna (fmckenna@ce.berkeley.edu) **
42 ** Gregory L. Fenves (fenves@ce.berkeley.edu) **
43 ** Filip C. Filippou (filippou@ce.berkeley.edu) **
44 ** **
45 ** ****************************************************************** */
46 
47 // $Revision: 1.13 $
48 // $Date: 2003/03/17 19:19:49 $
49 // $Source: /usr/local/cvs/OpenSees/SRC/element/truss/Spring.h,v $
50 
51 
52 #ifndef Spring_h
53 #define Spring_h
54 
55 // File: ~/element/truss/Spring.h
56 //
57 // Written: fmk
58 // Created: 07/98
59 // Revision: A
60 //
61 // Description: This file contains the class definition for Spring. A Spring object
62 // provides the abstraction of the small deformation bar element. Each truss
63 // object is assocaited with a material object. This Truss element will work
64 // in 1d, 2d or 3d problems.
65 //
66 // What: "@(#) Truss.h, revA"
67 
68 #include "ProtoTruss.h"
69 #include <utility/matrix/Matrix.h>
70 
71 namespace XC {
72 class Channel;
73 class UniaxialMaterial;
74 
75 class Spring : public ProtoTruss
76  {
77  private:
78  // private attributes - a copy for each object of the class
79  UniaxialMaterial *theMaterial;
80  double cosX[3];
81 
82  double computeCurrentStrain(void) const;
83  double computeCurrentStrainRate(void) const;
84 
85  int sendData(CommParameters &cp);
86  int recvData(const CommParameters &cp);
87  void inicializa(void);
88  protected:
89 
90  public:
91  Spring(int tag, int dimension, int Nd1, int Nd2, UniaxialMaterial &theMaterial, double A);
92  Spring(int tag,int dimension,const Material *ptr_mat);
93  Spring(void);
94  Spring(const Spring &);
95  Spring &operator=(const Spring &);
96  Element *getCopy(void) const;
97  ~Spring(void);
98 
99  // public methods to obtain inforrmation about dof & connectivity
100  void setDomain(Domain *theDomain);
101 
102  // public methods to set the state of the element
103  int commitState(void);
104  int revertToLastCommit(void);
105  int revertToStart(void);
106  int update(void);
107 
108  const Material *getMaterial(void) const;
109  Material *getMaterial(void);
110  virtual double getRho(void) const;
111 
112  // public methods to obtain stiffness, mass, damping and residual information
113  const Matrix &getKi(void);
114  const Matrix &getTangentStiff(void) const;
115  const Matrix &getInitialStiff(void) const;
116  const Matrix &getDamp(void) const;
117  const Matrix &getMass(void) const;
118 
119  int addLoad(ElementalLoad *theLoad, double loadFactor);
120  int addInertiaLoadToUnbalance(const Vector &accel);
121 
122  double getAxil(void) const;
123  const Vector &getResistingForce(void) const;
124  const Vector &getResistingForceIncInertia(void) const;
125 
126  // public methods for element output
127  int sendSelf(CommParameters &);
128  int recvSelf(const CommParameters &);
129  void Print(std::ostream &s, int flag =0);
130 
131 
132  Response *setResponse(const std::vector<std::string> &argv, Information &eleInfo);
133  int getResponse(int responseID, Information &eleInformation);
134  };
135 } // end of XC namespace
136 
137 #endif
138 
139 
140 
141 
int addLoad(ElementalLoad *theLoad, double loadFactor)
Adds a load.
Definition: Spring.cc:392
virtual double getRho(void) const
Returns the material density.
Definition: Spring.cc:366
Base class for materials.
Definition: Material.h:85
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:98
Definition: Vector.h:82
int revertToStart(void)
Returns to the initial state.
Definition: Spring.cc:271
Definition: Spring.h:75
const Matrix & getTangentStiff(void) const
Returns the tangent stiffness matrix.
Definition: Spring.cc:283
int revertToLastCommit(void)
Returns to the last commited state.
Definition: Spring.cc:267
Information about an element.
Definition: Information.h:80
Spring(void)
Definition: Spring.cc:82
Spring & operator=(const Spring &)
Assignment operator.
Definition: Spring.cc:98
void Print(std::ostream &s, int flag=0)
Imprime el objeto.
Definition: Spring.cc:492
Base calass for the finite elements.
Definition: Element.h:104
Base class for loads over elements.
Definition: ElementalLoad.h:73
void setDomain(Domain *theDomain)
Definition: Spring.cc:129
const Matrix & getDamp(void) const
Returns the matriz de amortiguamiento.
Definition: Spring.cc:335
Base class for truss elements.
Definition: ProtoTruss.h:44
~Spring(void)
Definition: Spring.cc:116
Element * getCopy(void) const
Virtual constructor.
Definition: Spring.cc:110
const Vector & getResistingForceIncInertia(void) const
Returns the reacción of the element incluyendo fuerzas de inercia.
Definition: Spring.cc:457
Definition: Matrix.h:82
const Matrix & getInitialStiff(void) const
Returns the initial tangent stiffness matrix.
Definition: Spring.cc:309
int update(void)
Computes current trial strain from trial displacements at the nodes.
Definition: Spring.cc:275
const Matrix & getMass(void) const
Returns the mass matrix.
Definition: Spring.cc:370
int commitState(void)
Commits its state.
Definition: Spring.cc:256
Communication parameters between processes.
Definition: CommParameters.h:65
================================================================================
Definition: ContinuaReprComponent.h:34
Definition: Response.h:71
const Vector & getResistingForce(void) const
Returns the reacción of the element.
Definition: Spring.cc:435
Base class for uniaxial materials.
Definition: UniaxialMaterial.h:88
int addInertiaLoadToUnbalance(const Vector &accel)
Adds las fuerzas de inercia.
Definition: Spring.cc:399