Пример #1
0
    def SIMD_declare_C_params():
        SIMD_declare_C_params_str = ""
        for i in range(len(par.glb_Cparams_list)):
            # keep_param is a boolean indicating whether we should accept or reject
            #    the parameter. singleparstring will contain the string indicating
            #    the variable type.
            keep_param, singleparstring = ccl.keep_param__return_type(par.glb_Cparams_list[i])

            if (keep_param) and ("CCTK_REAL" in singleparstring):
                parname = par.glb_Cparams_list[i].parname
                SIMD_declare_C_params_str += "    const "+singleparstring + "*NOSIMD"+parname+\
                                             " = CCTK_ParameterGet(\""+parname+"\",\"BaikalETK\",NULL);\n"
                SIMD_declare_C_params_str += "    const REAL_SIMD_ARRAY "+parname+" = ConstSIMD(*NOSIMD"+parname+");\n"
        return SIMD_declare_C_params_str
par.set_parval_from_str("BSSN.BSSN_gauge_RHSs::ShiftEvolutionOption",
                        ShiftCondition)
par.set_parval_from_str("BSSN.BSSN_gauge_RHSs::LapseEvolutionOption",
                        LapseCondition)

# Step 3.c: Now that NRPy+ parameters and gridfunctions have been
#           defined, we now have all the information we need loaded
#           into our NRPy+ environment to generate the Einstein
#           Toolkit ccl files
import BaikalETK.BaikalETK_ETK_ccl_files_codegen as cclgen

for enable_stress_energy_source_terms in [True, False]:
    ThornName = "Baikal"
    if enable_stress_energy_source_terms == False:
        ThornName = "BaikalVacuum"
    cclgen.output_param_ccl(ThornName, enable_stress_energy_source_terms)
    cclgen.output_interface_ccl(ThornName, enable_stress_energy_source_terms)
    cclgen.output_schedule_ccl(ThornName, enable_stress_energy_source_terms)
###############################

###############################
# Step 4: Generate C driver functions for ETK registration & NRPy+-generated kernels

# Now that we have constructed the basic C code kernels and the
# needed Einstein Toolkit ccl files, we next write the driver
# functions for registering BaikalETK within the Toolkit and the
# C code kernels. Each of these driver functions will be called
# directly from the thorn's schedule.ccl in the ETK.

# Step 4.a: First we call the functions in the `BaikalETK.BaikalETK_C_drivers_codegen`
#           Python module) to store all needed driver C files to a Python dictionary,