aboutsummaryrefslogtreecommitdiff
path: root/src/InitialCopy.c
blob: 4c0ee87ed524cf2a95a2a04c9ebe523409c5a487 (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
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
 /*@@
   @file      InitialCopy.c
   @date      Sun May 26 04:43:06 2002
   @author    Ian Hawke
   @desc 
   Performs the initial copy from the previous timelevel to the
   current. This is required because the driver has rotated the 
   timelevels, but the physics thorns are expecting data in the
   current.
   @enddesc 
   @version   $Header$
 @@*/

#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "cctk.h"
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"

#include "ExternalVariables.h"
#include "Operators.h"

static const char *rcsid = "$Header$";

CCTK_FILEVERSION(CactusBase_MoL_InitialCopy_c);

/********************************************************************
 *********************     Local Data Types   ***********************
 ********************************************************************/

/********************************************************************
 ********************* Local Routine Prototypes *********************
 ********************************************************************/

/********************************************************************
 ***************** Scheduled Routine Prototypes *********************
 ********************************************************************/

void MoL_InitialCopy(CCTK_ARGUMENTS);

void MoL_InitRHS(CCTK_ARGUMENTS);

void MoL_FillAllLevels(CCTK_ARGUMENTS);

void MoL_ReportNumberVariables(CCTK_ARGUMENTS);

/********************************************************************
 ********************* Other Routine Prototypes *********************
 ********************************************************************/

/********************************************************************
 *********************     Local Data   *****************************
 ********************************************************************/

/********************************************************************
 *********************     External Routines   **********************
 ********************************************************************/

 /*@@
   @routine    MoL_InitialCopy
   @date       ???
   @author     Ian Hawke
   @desc 
   Copy the previous time level to the current time level.
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/

#include <sys/time.h>
static inline int64_t gettime(void)
{
    struct timeval tv;
    gettimeofday(&tv, NULL);
    return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
}

void MoL_InitialCopy(CCTK_ARGUMENTS)
{

  DECLARE_CCTK_ARGUMENTS;
  DECLARE_CCTK_PARAMETERS;
  
  cGroupDynamicData arraydata;
  CCTK_INT groupindex, ierr;
  CCTK_INT arraytotalsize, arraydim;
  CCTK_INT totalarrayscratchsize;

  CCTK_INT var;
  CCTK_INT totalsize;

  CCTK_REAL       * restrict CurrentVar;
  CCTK_REAL const * restrict PreviousVar;
  CCTK_REAL       * restrict ScratchVar;
  CCTK_INT StorageOn;

  double *y = CCTK_VarDataPtr(cctkGH, 0, "grid::y");
  double y_idx;

  for (int i = 0; i < cctk_ash[1]; i++) {
      if (fabs(y[CCTK_GFINDEX3D(cctkGH, 0, i, 0)]) < 1e-8) {
          y_idx = i;
          break;
      }
  }

  static int64_t time, count;
  int64_t start;

  start = gettime();

  totalsize = 1;
  for (arraydim = 0; arraydim < cctk_dim; arraydim++)
  {
    totalsize *= cctk_ash[arraydim];
  }

  for (var = 0; var < MoLNumEvolvedVariables; var++)
  {
    const int       nsrc = 1;
    const int       srcs[1] = {EvolvedVariableIndex[var]};
    const int       tls[1] = {1};
    const CCTK_REAL facts[1] = {1.0};
    
    StorageOn = CCTK_QueryGroupStorageI(cctkGH,
                                       CCTK_GroupIndexFromVarI(EvolvedVariableIndex[var]));
    
    if (StorageOn < 0)
    {
      CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,"Warning for index %i", 
                 EvolvedVariableIndex[var]);
      CCTK_WARN(0, "The index passed does not correspond to a GF.");
    }
    else if (StorageOn == 0) {
      CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,"Warning for GF %s", 
                 CCTK_VarName(EvolvedVariableIndex[var]));
      CCTK_WARN(0, "The grid function does not have storage assigned.");
    }
    
    MoL_LinearCombination(cctkGH, EvolvedVariableIndex[var], 0.0,
                          srcs, tls, facts, nsrc);
  }
    
  /* Set up the array sizes */

  if (MoLNumEvolvedArrayVariables)
  {
    if (!ArrayScratchSizes)
    {
      ArrayScratchSizes = (CCTK_INT *)malloc(MoLNumEvolvedArrayVariables * sizeof(CCTK_INT));
      if (!ArrayScratchSizes)
      {
        CCTK_WARN(0, "Failed to allocate the array scratch sizes array.");
      }
      for (var = 0; var < MoLNumEvolvedArrayVariables; var++)
      {
        ArrayScratchSizes[var] = -1;
      }
    }
  }
  
  totalarrayscratchsize = 0;

  for (var = 0; var < MoLNumEvolvedArrayVariables; var++)
  {
    PreviousVar = (CCTK_REAL const*)CCTK_VarDataPtrI(cctkGH, 1,
                                               EvolvedArrayVariableIndex[var]);
    CurrentVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 0,
                                              EvolvedArrayVariableIndex[var]);
    
    groupindex = CCTK_GroupIndexFromVarI(EvolvedArrayVariableIndex[var]);
    ierr = CCTK_GroupDynamicData(cctkGH, groupindex,
                                 &arraydata);
    if (ierr)
    {
      CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, 
                 "The driver does not return group information "
                 "for group '%s'.", 
                 CCTK_GroupName(groupindex));
    }
    arraytotalsize = 1;
    for (arraydim = 0; arraydim < arraydata.dim; arraydim++)
    {
      arraytotalsize *= arraydata.ash[arraydim];
    }

    ArrayScratchSizes[var] = arraytotalsize;
    totalarrayscratchsize += arraytotalsize;

    if (arraytotalsize)
    {  
      if (PreviousVar && CurrentVar)
      {      
        memcpy(CurrentVar, PreviousVar, arraytotalsize * sizeof(CCTK_REAL));
      }
      else
      {
        printf("The pointers are %p (prev) and %p (curr)\n.",
               PreviousVar, CurrentVar);
        CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,"Null pointer for variable %s", 
                   CCTK_VarName(EvolvedArrayVariableIndex[var]));
      }
    }
    
  }

  if (totalarrayscratchsize > CurrentArrayScratchSize)
  {
    if (ArrayScratchSpace)
    {
      free(ArrayScratchSpace);
      ArrayScratchSpace = NULL;
    }
    ArrayScratchSpace = 
      (CCTK_REAL*)malloc(totalarrayscratchsize * 
                         MoL_Num_Scratch_Levels * 
                         sizeof(CCTK_REAL));
    for (var = 0; var < totalarrayscratchsize * MoL_Num_Scratch_Levels; var++)
    {
      ArrayScratchSpace[var] = 0.0;
    }
    CurrentArrayScratchSize = totalarrayscratchsize;
  }
  


  /* 
     Now the Save and Restore variables. Shift the data in the 
     current level to the scratch space, then do the copy 
  */

  for (var = 0; var < MoLNumSandRVariables; var++)
  {

    StorageOn = CCTK_QueryGroupStorageI(cctkGH,
                                       CCTK_GroupIndexFromVarI(SandRVariableIndex[var]));
    
    if (StorageOn < 0)
    {
      CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,"Warning for index %i", 
                 SandRVariableIndex[var]);
      CCTK_WARN(0, "The index passed does not correspond to a GF.");
    }
    else if (StorageOn == 0) {
      CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,"Warning for GF %s", 
                 CCTK_VarName(SandRVariableIndex[var]));
      CCTK_WARN(0, "The grid function does not have storage assigned.");
    }

    PreviousVar = (CCTK_REAL const*)CCTK_VarDataPtrI(cctkGH, 1, 
                                               SandRVariableIndex[var]);
    CurrentVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 0, 
                                              SandRVariableIndex[var]);
    /*
      ScratchVar = &SandRScratchSpace[var*totalsize];
    */
    ScratchVar = CCTK_VarDataPtrI(cctkGH, 0, 
                                  CCTK_FirstVarIndex("MOL::SANDRSCRATCHSPACE")
                                  + var);
    if (PreviousVar && CurrentVar && ScratchVar)
    {      
      memcpy(ScratchVar, CurrentVar, totalsize * sizeof(CCTK_REAL));
      memcpy(CurrentVar, PreviousVar, totalsize * sizeof(CCTK_REAL));
    }
    else
    {
      CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,"Null pointer for variable %s", 
                 CCTK_VarName(SandRVariableIndex[var]));
    }
  }  

  /*
    Now do the constrained variables.
  */

  for (var = 0; var < MoLNumConstrainedVariables; var++)
  {

    StorageOn = CCTK_QueryGroupStorageI(cctkGH,
                                        CCTK_GroupIndexFromVarI(ConstrainedVariableIndex[var]));
    
    if (StorageOn < 0)
    {
      CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,"Warning for index %i", 
                 ConstrainedVariableIndex[var]);
      CCTK_WARN(0, "The index passed does not correspond to a GF.");
    }
    else if (StorageOn == 0) {
      CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,"Warning for GF %s", 
                 CCTK_VarName(ConstrainedVariableIndex[var]));
      CCTK_WARN(0, "The grid function does not have storage assigned.");
    }

    /* 
       Check that there is more than one timelevel.
       If not, copying is unnecessary.
    */

    StorageOn = CCTK_ActiveTimeLevelsVI(cctkGH,
                                        ConstrainedVariableIndex[var]);
    
    if (StorageOn > 1)
    {
      
      PreviousVar = (CCTK_REAL const*)CCTK_VarDataPtrI(cctkGH, 1, 
                                                 ConstrainedVariableIndex[var]);
      CurrentVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 0, 
                                                ConstrainedVariableIndex[var]);

      if (PreviousVar && CurrentVar)
      {     
#pragma omp parallel for
        for (int k = 0; k < cctk_ash[2]; k++) {
            int offset = CCTK_GFINDEX3D(cctkGH, 0, y_idx, k);
            memcpy(CurrentVar + offset, PreviousVar + offset, cctk_ash[0] * sizeof(double));
        }
      }
      else
      {
        CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,"Null pointer for variable %s", 
                   CCTK_VarName(ConstrainedVariableIndex[var]));
      }
      
    }
    
  }
  time += gettime() - start;
  count++;


  //if (!(count & 31))
  //    fprintf(stderr, "%ld %g %g\n", count, (double)time / 1000000.0, (double)time / count);

  
  return;
}

 /*@@
   @routine    MoL_InitRHS
   @date       Tue Mar 23 2004
   @author     Erik Schnetter
   @desc 
   Initialise all RHS variables with zero.
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/

void MoL_InitRHS(CCTK_ARGUMENTS)
{

  DECLARE_CCTK_ARGUMENTS;
  DECLARE_CCTK_PARAMETERS;
  
  cGroupDynamicData arraydata;
  CCTK_INT groupindex, ierr;
  CCTK_INT arraytotalsize, arraydim;

  CCTK_INT var;
  CCTK_INT index;
/*   CCTK_INT i,j,k; */
  CCTK_INT totalsize;

  CCTK_REAL * restrict RHSVar;
  CCTK_INT StorageOn;

  /* FIXME */

