vtf-logo

DAGHGhostInteraction.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 #ifndef _included_DAGHGhostInteraction_h
00004 #define _included_DAGHGhostInteraction_h
00005 
00011 #include "DAGHParams.h"
00012 #include "GridDataParams.h"
00013 #include "DAGHDefaults.h"
00014 #include "BBox.h"
00015 
00016 #include <iosfwd>
00017 
00018 #ifndef DAGHDefaultInteraction
00019 #define DAGHDefaultInteraction  (DAGHGhostInteraction)
00020 #endif
00021 
00022 
00023 class GhostInteraction 
00024   {
00025    friend std::ostream& operator << (std::ostream&, const GhostInteraction &);
00026 
00027    short Irank;   /* Dimensions 1, 2, or 3 */
00028    short Itype;   /* Ghost Interactions ? */
00029    short Iwidth;  /* Radius of interactions */
00030     
00031    short Itotal;
00032 
00033    short Icounts[DAGHMaxAxis][DAGHMaxDirs];
00034    short *Ilists[DAGHMaxAxis][DAGHMaxDirs];
00035 
00036    short Iinside;
00037  
00038    short Iface_cnt;
00039    short *Ifaces;
00040 
00041    //short Iface_cnt[DAGHMaxAxis][DAGHMaxDirs];
00042    //short *Ifaces[DAGHMaxAxis][DAGHMaxDirs];
00043    //short Icorner_cnt[DAGHMaxAxis][DAGHMaxDirs];
00044    //short *Icorners[DAGHMaxAxis][DAGHMaxDirs];
00045    //short Iedge_cnt[DAGHMaxAxis][DAGHMaxDirs];
00046    //short *Iedges[DAGHMaxAxis][DAGHMaxDirs];
00047 
00048    short FaceFlag;
00049    short CornerFlag;
00050    short EdgeFlag;
00051 
00052    short SimpleFlag;
00053 
00054 public:
00055     
00056    GhostInteraction( const int rank, 
00057                      const int type,
00058                      const int width );    
00059 
00060    GhostInteraction( const int rank, 
00061                      const int fflag, 
00062                      const int cflag, 
00063                      const int eflag, 
00064                      const int type,
00065                      const int width,
00066                      const int simple=DAGHFalse );    
00067 
00068    GhostInteraction( const GhostInteraction &other );
00069 
00070    ~GhostInteraction();    
00071 
00072    void compute_interactions( const int fflag,
00073                               const int cflag,
00074                               const int eflag, 
00075                               const int simple );
00076 
00077    inline int total_interactions() const { return Itotal; }
00078 
00079    inline int num_interactions( const int axis, const int dir ) const
00080                 { return Icounts[axis][dir]; }
00081    inline short const *interactions( const int axis, const int dir ) const
00082                 { return Ilists[axis][dir]; }
00083 
00084    inline int simple() const { return (SimpleFlag == DAGHTrue); }
00085     
00086    inline int inside() const { return Iinside; }
00087 
00088    inline int complement(const int d) const { return Itotal-1-d; }
00089 
00090    //int is_forward(const int i);
00091    //int is_forward(const int i, const int d);
00092 
00093    //int is_backward(const int i);
00094    //int is_backward(const int i, const int d);
00095 
00096    inline int num_faces( const int axis, const int dir ) const
00097                 { return Iface_cnt; }
00098    inline short const *faces( ) const
00099                 { return Ifaces; }
00100    inline short faces( const int axis, const int dir ) const
00101                 { return Ifaces[2*axis+dir]; }
00102     
00103    //inline int num_faces( const int axis, const int dir ) 
00104    //           { return Iface_cnt[axis][dir]; }
00105    //inline short const *faces( const int axis, const int dir ) 
00106    //           { return Ifaces[axis][dir]; }
00107     
00108    //inline int num_corners( const int axis, const int dir ) 
00109    //           { return Icorner_cnt[axis][dir]; }
00110    //inline short const *corners( const int axis, const int dir ) 
00111    //           { return Icorners[axis][dir]; }
00112     
00113    //inline int num_edges( const int axis, const int dir ) 
00114    //           { return Iedge_cnt[axis][dir]; }
00115    //inline short const *edges( const int axis, const int dir ) 
00116    //           { return Iedges[axis][dir]; }
00117     
00118    BBox Ibbox( BBox const &mybb, const int dir, short const *rad ) const ;
00119    BBox Ibbox( BBox const &mybb, const int axis, const int dir, 
00120                short const *rad ) const ;
00121    BBox IbboxFrom( BBox const &mybb, const int dir, short const *rad, 
00122                    const short* olap ) const ;
00123 
00124    inline static int face_flag(const int cf)
00125      { return (cf == DAGHCommSimple || 
00126                cf != DAGHCommNoFace); }
00127 
00128    inline static int corner_flag(const int cf)
00129      { return (cf == DAGHCommSimple || 
00130                cf != DAGHCommFaceOnly && 
00131                cf != DAGHCommNoCorner); }
00132    
00133    inline static int edge_flag(const int cf)
00134      { return (cf == DAGHCommSimple ||
00135                cf != DAGHCommFaceOnly && 
00136                cf != DAGHCommNoEdge); }
00137    
00138    inline static int simple_flag(const int cf)
00139      { return (cf == DAGHCommSimple); }
00140 
00141 private:
00142 
00143    inline int is_inside( const int x, const int y, const int z )
00144                 { return (x==1 && y==1 && z==1); }
00145    inline int is_face( const int x, const int y, const int z )
00146                 { return ((x==1 && y==1 && z!=1) || 
00147                           (x==1 && y!=1 && z==1) ||
00148                           (x!=1 && y==1 && z==1)); }
00149    inline int is_corner( const int x, const int y, const int z )
00150                 { return (x!=1 && y!=1 && z!=1 ); }
00151    inline int is_edge( const int x, const int y, const int z )
00152                 { return ((x==1 && y!=1 && z!=1) || 
00153                           (x!=1 && y==1 && z!=1) ||
00154                           (x!=1 && y!=1 && z==1)); }
00155   };
00156 
00157 std::ostream& operator << (std::ostream&, const GhostInteraction &);
00158 
00159 #endif

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