00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #if !defined(GLOP_HPP)
00012 #define GLOP_HPP
00013
00014 #include "elem2d.hpp"
00015 #include "gtvector.hpp"
00016 #include "gtbuffer.hpp"
00017 #include "gttlist.hpp"
00018 #include "gs.hpp"
00019 #include "gcomm.hpp"
00020
00021 #if defined(DO_GLOP_TIMING)
00022 enum SETIMER_RESULT_T {SETTR_OP, SETTR_EXCH};
00023 #endif
00024
00025 class GlOp: public GS
00026 {
00027 public:
00028 GlOp();
00029 ~GlOp();
00030 GlOp(const GlOp &a);
00031 GlOp &operator=(const GlOp &);
00032
00033
00034 GCHandle Init(GNIDBuffer *glob_index, GNODEID maxindex);
00035 GBOOL DoOp (GDOUBLE *u, GINT ulen, G_OP op, GCHandle hand);
00036 GVector DoOp (GVector &u, G_OP op, GCHandle hand);
00037 GBOOL DSOp (GVector **u, GINT nop, G_OP op, GCHandle hand);
00038 GBOOL DSOp (GVecList &u, G_OP op, GCHandle hand);
00039 #if defined (GENERALIZED_EXCHANGE)
00040 GBOOL DoOp (void *u, GINT ulen, GC_DATATYPE dtype, G_OP op, GCHandle hand);
00041 #endif
00042 GVector *iMultiplicity(GINT ie, GCHandle hand);
00043 GBOOL FreeHandle(GCHandle);
00044
00045 #if defined(DO_GLOP_TIMING)
00046 GDOUBLE GetTimes(SETIMER_RESULT_T type);
00047 #endif
00048
00049 private:
00050
00051
00052
00053 GCHandle InitSort(GNIDBuffer *glob_index, GNODEID MaxNodes,
00054 GNIDBuffer **&irPrBin,
00055 GINT &numRecvBins, GINT &maxSharedNodes,
00056 GINT &PRrec_len );
00057 GINT BinSort(GNIDBuffer *glob_indices,
00058 GIBuffer *&bInRange_, GIBuffer *&nInRange_, GNIDBuffer *&iWorkNodes_);
00059
00060 GBOOL DoCommonNodeSort(GINT maxSharedNodes, GINT Proc_rec_length,
00061 GNIDBuffer *Input[], GSBuffer *procIDs,
00062 GNIDBuffer *ProcSortOutput[],
00063 const GINT NumberOfListBuffers);
00064 GBOOL Repack(GNIDBuffer **, GINT , GINT , GINT , GINT , GSBuffer *&,
00065 GNIDBuffer **&, GINT & );
00066 GBOOL GetRecord(GINT index, GNIDBuffer *rec_buff, GINT max_length,
00067 GNODEID *iGlobal, GSHORT *&proc_buff, GSHORT &num_procs);
00068 GBOOL BinFill(GNIDBuffer *nodelist, GNIDBuffer *bins[]);
00069
00070
00071 GBOOL CombineLocal(GDOUBLE *u, GINT n, GIBuffer **ilocal, GINT n_comb, G_OP op, GDOUBLE *result);
00072 GBOOL SetGlobalNodeVal(GCHandle h, GDOUBLE *u, GINT n, const GNODEID glNode, const GDOUBLE val);
00073 GBOOL Data_Exchange (GCHandle h, GDOUBLE *send_data, GDOUBLE *recv_data, GINT &n_recv);
00074
00075 #if defined (GENERALIZED_EXCHANGE)
00076 DoOp(2)- specific methods:
00077 GBOOL CombineLocal(void *u, GINT n, GC_DATATYPE dtype, GIBuffer **ilocal, GINT n_comb, G_OP op, void *&result);
00078 GBOOL SetGlobalNodeVal(GCHandle h, void *u, GINT n, GC_DATATYPE dtype, GNODEID glNode, void *val);
00079 GBOOL Data_Exchange (GCHandle h, void *send_data, void *&recv_data, GINT &n_recv, GC_DATATYPE dtype, GIBuffer *&list);
00080 #endif
00081
00082
00083 GCHandle GetNewHandle();
00084 GSHORT HandleIndex(GCHandle h );
00085 void FreeHandleMem(GCHandle h );
00086 GINT GlobalToLocal(GNIDBuffer *g2lbuffer,GINT istart, GNODEID global_index);
00087 GBOOL GetMultiplicity(GNIDBuffer *inlist, GNIDBuffer *&distinct_nodes,
00088 GIBuffer **&index_buffs);
00089 GBOOL ComputeGlobalMultiplicity(GCHandle hand, GVector *&global_mult_buff);
00090
00091
00092 GBOOL IndexSort(GNIDBuffer &);
00093 GBOOL IndexSort(GNIDBuffer &, GIBuffer &);
00094 #if defined(GBUFF_DEF_GSHORT)
00095 GBOOL IndexSort(GSBuffer &);
00096 GBOOL IndexSort(GSBuffer &, GIBuffer &);
00097 #endif
00098 void DeleteDynamic();
00099
00100
00101 GSHORT NProcs;
00102 GNODEID nMaxNodes;
00103 GINT numGlNode_buffs [MAX_OPHANDLES];
00104 GINT maxsend [MAX_OPHANDLES];
00105 GINT n_recv [MAX_OPHANDLES];
00106 GINT n_recv_data [MAX_OPHANDLES];
00107 GINT iLocalStack;
00108 GSHORT rank;
00109 GSHORT nUsedHandles;
00110 GCHBuffer *opHandle;
00111 CHandle *rhandle [MAX_OPHANDLES];
00112 GDOUBLE *lresult [MAX_OPHANDLES];
00113 GDOUBLE *gresult [MAX_OPHANDLES];
00114 GSBuffer *iUsedHandles;
00115 GSBuffer *srProc_list [MAX_OPHANDLES];
00116 GIBuffer *index [MAX_OPHANDLES];
00117 GIBuffer **node_indices_op [MAX_OPHANDLES];
00118 GNIDBuffer **srGlNode_buffs [MAX_OPHANDLES];
00119 GNIDBuffer *LocToGlob [MAX_OPHANDLES];
00120 GINT **ig2l [MAX_OPHANDLES];
00121 GNIDBuffer *glob_dups [MAX_OPHANDLES];
00122 GIBuffer **local_op_indices[MAX_OPHANDLES];
00123 GDBuffer *u_send [MAX_OPHANDLES];
00124 GDBuffer *u_recv [MAX_OPHANDLES];
00125 GVector *gmultiplicity [MAX_OPHANDLES];
00126 GVector *vflat [MAX_OPHANDLES];
00127 GNIDBuffer *g2lbuff;
00128 GNIDBuffer *glNodeList [MAX_OPHANDLES];
00129 GNIDBuffer *distinct_nodes_op[MAX_OPHANDLES];
00130
00131 #if defined(DO_GLOP_TIMING)
00132 GDOUBLE doop_time;
00133 GDOUBLE exch_time;
00134 #endif
00135
00136 };
00137 #endif
00138