00001 /* 00002 model.h 00003 Igor Terentyev. 00004 ******************************************************************************** 00005 Model function types. 00006 Model structure. 00007 */ 00008 /*============================================================================*/ 00009 00010 /* 00011 * Modified 03.12 by WWS - case switch in action list changes from 00012 * array to be updated to internal time step, to accommodate the many 00013 * cases where more than one array is updated, hence needs to be 00014 * exchanged, and perhaps different numbers in fwd, lin, and adj 00015 * (inversion apps) 00016 */ 00022 #ifndef __IWAVE_MODEL_H_ 00023 #define __IWAVE_MODEL_H_ 00024 /*----------------------------------------------------------------------------*/ 00025 00026 #include "utils.h" 00027 #include "parser.h" 00028 #include "stencil.h" 00029 /* WWS 22.02.08 */ 00030 #include "grid.h" 00031 #include "rdomain.h" 00032 00033 /*----------------------------------------------------------------------------*/ 00041 typedef struct { 00042 int it; 00043 int iv; 00044 int niv; 00045 ireal dt; 00046 ireal rhs; 00047 } TIMESTEPINDEX; 00048 00057 void next_step(TIMESTEPINDEX * ts); 00058 00066 int less_than(TIMESTEPINDEX t1, TIMESTEPINDEX t2); 00067 00073 ireal get_time(TIMESTEPINDEX ts); 00074 00075 /*----------------------------------------------------------------------------*/ 00076 /* 00077 int ndim : number of dimensions. 00078 STENCIL sten : stencil; 00079 void *specs : model specific data. 00080 TIMESTEP_FUN ts : timestep function. 00081 void *tspars : timestep function parameters. 00082 RDOM ld_a, ld_c : allocated domain, computational virtual domain. 00083 RDOM *ld_s, *ld_r : recv, send virtual domains. 00084 int nt : number of timesteps. 00085 00086 BIG TODO: remove ld_s, ld_r to particular models and get rid of domains; 00087 they should be special objects that are prepared before send: 00088 copy overlaped data before sending, etc. 00089 */ 00090 /* WWS 22.08.12: added g, dt, it, removed ndim, nt */ 00091 /* Igor, Feb 26: added physical domain ld_p 00092 RDOM ld_p 00093 */ 00105 typedef struct s_imodel { 00110 void * specs; 00111 00120 grid g; 00121 00127 std::vector<grid> sfg; 00128 00134 grid gl; 00135 00137 IPNT nls,nrs; 00138 00140 int nnei; 00141 00143 TIMESTEPINDEX tsind; 00144 00149 std::vector<std::string> active; 00150 00152 RDOM ld_a; 00154 RDOM ld_c; 00156 RDOM ld_p; 00158 RDOM *ld_s; 00160 RDOM *ld_r; 00161 00162 } IMODEL; 00163 00164 /*----------------------------------------------------------------------------*/ 00165 00166 typedef int (*IMODELINIT_FUN)(PARARRAY *pars, FILE *stream, IMODEL *model); 00167 /*----------------------------------------------------------------------------*/ 00171 int im_construct(IMODEL *model); 00172 /*----------------------------------------------------------------------------*/ 00176 int im_destroy(IMODEL *model, void (*destr)(void **)); 00177 /*----------------------------------------------------------------------------*/ 00181 int im_setndim(IMODEL *model); 00182 /*----------------------------------------------------------------------------*/ 00183 00184 #endif /*__MODEL_H_*/