00001
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;
00028 short Itype;
00029 short Iwidth;
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
00042
00043
00044
00045
00046
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
00091
00092
00093
00094
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
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
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