Skip to content

Commit

Permalink
updated Dataset to fix bugs added by indices
Browse files Browse the repository at this point in the history
  • Loading branch information
kai committed Mar 12, 1998
1 parent d6ce0a2 commit 2c71fdb
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 48 deletions.
11 changes: 3 additions & 8 deletions AmrPicture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,6 @@ void AmrPicture::ChangeDerived(aString derived, Palette *palptr) {
assert(palptr != NULL);
palPtr = palptr;
AmrData &amrData = dataServicesPtr->AmrDataRef();

if(currentDerived != derived || whichRange == USEFILE) {
maxsFound = false;
pltAppPtr->PaletteDrawn(false);
Expand Down Expand Up @@ -647,13 +646,13 @@ void AmrPicture::ChangeDerived(aString derived, Palette *palptr) {
&dataMin, &dataMax, &minMaxValid);
if(minMaxValid) {
dataMinRegion = Min(dataMinRegion, dataMin);
dataMaxRegion = Max(dataMaxRegion, dataMax);
dataMaxRegion = Max(dataMaxRegion, dataMax);
}
}
} // end for(lev...)
} else {
dataMinAllGrids = pltAppPtr->GlobalMin();
dataMaxAllGrids = pltAppPtr->GlobalMax();
dataMaxAllGrids = pltAppPtr->GlobalMax();
dataMinRegion = pltAppPtr->GlobalMin();
dataMaxRegion = pltAppPtr->GlobalMax();
}
Expand All @@ -672,7 +671,6 @@ void AmrPicture::ChangeDerived(aString derived, Palette *palptr) {
}

} // end if( ! maxsFound)

switch(whichRange) {
case USEGLOBAL:
minUsing = dataMinAllGrids;
Expand All @@ -695,7 +693,6 @@ void AmrPicture::ChangeDerived(aString derived, Palette *palptr) {
maxUsing = dataMaxAllGrids;
break;
}

VSHOWVAL(Verbose(), minUsing)
VSHOWVAL(Verbose(), maxUsing)

Expand All @@ -712,13 +709,11 @@ void AmrPicture::ChangeDerived(aString derived, Palette *palptr) {
dataSizeH[iLevel], dataSizeV[iLevel],
imageSizeH, imageSizeV);
}

if( ! pltAppPtr->PaletteDrawn()) {
pltAppPtr->PaletteDrawn(true);
palptr->Draw(minUsing, maxUsing, pltAppPtr->GetFormatString());
}