#ifdef MOLDOESCOMPLEX

  CCTK_COMPLEX * restsrict RHSComplexVar;

#endif

  totalsize = 1;
  for (arraydim = 0; arraydim < cctk_dim; arraydim++)
  {
    totalsize *= cctk_ash[arraydim];
  }

  for (var = 0; var < MoLNumEvolvedVariables; var++)
  {
    StorageOn = CCTK_QueryGroupStorageI(cctkGH,
                                       CCTK_GroupIndexFromVarI(RHSVariableIndex[var]));
    
    if (StorageOn < 0)
    {
      CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,"Warning for index %i", 
                 RHSVariableIndex[var]);
      CCTK_WARN(0, "The index passed does not correspond to a GF.");
    }
    else if (StorageOn == 0) {
#ifdef MOLDEBUG
      printf("Aargh! Vars %d var %d index %d name %s\n",
             MoLNumEvolvedVariables, var, RHSVariableIndex[var],  
                 CCTK_VarName(RHSVariableIndex[var]));
#endif
      CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,"Warning for GF %s", 
                 CCTK_VarName(RHSVariableIndex[var]));
      CCTK_WARN(0, "The grid function does not have storage assigned.");
    }
    
    MoL_LinearCombination(cctkGH, RHSVariableIndex[var], 0.0,
                          NULL, NULL, NULL, 0);
  }
    
  for (var = 0; var < MoLNumEvolvedArrayVariables; var++)
  {
    RHSVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, 0,
                                          RHSArrayVariableIndex[var]);
    
    groupindex = CCTK_GroupIndexFromVarI(RHSArrayVariableIndex[var]);
    ierr = CCTK_GroupDynamicData(cctkGH, groupindex,
                                 &arraydata);
    if (ierr)
    {
      CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING, 
                 "The driver does not return group information "
                 "for group '%s'.", 
                 CCTK_GroupName(groupindex));
    }
    arraytotalsize = 1;
    for (arraydim = 0; arraydim < arraydata.dim; arraydim++)
    {
      arraytotalsize *= arraydata.ash[arraydim];
    }

    if (arraytotalsize)
    {
      if (RHSVar)
      {
#pragma omp parallel for
        for (index = 0; index < arraytotalsize; index++)
        {
          RHSVar[index] = 0;
        }
      }
      else
      {
        printf("The pointer is %p (rhs)\n.",
               RHSVar);
        CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,"Null pointer for variable %s", 
                   CCTK_VarName(RHSArrayVariableIndex[var]));
      }
    }
    
  }

  /* FIXME */

