xc
ConstrContainer.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 //ConstrContainer.h
29 
30 #ifndef ConstrContainer_h
31 #define ConstrContainer_h
32 
33 #include "domain/mesh/MeshComponentContainer.h"
34 #include "MapActiveLoadPatterns.h"
35 #include <deque>
36 #include <set>
37 #include <list>
38 
39 namespace XC {
40 class Constraint;
41 class SFreedom_Constraint;
42 class MFreedom_Constraint;
43 class MRMFreedom_Constraint;
44 class NodalLoad;
45 class ElementalLoad;
46 class LoadPattern;
47 class NodeLocker;
48 class SFreedom_ConstraintIter;
49 class MFreedom_ConstraintIter;
50 class MRMFreedom_ConstraintIter;
51 class LoadPatternIter;
52 class NodeLockerIter;
53 
54 class SingleDomSFreedom_Iter;
55 class SingleDomMFreedom_Iter;
56 class SingleDomMRMFreedom_Iter;
57 class SingleDomAllSFreedom_Iter;
58 class FEM_ObjectBroker;
59 
60 class TaggedObjectStorage;
61 
63 //
66  {
67  private:
68  TaggedObjectStorage *theSPs;
69  TaggedObjectStorage *theMPs;
70  TaggedObjectStorage *theMRMPs;
71  MapActiveLoadPatterns<NodeLocker> activeNodeLockers;
72  MapActiveLoadPatterns<LoadPattern> activeLoadPatterns;
73 
74  SingleDomSFreedom_Iter *theSFreedom_Iter;
75  SingleDomMFreedom_Iter *theMFreedom_Iter;
76  SingleDomMRMFreedom_Iter *theMRMFreedom_Iter;
77  SingleDomAllSFreedom_Iter *allSFreedom_Iter;
78 
79  void alloc_containers(void);
80  void alloc_iters(void);
81  bool check_containers(void) const;
82  protected:
83  friend class Domain;
84  // methods to populate containers
88  virtual bool addLoadPattern(LoadPattern *);
89  virtual bool isLoadPatternActive(const LoadPattern *) const;
90  virtual bool addNodeLocker(NodeLocker *);
91 
92  // methods to add components to a LoadPattern object
93  virtual bool addSFreedom_Constraint(SFreedom_Constraint *, int loadPatternTag);
94  virtual bool addNodalLoad(NodalLoad *, int loadPatternTag);
95  virtual bool addElementalLoad(ElementalLoad *, int loadPatternTag);
96 
97  // methods to remove the components
98  virtual void clearAll(void);
99  virtual bool removeSFreedom_Constraint(int theNode, int theDOF, int loadPatternTag);
100  virtual bool removeSFreedom_Constraint(int tag);
101  virtual bool removeMFreedom_Constraint(int tag);
102  virtual bool removeMRMFreedom_Constraint(int tag);
103  virtual bool removeLoadPattern(int loadTag,int &numSPs);
104  virtual bool removeNodeLocker(int spcpTag,int &numSPs);
105  int removeLPs(void);
106  int removeNLs(void);
107 
108  virtual bool removeNodalLoad(int tag, int loadPattern);
109  virtual bool removeElementalLoad(int tag, int loadPattern);
110  virtual bool removeSFreedom_Constraint(int tag, int loadPattern);
111 
112  void free_mem(void);
113  DbTagData &getDbTagData(void) const;
114  void setTagsNLs(const ID &);
115  void setTagsLPs(const ID &);
116  int sendLPatternsTags(const int &,const int &,Communicator &);
117  int recvLPatternsTags(const int &,const int &,const Communicator &);
118  int sendNLockersTags(const int &,const int &,Communicator &comm);
119  int recvNLockersTags(const int &,const int &,const Communicator &comm);
120  int sendData(Communicator &comm);
121  int recvData(const Communicator &comm);
122  public:
123  ConstrContainer(Domain *owr);
124 
125  virtual ~ConstrContainer(void);
126 
127  // methods to access the components
128  virtual SFreedom_ConstraintIter &getSPs(void);
129  std::deque<SFreedom_Constraint *> getSPDeque(void);
130  boost::python::list getSPListPy(void);
131  virtual MFreedom_ConstraintIter &getMPs(void);
132  std::deque<MFreedom_Constraint *> getMPDeque(void);
133  boost::python::list getMPListPy(void);
134  virtual MRMFreedom_ConstraintIter &getMRMPs(void);
135  std::deque<MRMFreedom_Constraint *> getMRMPDeque(void);
136  boost::python::list getMRMPListPy(void);
137  const std::map<int,LoadPattern *> &getLoadPatterns(void) const;
138  const std::map<int,NodeLocker *> &getNodeLockers(void) const;
139  std::map<int,LoadPattern *> &getLoadPatterns(void);
140  std::map<int,NodeLocker *> &getNodeLockers(void);
142 
143  virtual bool existSFreedom_Constraint(int tag) const;
145  virtual const SFreedom_Constraint *getSFreedom_Constraint(int tag) const;
146  virtual bool existMFreedom_Constraint(int tag) const;
148  virtual const MFreedom_Constraint *getMFreedom_Constraint(int tag) const;
149  virtual bool existMRMFreedom_Constraint(int tag) const;
151  virtual const MRMFreedom_Constraint *getMRMFreedom_Constraint(int tag) const;
152  LoadPattern *getLoadPattern(const int &);
153  const LoadPattern *getLoadPattern(const int &) const;
154  NodeLocker *getNodeLocker(const int &, bool silent= false);
155  const NodeLocker *getNodeLocker(const int &, bool silent= false) const;
156 
157  // methods to update the domain
158  virtual void applyLoad(double pseudoTime);
159  virtual void setLoadConstant(void);
160 
161  // methods to query the state of the ConstrContainer
162  virtual int getNumSPs(void) const;
163  virtual int getNumMPs(void) const;
164  virtual int getNumMRMPs(void) const;
165  virtual int getNumLoadPatterns(void) const;
166  virtual std::string getActiveLoadCaseDescription(void) const;
167  virtual int getNumNodeLockers(void) const;
168 
169  std::deque<int> getTagsSPsNode(int , int ) const;
170  std::deque<int> getTagsSPsNode(int ) const;
171  std::deque<int> getTagsMPsNode(int , int ) const;
172  std::deque<int> getTagsMPsNode(int ) const;
173  std::deque<int> getTagsMRMPsNode(int , int ) const;
174  std::deque<int> getTagsMRMPsNode(int ) const;
175  std::deque<int> getTagsLPs(void) const;
176  std::deque<int> getTagsNLs(void) const;
177 
178  bool nodeAffectedBySPs(int) const;
179  std::set<int> getTagsNodesAffectedBySPs(int) const;
180  bool nodeAffectedByMPs(int) const;
181  bool nodeAffectedByMRMPs(int) const;
182  bool nodeAffectedByConstraints(int ) const;
183 
184  bool isDOFAffectedBySPs(int, int) const;
185  std::map<int, std::list<int> > getDOFsAffectedBySPs(void) const;
186  bool isDOFAffectedByMPs(int, int) const;
187  std::map<int, std::list<int> > getDOFsAffectedByMPs(void) const;
188  bool isDOFAffectedByMRMPs(int, int) const;
189  std::map<int, std::list<int> > getDOFsAffectedByMRMPs(void) const;
190  bool isDOFAffectedByConstraints(int, int) const;
191  std::map<int, std::list<int> > getDOFsAffectedByConstraints(void) const;
192 
193  std::string getLoadPatternsNames(void) const;
194 
195  virtual int calculateNodalReactions(bool inclInertia, const double &);
196 
197  virtual int sendSelf(Communicator &);
198  virtual int recvSelf(const Communicator &);
199  boost::python::dict getPyDict(void) const;
200  void setPyDict(const boost::python::dict &);
201 
202  virtual void Print(std::ostream &s, int flag =0) const;
203  friend std::ostream &operator<<(std::ostream &, const ConstrContainer &);
204  };
205 std::ostream &operator<<(std::ostream &, const ConstrContainer &);
206 } // end of XC namespace
207 
208 #endif
209 
210 
virtual SFreedom_Constraint * getSFreedom_Constraint(int tag)
Returns a pointer to the single freedom constraint whose identifier is being passed as parameter...
Definition: ConstrContainer.cc:671
virtual int calculateNodalReactions(bool inclInertia, const double &)
Reactions due to constraints.
Definition: ConstrContainer.cc:1336
virtual int recvSelf(const Communicator &)
Receives object through the communicator argument.
Definition: ConstrContainer.cc:1591
virtual void setLoadConstant(void)
Set as constant all the active load patterns (used in pushover analysis).
Definition: ConstrContainer.cc:1329
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: ConstrContainer.cc:1543
Iterator over multi-freedom constraints.
Definition: MFreedom_ConstraintIter.h:76
boost::python::list getMRMPListPy(void)
Return a Python list containing the pointers to the multi-row-multi-freedom constraints in the contai...
Definition: ConstrContainer.cc:636
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: ConstrContainer.cc:1519
int removeNLs(void)
Removes all node lockers.
Definition: ConstrContainer.cc:494
bool nodeAffectedByConstraints(int) const
Returns true if the node is affected by any constraint.
Definition: ConstrContainer.cc:1257
Communication parameters between processes.
Definition: Communicator.h:66
boost::python::list getSPListPy(void)
Return a Python list containing the pointers to the single-freedom constraints in the container...
Definition: ConstrContainer.cc:569
virtual MFreedom_Constraint * getMFreedom_Constraint(int tag)
Returns a pointer to the multi-freedom constraint identified by the argument.
Definition: ConstrContainer.cc:693
std::map< int, std::list< int > > getDOFsAffectedByMPs(void) const
Returns the DOFs of the nodes that are constrained by one or more multi-freedom constraints.
Definition: ConstrContainer.cc:1149
virtual SFreedom_ConstraintIter & getDomainAndLoadPatternSPs()
All (domain and load cases) single freedom constraints iterator.
Definition: ConstrContainer.cc:579
virtual bool removeSFreedom_Constraint(int theNode, int theDOF, int loadPatternTag)
Removes a single freedom constraint from this container or from a load pattern.
Definition: ConstrContainer.cc:360
virtual bool addMRMFreedom_Constraint(MRMFreedom_Constraint *)
Appends a multi-retained nodes constraint.
Definition: ConstrContainer.cc:207
int recvNLockersTags(const int &, const int &, const Communicator &comm)
Receives the node lockers tags through the communicator argument.
Definition: ConstrContainer.cc:1481
virtual bool removeMRMFreedom_Constraint(int tag)
Removes the multi-row multi-freedom constraint identified by the argument.
Definition: ConstrContainer.cc:415
int sendLPatternsTags(const int &, const int &, Communicator &)
Send the active load patterns tags through the communicator argument.
Definition: ConstrContainer.cc:1363
bool isDOFAffectedByMRMPs(int, int) const
Returns true if the DOF is affected by one or more multi-row multi-freedom constraints.
Definition: ConstrContainer.cc:1203
virtual bool addSFreedom_Constraint(SFreedom_Constraint *)
Appends a single freedom constraint.
Definition: ConstrContainer.cc:165
void setTagsNLs(const ID &)
Sets the tags of the node lockers.
Definition: ConstrContainer.cc:1458
virtual MRMFreedom_ConstraintIter & getMRMPs(void)
Return an iterator to the multi-row multi-freedom constraints.
Definition: ConstrContainer.cc:616
std::deque< int > getTagsMRMPsNode(int, int) const
Search on the container all the multi retained multi-freedom constraints that affect the node and deg...
Definition: ConstrContainer.cc:956
int sendData(Communicator &comm)
Send object members through the communicator argument.
Definition: ConstrContainer.cc:1496
std::set< int > getTagsNodesAffectedBySPs(int) const
Returns the tags of the nodes for whose DOFs are constrained by one or more single freedom constraint...
Definition: ConstrContainer.cc:1044
ConstrContainer(Domain *owr)
Constructor.
Definition: ConstrContainer.cc:129
std::deque< SFreedom_Constraint * > getSPDeque(void)
Return a std::deque containing the pointers to the single-freedom constraints in the container...
Definition: ConstrContainer.cc:557
std::map< int, std::list< int > > getDOFsAffectedBySPs(void) const
Returns the DOFs of the nodes whose DOFs are constrained by one or more single freedom constraints...
Definition: ConstrContainer.cc:1077
Vector that stores the dbTags of the class members.
Definition: DbTagData.h:44
std::deque< int > getTagsSPsNode(int, int) const
Search on the container all the single freedom constraints with the node and degree of freedom given...
Definition: ConstrContainer.cc:916
virtual void clearAll(void)
Deletes all the members of the container.
Definition: ConstrContainer.cc:140
void setTagsLPs(const ID &)
Set the tags of the active load patterns.
Definition: ConstrContainer.cc:1383
Vector of integers.
Definition: ID.h:95
int sendNLockersTags(const int &, const int &, Communicator &comm)
Send the node lockers tags through the communicator argument.
Definition: ConstrContainer.cc:1438
int removeLPs(void)
Removes all load patterns.
Definition: ConstrContainer.cc:480
virtual bool addMFreedom_Constraint(MFreedom_Constraint *)
Appends a multiple freedom constraint.
Definition: ConstrContainer.cc:187
Definition: SingleDomSFreedom_Iter.h:73
virtual bool existMFreedom_Constraint(int tag) const
Returns true if the constraint exists.
Definition: ConstrContainer.cc:748
A load pattern is the spatial distribution as well as its variation in time of a specific set of forc...
Definition: LoadPattern.h:97
virtual bool addLoadPattern(LoadPattern *)
Appends a load pattern.
Definition: ConstrContainer.cc:227
int recvLPatternsTags(const int &, const int &, const Communicator &)
Receives the active load patterns tags through the communicator argument.
Definition: ConstrContainer.cc:1423
virtual bool addNodalLoad(NodalLoad *, int loadPatternTag)
Appends a nodal load to a load pattern.
Definition: ConstrContainer.cc:294
bool isDOFAffectedBySPs(int, int) const
Returns true if the DOF is affected by one or more single freedom constraints.
Definition: ConstrContainer.cc:1060
Definition: SingleDomAllSFreedom_Iter.h:85
virtual bool addNodeLocker(NodeLocker *)
Appends a node locker.
Definition: ConstrContainer.cc:254
Iterator over multiple retained nodal constraints.
Definition: MRMFreedom_ConstraintIter.h:76
bool nodeAffectedByMPs(int) const
Returns true if the node is affected by one or more multi-freedom constraints.
Definition: ConstrContainer.cc:1113
virtual bool addElementalLoad(ElementalLoad *, int loadPatternTag)
Appends an elemental load to a load pattern.
Definition: ConstrContainer.cc:326
std::map< int, std::list< int > > getDOFsAffectedByMRMPs(void) const
Returns the DOFs of the nodes that are affected by one or more multi-row multi-freedom constraints...
Definition: ConstrContainer.cc:1220
std::string getLoadPatternsNames(void) const
Loop over all the load patterns that are currently added to the domain getting their names...
Definition: ConstrContainer.cc:983
virtual int getNumLoadPatterns(void) const
Returns the number of load patterns.
Definition: ConstrContainer.cc:855
virtual int sendSelf(Communicator &)
Sends object through the communicator argument.
Definition: ConstrContainer.cc:1575
virtual bool removeNodeLocker(int spcpTag, int &numSPs)
Removes the node locker whose identifier is being passed as parameter.
Definition: ConstrContainer.cc:453
virtual bool isLoadPatternActive(const LoadPattern *) const
Return true if the load pattern is already added to the domain.
Definition: ConstrContainer.cc:249
Single freedom constraint.
Definition: SFreedom_Constraint.h:85
std::deque< int > getTagsLPs(void) const
Loop over all the load patterns that are currently added to the domain getting their tags...
Definition: ConstrContainer.cc:972
virtual void applyLoad(double pseudoTime)
Apply loads from active node lockers.
Definition: ConstrContainer.cc:880
std::deque< MRMFreedom_Constraint * > getMRMPDeque(void)
Return a std::deque containing the pointers to the multi-row-multi-freedom constraints in the contain...
Definition: ConstrContainer.cc:624
int recvData(const Communicator &comm)
Receives object members through the communicator argument.
Definition: ConstrContainer.cc:1508
Definition: SingleDomMRMFreedom_Iter.h:49
virtual bool removeMFreedom_Constraint(int tag)
Removes the multi-freedom constraint whose identifier is being passed as parameter.
Definition: ConstrContainer.cc:403
Base class for the element and constraint containers.
Definition: MeshComponentContainer.h:41
bool nodeAffectedBySPs(int) const
Returns true if the node is affected by one or more single freedom constraints.
Definition: ConstrContainer.cc:1027
Definition: MapActiveLoadPatterns.h:40
virtual SFreedom_ConstraintIter & getSPs(void)
Return an iterator to the single freedom constraints.
Definition: ConstrContainer.cc:549
virtual bool existSFreedom_Constraint(int tag) const
Returns true if the constraint exists.
Definition: ConstrContainer.cc:738
std::deque< int > getTagsMPsNode(int, int) const
Search on the container all the multi-freedom constraints that affect the node and degree of freedom ...
Definition: ConstrContainer.cc:939
bool nodeAffectedByMRMPs(int) const
Returns true if the node is affected by one or more multi-row multi-freedom constraints.
Definition: ConstrContainer.cc:1186
LoadPattern * getLoadPattern(const int &)
Returns a pointer to the load pattern identified by the argument.
Definition: ConstrContainer.cc:769
virtual ~ConstrContainer(void)
Destructor.
Definition: ConstrContainer.cc:159
Multiple retained nodes constraint.
Definition: MRMFreedom_Constraint.h:59
DbTagData & getDbTagData(void) const
Returns a vector to store the dbTags of class members.
Definition: ConstrContainer.cc:1356
bool isDOFAffectedByMPs(int, int) const
Returns true if the DOF is affected by one or more multi-freedom constraints.
Definition: ConstrContainer.cc:1130
Single freedom constraints that make part of a load pattern.
Definition: NodeLocker.h:45
virtual int getNumMRMPs(void) const
Returns the number of multi-row multi-freedom constraints.
Definition: ConstrContainer.cc:851
Iterator over single freedom constraints.
Definition: SFreedom_ConstraintIter.h:76
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
const std::map< int, LoadPattern * > & getLoadPatterns(void) const
Returns the active load patterns container.
Definition: ConstrContainer.cc:654
boost::python::list getMPListPy(void)
Return a Python list containing the pointers to the multi-freedom constraints in the container...
Definition: ConstrContainer.cc:606
virtual int getNumMPs(void) const
Returns the number of multi-freedom constraints.
Definition: ConstrContainer.cc:847
Multi-freedom constraint.
Definition: MFreedom_Constraint.h:113
Definition: SingleDomMFreedom_Iter.h:73
bool isDOFAffectedByConstraints(int, int) const
Returns true if the DOF is affected by any constraint.
Definition: ConstrContainer.cc:1268
Base class for loads over elements.
Definition: ElementalLoad.h:79
virtual bool removeNodalLoad(int tag, int loadPattern)
Removes a nodal load from a load pattern.
Definition: ConstrContainer.cc:510
virtual int getNumSPs(void) const
Returns the number of single freedom constraints.
Definition: ConstrContainer.cc:843
virtual MRMFreedom_Constraint * getMRMFreedom_Constraint(int tag)
Returns a pointer to the multi-row multi-freedom constraint identified by the argument.
Definition: ConstrContainer.cc:716
std::deque< MFreedom_Constraint * > getMPDeque(void)
Return a std::deque containing the pointers to the multi-freedom constraints in the container...
Definition: ConstrContainer.cc:594
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:117
virtual bool removeLoadPattern(int loadTag, int &numSPs)
Removes the load pattern identified by the argument.
Definition: ConstrContainer.cc:427
std::deque< int > getTagsNLs(void) const
Loop over all the load patterns that are currently added to the domain getting their tag...
Definition: ConstrContainer.cc:1014
Constraint (essential and natural boundary conditions) container.
Definition: ConstrContainer.h:65
NodeLocker * getNodeLocker(const int &, bool silent=false)
Returns a pointer to the node locker identified by the argument.
Definition: ConstrContainer.cc:804
virtual int getNumNodeLockers(void) const
Returns the number of node lockers.
Definition: ConstrContainer.cc:875
virtual MFreedom_ConstraintIter & getMPs(void)
Return an iterator to the multi-freedom constraints.
Definition: ConstrContainer.cc:586
virtual void Print(std::ostream &s, int flag=0) const
Prints object information.
Definition: ConstrContainer.cc:1606
virtual std::string getActiveLoadCaseDescription(void) const
Return the load case description from the active load patterns.
Definition: ConstrContainer.cc:860
virtual bool removeElementalLoad(int tag, int loadPattern)
Removes a load over elements from a load pattern.
Definition: ConstrContainer.cc:525
Load over a node.
Definition: NodalLoad.h:83
std::map< int, std::list< int > > getDOFsAffectedByConstraints(void) const
Returns the DOFs affected by any constraint.
Definition: ConstrContainer.cc:1279
virtual bool existMRMFreedom_Constraint(int tag) const
Returns true if the constraint exists.
Definition: ConstrContainer.cc:758
const std::map< int, NodeLocker * > & getNodeLockers(void) const
Returns the active node lockers container.
Definition: ConstrContainer.cc:658