Block-Structured AMR Software Framework
AMReX_XYPlotDataList.H
Go to the documentation of this file.
1 // -------------------------------------------------------------------
2 // XYPlotDataList.H
3 // -------------------------------------------------------------------
4 #ifndef XYPLOTDATALIST_H
5 #define XYPLOTDATALIST_H
6 #include <AMReX_Config.H>
7 
8 #include <AMReX_Array.H>
9 #include <AMReX_Vector.H>
10 #include <AMReX_BLassert.H>
11 #include <AMReX_REAL.H>
12 #include <AMReX_FArrayBox.H>
13 
14 #include <list>
15 #include <string>
16 
17 
18 namespace amrex {
19 
20 class OrderedBoxes {
21  public:
22  OrderedBoxes(const int level, int idir, const amrex::Box &databox, const amrex::Box &finebox)
23  : iLevel(level), iDir(idir), dataBox(databox), finestBox(finebox)
24  { }
25 
26  int ILevel() const { return iLevel; }
27  const amrex::Box &DataBox() const { return dataBox; }
28  const amrex::Box &FinestBox() const { return finestBox; }
29  bool operator<(const OrderedBoxes &ob) const {
30  return(finestBox.smallEnd()[iDir] < ob.finestBox.smallEnd()[iDir]);
31  }
32 
33  protected:
34  int iLevel, iDir;
36 
37 };
38 
39 
41  public:
42  XYPlotDataListLink(const Real *d, int sX, int len)
43  : xypdllLength(len), startXi(sX)
44  {
45  BL_ASSERT(len != 0);
46  endXi = sX + len;
47  xypdllData = new Real[len];
48  for(int i(0); i < len; ++i) {
49  xypdllData[i] = d[i];
50  }
51  }
52 
54  delete [] xypdllData;
55  }
56 
57  Real *XYPDLLData() const { return xypdllData; }
58  int XYDPLLength() const { return xypdllLength; }
59  int StartXi() const { return startXi; }
60  int EndXi() const { return endXi; }
61  bool operator<(const XYPlotDataListLink &xyp) const {
62  return(startXi < xyp.startXi);
63  }
64 
65  protected:
66  Real *xypdllData;
68 };
69 
70 
72  public:
73  XYPlotDataList(const std::string &derived, int minlevel, int maxlevel,
74  int gridlinein,
75  const amrex::Vector<int> &ratiolist,
76  const amrex::Vector<Real> &dx,
77  const amrex::Vector<char *> &intersectpoint,
78  Real startx = 0.0);
81 
82  void AddFArrayBox(amrex::FArrayBox &fab, int direction, int level);
83 
84  void UpdateStats(void);
85  void SetLevel(int new_level) {
86  curLevel = (new_level < maxLevel) ? new_level : maxLevel;
87  }
88  const std::string &DerivedName() const { return xypdlDerived; }
89  const XYPlotDataList *CopiedFrom() const { return copiedFrom; }
90  void SetCopiedFrom(XYPlotDataList *xypdl) { copiedFrom = xypdl; }
91  int MaxLevel() const { return maxLevel; }
92  int NumPoints() const { return numPoints[curLevel]; }
93  int CurLevel() const { return curLevel; }
94  int Gridline() const { return gridline; }
95  double StartX() const { return startX; }
96  double EndX() const { return endX; }
97  double XYPDLLoY(const int ilev) const { return xypdlLoY[ilev]; }
98  double XYPDLHiY(const int ilev) const { return xypdlHiY[ilev]; }
99  char *IntersectPoint(const int ilev) const { return intersectPoint[ilev]; }
100  amrex::Vector<double> &XVal(int level) { return xypdlXVal[level]; }
101  amrex::Vector<double> &YVal(int level) { return xypdlYVal[level]; }
102 
103  protected:
105  amrex::Vector<int> xypdlRatios; // Used for insertion of data sets beginning
106  // in the middle of a single cell [level]
107  amrex::Vector<Real> dX; // dX in the proper direction [level]
108  amrex::Vector<char *> intersectPoint; // Intersected value (in problem space)
109  // for labelling plots [level]
112 
115  bool updatedQ;
116  double startX, endX, offsetX;
117  std::string xypdlDerived;
120 };
121 }
122 #endif
123 // -------------------------------------------------------------------
124 // -------------------------------------------------------------------
#define BL_ASSERT(EX)
Definition: AMReX_BLassert.H:39
int idir
Definition: AMReX_HypreMLABecLap.cpp:1093
AMREX_GPU_HOST_DEVICE const IntVectND< dim > & smallEnd() const &noexcept
Get the smallend of the BoxND.
Definition: AMReX_Box.H:105
A Fortran Array of REALs.
Definition: AMReX_FArrayBox.H:229
Definition: AMReX_XYPlotDataList.H:20
amrex::Box dataBox
Definition: AMReX_XYPlotDataList.H:35
int ILevel() const
Definition: AMReX_XYPlotDataList.H:26
int iLevel
Definition: AMReX_XYPlotDataList.H:34
int iDir
Definition: AMReX_XYPlotDataList.H:34
bool operator<(const OrderedBoxes &ob) const
Definition: AMReX_XYPlotDataList.H:29
const amrex::Box & FinestBox() const
Definition: AMReX_XYPlotDataList.H:28
OrderedBoxes(const int level, int idir, const amrex::Box &databox, const amrex::Box &finebox)
Definition: AMReX_XYPlotDataList.H:22
amrex::Box finestBox
Definition: AMReX_XYPlotDataList.H:35
const amrex::Box & DataBox() const
Definition: AMReX_XYPlotDataList.H:27
Definition: AMReX_XYPlotDataList.H:71
int minLevel
Definition: AMReX_XYPlotDataList.H:114
amrex::Vector< std::list< XYPlotDataListLink * > > dataSets
Definition: AMReX_XYPlotDataList.H:104
int curLevel
Definition: AMReX_XYPlotDataList.H:114
int whichDir
Definition: AMReX_XYPlotDataList.H:114
double XYPDLHiY(const int ilev) const
Definition: AMReX_XYPlotDataList.H:98
double EndX() const
Definition: AMReX_XYPlotDataList.H:96
~XYPlotDataList()
Definition: AMReX_XYPlotDataList.cpp:70
amrex::Vector< amrex::BoxList > fillBoxLists
Definition: AMReX_XYPlotDataList.H:119
const std::string & DerivedName() const
Definition: AMReX_XYPlotDataList.H:88
double startX
Definition: AMReX_XYPlotDataList.H:116
char * IntersectPoint(const int ilev) const
Definition: AMReX_XYPlotDataList.H:99
bool updatedQ
Definition: AMReX_XYPlotDataList.H:115
XYPlotDataList(const std::string &derived, int minlevel, int maxlevel, int gridlinein, const amrex::Vector< int > &ratiolist, const amrex::Vector< Real > &dx, const amrex::Vector< char * > &intersectpoint, Real startx=0.0)
Definition: AMReX_XYPlotDataList.cpp:12
amrex::Vector< amrex::BoxList > fabBoxLists
Definition: AMReX_XYPlotDataList.H:119
const XYPlotDataList * CopiedFrom() const
Definition: AMReX_XYPlotDataList.H:89
void SetLevel(int new_level)
Definition: AMReX_XYPlotDataList.H:85
void UpdateStats(void)
Definition: AMReX_XYPlotDataList.cpp:114
void SetCopiedFrom(XYPlotDataList *xypdl)
Definition: AMReX_XYPlotDataList.H:90
int maxLevel
Definition: AMReX_XYPlotDataList.H:114
std::string xypdlDerived
Definition: AMReX_XYPlotDataList.H:117
amrex::Vector< double > & YVal(int level)
Definition: AMReX_XYPlotDataList.H:101
amrex::Vector< double > xypdlLoY
Definition: AMReX_XYPlotDataList.H:110
amrex::Vector< Real > dX
Definition: AMReX_XYPlotDataList.H:107
void AddFArrayBox(amrex::FArrayBox &fab, int direction, int level)
Definition: AMReX_XYPlotDataList.cpp:85
amrex::Vector< double > & XVal(int level)
Definition: AMReX_XYPlotDataList.H:100
amrex::Vector< amrex::Vector< double > > xypdlXVal
Definition: AMReX_XYPlotDataList.H:111
int Gridline() const
Definition: AMReX_XYPlotDataList.H:94
int NumPoints() const
Definition: AMReX_XYPlotDataList.H:92
amrex::Vector< char * > intersectPoint
Definition: AMReX_XYPlotDataList.H:108
int gridline
Definition: AMReX_XYPlotDataList.H:114
XYPlotDataList * copiedFrom
Definition: AMReX_XYPlotDataList.H:118
double endX
Definition: AMReX_XYPlotDataList.H:116
double offsetX
Definition: AMReX_XYPlotDataList.H:116
amrex::Vector< int > xypdlRatios
Definition: AMReX_XYPlotDataList.H:105
double StartX() const
Definition: AMReX_XYPlotDataList.H:95
int MaxLevel() const
Definition: AMReX_XYPlotDataList.H:91
double XYPDLLoY(const int ilev) const
Definition: AMReX_XYPlotDataList.H:97
int CurLevel() const
Definition: AMReX_XYPlotDataList.H:93
amrex::Vector< double > xypdlHiY
Definition: AMReX_XYPlotDataList.H:110
amrex::Vector< amrex::Vector< double > > xypdlYVal
Definition: AMReX_XYPlotDataList.H:111
amrex::Vector< int > numPoints
Definition: AMReX_XYPlotDataList.H:113
Definition: AMReX_Amr.cpp:49