vtf-logo

GridFunction.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 #ifndef _included_GridFunction_h
00004 #define _included_GridFunction_h
00005 
00011 #include "DAGHParams.h"
00012 
00013 #include "GridHierarchy.h"
00014 
00015 #include "GridFunctionVoid.h"
00016 
00017 #include "GridDataBlock.h"
00018 #include "GridHierarchyCalls.h"
00019 #include "GridFunctionFunctors.h"
00020 
00021 #include "Timing.h"
00022 
00023 #include <iosfwd>
00024 
00025 template <class GFType, int dim> class GridFunction;
00026 template <class GFType, int dim>
00027 std::ostream& operator<<(std::ostream&, const GridFunction<GFType,dim>&);
00028 
00039 template <class GFType, int dim>
00040 class GridFunction : public GridFunctionVoid
00041  {
00042  private:
00043    friend class GridHierarchy;
00044 
00046    int* length;
00051    GridDataBlock<GFType,dim> ****gdb;
00052    
00054    GFBndryUpdateFunc<GFType,dim>* bfunc;
00055    
00057    GFAdptBndryUpdateFunc<GFType,dim>* abfunc;
00058 
00060    GFLevelTransferFunc<GFType,dim>* pfunc;
00061 
00063    GFLevelTransferFunc<GFType,dim>* rfunc;
00064 
00065    /* I/O Function */
00066    GFIOFunc<GFType,dim>* iofunc;
00067 
00068    /* Custon Recomposition Function */
00069    /* Is called for each level within loop over levels in Recompose() */
00070    GFRecomposeFunc<GFType,dim>* recompfunc;
00071 
00072    /*****************************************************************************/
00073    /* Disable assignments */
00074    /*****************************************************************************/
00075 private:
00076    GridFunction(const GridFunction<GFType,dim>&);
00077    const GridFunction<GFType,dim>& operator= (const GridFunction<GFType,dim>&);
00078    /*****************************************************************************/
00079 
00080    /*****************************************************************************/
00081    /* Constructors.... */
00082    /*****************************************************************************/
00083 public:   
00084    GridFunction(char const name[], GridHierarchy &gh);
00085 
00086    /* For backward compatibility */
00087    GridFunction(const char name[], 
00088                 const int t_sten, 
00089                 const int s_sten, 
00090                 GridHierarchy &gh,
00091                 const int cflag = DAGHComm,
00092                 const int extghflag = DAGHNoExternalGhost);
00093 
00094    GridFunction(const char name[], 
00095                 const int t_sten, 
00096                 const int s_sten, 
00097                 const int cfac,
00098                 GridHierarchy &gh,
00099                 const int cflag = DAGHComm,
00100                 const int extghflag = DAGHNoExternalGhost);
00101 
00102    GridFunction(const char name[], 
00103                 const int t_sten, 
00104                 const int s_sten, 
00105                 GridHierarchy &gh,
00106                 const int type, 
00107                 const int cflag,
00108                 const int bflag,
00109                 const int adptbflag,
00110                 const int extghflag = DAGHNoExternalGhost); 
00111 
00112    GridFunction(const char name[], 
00113                 const int t_sten, 
00114                 const int* s_sten, 
00115                 GridHierarchy &gh,
00116                 const int type, 
00117                 const int cflag,
00118                 const int bflag,
00119                 const int adptbflag,
00120                 const int extghflag = DAGHNoExternalGhost);
00121 
00122    /* Add one to set the alignment when rank < dagh.rank */
00123    GridFunction(const char name[], 
00124                 const int t_sten, 
00125                 const int s_sten, 
00126                 GridHierarchy &gh,
00127                 const int type, 
00128                 const int loff, 
00129                 const int cfac,
00130                 const int align, 
00131                 const int cflag,
00132                 const int bflag,
00133                 const int adptbflag,
00134                 const int extghflag);
00135 
00169    GridFunction(const char name[], 
00170                 const int t_sten, 
00171                 const int* s_sten, 
00172                 GridHierarchy &gh,
00173                 const int type, 
00174                 const int loff, 
00175                 const int cfac,
00176                 const int align, 
00177                 const int cflag,
00178                 const int bflag,
00179                 const int adptbflag,
00180                 const int extghflag);
00181 
00182    GridFunction(const char name[], 
00183                 const int t_sten, 
00184                 const int s_sten, 
00185                 const int time,
00186                 const int level,
00187                 GridHierarchy &gh,
00188                 const int type,
00189                 const int loff, 
00190                 const int cfac,
00191                 const int cflag,
00192                 const int bflag,
00193                 const int adptbflag,
00194                 const int extghflag = DAGHNoExternalGhost);
00195    
00197    GridFunction(const char name[], 
00198                 const int t_sten, 
00199                 const int* s_sten, 
00200                 const int time,
00201                 const int level,
00202                 GridHierarchy &gh,
00203                 const int type,
00204                 const int loff, 
00205                 const int cfac,
00206                 const int cflag,
00207                 const int bflag,
00208                 const int adptbflag,
00209                 const int extghflag = DAGHNoExternalGhost);
00210     
00212    GridFunction(const char name[], 
00213                 const GridFunction<GFType,dim>& gf,
00214                 const int time,
00215                 const int level,
00216                 const int cflag,
00217                 const int bflag,
00218                 const int adptbflag,
00219                 const int extghflag = DAGHNoExternalGhost);
00220    /*****************************************************************************/
00221 
00222    /*****************************************************************************/
00223    /* Destructor */
00224    /*****************************************************************************/
00225 public:
00226    virtual ~GridFunction();
00227    /*****************************************************************************/
00228 
00229    /*****************************************************************************/
00230    /* Delete Comm Info */
00231    /*****************************************************************************/
00232 private:
00233    void GF_DeleteGDBStorage();
00234    void GF_DeleteGDBStorage(const int t);
00235    void GF_DeleteGDBStorage(const int t, const int l);
00236    void GF_DeleteGhostCommInfo();
00237    void GF_DeleteDataCommInfo();
00238    void GF_DeleteGhostBndryInfo();
00239    void GF_CreateGDBStorage(const int t);  
00240    void GF_CreateGDBStorage(const int t, const int l);  
00241    /*****************************************************************************/
00242 public:
00243    void GF_CreateStorage(const int t) { 
00244      if (t==0 || t>time_sten_rad || t<-time_sten_rad) return;
00245      GF_CreateGDBStorage(t + time_sten_rad); 
00246    }
00247    void GF_CreateStorage(const int t, const int l) {
00248      if (t==0 || t>time_sten_rad || t<-time_sten_rad) return;
00249      if (l<0 || l>=dagh.totallevels()) return;    
00250      GF_CreateGDBStorage(t + time_sten_rad, l); 
00251    }
00252    void GF_DeleteStorage(const int t) {
00253      if (t==0 || t>time_sten_rad || t<-time_sten_rad) return;     
00254      GF_DeleteGDBStorage(t + time_sten_rad); 
00255    }
00256    void GF_DeleteStorage(const int t, const int l) {
00257      if (t==0 || t>time_sten_rad || t<-time_sten_rad) return;
00258      if (l<0 || l>=dagh.totallevels()) return;    
00259      GF_DeleteGDBStorage(t + time_sten_rad, l); 
00260    }
00261 
00262    /*****************************************************************************/
00263    /* Compose & Recompose */
00264    /*****************************************************************************/
00265 private:
00266    void GF_Compose();
00267    void GF_Compose(const int T, const int L);
00268    void GF_Compose(const GridFunction<GFType,dim>& gf, 
00269                    const int T, const int L);
00270 
00271    void GF_Recompose(int* reuse_possible, GridBoxList** ollist,
00272                      GridBoxList** rlist, GridBoxList** slist,
00273                      GridBoxList** olist); 
00274 
00275 public:
00276    /*****************************************************************************/
00277    /* For checkpointing */
00278    /*****************************************************************************/
00280    void GF_CheckpointRecompose();
00282    void GF_CheckpointRecompose(std::stringstream& ifs);
00284    void GF_Checkpoint(std::ofstream& ofs);
00286    void GF_Checkpoint(std::stringstream& ofs);
00287    int  GF_Checkpoint_StrStream_Memory();
00291    void GF_CheckpointRestart(int proc=-1); 
00293    void GF_CheckpointRestart(std::stringstream& ifs);
00294 
00295    /*****************************************************************************/
00296 
00297    /*****************************************************************************/
00299 private:
00300    void GF_SetUpGhostCommServers();
00301    /*****************************************************************************/
00302 
00303 private:
00304    /*****************************************************************************/
00306    void GF_GatherGhostCommInfo();
00307    /*****************************************************************************/
00308 
00309    /*****************************************************************************/
00313    void GF_GatherGhostBndryInfo();
00314    /*****************************************************************************/
00315 
00316    /*****************************************************************************/
00317    /* Set Functions */
00318    /*****************************************************************************/
00319 public:
00320    inline void GF_SetBndryUpdateFunc(GFBndryUpdateFunc<GFType,dim>* bf) 
00321      { bfunc = bf; }
00322    inline void GF_SetAdaptiveBndryUpdateFunc(GFAdptBndryUpdateFunc<GFType,dim>* abf) 
00323      { abfunc = abf; }
00324    inline void GF_SetProlongFunc(GFLevelTransferFunc<GFType,dim>* pf)
00325      { pfunc = pf; }
00326    inline void GF_SetRestrictFunc(GFLevelTransferFunc<GFType,dim>* rf)
00327      { rfunc = rf; }
00328    inline void GF_SetIOFunc(GFIOFunc<GFType,dim>* iof) 
00329      { iofunc = iof; }
00330    inline void GF_SetRecomposeFunc(GFRecomposeFunc<GFType,dim>* rcf) 
00331      { recompfunc = rcf; }
00332    /*****************************************************************************/
00333 
00334    /*****************************************************************************/
00335    /* Get Functions */
00336    /*****************************************************************************/
00337    inline GFBndryUpdateFunc<GFType,dim>* GF_GetBndryUpdateFunc() 
00338      { return bfunc; }
00339    inline GFAdptBndryUpdateFunc<GFType,dim>* GF_GetAdaptiveBndryUpdateFunc() 
00340      { return abfunc; }
00341    inline GFLevelTransferFunc<GFType,dim>* GF_GetProlongFunc()
00342      { return pfunc; }
00343    inline GFLevelTransferFunc<GFType,dim>* GF_GetRestrictFunc()
00344      { return rfunc; }
00345    inline GFIOFunc<GFType,dim>* GF_GetIOFunc() 
00346      { return iofunc; }
00347    inline GFRecomposeFunc<GFType,dim>* GF_GetRecomposeFunc() 
00348      { return recompfunc; }
00349    /*****************************************************************************/
00350 
00351    /*****************************************************************************/
00352    /* Query function status */
00353    /*****************************************************************************/
00354 public:
00355    inline int has_bndryupdatefunc()
00356      { return (bfunc != (GFBndryUpdateFunc<GFType,dim>*) 0); }
00357    inline int has_adaptivebndryupdatefunc()
00358      { return (abfunc != (GFAdptBndryUpdateFunc<GFType,dim>*) 0); }
00359    inline int has_prolongfunc()
00360      { return (pfunc != (GFLevelTransferFunc<GFType,dim>*) 0); }
00361    inline int has_restrictfunc() 
00362      { return (rfunc != (GFLevelTransferFunc<GFType,dim>*) 0); }
00363    inline int has_iofunc() 
00364      { return (iofunc != (GFIOFunc<GFType,dim>*) 0); }
00365    inline int has_recomposefunc() 
00366      { return (recompfunc != (GFRecomposeFunc<GFType,dim>*) 0); }
00367    /*****************************************************************************/
00368 
00369 public:
00370    /*****************************************************************************/
00372    void GF_SwapTimeLevels(const int l, const int t1, const int t2);
00373    void GF_CycleTimeLevels(const int l);
00374    /*****************************************************************************/
00375 
00376    /*****************************************************************************/
00377    /* Queries.... */
00378    /*****************************************************************************/
00379 public:
00380    inline int Length(GridBoxList* gbl) { return (gbl ? gbl->number() : 0); }
00382    inline int len(int lev) const { return (length[lev]); }
00383 
00384    inline int comm() const { return (comm_flag != DAGHNoComm); }
00385    inline int comm(const int t, const int l) const
00386         { return (comm_flag!=DAGHNoComm) &&
00387                  (comm_flag!=DAGHCommCurrentTimeOnly ||
00388                   t==dagh_timeindex(dagh.getCurrentTime(l),l)); }
00389 
00391    inline GridDataBlock<GFType,dim>& mygdb(const int t, 
00392                                                    const int l, 
00393                                                    const int c) 
00394         { return (*gdb[dagh_timeindex(t,l)][l][c]); }
00395 
00396    inline int exists(const int t, const int l, const int c) const
00397         { return (gdb[dagh_timeindex(t,l)][l][c] != 
00398                   (GridDataBlock<GFType,dim> *)0); }
00399 
00400    inline int has_parents(const int t, const int l, const int c) const
00401         { return gdb[dagh_timeindex(t,l)][l][c]->has_parents(); }
00403    inline const int& parents(const int t, const int l, const int c) const 
00404         { return gdb[dagh_timeindex(t,l)][l][c]->parents(); }
00406    inline const GDB_Interaction* parentlist(const int t, const int l, const int c) const 
00407         { return gdb[dagh_timeindex(t,l)][l][c]->parentlist(); }
00408    inline GDB_Interaction* parentlist(const int t, const int l, const int c) 
00409         { return gdb[dagh_timeindex(t,l)][l][c]->parentlist(); }
00410    inline const BBox& parentbox(const int t, const int l, const int c, const int j) const
00411         { return (gdb[dagh_timeindex(t,l)][l][c]->parentbox(j)); }
00412    inline const int& parentidx(const int t, const int l, const int c, const int j) const
00413         { return (gdb[dagh_timeindex(t,l)][l][c]->parentidx(j)); }
00414 
00415    inline int has_children(const int t, const int l, const int c) const
00416         { return gdb[dagh_timeindex(t,l)][l][c]->has_children(); }
00418    inline const int& children(const int t, const int l, const int c) const 
00419         { return gdb[dagh_timeindex(t,l)][l][c]->children(); }
00421    inline const GDB_Interaction* childlist(const int t, const int l, const int c) const 
00422         { return gdb[dagh_timeindex(t,l)][l][c]->childlist(); }
00423    inline GDB_Interaction* childlist(const int t, const int l, const int c) 
00424         { return gdb[dagh_timeindex(t,l)][l][c]->childlist(); }
00425    inline const BBox& childbox(const int t, const int l, const int c, const int j) const
00426         { return (gdb[dagh_timeindex(t,l)][l][c]->childbox(j)); }
00427    inline const int& childidx(const int t, const int l, const int c, const int j) const
00428         { return (gdb[dagh_timeindex(t,l)][l][c]->childidx(j)); }
00429    /*****************************************************************************/
00430 
00431    /*****************************************************************************/
00432    /* set/get current time */
00433    /*****************************************************************************/
00434 public:
00435    inline Coords GF_StepSize(const int lev) const 
00436      { return (Coords(dim,factor()*dagh.stepsize(lev))); }
00437    inline int GF_TimeStep(const int lev) const 
00438      { return (factor()*dagh.timestep(lev)); }
00439 
00441    inline int GF_CurrentTime(const int lev) const
00442      { return (dagh.getCurrentTime(lev)); }
00443    inline int GF_PreviousTime(const int lev) const
00444      { return (dagh.getCurrentTime(lev) - GF_TimeStep(lev)); }
00445    inline int GF_NextTime(const int lev) const
00446      { return (dagh.getCurrentTime(lev) + GF_TimeStep(lev)); }
00447 
00448    /*****************************************************************************/
00449    /* time queries based on DAGH current time information */
00450    /*****************************************************************************/
00451 public:
00456    inline int dagh_timevalue(const int t, const int l) const
00457    { return ((t-time_sten_rad)*GF_TimeStep(l) + dagh.getCurrentTime(l)); }
00458 
00460    inline int dagh_timeindex(const int t, const int l) const
00461    { return (time_alias[((t-dagh.getCurrentTime(l))/GF_TimeStep(l)) + time_sten_rad]); }
00462    /*****************************************************************************/
00463 
00464    /*****************************************************************************/
00465    /* physical time queries based on DAGH current time information */
00466    /*****************************************************************************/
00467 public:
00468    inline void set_phystime_timeindex(const int t, const int l, const double pht)
00469    { phys_time[t*dagh.totallevels() + l] = pht; }
00471    inline void set_phystime_timevalue(const int t, const int l, const double pht)
00472    { phys_time[time_alias[((t-dagh.getCurrentTime(l))/GF_TimeStep(l)) + 
00473                          time_sten_rad]*dagh.totallevels() + l] = pht; }
00474 
00475    inline double get_phystime_timeindex(const int t, const int l) const
00476    { return (phys_time[t*dagh.totallevels() + l]); }
00478    inline double get_phystime_timevalue(const int t, const int l) const
00479    { return (phys_time[time_alias[((t-dagh.getCurrentTime(l))/GF_TimeStep(l)) + 
00480                                  time_sten_rad]*dagh.totallevels() + l]); }
00481    /*****************************************************************************/
00482 
00483    /*****************************************************************************/
00484    /* Data Updates */
00485    /*****************************************************************************/
00486 private:
00487    void GF_ReadData(const int time);
00492    void GF_ReadData(const int time, const int level);
00493    void GF_ReadData(const int time, GridData<GFType,dim>& into);
00494    /*****************************************************************************/
00495     
00496 public:
00497    inline virtual void GF_WriteGhosts(const int time, const int level) 
00498      {  GF_WriteGhosts(time, level, DAGH_All, DAGH_Both); }
00499 
00504    virtual void GF_WriteGhosts(const int time, const int level, 
00505                                const int axis, const int dir);
00506 
00507 private:
00508    int ipow(int b, int p) 
00509      { register int tmpr = 1; while (p--) tmpr *= b; return tmpr; }
00510    void GF_PeriodicBBoxMove(BBox& from, int& idx, const int& length);
00511 public:
00512    inline virtual void GF_ReadGhosts(const int time, const int level) 
00513      {  GF_ReadGhosts(time, level, DAGH_All, DAGH_Both); }
00514 
00519    virtual void GF_ReadGhosts(const int time, const int level, 
00520                               const int axis, const int dir);
00521 
00522 public:
00524    inline void GF_BndryUpdate(const int time, const int level) { 
00525      GF_AdaptiveBndryUpdate(time,level);
00526      GF_WriteGhosts(time,level); 
00527      GF_ReadGhosts(time,level); 
00528      GF_ExternalBndryUpdate(time,level);
00529    }
00530 
00531    inline virtual void GF_Sync(const int time, const int level) { 
00532      GF_WriteGhosts(time,level); 
00533      GF_ReadGhosts(time,level); 
00534    }
00536    inline virtual void GF_Sync(const int time, const int level, 
00537                                const int axis, const int dir) { 
00538      COUNT(GF_SYNC);
00539 
00540      GF_WriteGhosts(time,level,axis,dir); 
00541      GF_ReadGhosts(time,level,axis,dir); 
00542    }
00543 
00544    inline const BBoxList* externalbndrylevel(const int l) const { return (bndrybboxlist[l]); }
00545    inline const BBoxList* prolongbndrylevel(const int l) const { return (prolongbboxlist[l]); }
00546 
00547    /*****************************************************************************/
00548 
00549    /*****************************************************************************/
00550    /* Use predefined functions */
00551    /*****************************************************************************/
00552 public:
00553    void GF_Prolong(const int tf, const int lf, const int tt, const int lt);
00559    void GF_Prolong(const int tf, const int lf, const int tt, const int lt,const BBox &bb);
00560 
00561    void GF_Restrict(const int tf, const int lf, const int tt, const int lt);
00568    void GF_Restrict(const int tf, const int lf, const int tt, const int lt,const BBox &bb);
00569 
00570    void GF_IO(const int time, const int level);
00571    void GF_IO(const int time, const int level, const BBox &bb);
00572    /*****************************************************************************/
00573 
00574    /*****************************************************************************/
00575    /* Boundary updates */
00576    /*****************************************************************************/
00581    void GF_AdaptiveBndryUpdate(const int time, const int level);
00586    void GF_ExternalBndryUpdate(const int time, const int level); 
00587 
00588    /*****************************************************************************/
00589 
00590    /*****************************************************************************/
00591    /* Queries */
00592    /*****************************************************************************/
00593    inline const BBox& boundingbbox(const int t, const int l, const int c) const
00594         { return (gdb[dagh_timeindex(t,l)][l][c]->boundingbox()); }
00596    inline BBox boundingbbox(const int t, const int l, const int c)
00597         { return (gdb[dagh_timeindex(t,l)][l][c]->boundingbox()); }
00598 
00599    inline const BBox& interiorbbox(const int t, const int l, const int c) const
00600         { return (gdb[dagh_timeindex(t,l)][l][c]->interiorbox()); }
00602    inline BBox interiorbbox(const int t, const int l, const int c)
00603         { return (gdb[dagh_timeindex(t,l)][l][c]->interiorbox()); }
00604 
00605    inline const BBox& databbox(const int t, const int l, const int c) const
00606         { return (gdb[dagh_timeindex(t,l)][l][c]->databox()); }
00608    inline BBox databbox(const int t, const int l, const int c)
00609         { return (gdb[dagh_timeindex(t,l)][l][c]->databox()); }
00610 
00611    void boundingbboxlist(BBoxList& bbl, const int l);
00612    void intbboxlist(BBoxList& bbl, const int l);
00613    void databboxlist(BBoxList& bbl, const int l);
00614    /*****************************************************************************/
00615 
00616    /*****************************************************************************/
00617    /* Query boundary info */
00618    /*****************************************************************************/
00619    inline int has_externalboundaries(const int t, const int l, const int c) const
00620         { return (gdb[dagh_timeindex(t,l)][l][c]->has_externalboundaries()); }
00621    inline int has_externalboundary(const int t, const int l, const int c, 
00622                                    const int dir) const
00623         { return (gdb[dagh_timeindex(t,l)][l][c]->has_externalboundary(dir)); }
00624    inline int externalboundaries(const int t, const int l, const int c, 
00625                                  const int dir) const
00626         { return (gdb[dagh_timeindex(t,l)][l][c]->externalboundaries(dir)); }
00627    inline int externalboundaries(const int t, const int l, const int c, const int dir) 
00628         { return (gdb[dagh_timeindex(t,l)][l][c]->externalboundaries(dir)); }
00629    
00630    inline const BBoxList* externalbndrylist(const int t, const int l, const int c, 
00631                                             const int dir) const
00632         { return (gdb[dagh_timeindex(t,l)][l][c]->externalbndrylist(dir)); }
00633    inline BBoxList* externalbndrylist(const int t, const int l, const int c, const int dir) 
00634         { return (gdb[dagh_timeindex(t,l)][l][c]->externalbndrylist(dir)); }
00635 
00636    inline int has_adaptiveboundaries(const int t, const int l, const int c) const
00637         { return (gdb[dagh_timeindex(t,l)][l][c]->has_adaptiveboundaries()); }
00638    inline int has_adaptiveboundary(const int t, const int l, const int c, 
00639                                    const int dir) const
00640         { return (gdb[dagh_timeindex(t,l)][l][c]->has_adaptiveboundary(dir)); }
00641    inline const BBox& adaptivebndrybox(const int t, const int l, const int c, 
00642                                        const int dir) const
00643         { return (gdb[dagh_timeindex(t,l)][l][c]->adaptivebndrybox(dir)); }
00644    inline BBox adaptivebndrybox(const int t, const int l, const int c, const int dir) 
00645         { return (gdb[dagh_timeindex(t,l)][l][c]->adaptivebndrybox(dir)); }
00646    /*****************************************************************************/
00647 
00648    /*****************************************************************************/
00649    /**** Operators ****/
00650    /*****************************************************************************/
00651    inline GridData<GFType,dim> const &operator () (const int t, 
00652                                                    const int l, const int c) const 
00653     { return (gdb[dagh_timeindex(t,l)][l][c]->griddata()); }
00654 
00656    inline GridData<GFType,dim> &operator () (const int t, const int l, const int c) 
00657     { return (gdb[dagh_timeindex(t,l)][l][c]->griddata()); }
00658 
00659    /*********************************************************************/
00660    /* Operators */
00661    /*********************************************************************/
00662    void GF_Fill(const GFType& val, const int time, const int level);
00663 
00664    void GF_Copy(const int t1, const int l1, 
00665                 const GridFunction<GFType,dim>& rhs, 
00666                 const int t2, const int l2, const BBox& where);
00667    void GF_Copy(const int t1, const int l1, 
00668                 const GridFunction<GFType,dim>& rhs, 
00669                 const int t2, const int l2);
00670 
00671    void GF_equals(const int t, const int l, const BBox& where, 
00672                   const GFType& val);
00673    void GF_equals(const int t, const int l, 
00674                   const GFType& val);
00675    void GF_equals(const int t1, const int l1, 
00676                   const GridFunction<GFType,dim>& rhs, 
00677                   const int t2, const int l2, const BBox& where);
00678    void GF_equals(const int t1, const int l1, 
00679                   const GridFunction<GFType,dim>& rhs, 
00680                   const int t2, const int l2);
00681 
00682    void GF_plus(const int t, const int l, const BBox& where, 
00683                 const GFType& val);
00684    void GF_plus(const int t, const int l, const GFType& val);
00685    void GF_plus(const int t1, const int l1, 
00686                 const GridFunction<GFType,dim>& rhs, 
00687                 const int t2, const int l2, const BBox& where);
00688    void GF_plus(const int t1, const int l1, 
00689                 const GridFunction<GFType,dim>& rhs, 
00690                 const int t2, const int l2);
00691 
00692    void GF_minus(const int t, const int l, const BBox& where, 
00693                  const GFType& val);
00694    void GF_minus(const int t, const int l, const GFType& val);
00695    void GF_minus(const int t1, const int l1, 
00696                  const GridFunction<GFType,dim>& rhs, 
00697                  const int t2, const int l2, const BBox& where);
00698    void GF_minus(const int t1, const int l1, 
00699                  const GridFunction<GFType,dim>& rhs, 
00700                  const int t2, const int l2);
00701 
00702    void GF_multiply(const int t, const int l, const BBox& where, 
00703                     const GFType& val);
00704    void GF_multiply(const int t, const int l, const GFType& val);
00705    void GF_multiply(const int t1, const int l1, 
00706                     const GridFunction<GFType,dim>& rhs, 
00707                     const int t2, const int l2, const BBox& where);
00708    void GF_multiply(const int t1, const int l1, 
00709                     const GridFunction<GFType,dim>& rhs, 
00710                     const int t2, const int l2);
00711 
00712    void GF_divide(const int t, const int l, const BBox& where, 
00713                   const GFType& val);
00714    void GF_divide(const int t, const int l, const GFType& val);
00715    void GF_divide(const int t1, const int l1, 
00716                   const GridFunction<GFType,dim>& rhs, 
00717                   const int t2, const int l2, const BBox& where);
00718    void GF_divide(const int t1, const int l1,
00719                   const GridFunction<GFType,dim>& rhs, 
00720                   const int t2, const int l2);
00721    /*********************************************************************/
00722 
00723    /*********************************************************************/
00724    /* Reduction Ops */
00725    /*********************************************************************/
00726    GFType GF_maxval(const int t, const int l);
00727    GFType GF_maxval(const int t, const int l, const BBox& where);
00728 
00729    GFType GF_minval(const int t, const int l);
00730    GFType GF_minval(const int t, const int l, const BBox& where);
00731 
00732    GFType GF_sum(const int t, const int l);
00733    GFType GF_sum(const int t, const int l, const BBox& where);
00734 
00735    GFType GF_product(const int t, const int l);
00736    GFType GF_product(const int t, const int l, const BBox& where);
00737 
00738    double GF_norm(const int t, const int l, const int param=DAGHNormL1);
00739    double GF_norm(const int t, const int l, const BBox& where, const int param=DAGHNormL1);
00740    /*********************************************************************/
00741 
00742    /*********************************************************************/
00743    /* IO Support */
00744    /*********************************************************************/
00745    void GF_Write(const int t, const int l, const int gfdtype, char* ioname=0);
00746    void GF_Write(const int t, const int l, const BBox& where, const int gfdtype, char* ioname=0);
00747 
00748    void GF_Read(const int t, const int l, const int gfdtype, char* ioname=0);
00749    void GF_Read(const int t, const int l, const BBox& where, const int gfdtype, char* ioname=0);
00750    void GF_Read(const int t, const int l, const BBox& to, const BBox& from, 
00751                 const int gfdtype, char* ioname=0);
00752    /*********************************************************************/
00753 
00754    /*****************************************************************************/
00755    /* Some Rudimentary debugging */
00756    /*****************************************************************************/
00757    std::ostream& GF_DebugPrintData(std::ostream& os, const int t, const int l);
00758    std::ostream& GF_DebugPrintIntData(std::ostream& os, const int t, const int l);
00759    std::ostream& GF_DebugPrintDataBlk(std::ostream& os, const int time, const int level);
00760    std::ostream& GF_DebugPrintTheData(std::ostream &os);
00761 
00762    /*****************************************************************************/
00763 
00764    friend std::ostream& operator<< <>(std::ostream&, const GridFunction<GFType,dim>&);
00765   };
00766 
00767 #include "GridFunction.ipp"
00768 #include "GridFunctionComm.ipp"
00769 #include "GridFunctionFuncs.ipp"
00770 #include "GridFunctionOps.ipp"
00771 #include "GridFunctionOpsRed.ipp"
00772 #include "GridFunctionBndry.ipp"
00773 #include "GridFunctionIO.ipp"
00774 
00775 /*********************************************************************/
00776 /*** Set it up ***/
00777 /*********************************************************************/
00778 inline void SetGridFunctionType(GridFunctionVoid& GFV,
00779                                 const int type) 
00780   { GFV.GF_SetGridFunctionType(type); }
00781 
00782 inline void SetCommType(GridFunctionVoid& GFV, const int c)
00783   { GFV.GF_SetCommType(c); }
00784 inline void SetBoundaryType(GridFunctionVoid& GFV, const int b)
00785   { GFV.GF_SetBoundaryType(b); }
00786 inline void SetAdaptBoundaryType(GridFunctionVoid& GFV, const int ab)
00787   { GFV.GF_SetAdaptBoundaryType(ab); }
00788 inline void SetExternalGhostFlag(GridFunctionVoid& GFV, const int e)
00789   { GFV.GF_SetExternalGhostFlag(e); }
00790 
00791 inline void SetProlongFlag(GridFunctionVoid& GFV, const int f)
00792   { GFV.GF_SetProlongFlag(f); }
00793 inline void SetRestrictFlag(GridFunctionVoid& GFV, const int f)
00794   { GFV.GF_SetRestrictFlag(f); }
00795 inline void SetBndryUpdateFlag(GridFunctionVoid& GFV, const int f)
00796   { GFV.GF_SetBndryUpdateFlag(f); }
00797 inline void SetAdaptBndryUpdateFlag(GridFunctionVoid& GFV, const int f)
00798   { GFV.GF_SetAdaptBndryUpdateFlag(f); }
00799 inline void SetIOFlag(GridFunctionVoid& GFV, const int f)
00800   { GFV.GF_SetIOFlag(f); }
00801 inline void SetCheckpointFlag(GridFunctionVoid& GFV, const int f)
00802   { GFV.GF_SetCheckpointFlag(f); }
00803 
00804 inline void SetBoundaryWidth(GridFunctionVoid& GFV, const int bw)
00805   { GFV.GF_BoundaryWidth(bw); }
00806 
00807 inline void SetExternalGhostWidth(GridFunctionVoid& GFV, const int ew)
00808   { GFV.GF_ExternalGhostWidth(ew); }
00809 
00810 inline void SetSpaceStencil(GridFunctionVoid& GFV, const int ss)
00811   { GFV.GF_SetSpaceStencil(ss); }
00812 inline void SetSpaceStencil(GridFunctionVoid& GFV, const int* ss)
00813   { GFV.GF_SetSpaceStencil(ss); }
00814 
00815 inline void SetTimeStencil(GridFunctionVoid& GFV, const int ts)
00816    { GFV.GF_SetTimeStencil(ts); }
00817 
00818 inline void SetTimeAlias(GridFunctionVoid& GFV, const int t, const int to)
00819    { GFV.GF_SetTimeAlias(t, to); }
00820 
00821 inline void SetAlignment(GridFunctionVoid& GFV, const int a)
00822    { GFV.GF_SetAlignment(a); }
00823 
00824 /*************************************************************************/
00825 /* Set/Query Updated Timestep Info */
00826 /*************************************************************************/
00827 inline int UpdatedValueAt(GridFunctionVoid &GFV)
00828    { return GFV.updatedvaluestep(); }
00829 inline void SetUpdatedValueStep(GridFunctionVoid& GFV, const int ustep) 
00830    { GFV.setupdatedvaluestep(ustep); }
00831 
00832 
00833 /*****************************************************************************/
00834 /* set and query user flags */
00835 /*****************************************************************************/
00836 inline void SetUserFlag(GridFunctionVoid& GFV,
00837                         const int id, const DAGHGFVFlagType& f)
00838    { GFV.GF_SetUserFlag(id, f); }
00839 
00840 inline DAGHGFVFlagType GetUserFlag(GridFunctionVoid& GFV,
00841                                    const int id)
00842    { return (GFV.GF_GetUserFlag(id)); }
00843 
00844 /*************************************************************************/
00845 /* Ghost communications */
00846 /*************************************************************************/
00847 inline 
00848 void Sync(std::list<GridFunctionVoid*> &gfvlist, const int t, const int l)
00849   {
00850     std::list<GridFunctionVoid*>::iterator gfv, gfvend = gfvlist.end();
00851     for (gfv = gfvlist.begin(); gfv != gfvend; ++gfv) {
00852       if ((*gfv)->comm()) (*gfv)->GF_WriteGhosts(t,l);
00853       if ((*gfv)->comm()) (*gfv)->GF_ReadGhosts(t,l);
00854     }
00855   }
00856   
00857 inline 
00858 void Sync(std::list<GridFunctionVoid*> &gfvlist, const int t, const int l,
00859           const int axis, const int dir)
00860   {
00861     std::list<GridFunctionVoid*>::iterator gfv, gfvend = gfvlist.end();
00862     for (gfv = gfvlist.begin(); gfv != gfvend; ++gfv) {
00863       if ((*gfv)->comm()) (*gfv)->GF_WriteGhosts(t,l,axis,dir);
00864       if ((*gfv)->comm()) (*gfv)->GF_ReadGhosts(t,l,axis,dir);
00865     }
00866   }
00867 
00868 #endif

Generated on Fri Aug 24 13:00:29 2007 for AMROC's Hierachical Data Structures - by  doxygen 1.4.7