aboutsummaryrefslogtreecommitdiff
path: root/src/EOS_GP.c
blob: a9ea0b6f6d38e0e96f342718a5603af850f87f76 (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
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

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

#include "EOS_GP.h"

void CCTK_FCALL CCTK_FNAME(EOS_GP_Pressure) (const CCTK_INT* nelems,
                                             const CCTK_REAL* rho,
                                             const CCTK_REAL* press);
void CCTK_FCALL CCTK_FNAME(EOS_GP_IntEn)    (const CCTK_INT* nelems,
                                             const CCTK_REAL* const rho,
                                             const CCTK_REAL* inten);
void CCTK_FCALL CCTK_FNAME(EOS_GP_DPDRho)   (const CCTK_INT* nelems,
                                             const CCTK_REAL* const rho,
                                             const CCTK_REAL* dpdrho);
void CCTK_FCALL CCTK_FNAME(EOS_GP_DPDIE)    (const CCTK_INT* nelems,
                                             const CCTK_REAL* const rho,
                                             const CCTK_REAL* dpdie);
void CCTK_FCALL CCTK_FNAME(EOS_GP_cs2)      (const CCTK_INT* nelems,
                                             const CCTK_REAL* const rho,
                                             const CCTK_REAL* cs2);

CCTK_INT EOS_GP_SetArray(const CCTK_INT param_table,
                         const CCTK_INT n_elems,
                         const CCTK_POINTER* indep_vars,
                         const CCTK_INT* which_deps_to_set,
                         CCTK_POINTER* dep_vars)
{

  DECLARE_CCTK_PARAMETERS;
  
  CCTK_INT ierr = 0, var;

  for (var = 0; var < N_DEPS; ++var)
  {
    if (which_deps_to_set[var])
    {
      switch (var)
      {
        case (0):
          CCTK_FNAME(EOS_GP_Pressure) (&n_elems,
                                       (const CCTK_REAL*)indep_vars[0], 
                                       (const CCTK_REAL*)dep_vars[0]);
          break;
        case (1):
          CCTK_FNAME(EOS_GP_IntEn)    (&n_elems,
                                       (const CCTK_REAL*)indep_vars[0], 
                                       (const CCTK_REAL*)dep_vars[1]);
          break;
        case (2):
          CCTK_FNAME(EOS_GP_DPDRho)   (&n_elems,
                                       (const CCTK_REAL*)indep_vars[0], 
                                       (const CCTK_REAL*)dep_vars[2]);
          break;
        case (3):
          CCTK_FNAME(EOS_GP_DPDIE)    (&n_elems,
                                       (const CCTK_REAL*)indep_vars[0], 
                                       (const CCTK_REAL*)dep_vars[3]);
          break;
        case (4):
          CCTK_FNAME(EOS_GP_cs2)      (&n_elems,
                                       (const CCTK_REAL*)indep_vars[0], 
                                       (const CCTK_REAL*)dep_vars[4]);
          break;
      }
    }
  }
  
  return ierr;
}

void CCTK_FCALL CCTK_FNAME(EOS_GP_Inv_Rho)      (const CCTK_INT* nelems,
                                                 const CCTK_REAL* rho,
                                                 const CCTK_REAL* press);
void CCTK_FCALL CCTK_FNAME(EOS_GP_Inv_IntEn)    (const CCTK_INT* nelems,
                                                 const CCTK_REAL* const rho,
                                                 const CCTK_REAL* inten);
void CCTK_FCALL CCTK_FNAME(EOS_GP_Inv_DPDRho)   (const CCTK_INT* nelems,
                                                 const CCTK_REAL* const rho,
                                                 const CCTK_REAL* dpdrho);
void CCTK_FCALL CCTK_FNAME(EOS_GP_Inv_DPDIE)    (const CCTK_INT* nelems,
                                                 const CCTK_REAL* const rho,
                                                 const CCTK_REAL* dpdie);
void CCTK_FCALL CCTK_FNAME(EOS_GP_Inv_cs2)      (const CCTK_INT* nelems,
                                                 const CCTK_REAL* const rho,
                                                 const CCTK_REAL* cs2);

CCTK_INT EOS_GP_Inverse_SetArray(const CCTK_INT param_table,
                                 const CCTK_INT n_elems,
                                 const CCTK_POINTER* indep_vars,
                                 const CCTK_INT* which_deps_to_set,
                                 CCTK_POINTER* dep_vars)
{

  DECLARE_CCTK_PARAMETERS;
  
  CCTK_INT ierr = 0, var, dim;

  for (var = 0; var < N_DEPS; ++var)
  {
    if (which_deps_to_set[var])
    {
      switch (var)
      {
        case (0):
          CCTK_FNAME(EOS_GP_Inv_Rho)      (&n_elems,
                                           (const CCTK_REAL*)indep_vars[0], 
                                           (const CCTK_REAL*)dep_vars[0]);
          break;
        case (1):
          CCTK_FNAME(EOS_GP_Inv_IntEn)    (&n_elems,
                                           (const CCTK_REAL*)indep_vars[0], 
                                           (const CCTK_REAL*)dep_vars[1]);
          break;
        case (2):
          CCTK_FNAME(EOS_GP_Inv_DPDRho)   (&n_elems,
                                           (const CCTK_REAL*)indep_vars[0], 
                                           (const CCTK_REAL*)dep_vars[2]);
          break;
        case (3):
          CCTK_FNAME(EOS_GP_Inv_DPDIE)    (&n_elems,
                                           (const CCTK_REAL*)indep_vars[0], 
                                           (const CCTK_REAL*)dep_vars[3]);
          break;
        case (4):
          CCTK_FNAME(EOS_GP_Inv_cs2)      (&n_elems,
                                           (const CCTK_REAL*)indep_vars[0], 
                                           (const CCTK_REAL*)dep_vars[4]);
          break;
      }
    }
  }
  
  return ierr;
}