#ifndef CGH_H #define CGH_H #include #include "MyList.h" #include "MPatch.h" #include "macrodef.h" #include "monitor.h" #include "Parallel.h" class cgh { public: int levels, movls, BH_num_in; // information of boxes int *grids; double ***bbox; int ***shape; double ***handle; double ***Porgls; double *Lt; // information of Patch list MyList **PatL; // information of OutBdLow2Hi point list and Restrict point list #if (RPB == 1) MyList **bdsul, **rsul; #endif #if (PSTR == 1 || PSTR == 2 || PSTR == 3) int mylev; int *start_rank, *end_rank; MPI_Comm *Commlev; #endif protected: int ingfs, fngfs; static constexpr double ratio = 0.75; int trfls; public: cgh(int ingfsi, int fngfsi, int Symmetry, char *filename, int checkrun, monitor *ErrorMonitor); ~cgh(); void compose_cgh(int nprocs); void sethandle(monitor *ErrorMonitor); void checkPatchList(MyList *PatL, bool buflog); void Regrid(int Symmetry, int BH_num, double **Porgbr, double **Porg0, MyList *OldList, MyList *StateList, MyList *FutureList, MyList *tmList, bool BB, monitor *ErrorMonitor); void Regrid_fake(int Symmetry, int BH_num, double **Porgbr, double **Porg0, MyList *OldList, MyList *StateList, MyList *FutureList, MyList *tmList, bool BB, monitor *ErrorMonitor); void recompose_cgh(int nprocs, bool *lev_flag, MyList *OldList, MyList *StateList, MyList *FutureList, MyList *tmList, int Symmetry, bool BB); void recompose_cgh_fake(int nprocs, bool *lev_flag, MyList *OldList, MyList *StateList, MyList *FutureList, MyList *tmList, int Symmetry, bool BB); void read_bbox(int Symmetry, char *filename); MyList *construct_patchlist(int lev, int Symmetry); bool Interp_One_Point(MyList *VarList, double *XX, /*input global Cartesian coordinate*/ double *Shellf, int Symmetry); void recompose_cgh_Onelevel(int nprocs, int lev, MyList *OldList, MyList *StateList, MyList *FutureList, MyList *tmList, int Symmetry, bool BB); void Regrid_Onelevel(int lev, int Symmetry, int BH_num, double **Porgbr, double **Porg0, MyList *OldList, MyList *StateList, MyList *FutureList, MyList *tmList, bool BB, monitor *ErrorMonitor); void Regrid_Onelevel_aux(int lev, int Symmetry, int BH_num, double **Porgbr, double **Porg0, MyList *OldList, MyList *StateList, MyList *FutureList, MyList *tmList, bool BB, monitor *ErrorMonitor); void settrfls(const int lev); #if (PSTR == 1 || PSTR == 2 || PSTR == 3) void construct_mylev(int nprocs); #endif // Load balancing support bool enable_load_balance; // Enable load balancing int load_balance_check_interval; // Check interval (in time steps) int current_time_step; // Current time step counter double *rank_interp_times; // Store interpolation times for each rank int *heavy_ranks; // Store heavy rank numbers int num_heavy_ranks; // Number of heavy ranks void init_load_balance(int nprocs); void update_interp_time(int rank, double time); bool check_and_rebalance(int nprocs, int lev, MyList *OldList, MyList *StateList, MyList *FutureList, MyList *tmList, int Symmetry, bool BB); }; #endif /* CGH_H */