00001 /* 00002 stencil.h 00003 Igor Terentyev. 00004 ******************************************************************************** 00005 */ 00062 /*============================================================================*/ 00063 00064 #ifndef __STENCIL_H_ 00065 #define __STENCIL_H_ 00066 /*----------------------------------------------------------------------------*/ 00067 00068 #include "utils.h" 00069 /*----------------------------------------------------------------------------*/ 00070 /* 00071 Mask structure. 00072 Indices in the index set are of ip array. 00073 00074 int ip : index of participating array. 00075 int ir : index of recomputed array. 00076 int n : index set size. 00077 IPNT *s : index set. 00078 */ 00083 typedef struct 00084 { 00086 int ip; 00088 int ir; 00090 int n; 00092 IPNT *s; 00093 } STENCIL_MASK; 00094 /*----------------------------------------------------------------------------*/ 00095 /* 00096 Stencil structure. 00097 00098 int nmask : number of masks in the mask array. 00099 STENCIL_MASK *masks : mask array. 00100 */ 00104 typedef struct 00105 { 00107 int nmask; 00109 STENCIL_MASK *masks; 00110 } STENCIL; 00111 /*----------------------------------------------------------------------------*/ 00112 /* 00113 STENCIL_MASK *mask : mask pointer. 00114 int i : set element index./ 00115 IPNT ind : set element (copied as data, not as pointer). 00116 */ 00120 int mask_setnull(STENCIL_MASK *mask); 00130 int mask_create(STENCIL_MASK *mask, int ip, int ir, int n); /* ALLOCATION */ 00135 int mask_destroy(STENCIL_MASK *mask); /* DEALLOCATION */ 00140 int mask_set(STENCIL_MASK *mask, int i, const IPNT ind); 00145 int mask_get(STENCIL_MASK *mask, int i, IPNT ind); 00146 /*----------------------------------------------------------------------------*/ 00147 /* 00148 Do not destroy masks that were set/get in the stencil. 00149 Use sten_destroy which will destroy them. 00150 00151 STENCIL *sten : stencil pointer. 00152 STENCIL_MASK *mask : mask pointer. 00153 int imask : mask index. 00154 */ 00158 int sten_setnull(STENCIL *sten); 00166 int sten_create(STENCIL *sten, int nmask); /* ALLOCATION */ 00170 int sten_destroy(STENCIL *sten); /* DEALLOCATION, INCLUDING MASKS */ 00175 int sten_set(STENCIL *sten, int imask, STENCIL_MASK *mask); 00179 int sten_get(STENCIL *sten, int imask, STENCIL_MASK *mask); 00180 /*----------------------------------------------------------------------------*/ 00181 /* 00182 Output stencil (for tests). 00183 */ 00193 int sten_out(STENCIL *sten, FILE* stream, const char* ind2str_fun(int)); 00194 /*----------------------------------------------------------------------------*/ 00195 00196 #endif /*__STENCIL_H_*/