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

glop.hpp

Go to the documentation of this file.
00001 //************************************************************************************//
00002 // Module       : glop.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
00008 // Derived From : none.
00009 // Modifications:
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 // Private methods:
00051  
00052 // Init-specific methods:
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 // DoOp(1)-specific methods:
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 // Handle-specific methods:
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 // General utilities:
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 // Private data:
00101 GSHORT             NProcs;                            // number of processors
00102 GNODEID            nMaxNodes;                         // total number of nodes distributed among all procs
00103 GINT               numGlNode_buffs  [MAX_OPHANDLES];  // number of proc ids(and gl. node buffers), to exchange data with in DoOp
00104 GINT               maxsend          [MAX_OPHANDLES];  // max number of procs to send to
00105 GINT               n_recv           [MAX_OPHANDLES];  // number of procs to recv from
00106 GINT               n_recv_data      [MAX_OPHANDLES];  // number of procs to recv from
00107 GINT               iLocalStack;                       // used for repeat call to GlobalToLocal 
00108 GSHORT             rank;                              // rank of current processor
00109 GSHORT             nUsedHandles;                      // number of handles from pool that are used
00110 GCHBuffer         *opHandle;                          // global operation handle pool
00111 CHandle           *rhandle          [MAX_OPHANDLES];  // basic communication handles
00112 GDOUBLE           *lresult          [MAX_OPHANDLES];  // local op result buffer
00113 GDOUBLE           *gresult          [MAX_OPHANDLES];  // global op result buffer
00114 GSBuffer          *iUsedHandles;                      // indices of used handles
00115 GSBuffer          *srProc_list      [MAX_OPHANDLES];  // proc ids with which to exchange global node values
00116 GIBuffer          *index            [MAX_OPHANDLES];  // local indices in DoOp
00117 GIBuffer          **node_indices_op [MAX_OPHANDLES];  // node indices in DoOp
00118 GNIDBuffer        **srGlNode_buffs  [MAX_OPHANDLES];  // repacked sorted data used by DoOp, containing global nodes to be exchanged with other procs
00119 GNIDBuffer        *LocToGlob        [MAX_OPHANDLES];  // stores the global indices used in call to Init
00120 GINT              **ig2l            [MAX_OPHANDLES];  // stores the global-to-local index transformations
00121 GNIDBuffer        *glob_dups        [MAX_OPHANDLES];  // indices among the LocToGlob which are duplicated--for local operations
00122 GIBuffer          **local_op_indices[MAX_OPHANDLES];  // those indices among the LocToGlob which are duplicated--for local operations
00123 GDBuffer          *u_send           [MAX_OPHANDLES];  // send buffers
00124 GDBuffer          *u_recv           [MAX_OPHANDLES];  // receive buffers
00125 GVector           *gmultiplicity    [MAX_OPHANDLES];  // global id multiplicity
00126 GVector           *vflat            [MAX_OPHANDLES];  // 'flat' vectors used for direct stiffness ops--one for each handle
00127 GNIDBuffer        *g2lbuff;                           // used for repeat call to GlobalToLocal
00128 GNIDBuffer        *glNodeList       [MAX_OPHANDLES];  // used for call to DoOp
00129 GNIDBuffer        *distinct_nodes_op[MAX_OPHANDLES];  // used for call to DoOp
00130 
00131 #if defined(DO_GLOP_TIMING)
00132 GDOUBLE              doop_time;
00133 GDOUBLE              exch_time;
00134 #endif
00135 
00136 };
00137 #endif
00138 

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