Xyce  6.1
N_DEV_DeviceState.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2015 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-----------------------------------------------------------------------------
26 // Filename : $RCSfile: N_DEV_DeviceState.h,v $
27 //
28 // Purpose : Used to store internal state info for devices
29 // To be used for restarts and migrations
30 // Special Notes :
31 //
32 // Creator : Robert Hoekstra, SNL, Parallel Computational Sciences
33 //
34 // Creation Date : 09/02/01
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.16.2.1 $
40 //
41 // Revision Date : $Date: 2015/04/02 18:20:09 $
42 //
43 // Current Owner : $Author: tvrusso $
44 //-----------------------------------------------------------------------------
45 
46 #ifndef Xyce_N_DEV_DeviceState_h
47 #define Xyce_N_DEV_DeviceState_h
48 
49 #include <string>
50 #include <vector>
51 #include <iosfwd>
52 
53 #include <N_DEV_fwd.h>
54 
55 #include <N_UTL_Packable.h>
56 
57 namespace Xyce {
58 namespace Device {
59 
60 //-----------------------------------------------------------------------------
61 // Class : DeviceState
62 // Purpose :
63 // Special Notes :
64 // Creator : Robert Hoektra, SNL, Parallel Computational Sciences
65 // Creation Date : 09/02/01
66 //-----------------------------------------------------------------------------
67 class DeviceState : public Packable
68 {
69 
70 public:
71  DeviceState( const std::string & id = "" )
72  : ID(id)
73  {}
74 
76 
77  //autogenerated copy and assignment for now
78 
79  bool operator==(const DeviceState & right) const
80  { return ID == right.ID; }
81  bool operator!=(const DeviceState & right) const
82  { return ID != right.ID; }
83 
84  //Packing Utils
85  Packable * instance() const { return new DeviceState(); }
86  int packedByteCount() const;
87 
88  void pack( char * buf, int bsize, int & pos, N_PDS_Comm * comm ) const;
89  void unpack( char * buf, int bsize, int & pos, N_PDS_Comm * comm );
90 
91  void dump( std::ostream & os );
92  void restore( std::istream & is );
93 
94  std::string ID;
95  std::vector<double> data;
96  std::vector<int> dataInt;
97  std::vector<size_t> dataSizeT;
98 
99  friend std::ostream& operator<<(std::ostream& os, const DeviceState & ds );
100 
101 };
102 
103 } // namespace Device
104 } // namespace Xyce
105 
106 #endif
DeviceState(const std::string &id="")
Pure virtual class to augment a linear system.
void pack(char *buf, int bsize, int &pos, N_PDS_Comm *comm) const
std::vector< int > dataInt
Packable * instance() const
bool operator!=(const DeviceState &right) const
bool operator==(const DeviceState &right) const
void unpack(char *buf, int bsize, int &pos, N_PDS_Comm *comm)
void restore(std::istream &is)
void dump(std::ostream &os)
std::vector< double > data
friend std::ostream & operator<<(std::ostream &os, const DeviceState &ds)
std::vector< size_t > dataSizeT