AMROC Main     Blockstructured Adaptive Mesh Refinement in object-oriented C++


Main Page   Class Hierarchy   Compound List   File List  

GridFunctionOps1.h

Go to the documentation of this file.
00001 
00002 #ifndef _included_GridFunctionOps1_h
00003 #define _included_GridFunctionOps1_h
00004 
00010 /************************************************************************************/
00011 /* Fill */
00012 /************************************************************************************/
00013 template <class DAGH_GFType>
00014 void GridFunction(1)<DAGH_GFType>::GF_Fill(const DAGH_GFType &val, 
00015                                                const int time, const int level) {
00016   register int t = dagh_timeindex(time,level);
00017   register int l = level;
00018   for (register int i=0; i<length[l]; i++)
00019     if (gdb[t][l][i]) (gdb[t][l][i]->griddata()).fill(val);
00020 }
00021 
00022 /************************************************************************************/
00023 
00024 /************************************************************************************/
00025 /* Copy */
00026 /************************************************************************************/
00027 template <class DAGH_GFType>
00028 void GridFunction(1)<DAGH_GFType>::GF_Copy(const int t1, const int l1, 
00029                                                const GridFunction(1)<DAGH_GFType> &rhs,
00030                                                const int t2, const int l2, 
00031                                                const BBox &where) {
00032   assert (where.rank == dagh.rank);
00033   
00034   BBox alignedwhere = where;
00035   gdbAlignBBox(gfrank,alignedwhere,alignment);
00036 
00037   register int time1 = dagh_timeindex(t1,l1);
00038   register int time2 = rhs.dagh_timeindex(t2,l2);
00039   for (register int i=0; i<length[l1]; i++)
00040     if (gdb[time1][l1][i])
00041       for (register int j=0; j<rhs.length[l2]; j++)
00042         if (rhs.gdb[time2][l2][j]) 
00043           (gdb[time1][l1][i]->griddata()).copy(
00044               rhs.gdb[time2][l2][j]->griddata(),alignedwhere);
00045 }
00046 
00047 template <class DAGH_GFType>
00048 void GridFunction(1)<DAGH_GFType>::GF_Copy(const int t1, const int l1, 
00049                                                const GridFunction(1)<DAGH_GFType> &rhs,
00050                                                const int t2, const int l2) {
00051   register int time1 = dagh_timeindex(t1,l1);
00052   register int time2 = rhs.dagh_timeindex(t2,l2);
00053   for (register int i=0; i<length[l1]; i++)
00054     if (gdb[time1][l1][i])
00055       for (register int j=0; j<rhs.length[l2]; j++)
00056         if (rhs.gdb[time2][l2][j]) 
00057           (gdb[time1][l1][i]->griddata()).copy(rhs.gdb[time2][l2][j]->griddata());
00058 }
00059 /************************************************************************************/
00060 
00061 /************************************************************************************/
00062 /* Equals */
00063 /************************************************************************************/
00064 template <class DAGH_GFType>
00065 void GridFunction(1)<DAGH_GFType>::GF_equals(const int time, const int level, 
00066                                                  const BBox &where, 
00067                                                  const DAGH_GFType &val) {
00068   assert (where.rank == dagh.rank);
00069   
00070   BBox alignedwhere = where;
00071   gdbAlignBBox(gfrank,alignedwhere,alignment);
00072 
00073   register int t = dagh_timeindex(time,level);
00074   register int l = level;
00075   for (register int i=0; i<length[l]; i++) if (gdb[t][l][i]) 
00076     (gdb[t][l][i]->griddata()).equals(val,alignedwhere);
00077 }
00078 
00079 template <class DAGH_GFType>
00080 void GridFunction(1)<DAGH_GFType>::GF_equals(const int time, const int level, 
00081                                                  const DAGH_GFType &val) {
00082   register int t = dagh_timeindex(time,level);
00083   register int l = level;
00084   for (register int i=0; i<length[l]; i++)
00085     if (gdb[t][l][i]) (gdb[t][l][i]->griddata()).equals(val);
00086 }
00087 
00088 template <class DAGH_GFType>
00089 void GridFunction(1)<DAGH_GFType>::GF_equals(const int t1, const int l1, 
00090                                                  const GridFunction(1)<DAGH_GFType> &rhs,
00091                                                  const int t2, const int l2, 
00092                                                  const BBox &where) {
00093   assert (where.rank == dagh.rank);
00094   
00095   BBox alignedwhere = where;
00096   gdbAlignBBox(gfrank,alignedwhere,alignment);
00097 
00098   register int time1 = dagh_timeindex(t1,l1);
00099   register int time2 = rhs.dagh_timeindex(t2,l2);
00100   for (register int i=0; i<length[l1]; i++)
00101     if (gdb[time1][l1][i])
00102       for (register int j=0; j<rhs.length[l2]; j++)
00103         if (rhs.gdb[time2][l2][j]) 
00104           (gdb[time1][l1][i]->griddata()).equals(
00105               rhs.gdb[time2][l2][j]->griddata(),alignedwhere);
00106 }
00107 
00108 template <class DAGH_GFType>
00109 void GridFunction(1)<DAGH_GFType>::GF_equals(const int t1, const int l1, 
00110                                                  const GridFunction(1)<DAGH_GFType> &rhs,
00111                                                  const int t2, const int l2) { 
00112   register int time1 = dagh_timeindex(t1,l1);
00113   register int time2 = rhs.dagh_timeindex(t2,l2);
00114   for (register int i=0; i<length[l1]; i++)
00115     if (gdb[time1][l1][i])
00116       for (register int j=0; j<rhs.length[l2]; j++)
00117         if (rhs.gdb[time2][l2][j]) 
00118           (gdb[time1][l1][i]->griddata()).equals(rhs.gdb[time2][l2][j]->griddata());
00119 }
00120 /************************************************************************************/
00121 
00122 /************************************************************************************/
00123 /* Plus */
00124 /************************************************************************************/
00125 template <class DAGH_GFType>
00126 void GridFunction(1)<DAGH_GFType>::GF_plus(const int time, const int level, 
00127                                                const BBox &where,
00128                                                const DAGH_GFType &val) {
00129   assert (where.rank == dagh.rank);
00130   
00131   BBox alignedwhere = where;
00132   gdbAlignBBox(gfrank,alignedwhere,alignment);
00133 
00134   register int t = dagh_timeindex(time,level);
00135   register int l = level;
00136   for (register int i=0; i<length[l]; i++)
00137     if (gdb[t][l][i]) (gdb[t][l][i]->griddata()).plus(val,alignedwhere);
00138 }
00139 
00140 template <class DAGH_GFType>
00141 void GridFunction(1)<DAGH_GFType>::GF_plus(const int time, const int level, 
00142                                                const DAGH_GFType &val) {
00143     register int t = dagh_timeindex(time,level);
00144     register int l = level;
00145     for (register int i=0; i<length[l]; i++)
00146       if (gdb[t][l][i]) (gdb[t][l][i]->griddata()).plus(val);
00147 }
00148 
00149 template <class DAGH_GFType>
00150 void GridFunction(1)<DAGH_GFType>::GF_plus(const int t1, const int l1, 
00151                                                const GridFunction(1)<DAGH_GFType> &rhs,
00152                                                const int t2, const int l2, 
00153                                                const BBox &where) {
00154   assert (where.rank == dagh.rank);
00155   
00156   BBox alignedwhere = where;
00157   gdbAlignBBox(gfrank,alignedwhere,alignment);
00158 
00159   register int time1 = dagh_timeindex(t1,l1);
00160   register int time2 = rhs.dagh_timeindex(t2,l2);
00161   for (register int i=0; i<length[l1]; i++)
00162     if (gdb[time1][l1][i])
00163       for (register int j=0; j<rhs.length[l2]; j++)
00164         if (rhs.gdb[time2][l2][j]) 
00165           (gdb[time1][l1][i]->griddata()).plus(
00166               rhs.gdb[time2][l2][j]->griddata(),alignedwhere);
00167 }
00168 
00169 template <class DAGH_GFType>
00170 void GridFunction(1)<DAGH_GFType>::GF_plus(const int t1, const int l1, 
00171                                                const GridFunction(1)<DAGH_GFType> &rhs,
00172                                                const int t2, const int l2) { 
00173   register int time1 = dagh_timeindex(t1,l1);
00174   register int time2 = rhs.dagh_timeindex(t2,l2);
00175   for (register int i=0; i<length[l1]; i++)
00176     if (gdb[time1][l1][i])
00177       for (register int j=0; j<rhs.length[l2]; j++)
00178         if (rhs.gdb[time2][l2][j]) 
00179           (gdb[time1][l1][i]->griddata()).plus(rhs.gdb[time2][l2][j]->griddata());
00180 }
00181 /************************************************************************************/
00182 
00183 /************************************************************************************/
00184 /* Minus */
00185 /************************************************************************************/
00186 template <class DAGH_GFType>
00187 void GridFunction(1)<DAGH_GFType>::GF_minus(const int time, const int level, 
00188                                                 const BBox &where,
00189                                                 const DAGH_GFType &val) {
00190   assert (where.rank == dagh.rank);
00191   
00192   BBox alignedwhere = where;
00193   gdbAlignBBox(gfrank,alignedwhere,alignment);
00194 
00195   register int t = dagh_timeindex(time,level);
00196   register int l = level;
00197   for (register int i=0; i<length[l]; i++) if (gdb[t][l][i]) 
00198     (gdb[t][l][i]->griddata()).minus(val,alignedwhere);
00199 }
00200 
00201 template <class DAGH_GFType>
00202 void GridFunction(1)<DAGH_GFType>::GF_minus(const int time, const int level, 
00203                                                 const DAGH_GFType &val) {
00204   register int t = dagh_timeindex(time,level);
00205   register int l = level;
00206   for (register int i=0; i<length[l]; i++)
00207     if (gdb[t][l][i]) (gdb[t][l][i]->griddata()).minus(val);
00208 }
00209 
00210 template <class DAGH_GFType>
00211 void GridFunction(1)<DAGH_GFType>::GF_minus(const int t1, const int l1, 
00212                                                 const GridFunction(1)<DAGH_GFType> &rhs,
00213                                                 const int t2, const int l2, 
00214                                                 const BBox &where) {
00215   assert (where.rank == dagh.rank);
00216   
00217   BBox alignedwhere = where;
00218   gdbAlignBBox(gfrank,alignedwhere,alignment);
00219 
00220   register int time1 = dagh_timeindex(t1,l1);
00221   register int time2 = rhs.dagh_timeindex(t2,l2);
00222   for (register int i=0; i<length[l1]; i++)
00223     if (gdb[time1][l1][i])
00224       for (register int j=0; j<rhs.length[l2]; j++)
00225         if (rhs.gdb[time2][l2][j]) 
00226           (gdb[time1][l1][i]->griddata()).minus(
00227               rhs.gdb[time2][l2][j]->griddata(),alignedwhere);
00228 }
00229 
00230 template <class DAGH_GFType>
00231 void GridFunction(1)<DAGH_GFType>::GF_minus(const int t1, const int l1, 
00232                                                 const GridFunction(1)<DAGH_GFType> &rhs,
00233                                                 const int t2, const int l2) { 
00234   register int time1 = dagh_timeindex(t1,l1);
00235   register int time2 = rhs.dagh_timeindex(t2,l2);
00236   for (register int i=0; i<length[l1]; i++)
00237     if (gdb[time1][l1][i])
00238       for (register int j=0; j<rhs.length[l2]; j++)
00239         if (rhs.gdb[time2][l2][j]) 
00240           (gdb[time1][l1][i]->griddata()).minus(rhs.gdb[time2][l2][j]->griddata());
00241 }
00242 /************************************************************************************/
00243 
00244 /************************************************************************************/
00245 /* Multiply */
00246 /************************************************************************************/
00247 template <class DAGH_GFType>
00248 void GridFunction(1)<DAGH_GFType>::GF_multiply(const int time, const int level, 
00249                                                    const BBox &where,
00250                                                    const DAGH_GFType &val) {
00251   assert (where.rank == dagh.rank);
00252   
00253   BBox alignedwhere = where;
00254   gdbAlignBBox(gfrank,alignedwhere,alignment);
00255   
00256   register int t = dagh_timeindex(time,level);
00257   register int l = level;
00258   for (register int i=0; i<length[l]; i++) if (gdb[t][l][i]) 
00259     (gdb[t][l][i]->griddata()).multiply(val,alignedwhere);
00260 }
00261 
00262 template <class DAGH_GFType>
00263 void GridFunction(1)<DAGH_GFType>::GF_multiply(const int time, const int level, 
00264                                                    const DAGH_GFType &val) {
00265   register int t = dagh_timeindex(time,level);
00266   register int l = level;
00267   for (register int i=0; i<length[l]; i++)
00268     if (gdb[t][l][i]) (gdb[t][l][i]->griddata()).multiply(val);
00269 }
00270 
00271 template <class DAGH_GFType>
00272 void GridFunction(1)<DAGH_GFType>::GF_multiply(const int t1, const int l1, 
00273                                                    const GridFunction(1)<DAGH_GFType> &rhs,
00274                                                    const int t2, const int l2, 
00275                                                    const BBox &where) {
00276   assert (where.rank == dagh.rank);
00277   
00278   BBox alignedwhere = where;
00279   gdbAlignBBox(gfrank,alignedwhere,alignment);
00280 
00281   register int time1 = dagh_timeindex(t1,l1);
00282   register int time2 = rhs.dagh_timeindex(t2,l2);
00283   for (register int i=0; i<length[l1]; i++)
00284     if (gdb[time1][l1][i])
00285       for (register int j=0; j<rhs.length[l2]; j++)
00286         if (rhs.gdb[time2][l2][j]) 
00287           (gdb[time1][l1][i]->griddata()).multiply(
00288               rhs.gdb[time2][l2][j]->griddata(),alignedwhere);
00289 }
00290 
00291 template <class DAGH_GFType>
00292 void GridFunction(1)<DAGH_GFType>::GF_multiply(const int t1, const int l1, 
00293                                                    const GridFunction(1)<DAGH_GFType> &rhs,
00294                                                    const int t2, const int l2) { 
00295   register int time1 = dagh_timeindex(t1,l1);
00296   register int time2 = rhs.dagh_timeindex(t2,l2);
00297   for (register int i=0; i<length[l1]; i++)
00298     if (gdb[time1][l1][i])
00299       for (register int j=0; j<rhs.length[l2]; j++)
00300         if (rhs.gdb[time2][l2][j]) 
00301           (gdb[time1][l1][i]->griddata()).multiply(rhs.gdb[time2][l2][j]->griddata());
00302 }
00303 /************************************************************************************/
00304 
00305 /************************************************************************************/
00306 /* Divide */
00307 /************************************************************************************/
00308 template <class DAGH_GFType>
00309 void GridFunction(1)<DAGH_GFType>::GF_divide(const int time, const int level, 
00310                                                  const BBox &where,
00311                                                  const DAGH_GFType &val) {
00312   assert (where.rank == dagh.rank);
00313   
00314   BBox alignedwhere = where;
00315   gdbAlignBBox(gfrank,alignedwhere,alignment);
00316   
00317   register int t = dagh_timeindex(time,level);
00318   register int l = level;
00319   for (register int i=0; i<length[l]; i++) if (gdb[t][l][i]) 
00320     (gdb[t][l][i]->griddata()).divide(val,alignedwhere);
00321 }
00322 
00323 template <class DAGH_GFType>
00324 void GridFunction(1)<DAGH_GFType>::GF_divide(const int time, const int level, 
00325                                                  const DAGH_GFType &val) {
00326   register int t = dagh_timeindex(time,level);
00327   register int l = level;
00328   for (register int i=0; i<length[l]; i++)
00329     if (gdb[t][l][i]) (gdb[t][l][i]->griddata()).divide(val);
00330 }
00331 
00332 template <class DAGH_GFType>
00333 void GridFunction(1)<DAGH_GFType>::GF_divide(const int t1, const int l1, 
00334                                                  const GridFunction(1)<DAGH_GFType> &rhs,
00335                                                  const int t2, const int l2, 
00336                                                  const BBox &where) {
00337   assert (where.rank == dagh.rank);
00338   
00339   BBox alignedwhere = where;
00340   gdbAlignBBox(gfrank,alignedwhere,alignment);
00341 
00342   register int time1 = dagh_timeindex(t1,l1);
00343   register int time2 = rhs.dagh_timeindex(t2,l2);
00344   for (register int i=0; i<length[l1]; i++)
00345     if (gdb[time1][l1][i])
00346       for (register int j=0; j<rhs.length[l2]; j++)
00347         if (rhs.gdb[time2][l2][j]) 
00348           (gdb[time1][l1][i]->griddata()).divide(
00349               rhs.gdb[time2][l2][j]->griddata(),alignedwhere);
00350 }
00351 
00352 template <class DAGH_GFType>
00353 void GridFunction(1)<DAGH_GFType>::GF_divide(const int t1, const int l1, 
00354                                                  const GridFunction(1)<DAGH_GFType> &rhs,
00355                                                  const int t2, const int l2) { 
00356   register int time1 = dagh_timeindex(t1,l1);
00357   register int time2 = rhs.dagh_timeindex(t2,l2);
00358   for (register int i=0; i<length[l1]; i++)
00359     if (gdb[time1][l1][i])
00360       for (register int j=0; j<rhs.length[l2]; j++)
00361         if (rhs.gdb[time2][l2][j]) 
00362           (gdb[time1][l1][i]->griddata()).divide(rhs.gdb[time2][l2][j]->griddata());
00363 }
00364 /************************************************************************************/
00365 
00366 #endif


Quickstart     Users Guide     Programmers Reference     Installation      Examples     Download



AMROC Main      Home      Contact
last update: 06/01/04