Xyce  6.1
N_DEV_DeviceBlock.C
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_DeviceBlock.C,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.42.2.2 $
40 //
41 // Revision Date : $Date: 2015/04/02 18:20:09 $
42 //
43 // Current Owner : $Author: tvrusso $
44 //-----------------------------------------------------------------------------
45 
46 #include <Xyce_config.h>
47 
48 
49 #include <iostream>
50 
51 #include <N_DEV_DeviceBlock.h>
52 #include <N_ERH_ErrorMgr.h>
53 #include <N_PDS_Comm.h>
54 #include <N_UTL_FeatureTest.h>
55 
56 namespace Xyce {
57 namespace Device {
58 
59 //-----------------------------------------------------------------------------
60 // Function : ModelBlock::ModelBlock
61 // Purpose : constructor
62 // Special Notes :
63 // Scope : public
64 // Creator : Robert Hoekstra, SNL, Parallel Computational Sciences
65 // Creation Date : 5/18/00
66 //-----------------------------------------------------------------------------
67 ModelBlock::ModelBlock(const std::string & name, const std::string &type, int level)
68  : name_(name),
69  level_(level),
70  type_(type),
71  netlistLocation_()
72 {}
73 
74 //-----------------------------------------------------------------------------
75 // Function : ModelBlock::ModelBlock
76 // Purpose : copy constructor
77 // Special Notes :
78 // Scope : public
79 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
80 // Creation Date : 3/16/00
81 //-----------------------------------------------------------------------------
83  : name_(right.name_),
84  type_(right.type_),
85  level_(right.level_),
86  netlistLocation_(right.netlistLocation_),
87  params(right.params)
88 {}
89 
90 //-----------------------------------------------------------------------------
91 // Function : ModelBlock::~ModelBlock
92 // Purpose : destructor
93 // Special Notes :
94 // Scope : public
95 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
96 // Creation Date : 3/16/00
97 //-----------------------------------------------------------------------------
99 {}
100 
101 //-----------------------------------------------------------------------------
102 // Function : ModelBlock::operator=
103 // Purpose : "=" operator
104 // Special Notes :
105 // Scope : public
106 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
107 // Creation Date : 3/16/00
108 //-----------------------------------------------------------------------------
110 {
111  if (this != &right)
112  {
113  name_ = right.name_;
114  type_ = right.type_;
115  level_ = right.level_;
116 
118 
119  params = right.params;
120  }
121 
122  return *this;
123 }
124 
125 //-----------------------------------------------------------------------------
126 // Function : ModelBlock::operator<<
127 // Purpose : "<<" operator
128 // Special Notes :
129 // Scope : public
130 // Creator : Robert Hoekstra, SNL, Parallel Computational Sciences
131 // Creation Date : 4/06/00
132 //-----------------------------------------------------------------------------
133 std::ostream& operator<<(std::ostream & os, const ModelBlock & mb)
134 {
135  std::vector<Param>::const_iterator it_pL, end_pL;
136 
137  os << "Model Block" << std::endl;
138  os << "Model: " << mb.name_ << std::endl;
139  os << " type: " << mb.type_ << std::endl;
140  os << " Level: " << mb.level_ << std::endl;
141  os << " netlistLocation_: " << mb.netlistLocation_ << std::endl;
142  os << " Tagged Params" << std::endl;
143  os << " -------------" << std::endl;
144 
145  it_pL=mb.params.begin();
146  end_pL=mb.params.end();
147  for ( ; it_pL != end_pL; ++it_pL)
148  {
149  os << it_pL->tag() << "\t" << it_pL->stringValue() << std::endl;
150  }
151 
152  os << " -------------" << std::endl;
153  os << std::endl;
154 
155  return os;
156 }
157 
158 //-----------------------------------------------------------------------------
159 // Function : ModelBlock::clear
160 // Purpose : empties out the block.
161 // Special Notes :
162 // Scope : public
163 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
164 // Creation Date : 5/01/00
165 //-----------------------------------------------------------------------------
167 {
168  name_ = "";
169  type_ = "";
170  level_ = 0;
171  params.clear();
172 
173  netlistLocation_ = NetlistLocation();
174 }
175 
176 //-----------------------------------------------------------------------------
177 // Function : ModelBlock::instance
178 // Purpose :
179 // Special Notes :
180 // Scope : public
181 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
182 // Creation Date : 6/28/01
183 //-----------------------------------------------------------------------------
184 Packable * ModelBlock::instance() const
185 {
186  return new ModelBlock();
187 }
188 
189 //-----------------------------------------------------------------------------
190 // Function : ModelBlock::packedByteCount
191 // Purpose : Counts bytes needed to pack block
192 // Special Notes :
193 // Scope : public
194 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
195 // Creation Date : 6/13/00
196 //-----------------------------------------------------------------------------
198 {
199 
200  int byteCount = 0;
201 
202  int size, length, i;
203 
204  std::vector<Param>::const_iterator it_tpL;
205 
206  //----- count name
207  length = name_.length();
208  byteCount += sizeof(int);
209  byteCount += length;
210 
211  //----- count type
212  length = type_.length();
213  byteCount += sizeof(int);
214  byteCount += length;
215 
216  //----- count level
217  byteCount += sizeof(int);
218 
219  //----- count params
220  size = params.size();
221  byteCount += sizeof(int);
222  it_tpL = params.begin();
223  for (i = 0; i < size; ++i, ++it_tpL)
224  {
225  byteCount += it_tpL->packedByteCount();
226  }
227 
228  //----- count netlistFilename_
229  length = netlistLocation_.getFilename().length();
230  byteCount += sizeof(int);
231  byteCount += length;
232 
233  //----- count lineNumber_
234  byteCount += sizeof(int);
235 
236  return byteCount;
237 
238 }
239 
240 //-----------------------------------------------------------------------------
241 // Function : ModelBlock::pack
242 // Purpose : Packs ModelBlock into char buffer using MPI_PACK
243 // Special Notes :
244 // Scope : public
245 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
246 // Creation Date : 5/24/00
247 //-----------------------------------------------------------------------------
248 void ModelBlock::pack(char * buf, int bsize, int & pos, N_PDS_Comm * comm) const
249 {
250 
251  int size, length;
252  int i;
253  std::vector<Param>::const_iterator it_tpL;
254 #ifdef Xyce_COUNT_PACKED_BYTES
255  int predictedPos = pos+packedByteCount();
256 #endif
257 
258  //----- pack name
259  length = name_.length();
260  comm->pack(&length, 1, buf, bsize, pos );
261  comm->pack( name_.c_str(), length, buf, bsize, pos );
262 
263  //----- pack type
264  length = type_.length();
265  comm->pack(&length, 1, buf, bsize, pos );
266  comm->pack( type_.c_str(), length, buf, bsize, pos );
267 
268  //----- pack level
269  comm->pack(&level_, 1, buf, bsize, pos );
270 
271  //----- pack params
272  size = params.size();
273  comm->pack(&size, 1, buf, bsize, pos );
274  it_tpL = params.begin();
275  for (i = 0; i < size; ++i, ++it_tpL)
276  {
277  it_tpL->pack( buf, bsize, pos, comm );
278  }
279 
280  //----- pack netlistFilename_
281  length = netlistLocation_.getFilename().length();
282  comm->pack(&length, 1, buf, bsize, pos );
283  comm->pack( netlistLocation_.getFilename().c_str(), length, buf, bsize, pos );
284 
285  //----- packlineNumber_
286  int line_number = netlistLocation_.getLineNumber();
287  comm->pack(&line_number, 1, buf, bsize, pos );
288 
289  if (DEBUG_TOPOLOGY)
290  Xyce::dout() << "Packed " << pos << " bytes for ModelBlock: " << name_ << std::endl;
291 
292 #ifdef Xyce_COUNT_PACKED_BYTES
293  if (pos != predictedPos)
294  {
295  DevelFatal(*this, "ModelBlock::pack") << "Predicted pos does not match actual pos";
296  }
297 #endif
298 
299 }
300 
301 //-----------------------------------------------------------------------------
302 // Function : ModelBlock::unpack
303 // Purpose : Unpacks ModelBlock from char buffer using MPI_UNPACK
304 // Special Notes :
305 // Scope : public
306 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
307 // Creation Date : 5/24/00
308 //-----------------------------------------------------------------------------
309 void ModelBlock::unpack(char * pB, int bsize,int & pos, N_PDS_Comm * comm)
310 {
311 
312  int size, length;
313  int i;
314 
315  //----- unpack name
316  comm->unpack( pB, bsize, pos, &length, 1 );
317  name_ = std::string( (pB+pos), length);
318  pos += length;
319 
320  //----- unpack type
321  comm->unpack( pB, bsize, pos, &length, 1 );
322  type_ = std::string( (pB+pos), length);
323  pos += length;
324 
325  //----- unpack level
326  comm->unpack( pB, bsize, pos, &level_, 1 );
327 
328  //----- unpack params
329  comm->unpack( pB, bsize, pos, &size, 1 );
330  params.clear();
331  Param dp;
332  for( i = 0; i < size; ++i )
333  {
334  dp.unpack( pB, bsize, pos, comm );
335  params.push_back( dp );
336  }
337 
338  //----- unpack netlistFilename_
339  comm->unpack( pB, bsize, pos, &length, 1 );
340  netlistLocation_.setFilename(std::string( (pB+pos), length));
341  pos += length;
342 
343  //----- unpack lineNumber_
344  int line_number = 0;
345  comm->unpack( pB, bsize, pos, &line_number, 1 );
346  netlistLocation_.setLineNumber(line_number);
347 
348  if (DEBUG_TOPOLOGY)
349  Xyce::dout() << "Unpacked " << pos << " bytes for ModelBlock: " << name_ << std::endl;
350 }
351 
352 //-----------------------------------------------------------------------------
353 // Function : InstanceBlock::InstanceBlock
354 // Purpose : constructor
355 // Special Notes :
356 // Scope : public
357 // Creator : Robert Hoekstra, SNL, Parallel Computational Sciences
358 // Creation Date : 5/18/00
359 //-----------------------------------------------------------------------------
360 InstanceBlock::InstanceBlock (const std::string &name)
361  : name_(name),
362  modelName_(),
363  iNumNodes(0),
364  numIntVars(0),
365  numExtVars(0),
366  numStateVars(0),
367  modelFlag(0),
368  sourceFlag(0),
369  bsourceFlag(0),
370  offFlag(0),
371  off(0),
372  netlistLocation_()
373 {
374 }
375 
376 //-----------------------------------------------------------------------------
377 // Function : InstanceBlock::InstanceBlock
378 // Purpose : copy constructor
379 // Special Notes :
380 // Scope : public
381 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
382 // Creation Date : 3/16/00
383 //-----------------------------------------------------------------------------
385  : name_ (right.name_),
386  modelName_(right.modelName_),
387  iNumNodes (right.iNumNodes),
388  numIntVars(right.numIntVars),
389  numExtVars(right.numExtVars),
390  numStateVars(right.numStateVars),
391  modelFlag (right.modelFlag),
392  sourceFlag(right.sourceFlag),
393  bsourceFlag(right.bsourceFlag),
394  offFlag (right.offFlag),
395  off (right.off),
396  netlistLocation_(right.netlistLocation_),
397  params (right.params)
398 {}
399 
400 //-----------------------------------------------------------------------------
401 // Function : InstanceBlock::~InstanceBlock
402 // Purpose : destructor
403 // Special Notes :
404 // Scope : public
405 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
406 // Creation Date : 3/16/00
407 //-----------------------------------------------------------------------------
409 {
410 }
411 
412 //-----------------------------------------------------------------------------
413 // Function : InstanceBlock::operator=
414 // Purpose : "=" operator
415 // Special Notes :
416 // Scope : public
417 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
418 // Creation Date : 3/16/00
419 //-----------------------------------------------------------------------------
421 {
422  if (this != &right)
423  {
424  name_ = right.name_;
425  modelName_ = right.modelName_;
426  iNumNodes = right.iNumNodes;
427  numIntVars= right.numIntVars;
428  numExtVars= right.numExtVars;
429  numStateVars= right.numStateVars;
430  modelFlag = right.modelFlag;
431  sourceFlag= right.sourceFlag;
432  bsourceFlag= right.bsourceFlag;
433  offFlag = right.offFlag;
434  off = right.off;
436  params = right.params;
437  }
438 
439  return *this;
440 }
441 
442 //-----------------------------------------------------------------------------
443 // Function : InstanceBlock::clear
444 // Purpose : empties out the block.
445 // Special Notes :
446 // Scope : public
447 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
448 // Creation Date : 5/01/00
449 //-----------------------------------------------------------------------------
451 {
452  name_ = InstanceName();
453  modelName_ = "";
454  iNumNodes = 0;
455  numIntVars = 0;
456  numExtVars = 0;
457  numStateVars = 0;
458  modelFlag = 0;
459  sourceFlag = 0;
460  bsourceFlag = 0;
461  offFlag = 0;
462  off = 0;
463  netlistLocation_ = NetlistLocation();
464 
465  params.clear();
466 }
467 
468 //-----------------------------------------------------------------------------
469 // Function : InstanceBlock::operator<<
470 // Purpose : "<<" operator
471 // Special Notes :
472 // Scope : public
473 // Creator : Robert Hoekstra, SNL, Parallel Computational Sciences
474 // Creation Date : 4/06/00
475 //-----------------------------------------------------------------------------
476 std::ostream& operator<<(std::ostream & os, const InstanceBlock & ib)
477 {
478  std::vector<Param>::const_iterator it_tpL, end_tpL;
479 
480  os << "Instance Block" << std::endl;
481  os << "Name: " << ib.name_ << std::endl;
482  os << " Model: " << ib.getModelName() << std::endl;
483  os << " # Nodes: " << ib.iNumNodes << std::endl;
484  os << " # Int Vars: " << ib.numIntVars << std::endl;
485  os << " # Ext Vars: " << ib.numExtVars << std::endl;
486  os << " # State Vars: " << ib.numStateVars << std::endl;
487  os << " modelFlag: " << ib.modelFlag << std::endl;
488  os << " sourceFlag: " << ib.sourceFlag << std::endl;
489  os << " bsourceFlag: " << ib.bsourceFlag << std::endl;
490  os << " offFlag: " << ib.offFlag << std::endl;
491  os << " off: " << ib.off << std::endl;
492  os << " netlistLocation_: " << ib.netlistLocation_ << std::endl;
493  os << " Tagged Params" << std::endl;
494  os << " -------------" << std::endl;
495 
496  it_tpL=ib.params.begin();
497  end_tpL=ib.params.end();
498  for ( ; it_tpL != end_tpL; ++it_tpL)
499  {
500  os << it_tpL->tag() << "\t" << it_tpL->stringValue() << std::endl;
501  }
502 
503  os << " -------------" << std::endl;
504  os << std::endl;
505 
506  return os;
507 }
508 
509 //-----------------------------------------------------------------------------
510 // Function : InstanceBlock::instance
511 // Purpose :
512 // Special Notes :
513 // Scope : public
514 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
515 // Creation Date : 6/28/01
516 //-----------------------------------------------------------------------------
517 Packable * InstanceBlock::instance() const
518 {
519  return new InstanceBlock();
520 }
521 
522 //-----------------------------------------------------------------------------
523 // Function : InstanceBlock::packedByteCount
524 // Purpose : count bytes needed to pack block
525 // Special Notes :
526 // Scope : public
527 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
528 // Creation Date : 6/13/00
529 //-----------------------------------------------------------------------------
531 {
532 
533  int byteCount = 0;
534 
535  int size, length, i;
536  std::vector<Param>::const_iterator it_tpL;
537 
538  //----- count name
539  const std::string &name = getInstanceName().getEncodedName();
540  length = name.length();
541  byteCount += sizeof(int);
542  byteCount += length * sizeof(char);
543 
544  //----- count getModelName()
545  length = getModelName().length();
546  byteCount += sizeof(int);
547  byteCount += length * sizeof(char);
548 
549  //----- count params
550  size = params.size();
551  byteCount += sizeof(int);
552  it_tpL = params.begin();
553  for (i = 0; i < size; ++i, ++it_tpL)
554  {
555  byteCount += it_tpL->packedByteCount();
556  }
557 
558  //----- count iNumNodes
559  byteCount += sizeof(int);
560 
561  //----- count numIntVars
562  byteCount += sizeof(int);
563 
564  //----- countnumExtVars
565  byteCount += sizeof(int);
566 
567  //----- count numStateVars
568  byteCount += sizeof(int);
569 
570  //----- count modelFlag
571  byteCount += sizeof(int);
572 
573  //----- count sourceFlag
574  byteCount += sizeof(int);
575 
576  //----- count bsourceFlag
577  byteCount += sizeof(int);
578 
579  //----- count offFlag
580  byteCount += sizeof(int);
581 
582  //----- pack off
583  byteCount += sizeof(int);
584 
585  //----- count netlistFilename_
586  length = netlistLocation_.getFilename().length();
587  byteCount += sizeof(int);
588  byteCount += length * sizeof(char);
589 
590  //----- count lineNumber_
591  byteCount += sizeof(int);
592 
593  return byteCount;
594 
595 }
596 
597 //-----------------------------------------------------------------------------
598 // Function : InstanceBlock::pack
599 // Purpose : Packs InstanceBlock into char buffer using MPI_PACK
600 // Special Notes :
601 // Scope : public
602 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
603 // Creation Date : 5/24/00
604 //-----------------------------------------------------------------------------
605 void InstanceBlock::pack(char * buf, int bsize, int & pos, N_PDS_Comm * comm) const
606 {
607 
608  int size, length;
609  int i;
610  std::vector<Param>::const_iterator it_tpL;
611 #ifdef Xyce_COUNT_PACKED_BYTES
612  int predictedPos = pos+packedByteCount();
613 #endif
614 
615  //----- pack name
616  const std::string &name = getInstanceName().getEncodedName();
617  length = name.length();
618  comm->pack(&length, 1, buf, bsize, pos);
619  comm->pack(name.c_str(), length, buf, bsize, pos);
620 
621  //----- pack getModelName()
622  length = getModelName().length();
623  comm->pack(&length, 1, buf, bsize, pos );
624  comm->pack( getModelName().c_str(), length, buf, bsize, pos );
625 
626  //----- pack params
627  size = params.size();
628  comm->pack(&size, 1, buf, bsize, pos );
629  it_tpL = params.begin();
630  for (i = 0; i < size; ++i, ++it_tpL)
631  {
632  it_tpL->pack( buf, bsize, pos, comm );
633  }
634 
635  //----- pack iNumNodes
636  comm->pack(&iNumNodes, 1, buf, bsize, pos );
637 
638  //----- pack numIntVars
639  comm->pack(&numIntVars, 1, buf, bsize, pos );
640 
641  //----- pack numExtVars
642  comm->pack(&numExtVars, 1, buf, bsize, pos );
643 
644  //----- pack numStateVars
645  comm->pack(&numStateVars, 1, buf, bsize, pos );
646 
647  //----- pack modelFlag
648  i = modelFlag;
649  comm->pack(&i, 1, buf, bsize, pos );
650 
651  //----- pack sourceFlag
652  i = sourceFlag;
653  comm->pack(&i, 1, buf, bsize, pos );
654 
655  //----- pack bsourceFlag
656  i = bsourceFlag;
657  comm->pack(&i, 1, buf, bsize, pos );
658 
659  //----- pack offFlag
660  i = offFlag;
661  comm->pack(&i, 1, buf, bsize, pos );
662 
663  //----- pack off
664  i = off;
665  comm->pack(&i, 1, buf, bsize, pos );
666 
667  //----- pack name
668  length = netlistLocation_.getFilename().length();
669  comm->pack(&length, 1, buf, bsize, pos );
670  comm->pack( netlistLocation_.getFilename().c_str(), length, buf, bsize, pos );
671 
672  //----- pack lineNumber_
673  int line_number = netlistLocation_.getLineNumber();
674  comm->pack(&line_number, 1, buf, bsize, pos );
675 
676  if (DEBUG_TOPOLOGY)
677  Xyce::dout() << "Packed " << pos << " bytes for InstanceBlock: " << getInstanceName() << std::endl;
678 
679 #ifdef Xyce_COUNT_PACKED_BYTES
680  if (pos != predictedPos)
681  {
682  DevelFatal(*this, "InstanceBlock::pack") << "Predicted pos does not match actual pos";
683  }
684 #endif
685 }
686 
687 //-----------------------------------------------------------------------------
688 // Function : InstanceBlock::unpack
689 // Purpose : Unpacks InstanceBlock from char buffer using MPI_UNPACK
690 // Special Notes :
691 // Scope : public
692 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
693 // Creation Date : 5/24/00
694 //-----------------------------------------------------------------------------
695 void InstanceBlock::unpack(char * pB, int bsize, int & pos, N_PDS_Comm * comm)
696 {
697 
698  int size, length;
699  int i;
700 
701  //----- unpack name
702  comm->unpack( pB, bsize, pos, &length, 1 );
703  name_ = InstanceName(std::string( (pB+pos), length));
704  pos += length;
705 
706  //----- unpack getModelName()
707  comm->unpack( pB, bsize, pos, &length, 1 );
708  modelName_ = std::string( (pB+pos), length);
709  pos += length;
710 
711  //----- unpack params
712  comm->unpack( pB, bsize, pos, &size, 1 );
713  params.clear();
714  Param dp;
715  for( i = 0; i < size; ++i )
716  {
717  dp.unpack( pB, bsize, pos, comm );
718  params.push_back( dp );
719  }
720 
721  //----- unpack iNumNodes
722  comm->unpack( pB, bsize, pos, &iNumNodes, 1 );
723 
724  //----- unpack numIntVars
725  comm->unpack( pB, bsize, pos, &numIntVars, 1 );
726 
727  //----- unpack numExtVars
728  comm->unpack( pB, bsize, pos, &numExtVars, 1 );
729 
730  //----- unpack numStateVars
731  comm->unpack( pB, bsize, pos, &numStateVars, 1 );
732 
733  //----- unpack modelFlag
734  comm->unpack( pB, bsize, pos, &i, 1 );
735  modelFlag = ( i != 0 );
736 
737  //----- unpack sourceFlag
738  comm->unpack( pB, bsize, pos, &i, 1 );
739  sourceFlag = ( i != 0 );
740 
741  //----- unpack bsourceFlag
742  comm->unpack( pB, bsize, pos, &i, 1 );
743  bsourceFlag = ( i != 0 );
744 
745  //----- unpack offFlag
746  comm->unpack( pB, bsize, pos, &i, 1 );
747  offFlag = ( i != 0 );
748 
749  //----- unpack off
750  comm->unpack( pB, bsize, pos, &i, 1 );
751  off = ( i != 0 );
752 
753  //----- unpack netlistFilename_
754  comm->unpack( pB, bsize, pos, &length, 1 );
755  netlistLocation_.setFilename(std::string( (pB+pos), length));
756  pos += length;
757 
758  //----- unpack lineNumber_
759  int line_number = 0;
760  comm->unpack( pB, bsize, pos, &line_number, 1 );
761  netlistLocation_.setLineNumber(line_number);
762 
763  if (DEBUG_TOPOLOGY)
764  Xyce::dout() << "Unpacked " << pos << " bytes for InstanceBlock: " << getInstanceName() << std::endl;
765 }
766 
767 } // namespace Device
768 } // namespace Xyce
ModelBlock(const std::string &name="", const std::string &type="", int level=1)
void unpack(char *pB, int bsize, int &pos, N_PDS_Comm *comm)
Pure virtual class to augment a linear system.
Devices and models are each named.
const std::string & getEncodedName() const
Return the instance name encoded as: [s:]*xname [s:]*Ytype!name [s:]*Utype!name!count.
virtual void unpack(char *pB, int bsize, int &pos, N_PDS_Comm *comm)
Definition: N_DEV_Param.C:114
void unpack(char *pB, int bsize, int &pos, N_PDS_Comm *comm)
NetlistLocation netlistLocation_
Path and line number of .MODEL command.
ModelName name_
Model name.
std::vector< Param > params
Parameters from the line.
InstanceBlock(const std::string &name=std::string())
Packable * instance() const
Packable * instance() const
ModelBlock & operator=(const ModelBlock &right)
void pack(char *buf, int bsize, int &pos, N_PDS_Comm *comm) const
std::string type_
Model type.
const ModelName & getModelName() const
const InstanceName & getInstanceName() const
InstanceName name_
Device instance name.
InstanceBlock & operator=(const InstanceBlock &right)
void pack(char *buf, int bsize, int &pos, N_PDS_Comm *comm) const
ModelBlock represents a .MODEL line from the netlist.
NetlistLocation netlistLocation_
Path and line number of .MODEL command.
InstanceBlock represent a device instance line from the netlist.
std::vector< Param > params
std::ostream & operator<<(std::ostream &os, const Configuration &configuration)
Definition: N_DEV_Dump.C:134
ModelName modelName_
Model name if provided.