Skip to content

Commit

Permalink
fixes for max scale and max allowable level for 1d.
Browse files Browse the repository at this point in the history
  • Loading branch information
vebeckner committed Aug 29, 2017
1 parent d5b0ee2 commit d2fbd53
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
10 changes: 9 additions & 1 deletion GlobalUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,7 @@ int AVGlobals::DetermineMaxAllowableLevel(const Box &finestbox,

Box levelDomain(finestbox);
int maxallowablelevel(finestlevel);
int max1DLength(exp2(15) - 1); // ---- a pixmap cannot exceed this length
unsigned long boxpoints;
while(maxallowablelevel > 0) {
# if (BL_SPACEDIM == 1)
Expand All @@ -1250,7 +1251,14 @@ int AVGlobals::DetermineMaxAllowableLevel(const Box &finestbox,
boxpoints = max(boxpoints, tempLength);
# endif

if(boxpoints > maxpoints) { // try next coarser level
bool tooLong(false);
for(int sd(0); sd < BL_SPACEDIM; ++sd) {
if(levelDomain.length(sd) > max1DLength) {
tooLong = true;
}
}

if(boxpoints > maxpoints || tooLong) { // ---- try next coarser level
--maxallowablelevel;
levelDomain = finestbox;
levelDomain.coarsen(CRRBetweenLevels(maxallowablelevel, finestlevel,
Expand Down
16 changes: 11 additions & 5 deletions PltApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,11 @@ PltApp::PltApp(XtAppContext app, Widget w, const string &filename,
maxAllowableScale = 1;
} else {
#if (BL_SPACEDIM == 1)
maxAllowableScale = (int) (exp2(14) / dataSize);
maxAllowableScale = (int) ((exp2(15) - 1) / dataSize);
#else
maxAllowableScale = (int) sqrt((Real) (AVGlobals::MaxPictureSize() / dataSize));
#endif
maxAllowableScale = max(1, maxAllowableScale);
}

int currentScale(max(1, min(GetInitialScale(), maxAllowableScale)));
Expand Down Expand Up @@ -491,14 +492,19 @@ PltApp::PltApp(XtAppContext app, Widget w, const Box &region,
unsigned long dataSize(static_cast<unsigned long>(maxDomain.length(Amrvis::XDIR)) *
static_cast<unsigned long>(maxDomain.length(Amrvis::YDIR)));
#endif
if(AVGlobals::MaxPictureSize() / dataSize == 0) {
if(AVGlobals::MaxPictureSize() == 0) {
maxAllowableScale = 1;
} else {
} else {
#if (BL_SPACEDIM == 1)
maxAllowableScale = (int) ((exp2(15) - 1) / dataSize);
#else
maxAllowableScale = (int) sqrt((Real) (AVGlobals::MaxPictureSize() / dataSize));
#endif
maxAllowableScale = max(1, maxAllowableScale);
}

int currentScale = min(maxAllowableScale,
pltParent->GetPltAppState()->CurrentScale());
int currentScale(max(1, min(maxAllowableScale,
pltParent->GetPltAppState()->CurrentScale())));
pltAppState->SetCurrentScale(currentScale);

// ------------------------------- handle commprof timeline format
Expand Down

0 comments on commit d2fbd53

Please sign in to comment.