aboutsummaryrefslogtreecommitdiff
path: root/src/GRHydro_Jacobian_state.c
blob: 55ca1b98cefbd1de4bfadd95a8fb9d7920677491 (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
#include <assert.h>

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




/**
   Checks states for Jacobians
*/
void
GRHydro_check_Jacobian_state (CCTK_ARGUMENTS)
{
  DECLARE_CCTK_ARGUMENTS
  DECLARE_CCTK_PARAMETERS

  static CCTK_INT idxJacobian_state = -1, idxiJacobian_state = -1;

  if (!CCTK_IsImplementationActive("Coordinates"))
     return; /* Multipatch infrastructure not active */

  if (idxJacobian_state == -1)
  {
     idxJacobian_state = CCTK_VarIndex("Coordinates::jacobian_state");
     assert(idxJacobian_state >= 0);
  }

  if (idxiJacobian_state == -1)
  {
     idxiJacobian_state = CCTK_VarIndex("Coordinates::inverse_jacobian_state");
     assert(idxiJacobian_state >= 0);
  }

  if (*(CCTK_INT *)CCTK_VarDataPtrI(cctkGH, 0, idxJacobian_state) == 0)
  {
     CCTK_WARN(0, "GRHydro requires storage for Jacobians. Please tell your Coordinates implementation to store the Jacobians!");
  }
  
  if (*(CCTK_INT *)CCTK_VarDataPtrI(cctkGH, 0, idxiJacobian_state) == 0)
  {
     CCTK_WARN(0, "GRHydro requires storage for inverse Jacobians. Please tell your Coordinates implementation to store the inverse Jacobians!");
  }
  
}