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 "EBPWQuadFillPatch.H"
00022 #include "EBIndexSpace.H"
00023 #include "EBAMRIO.H"
00024 #include "EBLevelGrid.H"
00025 #include "NamespaceHeader.H"
00026
00027 #define EBAMRDATAOPS_INTERIORREGVOFS 0x1
00028 #define EBAMRDATAOPS_BOUNDARYREGVOFS 0x2
00029 #define EBAMRDATAOPS_INTERIORIRREGVOFS 0x4
00030 #define EBAMRDATAOPS_BOUNDARYIRREGVOFS 0x8
00031
00032 #define EBAMRDATAOPS_ALLVOFS (EBAMRDATAOPS_INTERIORREGVOFS | \
00033 EBAMRDATAOPS_BOUNDARYREGVOFS | \
00034 EBAMRDATAOPS_INTERIORIRREGVOFS | \
00035 EBAMRDATAOPS_BOUNDARYIRREGVOFS )
00036
00037 #define EBAMRDATAOPS_REGULARVOFS (EBAMRDATAOPS_INTERIORREGVOFS | \
00038 EBAMRDATAOPS_BOUNDARYREGVOFS )
00039
00040 #define EBAMRDATAOPS_IRREGULARVOFS (EBAMRDATAOPS_INTERIORIRREGVOFS | \
00041 EBAMRDATAOPS_BOUNDARYIRREGVOFS )
00042
00043 #define EBAMRDATAOPS_BOUNDARYVOFS (EBAMRDATAOPS_BOUNDARYREGVOFS | \
00044 EBAMRDATAOPS_IRREGULARVOFS )
00046
00049 class EBAMRDataOps
00050 {
00051 public:
00052 EBAMRDataOps()
00053 {
00054 }
00055
00056 static void
00057 getErrorFromCoarseAndFine(Vector< LevelData<EBCellFAB>* >& a_errorCoar,
00058 const Vector< LevelData<EBCellFAB>* >& a_solnCoar,
00059 const Vector< DisjointBoxLayout >& a_gridsCoar,
00060 const Vector< EBISLayout >& a_ebislCoar,
00061 const ProblemDomain& a_level0DomainCoar,
00062 const Vector< LevelData<EBCellFAB>* >& a_solnFine,
00063 const Vector< DisjointBoxLayout >& a_gridsFine,
00064 const Vector< EBISLayout >& a_ebislFine,
00065 const ProblemDomain& a_level0DomainFine,
00066 const Vector<int>& a_refRat);
00067
00068 ~EBAMRDataOps(){;}
00069
00071
00074 static int countVoF(const Vector<DisjointBoxLayout>& a_dbl,
00075 const Vector<EBISLayout>& a_ebisl,
00076 const Vector<ProblemDomain>& a_domain);
00077
00079
00082 static void averageCellToFacesMAC(Vector<LevelData<EBFluxFAB>* >& a_dataFlux,
00083 const Vector<LevelData<EBCellFAB>* >& a_dataCell,
00084 const Vector<EBLevelGrid>& a_eblg,
00085 const Vector<int>& a_refRatio);
00086
00087
00089
00092 static void averageCellToFaces(Vector<LevelData<EBFluxFAB>* >& a_dataFlux,
00093 const Vector<LevelData<EBCellFAB>* >& a_dataCell,
00094 const Vector<EBLevelGrid>& a_eblg,
00095 const Vector<int>& a_refRatio,
00096 const int& a_comp);
00097
00099
00102 static void averageCellToFaces(Vector<RefCountedPtr<LevelData<EBFluxFAB> > >& a_dataFlux,
00103 const Vector<LevelData<EBCellFAB>* >& a_dataCell,
00104 const Vector<EBLevelGrid>& a_eblg,
00105 const Vector<int>& a_refRatio,
00106 const int& a_comp);
00107
00108
00110
00112 static void quadCFInterpAll(Vector<LevelData<EBCellFAB>* >& a_data,
00113 const Vector<DisjointBoxLayout>& a_dbl,
00114 const Vector<EBISLayout>& a_ebisl,
00115 const Vector<ProblemDomain>& a_domain,
00116 const Vector<int>& a_refRatio);
00117
00119
00121 static void quadCFInterpAll(Vector<LevelData<EBCellFAB>* >& a_data,
00122 const Vector<EBLevelGrid>& a_eblg,
00123 const Vector<int>& a_refRatio);
00124
00125
00127
00129 static void quadCFInterpOne(Vector<LevelData<EBCellFAB>* >& a_data,
00130 const Vector<EBLevelGrid>& a_eblg,
00131 const Vector<int>& a_refRatio,
00132 const int& a_fineLevel);
00133
00135
00137 static void quadCFInterpOne(Vector<LevelData<EBCellFAB>* >& a_data,
00138 const Vector<DisjointBoxLayout>& a_dbl,
00139 const Vector<EBISLayout>& a_ebisl,
00140 const Vector<ProblemDomain>& a_domain,
00141 const Vector<int>& a_refRatio,
00142 const int& a_fineLevel);
00143
00144
00146
00148 static void quadCFInterpOne(LevelData<EBCellFAB>& a_dataFine,
00149 const LevelData<EBCellFAB>& a_dataCoar,
00150 const DisjointBoxLayout& a_dblFine,
00151 const DisjointBoxLayout& a_dblCoar,
00152 const EBISLayout& a_ebislFine,
00153 const EBISLayout& a_ebislCoar,
00154 const ProblemDomain& a_domainCoar,
00155 const int& a_refRatio);
00156
00157
00159
00161 static void pwlFillPatchAll(Vector<LevelData<EBCellFAB>* >& a_data,
00162 const Vector<EBLevelGrid>& a_eblg,
00163 const Vector<int>& a_refRatio);
00165
00167 static void pwlFillPatchAll(Vector<LevelData<EBCellFAB>* >& a_data,
00168 const Vector<DisjointBoxLayout>& a_dbl,
00169 const Vector<EBISLayout>& a_ebisl,
00170 const Vector<ProblemDomain>& a_domain,
00171 const Vector<int>& a_refRatio);
00172
00173
00175
00177 static void pwlFillPatchOne(LevelData<EBCellFAB>& a_dataFine,
00178 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_refRatioCoar);
00185
00186
00188
00190 static void pwqFillPatchAll(Vector<LevelData<EBCellFAB>* >& a_data,
00191 const Vector<EBLevelGrid>& a_eblg,
00192 const Vector<int>& a_refRatio);
00193
00194
00196
00198 static void pwqFillPatchOne(LevelData<EBCellFAB>& a_dataFine,
00199 LevelData<EBCellFAB>& a_dataCoar,
00200 const EBLevelGrid& a_eblgFine,
00201 const EBLevelGrid& a_eblgCoar,
00202 const int& a_refRatioCoar);
00203
00204
00206
00208 static void exchangeAll(Vector<LevelData<EBCellFAB>* >& a_phi);
00209
00211
00213 static void exchangeCorners(Vector<LevelData<EBCellFAB>* >& a_data,
00214 const ProblemDomain& a_domain);
00215
00217
00219 static void exchangeComp(Vector<LevelData<EBCellFAB>* >& a_data,
00220 const int& a_comp);
00221
00222
00224
00226 static void exchangeAll(Vector<LevelData<EBFluxFAB>* >& a_phi);
00227
00228
00230
00232 static void exchangeComp(Vector<LevelData<EBFluxFAB>* >& a_data,
00233 const int& a_comp);
00234
00235
00237
00239 static void exchangeAll(Vector<RefCountedPtr<LevelData<EBCellFAB> > >& a_phi);
00240
00241
00243
00245 static void exchangeComp(Vector<RefCountedPtr<LevelData<EBCellFAB> > >& a_data,
00246 const int& a_comp);
00247
00248
00250
00252 static void exchangeAll(Vector<RefCountedPtr<LevelData<EBFluxFAB> > >& a_phi);
00253
00254
00256
00258 static void exchangeComp(Vector<RefCountedPtr<LevelData<EBFluxFAB> > >& a_data,
00259 const int& a_comp);
00260
00261
00263
00265 static void coarsenDown(Vector<LevelData<EBCellFAB>* >& a_data,
00266 const Vector<EBLevelGrid>& a_eblg,
00267 const Vector<int>& a_refRatio);
00268
00269
00271
00273 static void averageDown(Vector<LevelData<EBCellFAB>* >& a_data,
00274 const Vector<EBISLayout>& a_ebisl,
00275 const Vector<DisjointBoxLayout>& a_dbl,
00276 const Vector<ProblemDomain>& a_domain,
00277 const Vector<int>& a_refRatio);
00278
00280
00282 static void averageDown(Vector<LevelData<EBCellFAB>* >& a_data,
00283 const Vector<EBLevelGrid>& a_eblg,
00284 const Vector<int>& a_refRatio);
00285
00286
00288
00290 static void averageDown(LevelData<EBCellFAB>& a_dataCoar,
00291 const LevelData<EBCellFAB>& a_dataFine,
00292 const EBISLayout& a_ebislCoar,
00293 const EBISLayout& a_ebislFine,
00294 const DisjointBoxLayout& a_dblCoar,
00295 const DisjointBoxLayout& a_dblFine,
00296 const ProblemDomain& a_domainCoar,
00297 const int& a_refRatio);
00298
00299
00300 static Real subtractOffMean(Vector<LevelData<EBCellFAB>* >& a_data,
00301 const Vector<EBLevelGrid>& a_eblg,
00302 const Vector<int> & a_refRat);
00303
00304 static void averageDown(Vector<LevelData<EBFluxFAB> * >& a_data,
00305 const Vector<EBLevelGrid>& a_eblg,
00306 const Vector<int>& a_refRatio);
00308
00310 static void averageDown(Vector<LevelData<EBFluxFAB>* >& a_data,
00311 const Vector<EBISLayout>& a_ebisl,
00312 const Vector<DisjointBoxLayout>& a_dbl,
00313 const Vector<ProblemDomain>& a_domain,
00314 const Vector<int>& a_refRatio);
00315
00316
00318
00320 static void averageDown(Vector<RefCountedPtr<LevelData<EBCellFAB> > >& a_data,
00321 const Vector<EBISLayout>& a_ebisl,
00322 const Vector<DisjointBoxLayout>& a_dbl,
00323 const Vector<ProblemDomain>& a_domain,
00324 const Vector<int>& a_refRatio);
00325
00326
00328
00330 static void averageDown(Vector<RefCountedPtr<LevelData<EBFluxFAB> > >& a_data,
00331 const Vector<EBISLayout>& a_ebisl,
00332 const Vector<DisjointBoxLayout>& a_dbl,
00333 const Vector<ProblemDomain>& a_domain,
00334 const Vector<int>& a_refRatio);
00335
00337
00339 static void averageDown(Vector<RefCountedPtr<LevelData<EBFluxFAB> > >& a_data,
00340 const Vector<EBLevelGrid>& a_eblg,
00341 const Vector<int>& a_refRatio);
00342
00343
00345
00347 static void setCoveredAMRVal(Vector<LevelData<EBCellFAB>* >& a_data,
00348 const Vector<EBISLayout>& a_ebisl,
00349 const Vector<int>& a_refRat,
00350 const Real& a_value);
00351
00352 static void setCoveredAMRVal(Vector<LevelData<EBCellFAB>* >& a_data,
00353 const Vector<EBLevelGrid>& a_eblg,
00354 const Vector<int>& a_refRat,
00355 const Real& a_value);
00356
00357
00359
00361 static void setCoveredVal(Vector<LevelData<EBCellFAB>* >&a_data,
00362 const Real& a_value);
00363
00364
00366
00368 static void deleteAMRData(Vector<LevelData<EBCellFAB>* >& a_amrData);
00369
00370
00372
00374 static void defineAMRData(Vector<LevelData<EBCellFAB>* >& a_amrData,
00375 const Vector<EBLevelGrid>& a_eblg,
00376 const IntVect& a_ghosts,
00377 const int& a_nComp,
00378 const int& a_numLevels);
00380
00382 static void defineAMRData(Vector<LevelData<EBFluxFAB>* >& a_amrData,
00383 const Vector<EBLevelGrid>& a_eblg,
00384 const IntVect& a_ghosts,
00385 const int& a_nComp,
00386 const int& a_numLevels);
00387
00388
00390
00392 static void defineAMRData(Vector<RefCountedPtr<LevelData<EBCellFAB> > >& a_amrData,
00393 const Vector<EBLevelGrid>& a_eblg,
00394 const IntVect& a_ghosts,
00395 const int& a_nComp,
00396 const int& a_numLevels);
00397
00398
00400
00402 static void defineAMRData(Vector<RefCountedPtr<LevelData<EBFluxFAB> > >& a_amrData,
00403 const Vector<EBLevelGrid>& a_eblg,
00404 const IntVect& a_ghosts,
00405 const int& a_nComp,
00406 const int& a_numLevels);
00407
00408
00410
00412 static void scale(Vector<LevelData<EBFluxFAB>* >& a_lhs,
00413 const Real& a_scale) ;
00414
00415
00417
00419 static void scale(Vector<LevelData<EBCellFAB>* >& a_lhs,
00420 const Real& a_scale) ;
00421
00422
00424
00426 static void scale(Vector<LevelData<EBCellFAB>* >& a_lhs,
00427 const Real& a_scale,
00428 const int& a_comp);
00429
00430
00432
00434 static void setToZero(Vector<LevelData<EBCellFAB>* >& a_result);
00435
00436
00438
00440 static void setVal(Vector<LevelData<EBCellFAB>* >& a_result,
00441 const Real& a_value);
00442
00443
00445
00447 static void setVal(Vector<LevelData<EBCellFAB>* >& a_result,
00448 const Real& a_value,
00449 const int& a_comp);
00450
00451
00453
00455 static void setToZero(Vector<LevelData<EBFluxFAB>* >& a_result);
00456
00457
00459
00461 static void setVal(Vector<LevelData<EBFluxFAB>* >& a_result,
00462 const Real& a_value);
00463
00464
00466
00468 static void assign(Vector<LevelData<EBCellFAB>* >& a_lhs,
00469 const Vector<LevelData<EBCellFAB>* >& a_rhs);
00470
00471
00473
00475 static void assign(Vector<RefCountedPtr<LevelData<EBCellFAB> > >& a_lhs,
00476 const Vector<LevelData<EBCellFAB>* >& a_rhs);
00477
00478
00480
00482 static void assign(Vector<LevelData<EBFluxFAB>* >& a_lhs,
00483 const Vector<LevelData<EBFluxFAB>* >& a_rhs);
00484
00485
00487
00489 static void assign(Vector<RefCountedPtr<LevelData<EBFluxFAB> > >& a_lhs,
00490 const Vector<LevelData<EBFluxFAB>* >& a_rhs);
00491
00492
00494
00496 static void assign(Vector<LevelData<EBCellFAB>* >& a_to,
00497 const Vector<LevelData<EBCellFAB>* >& a_from,
00498 const Interval& a_toInterval,
00499 const Interval& a_fromInterval);
00500
00501
00503
00505 static void assign(Vector<RefCountedPtr<LevelData<EBCellFAB> > >& a_to,
00506 const Vector<LevelData<EBCellFAB>* >& a_from,
00507 const Interval& a_toInterval,
00508 const Interval& a_fromInterval);
00509
00510
00512
00514 static void incr(Vector<LevelData<EBCellFAB>* >& a_lhs,
00515 const Vector<LevelData<EBCellFAB>* >& a_rhs,
00516 const Real& a_scale);
00517
00518
00519
00521
00523 static void incr(Vector<LevelData<EBCellFAB>* >& a_lhs,
00524 const Real& a_scale);
00525
00526
00528
00530 static void axby(Vector<LevelData<EBCellFAB>* >& a_lhs,
00531 const Vector<LevelData<EBCellFAB>* >& a_x,
00532 const Vector<LevelData<EBCellFAB>* >& a_y,
00533 const Real& a,
00534 const Real& b);
00535
00536
00538
00540 static void axby(Vector<LevelData<EBCellFAB>* >& a_lhs,
00541 const Vector<LevelData<EBCellFAB>* >& a_x,
00542 const Vector<LevelData<EBCellFAB>* >& a_y,
00543 const Real& a_a,
00544 const Real& a_b,
00545 const int& a_lhsComp,
00546 const int& a_xComp,
00547 const int& a_yComp);
00548
00549
00551
00553 static void sum(Vector<LevelData<EBCellFAB>* >& a_result,
00554 const Vector<LevelData<EBCellFAB>* >& a_in1,
00555 const Vector<LevelData<EBCellFAB>* >& a_in2);
00556
00557
00559
00561 static void addConstant(Vector<LevelData<EBCellFAB>* >& a_data,
00562 const Real& a_constant);
00563
00564
00566
00568 static void product(Vector<LevelData<EBCellFAB>* >& a_result,
00569 const Vector<LevelData<EBCellFAB>* >& a_in1,
00570 const Vector<LevelData<EBCellFAB>* >& a_in2);
00571
00572
00574
00576 static void product(Vector<LevelData<EBCellFAB>* >& a_result,
00577 const Vector<LevelData<EBCellFAB>* >& a_in1,
00578 const Vector<LevelData<EBCellFAB>* >& a_in2,
00579 const int& a_rComp,
00580 const int& a_1Comp,
00581 const int& a_2Comp);
00582
00583
00585
00587 static void divideVectorByScalar(Vector<LevelData<EBCellFAB>* >& a_vectorOut,
00588 const Vector<LevelData<EBCellFAB>* >& a_vectorIn,
00589 const Vector<LevelData<EBCellFAB>* >& a_scalar);
00590
00592
00594 static void divide(Vector<LevelData<EBCellFAB>* >& a_result,
00595 const Vector<LevelData<EBCellFAB>* >& a_in1,
00596 const Vector<LevelData<EBCellFAB>* >& a_in2);
00597
00598
00600
00602 static void divide(Vector<LevelData<EBCellFAB>* >& a_result,
00603 const Vector<LevelData<EBCellFAB>* >& a_in1,
00604 const Vector<LevelData<EBCellFAB>* >& a_in2,
00605 const int& a_rComp,
00606 const int& a_1Comp,
00607 const int& a_2Comp);
00608
00609
00611
00613 static void product(Vector<LevelData<EBFluxFAB>* >& a_result,
00614 const Vector<LevelData<EBFluxFAB>* >& a_in1,
00615 const Vector<LevelData<EBFluxFAB>* >& a_in2);
00616
00617
00619
00621 static void kappaWeight(Vector<LevelData<EBCellFAB>* >& a_data);
00622
00623
00625
00627 static void kappaScale(Vector<LevelData<EBCellFAB>* >& a_data,
00628 const Real& a_scale);
00629
00630
00632
00634 static Real kappaNorm(Real& a_volume,
00635 const Vector<LevelData<EBCellFAB>* >& a_data,
00636 int a_which,
00637 const Vector<ProblemDomain>& a_domain,
00638 int a_p=2);
00639
00640
00642
00644 static Real noKappaNorm(Real& a_volume,
00645 const Vector<LevelData<EBCellFAB>* >& a_data,
00646 int a_which,
00647 const Vector<ProblemDomain>& a_domain,
00648 int a_p=2);
00649
00650
00652
00654 static Real kappaDotProduct(Real& a_volume,
00655 const Vector<LevelData<EBCellFAB>* >& a_data1,
00656 const Vector<LevelData<EBCellFAB>* >& a_data2,
00657 int a_which,
00658 const Vector<ProblemDomain>& a_domain);
00659
00660
00662
00664 static Real noKappaDotProduct(Real& a_volume,
00665 const Vector<LevelData<EBCellFAB>* >& a_data1,
00666 const Vector<LevelData<EBCellFAB>* >& a_data2,
00667 int a_which,
00668 const Vector<ProblemDomain>& a_domain);
00669
00670
00671
00673
00675 static void setMaxMin(Vector<LevelData<EBCellFAB>* >& a_data,
00676 const Real& a_maxVal,
00677 const Real& a_minVal,
00678 const int& a_comp);
00679
00681
00683 static void getMaxMin(Real& a_maxVal,
00684 Real& a_minVal,
00685 const Vector<LevelData<EBCellFAB>* >& a_data,
00686 const int& a_comp);
00687
00688
00690
00692 static Real subtractOffMean(Vector<LevelData<EBCellFAB>* >& a_data,
00693 const Vector<DisjointBoxLayout>& a_grids,
00694 const Vector<EBISLayout>& a_ebisl,
00695 const Vector<int> & a_refRat);
00696
00697
00699
00701 static void checkThisData(const Vector<LevelData<EBCellFAB>* >& a_data,
00702 const string& a_name,
00703 const IntVect& a_iv1 = IntVect::Zero,
00704 const IntVect& a_iv2 = IntVect::Zero,
00705 const Real& a_shift = 0.0);
00706
00707
00709
00711 static bool checkNANINF(const Vector<LevelData<EBCellFAB>* >& a_data,
00712 const IntVect& a_iv1 = IntVect::Zero,
00713 const IntVect& a_iv2 = IntVect::Zero,
00714 const Real& a_shift = 0.0);
00715
00716
00718
00720 static void checkThisData(const Vector<LevelData<EBFluxFAB>* >& a_data,
00721 const string& a_name);
00722
00723
00725
00727 static bool checkNANINF(const Vector<LevelData<EBFluxFAB>* >& a_data);
00728
00729
00730
00732
00734 static Real sum(const Vector<LevelData<EBCellFAB>* >& a_data,
00735 const Vector<DisjointBoxLayout>& a_grids,
00736 const Vector<EBISLayout>& a_ebisl,
00737 const Vector<int> & a_refRat,
00738 int a_comp,
00739 bool a_mutiplyByKappa);
00740
00741 protected:
00742
00743 };
00744 #include "NamespaceFooter.H"
00745 #endif