Commits

Britton Smith  committed f075e20 Merge

Merged in MatthewTurk/grackle (pull request #3)

  • Participants
  • Parent commits bca73f8, 7c173ac

Comments (0)

Files changed (8)

File src/clib/Makefile

 	   echo "Failed! See $(OUTPUT) for error messages"; \
 	fi)
 
+libgrackle.$(MACH_SHARED_EXT): $(MODULES) autogen dep
+	-@$(LD) $(LDFLAGS) $(SHARED_OPT) -o $@ $(OBJS_LIB) $(LIBS) >& $(OUTPUT)
+
 #-----------------------------------------------------------------------
 # WRITE ALL COMPILER OUTPUT TO FILE
 #-----------------------------------------------------------------------

File src/clib/chemistry_data.h

+#ifndef __CHEMISTRY_DATA_H__
+#define __CHEMISTRY_DATA_H__
 #define CLOUDY_COOLING_MAX_DIMENSION 5
 
-struct chemistry_data
+typedef struct 
 {
 
   // adiabatic index
   // Length of 1D flattened Cloudy data
   gr_int CloudyDataSize;
 
-};
+} chemistry_data;
+
+#endif

File src/clib/code_units.h

-struct code_units
+#ifndef __CODE_UNITS_H__
+#define __CODE_UNITS_H__
+typedef struct
 {
   gr_int comoving_coordinates;
   gr_float density_units;
   gr_float length_units;
   gr_float time_units;
   gr_float a_units;
-};
+} code_units;
+#endif

File src/clib/fix_enzo_defs.h

+#ifdef int
+#undef int
+#endif
+#ifdef float
+#undef float
+#endif

File src/clib/grackle.h

+#ifndef __GRACKLE_H__
+#define __GRACKLE_H__
+
+#include "code_units.h"
 #include "chemistry_data.h"
-#include "code_units.h"
 #include "phys_constants.h"
 
 chemistry_data set_default_chemistry_parameters();
                           gr_float *DI_density, gr_float *DII_density, gr_float *HDI_density,
                           gr_float *e_density, gr_float *metal_density,
                           gr_float *temperature);
+#endif

File src/clib/initialize_cloudy_data.C

File contents unchanged.

File src/python/grackle.pyx

+cdef extern from "chemistry_data.h":
+    ctypedef struct chemistry_data:
+        float Gamma
+        int use_chemistry
+        int primordial_chemistry
+        int metal_cooling
+        int h2_on_dust
+        int cmb_temperature_floor
+        int include_metal_heating
+        char *cloudy_table_file
+        int three_body_rate
+        int cie_cooling
+        int h2_optical_depth_approximation
+        int photoelectric_heating
+        # Most of the rest are not user-settable
+
+cdef extern from "code_units.h":
+    ctypedef struct code_units:
+      int comoving_coordinates
+      float density_units
+      float length_units
+      float time_units
+      float a_units
+
+cdef extern from "grackle.h":
+    chemistry_data set_default_chemistry_parameters()
+
+    int initialize_chemistry_data(chemistry_data &my_chemistry,
+                                  code_units &my_units, float a_value)
+
+    int solve_chemistry(chemistry_data &my_chemistry,
+                code_units &my_units,
+                float a_value, float dt_value,
+                int grid_rank, int *grid_dimension,
+                int *grid_start, int *grid_end,
+                float *density, float *internal_energy,
+                float *x_velocity, float *y_velocity, float  *z_velocity,
+                float *HI_density, float *HII_density, float *HM_density,
+                float *HeI_density, float *HeII_density, float *HeIII_density,
+                float *H2I_density, float *H2II_density,
+                float *DI_density, float *DII_density, float *HDI_density,
+                float *e_density, float *metal_density)
+
+    int calculate_cooling_time(chemistry_data &my_chemistry,
+                   code_units &my_units,
+                   float a_value, float dt_value,
+                   int grid_rank, int *grid_dimension,
+                   int *grid_start, int *grid_end,
+                   float *density, float *internal_energy,
+                   float *x_velocity, float *y_velocity, float  *z_velocity,
+                   float *HI_density, float *HII_density, float *HM_density,
+                   float *HeI_density, float *HeII_density, float *HeIII_density,
+                   float *H2I_density, float *H2II_density,
+                   float *DI_density, float *DII_density, float *HDI_density,
+                   float *e_density, float *metal_density,
+                   float *cooling_time)
+
+    int calculate_gamma(chemistry_data &my_chemistry,
+                        code_units &my_units,
+                        int grid_rank, int *grid_dimension,
+                        float *density, float *internal_energy,
+                        float *HI_density, float *HII_density, float *HM_density,
+                        float *HeI_density, float *HeII_density, float *HeIII_density,
+                        float *H2I_density, float *H2II_density,
+                        float *DI_density, float *DII_density, float *HDI_density,
+                        float *e_density, float *metal_density,
+                        float *my_gamma)
+
+    int calculate_pressure(chemistry_data &my_chemistry,
+                           code_units &my_units,
+                           int grid_rank, int *grid_dimension,
+                           float *density, float *internal_energy,
+                           float *HI_density, float *HII_density, float *HM_density,
+                           float *HeI_density, float *HeII_density, float *HeIII_density,
+                           float *H2I_density, float *H2II_density,
+                           float *DI_density, float *DII_density, float *HDI_density,
+                           float *e_density, float *metal_density,
+                           float *pressure)
+
+    int calculate_temperature(chemistry_data &my_chemistry,
+                              code_units &my_units,
+                              int grid_rank, int *grid_dimension,
+                              float *density, float *internal_energy,
+                              float *HI_density, float *HII_density, float *HM_density,
+                              float *HeI_density, float *HeII_density, float *HeIII_density,
+                              float *H2I_density, float *H2II_density,
+                              float *DI_density, float *DII_density, float *HDI_density,
+                              float *e_density, float *metal_density,
+                              float *temperature)

File src/python/setup.py

+from distutils.core import setup
+from distutils.extension import Extension
+from Cython.Distutils import build_ext
+
+setup(
+    cmdclass = {'build_ext': build_ext},
+    ext_modules = [Extension("grackle",
+        ["grackle.pyx"],
+        language="c++",
+        include_dirs=["../clib/"],
+        library_dirs=["../clib/"],
+        libraries=["grackle"],
+        define_macros=[("BFLOAT_8", True),
+                       ("PFLOAT_8", True)]
+        )]
+)