xc
ConstrContainer.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 //ConstrContainer.h
28 
29 #ifndef ConstrContainer_h
30 #define ConstrContainer_h
31 
32 #include "domain/mesh/MeshComponentContainer.h"
33 #include "MapCasosActivos.h"
34 #include <deque>
35 #include <set>
36 
37 namespace XC {
38 class SFreedom_Constraint;
39 class MFreedom_Constraint;
40 class MRMFreedom_Constraint;
41 class NodalLoad;
42 class ElementalLoad;
43 class LoadPattern;
44 class NodeLocker;
45 class SFreedom_ConstraintIter;
46 class MFreedom_ConstraintIter;
47 class MRMFreedom_ConstraintIter;
48 class LoadPatternIter;
49 class NodeLockerIter;
50 
51 class SingleDomSFreedom_Iter;
52 class SingleDomMFreedom_Iter;
53 class SingleDomMRMFreedom_Iter;
54 class SingleDomAllSFreedom_Iter;
55 class FEM_ObjectBroker;
56 
57 class TaggedObjectStorage;
58 
60 //
63  {
64  private:
65  TaggedObjectStorage *theSPs;
66  TaggedObjectStorage *theMPs;
67  TaggedObjectStorage *theMRMPs;
68  MapCasosActivos<NodeLocker> activeNodeLockers;
69  MapCasosActivos<LoadPattern> activeLoadPatterns;
70 
71  SingleDomSFreedom_Iter *theSFreedom_Iter;
72  SingleDomMFreedom_Iter *theMFreedom_Iter;
73  SingleDomMRMFreedom_Iter *theMRMFreedom_Iter;
74  SingleDomAllSFreedom_Iter *allSFreedom_Iter;
75 
76  void alloc_containers(void);
77  void alloc_iters(void);
78  bool check_containers(void) const;
79  protected:
80  friend class Domain;
81  // methods to populate containers
85  virtual bool addLoadPattern(LoadPattern *);
86  virtual bool addNodeLocker(NodeLocker *);
87 
88  // methods to add components to a LoadPattern object
89  virtual bool addSFreedom_Constraint(SFreedom_Constraint *, int loadPatternTag);
90  virtual bool addNodalLoad(NodalLoad *, int loadPatternTag);
91  virtual bool addElementalLoad(ElementalLoad *, int loadPatternTag);
92 
93  // methods to remove the components
94  virtual void clearAll(void);
95  virtual bool removeSFreedom_Constraint(int theNode, int theDOF, int loadPatternTag);
96  virtual bool removeSFreedom_Constraint(int tag);
97  virtual bool removeMFreedom_Constraint(int tag);
98  virtual bool removeMRMFreedom_Constraint(int tag);
99  virtual bool removeLoadPattern(int loadTag,int &numSPs);
100  virtual bool removeNodeLocker(int spcpTag,int &numSPs);
101  int removeLPs(void);
102  int removeNLs(void);
103 
104  virtual bool removeNodalLoad(int tag, int loadPattern);
105  virtual bool removeElementalLoad(int tag, int loadPattern);
106  virtual bool removeSFreedom_Constraint(int tag, int loadPattern);
107 
108  void free_mem(void);
109  DbTagData &getDbTagData(void) const;
110  int sendLPatternsTags(const int &,const int &,CommParameters &);
111  int recvLPatternsTags(const int &,const int &,const CommParameters &);
112  int sendNLockersTags(const int &,const int &,CommParameters &cp);
113  int recvNLockersTags(const int &,const int &,const CommParameters &cp);
114  int sendData(CommParameters &cp);
115  int recvData(const CommParameters &cp);
116  public:
117  ConstrContainer(Domain *owr);
118 
119  virtual ~ConstrContainer(void);
120 
121  // methods to access the components
122  virtual SFreedom_ConstraintIter &getSPs();
123  virtual MFreedom_ConstraintIter &getMPs();
125  const std::map<int,LoadPattern *> &getLoadPatterns(void) const;
126  const std::map<int,NodeLocker *> &getNodeLockers(void) const;
127  std::map<int,LoadPattern *> &getLoadPatterns(void);
128  std::map<int,NodeLocker *> &getNodeLockers(void);
130 
134  LoadPattern *getLoadPattern(const int &);
135  const LoadPattern *getLoadPattern(const int &) const;
136  NodeLocker *getNodeLocker(const int &);
137  const NodeLocker *getNodeLocker(const int &) const;
138 
139  // methods to update the domain
140  virtual void applyLoad(double pseudoTime);
141  virtual void setLoadConstant(void);
142 
143  // methods to query the state of the ConstrContainer
144  virtual int getNumSPs(void) const;
145  virtual int getNumMPs(void) const;
146  virtual int getNumMRMPs(void) const;
147  virtual int getNumLoadPatterns(void) const;
148  virtual int getNumNodeLockers(void) const;
149 
150  std::deque<int> getTagsSPsNode(int , int ) const;
151  std::deque<int> getTagsSPsNode(int ) const;
152  std::deque<int> getTagsMPsNode(int , int ) const;
153  std::deque<int> getTagsMPsNode(int ) const;
154  std::deque<int> getTagsMRMPsNode(int , int ) const;
155  std::deque<int> getTagsMRMPsNode(int ) const;
156  std::deque<int> getTagsLPs(void) const;
157  std::deque<int> getTagsNLs(void) const;
158  bool nodeAffectedBySPs(int) const;
159  std::set<int> getTagsNodesffectedBySPs(int ) const;
160  bool nodeAffectedByMPs(int) const;
161  bool nodeAffectedByMRMPs(int) const;
162  bool nodeAffectedByConstraints(int ) const;
163  bool isDOFAffectedBySPs(int, int) const;
164  bool isDOFAffectedByMPs(int, int) const;
165  bool isDOFAffectedByMRMPs(int, int) const;
166  bool isDOFAffectedByConstraints(int, int) const;
167  std::string getLoadPatternsNames(void) const;
168 
169  virtual int calculateNodalReactions(bool inclInertia, const double &);
170 
171  virtual int sendSelf(CommParameters &);
172  virtual int recvSelf(const CommParameters &);
173 
174  virtual void Print(std::ostream &s, int flag =0);
175  friend std::ostream &operator<<(std::ostream &, ConstrContainer &);
176  };
177 std::ostream &operator<<(std::ostream &, ConstrContainer &);
178 } // end of XC namespace
179 
180 #endif
181 
182 
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:589
virtual int calculateNodalReactions(bool inclInertia, const double &)
Reactions due to constraints.
Definition: ConstrContainer.cc:1003
int recvLPatternsTags(const int &, const int &, const CommParameters &)
Receives the active load patterns tags through the channel being passed as parameter.
Definition: ConstrContainer.cc:1046
virtual void setLoadConstant(void)
Set as constant all the active load patterns (used in pushover analysis).
Definition: ConstrContainer.cc:996
int sendLPatternsTags(const int &, const int &, CommParameters &)
Send the active load patterns tags through the channel being passed as parameter. ...
Definition: ConstrContainer.cc:1026
virtual void Print(std::ostream &s, int flag=0)
Prints object information.
Definition: ConstrContainer.cc:1197
Iterator over multi-freedom constraints.
Definition: MFreedom_ConstraintIter.h:75
int removeNLs(void)
Removes all nodel lockers.
Definition: ConstrContainer.cc:480
int recvData(const CommParameters &cp)
Receives object members through the channel being passed as parameter.
Definition: ConstrContainer.cc:1157
bool nodeAffectedByConstraints(int) const
Returns true if the node is affected by any constraint.
Definition: ConstrContainer.cc:974
virtual MFreedom_Constraint * getMFreedom_Constraint(int tag)
Returns a pointer to the multi-freedom constraint identified by the argument.
Definition: ConstrContainer.cc:602
virtual SFreedom_ConstraintIter & getDomainAndLoadPatternSPs()
All (domain and load cases) single freedom constraints iterator.
Definition: ConstrContainer.cc:542
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:345
virtual bool addMRMFreedom_Constraint(MRMFreedom_Constraint *)
Appends a multi-retained nodes constraint.
Definition: ConstrContainer.cc:200
virtual bool removeMRMFreedom_Constraint(int tag)
Removes the multi-row multi-freedom constraint identified by the argument.
Definition: ConstrContainer.cc:400
bool isDOFAffectedByMRMPs(int, int) const
Returns true if the DOF is affected by one or more multi-row multi-freedom constraints.
Definition: ConstrContainer.cc:958
virtual bool addSFreedom_Constraint(SFreedom_Constraint *)
Appends a single freedom constraint.
Definition: ConstrContainer.cc:158
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:787
ConstrContainer(Domain *owr)
Constructor.
Definition: ConstrContainer.cc:122
Vector that stores the dbTags of the class members.
Definition: DbTagData.h:43
std::deque< int > getTagsSPsNode(int, int) const
Search on the container all the single freedom constraints with the node and degree of freedom being ...
Definition: ConstrContainer.cc:747
virtual void clearAll(void)
Deletes all the members of the container.
Definition: ConstrContainer.cc:133
int removeLPs(void)
Removes all load patterns.
Definition: ConstrContainer.cc:466
virtual bool addMFreedom_Constraint(MFreedom_Constraint *)
Appends a multiple freedom constraint.
Definition: ConstrContainer.cc:180
Definition: SingleDomSFreedom_Iter.h:72
A LoadPattern object is used to to store reference loads and single point constraints and a TimeSerie...
Definition: LoadPattern.h:93
virtual bool addLoadPattern(LoadPattern *)
Appends a load pattern.
Definition: ConstrContainer.cc:220
virtual bool addNodalLoad(NodalLoad *, int loadPatternTag)
Appends a nodal load to a load pattern.
Definition: ConstrContainer.cc:279
bool isDOFAffectedBySPs(int, int) const
Returns true if the DOF is affected by one or more single freedom constraints.
Definition: ConstrContainer.cc:872
Definition: SingleDomAllSFreedom_Iter.h:84
virtual bool addNodeLocker(NodeLocker *)
Appends a node locker.
Definition: ConstrContainer.cc:241
Iterator over multiple retained nodal constraints.
Definition: MRMFreedom_ConstraintIter.h:75
NodeLocker * getNodeLocker(const int &)
Returns a pointer to the node locker identified by the argument.
Definition: ConstrContainer.cc:661
bool nodeAffectedByMPs(int) const
Returns true if the node is affected by one or more multi-freedom constraints.
Definition: ConstrContainer.cc:905
virtual bool addElementalLoad(ElementalLoad *, int loadPatternTag)
Appends an elemental load to a load pattern.
Definition: ConstrContainer.cc:311
std::string getLoadPatternsNames(void) const
Loop over all the load patterns that are currently added to the domain getting their names...
Definition: ConstrContainer.cc:812
virtual int getNumLoadPatterns(void) const
Returns the number of load patterns.
Definition: ConstrContainer.cc:704
virtual bool removeNodeLocker(int spcpTag, int &numSPs)
Removes the node locker whose identifier is being passed as parameter.
Definition: ConstrContainer.cc:439
Single freedom constraint.
Definition: SFreedom_Constraint.h:84
virtual SFreedom_ConstraintIter & getSPs()
Return an iterator to the single freedom constraints.
Definition: ConstrContainer.cc:535
std::set< int > getTagsNodesffectedBySPs(int) const
Returns the tags of the nodes that are which theDOF constrained by one or more single freedom constra...
Definition: ConstrContainer.cc:889
Definition: MapCasosActivos.h:39
std::deque< int > getTagsLPs(void) const
Loop over all the load patterns that are currently added to the domain getting their tag...
Definition: ConstrContainer.cc:802
int sendData(CommParameters &cp)
Send object members through the channel being passed as parameter.
Definition: ConstrContainer.cc:1145
virtual void applyLoad(double pseudoTime)
Apply loads from active node lockers.
Definition: ConstrContainer.cc:712
Definition: SingleDomMRMFreedom_Iter.h:48
int sendNLockersTags(const int &, const int &, CommParameters &cp)
Send the node lockers tags through the channel being passed as parameter.
Definition: ConstrContainer.cc:1093
virtual bool removeMFreedom_Constraint(int tag)
Removes the multi-freedom constraint whose identifier is being passed as parameter.
Definition: ConstrContainer.cc:388
Base class for the element and constraint containers.
Definition: MeshComponentContainer.h:40
bool nodeAffectedBySPs(int) const
Returns true if the node is affected by one or more single freedom constraints.
Definition: ConstrContainer.cc:855
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:770
bool nodeAffectedByMRMPs(int) const
Returns true if the node is affected by one or more multi-row multi-freedom constraints.
Definition: ConstrContainer.cc:941
LoadPattern * getLoadPattern(const int &)
Returns a pointer to the load pattern identified by the argument.
Definition: ConstrContainer.cc:628
int recvNLockersTags(const int &, const int &, const CommParameters &cp)
Receives the node lockers tags through the channel being passed as parameter.
Definition: ConstrContainer.cc:1113
virtual ~ConstrContainer(void)
Destructor.
Definition: ConstrContainer.cc:152
Multiple retained nodes constraint.
Definition: MRMFreedom_Constraint.h:58
DbTagData & getDbTagData(void) const
Returns a vector to store the dbTags of class members.
Definition: ConstrContainer.cc:1019
bool isDOFAffectedByMPs(int, int) const
Returns true if the DOF is affected by one or more multi-freedom constraints.
Definition: ConstrContainer.cc:922
Single freedom constraints that make part of a load pattern.
Definition: NodeLocker.h:44
virtual int getNumMRMPs(void) const
Returns the number of multi-row multi-freedom constraints.
Definition: ConstrContainer.cc:700
virtual MRMFreedom_ConstraintIter & getMRMPs()
Return an iterator to the multi-row multi-freedom constraints.
Definition: ConstrContainer.cc:556
Iterator over single freedom constraints.
Definition: SFreedom_ConstraintIter.h:75
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
virtual int recvSelf(const CommParameters &)
Receives object through the channel being passed as parameter.
Definition: ConstrContainer.cc:1183
const std::map< int, LoadPattern * > & getLoadPatterns(void) const
Returns the active load patterns container.
Definition: ConstrContainer.cc:572
Communication parameters between processes.
Definition: CommParameters.h:65
virtual int getNumMPs(void) const
Returns the number of multi-freedom constraints.
Definition: ConstrContainer.cc:696
Multi-freedom constraint.
Definition: MFreedom_Constraint.h:110
Definition: SingleDomMFreedom_Iter.h:72
bool isDOFAffectedByConstraints(int, int) const
Returns true if the DOF is affected by any constraint.
Definition: ConstrContainer.cc:985
Base class for loads over elements.
Definition: ElementalLoad.h:77
virtual bool removeNodalLoad(int tag, int loadPattern)
Removes a nodal load from a load pattern.
Definition: ConstrContainer.cc:496
virtual int getNumSPs(void) const
Returns the number of single freedom constraints.
Definition: ConstrContainer.cc:692
virtual MRMFreedom_Constraint * getMRMFreedom_Constraint(int tag)
Returns a pointer to the multi-row multi-freedom constraint identified by the argument.
Definition: ConstrContainer.cc:615
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:116
virtual bool removeLoadPattern(int loadTag, int &numSPs)
Removes the load pattern identified by the argument.
Definition: ConstrContainer.cc:412
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:842
virtual int sendSelf(CommParameters &)
Sends object through the channel being passed as parameter.
Definition: ConstrContainer.cc:1168
Constraint (essential and natural boundary conditions) container.
Definition: ConstrContainer.h:62
virtual int getNumNodeLockers(void) const
Returns the number of node lockers.
Definition: ConstrContainer.cc:708
virtual MFreedom_ConstraintIter & getMPs()
Return an iterator to the multi-freedom constraints.
Definition: ConstrContainer.cc:549
virtual bool removeElementalLoad(int tag, int loadPattern)
Removes a load over elements from a load pattern.
Definition: ConstrContainer.cc:511
Load over a node.
Definition: NodalLoad.h:82
const std::map< int, NodeLocker * > & getNodeLockers(void) const
Returns the active node lockers container.
Definition: ConstrContainer.cc:576