#ifdef MOLDOESCOMPLEX

  for (var = 0; var < MoLNumEvolvedComplexVariables; var++)
  {
    
    StorageOn = CCTK_QueryGroupStorageI(cctkGH,
                                       CCTK_GroupIndexFromVarI(RHSComplexVariableIndex[var]));
    
    if (StorageOn < 0)
    {
      CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,"Warning for index %i", 
                 RHSComplexVariableIndex[var]);
      CCTK_WARN(0, "The index passed does not correspond to a GF.");
    }
    else if (StorageOn == 0) {
      CCTK_VWarn(1,__LINE__,__FILE__,CCTK_THORNSTRING,"Warning for GF %s", 
                 CCTK_VarName(RHSComplexVariableIndex[var]));
      CCTK_WARN(0, "The grid function does not have storage assigned.");
    }
    
    RHSComplexVar = (CCTK_COMPLEX*)CCTK_VarDataPtrI(cctkGH, 0, 
                                                    RHSComplexVariableIndex[var]);
    if (RHSVar)
    {
#pragma omp parallel for
      for (index = 0; index < totalsize; index++)
      {
        RHSVar[index] = 0;
      }
    }
    else
    {
      CCTK_VWarn(0,__LINE__,__FILE__,CCTK_THORNSTRING,"Null pointer for variable %s", 
                 CCTK_VarName(RHSComplexVariableIndex[var]));
    }

  }
  
