00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _EBLEVELDATAOPS_H_
00012 #define _EBLEVELDATAOPS_H_
00013
00014 #include "IntVect.H"
00015 #include "LevelData.H"
00016 #include "RefCountedPtr.H"
00017
00018 #include "EBCellFAB.H"
00019 #include "EBCellFactory.H"
00020 #include "EBFluxFAB.H"
00021 #include "EBFluxFactory.H"
00022 #include "EBISLayout.H"
00023 #include "NamespaceHeader.H"
00024
00025 #define EBLEVELDATAOPS_INTERIORREGVOFS 0x1
00026 #define EBLEVELDATAOPS_BOUNDARYREGVOFS 0x2
00027 #define EBLEVELDATAOPS_INTERIORIRREGVOFS 0x4
00028 #define EBLEVELDATAOPS_BOUNDARYIRREGVOFS 0x8
00029
00030 #define EBLEVELDATAOPS_ALLVOFS (EBLEVELDATAOPS_INTERIORREGVOFS | \
00031 EBLEVELDATAOPS_BOUNDARYREGVOFS | \
00032 EBLEVELDATAOPS_INTERIORIRREGVOFS | \
00033 EBLEVELDATAOPS_BOUNDARYIRREGVOFS )
00034
00035 #define EBLEVELDATAOPS_REGULARVOFS (EBLEVELDATAOPS_INTERIORREGVOFS | \
00036 EBLEVELDATAOPS_BOUNDARYREGVOFS )
00037
00038 #define EBLEVELDATAOPS_IRREGULARVOFS (EBLEVELDATAOPS_INTERIORIRREGVOFS | \
00039 EBLEVELDATAOPS_BOUNDARYIRREGVOFS )
00040
00041 #define EBLEVELDATAOPS_BOUNDARYVOFS (EBLEVELDATAOPS_BOUNDARYREGVOFS | \
00042 EBLEVELDATAOPS_IRREGULARVOFS )
00043
00045
00049 class EBLevelDataOps
00050 {
00051 public:
00052 EBLevelDataOps()
00053 {
00054 }
00055
00056 ~EBLevelDataOps(){;}
00057
00059
00061 static void pruneCoveredBoxes(Vector<Box>& a_boxes,
00062 const ProblemDomain& a_domain,
00063 const EBIndexSpace* a_ebisPtr);
00064
00066
00068 static int parallelSum(const int& a_value);
00069
00071
00073 static Real parallelSum(const Real& a_value);
00074
00076
00078 static int parallelMin(const int& a_value);
00079
00081
00083 static int parallelMax(const int& a_value);
00084
00086
00088 static Real parallelMin(const Real& a_value);
00089
00091
00093 static Real parallelMax(const Real& a_value);
00094
00095
00097
00099 static void
00100 averageCellToFaces(LevelData<EBFluxFAB>& a_fluxData,
00101 const LevelData<EBCellFAB>& a_cellData,
00102 const DisjointBoxLayout& a_grids,
00103 const EBISLayout& a_ebisl,
00104 const ProblemDomain& a_domain,
00105 const int& a_comp);
00106
00107
00109
00111 static void
00112 averageCellToFacesMAC(LevelData<EBFluxFAB>& a_fluxData,
00113 const LevelData<EBCellFAB>& a_cellData,
00114 const DisjointBoxLayout& a_grids,
00115 const EBISLayout& a_ebisl,
00116 const ProblemDomain& a_domain);
00117
00118
00120
00122 static void exchangeAll(LevelData<EBCellFAB>& a_phi);
00123
00125
00127 static void exchangeCorners(LevelData<EBCellFAB>& a_data,
00128 const ProblemDomain& a_domain);
00129
00131
00133 static void exchangeComp(LevelData<EBCellFAB>& a_data,
00134 const int& a_comp);
00135
00136
00138
00140 static void exchangeAll(LevelData<EBFluxFAB>& a_phi);
00141
00142
00144
00146 static void exchangeComp(LevelData<EBFluxFAB>& a_data,
00147 const int& a_comp);
00148
00149
00151
00153 static void setIrregVal(LevelData<EBCellFAB>& a_data,
00154 const DisjointBoxLayout& a_dbl,
00155 const EBISLayout& a_ebisl,
00156 const Real& a_value);
00157
00159
00161 static bool checkNANINF(const LevelData<EBCellFAB>&a_data,
00162 const IntVect& a_iv1 = IntVect::Zero,
00163 const IntVect& a_iv2 = IntVect::Zero,
00164 const Real& a_shift = 0.0);
00165
00167
00169 static void getMaxMin(Real& a_maxVal,
00170 Real& a_minVal,
00171 const LevelData<EBCellFAB>& a_data,
00172 const int& a_comp,
00173 const bool& a_doAbs=false);
00175
00177 static void setCoveredVal(LevelData<EBCellFAB>& a_lData,
00178 const Real& a_value);
00179
00180
00182
00184 static void setCoveredVal(LevelData<EBCellFAB>& a_lData,
00185 const int& a_comp,
00186 const Real& a_value);
00187
00189
00191 static void setCoveredVal(LevelData<EBFluxFAB>& a_lData,
00192 const Real& a_value);
00193
00194
00196
00198 static void setCoveredVal(LevelData<EBFluxFAB>& a_lData,
00199 const int& a_comp,
00200 const Real& a_value);
00201
00203
00205 static void averageMultiVofsToRegFAB(LevelData<EBCellFAB>& a_data,
00206 const DisjointBoxLayout& a_dbl,
00207 const EBISLayout& a_ebisl);
00208
00209
00211
00213 static void copyToMultiVofsFromRegFAB(LevelData<EBCellFAB>& a_data,
00214 const DisjointBoxLayout& a_dbl,
00215 const EBISLayout& a_ebisl);
00216
00217
00219
00221 static void defineLevelData(LevelData<EBCellFAB>& a_levelData,
00222 const EBISLayout& a_ebisl,
00223 const DisjointBoxLayout& a_dbl,
00224 const IntVect& a_ghosts,
00225 const int& a_nComp);
00226
00227
00229
00231 static void defineLevelData(LevelData<EBFluxFAB>& a_levelData,
00232 const EBISLayout& a_ebisl,
00233 const DisjointBoxLayout& a_dbl,
00234 const IntVect& a_ghosts,
00235 const int& a_nComp);
00236
00237
00239
00241 static void setToZero(LevelData<EBCellFAB>& a_result);
00242
00243
00245
00247 static void setToZero(LevelData<EBFluxFAB>& a_result);
00248
00249
00251
00253 static void scale(LevelData<EBFluxFAB>& a_lhs,
00254 const Real& a_scale) ;
00255
00256
00258
00260 static void scale(LevelData<EBCellFAB>& a_lhs,
00261 const Real& a_scale) ;
00262
00263
00265
00267 static void scale(LevelData<EBCellFAB>& a_lhs,
00268 const Real& a_scale,
00269 const int& a_comp);
00270
00271
00273
00275 static void setVal(LevelData<EBCellFAB>& a_result,
00276 const Real& a_value);
00277
00279
00281 static void setVal(LevelData<EBCellFAB>& a_result,
00282 const Real& a_value,
00283 const int& a_comp);
00284
00286
00288 static void setVal(LevelData<EBFluxFAB>& a_result,
00289 const Real& a_value);
00290
00292
00294 static void assign(LevelData<EBCellFAB>& a_to,
00295 const LevelData<EBCellFAB>& a_from,
00296 const Interval& a_toInterva,
00297 const Interval& a_fromInterval);
00298
00299
00301
00303 static void assign(LevelData<EBCellFAB>& a_lhs,
00304 const LevelData<EBCellFAB>& a_rhs);
00305
00306
00308
00310 static void clone(LevelData<EBCellFAB>& a_lhs,
00311 const LevelData<EBCellFAB>& a_rhs);
00312
00313
00315
00317 static void assign(LevelData<EBFluxFAB>& a_lhs,
00318 const LevelData<EBFluxFAB>& a_rhs);
00319
00320
00322
00324 static void incr( LevelData<EBCellFAB>& a_lhs,
00325 const LevelData<EBCellFAB>& a_rhs,
00326 const Real& a_scale);
00327
00328
00330
00332 static void incr( LevelData<EBCellFAB>& a_lhs,
00333 const Real& a_scale);
00334
00335
00337
00339 static void axby( LevelData<EBCellFAB>& a_lhs,
00340 const LevelData<EBCellFAB>& a_x,
00341 const LevelData<EBCellFAB>& a_y,
00342 const Real& a,
00343 const Real& b);
00344
00345
00347
00349 static void axby( LevelData<EBCellFAB>& a_lhs,
00350 const LevelData<EBCellFAB>& a_x,
00351 const LevelData<EBCellFAB>& a_y,
00352 const Real& a,
00353 const Real& b,
00354 const int& a_lhsComp,
00355 const int& a_xComp,
00356 const int& a_yComp);
00357
00358
00359
00361
00363 static void sum(LevelData<EBCellFAB>& a_result,
00364 const LevelData<EBCellFAB>& a_in1,
00365 const LevelData<EBCellFAB>& a_in2);
00366
00367
00369
00371 static void addConstant(LevelData<EBCellFAB>& a_data,
00372 const Real& a_constant);
00373
00374
00376
00378 static void power(LevelData<EBCellFAB>& a_result,
00379 const Real& a_exponent,
00380 const int& a_comp);
00381
00383
00385 static void product(LevelData<EBCellFAB>& a_result,
00386 const LevelData<EBCellFAB>& a_in1,
00387 const LevelData<EBCellFAB>& a_in2);
00388
00389
00391
00393 static void product(LevelData<EBFluxFAB>& a_result,
00394 const LevelData<EBFluxFAB>& a_in1,
00395 const LevelData<EBFluxFAB>& a_in2);
00396
00397
00399
00401 static void product(LevelData<EBCellFAB>& a_result,
00402 const LevelData<EBCellFAB>& a_in1,
00403 const LevelData<EBCellFAB>& a_in2,
00404 const int& a_rComp,
00405 const int& a_1Comp,
00406 const int& a_2Comp);
00407
00408
00410
00412 static void invert(LevelData<EBCellFAB>& a_result,
00413 const LevelData<EBCellFAB>& a_in1);
00414
00415
00417
00419 static void divideVectorByScalar(LevelData<EBCellFAB>& a_vectorOut,
00420 const LevelData<EBCellFAB>& a_vectorIn,
00421 const LevelData<EBCellFAB>& a_scalar);
00422
00424
00426 static void divide(LevelData<EBCellFAB>& a_result,
00427 const LevelData<EBCellFAB>& a_in1,
00428 const LevelData<EBCellFAB>& a_in2);
00429
00430
00432
00434 static void divide(LevelData<EBCellFAB>& a_result,
00435 const LevelData<EBCellFAB>& a_in1,
00436 const LevelData<EBCellFAB>& a_in2,
00437 const int& a_rComp,
00438 const int& a_1Comp,
00439 const int& a_2Comp);
00440
00441
00443
00445 static void kappaWeight(LevelData<EBCellFAB>& a_data);
00446
00447
00449
00451 static void kappaWeight(EBCellFAB& a_data);
00452
00453
00455
00457 static void kappaScale(LevelData<EBCellFAB>& a_data,
00458 const Real& a_scale);
00459
00460
00462
00464 static Real kappaNorm(Real& a_volume,
00465 const LevelData<EBCellFAB>& a_data,
00466 int a_which,
00467 const ProblemDomain& a_domain,
00468 int a_p=2);
00469
00470
00472
00474 static Vector<Real> vectorKappaNorm(Real& a_volume,
00475 const LevelData<EBCellFAB>& a_data,
00476 int a_which,
00477 const ProblemDomain& a_domain,
00478 int a_p=2);
00479
00480
00482
00484 static Real noKappaNorm(Real& a_volume,
00485 const LevelData<EBCellFAB>& a_data,
00486 int a_which,
00487 const ProblemDomain& a_domain,
00488 int a_p=2);
00489
00490
00492
00494 static Real kappaDotProduct(Real& a_volume,
00495 const LevelData<EBCellFAB>& a_data1,
00496 const LevelData<EBCellFAB>& a_data2,
00497 int a_which,
00498 const ProblemDomain& a_domain);
00499
00500
00502
00504 static Real noKappaDotProduct(Real& a_volume,
00505 const LevelData<EBCellFAB>& a_data1,
00506 const LevelData<EBCellFAB>& a_data2,
00507 int a_which,
00508 const ProblemDomain& a_domain);
00509
00510
00512
00514 static Real kappaSumLevel(Real& a_volume,
00515 const LevelData<EBCellFAB>& a_data,
00516 int a_which,
00517 const ProblemDomain& a_domain);
00518
00519
00521
00523 static Real noKappaSumLevel(Real& a_volume,
00524 const LevelData<EBCellFAB>& a_data,
00525 int a_which,
00526 const ProblemDomain& a_domain);
00527
00528
00530
00532 static Vector<Real> vectorSumKappaPow(Real& a_volume,
00533 const EBCellFAB& a_data, const Box& curBox,
00534 int a_which,
00535 const ProblemDomain& a_domain,
00536 int a_p);
00537
00539
00541 static Real sumKappaPow(Real& a_volume,
00542 const EBCellFAB& a_data, const Box& a_region,
00543 int a_which,
00544 const ProblemDomain& a_domain,
00545 int a_p);
00546
00547
00549
00551 static Real sumNoKappaPow(Real& a_volume,
00552 const EBCellFAB& a_data,const Box& a_region,
00553 int a_which,
00554 const ProblemDomain& a_domain,
00555 int a_p);
00556
00557
00559
00561 static Real sumKappaDotProduct(Real& a_volume,
00562 const EBCellFAB& a_data1,
00563 const EBCellFAB& a_data2,const Box& a_region,
00564 int a_which,
00565 const ProblemDomain& a_domain);
00566
00567
00569
00571 static Real sumNoKappaDotProduct(Real& a_volume,
00572 const EBCellFAB& a_data1,
00573 const EBCellFAB& a_data2,const Box& a_region,
00574 int a_which,
00575 const ProblemDomain& a_domain);
00576
00577
00579
00581 static Real sumKappa(Real& a_volume,
00582 const EBCellFAB& a_data,const Box& a_region,
00583 int a_which,
00584 const ProblemDomain& a_domain);
00585
00586
00588
00590 static Real sumNoKappa(Real& a_volume,
00591 const EBCellFAB& a_data,const Box& a_region,
00592 int a_which,
00593 const ProblemDomain& a_domain);
00594
00596
00598
00600 static void
00601 averageCellToFace(EBFaceFAB& a_faceData,
00602 const EBCellFAB& a_cellData,
00603 const EBGraph& a_ebGraph,
00604 const Box& a_dblBox,
00605 const int& a_ghostFlux,
00606 const int& a_idir,
00607 const ProblemDomain& a_domain,
00608 const int& a_cellComp,
00609 const int& a_faceComp);
00610
00611
00613
00615 static void gatherBroadCast(Real& a_accum, Real& a_volume, const int& a_p);
00616
00618
00620 static void gatherBroadCast(Vector<Real>& a_accum, Real& a_volume, const int& a_p);
00621
00622
00624
00626 static Real sum(const LevelData<EBCellFAB> & a_data,
00627 const DisjointBoxLayout & a_grids,
00628 const EBISLayout & a_ebisl,
00629 const IntVectSet & a_ivsExclude,
00630 int a_comp,
00631 bool a_mutiplyByKappa);
00632 private:
00633
00634 };
00635 #include "NamespaceFooter.H"
00636 #endif