Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_DEV_DeviceBlock.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-2014 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_DeviceBlock.h,v $
27 //
28 // Purpose :
29 //
30 // Special Notes :
31 //
32 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
33 //
34 // Creation Date : 02/28/00
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.27.2.1 $
40 //
41 // Revision Date : $Date: 2014/02/26 20:16:30 $
42 //
43 // Current Owner : $Author: tvrusso $
44 //-----------------------------------------------------------------------------
45 
46 
47 #ifndef Xyce_N_DEV_DeviceBlock_h
48 #define Xyce_N_DEV_DeviceBlock_h
49 
50 #include <string>
51 #include <vector>
52 #include <iosfwd>
53 
54 #include <N_DEV_Param.h>
55 #include <N_UTL_Misc.h>
56 #include <N_UTL_Xyce.h>
57 #include <N_UTL_Packable.h>
58 
59 
60 namespace Xyce {
61 namespace Device {
62 
63 bool hasSubcircuitInInstanceName(const InstanceBlock &instance_block);
64 std::string subcircuitNameFromInstanceName(const InstanceBlock &instance_block);
65 std::string modelNameFromInstanceName(const InstanceBlock &instance_block);
66 
67 //-----------------------------------------------------------------------------
68 // Class : ModelBlock
69 // Purpose :
70 // Special Notes :
71 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
72 // Creation Date : 3/31/00
73 //-----------------------------------------------------------------------------
74 class ModelBlock : public Packable
75 {
76 public:
77  ModelBlock(const std::string &name_ = "", const std::string &type_ = "", int level_ = 1);
78 
79  ModelBlock(const ModelBlock & right);
80  ModelBlock & operator=(const ModelBlock & right);
81 
82  ~ModelBlock();
83 
84  void clear ();
85 
86  //Packing Utils
87  Packable * instance() const;
88  int packedByteCount() const;
89 
90  void pack( char * buf, int bsize, int & pos, N_PDS_Comm * comm ) const;
91  void unpack( char * pB, int bsize, int & pos, N_PDS_Comm * comm );
92 
93  int operator==(const ModelBlock &right) const;
94  int operator!=(const ModelBlock &right) const;
95 
96  std::string name;
97  std::string type;
98  int level;
99  std::vector<Param> params;
100 
101  std::string netlistFileName_;
103 
104  friend std::ostream& operator<<(std::ostream& os, const ModelBlock & mb);
105 };
106 
107 //-----------------------------------------------------------------------------
108 // Class : InstanceBlock
109 // Purpose :
110 // Special Notes :
111 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
112 // Creation Date : 3/31/00
113 //-----------------------------------------------------------------------------
114 class InstanceBlock : public Packable
115 {
116 
117 public:
118  InstanceBlock(const std::string &name = std::string());
119 
120  InstanceBlock(const InstanceBlock & right);
122 
123  ~InstanceBlock();
124 
125  const std::string &getName() const
126  {
127  return name_;
128  }
129 
130  void setName(const std::string &name)
131  {
132  name_ = name;
133  }
134 
135  const std::string &getModelName() const
136  {
137  return modelName_;
138  }
139 
140  void setModelName(const std::string &modelName)
141  {
142  modelName_ = modelName;
143  }
144 
145  void clear ();
146 
147  //Packing Utils
148  Packable * instance() const;
149  int packedByteCount() const;
150 
151  void pack( char * buf, int bsize, int & pos, N_PDS_Comm * comm ) const;
152  void unpack( char * pB, int bsize, int & pos, N_PDS_Comm * comm );
153 
154  int operator==(InstanceBlock &right) const;
155  int operator!=(InstanceBlock &right) const;
156 
157 private:
158  std::string name_;
159  std::string modelName_;
160 
161 public:
162  std::vector<Param> params;
163 
168 
169  bool modelFlag;
172  bool offFlag;
173  bool off;
174 
175  std::string netlistFileName_;
177 
178  friend std::ostream& operator<<(std::ostream& os, const InstanceBlock & ib);
179 };
180 
181 } // namespace Device
182 } // namespace Xyce
183 
186 
187 #endif