xc
MFreedom_ConstraintBase.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 #ifndef MFreedom_ConstraintBase_h
30 #define MFreedom_ConstraintBase_h
31 
32 // File: ~/domain/constraints/MFreedom_ConstraintBase.h
33 //
34 // Written: lcpt
35 // Created: 03/2015
36 // Revision: A
37 //
38 // Purpose: This file contains the class definition for MFreedom_ConstraintBase.
39 // MFreedom_ConstraintBase is a base class for multi node constraints.
40 // A multifreedom constraint relates certain dofs at
41 // a constrained node to be related to certain dosf at one or more
42 // retained nodes
43 
44 #include "Constraint.h"
45 #include <utility/matrix/Matrix.h>
46 
47 
48 namespace XC {
49 class Matrix;
50 class ID;
51 
54 //
56 //
59  {
60  protected:
64 
65  void set_constraint(const Matrix &c);
66  void set_constrained_dofs(const ID &);
67  void initializeUc0(const Domain *);
68  protected:
69  int sendData(Communicator &comm);
70  int recvData(const Communicator &comm);
71  public:
72  // constructors
73  MFreedom_ConstraintBase(int tag , int classTag ); // Arash
74 
75  MFreedom_ConstraintBase(int tag, int nodeConstr, int classTag);
76 
77  MFreedom_ConstraintBase(int tag, int nodeConstr, const ID &,int classTag);
78 
79  MFreedom_ConstraintBase(int tag, int nodeConstr, const Matrix &, const ID &, int classTag);
80 
81  // method to get information about the constraint
83  virtual inline const int &getNodeConstrained(void) const
84  { return constrNodeTag; }
86  virtual inline int &getNodeConstrained(void)
87  { return constrNodeTag; }
88  virtual const ID &getRetainedDOFs(void) const= 0;
89  virtual const ID &getConstrainedDOFs(void) const;
90  virtual const Matrix &getConstraint(void) const;
91  virtual const Vector &getConstrainedDOFsInitialDisplacement(void) const;
92  virtual size_t getNumRetainedNodes(void) const= 0;
93  virtual std::vector<Node *> getPointersToRetainedNodes(void)= 0;
94  virtual std::vector<const Node *> getPointersToRetainedNodes(void) const= 0;
95  std::vector<int> getIdxNodes(void) const;
96 
97  bool isTimeVarying(void) const;
98 
99  void setDomain(Domain *);
100 
101  bool affectsNode(int ) const;
102  bool affectsNodeAndDOF(int theNode, int theDOF) const;
103  int addResistingForceToNodalReaction(bool inclInertia);
104 
105  virtual void Print(std::ostream &s, int flag =0) const;
106  boost::python::dict getPyDict(void) const;
107  void setPyDict(const boost::python::dict &);
108 
109  };
110 } // end of XC namespace
111 
112 #endif
113 
void setDomain(Domain *)
Sets the domain for the constraint.
Definition: MFreedom_ConstraintBase.cc:134
MFreedom_ConstraintBase(int tag, int classTag)
Constructor.
Definition: MFreedom_ConstraintBase.cc:65
int constrNodeTag
constrained node tag
Definition: Constraint.h:51
Float vector abstraction.
Definition: Vector.h:94
Base class for mult-freedom constraints.
Definition: MFreedom_ConstraintBase.h:58
void set_constrained_dofs(const ID &)
Set the constrained degrees of freedom.
Definition: MFreedom_ConstraintBase.cc:55
Matrix constraintMatrix
Constraint matrix.
Definition: MFreedom_ConstraintBase.h:61
Communication parameters between processes.
Definition: Communicator.h:66
void initializeUc0(const Domain *)
Compute the initial displacement at constrained DOFs.
Definition: MFreedom_ConstraintBase.cc:101
ID constrDOF
ID of constrained DOF at constrained node.
Definition: MFreedom_ConstraintBase.h:62
bool affectsNodeAndDOF(int theNode, int theDOF) const
Returns true if the constraint affects the node and DOF arguments.
Definition: MFreedom_ConstraintBase.cc:157
Vector of integers.
Definition: ID.h:95
bool isTimeVarying(void) const
Returns true if the constraint varies with time.
Definition: MFreedom_ConstraintBase.cc:178
std::vector< int > getIdxNodes(void) const
Return the indices of the nodes (for VTK).
Definition: MFreedom_ConstraintBase.cc:257
Vector Uc0
initial displacement at constrained DOFs (same size as constrDOF)
Definition: MFreedom_ConstraintBase.h:63
void set_constraint(const Matrix &c)
Set the constraint matrix.
Definition: MFreedom_ConstraintBase.cc:50
int addResistingForceToNodalReaction(bool inclInertia)
Add reactions to nodes.
Definition: MFreedom_ConstraintBase.cc:183
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: MFreedom_ConstraintBase.cc:225
bool affectsNode(int) const
Returns true if the constraints affects the node identified by the tag being passed as parameter...
Definition: MFreedom_ConstraintBase.cc:151
virtual const ID & getConstrainedDOFs(void) const
Returns the identifiers of the constrained degrees of fredom.
Definition: MFreedom_ConstraintBase.cc:170
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: MFreedom_ConstraintBase.cc:234
virtual const int & getNodeConstrained(void) const
Return the identifier of the constrained node.
Definition: MFreedom_ConstraintBase.h:83
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Matrix of floats.
Definition: Matrix.h:111
Base class for model constraints.
Definition: Constraint.h:48
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:117
virtual const Matrix & getConstraint(void) const
Returns the constraint matrix.
Definition: MFreedom_ConstraintBase.cc:196
int sendData(Communicator &comm)
Send data through the communicator argument.
Definition: MFreedom_ConstraintBase.cc:205
int recvData(const Communicator &comm)
Receive data through the communicator argument.
Definition: MFreedom_ConstraintBase.cc:215
virtual void Print(std::ostream &s, int flag=0) const
Printing.
Definition: MFreedom_ConstraintBase.cc:246
virtual int & getNodeConstrained(void)
Return the identifier of the constrained node.
Definition: MFreedom_ConstraintBase.h:86