aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Carpet/src/Restrict.cc
blob: f79d57386bea12c826e913935d01510a4fb4a609 (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
#include <assert.h>
#include <stdlib.h>

#include "cctk.h"

#include "Carpet/CarpetLib/src/ggf.hh"
#include "Carpet/CarpetLib/src/gh.hh"

#include "carpet.hh"

static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/Carpet/src/Restrict.cc,v 1.3 2001/11/02 10:58:59 schnetter Exp $";



namespace Carpet {
  
  using namespace std;
  
  
  
  void Restrict (const cGH* cgh)
  {
    assert (component == -1);
    
    Checkpoint ("%*sRestrict", 2*reflevel, "");
    
    if (reflevel == hh->reflevels()-1) return;
    
    for (int group=0; group<CCTK_NumGroups(); ++group) {
      
      // Restrict only groups with storage
      if (CCTK_QueryGroupStorageI((cGH*)cgh, group)) {
	
	const int tl = 0;
	
	for (int var=0; var<(int)arrdata[group].data.size(); ++var) {
	  for (int c=0; c<hh->components(reflevel); ++c) {
	    arrdata[group].data[var]->ref_restrict
	      (tl, reflevel, c, mglevel);
	  }
	  for (int c=0; c<arrdata[group].hh->components(reflevel); ++c) {
	    arrdata[group].data[var]->sync (tl, reflevel, c, mglevel);
	  }
	}
	
      }	// if group has storage
      
    } // loop over groups
  }
  
} // namespace Carpet