aboutsummaryrefslogtreecommitdiff
path: root/CarpetExtra/CarpetIntegrateTest/src/Local.cc
blob: d41b12c9cf0b2f0bb1feaaa9634824c796f80aca (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
// $Header: /home/eschnett/C/carpet/Carpet/CarpetExtra/CarpetIntegrateTest/src/Local.cc,v 1.1 2004/09/01 17:47:53 schnetter Exp $

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

#include "carpet.hh"
#include "defs.hh"
#include "vect.hh"


#include "util_Table.h"
#include "math.h"

extern "C" { CCTK_INT CarpetIntegrate_Local(CCTK_ARGUMENTS);
}

static void SpatialDeterminant(CCTK_REAL gxx,
                               CCTK_REAL gxy,
                               CCTK_REAL gxz,
                               CCTK_REAL gyy,
                               CCTK_REAL gyz,
                               CCTK_REAL gzz,
                               CCTK_REAL *detg);

CCTK_INT CarpetIntegrate_Local(CCTK_ARGUMENTS)
{
  DECLARE_CCTK_ARGUMENTS;
  DECLARE_CCTK_PARAMETERS;

  using namespace std;
  using namespace Carpet;

  int nx = cctk_lsh[0];
  int ny = cctk_lsh[1];
  int nz = cctk_lsh[2];

  for (int k=0;k<nz;k++)
    for (int j=0;j<ny;j++)
      for (int i=0;i<nx;i++) {
	int index = CCTK_GFINDEX3D(cctkGH,i,j,k);

	/*
	SpatialDeterminant(gxx[index],gxy[index],gxz[index],
			   gyy[index],gyz[index],gzz[index],
			   &detg);
	*/

	integrand[index] = 1;

      }

  return 0;
}


void SpatialDeterminant(CCTK_REAL gxx,
			CCTK_REAL gxy,
			CCTK_REAL gxz,
			CCTK_REAL gyy,
			CCTK_REAL gyz,
			CCTK_REAL gzz,
			CCTK_REAL *detg)
{

  *detg = -gxz*gxz*gyy + 2.0*gxy*gxz*gyz 
    - gxx*gyz*gyz - gxy*gxy*gzz + gxx*gyy*gzz;

  return;
}