00001 #ifndef PROTOTYPES_H
00002 #define PROTOTYPES_H
00003 #include "copyright.h"
00004
00005
00006
00007
00008 #include <stdio.h>
00009 #include <stdarg.h>
00010 #include "athena.h"
00011 #include "defs.h"
00012 #include "config.h"
00013
00014
00015 #ifdef FFT_ENABLED
00016 #include "fftsrc/prototypes.h"
00017 #endif
00018
00019 #include "gravity/prototypes.h"
00020 #include "integrators/prototypes.h"
00021 #include "microphysics/prototypes.h"
00022 #include "particles/prototypes.h"
00023 #include "reconstruction/prototypes.h"
00024 #include "rsolvers/prototypes.h"
00025
00026
00027
00028 int athena_main(int argc, char *argv[]);
00029
00030
00031
00032 void* calloc_1d_array( size_t nc, size_t size);
00033 void** calloc_2d_array( size_t nr, size_t nc, size_t size);
00034 void*** calloc_3d_array(size_t nt, size_t nr, size_t nc, size_t size);
00035 void free_1d_array(void *array);
00036 void free_2d_array(void *array);
00037 void free_3d_array(void *array);
00038
00039
00040
00041 void ath_log_set_level(const int out, const int err);
00042 void ath_log_open(const char *basename, const int lazy, const char *mode);
00043 void ath_log_close(void);
00044 FILE *athout_fp(void);
00045 FILE *atherr_fp(void);
00046 void ath_flush_out(void);
00047 void ath_flush_err(void);
00048 int ath_perr(const int level, const char *fmt, ...);
00049 int ath_pout(const int level, const char *fmt, ...);
00050
00051
00052
00053 char *ath_fname(const char *path, const char *basename,
00054 const char *levstr, const char *domstr,
00055 const int dlen, const int idump,
00056 const char *id, const char *ext);
00057
00058
00059
00060 void ath_sig_init(void);
00061 int ath_sig_act(int *piquit);
00062
00063
00064
00065 void baton_start(const int Nb, const int tag);
00066 void baton_stop(const int Nb, const int tag);
00067
00068
00069
00070 void bvals_mhd_init(MeshS *pM);
00071 void bvals_mhd_fun(DomainS *pD, enum BCDirection dir, VGFun_t prob_bc);
00072 void bvals_mhd(DomainS *pDomain);
00073
00074
00075
00076 #ifdef SHEARING_BOX
00077 void ShearingSheet_ix1(DomainS *pD);
00078 void ShearingSheet_ox1(DomainS *pD);
00079 void RemapEy_ix1(DomainS *pD, Real ***emfy, Real **remapEyiib);
00080 void RemapEy_ox1(DomainS *pD, Real ***emfy, Real **remapEyoib);
00081 void bvals_shear_init(MeshS *pM);
00082 void bvals_shear_destruct(void);
00083 #ifdef FARGO
00084 void Fargo(DomainS *pD);
00085 #endif
00086 #endif
00087
00088 #if defined (FARGO) && defined (CYLINDRICAL)
00089 void bvals_shear_init(MeshS *pM);
00090 void bvals_shear_destruct(void);
00091 void Fargo(DomainS *pD);
00092 #endif
00093
00094
00095
00096 void cc_pos(const GridS *pG, const int i, const int j,const int k,
00097 Real *px1, Real *px2, Real *px3);
00098 void fc_pos(const GridS *pG, const int i, const int j,const int k,
00099 Real *px1, Real *px2, Real *px3);
00100 #ifdef CYLINDRICAL
00101 Real x1vc(const GridS *pG, const int i);
00102 #endif
00103 #ifdef PARTICLES
00104 int celli(const GridS *pGrid, const Real x, const Real dx1_1, int *i, Real *a);
00105 Real x1cc(const GridS *pGrid, const int i);
00106 int cellj(const GridS *pGrid, const Real y, const Real dx2_1, int *j, Real *b);
00107 Real x2cc(const GridS *pGrid, const int j);
00108 int cellk(const GridS *pGrid, const Real z, const Real dx3_1, int *k, Real *c);
00109 Real x3cc(const GridS *pGrid, const int k);
00110 #endif
00111
00112
00113
00114 PrimS Cons_to_Prim(const ConsS *pU);
00115 ConsS Prim_to_Cons(const PrimS *pW);
00116 Prim1DS Cons1D_to_Prim1D(const Cons1DS *pU, const Real *pBx);
00117 Cons1DS Prim1D_to_Cons1D(const Prim1DS *pW, const Real *pBx);
00118 #ifndef SPECIAL_RELATIVITY
00119 Real cfast(const Cons1DS *U, const Real *Bx);
00120 #endif
00121 #ifdef SPECIAL_RELATIVITY
00122 PrimS check_Prim(const ConsS *pU);
00123 #ifdef MHD
00124 PrimS fix_vsq (const ConsS *pU);
00125 PrimS entropy_fix (const ConsS *pU, const Real *ent);
00126 Prim1DS check_Prim1D (const Cons1DS *pU, const Real *pBx);
00127 #endif
00128 #endif
00129
00130
00131
00132
00133 void init_grid(MeshS *pM);
00134
00135
00136
00137 void init_mesh(MeshS *pM);
00138 void get_myGridIndex(DomainS *pD, const int my_id, int *pi, int *pj, int *pk);
00139
00140
00141
00142 void new_dt(MeshS *pM);
00143
00144
00145
00146 void init_output(MeshS *pM);
00147 void data_output(MeshS *pM, const int flag);
00148 void add_rst_out(OutputS *new_out);
00149 void data_output_destruct(void);
00150 void dump_history_enroll(const ConsFun_t pfun, const char *label);
00151 Real ***OutData3(GridS *pGrid, OutputS *pOut, int *Nx1, int *Nx2, int *Nx3);
00152 Real **OutData2(GridS *pGrid, OutputS *pOut, int *Nx1, int *Nx2);
00153 Real *OutData1(GridS *pGrid, OutputS *pOut, int *Nx1);
00154
00155 void output_pdf (MeshS *pM, OutputS *pOut);
00156 void output_pgm (MeshS *pM, OutputS *pOut);
00157 void output_ppm (MeshS *pM, OutputS *pOut);
00158 void output_vtk (MeshS *pM, OutputS *pOut);
00159 void output_tab (MeshS *pM, OutputS *pOut);
00160
00161 void dump_binary (MeshS *pM, OutputS *pOut);
00162 void dump_history (MeshS *pM, OutputS *pOut);
00163 void dump_tab_cons(MeshS *pM, OutputS *pOut);
00164 void dump_tab_prim(MeshS *pM, OutputS *pOut);
00165 void dump_vtk (MeshS *pM, OutputS *pOut);
00166
00167
00168
00169 void par_open(char *filename);
00170 void par_cmdline(int argc, char *argv[]);
00171 int par_exist(char *block, char *name);
00172
00173 char *par_gets(char *block, char *name);
00174 int par_geti(char *block, char *name);
00175 double par_getd(char *block, char *name);
00176
00177 char *par_gets_def(char *block, char *name, char *def);
00178 int par_geti_def(char *block, char *name, int def);
00179 double par_getd_def(char *block, char *name, double def);
00180
00181 void par_sets(char *block, char *name, char *sval, char *comment);
00182 void par_seti(char *block, char *name, char *fmt, int ival, char *comment);
00183 void par_setd(char *block, char *name, char *fmt, double dval, char *comment);
00184
00185 void par_dump(int mode, FILE *fp);
00186 void par_close(void);
00187
00188 #ifdef MPI_PARALLEL
00189 void par_dist_mpi(const int mytid, MPI_Comm comm);
00190 #endif
00191
00192
00193
00194
00195
00196 void problem(DomainS *pD);
00197
00198
00199
00200 void Userwork_in_loop(MeshS *pM);
00201
00202
00203
00204 void Userwork_after_loop(MeshS *pM);
00205
00206
00207
00208 void problem_read_restart(MeshS *pM, FILE *fp);
00209
00210
00211
00212 void problem_write_restart(MeshS *pM, FILE *fp);
00213
00214
00215 ConsFun_t get_usr_expr(const char *expr);
00216
00217
00218 VOutFun_t get_usr_out_fun(const char *name);
00219 #ifdef PARTICLES
00220
00221
00222 PropFun_t get_usr_par_prop(const char *name);
00223 void gasvshift(const Real x1, const Real x2, const Real x3, Real *u1, Real *u2, Real *u3);
00224 void Userforce_particle(Vector *ft, const Real x1, const Real x2, const Real x3, const Real v1, const Real v2, const Real v3);
00225 #endif
00226
00227
00228
00229 void dump_restart(MeshS *pM, OutputS *pout);
00230 void restart_grids(char *res_file, MeshS *pM);
00231
00232
00233
00234 void show_config(void);
00235 void show_config_par(void);
00236
00237
00238
00239 void RestrictCorrect(MeshS *pM);
00240 void Prolongate(MeshS *pM);
00241 void SMR_init(MeshS *pM);
00242
00243
00244
00245 char *ath_strdup(const char *in);
00246 int ath_gcd(int a, int b);
00247 int ath_big_endian(void);
00248 void ath_bswap(void *vdat, int sizeof_len, int cnt);
00249 void ath_error(char *fmt, ...);
00250 void minmax1(Real *data, int nx1, Real *dmin, Real *dmax);
00251 void minmax2(Real **data, int nx2, int nx1, Real *dmin, Real *dmax);
00252 void minmax3(Real ***data, int nx3, int nx2, int nx1, Real *dmin, Real *dmax);
00253 void do_nothing_bc(GridS *pG);
00254 Real compute_div_b(GridS *pG);
00255 int sign_change(Real (*func)(const Real,const Real), const Real a0, const Real b0, const Real x, Real *a, Real *b);
00256 int bisection(Real (*func)(const Real,const Real), const Real a0, const Real b0, const Real x, Real *root);
00257 Real trapzd(Real (*func)(Real), const Real a, const Real b, const int n, const Real s);
00258 Real qsimp(Real (*func)(Real), const Real a, const Real b);
00259 Real avg1d(Real (*func)(Real, Real, Real), const GridS *pG, const int i, const int j, const int k);
00260 Real avg2d(Real (*func)(Real, Real, Real), const GridS *pG, const int i, const int j, const int k);
00261 Real avg3d(Real (*func)(Real, Real, Real), const GridS *pG, const int i, const int j, const int k);
00262 Real avgXZ(Real (*func)(Real, Real, Real), const GridS *pG, const int i, const int j, const int k);
00263 Real vecpot2b1i(Real (*A2)(Real,Real,Real), Real (*A3)(Real,Real,Real),
00264 const GridS *pG, const int i, const int j, const int k);
00265 Real vecpot2b2i(Real (*A1)(Real,Real,Real), Real (*A3)(Real,Real,Real),
00266 const GridS *pG, const int i, const int j, const int k);
00267 Real vecpot2b3i(Real (*A1)(Real,Real,Real), Real (*A2)(Real,Real,Real),
00268 const GridS *pG, const int i, const int j, const int k);
00269 #ifdef PARTICLES
00270 void InverseMatrix(Real **a, int n, Real **b);
00271 void MatrixMult(Real **a, Real **b, int m, int n, int l, Real **c);
00272 #endif
00273 #endif