summaryrefslogtreecommitdiff
path: root/src/comm/CactusDefaultComm.c
blob: 4981c603506e4a625d4080e4abb1c7f68627ea15 (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
 /*@@
   @file      CactusDefaultComm.c
   @date      Tue Sep 29 15:06:22 1998
   @author    Tom Goodale
   @desc 
   Default communication routines.
   @enddesc 
 @@*/


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

#include "flesh.h"
#include "CactusMainDefaults.h"
#include "CactusCommDefaults.h"
#include "GHExtensions.h"

static char *rcsid = "$Id$";


 /*@@
   @routine    CactusDefaultSetupGH
   @date       Tue Sep 29 15:06:22 1998
   @author     Tom Goodale
   @desc 
   Default cactus SetupGH routine.
   @enddesc 
   @calls     
   @calledby   
   @history 
 
   @endhistory 

@@*/
cGH *CactusDefaultSetupGH(tFleshConfig *config, int convergence_level)
{
  cGH *retval;

  cGH *thisGH;

  int n_variables;
  int variable;

  retval = NULL;

  /* Put this in for the moment until parameter stuff is done. */
  if(convergence_level > 0)
  {
    return retval;
  }

  /* Create a new Grid Hierarchy */
  thisGH = (cGH *)malloc(sizeof(cGH));

  if(thisGH)
  {
    thisGH->dim = CCTK_GetMaxDim();
    thisGH->iteration = 0;
    thisGH->local_shape = (int *)malloc(thisGH->dim*sizeof(int));
    thisGH->lower_bound = (int *)malloc(thisGH->dim*sizeof(int));
    thisGH->upper_bound = (int *)malloc(thisGH->dim*sizeof(int));
    thisGH->bbox        = (int *)malloc(2*thisGH->dim*sizeof(int));

    thisGH->levfac = 1;

    n_variables = CCTK_GetNVariables();

    thisGH->data = (void **)malloc(n_variables*sizeof(void *));

    if(thisGH->data)
    {
      for(variable = 0; variable < n_variables; variable++)
      {
	thisGH->data[variable] = NULL;
      }
    }

    thisGH->extensions = NULL;

    thisGH->GroupData = (cGHGroupData *)malloc(CCTK_GetNGroups()*sizeof(cGHGroupData));

  }
  
  if(thisGH && 
     thisGH->local_shape &&
     thisGH->lower_bound &&
     thisGH->upper_bound &&
     thisGH->bbox &&
     thisGH->data &&
     thisGH->GroupData)
  {
    /* Traverse list of GH setup routines. */
    CCTK_TraverseGHExtensions(config, convergence_level, thisGH);

    retval = thisGH;
  }

  return thisGH;
}

int CactusDefaultSyncAllFuncs(cGH *GH)
{
  printf("I'm at line %d of file %s\n", __LINE__, __FILE__);
}

int CactusDefaultSyncGroupFuncs(cGH *GH, const char *group)
{
  printf("I'm at line %d of file %s\n", __LINE__, __FILE__);
}

int CactusDefaultSyncOneFunc(cGH *GH, int GF)
{
  printf("I'm at line %d of file %s\n", __LINE__, __FILE__);
}

int CactusDefaultParallelInit(tFleshConfig *config)
{
  printf("I'm at line %d of file %s\n", __LINE__, __FILE__);
}

int CactusDefaultParallelFinalise(tFleshConfig *config)
{
  printf("I'm at line %d of file %s\n", __LINE__, __FILE__);
}

int CactusDefaultReduce(cGH *GH, int GF, int operation, void *result)
{
  printf("I'm at line %d of file %s\n", __LINE__, __FILE__);
}