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.45 $
40 //
41 // Revision Date : $Date: 2015/05/13 22:28:56 $
42 //
43 // Current Owner : $Author: dgbaur $
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 // Function : InstanceBlock::InstanceBlock
177 // Purpose : constructor
178 // Special Notes :
179 // Scope : public
180 // Creator : Robert Hoekstra, SNL, Parallel Computational Sciences
181 // Creation Date : 5/18/00
182 //-----------------------------------------------------------------------------
183 InstanceBlock::InstanceBlock (const std::string &name)
184  : name_(name),
185  modelName_(),
186  iNumNodes(0),
187  numIntVars(0),
188  numExtVars(0),
189  numStateVars(0),
190  modelFlag(0),
191  sourceFlag(0),
192  bsourceFlag(0),
193  offFlag(0),
194  off(0),
195  netlistLocation_()
196 {
197 }
198 
199 //-----------------------------------------------------------------------------
200 // Function : InstanceBlock::InstanceBlock
201 // Purpose : copy constructor
202 // Special Notes :
203 // Scope : public
204 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
205 // Creation Date : 3/16/00
206 //-----------------------------------------------------------------------------
208  : name_ (right.name_),
209  modelName_(right.modelName_),
210  iNumNodes (right.iNumNodes),
211  numIntVars(right.numIntVars),
212  numExtVars(right.numExtVars),
213  numStateVars(right.numStateVars),
214  modelFlag (right.modelFlag),
215  sourceFlag(right.sourceFlag),
216  bsourceFlag(right.bsourceFlag),
217  offFlag (right.offFlag),
218  off (right.off),
219  netlistLocation_(right.netlistLocation_),
220  params (right.params)
221 {}
222 
223 //-----------------------------------------------------------------------------
224 // Function : InstanceBlock::~InstanceBlock
225 // Purpose : destructor
226 // Special Notes :
227 // Scope : public
228 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
229 // Creation Date : 3/16/00
230 //-----------------------------------------------------------------------------
232 {
233 }
234 
235 //-----------------------------------------------------------------------------
236 // Function : InstanceBlock::operator=
237 // Purpose : "=" operator
238 // Special Notes :
239 // Scope : public
240 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
241 // Creation Date : 3/16/00
242 //-----------------------------------------------------------------------------
244 {
245  if (this != &right)
246  {
247  name_ = right.name_;
248  modelName_ = right.modelName_;
249  iNumNodes = right.iNumNodes;
250  numIntVars= right.numIntVars;
251  numExtVars= right.numExtVars;
252  numStateVars= right.numStateVars;
253  modelFlag = right.modelFlag;
254  sourceFlag= right.sourceFlag;
255  bsourceFlag= right.bsourceFlag;
256  offFlag = right.offFlag;
257  off = right.off;
259  params = right.params;
260  }
261 
262  return *this;
263 }
264 
265 //-----------------------------------------------------------------------------
266 // Function : InstanceBlock::clear
267 // Purpose : empties out the block.
268 // Special Notes :
269 // Scope : public
270 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
271 // Creation Date : 5/01/00
272 //-----------------------------------------------------------------------------
274 {
275  name_ = InstanceName();
276  modelName_ = "";
277  iNumNodes = 0;
278  numIntVars = 0;
279  numExtVars = 0;
280  numStateVars = 0;
281  modelFlag = 0;
282  sourceFlag = 0;
283  bsourceFlag = 0;
284  offFlag = 0;
285  off = 0;
286  netlistLocation_ = NetlistLocation();
287 
288  params.clear();
289 }
290 
291 //-----------------------------------------------------------------------------
292 // Function : InstanceBlock::operator<<
293 // Purpose : "<<" operator
294 // Special Notes :
295 // Scope : public
296 // Creator : Robert Hoekstra, SNL, Parallel Computational Sciences
297 // Creation Date : 4/06/00
298 //-----------------------------------------------------------------------------
299 std::ostream& operator<<(std::ostream & os, const InstanceBlock & ib)
300 {
301  std::vector<Param>::const_iterator it_tpL, end_tpL;
302 
303  os << "Instance Block" << std::endl;
304  os << "Name: " << ib.name_ << std::endl;
305  os << " Model: " << ib.getModelName() << std::endl;
306  os << " # Nodes: " << ib.iNumNodes << std::endl;
307  os << " # Int Vars: " << ib.numIntVars << std::endl;
308  os << " # Ext Vars: " << ib.numExtVars << std::endl;
309  os << " # State Vars: " << ib.numStateVars << std::endl;
310  os << " modelFlag: " << ib.modelFlag << std::endl;
311  os << " sourceFlag: " << ib.sourceFlag << std::endl;
312  os << " bsourceFlag: " << ib.bsourceFlag << std::endl;
313  os << " offFlag: " << ib.offFlag << std::endl;
314  os << " off: " << ib.off << std::endl;
315  os << " netlistLocation_: " << ib.netlistLocation_ << std::endl;
316  os << " Tagged Params" << std::endl;
317  os << " -------------" << std::endl;
318 
319  it_tpL=ib.params.begin();
320  end_tpL=ib.params.end();
321  for ( ; it_tpL != end_tpL; ++it_tpL)
322  {
323  os << it_tpL->tag() << "\t" << it_tpL->stringValue() << std::endl;
324  }
325 
326  os << " -------------" << std::endl;
327  os << std::endl;
328 
329  return os;
330 }
331 
332 } // namespace Device
333 
334 //-----------------------------------------------------------------------------
335 // Function : ModelBlock::packedByteCount
336 // Purpose : Counts bytes needed to pack block
337 // Special Notes :
338 // Scope : public
339 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
340 // Creation Date : 6/13/00
341 //-----------------------------------------------------------------------------
342 template<>
343 int
344 Pack<Device::ModelBlock>::packedByteCount(const Device::ModelBlock &model_block)
345 {
346 
347  int byteCount = 0;
348 
349  int size, length, i;
350 
351  //----- count name
352  length = model_block.name_.length();
353  byteCount += sizeof(int);
354  byteCount += length;
355 
356  //----- count type
357  length = model_block.type_.length();
358  byteCount += sizeof(int);
359  byteCount += length;
360 
361  //----- count level
362  byteCount += sizeof(int);
363 
364  //----- count params
365  size = model_block.params.size();
366  byteCount += sizeof(int);
367  std::vector<Device::Param>::const_iterator it_tpL = model_block.params.begin();
368  for (i = 0; i < size; ++i, ++it_tpL)
369  {
370  byteCount += Pack<Device::Param>::packedByteCount(*it_tpL);
371  }
372 
373  //----- count netlistFilename_
374  length = model_block.netlistLocation_.getFilename().length();
375  byteCount += sizeof(int);
376  byteCount += length;
377 
378  //----- count lineNumber_
379  byteCount += sizeof(int);
380 
381  return byteCount;
382 
383 }
384 
385 //-----------------------------------------------------------------------------
386 // Function : ModelBlock::pack
387 // Purpose : Packs ModelBlock into char buffer using MPI_PACK
388 // Special Notes :
389 // Scope : public
390 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
391 // Creation Date : 5/24/00
392 //-----------------------------------------------------------------------------
393 template<>
394 void
395 Pack<Device::ModelBlock>::pack(const Device::ModelBlock &model_block, char * buf, int bsize, int & pos, N_PDS_Comm * comm)
396 {
397 
398  int size, length;
399  int i;
400 #ifdef Xyce_COUNT_PACKED_BYTES
401  int predictedPos = pos+packedByteCount();
402 #endif
403 
404  //----- pack name
405  length = model_block.name_.length();
406  comm->pack(&length, 1, buf, bsize, pos );
407  comm->pack( model_block.name_.c_str(), length, buf, bsize, pos );
408 
409  //----- pack type
410  length = model_block.type_.length();
411  comm->pack(&length, 1, buf, bsize, pos );
412  comm->pack( model_block.type_.c_str(), length, buf, bsize, pos );
413 
414  //----- pack level
415  comm->pack(&model_block.level_, 1, buf, bsize, pos );
416 
417  //----- pack params
418  size = model_block.params.size();
419  comm->pack(&size, 1, buf, bsize, pos );
420  std::vector<Device::Param>::const_iterator it_tpL = model_block.params.begin();
421  for (i = 0; i < size; ++i, ++it_tpL)
422  {
423  Pack<Device::Param>::pack(*it_tpL, buf, bsize, pos, comm );
424  }
425 
426  //----- pack netlistFilename_
427  length = model_block.netlistLocation_.getFilename().length();
428  comm->pack(&length, 1, buf, bsize, pos );
429  comm->pack( model_block.netlistLocation_.getFilename().c_str(), length, buf, bsize, pos );
430 
431  //----- packlineNumber_
432  int line_number = model_block.netlistLocation_.getLineNumber();
433  comm->pack(&line_number, 1, buf, bsize, pos );
434 
435  if (DEBUG_TOPOLOGY)
436  Xyce::dout() << "Packed " << pos << " bytes for ModelBlock: " << model_block.name_ << std::endl;
437 
438 #ifdef Xyce_COUNT_PACKED_BYTES
439  if (pos != predictedPos)
440  {
441  DevelFatal(*this, "ModelBlock::pack") << "Predicted pos does not match actual pos";
442  }
443 #endif
444 
445 }
446 
447 //-----------------------------------------------------------------------------
448 // Function : ModelBlock::unpack
449 // Purpose : Unpacks ModelBlock from char buffer using MPI_UNPACK
450 // Special Notes :
451 // Scope : public
452 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
453 // Creation Date : 5/24/00
454 //-----------------------------------------------------------------------------
455 template<>
456 void
457 Pack<Device::ModelBlock>::unpack(Device::ModelBlock &model_block, char * pB, int bsize,int & pos, N_PDS_Comm * comm)
458 {
459 
460  int size, length;
461  int i;
462 
463  //----- unpack name
464  comm->unpack( pB, bsize, pos, &length, 1 );
465  model_block.name_ = std::string( (pB+pos), length);
466  pos += length;
467 
468  //----- unpack type
469  comm->unpack( pB, bsize, pos, &length, 1 );
470  model_block.type_ = std::string( (pB+pos), length);
471  pos += length;
472 
473  //----- unpack level
474  comm->unpack( pB, bsize, pos, &model_block.level_, 1 );
475 
476  //----- unpack params
477  comm->unpack( pB, bsize, pos, &size, 1 );
478  model_block.params.clear();
479  Device::Param dp;
480  for( i = 0; i < size; ++i )
481  {
482  Pack<Device::Param>::unpack(dp, pB, bsize, pos, comm );
483  model_block.params.push_back( dp );
484  }
485 
486  //----- unpack netlistFilename_
487  comm->unpack( pB, bsize, pos, &length, 1 );
488  model_block.netlistLocation_.setFilename(std::string( (pB+pos), length));
489  pos += length;
490 
491  //----- unpack lineNumber_
492  int line_number = 0;
493  comm->unpack( pB, bsize, pos, &line_number, 1 );
494  model_block.netlistLocation_.setLineNumber(line_number);
495 
496  if (DEBUG_TOPOLOGY)
497  Xyce::dout() << "Unpacked " << pos << " bytes for ModelBlock: " << model_block.name_ << std::endl;
498 }
499 
500 //-----------------------------------------------------------------------------
501 // Function : InstanceBlock::packedByteCount
502 // Purpose : count bytes needed to pack block
503 // Special Notes :
504 // Scope : public
505 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
506 // Creation Date : 6/13/00
507 //-----------------------------------------------------------------------------
508 template<>
509 int
510 Pack<Device::InstanceBlock>::packedByteCount(const Device::InstanceBlock &instance_block)
511 {
512 
513  int byteCount = 0;
514 
515  int size, length, i;
516 
517  //----- count name
518  const std::string &name = instance_block.getInstanceName().getEncodedName();
519  length = name.length();
520  byteCount += sizeof(int);
521  byteCount += length * sizeof(char);
522 
523  //----- count getModelName()
524  length = instance_block.getModelName().length();
525  byteCount += sizeof(int);
526  byteCount += length * sizeof(char);
527 
528  //----- count params
529  size = instance_block.params.size();
530  byteCount += sizeof(int);
531 
532  std::vector<Device::Param>::const_iterator it_tpL = instance_block.params.begin();
533  for (i = 0; i < size; ++i, ++it_tpL)
534  {
535  byteCount += Pack<Device::Param>::packedByteCount(*it_tpL);
536  }
537 
538  //----- count iNumNodes
539  byteCount += sizeof(int);
540 
541  //----- count numIntVars
542  byteCount += sizeof(int);
543 
544  //----- countnumExtVars
545  byteCount += sizeof(int);
546 
547  //----- count numStateVars
548  byteCount += sizeof(int);
549 
550  //----- count modelFlag
551  byteCount += sizeof(int);
552 
553  //----- count sourceFlag
554  byteCount += sizeof(int);
555 
556  //----- count bsourceFlag
557  byteCount += sizeof(int);
558 
559  //----- count offFlag
560  byteCount += sizeof(int);
561 
562  //----- pack off
563  byteCount += sizeof(int);
564 
565  //----- count netlistFilename_
566  length = instance_block.netlistLocation_.getFilename().length();
567  byteCount += sizeof(int);
568  byteCount += length * sizeof(char);
569 
570  //----- count lineNumber_
571  byteCount += sizeof(int);
572 
573  return byteCount;
574 
575 }
576 
577 //-----------------------------------------------------------------------------
578 // Function : InstanceBlock::pack
579 // Purpose : Packs InstanceBlock into char buffer using MPI_PACK
580 // Special Notes :
581 // Scope : public
582 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
583 // Creation Date : 5/24/00
584 //-----------------------------------------------------------------------------
585 template<>
586 void
587 Pack<Device::InstanceBlock>::pack(const Device::InstanceBlock &instance_block, char * buf, int bsize, int & pos, N_PDS_Comm * comm)
588 {
589 
590  int size, length;
591  int i;
592 #ifdef Xyce_COUNT_PACKED_BYTES
593  int predictedPos = pos+packedByteCount();
594 #endif
595 
596  //----- pack name
597  const std::string &name = instance_block.getInstanceName().getEncodedName();
598  length = name.length();
599  comm->pack(&length, 1, buf, bsize, pos);
600  comm->pack(name.c_str(), length, buf, bsize, pos);
601 
602  //----- pack getModelName()
603  length = instance_block.getModelName().length();
604  comm->pack(&length, 1, buf, bsize, pos );
605  comm->pack( instance_block.getModelName().c_str(), length, buf, bsize, pos );
606 
607  //----- pack params
608  size = instance_block.params.size();
609  comm->pack(&size, 1, buf, bsize, pos );
610  std::vector<Device::Param>::const_iterator it_tpL = instance_block.params.begin();
611  for (i = 0; i < size; ++i, ++it_tpL)
612  {
613  Pack<Device::Param>::pack(*it_tpL, buf, bsize, pos, comm );
614  }
615 
616  //----- pack iNumNodes
617  comm->pack(&instance_block.iNumNodes, 1, buf, bsize, pos );
618 
619  //----- pack numIntVars
620  comm->pack(&instance_block.numIntVars, 1, buf, bsize, pos );
621 
622  //----- pack numExtVars
623  comm->pack(&instance_block.numExtVars, 1, buf, bsize, pos );
624 
625  //----- pack numStateVars
626  comm->pack(&instance_block.numStateVars, 1, buf, bsize, pos );
627 
628  //----- pack modelFlag
629  i = instance_block.modelFlag;
630  comm->pack(&i, 1, buf, bsize, pos );
631 
632  //----- pack sourceFlag
633  i = instance_block.sourceFlag;
634  comm->pack(&i, 1, buf, bsize, pos );
635 
636  //----- pack bsourceFlag
637  i = instance_block.bsourceFlag;
638  comm->pack(&i, 1, buf, bsize, pos );
639 
640  //----- pack offFlag
641  i = instance_block.offFlag;
642  comm->pack(&i, 1, buf, bsize, pos );
643 
644  //----- pack off
645  i = instance_block.off;
646  comm->pack(&i, 1, buf, bsize, pos );
647 
648  //----- pack name
649  length = instance_block.netlistLocation_.getFilename().length();
650  comm->pack(&length, 1, buf, bsize, pos );
651  comm->pack( instance_block.netlistLocation_.getFilename().c_str(), length, buf, bsize, pos );
652 
653  //----- pack lineNumber_
654  int line_number = instance_block.netlistLocation_.getLineNumber();
655  comm->pack(&line_number, 1, buf, bsize, pos );
656 
657  if (DEBUG_TOPOLOGY)
658  Xyce::dout() << "Packed " << pos << " bytes for InstanceBlock: " << instance_block.getInstanceName() << std::endl;
659 
660 #ifdef Xyce_COUNT_PACKED_BYTES
661  if (pos != predictedPos)
662  {
663  DevelFatal(*this, "InstanceBlock::pack") << "Predicted pos does not match actual pos";
664  }
665 #endif
666 }
667 
668 //-----------------------------------------------------------------------------
669 // Function : InstanceBlock::unpack
670 // Purpose : Unpacks InstanceBlock from char buffer using MPI_UNPACK
671 // Special Notes :
672 // Scope : public
673 // Creator : Rob Hoekstra, SNL, Parallel Computational Sciences
674 // Creation Date : 5/24/00
675 //-----------------------------------------------------------------------------
676 template<>
677 void
678 Pack<Device::InstanceBlock>::unpack(Device::InstanceBlock &instance_block, char * pB, int bsize, int & pos, N_PDS_Comm * comm)
679 {
680 
681  int size, length;
682  int i;
683 
684  //----- unpack name
685  comm->unpack( pB, bsize, pos, &length, 1 );
686  instance_block.name_ = Device::InstanceName(std::string( (pB+pos), length));
687  pos += length;
688 
689  //----- unpack getModelName()
690  comm->unpack( pB, bsize, pos, &length, 1 );
691  instance_block.modelName_ = std::string( (pB+pos), length);
692  pos += length;
693 
694  //----- unpack params
695  comm->unpack( pB, bsize, pos, &size, 1 );
696  instance_block.params.clear();
697  Device::Param dp;
698  for( i = 0; i < size; ++i )
699  {
700  Pack<Device::Param>::unpack(dp, pB, bsize, pos, comm );
701  instance_block.params.push_back( dp );
702  }
703 
704  //----- unpack iNumNodes
705  comm->unpack( pB, bsize, pos, &instance_block.iNumNodes, 1 );
706 
707  //----- unpack numIntVars
708  comm->unpack( pB, bsize, pos, &instance_block.numIntVars, 1 );
709 
710  //----- unpack numExtVars
711  comm->unpack( pB, bsize, pos, &instance_block.numExtVars, 1 );
712 
713  //----- unpack numStateVars
714  comm->unpack( pB, bsize, pos, &instance_block.numStateVars, 1 );
715 
716  //----- unpack modelFlag
717  comm->unpack( pB, bsize, pos, &i, 1 );
718  instance_block.modelFlag = ( i != 0 );
719 
720  //----- unpack sourceFlag
721  comm->unpack( pB, bsize, pos, &i, 1 );
722  instance_block.sourceFlag = ( i != 0 );
723 
724  //----- unpack bsourceFlag
725  comm->unpack( pB, bsize, pos, &i, 1 );
726  instance_block.bsourceFlag = ( i != 0 );
727 
728  //----- unpack offFlag
729  comm->unpack( pB, bsize, pos, &i, 1 );
730  instance_block.offFlag = ( i != 0 );
731 
732  //----- unpack off
733  comm->unpack( pB, bsize, pos, &i, 1 );
734  instance_block.off = ( i != 0 );
735 
736  //----- unpack netlistFilename_
737  comm->unpack( pB, bsize, pos, &length, 1 );
738  instance_block.netlistLocation_.setFilename(std::string( (pB+pos), length));
739  pos += length;
740 
741  //----- unpack lineNumber_
742  int line_number = 0;
743  comm->unpack( pB, bsize, pos, &line_number, 1 );
744  instance_block.netlistLocation_.setLineNumber(line_number);
745 
746  if (DEBUG_TOPOLOGY)
747  Xyce::dout() << "Unpacked " << pos << " bytes for InstanceBlock: " << instance_block.getInstanceName() << std::endl;
748 }
749 
750 } // namespace Xyce
ModelBlock(const std::string &name="", const std::string &type="", int level=1)
Pure virtual class to augment a linear system.
Devices and models are each named.
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())
ModelBlock & operator=(const ModelBlock &right)
std::string type_
Model type.
const ModelName & getModelName() const
InstanceName name_
Device instance name.
InstanceBlock & operator=(const InstanceBlock &right)
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.