Skip to content

Commit

Permalink
correct region selection.
Browse files Browse the repository at this point in the history
  • Loading branch information
vebeckner committed May 26, 2017
1 parent 0722829 commit 2b606e7
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 7 deletions.
1 change: 1 addition & 0 deletions ProfApp.H
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ private:
int startX, startY, endX, endY;
int sdLineXL, sdLineXH, axisLengthX, axisLengthY;
amrex::Array<amrex::Array<BLProfStats::TimeRange>> rtr;
amrex::Array<std::list<BLProfStats::TimeRange>> filterTimeRanges;

// ---- baggage for fast rubber banding
GC rbgc;
Expand Down
7 changes: 5 additions & 2 deletions ProfApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ const int topLevelNy(300);
const int marginBottom(2);
const int infoWidth(400);
const int infoHeight(300);
const int plotAreaHeight(342);
const int funcListHeight(600);
const int funcListWidth(850);

void CollectMProfStats(std::map<std::string, BLProfiler::ProfStats> &mProfStats,
const Array<Array<BLProfStats::FuncStat> > &funcStats,
Expand Down Expand Up @@ -302,11 +305,12 @@ if(regionTimeRanges.size() > 0) {
// -------------------------------------------------------------------
void ProfApp::ProfAppInit(bool bSubregion) {
int np;
int plotAreaHeight(242), funcListHeight(600), funcListWidth(850);

currentScale = 1;
maxAllowableScale = 8;

filterTimeRanges.resize(profDataServicesPtr[0]->GetBLProfStats().GetNProcs());

XmAddWMProtocolCallback(wAmrVisTopLevel,
XmInternAtom(display,const_cast<String> ("WM_DELETE_WINDOW"), false),
(XtCallbackProc) CBQuitProfApp, (XtPointer) this);
Expand Down Expand Up @@ -954,7 +958,6 @@ void ProfApp::DoGenerateFuncList(Widget w, XtPointer client_data,
cout << "_in ProfApp::DoGenerateFuncList: r = " << r << endl;

RegionsProfStats &regionsProfStats = profDataServicesPtr[0]->GetRegionsProfStats();
Array<std::list<BLProfStats::TimeRange>> filterTimeRanges(regionsProfStats.GetNProcs());
cout << "filterTimeRanges.size() = " << filterTimeRanges.size() << endl;
for(int i(0); i < filterTimeRanges.size(); ++i) {
filterTimeRanges[i].push_back(BLProfStats::TimeRange(1.71263, 7.71314));
Expand Down
11 changes: 6 additions & 5 deletions RegionPicture.H
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@ class RegionPicture {
Window PictureWindow() { return pictureWindow; }

private:
Window pictureWindow;
Window pictureWindow;
GraphicsAttributes *gaPtr;
Display *display;
GC xgc;
Pixmap pixMap;
Pixmap pixMap;
XImage *xImage, *atiXImage;
XImage *xImageDim, *atiXImageDim;
unsigned long dataSize, dataSizeH, dataSizeV;
unsigned long atiDataSize, atiDataSizeH, atiDataSizeV;
unsigned int imageSize, imageSizeH, imageSizeV;
unsigned int atiImageSize, atiImageSizeH, atiImageSizeV;
Palette *palPtr;
Palette *palPtr;
amrex::FArrayBox *sliceFab;
amrex::Box subRegion;
unsigned char *imageData;
Expand All @@ -89,8 +89,9 @@ class RegionPicture {
int regionX, regionY, region2ndX, region2ndY;
int subcutX, subcutY, subcut2ndX, subcut2ndY;
BLProfStats::TimeRange calcTimeRange, subTimeRange;
amrex::Array<amrex::Array<amrex::Box>> regionBoxes;
amrex::Array<amrex::Array<int>> regionsOnOff;
amrex::Array<amrex::Array<amrex::Box>> regionBoxes; // ---- [region][box]
amrex::Array<amrex::Array<int>> regionsOnOff; // ---- [region][onoff]
amrex::BoxDomain timeSpanOff; // ---- time spans that are off

void SetSlice(int view, int here);
void CoarsenSliceBox();
Expand Down
47 changes: 47 additions & 0 deletions RegionPicture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,24 @@ void RegionPicture::APDraw(int fromLevel, int toLevel) {
atiImageSizeH, atiImageSizeV);

XImage *xi, *atixi;
for(auto it = timeSpanOff.begin(); it != timeSpanOff.end(); ++it) {
const Box &b = *it;
int bSX(b.smallEnd(Amrvis::XDIR) * currentScale);
int bBY(b.bigEnd(Amrvis::YDIR) * currentScale);
int bLX(b.length(Amrvis::XDIR) * currentScale);
int bLY(b.length(Amrvis::YDIR) * currentScale);
xi = xImageDim;
atixi = atiXImageDim;
XPutImage(display, pixMap, xgc, xi,
bSX, invert - bBY,
bSX, invert - bBY,
bLX, bLY);
XPutImage(display, pixMap, xgc, atixi,
bSX, 0,
bSX, invert,
bLX, atiImageSizeV);
}
/*
for(int i(0); i < regionsOnOff.size(); ++i) {
for(int j(0); j < regionsOnOff[i].size(); ++j) {
const Box &b = regionBoxes[i][j];
Expand All @@ -165,6 +183,8 @@ void RegionPicture::APDraw(int fromLevel, int toLevel) {
bLX, atiImageSizeV);
}
}
*/

DoExposePicture();
}

Expand Down Expand Up @@ -446,6 +466,26 @@ void RegionPicture::SetRegionOnOff(int regionIndex, int whichRegion,
if(whichRegion < 0 || whichRegion >= regionsOnOff[regionIndex].size()) {
return;
}
Box regionSpanBox(regionBoxes[regionIndex][whichRegion]);
regionSpanBox.setSmall(Amrvis::YDIR, subRegion.smallEnd(Amrvis::YDIR));
regionSpanBox.setBig(Amrvis::YDIR, subRegion.bigEnd(Amrvis::YDIR) - regionBaseHeight);

cout << "regionIndex whichRegion regionBox regionSpanBox = " << regionIndex
<< " " << whichRegion << " " << regionBoxes[regionIndex][whichRegion]
<< " " << regionSpanBox << endl;

if(onoff == RP_ON) {
BoxList iSect(timeSpanOff.boxList());
iSect.intersect(regionSpanBox);
for(auto it = iSect.begin(); it != iSect.end(); ++it) {
Box onBox(*it);
timeSpanOff.rmBox(onBox);
}
}
if(onoff == RP_OFF) {
timeSpanOff.add(regionSpanBox);
}

regionsOnOff[regionIndex][whichRegion] = onoff;
APDraw(0, 0);
}
Expand All @@ -460,6 +500,13 @@ void RegionPicture::SetAllOnOff(int onoff)
regionsOnOff[i][j] = onoff;
}
}
timeSpanOff.clear();
if(onoff == RP_OFF) {
Box regionSpanBox(subRegion);
regionSpanBox.setBig(Amrvis::YDIR, subRegion.bigEnd(Amrvis::YDIR) - regionBaseHeight);
//timeSpanOff.push_back(regionSpanBox);
timeSpanOff.add(regionSpanBox);
}
} else {
cerr << "**** Error in RegionPicture::SetAllOnOff: bad value: " << onoff << endl;
return;
Expand Down

0 comments on commit 2b606e7

Please sign in to comment.