xc
RecorderContainer.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 //RecorderContainer.h
29 
30 
31 #ifndef RecorderContainer_h
32 #define RecorderContainer_h
33 
34 #include "utility/handler/DataOutputHandler.h"
35 #include <list>
36 
37 namespace XC {
38 class Recorder;
39  class Domain;
40 
42 //
45  {
46  public:
47  typedef std::list<Recorder *> recorders_list;
48  typedef recorders_list::iterator recorder_iterator;
49  typedef recorders_list::const_iterator const_recorder_iterator;
50  private:
51  recorders_list theRecorders;
52  DataOutputHandler::map_output_handlers *output_handlers;
53 
54  protected:
55  int sendData(Communicator &comm);
56  int recvData(const Communicator &comm);
57 
59  inline size_t getNumRecorders(void) const
60  { return theRecorders.size(); }
61  virtual Domain *get_domain_ptr(void)= 0;
62  public:
63  RecorderContainer(DataOutputHandler::map_output_handlers *oh= nullptr);
64  virtual ~RecorderContainer(void);
65 
66  Recorder *newRecorder(const std::string &, DataOutputHandler *oh= nullptr);
67  virtual int addRecorder(Recorder &theRecorder);
68  inline recorder_iterator recorder_begin(void)
69  { return theRecorders.begin(); }
70  inline const_recorder_iterator recorder_begin(void) const
71  { return theRecorders.begin(); }
72  inline recorder_iterator recorder_end(void)
73  { return theRecorders.end(); }
74  inline const_recorder_iterator recorder_end(void) const
75  { return theRecorders.end(); }
76  virtual int record(int track, double timeStamp= 0.0);
77  void restart(void);
78  virtual int removeRecorders(void);
79  void setLinks(Domain *dom);
80  void SetOutputHandlers(DataOutputHandler::map_output_handlers *oh);
81 
82  boost::python::dict getPyDict(void) const;
83  void setPyDict(const boost::python::dict &);
84  };
85 } // end of XC namespace
86 
87 #endif
88 
89 
virtual int addRecorder(Recorder &theRecorder)
Adds a recorder.
Definition: RecorderContainer.cc:184
virtual ~RecorderContainer(void)
Destructor.
Definition: RecorderContainer.cc:173
Communication parameters between processes.
Definition: Communicator.h:66
An Recorder object is used in the program to store/restore information at each commit().
Definition: Recorder.h:87
void setLinks(Domain *dom)
Asigna el domain a los recorders.
Definition: RecorderContainer.cc:217
void restart(void)
To invoke {restart()} on any Recorder objects which have been added.
Definition: RecorderContainer.cc:201
virtual int record(int track, double timeStamp=0.0)
To invoke {record(cTag, timeStamp)} on any Recorder objects which have been added.
Definition: RecorderContainer.cc:192
Object that can manage Recorders.
Definition: RecorderContainer.h:44
virtual int removeRecorders(void)
Remove the recorders.
Definition: RecorderContainer.cc:208
void SetOutputHandlers(DataOutputHandler::map_output_handlers *oh)
Set the outputhandlers container.
Definition: RecorderContainer.cc:235
Recorder * newRecorder(const std::string &, DataOutputHandler *oh=nullptr)
Read a Recorder object from file.
Definition: RecorderContainer.cc:74
size_t getNumRecorders(void) const
Returns the number of recorders already defined.
Definition: RecorderContainer.h:59
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:35
Domain (mesh and boundary conditions) of the finite element model.
Definition: Domain.h:117
void setPyDict(const boost::python::dict &)
Set the values of the object members from a Python dictionary.
Definition: RecorderContainer.cc:268
boost::python::dict getPyDict(void) const
Return a Python dictionary with the object members values.
Definition: RecorderContainer.cc:253
Base class for data output handlers.
Definition: DataOutputHandler.h:69