Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

glopdw.hpp

Go to the documentation of this file.
00001 //************************************************************************************//
00002 // Module       : glopdw.hpp
00003 // Date         : 2/14/02 (DLR)
00004 // Copyright    : 2002-2006 Copyright University Corporation for Atmospheric
00005 //                Research
00006 // Description  : Encapsulates the methods and data associated with
00007 //                a geometry--free global gather/scatter operator; uses
00008 //                a formulation that accepts GDWORD data and parses it
00009 //                into HiWord and LoWord data.
00010 // Derived From : none.
00011 // Modifications:
00012 //************************************************************************************//
00013 #if !defined(GLOPDW_HPP)
00014 #define GLOPDW_HPP
00015 
00016 #include "elem2d.hpp"
00017 #include "gtvector.hpp"
00018 #include "gtbuffer.hpp"
00019 #include "gttlist.hpp"
00020 #include "gs.hpp"
00021 
00022 #if defined(DO_GLOP_TIMING)
00023 enum SETIMER_RESULT_T {SETTR_OP, SETTR_EXCH};
00024 #endif
00025 
00026 class GlOpDW: public GS 
00027 {
00028 public:
00029                   GlOpDW(GBOOL useHiWordData=FALSE);
00030                  ~GlOpDW();
00031                   GlOpDW(const GlOpDW &a);
00032 GlOpDW             &operator=(const GlOpDW &);
00033                    
00034 
00035 GCHandle          Init(GDWBuffer  *glob_index, GINT  maxindex);
00036 GBOOL             DoOp (GDOUBLE *u,  GINT  ulen, G_OP op, GCHandle hand);
00037 GVector           DoOp (GVector &u,  G_OP op, GCHandle hand);
00038 GBOOL             DSOp (GVector **u,  GINT  nop, G_OP op, GCHandle hand);
00039 GBOOL             DSOp (GVecList &u,   G_OP op, GCHandle hand);
00040 #if defined (GENERALIZED_EXCHANGE)
00041 GBOOL             DoOp (void *u,  GINT  ulen, GC_DATATYPE dtype, G_OP op, GCHandle hand);
00042 #endif
00043 GVector          *iMultiplicity(GINT  ie, GCHandle hand);
00044 GBOOL             FreeHandle(GCHandle);
00045 
00046 #if defined(DO_GLOP_TIMING)
00047 GDOUBLE             GetTimes(SETIMER_RESULT_T type);
00048 #endif
00049 
00050 private:
00051 // Private methods:
00052  
00053 // Init-specific methods:
00054 GCHandle          InitSort(GDWBuffer  *glob_index, GDWORD MaxNodes, 
00055                           GWBuffer  **&irPrBin, GWBuffer  **&irHiBin, 
00056                           GINT  &numRecvBins, GINT  &maxSharedNodes,
00057                           GINT  &PRrec_len  , GINT  &HIrec_len);
00058 GINT              BinSort(GDWBuffer  *glob_indices,  
00059                           GIBuffer  *&bInRange_, GIBuffer  *&nInRange_, GDWBuffer  *&iWorkNodes_);
00060 
00061 GBOOL             DoCommonNodeSort(GINT  maxSharedNodes, GINT  Proc_rec_length, GINT  HiWrd_rec_length,
00062                                    GDWBuffer  *Input[], GSBuffer   *procIDs, 
00063                                    GWBuffer   *ProcSortOutput[], GWBuffer  *HiWrdSortOutput[],
00064                                    const GINT  NumberOfListBuffers);
00065 GBOOL             Repack(GWBuffer  **, GINT , GINT , GINT , GINT , GSBuffer  *&,
00066                          GWBuffer  **&, GINT  & );
00067 GBOOL             GetRecord(GINT  index, GWBuffer  *rec_buff, GINT  max_length,
00068                             GWORD *iGlobal, GSHORT  **proc_buff, GSHORT  *num_procs);
00069 GBOOL             BinFill(GDWBuffer  *nodelist, GDWBuffer  *bins[]);
00070 
00071 // DoOp(1)-specific methods:
00072 GBOOL             CombineLocal(GDOUBLE *u, GINT  n, GIBuffer  **ilocal, GINT  n_comb, G_OP op, GDOUBLE *&result);
00073 GBOOL             SetGlobalNodeVal(GCHandle h, GDOUBLE *u, GINT  n, const GWORD  glNode, const GDOUBLE val);
00074 GBOOL             Data_Exchange     (GCHandle h, GDOUBLE *send_data, GDOUBLE *&recv_data, GINT  &n_recv, GWBuffer  *&list);
00075 
00076 #if defined (GENERALIZED_EXCHANGE)
00077 DoOp(2)- specific methods:
00078 GBOOL             CombineLocal(void *u, GINT  n, GC_DATATYPE dtype, GIBuffer  **ilocal, GINT  n_comb, G_OP op, void *&result);
00079 GBOOL             SetGlobalNodeVal(GCHandle h, void *u, GINT  n, GC_DATATYPE dtype, GWORD glNode, void *val);
00080 GBOOL             Data_Exchange     (GCHandle h, void *send_data, void *&recv_data, GINT  &n_recv, GC_DATATYPE dtype, GIBuffer  *&list);
00081 #endif
00082 
00083 // Handle-specific methods:
00084 GCHandle          GetNewHandle();
00085 GSHORT            HandleIndex(GCHandle h );
00086 void              FreeHandleMem(GCHandle h );
00087 GINT              GlobalToLocal(GWBuffer  *g2lbuffer,GINT  istart,  GWORD  global_index);
00088 GBOOL             GetMultiplicity(GWBuffer  *inlist, GWBuffer  *&distinct_nodes, 
00089                                   GIBuffer   **&index_buffs);
00090 GBOOL             ComputeGlobalMultiplicity(GCHandle hand, GVector *&global_mult_buff);
00091 
00092 // General utilities:
00093 GBOOL             IndexSort(GWBuffer  &);
00094 GBOOL             IndexSort(GWBuffer  &, GIBuffer  &);
00095 #if  !defined(GKEY_EQUAL_GINT )
00096 GBOOL             IndexSort(GDWBuffer &, GIBuffer  &);
00097 #endif
00098 #if  !defined(GSHORT_EQUAL_GINT )
00099 GBOOL             IndexSort(GSBuffer  &);
00100 GBOOL             IndexSort(GSBuffer  &, GIBuffer  &);
00101 #endif
00102 void              DeleteDynamic();
00103 
00104 // Private data:
00105 GSHORT             NProcs;                            // number of processors
00106 GINT               nMaxNodes;                       // total number of nodes distributed among all procs
00107 GINT               numGlNode_buffs  [MAX_OPHANDLES];  // number of proc ids(and gl. node buffers), to exchange data with in DoOp
00108 GINT               iLocalStack;                       // used for repeat call to GlobalToLocal 
00109 GSHORT             rank;                              // rank of current processor
00110 GSHORT             nUsedHandles;                      // number of handles from pool that are used
00111 GBOOL              bHiWordUsed;                       // use high-word of node data?
00112 GHBuffer          *opHandle;                          // global operation handle pool
00113 GSBuffer          *iUsedHandles;                      // indices of used handles
00114 GSBuffer          *srProc_list      [MAX_OPHANDLES];  // proc ids with which to exchange global node values
00115 GWBuffer          **srGlNode_buffs   [MAX_OPHANDLES]; // repacked sorted data used by DoOp, containing global nodes to be exchanged with other procs
00116 GWBuffer          *LocToGlob        [MAX_OPHANDLES];  // stores the global indices used in call to Init
00117 GINT              **ig2l             [MAX_OPHANDLES]; // stores the global-to-local index transformations
00118 GWBuffer          *glob_dups        [MAX_OPHANDLES];  // indices among the LocToGlob which are duplicated--for local operations
00119 GIBuffer          **local_op_indices [MAX_OPHANDLES]; // those indices among the LocToGlob which are duplicated--for local operations
00120 GVector           *gmultiplicity    [MAX_OPHANDLES];  // global id multiplicity
00121 GVector           *vflat            [MAX_OPHANDLES];  // 'flat' vectors used for direct stiffness ops--one for each handle
00122 GWBuffer          *g2lbuff;                           // used for repeat call to GlobalToLocal
00123 
00124 #if defined(DO_GLOP_TIMING)
00125 GDOUBLE              doop_time;
00126 GDOUBLE              exch_time;
00127 #endif
00128 
00129 };
00130 #endif
00131 

Generated on Wed Dec 21 16:00:48 2005 for Geophysics & Astrophysics Spectral Element Adaptive Refinement (GASpAR) 2D Code by  doxygen 1.4.4