xc
TransformationDOF_Group.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.5 $
49 // $Date: 2005/08/03 19:12:26 $
50 // $Source: /usr/local/cvs/OpenSees/SRC/analysis/model/dof_grp/TransformationDOF_Group.h,v $
51 
52 
53 #ifndef TransformationDOF_Group_h
54 #define TransformationDOF_Group_h
55 
56 // Written: fmk
57 // Created: 05/99
58 // Revision: A
59 //
60 // Description: This file contains the class definition for
61 // TransformationDOF_Group. A TransformationDOF_Group object is
62 // instantiated by the TransformationConstraintHandler for
63 // every node in the domain which is constrained by an MFreedom_Constraint
64 // or an SFreedom_Constrant.
65 //
66 // What: "@(#) TransformationDOF_Group.h, revA"
67 
68 #include <solution/analysis/model/dof_grp/DOF_Group.h>
69 #include "utility/matrix/Matrix.h"
70 #include "solution/analysis/model/UnbalAndTangent.h"
71 
72 // M.Petracca 2024. Unified approach to constraints
73 #define TRANSF_INCREMENTAL_SP
74 #define TRANSF_INCREMENTAL_MP
75 //#define TRANSF_INCREMENTAL_MP_DEBUG
76 
77 namespace XC {
78 class MFreedom_ConstraintBase;
79 class MFreedom_Constraint;
80 class MRMFreedom_Constraint;
81 class SFreedom_Constraint;
82 class TransformationConstraintHandler;
83 
85 //
93  {
94  private:
96 
97  mutable Matrix Trans;
98  ID modID;
99  int modNumDOF;
100  mutable UnbalAndTangent unbalAndTangentMod;
101  int needRetainedData;
102  std::vector<SFreedom_Constraint *> theSPs;
103 
104  // static variables - single copy for all objects of the class
105  static UnbalAndTangentStorage unbalAndTangentArrayMod;
106  static TransformationConstraintHandler *theHandler;
107 
108 #ifdef TRANSF_INCREMENTAL_MP
109  // used to store locally the total displacement as we cannot rely
110  // on getting it from the retained node when processing the constrained
111  // node: the retained node may have been processed before
112  mutable Vector modTotalDisp;
113  static Vector modTrialDispOld;
114 #endif // TRANSF_INCREMENTAL_MP
115 
116  void arrays_setup(int numNodalDOF, int numConstrainedNodeRetainedDOF, int numRetainedNodeDOF, int numRetainedNodes);
117  void initialize(TransformationConstraintHandler *);
118  protected:
119  friend class AnalysisModel;
120  friend class AutoConstraintHandler;
123  std::vector<SFreedom_Constraint *> getSFreedomConstraintArray(int ) const;
126  size_t getNumRetainedNodes(void) const;
127  size_t getNumRetainedNodeDOFs(void) const;
128  std::vector<Node *> getPointersToRetainedNodes(void);
129  std::vector<const Node *> getPointersToRetainedNodes(void) const;
130  const Vector &setupResidual(int numCNodeDOF, const ID &,const ID &, const Vector &, const std::vector<const Node *> &,const Vector &(Node::*response)(void) const) const;
131  const Vector &getTrialResponse(const Vector &(Node::*response)(void) const) const;
132  const Vector &getCommittedResponse(const Vector &(Node::*response)(void) const) const;
133  void setupResidual(const Vector &,int (Node::*setTrial)(const Vector &), const Vector &(Node::*response)(void) const) const;
134  public:
136 
137  // methods dealing with the ID and transformation matrix
138  int doneID(void);
139  const ID &getID(void) const;
140  virtual void setID(int dof, int value);
141  const Matrix *getT(void) const;
142  virtual int getNumDOF(void) const;
143  virtual int getNumFreeDOF(void) const;
144  virtual int getNumConstrainedDOF(void) const;
145 
146  // methods to form the tangent
147  const Matrix &getTangent(Integrator *theIntegrator);
148 
149  // methods to form the unbalance
150  const Vector &getUnbalance(Integrator *theIntegrator);
151  void addM_Force(const Vector &Udotdot, double fact = 1.0);
152 
153  const Vector &getTangForce(const Vector &x, double fact = 1.0);
154  const Vector &getC_Force(const Vector &x, double fact = 1.0);
155  const Vector &getM_Force(const Vector &x, double fact = 1.0);
156 
157  // methods to obtain trial responses from the nodes
158  const Vector &getTrialDisp(void) const;
159  const Vector &getTrialVel(void) const;
160  const Vector &getTrialAccel(void) const;
161 
162  // methods to obtain committed responses from the nodes
163  const Vector &getCommittedDisp(void) const;
164  const Vector &getCommittedVel(void) const;
165  const Vector &getCommittedAccel(void) const;
166 
167  // methods to update the trial response at the nodes
168  void setNodeDisp(const Vector &u);
169  void setNodeVel(const Vector &udot);
170  void setNodeAccel(const Vector &udotdot);
171 
172  void incrNodeDisp(const Vector &u);
173  void incrNodeVel(const Vector &udot);
174  void incrNodeAccel(const Vector &udotdot);
175 
176  virtual void setEigenvector(int mode, const Vector &eigenvalue);
177 
178  int addSFreedom_Constraint(SFreedom_Constraint &theSP);
179  int enforceSPs(int doMP);
180 
181 // AddingSensitivity:BEGIN ////////////////////////////////////
182  void addM_ForceSensitivity(const Vector &Udotdot, double fact = 1.0);
183  void addD_ForceSensitivity(const Vector &vel, double fact = 1.0);
184  void addD_Force(const Vector &vel, double fact = 1.0);
185 
186  const Vector & getDispSensitivity(int gradNumber);
187  const Vector & getVelSensitivity(int gradNumber);
188  const Vector & getAccSensitivity(int gradNumber);
189  int saveSensitivity(Vector *v,Vector *vdot,Vector *vdotdot,int gradNum,int numGrads);
190 // AddingSensitivity:END //////////////////////////////////////
191  };
192 } // end of XC namespace
193 
194 #endif
195 
Unbalanced force vectors and tangent stiffness matrices.
Definition: UnbalAndTangentStorage.h:47
void incrNodeAccel(const Vector &udotdot)
Method to set the corresponding nodes accelerations increments to the values in u, components identified by myID.
Definition: TransformationDOF_Group.cpp:677
const Vector & getCommittedDisp(void) const
Returns the committed value for the displacement.
Definition: TransformationDOF_Group.cpp:446
Float vector abstraction.
Definition: Vector.h:94
Base class for mult-freedom constraints.
Definition: MFreedom_ConstraintBase.h:58
size_t getNumRetainedNodeDOFs(void) const
Returns the number of retained degrees of freedom (retained nodes x retained DOFs on each node)...
Definition: TransformationDOF_Group.cpp:319
const ID & getID(void) const
Method to return the current ID.
Definition: TransformationDOF_Group.cpp:205
const Vector & getTrialAccel(void) const
Returnt trial acceleration.
Definition: TransformationDOF_Group.cpp:440
const Vector & setupResidual(int numCNodeDOF, const ID &, const ID &, const Vector &, const std::vector< const Node *> &, const Vector &(Node::*response)(void) const) const
Computes the residual vector and returns it.
Definition: TransformationDOF_Group.cpp:288
virtual void setID(int dof, int value)
to set the corresponding index of the ID to value.
Definition: TransformationDOF_Group.cpp:164
std::vector< Node * > getPointersToRetainedNodes(void)
Returns a vector with the pointers to the retained nodes.
Definition: TransformationDOF_Group.cpp:332
const Vector & getTrialVel(void) const
Return trial velocity.
Definition: TransformationDOF_Group.cpp:434
void setNodeDisp(const Vector &u)
Method to set the corresponding nodes displacements to the values in u, components identified by myID...
Definition: TransformationDOF_Group.cpp:594
Vector of integers.
Definition: ID.h:95
const Vector & getTrialDisp(void) const
Return trial displacement.
Definition: TransformationDOF_Group.cpp:429
const Vector & getCommittedAccel(void) const
Returns the committed value for the acceleration.
Definition: TransformationDOF_Group.cpp:454
const Matrix & getTangent(Integrator *theIntegrator)
Returns the current tangent matrix for the DOF_Group.
Definition: TransformationDOF_Group.cpp:246
virtual int getNumConstrainedDOF(void) const
Returns the total number of constrained DOFs.
Definition: TransformationDOF_Group.cpp:231
void setNodeVel(const Vector &udot)
Method to set the corresponding nodes velocities to the values in u, components identified by myID...
Definition: TransformationDOF_Group.cpp:614
A TransformationDOF_Group object is instantiated by the TransformationConstraintHandler for every nod...
Definition: TransformationDOF_Group.h:92
Container for FE_Element and DOF_Group objects created by the constraint handler. ...
Definition: AnalysisModel.h:134
Unbalanced force vector and tangent stiffness matrix.
Definition: UnbalAndTangent.h:41
Single freedom constraint.
Definition: SFreedom_Constraint.h:85
std::vector< SFreedom_Constraint * > getSFreedomConstraintArray(int) const
Create SFreedom_Constraint pointer array.
Definition: TransformationDOF_Group.cpp:83
Base class for the objects that performs the integration of physical properties over the domain to fo...
Definition: Integrator.h:100
A DOF_Group object is instantiated by the ConstraintHandler for every unconstrained node in the domai...
Definition: DOF_Group.h:107
virtual int getNumFreeDOF(void) const
Returns the total number of free DOFs.
Definition: TransformationDOF_Group.cpp:217
const Vector & getCommittedResponse(const Vector &(Node::*response)(void) const) const
Returns the committed value for the given response.
Definition: TransformationDOF_Group.cpp:354
const Vector & getUnbalance(Integrator *theIntegrator)
Returns the vector holding the unbalance.
Definition: TransformationDOF_Group.cpp:261
~TransformationDOF_Group()
Destructor.
Definition: TransformationDOF_Group.cpp:201
MFreedom_ConstraintBase * getMFreedomConstraint(void)
Returns a pointer to the multi-freedom constraint.
Definition: TransformationDOF_Group.cpp:281
void setNodeAccel(const Vector &udotdot)
Method to set the corresponding nodes accelerations to the values in u, components identified by myID...
Definition: TransformationDOF_Group.cpp:630
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Definition: AutoConstraintHandler.h:84
Matrix of floats.
Definition: Matrix.h:111
size_t getNumRetainedNodes(void) const
Returns the number of retained nodes.
Definition: TransformationDOF_Group.cpp:315
TransformationConstraintHandler is a constraint handler for handling constraints using the Transforma...
Definition: TransformationConstraintHandler.h:88
void incrNodeDisp(const Vector &u)
Method to set the corresponding nodes displacements increments to the values in u, components identified by myID.
Definition: TransformationDOF_Group.cpp:645
Mesh node.
Definition: Node.h:111
void incrNodeVel(const Vector &udot)
Method to set the corresponding nodes velocities increments to the values in u, components identified...
Definition: TransformationDOF_Group.cpp:662
const Vector & getCommittedVel(void) const
Returns the committed value for the velocity.
Definition: TransformationDOF_Group.cpp:450
virtual int getNumDOF(void) const
Returns the total number of DOFs in the DOF_Group.
Definition: TransformationDOF_Group.cpp:213