#endif
  
  return;
}

 /*@@
   @routine    MoL_FillAllLevels
   @date       Fri Apr 25 16:11:18 2003
   @author     Ian Hawke
   @desc 
   This routine is a bit of a hack, and I'm still not convinced 
   it is really necessary. It fills the previous timelevels by 
   copying the data from the current timelevels, which should have
   been set up during the CCTK_INITIAL timebin.
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/

void MoL_FillAllLevels(CCTK_ARGUMENTS)
{

  DECLARE_CCTK_ARGUMENTS;
  DECLARE_CCTK_PARAMETERS;

  CCTK_INT var, level;
  CCTK_INT totalsize, arraydim;

  CCTK_REAL const * restrict CurrentVar;
  CCTK_REAL       * restrict PreviousVar;

  totalsize = 1;
  for (arraydim = 0; arraydim < cctk_dim; arraydim++)
  {
    totalsize *= cctk_ash[arraydim];
  }

  for (var = 0; var < MoLNumEvolvedVariables; var++)
  {
    CurrentVar = (CCTK_REAL const*)CCTK_VarDataPtrI(cctkGH, 0, 
                                              EvolvedVariableIndex[var]);
    for (level = 1; 
         level < CCTK_ActiveTimeLevelsVI(cctkGH,
                                         EvolvedVariableIndex[var]); 
         level++)
    {
      PreviousVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, level, 
                                                 EvolvedVariableIndex[var]);
      if (PreviousVar)
      {   
        memcpy(PreviousVar, CurrentVar, totalsize * sizeof(CCTK_REAL));
      }
    }
  }
  

  for (var = 0; var < MoLNumConstrainedVariables; var++)
  {
    CurrentVar = (CCTK_REAL const*)CCTK_VarDataPtrI(cctkGH, 0, 
                                              ConstrainedVariableIndex[var]);
    for (level = 1; level < CCTK_ActiveTimeLevelsVI(cctkGH,
                                                    ConstrainedVariableIndex[var]); level++)
    {
      PreviousVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, level, 
                                                 ConstrainedVariableIndex[var]);
      if (PreviousVar)
      {   
        memcpy(PreviousVar, CurrentVar, totalsize * sizeof(CCTK_REAL));
      }
    }
  }
  

  for (var = 0; var < MoLNumSandRVariables; var++)
  {
    CurrentVar = (CCTK_REAL const*)CCTK_VarDataPtrI(cctkGH, 0, 
                                              SandRVariableIndex[var]);
    for (level = 1; level < CCTK_ActiveTimeLevelsVI(cctkGH,
                                                    SandRVariableIndex[var]); 
         level++)
    {
      PreviousVar = (CCTK_REAL*)CCTK_VarDataPtrI(cctkGH, level, 
                                                 SandRVariableIndex[var]);
      if (PreviousVar)
      {   
        memcpy(PreviousVar, CurrentVar, totalsize * sizeof(CCTK_REAL));
      }
    }
  }

  return;
}

 /*@@
   @routine    MoL_ReportNumberVariables
   @date       Thu Jul 17 18:35:54 2003
   @author     Ian Hawke
   @desc 
   Prints some useful information about the number of
   registered functions.
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/

void MoL_ReportNumberVariables(CCTK_ARGUMENTS)
{

  DECLARE_CCTK_ARGUMENTS;
  DECLARE_CCTK_PARAMETERS;

  CCTK_INT var;
  
  CCTK_VInfo(CCTK_THORNSTRING,
             "The maximum number of evolved variables is %d. "
             "%d are registered.",
             MoL_Num_Evolved_Vars,MoLNumEvolvedVariables);

  CCTK_VInfo(CCTK_THORNSTRING,
             "The maximum number of constrained variables is %d. "
             "%d are registered.",
             MoL_Num_Constrained_Vars,MoLNumConstrainedVariables);
  
  CCTK_VInfo(CCTK_THORNSTRING,
             "The maximum number of SandR variables is %d. "
             "%d are registered.",
             MoL_Num_SaveAndRestore_Vars,MoLNumSandRVariables);
  

  CCTK_VInfo(CCTK_THORNSTRING,
             "The maximum number of evolved complex variables is %d. "
             "%d are registered.",
             MoL_Num_ComplexEvolved_Vars,MoLNumEvolvedComplexVariables);
  
  CCTK_VInfo(CCTK_THORNSTRING,
             "The maximum number of constrained complex variables is %d. "
             "%d are registered.",
             MoL_Num_ComplexConstrained_Vars,MoLNumConstrainedComplexVariables);
  
  CCTK_VInfo(CCTK_THORNSTRING,
             "The maximum number of SandR complex variables is %d. "
             "%d are registered.",
             MoL_Num_ComplexSaveAndRestore_Vars,MoLNumSandRComplexVariables);
  

  CCTK_VInfo(CCTK_THORNSTRING,
             "The maximum number of evolved array variables is %d. "
             "%d are registered.",
             MoL_Num_ArrayEvolved_Vars,MoLNumEvolvedArrayVariables);
  
  CCTK_VInfo(CCTK_THORNSTRING,
             "The maximum number of constrained array variables is %d. "
             "%d are registered.",
             MoL_Num_ArrayConstrained_Vars,MoLNumConstrainedArrayVariables);
  
  CCTK_VInfo(CCTK_THORNSTRING,
             "The maximum number of SandR array variables is %d. "
             "%d are registered.",
             MoL_Num_ArraySaveAndRestore_Vars,MoLNumSandRArrayVariables);
  

  CCTK_VInfo(CCTK_THORNSTRING,
             "The maximum number of evolved complex array variables is %d. "
             "%d are registered.",
             MoL_Num_ComplexArrayEvolved_Vars,
             MoLNumEvolvedComplexArrayVariables);
  
  CCTK_VInfo(CCTK_THORNSTRING,
             "The maximum number of constrained complex array "
             "variables is %d. %d are registered.",
             MoL_Num_ComplexArrayConstrained_Vars,
             MoLNumConstrainedComplexArrayVariables);
  
  CCTK_VInfo(CCTK_THORNSTRING,
             "The maximum number of SandR complex array "
             "variables is %d. %d are registered.",
             MoL_Num_ComplexArraySaveAndRestore_Vars,
             MoLNumSandRComplexArrayVariables);  
  
  CCTK_VInfo(CCTK_THORNSTRING,
             "The maximum size of any array variables is %d.",
             MoL_Max_Evolved_Array_Size);

  if (CCTK_Equals(verbose, "register"))
  {

    if (MoLNumEvolvedVariables)
    {
      CCTK_INFO("The evolved variables are:");
      for (var = 0; var < MoLNumEvolvedVariables; var++)
      {
        CCTK_VInfo(CCTK_THORNSTRING,"   %d   :   %s",
                   var, CCTK_VarName(EvolvedVariableIndex[var]));
      }
    }

    if (MoLNumConstrainedVariables)
    {    
      CCTK_INFO("The constrained variables are:");
      for (var = 0; var < MoLNumConstrainedVariables; var++)
      {
        CCTK_VInfo(CCTK_THORNSTRING,"   %d   :   %s",
                   var, CCTK_VarName(ConstrainedVariableIndex[var]));
      }
    }
    
    if (MoLNumSandRVariables)
    {
      CCTK_INFO("The save and restore variables are:");
      for (var = 0; var < MoLNumSandRVariables; var++)
      {
        CCTK_VInfo(CCTK_THORNSTRING,"   %d   :   %s",
                   var, CCTK_VarName(SandRVariableIndex[var]));
      }
    }
    
    if (MoLNumEvolvedComplexVariables)
    {
      CCTK_INFO("The evolved complex variables are:");
      for (var = 0; var < MoLNumEvolvedComplexVariables; var++)
      {
        CCTK_VInfo(CCTK_THORNSTRING,"   %d   :   %s",
                   var, CCTK_VarName(EvolvedComplexVariableIndex[var]));
      }
    }
    
    if (MoLNumConstrainedComplexVariables)
    {
      CCTK_INFO("The constrained complex variables are:");
      for (var = 0; var < MoLNumConstrainedComplexVariables; var++)
      {
        CCTK_VInfo(CCTK_THORNSTRING,"   %d   :   %s",
                   var, CCTK_VarName(ConstrainedComplexVariableIndex[var]));
      }
    }
    
    if (MoLNumSandRComplexVariables)
    {
      CCTK_INFO("The constrained complex variables are:");
      for (var = 0; var < MoLNumSandRComplexVariables; var++)
      {
        CCTK_VInfo(CCTK_THORNSTRING,"   %d   :   %s",
                   var, CCTK_VarName(SandRComplexVariableIndex[var]));
      }
    }
    
    if (MoLNumEvolvedArrayVariables)
    {
      CCTK_INFO("The evolved array variables are:");
      for (var = 0; var < MoLNumEvolvedArrayVariables; var++)
      {
        CCTK_VInfo(CCTK_THORNSTRING,"   %d   :   %s",
                   var, CCTK_VarName(EvolvedArrayVariableIndex[var]));
      }
    }

    if (MoLNumConstrainedArrayVariables)
    {    
      CCTK_INFO("The constrained array variables are:");
      for (var = 0; var < MoLNumConstrainedArrayVariables; var++)
      {
        CCTK_VInfo(CCTK_THORNSTRING,"   %d   :   %s",
                   var, CCTK_VarName(ConstrainedArrayVariableIndex[var]));
      }
    }
    
    if (MoLNumSandRArrayVariables)
    {
      CCTK_INFO("The save and restore array variables are:");
      for (var = 0; var < MoLNumSandRArrayVariables; var++)
      {
        CCTK_VInfo(CCTK_THORNSTRING,"   %d   :   %s",
                   var, CCTK_VarName(SandRArrayVariableIndex[var]));
      }
    }
    
    if (MoLNumEvolvedComplexArrayVariables)
    {
      CCTK_INFO("The evolved complex array variables are:");
      for (var = 0; var < MoLNumEvolvedComplexArrayVariables; var++)
      {
        CCTK_VInfo(CCTK_THORNSTRING,"   %d   :   %s",
                   var, CCTK_VarName(EvolvedComplexArrayVariableIndex[var]));
      }
    }
    
    if (MoLNumConstrainedComplexArrayVariables)
    {
      CCTK_INFO("The constrained complex array variables are:");
      for (var = 0; var < MoLNumConstrainedComplexArrayVariables; var++)
      {
        CCTK_VInfo(CCTK_THORNSTRING,"   %d   :   %s",
                   var, CCTK_VarName(ConstrainedComplexArrayVariableIndex[var]));
      }
    }
    
    if (MoLNumSandRComplexArrayVariables)
    {
      CCTK_INFO("The constrained complex array variables are:");
      for (var = 0; var < MoLNumSandRComplexArrayVariables; var++)
      {
        CCTK_VInfo(CCTK_THORNSTRING,"   %d   :   %s",
                   var, CCTK_VarName(SandRComplexArrayVariableIndex[var]));
      }
    }
    
  }

  return;
}

/********************************************************************
 *********************     Local Routines   *************************
 ********************************************************************/