XC Open source finite element analysis program
MovableObject.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 /* ****************************************************************** **
28 ** OpenSees - Open System for Earthquake Engineering Simulation **
29 ** Pacific Earthquake Engineering Research Center **
30 ** **
31 ** **
32 ** (C) Copyright 1999, The Regents of the University of California **
33 ** All Rights Reserved. **
34 ** **
35 ** Commercial use of this program without express permission of the **
36 ** University of California, Berkeley, is strictly prohibited. See **
37 ** file 'COPYRIGHT' in main directory for information on usage and **
38 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. **
39 ** **
40 ** Developed by: **
41 ** Frank McKenna (fmckenna@ce.berkeley.edu) **
42 ** Gregory L. Fenves (fenves@ce.berkeley.edu) **
43 ** Filip C. Filippou (filippou@ce.berkeley.edu) **
44 ** **
45 ** ****************************************************************** */
46 
47 // $Revision: 1.1.1.1 $
48 // $Date: 2000/09/15 08:23:15 $
49 // $Source: /usr/local/cvs/OpenSees/SRC/actor/actor/MovableObject.h,v $
50 
51 
52 #ifndef MovableObject_h
53 #define MovableObject_h
54 
55 // File: ~/actor/MovableObject.h
56 //
57 // Written: fmk
58 // Created: 11/96
59 // Revision: A
60 //
61 // Purpose: This file contains the class definition for MovableObject.
62 // MovableObject is meant to be an abstract base class and thus no objects
63 // of it's type can be instantiated. A movable object is an object which
64 // can send/receive itself to/from a Channel object.
65 //
66 // What: "@(#) MovableObject.h, revA"
67 
68 #include "DistributedBase.h"
69 #include "classTags.h"
70 #include <string>
71 #include <vector>
72 #include "utility/actor/objectBroker/FEM_ObjectBroker.h"
73 #include <iostream>
74 #include "CommParameters.h"
75 
76 namespace XC {
77 class Channel;
78 class FEM_ObjectBroker;
79 class Parameter;
80 class Information;
81 class CommParameters;
82 class CommMetaData;
83 
85 //
87 //
89 //
92  {
93  private:
94  int classTag;
95  int dbTag;
96  public:
97  MovableObject(int classTag, int dbTag);
98  MovableObject(int classTag);
99  MovableObject(const MovableObject &otro);
100  MovableObject &operator=(const MovableObject &otro);
101 
102  int getClassTag(void) const;
103  int getDbTag(void) const;
104  int getDbTag(CommParameters &);
105  void setDbTag(int dbTag);
106  void setDbTag(CommParameters &);
107 
108  virtual int sendSelf(CommParameters &) =0;
109  virtual int recvSelf(const CommParameters &) =0;
110 
111  // methods for sensitivity studies
112  virtual int setParameter(const std::vector<std::string> &argv, Parameter &param);
113  virtual int updateParameter(int parameterID, Information &info);
114  virtual int activateParameter(int parameterID);
115 
116  virtual int setVariable(const std::string &variable, Information &);
117  virtual int getVariable(const std::string &variable, Information &);
118  };
119 
120 
121 template <class T>
122 T *getBrokedMovable(const int &dbTag,const int &classTag,const CommParameters &cp,T *(FEM_ObjectBroker::*ptrFunc)(int))
123  {
124  T *retval=cp.getBrokedPtr(classTag,ptrFunc);
125 
126  if(retval)
127  retval->setDbTag(dbTag);
128  else
129  std::cerr << "getBrokedMovable; no se pudo crear el objeto con classTag: "
130  << classTag << std::endl;
131  return retval;
132  }
133 
134 } // end of XC namespace
135 
136 #endif
void setDbTag(int dbTag)
Asigna el tag para la database.
Definition: MovableObject.cpp:104
MovableObject & operator=(const MovableObject &otro)
Operacdor asignación.
Definition: MovableObject.cpp:81
int getDbTag(void) const
Returns the tag para la database.
Definition: MovableObject.cpp:92
Information about an element.
Definition: Information.h:80
FEM_ObjectBroker is is an object broker class for the finite element method. All methods are virtual ...
Definition: FEM_ObjectBroker.h:138
Object that can move between processes.
Definition: MovableObject.h:91
int getClassTag(void) const
Returns the tag de la clase.
Definition: MovableObject.cpp:88
Base class for distributed processing.
Definition: DistributedBase.h:40
MovableObject(int classTag, int dbTag)
Constructor.
Definition: MovableObject.cpp:68
Definition: Parameter.h:65
virtual int setVariable(const std::string &variable, Information &)
Returns the identificador de la variable cuyo nombre being passed as parameter.
Definition: MovableObject.cpp:125
Communication parameters between processes.
Definition: CommParameters.h:65
================================================================================
Definition: ContinuaReprComponent.h:34