Draw(minDrawnLevel, maxDrawnLevel);
Draw(minDrawnLevel, maxDrawnLevel);
if(printDone) {
sprintf(buffer, "done.\n");
PrintMessage(buffer);
Expand Down
21 changes: 11 additions & 10 deletions Dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,8 @@ void Dataset::DoExpose(int fromExpose) {

XClearWindow(GAptr->PDisplay(), XtWindow(wPixArea));

// XClearArea(GAptr->PDisplay(), XtWindow(wPixArea), 0, 0,
// dataItemWidth*datasetRegion[0].length(hDIR),
// dataItemHeight*datasetRegion[0].length(vDIR), false);
//Draw Indices first time
DrawIndices(bTemp);

// draw grid structure for entire region
for(lev = 0; lev <= maxAllowableLevel; ++lev) {
Expand All @@ -721,11 +720,13 @@ void Dataset::DoExpose(int fromExpose) {
temp.refine(CRRBetweenLevels(lev,
maxAllowableLevel, amrData.RefRatio()));
temp.shift(hDIR, -datasetRegion[maxAllowableLevel].smallEnd(hDIR));
temp.shift(vDIR, -datasetRegion[maxAllowableLevel].smallEnd(vDIR));
DrawGrid(temp.smallEnd(hDIR) * dataItemWidth,
pixSizeY-1 - (temp.bigEnd(vDIR)+1) * CHARACTERHEIGHT,
temp.shift(vDIR, -datasetRegion[maxAllowableLevel].smallEnd(vDIR));
DrawGrid(temp.smallEnd(hDIR) * dataItemWidth,
(pixSizeY-1 - (temp.bigEnd(vDIR)+1) * CHARACTERHEIGHT)
-((maxAllowableLevel+1)*hIndexAreaHeight),
(temp.bigEnd(hDIR)+1) * dataItemWidth,
pixSizeY-1 - temp.smallEnd(vDIR) * CHARACTERHEIGHT,
(pixSizeY-1 - temp.smallEnd(vDIR) * CHARACTERHEIGHT)
-((maxAllowableLevel+1)*hIndexAreaHeight),
CRRBetweenLevels(lev, maxAllowableLevel, amrData.RefRatio()),
whiteIndex, blackIndex);
}
Expand All @@ -744,7 +745,7 @@ void Dataset::DoExpose(int fromExpose) {
if(XmToggleButtonGetState(wColorButton)) {
for(stringCount=0; stringCount<numStrings; stringCount++) {
xloc = dataStringArray[stringCount].xloc;
yloc = dataStringArray[stringCount].yloc;
yloc = dataStringArray[stringCount].yloc-((maxAllowableLevel+1)*hIndexAreaHeight);
#ifndef SCROLLBARERROR
if(dataStringArray[stringCount].olflag == false &&
xloc > xh && yloc > yv &&
Expand All @@ -754,7 +755,7 @@ void Dataset::DoExpose(int fromExpose) {
#endif
{
XSetForeground(XtDisplay(wPixArea), GAptr->PGC(),
whiteIndex/*dataStringArray[stringCount].color*/);
dataStringArray[stringCount].color);
XDrawString(XtDisplay(wPixArea), XtWindow(wPixArea),
GAptr->PGC(), xloc, yloc,
dataStringArray[stringCount].ds,
Expand All @@ -766,7 +767,7 @@ void Dataset::DoExpose(int fromExpose) {
XSetForeground(XtDisplay(wPixArea), GAptr->PGC(), whiteIndex);
for(stringCount=0; stringCount<numStrings; stringCount++) {
xloc = dataStringArray[stringCount].xloc;
yloc = dataStringArray[stringCount].yloc;
yloc = dataStringArray[stringCount].yloc-((maxAllowableLevel+1)*hIndexAreaHeight);
#ifndef SCROLLBARERROR
if(dataStringArray[stringCount].olflag == false &&
xloc > xh && yloc > yv &&
Expand Down
1 change: 0 additions & 1 deletion GraphicsAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ GraphicsAttributes::GraphicsAttributes(Widget topLevel) {
visual = visual_info.visual;
gc = screen->default_gc;
root = RootWindow(display, DefaultScreen(display));
//depth = DefaultDepthOfScreen(screen);
depth = 8;
bytesPerPixel = CalculateNBP();
}
Expand Down
11 changes: 4 additions & 7 deletions Palette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ void Palette::Draw(Real palMin, Real palMax, const aString &numberFormat) {
pmin = palMin;
pmax = palMax;
defaultFormat = numberFormat;
XClearWindow(display, palWindow);
XClearWindow(display, palWindow);
//if(palPixmap == NULL) {

if(palPixmap == 0) {
palPixmap = XCreatePixmap(display, palWindow, totalPalWidth,
totalPalHeight + 50, 8);
Expand Down Expand Up @@ -163,7 +164,6 @@ void Palette::Draw(Real palMin, Real palMax, const aString &numberFormat) {
palString, strlen(palString));
}
ExposePalette();

} // end Palette::Draw.


Expand All @@ -172,20 +172,17 @@ void Palette::SetTransfers(int ntranspts, int *transx, float *transy) {
// interpolate between points
int n, ntrans, leftx, rightx;
float lefty, righty, m, x;

transSet = true;
ntrans = 0; // where we are in transx

if(transx[0] != 0) {
cerr << "Error in Palette::SetTransfers: transx[0] != 0 " << endl;
//exit(-5);
}

for(n=0; n < COLORSLOTS; n++) {

if((ntrans+1) > ntranspts) {
cerr << "Error in Palette::SetTransfers: (ntrans+1) > ntranspts = "
<< (ntrans+1) << " > " << ntranspts << endl;
cout << (ntrans+1) << " > " << ntranspts << endl;
//exit(-5);
}

Expand All @@ -204,7 +201,7 @@ void Palette::SetTransfers(int ntranspts, int *transx, float *transy) {
transY[n] = m*x + lefty;
}
}
Redraw();
Redraw();
}


Expand Down
28 changes: 11 additions & 17 deletions PltApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ PltApp::PltApp(XtAppContext app, Widget w, const aString &filename,
NULL);

GAptr = new GraphicsAttributes(wAmrVisTopLevel);

FileType fileType = GetDefaultFileType();
assert(fileType != INVALIDTYPE);
dataServicesPtr = dataservicesptr;
Expand All @@ -117,7 +117,7 @@ PltApp::PltApp(XtAppContext app, Widget w, const aString &filename,
SetInitialDerived(dataServicesPtr->PlotVarNames()[0]);
}
currentDerived = PltApp::initialDerived;

const AmrData &amrData = dataServicesPtr->AmrDataRef();
int finestLevel(amrData.FinestLevel());
int maxlev = DetermineMaxAllowableLevel(amrData.ProbDomain()[finestLevel],
Expand Down Expand Up @@ -146,8 +146,6 @@ PltApp::PltApp(XtAppContext app, Widget w, const aString &filename,
ivLowOffsetMAL.setVal(i, amrData.ProbDomain()[maxlev].smallEnd(i));
}
palFilename = PltApp::defaultPaletteString;
cout<<"GetDefaultShowBoxes() is "
<<( GetDefaultShowBoxes() ? "true" : "false" )<<endl;
PltAppInit();
}

Expand Down Expand Up @@ -225,7 +223,6 @@ PltApp::PltApp(XtAppContext app, Widget w, const Box &region,

ivLowOffsetMAL = offset;
currentDerived = newderived;

PltAppInit();
}

Expand Down Expand Up @@ -341,6 +338,7 @@ void PltApp::PltAppInit() {
NULL);
XmStringFree(newOString);


// ****************************************** Level Menu
char levelItem[LINELENGTH];
XmStringTable levelStringList;
Expand Down Expand Up @@ -385,6 +383,7 @@ void PltApp::PltAppInit() {
NULL);
XmStringFree(newLString);


// ****************************************** Derive Menu

int derived;
Expand Down Expand Up @@ -638,7 +637,6 @@ void PltApp::PltAppInit() {
wPlotArea = XtVaCreateWidget("plotarea", xmFormWidgetClass,
wFrames[PLOTFRAME],
NULL);

// ******************************************************* XY

wScrollArea[ZPLANE] = XtVaCreateManagedWidget("scrollAreaXY",
Expand Down Expand Up @@ -834,6 +832,7 @@ void PltApp::PltAppInit() {
#endif
// *************************************** Axis and animation control area


int wc, wcfWidth = 150, wcfHeight = 260;
int centerX = wcfWidth/2, centerY = wcfHeight / 2 - 16;
wFrames[CONTROLSFRAME] = XtVaCreateManagedWidget("controlsframe",
Expand Down Expand Up @@ -1031,6 +1030,7 @@ void PltApp::PltAppInit() {
NULL);
#endif


// *****************************************************************

XtManageChild(wScaleMenu);
Expand Down Expand Up @@ -1109,7 +1109,6 @@ void PltApp::PltAppInit() {
}
*/
}

#if (BL_SPACEDIM == 3)
Dimension width, height;
XtVaGetValues(wTransDA, XmNwidth, &width, XmNheight, &height, NULL);
Expand All @@ -1118,20 +1117,17 @@ void PltApp::PltAppInit() {
projPicturePtr = new ProjectionPicture(this, &viewTrans,
wTransDA, daWidth, daHeight);
#endif

for(np = 0; np < NPLANES; np++) {
amrPicturePtrArray[np]->CreatePicture(XtWindow(wPlotPlane[np]),
pltPaletteptr, derivedStrings[cderived]);
for(np = 0; np < NPLANES; np++) {
amrPicturePtrArray[np]->CreatePicture(XtWindow(wPlotPlane[np]),
pltPaletteptr, derivedStrings[cderived]);
}
FileType fileType = dataServicesPtr->GetFileType();
assert(fileType != INVALIDTYPE);
if(fileType == FAB || fileType == MULTIFAB) {
currentDerived = amrPicturePtrArray[ZPLANE]->CurrentDerived();
}

#if (BL_SPACEDIM == 3)
viewTrans.MakeTransform();

XmToggleButtonSetState(wAutoDraw, false, false);
labelAxes = false;
transDetached = false;
Expand All @@ -1143,13 +1139,11 @@ void PltApp::PltAppInit() {
finishcutY[np] = amrPicturePtrArray[np]->GetHLine();
}
#endif

for(np = 0; np < NPLANES; np++) {
XtAddEventHandler(wPlotPlane[np], ExposureMask, false,
(XtEventHandler) CBDoExposePicture,
(XtPointer) amrPicturePtrArray[np]);
}

#if (BL_SPACEDIM == 3)
XtAddEventHandler(wControlForm, ExposureMask, false,
(XtEventHandler) CBDoExposeRef, (XtPointer) this);
Expand All @@ -1172,7 +1166,6 @@ void PltApp::PltAppInit() {
rbgc = XCreateGC(GAptr->PDisplay(), GAptr->PRoot(), 0, NULL);
cursor = XCreateFontCursor(GAptr->PDisplay(), XC_left_ptr);
XSetFunction(GAptr->PDisplay(), rbgc, GXxor);

#if (BL_SPACEDIM == 3)
for(np = 0; np < NPLANES; np++) {
amrPicturePtrArray[np]->ToggleShowSubCut();
Expand All @@ -1184,7 +1177,8 @@ void PltApp::PltAppInit() {
for(np = 0; np < NPLANES; np++) {
amrPicturePtrArray[np]->SetDataMin(amrPicturePtrArray[np]->GetRegionMin());
amrPicturePtrArray[np]->SetDataMax(amrPicturePtrArray[np]->GetRegionMax());
}
}

} // end of PltAppInit


Expand Down
5 changes: 0 additions & 5 deletions ProjectionPicture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ ProjectionPicture::ProjectionPicture(PltApp *pltappptr, ViewTransform *vtptr,
showSubCut = false;
pixCreated = false;
imageData = NULL;

maxDataLevel = amrPicturePtr->MaxAllowableLevel();
theDomain = amrPicturePtr->GetSubDomain();

Expand All @@ -63,7 +62,6 @@ ProjectionPicture::ProjectionPicture(PltApp *pltappptr, ViewTransform *vtptr,
boxTransPoints[lev][iBox].resize(NVERTICIES);
}
}

subCutColor = 160;
boxColors.resize(maxDataLevel + 1);
for(lev = minDrawnLevel; lev <= maxDataLevel; ++lev) {
Expand All @@ -84,7 +82,6 @@ ProjectionPicture::ProjectionPicture(PltApp *pltappptr, ViewTransform *vtptr,
}
}
}

Box alignedBox(theDomain[minDrawnLevel]);
alignedBox.refine(CRRBetweenLevels(minDrawnLevel, maxDataLevel,
amrData.RefRatio()));
Expand Down Expand Up @@ -113,9 +110,7 @@ ProjectionPicture::ProjectionPicture(PltApp *pltappptr, ViewTransform *vtptr,

viewTransformPtr->SetObjCenter(xcenter, ycenter, zcenter);
viewTransformPtr->SetScreenPosition(daWidth/2, daHeight/2);

ReadTransferFile("vpramps.dat");

} // end ProjectionPicture()


Expand Down

0 comments on commit 2c71fdb

Please sign in to comment.