xc
ASDShellQ4Transformation.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 /* ****************************************************************** **
29 ** OpenSees - Open System for Earthquake Engineering Simulation **
30 ** Pacific Earthquake Engineering Research Center **
31 ** **
32 ** **
33 ** (C) Copyright 1999, The Regents of the University of California **
34 ** All Rights Reserved. **
35 ** **
36 ** Commercial use of this program without express permission of the **
37 ** University of California, Berkeley, is strictly prohibited. See **
38 ** file 'COPYRIGHT' in main directory for information on usage and **
39 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. **
40 ** **
41 ** Developed by: **
42 ** Frank McKenna (fmckenna@ce.berkeley.edu) **
43 ** Gregory L. Fenves (fenves@ce.berkeley.edu) **
44 ** Filip C. Filippou (filippou@ce.berkeley.edu) **
45 ** **
46 ** ****************************************************************** */
47 
48 // $Revision: 1.10 $
49 // $Date: 2020/05/18 22:51:21 $
50 
51 // Original implementation: Massimo Petracca (ASDEA)
52 //
53 // Implementation of a linear coordinate transformation 4-node shells
54 //
55 
56 #ifndef ASDShellQ4Transformation_h
57 #define ASDShellQ4Transformation_h
58 
59 #include "ASDShellQ4LocalCoordinateSystem.h"
60 #include "domain/mesh/node/Node.h"
61 #include "domain/domain/Domain.h"
62 
63 namespace XC {
64 
75  {
76  public:
79  typedef Vector VectorType;
80  typedef Matrix MatrixType;
81  typedef std::array<Node*, 4> NodeContainerType;
82 
83  protected:
84  Vector m_U0= Vector(24);
85  NodeContainerType m_nodes= { {nullptr, nullptr, nullptr, nullptr} };
86 
87  public:
89  {}
90  virtual ~ASDShellQ4Transformation(void)
91  {}
92  virtual ASDShellQ4Transformation *getCopy(void) const;
93 
94  virtual ASDShellQ4Transformation* create() const
95  { return getCopy(); }
96 
97  virtual bool isLinear(void) const
98  { return true; }
99 
100  virtual void revertToStart(void)
101  { }
102 
103  virtual void setDomain(Domain *, const ID &);
104 
105  virtual void revertToLastCommit()
106  {}
107 
108  virtual void commit()
109  {}
110 
111  virtual void update(const VectorType& globalDisplacements)
112  { }
113 
114  virtual ASDShellQ4LocalCoordinateSystem createReferenceCoordinateSystem()const
115  {
116  // the reference coordinate system in the underformed configuration
117  // using the default alignment to the first column of the jacobian at center
119  Vector3Type(m_nodes[0]->getCrds()),
120  Vector3Type(m_nodes[1]->getCrds()),
121  Vector3Type(m_nodes[2]->getCrds()),
122  Vector3Type(m_nodes[3]->getCrds())
123  );
124  }
125 
126  virtual ASDShellQ4LocalCoordinateSystem createLocalCoordinateSystem(const VectorType& globalDisplacements)const
127  {
128  // same as reference
129  return createReferenceCoordinateSystem();
130  }
131 
132  virtual void computeGlobalDisplacements(VectorType& globalDisplacements) const
133  {
134  for (int i = 0; i < 4; i++) {
135  int index = i * 6;
136  const VectorType& iU = m_nodes[i]->getTrialDisp();
137  for (int j = 0; j < 6; j++) {
138  globalDisplacements(index + j) = iU(j) - m_U0(index + j);
139  }
140  }
141  }
142 
143  virtual const MatrixType& computeTransformationMatrix(const ASDShellQ4LocalCoordinateSystem& LCS) const
144  {
145  static MatrixType R(24, 24);
146  static MatrixType T(24, 24);
147  static MatrixType W(24, 24);
148  if (LCS.IsWarped()) {
149  LCS.ComputeTotalRotationMatrix(R);
150  LCS.ComputeTotalWarpageMatrix(W);
151  T.addMatrixProduct(0.0, W, R, 1.0);
152  }
153  else {
154  LCS.ComputeTotalRotationMatrix(T);
155  }
156  return T;
157  }
158 
159  virtual void calculateLocalDisplacements(
161  const VectorType& globalDisplacements,
162  VectorType& localDisplacements)
163  {
164  const MatrixType& R = computeTransformationMatrix(LCS);
165  localDisplacements.addMatrixVector(0.0, R, globalDisplacements, 1.0);
166  }
167 
168  virtual void transformToGlobal(
170  const VectorType& globalDisplacements,
171  const VectorType& localDisplacements,
172  MatrixType& LHS,
173  VectorType& RHS,
174  bool LHSrequired)
175  {
176  static MatrixType RT_LHS(24, 24);
177  static VectorType RHScopy(24);
178  const MatrixType& R = computeTransformationMatrix(LCS);
179  RHScopy = RHS;
180  RHS.addMatrixTransposeVector(0.0, R, RHScopy, 1.0);
181  if (LHSrequired) {
182  RT_LHS.addMatrixTransposeProduct(0.0, R, LHS, 1.0);
183  LHS.addMatrixProduct(0.0, RT_LHS, R, 1.0);
184  }
185  }
186 
187  virtual void transformToGlobal(
189  MatrixType& LHS,
190  VectorType& RHS,
191  bool LHSrequired)
192  {
193  static VectorType dummy;
194  transformToGlobal(LCS, dummy, dummy, LHS, RHS, LHSrequired);
195  }
196 
197  virtual int internalDataSize() const
198  {
199  // just the size of the initial displacements
200  return 24;
201  }
202 
204  virtual Vector getInternalData(void) const
205  {
206  Vector retval(internalDataSize());
207  for(int i = 0; i < 24; i++)
208  retval(i) = m_U0(i);
209  return retval;
210  }
211 
213  virtual void setInternalData(const VectorType &v)
214  {
215  for(int i = 0; i < 24; i++)
216  m_U0(i) = v(i);
217  }
218 
219 public:
220 
221  inline const NodeContainerType& getNodes()const { return m_nodes; }
222  inline NodeContainerType& getNodes() { return m_nodes; }
223 
224  };
225 
226 } // end of XC namespace
227 
228 #endif // !ASDShellQ4Transformation_h
229 
Float vector abstraction.
Definition: Vector.h:94
Vector of integers.
Definition: ID.h:95
This class represent the local coordinate system of any element whose geometry is a 4-node Quadrilate...
Definition: ASDShellQ4LocalCoordinateSystem.h:41
virtual void setInternalData(const VectorType &v)
Restore the object from its internal data.
Definition: ASDShellQ4Transformation.h:213
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Matrix of floats.
Definition: Matrix.h:111
virtual Vector getInternalData(void) const
Return the data needed to recreate the object.
Definition: ASDShellQ4Transformation.h:204
This class represents a basic (linear) coordinate transformation that can be used by any element whos...
Definition: ASDShellQ4Transformation.h:74
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:117
int addMatrixVector(double factThis, const Matrix &m, const Vector &v, double factOther)
To add a factor fact times the Vector formed by the product of the matrix m and the Vector v to the c...
Definition: Vector.cpp:470
ASDQuaternion A simple class that implements the main features of quaternion algebra.
Definition: ASDMath.h:328