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

octUtils.h

Go to the documentation of this file.
00001 
00009 #ifndef _OCTUTILS_H_
00010 #define _OCTUTILS_H_
00011 
00012 #include "mpi.h"
00013 #include <vector>
00014 
00015 #ifdef PETSC_USE_LOG
00016 
00017 #include "petscsys.h"
00018 
00019 namespace ot {
00020   extern int markHangingEvent;
00021   extern int addBdyEvent;
00022   extern int FLNstage1Event;
00023   extern int FLNstage2Event;
00024   extern int FLNstage3Event;
00025   extern int FLNstage4Event;
00026   extern int FLNstage5Event;
00027   extern int FLNstage6Event;
00028   extern int FLNstage7Event;
00029   extern int FLNstage8Event;
00030   extern int FLNstage9Event;
00031   extern int FLNstage10Event;
00032   extern int FLNstage11Event;
00033 
00034   extern int mergeRecvKeysBalEvent; 
00035   extern int prepBalWlistEvent;
00036   extern int prepBalComm1MssgEvent;
00037   extern int prepBalComm2MssgEvent;
00038   extern int finalBalMergeEvent;
00039   extern int mergeComboBalEvent;
00040   extern int pickNhBlocksEvent;
00041   extern int balanceEvent;
00042   extern int balSubtreeEvent;
00043   extern int completeSubtreeEvent;
00044   extern int coarsenEvent;
00045   extern int coarsenSeqEvent;
00046   extern int simpleCoarsenEvent;
00047   extern int mergeOctreesEvent;
00048   extern int rg2oEvent;
00049   extern int p2oEvent;
00050   extern int p2oSeqEvent;
00051   extern int p2oLocalEvent;
00052   extern int n2oEvent;
00053   extern int n2oSeqEvent;
00054   extern int completeRegionEvent;
00055   extern int blockPart1Event;
00056   extern int blockPart2Event;
00057   extern int blockPart3Event;
00058   extern int conBalEvent;
00059   extern int rippleBalEvent;
00060   extern int ptrRippleBalEvent;
00061   extern int parRippleType3Event;
00062   extern int parRippleType2Event;
00063   extern int parRippleType1Event;
00064   extern int comboRippleEvent;
00065   extern int pickBndEvent;
00066   extern int balCommEvent;
00067   extern int balScatterEvent;
00068   extern int balSplitCommEvent;
00069   extern int balBpart1Event;
00070   extern int balBpart2Event;
00071 }
00072 
00073 #define PROF_FLN_STAGE1_BEGIN PetscLogEventBegin(FLNstage1Event,0,0,0,0);
00074 #define PROF_FLN_STAGE1_END PetscLogEventEnd(FLNstage1Event,0,0,0,0); 
00075 
00076 #define PROF_FLN_STAGE2_BEGIN PetscLogEventBegin(FLNstage2Event,0,0,0,0);
00077 #define PROF_FLN_STAGE2_END PetscLogEventEnd(FLNstage2Event,0,0,0,0); 
00078 
00079 #define PROF_FLN_STAGE3_BEGIN PetscLogEventBegin(FLNstage3Event,0,0,0,0);
00080 #define PROF_FLN_STAGE3_END PetscLogEventEnd(FLNstage3Event,0,0,0,0); 
00081 
00082 #define PROF_FLN_STAGE4_BEGIN PetscLogEventBegin(FLNstage4Event,0,0,0,0);
00083 #define PROF_FLN_STAGE4_END PetscLogEventEnd(FLNstage4Event,0,0,0,0); 
00084 
00085 #define PROF_FLN_STAGE5_BEGIN PetscLogEventBegin(FLNstage5Event,0,0,0,0);
00086 #define PROF_FLN_STAGE5_END PetscLogEventEnd(FLNstage5Event,0,0,0,0); 
00087 
00088 #define PROF_FLN_STAGE6_BEGIN PetscLogEventBegin(FLNstage6Event,0,0,0,0);
00089 #define PROF_FLN_STAGE6_END PetscLogEventEnd(FLNstage6Event,0,0,0,0); 
00090 
00091 #define PROF_FLN_STAGE7_BEGIN PetscLogEventBegin(FLNstage7Event,0,0,0,0);
00092 #define PROF_FLN_STAGE7_END PetscLogEventEnd(FLNstage7Event,0,0,0,0); 
00093 
00094 #define PROF_FLN_STAGE8_BEGIN PetscLogEventBegin(FLNstage8Event,0,0,0,0);
00095 #define PROF_FLN_STAGE8_END PetscLogEventEnd(FLNstage8Event,0,0,0,0); 
00096 
00097 #define PROF_FLN_STAGE9_BEGIN PetscLogEventBegin(FLNstage9Event,0,0,0,0);
00098 #define PROF_FLN_STAGE9_END PetscLogEventEnd(FLNstage9Event,0,0,0,0); 
00099 
00100 #define PROF_FLN_STAGE10_BEGIN PetscLogEventBegin(FLNstage10Event,0,0,0,0);
00101 #define PROF_FLN_STAGE10_END PetscLogEventEnd(FLNstage10Event,0,0,0,0); 
00102 
00103 #define PROF_FLN_STAGE11_BEGIN PetscLogEventBegin(FLNstage11Event,0,0,0,0);
00104 #define PROF_FLN_STAGE11_END PetscLogEventEnd(FLNstage11Event,0,0,0,0); 
00105 
00106 #define PROF_MARK_HANGING_BEGIN PetscLogEventBegin(markHangingEvent,0,0,0,0);
00107 #define PROF_MARK_HANGING_END \
00108   PetscLogEventEnd(markHangingEvent,0,0,0,0); \
00109 return ;
00110 
00111 #define PROF_ADD_BDY_BEGIN PetscLogEventBegin(addBdyEvent,0,0,0,0);
00112 #define PROF_ADD_BDY_END \
00113   PetscLogEventEnd(addBdyEvent,0,0,0,0); \
00114 return ;
00115 
00116 #define PROF_BAL_COMM_BEGIN PetscLogEventBegin(balCommEvent,0,0,0,0);
00117 #define PROF_BAL_COMM_END PetscLogEventEnd(balCommEvent,0,0,0,0);
00118 
00119 #define PROF_BAL_SCATTER_BEGIN PetscLogEventBegin(balScatterEvent,0,0,0,0);
00120 #define PROF_BAL_SCATTER_END PetscLogEventEnd(balScatterEvent,0,0,0,0);
00121 
00122 #define PROF_BAL_SPLIT_COMM_BEGIN PetscLogEventBegin(balSplitCommEvent,0,0,0,0);
00123 #define PROF_BAL_SPLIT_COMM_END PetscLogEventEnd(balSplitCommEvent,0,0,0,0);
00124 
00125 #define PROF_BAL_BPART1_BEGIN PetscLogEventBegin(balBpart1Event,0,0,0,0);
00126 #define PROF_BAL_BPART1_END PetscLogEventEnd(balBpart1Event,0,0,0,0);
00127 
00128 #define PROF_BAL_BPART2_BEGIN PetscLogEventBegin(balBpart2Event,0,0,0,0);
00129 #define PROF_BAL_BPART2_END PetscLogEventEnd(balBpart2Event,0,0,0,0);
00130 
00131 #define PROF_MERGE_RECV_KEYS_BAL_BEGIN \
00132   PetscFunctionBegin; \
00133 PetscLogEventBegin(mergeRecvKeysBalEvent,0,0,0,0);
00134 #define PROF_MERGE_RECV_KEYS_BAL_END \
00135   PetscLogEventEnd(mergeRecvKeysBalEvent,0,0,0,0); \
00136 PetscFunctionReturn(0);
00137 
00138 #define PROF_PREP_BAL_WLIST_BEGIN \
00139   PetscFunctionBegin; \
00140 PetscLogEventBegin(prepBalWlistEvent,0,0,0,0);
00141 #define PROF_PREP_BAL_WLIST_END \
00142   PetscLogEventEnd(prepBalWlistEvent,0,0,0,0); \
00143 PetscFunctionReturn(0);
00144 
00145 #define PROF_PREP_BAL_COMM1_MSSG_BEGIN \
00146   PetscFunctionBegin; \
00147 PetscLogEventBegin(prepBalComm1MssgEvent,0,0,0,0);
00148 #define PROF_PREP_BAL_COMM1_MSSG_END \
00149   PetscLogEventEnd(prepBalComm1MssgEvent,0,0,0,0); \
00150 PetscFunctionReturn(0);
00151 
00152 #define PROF_PREP_BAL_COMM2_MSSG_BEGIN \
00153   PetscFunctionBegin; \
00154 PetscLogEventBegin(prepBalComm2MssgEvent,0,0,0,0);
00155 #define PROF_PREP_BAL_COMM2_MSSG_END \
00156   PetscLogEventEnd(prepBalComm2MssgEvent,0,0,0,0); \
00157 PetscFunctionReturn(0);
00158 
00159 #define PROF_FINAL_MERGE_IN_BAL_BEGIN \
00160   PetscFunctionBegin; \
00161 PetscLogEventBegin(finalBalMergeEvent,0,0,0,0);
00162 #define PROF_FINAL_MERGE_IN_BAL_END \
00163   PetscLogEventEnd(finalBalMergeEvent,0,0,0,0); \
00164 PetscFunctionReturn(0);
00165 
00166 #define PROF_MERGE_COMBO_BAL_BEGIN \
00167   PetscFunctionBegin; \
00168 PetscLogEventBegin(mergeComboBalEvent,0,0,0,0);
00169 #define PROF_MERGE_COMBO_BAL_END \
00170   PetscLogEventEnd(mergeComboBalEvent,0,0,0,0); \
00171 PetscFunctionReturn(0);
00172 
00173 #define PROF_PICK_NH_BLOCKS_BEGIN \
00174   PetscFunctionBegin; \
00175 PetscLogEventBegin(pickNhBlocksEvent,0,0,0,0);
00176 #define PROF_PICK_NH_BLOCKS_END \
00177   PetscLogEventEnd(pickNhBlocksEvent,0,0,0,0); \
00178 PetscFunctionReturn(0);
00179 
00180 #define PROF_COMBO_RIPPLE_BEGIN \
00181   PetscFunctionBegin; \
00182 PetscLogEventBegin(comboRippleEvent,0,0,0,0);
00183 #define PROF_COMBO_RIPPLE_END \
00184   PetscLogEventEnd(comboRippleEvent,0,0,0,0); \
00185 PetscFunctionReturn(0);
00186 
00187 #define PROF_SIMPLE_COARSE_BEGIN \
00188   PetscFunctionBegin; \
00189 PetscLogEventBegin(simpleCoarsenEvent,0,0,0,0);
00190 #define PROF_SIMPLE_COARSE_END         \
00191   PetscLogEventEnd(simpleCoarsenEvent,0,0,0,0); \
00192 PetscFunctionReturn(0);
00193 
00194 #define PROF_COARSE_BEGIN \
00195   PetscFunctionBegin; \
00196 PetscLogEventBegin(coarsenEvent,0,0,0,0);
00197 #define PROF_COARSE_END         \
00198   PetscLogEventEnd(coarsenEvent,0,0,0,0); \
00199 PetscFunctionReturn(0);
00200 
00201 #define PROF_COARSE_SEQ_BEGIN \
00202   PetscFunctionBegin; \
00203 PetscLogEventBegin(coarsenSeqEvent,0,0,0,0);
00204 #define PROF_COARSE_SEQ_END         \
00205   PetscLogEventEnd(coarsenSeqEvent,0,0,0,0); \
00206 PetscFunctionReturn(0);
00207 
00208 #define PROF_CON_BAL_BEGIN \
00209   PetscFunctionBegin; \
00210 PetscLogEventBegin(conBalEvent,0,0,0,0);
00211 #define PROF_CON_BAL_END         \
00212   PetscLogEventEnd(conBalEvent,0,0,0,0); \
00213 PetscFunctionReturn(0);
00214 
00215 #define PROF_RIPPLE_BAL_BEGIN \
00216   PetscFunctionBegin; \
00217 PetscLogEventBegin(rippleBalEvent,0,0,0,0);
00218 #define PROF_RIPPLE_BAL_END         \
00219   PetscLogEventEnd(rippleBalEvent,0,0,0,0); \
00220 PetscFunctionReturn(0);
00221 
00222 #define PROF_PTR_RIPPLE_BAL_BEGIN \
00223   PetscFunctionBegin; \
00224 PetscLogEventBegin(ptrRippleBalEvent,0,0,0,0);
00225 #define PROF_PTR_RIPPLE_BAL_END         \
00226   PetscLogEventEnd(ptrRippleBalEvent,0,0,0,0); \
00227 PetscFunctionReturn(0);
00228 
00229 #define PROF_PICK_BND_BEGIN \
00230   PetscFunctionBegin; \
00231 PetscLogEventBegin(pickBndEvent,0,0,0,0);
00232 #define PROF_PICK_BND_END         \
00233   PetscLogEventEnd(pickBndEvent,0,0,0,0); \
00234 PetscFunctionReturn(0);
00235 
00236 #define PROF_BAL_SUBTREE_BEGIN  \
00237   PetscFunctionBegin; \
00238 PetscLogEventBegin(balSubtreeEvent,0,0,0,0);
00239 #define PROF_BAL_SUBTREE_END         \
00240   PetscLogEventEnd(balSubtreeEvent,0,0,0,0); \
00241 PetscFunctionReturn(0);
00242 
00243 #define PROF_COMPLETE_SUBTREE_BEGIN     \
00244   PetscFunctionBegin; \
00245 PetscLogEventBegin(completeSubtreeEvent,0,0,0,0);
00246 #define PROF_COMPLETE_SUBTREE_END         \
00247   PetscLogEventEnd(completeSubtreeEvent,0,0,0,0); \
00248 PetscFunctionReturn(0);
00249 
00250 #define PROF_BAL_BEGIN \
00251   PetscFunctionBegin; \
00252 PetscLogEventBegin(balanceEvent,0,0,0,0);
00253 #define PROF_BAL_END \
00254   PetscLogEventEnd(balanceEvent,0,0,0,0); \
00255 PetscFunctionReturn(0);
00256 
00257 #define PROF_PAR_RIPPLE_TYPE3_BEGIN \
00258   PetscFunctionBegin; \
00259 PetscLogEventBegin(parRippleType3Event,0,0,0,0);
00260 #define PROF_PAR_RIPPLE_TYPE3_END \
00261   PetscLogEventEnd(parRippleType3Event,0,0,0,0); \
00262 PetscFunctionReturn(0);
00263 
00264 #define PROF_PAR_RIPPLE_TYPE2_BEGIN \
00265   PetscFunctionBegin; \
00266 PetscLogEventBegin(parRippleType2Event,0,0,0,0);
00267 #define PROF_PAR_RIPPLE_TYPE2_END \
00268   PetscLogEventEnd(parRippleType2Event,0,0,0,0); \
00269 PetscFunctionReturn(0);
00270 
00271 #define PROF_PAR_RIPPLE_TYPE1_BEGIN \
00272   PetscFunctionBegin; \
00273 PetscLogEventBegin(parRippleType1Event,0,0,0,0);
00274 #define PROF_PAR_RIPPLE_TYPE1_END \
00275   PetscLogEventEnd(parRippleType1Event,0,0,0,0); \
00276 PetscFunctionReturn(0);
00277 
00278 #define PROF_MERGE_OCTREES_BEGIN \
00279   PetscFunctionBegin; \
00280 PetscLogEventBegin(mergeOctreesEvent,0,0,0,0);
00281 #define PROF_MERGE_OCTREES_END \
00282   PetscLogEventEnd(mergeOctreesEvent,0,0,0,0); \
00283 PetscFunctionReturn(0);
00284 
00285 #define PROF_RG2O_BEGIN \
00286   PetscFunctionBegin; \
00287 PetscLogEventBegin(rg2oEvent,0,0,0,0);
00288 #define PROF_RG2O_END \
00289   PetscLogEventEnd(rg2oEvent,0,0,0,0); \
00290 PetscFunctionReturn(0);
00291 
00292 #define PROF_P2O_BEGIN  \
00293   PetscFunctionBegin; \
00294 PetscLogEventBegin(p2oEvent,0,0,0,0);
00295 #define PROF_P2O_END         \
00296   PetscLogEventEnd(p2oEvent,0,0,0,0); \
00297 PetscFunctionReturn(0);
00298 
00299 #define PROF_P2O_SEQ_BEGIN \
00300   PetscFunctionBegin; \
00301 PetscLogEventBegin(p2oSeqEvent,0,0,0,0);
00302 #define PROF_P2O_SEQ_END \
00303   PetscLogEventEnd(p2oSeqEvent,0,0,0,0); \
00304 PetscFunctionReturn(0);
00305 
00306 #define PROF_P2O_LOCAL_BEGIN    \
00307   PetscFunctionBegin; \
00308 PetscLogEventBegin(p2oLocalEvent,0,0,0,0);
00309 #define PROF_P2O_LOCAL_END         \
00310   PetscLogEventEnd(p2oLocalEvent,0,0,0,0); \
00311 PetscFunctionReturn(0);
00312 
00313 #define PROF_N2O_BEGIN  \
00314   PetscFunctionBegin; \
00315 PetscLogEventBegin(n2oEvent,0,0,0,0);
00316 #define PROF_N2O_END         \
00317   PetscLogEventEnd(n2oEvent,0,0,0,0); \
00318 PetscFunctionReturn(0);
00319 
00320 #define PROF_N2O_SEQ_BEGIN      \
00321   PetscFunctionBegin; \
00322 PetscLogEventBegin(n2oSeqEvent,0,0,0,0);
00323 #define PROF_N2O_SEQ_END         \
00324   PetscLogEventEnd(n2oSeqEvent,0,0,0,0); \
00325 PetscFunctionReturn(0);
00326 
00327 #define PROF_COMPLETE_REGION_BEGIN      \
00328   PetscFunctionBegin; \
00329 PetscLogEventBegin(completeRegionEvent,0,0,0,0);
00330 #define PROF_COMPLETE_REGION_END         \
00331   PetscLogEventEnd(completeRegionEvent,0,0,0,0); \
00332 PetscFunctionReturn(0);
00333 
00334 #define PROF_BLKPART1_BEGIN     \
00335   PetscFunctionBegin; \
00336 PetscLogEventBegin(blockPart1Event,0,0,0,0);
00337 #define PROF_BLKPART1_END         \
00338   PetscLogEventEnd(blockPart1Event,0,0,0,0); \
00339 PetscFunctionReturn(0);
00340 
00341 #define PROF_BLKPART2_BEGIN     \
00342   PetscFunctionBegin; \
00343 PetscLogEventBegin(blockPart2Event,0,0,0,0);
00344 #define PROF_BLKPART2_END         \
00345   PetscLogEventEnd(blockPart2Event,0,0,0,0); \
00346 PetscFunctionReturn(0);
00347 
00348 #define PROF_BLKPART3_BEGIN     \
00349   PetscFunctionBegin; \
00350 PetscLogEventBegin(blockPart3Event,0,0,0,0);
00351 #define PROF_BLKPART3_END         \
00352   PetscLogEventEnd(blockPart3Event,0,0,0,0); \
00353 PetscFunctionReturn(0);
00354 
00355 #else
00356 
00357 #define PROF_BAL_COMM_BEGIN 
00358 #define PROF_BAL_SCATTER_BEGIN 
00359 #define PROF_BAL_SPLIT_COMM_BEGIN 
00360 #define PROF_BAL_BPART1_BEGIN 
00361 #define PROF_BAL_BPART2_BEGIN 
00362 #define PROF_FINAL_MERGE_IN_BAL_BEGIN
00363 #define PROF_MERGE_COMBO_BAL_BEGIN
00364 #define PROF_PICK_NH_BLOCKS_BEGIN
00365 #define PROF_COARSE_BEGIN
00366 #define PROF_COARSE_SEQ_BEGIN
00367 #define PROF_SIMPLE_COARSE_BEGIN
00368 #define PROF_BAL_BEGIN
00369 #define PROF_BAL_SUBTREE_BEGIN
00370 #define PROF_COMPLETE_SUBTREE_BEGIN
00371 #define PROF_MERGE_OCTREES_BEGIN
00372 #define PROF_RG2O_BEGIN
00373 #define PROF_P2O_BEGIN
00374 #define PROF_P2O_SEQ_BEGIN
00375 #define PROF_P2O_LOCAL_BEGIN
00376 #define PROF_N2O_BEGIN
00377 #define PROF_N2O_SEQ_BEGIN
00378 #define PROF_COMPLETE_REGION_BEGIN
00379 #define PROF_BLKPART1_BEGIN
00380 #define PROF_BLKPART2_BEGIN
00381 #define PROF_BLKPART3_BEGIN
00382 #define PROF_COMBO_RIPPLE_BEGIN
00383 #define PROF_CON_BAL_BEGIN
00384 #define PROF_RIPPLE_BAL_BEGIN
00385 #define PROF_PTR_RIPPLE_BAL_BEGIN
00386 #define PROF_PAR_RIPPLE_TYPE3_BEGIN
00387 #define PROF_PAR_RIPPLE_TYPE2_BEGIN
00388 #define PROF_PAR_RIPPLE_TYPE1_BEGIN
00389 #define PROF_PICK_BND_BEGIN
00390 #define PROF_PREP_BAL_COMM1_MSSG_BEGIN 
00391 #define PROF_PREP_BAL_WLIST_BEGIN 
00392 #define PROF_PREP_BAL_COMM2_MSSG_BEGIN 
00393 #define PROF_MERGE_RECV_KEYS_BAL_BEGIN 
00394 
00395 #define PROF_BAL_BPART2_END 
00396 #define PROF_BAL_COMM_END 
00397 #define PROF_BAL_SCATTER_END 
00398 #define PROF_BAL_SPLIT_COMM_END 
00399 #define PROF_BAL_BPART1_END 
00400 #define PROF_MERGE_RECV_KEYS_BAL_END return 1;
00401 #define PROF_PREP_BAL_COMM2_MSSG_END return 1;
00402 #define PROF_PREP_BAL_WLIST_END return 1;
00403 #define PROF_PREP_BAL_COMM1_MSSG_END return 1;
00404 #define PROF_FINAL_MERGE_IN_BAL_END return 1;
00405 #define PROF_MERGE_COMBO_BAL_END return 1;
00406 #define PROF_PICK_NH_BLOCKS_END return 1;
00407 #define PROF_COARSE_END return 1; 
00408 #define PROF_COARSE_SEQ_END return 1; 
00409 #define PROF_SIMPLE_COARSE_END return 1; 
00410 #define PROF_BAL_END return 1; 
00411 #define PROF_BAL_SUBTREE_END return 1; 
00412 #define PROF_COMPLETE_SUBTREE_END return 1; 
00413 #define PROF_MERGE_OCTREES_END return 1;
00414 #define PROF_RG2O_END return 1; 
00415 #define PROF_P2O_END return 1; 
00416 #define PROF_P2O_SEQ_END return 1; 
00417 #define PROF_P2O_LOCAL_END return 1; 
00418 #define PROF_N2O_END return 1;
00419 #define PROF_N2O_SEQ_END return 1;
00420 #define PROF_COMPLETE_REGION_END return 1;
00421 #define PROF_BLKPART1_END return 1;
00422 #define PROF_BLKPART2_END return 1;
00423 #define PROF_BLKPART3_END return 1;
00424 #define PROF_COMBO_RIPPLE_END return 1;
00425 #define PROF_CON_BAL_END return 1; 
00426 #define PROF_RIPPLE_BAL_END return 1; 
00427 #define PROF_PTR_RIPPLE_BAL_END return 1; 
00428 #define PROF_PAR_RIPPLE_TYPE3_END return 1; 
00429 #define PROF_PAR_RIPPLE_TYPE2_END return 1; 
00430 #define PROF_PAR_RIPPLE_TYPE1_END return 1; 
00431 #define PROF_PICK_BND_END return 1;
00432 
00433 #define PROF_FLN_STAGE1_BEGIN
00434 #define PROF_FLN_STAGE2_BEGIN
00435 #define PROF_FLN_STAGE3_BEGIN
00436 #define PROF_FLN_STAGE4_BEGIN
00437 #define PROF_FLN_STAGE5_BEGIN
00438 #define PROF_FLN_STAGE6_BEGIN
00439 #define PROF_FLN_STAGE7_BEGIN
00440 #define PROF_FLN_STAGE8_BEGIN 
00441 #define PROF_FLN_STAGE9_BEGIN 
00442 #define PROF_FLN_STAGE10_BEGIN 
00443 #define PROF_FLN_STAGE11_BEGIN 
00444 
00445 #define PROF_FLN_STAGE1_END
00446 #define PROF_FLN_STAGE2_END
00447 #define PROF_FLN_STAGE3_END
00448 #define PROF_FLN_STAGE4_END
00449 #define PROF_FLN_STAGE5_END
00450 #define PROF_FLN_STAGE6_END
00451 #define PROF_FLN_STAGE7_END
00452 #define PROF_FLN_STAGE8_END 
00453 #define PROF_FLN_STAGE9_END 
00454 #define PROF_FLN_STAGE10_END 
00455 #define PROF_FLN_STAGE11_END 
00456 
00457 #define PROF_MARK_HANGING_BEGIN 
00458 #define PROF_MARK_HANGING_END return ;
00459 
00460 #define PROF_ADD_BDY_BEGIN
00461 #define PROF_ADD_BDY_END return;
00462 
00463 #endif
00464 
00468 #define _COMBO_RIPPLE_FACTOR_ 1000000
00469 
00476 namespace ot {
00477 
00478   class TreeNode;
00479 
00480   struct TreeNodePointer;
00481 
00482   void appendOctantsAtLevel(const ot::TreeNodePointer & ptrOctree, 
00483       std::vector<ot::TreeNode> & wList, unsigned int lev);
00484 
00485   void findOctantOrFinestAncestor(ot::TreeNodePointer & octree,
00486       const ot::TreeNode & key, ot::TreeNodePointer* & result);
00487 
00488   void addOctantToTreeNodePointer(ot::TreeNodePointer & ptrOct, const ot::TreeNode & octant);
00489 
00496   void convertLinearToPointer(const std::vector<ot::TreeNode> & linOct, ot::TreeNodePointer & ptrOct);
00497 
00504   void convertPointerToLinear(std::vector<ot::TreeNode> & linOct, const ot::TreeNodePointer & ptrOct);
00505 
00506   void deleteTreeNodePointer(ot::TreeNodePointer & ptrOct);
00507 
00517   void addBoundaryNodesType1( std::vector<ot::TreeNode> &in,
00518       std::vector<ot::TreeNode> &bdy,
00519       unsigned int dim, unsigned int maxDepth);
00520 
00528   void flagNodesType1(std::vector<ot::TreeNode> & in, MPI_Comm comm);
00529 
00536   void flagNodesType2(std::vector<ot::TreeNode> & in, MPI_Comm comm);
00537 
00543   void flagNodesType3(std::vector<ot::TreeNode> & in, MPI_Comm comm);
00544 
00545 
00546   void addBoundaryNodesType2( std::vector<ot::TreeNode>& in,
00547       std::vector<ot::TreeNode> &bdy, unsigned int dim, unsigned int maxDepth);
00548 
00549   void discardExtraBoundaryOctants(std::vector<ot::TreeNode>& in,
00550       unsigned int dim, unsigned int maxDepth);
00551 
00552   void markBoundaryNodesAtAllLevels(std::vector<ot::TreeNode>& finestOctree, unsigned int nlevels,
00553       std::vector<ot::TreeNode>* coarserOctrees, unsigned int maxDepth);
00554 
00555   void markHangingNodesAtAllLevels(std::vector<ot::TreeNode>& finestOctree, unsigned int nlevels, 
00556       std::vector<ot::TreeNode>* coarserOctrees, MPI_Comm* activeComms,
00557       unsigned int dim, unsigned int maxDepth);
00558 
00565   int lineariseList(std::vector<ot::TreeNode> & list, bool skipLast = false);
00566 
00572   int lineariseList(std::vector<ot::TreeNode> & list, MPI_Comm comm);
00573 
00578   bool lessThanUsingWts ( TreeNode  const & a,  TreeNode  const & b);
00579 
00587   int appendCompleteRegion(TreeNode first, TreeNode second, std::vector<ot::TreeNode>& out,
00588       bool includeMin, bool includeMax);
00589 
00594   bool areComparable(TreeNode first, TreeNode second);
00595 
00600   bool bPartComparator(TreeNode a, TreeNode b) ;
00601 
00608   TreeNode getNCA(TreeNode first, TreeNode second);
00609 
00624   int points2Octree(std::vector<double>& points, double * gLens, std::vector<TreeNode> & nodes,
00625       unsigned int dim, unsigned int maxDepth, unsigned int maxNumPtsPerOctant, MPI_Comm comm ) ;
00626 
00640   int regularGrid2Octree(const std::vector<double>& elementValues,
00641       unsigned int N, unsigned int nx, unsigned int ny, unsigned int nz,
00642       unsigned int xs, unsigned int ys, unsigned int zs, std::vector<TreeNode>& linOct,
00643       unsigned int dim, unsigned int maxDepth, double threshold, MPI_Comm comm);
00644 
00651   int mergeOctrees(std::vector<TreeNode>& inOct1, std::vector<TreeNode>& inOct2,
00652       std::vector<TreeNode>& outOct, MPI_Comm comm);
00653 
00659   int points2OctreeSeq(std::vector<double>& pts, double * gLens, std::vector<TreeNode> & nodes,
00660       unsigned int dim, unsigned int maxDepth, unsigned int maxNumPts);
00661 
00668   int p2oLocal(std::vector<TreeNode> & nodes, std::vector<TreeNode>& leaves,
00669       unsigned int maxNumPts, unsigned int dim, unsigned int maxDepth);
00670 
00683   int balanceOctree(std::vector<TreeNode > &in, std::vector<TreeNode > &out,
00684       unsigned int dim, unsigned int maxDepth, bool incCorner, 
00685       MPI_Comm comm, MPI_Comm* newCommPtr = NULL, bool* iAmActive = NULL);
00686 
00692   int mergeComboBalAndPickBoundary(std::vector<ot::TreeNode>& out, 
00693       std::vector<ot::TreeNode>& allBoundaryLeaves,
00694       const ot::TreeNode& firstBlock, const ot::TreeNode& lastBlock);
00695 
00699   int finalMergeInBal(std::vector<ot::TreeNode>& out, std::vector<ot::TreeNode>& allBoundaryLeaves);
00700 
00704   int prepareBalComm1MessagesType2(const std::vector<ot::TreeNode>& allBoundaryLeaves, 
00705       const std::vector<ot::TreeNode>& minsAllBlocks, int rank, unsigned int dim,
00706       unsigned int maxDepth, std::vector<TreeNode>* sendNodes,
00707       std::vector<unsigned int>* sentToPid, int* sendCnt);
00708 
00712   int prepareBalComm1MessagesType1(const std::vector<ot::TreeNode>& allBoundaryLeaves, 
00713       const std::vector<ot::TreeNode>& myNhBlocks, int npes, unsigned int maxDepth, 
00714       std::vector<TreeNode>* sendNodes, std::vector<unsigned int>* sentToPid, int* sendCnt);
00715 
00719   int prepareBalComm2Messages(const std::vector<ot::TreeNode>& allBoundaryLeaves,
00720       const std::vector<ot::TreeNode>& wList,
00721       const std::vector<std::vector<unsigned int> >& wListRanks,
00722       std::vector<TreeNode>* sendNodes, std::vector<unsigned int>* sentToPid, int* sendCnt);
00723 
00727   int prepareWlistInBal(const std::vector<ot::TreeNode>& recvK1, 
00728       const int* recvCnt, int npes, const ot::TreeNode& myFirstBlock,
00729       const ot::TreeNode& myLastBlock, std::vector<TreeNode>& wList,
00730       std::vector<std::vector<unsigned int> >& wListRanks);
00731 
00735   int mergeRecvKeysInBal(const std::vector<ot::TreeNode>& recvK1, const int* recvOffsets1,
00736       const std::vector<ot::TreeNode>& recvK2, const int* recvOffsets2, 
00737       int npes, std::vector<ot::TreeNode>& recvK);
00738 
00742   int selectNeighboringBlocks(const std::vector<TreeNode>& allBlocks,
00743       const std::vector<TreeNode>& blocks, const std::vector<unsigned int>& maxBlockBndVec,
00744       int myRank, std::vector<TreeNode>& myNhBlocks);
00745 
00751   int parallelRippleType1(std::vector<TreeNode> & nodes,
00752       bool incCorners, bool checkBailOut, bool rePart,
00753       unsigned int dim, unsigned int maxDepth,
00754       MPI_Comm comm);
00755 
00761   int parallelRippleType2(std::vector<TreeNode> & nodes,
00762       bool incCorners, bool checkBailOut, bool rePart,
00763       unsigned int dim, unsigned int maxDepth,
00764       MPI_Comm comm);
00765 
00771   int parallelRippleType3(std::vector<TreeNode> & nodes,
00772       bool incCorners, bool checkBailOut, bool rePart,
00773       unsigned int dim, unsigned int maxDepth,
00774       MPI_Comm comm);
00775 
00787   int completeSubtree(TreeNode block, const std::vector<TreeNode > & inp,
00788       std::vector<TreeNode > & out, unsigned int dim,
00789       unsigned int maxDepth, bool isUnique, bool isSorted);
00790 
00804   int completeOctree (const std::vector<TreeNode > &in, std::vector<TreeNode > &out,
00805       unsigned int dim, unsigned int maxDepth, bool isUnique, bool isSorted,
00806       bool assertNoEmptyProcs, MPI_Comm comm);
00807 
00816   int coarsenOctree(const std::vector<TreeNode > &in, std::vector<TreeNode> &out,
00817       unsigned int dim, unsigned int maxDepth, MPI_Comm comm,
00818       bool skipPartition = false, MPI_Comm* newCommPtr = NULL, bool* iAmActive = NULL);
00819 
00825   int simpleCoarsen(const std::vector<TreeNode > &in, std::vector<TreeNode> &out, MPI_Comm comm);
00826 
00832   int coarsenOctree(const std::vector<TreeNode > &in, std::vector<TreeNode> &out); 
00833 
00840   int refineOctree(const std::vector<TreeNode > &in, std::vector<TreeNode> &out); 
00841 
00849   int refineAndPartitionOctree(const std::vector<TreeNode > &in,
00850       std::vector<TreeNode> &out,MPI_Comm comm); 
00851 
00860   int createRegularOctree(std::vector<ot::TreeNode>& out, unsigned int lev, 
00861       unsigned int dim, unsigned int maxDepth, MPI_Comm comm);
00862 
00863   //nodes are partitioned (Used only for p2o) Basically uses a different
00864   //criteria for selecting blocks than the version used for balancing/meshing.
00865   //This is because, for balancing and meshing the input is complete. For p2o,
00866   //the input is typically not complete.
00867   int blockPartStage1_p2o(std::vector<TreeNode> &nodes, std::vector<TreeNode> &blocks,
00868       unsigned int dim, unsigned int maxDepth, MPI_Comm comm);
00869 
00870   int blockPartStage2_p2o(std::vector<TreeNode> &nodes, std::vector<TreeNode> &blocks,
00871       std::vector<ot::TreeNode>& minsAllBlocks, 
00872       unsigned int dim, unsigned int maxDepth, MPI_Comm comm);
00873 
00874   //nodes are partitioned (Used for balancing and meshing)
00875   int blockPartStage1(std::vector<TreeNode> &nodes, std::vector<TreeNode> &blocks,
00876       unsigned int dim, unsigned int maxDepth, MPI_Comm comm);
00877 
00878   //nodes and blocks are partitioned.
00879   int blockPartStage2(std::vector<TreeNode> &nodes, std::vector<TreeNode> &blocks,
00880       std::vector<ot::TreeNode>& minsAllBlocks, 
00881       unsigned int dim, unsigned int maxDepth, MPI_Comm comm);
00882 
00883   int balanceBlocks (const std::vector<TreeNode> &inp,
00884       const std::vector<TreeNode> &blocks,
00885       std::vector<TreeNode> &nodes, std::vector<TreeNode> &allBoundaryLeaves,
00886       bool incCorners, std::vector<unsigned int> *maxBlockBndVec = NULL);
00887 
00888   int comboRipple(std::vector<TreeNode> & in, bool incCorner,
00889       const unsigned int maxNum = _COMBO_RIPPLE_FACTOR_);
00890 
00897   int ripple(std::vector<TreeNode> & nodes, bool incCorners) ;
00898 
00905   int pointerBasedRipple(std::vector<ot::TreeNode> & nodes, bool incCorners);
00906 
00907   int pickInterProcessorBoundaryNodes(const std::vector<ot::TreeNode> & nodes,
00908       std::vector<ot::TreeNode>& bndLeaves,
00909       const ot::TreeNode& firstBlock, const ot::TreeNode& lastBlock);
00910 
00911   int pickInterProcessorBoundaryNodes(const std::vector<ot::TreeNode> & nodes, 
00912       std::vector<unsigned int >& res,
00913       const ot::TreeNode& firstBlock, const ot::TreeNode& lastBlock);
00914 
00915   /*
00916   //old version
00917   int pickInterProcessorBoundaryNodes(const std::vector<ot::TreeNode> & blocks,
00918   const std::vector<ot::TreeNode> &nodes,
00919   std::vector<ot::TreeNode>& bndLeaves,
00920   unsigned int dim, unsigned int maxDepth);
00921 
00922   //old version
00923   int pickInterProcessorBoundaryNodes(const std::vector<ot::TreeNode> & blocks,
00924   const std::vector<ot::TreeNode> &nodes, 
00925   std::vector<unsigned int >& res,
00926   unsigned int dim, unsigned int maxDepth);
00927   */
00928 
00929   char int2char(int dec);
00930   int int2str(int dec,char* numStr) ;
00931 
00938   int readPtsFromFile(char* filename, std::vector<double>& pts);
00939 
00947   int readDataPtsFromFile(char* filename, std::vector<double>& pts, std::vector<double>& ptVals);
00948 
00955   int writePtsToFile(char* filename,  std::vector<double>& pts);
00956 
00964   int writeDataPtsToFile(char* filename, std::vector<double>& pts, std::vector<double>& data);
00965 
00966 
00973   int writeNodesToFile (char* filename, const std::vector<TreeNode> & nodes);
00974 
00981   int readNodesFromFile (char* filename,std::vector<TreeNode > & nodes );
00982 
00983   unsigned int getNodeWeight(const TreeNode * t);
00984 
00985 }//end namespace
00986 
00987 #endif /*OCTUTILS_H_*/
00988 
00989 
00990 

Generated on Tue Mar 24 16:14:01 2009 for DENDRO by  doxygen 1.3.9.1