xc
MapActiveLoadPatterns.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 //MapActiveLoadPatterns.h
29 
30 
31 #ifndef MapActiveLoadPatterns_h
32 #define MapActiveLoadPatterns_h
33 
34 #include "utility/kernel/CommandEntity.h"
35 #include <map>
36 
37 
38 namespace XC {
39 template<class T>
40 class MapActiveLoadPatterns: public CommandEntity, public std::map<int,T *>
41  {
42  public:
43  typedef std::map<int, T *> t_map;
44  typedef typename t_map::iterator iterator;
45  typedef typename t_map::const_iterator const_iterator;
46  typedef typename t_map::reference reference;
47  typedef typename t_map::const_reference const_reference;
48  typedef typename t_map::value_type value_type;
50  bool in(const T *) const;
51  void Print(std::ostream &s, int flag =0) const;
52  };
53 
55 template<class T>
57 
58  : CommandEntity(owr), t_map(*this) {}
59 
60 template<class T>
61 bool MapActiveLoadPatterns<T>::in(const T *lp) const
62  {
63  bool retval= false;
64  const_iterator i= this->find(lp->getTag());
65  if(i!=this->end())
66  retval= true;
67  return retval;
68  }
69 
70 template<class T>
71 void MapActiveLoadPatterns<T>::Print(std::ostream &s, int flag) const
72  {
73  // go through the array invoking Print on non-zero entries
74  const_iterator p = this->begin();
75  while(p!=this->end())
76  {
77  ((*p).second)->Print(s, flag);
78  p++;
79  }
80  }
81 
82 } // end of XC namespace
83 
84 #endif
85 
86 
87 
Objet that can execute python scripts.
Definition: CommandEntity.h:40
Definition: MapActiveLoadPatterns.h:40
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
MapActiveLoadPatterns(CommandEntity *)
Constructor.
Definition: MapActiveLoadPatterns.h:56