00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011 #ifndef _EBAMRDATAOPS_H_
00012 #define _EBAMRDATAOPS_H_
00013
00014 #include "EBLevelDataOps.H"
00015 #include "FaceIterator.H"
00016 #include "EBFluxFAB.H"
00017 #include "EBCoarseAverage.H"
00018 #include "EBCoarsen.H"
00019 #include "EBQuadCFInterp.H"
00020 #include "EBPWLFillPatch.H"
00021 #include "EBIndexSpace.H"
00022 #include "EBAMRIO.H"
00023 #include "EBLevelGrid.H"
00024 #include "NamespaceHeader.H"
00025
00026 #define EBAMRDATAOPS_INTERIORREGVOFS 0x1
00027 #define EBAMRDATAOPS_BOUNDARYREGVOFS 0x2
00028 #define EBAMRDATAOPS_INTERIORIRREGVOFS 0x4
00029 #define EBAMRDATAOPS_BOUNDARYIRREGVOFS 0x8
00030
00031 #define EBAMRDATAOPS_ALLVOFS (EBAMRDATAOPS_INTERIORREGVOFS | \
00032 EBAMRDATAOPS_BOUNDARYREGVOFS | \
00033 EBAMRDATAOPS_INTERIORIRREGVOFS | \
00034 EBAMRDATAOPS_BOUNDARYIRREGVOFS )
00035
00036 #define EBAMRDATAOPS_REGULARVOFS (EBAMRDATAOPS_INTERIORREGVOFS | \
00037 EBAMRDATAOPS_BOUNDARYREGVOFS )
00038
00039 #define EBAMRDATAOPS_IRREGULARVOFS (EBAMRDATAOPS_INTERIORIRREGVOFS | \
00040 EBAMRDATAOPS_BOUNDARYIRREGVOFS )
00041
00042 #define EBAMRDATAOPS_BOUNDARYVOFS (EBAMRDATAOPS_BOUNDARYREGVOFS | \
00043 EBAMRDATAOPS_IRREGULARVOFS )
00044
00045
00046
00047
00048 class EBAMRDataOps
00049 {
00050 public:
00051 EBAMRDataOps()
00052 {
00053 }
00054
00055
00056
00057
00058
00059
00060
00061
00062 static void
00063 getErrorFromCoarseAndFine(Vector< LevelData<EBCellFAB>* >& a_errorCoar,
00064 const Vector< LevelData<EBCellFAB>* >& a_solnCoar,
00065 const Vector< DisjointBoxLayout >& a_gridsCoar,
00066 const Vector< EBISLayout >& a_ebislCoar,
00067 const ProblemDomain& a_level0DomainCoar,
00068 const Vector< LevelData<EBCellFAB>* >& a_solnFine,
00069 const Vector< DisjointBoxLayout >& a_gridsFine,
00070 const Vector< EBISLayout >& a_ebislFine,
00071 const ProblemDomain& a_level0DomainFine,
00072 const Vector<int>& a_refRat,
00073 bool a_kappaAlreadyMultipliedIn = false);
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 static void
00084 getErrorFromCoarseAndFine(LevelData<EBCellFAB>& a_errorCoar,
00085 const LevelData<EBCellFAB>& a_solnCoar,
00086 const DisjointBoxLayout & a_gridsCoar,
00087 const EBISLayout & a_ebislCoar,
00088 const ProblemDomain& a_level0DomainCoar,
00089 const LevelData<EBCellFAB>& a_solnFine,
00090 const DisjointBoxLayout & a_gridsFine,
00091 const EBISLayout & a_ebislFine,
00092 const ProblemDomain& a_level0DomainFine,
00093 bool a_kappaAlreadyMultipliedIn = false);
00094
00095 ~EBAMRDataOps()
00096 {
00097 }
00098
00099
00100
00101
00102
00103 static int countVoF(const Vector<DisjointBoxLayout>& a_dbl,
00104 const Vector<EBISLayout>& a_ebisl,
00105 const Vector<ProblemDomain>& a_domain);
00106
00107
00108
00109
00110
00111 static void averageCellToFacesMAC(Vector<LevelData<EBFluxFAB>* >& a_dataFlux,
00112 const Vector<LevelData<EBCellFAB>* >& a_dataCell,
00113 const Vector<EBLevelGrid>& a_eblg,
00114 const Vector<int>& a_refRatio);
00115
00116
00117
00118
00119
00120
00121 static void averageCellToFaces(Vector<LevelData<EBFluxFAB>* >& a_dataFlux,
00122 const Vector<LevelData<EBCellFAB>* >& a_dataCell,
00123 const Vector<EBLevelGrid>& a_eblg,
00124 const Vector<int>& a_refRatio,
00125 const int& a_comp);
00126
00127
00128
00129
00130
00131 static void averageCellToFaces(Vector<RefCountedPtr<LevelData<EBFluxFAB> > >& a_dataFlux,
00132 const Vector<LevelData<EBCellFAB>* >& a_dataCell,
00133 const Vector<EBLevelGrid>& a_eblg,
00134 const Vector<int>& a_refRatio,
00135 const int& a_comp);
00136
00137
00138
00139
00140
00141 static void quadCFInterpAll(Vector<LevelData<EBCellFAB>* >& a_data,
00142 const Vector<DisjointBoxLayout>& a_dbl,
00143 const Vector<EBISLayout>& a_ebisl,
00144 const Vector<ProblemDomain>& a_domain,
00145 const Vector<int>& a_refRatio);
00146
00147
00148
00149
00150 static void quadCFInterpAll(Vector<LevelData<EBCellFAB>* >& a_data,
00151 const Vector<EBLevelGrid>& a_eblg,
00152 const Vector<int>& a_refRatio);
00153
00154
00155
00156
00157
00158 static void quadCFInterpOne(Vector<LevelData<EBCellFAB>* >& a_data,
00159 const Vector<EBLevelGrid>& a_eblg,
00160 const Vector<int>& a_refRatio,
00161 const int& a_fineLevel);
00162
00163
00164
00165
00166 static void quadCFInterpOne(Vector<LevelData<EBCellFAB>* >& a_data,
00167 const Vector<DisjointBoxLayout>& a_dbl,
00168 const Vector<EBISLayout>& a_ebisl,
00169 const Vector<ProblemDomain>& a_domain,
00170 const Vector<int>& a_refRatio,
00171 const int& a_fineLevel);
00172
00173
00174
00175
00176
00177 static void quadCFInterpOne(LevelData<EBCellFAB>& a_dataFine,
00178 const LevelData<EBCellFAB>& a_dataCoar,
00179 const DisjointBoxLayout& a_dblFine,
00180 const DisjointBoxLayout& a_dblCoar,
00181 const EBISLayout& a_ebislFine,
00182 const EBISLayout& a_ebislCoar,
00183 const ProblemDomain& a_domainCoar,
00184 const int& a_refRatio);
00185
00186
00187
00188
00189
00190 static void pwlFillPatchAll(Vector<LevelData<EBCellFAB>* >& a_data,
00191 const Vector<EBLevelGrid>& a_eblg,
00192 const Vector<int>& a_refRatio);
00193
00194
00195
00196 static void pwlFillPatchAll(Vector<LevelData<EBCellFAB>* >& a_data,
00197 const Vector<DisjointBoxLayout>& a_dbl,
00198 const Vector<EBISLayout>& a_ebisl,
00199 const Vector<ProblemDomain>& a_domain,
00200 const Vector<int>& a_refRatio);
00201
00202
00203
00204
00205
00206 static void pwlFillPatchOne(LevelData<EBCellFAB>& a_dataFine,
00207 LevelData<EBCellFAB>& a_dataCoar,
00208 const DisjointBoxLayout& a_dblFine,
00209 const DisjointBoxLayout& a_dblCoar,
00210 const EBISLayout& a_ebislFine,
00211 const EBISLayout& a_ebislCoar,
00212 const ProblemDomain& a_domainCoar,
00213 const int& a_refRatioCoar);
00214
00215
00216
00217
00218
00219
00220
00221
00222 static void exchangeAll(Vector<LevelData<EBCellFAB>* >& a_phi);
00223
00224
00225
00226
00227 static void exchangeCorners(Vector<LevelData<EBCellFAB>* >& a_data,
00228 const ProblemDomain& a_domain);
00229
00230
00231
00232
00233 static void exchangeComp(Vector<LevelData<EBCellFAB>* >& a_data,
00234 const int& a_comp);
00235
00236
00237
00238
00239
00240 static void exchangeAll(Vector<LevelData<EBFluxFAB>* >& a_phi);
00241
00242
00243
00244
00245
00246 static void exchangeComp(Vector<LevelData<EBFluxFAB>* >& a_data,
00247 const int& a_comp);
00248
00249
00250
00251
00252
00253 static void exchangeAll(Vector<RefCountedPtr<LevelData<EBCellFAB> > >& a_phi);
00254
00255
00256
00257
00258
00259 static void exchangeComp(Vector<RefCountedPtr<LevelData<EBCellFAB> > >& a_data,
00260 const int& a_comp);
00261
00262
00263
00264
00265
00266 static void exchangeAll(Vector<RefCountedPtr<LevelData<EBFluxFAB> > >& a_phi);
00267
00268
00269
00270
00271
00272 static void exchangeComp(Vector<RefCountedPtr<LevelData<EBFluxFAB> > >& a_data,
00273 const int& a_comp);
00274
00275
00276
00277
00278
00279 static void coarsenDown(Vector<LevelData<EBCellFAB>* >& a_data,
00280 const Vector<EBLevelGrid>& a_eblg,
00281 const Vector<int>& a_refRatio);
00282
00283
00284
00285
00286
00287 static void averageDown(Vector<LevelData<EBCellFAB>* >& a_data,
00288 const Vector<EBISLayout>& a_ebisl,
00289 const Vector<DisjointBoxLayout>& a_dbl,
00290 const Vector<ProblemDomain>& a_domain,
00291 const Vector<int>& a_refRatio);
00292
00293
00294
00295
00296 static void averageDown(Vector<LevelData<EBCellFAB>* >& a_data,
00297 const Vector<EBLevelGrid>& a_eblg,
00298 const Vector<int>& a_refRatio);
00299
00300
00301
00302
00303
00304 static void averageDown(LevelData<EBCellFAB>& a_dataCoar,
00305 const LevelData<EBCellFAB>& a_dataFine,
00306 const EBISLayout& a_ebislCoar,
00307 const EBISLayout& a_ebislFine,
00308 const DisjointBoxLayout& a_dblCoar,
00309 const DisjointBoxLayout& a_dblFine,
00310 const ProblemDomain& a_domainCoar,
00311 const int& a_refRatio);
00312
00313
00314 static Real subtractOffMean(Vector<LevelData<EBCellFAB>* >& a_data,
00315 const Vector<EBLevelGrid>& a_eblg,
00316 const Vector<int> & a_refRat);
00317
00318 static void averageDown(Vector<LevelData<EBFluxFAB> * >& a_data,
00319 const Vector<EBLevelGrid>& a_eblg,
00320 const Vector<int>& a_refRatio);
00321
00322
00323
00324 static void averageDown(Vector<LevelData<EBFluxFAB>* >& a_data,
00325 const Vector<EBISLayout>& a_ebisl,
00326 const Vector<DisjointBoxLayout>& a_dbl,
00327 const Vector<ProblemDomain>& a_domain,
00328 const Vector<int>& a_refRatio);
00329
00330
00331
00332
00333
00334 static void averageDown(Vector<RefCountedPtr<LevelData<EBCellFAB> > >& a_data,
00335 const Vector<EBISLayout>& a_ebisl,
00336 const Vector<DisjointBoxLayout>& a_dbl,
00337 const Vector<ProblemDomain>& a_domain,
00338 const Vector<int>& a_refRatio);
00339
00340
00341
00342
00343
00344 static void averageDown(Vector<RefCountedPtr<LevelData<EBFluxFAB> > >& a_data,
00345 const Vector<EBISLayout>& a_ebisl,
00346 const Vector<DisjointBoxLayout>& a_dbl,
00347 const Vector<ProblemDomain>& a_domain,
00348 const Vector<int>& a_refRatio);
00349
00350
00351
00352
00353 static void averageDown(Vector<RefCountedPtr<LevelData<EBFluxFAB> > >& a_data,
00354 const Vector<EBLevelGrid>& a_eblg,
00355 const Vector<int>& a_refRatio);
00356
00357
00358
00359
00360
00361 static void setCoveredAMRVal(Vector<LevelData<EBCellFAB>* >& a_data,
00362 const Vector<EBISLayout>& a_ebisl,
00363 const Vector<int>& a_refRat,
00364 const Real& a_value);
00365
00366 static void setCoveredAMRVal(Vector<LevelData<EBCellFAB>* >& a_data,
00367 const Vector<EBLevelGrid>& a_eblg,
00368 const Vector<int>& a_refRat,
00369 const Real& a_value);
00370
00371
00372
00373
00374
00375 static void setCoveredVal(Vector<LevelData<EBCellFAB>* >&a_data,
00376 const Real& a_value);
00377
00378
00379
00380
00381 static void setCoveredVal(Vector<LevelData<EBCellFAB>* >&a_data,
00382 const int& a_comp,
00383 const Real& a_value);
00384
00385
00386
00387
00388
00389 static void deleteAMRData(Vector<LevelData<EBCellFAB>* >& a_amrData);
00390
00391
00392
00393 static void defineAMRData(Vector<LevelData<EBCellFAB>* >& a_amrData,
00394 const Vector<EBLevelGrid>& a_eblg,
00395 const IntVect& a_ghosts,
00396 const int& a_nComp,
00397 const int& a_numLevels);
00398
00399
00400 static void defineAMRData(Vector<LevelData<EBFluxFAB>* >& a_amrData,
00401 const Vector<EBLevelGrid>& a_eblg,
00402 const IntVect& a_ghosts,
00403 const int& a_nComp,
00404 const int& a_numLevels);
00405
00406
00407
00408
00409 static void defineAMRData(Vector<RefCountedPtr<LevelData<EBCellFAB> > >& a_amrData,
00410 const Vector<EBLevelGrid>& a_eblg,
00411 const IntVect& a_ghosts,
00412 const int& a_nComp,
00413 const int& a_numLevels);
00414
00415
00416
00417
00418 static void defineAMRData(Vector<RefCountedPtr<LevelData<EBFluxFAB> > >& a_amrData,
00419 const Vector<EBLevelGrid>& a_eblg,
00420 const IntVect& a_ghosts,
00421 const int& a_nComp,
00422 const int& a_numLevels);
00423
00424
00425
00426 static void scale(Vector<LevelData<EBFluxFAB>* >& a_lhs,
00427 const Real& a_scale) ;
00428
00429
00430
00431 static void scale(Vector<LevelData<EBCellFAB>* >& a_lhs,
00432 const Real& a_scale) ;
00433
00434
00435
00436
00437 static void scale(Vector<LevelData<EBCellFAB>* >& a_lhs,
00438 const Real& a_scale,
00439 const int& a_comp);
00440
00441
00442
00443 static void setToZero(Vector<LevelData<EBCellFAB>* >& a_result);
00444
00445
00446
00447 static void setVal(Vector<LevelData<EBCellFAB>* >& a_result,
00448 const Real& a_value);
00449
00450
00451
00452
00453 static void setVal(Vector<LevelData<EBCellFAB>* >& a_result,
00454 const Real& a_value,
00455 const int& a_comp);
00456
00457
00458
00459 static void setToZero(Vector<LevelData<EBFluxFAB>* >& a_result);
00460
00461
00462
00463 static void setVal(Vector<LevelData<EBFluxFAB>* >& a_result,
00464 const Real& a_value);
00465
00466
00467
00468
00469
00470 static void assign(Vector<LevelData<EBCellFAB>* >& a_lhs,
00471 const Vector<LevelData<EBCellFAB>* >& a_rhs);
00472
00473
00474
00475
00476
00477 static void assign(Vector<RefCountedPtr<LevelData<EBCellFAB> > >& a_lhs,
00478 const Vector<LevelData<EBCellFAB>* >& a_rhs);
00479
00480
00481
00482
00483
00484 static void assign(Vector<LevelData<EBFluxFAB>* >& a_lhs,
00485 const Vector<LevelData<EBFluxFAB>* >& a_rhs);
00486
00487
00488
00489
00490
00491 static void assign(Vector<RefCountedPtr<LevelData<EBFluxFAB> > >& a_lhs,
00492 const Vector<LevelData<EBFluxFAB>* >& a_rhs);
00493
00494
00495
00496
00497
00498 static void assign(Vector<LevelData<EBCellFAB>* >& a_to,
00499 const Vector<LevelData<EBCellFAB>* >& a_from,
00500 const Interval& a_toInterval,
00501 const Interval& a_fromInterval);
00502
00503
00504
00505
00506
00507 static void assign(Vector<RefCountedPtr<LevelData<EBCellFAB> > >& a_to,
00508 const Vector<LevelData<EBCellFAB>* >& a_from,
00509 const Interval& a_toInterval,
00510 const Interval& a_fromInterval);
00511
00512
00513
00514
00515
00516 static void incr(Vector<LevelData<EBCellFAB>* >& a_lhs,
00517 const Vector<LevelData<EBCellFAB>* >& a_rhs,
00518 const Real& a_scale);
00519
00520
00521
00522
00523
00524 static void incr(Vector<LevelData<EBFluxFAB>* >& a_lhs,
00525 const Vector<LevelData<EBFluxFAB>* >& a_rhs,
00526 const Real& a_scale);
00527
00528
00529
00530
00531
00532 static void incr(Vector<LevelData<EBCellFAB>* >& a_lhs,
00533 const Real& a_scale);
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543 static void axby(Vector<LevelData<EBCellFAB>* >& a_lhs,
00544 const Vector<LevelData<EBCellFAB>* >& a_x,
00545 const Vector<LevelData<EBCellFAB>* >& a_y,
00546 const Real& a,
00547 const Real& b);
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562 static void axby(Vector<LevelData<EBCellFAB>* >& a_lhs,
00563 const Vector<LevelData<EBCellFAB>* >& a_x,
00564 const Vector<LevelData<EBCellFAB>* >& a_y,
00565 const Real& a_a,
00566 const Real& a_b,
00567 const int& a_lhsComp,
00568 const int& a_xComp,
00569 const int& a_yComp);
00570 */
00571
00572
00573
00574
00575
00576 static void sum(Vector<LevelData<EBCellFAB>* >& a_result,
00577 const Vector<LevelData<EBCellFAB>* >& a_in1,
00578 const Vector<LevelData<EBCellFAB>* >& a_in2);
00579
00580
00581
00582 static void addConstant(Vector<LevelData<EBCellFAB>* >& a_data,
00583 const Real& a_constant);
00584
00585
00586
00587
00588
00589 static void product(Vector<LevelData<EBCellFAB>* >& a_result,
00590 const Vector<LevelData<EBCellFAB>* >& a_in1,
00591 const Vector<LevelData<EBCellFAB>* >& a_in2);
00592
00593
00594
00595
00596
00597 static void product(Vector<LevelData<EBCellFAB>* >& a_result,
00598 const Vector<LevelData<EBCellFAB>* >& a_in1,
00599 const Vector<LevelData<EBCellFAB>* >& a_in2,
00600 const int& a_rComp,
00601 const int& a_1Comp,
00602 const int& a_2Comp);
00603
00604
00605
00606
00607
00608 static void divideVectorByScalar(Vector<LevelData<EBCellFAB>* >& a_vectorOut,
00609 const Vector<LevelData<EBCellFAB>* >& a_vectorIn,
00610 const Vector<LevelData<EBCellFAB>* >& a_scalar);
00611
00612
00613
00614
00615 static void divide(Vector<LevelData<EBCellFAB>* >& a_result,
00616 const Vector<LevelData<EBCellFAB>* >& a_in1,
00617 const Vector<LevelData<EBCellFAB>* >& a_in2);
00618
00619
00620
00621
00622
00623 static void divide(Vector<LevelData<EBCellFAB>* >& a_result,
00624 const Vector<LevelData<EBCellFAB>* >& a_in1,
00625 const Vector<LevelData<EBCellFAB>* >& a_in2,
00626 const int& a_rComp,
00627 const int& a_1Comp,
00628 const int& a_2Comp);
00629
00630
00631
00632
00633
00634 static void product(Vector<LevelData<EBFluxFAB>* >& a_result,
00635 const Vector<LevelData<EBFluxFAB>* >& a_in1,
00636 const Vector<LevelData<EBFluxFAB>* >& a_in2);
00637
00638
00639
00640
00641
00642 static void kappaWeight(Vector<LevelData<EBCellFAB>* >& a_data);
00643
00644
00645
00646
00647
00648 static void kappaScale(Vector<LevelData<EBCellFAB>* >& a_data,
00649 const Real& a_scale);
00650
00651
00652
00653
00654
00655 static Real kappaNorm(Real& a_volume,
00656 const Vector<LevelData<EBCellFAB>* >& a_data,
00657 int a_which,
00658 const Vector<ProblemDomain>& a_domain,
00659 int a_p=2);
00660
00661
00662
00663
00664
00665 static Real noKappaNorm(Real& a_volume,
00666 const Vector<LevelData<EBCellFAB>* >& a_data,
00667 int a_which,
00668 const Vector<ProblemDomain>& a_domain,
00669 int a_p=2);
00670
00671
00672
00673
00674
00675 static Real kappaDotProduct(Real& a_volume,
00676 const Vector<LevelData<EBCellFAB>* >& a_data1,
00677 const Vector<LevelData<EBCellFAB>* >& a_data2,
00678 int a_which,
00679 const Vector<ProblemDomain>& a_domain);
00680
00681
00682
00683
00684
00685 static Real noKappaDotProduct(Real& a_volume,
00686 const Vector<LevelData<EBCellFAB>* >& a_data1,
00687 const Vector<LevelData<EBCellFAB>* >& a_data2,
00688 int a_which,
00689 const Vector<ProblemDomain>& a_domain);
00690
00691
00692
00693
00694
00695
00696
00697 static void setMaxMin(Vector<LevelData<EBCellFAB>* >& a_data,
00698 const Real& a_maxVal,
00699 const Real& a_minVal,
00700 const int& a_comp);
00701
00702
00703
00704
00705
00706
00707 static void getMaxMin(Real& a_maxVal,
00708 Real& a_minVal,
00709 const Vector<LevelData<EBCellFAB>* >& a_data,
00710 const int& a_comp,
00711 Vector<int> a_refRat = Vector<int>());
00712
00713
00714
00715
00716
00717 static Real subtractOffMean(Vector<LevelData<EBCellFAB>* >& a_data,
00718 const Vector<DisjointBoxLayout>& a_grids,
00719 const Vector<EBISLayout>& a_ebisl,
00720 const Vector<int> & a_refRat);
00721
00722
00723
00724
00725
00726 static void checkThisData(const Vector<LevelData<EBCellFAB>* >& a_data,
00727 const string& a_name,
00728 const IntVect& a_iv1 = IntVect::Zero,
00729 const IntVect& a_iv2 = IntVect::Zero,
00730 const Real& a_shift = 0.0);
00731
00732
00733
00734
00735
00736 static bool checkNANINF(const Vector<LevelData<EBCellFAB>* >& a_data,
00737 const IntVect& a_iv1 = IntVect::Zero,
00738 const IntVect& a_iv2 = IntVect::Zero,
00739 const Real& a_shift = 0.0);
00740
00741
00742
00743
00744
00745 static void checkThisData(const Vector<LevelData<EBFluxFAB>* >& a_data,
00746 const string& a_name);
00747
00748
00749
00750
00751
00752 static bool checkNANINF(const Vector<LevelData<EBFluxFAB>* >& a_data);
00753
00754
00755
00756
00757
00758
00759 static Real sum(const Vector<LevelData<EBCellFAB>* >& a_data,
00760 const Vector<DisjointBoxLayout>& a_grids,
00761 const Vector<EBISLayout>& a_ebisl,
00762 const Vector<int> & a_refRat,
00763 int a_comp,
00764 bool a_mutiplyByKappa);
00765
00766
00767
00768
00769 static Real sum(const Vector<LevelData<EBCellFAB>* >& a_data,
00770 const Vector<EBLevelGrid>& a_eblg,
00771 const Vector<int> & a_refRat,
00772 int a_comp,
00773 bool a_mutiplyByKappa);
00774
00775 protected:
00776
00777 };
00778 #include "NamespaceFooter.H"
00779 #endif