summaryrefslogtreecommitdiffstats
path: root/sources/over1.cpp
blob: 35b6ced6b041b234d3e4e187a5cfc98061432acd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
//-*- mode: c++; indent-tabs-mode: t; coding: utf-8; show-trailing-whitespace: t -*-

// file over1.cpp

#include "over1.hpp"

namespace over1 {

  // subroutine over1.
  void over1(void)
  {
    long int i;
    long int j;
    long int ll1, ll8, ll80;
    long int n1, n5, n6, n7, n9;
    long int nIAdQQ;
    long int nIDA;
    long int nIFKC;
    long int nIP;
    long int nIsWent;
    long int nIY;
    long int nNFDBR;
    long int nNFDHST;
    long int nNFDPH;
    long int nNFDPol;
    long int nNGroup;
    long int nNK;
    long int nNMAuto;
    long int nNTLin;
    long int nNTurn;
    long int nNumBCO;
    long int nNumNam;
    long int pLSTACS[] = { 20, 90, 100, 20, 30, 250, 350, 60 };
    double d1, d2, d3, d13;
    double nPU;
    double nZNVRef;
    void *pLU2 = nullptr;
    void *pLU6 = nullptr;
    std::string sBus;
    std::string sDiskFileName;
    std::string sText2("name  ");
    std::string sText6("copy  ");
    std::string sText1("tacs o");
    std::string sText3("tacs h");
    std::string sText4("tacs s");
    std::string sText5("4     ");
    std::string sText7("tacs  ");
    //
    auto start_again = [ & ](void)
    {
      long int j;
      //
      blkcom::pIAlter = blkcom::pLFiles[ 1 ];
      if(blkcom::nNOutPR == 0)
	(*reinterpret_cast<std::ostream *>(blkcom::pKFile6)) << "+Continue partially-completed data case." << std::endl;
      if(blkcom::sTexCol[ 12 ] == sText5[ 0 ])
	goto a2861;
      blkcom::sABuff >> sDiskFileName;
      for(j = 1; j <= 2; j++) {
	n7 = sDiskFileName.find(',');
	sDiskFileName.replace(0, n7, " ");
      }
      for(j = n7; j <= 80; j++)
	if(sDiskFileName[ j - 1 ] != ' ')
	  break;
      std::cout << " name of old pl4 file  disk_file(j : 80) = " << sDiskFileName.substr(j, 80) << std::endl;
      blkcom::pLFiles[ 76 ] = nullptr;
      blkcom::pLFiles[ 76 ] = (void *) new std::ifstream;
      if(blkcom::pLFiles[ 76 ]) {
	reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ]) -> open(sDiskFileName.substr(j, 80).c_str(), std::ios::in);
      }
      std::cout << " 1st record.  numnam, numnvo, numbco, numbrn =" << nNumNam << dekplt::nNumNVO << nNumBCO << dekplt::nNumBrn << std::endl;
      if(((blkcom::nLBus + blkcom::pSStat -> m_nSize7) >= nNumNam) && \
	 (blkcom::pSStat -> m_nSize12 >= dekplt::nNumNVO) &&	      \
	 (blkcom::nLBranch >= dekplt::nNumBrn))
	goto a2859;
      (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Temporary error stop in \"over1\".  Program dimensioning is inadequate.  numnam, numnvo, numbrn =" << std::setfill(' ') << std::setw(8) << blkcom::nNumName << blkcom::nNumNVO << blkcom::nNumBRN << std::endl;
      if(blkcom::pLFiles[ 76 ]) {
	reinterpret_cast<std::ifstream *>(blkcom::pLFiles) -> close();
	delete blkcom::pLFiles[ 76 ];
      }
      stoptp();

    a2859:
      reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ]) -> seekg(0, std::ios::beg);
      n8 = blkcom::nLBus;
      if(blkcom::nLBus >= blkcom::nNumNam)
	n8 = blkcom::nNumNam - 1;
      std::cout << " New name logic. n8, numnam, lbus =" << n8 << blkcom::nNumNam << blkcom::nLBus << std::endl;
      (*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) << datexx << tcloxx << blkcom::nNumNam << blkcom << nNumNVO << blkcom::nNumBCO << blkcom::nNumBRN;
      for(j = 1; j <= n8; j++)
	(*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) >> blkcom::sBus[ j - 1 ];
      std::cout << " bus(1 : n8) =";
      for(j = 1; j <= n8; j++)
	std::cout << blkcom::sBus[ j - 1 ] << " ";
      std::cout << std::endl;

    a2859:
      reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ]) -> seekg(0, std::ios::beg);
      blkcom::nNum888 = blkcom::nNumNam - n8;
      std::cout << " Ready for final, full read with  num888 =" << blkcom::nNum888 << std::endl;
      (*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) >> datexx >> tcloxx >> blkcom::nNumNam >> blckom::nNumNVO >> blkcom::nNumBCO >> blkcom::nNumBRN;
      for(j = 1; j <= n8; j++)
	(*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) >> blkcom::sBus[ j - 1 ];
      for(j = 1; j <= blkcom::nNum888; j++)
	(*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) >> blkcom::pTexVec[ j - 1 ];
      std::cout << " After all named are read.  Next, ibsout." << std::endl;
      if(blkcom::nNumNVO > 0)
	for(j = 1; j <= blkcom::nNumNVO)
	  (*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) >> blkcom::pIBSOut[ j - 1 ];
      std::cout << " After ibsout.  Next, ...." << std::endl;
      if(blkcom::nNumBRN > 0)
	for(j = 1; j <= blkcom::nNumBRN)
	  (*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) >> blkcom::sMBus[ j - 1 ];
      std::cout << " After kbus, mbus." << std::endl;
      (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 3 ])) << blkcom::sDate1 << blkcom::sTClock << blkcom::nNumNam << blkcom::nNumNVO << blkcom::nNumBCO << blkcom::nNumBRN;
      for(j = 1; j <= n8; j++)
	(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 3 ])) << blkcom::sBus[ j - 1 ];
      for(j = 1; j <= blkcom::nNum888; j++)
	(*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 3 ])) << blkcom::sTexVec[ j - 1 ];
      std::cout << " over1, lunit4 date and time =" << blkcom::pDate1[ 0 ] << blkcom::pDate1[ 1 ] << " " << blkcom::pTClock[ 0 ] << blkcom::pTClock[ 1 ] << std::endl;
      if(blkcom::nNumNVO > 0)
	for(j = 1; j <= blkcom::nNumNVO; j++)
	  (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 3 ])) << blkcom::pIBSOut[ j - 1 ];
      if(blkcom::nNumBRN > 0)
	for(j = 1; j <= blkcom::nNumBRN; j++)
	  (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 3 ])) << blkcom::pKBus[ j - 1 ] << blkcom::pMBus[ j - 1 ];
      n18 = blkcom::nNumNVO + blkcom::nNumBRN + 1;
      std::cout << " Enter loop over numbers.  n18 =" << n18 << std::endl;
      j = 1;
      FOREVER {
	for(k = 1; k <= n18; k++) {
	  (*reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ])) >> labcom::sR4[ k - 1 ];
	  if(reinterpret_cast<std::ifstream *>(blkcom::pLFiles[ 76 ]) -> eof())
	    goto a6539;
	}
	if((blkcom::nIprsUp == 7) || (blkcom::nIprsUp > 9))
	  std::cout << " j, r4(1) =" << j << labcom::sR4[ 0 ];\
	if(sR4[ 0 ] == -9999.0e0)
	  break;
	for(k = 1; k <= n18; k++)
	  (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 3 ])) << labcom::sR4[ k - 1 ];
	++j;
      }

    a6539:
      std::cout << " Done transferring lun77 to lunit(4).  j =" << j << std::endl;
      runtym(d1, d2);
      n18 = pLocker[ 0 ];
      n19 = pLocker[ 1 ];
      pfatch();
      tables();
      std::cout << " n18, n19, locker(1), locker(2) =" << n18 << n19 << pLocker[ 0 ] << pLocker[ 1 ] << std::endl;
      blkcom::pFLStat[ 0 ] = -d1;
      blkcom::pFLStat[ 1 ] = -d2;
      if((n18 == pLocker[ 0 ]) && (n19 == pLocker[ 1 ]))
	goto a2863;
      blkcom::nKill = 201;
      blkcom::sStat.m_nTACST = 2861;
    };
    auto absolute_TACS_dimensions = [ & ](void)
    {
      if(blkcom::nNOutPR == 0)
	(*reinterpret_cast<std::ostream *>(blkcom::pKFile6)) << "+Set absolute TACS list size limits." << std::endl;
      // To do.
    };
    auto relative_TACS_dimensions = [ & ](void)
    {
      if(blkcom::nNOutPR == 0)
	(*reinterpret_cast<std::ostream *>(blkcom::pLFile6)) << "+Proportional allocation of total TACS storage." << std::endl;
      cimage();
      if(blkcom::nKolBeg > 0)
	goto a7120;
      expchk(ll1, ll80, ll8);
      if(blkcom::nKill > 0)
	goto a9200;
      for(i = 1; i <= 10; i++)
	blkcom::sABuff >> labcom::sVoltBC[ i - 1 ];
      goto a7130;

    a7120:
      blkcom::nNFrFld = 10;
      freeOne(sVoltBC);

    a7130:
      if(blkcom::nNOutPR == 0)
	(*reinterpret_cast<std::ostream *>(blkcom::pKFile6)) "+Relative list sizes." << labcom::sVoltBC[ 0 ] << labcom::sVoltBC[ 1 ] << labcom::sVoltBC[ 2 ] << std::endl;
      d1 = 0.0e0;
      for(i = 1; i <= 8; i++)
	d1 += labcom::sVoltBC[ i - 1 ];
      d1 = blckom::nLTACST * blkcom::pNByte[ 2 ] / d1;
      pLSTACS[ 0 ] = (long int) (labcom::sVoltBC[ 0 ] * d1 / (4 * blkcom::pNByte[ 2 ] + 8 * blkcom::pNByte[ 3 ]));
      pLSTACS[ 1 ] = (long int) (labcom::sVoltBC[ 1 ] * d1 / (2 * blkcom::pNByte[ 2 ] + blkcom::pNByte[ 3 ]));
      pLSTACS[ 2 ] = (long int) (labcom::sVoltBC[ 2 ] * d1 / (2 * blkcom::pNByte[ 3 ]));
      pLSTACS[ 3 ] = (long int) (labcom::sVoltBC[ 3 ] * d1 / (5 * blkcom::pNByte[ 2 ] + blkcom::pNByte[ 3 ]));
      pLSTACS[ 4 ] = (long int) (labcom::sVoltBC[ 4 ] * d1 / (3 * blkcom::pNByte[ 3 ]));
      pLSTACS[ 5 ] = (long int) (labcom::sVoltBC[ 5 ] * d1 / blkcom::pNByte[ 3 ]);
      PLSTACS[ 6 ] = (long int) (labcom::sVoltBC[ 6 ] * d1 / blkcom::pNByte[ 2 ]);
      pLSTACS[ 7 ] = (long int) (labcom::sVoltBC[ 7 ] * d1 / (6 * blkcom::pNByte[ 2 ] + 2 * blkcom::pNByte[ 3 ]));
    };
    auto read_input_card = [ & ](void)
    {
      cimage();
      for(i = 1; i <= 14; i++)
	blkcom::sABuff >> blkcom::sAUpper[ i - 1 ];
      if(strcom::toLower(blkcom::sAUpper[ 0 ]) == sText1)
	goto a2697;
      if(strcom::toLower(blkcom::sAUpper[ 0 ]) == sText3)
	goto a2697;
      if(strcom::toLower(blkcom::sAUpper[ 0 ]) == sText4)
	goto a2699;
      if(strcom::toLower(blkcom::sAUpper[ 0 ]) == sText6)
	goto a7722;
      (*reinterpret_cast<std::ostream *>(blkcom::pKFile6)) << " Begin TACS. " << std::string(27, ' ') << std::endl;
      blkcom::nNewTAC = 1;
      blkcom::nNTCSEX = 1;
      blkcom::nNIUNRS = 1;
      std::cout << " Prepare to call ntacs1 from over1." << std::endl;
      ntacs1();
      std::cout << " Back from ntacs1, back in over1." << std::endl;
      goto a4284;

    a2697:
      blkcom::nNTCSEX = 1;

    a2699:
      n1 = 1;
      if(blkcom::nNOutPR != 0)
	goto a2691;
      if(blckom::nNTCSEX == 0)
	goto a22699;
      if(blckom::nNOutPR == 0)
	(*reinterpret_cast<std::ostream *>(blkcom::pKFile6)) << "+TACS hyvrid setup.  TACS data cards follow." << std::endl;
      // 1984 format(18x, i2)

      char *pTemp[ 20 ];
      blkcom::sABuff.read(pTemp, 18);
      blkcom::sABuff >> blkcom::sLStat[ 51 ];
      goto a2691;

    a4281:
      if(n1 == 0)
	goto a4284;
      move(blkcom::pLSTACS, &blkcom::pLStat[ 60 ], ll8);
      blkcom::nKTab = 1;
      tacs1();
      if(blkcom::nKill > 0)
	goto a9200;
      if((blkcom::nNTCSEX + blkcom::nNSTACS) > 0)
	goto a4276;
      blkcom::nIndStp = 1;
      blkcom::LimStp = blkcom::pKprChg[ 0 ];
      runtym(d1, d2);
      blkcom::pFLStat[ 0 ] += d1;
      blkcom::pFLStat[ 1 ] += d2;
      blkcom::pFLStat[ 6 ] -= d1;
      blkcom::pFLStat[ 7 ] -= d2;
      blkcom::nChain = 12;
    };
    //
    // over1 main function body.
    //
    ll8 = LL8;
    ll80 = LL80;
    //
    if(blkcom::nIprsUp >= 1)
      (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "Begin module over1." << std::endl;
    nPU = std::numeric_limits<double>::infinity();
    movecopy::move0<long int>(blkcom::pKTRLSW, LL6);
    movecopy::move0<long int>(blkcom::pIpnTV, LL11);
    movecopy::move0<long int>(blkcom::pLoopSS, LL11);
    blkcom::sMonCar.m_nUserSST = 0;
    nNMAuto = 0;
    umcom::pBUSUM[ 0 ] = sText2;
    blkcom::nNRight = 0;
    blkcom::nIofgnd = 0;
    blkcom::nMolDat = 0;
    blkcom::nIStep = 0;
    blkcom::sMonCar.m_nKLoaEP = 0;
    blkcom::nTEnerg = 1e+20;
    blkcom::sBranch = sText2;
    blkcom::sCopy = sText6;
    blkcom::nIAlter = 0;
    blkcom::nIsPrin = 0;
    blkcom::nIsPlot = 0;
    blkcom::nIndStp = 1;
    blkcom::nNOutPR = 0;
    blkcom::pLFiles[ 0 ] = reinterpret_cast<void *>(&std::cerr);
    blkcom::pLFiles[ 4 ] = reinterpret_cast<void *>(&std::cin);
    blkcom::pLFiles[ 5 ] = reinterpret_cast<void *>(&std::cout);
    blkcom::pKFile6 = blkcom::pLFiles[ 5 ];
    blkcom::pPeakND[ 0 ] = 0.0;
    blkcom::nKBurro = 0;
    // Assign default relative precision for 6 EMTP variable types.
    // 1 --- alphanumeric                 2 --- complex
    // 3 --- floating-point numeric       4 --- integer numeric
    // 5 --- 3 of 'subr31'                6 --- 4 of 'subr31'
    // setting all equal to unity means that all have equal length.
    for(j = 1; j <= 6; j++)
      blkcom::pNByte[ j - 1 ] = 1;
    emtp::dimens(blkcom::sLStat,					\
		 blkcom::nChain,					\
		 blkcom::sBus1,						\
		 blkcom::sBus2);
    /*
    blkcom::nLBus = blkcom::sLStat[ 0 ];
    blkcom::nLBrnch = blkcom::sLStat[ 1 ];
    blkcom::nLData = blkcom::sLStat[ 2 ];
    blkcom::nLExct = blkcom::sLStat[ 3 ];
    blkcom::nLYMat = blkcom::sLStat[ 4 ];
    blkcom::nLSwtch = blkcom::sLStat[ 5 ];
    blkcom::nLSize7 = blkcom::sLStat[ 6 ];
    blkcom::nLPast = blkcom::sLStat[ 7 ];
    blkcom::nLNonL = blkcom::sLStat[ 8 ];
    blkcom::nLChar = blkcom::sLStat[ 9 ];
    blkcom::nLSMOut = blkcom::sLStat[ 10 ];
    blkcom::nLSize12 = blkcom::sLStat[ 11 ];
    blkcom::nLFDep = blkcom::sLStat[ 12 ];
    blkcom::nLWT = blkcom::sLStat[ 13 ];
    blkcom::nLTails = blkcom::sLStat[ 14 ];
    blkcom::nLIMass = blkcom::sLStat[ 15 ];
    blkcom::nLSyn = blkcom::sLStat[ 16 ];
    blkcom::nMaxPE = blkcom::sLStat[ 17 ];
    blkcom::nLTCST = blkcom::sLStat[ 18 ];
    blkcom::nLFSem = blkcom::sLStat[ 19 ];
    blkcom::nLFD = blkcom::sLStat[ 20 ];
    blkcom::nLHist = blkcom::sLStat[ 21 ];
    blkcom::nLSize23 = blkcom::sLStat[ 22 ];
    blkcom::nLComp = blkcom::sLStat[ 23 ];
    blkcom::nLSPCum = blkcom::sLStat[ 24 ];
    blkcom::nLSize26 = blkcom::sLStat[ 25 ];
    blkcom::nLSize27 = blkcom::sLStat[ 26 ];
    blkcom::nLSize28 = blkcom::sLStat[ 27 ];
    */
    //    memcpy((void *) &blkcom::sSStat,				\
    //	   (void *) blkcom::sLStat.data(),				\
    //sizeof(blkcom::tStat));
    blkcom::pSStat = blkcom::sLStat.data()
    // Assign 'n1' equal to the number of EMTP lists of variable
    // dimensioning (of the solution overlays).
    //n1 = 27;
    //blkcom::nLTLabl = blkcom::sLStat[ n1 + 1 ];
    comlock::pLocker[ 0 ] = blkcom::sBus1;
    comlock::pLocker[ 1 ] = blkcom::sBus2;
    d13 = blkcom::pSStat -> m_nTACST;
    d13 /= 1600.;
    for(j = 1; j <= 8; j++)
      pLSTACS[ j - 1 ] *= d13;
    n1 = -9999;
    movecopy::copy<long int>(n1, blkcom::sLStat, LL60);
    sysdep();
    movecopy::move0<double>(blkcom::sFLStat, LL20);
    date_time::runtym(d1, d2);
    blkcom::sFLStat[ 0 ] -= d1;
    blkcom::sFLStat[ 1 ] -= d2;
    blkcom::nTenM6 = pow(blkcom::nTenM3, 2.0);
    blkcom::nMaxZNO = 50;
    blkcom::nEpsZNo = blkcom::nEpsilon;
    blkcom::nEpWarn = blkcom::nTenM3;
    blkcom::nEpStop = 0.1;
    blkcom::pZNoLim[ 0 ] = 1.0;
    blkcom::pZNoLim[ 1 ] = 1.5;
    blkcom::sMonCar.m_nKBase = 0;
    blkcom::sMonCar.m_nISW = 0;
    blkcom::pKPrChg[ 0 ] = -7777;
    blkcom::nJFLSOS = 0;
    // rewind lunit1
    // rewind lunit3
    // rewind lunit4
    blkcom::sMonCar.m_nKnt = 1;
    blkcom::sMonCar.m_pMTape = blkcom::pLFiles[ 4 ];
    blkcom::nIFDep = 0;
    blkcom::nNTCSex = 0;
    blkcom::nNSTACS = 0;
    blkcom::nKanal = 0;

    // Initialize KPARTB with nonzero value so later minus
    // sign can be applied as flag of "renumber bypass" usage:
    blkcom::nKPartB = 1000;

    // SYSDEP will redefine if low-prec. Complex ("cable constants"):
    nZNVRef = 0.0;
    blkcom::nFMaxFS = 0.0;
    blkcom::pBegMax[ 0 ] = 0.0;
    blkcom::pBegMax[ 1 ] = 0.0;
    blkcom::pBegMax[ 2 ] = std::numeric_limits<double>::infinity();
    blkcom::nKTRef = 0;
    blkcom::nNComp = 0;
    blkcom::nNumSM = 0;
    blkcom::nNumUM = 0;
    blkcom::nNumOut = 0;
    blkcom::nKill = 0;
    blkcom::nNum99 = 0;
    blkcom::nModOut = 0;
    blkcom::pInEcho = nullptr;
    sBus = blkcom::sBlank;
    blkcom::nIAverg = 0;
    movecopy::move0<int>(labcom::sISourc, blkcom::sSStat.m_nSwitch);
    movecopy::move0<int>(labcom::sKodeBR, blkcom::sSStat.m_nBranch);
    movecopy::move0<int>(labcom::sKodSem, blkcom::sSStat.m_nBranch);
    movecopy::move0<int>(labcom::sLength, blkcom::sSStat.m_nBranch);
    movecopy::move0<int>(labcom::sIndHst, blkcom::sSStat.m_nBranch);
    movecopy::move0<double>(labcom::sBValue, blkcom::sSStat.m_nSize12);
    nIsWent = 1;
    blkcom::nOmega = 0.0;
    blkcom::nDegMin = 0.0;
    blkcom::nDegMax = 0.0;
    blkcom::nSglFir = 2.0 * M_PI;
    blkcom::nJST = 0;
    blkcom::nJST1 = 1;
    blkcom::nIFDep2 = 1;
    blkcom::nIAdd = 0;
    blkcom::nIFSem = 0;
    //
    com2::nIDM = 1;
    com2::nIDQ = 1;
    com2::nIDU = 1;
    com2::nIDT = 1;
    nIAdQQ = 1;
    com2::nIQ = 0;
    com2::nIDA = 0;
    com2::nIDY = 0;
    com2::nIFKC = 0;
    nNK = 0;
    nNGroup = 0;
    nNTurn = 0;
    nNFDBR = 0;
    nNFDPH = 9;
    nNFDHST = 5400;
    // nNFDPOL = 25;
    nNFDPol = 30;
    nNTLin = 0;
    // pLU2 = ...
    pLU6 = blkcom::pLFiles[ 5 ];

  a5223:
    blkcom::nIFX = 0;
    nIP = 2;
    nIY = 2;
    blkcom::nICat = 0;
    if(blkcom::nNOutPR != 0)
      goto a15;
    if(blkcom::nKol132 == 132)
      goto a6452;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " *********  Begin \"M40.\" EMTP solution.";
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "   Size /label/ =";
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(7) << std::setfill(' ') << std::dec;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << blkcom::sSStat.m_nTLabl;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "  integer words." << std::endl;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " list limits  1-10 :";
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nBus;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nBranch;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nData;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nExct;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nYMat;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nSwitch;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nSize7;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nPast;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nNOnL;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nChar << std::endl;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " list limits 11-20 :";
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nSMOut;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nSize12;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nFDep;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nWT;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nTails;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nIMass;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nSyn;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nMaxPE;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nTACST;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(6) << std::dec << blkcom::sSStat.m_nFSem << std::endl;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " list limits 21-end:";
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nFD;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nHist;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize23;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nComp;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSPCum;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize26;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize27;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize28 << std::endl;
    goto a15;

  a6452:
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Associated user documentation is the 864-page EMTP rule book dated  June, 1984.   Version M43.   Vardim time/date =";
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << comlock::pLocker[ 0 ] << comlock::pLocker[ 1 ] << std::endl;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Independent list limits follow.    Total length of /label/  equals ";
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(8) << std::dec << blkcom::sSStat.m_nTLabl;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "  integer words.   ";
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nBus;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nBranch;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nData;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nExct;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nYMat;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSwitch << std::endl;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize7;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nPast;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nNOnL;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nChar;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSMOut;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize12;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nFDep;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nWT;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nTails;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nIMass;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSyn;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nMaxPE;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nTACST;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nFSem;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nFD;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nHist;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize23;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nComp;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSPCum;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize26;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize27;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setw(6) << std::setfill(' ') << std::dec << blkcom::sSStat.m_nSize28 << std::endl;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(51, '-') << "+" << std::string(80, '-') << std::endl;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " Descriptive interpretation of new-case input data  |" << std::flush;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " input data card images printed below, all 80 columns, character by character." << std::endl << std::flush;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(51, ' ') << "|" << std::flush;
    for(i = 1; i <= 8; i++) {
      (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(9, ' ') << std::flush;
      (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::setfill(' ') << std::setw(1) << std::dec << i << std::flush;
    }
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(51, ' ') << "|" << std::flush;
    for(i = 1; i <= 8; i++)
      (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::string(9, ' ') << "0" << std::flush;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << std::endl << std::flush;
    (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << " " << std::string(51, '-') << "+" << std::string(80, '-') << std::endl;

  a15:
    FOREVER {
      emtp::cimage();
      if(blkcom::nKill > 0)
	goto a9200;
      blkcom::nNRight = -2;
      n9 = blkcom::nKolBeg;
      blkcom::nKolBeg = 1;
      blkcom::sTexCol = blkcom::sABuff.str().substr(0, 80);
      freedom::freeOne(d1);

    a3247:
      blkcom::nNRight = 0;
      if(n9 == -std::numeric_limits<long int>::infinity())
	blkcom::nKolBeg = n9;
      if(blkcom::nNFrFld > 0)
	goto a3280;
      if(blkcom::nNOutPR == 0)
	(*reinterpret_cast<std::ostream *>(blkcom::pKFile6)) << "+Blank termination-of-run card." << std::endl;
      interp();
      blkcom::nIVolt = 7777;

    a3273:
      blkcom::nKill = 9999;
      blkcom::nChain = 31;
      goto a9800;

    a3280:
      reques();
      i = sStat.m_nMaxPE;
      switch(i) {
      case 0:

      a2843:
	if((blkcom::nNOutPR != 0) && (blkcom::nIprsUp > 0))
	  blkcom::nNOutPR = 0;
	blkcom::nXOpt = blkcom::nStatFR;
	blkcom::nCOpt = blkcom::nStatFR;
	blkcom::nKolBeg = n9;
	if(blkcom::nKolBeg > 0)
	  goto a4201;
	utilities::expchk(ll1, ll80, ll8);
	if(blkcom::nKill > 0)
	  goto a9200;
	blkcom::sABuff >> blkcom::nDeltaT >> blkcom::nTMax >> d1 >> d2 >> d3 >> blkcom::nTolMat >> blkcom::nT;
	if(blkcom::nT == 0.0)
	  blkcom::nT = 0.0e0;
	goto a4202;

      a4201:
	blkcom::nNFrFld = 1;
	blkcom::nNRight = 0;
	freedom::freeOne(blkcom::nDeltaT);
	freedom::freeOne(blkcom::nTMax);
	freedom::freeOne(d1);
	freedom::freeOne(d2);
	freedom::freeOne(d3);
	freedom::freeOne(blkcom::nTolMat);
	freedom::freeOne(blkcom::nT);

      a4202:
	if(blkcom::nNOutPR == 0)
	  (*reinterpret_cast<std::ostream *>(blkcom::pKFile6)) << "+Misc. data." << std::setfill(' ') << std::setw(12) << blkcom::nDeltaT << blkcom::nTMax << d1 << std::endl;
	if(blkcom::nIofbnd != 33666)
	  goto a4206;
	blkcom::nChain = 41;
	blkcom::nXOpt = d1;
	goto a9800;
	break;

      case 11:
	goto a3273;
	break;

      case 15:
	start_again();
	goto a9200;
	break;

      case 28:
	goto a3247;
	break;

      case 32:
	absolute_TACS_dimensions();
	goto a15;
	break;

      case 33:
	relative_TACS_dimensions();
	goto a15;
	break;

      case 34:
	goto a523;
	break;

      case 38:
	goto a15;
	break;

      case 40:
	goto a4308;
	break;
      }
      if(blkcom::nKill > 0)
	goto a9200;
      if(blkcom::nChain != 1)
	goto a9800;
    }

  a4276:
    blkcom::nChain = 12;
    goto a9800;

  a4284:
    blkcom::nChain = 2;
    goto a9800;

  a9200:
    blkcom::nChain = 51;
    blkcom::sLStat[ 17 ] = 1;

  a9800:
    blkcom::nLastOV = 1;
    n5 = (size_t) &nIDA;
    n6 = (size_t) &nIFKC;
    if(blkcom::nIprsUp >= 1)
      (*reinterpret_cast<std::ostream *>(blkcom::pLFiles[ 5 ])) << "Exit module over1." << std::endl;

  a99999:
    return;
  }

  // subroutine tacs1c.
  void tacs1c(void)
  {
    // To do.
  }

  // subroutine swmodf.
  void swmodf(void)
  {
    // To do.
  }

  // subroutine reques.
  void reques(void)
  {
    // To do.
  }

  // subroutine sysdep.
  void sysdep(void)
  {
    std::string sCol("");
    std::string sColXXX("plt00000000000.pl4");
    std::string sLettra("a");
    std::string sLettrb("b");
    std::string sLettrc("c");
    std::string sBusNM1("      ");
    std::string sBusNM2("........");
    std::string sBusNM3("terra");
    std::string sText1 = ",";
    std::string sText2 = "$";
    //
    sCol = sColXXX;
    // To do.
    blkcom::sBlank = sBusNM1;
    blkcom::sTrash = sBusNM2;
    blkcom::sTerra = sBusNM3;
    blkcom::cCSepar = sText1[ 0 ];
    blkcom::sChCont = sText2;
    blkcom::nTenM3 = 1.0e-3;
    blkcom::nUnity = 1.0e0;
    blkcom::nOneHaf = 0.5e0;
    blkcom::pNByte[ 0 ] = 2;
    blkcom::pNByte[ 1 ] = 2;
    blkcom::pKTRLSW[ 5 ] = 0;
    blkcom::pNByte[ 2 ] = 2;
    blkcom::nEpsilon = 1.0e-8;
    //blkcom::nTwoPI = 2.0 * M_PI;
    // To do.
  }

  // subroutine midov1.
  void midov1(void)
  {
    // To do.
  }

  // subroutine nmincr.
  void nmincr(std::string &, int &)
  {
    // To do.
  }

  // subroutine tacs1.
  void tacs1(void)
  {
    // To do.
  }

  // subroutine tacs1a.
  void tacs1a(void)
  {
    // To do.
  }

  // subroutine tacs1b.
  void tacs1b(void)
  {
    // To do.
  }

  // subroutine expchk.
  void expchk(int &, int &, int &)
  {
    // To do.
  }

  // subroutine intchk.
  void intchk(int &, int &, int &)
  {
    // To do.
  }

  // subroutine pfatch.
  void pfatch(void)
  {
    // To do.
  }

}

// end of file over1.cpp