diff --git a/AmrData.H b/AmrData.H deleted file mode 100644 index f2e501e..0000000 --- a/AmrData.H +++ /dev/null @@ -1,186 +0,0 @@ - -// -// $Id: AmrData.H,v 1.26 2007-08-28 00:35:24 vince Exp $ -// - -// --------------------------------------------------------------- -// AmrData.H -// --------------------------------------------------------------- -#ifndef _AMRDATA_H_ -#define _AMRDATA_H_ - -#include "AmrvisConstants.H" -#include "Array.H" -#include "MultiFab.H" -#include "VisMF.H" - -#include -#include -#include -#include -using std::list; -using std::string; -using std::vector; -//using std::istream; -//using std::ostream; - -class Interpolater; - -class AmrData { - - protected: - // List of grids at each level, level 0 being coarsest. - Array > dataGrids; // [level][component] - //Array > > dataGridsDefined; // [level][component][index] - vector > > dataGridsDefined; // [level][component][index] - // ^^^^^^^^^^^^^^^^^^^^^^^^ need to put these in a class which handles - // setting defined/not defined - Array > visMF; // [level][whichMultiFab] - Array compIndexToVisMFMap; // [nComp] - Array compIndexToVisMFComponentMap; // [nComp] - - int finestLevel; // most refined level available - Array refRatio; // refinement ratio between level L and L+1 - Array< Array > dxLevel; // [level][dim]; // grid spacing - Array< Array< Array > > gridLocLo, gridLocHi; - Array probDomain; - Array maxDomain; // max problem domain size - Array probSize, probLo, probHi; - Real time; - Array plotVars; - Array vfEps, afEps; - int nComp, nGrow; - int nRegions; // number of boundary regions - int boundaryWidth; // number of zones in the boundary regions - int coordSys; - Array< Array< FArrayBox *> > regions; // [lev][nReg] ptrs to bndry data - BoxArray fabBoxArray; // used only for fileType == FAB - string plotFileVersion; - - FileType fileType; - bool bCartGrid; - bool bTerrain; - Array levelSteps; - - public: - AmrData(); - ~AmrData(); - - bool ReadData(const string &filename, FileType filetype); - bool ReadNonPlotfileData(const string &filename, FileType filetype); - - const Array &PlotVarNames() const { return plotVars; } - - int FinestLevel() const { return finestLevel; } - const Array &RefRatio() const { return refRatio; } - const BoxArray &boxArray(int level) const { - if(fileType == FAB || (fileType == MULTIFAB && level == 0)) { - return fabBoxArray; - } else { - // use visMF[][0]: all boxArrays are - // guaranteed to be the same for each MultiFab - return visMF[level][0]->boxArray(); - } - } - - // limits of interior region of computational domain at each level - const Array &ProbDomain() const { return probDomain; } - // physical size of computational domain - const Array &ProbSize() const { return probSize; } - const Array &ProbLo() const { return probLo; } - const Array &ProbHi() const { return probHi; } - - // return physical location of cell at index ix, level lev - // cellLoc = location of cell center - // loNodeLoc = location of node (vertex) on lower left hand corner - // hiNodeLoc = location of node (vertex) on upper right hand corner - void CellLoc(int lev, IntVect ix, Array &pos) const; - void LoNodeLoc(int lev, IntVect ix, Array &pos) const; - void HiNodeLoc(int lev, IntVect ix, Array &pos) const; - - // find the IntVect given a physical location - // returns the intvect, the finest level it is contained on, - // and the intvect at the given finest level - void IntVectFromLocation(const int finestFillLevel, const Array &location, - IntVect &ivLoc, int &ivLevel, IntVect &ivFinestFillLev); - - const Array< Array< Array > > &GridLocLo() const { return gridLocLo; } - const Array< Array< Array > > &GridLocHi() const { return gridLocHi; } - const Array< Array > &DxLevel() const { return dxLevel; } - const Array &LevelSteps() const { return levelSteps; } - - int NComp() const { return nComp; } - int BoundaryWidth() const { return boundaryWidth; } - int NGrow() const { return nGrow; } - int CoordSys() const { return coordSys; } - Real Time() const { return time; } - const string &PlotFileVersion() { return plotFileVersion; } - - // fill a databox using conservative interpolation - void FillVar(FArrayBox *destFab, const Box &destBox, - int finestFillLevel, const string &varName, int procWithFabs); - void FillVar(Array &destFabs, const Array &destBoxes, - int finestFillLevel, const string &varName, int procWithFabs); - void FillVar(MultiFab &destMultiFab, int finestFillLevel, - const Array &varNames, const Array &destFillComps); - void FillVar(MultiFab &destMultiFab, int finestFillLevel, - const string &varname, int destcomp = 0); - - const string &GetFileName() const { return fileName; } - - void SetFileType(FileType type); - FileType GetFileType() const { return fileType; } - bool CartGrid() const { return bCartGrid; } - Real VfEps(int level) const { return vfEps[level]; } - void SetVfEps(Real *newvfeps, int finestlev); - bool Terrain() const { return bTerrain; } - - void SetBoundaryWidth(int width) { boundaryWidth = width; } - - bool CanDerive(const string &name) const; - bool CanDerive(const Array &names) const; - int NumDeriveFunc() const; - void ListDeriveFunc(std::ostream &os) const; - int StateNumber(const string &statename) const; - - // return the finest level <= startLevel that fully contains box b - // b is defined on startLevel - int FinestContainingLevel(const Box &b, int startLevel) const; - - // return the finest level <= startLevel that intersects box b - // b is defined on startLevel - int FinestIntersectingLevel(const Box &b, int startLevel) const; - - // number of grids at level which intersect b - int NIntersectingGrids(int level, const Box &b) const; - MultiFab &GetGrids(int level, int componentIndex); - MultiFab &GetGrids(int level, int componentIndex, const Box &onBox); - void FlushGrids(int componentIndex); - - // calculate the min and max values of derived on onBox at level - // return false if onBox did not intersect any grids - bool MinMax(const Box &onBox, const string &derived, int level, - Real &dataMin, Real &dataMax); - - static void SetVerbose(bool tf) { verbose = tf; } - static void SetSkipPltLines(int spl) { skipPltLines = spl; } - static void SetStaticBoundaryWidth(int bw) { sBoundaryWidth = bw; } - - private: - string fileName; - static FileType defaultFileType; - static bool verbose; - static int skipPltLines; - static int sBoundaryWidth; - - // fill on interior by piecewise constant interpolation - void FillInterior(FArrayBox &dest, int level, const Box &subbox); - void Interp(FArrayBox &fine, FArrayBox &crse, - const Box &fine_box, int lrat); - void PcInterp(FArrayBox &fine, const FArrayBox &crse, - const Box &subbox, int lrat); - FArrayBox *ReadGrid(std::istream &is, int numVar); - bool DefineFab(int level, int componentIndex, int fabIndex); -}; - -#endif diff --git a/AmrData.cpp b/AmrData.cpp deleted file mode 100644 index 8baf4a3..0000000 --- a/AmrData.cpp +++ /dev/null @@ -1,2067 +0,0 @@ - -// -// $Id: AmrData.cpp,v 1.81 2011-04-08 22:43:21 lijewski Exp $ -// - -// --------------------------------------------------------------- -// AmrData.cpp -// --------------------------------------------------------------- -#include - -#include "AmrData.H" -#include "ArrayLim.H" -#include "VisMF.H" - -#include -#include -using std::string; -using std::cout; -using std::cerr; -using std::endl; -using std::min; -using std::max; -#ifndef WIN32 -using std::strlen; -#endif - -#if ! (defined(BL_Linux) || defined(BL_Darwin) || defined(BL_AIX) || defined(BL_IRIX64) || defined(WIN32) || defined(BL_CYGWIN_NT) || defined(BL_CRAYX1)) -#define BL_ALWAYS_FIX_DENORMALS -#endif - -#ifdef BL_ALWAYS_FIX_DENORMALS -#include -#if defined(BL_CRAYX1) -# include -#endif -#if defined(BL_T3E) -# include -# if (BL_USE_FLOAT) -# define DS_FP_CLASS fpclassify -# else -# define DS_FP_CLASS fpclassify -# endif -#else -# if (BL_USE_FLOAT) -# define DS_FP_CLASS fp_classf -# else -# define DS_FP_CLASS fp_class -# endif -#endif - -#endif - -#include -#include -#include -using std::ios; -using std::ifstream; - -// -// This MUST be defined if don't have pubsetbuf() in I/O Streams Library. -// -#ifdef BL_USE_SETBUF -#define pubsetbuf setbuf -#endif - -#ifdef SHOWVAL -#undef SHOWVAL -#endif - -#define SHOWVAL(val) { cout << #val << " = " << val << endl; } - -#ifdef VSHOWVAL -#undef VSHOWVAL -#endif - -#define VSHOWVAL(verbose, val) { if(verbose) { \ - cout << #val << " = " << val << endl; } } - - -#if defined( BL_FORT_USE_UPPERCASE ) -# if (BL_SPACEDIM == 2) -# define FORT_CINTERP CINTERP2D -# define FORT_PCINTERP PCINTERP2D -# define FORT_CARTGRIDMINMAX CARTGRIDMINMAX2D -# elif (BL_SPACEDIM == 3) -# define FORT_CINTERP CINTERP3D -# define FORT_PCINTERP PCINTERP3D -# define FORT_CARTGRIDMINMAX CARTGRIDMINMAX3D -# endif -#elif defined( BL_FORT_USE_LOWERCASE ) -# if (BL_SPACEDIM == 2) -# define FORT_CINTERP cinterp2d -# define FORT_PCINTERP pcinterp2d -# define FORT_CARTGRIDMINMAX cartgridminmax2d -# elif (BL_SPACEDIM == 3) -# define FORT_CINTERP cinterp3d -# define FORT_PCINTERP pcinterp3d -# define FORT_CARTGRIDMINMAX cartgridminmax3d -# endif -#else -# if (BL_SPACEDIM == 2) -# define FORT_CINTERP cinterp2d_ -# define FORT_PCINTERP pcinterp2d_ -# define FORT_CARTGRIDMINMAX cartgridminmax2d_ -# elif (BL_SPACEDIM == 3) -# define FORT_CINTERP cinterp3d_ -# define FORT_PCINTERP pcinterp3d_ -# define FORT_CARTGRIDMINMAX cartgridminmax3d_ -# endif -#endif - - -#if (BL_SPACEDIM != 1) -extern "C" { - void FORT_CINTERP(Real *fine, ARLIM_P(flo), ARLIM_P(fhi), - const int *fblo, const int *fbhi, - const int &nvar, const int &lratio, - const Real *crse, const int &clo, const int &chi, - const int *cslo, const int *cshi, - const int *fslo, const int *fshi, - Real *cslope, const int &c_len, - Real *fslope, Real *fdat, const int &f_len, - Real *foff); - - void FORT_PCINTERP(Real *fine, ARLIM_P(flo), ARLIM_P(fhi), - const int *fblo, const int *fbhi, - const int &lrat, const int &nvar, - const Real *crse, ARLIM_P(clo), ARLIM_P(chi), - const int *cblo, const int *cbhi, - Real *temp, const int &tlo, const int &thi); - - void FORT_CARTGRIDMINMAX (Real *data, ARLIM_P(dlo), ARLIM_P(dhi), - const Real *vfrac, const Real &vfeps, - Real &dmin, Real &dmax); -} -#endif - - -bool AmrData::verbose = false; -int AmrData::skipPltLines = 0; -int AmrData::sBoundaryWidth = 0; - -// --------------------------------------------------------------- -AmrData::AmrData() { - probSize.resize(BL_SPACEDIM, -1.0); - probLo.resize(BL_SPACEDIM, 0.0); - probHi.resize(BL_SPACEDIM, -1.0); - plotVars.clear(); - nRegions = 0; - boundaryWidth = 0; -} - - -// --------------------------------------------------------------- -AmrData::~AmrData() { - for(int i(0); i < nRegions; ++i) { - for(int lev(0); lev <= finestLevel; ++lev) { - delete regions[lev][i]; - } - } - - for(int lev(0); lev <= finestLevel; ++lev) { - for(int iComp(0); iComp < nComp; ++iComp) { - delete dataGrids[lev][iComp]; - } - } -} - - -// --------------------------------------------------------------- -namespace { - void mytrim(char *str) { - int i(strlen(str)); - for(int n(i - 1); n >= 0; --n) { - if( str[n] > ' ' ) { - break; - } - str[n] = 0; - } - } -} - - -// --------------------------------------------------------------- -bool AmrData::ReadData(const string &filename, FileType filetype) { - fileType = filetype; - bCartGrid = false; - bTerrain = false; - if(filetype == FAB || filetype == MULTIFAB) { - return ReadNonPlotfileData(filename, filetype); - } - - int i, j, k, width; - fileName = filename; - - string File = filename; - -#ifdef BL_NO_PARALLEL_IO - // do nothing -#else - File += '/'; - File += "Header"; -#endif - - VisMF::IO_Buffer io_buffer(VisMF::IO_Buffer_Size); - - ifstream isPltIn; - - isPltIn.rdbuf()->pubsetbuf(io_buffer.dataPtr(), io_buffer.size()); - - if(verbose) { - if(ParallelDescriptor::IOProcessor()) { - cout << "AmrData::opening file = " << filename << endl; - } - } - - isPltIn.open(File.c_str(), ios::in); - if(isPltIn.fail()) { - if(ParallelDescriptor::IOProcessor()) { - cerr << "Unable to open file: " << filename << endl; - } - return false; - } - - char skipBuff[LINELENGTH]; - for(i = 0; i < skipPltLines; ++i) { - isPltIn.getline(skipBuff, LINELENGTH); - if(ParallelDescriptor::IOProcessor()) { - cout << "Skipped line in pltfile = " << skipBuff << endl; - } - } - - isPltIn >> plotFileVersion; - if(strncmp(plotFileVersion.c_str(), "CartGrid", 8) == 0) { - bCartGrid = true; - } - if(strncmp(plotFileVersion.c_str(), "Terrain", 7) == 0) { - bTerrain = true; - } - if(verbose) { - if(ParallelDescriptor::IOProcessor()) { - cout << "Plot file version: " << plotFileVersion << endl; - if(bCartGrid) { - cout << ":::: Found a CartGrid file type." << endl; - } - if(bTerrain) { - cout << ":::: Found a Terrain file type." << endl; - } - } - } - - // read list of variables - isPltIn >> nComp; - if(nComp < 1 || nComp > 1024) { // arbitrarily limit to 1024 - if(ParallelDescriptor::IOProcessor()) { - cerr << "Error in AmrData: bad nComp = " << nComp << endl; - } - return false; - } - if(ParallelDescriptor::IOProcessor()) { - VSHOWVAL(verbose, nComp); - } - - plotVars.resize(nComp); - char plotVarName[LINELENGTH]; - bool bVFracFound(false); - isPltIn.getline(plotVarName, LINELENGTH); // eat white space left by op<< - for(i = 0; i < nComp; ++i) { - isPltIn.getline(plotVarName, LINELENGTH); - mytrim(plotVarName); - if(bCartGrid) { // check various permutations of vfrac name - if(strcmp(plotVarName, "vol_frac") == 0) { - cout << "+++++++++++++ found bad vfrac name: " << plotVarName << endl; - strcpy(plotVarName, "vfrac"); - cout << "+++++++++++++ now: " << plotVarName << endl; - } - if(strcmp(plotVarName, "volfrac") == 0) { - cout << "+++++++++++++ found bad vfrac name: " << plotVarName << endl; - strcpy(plotVarName, "vfrac"); - cout << "+++++++++++++ now: " << plotVarName << endl; - } - if(strcmp(plotVarName, "vfrac") == 0) { - bVFracFound = true; - } - } - plotVars[i] = plotVarName; - if(ParallelDescriptor::IOProcessor()) { - VSHOWVAL(verbose, plotVarName); - } - } - if(bCartGrid && bVFracFound == false) { - cerr << endl << " ~~~~ Error: no vfrac found for a " << plotFileVersion - << " file." << endl << endl; - return false; - } - - int spacedim; - isPltIn >> spacedim >> time >> finestLevel; - if(ParallelDescriptor::IOProcessor()) { - VSHOWVAL(verbose, spacedim); - VSHOWVAL(verbose, time); - VSHOWVAL(verbose, finestLevel); - } - if(spacedim != BL_SPACEDIM) { - if(ParallelDescriptor::IOProcessor()) { - cerr << endl << " ~~~~ Error: You are using " << BL_SPACEDIM - << "D amrvis " - << "to look at a " << spacedim << "D file." << endl << endl; - } - return false; - } - if(finestLevel < 0) { - if(ParallelDescriptor::IOProcessor()) { - cerr << "Error in AmrData: bad finestLevel = " << finestLevel << endl; - } - return false; - } - for(i = 0; i < BL_SPACEDIM; ++i) { - isPltIn >> probLo[i]; - if(verbose) { - if(ParallelDescriptor::IOProcessor()) { - cout << "probLo[" << i << "] = " << probLo[i] << endl; - } - } - } - for(i = 0; i < BL_SPACEDIM; ++i) { - isPltIn >> probHi[i]; - if(verbose) { - if(ParallelDescriptor::IOProcessor()) { - cout << "probHi[" << i << "] = " << probHi[i] << endl; - } - } - } - if(verbose) { - if(ParallelDescriptor::IOProcessor()) { - if(finestLevel > 0) { - cout << "Resizing refRatio to size = " << finestLevel << endl; - } - } - } - if(finestLevel == 0) { - refRatio.resize(1, 1); - } else { - refRatio.resize(finestLevel, -1); - } - while(isPltIn.get() != '\n') { - ; // do nothing - } - bool bIVRefRatio(false); - if(isPltIn.peek() == '(') { // it is an IntVect - bIVRefRatio = true; - } - for(i = 0; i < finestLevel; ++i) { - // try to guess if refRatio is an IntVect - if(bIVRefRatio) { // it is an IntVect - IntVect ivRefRatio; - isPltIn >> ivRefRatio; - if(verbose) { - if(ParallelDescriptor::IOProcessor()) { - cout << "IntVect refRatio[" << i << "] = " << ivRefRatio << endl; - } - } - refRatio[i] = ivRefRatio[0]; // non-uniform ref ratios not supported - } else { - isPltIn >> refRatio[i]; - } - if(verbose) { - if(ParallelDescriptor::IOProcessor()) { - cout << "refRatio[" << i << "] = " << refRatio[i] << endl; - } - } - } - for(i = 0; i < finestLevel; ++i ) { - if(refRatio[i] < 2 || refRatio[i] > 32 ) { - if(ParallelDescriptor::IOProcessor()) { - cerr << "Error in AmrData: bad refRatio at level " << i << " = " - << refRatio[i] << endl; - } - return false; - } - } - while(isPltIn.get() != '\n') { - ; // do nothing - } - probDomain.resize(finestLevel + 1); - maxDomain.resize(finestLevel + 1); - for(i = 0; i <= finestLevel; ++i) { - isPltIn >> probDomain[i]; - if(verbose) { - if(ParallelDescriptor::IOProcessor()) { - cout << "probDomain[" << i << "] = " << probDomain[i] << endl; - } - } - if( ! probDomain[i].ok()) { - if(ParallelDescriptor::IOProcessor()) { - cerr << "Error in AmrData: bad probDomain[" << i << "] = " - << probDomain[i] << endl; - } - return false; - } - } - - while(isPltIn.get() != '\n') { - ; // do nothing - } -#if 0 - char lstepbuff[128]; - isPltIn.getline(lstepbuff, 128); // ignore levelsteps--some files have - // finestlevel of these, others have - // finestlevel + 1 - - - if(verbose) { - if(ParallelDescriptor::IOProcessor()) { - cout << "Ignored levelSteps = " << lstepbuff << endl; - } - } -#else - // Get level steps - why do some have fl+1 ? (note above...just throw away last one here) - levelSteps.resize(finestLevel+1); - for(i = 0; i <= finestLevel; ++i) { - isPltIn >> levelSteps[i]; - } - while(isPltIn.get() != '\n') { - ; // do nothing - } - - if(verbose) { - if(ParallelDescriptor::IOProcessor()) { - for(i = 0; i <= finestLevel; ++i) { - cout << "LevelSteps[" << i << "] = " << levelSteps[i] << endl; - } - } - } -#endif - - dxLevel.resize(finestLevel + 1); - for(i = 0; i <= finestLevel; ++i) { - dxLevel[i].resize(BL_SPACEDIM); - for(k = 0; k < BL_SPACEDIM; ++k) { - isPltIn >> dxLevel[i][k]; - if(verbose) { - if(ParallelDescriptor::IOProcessor()) { - cout << "dxLevel[" << i << "][" << k << "] = " - << dxLevel[i][k] << endl; - } - } - } - } - - vfEps.resize(finestLevel + 1); // must resize these even if not cartGrid - afEps.resize(finestLevel + 1); - if(bCartGrid) { - for(i = 0; i <= finestLevel; ++i) { - isPltIn >> vfEps[i]; - if(verbose) { - cout << "vfEps[" << i << "] = " << vfEps[i] << endl; - } - } - } - - for(i = 0; i < BL_SPACEDIM; ++i) { - probSize[i] = probHi[i] - probLo[i]; - if(probSize[i] <= 0.0 ) { - if(ParallelDescriptor::IOProcessor()) { - cerr << "Error in AmrData: bad probSize[" << i << "] = " - << probSize[i] << endl; - } - return false; - } - } - - isPltIn >> coordSys; - if(ParallelDescriptor::IOProcessor()) { - VSHOWVAL(verbose, coordSys); - } - while(isPltIn.get() != '\n') { - ; // do nothing - } - - isPltIn >> width; // width of bndry regions - if(ParallelDescriptor::IOProcessor()) { - VSHOWVAL(verbose, width); - } - while(isPltIn.get() != '\n') { - ; // do nothing - } - - dataGrids.resize(finestLevel + 1); - dataGridsDefined.resize(finestLevel + 1); - - int lev; - boundaryWidth = max(width, sBoundaryWidth); - bool bRestrictDomain(maxDomain[0].ok()); - if(bRestrictDomain) { - for(lev = 1; lev <= finestLevel; ++lev) { - maxDomain[lev] = BoxLib::refine(maxDomain[lev-1],refRatio[lev-1]); - } - } - Array restrictDomain(finestLevel + 1); - Array extendRestrictDomain(finestLevel + 1); - regions.resize(finestLevel + 1); - for(lev = 0; lev <= finestLevel; ++lev) { - restrictDomain[lev] = probDomain[lev]; - if(bRestrictDomain) { - restrictDomain[lev] = maxDomain[lev]; - } - extendRestrictDomain[lev] = BoxLib::grow(restrictDomain[lev],boundaryWidth); - BoxList bndry_boxes = BoxLib::boxDiff(extendRestrictDomain[lev], - restrictDomain[lev]); - nRegions = bndry_boxes.size(); - - BoxList::iterator bli = bndry_boxes.begin(); - regions[lev].resize(nRegions); - i = 0; - while(bli != bndry_boxes.end()) { - regions[lev][i] = new FArrayBox(*bli, nComp); - if(verbose) { - if(ParallelDescriptor::IOProcessor()) { - cout << "BNDRY REGION " << i << " : " << *bli << endl; - cout << " numPts = " << bli->numPts() << endl; - } - } - ++i; - ++bli; - } - } - - // if positive set up and read bndry databoxes - if(width > 0) { - if(ParallelDescriptor::IOProcessor()) { - cerr << "Error in AmrData: Boundary width > 0 not supported: width = " - << width << endl; - } - return false; - } // end if(width...) - - // read all grids but only save those inside the restricted region - - visMF.resize(finestLevel + 1); - compIndexToVisMFMap.resize(nComp); - compIndexToVisMFComponentMap.resize(nComp); - gridLocLo.resize(finestLevel + 1); - gridLocHi.resize(finestLevel + 1); - - for(i = 0; i <= finestLevel; ++i) { - int nGrids; - Real gTime; - int iLevelSteps; - isPltIn >> lev >> nGrids >> gTime >> iLevelSteps; - if(ParallelDescriptor::IOProcessor()) { - VSHOWVAL(verbose, lev); - VSHOWVAL(verbose, nGrids); - VSHOWVAL(verbose, gTime); - VSHOWVAL(verbose, iLevelSteps); - } - if(i != lev) { - if(ParallelDescriptor::IOProcessor()) { - cerr << "Level misrestart:mismatch on restart" << endl; - cerr << "Error in AmrData: Level mismatch: read level " << lev - << " while expecting level " << i << endl; - } - return false; - } - if(nGrids < 1) { - if(ParallelDescriptor::IOProcessor()) { - cerr << "Error in AmrData: bad nGrids = " << nGrids << endl; - } - return false; - } - - gridLocLo[i].resize(nGrids); - gridLocHi[i].resize(nGrids); - for(int iloc = 0; iloc < nGrids; ++iloc) { - gridLocLo[i][iloc].resize(BL_SPACEDIM); - gridLocHi[i][iloc].resize(BL_SPACEDIM); - for(int iDim = 0; iDim < BL_SPACEDIM; ++iDim) { - isPltIn >> gridLocLo[i][iloc][iDim] >> gridLocHi[i][iloc][iDim]; - if(ParallelDescriptor::IOProcessor()) { - VSHOWVAL(verbose, gridLocLo[i][iloc][iDim]); - VSHOWVAL(verbose, gridLocHi[i][iloc][iDim]); - } - } - } - - // here we account for multiple multifabs in a plot file - int currentIndexComp(0); - int currentVisMF(0); - dataGrids[i].resize(nComp); - dataGridsDefined[i].resize(nComp); - - while(currentIndexComp < nComp) { - - string mfNameRelative; - isPltIn >> mfNameRelative; - string mfName(fileName); -#ifdef BL_NO_PARALLEL_IO - // do nothing -#else - mfName += '/'; - mfName += mfNameRelative; - VSHOWVAL(verbose, mfName); - VSHOWVAL(verbose, mfNameRelative); -#endif - - visMF[i].resize(currentVisMF + 1); // this preserves previous ones - visMF[i][currentVisMF] = new VisMF(mfName); - int iComp(currentIndexComp); - nGrow = visMF[i][currentVisMF]->nGrow(); - currentIndexComp += visMF[i][currentVisMF]->nComp(); - int currentVisMFComponent(0); - for( ; iComp < currentIndexComp; ++iComp) { - // make single component multifabs - // defer reading the MultiFab data - dataGrids[i][iComp] = new MultiFab(visMF[i][currentVisMF]->boxArray(), 1, - visMF[i][currentVisMF]->nGrow(), - Fab_noallocate); - dataGridsDefined[i][iComp].resize(visMF[i][currentVisMF]->size(), - false); - compIndexToVisMFMap[iComp] = currentVisMF; - compIndexToVisMFComponentMap[iComp] = currentVisMFComponent; - ++currentVisMFComponent; - } - - ++currentVisMF; - } // end while - - } // end for(i...finestLevel) - - // fill a set of temporary bndry regions surrounding the - // restricted domain by extension from interior data - // only use this data in bndry regions that did not - // get better data from interior or input bndry regions - for(lev = 0; lev <= finestLevel; ++lev) { - Box inbox(restrictDomain[lev]); - Box reg1(BoxLib::grow(restrictDomain[lev],boundaryWidth)); - Box reg2(BoxLib::grow(probDomain[lev],width)); - BoxList outside = BoxLib::boxDiff(reg1, reg2); - if(outside.size() > 0) { - // parts of the bndry have not been filled from the input - // data, must extending from interior regions - - for(int idir(0); idir < BL_SPACEDIM; ++idir) { - Box bx(BoxLib::adjCellLo(inbox,idir,boundaryWidth)); - Box br(bx); - for(k = 0; k < BL_SPACEDIM; ++k) { - if(k != idir) { - br.grow(k,boundaryWidth); - } - } - - br.shift(idir,1); - FArrayBox tmpreg(br,nComp); - Box reg_bx = tmpreg.box(); - reg_bx &= inbox; - FillInterior(tmpreg,lev,reg_bx); - br.shift(idir,-1); - FArrayBox tmpreg_lo(br,nComp); - tmpreg_lo.copy(tmpreg,tmpreg.box(),0,tmpreg_lo.box(),0,nComp); - - // now fill out tmp region along idir direction - Box b_lo(BoxLib::adjCellLo(inbox,idir,1)); - for(k = 1; k < boundaryWidth; ++k) { - Box btmp(b_lo); - btmp.shift(idir, -k); - tmpreg_lo.copy(tmpreg_lo,b_lo,0,btmp,0,nComp); - } - - // now fill out temp bndry region - Box b_src, b_dest; - int n; - for(k = 1; k < BL_SPACEDIM; ++k) { - int kdir = (idir + k) % BL_SPACEDIM; - b_dest = BoxLib::adjCellLo(bx, kdir, 1); - b_src = b_dest; - b_src = b_src.shift(kdir, 1); - for(n = 1; n <= boundaryWidth; ++n) { - tmpreg_lo.copy(tmpreg_lo, b_src, 0, b_dest, 0, nComp); - b_dest.shift(kdir, -1); - } - - b_dest = BoxLib::adjCellHi(bx,kdir,1); - b_src = b_dest; - b_src.shift(kdir,-1); - for(n = 1; n <= boundaryWidth; ++n) { - tmpreg_lo.copy(tmpreg_lo,b_src,0,b_dest,0,nComp); - b_dest.shift(kdir,1); - } - bx.grow(kdir,boundaryWidth); - } - - // now copy into real bndry regions - for(j = 0; j < nRegions; ++j) { - FArrayBox *p = regions[lev][j]; - Box p_box = p->box(); - BoxList::iterator bli = outside.begin(); - while(bli != outside.end()) { - Box ovlp(p_box); - ovlp &= *bli; - ovlp &= br; - if(ovlp.ok()) { - p->copy(tmpreg_lo, ovlp); - } - ++bli; - } - } // end for j - - // now work on the high side of the bndry region - bx = BoxLib::adjCellHi(inbox,idir,boundaryWidth); - br = bx; - for(k = 0; k < BL_SPACEDIM; ++k) { - if(k != idir) br.grow(k, boundaryWidth); - } - - br.shift(idir,-1); - FArrayBox tmpreg2(br,nComp); - reg_bx = tmpreg2.box(); - reg_bx &= inbox; - FillInterior(tmpreg2,lev,reg_bx); - br.shift(idir,1); - FArrayBox tmpreg_hi(br,nComp); - tmpreg_hi.copy(tmpreg2,tmpreg2.box(),0,tmpreg_hi.box(),0,nComp); - - // now fill out tmp region along idir direction - Box b_hi(BoxLib::adjCellHi(inbox,idir,1)); - for(k = 1; k < boundaryWidth; ++k) { - Box btmp(b_hi); - btmp.shift(idir,k); - tmpreg_hi.copy(tmpreg_hi,b_hi,0,btmp,0,nComp); - } - - // now fill out temp bndry region - for(k = 1; k < BL_SPACEDIM; ++k) { - int kdir = (idir + k) % BL_SPACEDIM; - b_dest = BoxLib::adjCellLo(bx, kdir, 1); - b_src = b_dest; - b_src.shift(kdir, 1); - for(n = 1; n <= boundaryWidth; ++n) { - tmpreg_hi.copy(tmpreg_hi, b_src, 0, b_dest, 0, nComp); - b_dest.shift(kdir,-1); - } - - b_dest = BoxLib::adjCellHi(bx, kdir, 1); - b_src = b_dest; - b_src.shift(kdir, -1); - for(n = 1; n <= boundaryWidth; ++n) { - tmpreg_hi.copy(tmpreg_hi, b_src, 0, b_dest, 0, nComp); - b_dest.shift(kdir, 1); - } - bx.grow(kdir, boundaryWidth); - } - - // now copy into real bndry regions - for(j = 0; j < nRegions; ++j) { - FArrayBox *p = regions[lev][j]; - Box p_box = p->box(); - BoxList::iterator bli = outside.begin(); - while(bli != outside.end()) { - Box ovlp(p_box); - ovlp &= *bli; - ovlp &= br; - if(ovlp.ok()) { - p->copy(tmpreg_hi, ovlp); - } - ++bli; - } - } // end for j - - } // end for(idir...) - } // end if(outside.size())... - - outside.clear(); - - } // end for(lev...) - - if(bRestrictDomain) { - Array p_lo(BL_SPACEDIM), p_hi(BL_SPACEDIM); - LoNodeLoc(0,maxDomain[0].smallEnd(),p_lo); - HiNodeLoc(0,maxDomain[0].bigEnd(),p_hi); - for(i = 0; i < BL_SPACEDIM; ++i) { - probLo[i] = p_lo[i]; - probHi[i] = p_hi[i]; - probSize[i] = p_hi[i] - p_lo[i]; - } - for(lev = 0; lev <= finestLevel; ++lev) { - probDomain[lev] = maxDomain[lev]; - } - } - - return true; - -} // end ReadData - - -// --------------------------------------------------------------- -bool AmrData::ReadNonPlotfileData(const string &filename, FileType filetype) { - int i; - if(verbose) { - cout << "AmrPlot::opening file = " << filename << endl; - } - - fileName = filename; - -#ifdef BL_USE_SETBUF - VisMF::IO_Buffer io_buffer(VisMF::IO_Buffer_Size); -#endif - - time = 0; - if(fileType == FAB) { - finestLevel = 0; - } else if(fileType == MULTIFAB) { - finestLevel = 1; // level zero is filler - } - probDomain.resize(finestLevel + 1); - maxDomain.resize(finestLevel + 1); - dxLevel.resize(finestLevel + 1); - refRatio.resize(finestLevel + 1); - if(fileType == FAB) { - refRatio[0] = 1; - } else if(fileType == MULTIFAB) { - refRatio[0] = 2; - } - for(int iLevel(0); iLevel <= finestLevel; ++iLevel) { - dxLevel[iLevel].resize(BL_SPACEDIM); - for(i = 0; i < BL_SPACEDIM; ++i) { - probLo[i] = 0.0; - probHi[i] = 1.0; // arbitrarily - probSize[i] = probHi[i] - probLo[i]; - dxLevel[iLevel][i] = 0.0; // temporarily - } - } - - dataGrids.resize(finestLevel + 1); - dataGridsDefined.resize(finestLevel + 1); - - if(fileType == FAB) { - ifstream is; - is.open(filename.c_str(), ios::in); - if(is.fail()) { - cerr << "Unable to open plotfile: " << filename << endl; - return false; - } - -#ifdef BL_USE_SETBUF - is.rdbuf()->setbuf(io_buffer.dataPtr(), io_buffer.size()); -#endif - - FArrayBox *newfab = new FArrayBox; - nComp = newfab->readFrom(is, 0); // read the first component - Box fabbox(newfab->box()); - fabBoxArray.resize(1); - fabBoxArray.set(0, fabbox); - dataGrids[0].resize(nComp); - dataGridsDefined[0].resize(nComp); - dataGridsDefined[0][0].resize(1); - dataGrids[0][0] = new MultiFab; - int nGrow(0); - dataGrids[0][0]->define(fabBoxArray, 0, nGrow, Fab_noallocate); - dataGrids[0][0]->setFab(0, newfab); - dataGridsDefined[0][0][0] = true; - // read subsequent components - // need to optimize this for lazy i/o - for(int iComp = 1; iComp < nComp; ++iComp) { - dataGrids[0][iComp] = new MultiFab; - dataGrids[0][iComp]->define(fabBoxArray, 0, nGrow, Fab_noallocate); - newfab = new FArrayBox; - is.seekg(0, ios::beg); - newfab->readFrom(is, iComp); // read the iComp component - dataGrids[0][iComp]->setFab(0, newfab); - dataGridsDefined[0][iComp].resize(1); - dataGridsDefined[0][iComp][0] = true; - } - char fabname[64]; // arbitrarily - plotVars.resize(nComp); - for(i = 0; i < nComp; ++i) { - sprintf(fabname, "%s%d", "Fab_", i); - plotVars[i] = fabname; - } - probDomain[0] = newfab->box(); - for(i = 0; i < BL_SPACEDIM; ++i) { - dxLevel[0][i] = 1.0 / probDomain[0].length(i); - } - is.close(); - - } else if(fileType == MULTIFAB) { - VisMF tempVisMF(filename); - nComp = tempVisMF.nComp(); - probDomain[1] = tempVisMF.boxArray().minimalBox(); - probDomain[0] = probDomain[1]; - probDomain[0].coarsen(refRatio[0]); - BoxArray mfBoxArray(tempVisMF.boxArray()); - BoxArray levelZeroBoxArray; - levelZeroBoxArray.resize(1); - levelZeroBoxArray.set(0, probDomain[0]); - dataGrids[0].resize(nComp, NULL); - dataGrids[1].resize(nComp, NULL); - dataGridsDefined[0].resize(nComp); - dataGridsDefined[1].resize(nComp); - fabBoxArray.resize(1); - fabBoxArray.set(0, probDomain[0]); - - int nGrow(0); - char fabname[64]; // arbitrarily - plotVars.resize(nComp); - - for(int iComp(0); iComp < nComp; ++iComp) { - sprintf(fabname, "%s%d", "MultiFab_", iComp); - plotVars[iComp] = fabname; - - for(int iDim(0); iDim < BL_SPACEDIM; ++iDim) { - dxLevel[0][iDim] = 1.0 / probDomain[0].length(iDim); - dxLevel[1][iDim] = 1.0 / probDomain[1].length(iDim); - } - - // set the level zero multifab - dataGridsDefined[0][iComp].resize(1, false); - dataGrids[0][iComp] = new MultiFab; - dataGrids[0][iComp]->define(levelZeroBoxArray, 0, nGrow, Fab_noallocate); - FArrayBox *newfab = new FArrayBox(probDomain[0], 1); - Real levelZeroValue, zvMin, zvMax; - zvMin = tempVisMF.min(0, iComp); // init with first value - zvMax = tempVisMF.max(0, iComp); // init with first value - for(int ic(0); ic < tempVisMF.size(); ++ic) { - zvMin = min(zvMin, tempVisMF.min(ic, iComp)); - zvMax = max(zvMax, tempVisMF.max(ic, iComp)); - } - levelZeroValue = zvMin; - newfab->setVal(levelZeroValue); -#if(BL_SPACEDIM == 2) -#ifdef BL_SETMFBACKGROUND - Real *dptr = newfab->dataPtr(); - int idx; - for(int icr(0); icr < newfab->box().length(1); ++icr) { - for(int icc(0); icc < newfab->box().length(0); ++icc) { - idx = icc + (icr * newfab->box().length(0)); - BL_ASSERT(idx < newfab->box().numPts()); - if((icc + icr) % 5 == 0) { - dptr[idx] = zvMax; - } - } - } -#endif -#endif - dataGrids[0][iComp]->setFab(0, newfab); - dataGridsDefined[0][iComp][0] = true; - - } // end for(iComp...) - - - // set the level one multifab - - // here we account for multiple multifabs in a plot file - int currentIndexComp(0); - int currentVisMF(0); - visMF.resize(finestLevel + 1); - compIndexToVisMFMap.resize(nComp); - compIndexToVisMFComponentMap.resize(nComp); - - while(currentIndexComp < nComp) { - visMF[1].resize(currentVisMF + 1); // this preserves previous ones - visMF[1][currentVisMF] = new VisMF(filename); - int iComp(currentIndexComp); - nGrow = visMF[1][currentVisMF]->nGrow(); - currentIndexComp += visMF[1][currentVisMF]->nComp(); - for(int currentVisMFComponent(0); iComp < currentIndexComp; ++iComp) { - // make single component multifabs for level one - dataGrids[1][iComp] = new MultiFab(visMF[1][currentVisMF]->boxArray(), 1, - visMF[1][currentVisMF]->nGrow(), - Fab_noallocate); - dataGridsDefined[1][iComp].resize(visMF[1][currentVisMF]->size(), false); - compIndexToVisMFMap[iComp] = currentVisMF; - compIndexToVisMFComponentMap[iComp] = currentVisMFComponent; - ++currentVisMFComponent; - } - - ++currentVisMF; - } // end while - - } // end if(fileType...) - - return true; -} - - -// --------------------------------------------------------------- -void AmrData::CellLoc(int lev, IntVect ix, Array &pos) const { - BL_ASSERT(pos.size() == dxLevel[lev].size()); - for(int i(0); i < BL_SPACEDIM; ++i) { - pos[i] = probLo[i] + (dxLevel[lev][i])*(0.5 + Real(ix[i])); - } -} - - -// --------------------------------------------------------------- -void AmrData::LoNodeLoc(int lev, IntVect ix, Array &pos) const { - BL_ASSERT(pos.size() == dxLevel[lev].size()); - for(int i(0); i < BL_SPACEDIM; ++i) { - pos[i] = probLo[i] + (dxLevel[lev][i])*Real(ix[i]); - } -} - - -// --------------------------------------------------------------- -void AmrData::HiNodeLoc(int lev, IntVect ix, Array &pos) const { - BL_ASSERT(pos.size() == dxLevel[lev].size()); - for(int i(0); i < BL_SPACEDIM; ++i) { - pos[i] = probLo[i] + (dxLevel[lev][i])*Real(ix[i]+1); - } -} - - -// --------------------------------------------------------------- -void AmrData::IntVectFromLocation(const int finestFillLevel, - const Array &location, - IntVect &ivLoc, int &ivLevel, - IntVect &ivFinestFillLev) -{ - BL_ASSERT(location.size() == BL_SPACEDIM); - BL_ASSERT(finestFillLevel <= finestLevel); - - int ffl(finestFillLevel); - - for(int i(0); i < BL_SPACEDIM; ++i) { - int ival = probDomain[ffl].smallEnd()[i] + - ((int) ( (location[i] - probLo[i]) / dxLevel[ffl][i] ) ); - ivFinestFillLev.setVal(i, ival); - } -} - - -// --------------------------------------------------------------- -void AmrData::FillVar(FArrayBox *destFab, const Box &destBox, - int finestFillLevel, const string &varname, int procWithFabs) -{ - Array destFabs(1); - Array destBoxes(1); - destFabs[0] = destFab; - destBoxes[0] = destBox; - - FillVar(destFabs, destBoxes, finestFillLevel, varname, procWithFabs); -} - - -// --------------------------------------------------------------- -void AmrData::FillVar(MultiFab &destMultiFab, int finestFillLevel, - const string &varname, int destcomp) -{ - int numFillComps(1); - Array varNames(numFillComps); - Array destComps(numFillComps); - varNames[0] = varname; - destComps[0] = destcomp; - FillVar(destMultiFab, finestFillLevel, varNames, destComps); -} - - -// --------------------------------------------------------------- -void AmrData::FillVar(MultiFab &destMultiFab, int finestFillLevel, - const Array &varNames, - const Array &destFillComps) -{ -// This function fills the destMultiFab which is defined on -// the finestFillLevel. - - BL_ASSERT(finestFillLevel >= 0 && finestFillLevel <= finestLevel); - BoxArray destBoxes(destMultiFab.boxArray()); - for(int iIndex = 0; iIndex < destBoxes.size(); ++iIndex) { - BL_ASSERT(probDomain[finestFillLevel].contains(destBoxes[iIndex])); - } - - int myProc(ParallelDescriptor::MyProc()); - int srcComp(0); // always 0 since AmrData uses single component MultiFabs - int nFillComps(1); // always - int currentLevel; - - Array cumulativeRefRatios(finestFillLevel + 1, -1); - - cumulativeRefRatios[finestFillLevel] = 1; - for(currentLevel = finestFillLevel - 1; currentLevel >= 0; --currentLevel) { - cumulativeRefRatios[currentLevel] = cumulativeRefRatios[currentLevel + 1] * - refRatio[currentLevel]; - } - - BL_ASSERT(varNames.size() == destFillComps.size()); - int nFillVars(varNames.size()); - - for(int currentFillIndex(0); currentFillIndex < nFillVars; ++currentFillIndex) { - int destComp(destFillComps[currentFillIndex]); - int stateIndex(StateNumber(varNames[currentFillIndex])); - // ensure the required grids are in memory - for(currentLevel = 0; currentLevel <= finestFillLevel; ++currentLevel) { - for(int iBox = 0; iBox < destBoxes.size(); ++iBox) { - Box tempCoarseBox(destBoxes[iBox]); - if(currentLevel != finestFillLevel) { - tempCoarseBox.coarsen(cumulativeRefRatios[currentLevel]); - } - GetGrids(currentLevel, stateIndex, tempCoarseBox); - } - } - - MultiFabCopyDescriptor multiFabCopyDesc; - Array stateDataMFId(finestFillLevel + 1); - for(currentLevel = 0; currentLevel <= finestFillLevel; ++currentLevel) { - stateDataMFId[currentLevel] = - multiFabCopyDesc.RegisterFabArray(dataGrids[currentLevel][stateIndex]); - } - - BoxArray localMFBoxes(destBoxes.size()); // These are the ones - // we want to fillpatch. - Array< Array< Array< Array > > > fillBoxId; - Array< Array< Array< Array > > > fillBoxIdBAs; - // [grid][level][fillablesubbox][oldnew] - // oldnew not used here - Array< Array< Array > > savedFineBox; // [grid][level][fillablesubbox] - - fillBoxId.resize(destBoxes.size()); - fillBoxIdBAs.resize(destBoxes.size()); - savedFineBox.resize(destBoxes.size()); - for(int iBox(0); iBox < destBoxes.size(); ++iBox) { - if(destMultiFab.DistributionMap()[iBox] == myProc) { - localMFBoxes.set(iBox, destBoxes[iBox]); - fillBoxId[iBox].resize(finestFillLevel + 1); - fillBoxIdBAs[iBox].resize(finestFillLevel + 1); - savedFineBox[iBox].resize(finestFillLevel + 1); - } - } - - IndexType boxType(destBoxes[0].ixType()); - BoxList unfilledBoxesOnThisLevel(boxType); - BoxList unfillableBoxesOnThisLevel(boxType); - // Do this for all local fab boxes. - for(int ibox(0); ibox < localMFBoxes.size(); ++ibox) { - if(destMultiFab.DistributionMap()[ibox] != myProc) { - continue; - } - unfilledBoxesOnThisLevel.clear(); - BL_ASSERT(unfilledBoxesOnThisLevel.ixType() == boxType); - BL_ASSERT(unfilledBoxesOnThisLevel.ixType() == localMFBoxes[ibox].ixType()); - unfilledBoxesOnThisLevel.push_back(localMFBoxes[ibox]); - // Find the boxes that can be filled on each level--these are all - // defined at their level of refinement. - bool needsFilling(true); - for(currentLevel = finestFillLevel; currentLevel >= 0 && needsFilling; - --currentLevel) - { - unfillableBoxesOnThisLevel.clear(); - const Box ¤tPDomain = probDomain[currentLevel]; - - int ufbLength(unfilledBoxesOnThisLevel.size()); - fillBoxId[ibox][currentLevel].resize(ufbLength); - fillBoxIdBAs[ibox][currentLevel].resize(ufbLength); - savedFineBox[ibox][currentLevel].resize(ufbLength); - - int currentBLI(0); - for(BoxList::iterator bli = unfilledBoxesOnThisLevel.begin(); - bli != unfilledBoxesOnThisLevel.end(); ++bli) - { - BL_ASSERT(bli->ok()); - Box coarseDestBox(*bli); - Box fineTruncDestBox(coarseDestBox & currentPDomain); - if(fineTruncDestBox.ok()) { - fineTruncDestBox.refine(cumulativeRefRatios[currentLevel]); - Box tempCoarseBox; - if(currentLevel == finestFillLevel) { - tempCoarseBox = fineTruncDestBox; - } else { - tempCoarseBox = fineTruncDestBox; - // check this vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv - tempCoarseBox.coarsen(cumulativeRefRatios[currentLevel]); - } - - savedFineBox[ibox][currentLevel][currentBLI] = fineTruncDestBox; - BL_ASSERT(localMFBoxes[ibox].intersects(fineTruncDestBox)); - - BoxList tempUnfillableBoxes(boxType); - fillBoxId[ibox][currentLevel][currentBLI].resize(1); - fillBoxIdBAs[ibox][currentLevel][currentBLI].resize(1); - - fillBoxId[ibox][currentLevel][currentBLI][0] = - multiFabCopyDesc.AddBox(stateDataMFId[currentLevel], - tempCoarseBox, &tempUnfillableBoxes, - srcComp, 0, 1); - - fillBoxIdBAs[ibox][currentLevel][currentBLI][0] = - BoxArray(BoxLib::complementIn(tempCoarseBox, - tempUnfillableBoxes)); - - unfillableBoxesOnThisLevel.join(tempUnfillableBoxes); - ++currentBLI; - } - } - - unfilledBoxesOnThisLevel.clear(); - unfilledBoxesOnThisLevel = - unfillableBoxesOnThisLevel.intersect(currentPDomain); - - if(unfilledBoxesOnThisLevel.isEmpty()) { - needsFilling = false; - } else { - Box coarseLocalMFBox(localMFBoxes[ibox]); - coarseLocalMFBox.coarsen(cumulativeRefRatios[currentLevel]); - unfilledBoxesOnThisLevel.intersect(coarseLocalMFBox); - // check this vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv - if(currentLevel != 0) { - unfilledBoxesOnThisLevel.coarsen(refRatio[currentLevel - 1]); - } - - if(currentLevel == 0) { - BoxList unfilledInside = - unfilledBoxesOnThisLevel.intersect(currentPDomain); - if( ! unfilledInside.isEmpty()) { - unfilledInside.intersect(coarseLocalMFBox); - BL_ASSERT(unfilledInside.isEmpty()); - } - } - } - } - } - - multiFabCopyDesc.CollectData(); - - - for(int currentIndex = 0; currentIndex < destBoxes.size(); ++currentIndex) { - if(destMultiFab.DistributionMap()[currentIndex] != myProc) { - continue; - } - for(int currentLevel(0); currentLevel <= finestFillLevel; ++currentLevel) { - for(int currentBox(0); - currentBox < fillBoxId[currentIndex][currentLevel].size(); - ++currentBox) - { - Box tempCoarseBox( - fillBoxId[currentIndex][currentLevel][currentBox][0].box()); - FArrayBox tempCoarseDestFab(tempCoarseBox, 1); - tempCoarseDestFab.setVal(1.e30); - multiFabCopyDesc.FillFab(stateDataMFId[currentLevel], - fillBoxId[currentIndex][currentLevel][currentBox][0], - tempCoarseDestFab); - - Box intersectDestBox(savedFineBox[currentIndex][currentLevel][currentBox]); - intersectDestBox &= destMultiFab[currentIndex].box(); - - const BoxArray &filledBoxes = - fillBoxIdBAs[currentIndex][currentLevel][currentBox][0]; - BoxArray fboxes(filledBoxes); - FArrayBox *copyFromThisFab; - const BoxArray *copyFromTheseBoxes; - FArrayBox tempCurrentFillPatchedFab; - - if(intersectDestBox.ok()) { - if(currentLevel != finestFillLevel) { - fboxes.refine(cumulativeRefRatios[currentLevel]); - // Interpolate up to fine patch. - tempCurrentFillPatchedFab.resize(intersectDestBox, nFillComps); - tempCurrentFillPatchedFab.setVal(1.e30); - BL_ASSERT(intersectDestBox.ok()); - BL_ASSERT(tempCoarseDestFab.box().ok()); - PcInterp(tempCurrentFillPatchedFab, - tempCoarseDestFab, intersectDestBox, - cumulativeRefRatios[currentLevel]); - copyFromThisFab = &tempCurrentFillPatchedFab; - copyFromTheseBoxes = &fboxes; - } else { - copyFromThisFab = &tempCoarseDestFab; - copyFromTheseBoxes = &filledBoxes; - } - for(int iFillBox(0); iFillBox < copyFromTheseBoxes->size(); - ++iFillBox) - { - Box srcdestBox((*copyFromTheseBoxes)[iFillBox]); - srcdestBox &= destMultiFab[currentIndex].box(); - srcdestBox &= intersectDestBox; - if(srcdestBox.ok()) { - destMultiFab[currentIndex].copy(*copyFromThisFab, - srcdestBox, 0, srcdestBox, - destComp, nFillComps); - } - } - } - } - } // end for(currentLevel...) - } // end for(currentIndex...) - - } // end for(currentFillIndex...) -} - - -// --------------------------------------------------------------- -void AmrData::FillVar(Array &destFabs, const Array &destBoxes, - int finestFillLevel, const string &varname, int procWithFabs) -{ - -// -// This function fills dest only on procWithFabs. All other dest -// pointers (on other processors) should be NULL. destBox -// on all processors must be defined. -// - - BL_ASSERT(finestFillLevel >= 0 && finestFillLevel <= finestLevel); - BL_ASSERT(procWithFabs >= 0 && procWithFabs < ParallelDescriptor::NProcs()); - for(int iIndex(0); iIndex < destBoxes.size(); ++iIndex) { - BL_ASSERT(probDomain[finestFillLevel].contains(destBoxes[iIndex])); - } - - int myproc(ParallelDescriptor::MyProc()); - int stateIndex(StateNumber(varname)); - int srcComp(0); - int destComp(0); - int numFillComps(1); - - int currentLevel; - Array cumulativeRefRatios(finestFillLevel + 1, -1); - - cumulativeRefRatios[finestFillLevel] = 1; - for(currentLevel = finestFillLevel - 1; currentLevel >= 0; --currentLevel) { - cumulativeRefRatios[currentLevel] = cumulativeRefRatios[currentLevel + 1] * - refRatio[currentLevel]; - } - - // ensure the required grids are in memory - for(currentLevel = 0; currentLevel <= finestFillLevel; ++currentLevel) { - for(int iBox = 0; iBox < destBoxes.size(); ++iBox) { - Box tempCoarseBox(destBoxes[iBox]); - if(currentLevel != finestFillLevel) { - tempCoarseBox.coarsen(cumulativeRefRatios[currentLevel]); - } - GetGrids(currentLevel, stateIndex, tempCoarseBox); - } - } - - MultiFabCopyDescriptor multiFabCopyDesc; - Array stateDataMFId(finestFillLevel + 1); - for(currentLevel = 0; currentLevel <= finestFillLevel; ++currentLevel) { - stateDataMFId[currentLevel] = - multiFabCopyDesc.RegisterFabArray(dataGrids[currentLevel][stateIndex]); - } - - Array localMFBoxes; // These are the ones we want to fillpatch. - Array< Array< Array< Array > > > fillBoxId; - Array< Array< Array< Array > > > fillBoxIdBAs; - // [grid][level][fillablesubbox][oldnew] - // oldnew not used here - Array< Array< Array > > savedFineBox; // [grid][level][fillablesubbox] - if(myproc == procWithFabs) { - localMFBoxes = destBoxes; - fillBoxId.resize(destBoxes.size()); - fillBoxIdBAs.resize(destBoxes.size()); - savedFineBox.resize(destBoxes.size()); - for(int iLocal = 0; iLocal < localMFBoxes.size(); ++iLocal) { - fillBoxId[iLocal].resize(finestFillLevel + 1); - fillBoxIdBAs[iLocal].resize(finestFillLevel + 1); - savedFineBox[iLocal].resize(finestFillLevel + 1); - } - } - - IndexType boxType(destBoxes[0].ixType()); - BoxList unfilledBoxesOnThisLevel(boxType); - BoxList unfillableBoxesOnThisLevel(boxType); - // Do this for all local fab boxes. - for(int ibox(0); ibox < localMFBoxes.size(); ++ibox) { - unfilledBoxesOnThisLevel.clear(); - BL_ASSERT(unfilledBoxesOnThisLevel.ixType() == boxType); - BL_ASSERT(unfilledBoxesOnThisLevel.ixType() == localMFBoxes[ibox].ixType()); - unfilledBoxesOnThisLevel.push_back(localMFBoxes[ibox]); - // Find the boxes that can be filled on each level--these are all - // defined at their level of refinement. - bool needsFilling(true); - for(currentLevel = finestFillLevel; currentLevel >= 0 && needsFilling; - --currentLevel) - { - unfillableBoxesOnThisLevel.clear(); - const Box ¤tPDomain = probDomain[currentLevel]; - - int ufbLength = unfilledBoxesOnThisLevel.size(); - fillBoxId[ibox][currentLevel].resize(ufbLength); - fillBoxIdBAs[ibox][currentLevel].resize(ufbLength); - savedFineBox[ibox][currentLevel].resize(ufbLength); - - int currentBLI(0); - for(BoxList::iterator bli = unfilledBoxesOnThisLevel.begin(); - bli != unfilledBoxesOnThisLevel.end(); ++bli) - { - BL_ASSERT(bli->ok()); - Box coarseDestBox(*bli); - Box fineTruncDestBox(coarseDestBox & currentPDomain); - if(fineTruncDestBox.ok()) { - fineTruncDestBox.refine(cumulativeRefRatios[currentLevel]); - Box tempCoarseBox; - if(currentLevel == finestFillLevel) { - tempCoarseBox = fineTruncDestBox; - } else { - tempCoarseBox = fineTruncDestBox; - // check this vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv - tempCoarseBox.coarsen(cumulativeRefRatios[currentLevel]); - } - - savedFineBox[ibox][currentLevel][currentBLI] = fineTruncDestBox; - BL_ASSERT(localMFBoxes[ibox].intersects(fineTruncDestBox)); - - BoxList tempUnfillableBoxes(boxType); - fillBoxId[ibox][currentLevel][currentBLI].resize(1); - fillBoxIdBAs[ibox][currentLevel][currentBLI].resize(1); - - fillBoxId[ibox][currentLevel][currentBLI][0] = - multiFabCopyDesc.AddBox(stateDataMFId[currentLevel], - tempCoarseBox, &tempUnfillableBoxes, - srcComp, destComp, numFillComps); - - fillBoxIdBAs[ibox][currentLevel][currentBLI][0] = - BoxArray(BoxLib::complementIn(tempCoarseBox, - tempUnfillableBoxes)); - - unfillableBoxesOnThisLevel.join(tempUnfillableBoxes); - ++currentBLI; - } - } - - unfilledBoxesOnThisLevel.clear(); - unfilledBoxesOnThisLevel = - unfillableBoxesOnThisLevel.intersect(currentPDomain); - - if(unfilledBoxesOnThisLevel.isEmpty()) { - needsFilling = false; - } else { - Box coarseLocalMFBox(localMFBoxes[ibox]); - coarseLocalMFBox.coarsen(cumulativeRefRatios[currentLevel]); - unfilledBoxesOnThisLevel.intersect(coarseLocalMFBox); - // check this vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv - if(currentLevel != 0) { - unfilledBoxesOnThisLevel.coarsen(refRatio[currentLevel - 1]); - } - - if(currentLevel == 0) { - BoxList unfilledInside = - unfilledBoxesOnThisLevel.intersect(currentPDomain); - if( ! unfilledInside.isEmpty()) { - unfilledInside.intersect(coarseLocalMFBox); - BL_ASSERT(unfilledInside.isEmpty()); - } - } - } - } - } - - multiFabCopyDesc.CollectData(); - - - for(int currentIndex = 0; currentIndex < destBoxes.size(); ++currentIndex) { - for(int currentLevel = 0; currentLevel <= finestFillLevel; ++currentLevel) { - if(myproc != procWithFabs) { - break; - } - for(int currentBox(0); - currentBox < fillBoxId[currentIndex][currentLevel].size(); - ++currentBox) - { - Box tempCoarseBox( - fillBoxId[currentIndex][currentLevel][currentBox][0].box()); - FArrayBox tempCoarseDestFab(tempCoarseBox, numFillComps); - tempCoarseDestFab.setVal(1.e30); - multiFabCopyDesc.FillFab(stateDataMFId[currentLevel], - fillBoxId[currentIndex][currentLevel][currentBox][0], - tempCoarseDestFab); - - Box intersectDestBox(savedFineBox[currentIndex][currentLevel][currentBox]); - intersectDestBox &= destFabs[currentIndex]->box(); - - const BoxArray &filledBoxes = - fillBoxIdBAs[currentIndex][currentLevel][currentBox][0]; - BoxArray fboxes(filledBoxes); - FArrayBox *copyFromThisFab; - const BoxArray *copyFromTheseBoxes; - FArrayBox tempCurrentFillPatchedFab; - - if(intersectDestBox.ok()) { - if(currentLevel != finestFillLevel) { - fboxes.refine(cumulativeRefRatios[currentLevel]); - // Interpolate up to fine patch. - tempCurrentFillPatchedFab.resize(intersectDestBox, numFillComps); - tempCurrentFillPatchedFab.setVal(1.e30); - BL_ASSERT(intersectDestBox.ok()); - BL_ASSERT( tempCoarseDestFab.box().ok()); - PcInterp(tempCurrentFillPatchedFab, - tempCoarseDestFab, - intersectDestBox, - cumulativeRefRatios[currentLevel]); - copyFromThisFab = &tempCurrentFillPatchedFab; - copyFromTheseBoxes = &fboxes; - } else { - copyFromThisFab = &tempCoarseDestFab; - copyFromTheseBoxes = &filledBoxes; - } - for(int iFillBox(0); iFillBox < copyFromTheseBoxes->size(); - ++iFillBox) - { - Box srcdestBox((*copyFromTheseBoxes)[iFillBox]); - srcdestBox &= destFabs[currentIndex]->box(); - srcdestBox &= intersectDestBox; - if(srcdestBox.ok()) { - destFabs[currentIndex]->copy(*copyFromThisFab, - srcdestBox, 0, srcdestBox, - destComp, numFillComps); - } - } - } - } - } // end for(currentLevel...) - } // end for(currentIndex...) -} // end FillVar for a fab on a single processor - - -// --------------------------------------------------------------- -void AmrData::FillInterior(FArrayBox &dest, int level, const Box &subbox) { - BoxLib::Abort("Error: should not be in AmrData::FillInterior"); -} - - -// --------------------------------------------------------------- -int AmrData::NumDeriveFunc() const { - return (plotVars.size()); -} - - -// --------------------------------------------------------------- -// return true if the given name is the name of a plot variable -// that can be derived from what is known. -// --------------------------------------------------------------- -bool AmrData::CanDerive(const string &name) const { - for(int i(0); i < plotVars.size(); ++i) { - if(plotVars[i] == name) { - return true; - } - } - return false; -} - - -// --------------------------------------------------------------- -bool AmrData::CanDerive(const Array &names) const { - int nFound(0); - for(int n(0); n < names.size(); ++n) { - for(int i(0); i < plotVars.size(); ++i) { - if(plotVars[i] == names[n]) { - ++nFound; - continue; - } - } - } - return(nFound == names.size()); -} - - -// --------------------------------------------------------------- -// output the list of variables that can be derived -// --------------------------------------------------------------- -void AmrData::ListDeriveFunc(std::ostream &os) const { - for(int i(0); i < plotVars.size(); ++i) { - os << plotVars[i] << endl; - } -} - - -// --------------------------------------------------------------- -int AmrData::NIntersectingGrids(int level, const Box &b) const { - BL_ASSERT(level >=0 && level <= finestLevel); - BL_ASSERT(b.ok()); - - int nGrids(0); - if(fileType == FAB || (fileType == MULTIFAB && level == 0)) { - nGrids = 1; - } else { - const BoxArray &visMFBA = visMF[level][0]->boxArray(); - for(int boxIndex = 0; boxIndex < visMFBA.size(); ++boxIndex) { - if(b.intersects(visMFBA[boxIndex])) { - ++nGrids; - } - } - } - return nGrids; -} - - -// --------------------------------------------------------------- -int AmrData::FinestContainingLevel(const Box &b, int startLevel) const { - BL_ASSERT(startLevel >= 0 && startLevel <= finestLevel); - BL_ASSERT(b.ok()); - - if(fileType == FAB) { - return 0; - } else { - Box levelBox(b); - for(int level = startLevel; level > 0; --level) { - const BoxArray &visMFBA = visMF[level][0]->boxArray(); - if(visMFBA.contains(levelBox)) { - return level; - } - levelBox.coarsen(refRatio[level - 1]); - } - } - return 0; -} - - -// --------------------------------------------------------------- -int AmrData::FinestIntersectingLevel(const Box &b, int startLevel) const { - BL_ASSERT(startLevel >= 0 && startLevel <= finestLevel); - BL_ASSERT(b.ok()); - - if(fileType == FAB) { - return 0; - } else { - Box levelBox(b); - for(int level(startLevel); level > 0; --level) { - const BoxArray &visMFBA = visMF[level][0]->boxArray(); - - for(int iBox(0); iBox < visMFBA.size(); ++iBox) { - if(visMFBA[iBox].intersects(levelBox)) { - return level; - } - } - - levelBox.coarsen(refRatio[level - 1]); - } - } - return 0; -} - - -// --------------------------------------------------------------- -MultiFab &AmrData::GetGrids(int level, int componentIndex) { - for(MFIter mfi(*dataGrids[level][componentIndex]); mfi.isValid(); ++mfi) { - DefineFab(level, componentIndex, mfi.index()); - } - return *dataGrids[level][componentIndex]; -} - - -// --------------------------------------------------------------- -MultiFab &AmrData::GetGrids(int level, int componentIndex, const Box &onBox) { - if(fileType == FAB || (fileType == MULTIFAB && level == 0)) { - // do nothing - } else { - int whichVisMF(compIndexToVisMFMap[componentIndex]); - for(MFIter mfi(*dataGrids[level][componentIndex]); - mfi.isValid(); ++mfi) - { - if(onBox.intersects(visMF[level][whichVisMF]->boxArray()[mfi.index()])) { - DefineFab(level, componentIndex, mfi.index()); - } - } - } - return *dataGrids[level][componentIndex]; -} - - -// --------------------------------------------------------------- -bool AmrData::DefineFab(int level, int componentIndex, int fabIndex) { - - if( ! dataGridsDefined[level][componentIndex][fabIndex]) { - int whichVisMF(compIndexToVisMFMap[componentIndex]); - int whichVisMFComponent(compIndexToVisMFComponentMap[componentIndex]); - dataGrids[level][componentIndex]->setFab(fabIndex, - visMF[level][whichVisMF]->readFAB(fabIndex, whichVisMFComponent)); - dataGridsDefined[level][componentIndex][fabIndex] = true; - } - return true; -} - - -// --------------------------------------------------------------- -void AmrData::FlushGrids(int componentIndex) { - - for(int lev = 0; lev <= finestLevel; ++lev) { - dataGrids[lev][componentIndex]->clear(); - for(MFIter mfi(*dataGrids[lev][componentIndex]); - mfi.isValid(); ++mfi) - { - dataGridsDefined[lev][componentIndex][mfi.index()] = false; - } - } -} - - -// --------------------------------------------------------------- -bool AmrData::MinMax(const Box &onBox, const string &derived, int level, - Real &dataMin, Real &dataMax) -{ - BL_ASSERT(level >= 0 && level <= finestLevel); - BL_ASSERT(onBox.ok()); - - bool valid(false); // does onBox intersect any grids (are minmax valid) - Real minVal, maxVal; - dataMin = std::numeric_limits::max(); - dataMax = -std::numeric_limits::max(); - Box overlap; - - // our strategy here is to use the VisMF min and maxes if possible - // first, test if onBox completely contains each multifab box - // if so, use VisMF min and max - // if not, test if VisMF min and max are within dataMin and dataMax - // if so, use VisMF min and max - - int compIndex(StateNumber(derived)); - - if(fileType == FAB || (fileType == MULTIFAB && level == 0)) { - for(MFIter gpli(*dataGrids[level][compIndex]); gpli.isValid(); ++gpli) { - if(onBox.intersects(dataGrids[level][compIndex]->boxArray()[gpli.index()])) { - valid = true; - overlap = onBox; - overlap &= gpli.validbox(); - minVal = (*dataGrids[level][compIndex])[gpli].min(overlap, 0); - maxVal = (*dataGrids[level][compIndex])[gpli].max(overlap, 0); - - dataMin = min(dataMin, minVal); - dataMax = max(dataMax, maxVal); - } - } - - } else if(bCartGrid && (compIndex != StateNumber("vfrac"))) { -#if (BL_SPACEDIM == 1) - BoxLib::Abort("AmrData::MinMax: should not be here for 1d."); -#else - int iCount(0), iCountAllBody(0); - int iCountMixedSkipped(0), iCountMixedFort(0); - int cCount(0), cCountAllBody(0), cCountAllFluid(0), cCountMixed(0); - int cCountMixedSkipped(0), cCountMixedFort(0); - int allCount(0), outsideCount(0); - for(MFIter gpli(*dataGrids[level][compIndex]); gpli.isValid(); ++gpli) { - /* - if(onBox.intersects(gpli.validbox())) { - int vfIndex(StateNumber("vfrac")); - DefineFab(level, compIndex, gpli.index()); - DefineFab(level, vfIndex, gpli.index()); - Real *ddat = (*dataGrids[level][compIndex])[gpli].dataPtr(); - Real *vdat = (*dataGrids[level][vfIndex])[gpli].dataPtr(); - const int *dlo = (*dataGrids[level][compIndex])[gpli].loVect(); - const int *dhi = (*dataGrids[level][compIndex])[gpli].hiVect(); - - overlap = onBox; - overlap &= gpli.validbox(); - Real vfMaxVal = (*dataGrids[level][vfIndex])[gpli].max(overlap, 0); - Real vfMinVal = (*dataGrids[level][vfIndex])[gpli].min(overlap, 0); - if(vfMaxVal >= vfEps[level]) { - valid = true; - - FORT_CARTGRIDMINMAX(ddat, ARLIM(dlo), ARLIM(dhi), vdat, vfEps[level], - minVal, maxVal); - dataMin = min(dataMin, minVal); - dataMax = max(dataMax, maxVal); - } - } - */ - ++allCount; - int gdx(gpli.index()); - int whichVisMF(compIndexToVisMFMap[compIndex]); - int whichVisMFComponent(compIndexToVisMFComponentMap[compIndex]); - Real visMFMin(visMF[level][whichVisMF]->min(gdx, whichVisMFComponent)); - Real visMFMax(visMF[level][whichVisMF]->max(gdx, whichVisMFComponent)); - int vfIndex(StateNumber("vfrac")); - if(onBox.contains(gpli.validbox())) { - ++cCount; - int vfWhichVisMF(compIndexToVisMFMap[vfIndex]); - int vfWhichVisMFComponent(compIndexToVisMFComponentMap[vfIndex]); - Real vfVisMFMin(visMF[level][vfWhichVisMF]->min(gdx, vfWhichVisMFComponent)); - Real vfVisMFMax(visMF[level][vfWhichVisMF]->max(gdx, vfWhichVisMFComponent)); - if(vfVisMFMin > (1.0 - vfEps[level])) { // no cg body in this grid - ++cCountAllFluid; - dataMin = min(dataMin, visMFMin); - dataMax = max(dataMax, visMFMax); - valid = true; - } else if(vfVisMFMax >= vfEps[level] ) { - ++cCountMixed; - if(visMFMin < dataMin || visMFMax > dataMax) { // do it the hard way - DefineFab(level, compIndex, gdx); - DefineFab(level, vfIndex, gdx); - Real *ddat = (*dataGrids[level][compIndex])[gpli].dataPtr(); - Real *vdat = (*dataGrids[level][vfIndex])[gpli].dataPtr(); - const int *dlo = (*dataGrids[level][compIndex])[gpli].loVect(); - const int *dhi = (*dataGrids[level][compIndex])[gpli].hiVect(); - - overlap = onBox; - overlap &= gpli.validbox(); - Real vfMaxVal = (*dataGrids[level][vfIndex])[gpli].max(overlap, 0); - if(vfMaxVal >= vfEps[level]) { - ++cCountMixedFort; - valid = true; - - FORT_CARTGRIDMINMAX(ddat, ARLIM(dlo), ARLIM(dhi), vdat, vfEps[level], - minVal, maxVal); - dataMin = min(dataMin, minVal); - dataMax = max(dataMax, maxVal); - } - } else { - ++cCountMixedSkipped; - } - } else { // all body - ++cCountAllBody; - } - } else if(onBox.intersects(visMF[level][whichVisMF]->boxArray()[gdx])) { - ++iCount; - if(visMFMin < dataMin || visMFMax > dataMax) { // do it the hard way - DefineFab(level, compIndex, gdx); - DefineFab(level, vfIndex, gdx); - Real *ddat = (*dataGrids[level][compIndex])[gpli].dataPtr(); - Real *vdat = (*dataGrids[level][vfIndex])[gpli].dataPtr(); - const int *dlo = (*dataGrids[level][compIndex])[gpli].loVect(); - const int *dhi = (*dataGrids[level][compIndex])[gpli].hiVect(); - - overlap = onBox; - overlap &= gpli.validbox(); - Real vfMaxVal = (*dataGrids[level][vfIndex])[gpli].max(overlap, 0); - if(vfMaxVal >= vfEps[level]) { - ++iCountMixedFort; - valid = true; - - FORT_CARTGRIDMINMAX(ddat, ARLIM(dlo), ARLIM(dhi), vdat, vfEps[level], - minVal, maxVal); - dataMin = min(dataMin, minVal); - dataMax = max(dataMax, maxVal); - } else { - ++iCountAllBody; - } - } else { - ++iCountMixedSkipped; - } - } else { - ++outsideCount; - } - } - if(verbose) { - cout << "*** Level: " << level << endl; - SHOWVAL(allCount); - SHOWVAL(outsideCount); - cout << "--------------" << endl; - - SHOWVAL(cCount); - SHOWVAL(cCountAllBody); - SHOWVAL(cCountAllFluid); - SHOWVAL(cCountMixed); - SHOWVAL(cCountMixedSkipped); - SHOWVAL(cCountMixedFort); - cout << "--------------" << endl; - if(iCount > 0) { - SHOWVAL(iCount); - SHOWVAL(iCountAllBody); - SHOWVAL(iCountMixedSkipped); - SHOWVAL(iCountMixedFort); - cout << "--------------" << endl; - } - cout << endl << endl; - } -#endif - - } else { - for(MFIter gpli(*dataGrids[level][compIndex]); gpli.isValid(); ++gpli) { - int whichVisMF(compIndexToVisMFMap[compIndex]); - int whichVisMFComponent(compIndexToVisMFComponentMap[compIndex]); - Real visMFMin(visMF[level][whichVisMF]->min(gpli.index(), - whichVisMFComponent)); - Real visMFMax(visMF[level][whichVisMF]->max(gpli.index(), - whichVisMFComponent)); -#ifdef BL_ALWAYS_FIX_DENORMALS -# if defined(BL_T3E) - int dsFpClassMin(DS_FP_CLASS(visMFMin)); - if(dsFpClassMin == FP_SUBNORMAL) { - visMFMin = 0.0; - } - int dsFpClassMax(DS_FP_CLASS(visMFMax)); - if(dsFpClassMax == FP_SUBNORMAL) { - visMFMax = 0.0; - } -# else - int dsFpClassMin(DS_FP_CLASS(visMFMin)); - if(dsFpClassMin == FP_POS_DENORM || dsFpClassMin == FP_NEG_DENORM) { - visMFMin = 0.0; - } - int dsFpClassMax(DS_FP_CLASS(visMFMax)); - if(dsFpClassMax == FP_POS_DENORM || dsFpClassMax == FP_NEG_DENORM) { - visMFMax = 0.0; - } -# endif -#endif - if(onBox.contains(gpli.validbox())) { - dataMin = min(dataMin, visMFMin); - dataMax = max(dataMax, visMFMax); - valid = true; - } else if(onBox.intersects(visMF[level][whichVisMF]-> - boxArray()[gpli.index()])) - { - if(visMFMin < dataMin || visMFMax > dataMax) { // do it the hard way - DefineFab(level, compIndex, gpli.index()); - valid = true; - overlap = onBox; - overlap &= gpli.validbox(); - minVal = (*dataGrids[level][compIndex])[gpli].min(overlap, 0); - maxVal = (*dataGrids[level][compIndex])[gpli].max(overlap, 0); - - dataMin = min(dataMin, minVal); - dataMax = max(dataMax, maxVal); - } // end if(visMFMin...) - } - } - } - - ParallelDescriptor::ReduceRealMin(dataMin); - ParallelDescriptor::ReduceRealMax(dataMax); - - return valid; -} // end MinMax - - -// --------------------------------------------------------------- -int AmrData::StateNumber(const string &statename) const { - for(int ivar = 0; ivar < plotVars.size(); ++ivar) { - if(statename == plotVars[ivar]) { - return ivar; - } - } - return(-1); -} - - -// --------------------------------------------------------------- -void AmrData::Interp(FArrayBox &fine, FArrayBox &crse, - const Box &fine_box, int lrat) -{ -#if (BL_SPACEDIM == 1) - BoxLib::Abort("AmrData::MinMax: should not be here for 1d."); -#else - BL_ASSERT(fine.box().contains(fine_box)); - Box crse_bx(BoxLib::coarsen(fine_box,lrat)); - Box fslope_bx(BoxLib::refine(crse_bx,lrat)); - Box cslope_bx(crse_bx); - cslope_bx.grow(1); - BL_ASSERT(crse.box() == cslope_bx); - - // alloc temp space for coarse grid slopes - long cLen = cslope_bx.numPts(); - Real *cslope = new Real[BL_SPACEDIM*cLen]; - long loslp = cslope_bx.index(crse_bx.smallEnd()); - long hislp = cslope_bx.index(crse_bx.bigEnd()); - long cslope_vol = cslope_bx.numPts(); - long clo = 1 - loslp; - long chi = clo + cslope_vol - 1; - cLen = hislp - loslp + 1; - - // alloc temp space for one strip of fine grid slopes - int dir; - int fLen = fslope_bx.longside(dir); - Real *fdat = new Real[(BL_SPACEDIM+2)*fLen]; - Real *foff = fdat + fLen; - Real *fslope = foff + fLen; - - - // alloc tmp space for slope calc and to allow for vectorization - const int *fblo = fine_box.loVect(); - const int *fbhi = fine_box.hiVect(); - const int *cblo = crse_bx.loVect(); - const int *cbhi = crse_bx.hiVect(); - const int *fslo = fslope_bx.loVect(); - const int *fshi = fslope_bx.hiVect(); - - FORT_CINTERP(fine.dataPtr(0),ARLIM(fine.loVect()),ARLIM(fine.hiVect()), - fblo,fbhi,fine.nComp(),lrat, - crse.dataPtr(0),clo,chi,cblo,cbhi,fslo,fshi, - cslope,cLen,fslope,fdat,fLen,foff); - - delete [] fdat; - delete [] cslope; -#endif -} - - -// --------------------------------------------------------------- -void AmrData::PcInterp(FArrayBox &fine, const FArrayBox &crse, - const Box &subbox, int lrat) -{ -#if (BL_SPACEDIM == 1) - BoxLib::Abort("AmrData::MinMax: should not be here for 1d."); -#else - BL_ASSERT(fine.box().contains(subbox)); - BL_ASSERT(fine.nComp() == crse.nComp()); - Box cfine(crse.box()); - cfine.refine(lrat); - Box fine_ovlp(subbox); - fine_ovlp &= cfine; - if(fine_ovlp.ok()) { - const int *fblo = fine_ovlp.smallEnd().getVect(); - const int *fbhi = fine_ovlp.bigEnd().getVect(); - Box crse_ovlp(fine_ovlp); - crse_ovlp.coarsen(lrat); - const int *cblo = crse_ovlp.smallEnd().getVect(); - const int *cbhi = crse_ovlp.bigEnd().getVect(); - Box fine_temp(crse_ovlp); - fine_temp.refine(lrat); - int tlo = fine_temp.smallEnd()[0]; - int thi = fine_temp.bigEnd()[0]; - int inextra(0); - if(fine_temp.ixType().test(0) == true) { // node type - inextra = 1; - } - Real *tempSpace = new Real[thi-tlo+1+inextra]; - FORT_PCINTERP(fine.dataPtr(0),ARLIM(fine.loVect()),ARLIM(fine.hiVect()), - fblo,fbhi, lrat,fine.nComp(), - crse.dataPtr(),ARLIM(crse.loVect()),ARLIM(crse.hiVect()), - cblo,cbhi, tempSpace,tlo,thi); - - delete [] tempSpace; - } -#endif -} - - -// --------------------------------------------------------------- -FArrayBox *AmrData::ReadGrid(std::istream &is, int numVar) { - long i, gstep; - Real time; - static int gridCount(0); - Box gbox; - int glev; - - int gid(gridCount); - ++gridCount; - - is >> gbox >> glev; - VSHOWVAL(verbose, gbox) - VSHOWVAL(verbose, glev) - - is >> gstep >> time; - VSHOWVAL(verbose, gstep) - VSHOWVAL(verbose, time) - - for(i = 0; i < BL_SPACEDIM; ++i) { - Real xlo, xhi; - is >> xlo >> xhi; // unused - if(verbose) { - cout << "xlo xhi [" << i << "] = " << xlo << " " << xhi << endl; - } - } - while (is.get() != '\n') { - ; // do nothing - } - - FArrayBox *fabPtr = new FArrayBox(gbox, numVar); - int whileTrap(0); - int ivar(0); - // optimize this for numVar == newdat.nComp() - while(ivar < numVar) { - //FArrayBox tempfab(is); - FArrayBox tempfab; - tempfab.readFrom(is); - fabPtr->copy(tempfab, 0, ivar, tempfab.nComp()); - ivar += tempfab.nComp(); - if(++whileTrap > 256) { // an arbitrarily large number - cerr << "Error in GridPlot: whileTrap caught loop." << endl; - exit(-4); - } - } - - if(verbose) { - cout << "Constructing Grid, lev = " << glev << " id = " << gid; - cout << " box = " << gbox << endl; - } - return fabPtr; -} -// --------------------------------------------------------------- -// --------------------------------------------------------------- diff --git a/AmrPicture.H b/AmrPicture.H index 5128f42..80f3abd 100644 --- a/AmrPicture.H +++ b/AmrPicture.H @@ -1,8 +1,3 @@ - -// -// $Id: AmrPicture.H,v 1.45 2007-08-28 00:35:24 vince Exp $ -// - // --------------------------------------------------------------- // AmrPicture.H // --------------------------------------------------------------- @@ -11,13 +6,13 @@ #include -#include "REAL.H" -#include "Box.H" -#include "AmrvisConstants.H" -#include "GlobalUtilities.H" -#include "GridPicture.H" -#include "Array.H" -#include "FArrayBox.H" +#include +#include +#include +#include +#include +#include +#include #include using std::string; @@ -72,7 +67,7 @@ class AmrPicture { void ToggleShowSubCut(); void DrawDatasetPoint(int hplot, int vplot, int size); void UnDrawDatasetPoint(); - void Sweep(AnimDirection direction); + void Sweep(Amrvis::AnimDirection direction); void SetHVLine(int scale); void SetHLine(int hl) { hLine = hl; } void SetVLine(int vl) { vLine = vl; } @@ -90,7 +85,7 @@ class AmrPicture { void SetFrameSpeed(int toThis) { frameSpeed = toThis; } Window PictureWindow() { return pictureWindow; } void SetCartGridSmoothing(bool tf) { bCartGridSmoothing = tf; } - void APChangeContour(ContourType prevCType); + void APChangeContour(Amrvis::ContourType prevCType); void GetGridBoxes(Array< Array > &gb, const int minlev, const int maxlev); @@ -112,7 +107,7 @@ class AmrPicture { Array frameBuffer; bool framesMade; int frameSpeed; - AnimDirection sweepDirection; + Amrvis::AnimDirection sweepDirection; XtIntervalId pendingTimeOut; Palette *palPtr; Array sliceFab; @@ -138,7 +133,7 @@ class AmrPicture { void SetSlice(int view, int here); void CoarsenSliceBox(); void ShowFrameImage(int iSlice); - void CreateFrames(AnimDirection direction); + void CreateFrames(Amrvis::AnimDirection direction); void AmrPictureInit(); void DrawBoxes(Array< Array > &gp, Drawable &drawable); void DrawTerrBoxes(int level, bool bIsWindow, bool bIsPixmap); diff --git a/AmrPicture.cpp b/AmrPicture.cpp index f5fbbcb..b56a2dd 100644 --- a/AmrPicture.cpp +++ b/AmrPicture.cpp @@ -1,20 +1,15 @@ - -// -// $Id: AmrPicture.cpp,v 1.95 2011-01-13 18:56:40 vince Exp $ -// - // --------------------------------------------------------------- // AmrPicture.cpp // --------------------------------------------------------------- #include -#include "AmrPicture.H" -#include "PltApp.H" -#include "PltAppState.H" -#include "Palette.H" -#include "DataServices.H" -#include "ProjectionPicture.H" +#include +#include +#include +#include +#include +#include using std::cout; using std::cerr; @@ -25,7 +20,7 @@ using std::min; #include #ifdef BL_USE_ARRAYVIEW -#include "ArrayView.H" +#include #endif @@ -37,22 +32,22 @@ static bool vecIsMom[] = { false, false, false, false, true, true, true, true }; // --------------------------------------------------------------------- -bool DrawRaster(ContourType cType) { - return (cType == RASTERONLY || cType == RASTERCONTOURS || cType == VECTORS); +bool DrawRaster(Amrvis::ContourType cType) { + return (cType == Amrvis::RASTERONLY || cType == Amrvis::RASTERCONTOURS || cType == Amrvis::VECTORS); } // --------------------------------------------------------------------- -bool DrawContours(ContourType cType) { - return (cType == RASTERCONTOURS || cType == COLORCONTOURS || cType == BWCONTOURS); +bool DrawContours(Amrvis::ContourType cType) { + return (cType == Amrvis::RASTERCONTOURS || cType == Amrvis::COLORCONTOURS || cType == Amrvis::BWCONTOURS); } // --------------------------------------------------------------------- -static bool UsingFileRange(const MinMaxRangeType rt) { - return(rt == FILEGLOBALMINMAX || - rt == FILESUBREGIONMINMAX || - rt == FILEUSERMINMAX); +static bool UsingFileRange(const Amrvis::MinMaxRangeType rt) { + return(rt == Amrvis::FILEGLOBALMINMAX || + rt == Amrvis::FILESUBREGIONMINMAX || + rt == Amrvis::FILEUSERMINMAX); } @@ -65,7 +60,7 @@ AmrPicture::AmrPicture(GraphicsAttributes *gaptr, pltAppPtr(pltappptr), pltAppStatePtr(pltappstateptr), dataServicesPtr(dataservicesptr), - myView(XY), + myView(Amrvis::XY), bCartGridSmoothing(bcartgridsmoothing), isSubDomain(false) { @@ -97,8 +92,8 @@ AmrPicture::AmrPicture(GraphicsAttributes *gaptr, dataSizeV.resize(numberOfLevels); dataSize.resize(numberOfLevels); for(ilev = 0; ilev <= maxAllowableLevel; ++ilev) { - dataSizeH[ilev] = subDomain[ilev].length(XDIR); - dataSizeV[ilev] = subDomain[ilev].length(YDIR); + dataSizeH[ilev] = subDomain[ilev].length(Amrvis::XDIR); + dataSizeV[ilev] = subDomain[ilev].length(Amrvis::YDIR); dataSize[ilev] = dataSizeH[ilev] * dataSizeV[ilev]; // for a picture (slice). } @@ -107,30 +102,30 @@ AmrPicture::AmrPicture(GraphicsAttributes *gaptr, int coarsenCRR = AVGlobals::CRRBetweenLevels(maxAllowableLevel, pltAppStatePtr->FinestLevel(), amrData.RefRatio()); - int tempSliceV = AVGlobals::GetInitialPlanes()[XDIR]; // at finest lev - int tempSliceH = AVGlobals::GetInitialPlanes()[YDIR]; // at finest lev + int tempSliceV = AVGlobals::GetInitialPlanes()[Amrvis::XDIR]; // at finest lev + int tempSliceH = AVGlobals::GetInitialPlanes()[Amrvis::YDIR]; // at finest lev tempSliceV /= coarsenCRR; tempSliceH /= coarsenCRR; - tempSliceH = subDomain[maxAllowableLevel].bigEnd(YDIR) - tempSliceH; + tempSliceH = subDomain[maxAllowableLevel].bigEnd(Amrvis::YDIR) - tempSliceH; vLine = max(min(tempSliceV, - subDomain[maxAllowableLevel].bigEnd(XDIR)), - subDomain[maxAllowableLevel].smallEnd(XDIR)); + subDomain[maxAllowableLevel].bigEnd(Amrvis::XDIR)), + subDomain[maxAllowableLevel].smallEnd(Amrvis::XDIR)); hLine = max(min(tempSliceH, - subDomain[maxAllowableLevel].bigEnd(YDIR)), - subDomain[maxAllowableLevel].smallEnd(YDIR)); + subDomain[maxAllowableLevel].bigEnd(Amrvis::YDIR)), + subDomain[maxAllowableLevel].smallEnd(Amrvis::YDIR)); vLine *= pltAppStatePtr->CurrentScale(); hLine *= pltAppStatePtr->CurrentScale(); subcutY = hLine; subcut2ndY = hLine; - int tempSlice = AVGlobals::GetInitialPlanes()[YZ - myView]; // at finest lev + int tempSlice = AVGlobals::GetInitialPlanes()[Amrvis::YZ - myView]; // at finest lev tempSlice /= coarsenCRR; slice = max(min(tempSlice, - subDomain[maxAllowableLevel].bigEnd(YZ-myView)), - subDomain[maxAllowableLevel].smallEnd(YZ-myView)); + subDomain[maxAllowableLevel].bigEnd(Amrvis::YZ-myView)), + subDomain[maxAllowableLevel].smallEnd(Amrvis::YZ-myView)); } else { vLine = 0; - hLine = subDomain[maxAllowableLevel].bigEnd(YDIR) * + hLine = subDomain[maxAllowableLevel].bigEnd(Amrvis::YDIR) * pltAppStatePtr->CurrentScale(); subcutY = hLine; subcut2ndY = hLine; @@ -138,7 +133,7 @@ AmrPicture::AmrPicture(GraphicsAttributes *gaptr, #if (BL_SPACEDIM == 2) slice = 0; #else - slice = subDomain[maxAllowableLevel].smallEnd(YZ-myView); + slice = subDomain[maxAllowableLevel].smallEnd(Amrvis::YZ-myView); #endif } sliceBox.resize(numberOfLevels); @@ -195,33 +190,33 @@ AmrPicture::AmrPicture(int view, GraphicsAttributes *gaptr, dataSizeV.resize(numberOfLevels); dataSize.resize(numberOfLevels); for(ilev = 0; ilev <= maxAllowableLevel; ++ilev) { - if(myView==XZ) { - dataSizeH[ilev] = subDomain[ilev].length(XDIR); - dataSizeV[ilev] = subDomain[ilev].length(ZDIR); - } else if(myView==YZ) { - dataSizeH[ilev] = subDomain[ilev].length(YDIR); - dataSizeV[ilev] = subDomain[ilev].length(ZDIR); + if(myView==Amrvis::XZ) { + dataSizeH[ilev] = subDomain[ilev].length(Amrvis::XDIR); + dataSizeV[ilev] = subDomain[ilev].length(Amrvis::ZDIR); + } else if(myView==Amrvis::YZ) { + dataSizeH[ilev] = subDomain[ilev].length(Amrvis::YDIR); + dataSizeV[ilev] = subDomain[ilev].length(Amrvis::ZDIR); } else { - dataSizeH[ilev] = subDomain[ilev].length(XDIR); - dataSizeV[ilev] = subDomain[ilev].length(YDIR); + dataSizeH[ilev] = subDomain[ilev].length(Amrvis::XDIR); + dataSizeV[ilev] = subDomain[ilev].length(Amrvis::YDIR); } dataSize[ilev] = dataSizeH[ilev] * dataSizeV[ilev]; } # if (BL_SPACEDIM == 3) - if(myView==XY) { - hLine = (subDomain[maxAllowableLevel].bigEnd(YDIR) - - subDomain[maxAllowableLevel].smallEnd(YDIR)) * + if(myView==Amrvis::XY) { + hLine = (subDomain[maxAllowableLevel].bigEnd(Amrvis::YDIR) - + subDomain[maxAllowableLevel].smallEnd(Amrvis::YDIR)) * pltAppStatePtr->CurrentScale(); vLine = 0; - } else if(myView==XZ) { - hLine = (subDomain[maxAllowableLevel].bigEnd(ZDIR) - - subDomain[maxAllowableLevel].smallEnd(ZDIR)) * + } else if(myView==Amrvis::XZ) { + hLine = (subDomain[maxAllowableLevel].bigEnd(Amrvis::ZDIR) - + subDomain[maxAllowableLevel].smallEnd(Amrvis::ZDIR)) * pltAppStatePtr->CurrentScale(); vLine = 0; } else { - hLine = (subDomain[maxAllowableLevel].bigEnd(ZDIR) - - subDomain[maxAllowableLevel].smallEnd(ZDIR)) * + hLine = (subDomain[maxAllowableLevel].bigEnd(Amrvis::ZDIR) - + subDomain[maxAllowableLevel].smallEnd(Amrvis::ZDIR)) * pltAppStatePtr->CurrentScale(); vLine = 0; } @@ -233,61 +228,61 @@ AmrPicture::AmrPicture(int view, GraphicsAttributes *gaptr, pltAppStatePtr->MaxDrawnLevel(), amrData.RefRatio()); slice = max(min(tempSlice, - subDomain[maxAllowableLevel].bigEnd(YZ-myView)), - subDomain[maxAllowableLevel].smallEnd(YZ-myView)); + subDomain[maxAllowableLevel].bigEnd(Amrvis::YZ-myView)), + subDomain[maxAllowableLevel].smallEnd(Amrvis::YZ-myView)); } else { if(AVGlobals::GivenInitialPlanes()) { - int tempSlice = AVGlobals::GetInitialPlanes()[YZ - myView]; // finest lev + int tempSlice = AVGlobals::GetInitialPlanes()[Amrvis::YZ - myView]; // finest lev int coarsenCRR = AVGlobals::CRRBetweenLevels(maxAllowableLevel, pltAppStatePtr->FinestLevel(), amrData.RefRatio()); tempSlice /= coarsenCRR; slice = max(min(tempSlice, - subDomain[maxAllowableLevel].bigEnd(YZ-myView)), - subDomain[maxAllowableLevel].smallEnd(YZ-myView)); + subDomain[maxAllowableLevel].bigEnd(Amrvis::YZ-myView)), + subDomain[maxAllowableLevel].smallEnd(Amrvis::YZ-myView)); int tempSliceV, tempSliceH; - if(myView==XY) { - tempSliceV = AVGlobals::GetInitialPlanes()[XDIR]; // at finest lev - tempSliceH = AVGlobals::GetInitialPlanes()[YDIR]; // at finest lev + if(myView==Amrvis::XY) { + tempSliceV = AVGlobals::GetInitialPlanes()[Amrvis::XDIR]; // at finest lev + tempSliceH = AVGlobals::GetInitialPlanes()[Amrvis::YDIR]; // at finest lev tempSliceV /= coarsenCRR; tempSliceH /= coarsenCRR; - tempSliceH = subDomain[maxAllowableLevel].bigEnd(YDIR) - tempSliceH; + tempSliceH = subDomain[maxAllowableLevel].bigEnd(Amrvis::YDIR) - tempSliceH; vLine = max(min(tempSliceV, - subDomain[maxAllowableLevel].bigEnd(XDIR)), - subDomain[maxAllowableLevel].smallEnd(XDIR)); + subDomain[maxAllowableLevel].bigEnd(Amrvis::XDIR)), + subDomain[maxAllowableLevel].smallEnd(Amrvis::XDIR)); hLine = max(min(tempSliceH, - subDomain[maxAllowableLevel].bigEnd(YDIR)), - subDomain[maxAllowableLevel].smallEnd(YDIR)); - } else if(myView==XZ) { - tempSliceV = AVGlobals::GetInitialPlanes()[XDIR]; // at finest lev - tempSliceH = AVGlobals::GetInitialPlanes()[ZDIR]; // at finest lev + subDomain[maxAllowableLevel].bigEnd(Amrvis::YDIR)), + subDomain[maxAllowableLevel].smallEnd(Amrvis::YDIR)); + } else if(myView==Amrvis::XZ) { + tempSliceV = AVGlobals::GetInitialPlanes()[Amrvis::XDIR]; // at finest lev + tempSliceH = AVGlobals::GetInitialPlanes()[Amrvis::ZDIR]; // at finest lev tempSliceV /= coarsenCRR; tempSliceH /= coarsenCRR; - tempSliceH = subDomain[maxAllowableLevel].bigEnd(ZDIR) - tempSliceH; + tempSliceH = subDomain[maxAllowableLevel].bigEnd(Amrvis::ZDIR) - tempSliceH; vLine = max(min(tempSliceV, - subDomain[maxAllowableLevel].bigEnd(XDIR)), - subDomain[maxAllowableLevel].smallEnd(XDIR)); + subDomain[maxAllowableLevel].bigEnd(Amrvis::XDIR)), + subDomain[maxAllowableLevel].smallEnd(Amrvis::XDIR)); hLine = max(min(tempSliceH, - subDomain[maxAllowableLevel].bigEnd(ZDIR)), - subDomain[maxAllowableLevel].smallEnd(ZDIR)); + subDomain[maxAllowableLevel].bigEnd(Amrvis::ZDIR)), + subDomain[maxAllowableLevel].smallEnd(Amrvis::ZDIR)); } else { - tempSliceV = AVGlobals::GetInitialPlanes()[YDIR]; // at finest lev - tempSliceH = AVGlobals::GetInitialPlanes()[ZDIR]; // at finest lev + tempSliceV = AVGlobals::GetInitialPlanes()[Amrvis::YDIR]; // at finest lev + tempSliceH = AVGlobals::GetInitialPlanes()[Amrvis::ZDIR]; // at finest lev tempSliceV /= coarsenCRR; tempSliceH /= coarsenCRR; - tempSliceH = subDomain[maxAllowableLevel].bigEnd(ZDIR) - tempSliceH; + tempSliceH = subDomain[maxAllowableLevel].bigEnd(Amrvis::ZDIR) - tempSliceH; vLine = max(min(tempSliceV, - subDomain[maxAllowableLevel].bigEnd(YDIR)), - subDomain[maxAllowableLevel].smallEnd(YDIR)); + subDomain[maxAllowableLevel].bigEnd(Amrvis::YDIR)), + subDomain[maxAllowableLevel].smallEnd(Amrvis::YDIR)); hLine = max(min(tempSliceH, - subDomain[maxAllowableLevel].bigEnd(ZDIR)), - subDomain[maxAllowableLevel].smallEnd(ZDIR)); + subDomain[maxAllowableLevel].bigEnd(Amrvis::ZDIR)), + subDomain[maxAllowableLevel].smallEnd(Amrvis::ZDIR)); } vLine *= pltAppStatePtr->CurrentScale(); hLine *= pltAppStatePtr->CurrentScale(); } else { - slice = subDomain[maxAllowableLevel].smallEnd(YZ - myView); + slice = subDomain[maxAllowableLevel].smallEnd(Amrvis::YZ - myView); } } @@ -312,16 +307,16 @@ void AmrPicture::AmrPictureInit() { int iLevel; int minDrawnLevel(pltAppStatePtr->MinDrawnLevel()); int maxAllowableLevel(pltAppStatePtr->MaxAllowableLevel()); - if(myView==XZ) { - sliceBox[maxAllowableLevel].setSmall(YDIR, slice); - sliceBox[maxAllowableLevel].setBig(YDIR, slice); - } else if(myView==YZ) { - sliceBox[maxAllowableLevel].setSmall(XDIR, slice); - sliceBox[maxAllowableLevel].setBig(XDIR, slice); - } else { // XY + if(myView==Amrvis::XZ) { + sliceBox[maxAllowableLevel].setSmall(Amrvis::YDIR, slice); + sliceBox[maxAllowableLevel].setBig(Amrvis::YDIR, slice); + } else if(myView==Amrvis::YZ) { + sliceBox[maxAllowableLevel].setSmall(Amrvis::XDIR, slice); + sliceBox[maxAllowableLevel].setBig(Amrvis::XDIR, slice); + } else { // Amrvis::XY # if (BL_SPACEDIM == 3) - sliceBox[maxAllowableLevel].setSmall(ZDIR, slice); - sliceBox[maxAllowableLevel].setBig(ZDIR, slice); + sliceBox[maxAllowableLevel].setSmall(Amrvis::ZDIR, slice); + sliceBox[maxAllowableLevel].setBig(Amrvis::ZDIR, slice); # endif } @@ -378,10 +373,10 @@ void AmrPicture::AmrPictureInit() { subcutX = 0; subcut2ndX = 0; framesMade = false; - if(myView == XZ) { + if(myView == Amrvis::XZ) { hColor = AVGlobals::MaxPaletteIndex(); vColor = 65; - } else if(myView == YZ) { + } else if(myView == Amrvis::YZ) { hColor = AVGlobals::MaxPaletteIndex(); vColor = 220; } else { @@ -413,21 +408,21 @@ void AmrPicture::AmrPictureInit() { void AmrPicture::SetHVLine(int scale) { int maxDrawnLevel(pltAppStatePtr->MaxDrawnLevel()); int first(0); - for(int i(0); i <= YZ; ++i) { + for(int i(0); i <= Amrvis::YZ; ++i) { if(i == myView) { // do nothing } else { if(first == 0) { hLine = imageSizeV-1 - ((pltAppPtr->GetAmrPicturePtr(i)->GetSlice() - - pltAppPtr->GetAmrPicturePtr(YZ - i)-> - GetSubDomain()[maxDrawnLevel].smallEnd(YZ - i)) * + pltAppPtr->GetAmrPicturePtr(Amrvis::YZ - i)-> + GetSubDomain()[maxDrawnLevel].smallEnd(Amrvis::YZ - i)) * scale); first = 1; } else { vLine = ( pltAppPtr->GetAmrPicturePtr(i)->GetSlice() - - pltAppPtr->GetAmrPicturePtr(YZ - i)-> - GetSubDomain()[maxDrawnLevel].smallEnd(YZ - i)) * + pltAppPtr->GetAmrPicturePtr(Amrvis::YZ - i)-> + GetSubDomain()[maxDrawnLevel].smallEnd(Amrvis::YZ - i)) * scale; } } @@ -464,7 +459,7 @@ void AmrPicture::SetSlice(int view, int here) { int lev; int minDrawnLevel(pltAppStatePtr->MinDrawnLevel()); int maxAllowableLevel(pltAppStatePtr->MaxAllowableLevel()); - sliceDir = YZ - view; + sliceDir = Amrvis::YZ - view; const AmrData &amrData = dataServicesPtr->AmrDataRef(); BL_ASSERT(amrData.RefRatio().size() > 0); @@ -539,10 +534,10 @@ void AmrPicture::SetSlice(int view, int here) { if(sliceBox[lev].intersects(temp)) { temp &= sliceBox[lev]; Box sliceDataBox(temp); - temp.shift(XDIR, -subDomain[lev].smallEnd(XDIR)); - temp.shift(YDIR, -subDomain[lev].smallEnd(YDIR)); + temp.shift(Amrvis::XDIR, -subDomain[lev].smallEnd(Amrvis::XDIR)); + temp.shift(Amrvis::YDIR, -subDomain[lev].smallEnd(Amrvis::YDIR)); #if (BL_SPACEDIM == 3) - temp.shift(ZDIR, -subDomain[lev].smallEnd(ZDIR)); + temp.shift(Amrvis::ZDIR, -subDomain[lev].smallEnd(Amrvis::ZDIR)); #endif gpArray[lev][gridNumber].GridPictureInit(lev, AVGlobals::CRRBetweenLevels(lev, maxAllowableLevel, @@ -557,8 +552,8 @@ void AmrPicture::SetSlice(int view, int here) { // --------------------------------------------------------------------- -void AmrPicture::APChangeContour(ContourType prevCType) { - ContourType cType(pltAppStatePtr->GetContourType()); +void AmrPicture::APChangeContour(Amrvis::ContourType prevCType) { + Amrvis::ContourType cType(pltAppStatePtr->GetContourType()); Real minUsing, maxUsing; pltAppStatePtr->GetMinMax(minUsing, maxUsing); int minDrawnLevel(pltAppStatePtr->MinDrawnLevel()); @@ -765,10 +760,10 @@ void AmrPicture::APDraw(int fromLevel, int toLevel) { XPutImage(display, pixMap, xgc, xImageArray[toLevel], 0, 0, 0, 0, imageSizeH, imageSizeV); - ContourType cType(pltAppStatePtr->GetContourType()); + Amrvis::ContourType cType(pltAppStatePtr->GetContourType()); if(DrawContours(cType)) { DrawContour(sliceFab, display, pixMap, xgc); - } else if(cType == VECTORS) { + } else if(cType == Amrvis::VECTORS) { DrawVectorField(display, pixMap, xgc); } @@ -1668,14 +1663,14 @@ void AmrPicture::CoarsenSliceBox() { // --------------------------------------------------------------------- -void AmrPicture::CreateFrames(AnimDirection direction) { - char buffer[BUFSIZ]; +void AmrPicture::CreateFrames(Amrvis::AnimDirection direction) { + char buffer[Amrvis::BUFSIZE]; bool cancelled(false); int islice(0), i, j, lev, gridNumber; Array intersectGrids; int maxLevelWithGridsHere; int posneg(1); - if(direction == ANIMNEGDIR) { + if(direction == Amrvis::ANIMNEGDIR) { posneg = -1; } const AmrData &amrData = dataServicesPtr->AmrDataRef(); @@ -1725,9 +1720,9 @@ void AmrPicture::CreateFrames(AnimDirection direction) { if(interBox[lev].intersects(temp)) { temp &= interBox[lev]; Box sliceDataBox(temp); - temp.shift(XDIR, -subDomain[lev].smallEnd(XDIR)); - temp.shift(YDIR, -subDomain[lev].smallEnd(YDIR)); - temp.shift(ZDIR, -subDomain[lev].smallEnd(ZDIR)); + temp.shift(Amrvis::XDIR, -subDomain[lev].smallEnd(Amrvis::XDIR)); + temp.shift(Amrvis::YDIR, -subDomain[lev].smallEnd(Amrvis::YDIR)); + temp.shift(Amrvis::ZDIR, -subDomain[lev].smallEnd(Amrvis::ZDIR)); frameGrids[islice][lev][gridNumber].GridPictureInit(lev, AVGlobals::CRRBetweenLevels(lev, maxAllowableLevel, amrData.RefRatio()), @@ -1782,7 +1777,7 @@ void AmrPicture::CreateFrames(AnimDirection direction) { #if (BL_SPACEDIM == 3) if( ! framesMade) { - pltAppPtr->GetProjPicturePtr()->ChangeSlice(YZ-sliceDir, islice+start); + pltAppPtr->GetProjPicturePtr()->ChangeSlice(Amrvis::YZ-sliceDir, islice+start); pltAppPtr->GetProjPicturePtr()->MakeSlices(); XClearWindow(XtDisplay(pltAppPtr->GetWTransDA()), XtWindow(pltAppPtr->GetWTransDA())); @@ -1811,33 +1806,33 @@ void AmrPicture::CreateFrames(AnimDirection direction) { sprintf(buffer, "Cancelled.\n"); PrintMessage(buffer); APChangeSlice(start+islice); - AmrPicture *apXY = pltAppPtr->GetAmrPicturePtr(XY); - AmrPicture *apXZ = pltAppPtr->GetAmrPicturePtr(XZ); - AmrPicture *apYZ = pltAppPtr->GetAmrPicturePtr(YZ); - if(sliceDir == XDIR) { - apXY->SetVLine((slice - subDomain[maxAllowableLevel].smallEnd(XDIR)) * + AmrPicture *apXY = pltAppPtr->GetAmrPicturePtr(Amrvis::XY); + AmrPicture *apXZ = pltAppPtr->GetAmrPicturePtr(Amrvis::XZ); + AmrPicture *apYZ = pltAppPtr->GetAmrPicturePtr(Amrvis::YZ); + if(sliceDir == Amrvis::XDIR) { + apXY->SetVLine((slice - subDomain[maxAllowableLevel].smallEnd(Amrvis::XDIR)) * pltAppStatePtr->CurrentScale()); apXY->DoExposePicture(); - apXZ->SetVLine((slice - subDomain[maxAllowableLevel].smallEnd(XDIR)) * + apXZ->SetVLine((slice - subDomain[maxAllowableLevel].smallEnd(Amrvis::XDIR)) * pltAppStatePtr->CurrentScale()); apXZ->DoExposePicture(); } - if(sliceDir == YDIR) { + if(sliceDir == Amrvis::YDIR) { apXY->SetHLine(apXY->ImageSizeV()-1 - (slice - - subDomain[maxAllowableLevel].smallEnd(YDIR)) * + subDomain[maxAllowableLevel].smallEnd(Amrvis::YDIR)) * pltAppStatePtr->CurrentScale()); apXY->DoExposePicture(); - apYZ->SetVLine((slice - subDomain[maxAllowableLevel].smallEnd(YDIR)) * + apYZ->SetVLine((slice - subDomain[maxAllowableLevel].smallEnd(Amrvis::YDIR)) * pltAppStatePtr->CurrentScale()); apYZ->DoExposePicture(); } - if(sliceDir == ZDIR) { + if(sliceDir == Amrvis::ZDIR) { apYZ->SetHLine(apYZ->ImageSizeV()-1 - (slice - - subDomain[maxAllowableLevel].smallEnd(ZDIR)) * + subDomain[maxAllowableLevel].smallEnd(Amrvis::ZDIR)) * pltAppStatePtr->CurrentScale()); apYZ->DoExposePicture(); apXZ->SetHLine(apXZ->ImageSizeV()-1 - (slice - - subDomain[maxAllowableLevel].smallEnd(ZDIR)) * + subDomain[maxAllowableLevel].smallEnd(Amrvis::ZDIR)) * pltAppStatePtr->CurrentScale()); apXZ->DoExposePicture(); } @@ -1890,7 +1885,7 @@ void AmrPicture::CBContourSweep(XtPointer client_data, XtIntervalId *) { // --------------------------------------------------------------------- void AmrPicture::DoFrameUpdate() { int maxAllowableLevel(pltAppStatePtr->MaxAllowableLevel()); - if(sweepDirection == ANIMPOSDIR) { + if(sweepDirection == Amrvis::ANIMPOSDIR) { if(slice < subDomain[maxAllowableLevel].bigEnd(sliceDir)) { ++slice; } else { @@ -1915,7 +1910,7 @@ void AmrPicture::DoFrameUpdate() { // --------------------------------------------------------------------- void AmrPicture::DoContourSweep() { - if(sweepDirection == ANIMPOSDIR) { + if(sweepDirection == Amrvis::ANIMPOSDIR) { pltAppPtr->DoForwardStep(myView); } else { pltAppPtr->DoBackStep(myView); @@ -1937,7 +1932,7 @@ void AmrPicture::DoStop() { // --------------------------------------------------------------------- -void AmrPicture::Sweep(AnimDirection direction) { +void AmrPicture::Sweep(Amrvis::AnimDirection direction) { if(pendingTimeOut != 0) { DoStop(); } @@ -1969,9 +1964,9 @@ void AmrPicture::DrawSlice(int iSlice) { // --------------------------------------------------------------------- void AmrPicture::ShowFrameImage(int iSlice) { - AmrPicture *apXY = pltAppPtr->GetAmrPicturePtr(XY); - AmrPicture *apXZ = pltAppPtr->GetAmrPicturePtr(XZ); - AmrPicture *apYZ = pltAppPtr->GetAmrPicturePtr(YZ); + AmrPicture *apXY = pltAppPtr->GetAmrPicturePtr(Amrvis::XY); + AmrPicture *apXZ = pltAppPtr->GetAmrPicturePtr(Amrvis::XZ); + AmrPicture *apYZ = pltAppPtr->GetAmrPicturePtr(Amrvis::YZ); int iRelSlice(iSlice); XPutImage(display, pictureWindow, xgc, @@ -1994,19 +1989,19 @@ void AmrPicture::ShowFrameImage(int iSlice) { XSetForeground(display, xgc, palPtr->makePixel(vColor-30)); XDrawLine(display, pictureWindow, xgc, vLine+1, 0, vLine+1, imageSizeV); - if(sliceDir == XDIR) { + if(sliceDir == Amrvis::XDIR) { apXY->SetVLine(iRelSlice * pltAppStatePtr->CurrentScale()); apXY->DoExposePicture(); apXZ->SetVLine(iRelSlice * pltAppStatePtr->CurrentScale()); apXZ->DoExposePicture(); } - if(sliceDir == YDIR) { + if(sliceDir == Amrvis::YDIR) { apXY->SetHLine(apXY->ImageSizeV() - 1 - iRelSlice * pltAppStatePtr->CurrentScale()); apXY->DoExposePicture(); apYZ->SetVLine(iRelSlice * pltAppStatePtr->CurrentScale()); apYZ->DoExposePicture(); } - if(sliceDir == ZDIR) { + if(sliceDir == Amrvis::ZDIR) { apYZ->SetHLine(apYZ->ImageSizeV() - 1 - iRelSlice * pltAppStatePtr->CurrentScale()); apYZ->DoExposePicture(); apXZ->SetHLine(apXZ->ImageSizeV() - 1 - iRelSlice * pltAppStatePtr->CurrentScale()); @@ -2044,15 +2039,15 @@ void AmrPicture::DrawContour(Array passedSliceFab, v_off = 1.0; } int hDir, vDir; - if(myView == XZ) { - hDir = XDIR; - vDir = ZDIR; - } else if(myView == YZ) { - hDir = YDIR; - vDir = ZDIR; + if(myView == Amrvis::XZ) { + hDir = Amrvis::XDIR; + vDir = Amrvis::ZDIR; + } else if(myView == Amrvis::YZ) { + hDir = Amrvis::YDIR; + vDir = Amrvis::ZDIR; } else { - hDir = XDIR; - vDir = YDIR; + hDir = Amrvis::XDIR; + vDir = Amrvis::YDIR; } const AmrData &amrData = dataServicesPtr->AmrDataRef(); @@ -2143,7 +2138,7 @@ SHOWVAL(maxDrawnLevel); for(int icont(0); icont < pltAppStatePtr->GetNumContours(); ++icont) { Real frac((Real) icont / pltAppStatePtr->GetNumContours()); Real value(v_off + frac * (v_max - v_min)); - if(pltAppStatePtr->GetContourType() == COLORCONTOURS) { + if(pltAppStatePtr->GetContourType() == Amrvis::COLORCONTOURS) { if(value > maxUsing) { // clip drawColor = paletteEnd; } else if(value < minUsing) { // clip @@ -2363,7 +2358,7 @@ VectorDerived AmrPicture::FindVectorDerived(Array &aVectorDeriveNames) { if(dataServicesPtr->CanDerive(densityName)) { return enMomentum; } else { - if(myView == XY) { + if(myView == Amrvis::XY) { cerr << "*** Error: found momentums but not " << densityName << endl; } return enNoneFound; @@ -2374,7 +2369,7 @@ VectorDerived AmrPicture::FindVectorDerived(Array &aVectorDeriveNames) { } } else { aVectorDeriveNames = AVGlobals::UserVectorNames(); - if(myView == XY) { + if(myView == Amrvis::XY) { cerr << "*** Error: cannot find components: "; for(int ii(0); ii < BL_SPACEDIM; ++ii) { cerr << aVectorDeriveNames[ii] << " "; @@ -2392,7 +2387,7 @@ VectorDerived AmrPicture::FindVectorDerived(Array &aVectorDeriveNames) { if(dataServicesPtr->CanDerive(densityName)) { return enMomentum; } else { - if(myView == XY) { + if(myView == Amrvis::XY) { cerr << "*** Error: found momentums but not " << densityName << endl; } return enNoneFound; @@ -2412,15 +2407,15 @@ void AmrPicture::DrawVectorField(Display *pDisplay, Drawable &pDrawable, const GC &pGC) { int hDir(-1), vDir(-1); - if(myView == XY) { - hDir = XDIR; - vDir = YDIR; - } else if(myView == XZ) { - hDir = XDIR; - vDir = ZDIR; - } else if(myView == YZ) { - hDir = YDIR; - vDir = ZDIR; + if(myView == Amrvis::XY) { + hDir = Amrvis::XDIR; + vDir = Amrvis::YDIR; + } else if(myView == Amrvis::XZ) { + hDir = Amrvis::XDIR; + vDir = Amrvis::ZDIR; + } else if(myView == Amrvis::YZ) { + hDir = Amrvis::YDIR; + vDir = Amrvis::ZDIR; } else { BL_ASSERT(false); } @@ -2442,7 +2437,7 @@ void AmrPicture::DrawVectorField(Display *pDisplay, whichVectorDerived = FindVectorDerived(choice); if(whichVectorDerived == enNoneFound) { - if(myView == XY) { + if(myView == Amrvis::XY) { cerr << "Could not find suitable quantities to create velocity vectors." << endl; } diff --git a/AmrVisTool.cpp b/AmrVisTool.cpp index 5a3e939..7f0f41c 100644 --- a/AmrVisTool.cpp +++ b/AmrVisTool.cpp @@ -1,13 +1,8 @@ - -// -// $Id: AmrVisTool.cpp,v 1.78 2011-01-13 18:56:40 vince Exp $ -// - // --------------------------------------------------------------- // AmrVisTool.cpp // --------------------------------------------------------------- -#include "ParallelDescriptor.H" +#include #include #if ! (defined(BL_OSF1) || defined(BL_Darwin) || defined(BL_AIX) || defined(BL_IRIX64) || defined(BL_CYGWIN_NT) || defined(BL_CRAYX1)) @@ -22,21 +17,21 @@ // BoxLib has index member functions, Xos might define it (LessTif). #undef index -#include "MessageArea.H" -#include "GraphicsAttributes.H" -#include "Palette.H" -#include "PltApp.H" -#include "GlobalUtilities.H" -#include "ParmParse.H" -#include "DataServices.H" -#include "PltAppState.H" +#include +#include +#include +#include +#include +#include +#include +#include #ifdef BL_VOLUMERENDER -#include "VolRender.H" +#include #endif #ifdef BL_USE_ARRAYVIEW -#include "ArrayView.H" +#include #endif using std::cout; @@ -62,7 +57,7 @@ Widget wTopLevel, wTextOut, wDialog; Widget wMainWindow, wMenuBar; Arg args[32]; cMessageArea messageText; -char buffer[BUFSIZ]; +char buffer[Amrvis::BUFSIZE]; XmString sDirectory = XmStringCreateSimple("none"); list pltAppList; @@ -135,7 +130,7 @@ int main(int argc, char *argv[]) { if(AVGlobals::IsAnimation()) { BL_ASSERT(AVGlobals::GetFileCount() > 0); bool bAmrDataOk(true); - FileType fileType = AVGlobals::GetDefaultFileType(); + Amrvis::FileType fileType = AVGlobals::GetDefaultFileType(); BL_ASSERT(fileType != INVALIDTYPE); Array dspArray(AVGlobals::GetFileCount()); for(int nPlots = 0; nPlots < AVGlobals::GetFileCount(); ++nPlots) { @@ -191,7 +186,7 @@ int main(int argc, char *argv[]) { } } else { // loop through the command line list of plot files - FileType fileType = AVGlobals::GetDefaultFileType(); + Amrvis::FileType fileType = AVGlobals::GetDefaultFileType(); BL_ASSERT(fileType != INVALIDTYPE); Array dspArray(AVGlobals::GetFileCount()); @@ -353,7 +348,7 @@ void BatchFunctions() { if(ParallelDescriptor::IOProcessor()) { cout << "FileName = " << comlineFileName << endl; } - FileType fileType = AVGlobals::GetDefaultFileType(); + Amrvis::FileType fileType = AVGlobals::GetDefaultFileType(); BL_ASSERT(fileType != INVALIDTYPE); DataServices dataServices(comlineFileName, fileType); @@ -515,7 +510,7 @@ void QuitAll() { // --------------------------------------------------------------- void CBFileMenu(Widget, XtPointer client_data, XtPointer) { - Arg args[MAXARGS]; + Arg args[Amrvis::MAXARGS]; int i = 0; unsigned long item = (unsigned long) client_data; @@ -523,11 +518,11 @@ void CBFileMenu(Widget, XtPointer client_data, XtPointer) { QuitAll(); } else if(item == OPENITEM) { i = 0; - FileType fileType(AVGlobals::GetDefaultFileType()); + Amrvis::FileType fileType(AVGlobals::GetDefaultFileType()); XmString sMask; - if(fileType == FAB) { + if(fileType == Amrvis::FAB) { sMask = XmStringCreateSimple("*.fab"); - } else if(fileType == MULTIFAB) { + } else if(fileType == Amrvis::MULTIFAB) { sMask = XmStringCreateSimple("*_H"); } else { sMask = XmStringCreateSimple("plt*"); @@ -564,8 +559,8 @@ void CBOpenPltFile(Widget w, XtPointer, XtPointer call_data) { cerr << "CBOpenPltFile : system error" << endl; return; } - FileType fileType(AVGlobals::GetDefaultFileType()); - if(fileType == MULTIFAB) { + Amrvis::FileType fileType(AVGlobals::GetDefaultFileType()); + if(fileType == Amrvis::MULTIFAB) { // delete the _H from the filename if it is there const char *uH = "_H"; char *fm2 = filename + (strlen(filename) - 2); @@ -573,7 +568,7 @@ void CBOpenPltFile(Widget w, XtPointer, XtPointer call_data) { filename[strlen(filename) - 2] = '\0'; } } - char path[BUFSIZ]; + char path[Amrvis::BUFSIZE]; strcpy(path, filename); int pathPos(strlen(path) - 1); while(pathPos > -1 && path[pathPos] != '/') { diff --git a/AmrvisConstants.H b/AmrvisConstants.H deleted file mode 100644 index 7d9dcba..0000000 --- a/AmrvisConstants.H +++ /dev/null @@ -1,88 +0,0 @@ - -// -// $Id: AmrvisConstants.H,v 1.20 2004-04-20 00:44:11 vince Exp $ -// - -// --------------------------------------------------------------- -// AmrvisConstants.H -// --------------------------------------------------------------- -#ifndef _AMRVISCONSTANTS_H -#define _AMRVISCONSTANTS_H - -#include -#include - -#include - -#ifndef BUFSIZ -# define BUFSIZ 8192 -#endif - -const int LINELENGTH = 160; -const int MAXARGS = 50; - -#if (BL_SPACEDIM == 2) -const int NPLANES = 1; -#endif -#if (BL_SPACEDIM == 3) -const int NPLANES = 3; -#endif - -const int XDIR = 0; -const int YDIR = 1; -const int ZDIR = 2; - -const int XY = 0; -const int XZ = 1; -const int YZ = 2; - -const int XYPLANE = 0; -const int XZPLANE = 1; -const int YZPLANE = 2; - -const int ZPLANE = 0; -const int YPLANE = 1; -const int XPLANE = 2; -const int ISOVIEW = 3; -const int PALETTEVIEW = 4; - - -const int WOFFSET = 4; - -enum AnimDirection { ANIMPOSDIR = 0, ANIMNEGDIR }; - -// these are for PltApps wRangeRadioButton -enum MinMaxRangeTypeForButtons { - BGLOBALMINMAX = 0, - BSUBREGIONMINMAX = 1, - BUSERMINMAX = 2, - BNUMBEROFMINMAX = 3, - BINVALIDMINMAX -}; - -enum MinMaxRangeType { - GLOBALMINMAX = 0, - SUBREGIONMINMAX = 1, - USERMINMAX = 2, - FILEGLOBALMINMAX = 3, - FILESUBREGIONMINMAX = 4, - FILEUSERMINMAX = 5, - NUMBEROFMINMAX = 6, - INVALIDMINMAX -}; - -enum ContourType { - RASTERONLY = 0, - RASTERCONTOURS = 1, - COLORCONTOURS = 2, - BWCONTOURS = 3, - VECTORS = 4, - NCONTOPTIONS = 5, - INVALIDCONTOURTYPE -}; - -enum FileType { INVALIDTYPE = 0, FAB, MULTIFAB, NEWPLT, NUMDBPTYPES }; - -#endif -// ------------------------------------------------------------------- -// ------------------------------------------------------------------- diff --git a/ArrayView.H b/ArrayView.H index e1512d4..91c73e6 100644 --- a/ArrayView.H +++ b/ArrayView.H @@ -1,20 +1,15 @@ - -// -// $Id: ArrayView.H,v 1.3 2000-10-02 20:53:07 lijewski Exp $ -// - // --------------------------------------------------------------- // ArrayView.H // --------------------------------------------------------------- #ifndef _ARRAYVIEW_H_ #define _ARRAYVIEW_H_ -#include "FArrayBox.H" -#include "MultiFab.H" +#include +#include #ifdef BL_ARRAYVIEW_TAGBOX -#include "TagBox.H" +#include #endif -#include "DatasetClient.H" +#include // ------------------------------------------------------------- void NeverCalled() { diff --git a/DataServices.H b/DataServices.H deleted file mode 100644 index b731ccd..0000000 --- a/DataServices.H +++ /dev/null @@ -1,148 +0,0 @@ - -// -// $Id: DataServices.H,v 1.21 2009-08-18 22:23:47 vince Exp $ -// - -// --------------------------------------------------------------- -// DataServices.H -// --------------------------------------------------------------- -#ifndef _DATASERVICES_H_ -#define _DATASERVICES_H_ - -#include "Array.H" -#include "AmrData.H" - -#include -#include -using std::string; - -class XYPlotDataList; - - -class DataServices { - - public: - - enum DSRequestType { - InvalidRequestType = 0, - ExitRequest, - NewRequest, - DeleteRequest, - FillVarOneFab, - FillVarArrayOfFabs, - FillVarMultiFab, - WriteFabOneVar, - WriteFabAllVars, - DumpSlicePlaneOneVar, - DumpSlicePlaneAllVars, - DumpSliceBoxOneVar, - DumpSliceBoxAllVars, - MinMaxRequest, - PointValueRequest, -#ifndef BL_NOLINEVALUES - LineValuesRequest -#endif - }; - - DataServices(const string &filename, const FileType &filetype); - DataServices(); - void Init(const string &filename, const FileType &filetype); - ~DataServices(); - - static void SetBatchMode(); - static void Dispatch(DSRequestType requestType, DataServices *ds, ...); - - static void SetFabOutSize(int iSize); - - private: - - // Dispatchable functions - - // FillVarOneFab - bool FillVar(FArrayBox *destFab, const Box &destBox, - int finestFillLevel, const string &varname, - int procWithFab); - - // FillVarArrayOfFabs - //bool FillVar(Array &destFabs, const Array &destBoxes, - //int finestFillLevel, const string &varname, - //int procWithFab); - - // FillVarMultiFab - bool FillVar(MultiFab &destMultiFab, int finestFillLevel, - const string &varname); - - // WriteFabOneVar: write a single variable to one fab - bool WriteFab(const string &fabfilename, const Box ®ion, int lev, - const string &varname); - - // WriteFabAllVars: write all vars in one fab - bool WriteFab(const string &fabfilename, const Box ®ion, int lev); - - // DumpSlicePlaneOneVar - bool DumpSlice(int slicedir, int slicenum, const string &varname); - - // DumpSlicePlaneAllVars - bool DumpSlice(int slicedir, int slicenum); - - // DumpSliceBoxOneVar - bool DumpSlice(const Box &slicebox, const string &varname); - - // DumpSliceBoxAllVars - bool DumpSlice(const Box &slicebox); - - // MinMaxRequest - bool MinMax(const Box &onBox, const string &derived, int level, - Real &dataMin, Real &dataMax, bool &minMaxValid); - - // PointValueRequest - void PointValue(int pointBoxArraySize, Box *pointBoxArray, - const string ¤tDerived, - int coarsestLevelToSearch, int finestLevelToSearch, - int &intersectedLevel, Box &intersectedGrid, - Real &dataPointValue, bool &bPointIsValid); - -#ifndef BL_NOLINEVALUES - // LineValuesRequest - void LineValues(int lineBoxArraySize, Box *lineBoxArray, int whichDir, - const string ¤tDerived, - int coarsestLevelToSearch, int finestLevelToSearch, - XYPlotDataList *dataList, bool &lineIsValid); -#endif - - public: - - // information functions - const string &GetFileName() const { return fileName; } - FileType GetFileType() const { return fileType; } - bool CanDerive(const string &name) const; - bool CanDerive(const Array &names) const; - int NumDeriveFunc() const; - void ListDeriveFunc(std::ostream &os) const; - const Array &PlotVarNames() const { return amrData.PlotVarNames(); } - AmrData &AmrDataRef() { return amrData; } - bool AmrDataOk() { return bAmrDataOk; } - void SetWriteToLevel(const int iwtlev) { iWriteToLevel = iwtlev; } - - // other functions - int GetNumberOfUsers() const { return numberOfUsers; } - void IncrementNumberOfUsers() { ++numberOfUsers; } - void DecrementNumberOfUsers() { --numberOfUsers; } - - - private: - string fileName; - FileType fileType; - AmrData amrData; - bool bAmrDataOk; - int dsArrayIndex; - int numberOfUsers; - int iWriteToLevel; - - static Array dsArray; - static int dsArrayIndexCounter; - static int dsFabOutSize; - static bool dsBatchMode; -}; - -#endif diff --git a/DataServices.cpp b/DataServices.cpp deleted file mode 100644 index 97509f5..0000000 --- a/DataServices.cpp +++ /dev/null @@ -1,1185 +0,0 @@ - -// -// $Id: DataServices.cpp,v 1.46 2011-01-13 18:56:40 vince Exp $ -// - -// --------------------------------------------------------------- -// DataServices.cpp -// --------------------------------------------------------------- -#include - -#include "AmrvisConstants.H" -#include "DataServices.H" -#include "ParallelDescriptor.H" - -#ifndef BL_NOLINEVALUES -# include "XYPlotDataList.H" -#endif - -#include -#include -#include -using std::ios; -using std::ofstream; -using std::cout; -using std::cerr; -using std::endl; -using std::min; -using std::max; - -Array DataServices::dsArray; -int DataServices::dsArrayIndexCounter = 0; -int DataServices::dsFabOutSize = 0; -bool DataServices::dsBatchMode = false; - - -// --------------------------------------------------------------- -namespace ParallelDescriptor { - template <> void Bcast (Box *b, size_t n, int root) { - const int n3SDim(n * 3 * BL_SPACEDIM); - - Array tmp(n3SDim); - - int cnt(0); - - for(int j(0); j < n; ++j) { - for(int i(0); i < BL_SPACEDIM; ++i) { - tmp[cnt++] = b[j].smallEnd(i); - } - - for(int i(0); i < BL_SPACEDIM; ++i) { - tmp[cnt++] = b[j].bigEnd(i); - } - - IntVect indx = b[j].type(); - - for(int i(0); i < BL_SPACEDIM; ++i) { - tmp[cnt++] = indx[i]; - } - } - - BL_ASSERT(n3SDim == cnt); - - ParallelDescriptor::Bcast(&tmp[0], n3SDim, root); - - cnt = 0; - - for(int j(0); j < n; ++j) { - IntVect sm(&tmp[cnt]); - cnt += BL_SPACEDIM; - IntVect bg(&tmp[cnt]); - cnt += BL_SPACEDIM; - IntVect id(&tmp[cnt]); - cnt += BL_SPACEDIM; - - b[j] = Box(sm, bg, id); - } - } -} // end namespace - - -// --------------------------------------------------------------- -DataServices::DataServices(const string &filename, const FileType &filetype) - : fileName(filename), fileType(filetype), bAmrDataOk(false), - iWriteToLevel(-1) -{ - numberOfUsers = 0; // the user must do all incrementing and decrementing - - bAmrDataOk = amrData.ReadData(fileName, fileType); - - if(bAmrDataOk) { - dsArrayIndex = DataServices::dsArrayIndexCounter; - ++DataServices::dsArrayIndexCounter; - DataServices::dsArray.resize(DataServices::dsArrayIndexCounter); - DataServices::dsArray[dsArrayIndex] = this; - } -} - - -// --------------------------------------------------------------- -DataServices::DataServices() { - // must call init - bAmrDataOk = false; - iWriteToLevel = -1; -} - - -// --------------------------------------------------------------- -void DataServices::Init(const string &filename, const FileType &filetype) { - fileName = filename; - fileType = filetype; - bAmrDataOk = false; - iWriteToLevel = -1; - - numberOfUsers = 0; // the user must do all incrementing and decrementing -} - - -// --------------------------------------------------------------- -DataServices::~DataServices() { - BL_ASSERT(numberOfUsers == 0); - DataServices::dsArray[dsArrayIndex] = NULL; -} - - -// --------------------------------------------------------------- -void DataServices::SetBatchMode() { - dsBatchMode = true; -} - - -// --------------------------------------------------------------- -void DataServices::SetFabOutSize(int iSize) { - if(iSize == 1 || iSize == 8 || iSize == 32) { - dsFabOutSize = iSize; - } else { - cerr << "Warning: DataServices::SetFabOutSize: size must be 1, 8 or 32 only." - << " Defaulting to native." << endl; - dsFabOutSize = 0; - } -} - - -// --------------------------------------------------------------- -void DataServices::Dispatch(DSRequestType requestType, DataServices *ds, ...) { - bool bContinueLooping(true); - va_list ap; - int whichDSIndex; - int ioProcNumber(ParallelDescriptor::IOProcessorNumber()); - - while(bContinueLooping) { - if(ParallelDescriptor::IOProcessor() || dsBatchMode) { - bContinueLooping = false; - } - - ParallelDescriptor::Barrier(); // nonioprocessors wait here - - { - int tmp = requestType; - ParallelDescriptor::Bcast(&tmp, 1, 0); - requestType = static_cast(tmp); - } - - // handle new request - if(requestType == NewRequest) { - // broadcast the fileName and fileType to nonioprocessors - char *fileNameCharPtr; - int fileNameLength(-1), fileNameLengthPadded(-1); - FileType newFileType(INVALIDTYPE); - - if(ParallelDescriptor::IOProcessor()) { - fileNameLength = ds->fileName.length(); - newFileType = ds->fileType; - } - - ParallelDescriptor::Bcast(&fileNameLength, 1, 0); - - { - int tmp = newFileType; - ParallelDescriptor::Bcast(&tmp, 1, 0); - newFileType = static_cast(tmp); - } - - fileNameLengthPadded = fileNameLength + 1; // for the null - fileNameLengthPadded += fileNameLengthPadded % 8; // for alignment on the t3e - fileNameCharPtr = new char[fileNameLengthPadded]; - if(ParallelDescriptor::IOProcessor()) { - strcpy(fileNameCharPtr, ds->fileName.c_str()); - } - - ParallelDescriptor::Bcast(fileNameCharPtr, fileNameLengthPadded,0); - - string newFileName(fileNameCharPtr); - delete [] fileNameCharPtr; - - // make a new DataServices for nonioprocessors - if( ! ParallelDescriptor::IOProcessor()) { - ds = new DataServices(); - ds->Init(newFileName, newFileType); - } - - ds->bAmrDataOk = ds->amrData.ReadData(ds->fileName, ds->fileType); - - if(ds->bAmrDataOk) { - ds->dsArrayIndex = DataServices::dsArrayIndexCounter; - ++DataServices::dsArrayIndexCounter; - DataServices::dsArray.resize(DataServices::dsArrayIndexCounter); - DataServices::dsArray[ds->dsArrayIndex] = ds; - } else { - cerr << "*** Error in DataServices NewRequest: Bad AmrData." << endl; - continue; // go to the top of the while loop - } - - continue; // go to the top of the while loop - } // end NewRequest - - - // handle exit request - if(requestType == ExitRequest) { // cleanup memory - for(int i(0); i < dsArray.size(); ++i) { - if(DataServices::dsArray[i] != NULL) { - BL_ASSERT(DataServices::dsArray[i]->numberOfUsers == 0); - delete DataServices::dsArray[i]; - } - } - ParallelDescriptor::EndParallel(); - exit(0); - } // end ExitRequest - - if(ParallelDescriptor::IOProcessor()) { - va_start(ap, ds); - whichDSIndex = ds->dsArrayIndex; - } - - ParallelDescriptor::Bcast(&whichDSIndex, 1, 0); - if( ! ParallelDescriptor::IOProcessor()) { - ds = DataServices::dsArray[whichDSIndex]; - } - BL_ASSERT(ds != NULL); - - switch(requestType) { - case DeleteRequest: - { - bool bDeleteDS(false); - BL_ASSERT(DataServices::dsArray[whichDSIndex]->numberOfUsers >= 0); - if(ParallelDescriptor::IOProcessor()) { - bDeleteDS = (DataServices::dsArray[whichDSIndex]->numberOfUsers == 0); - } - - { - int tmp = bDeleteDS; - ParallelDescriptor::Bcast(&tmp, 1, 0); - bDeleteDS = tmp; - } - if(bDeleteDS) { - delete DataServices::dsArray[whichDSIndex]; - } - } - break; - - case FillVarOneFab: - { - FArrayBox *destFab = NULL; - Box destBox; - int fineFillLevel; - string derivedTemp; - char *derivedCharPtr; - int derivedLength, derivedLengthPadded; - - if(ParallelDescriptor::IOProcessor()) { - destFab = (FArrayBox *) va_arg(ap, void *); - const Box *boxRef = (const Box *) va_arg(ap, void *); - destBox = *boxRef; - fineFillLevel = va_arg(ap, int); - const string *derivedRef = (const string *) va_arg(ap, void *); - derivedTemp = *derivedRef; - derivedLength = derivedTemp.length(); - } - - ParallelDescriptor::Bcast(&destBox, 1, 0); - ParallelDescriptor::Bcast(&fineFillLevel, 1, 0); - ParallelDescriptor::Bcast(&derivedLength, 1, 0); - - derivedLengthPadded = derivedLength + 1; - derivedLengthPadded += derivedLengthPadded % 8; - derivedCharPtr = new char[derivedLengthPadded]; - if(ParallelDescriptor::IOProcessor()) { - strcpy(derivedCharPtr, derivedTemp.c_str()); - } - - ParallelDescriptor::Bcast(derivedCharPtr, derivedLengthPadded, 0); - - string derived(derivedCharPtr); - delete [] derivedCharPtr; - - ds->FillVar(destFab, destBox, fineFillLevel, derived, ioProcNumber); - - } - break; - - case FillVarArrayOfFabs: - { - BoxLib::Abort("FillVarArrayOfFabs not implemented yet."); - } - break; - - case FillVarMultiFab: - { - BoxLib::Abort("FillVarMultiFab not implemented yet."); - } - break; - - case WriteFabOneVar: - { - // interface: (requestType, dsPtr, fabFileName, box, maxLevel, derivedName) - Box destBox; - int fineFillLevel; - string fabFileName; - string derivedTemp; - char *derivedCharPtr; - int derivedLength, derivedLengthPadded; - - if(ParallelDescriptor::IOProcessor()) { - const string *fabFileNameRef = (const string *) va_arg(ap, void *); - fabFileName = *fabFileNameRef; - const Box *boxRef = (const Box *) va_arg(ap, void *); - destBox = *boxRef; - fineFillLevel = va_arg(ap, int); - const string *derivedRef = (const string *) va_arg(ap, void *); - derivedTemp = *derivedRef; - derivedLength = derivedTemp.length(); - } - - ParallelDescriptor::Bcast(&destBox, 1, 0); - ParallelDescriptor::Bcast(&fineFillLevel, 1, 0); - ParallelDescriptor::Bcast(&derivedLength, 1, 0); - - derivedLengthPadded = derivedLength + 1; - derivedLengthPadded += derivedLengthPadded % 8; - derivedCharPtr = new char[derivedLengthPadded]; - if(ParallelDescriptor::IOProcessor()) { - strcpy(derivedCharPtr, derivedTemp.c_str()); - } - - ParallelDescriptor::Bcast(derivedCharPtr, derivedLengthPadded, 0); - - string derived(derivedCharPtr); - delete [] derivedCharPtr; - - ds->WriteFab(fabFileName, destBox, fineFillLevel, derived); - - } - break; - - case WriteFabAllVars: - { - // interface: (requestType, dsPtr, fabFileName, box, maxLevel) - Box destBox; - int fineFillLevel; - string fabFileName; - - if(ParallelDescriptor::IOProcessor()) { - const string *fabFileNameRef = (const string *) va_arg(ap, void *); - fabFileName = *fabFileNameRef; - const Box *boxRef = (const Box *) va_arg(ap, void *); - destBox = *boxRef; - fineFillLevel = va_arg(ap, int); - } - - ParallelDescriptor::Bcast(&destBox, 1, 0); - ParallelDescriptor::Bcast(&fineFillLevel, 1, 0); - - ds->WriteFab(fabFileName, destBox, fineFillLevel); - } - break; - - case DumpSlicePlaneOneVar: - { - int slicedir; - int slicenum; - string derivedTemp; - char *derivedCharPtr; - int derivedLength, derivedLengthPadded; - if(ParallelDescriptor::IOProcessor()) { - slicedir = va_arg(ap, int); - slicenum = va_arg(ap, int); - const string *derivedRef = (const string *) va_arg(ap, void *); - derivedTemp = *derivedRef; - derivedLength = derivedTemp.length(); - } - - ParallelDescriptor::Bcast(&slicedir, 1, 0); - ParallelDescriptor::Bcast(&slicenum, 1, 0); - ParallelDescriptor::Bcast(&derivedLength, 1, 0); - - derivedLengthPadded = derivedLength + 1; - derivedLengthPadded += derivedLengthPadded % 8; - derivedCharPtr = new char[derivedLengthPadded]; - if(ParallelDescriptor::IOProcessor()) { - strcpy(derivedCharPtr, derivedTemp.c_str()); - } - ParallelDescriptor::Bcast(derivedCharPtr, derivedLengthPadded, 0); - - string derived(derivedCharPtr); - delete [] derivedCharPtr; - - ds->DumpSlice(slicedir, slicenum, derived); - - } - break; - - case DumpSlicePlaneAllVars: - { - int slicedir; - int slicenum; - if(ParallelDescriptor::IOProcessor()) { - slicedir = va_arg(ap, int); - slicenum = va_arg(ap, int); - } - ParallelDescriptor::Bcast(&slicedir, 1, 0); - ParallelDescriptor::Bcast(&slicenum, 1, 0); - - ds->DumpSlice(slicedir, slicenum); - - } - break; - - case DumpSliceBoxOneVar: - { - Box box; - string derivedTemp; - char *derivedCharPtr; - int derivedLength, derivedLengthPadded; - if(ParallelDescriptor::IOProcessor()) { - const Box *boxRef = (const Box *) va_arg(ap, void *); - box = *boxRef; - const string *derivedRef = (const string *) va_arg(ap, void *); - derivedTemp = *derivedRef; - derivedLength = derivedTemp.length(); - } - - ParallelDescriptor::Bcast(&box, 1, 0); - ParallelDescriptor::Bcast(&derivedLength, 1, 0); - - derivedLengthPadded = derivedLength + 1; - derivedLengthPadded += derivedLengthPadded % 8; - derivedCharPtr = new char[derivedLengthPadded]; - if(ParallelDescriptor::IOProcessor()) { - strcpy(derivedCharPtr, derivedTemp.c_str()); - } - ParallelDescriptor::Bcast(derivedCharPtr, derivedLengthPadded, 0); - - string derived(derivedCharPtr); - delete [] derivedCharPtr; - - ds->DumpSlice(box, derived); - } - break; - - case DumpSliceBoxAllVars: - { - Box box; - if(ParallelDescriptor::IOProcessor()) { - const Box *boxRef = (const Box *) va_arg(ap, void *); - box = *boxRef; - } - - ParallelDescriptor::Bcast(&box, 1, 0); - - ds->DumpSlice(box); - - } - break; - - case MinMaxRequest: - { - Box box; - string derivedTemp; - char *derivedCharPtr; - int level; - int derivedLength, derivedLengthPadded; - Real dataMin, dataMax; - bool minMaxValid; - if(ParallelDescriptor::IOProcessor()) { - const Box *boxRef = (const Box *) va_arg(ap, void *); - const string *derivedRef = (const string *) va_arg(ap, void *); - level = va_arg(ap, int); - box = *boxRef; - derivedTemp = *derivedRef; - derivedLength = derivedTemp.length(); - } - - ParallelDescriptor::Bcast(&box, 1, 0); - ParallelDescriptor::Bcast(&derivedLength, 1, 0); - ParallelDescriptor::Bcast(&level, 1, 0); - - derivedLengthPadded = derivedLength + 1; - derivedLengthPadded += derivedLengthPadded % 8; - derivedCharPtr = new char[derivedLengthPadded]; - if(ParallelDescriptor::IOProcessor()) { - strcpy(derivedCharPtr, derivedTemp.c_str()); - } - ParallelDescriptor::Bcast(derivedCharPtr, derivedLengthPadded, 0); - - string derived(derivedCharPtr); - delete [] derivedCharPtr; - - ds->MinMax(box, derived, level, dataMin, dataMax, minMaxValid); - - // set the return values - if(ParallelDescriptor::IOProcessor()) { - Real *dataMinRef = va_arg(ap, Real *); - Real *dataMaxRef = va_arg(ap, Real *); - bool *minMaxValidRef = va_arg(ap, bool *); - *dataMinRef = dataMin; - *dataMaxRef = dataMax; - *minMaxValidRef = minMaxValid; - } - } - break; - - case PointValueRequest: - { - // interface: (requestType, dsPtr, - // pointBoxArraySize, pointBoxArray *, - // derivedName, - // coarsestLevelToSearch, finestLevelToSearch, - // intersectedLevel, /* return this value */ - // intersectedBox, /* return this value */ - // dataPointValue, /* return this value */ - // bPointIsValid) /* return this value */ - - // need to broadcast pointBoxArraySize, pointBoxArray, derivedName, - // coarsestLevelToSearch, and finestLevelToSearch - - int pointBoxArraySize; - Box *pointBoxArrayPtr(NULL), *pointBoxArrayTempPtr(NULL); - int coarsestLevelToSearch, finestLevelToSearch; - - string derivedTemp; - char *derivedCharPtr(NULL); - int derivedLength, derivedLengthPadded; - - if(ParallelDescriptor::IOProcessor()) { - pointBoxArraySize = va_arg(ap, int); - pointBoxArrayTempPtr = (Box *) va_arg(ap, void *); - const string *derivedRef = (const string *) va_arg(ap, void *); - derivedTemp = *derivedRef; - derivedLength = derivedTemp.length(); - coarsestLevelToSearch = va_arg(ap, int); - finestLevelToSearch = va_arg(ap, int); - } - - ParallelDescriptor::Bcast(&pointBoxArraySize, 1, 0); - ParallelDescriptor::Bcast(&derivedLength, 1, 0); - ParallelDescriptor::Bcast(&coarsestLevelToSearch, 1, 0); - ParallelDescriptor::Bcast(&finestLevelToSearch, 1, 0); - - pointBoxArrayPtr = new Box[pointBoxArraySize]; - - derivedLengthPadded = derivedLength + 1; - derivedLengthPadded += derivedLengthPadded % 8; - derivedCharPtr = new char[derivedLengthPadded]; - if(ParallelDescriptor::IOProcessor()) { - strcpy(derivedCharPtr, derivedTemp.c_str()); - for(int iBox = 0; iBox < pointBoxArraySize; ++iBox) { - pointBoxArrayPtr[iBox] = pointBoxArrayTempPtr[iBox]; - } - } - ParallelDescriptor::Bcast(derivedCharPtr, derivedLengthPadded, 0); - ParallelDescriptor::Bcast(pointBoxArrayPtr, pointBoxArraySize, 0); - - string derived(derivedCharPtr); - delete [] derivedCharPtr; - - // return values - int intersectedLevel; - Box intersectedBox; - Real dataPointValue; - bool bPointIsValid; - - ds->PointValue(pointBoxArraySize, pointBoxArrayPtr, - derived, - coarsestLevelToSearch, - finestLevelToSearch, - intersectedLevel, - intersectedBox, - dataPointValue, - bPointIsValid); - - // set the return values - if(ParallelDescriptor::IOProcessor()) { - int *intersectedLevelRef = va_arg(ap, int *); - Box *intersectedBoxRef = (Box *) va_arg(ap, void *); - Real *dataPointValueRef = va_arg(ap, Real *); - bool *bPointIsValidRef = va_arg(ap, bool *); - *intersectedLevelRef = intersectedLevel; - *intersectedBoxRef = intersectedBox; - *dataPointValueRef = dataPointValue; - *bPointIsValidRef = bPointIsValid; - } - - // dont need to broadcast the return values--only the IOProcessor uses them - - delete [] pointBoxArrayPtr; - } - break; - -#ifndef BL_NOLINEVALUES - case LineValuesRequest: - { - // interface: (requestType, dsPtr, - // lineBoxArraySize, lineBoxArray *, - // derivedName, - // coarsestLevelToSearch, finestLevelToSearch, - // dataList, /* modify this value */ - // bLineIsValid) /* return this value */ - - // need to broadcast lineBoxArraySize, lineBoxArray, derivedName, - // coarsestLevelToSearch, and finestLevelToSearch - - int lineBoxArraySize; - Box *lineBoxArrayPtr(NULL), *lineBoxArrayTempPtr(NULL); - int coarsestLevelToSearch(-1), finestLevelToSearch(-1), whichDir(-1); - XYPlotDataList *dataList(NULL); - - string derivedTemp; - char *derivedCharPtr; - int derivedLength, derivedLengthPadded; - - if(ParallelDescriptor::IOProcessor()) { - lineBoxArraySize = va_arg(ap, int); - lineBoxArrayTempPtr = (Box *) va_arg(ap, void *); - whichDir = va_arg(ap, int); - const string *derivedRef = (const string *) va_arg(ap, void *); - derivedTemp = *derivedRef; - derivedLength = derivedTemp.length(); - coarsestLevelToSearch = va_arg(ap, int); - finestLevelToSearch = va_arg(ap, int); - dataList = (XYPlotDataList *) va_arg(ap, void *); - } - - ParallelDescriptor::Bcast(&lineBoxArraySize, 1, 0); - ParallelDescriptor::Bcast(&derivedLength, 1, 0); - ParallelDescriptor::Bcast(&coarsestLevelToSearch, 1, 0); - ParallelDescriptor::Bcast(&finestLevelToSearch, 1, 0); - - lineBoxArrayPtr = new Box[lineBoxArraySize]; - - derivedLengthPadded = derivedLength + 1; - derivedLengthPadded += derivedLengthPadded % 8; - derivedCharPtr = new char[derivedLengthPadded]; - if(ParallelDescriptor::IOProcessor()) { - strcpy(derivedCharPtr, derivedTemp.c_str()); - for(int iBox(0); iBox < lineBoxArraySize; ++iBox) { - lineBoxArrayPtr[iBox] = lineBoxArrayTempPtr[iBox]; - } - } - ParallelDescriptor::Bcast(derivedCharPtr, derivedLengthPadded, 0); - ParallelDescriptor::Bcast(lineBoxArrayPtr, lineBoxArraySize, 0); - - string derived(derivedCharPtr); - delete [] derivedCharPtr; - - // return values - bool bLineIsValid; - - ds->LineValues(lineBoxArraySize, lineBoxArrayPtr, whichDir, - derived, - coarsestLevelToSearch, - finestLevelToSearch, - dataList, - bLineIsValid); - - // set the return values - if(ParallelDescriptor::IOProcessor()) { - bool *bLineIsValidRef = va_arg(ap, bool *); - *bLineIsValidRef = bLineIsValid; - } - // dont need to broadcast the return values--only the IOProcessor uses them - - delete [] lineBoxArrayPtr; - - } -#endif - - } // end switch - - if(ParallelDescriptor::IOProcessor()) { - va_end(ap); - } - - } // end while(bContinueLooping) - - return; -} // end Dispatch - - -// --------------------------------------------------------------- -bool DataServices::DumpSlice(int slicedir, int slicenum, - const string &varname) -{ - if( ! bAmrDataOk) { - return false; - } - - int iWTL(-2); - if(iWriteToLevel == -1) { - iWTL = amrData.FinestLevel(); - } else { - iWTL = iWriteToLevel; - } - - string sliceFile = fileName; - sliceFile += "."; - sliceFile += varname; - sliceFile += "."; - if(slicedir == XDIR) { - sliceFile += "xslice"; - } else if(slicedir == YDIR) { - sliceFile += "yslice"; - } else if(slicedir == ZDIR) { - sliceFile += "zslice"; - } else { - cerr << "bad slicedir = " << slicedir << endl; - return false; - } - sliceFile += "."; - char slicechar[64]; - sprintf(slicechar, "%d.Level_%d", slicenum, iWTL); - sliceFile += slicechar; - sliceFile += ".fab"; - cout << "sliceFile = " << sliceFile << endl; - - Box sliceBox(amrData.ProbDomain()[iWTL]); - - if(BL_SPACEDIM == 2 && slicedir == ZDIR) { - // use probDomain for the sliceBox - } else { - // make the box one cell thick in the slice direction - sliceBox.setSmall(slicedir, slicenum); - sliceBox.setBig(slicedir, slicenum); - } - - cout << "sliceBox = " << sliceBox << endl; - cout << endl; - if( ! amrData.ProbDomain()[iWTL].contains(sliceBox)) { - cerr << "Error: sliceBox = " << sliceBox << " slicedir " << slicenum - << " on Level " << iWTL - << " not in probDomain: " << amrData.ProbDomain()[iWTL] - << endl; - return false; - } - bool bWF = WriteFab(sliceFile, sliceBox, iWTL, varname); - return bWF; -} - - -// --------------------------------------------------------------- -bool DataServices::DumpSlice(int slicedir, int slicenum) { // dump all vars - if( ! bAmrDataOk) { - return false; - } - - int iWTL(-2); - if(iWriteToLevel == -1) { - iWTL = amrData.FinestLevel(); - } else { - iWTL = iWriteToLevel; - } - - string sliceFile = fileName; - sliceFile += "."; - if(slicedir == XDIR) { - sliceFile += "xslice"; - } else if(slicedir == YDIR) { - sliceFile += "yslice"; - } else if(slicedir == ZDIR) { - sliceFile += "zslice"; - } else { - cerr << "bad slicedir = " << slicedir << endl; - return false; - } - sliceFile += "."; - char slicechar[64]; - sprintf(slicechar, "%d.Level_%d", slicenum, iWTL); - sliceFile += slicechar; - sliceFile += ".fab"; - cout << "sliceFile = " << sliceFile << endl; - - Box sliceBox(amrData.ProbDomain()[iWTL]); - - if(BL_SPACEDIM == 2 && slicedir == ZDIR) { - // use probDomain for the sliceBox - } else { - // make the box one cell thick in the slice direction - sliceBox.setSmall(slicedir, slicenum); - sliceBox.setBig(slicedir, slicenum); - } - - cout << "sliceBox = " << sliceBox << endl; - cout << endl; - if( ! amrData.ProbDomain()[iWTL].contains(sliceBox)) { - cerr << "Error: sliceBox = " << sliceBox << " slicedir " << slicenum - << " on Level " << iWTL - << " not in probDomain: " << amrData.ProbDomain()[iWTL] - << endl; - return false; - } - bool bWF = WriteFab(sliceFile, sliceBox, iWTL); - return bWF; -} - - -// --------------------------------------------------------------- -bool DataServices::DumpSlice(const Box &b, const string &varname) { - if( ! bAmrDataOk) { - return false; - } - - int iWTL(-2); - if(iWriteToLevel == -1) { - iWTL = amrData.FinestLevel(); - } else { - iWTL = iWriteToLevel; - } - - string sliceFile = fileName; - sliceFile += "."; - sliceFile += varname; - sliceFile += "."; - char slicechar[256]; -# if (BL_SPACEDIM == 2) - sprintf(slicechar, "%d_%d__%d_%d.Level_%d", - b.smallEnd(XDIR), b.smallEnd(YDIR), - b.bigEnd(XDIR), b.bigEnd(YDIR), iWTL); -# else - sprintf(slicechar, "%d_%d_%d__%d_%d_%d.Level_%d", - b.smallEnd(XDIR), b.smallEnd(YDIR), b.smallEnd(ZDIR), - b.bigEnd(XDIR), b.bigEnd(YDIR), b.bigEnd(ZDIR), iWTL); -#endif - sliceFile += slicechar; - sliceFile += ".fab"; - cout << "sliceFile = " << sliceFile << endl; - cout << "sliceBox = " << b << endl; - cout << endl; - - if( ! amrData.ProbDomain()[iWTL].contains(b)) { - cerr << "Slice box not in probDomain: " - << amrData.ProbDomain()[iWTL] - << " on Level " << iWTL - << endl; - return false; - } - bool bWF = WriteFab(sliceFile, b, iWTL, varname); - return bWF; -} - - -// --------------------------------------------------------------- -bool DataServices::DumpSlice(const Box &b) { // dump all vars - if( ! bAmrDataOk) { - return false; - } - - int iWTL(-2); - if(iWriteToLevel == -1) { - iWTL = amrData.FinestLevel(); - } else { - iWTL = iWriteToLevel; - } - - string sliceFile = fileName; - sliceFile += "."; - char slicechar[256]; -# if (BL_SPACEDIM == 2) - sprintf(slicechar, "%d_%d__%d_%d.Level_%d", - b.smallEnd(XDIR), b.smallEnd(YDIR), - b.bigEnd(XDIR), b.bigEnd(YDIR), iWTL); -# else - sprintf(slicechar, "%d_%d_%d__%d_%d_%d.Level_%d", - b.smallEnd(XDIR), b.smallEnd(YDIR), b.smallEnd(ZDIR), - b.bigEnd(XDIR), b.bigEnd(YDIR), b.bigEnd(ZDIR), iWTL); -#endif - sliceFile += slicechar; - sliceFile += ".fab"; - cout << "sliceFile = " << sliceFile << endl; - cout << "sliceBox = " << b << endl; - cout << endl; - - if( ! amrData.ProbDomain()[iWTL].contains(b)) { - cerr << "Slice box not in probDomain: " - << amrData.ProbDomain()[iWTL] - << " on Level " << iWTL - << endl; - return false; - } - bool bWF = WriteFab(sliceFile, b, iWTL); - return bWF; -} - - - -// --------------------------------------------------------------- -bool DataServices::FillVar(FArrayBox *destFab, const Box &destBox, - int finestFillLevel, const string &varname, - int procWithFab) -{ - if( ! bAmrDataOk) { - return false; - } - amrData.FillVar(destFab, destBox, finestFillLevel, varname, procWithFab); - - return true; -} // end FillVar - - -// --------------------------------------------------------------- -bool DataServices::FillVar(MultiFab &destMultiFab, int finestFillLevel, - const string &varname) -{ - if( ! bAmrDataOk) { - return false; - } - amrData.FillVar(destMultiFab, finestFillLevel, varname); - - return true; -} // end FillVar - - -// --------------------------------------------------------------- -// -// -// Change this to take an Array (or BoxArray?) and create -// a MultiFab and pass the proc number for the multifabs disributionMapping -// to create the FillVared fabs on separate processors -// -// -bool DataServices::WriteFab(const string &fname, const Box ®ion, int lev, - const string &varname) -{ - if( ! bAmrDataOk) { - return false; - } - FArrayBox data; - if(ParallelDescriptor::IOProcessor()) { - data.resize(region, 1); - } - - Array destFabs(1); - Array destBoxes(1); - destFabs[0] = &data; - destBoxes[0] = region; - amrData.FillVar(destFabs, destBoxes, lev, varname, - ParallelDescriptor::IOProcessorNumber()); - - bool bWF(true); - if(ParallelDescriptor::IOProcessor()) { - FABio::Format oldFabFormat = FArrayBox::getFormat(); - if(dsFabOutSize == 1) { - FArrayBox::setFormat(FABio::FAB_ASCII); - } - if(dsFabOutSize == 8) { - FArrayBox::setFormat(FABio::FAB_8BIT); - } - if(dsFabOutSize == 32) { - FArrayBox::setFormat(FABio::FAB_IEEE_32); - } - - ofstream os; - os.open(fname.c_str(), ios::out); - if(os) { - data.writeOn(os); - os.close(); - } else { - cerr << "*** Error: cannot open file: " << fname << endl; - bWF = false; - } - - FArrayBox::setFormat(oldFabFormat); - } - - return bWF; -} // end WriteFab - - -// --------------------------------------------------------------- -// -// -// Change this to take an Array (or BoxArray?) and create -// a MultiFab and pass the proc number for the multifabs disributionMapping -// to create the FillVared fabs on separate processors -// -// -bool DataServices::WriteFab(const string &fname, const Box ®ion, int lev) { - if( ! bAmrDataOk) { - return false; - } - - // write all fab vars - FArrayBox tempdata; - FArrayBox data; - if(ParallelDescriptor::IOProcessor()) { - tempdata.resize(region, 1); - data.resize(region, amrData.NComp()); - } - for(int ivar = 0; ivar < amrData.NComp(); ++ivar) { - //amrData.FillVar(tempdata, lev, amrData.PlotVarNames()[ivar]); - Array destFabs(1); - Array destBoxes(1); - destFabs[0] = &tempdata; - destBoxes[0] = region; - amrData.FillVar(destFabs, destBoxes, lev, amrData.PlotVarNames()[ivar], - ParallelDescriptor::IOProcessorNumber()); - int srccomp(0); - int destcomp(ivar); - int ncomp(1); - if(ParallelDescriptor::IOProcessor()) { - data.copy(tempdata, srccomp, destcomp, ncomp); - } - amrData.FlushGrids(ivar); - } - - bool bWF(true); - if(ParallelDescriptor::IOProcessor()) { - FABio::Format oldFabFormat = FArrayBox::getFormat(); - if(dsFabOutSize == 1) { - FArrayBox::setFormat(FABio::FAB_ASCII); - } - if(dsFabOutSize == 8) { - FArrayBox::setFormat(FABio::FAB_8BIT); - } - if(dsFabOutSize == 32) { - FArrayBox::setFormat(FABio::FAB_IEEE_32); - } - - ofstream os; - os.open(fname.c_str(), ios::out); - if(os) { - data.writeOn(os); - os.close(); - } else { - cerr << "*** Error: cannot open file: " << fname << endl; - bWF = false; - } - - FArrayBox::setFormat(oldFabFormat); - } - - return bWF; -} // end WriteFab - - -// --------------------------------------------------------------- -bool DataServices::CanDerive(const string &name) const { - if( ! bAmrDataOk) { - return false; - } - return amrData.CanDerive(name); -} - - -// --------------------------------------------------------------- -bool DataServices::CanDerive(const Array &names) const { - if( ! bAmrDataOk) { - return false; - } - return amrData.CanDerive(names); -} - - -// --------------------------------------------------------------- -// output the list of variables that can be derived -void DataServices::ListDeriveFunc(std::ostream &os) const { - if( ! bAmrDataOk) { - return; - } - amrData.ListDeriveFunc(os); -} - - -// --------------------------------------------------------------- -int DataServices::NumDeriveFunc() const { - return amrData.NumDeriveFunc(); -} - - -// --------------------------------------------------------------- -void DataServices::PointValue(int pointBoxArraySize, Box *pointBoxArray, - const string ¤tDerived, - int coarsestLevelToSearch, - int finestLevelToSearch, - int &intersectedLevel, - Box &intersectedGrid, - Real &dataPointValue, - bool &bPointIsValid) -{ - bPointIsValid = false; - if( ! bAmrDataOk) { - return; - } - - intersectedLevel = - amrData.FinestContainingLevel(pointBoxArray[finestLevelToSearch], - finestLevelToSearch); - - if(intersectedLevel < coarsestLevelToSearch) { - return; - } - - Box destBox(pointBoxArray[intersectedLevel]); - if(destBox.numPts() != 1) { - cout << "Error in DS::PointValue:bad destBox: " << destBox << endl; - } - BL_ASSERT(destBox.numPts() == 1); - - const BoxArray &intersectedBA = amrData.boxArray(intersectedLevel); - for(int iGrid = 0; iGrid < intersectedBA.size(); ++iGrid) { - if(destBox.intersects(intersectedBA[iGrid])) { - intersectedGrid = intersectedBA[iGrid]; - break; - } - } - - FArrayBox *destFab = NULL; - if(ParallelDescriptor::IOProcessor()) { - destFab = new FArrayBox(destBox, 1); - } - amrData.FillVar(destFab, destBox, intersectedLevel, currentDerived, - ParallelDescriptor::IOProcessorNumber()); - - if(ParallelDescriptor::IOProcessor()) { - dataPointValue = (destFab->dataPtr())[0]; - delete destFab; - } - bPointIsValid = true; - -} // end PointValue - - -#ifndef BL_NOLINEVALUES -// --------------------------------------------------------------- -void DataServices::LineValues(int lineBoxArraySize, Box *lineBoxArray, int whichDir, - const string ¤tDerived, - int coarsestLevelToSearch, int finestLevelToSearch, - XYPlotDataList *dataList, bool &bLineIsValid) { - bLineIsValid = false; - if( ! bAmrDataOk) { - return; - } - - for(int lev(coarsestLevelToSearch); lev <= finestLevelToSearch; ++lev) { - const BoxArray &intersectedBA = amrData.boxArray(lev); - int numGrids(intersectedBA.size()); - for(int iGrid(0); iGrid != numGrids; ++iGrid) { - if(lineBoxArray[lev].intersects(intersectedBA[iGrid])) { - bLineIsValid = true; - FArrayBox *destFab = NULL; - Box destFabBox(lineBoxArray[lev] & intersectedBA[iGrid]); - if(ParallelDescriptor::IOProcessor()) { - destFab = new FArrayBox(destFabBox, 1); - } - amrData.FillVar(destFab, destFabBox, - lev, currentDerived, - ParallelDescriptor::IOProcessorNumber()); - if(ParallelDescriptor::IOProcessor()) { - dataList->AddFArrayBox(*destFab, whichDir, lev); - delete destFab; - } - } - } - } -} -#endif - - -// --------------------------------------------------------------- -bool DataServices::MinMax(const Box &onBox, const string &derived, int level, - Real &dataMin, Real &dataMax, bool &minMaxValid) -{ - minMaxValid = amrData.MinMax(onBox, derived, level, dataMin, dataMax); - return minMaxValid; -} // end MinMax - -// --------------------------------------------------------------- -// --------------------------------------------------------------- diff --git a/Dataset.H b/Dataset.H index 793f527..ff0c2f2 100644 --- a/Dataset.H +++ b/Dataset.H @@ -1,24 +1,19 @@ - -// -// $Id: Dataset.H,v 1.32 2010-12-15 23:10:27 vince Exp $ -// - // --------------------------------------------------------------- // Dataset.H // --------------------------------------------------------------- #ifndef _DATASET_H_ #define _DATASET_H_ -#include "ParallelDescriptor.H" +#include #include #undef index -#include "GlobalUtilities.H" -#include "GraphicsAttributes.H" +#include +#include -#include "Box.H" -#include "AmrvisConstants.H" +#include +#include const int MAXSTRINGWIDTH = 64; @@ -59,7 +54,7 @@ class Dataset { Widget wDatasetTopLevel, wDatasetForm; Widget wDatasetTools, wScrollArea, wPixArea; Widget wFormat, wColorButton, wQuitButton, wLevels, wMinValue, wMaxValue; - Arg args[MAXARGS]; + Arg args[Amrvis::MAXARGS]; Box *datasetRegion; unsigned int pixSizeX, pixSizeY; int dataItemWidth, dataItemHeight; diff --git a/Dataset.cpp b/Dataset.cpp index 3600881..d7bc048 100644 --- a/Dataset.cpp +++ b/Dataset.cpp @@ -1,8 +1,3 @@ - -// -// $Id: Dataset.cpp,v 1.59 2010-12-15 23:10:27 vince Exp $ -// - // --------------------------------------------------------------- // Dataset.cpp // --------------------------------------------------------------- @@ -10,7 +5,7 @@ const int CHARACTERWIDTH = 13; const int CHARACTERHEIGHT = 22; const int MAXINDEXCHARS = 4; -#include "ParallelDescriptor.H" +#include #include @@ -28,11 +23,11 @@ const int MAXINDEXCHARS = 4; #include #undef index -#include "Dataset.H" -#include "PltApp.H" -#include "PltAppState.H" -#include "AmrPicture.H" -#include "DataServices.H" +#include +#include +#include +#include +#include #include #include @@ -84,7 +79,7 @@ Dataset::Dataset(const Box &alignedRegion, AmrPicture *apptr, // ************************************************ Dataset Window - char header[BUFSIZ]; + char header[Amrvis::BUFSIZE]; ostrstream outstr(header, sizeof(header)); outstr << AVGlobals::StripSlashes(pltAppPtr->GetFileName()) << " " << pltAppStatePtr->CurrentDerived() @@ -122,9 +117,9 @@ Dataset::Dataset(const Box &alignedRegion, AmrPicture *apptr, // ************************************************ Color Button i=0; XtSetArg(args[i], XmNtopAttachment, XmATTACH_FORM); ++i; - XtSetArg(args[i], XmNtopOffset, WOFFSET); ++i; + XtSetArg(args[i], XmNtopOffset, Amrvis::WOFFSET); ++i; XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); ++i; - XtSetArg(args[i], XmNleftOffset, WOFFSET); ++i; + XtSetArg(args[i], XmNleftOffset, Amrvis::WOFFSET); ++i; //XtSetArg(args[i], XmNheight, bHeight); ++i; wColorButton = XmCreateToggleButton(wDatasetTools, "Color", args, i); XtAddCallback(wColorButton, XmNvalueChangedCallback, @@ -137,7 +132,7 @@ Dataset::Dataset(const Box &alignedRegion, AmrPicture *apptr, // ************************************************ Close Button i=0; XtSetArg(args[i], XmNtopAttachment, XmATTACH_FORM); ++i; - XtSetArg(args[i], XmNtopOffset, WOFFSET); ++i; + XtSetArg(args[i], XmNtopOffset, Amrvis::WOFFSET); ++i; XtSetArg(args[i], XmNrightAttachment, XmATTACH_FORM); ++i; XtSetArg(args[i], XmNrightOffset, 20); ++i; XtSetArg(args[i], XmNheight, bHeight); ++i; @@ -153,10 +148,10 @@ Dataset::Dataset(const Box &alignedRegion, AmrPicture *apptr, xmLabelWidgetClass, wDatasetTools, XmNlabelString, sMax, XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, WOFFSET+8, + XmNtopOffset, Amrvis::WOFFSET+8, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, wQuitButton, - XmNrightOffset, WOFFSET+10, + XmNrightOffset, Amrvis::WOFFSET+10, XmNheight, bHeight, NULL); XmStringFree(sMax); @@ -167,10 +162,10 @@ Dataset::Dataset(const Box &alignedRegion, AmrPicture *apptr, xmLabelWidgetClass, wDatasetTools, XmNlabelString, sMin, XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, WOFFSET+8, + XmNtopOffset, Amrvis::WOFFSET+8, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, wMaxValue, - XmNrightOffset, WOFFSET+6, + XmNrightOffset, Amrvis::WOFFSET+6, XmNheight, bHeight, NULL); XmStringFree(sMin); @@ -185,10 +180,10 @@ Dataset::Dataset(const Box &alignedRegion, AmrPicture *apptr, xmLabelWidgetClass, wDatasetTools, XmNlabelString, sLabel, XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, WOFFSET+8, + XmNtopOffset, Amrvis::WOFFSET+8, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, wMinValue, - XmNrightOffset, WOFFSET+6, + XmNrightOffset, Amrvis::WOFFSET+6, XmNheight, bHeight, NULL); XmStringFree(sLabel); @@ -313,7 +308,7 @@ void Dataset::DatasetRender(const Box &alignedRegion, AmrPicture *apptr, vAxisString = "error"; } - char fstring[BUFSIZ]; + char fstring[Amrvis::BUFSIZE]; strcpy(fstring, pltAppStatePtr->GetFormatString().c_str()); if( ! stringOk) { return; @@ -347,7 +342,7 @@ void Dataset::DatasetRender(const Box &alignedRegion, AmrPicture *apptr, int paletteStart(palptr->PaletteStart()); int paletteEnd(palptr->PaletteEnd()); - char header[BUFSIZ]; + char header[Amrvis::BUFSIZE]; ostrstream outstr(header, sizeof(header)); outstr << AVGlobals::StripSlashes(pltAppPtr->GetFileName()) << " " << pltAppStatePtr->CurrentDerived() @@ -397,13 +392,13 @@ void Dataset::DatasetRender(const Box &alignedRegion, AmrPicture *apptr, largestWidth = max(5, largestWidth); // for body string } - bool bIsMF(dataServicesPtr->GetFileType() == MULTIFAB); + bool bIsMF(dataServicesPtr->GetFileType() == Amrvis::MULTIFAB); if(bIsMF) { // fix level zero data largestWidth = max(8, largestWidth); // for no data string } - char levelInfo[LINELENGTH], maxInfo[LINELENGTH], minInfo[LINELENGTH]; - char maxInfoV[LINELENGTH], minInfoV[LINELENGTH]; + char levelInfo[Amrvis::LINELENGTH], maxInfo[Amrvis::LINELENGTH], minInfo[Amrvis::LINELENGTH]; + char maxInfoV[Amrvis::LINELENGTH], minInfoV[Amrvis::LINELENGTH]; sprintf(levelInfo, "Level: %i", maxDrawnLevel); XmString sNewLevel = XmStringCreateSimple(levelInfo); @@ -783,23 +778,23 @@ void Dataset::DoPixInput(XmDrawingAreaCallbackStruct *cbs) { if(xcell >= 0 && xcell < pixSizeX/dataItemWidth && ycell >= 0 && ycell < pixSizeY/CHARACTERHEIGHT) { - if(amrPicturePtr->GetMyView() == XY) { - hDir = XDIR; - vDir = YDIR; + if(amrPicturePtr->GetMyView() == Amrvis::XY) { + hDir = Amrvis::XDIR; + vDir = Amrvis::YDIR; # if (BL_SPACEDIM == 3) - depthDir = ZDIR; + depthDir = Amrvis::ZDIR; # endif - } else if(amrPicturePtr->GetMyView() == XZ) { - hDir = XDIR; - vDir = ZDIR; + } else if(amrPicturePtr->GetMyView() == Amrvis::XZ) { + hDir = Amrvis::XDIR; + vDir = Amrvis::ZDIR; # if (BL_SPACEDIM == 3) - depthDir = YDIR; + depthDir = Amrvis::YDIR; # endif - } else if(amrPicturePtr->GetMyView() == YZ) { - hDir = YDIR; - vDir = ZDIR; + } else if(amrPicturePtr->GetMyView() == Amrvis::YZ) { + hDir = Amrvis::YDIR; + vDir = Amrvis::ZDIR; # if (BL_SPACEDIM == 3) - depthDir = XDIR; + depthDir = Amrvis::XDIR; # endif } @@ -820,12 +815,12 @@ void Dataset::DoPixInput(XmDrawingAreaCallbackStruct *cbs) { boxCoor[hDir] = hplot; boxCoor[vDir] = vplot; # if (BL_SPACEDIM == 3) - boxCoor[depthDir] = pltAppPtr->GetAmrPicturePtr(YZ - depthDir)->GetSlice(); + boxCoor[depthDir] = pltAppPtr->GetAmrPicturePtr(Amrvis::YZ - depthDir)->GetSlice(); boxCoor[depthDir] /= baseRatio; - //IntVect boxLocation(boxCoor[XDIR], boxCoor[YDIR], boxCoor[ZDIR]); + //IntVect boxLocation(boxCoor[Amrvis::XDIR], boxCoor[Amrvis::YDIR], boxCoor[Amrvis::ZDIR]); # endif # if (BL_SPACEDIM == 2) - //IntVect boxLocation(boxCoor[XDIR], boxCoor[YDIR]); + //IntVect boxLocation(boxCoor[Amrvis::XDIR], boxCoor[Amrvis::YDIR]); # endif IntVect boxLocation(boxCoor); Box chosenBox(boxLocation, boxLocation, regionBox.ixType()); diff --git a/DatasetClient.H b/DatasetClient.H index 5593982..dc9a545 100644 --- a/DatasetClient.H +++ b/DatasetClient.H @@ -1,15 +1,10 @@ - -// -// $Id: DatasetClient.H,v 1.4 2000-10-02 20:53:08 lijewski Exp $ -// - // --------------------------------------------------------------- // DatasetClient.H // --------------------------------------------------------------- #ifndef _DATASETCLIENT_H_ #define _DATASETCLIENT_H_ -#include "REAL.H" +#include #include #include diff --git a/DatasetClient.cpp b/DatasetClient.cpp index 77ab472..b51ed7c 100644 --- a/DatasetClient.cpp +++ b/DatasetClient.cpp @@ -1,8 +1,3 @@ - -// -// $Id: DatasetClient.cpp,v 1.9 2006-05-08 22:11:30 lijewski Exp $ -// - // --------------------------------------------------------------- // DatasetClient.cpp // --------------------------------------------------------------- @@ -21,12 +16,12 @@ #include #include -#include "DatasetClient.H" -#include "Box.H" -#include "FArrayBox.H" -#include "MultiFab.H" +#include +#include +#include +#include #ifdef BL_ARRAYVIEW_TAGBOX -#include "TagBox.H" +#include #endif const int MAXBUFSIZE = 1024; diff --git a/FABUTIL_2D.F b/FABUTIL_2D.F deleted file mode 100644 index e6d31de..0000000 --- a/FABUTIL_2D.F +++ /dev/null @@ -1,279 +0,0 @@ -c ::: SCCS stuff "@(#)FABUTIL_2D.F 3.1\t6/25/93" - -#define FORT_CINTERP cinterp2d -#define FORT_PCINTERP pcinterp2d - -#include "REAL.H" -#include "CONSTANTS.H" - -c ::: -------------------------------------------------------------- - subroutine FORT_CINTERP (fine,floi1,floi2,fhii1,fhii2, fblo,fbhi, - $ nvar,lratio, crse,clo,chi,cblo,cbhi,fslo,fshi, cslope,clen, - $ fslope,fdat,flen,voff) - - integer floi1,floi2, fhii1,fhii2 - - integer fblo(2), fbhi(2) - integer cblo(2), cbhi(2) - integer fslo(2), fshi(2) - integer lratio, nvar, clen, flen, clo, chi - REAL_T fine(floi1 :fhii1 ,floi2 :fhii2, nvar) - REAL_T crse(clo:chi, nvar) - REAL_T cslope(clo:chi, 2) - REAL_T fslope(flen, 2) - REAL_T fdat(flen) - REAL_T voff(flen) - -c ::: NOTE: data must be sent in so that -c ::: cslope(1,*) and crse(1,*) are associated with -c ::: the same cell - -c ::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -c ::: cinterp: conservative interpolation from coarse grid to -c ::: subregion of fine grid defined by (fblo,fbhi) -c ::: -c ::: Inputs/Outputs -c ::: fine <=> (modify) fine grid array -c ::: flo,fhi => (const) index limits of fine grid -c ::: fblo,fbhi => (const) subregion of fine grid to get values -c ::: nvar => (const) number of variables in state vector -c ::: lratio => (const) refinement ratio between levels -c ::: -c ::: crse => (const) coarse grid data widended by 1 zone -c ::: and unrolled -c ::: clo,chi => (const) one dimensional limits of crse grid -c ::: cslo,cshi => (const) coarse grid index limits where -c ::: slopes are to be defined. This is -c ::: the projection of (fblo,fbhi) down -c ::: to the coarse level -c ::: fslo,fshi => (const) fine grid index limits where -c ::: slopes are needed. This is the -c ::: refinement of (cslo,cshi) and -c ::: contains but may not be identical -c ::: to (fblo,fbhi). -c ::: cslope => (modify) temp array coarse grid slopes -c ::: clen => (const) length of coarse gtid slopes -c ::: fslope => (modify) temp array for fine grid slope -c ::: flen => (const) length of fine grid slope array -c ::: fdat => (const) temp array for fine grid data -c ::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -c ::: local var - integer n, fn - integer i, ic, ioff - integer j, jc, joff - integer ist, jst - REAL_T hafrat, volratio - REAL_T cen, forw, back, slp - REAL_T xoff, yoff - integer ncbx, ncby - integer ncsx, ncsy - integer islo, jslo - integer icc, istart, iend - integer lenx, leny, maxlen - - hafrat = half*float(lratio-1) - volratio = one/float(lratio) - - ncbx = cbhi(1)-cblo(1)+1 - ncby = cbhi(2)-cblo(2)+1 - ncsx = ncbx+2 - ncsy = ncby+2 - ist = 1 - jst = ncsx - islo = cblo(1)-1 - jslo = cblo(2)-1 - lenx = fbhi(1)-fblo(1)+1 - leny = fbhi(2)-fblo(2)+1 - maxlen = max(lenx,leny) - if (maxlen .eq. lenx) then - do 100 i = fblo(1), fbhi(1) - fn = i-fslo(1)+1 - ioff = mod(fn-1,lratio) - voff(fn) = float(ioff)-hafrat -100 continue - else - do 110 j = fblo(2), fbhi(2) - fn = j-fslo(2)+1 - joff = mod(fn-1,lratio) - voff(fn) = float(joff)-hafrat -110 continue - end if - do 120 n = 1, nvar - -c ::: ::::: compute slopes in x direction - do 130 i = 1, clen - cen = half*(crse(i+ist,n)-crse(i-ist,n)) - forw = crse(i+ist,n)-crse(i,n) - back = crse(i,n)-crse(i-ist,n) - slp = sign(one,cen)*min(abs(cen),abs(forw),abs(back)) - cslope(i,1)=cvmgp(slp,zero,forw*back) -130 continue -c ::: ::::: compute slopes in y direction - do 140 i = 1, clen - cen = half*(crse(i+jst,n)-crse(i-jst,n)) - forw = crse(i+jst,n)-crse(i,n) - back = crse(i,n)-crse(i-jst,n) - slp = sign(one,cen)*min(abs(cen),abs(forw),abs(back)) - cslope(i,2)=cvmgp(slp,zero,forw*back) -140 continue - if (maxlen .eq. lenx) then - do 150 jc = cblo(2), cbhi(2) - -c ::: ..,.......::::: strip out a fine grid slope vector - do 160 ioff = 1, lratio - icc = clo + ist + jst*(jc-jslo) - istart = ioff - iend = ioff + (ncbx-1)*lratio - do 170 fn = istart, iend, lratio - fslope(fn,1) = cslope(icc,1) - fslope(fn,2) = cslope(icc,2) - fdat(fn) = crse(icc,n) - icc = icc + ist -170 continue -160 continue - - do 180 joff = 0, lratio-1 - j = lratio*jc + joff - if (j .lt. fblo(2)) then - goto 180 -c --- next --- - end if - if (j .gt. fbhi(2)) then - goto 181 -c --- break --- - end if - yoff = float(joff)-hafrat - - do 190 i = fblo(1), fbhi(1) - fn = i-fslo(1)+1 - fine(i,j,n) = fdat(fn) + volratio* (voff(fn)* - $ fslope(fn,1)+yoff*fslope(fn,2)) -190 continue -180 continue -181 continue -150 continue - else - do 200 ic = cblo(1), cbhi(1) - -c ::: ..,.......::::: strip out a fine grid slope vector - do 210 joff = 1, lratio - icc = clo + ist*(ic-islo) + jst - istart = joff - iend = joff + (ncby-1)*lratio - do 220 fn = istart, iend, lratio - fslope(fn,1) = cslope(icc,1) - fslope(fn,2) = cslope(icc,2) - fdat(fn) = crse(icc,n) - icc = icc + jst -220 continue -210 continue - - do 230 ioff = 0, lratio-1 - i = lratio*ic + ioff - if (i .lt. fblo(1)) then - goto 230 -c --- next --- - end if - if (i .gt. fbhi(1)) then - goto 231 -c --- break --- - end if - xoff = float(ioff)-hafrat - - do 240 j = fblo(2), fbhi(2) - fn = j-fslo(2)+1 - fine(i,j,n) = fdat(fn) + volratio* (xoff* - $ fslope(fn,1)+voff(fn)*fslope(fn,2)) -240 continue -230 continue -231 continue -200 continue - end if -120 continue - - return - end - - -c ::: -------------------------------------------------------------- - subroutine FORT_PCINTERP (fine,floi1,floi2,fhii1,fhii2,fblo, fbhi,lrat, - $ nvar, crse,cloi1,cloi2,chii1,chii2,cblo, cbhi,temp,tloi,thii) - - integer floi1,floi2 - integer fhii1,fhii2 - integer cloi1,cloi2 - integer chii1,chii2 - - integer fblo(2), fbhi(2) - integer cblo(2), cbhi(2) - integer lrat, nvar, tloi, thii - REAL_T fine(floi1 :fhii1 ,floi2 :fhii2, nvar) - REAL_T crse(cloi1 :chii1 ,cloi2 :chii2, nvar) - REAL_T temp(tloi:thii + 1) -c ::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -c ::: pcinterp: use piecewise constant interpolation to define -c ::: values on the subregion of the fine FAB defined -c ::: by (fblo,fbhi). -c ::: -c ::: Inputs/Outputs -c ::: fine <=> (modify) fab to get interpolated values -c ::: flo,fhi => (const) index limits of fine -c ::: fblo,fbhi => (const) subregion of fine grid to get values -c ::: crse => (const) fab holding coarse grid values -c ::: clo,chi => (const) index limits of src -c ::: cblo,cbhi => (const) subregion of coarse grid holding values -c ::: temp => (modify) temporary space for vectorization -c ::: tlo,thi => (const) index limits of temp space -c ::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -c ::: local var - integer i,j,k,ic,jc,kc,ioff,n - integer ixproj,ii,ll - ixproj(ii,ll) = (ii + ll*iabs(ii))/ll - iabs(ii) - - do 120 j = fblo(2), fbhi(2) - jc = ixproj(j,lrat) - do 130 n = 1, nvar - do 140 ioff = 0, lrat-1 - do 150 ic = cblo(1),cbhi(1) - i = lrat*ic + ioff - temp(i) = crse(ic,jc,n) -150 continue -140 continue - do 160 i = fblo(1), fbhi(1) - fine(i,j,n) = temp(i) -160 continue -130 continue -120 continue - - return - end - - -c ::: -------------------------------------------------------------- - subroutine cartgridminmax2d (data, lo1, lo2, hi1, hi2, - $ vfracdata, vfeps, dmin, dmax) - implicit none - - integer lo1, lo2, hi1, hi2 - REAL_T data(lo1:hi1 ,lo2:hi2) - REAL_T vfracdata(lo1:hi1 ,lo2:hi2) - REAL_T vfeps, dmin, dmax - - integer i, j - - dmax = -bigreal - dmin = bigreal - do 420 j = lo2, hi2 - do 430 i = lo1, hi1 -c print *, "i j vfracdata(i,j) = ",i,j,vfracdata(i,j) - if ( .not. (vfracdata(i,j).lt.vfeps)) then - dmax = max(dmax,data(i,j)) - dmin = min(dmin,data(i,j)) - endif -430 continue -420 continue - - return - end - diff --git a/FABUTIL_3D.F b/FABUTIL_3D.F deleted file mode 100644 index 37e1d35..0000000 --- a/FABUTIL_3D.F +++ /dev/null @@ -1,738 +0,0 @@ -c ::: SCCS stuff "@(#)FABUTIL_3D.F 3.1\t6/25/93" - -#define FORT_CINTERP cinterp3d -#define FORT_PCINTERP pcinterp3d -#define FORT_VCINTERP vcinterp3d -#define FORT_CARTGRIDMINMAX cartgridminmax3d - -#include "REAL.H" -#include "CONSTANTS.H" - -#define IX_PROJ(A,B) (A+B*iabs(A))/B-iabs(A) - - -c ::: -------------------------------------------------------------- - subroutine FORT_CARTGRIDMINMAX (data, dlo1, dlo2, dlo3, dhi1, dhi2, dhi3, - $ vfracdata, vfeps, dmin, dmax) - implicit none - - integer dlo1, dlo2, dlo3, dhi1, dhi2, dhi3 - REAL_T data(dlo1:dhi1 ,dlo2:dhi2, dlo3:dhi3) - REAL_T vfracdata(dlo1:dhi1 ,dlo2:dhi2, dlo3:dhi3) - REAL_T vfeps, dmin, dmax - - integer i, j, k - - dmax = -bigreal - dmin = bigreal - do 410 k = dlo3, dhi3 - do 420 j = dlo2, dhi2 - do 430 i = dlo1, dhi1 - if ( (vfracdata(i,j,k).ge.vfeps)) then - dmax = max(dmax,data(i,j,k)) - dmin = min(dmin,data(i,j,k)) - endif -430 continue -420 continue -410 continue - - return - end - - -c ::: -------------------------------------------------------------- - subroutine FORT_CINTERP (fine,floi1,floi2,floi3,fhii1,fhii2,fhii3, - $ fblo,fbhi,nvar,lratio, crse,clo,chi,cblo,cbhi,fslo,fshi, cslope, - $ clen,fslope,fdat,flen,voff) - - integer floi1,floi2,floi3, fhii1,fhii2,fhii3 - integer fblo(3), fbhi(3) - integer cblo(3), cbhi(3) - integer fslo(3), fshi(3) - integer lratio, nvar, clen, flen, clo, chi - REAL_T fine(floi1 :fhii1 ,floi2 :fhii2 ,floi3 :fhii3, nvar) - REAL_T crse(clo:chi, nvar) - REAL_T cslope(clo:chi, 3) - REAL_T fslope(flen, 3) - REAL_T fdat(flen) - REAL_T voff(flen) - -c ::: NOTE: data must be sent in so that -c ::: cslope(1,*) and crse(1,*) are associated with -c ::: the same cell - -c ::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -c ::: cinterp: conservative interpolation from coarse grid to -c ::: subregion of fine grid defined by (fblo,fbhi) -c ::: -c ::: Inputs/Outputs -c ::: fine <=> (modify) fine grid array -c ::: flo,fhi => (const) index limits of fine grid -c ::: fblo,fbhi => (const) subregion of fine grid to get values -c ::: nvar => (const) number of variables in state vector -c ::: lratio => (const) refinement ratio between levels -c ::: -c ::: crse => (const) coarse grid data widended by 1 zone -c ::: and unrolled -c ::: clo,chi => (const) one dimensional limits of crse grid -c ::: cslo,cshi => (const) coarse grid index limits where -c ::: slopes are to be defined. This is -c ::: the projection of (fblo,fbhi) down -c ::: to the coarse level -c ::: fslo,fshi => (const) fine grid index limits where -c ::: slopes are needed. This is the -c ::: refinement of (cslo,cshi) and -c ::: contains but may not be identical -c ::: to (fblo,fbhi). -c ::: cslope => (modify) temp array coarse grid slopes -c ::: clen => (const) length of coarse gtid slopes -c ::: fslope => (modify) temp array for fine grid slope -c ::: flen => (const) length of fine grid slope array -c ::: fdat => (const) temp array for fine grid data -c ::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -c ::: local var - integer n, fn - integer i, ic, ioff - integer j, jc, joff - integer k, kc, koff - integer ist, jst, kst - REAL_T hafrat, volratio - REAL_T cen, forw, back, slp - REAL_T xoff, yoff, zoff - integer ncbx, ncby, ncbz - integer ncsx, ncsy, ncsz - integer islo, jslo, kslo - integer icc, istart, iend - integer lenx, leny, lenz, maxlen - - hafrat = half*float(lratio-1) - volratio = one/float(lratio) - - ncbx = cbhi(1)-cblo(1)+1 - ncby = cbhi(2)-cblo(2)+1 - ncbz = cbhi(3)-cblo(3)+1 - ncsx = ncbx+2 - ncsy = ncby+2 - ncsz = ncbz+2 - ist = 1 - jst = ncsx - kst = ncsx*ncsy - islo = cblo(1)-1 - jslo = cblo(2)-1 - kslo = cblo(3)-1 - lenx = fbhi(1)-fblo(1)+1 - leny = fbhi(2)-fblo(2)+1 - lenz = fbhi(3)-fblo(3)+1 - maxlen = max(lenx,leny,lenz) - if (maxlen .eq. lenx) then - do 100 i = fblo(1), fbhi(1) - fn = i-fslo(1)+1 - ioff = mod(fn-1,lratio) - voff(fn) = float(ioff)-hafrat -100 continue - else if (maxlen .eq. leny) then - do 110 j = fblo(2), fbhi(2) - fn = j-fslo(2)+1 - joff = mod(fn-1,lratio) - voff(fn) = float(joff)-hafrat -110 continue - else - do 120 k = fblo(3), fbhi(3) - fn = k-fslo(3)+1 - koff = mod(fn-1,lratio) - voff(fn) = float(koff)-hafrat -120 continue - end if - do 130 n = 1, nvar - -c ::: ::::: compute slopes in x direction - do 140 i = 1, clen - cen = half*(crse(i+ist,n)-crse(i-ist,n)) - forw = crse(i+ist,n)-crse(i,n) - back = crse(i,n)-crse(i-ist,n) - slp = sign(one,cen)*min(abs(cen),abs(forw),abs(back)) - cslope(i,1)=cvmgp(slp,zero,forw*back) -140 continue -c ::: ::::: compute slopes in y direction - do 150 i = 1, clen - cen = half*(crse(i+jst,n)-crse(i-jst,n)) - forw = crse(i+jst,n)-crse(i,n) - back = crse(i,n)-crse(i-jst,n) - slp = sign(one,cen)*min(abs(cen),abs(forw),abs(back)) - cslope(i,2)=cvmgp(slp,zero,forw*back) -150 continue -c ::: ::::: compute slopes in z direction - do 160 i = 1, clen - cen = half*(crse(i+kst,n)-crse(i-kst,n)) - forw = crse(i+kst,n)-crse(i,n) - back = crse(i,n)-crse(i-kst,n) - slp = sign(one,cen)*min(abs(cen),abs(forw),abs(back)) - cslope(i,3)=cvmgp(slp,zero,forw*back) -160 continue - - if (maxlen .eq. lenx) then - do 170 kc = cblo(3), cbhi(3) - do 180 jc = cblo(2), cbhi(2) - -c ::: ..,.......::::: strip out a fine grid slope vector - do 190 ioff = 1, lratio - icc = clo + ist + jst*(jc-jslo) + kst*(kc- - $ kslo) - istart = ioff - iend = ioff + (ncbx-1)*lratio - do 200 fn = istart, iend, lratio - fslope(fn,1) = cslope(icc,1) - fslope(fn,2) = cslope(icc,2) - fslope(fn,3) = cslope(icc,3) - fdat(fn) = crse(icc,n) - icc = icc + ist -200 continue -190 continue - - do 210 koff = 0, lratio-1 - k = lratio*kc + koff - if (k .lt. fblo(3)) then - goto 210 -c --- next --- - end if - if (k .gt. fbhi(3)) then - goto 211 -c --- break --- - end if - zoff = float(koff)-hafrat - do 220 joff = 0, lratio-1 - j = lratio*jc + joff - if (j .lt. fblo(2)) then - goto 220 -c --- next --- - end if - if (j .gt. fbhi(2)) then - goto 221 -c --- break --- - end if - yoff = float(joff)-hafrat - - do 230 i = fblo(1), fbhi(1) - fn = i-fslo(1)+1 - fine(i,j,k,n) = fdat(fn) + volratio* - $ (voff(fn)*fslope(fn,1)+yoff*fslope(fn, - $ 2)+ zoff*fslope(fn,3)) -230 continue -220 continue -221 continue -210 continue -211 continue -180 continue -170 continue - else if (maxlen .eq. leny) then - do 240 kc = cblo(3), cbhi(3) - do 250 ic = cblo(1), cbhi(1) - -c ::: ..,.......::::: strip out a fine grid slope vector - do 260 joff = 1, lratio - icc = clo + ist*(ic-islo) + jst + kst*(kc- - $ kslo) - istart = joff - iend = joff + (ncby-1)*lratio - do 270 fn = istart, iend, lratio - fslope(fn,1) = cslope(icc,1) - fslope(fn,2) = cslope(icc,2) - fslope(fn,3) = cslope(icc,3) - fdat(fn) = crse(icc,n) - icc = icc + jst -270 continue -260 continue - - do 280 koff = 0, lratio-1 - k = lratio*kc + koff - if (k .lt. fblo(3)) then - goto 280 -c --- next --- - end if - if (k .gt. fbhi(3)) then - goto 281 -c --- break --- - end if - zoff = float(koff)-hafrat - do 290 ioff = 0, lratio-1 - i = lratio*ic + ioff - if (i .lt. fblo(1)) then - goto 290 -c --- next --- - end if - if (i .gt. fbhi(1)) then - goto 291 -c --- break --- - end if - xoff = float(ioff)-hafrat - - do 300 j = fblo(2), fbhi(2) - fn = j-fslo(2)+1 - fine(i,j,k,n) = fdat(fn) + volratio* - $ (xoff*fslope(fn,1)+voff(fn)*fslope(fn, - $ 2)+ zoff*fslope(fn,3)) -300 continue -290 continue -291 continue -280 continue -281 continue -250 continue -240 continue - else - do 310 jc = cblo(2), cbhi(2) - do 320 ic = cblo(1), cbhi(1) - -c ::: ..,.......::::: strip out a fine grid slope vector - do 330 koff = 1, lratio - icc = clo + ist*(ic-islo) + jst*(jc-jslo) + - $ kst - istart = koff - iend = koff + (ncbz-1)*lratio - do 340 fn = istart, iend, lratio - fslope(fn,1) = cslope(icc,1) - fslope(fn,2) = cslope(icc,2) - fslope(fn,3) = cslope(icc,3) - fdat(fn) = crse(icc,n) - icc = icc + kst -340 continue -330 continue - - do 350 joff = 0, lratio-1 - j = lratio*jc + joff - if (j .lt. fblo(2)) then - goto 350 -c --- next --- - end if - if (j .gt. fbhi(2)) then - goto 351 -c --- break --- - end if - yoff = float(joff)-hafrat - do 360 ioff = 0, lratio-1 - i = lratio*ic + ioff - if (i .lt. fblo(1)) then - goto 360 -c --- next --- - end if - if (i .gt. fbhi(1)) then - goto 361 -c --- break --- - end if - xoff = float(ioff)-hafrat - - do 370 k = fblo(3), fbhi(3) - fn = k-fslo(3)+1 - fine(i,j,k,n) = fdat(fn) + volratio* - $ (xoff*fslope(fn,1)+yoff*fslope(fn,2)+ - $ voff(fn)*fslope(fn,3)) -370 continue -360 continue -361 continue -350 continue -351 continue -320 continue -310 continue - end if -130 continue - - return - end - - -c ::: -------------------------------------------------------------- - subroutine FORT_PCINTERP (fine,floi1,floi2,floi3,fhii1,fhii2,fhii3, - $ fblo, fbhi,lrat,nvar, crse,cloi1,cloi2,cloi3,chii1,chii2,chii3, - $ cblo, cbhi,temp,tloi,thii) - - integer floi1,floi2,floi3 - integer fhii1,fhii2,fhii3 - integer cloi1,cloi2,cloi3 - integer chii1,chii2,chii3 - - integer fblo(3), fbhi(3) - integer cblo(3), cbhi(3) - integer lrat, nvar, tloi, thii - REAL_T fine(floi1 :fhii1 ,floi2 :fhii2 ,floi3 :fhii3, nvar) - REAL_T crse(cloi1 :chii1 ,cloi2 :chii2 ,cloi3 :chii3, nvar) - REAL_T temp(tloi:thii + 1) -c ::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -c ::: pcinterp: use piecewise constant interpolation to define -c ::: values on the subregion of the fine FAB defined -c ::: by (fblo,fbhi). -c ::: -c ::: Inputs/Outputs -c ::: fine <=> (modify) fab to get interpolated values -c ::: flo,fhi => (const) index limits of fine -c ::: fblo,fbhi => (const) subregion of fine grid to get values -c ::: crse => (const) fab holding coarse grid values -c ::: clo,chi => (const) index limits of src -c ::: cblo,cbhi => (const) subregion of coarse grid holding values -c ::: temp => (modify) temporary space for vectorization -c ::: tlo,thi => (const) index limits of temp space -c ::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -c ::: local var - integer i,j,k,ic,jc,kc,ioff,n - integer ixproj,ii,ll - ixproj(ii,ll) = (ii + ll*iabs(ii))/ll - iabs(ii) - - do 130 k = fblo(3), fbhi(3) - kc = ixproj(k,lrat) - do 140 j = fblo(2), fbhi(2) - jc = ixproj(j,lrat) - do 150 n = 1, nvar - do 160 ioff = 0, lrat-1 - do 170 ic = cblo(1),cbhi(1) - i = lrat*ic + ioff - temp(i) = crse(ic,jc,kc,n) -170 continue -160 continue - do 180 i = fblo(1), fbhi(1) - fine(i,j,k,n) = temp(i) -180 continue -150 continue -140 continue -130 continue - - return - end - - -c ::: -------------------------------------------------------------- - subroutine FORT_VCINTERP (fine,floi1,floi2,floi3,fhii1,fhii2, - $ fhii3,fbloi1,fbloi2,fbloi3, fbhii1,fbhii2,fbhii3,nvar,lratio, - $ crse,clo,chi,cblo,cbhi, fslo,fshi,cvloi1,cvloi2,cvloi3,cvhii1, - $ cvhii2,cvhii3, cslope,clen,fslope,fdat,flen,voff, cvc1,fvc1,cvc2, - $ fvc2,cvc3,fvc3) - - integer floi1,floi2,floi3 - integer fhii1,fhii2,fhii3 - integer fbloi1,fbloi2,fbloi3 - integer fbhii1,fbhii2,fbhii3 - integer cvloi1,cvloi2,cvloi3 - integer cvhii1,cvhii2,cvhii3 - - integer cblo(3), cbhi(3) - integer fslo(3), fshi(3) - integer lratio, nvar, clen, flen, clo, chi - REAL_T fine(floi1 :fhii1 ,floi2 :fhii2 ,floi3 :fhii3, nvar) - REAL_T crse(clo:chi, nvar) - REAL_T cslope(clo:chi, 3) - REAL_T fslope(flen, 3) - REAL_T fdat(flen) - REAL_T voff(flen) - - REAL_T cvc1(cvloi1 :cvhii1+1) - REAL_T cvc2(cvloi2 :cvhii2+1) - REAL_T cvc3(cvloi3 :cvhii3+1) - REAL_T fvc1(fbloi1 :fbhii1+1) - REAL_T fvc2(fbloi2 :fbhii2+1) - REAL_T fvc3(fbloi3 :fbhii3+1) - -c ::: NOTE: data must be sent in so that -c ::: cslope(1,*) and crse(1,*) are associated with -c ::: the same cell - -c ::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -c ::: vcinterp: conservative interpolation in volume coordinates -c ::: from coarse grid to -c ::: subregion of fine grid defined by (fblo,fbhi) -c ::: -c ::: Inputs/Outputs -c ::: fine <=> (modify) fine grid array -c ::: flo,fhi => (const) index limits of fine grid -c ::: fblo,fbhi => (const) subregion of fine grid to get values -c ::: nvar => (const) number of variables in state vector -c ::: lratio => (const) refinement ratio between levels -c ::: -c ::: crse => (const) coarse grid data widended by 1 zone -c ::: and unrolled -c ::: clo,chi => (const) one dimensional limits of crse grid -c ::: cslo,cshi => (const) coarse grid index limits where -c ::: slopes are to be defined. This is -c ::: the projection of (fblo,fbhi) down -c ::: to the coarse level -c ::: fslo,fshi => (const) fine grid index limits where -c ::: slopes are needed. This is the -c ::: refinement of (cslo,cshi) and -c ::: contains but may not be identical -c ::: to (fblo,fbhi). -c ::: cslope => (modify) temp array coarse grid slopes -c ::: clen => (const) length of coarse gtid slopes -c ::: fslope => (modify) temp array for fine grid slope -c ::: flen => (const) length of fine grid slope array -c ::: fdat => (const) temp array for fine grid data -c ::: cvlo,cvhi => (const) coarse grid index limits where -c ::: volume coordinates are defined -c ::: cvc1 => (const) coarse grid volume coords, x-dir -c ::: cvc2 => (const) coarse grid volume coords, y_dir -c ::: cvc3 => (const) coarse grid volume coords, z-dir -c ::: fvc1 => (const) fine grid volume coords, x-dir -c ::: fvc2 => (const) fine grid volume coords, y-dir -c ::: fvc3 => (const) fine grid volume coords, z-dir -c ::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -c ::: local var - integer n, fn - integer i, ic, ioff - integer j, jc, joff - integer k, kc, koff - integer ist, jst, kst - REAL_T cen, forw, back, slp - REAL_T xoff, yoff, zoff - REAL_T fcen, ccen - integer ncbx, ncby, ncbz - integer ncsx, ncsy, ncsz - integer islo, jslo, kslo - integer icc, istart, iend - integer lenx, leny, lenz, maxlen - - ncbx = cbhi(1)-cblo(1)+1 - ncby = cbhi(2)-cblo(2)+1 - ncbz = cbhi(3)-cblo(3)+1 - ncsx = ncbx+2 - ncsy = ncby+2 - ncsz = ncbz+2 - ist = 1 - jst = ncsx - kst = ncsx*ncsy - islo = cblo(1)-1 - jslo = cblo(2)-1 - kslo = cblo(3)-1 - lenx = fbhii1-fbloi1+1 - leny = fbhii2-fbloi2+1 - lenz = fbhii3-fbloi3+1 - maxlen = max(lenx,leny,lenz) - if (maxlen .eq. lenx) then - do 380 i = fbloi1, fbhii1 - fn = i-fslo(1)+1 - ic = IX_PROJ(i,lratio) - fcen = half*(fvc1(i)+fvc1(i+1)) - ccen = half*(cvc1(ic)+cvc1(ic+1)) - voff(fn) = (fcen-ccen)/(cvc1(ic+1)-cvc1(ic)) -380 continue - else if (maxlen .eq. leny) then - do 390 j = fbloi2, fbhii2 - fn = j-fslo(2)+1 - jc = IX_PROJ(j,lratio) - fcen = half*(fvc2(j)+fvc2(j+1)) - ccen = half*(cvc2(jc)+cvc2(jc+1)) - voff(fn) = (fcen-ccen)/(cvc2(jc+1)-cvc2(jc)) -390 continue - else - do 400 k = fbloi3, fbhii3 - fn = k-fslo(3)+1 - kc = IX_PROJ(k,lratio) - fcen = half*(fvc3(k)+fvc3(k+1)) - ccen = half*(cvc3(kc)+cvc3(kc+1)) - voff(fn) = (fcen-ccen)/(cvc3(kc+1)-cvc3(kc)) -400 continue - end if - do 410 n = 1, nvar - -c ::: ::::: compute slopes in x direction - do 420 i = 1, clen - cen = half*(crse(i+ist,n)-crse(i-ist,n)) - forw = crse(i+ist,n)-crse(i,n) - back = crse(i,n)-crse(i-ist,n) - slp = sign(one,cen)*min(abs(cen),abs(forw),abs(back)) - cslope(i,1)=cvmgp(slp,zero,forw*back) -420 continue -c ::: ::::: compute slopes in y direction - do 430 i = 1, clen - cen = half*(crse(i+jst,n)-crse(i-jst,n)) - forw = crse(i+jst,n)-crse(i,n) - back = crse(i,n)-crse(i-jst,n) - slp = sign(one,cen)*min(abs(cen),abs(forw),abs(back)) - cslope(i,2)=cvmgp(slp,zero,forw*back) -430 continue -c ::: ::::: compute slopes in z direction - do 440 i = 1, clen - cen = half*(crse(i+kst,n)-crse(i-kst,n)) - forw = crse(i+kst,n)-crse(i,n) - back = crse(i,n)-crse(i-kst,n) - slp = sign(one,cen)*min(abs(cen),abs(forw),abs(back)) - cslope(i,3)=cvmgp(slp,zero,forw*back) -440 continue - - if (maxlen .eq. lenx) then - do 450 kc = cblo(3), cbhi(3) - do 460 jc = cblo(2), cbhi(2) - -c ::: ..,.......::::: strip out a fine grid slope vector - do 470 ioff = 1, lratio - icc = clo + ist + jst*(jc-jslo) + kst*(kc- - $ kslo) - istart = ioff - iend = ioff + (ncbx-1)*lratio - do 480 fn = istart, iend, lratio - fslope(fn,1) = cslope(icc,1) - fslope(fn,2) = cslope(icc,2) - fslope(fn,3) = cslope(icc,3) - fdat(fn) = crse(icc,n) - icc = icc + ist -480 continue -470 continue - - do 490 koff = 0, lratio-1 - k = lratio*kc + koff - if (k .lt. fbloi3) then - goto 490 -c --- next --- - end if - if (k .gt. fbhii3) then - goto 491 -c --- break --- - end if - fcen = half*(fvc3(k)+fvc3(k+1)) - ccen = half*(cvc3(kc)+cvc3(kc+1)) - zoff = (fcen-ccen)/(cvc3(kc+1)-cvc3(kc)) - do 500 joff = 0, lratio-1 - j = lratio*jc + joff - if (j .lt. fbloi2) then - goto 500 -c --- next --- - end if - if (j .gt. fbhii2) then - goto 501 -c --- break --- - end if - fcen = half*(fvc2(j)+fvc2(j+1)) - ccen = half*(cvc2(jc)+cvc2(jc+1)) - yoff = (fcen-ccen)/(cvc2(jc+1)-cvc2(jc)) - - do 510 i = fbloi1, fbhii1 - fn = i-fslo(1)+1 - fine(i,j,k,n) = fdat(fn) + voff(fn)* - $ fslope(fn,1)+yoff*fslope(fn,2)+ zoff* - $ fslope(fn,3) -510 continue -500 continue -501 continue -490 continue -491 continue -460 continue -450 continue - else if (maxlen .eq. leny) then - do 520 kc = cblo(3), cbhi(3) - do 530 ic = cblo(1), cbhi(1) - -c ::: ..,.......::::: strip out a fine grid slope vector - do 540 joff = 1, lratio - icc = clo + ist*(ic-islo) + jst + kst*(kc- - $ kslo) - istart = joff - iend = joff + (ncby-1)*lratio - do 550 fn = istart, iend, lratio - fslope(fn,1) = cslope(icc,1) - fslope(fn,2) = cslope(icc,2) - fslope(fn,3) = cslope(icc,3) - fdat(fn) = crse(icc,n) - icc = icc + jst -550 continue -540 continue - - do 560 koff = 0, lratio-1 - k = lratio*kc + koff - if (k .lt. fbloi3) then - goto 560 -c --- next --- - end if - if (k .gt. fbhii3) then - goto 561 -c --- break --- - end if - fcen = half*(fvc3(k)+fvc3(k+1)) - ccen = half*(cvc3(kc)+cvc3(kc+1)) - zoff = (fcen-ccen)/(cvc3(kc+1)-cvc3(kc)) - do 570 ioff = 0, lratio-1 - i = lratio*ic + ioff - if (i .lt. fbloi1) then - goto 570 -c --- next --- - end if - if (i .gt. fbhii1) then - goto 571 -c --- break --- - end if - fcen = half*(fvc1(i)+fvc1(i+1)) - ccen = half*(cvc1(ic)+cvc1(ic+1)) - xoff = (fcen-ccen)/(cvc1(ic+1)-cvc1(ic)) - - do 580 j = fbloi2, fbhii2 - fn = j-fslo(2)+1 - fine(i,j,k,n) = fdat(fn) + xoff* - $ fslope(fn,1)+voff(fn)*fslope(fn,2)+ - $ zoff*fslope(fn,3) -580 continue -570 continue -571 continue -560 continue -561 continue -530 continue -520 continue - else - do 590 jc = cblo(2), cbhi(2) - do 600 ic = cblo(1), cbhi(1) - -c ::: ..,.......::::: strip out a fine grid slope vector - do 610 koff = 1, lratio - icc = clo + ist*(ic-islo) + jst*(jc-jslo) + - $ kst - istart = koff - iend = koff + (ncbz-1)*lratio - do 620 fn = istart, iend, lratio - fslope(fn,1) = cslope(icc,1) - fslope(fn,2) = cslope(icc,2) - fslope(fn,3) = cslope(icc,3) - fdat(fn) = crse(icc,n) - icc = icc + kst -620 continue -610 continue - - do 630 joff = 0, lratio-1 - j = lratio*jc + joff - if (j .lt. fbloi2) then - goto 630 -c --- next --- - end if - if (j .gt. fbhii2) then - goto 631 -c --- break --- - end if - fcen = half*(fvc2(j)+fvc2(j+1)) - ccen = half*(cvc2(jc)+cvc2(jc+1)) - yoff = (fcen-ccen)/(cvc2(jc+1)-cvc2(jc)) - do 640 ioff = 0, lratio-1 - i = lratio*ic + ioff - if (i .lt. fbloi1) then - goto 640 -c --- next --- - end if - if (i .gt. fbhii1) then - goto 641 -c --- break --- - end if - fcen = half*(fvc1(i)+fvc1(i+1)) - ccen = half*(cvc1(ic)+cvc1(ic+1)) - xoff = (fcen-ccen)/(cvc1(ic+1)-cvc1(ic)) - - do 650 k = fbloi3, fbhii3 - fn = k-fslo(3)+1 - fine(i,j,k,n) = fdat(fn) + xoff* - $ fslope(fn,1)+yoff*fslope(fn,2)+ - $ voff(fn)*fslope(fn,3) -650 continue -640 continue -641 continue -630 continue -631 continue -600 continue -590 continue - end if -410 continue - - return - end - - diff --git a/GNUmakefile b/GNUmakefile index beffe76..434329b 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -36,6 +36,7 @@ HERE = . INCLUDE_LOCATIONS += $(HERE) INCLUDE_LOCATIONS += $(BOXLIB_HOME)/Src/C_BaseLib +INCLUDE_LOCATIONS += $(BOXLIB_HOME)/Src/Extern/amrdata DEFINES += -DBL_PARALLEL_IO @@ -125,10 +126,11 @@ endif include $(HERE)/Make.package include $(BOXLIB_HOME)/Src/C_BaseLib/Make.package +include $(BOXLIB_HOME)/Src/Extern/amrdata/Make.package -vpath %.cpp $(HERE) $(BOXLIB_HOME)/Src/C_BaseLib -vpath %.H $(HERE) $(BOXLIB_HOME)/Src/C_BaseLib -vpath %.F $(HERE) $(BOXLIB_HOME)/Src/C_BaseLib +vpath %.cpp $(HERE) $(BOXLIB_HOME)/Src/C_BaseLib $(BOXLIB_HOME)/Src/Extern/amrdata +vpath %.H $(HERE) $(BOXLIB_HOME)/Src/C_BaseLib $(BOXLIB_HOME)/Src/Extern/amrdata +vpath %.F $(HERE) $(BOXLIB_HOME)/Src/C_BaseLib $(BOXLIB_HOME)/Src/Extern/amrdata vpath %.f $(HERE) $(BOXLIB_HOME)/Src/C_BaseLib vpath %.a $(LIBRARY_LOCATIONS) diff --git a/GlobalUtilities.H b/GlobalUtilities.H index 252c57e..429b289 100644 --- a/GlobalUtilities.H +++ b/GlobalUtilities.H @@ -1,17 +1,12 @@ - -// -// $Id: GlobalUtilities.H,v 1.25 2008-07-31 22:12:37 vince Exp $ -// - // --------------------------------------------------------------- // GlobalUtilities.H // --------------------------------------------------------------- #ifndef _GLOBALUTILITIES_H_ #define _GLOBALUTILITIES_H_ -#include "AmrvisConstants.H" -#include "Box.H" -#include "Array.H" +#include +#include +#include #include #include @@ -53,7 +48,7 @@ namespace AVGlobals { int SleepTime(); const string &GetComlineFilename(int index); string StripSlashes(const string &inString); - FileType GetDefaultFileType(); + Amrvis::FileType GetDefaultFileType(); bool GivenBox(); bool GivenBoxSlice(); bool GivenFilename(); diff --git a/GlobalUtilities.cpp b/GlobalUtilities.cpp index 6d7d6a7..9d8fdd1 100644 --- a/GlobalUtilities.cpp +++ b/GlobalUtilities.cpp @@ -1,13 +1,9 @@ -// -// $Id: GlobalUtilities.cpp,v 1.65 2011-08-11 19:27:22 vince Exp $ -// - // --------------------------------------------------------------- // GlobalUtilities.cpp // --------------------------------------------------------------- -#include "GlobalUtilities.H" -#include "FArrayBox.H" -#include "FabConv.H" +#include +#include +#include #include #include using std::ifstream; @@ -18,8 +14,8 @@ using std::endl; using std::min; using std::max; -#include "PltApp.H" -#include "ParallelDescriptor.H" +#include +#include const int DEFAULTMAXPICTURESIZE = 600000; @@ -27,7 +23,7 @@ int boundaryWidth; int skipPltLines; int boxColor; int maxPictureSize; -FileType fileType; +Amrvis::FileType fileType; bool animation; bool bCacheAnimFrames; Array comlinefilename; @@ -123,7 +119,7 @@ void AddSlices(int dir, char *sliceset) { list::iterator dsliter; if(bRangeSpecified) { - if(BL_SPACEDIM == 2 && dir == ZDIR) { + if(BL_SPACEDIM == 2 && dir == Amrvis::ZDIR) { slice = 0; dsliter = find(dumpSliceList[dir].begin(), dumpSliceList[dir].end(), slice); if(dsliter == dumpSliceList[dir].end()) { @@ -139,7 +135,7 @@ void AddSlices(int dir, char *sliceset) { } } else { slice = atoi(sliceset); - if(BL_SPACEDIM == 2 && dir == ZDIR) { + if(BL_SPACEDIM == 2 && dir == Amrvis::ZDIR) { slice = 0; } dsliter = find(dumpSliceList[dir].begin(),dumpSliceList[dir].end(),slice); @@ -156,9 +152,9 @@ bool AVGlobals::ReadLightingFile(const string &lightdefaultsFile, Real &shinyDef, Real &minRayOpacityDef, Real &maxRayOpacityDef) { - char defaultString[LINELENGTH], cRealIn[LINELENGTH]; + char defaultString[Amrvis::LINELENGTH], cRealIn[Amrvis::LINELENGTH]; // try to find the defaultsFile - char buffer[BUFSIZ]; + char buffer[Amrvis::BUFSIZE]; ifstream defs(lightdefaultsFile.c_str()); @@ -173,7 +169,7 @@ bool AVGlobals::ReadLightingFile(const string &lightdefaultsFile, } ws(defs); - defs.getline(buffer, BUFSIZ, '\n'); + defs.getline(buffer, Amrvis::BUFSIZE, '\n'); while( ! defs.eof()) { sscanf(buffer,"%s", defaultString); @@ -199,7 +195,7 @@ bool AVGlobals::ReadLightingFile(const string &lightdefaultsFile, maxRayOpacityDef = atof(cRealIn); } } - defs.getline(buffer, BUFSIZ, '\n'); + defs.getline(buffer, Amrvis::BUFSIZE, '\n'); } } return true; @@ -243,10 +239,10 @@ bool AVGlobals::WriteLightingFile(const string &lightdefaultsFile, // ------------------------------------------------------------------- void AVGlobals::GetDefaults(const string &defaultsFile) { - char buffer[BUFSIZ]; - char defaultString[LINELENGTH]; - char tempString[LINELENGTH]; - char tempStringSDim[BL_SPACEDIM][LINELENGTH]; + char buffer[Amrvis::BUFSIZE]; + char defaultString[Amrvis::LINELENGTH]; + char tempString[Amrvis::LINELENGTH]; + char tempStringSDim[BL_SPACEDIM][Amrvis::LINELENGTH]; int tempInt; // standard defaults @@ -265,7 +261,7 @@ void AVGlobals::GetDefaults(const string &defaultsFile) { skipPltLines = 0; maxPaletteIndex = 255; // dont clip the top palette index (default) boxColor = -1; // invalid - fileType = NEWPLT; // default + fileType = Amrvis::NEWPLT; // default fabIOSize = 0; lowBlack = false; bShowBody = true; @@ -310,7 +306,7 @@ void AVGlobals::GetDefaults(const string &defaultsFile) { } ws(defs); - defs.getline(buffer, BUFSIZ, '\n'); + defs.getline(buffer, Amrvis::BUFSIZE, '\n'); while( ! defs.eof()) { sscanf(buffer,"%s", defaultString); @@ -415,11 +411,11 @@ void AVGlobals::GetDefaults(const string &defaultsFile) { else if(strcmp(defaultString, "filetype") == 0) { sscanf(buffer, "%s%s", defaultString, tempString); if(strcmp(tempString, "fab") == 0) { - fileType = FAB; + fileType = Amrvis::FAB; } else if(strcmp(tempString, "multifab") == 0) { - fileType = MULTIFAB; + fileType = Amrvis::MULTIFAB; } else if(strcmp(tempString, "newplt") == 0) { - fileType = NEWPLT; + fileType = Amrvis::NEWPLT; } else { // error cerr << "Error in defaults file: invalid parameter for filetype: " << tempString << endl; @@ -441,9 +437,9 @@ void AVGlobals::GetDefaults(const string &defaultsFile) { else if(strcmp(defaultString, "initplanes") == 0) { int tempX, tempY, tempZ; sscanf(buffer, "%s%d%d%d", defaultString, &tempX, &tempY, &tempZ); - ivInitialPlanes.setVal(XDIR, tempX); - ivInitialPlanes.setVal(YDIR, tempY); - ivInitialPlanes.setVal(ZDIR, tempZ); + ivInitialPlanes.setVal(Amrvis::XDIR, tempX); + ivInitialPlanes.setVal(Amrvis::YDIR, tempY); + ivInitialPlanes.setVal(Amrvis::ZDIR, tempZ); givenInitialPlanes = true; } #endif @@ -494,7 +490,7 @@ void AVGlobals::GetDefaults(const string &defaultsFile) { } ws(defs); - defs.getline(buffer, BUFSIZ, '\n'); + defs.getline(buffer, Amrvis::BUFSIZE, '\n'); } defs.close(); @@ -704,15 +700,15 @@ void AVGlobals::ParseCommandLine(int argc, char *argv[]) { bCacheAnimFrames = false; # endif } else if(strcmp(argv[i],"-fab") == 0) { - fileType = FAB; + fileType = Amrvis::FAB; } else if(strcmp(argv[i],"-fb") == 0) { - fileType = FAB; + fileType = Amrvis::FAB; } else if(strcmp(argv[i],"-multifab") == 0) { - fileType = MULTIFAB; + fileType = Amrvis::MULTIFAB; } else if(strcmp(argv[i],"-mf") == 0) { - fileType = MULTIFAB; + fileType = Amrvis::MULTIFAB; } else if(strcmp(argv[i],"-newplt") == 0) { - fileType = NEWPLT; + fileType = Amrvis::NEWPLT; } else if(strcmp(argv[i],"-v") == 0) { verbose = true; } else if(strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "-subdomain") == 0) { @@ -818,21 +814,21 @@ void AVGlobals::ParseCommandLine(int argc, char *argv[]) { if(argc-1 atoi(clbx) || atoi(clsy) > atoi(clby) || atoi(clsz) > atoi(clbz)) @@ -1004,25 +1000,25 @@ void AVGlobals::ParseCommandLine(int argc, char *argv[]) { } exit(0); } - comlinebox.setSmall(XDIR, atoi(clsx)); - comlinebox.setSmall(YDIR, atoi(clsy)); - comlinebox.setSmall(ZDIR, atoi(clsz)); - comlinebox.setBig(XDIR, atoi(clbx)); - comlinebox.setBig(YDIR, atoi(clby)); - comlinebox.setBig(ZDIR, atoi(clbz)); + comlinebox.setSmall(Amrvis::XDIR, atoi(clsx)); + comlinebox.setSmall(Amrvis::YDIR, atoi(clsy)); + comlinebox.setSmall(Amrvis::ZDIR, atoi(clsz)); + comlinebox.setBig(Amrvis::XDIR, atoi(clbx)); + comlinebox.setBig(Amrvis::YDIR, atoi(clby)); + comlinebox.setBig(Amrvis::ZDIR, atoi(clbz)); #endif } #if (BL_SPACEDIM == 3) if(givenInitialPlanesOnComline) { - ivInitialPlanes.setVal(XDIR, atoi(clPlaneX)); - ivInitialPlanes.setVal(YDIR, atoi(clPlaneY)); - ivInitialPlanes.setVal(ZDIR, atoi(clPlaneZ)); + ivInitialPlanes.setVal(Amrvis::XDIR, atoi(clPlaneX)); + ivInitialPlanes.setVal(Amrvis::YDIR, atoi(clPlaneY)); + ivInitialPlanes.setVal(Amrvis::ZDIR, atoi(clPlaneZ)); } #endif - if(fileType == INVALIDTYPE) { + if(fileType == Amrvis::INVALIDTYPE) { BoxLib::Abort("Error: invalid file type. Exiting."); } else { if(ParallelDescriptor::IOProcessor()) { @@ -1068,7 +1064,7 @@ bool AVGlobals::GetShowBody() { return bShowBody; } Real AVGlobals::GetBodyOpacity() { return bodyOpacity; } const string &AVGlobals::GetComlineFilename(int i) { return comlinefilename[i]; } -FileType AVGlobals::GetDefaultFileType() { return fileType; } +Amrvis::FileType AVGlobals::GetDefaultFileType() { return fileType; } bool AVGlobals::GivenBox() { return givenBox; } bool AVGlobals::GivenBoxSlice() { return givenBoxSlice; } @@ -1138,17 +1134,17 @@ int AVGlobals::DetermineMaxAllowableLevel(const Box &finestbox, unsigned long boxpoints; while(maxallowablelevel > 0) { # if (BL_SPACEDIM == 2) - boxpoints = static_cast(levelDomain.length(XDIR)) * - static_cast(levelDomain.length(YDIR)); + boxpoints = static_cast(levelDomain.length(Amrvis::XDIR)) * + static_cast(levelDomain.length(Amrvis::YDIR)); # else unsigned long tempLength; - boxpoints = static_cast(levelDomain.length(XDIR)) * - static_cast(levelDomain.length(YDIR)); - tempLength = static_cast(levelDomain.length(YDIR)) * - static_cast(levelDomain.length(ZDIR)); + boxpoints = static_cast(levelDomain.length(Amrvis::XDIR)) * + static_cast(levelDomain.length(Amrvis::YDIR)); + tempLength = static_cast(levelDomain.length(Amrvis::YDIR)) * + static_cast(levelDomain.length(Amrvis::ZDIR)); boxpoints = max(boxpoints, tempLength); - tempLength = static_cast(levelDomain.length(XDIR)) * - static_cast(levelDomain.length(ZDIR)); + tempLength = static_cast(levelDomain.length(Amrvis::XDIR)) * + static_cast(levelDomain.length(Amrvis::ZDIR)); boxpoints = max(boxpoints, tempLength); # endif diff --git a/GraphicsAttributes.H b/GraphicsAttributes.H index 7ec8ca0..0a645b2 100644 --- a/GraphicsAttributes.H +++ b/GraphicsAttributes.H @@ -1,15 +1,10 @@ - -// -// $Id: GraphicsAttributes.H,v 1.18 2001-11-16 01:48:08 vince Exp $ -// - // --------------------------------------------------------------- // GraphicsAttributes.H // --------------------------------------------------------------- #ifndef _GRAPHICSATTRIBUTES_H #define _GRAPHICSATTRIBUTES_H -#include "AmrvisConstants.H" +#include #include using std::ostream; diff --git a/GraphicsAttributes.cpp b/GraphicsAttributes.cpp index 359b384..7194600 100644 --- a/GraphicsAttributes.cpp +++ b/GraphicsAttributes.cpp @@ -1,8 +1,3 @@ - -// -// $Id: GraphicsAttributes.cpp,v 1.21 2008-07-31 22:14:28 vince Exp $ -// - // --------------------------------------------------------------- // GraphicsAttributes.cpp // --------------------------------------------------------------- @@ -13,7 +8,7 @@ using std::cout; using std::cerr; using std::endl; -#include "GraphicsAttributes.H" +#include #include #include #include diff --git a/GridPicture.H b/GridPicture.H index a961884..78ebba4 100644 --- a/GridPicture.H +++ b/GridPicture.H @@ -1,16 +1,11 @@ - -// -// $Id: GridPicture.H,v 1.8 2000-10-02 20:53:08 lijewski Exp $ -// - // --------------------------------------------------------------- // GridPicture.H // --------------------------------------------------------------- #ifndef _GRIDPICTURE_H #define _GRIDPICTURE_H -#include "AmrvisConstants.H" -#include "Box.H" +#include +#include class GridPicture { diff --git a/GridPicture.cpp b/GridPicture.cpp index d0294b4..688d55a 100644 --- a/GridPicture.cpp +++ b/GridPicture.cpp @@ -1,8 +1,8 @@ // ------------------------------------------------------------------- // GridPicture.cpp // ------------------------------------------------------------------- -#include "GridPicture.H" -#include "GlobalUtilities.H" +#include +#include #include #include @@ -29,15 +29,15 @@ void GridPicture::GridPictureInit(int level, imageBox = overlapBox; imageBox.refine(refRatio * currentScale); - if(sliceDir == ZDIR) { - dataSizeH = boxWithData.length(XDIR); - dataSizeV = boxWithData.length(YDIR); - } else if(sliceDir == YDIR) { - dataSizeV = boxWithData.length(ZDIR); - dataSizeH = boxWithData.length(XDIR); + if(sliceDir == Amrvis::ZDIR) { + dataSizeH = boxWithData.length(Amrvis::XDIR); + dataSizeV = boxWithData.length(Amrvis::YDIR); + } else if(sliceDir == Amrvis::YDIR) { + dataSizeV = boxWithData.length(Amrvis::ZDIR); + dataSizeH = boxWithData.length(Amrvis::XDIR); } else { - dataSizeH = boxWithData.length(YDIR); - dataSizeV = boxWithData.length(ZDIR); + dataSizeH = boxWithData.length(Amrvis::YDIR); + dataSizeV = boxWithData.length(Amrvis::ZDIR); } imageSizeH = dataSizeH * refRatio * currentScale; imageSizeV = dataSizeV * refRatio * currentScale; @@ -67,12 +67,12 @@ void GridPicture::ChangeScale(int newScale, int picSizeH, int picSizeV) { // ------------------------------------------------------------------- int GridPicture::HPositionInPicture() { int endLoc; - if(sliceDir == ZDIR) { - endLoc = imageBox.smallEnd()[XDIR]; - } else if(sliceDir == YDIR) { - endLoc = imageBox.smallEnd()[XDIR]; + if(sliceDir == Amrvis::ZDIR) { + endLoc = imageBox.smallEnd()[Amrvis::XDIR]; + } else if(sliceDir == Amrvis::YDIR) { + endLoc = imageBox.smallEnd()[Amrvis::XDIR]; } else { - endLoc = imageBox.smallEnd()[YDIR]; + endLoc = imageBox.smallEnd()[Amrvis::YDIR]; } return (endLoc - ((int) imageSizeH % refRatio)); } @@ -81,15 +81,15 @@ int GridPicture::HPositionInPicture() { // ------------------------------------------------------------------- int GridPicture::VPositionInPicture() { int endLoc, nodeAdjustment; - if(sliceDir == ZDIR) { - endLoc = imageBox.bigEnd()[YDIR]; - nodeAdjustment = imageBox.type()[YDIR] * (currentScale - 1) * refRatio; - } else if(sliceDir == YDIR) { - endLoc = imageBox.bigEnd()[ZDIR]; - nodeAdjustment = imageBox.type()[ZDIR] * (currentScale - 1) * refRatio; + if(sliceDir == Amrvis::ZDIR) { + endLoc = imageBox.bigEnd()[Amrvis::YDIR]; + nodeAdjustment = imageBox.type()[Amrvis::YDIR] * (currentScale - 1) * refRatio; + } else if(sliceDir == Amrvis::YDIR) { + endLoc = imageBox.bigEnd()[Amrvis::ZDIR]; + nodeAdjustment = imageBox.type()[Amrvis::ZDIR] * (currentScale - 1) * refRatio; } else { - endLoc = imageBox.bigEnd()[ZDIR]; - nodeAdjustment = imageBox.type()[ZDIR] * (currentScale - 1) * refRatio; + endLoc = imageBox.bigEnd()[Amrvis::ZDIR]; + nodeAdjustment = imageBox.type()[Amrvis::ZDIR] * (currentScale - 1) * refRatio; } return ((pictureSizeV-1) - endLoc - ((int) imageSizeV % refRatio) - nodeAdjustment); diff --git a/Make.package b/Make.package index 3d3dbed..0962933 100644 --- a/Make.package +++ b/Make.package @@ -1,13 +1,13 @@ -CEXE_headers += AmrPicture.H AmrData.H AmrvisConstants.H \ - DataServices.H Dataset.H \ +CEXE_headers += AmrPicture.H AmrvisConstants.H \ + Dataset.H \ GlobalUtilities.H GraphicsAttributes.H \ GridPicture.H MessageArea.H \ Palette.H PltApp.H Output.H Quaternion.H Point.H \ Trackball.H XYPlotDataList.H XYPlotDefaults.H \ XYPlotWin.H XYPlotParam.H PltAppState.H -CEXE_sources += AmrPicture.cpp AmrData.cpp AmrVisTool.cpp \ - DataServices.cpp Dataset.cpp \ +CEXE_sources += AmrPicture.cpp AmrVisTool.cpp \ + Dataset.cpp \ GraphicsAttributes.cpp GridPicture.cpp \ MessageArea.cpp PltApp.cpp \ GlobalUtilities.cpp Palette.cpp PltAppOutput.cpp \ @@ -36,8 +36,6 @@ ifeq ($(DIM),3) CEXE_sources += ProjectionPicture.cpp ViewTransform.cpp PltApp3D.cpp endif -FEXE_sources += FABUTIL_$(DIM)D.F - ifeq ($(USE_ARRAYVIEW),TRUE) CEXE_sources += DatasetClient.cpp endif diff --git a/MessageArea.H b/MessageArea.H index a9fb287..8129b4b 100644 --- a/MessageArea.H +++ b/MessageArea.H @@ -1,8 +1,3 @@ - -// -// $Id: MessageArea.H,v 1.9 2002-04-03 01:03:47 vince Exp $ -// - // --------------------------------------------------------------- // MessageArea.H // --------------------------------------------------------------- @@ -11,7 +6,7 @@ #include #include -#include "AmrvisConstants.H" +#include class cMessageArea { private: diff --git a/MessageArea.cpp b/MessageArea.cpp index 4bbda16..c6517f1 100644 --- a/MessageArea.cpp +++ b/MessageArea.cpp @@ -1,12 +1,7 @@ - -// -// $Id: MessageArea.cpp,v 1.5 2000-10-02 20:53:08 lijewski Exp $ -// - // --------------------------------------------------------------- // MessageArea.cpp // --------------------------------------------------------------- -#include "MessageArea.H" +#include // ------------------------------------------------------------------- diff --git a/Output.H b/Output.H index 11cc502..7b97528 100644 --- a/Output.H +++ b/Output.H @@ -1,8 +1,3 @@ - -// -// $Id: Output.H,v 1.14 2002-10-02 16:51:36 car Exp $ -// - // --------------------------------------------------------------- // Output.H // --------------------------------------------------------------- @@ -12,8 +7,8 @@ #include #undef index -#include "REAL.H" -#include "Array.H" +#include +#include #include #include #include diff --git a/Output.cpp b/Output.cpp index 45c5a92..b4d289c 100644 --- a/Output.cpp +++ b/Output.cpp @@ -1,18 +1,13 @@ - -// -// $Id: Output.cpp,v 1.39 2010-12-15 23:10:27 vince Exp $ -// - // --------------------------------------------------------------- // Output.cpp // --------------------------------------------------------------- -#include "ParallelDescriptor.H" +#include #include #include #include -#include "Output.H" +#include #include #include diff --git a/Palette.H b/Palette.H index bf14efe..62e9a74 100644 --- a/Palette.H +++ b/Palette.H @@ -1,8 +1,3 @@ - -// -// $Id: Palette.H,v 1.32 2010-12-15 23:10:27 vince Exp $ -// - // --------------------------------------------------------------- // Palette.H // --------------------------------------------------------------- @@ -14,10 +9,10 @@ using std::map; using std::string; -#include "REAL.H" -#include "Array.H" -#include "Array.H" -#include "ParallelDescriptor.H" +#include +#include +#include +#include const int PALLISTLENGTH = 8; const int PALWIDTH = 24; diff --git a/Palette.cpp b/Palette.cpp index d93cde8..a74a0c8 100644 --- a/Palette.cpp +++ b/Palette.cpp @@ -1,14 +1,9 @@ - -// -// $Id: Palette.cpp,v 1.53 2008-07-15 20:55:35 vince Exp $ -// - // --------------------------------------------------------------- // Palette.cpp // --------------------------------------------------------------- -#include "Palette.H" -#include "GlobalUtilities.H" -#include "GraphicsAttributes.H" +#include +#include +#include #include #include diff --git a/PltApp.H b/PltApp.H index e1b8a64..38f0b6d 100644 --- a/PltApp.H +++ b/PltApp.H @@ -1,27 +1,22 @@ - -// -// $Id: PltApp.H,v 1.66 2010-12-15 23:10:27 vince Exp $ -// - // --------------------------------------------------------------- // PltApp.H // --------------------------------------------------------------- #ifndef _PLTAPP_H_ #define _PLTAPP_H_ -#include "ParallelDescriptor.H" +#include #include #include #undef index -#include "AmrvisConstants.H" -#include "Box.H" -#include "Dataset.H" -#include "GlobalUtilities.H" -#include "Palette.H" +#include +#include +#include +#include +#include #if (BL_SPACEDIM==3) -# include "ViewTransform.H" +# include class ProjectionPicture; #endif @@ -145,7 +140,7 @@ public: private: Widget wTopLevel, wAmrVisTopLevel; - Widget wScrollArea[NPLANES], wPlotPlane[NPLANES]; + Widget wScrollArea[Amrvis::NPLANES], wPlotPlane[Amrvis::NPLANES]; Array wRangeRadioButton; Widget wFileRangeCheckBox; Widget wUserMin, wUserMax; @@ -178,11 +173,11 @@ private: XYPlotWin *XYplotwin[BL_SPACEDIM]; XtAppContext appContext; - Arg args[MAXARGS]; + Arg args[Amrvis::MAXARGS]; Palette *pltPaletteptr; - AmrPicture *amrPicturePtrArray[NPLANES]; + AmrPicture *amrPicturePtrArray[Amrvis::NPLANES]; IntVect ivLowOffsetMAL; // at maxAllowableLevel - MinMaxRangeType currentRangeType; + Amrvis::MinMaxRangeType currentRangeType; bool animating2d, setRangeShowing, contoursShowing, infoShowing, bFormatShowing; bool bSetRangeRedraw; bool datasetShowing, paletteDrawn, writingRGB, interfaceReady; @@ -202,7 +197,7 @@ private: Array fileNames; Array frameBuffer; vector readyFrames; - AnimDirection animDirection; + Amrvis::AnimDirection animDirection; XtIntervalId animationIId, multiclickIId; Real finestDx[BL_SPACEDIM], gridOffset[BL_SPACEDIM]; String trans; @@ -250,7 +245,7 @@ private: void DrawAxes(Widget, int, int, int, char *, char *, int); void ResetAnimation(); void StopAnimation(); - void Animate(AnimDirection direction); + void Animate(Amrvis::AnimDirection direction); void ShowFrame(); void DirtyFrames(); void DoRubberBanding(Widget, XtPointer, XtPointer); @@ -318,7 +313,7 @@ private: void Clear(); #endif - void FindAndSetMinMax(const MinMaxRangeType mmrangetype, const int framenumber, + void FindAndSetMinMax(const Amrvis::MinMaxRangeType mmrangetype, const int framenumber, const string ¤tderived, const int derivednumber, const Array &onBox, const int coarselevel, const int finelevel, diff --git a/PltApp.cpp b/PltApp.cpp index cea562e..ad0244d 100644 --- a/PltApp.cpp +++ b/PltApp.cpp @@ -1,22 +1,17 @@ - -// -// $Id: PltApp.cpp,v 1.140 2010-12-15 23:10:27 vince Exp $ -// - // --------------------------------------------------------------- // PltApp.cpp // --------------------------------------------------------------- #include -#include "PltApp.H" -#include "PltAppState.H" -#include "AmrPicture.H" -#include "DataServices.H" -#include "GraphicsAttributes.H" -#include "ProjectionPicture.H" -#include "XYPlotWin.H" -#include "ParallelDescriptor.H" +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -65,10 +60,10 @@ const int MAXSCALE(32); #define MARK fprintf(stderr, "Mark at file %s, line %d.\n", __FILE__, __LINE__) -static bool UsingFileRange(const MinMaxRangeType rt) { - return(rt == FILEGLOBALMINMAX || - rt == FILESUBREGIONMINMAX || - rt == FILEUSERMINMAX); +static bool UsingFileRange(const Amrvis::MinMaxRangeType rt) { + return(rt == Amrvis::FILEGLOBALMINMAX || + rt == Amrvis::FILESUBREGIONMINMAX || + rt == Amrvis::FILEUSERMINMAX); } @@ -76,14 +71,14 @@ static bool UsingFileRange(const MinMaxRangeType rt) { PltApp::~PltApp() { int np; #if (BL_SPACEDIM == 3) - for(np = 0; np != NPLANES; ++np) { + for(np = 0; np != Amrvis::NPLANES; ++np) { amrPicturePtrArray[np]->DoStop(); } #endif if(animating2d) { StopAnimation(); } - for(np = 0; np != NPLANES; ++np) { + for(np = 0; np != Amrvis::NPLANES; ++np) { delete amrPicturePtrArray[np]; } #if (BL_SPACEDIM == 3) @@ -110,7 +105,7 @@ PltApp::PltApp(XtAppContext app, Widget w, const string &filename, const Array &dataservicesptr, bool isAnim) : wTopLevel(w), appContext(app), - currentRangeType(GLOBALMINMAX), + currentRangeType(Amrvis::GLOBALMINMAX), animating2d(isAnim), paletteDrawn(false), currentFrame(0), @@ -130,8 +125,8 @@ PltApp::PltApp(XtAppContext app, Widget w, const string &filename, int i; - char header[BUFSIZ]; - ostrstream headerout(header, BUFSIZ); + char header[Amrvis::BUFSIZE]; + ostrstream headerout(header, Amrvis::BUFSIZE); if(animating2d) { animFrames = AVGlobals::GetFileCount(); @@ -152,7 +147,7 @@ PltApp::PltApp(XtAppContext app, Widget w, const string &filename, } pltAppState = new PltAppState(animFrames, amrData.NumDeriveFunc()); - pltAppState->SetContourType(RASTERONLY); + pltAppState->SetContourType(Amrvis::RASTERONLY); pltAppState->SetCurrentFrame(currentFrame); // Set the delete response to DO_NOTHING so that it can be app defined. @@ -196,8 +191,8 @@ PltApp::PltApp(XtAppContext app, Widget w, const string &filename, pltAppState->SetMinDrawnLevel(minAllowableLevel); pltAppState->SetMaxDrawnLevel(maxlev); Box maxDomain(amrData.ProbDomain()[maxlev]); - unsigned long dataSize(static_cast(maxDomain.length(XDIR)) * - static_cast(maxDomain.length(YDIR))); + unsigned long dataSize(static_cast(maxDomain.length(Amrvis::XDIR)) * + static_cast(maxDomain.length(Amrvis::YDIR))); if(AVGlobals::MaxPictureSize() == 0) { maxAllowableScale = 1; } else { @@ -208,7 +203,7 @@ PltApp::PltApp(XtAppContext app, Widget w, const string &filename, pltAppState->SetCurrentScale(currentScale); pltAppState->SetMaxScale(maxAllowableScale); - pltAppState->SetMinMaxRangeType(GLOBALMINMAX); + pltAppState->SetMinMaxRangeType(Amrvis::GLOBALMINMAX); Real rGlobalMin, rGlobalMax; rGlobalMin = std::numeric_limits::max(); rGlobalMax = -std::numeric_limits::max(); @@ -220,18 +215,18 @@ PltApp::PltApp(XtAppContext app, Widget w, const string &filename, for(int iFrame(0); iFrame < animFrames; ++iFrame) { Real rFileMin, rFileMax; - FindAndSetMinMax(FILEGLOBALMINMAX, iFrame, asCDer, iCDerNum, + FindAndSetMinMax(Amrvis::FILEGLOBALMINMAX, iFrame, asCDer, iCDerNum, onBox, coarseLevel, fineLevel, false); // dont reset if set - pltAppState->GetMinMax(FILEGLOBALMINMAX, iFrame, iCDerNum, + pltAppState->GetMinMax(Amrvis::FILEGLOBALMINMAX, iFrame, iCDerNum, rFileMin, rFileMax); rGlobalMin = min(rFileMin, rGlobalMin); rGlobalMax = max(rFileMax, rGlobalMax); // also set FILESUBREGIONMINMAXs and FILEUSERMINMAXs to the global values - pltAppState->SetMinMax(FILESUBREGIONMINMAX, iFrame, + pltAppState->SetMinMax(Amrvis::FILESUBREGIONMINMAX, iFrame, pltAppState->CurrentDerivedNumber(), rFileMin, rFileMax); - pltAppState->SetMinMax(FILEUSERMINMAX, iFrame, + pltAppState->SetMinMax(Amrvis::FILEUSERMINMAX, iFrame, pltAppState->CurrentDerivedNumber(), rFileMin, rFileMax); } // end for(iFrame...) @@ -239,43 +234,43 @@ PltApp::PltApp(XtAppContext app, Widget w, const string &filename, // now set global values for each file in the animation for(int iFrame(0); iFrame < animFrames; ++iFrame) { // set GLOBALMINMAXs - pltAppState->SetMinMax(GLOBALMINMAX, iFrame, + pltAppState->SetMinMax(Amrvis::GLOBALMINMAX, iFrame, pltAppState->CurrentDerivedNumber(), rGlobalMin, rGlobalMax); // also set SUBREGIONMINMAXs and USERMINMAXs to the global values - pltAppState->SetMinMax(SUBREGIONMINMAX, iFrame, + pltAppState->SetMinMax(Amrvis::SUBREGIONMINMAX, iFrame, pltAppState->CurrentDerivedNumber(), rGlobalMin, rGlobalMax); - pltAppState->SetMinMax(USERMINMAX, iFrame, + pltAppState->SetMinMax(Amrvis::USERMINMAX, iFrame, pltAppState->CurrentDerivedNumber(), rGlobalMin, rGlobalMax); } // end for(iFrame...) if(AVGlobals::UseSpecifiedMinMax()) { - pltAppState->SetMinMaxRangeType(USERMINMAX); + pltAppState->SetMinMaxRangeType(Amrvis::USERMINMAX); Real specifiedMin, specifiedMax; AVGlobals::GetSpecifiedMinMax(specifiedMin, specifiedMax); for(int iFrame(0); iFrame < animFrames; ++iFrame) { - pltAppState->SetMinMax(USERMINMAX, iFrame, + pltAppState->SetMinMax(Amrvis::USERMINMAX, iFrame, pltAppState->CurrentDerivedNumber(), specifiedMin, specifiedMax); - pltAppState->SetMinMax(FILEUSERMINMAX, iFrame, + pltAppState->SetMinMax(Amrvis::FILEUSERMINMAX, iFrame, pltAppState->CurrentDerivedNumber(), specifiedMin, specifiedMax); } } - amrPicturePtrArray[ZPLANE] = new AmrPicture(gaPtr, this, pltAppState, + amrPicturePtrArray[Amrvis::ZPLANE] = new AmrPicture(gaPtr, this, pltAppState, dataServicesPtr[currentFrame], bCartGridSmoothing); #if (BL_SPACEDIM == 3) - amrPicturePtrArray[YPLANE] = new AmrPicture(YPLANE, gaPtr, + amrPicturePtrArray[Amrvis::YPLANE] = new AmrPicture(Amrvis::YPLANE, gaPtr, amrData.ProbDomain()[finestLevel], NULL, this, pltAppState, bCartGridSmoothing); - amrPicturePtrArray[XPLANE] = new AmrPicture(XPLANE, gaPtr, + amrPicturePtrArray[Amrvis::XPLANE] = new AmrPicture(Amrvis::XPLANE, gaPtr, amrData.ProbDomain()[finestLevel], NULL, this, pltAppState, @@ -323,7 +318,7 @@ PltApp::PltApp(XtAppContext app, Widget w, const Box ®ion, #endif contourNumString = pltParent->contourNumString.c_str(); - char header[BUFSIZ]; + char header[Amrvis::BUFSIZE]; bCartGridSmoothing = pltParent->bCartGridSmoothing; int finestLevel(amrData.FinestLevel()); @@ -349,7 +344,7 @@ PltApp::PltApp(XtAppContext app, Widget w, const Box ®ion, amrData.RefRatio())); } - unsigned long dataSize(maxDomain.length(XDIR) * maxDomain.length(YDIR)); + unsigned long dataSize(maxDomain.length(Amrvis::XDIR) * maxDomain.length(Amrvis::YDIR)); if(AVGlobals::MaxPictureSize() / dataSize == 0) { maxAllowableScale = 1; } else { @@ -384,11 +379,11 @@ PltApp::PltApp(XtAppContext app, Widget w, const Box ®ion, // these do not change for a subregion // set FILESUBREGIONMINMAX - FindAndSetMinMax(FILESUBREGIONMINMAX, iFrame, asCDer, iCDerNum, onBox, + FindAndSetMinMax(Amrvis::FILESUBREGIONMINMAX, iFrame, asCDer, iCDerNum, onBox, coarseLevel, fineLevel, true); // reset if already set Real rTempMin, rTempMax; - pltAppState->GetMinMax(FILESUBREGIONMINMAX, iFrame, iCDerNum, + pltAppState->GetMinMax(Amrvis::FILESUBREGIONMINMAX, iFrame, iCDerNum, rTempMin, rTempMax); // collect file values rSMin = min(rSMin, rTempMin); @@ -396,7 +391,7 @@ PltApp::PltApp(XtAppContext app, Widget w, const Box ®ion, } // now set each frame's SUBREGIONMINMAX to the overall subregion minmax for(int iFrame(0); iFrame < animFrames; ++iFrame) { - pltAppState->SetMinMax(SUBREGIONMINMAX, iFrame, iCDerNum, rSMin, rSMax); + pltAppState->SetMinMax(Amrvis::SUBREGIONMINMAX, iFrame, iCDerNum, rSMin, rSMax); } // --------------- @@ -409,7 +404,7 @@ PltApp::PltApp(XtAppContext app, Widget w, const Box ®ion, timeOut << " T = " << amrData.Time() << ends; } - ostrstream headerout(header, BUFSIZ); + ostrstream headerout(header, Amrvis::BUFSIZE); headerout << AVGlobals::StripSlashes(fileName) << timestr << " Subregion: " << maxDomain << " on level " << maxlev << ends; @@ -435,7 +430,7 @@ PltApp::PltApp(XtAppContext app, Widget w, const Box ®ion, if(gaPtr->PVisual() != XDefaultVisual(display, gaPtr->PScreenNumber())) { XtVaSetValues(wAmrVisTopLevel, XmNvisual, gaPtr->PVisual(), XmNdepth, 8, NULL); } - for(int np(0); np < NPLANES; ++np) { + for(int np(0); np < Amrvis::NPLANES; ++np) { amrPicturePtrArray[np] = new AmrPicture(np, gaPtr, region, pltParent, this, pltAppState, @@ -458,7 +453,7 @@ void PltApp::PltAppInit(bool bSubVolume) { const AmrData &amrData = dataServicesPtr[currentFrame]->AmrDataRef(); int minAllowableLevel(pltAppState->MinAllowableLevel()); int maxAllowableLevel(pltAppState->MaxAllowableLevel()); - wRangeRadioButton.resize(BNUMBEROFMINMAX); + wRangeRadioButton.resize(Amrvis::BNUMBEROFMINMAX); // User defined widget destroy callback -- will free all memory used to create // window. @@ -481,7 +476,7 @@ void PltApp::PltAppInit(bool bSubVolume) { placementOffsetY += 20; servingButton = 0; - activeView = ZPLANE; + activeView = Amrvis::ZPLANE; int maxDrawnLevel(maxAllowableLevel); startX = 0; startY = 0; @@ -498,7 +493,7 @@ void PltApp::PltAppInit(bool bSubVolume) { selectionBox.setSmall(IntVect::TheZeroVector()); selectionBox.setBig(IntVect::TheZeroVector()); - for(np = 0; np != NPLANES; ++np) { + for(np = 0; np != Amrvis::NPLANES; ++np) { amrPicturePtrArray[np]->SetFrameSpeed(frameSpeed); amrPicturePtrArray[np]->SetRegion(startX, startY, endX, endY); } @@ -1037,7 +1032,7 @@ void PltApp::PltAppInit(bool bSubVolume) { XtVaGetValues(wAnimLabelFast, XmNwidth, &slw, NULL); XtVaSetValues(wAnimLabelFast, XmNx, wcfWidth - slw, NULL); - char cTempFN[BUFSIZ]; + char cTempFN[Amrvis::BUFSIZE]; strcpy(cTempFN, AVGlobals::StripSlashes(fileNames[currentFrame]).c_str()); XmString fileString = XmStringCreateSimple(cTempFN); wWhichFileLabel = XtVaCreateManagedWidget("whichFileLabel", @@ -1049,8 +1044,8 @@ void PltApp::PltAppInit(bool bSubVolume) { XmStringFree(fileString); // We add a which-time label to indicate the time of each plot file. - char tempTimeName[LINELENGTH]; - ostrstream tempTimeOut(tempTimeName, LINELENGTH); + char tempTimeName[Amrvis::LINELENGTH]; + ostrstream tempTimeOut(tempTimeName, Amrvis::LINELENGTH); tempTimeOut << "T=" << amrData.Time() << ends; XmString timeString = XmStringCreateSimple(tempTimeName); wWhichTimeLabel = XtVaCreateManagedWidget("whichTimeLabel", @@ -1118,7 +1113,7 @@ void PltApp::PltAppInit(bool bSubVolume) { XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, wLocArea, NULL); - wScrollArea[ZPLANE] = XtVaCreateManagedWidget("scrollAreaXY", + wScrollArea[Amrvis::ZPLANE] = XtVaCreateManagedWidget("scrollAreaXY", xmScrolledWindowWidgetClass, wPlotArea, XmNleftAttachment, XmATTACH_FORM, @@ -1139,20 +1134,20 @@ void PltApp::PltAppInit(bool bSubVolume) { : DrawingAreaInput() ManagerGadgetButtonMotion() \n\ : DrawingAreaInput() ManagerGadgetButtonMotion()"; - wPlotPlane[ZPLANE] = XtVaCreateManagedWidget("plotArea", - xmDrawingAreaWidgetClass, wScrollArea[ZPLANE], + wPlotPlane[Amrvis::ZPLANE] = XtVaCreateManagedWidget("plotArea", + xmDrawingAreaWidgetClass, wScrollArea[Amrvis::ZPLANE], XmNtranslations, XtParseTranslationTable(trans), - XmNwidth, amrPicturePtrArray[ZPLANE]->ImageSizeH() + 1, - XmNheight, amrPicturePtrArray[ZPLANE]->ImageSizeV() + 1, + XmNwidth, amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeH() + 1, + XmNheight, amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeV() + 1, NULL); - XtVaSetValues(wScrollArea[ZPLANE], XmNworkWindow, wPlotPlane[ZPLANE], NULL); + XtVaSetValues(wScrollArea[Amrvis::ZPLANE], XmNworkWindow, wPlotPlane[Amrvis::ZPLANE], NULL); #if (BL_SPACEDIM == 2) - XtVaSetValues(wScrollArea[ZPLANE], XmNbottomAttachment, XmATTACH_FORM, + XtVaSetValues(wScrollArea[Amrvis::ZPLANE], XmNbottomAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL); #elif (BL_SPACEDIM == 3) XtVaSetValues(wAmrVisTopLevel, XmNwidth, 1100, XmNheight, 650, NULL); - XtVaSetValues(wScrollArea[ZPLANE], + XtVaSetValues(wScrollArea[Amrvis::ZPLANE], XmNrightAttachment, XmATTACH_POSITION, XmNrightPosition, 50, // % XmNbottomAttachment, XmATTACH_POSITION, @@ -1160,12 +1155,12 @@ void PltApp::PltAppInit(bool bSubVolume) { NULL); // ********************************************************* XZ - wScrollArea[YPLANE] = + wScrollArea[Amrvis::YPLANE] = XtVaCreateManagedWidget("scrollAreaXZ", xmScrolledWindowWidgetClass, wPlotArea, XmNrightAttachment, XmATTACH_FORM, XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, wScrollArea[ZPLANE], + XmNleftWidget, wScrollArea[Amrvis::ZPLANE], XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 50, XmNtopAttachment, XmATTACH_FORM, @@ -1173,16 +1168,16 @@ void PltApp::PltAppInit(bool bSubVolume) { XmNscrollingPolicy, XmAUTOMATIC, NULL); - wPlotPlane[YPLANE] = XtVaCreateManagedWidget("plotArea", - xmDrawingAreaWidgetClass, wScrollArea[YPLANE], + wPlotPlane[Amrvis::YPLANE] = XtVaCreateManagedWidget("plotArea", + xmDrawingAreaWidgetClass, wScrollArea[Amrvis::YPLANE], XmNtranslations, XtParseTranslationTable(trans), - XmNwidth, amrPicturePtrArray[YPLANE]->ImageSizeH() + 1, - XmNheight, amrPicturePtrArray[YPLANE]->ImageSizeV() + 1, + XmNwidth, amrPicturePtrArray[Amrvis::YPLANE]->ImageSizeH() + 1, + XmNheight, amrPicturePtrArray[Amrvis::YPLANE]->ImageSizeV() + 1, NULL); - XtVaSetValues(wScrollArea[YPLANE], XmNworkWindow, wPlotPlane[YPLANE], NULL); + XtVaSetValues(wScrollArea[Amrvis::YPLANE], XmNworkWindow, wPlotPlane[Amrvis::YPLANE], NULL); // ********************************************************* YZ - wScrollArea[XPLANE] = + wScrollArea[Amrvis::XPLANE] = XtVaCreateManagedWidget("scrollAreaYZ", xmScrolledWindowWidgetClass, wPlotArea, XmNbottomAttachment, XmATTACH_FORM, @@ -1194,20 +1189,20 @@ void PltApp::PltAppInit(bool bSubVolume) { XmNscrollingPolicy, XmAUTOMATIC, NULL); - wPlotPlane[XPLANE] = XtVaCreateManagedWidget("plotArea", - xmDrawingAreaWidgetClass, wScrollArea[XPLANE], + wPlotPlane[Amrvis::XPLANE] = XtVaCreateManagedWidget("plotArea", + xmDrawingAreaWidgetClass, wScrollArea[Amrvis::XPLANE], XmNtranslations, XtParseTranslationTable(trans), - XmNwidth, amrPicturePtrArray[XPLANE]->ImageSizeH() + 1, - XmNheight, amrPicturePtrArray[XPLANE]->ImageSizeV() + 1, + XmNwidth, amrPicturePtrArray[Amrvis::XPLANE]->ImageSizeH() + 1, + XmNheight, amrPicturePtrArray[Amrvis::XPLANE]->ImageSizeV() + 1, NULL); - XtVaSetValues(wScrollArea[XPLANE], XmNworkWindow, wPlotPlane[XPLANE], NULL); + XtVaSetValues(wScrollArea[Amrvis::XPLANE], XmNworkWindow, wPlotPlane[Amrvis::XPLANE], NULL); // ****************************************** Transform Area & buttons wOrientXY = XtVaCreateManagedWidget("XY", xmPushButtonGadgetClass, wPlotArea, XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, wScrollArea[XPLANE], - XmNleftOffset, WOFFSET, + XmNleftWidget, wScrollArea[Amrvis::XPLANE], + XmNleftOffset, Amrvis::WOFFSET, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 50, NULL); @@ -1219,7 +1214,7 @@ void PltApp::PltAppInit(bool bSubVolume) { xmPushButtonGadgetClass, wPlotArea, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wOrientXY, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 50, NULL); @@ -1231,7 +1226,7 @@ void PltApp::PltAppInit(bool bSubVolume) { xmPushButtonGadgetClass, wPlotArea, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wOrientYZ, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 50, NULL); @@ -1243,7 +1238,7 @@ void PltApp::PltAppInit(bool bSubVolume) { xmPushButtonGadgetClass, wPlotArea, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wOrientXZ, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 50, NULL); @@ -1255,7 +1250,7 @@ void PltApp::PltAppInit(bool bSubVolume) { xmPushButtonGadgetClass, wPlotArea, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wLabelAxes, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 50, NULL); AddStaticCallback(wRender, XmNactivateCallback, &PltApp::DoRender); @@ -1268,7 +1263,7 @@ void PltApp::PltAppInit(bool bSubVolume) { wPlotArea, XmNlabelString, sDetach, XmNrightAttachment, XmATTACH_FORM, - XmNrightOffset, WOFFSET, + XmNrightOffset, Amrvis::WOFFSET, XmNtopAttachment, XmATTACH_POSITION, XmNtopPosition, 50, NULL); @@ -1280,7 +1275,7 @@ void PltApp::PltAppInit(bool bSubVolume) { wPlotArea, XmNtranslations, XtParseTranslationTable(trans), XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, wScrollArea[XPLANE], + XmNleftWidget, wScrollArea[Amrvis::XPLANE], XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, wOrientXY, XmNrightAttachment, XmATTACH_FORM, @@ -1289,7 +1284,7 @@ void PltApp::PltAppInit(bool bSubVolume) { #endif - for(np = 0; np < NPLANES; ++np) { + for(np = 0; np < Amrvis::NPLANES; ++np) { AddStaticCallback(wPlotPlane[np], XmNinputCallback, &PltApp::DoRubberBanding, (XtPointer) np); AddStaticEventHandler(wPlotPlane[np], ExposureMask, &PltApp::PADoExposePicture, @@ -1308,7 +1303,7 @@ void PltApp::PltAppInit(bool bSubVolume) { pltPaletteptr->SetWindowPalette(palFilename, XtWindow(wPalArea)); pltPaletteptr->SetWindowPalette(palFilename, XtWindow(wPlotArea)); pltPaletteptr->SetWindowPalette(palFilename, XtWindow(wAmrVisTopLevel)); - for(np = 0; np != NPLANES; ++np) { + for(np = 0; np != Amrvis::NPLANES; ++np) { pltPaletteptr->SetWindowPalette(palFilename, XtWindow(wPlotPlane[np])); } @@ -1333,7 +1328,7 @@ void PltApp::PltAppInit(bool bSubVolume) { sprintf(plottertitle, "XYPlot%dd", BL_SPACEDIM); XYplotparameters = new XYPlotParameters(pltPaletteptr, gaPtr, plottertitle); - for(np = 0; np < NPLANES; ++np) { + for(np = 0; np < Amrvis::NPLANES; ++np) { amrPicturePtrArray[np]->CreatePicture(XtWindow(wPlotPlane[np]), pltPaletteptr); } @@ -1343,7 +1338,7 @@ void PltApp::PltAppInit(bool bSubVolume) { labelAxes = false; transDetached = false; - for(np = 0; np < NPLANES; ++np) { + for(np = 0; np < Amrvis::NPLANES; ++np) { startcutX[np] = 0; startcutY[np] = amrPicturePtrArray[np]->GetHLine(); finishcutX[np] = 0; @@ -1373,7 +1368,7 @@ void PltApp::PltAppInit(bool bSubVolume) { // ------------------------------------------------------------------- -void PltApp::FindAndSetMinMax(const MinMaxRangeType mmrangetype, +void PltApp::FindAndSetMinMax(const Amrvis::MinMaxRangeType mmrangetype, const int framenumber, const string ¤tderived, const int derivednumber, @@ -1408,7 +1403,7 @@ void PltApp::DoExposeRef(Widget, XtPointer, XtPointer) { int zPlanePosX(10), zPlanePosY(15); int whiteColor(pltPaletteptr->WhiteIndex()); int zpColor(whiteColor); - char sX[LINELENGTH], sY[LINELENGTH], sZ[LINELENGTH]; + char sX[Amrvis::LINELENGTH], sY[Amrvis::LINELENGTH], sZ[Amrvis::LINELENGTH]; int maxAllowLev(pltAppState->MaxAllowableLevel()); int maxDrawnLev(pltAppState->MaxDrawnLevel()); @@ -1431,7 +1426,7 @@ void PltApp::DoExposeRef(Widget, XtPointer, XtPointer) { int yPlanePosX(80), yPlanePosY(15); int xPlanePosX(10); int xPlanePosY((int) (axisLength + zPlanePosY + 1.4 * stringOffsetY)); - char temp[LINELENGTH]; + char temp[Amrvis::LINELENGTH]; Dimension width, height; XtVaGetValues(wControlForm, XmNwidth, &width, XmNheight, &height, NULL); int centerX((int) width / 2); @@ -1440,19 +1435,19 @@ void PltApp::DoExposeRef(Widget, XtPointer, XtPointer) { DrawAxes(wControlForm, yPlanePosX, yPlanePosY, 0, sX, sZ, ypColor); DrawAxes(wControlForm, xPlanePosX, xPlanePosY, 0, sY, sZ, xpColor); - sprintf(temp, "Z=%i", amrPicturePtrArray[ZPLANE]->GetSlice() / crrDiff); + sprintf(temp, "Z=%i", amrPicturePtrArray[Amrvis::ZPLANE]->GetSlice() / crrDiff); XSetForeground(display, xgc, pltPaletteptr->makePixel(zpColor)); XDrawString(display, XtWindow(wControlForm), xgc, centerX-xyzAxisLength+12, centerY+xyzAxisLength+4, temp, strlen(temp)); - sprintf(temp, "Y=%i", amrPicturePtrArray[YPLANE]->GetSlice() / crrDiff); + sprintf(temp, "Y=%i", amrPicturePtrArray[Amrvis::YPLANE]->GetSlice() / crrDiff); XSetForeground(display, xgc, pltPaletteptr->makePixel(ypColor)); XDrawString(display, XtWindow(wControlForm), xgc, centerX+stringOffsetX, centerY-xyzAxisLength+4, temp, strlen(temp)); - sprintf(temp, "X=%i", amrPicturePtrArray[XPLANE]->GetSlice() / crrDiff); + sprintf(temp, "X=%i", amrPicturePtrArray[Amrvis::XPLANE]->GetSlice() / crrDiff); XSetForeground(display, xgc, pltPaletteptr->makePixel(xpColor)); XDrawString(display, XtWindow(wControlForm), xgc, centerX+4*stringOffsetX, centerY+stringOffsetY+2, @@ -1477,7 +1472,7 @@ void PltApp::DrawAxes(Widget wArea, int xpos, int ypos, int /* orientation */ , char *hlabel, char *vlabel, int color) { int axisLength(20); - char hLabel[LINELENGTH], vLabel[LINELENGTH]; + char hLabel[Amrvis::LINELENGTH], vLabel[Amrvis::LINELENGTH]; strcpy(hLabel, hlabel); strcpy(vLabel, vlabel); XSetForeground(XtDisplay(wArea), xgc, pltPaletteptr->makePixel(color)); @@ -1509,7 +1504,7 @@ void PltApp::ChangeScale(Widget w, XtPointer client_data, XtPointer) { ResetAnimation(); DirtyFrames(); } - for(int whichView(0); whichView < NPLANES; ++whichView) { + for(int whichView(0); whichView < Amrvis::NPLANES; ++whichView) { if(whichView == activeView) { startX = (int) startX / previousScale * currentScale; startY = (int) startY / previousScale * currentScale; @@ -1562,11 +1557,11 @@ void PltApp::ChangeLevel(Widget w, XtPointer client_data, XtPointer) { pltAppState->SetMinDrawnLevel(minDrawnLevel); pltAppState->SetMaxDrawnLevel(maxDrawnLevel); - for(int whichView(0); whichView < NPLANES; ++whichView) { + for(int whichView(0); whichView < Amrvis::NPLANES; ++whichView) { amrPicturePtrArray[whichView]->APChangeLevel(); #if (BL_SPACEDIM == 3) - if(whichView == ZPLANE) { + if(whichView == Amrvis::ZPLANE) { #if defined(BL_VOLUMERENDER) || defined(BL_PARALLELVOLUMERENDER) if( ! XmToggleButtonGetState(wAutoDraw)) { projPicturePtr->MakeBoxes(); @@ -1584,9 +1579,9 @@ void PltApp::ChangeLevel(Widget w, XtPointer client_data, XtPointer) { if(datasetShowing) { int hdir(-1), vdir(-1), sdir(-1); - if(activeView==ZPLANE) { hdir = XDIR; vdir = YDIR; sdir = ZDIR; } - if(activeView==YPLANE) { hdir = XDIR; vdir = ZDIR; sdir = YDIR; } - if(activeView==XPLANE) { hdir = YDIR; vdir = ZDIR; sdir = XDIR; } + if(activeView==Amrvis::ZPLANE) { hdir = Amrvis::XDIR; vdir = Amrvis::YDIR; sdir = Amrvis::ZDIR; } + if(activeView==Amrvis::YPLANE) { hdir = Amrvis::XDIR; vdir = Amrvis::ZDIR; sdir = Amrvis::YDIR; } + if(activeView==Amrvis::XPLANE) { hdir = Amrvis::YDIR; vdir = Amrvis::ZDIR; sdir = Amrvis::XDIR; } datasetPtr->DatasetRender(trueRegion, amrPicturePtrArray[activeView], this, pltAppState, hdir, vdir, sdir); datasetPtr->DoExpose(false); @@ -1614,7 +1609,7 @@ void PltApp::ChangeDerived(Widget w, XtPointer client_data, XtPointer) { const AmrData &amrData = dataServicesPtr[currentFrame]->AmrDataRef(); // possibly set all six minmax types here - const Array &onSubregionBox = amrPicturePtrArray[ZPLANE]->GetSubDomain(); + const Array &onSubregionBox = amrPicturePtrArray[Amrvis::ZPLANE]->GetSubDomain(); const Array &onBox(amrData.ProbDomain()); int iCDerNum(pltAppState->CurrentDerivedNumber()); int coarseLevel(pltAppState->MinAllowableLevel()); @@ -1628,43 +1623,43 @@ void PltApp::ChangeDerived(Widget w, XtPointer client_data, XtPointer) { const string asCDer(pltAppState->CurrentDerived()); for(int iFrame(0); iFrame < animFrames; ++iFrame) { // set FILEGLOBALMINMAX dont reset if already set - FindAndSetMinMax(FILEGLOBALMINMAX, iFrame, asCDer, iCDerNum, onBox, + FindAndSetMinMax(Amrvis::FILEGLOBALMINMAX, iFrame, asCDer, iCDerNum, onBox, coarseLevel, fineLevel, false); // set FILESUBREGIONMINMAX dont reset if already set - FindAndSetMinMax(FILESUBREGIONMINMAX, iFrame, asCDer, iCDerNum, onSubregionBox, + FindAndSetMinMax(Amrvis::FILESUBREGIONMINMAX, iFrame, asCDer, iCDerNum, onSubregionBox, coarseLevel, fineLevel, false); // collect file values Real rTempMin, rTempMax; - pltAppState->GetMinMax(FILEGLOBALMINMAX, iFrame, iCDerNum, + pltAppState->GetMinMax(Amrvis::FILEGLOBALMINMAX, iFrame, iCDerNum, rTempMin, rTempMax); rGlobalMin = min(rGlobalMin, rTempMin); rGlobalMax = max(rGlobalMax, rTempMax); - pltAppState->GetMinMax(FILESUBREGIONMINMAX, iFrame, iCDerNum, + pltAppState->GetMinMax(Amrvis::FILESUBREGIONMINMAX, iFrame, iCDerNum, rTempMin, rTempMax); rSubregionMin = min(rSubregionMin, rTempMin); rSubregionMax = max(rSubregionMax, rTempMax); // set FILEUSERMINMAX dont reset if already set // this sets values to FILESUBREGIONMINMAX values if the user has not set them - bool isSet(pltAppState->IsSet(FILEUSERMINMAX, iFrame, iCDerNum)); + bool isSet(pltAppState->IsSet(Amrvis::FILEUSERMINMAX, iFrame, iCDerNum)); if( ! isSet) { - pltAppState->SetMinMax(FILEUSERMINMAX, iFrame, iCDerNum, rTempMin, rTempMax); + pltAppState->SetMinMax(Amrvis::FILEUSERMINMAX, iFrame, iCDerNum, rTempMin, rTempMax); } } for(int iFrame(0); iFrame < animFrames; ++iFrame) { - pltAppState->SetMinMax(GLOBALMINMAX, iFrame, iCDerNum, rGlobalMin, rGlobalMax); - pltAppState->SetMinMax(SUBREGIONMINMAX, iFrame, iCDerNum, + pltAppState->SetMinMax(Amrvis::GLOBALMINMAX, iFrame, iCDerNum, rGlobalMin, rGlobalMax); + pltAppState->SetMinMax(Amrvis::SUBREGIONMINMAX, iFrame, iCDerNum, rSubregionMin, rSubregionMax); // set FILEUSERMINMAX dont reset if already set // this sets values to FILESUBREGIONMINMAX values if the user has not set them - bool isSet(pltAppState->IsSet(USERMINMAX, iFrame, iCDerNum)); + bool isSet(pltAppState->IsSet(Amrvis::USERMINMAX, iFrame, iCDerNum)); if( ! isSet) { - pltAppState->SetMinMax(USERMINMAX, iFrame, iCDerNum, + pltAppState->SetMinMax(Amrvis::USERMINMAX, iFrame, iCDerNum, rSubregionMin, rSubregionMax); } } @@ -1735,15 +1730,15 @@ void PltApp::ChangeDerived(Widget w, XtPointer client_data, XtPointer) { XtVaSetValues(wPlotLabel, XmNlabelString, label_str, NULL); XmStringFree(label_str); - for(int iv(0); iv < NPLANES; ++iv) { + for(int iv(0); iv < Amrvis::NPLANES; ++iv) { amrPicturePtrArray[iv]->APMakeImages(pltPaletteptr); } if(datasetShowing) { int hdir(-1), vdir(-1), sdir(-1); - hdir = (activeView == XPLANE) ? YDIR : XDIR; - vdir = (activeView == ZPLANE) ? YDIR : ZDIR; - sdir = (activeView == YPLANE) ? YDIR : ((activeView == XYPLANE) ? XDIR : ZDIR); + hdir = (activeView == Amrvis::XPLANE) ? Amrvis::YDIR : Amrvis::XDIR; + vdir = (activeView == Amrvis::ZPLANE) ? Amrvis::YDIR : Amrvis::ZDIR; + sdir = (activeView == Amrvis::YPLANE) ? Amrvis::YDIR : ((activeView == Amrvis::XYPLANE) ? Amrvis::XDIR : Amrvis::ZDIR); datasetPtr->DatasetRender(trueRegion, amrPicturePtrArray[activeView], this, pltAppState, hdir, vdir, sdir); datasetPtr->DoExpose(false); @@ -1761,23 +1756,23 @@ void PltApp::ChangeDerived(Widget w, XtPointer client_data, XtPointer) { // ------------------------------------------------------------------- void PltApp::ChangeContour(Widget w, XtPointer input_data, XtPointer) { - ContourType prevCType(pltAppState->GetContourType()); - ContourType newCType = ContourType((unsigned long) input_data); + Amrvis::ContourType prevCType(pltAppState->GetContourType()); + Amrvis::ContourType newCType = Amrvis::ContourType((unsigned long) input_data); if(newCType == prevCType) { return; } pltAppState->SetContourType(newCType); XtVaSetValues(wContourLabel, - XmNsensitive, (newCType != RASTERONLY), + XmNsensitive, (newCType != Amrvis::RASTERONLY), NULL); XtVaSetValues(wNumberContours, - XmNsensitive, (newCType != RASTERONLY), + XmNsensitive, (newCType != Amrvis::RASTERONLY), NULL); if(animating2d) { ResetAnimation(); DirtyFrames(); } - for(int np(0); np < NPLANES; ++np) { + for(int np(0); np < Amrvis::NPLANES; ++np) { amrPicturePtrArray[np]->APChangeContour(prevCType); } } @@ -1812,7 +1807,7 @@ void PltApp::ReadContourString(Widget w, XtPointer, XtPointer) { if(stringOk) { contourNumString = tmpContourNumString; pltAppState->SetNumContours(atoi(contourNumString.c_str())); - for(int ii(0); ii < NPLANES; ++ii) { + for(int ii(0); ii < Amrvis::NPLANES; ++ii) { amrPicturePtrArray[ii]->APDraw(pltAppState->MinDrawnLevel(), pltAppState->MaxDrawnLevel()); } @@ -1827,14 +1822,14 @@ void PltApp::ToggleRange(Widget w, XtPointer client_data, XtPointer call_data) { unsigned long r = (unsigned long) client_data; XmToggleButtonCallbackStruct *state = (XmToggleButtonCallbackStruct *) call_data; if(state->set == true) { - currentRangeType = (MinMaxRangeType) r; + currentRangeType = (Amrvis::MinMaxRangeType) r; if(bFileRangeButtonSet) { - if(currentRangeType == GLOBALMINMAX) { - currentRangeType = FILEGLOBALMINMAX; - } else if(currentRangeType == SUBREGIONMINMAX) { - currentRangeType = FILESUBREGIONMINMAX; - } else if(currentRangeType == USERMINMAX) { - currentRangeType = FILEUSERMINMAX; + if(currentRangeType == Amrvis::GLOBALMINMAX) { + currentRangeType = Amrvis::FILEGLOBALMINMAX; + } else if(currentRangeType == Amrvis::SUBREGIONMINMAX) { + currentRangeType = Amrvis::FILESUBREGIONMINMAX; + } else if(currentRangeType == Amrvis::USERMINMAX) { + currentRangeType = Amrvis::FILEUSERMINMAX; } } } @@ -1852,7 +1847,7 @@ void PltApp::DoSubregion(Widget, XtPointer, XtPointer) { // subregionBox is at the maxAllowableLevel #if (BL_SPACEDIM == 2) - if(selectionBox.bigEnd(XDIR) == 0 || selectionBox.bigEnd(YDIR) == 0) { + if(selectionBox.bigEnd(Amrvis::XDIR) == 0 || selectionBox.bigEnd(Amrvis::YDIR) == 0) { return; } subregionBox = selectionBox + ivLowOffsetMAL; @@ -1861,24 +1856,24 @@ void PltApp::DoSubregion(Widget, XtPointer, XtPointer) { #if (BL_SPACEDIM == 3) int np; int currentScale(pltAppState->CurrentScale()); - for(np = 0; np < NPLANES; ++np) { + for(np = 0; np < Amrvis::NPLANES; ++np) { startcutX[np] /= currentScale; startcutY[np] /= currentScale; finishcutX[np] /= currentScale; finishcutY[np] /= currentScale; } - subregionBox.setSmall(XDIR, min(startcutX[ZPLANE], finishcutX[ZPLANE])); - subregionBox.setSmall(YDIR, min(startcutX[XPLANE], finishcutX[XPLANE])); - subregionBox.setSmall(ZDIR, (amrPicturePtrArray[XPLANE]->ImageSizeV()-1)/ - currentScale - max(startcutY[XPLANE], finishcutY[XPLANE])); - subregionBox.setBig(XDIR, max(startcutX[ZPLANE], finishcutX[ZPLANE])); - subregionBox.setBig(YDIR, max(startcutX[XPLANE], finishcutX[XPLANE])); - subregionBox.setBig(ZDIR, (amrPicturePtrArray[XPLANE]->ImageSizeV()-1)/ - currentScale - min(startcutY[XPLANE], finishcutY[XPLANE])); + subregionBox.setSmall(Amrvis::XDIR, min(startcutX[Amrvis::ZPLANE], finishcutX[Amrvis::ZPLANE])); + subregionBox.setSmall(Amrvis::YDIR, min(startcutX[Amrvis::XPLANE], finishcutX[Amrvis::XPLANE])); + subregionBox.setSmall(Amrvis::ZDIR, (amrPicturePtrArray[Amrvis::XPLANE]->ImageSizeV()-1)/ + currentScale - max(startcutY[Amrvis::XPLANE], finishcutY[Amrvis::XPLANE])); + subregionBox.setBig(Amrvis::XDIR, max(startcutX[Amrvis::ZPLANE], finishcutX[Amrvis::ZPLANE])); + subregionBox.setBig(Amrvis::YDIR, max(startcutX[Amrvis::XPLANE], finishcutX[Amrvis::XPLANE])); + subregionBox.setBig(Amrvis::ZDIR, (amrPicturePtrArray[Amrvis::XPLANE]->ImageSizeV()-1)/ + currentScale - min(startcutY[Amrvis::XPLANE], finishcutY[Amrvis::XPLANE])); if(subregionBox.numPts() <= 4) { - for(np = 0; np < NPLANES; ++np) { + for(np = 0; np < Amrvis::NPLANES; ++np) { startcutX[np] *= currentScale; startcutY[np] *= currentScale; finishcutX[np] *= currentScale; @@ -1925,7 +1920,7 @@ void PltApp::DoSubregion(Widget, XtPointer, XtPointer) { fileName); #if (BL_SPACEDIM == 3) - for(np = 0; np < NPLANES; ++np) { + for(np = 0; np < Amrvis::NPLANES; ++np) { startcutX[np] *= currentScale; startcutY[np] *= currentScale; finishcutX[np] *= currentScale; @@ -1937,7 +1932,7 @@ void PltApp::DoSubregion(Widget, XtPointer, XtPointer) { // ------------------------------------------------------------------- void PltApp::DoDatasetButton(Widget, XtPointer, XtPointer) { - if(selectionBox.bigEnd(XDIR) == 0 || selectionBox.bigEnd(YDIR) == 0) { + if(selectionBox.bigEnd(Amrvis::XDIR) == 0 || selectionBox.bigEnd(Amrvis::YDIR) == 0) { return; } @@ -1946,37 +1941,37 @@ void PltApp::DoDatasetButton(Widget, XtPointer, XtPointer) { trueRegion = selectionBox; #if (BL_SPACEDIM == 3) - trueRegion.setSmall(ZDIR, amrPicturePtrArray[ZPLANE]->GetSlice()); - trueRegion.setBig(ZDIR, amrPicturePtrArray[ZPLANE]->GetSlice()); + trueRegion.setSmall(Amrvis::ZDIR, amrPicturePtrArray[Amrvis::ZPLANE]->GetSlice()); + trueRegion.setBig(Amrvis::ZDIR, amrPicturePtrArray[Amrvis::ZPLANE]->GetSlice()); #endif - hdir = (activeView == XPLANE) ? YDIR : XDIR; - vdir = (activeView == ZPLANE) ? YDIR : ZDIR; + hdir = (activeView == Amrvis::XPLANE) ? Amrvis::YDIR : Amrvis::XDIR; + vdir = (activeView == Amrvis::ZPLANE) ? Amrvis::YDIR : Amrvis::ZDIR; switch (activeView) { - case ZPLANE: // orient box to view and shift - trueRegion.shift(XDIR, ivLowOffsetMAL[XDIR]); - trueRegion.shift(YDIR, ivLowOffsetMAL[YDIR]); - sdir = ZDIR; + case Amrvis::ZPLANE: // orient box to view and shift + trueRegion.shift(Amrvis::XDIR, ivLowOffsetMAL[Amrvis::XDIR]); + trueRegion.shift(Amrvis::YDIR, ivLowOffsetMAL[Amrvis::YDIR]); + sdir = Amrvis::ZDIR; break; - case YPLANE: - trueRegion.setSmall(ZDIR, trueRegion.smallEnd(YDIR)); - trueRegion.setBig(ZDIR, trueRegion.bigEnd(YDIR)); - trueRegion.setSmall(YDIR, amrPicturePtrArray[YPLANE]->GetSlice()); - trueRegion.setBig(YDIR, amrPicturePtrArray[YPLANE]->GetSlice()); - trueRegion.shift(XDIR, ivLowOffsetMAL[XDIR]); - trueRegion.shift(ZDIR, ivLowOffsetMAL[ZDIR]); - sdir = YDIR; + case Amrvis::YPLANE: + trueRegion.setSmall(Amrvis::ZDIR, trueRegion.smallEnd(Amrvis::YDIR)); + trueRegion.setBig(Amrvis::ZDIR, trueRegion.bigEnd(Amrvis::YDIR)); + trueRegion.setSmall(Amrvis::YDIR, amrPicturePtrArray[Amrvis::YPLANE]->GetSlice()); + trueRegion.setBig(Amrvis::YDIR, amrPicturePtrArray[Amrvis::YPLANE]->GetSlice()); + trueRegion.shift(Amrvis::XDIR, ivLowOffsetMAL[Amrvis::XDIR]); + trueRegion.shift(Amrvis::ZDIR, ivLowOffsetMAL[Amrvis::ZDIR]); + sdir = Amrvis::YDIR; break; - case XPLANE: - trueRegion.setSmall(ZDIR, trueRegion.smallEnd(YDIR)); - trueRegion.setBig(ZDIR, trueRegion.bigEnd(YDIR)); - trueRegion.setSmall(YDIR, trueRegion.smallEnd(XDIR)); - trueRegion.setBig(YDIR, trueRegion.bigEnd(XDIR)); - trueRegion.setSmall(XDIR, amrPicturePtrArray[XPLANE]->GetSlice()); - trueRegion.setBig(XDIR, amrPicturePtrArray[XPLANE]->GetSlice()); - trueRegion.shift(YDIR, ivLowOffsetMAL[YDIR]); - trueRegion.shift(ZDIR, ivLowOffsetMAL[ZDIR]); - sdir = XDIR; + case Amrvis::XPLANE: + trueRegion.setSmall(Amrvis::ZDIR, trueRegion.smallEnd(Amrvis::YDIR)); + trueRegion.setBig(Amrvis::ZDIR, trueRegion.bigEnd(Amrvis::YDIR)); + trueRegion.setSmall(Amrvis::YDIR, trueRegion.smallEnd(Amrvis::XDIR)); + trueRegion.setBig(Amrvis::YDIR, trueRegion.bigEnd(Amrvis::XDIR)); + trueRegion.setSmall(Amrvis::XDIR, amrPicturePtrArray[Amrvis::XPLANE]->GetSlice()); + trueRegion.setBig(Amrvis::XDIR, amrPicturePtrArray[Amrvis::XPLANE]->GetSlice()); + trueRegion.shift(Amrvis::YDIR, ivLowOffsetMAL[Amrvis::YDIR]); + trueRegion.shift(Amrvis::ZDIR, ivLowOffsetMAL[Amrvis::ZDIR]); + sdir = Amrvis::XDIR; } if(datasetShowing) { @@ -2067,7 +2062,7 @@ void PltApp::DoInfoButton(Widget, XtPointer, XtPointer) { XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 80, NULL); @@ -2078,12 +2073,12 @@ void PltApp::DoInfoButton(Widget, XtPointer, XtPointer) { char **entries = new char *[numEntries]; for(int j(0); j < numEntries; ++j) { - entries[j] = new char[BUFSIZ]; + entries[j] = new char[Amrvis::BUFSIZE]; } i=0; - char buf[BUFSIZ]; - ostrstream prob(buf, BUFSIZ); + char buf[Amrvis::BUFSIZE]; + ostrstream prob(buf, Amrvis::BUFSIZE); prob.precision(15); strcpy(entries[i], fileNames[currentFrame].c_str()); ++i; strcpy(entries[i], amrData.PlotFileVersion().c_str()); ++i; @@ -2092,7 +2087,7 @@ void PltApp::DoInfoButton(Widget, XtPointer, XtPointer) { sprintf(entries[i], "levels: %d", amrData.FinestLevel()+1); ++i; sprintf(entries[i], "prob domain"); ++i; for(int k(0); k <= amrData.FinestLevel(); ++k, ++i) { - ostrstream prob_domain(entries[i], BUFSIZ); + ostrstream prob_domain(entries[i], Amrvis::BUFSIZE); prob_domain << " level " << k << ": " << amrData.ProbDomain()[k] << ends; } @@ -2207,10 +2202,10 @@ void PltApp::DoContoursButton(Widget, XtPointer, XtPointer) { XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, NULL); - char *conItems[NCONTOPTIONS] = {"Raster", "Raster & Contours", "Color Contours", + char *conItems[Amrvis::NCONTOPTIONS] = {"Raster", "Raster & Contours", "Color Contours", "B/W Contours", "Velocity Vectors"}; const AmrData &amrData = dataServicesPtr[currentFrame]->AmrDataRef(); - for(int j(0); j < NCONTOPTIONS; ++j) { + for(int j(0); j < Amrvis::NCONTOPTIONS; ++j) { wid = XtVaCreateManagedWidget(conItems[j], xmToggleButtonGadgetClass, wContourRadio, NULL); if(j == (int) pltAppState->GetContourType()) { @@ -2225,12 +2220,12 @@ void PltApp::DoContoursButton(Widget, XtPointer, XtPointer) { xmLabelWidgetClass, wContoursForm, XmNlabelString, label_str, XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, wContourRadio, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNsensitive, - pltAppState->GetContourType() != RASTERONLY, + pltAppState->GetContourType() != Amrvis::RASTERONLY, NULL); XmStringFree(label_str); @@ -2238,14 +2233,14 @@ void PltApp::DoContoursButton(Widget, XtPointer, XtPointer) { xmTextFieldWidgetClass, wContoursForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, wContourRadio, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wContourLabel, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, XmNvalue, contourNumString.c_str(), XmNcolumns, 4, XmNsensitive, - pltAppState->GetContourType() != RASTERONLY, + pltAppState->GetContourType() != Amrvis::RASTERONLY, NULL); AddStaticCallback(wNumberContours, XmNactivateCallback, &PltApp::ReadContourString); @@ -2253,7 +2248,7 @@ void PltApp::DoContoursButton(Widget, XtPointer, XtPointer) { wCloseButton = XtVaCreateManagedWidget(" Close ", xmPushButtonGadgetClass, wContoursForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_POSITION, XmNleftPosition, 33, XmNrightAttachment, XmATTACH_POSITION, @@ -2288,20 +2283,20 @@ void PltApp::DoToggleFileRangeButton(Widget w, XtPointer client_data, { bFileRangeButtonSet = XmToggleButtonGetState(wFileRangeCheckBox); if(bFileRangeButtonSet) { - if(currentRangeType == GLOBALMINMAX) { - currentRangeType = FILEGLOBALMINMAX; - } else if(currentRangeType == SUBREGIONMINMAX) { - currentRangeType = FILESUBREGIONMINMAX; - } else if(currentRangeType == USERMINMAX) { - currentRangeType = FILEUSERMINMAX; + if(currentRangeType == Amrvis::GLOBALMINMAX) { + currentRangeType = Amrvis::FILEGLOBALMINMAX; + } else if(currentRangeType == Amrvis::SUBREGIONMINMAX) { + currentRangeType = Amrvis::FILESUBREGIONMINMAX; + } else if(currentRangeType == Amrvis::USERMINMAX) { + currentRangeType = Amrvis::FILEUSERMINMAX; } } else { - if(currentRangeType == FILEGLOBALMINMAX) { - currentRangeType = GLOBALMINMAX; - } else if(currentRangeType == FILESUBREGIONMINMAX) { - currentRangeType = SUBREGIONMINMAX; - } else if(currentRangeType == FILEUSERMINMAX) { - currentRangeType = USERMINMAX; + if(currentRangeType == Amrvis::FILEGLOBALMINMAX) { + currentRangeType = Amrvis::GLOBALMINMAX; + } else if(currentRangeType == Amrvis::FILESUBREGIONMINMAX) { + currentRangeType = Amrvis::SUBREGIONMINMAX; + } else if(currentRangeType == Amrvis::FILEUSERMINMAX) { + currentRangeType = Amrvis::USERMINMAX; } } } @@ -2318,11 +2313,11 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) { return; } - char range[LINELENGTH]; - char saveRangeString[LINELENGTH]; - char format[LINELENGTH]; - char fMin[LINELENGTH]; - char fMax[LINELENGTH]; + char range[Amrvis::LINELENGTH]; + char saveRangeString[Amrvis::LINELENGTH]; + char format[Amrvis::LINELENGTH]; + char fMin[Amrvis::LINELENGTH]; + char fMax[Amrvis::LINELENGTH]; strcpy(format, pltAppState->GetFormatString().c_str()); Widget wSetRangeForm, wDoneButton, wApplyButton, wCancelButton; Widget wSetRangeRadioBox, wRangeRC, wid; @@ -2330,7 +2325,7 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) { // do these here to set XmNwidth of wSetRangeTopLevel Real rtMin, rtMax; - pltAppState->GetMinMax(GLOBALMINMAX, currentFrame, + pltAppState->GetMinMax(Amrvis::GLOBALMINMAX, currentFrame, pltAppState->CurrentDerivedNumber(), rtMin, rtMax); sprintf(fMin, format, rtMin); @@ -2371,9 +2366,9 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) { wDoneButton = XtVaCreateManagedWidget(" Ok ", xmPushButtonGadgetClass, wSetRangeForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); bool bKillSRWindow(true); AddStaticCallback(wDoneButton, XmNactivateCallback, &PltApp::DoDoneSetRange, @@ -2382,10 +2377,10 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) { wApplyButton = XtVaCreateManagedWidget(" Apply ", xmPushButtonGadgetClass, wSetRangeForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wDoneButton, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); bKillSRWindow = false; AddStaticCallback(wApplyButton, XmNactivateCallback, &PltApp::DoDoneSetRange, @@ -2394,9 +2389,9 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) { wCancelButton = XtVaCreateManagedWidget(" Cancel ", xmPushButtonGadgetClass, wSetRangeForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNrightAttachment, XmATTACH_FORM, - XmNrightOffset, WOFFSET, + XmNrightOffset, Amrvis::WOFFSET, NULL); AddStaticCallback(wCancelButton, XmNactivateCallback, &PltApp::DoCancelSetRange); @@ -2407,26 +2402,26 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) { XtVaSetValues(wSetRangeRadioBox, XmNmarginWidth, 4, NULL); XtVaSetValues(wSetRangeRadioBox, XmNspacing, 14, NULL); - wRangeRadioButton[BGLOBALMINMAX] = XtVaCreateManagedWidget("Global", + wRangeRadioButton[Amrvis::BGLOBALMINMAX] = XtVaCreateManagedWidget("Global", xmToggleButtonWidgetClass, wSetRangeRadioBox, NULL); - AddStaticCallback(wRangeRadioButton[BGLOBALMINMAX], XmNvalueChangedCallback, - &PltApp::ToggleRange, (XtPointer) BGLOBALMINMAX); - wRangeRadioButton[BSUBREGIONMINMAX] = XtVaCreateManagedWidget("Local", + AddStaticCallback(wRangeRadioButton[Amrvis::BGLOBALMINMAX], XmNvalueChangedCallback, + &PltApp::ToggleRange, (XtPointer) Amrvis::BGLOBALMINMAX); + wRangeRadioButton[Amrvis::BSUBREGIONMINMAX] = XtVaCreateManagedWidget("Local", xmToggleButtonWidgetClass, wSetRangeRadioBox, NULL); - AddStaticCallback(wRangeRadioButton[BSUBREGIONMINMAX], XmNvalueChangedCallback, - &PltApp::ToggleRange, (XtPointer) BSUBREGIONMINMAX); - wRangeRadioButton[BUSERMINMAX] = XtVaCreateManagedWidget("User", + AddStaticCallback(wRangeRadioButton[Amrvis::BSUBREGIONMINMAX], XmNvalueChangedCallback, + &PltApp::ToggleRange, (XtPointer) Amrvis::BSUBREGIONMINMAX); + wRangeRadioButton[Amrvis::BUSERMINMAX] = XtVaCreateManagedWidget("User", xmToggleButtonWidgetClass, wSetRangeRadioBox, NULL); - AddStaticCallback(wRangeRadioButton[BUSERMINMAX], XmNvalueChangedCallback, - &PltApp::ToggleRange, (XtPointer) BUSERMINMAX); + AddStaticCallback(wRangeRadioButton[Amrvis::BUSERMINMAX], XmNvalueChangedCallback, + &PltApp::ToggleRange, (XtPointer) Amrvis::BUSERMINMAX); if(animating2d) { int i(0); XtSetArg(args[i], XmNleftAttachment, XmATTACH_FORM); ++i; - XtSetArg(args[i], XmNleftOffset, WOFFSET); ++i; + XtSetArg(args[i], XmNleftOffset, Amrvis::WOFFSET); ++i; XtSetArg(args[i], XmNtopAttachment, XmATTACH_WIDGET); ++i; XtSetArg(args[i], XmNtopWidget, wSetRangeRadioBox); ++i; - XtSetArg(args[i], XmNtopOffset, WOFFSET); ++i; + XtSetArg(args[i], XmNtopOffset, Amrvis::WOFFSET); ++i; XtSetArg(args[i], XmNset, bFileRangeButtonSet); ++i; wFileRangeCheckBox = XmCreateToggleButton(wSetRangeForm, "File_Range", args, i); @@ -2435,15 +2430,15 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) { } currentRangeType = pltAppState->GetMinMaxRangeType(); - MinMaxRangeTypeForButtons mmButton(BINVALIDMINMAX); - if(currentRangeType == GLOBALMINMAX || currentRangeType == FILEGLOBALMINMAX) { - mmButton = BGLOBALMINMAX; - } else if(currentRangeType == SUBREGIONMINMAX || - currentRangeType == FILESUBREGIONMINMAX) + Amrvis::MinMaxRangeTypeForButtons mmButton(Amrvis::BINVALIDMINMAX); + if(currentRangeType == Amrvis::GLOBALMINMAX || currentRangeType == Amrvis::FILEGLOBALMINMAX) { + mmButton = Amrvis::BGLOBALMINMAX; + } else if(currentRangeType == Amrvis::SUBREGIONMINMAX || + currentRangeType == Amrvis::FILESUBREGIONMINMAX) { - mmButton = BSUBREGIONMINMAX; - } else if(currentRangeType == USERMINMAX || currentRangeType == FILEUSERMINMAX) { - mmButton = BUSERMINMAX; + mmButton = Amrvis::BSUBREGIONMINMAX; + } else if(currentRangeType == Amrvis::USERMINMAX || currentRangeType == Amrvis::FILEUSERMINMAX) { + mmButton = Amrvis::BUSERMINMAX; } else { BoxLib::Abort("Bad button range type."); } @@ -2461,7 +2456,7 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) { XmNorientation, XmHORIZONTAL, NULL); // make the strings representing data min and maxes - pltAppState->GetMinMax(GLOBALMINMAX, currentFrame, + pltAppState->GetMinMax(Amrvis::GLOBALMINMAX, currentFrame, pltAppState->CurrentDerivedNumber(), rtMin, rtMax); sprintf(fMin, format, rtMin); sprintf(fMax, format, rtMax); @@ -2471,7 +2466,7 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) { sprintf(range, "Max: %s", fMax); XtVaCreateManagedWidget(range, xmLabelGadgetClass, wRangeRC, NULL); - pltAppState->GetMinMax(SUBREGIONMINMAX, currentFrame, + pltAppState->GetMinMax(Amrvis::SUBREGIONMINMAX, currentFrame, pltAppState->CurrentDerivedNumber(), rtMin, rtMax); sprintf(fMin, format, rtMin); @@ -2481,7 +2476,7 @@ void PltApp::DoSetRangeButton(Widget, XtPointer, XtPointer) { sprintf(range, "Max: %s", fMax); XtVaCreateManagedWidget(range, xmLabelGadgetClass, wRangeRC, NULL); - pltAppState->GetMinMax(USERMINMAX, currentFrame, + pltAppState->GetMinMax(Amrvis::USERMINMAX, currentFrame, pltAppState->CurrentDerivedNumber(), rtMin, rtMax); wid = XtVaCreateManagedWidget("wid", xmRowColumnWidgetClass, wRangeRC, @@ -2542,9 +2537,9 @@ void PltApp::SetNewFormatString(const string &newformatstring) { pltPaletteptr->Redraw(); if(datasetShowing) { int hdir(-1), vdir(-1), sdir(-1); - if(activeView == ZPLANE) { hdir = XDIR; vdir = YDIR; sdir = ZDIR; } - if(activeView == YPLANE) { hdir = XDIR; vdir = ZDIR; sdir = YDIR; } - if(activeView == XPLANE) { hdir = YDIR; vdir = ZDIR; sdir = XDIR; } + if(activeView == Amrvis::ZPLANE) { hdir = Amrvis::XDIR; vdir = Amrvis::YDIR; sdir = Amrvis::ZDIR; } + if(activeView == Amrvis::YPLANE) { hdir = Amrvis::XDIR; vdir = Amrvis::ZDIR; sdir = Amrvis::YDIR; } + if(activeView == Amrvis::XPLANE) { hdir = Amrvis::YDIR; vdir = Amrvis::ZDIR; sdir = Amrvis::XDIR; } datasetPtr->DatasetRender(trueRegion, amrPicturePtrArray[activeView], this, pltAppState, hdir, vdir, sdir); datasetPtr->DoExpose(false); @@ -2570,7 +2565,7 @@ void PltApp::DoNumberFormatButton(Widget, XtPointer, XtPointer) { return; } - char format[LINELENGTH]; + char format[Amrvis::LINELENGTH]; strcpy(format, pltAppState->GetFormatString().c_str()); Widget wNumberFormatForm, wDoneButton, wApplyButton, wCancelButton, wid; @@ -2608,9 +2603,9 @@ void PltApp::DoNumberFormatButton(Widget, XtPointer, XtPointer) { wDoneButton = XtVaCreateManagedWidget(" Ok ", xmPushButtonGadgetClass, wNumberFormatForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); bool bKillNFWindow(true); AddStaticCallback(wDoneButton, XmNactivateCallback, &PltApp::DoDoneNumberFormat, @@ -2619,10 +2614,10 @@ void PltApp::DoNumberFormatButton(Widget, XtPointer, XtPointer) { wApplyButton = XtVaCreateManagedWidget(" Apply ", xmPushButtonGadgetClass, wNumberFormatForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wDoneButton, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); bKillNFWindow = false; AddStaticCallback(wApplyButton, XmNactivateCallback, &PltApp::DoDoneNumberFormat, @@ -2631,9 +2626,9 @@ void PltApp::DoNumberFormatButton(Widget, XtPointer, XtPointer) { wCancelButton = XtVaCreateManagedWidget(" Cancel ", xmPushButtonGadgetClass, wNumberFormatForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNrightAttachment, XmATTACH_FORM, - XmNrightOffset, WOFFSET, + XmNrightOffset, Amrvis::WOFFSET, NULL); AddStaticCallback(wCancelButton, XmNactivateCallback, &PltApp::DoCancelNumberFormat); @@ -2641,9 +2636,9 @@ void PltApp::DoNumberFormatButton(Widget, XtPointer, XtPointer) { wid = XtVaCreateManagedWidget("Format:", xmLabelGadgetClass, wNumberFormatForm, XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); wFormat = XtVaCreateManagedWidget("format", xmTextFieldWidgetClass, wNumberFormatForm, @@ -2651,10 +2646,10 @@ void PltApp::DoNumberFormatButton(Widget, XtPointer, XtPointer) { XmNeditable, true, XmNcolumns, strlen(format) + 4, XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wid, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); bKillNFWindow = true; AddStaticCallback(wFormat, XmNactivateCallback, &PltApp::DoDoneNumberFormat, @@ -2729,16 +2724,16 @@ void PltApp::DoDoneSetRange(Widget, XtPointer client_data, XtPointer) { Real umax(atof(XmTextFieldGetString(wUserMax))); for(int iFrame(0); iFrame < animFrames; ++iFrame) { - pltAppState->SetMinMax(USERMINMAX, iFrame, + pltAppState->SetMinMax(Amrvis::USERMINMAX, iFrame, pltAppState->CurrentDerivedNumber(), umin, umax); } if(currentRangeType != pltAppState->GetMinMaxRangeType() || - currentRangeType == USERMINMAX || currentRangeType == FILEUSERMINMAX) + currentRangeType == Amrvis::USERMINMAX || currentRangeType == Amrvis::FILEUSERMINMAX) { pltAppState->SetMinMaxRangeType(currentRangeType); - for(np = 0; np < NPLANES; ++np) { + for(np = 0; np < Amrvis::NPLANES; ++np) { amrPicturePtrArray[np]->APMakeImages(pltPaletteptr); } #if (BL_SPACEDIM == 3) @@ -2767,9 +2762,9 @@ void PltApp::DoDoneSetRange(Widget, XtPointer client_data, XtPointer) { if(datasetShowing) { datasetPtr->DoRaise(); int hdir(-1), vdir(-1), sdir(-1); - if(activeView==ZPLANE) { hdir = XDIR; vdir = YDIR; sdir = ZDIR; } - if(activeView==YPLANE) { hdir = XDIR; vdir = ZDIR; sdir = YDIR; } - if(activeView==XPLANE) { hdir = YDIR; vdir = ZDIR; sdir = XDIR; } + if(activeView==Amrvis::ZPLANE) { hdir = Amrvis::XDIR; vdir = Amrvis::YDIR; sdir = Amrvis::ZDIR; } + if(activeView==Amrvis::YPLANE) { hdir = Amrvis::XDIR; vdir = Amrvis::ZDIR; sdir = Amrvis::YDIR; } + if(activeView==Amrvis::XPLANE) { hdir = Amrvis::YDIR; vdir = Amrvis::ZDIR; sdir = Amrvis::XDIR; } datasetPtr->DatasetRender(trueRegion, amrPicturePtrArray[activeView], this, pltAppState, hdir, vdir, sdir); datasetPtr->DoExpose(false); @@ -2795,19 +2790,19 @@ void PltApp::DestroySetRangeWindow(Widget, XtPointer, XtPointer) { // ------------------------------------------------------------------- void PltApp::DoUserMin(Widget, XtPointer, XtPointer) { - if(currentRangeType == GLOBALMINMAX || currentRangeType == FILEGLOBALMINMAX) { - XtVaSetValues(wRangeRadioButton[BGLOBALMINMAX], XmNset, false, NULL); + if(currentRangeType == Amrvis::GLOBALMINMAX || currentRangeType == Amrvis::FILEGLOBALMINMAX) { + XtVaSetValues(wRangeRadioButton[Amrvis::BGLOBALMINMAX], XmNset, false, NULL); } - if(currentRangeType == SUBREGIONMINMAX || - currentRangeType == FILESUBREGIONMINMAX) + if(currentRangeType == Amrvis::SUBREGIONMINMAX || + currentRangeType == Amrvis::FILESUBREGIONMINMAX) { - XtVaSetValues(wRangeRadioButton[BSUBREGIONMINMAX], XmNset, false, NULL); + XtVaSetValues(wRangeRadioButton[Amrvis::BSUBREGIONMINMAX], XmNset, false, NULL); } - XtVaSetValues(wRangeRadioButton[BUSERMINMAX], XmNset, true, NULL); + XtVaSetValues(wRangeRadioButton[Amrvis::BUSERMINMAX], XmNset, true, NULL); if(bFileRangeButtonSet) { - currentRangeType = FILEUSERMINMAX; + currentRangeType = Amrvis::FILEUSERMINMAX; } else { - currentRangeType = USERMINMAX; + currentRangeType = Amrvis::USERMINMAX; } bool bKillSRWindow(true); DoDoneSetRange(NULL, (XtPointer) bKillSRWindow, NULL); @@ -2816,19 +2811,19 @@ void PltApp::DoUserMin(Widget, XtPointer, XtPointer) { // ------------------------------------------------------------------- void PltApp::DoUserMax(Widget, XtPointer, XtPointer) { - if(currentRangeType == GLOBALMINMAX || currentRangeType == FILEGLOBALMINMAX) { - XtVaSetValues(wRangeRadioButton[BGLOBALMINMAX], XmNset, false, NULL); + if(currentRangeType == Amrvis::GLOBALMINMAX || currentRangeType == Amrvis::FILEGLOBALMINMAX) { + XtVaSetValues(wRangeRadioButton[Amrvis::BGLOBALMINMAX], XmNset, false, NULL); } - if(currentRangeType == SUBREGIONMINMAX || - currentRangeType == FILESUBREGIONMINMAX) + if(currentRangeType == Amrvis::SUBREGIONMINMAX || + currentRangeType == Amrvis::FILESUBREGIONMINMAX) { - XtVaSetValues(wRangeRadioButton[BSUBREGIONMINMAX], XmNset, false, NULL); + XtVaSetValues(wRangeRadioButton[Amrvis::BSUBREGIONMINMAX], XmNset, false, NULL); } - XtVaSetValues(wRangeRadioButton[BUSERMINMAX], XmNset, true, NULL); + XtVaSetValues(wRangeRadioButton[Amrvis::BUSERMINMAX], XmNset, true, NULL); if(bFileRangeButtonSet) { - currentRangeType = FILEUSERMINMAX; + currentRangeType = Amrvis::FILEUSERMINMAX; } else { - currentRangeType = USERMINMAX; + currentRangeType = Amrvis::USERMINMAX; } bool bKillSRWindow(true); DoDoneSetRange(NULL, (XtPointer) bKillSRWindow, NULL); @@ -2842,7 +2837,7 @@ void PltApp::DoBoxesButton(Widget, XtPointer, XtPointer) { DirtyFrames(); } pltAppState->SetShowingBoxes( ! pltAppState->GetShowingBoxes()); - for(int np(0); np < NPLANES; ++np) { + for(int np(0); np < Amrvis::NPLANES; ++np) { amrPicturePtrArray[np]->DoExposePicture(); } #if (BL_SPACEDIM == 3) @@ -2860,12 +2855,12 @@ void PltApp::DoBoxesButton(Widget, XtPointer, XtPointer) { // draw a bounding box around the image /* - int imageSizeX = amrPicturePtrArray[ZPLANE]->ImageSizeH(); - int imageSizeY = amrPicturePtrArray[ZPLANE]->ImageSizeV(); + int imageSizeX = amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeH(); + int imageSizeY = amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeV(); XSetForeground(display, xgc, pltPaletteptr->WhiteIndex()); - XDrawLine(display, XtWindow(wPlotPlane[ZPLANE]), xgc, + XDrawLine(display, XtWindow(wPlotPlane[Amrvis::ZPLANE]), xgc, 0, imageSizeY, imageSizeX, imageSizeY); - XDrawLine(display, XtWindow(wPlotPlane[ZPLANE]), xgc, + XDrawLine(display, XtWindow(wPlotPlane[Amrvis::ZPLANE]), xgc, imageSizeX, 0, imageSizeX, imageSizeY); */ } @@ -2903,7 +2898,7 @@ void PltApp::DoOpenPalFile(Widget w, XtPointer, XtPointer call_data) { XYplotwin[np]->SetPalette(); } } - for(int npp(0); npp < NPLANES; ++npp) { + for(int npp(0); npp < Amrvis::NPLANES; ++npp) { amrPicturePtrArray[npp]->CreatePicture(XtWindow(wPlotPlane[npp]), pltPaletteptr); } @@ -2929,31 +2924,31 @@ XYPlotDataList *PltApp::CreateLinePlot(int V, int sdir, int mal, int ix, int dir2(-1); #endif switch (V) { - case ZPLANE: - tdir = (sdir == XDIR) ? YDIR : XDIR; + case Amrvis::ZPLANE: + tdir = (sdir == Amrvis::XDIR) ? Amrvis::YDIR : Amrvis::XDIR; dir1 = tdir; #if (BL_SPACEDIM == 3) - dir2 = ZDIR; + dir2 = Amrvis::ZDIR; break; - case YPLANE: - if(sdir == XDIR) { - tdir = ZDIR; - dir1 = YDIR; - dir2 = ZDIR; + case Amrvis::YPLANE: + if(sdir == Amrvis::XDIR) { + tdir = Amrvis::ZDIR; + dir1 = Amrvis::YDIR; + dir2 = Amrvis::ZDIR; } else { - tdir = XDIR; - dir1 = XDIR; - dir2 = YDIR; + tdir = Amrvis::XDIR; + dir1 = Amrvis::XDIR; + dir2 = Amrvis::YDIR; } break; - case XPLANE: - dir1 = XDIR; - if(sdir == YDIR) { - tdir = ZDIR; + case Amrvis::XPLANE: + dir1 = Amrvis::XDIR; + if(sdir == Amrvis::YDIR) { + tdir = Amrvis::ZDIR; } else { - tdir = YDIR; + tdir = Amrvis::YDIR; } - dir1 = XDIR; + dir1 = Amrvis::XDIR; dir2 = tdir; break; #endif @@ -2975,14 +2970,14 @@ XYPlotDataList *PltApp::CreateLinePlot(int V, int sdir, int mal, int ix, #if (BL_SPACEDIM == 3) char buffer[128]; sprintf(buffer, "%s%s %s%s", - (dir1 == XDIR) ? "X=" : "Y=", pltAppState->GetFormatString().c_str(), - (dir2 == YDIR) ? "Y=" : "Z=", pltAppState->GetFormatString().c_str()); + (dir1 == Amrvis::XDIR) ? "X=" : "Y=", pltAppState->GetFormatString().c_str(), + (dir2 == Amrvis::YDIR) ? "Y=" : "Z=", pltAppState->GetFormatString().c_str()); #endif for(lev = 0; lev <= mal; ++lev) { XdX[lev] = amrData.DxLevel()[lev][sdir]; intersectStr[lev] = new char[128]; #if (BL_SPACEDIM == 2) - sprintf(intersectStr[lev], ((dir1 == XDIR) ? "X=" : "Y=")); + sprintf(intersectStr[lev], ((dir1 == Amrvis::XDIR) ? "X=" : "Y=")); sprintf(intersectStr[lev]+2, pltAppState->GetFormatString().c_str(), gridOffset[dir1] + (0.5 + trueRegion[lev].smallEnd(dir1))*amrData.DxLevel()[lev][dir1]); @@ -3088,33 +3083,33 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) #if (BL_SPACEDIM == 3) // 3D sub domain selecting switch (V) { - case ZPLANE: - XDrawRectangle(display, amrPicturePtrArray[YPLANE]->PictureWindow(), - rbgc, rStartX, startcutY[YPLANE], rWidth, - abs(finishcutY[YPLANE]-startcutY[YPLANE])); + case Amrvis::ZPLANE: + XDrawRectangle(display, amrPicturePtrArray[Amrvis::YPLANE]->PictureWindow(), + rbgc, rStartX, startcutY[Amrvis::YPLANE], rWidth, + abs(finishcutY[Amrvis::YPLANE]-startcutY[Amrvis::YPLANE])); rStartPlane = (anchorY < oldY) ? oldY : anchorY; - XDrawRectangle(display, amrPicturePtrArray[XPLANE]->PictureWindow(), - rbgc, imageHeight-rStartPlane, startcutY[XPLANE], + XDrawRectangle(display, amrPicturePtrArray[Amrvis::XPLANE]->PictureWindow(), + rbgc, imageHeight-rStartPlane, startcutY[Amrvis::XPLANE], rHeight, - abs(finishcutY[XPLANE]-startcutY[XPLANE])); + abs(finishcutY[Amrvis::XPLANE]-startcutY[Amrvis::XPLANE])); break; - case YPLANE: - XDrawRectangle(display, amrPicturePtrArray[ZPLANE]->PictureWindow(), - rbgc, rStartX, startcutY[ZPLANE], rWidth, - abs(finishcutY[ZPLANE]-startcutY[ZPLANE])); - XDrawRectangle(display, amrPicturePtrArray[XPLANE]->PictureWindow(), - rbgc, startcutX[XPLANE], rStartY, - abs(finishcutX[XPLANE]-startcutX[XPLANE]), + case Amrvis::YPLANE: + XDrawRectangle(display, amrPicturePtrArray[Amrvis::ZPLANE]->PictureWindow(), + rbgc, rStartX, startcutY[Amrvis::ZPLANE], rWidth, + abs(finishcutY[Amrvis::ZPLANE]-startcutY[Amrvis::ZPLANE])); + XDrawRectangle(display, amrPicturePtrArray[Amrvis::XPLANE]->PictureWindow(), + rbgc, startcutX[Amrvis::XPLANE], rStartY, + abs(finishcutX[Amrvis::XPLANE]-startcutX[Amrvis::XPLANE]), rHeight); break; - default: // XPLANE + default: // Amrvis::XPLANE rStartPlane = (anchorX < oldX) ? oldX : anchorX; - XDrawRectangle(display, amrPicturePtrArray[ZPLANE]->PictureWindow(), - rbgc, startcutX[ZPLANE], imageWidth-rStartPlane, - abs(finishcutX[ZPLANE]-startcutX[ZPLANE]), rWidth); - XDrawRectangle(display, amrPicturePtrArray[YPLANE]->PictureWindow(), - rbgc, startcutX[YPLANE], rStartY, - abs(finishcutX[YPLANE]-startcutX[YPLANE]), + XDrawRectangle(display, amrPicturePtrArray[Amrvis::ZPLANE]->PictureWindow(), + rbgc, startcutX[Amrvis::ZPLANE], imageWidth-rStartPlane, + abs(finishcutX[Amrvis::ZPLANE]-startcutX[Amrvis::ZPLANE]), rWidth); + XDrawRectangle(display, amrPicturePtrArray[Amrvis::YPLANE]->PictureWindow(), + rbgc, startcutX[Amrvis::YPLANE], rStartY, + abs(finishcutX[Amrvis::YPLANE]-startcutX[Amrvis::YPLANE]), rHeight); } #endif @@ -3156,67 +3151,67 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) finishcutX[V] = rStartX + rWidth; finishcutY[V] = rStartY + rHeight; switch (V) { - case ZPLANE: - startcutX[YPLANE] = startcutX[V]; - finishcutX[YPLANE] = finishcutX[V]; - startcutX[XPLANE] = imageHeight - startcutY[V]; - finishcutX[XPLANE] = imageHeight - finishcutY[V]; + case Amrvis::ZPLANE: + startcutX[Amrvis::YPLANE] = startcutX[V]; + finishcutX[Amrvis::YPLANE] = finishcutX[V]; + startcutX[Amrvis::XPLANE] = imageHeight - startcutY[V]; + finishcutX[Amrvis::XPLANE] = imageHeight - finishcutY[V]; // draw in other planes - XDrawRectangle(display, amrPicturePtrArray[YPLANE]->PictureWindow(), - rbgc, rStartX, startcutY[YPLANE], rWidth, - abs(finishcutY[YPLANE]-startcutY[YPLANE])); + XDrawRectangle(display, amrPicturePtrArray[Amrvis::YPLANE]->PictureWindow(), + rbgc, rStartX, startcutY[Amrvis::YPLANE], rWidth, + abs(finishcutY[Amrvis::YPLANE]-startcutY[Amrvis::YPLANE])); rStartPlane = (anchorY < newY) ? newY : anchorY; - XDrawRectangle(display, amrPicturePtrArray[XPLANE]->PictureWindow(), - rbgc, imageHeight-rStartPlane, startcutY[XPLANE], + XDrawRectangle(display, amrPicturePtrArray[Amrvis::XPLANE]->PictureWindow(), + rbgc, imageHeight-rStartPlane, startcutY[Amrvis::XPLANE], rHeight, - abs(finishcutY[XPLANE]-startcutY[XPLANE])); + abs(finishcutY[Amrvis::XPLANE]-startcutY[Amrvis::XPLANE])); break; - case YPLANE: - startcutX[ZPLANE] = startcutX[V]; - finishcutX[ZPLANE] = finishcutX[V]; - startcutY[XPLANE] = startcutY[V]; - finishcutY[XPLANE] = finishcutY[V]; - XDrawRectangle(display, amrPicturePtrArray[ZPLANE]->PictureWindow(), - rbgc, rStartX, startcutY[ZPLANE], rWidth, - abs(finishcutY[ZPLANE]-startcutY[ZPLANE])); - XDrawRectangle(display, amrPicturePtrArray[XPLANE]->PictureWindow(), - rbgc, startcutX[XPLANE], rStartY, - abs(finishcutX[XPLANE]-startcutX[XPLANE]), rHeight); + case Amrvis::YPLANE: + startcutX[Amrvis::ZPLANE] = startcutX[V]; + finishcutX[Amrvis::ZPLANE] = finishcutX[V]; + startcutY[Amrvis::XPLANE] = startcutY[V]; + finishcutY[Amrvis::XPLANE] = finishcutY[V]; + XDrawRectangle(display, amrPicturePtrArray[Amrvis::ZPLANE]->PictureWindow(), + rbgc, rStartX, startcutY[Amrvis::ZPLANE], rWidth, + abs(finishcutY[Amrvis::ZPLANE]-startcutY[Amrvis::ZPLANE])); + XDrawRectangle(display, amrPicturePtrArray[Amrvis::XPLANE]->PictureWindow(), + rbgc, startcutX[Amrvis::XPLANE], rStartY, + abs(finishcutX[Amrvis::XPLANE]-startcutX[Amrvis::XPLANE]), rHeight); break; - default: // XPLANE - startcutY[YPLANE] = startcutY[V]; - finishcutY[YPLANE] = finishcutY[V]; - startcutY[ZPLANE] = imageWidth - startcutX[V]; - finishcutY[ZPLANE] = imageWidth - finishcutX[V]; + default: // Amrvis::XPLANE + startcutY[Amrvis::YPLANE] = startcutY[V]; + finishcutY[Amrvis::YPLANE] = finishcutY[V]; + startcutY[Amrvis::ZPLANE] = imageWidth - startcutX[V]; + finishcutY[Amrvis::ZPLANE] = imageWidth - finishcutX[V]; rStartPlane = (anchorX < newX) ? newX : anchorX; - XDrawRectangle(display, amrPicturePtrArray[ZPLANE]->PictureWindow(), - rbgc, startcutX[ZPLANE], imageWidth-rStartPlane, - abs(finishcutX[ZPLANE]-startcutX[ZPLANE]), rWidth); - XDrawRectangle(display, amrPicturePtrArray[YPLANE]->PictureWindow(), - rbgc, startcutX[YPLANE], rStartY, - abs(finishcutX[YPLANE]-startcutX[YPLANE]), rHeight); + XDrawRectangle(display, amrPicturePtrArray[Amrvis::ZPLANE]->PictureWindow(), + rbgc, startcutX[Amrvis::ZPLANE], imageWidth-rStartPlane, + abs(finishcutX[Amrvis::ZPLANE]-startcutX[Amrvis::ZPLANE]), rWidth); + XDrawRectangle(display, amrPicturePtrArray[Amrvis::YPLANE]->PictureWindow(), + rbgc, startcutX[Amrvis::YPLANE], rStartY, + abs(finishcutX[Amrvis::YPLANE]-startcutX[Amrvis::YPLANE]), rHeight); } #if defined(BL_VOLUMERENDER) || defined(BL_PARALLELVOLUMERENDER) if( ! XmToggleButtonGetState(wAutoDraw)) #endif { - x1 = startcutX[ZPLANE]/scale + ivLowOffsetMAL[XDIR]; - y1 = startcutX[XPLANE]/scale + ivLowOffsetMAL[YDIR]; - z1 = (amrPicturePtrArray[YPLANE]->ImageSizeV()-1 - - startcutY[YPLANE])/scale + ivLowOffsetMAL[ZDIR]; - x2 = finishcutX[ZPLANE]/scale + ivLowOffsetMAL[XDIR]; - y2 = finishcutX[XPLANE]/scale + ivLowOffsetMAL[YDIR]; - z2 = (amrPicturePtrArray[YPLANE]->ImageSizeV()-1 - - finishcutY[YPLANE])/scale + ivLowOffsetMAL[ZDIR]; + x1 = startcutX[Amrvis::ZPLANE]/scale + ivLowOffsetMAL[Amrvis::XDIR]; + y1 = startcutX[Amrvis::XPLANE]/scale + ivLowOffsetMAL[Amrvis::YDIR]; + z1 = (amrPicturePtrArray[Amrvis::YPLANE]->ImageSizeV()-1 - + startcutY[Amrvis::YPLANE])/scale + ivLowOffsetMAL[Amrvis::ZDIR]; + x2 = finishcutX[Amrvis::ZPLANE]/scale + ivLowOffsetMAL[Amrvis::XDIR]; + y2 = finishcutX[Amrvis::XPLANE]/scale + ivLowOffsetMAL[Amrvis::YDIR]; + z2 = (amrPicturePtrArray[Amrvis::YPLANE]->ImageSizeV()-1 - + finishcutY[Amrvis::YPLANE])/scale + ivLowOffsetMAL[Amrvis::ZDIR]; if(z2 > 65536) { // fix bad -z values - z2 = amrPicturePtrArray[ZPLANE]->GetSubDomain()[mal].smallEnd(ZDIR); + z2 = amrPicturePtrArray[Amrvis::ZPLANE]->GetSubDomain()[mal].smallEnd(Amrvis::ZDIR); } IntVect ivmin(min(x1,x2), min(y1,y2), min(z1,z2)); IntVect ivmax(max(x1,x2), max(y1,y2), max(z1,z2)); Box xyz12(ivmin, ivmax); - xyz12 &= amrPicturePtrArray[ZPLANE]->GetSubDomain()[mal]; + xyz12 &= amrPicturePtrArray[Amrvis::ZPLANE]->GetSubDomain()[mal]; projPicturePtr->SetSubCut(xyz12); //projPicturePtr->MakeBoxes(); @@ -3245,11 +3240,11 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) } // make "aligned" box with correct size, converted to AMR space. - selectionBox.setSmall(XDIR, min(startX, endX)); - selectionBox.setSmall(YDIR, ((imageHeight + 1) / scale) - + selectionBox.setSmall(Amrvis::XDIR, min(startX, endX)); + selectionBox.setSmall(Amrvis::YDIR, ((imageHeight + 1) / scale) - max(startY, endY) - 1); - selectionBox.setBig(XDIR, max(startX, endX)); - selectionBox.setBig(YDIR, ((imageHeight + 1) / scale) - + selectionBox.setBig(Amrvis::XDIR, max(startX, endX)); + selectionBox.setBig(Amrvis::YDIR, ((imageHeight + 1) / scale) - min(startY, endY) - 1); // selectionBox is now at the maxAllowableLevel because @@ -3265,42 +3260,42 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) trueRegion[mal] = selectionBox; // convert to point box - trueRegion[mal].setBig(XDIR, trueRegion[mal].smallEnd(XDIR)); - trueRegion[mal].setBig(YDIR, trueRegion[mal].smallEnd(YDIR)); + trueRegion[mal].setBig(Amrvis::XDIR, trueRegion[mal].smallEnd(Amrvis::XDIR)); + trueRegion[mal].setBig(Amrvis::YDIR, trueRegion[mal].smallEnd(Amrvis::YDIR)); - if(V == ZPLANE) { - trueRegion[mal].shift(XDIR, ivLowOffsetMAL[XDIR]); - trueRegion[mal].shift(YDIR, ivLowOffsetMAL[YDIR]); + if(V == Amrvis::ZPLANE) { + trueRegion[mal].shift(Amrvis::XDIR, ivLowOffsetMAL[Amrvis::XDIR]); + trueRegion[mal].shift(Amrvis::YDIR, ivLowOffsetMAL[Amrvis::YDIR]); if(BL_SPACEDIM == 3) { - trueRegion[mal].setSmall(ZDIR, plane); - trueRegion[mal].setBig(ZDIR, plane); + trueRegion[mal].setSmall(Amrvis::ZDIR, plane); + trueRegion[mal].setBig(Amrvis::ZDIR, plane); } } - if(V == YPLANE) { - trueRegion[mal].setSmall(ZDIR, trueRegion[mal].smallEnd(YDIR)); - trueRegion[mal].setBig(ZDIR, trueRegion[mal].bigEnd(YDIR)); - trueRegion[mal].setSmall(YDIR, plane); - trueRegion[mal].setBig(YDIR, plane); - trueRegion[mal].shift(XDIR, ivLowOffsetMAL[XDIR]); - trueRegion[mal].shift(ZDIR, ivLowOffsetMAL[ZDIR]); + if(V == Amrvis::YPLANE) { + trueRegion[mal].setSmall(Amrvis::ZDIR, trueRegion[mal].smallEnd(Amrvis::YDIR)); + trueRegion[mal].setBig(Amrvis::ZDIR, trueRegion[mal].bigEnd(Amrvis::YDIR)); + trueRegion[mal].setSmall(Amrvis::YDIR, plane); + trueRegion[mal].setBig(Amrvis::YDIR, plane); + trueRegion[mal].shift(Amrvis::XDIR, ivLowOffsetMAL[Amrvis::XDIR]); + trueRegion[mal].shift(Amrvis::ZDIR, ivLowOffsetMAL[Amrvis::ZDIR]); } - if(V == XPLANE) { - trueRegion[mal].setSmall(ZDIR, trueRegion[mal].smallEnd(YDIR)); - trueRegion[mal].setBig(ZDIR, trueRegion[mal].bigEnd(YDIR)); - trueRegion[mal].setSmall(YDIR, trueRegion[mal].smallEnd(XDIR)); - trueRegion[mal].setBig(YDIR, trueRegion[mal].bigEnd(XDIR)); - trueRegion[mal].setSmall(XDIR, plane); - trueRegion[mal].setBig(XDIR, plane); - trueRegion[mal].shift(YDIR, ivLowOffsetMAL[YDIR]); - trueRegion[mal].shift(ZDIR, ivLowOffsetMAL[ZDIR]); + if(V == Amrvis::XPLANE) { + trueRegion[mal].setSmall(Amrvis::ZDIR, trueRegion[mal].smallEnd(Amrvis::YDIR)); + trueRegion[mal].setBig(Amrvis::ZDIR, trueRegion[mal].bigEnd(Amrvis::YDIR)); + trueRegion[mal].setSmall(Amrvis::YDIR, trueRegion[mal].smallEnd(Amrvis::XDIR)); + trueRegion[mal].setBig(Amrvis::YDIR, trueRegion[mal].bigEnd(Amrvis::XDIR)); + trueRegion[mal].setSmall(Amrvis::XDIR, plane); + trueRegion[mal].setBig(Amrvis::XDIR, plane); + trueRegion[mal].shift(Amrvis::YDIR, ivLowOffsetMAL[Amrvis::YDIR]); + trueRegion[mal].shift(Amrvis::ZDIR, ivLowOffsetMAL[Amrvis::ZDIR]); } for(y = mal - 1; y >= 0; --y) { trueRegion[y] = trueRegion[mal]; trueRegion[y].coarsen(AVGlobals::CRRBetweenLevels(y, mal, amrData.RefRatio())); - trueRegion[y].setBig(XDIR, trueRegion[y].smallEnd(XDIR)); - trueRegion[y].setBig(YDIR, trueRegion[y].smallEnd(YDIR)); + trueRegion[y].setBig(Amrvis::XDIR, trueRegion[y].smallEnd(Amrvis::XDIR)); + trueRegion[y].setBig(Amrvis::YDIR, trueRegion[y].smallEnd(Amrvis::YDIR)); } bool goodIntersect; Real dataValue; @@ -3312,7 +3307,7 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) minDrawnLevel, maxDrawnLevel, &intersectedLevel, &intersectedGrid, &dataValue, &goodIntersect); - char dataValueCharString[LINELENGTH]; + char dataValueCharString[Amrvis::LINELENGTH]; sprintf(dataValueCharString, pltAppState->GetFormatString().c_str(), dataValue); string dataValueString(dataValueCharString); @@ -3335,12 +3330,12 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) dataValueString = "body"; } } - bool bIsMF(dataServicesPtr[currentFrame]->GetFileType() == MULTIFAB); + bool bIsMF(dataServicesPtr[currentFrame]->GetFileType() == Amrvis::MULTIFAB); if(bIsMF && intersectedLevel == 0) { dataValueString = "no data"; } - ostrstream buffout(buffer, BUFSIZ); + ostrstream buffout(buffer, Amrvis::BUFSIZE); if(goodIntersect) { buffout << '\n'; buffout << "level = " << intersectedLevel << '\n'; @@ -3355,7 +3350,7 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) double dLoc = gridOffset[idx] + (0.5 + trueRegion[mal].smallEnd()[idx]) * amrData.DxLevel()[mal][idx]; - char dLocStr[LINELENGTH]; + char dLocStr[Amrvis::LINELENGTH]; sprintf(dLocStr, pltAppState->GetFormatString().c_str(), dLoc); buffout << dLocStr; } @@ -3373,22 +3368,22 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) // tell the amrpicture about the box activeView = V; if(startX < endX) { // box in scaled pixmap space - startX = selectionBox.smallEnd(XDIR) * scale; - endX = selectionBox.bigEnd(XDIR) * scale; + startX = selectionBox.smallEnd(Amrvis::XDIR) * scale; + endX = selectionBox.bigEnd(Amrvis::XDIR) * scale; } else { - startX = selectionBox.bigEnd(XDIR) * scale; - endX = selectionBox.smallEnd(XDIR) * scale; + startX = selectionBox.bigEnd(Amrvis::XDIR) * scale; + endX = selectionBox.smallEnd(Amrvis::XDIR) * scale; } if(startY < endY) { - startY = imageHeight - selectionBox.bigEnd(YDIR) * scale; - endY = imageHeight - selectionBox.smallEnd(YDIR) * scale; + startY = imageHeight - selectionBox.bigEnd(Amrvis::YDIR) * scale; + endY = imageHeight - selectionBox.smallEnd(Amrvis::YDIR) * scale; } else { - startY = imageHeight - selectionBox.smallEnd(YDIR) * scale; - endY = imageHeight - selectionBox.bigEnd(YDIR) * scale; + startY = imageHeight - selectionBox.smallEnd(Amrvis::YDIR) * scale; + endY = imageHeight - selectionBox.bigEnd(Amrvis::YDIR) * scale; } - int nodeAdjustment = (scale - 1) * selectionBox.type()[YDIR]; + int nodeAdjustment = (scale - 1) * selectionBox.type()[Amrvis::YDIR]; startY -= nodeAdjustment; endY -= nodeAdjustment; @@ -3397,27 +3392,27 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) #if (BL_SPACEDIM == 3) amrPicturePtrArray[V]->SetSubCut(startcutX[V], startcutY[V], finishcutX[V], finishcutY[V]); - if(V == ZPLANE) { - amrPicturePtrArray[YPLANE]->SetSubCut(startcutX[V], -1, + if(V == Amrvis::ZPLANE) { + amrPicturePtrArray[Amrvis::YPLANE]->SetSubCut(startcutX[V], -1, finishcutX[V], -1); - amrPicturePtrArray[XPLANE]->SetSubCut(imageHeight-startcutY[V],-1, + amrPicturePtrArray[Amrvis::XPLANE]->SetSubCut(imageHeight-startcutY[V],-1, imageHeight-finishcutY[V],-1); } - if(V == YPLANE) { - amrPicturePtrArray[ZPLANE]->SetSubCut(startcutX[V], -1, + if(V == Amrvis::YPLANE) { + amrPicturePtrArray[Amrvis::ZPLANE]->SetSubCut(startcutX[V], -1, finishcutX[V], -1); - amrPicturePtrArray[XPLANE]->SetSubCut(-1, startcutY[V], + amrPicturePtrArray[Amrvis::XPLANE]->SetSubCut(-1, startcutY[V], -1, finishcutY[V]); } - if(V == XPLANE) { - amrPicturePtrArray[ZPLANE]->SetSubCut(-1, imageWidth-startcutX[V], + if(V == Amrvis::XPLANE) { + amrPicturePtrArray[Amrvis::ZPLANE]->SetSubCut(-1, imageWidth-startcutX[V], -1, imageWidth-finishcutX[V]); - amrPicturePtrArray[YPLANE]->SetSubCut(-1, startcutY[V], + amrPicturePtrArray[Amrvis::YPLANE]->SetSubCut(-1, startcutY[V], -1, finishcutY[V]); } #endif - for(int np(0); np < NPLANES; ++np) { + for(int np(0); np < Amrvis::NPLANES; ++np) { amrPicturePtrArray[np]->DoExposePicture(); } } @@ -3440,18 +3435,18 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) #if (BL_SPACEDIM == 3) switch (V) { - case ZPLANE: - XDrawLine(display, amrPicturePtrArray[XPLANE]->PictureWindow(), + case Amrvis::ZPLANE: + XDrawLine(display, amrPicturePtrArray[Amrvis::XPLANE]->PictureWindow(), rbgc, imageHeight-oldY, 0, imageHeight-oldY, - amrPicturePtrArray[XPLANE]->ImageSizeV()); + amrPicturePtrArray[Amrvis::XPLANE]->ImageSizeV()); break; - case YPLANE: - XDrawLine(display, amrPicturePtrArray[XPLANE]->PictureWindow(), rbgc, - 0, oldY, amrPicturePtrArray[XPLANE]->ImageSizeH(), oldY); + case Amrvis::YPLANE: + XDrawLine(display, amrPicturePtrArray[Amrvis::XPLANE]->PictureWindow(), rbgc, + 0, oldY, amrPicturePtrArray[Amrvis::XPLANE]->ImageSizeH(), oldY); break; - default: // XPLANE - XDrawLine(display, amrPicturePtrArray[YPLANE]->PictureWindow(), rbgc, - 0, oldY, amrPicturePtrArray[YPLANE]->ImageSizeH(), oldY); + default: // Amrvis::XPLANE + XDrawLine(display, amrPicturePtrArray[Amrvis::YPLANE]->PictureWindow(), rbgc, + 0, oldY, amrPicturePtrArray[Amrvis::YPLANE]->ImageSizeH(), oldY); } #endif int tempi; @@ -3466,16 +3461,16 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) rbgc, 0, oldY, imageWidth, oldY); #if (BL_SPACEDIM == 3) // undraw in other planes - if(V == ZPLANE) { - XDrawLine(display, amrPicturePtrArray[XPLANE]->PictureWindow(), + if(V == Amrvis::ZPLANE) { + XDrawLine(display, amrPicturePtrArray[Amrvis::XPLANE]->PictureWindow(), rbgc, imageHeight-oldY, 0, imageHeight-oldY, - amrPicturePtrArray[XPLANE]->ImageSizeV()); - } else if(V == YPLANE) { - XDrawLine(display, amrPicturePtrArray[XPLANE]->PictureWindow(), rbgc, - 0, oldY, amrPicturePtrArray[XPLANE]->ImageSizeH(), oldY); - } else if(V == XPLANE) { - XDrawLine(display, amrPicturePtrArray[YPLANE]->PictureWindow(), rbgc, - 0, oldY, amrPicturePtrArray[YPLANE]->ImageSizeH(), oldY); + amrPicturePtrArray[Amrvis::XPLANE]->ImageSizeV()); + } else if(V == Amrvis::YPLANE) { + XDrawLine(display, amrPicturePtrArray[Amrvis::XPLANE]->PictureWindow(), rbgc, + 0, oldY, amrPicturePtrArray[Amrvis::XPLANE]->ImageSizeH(), oldY); + } else if(V == Amrvis::XPLANE) { + XDrawLine(display, amrPicturePtrArray[Amrvis::YPLANE]->PictureWindow(), rbgc, + 0, oldY, amrPicturePtrArray[Amrvis::YPLANE]->ImageSizeH(), oldY); } #endif @@ -3492,18 +3487,18 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) rbgc, 0, oldY, imageWidth, oldY); #if (BL_SPACEDIM == 3) switch (V) { - case ZPLANE: - XDrawLine(display, amrPicturePtrArray[XPLANE]->PictureWindow(), + case Amrvis::ZPLANE: + XDrawLine(display, amrPicturePtrArray[Amrvis::XPLANE]->PictureWindow(), rbgc, imageHeight-oldY, 0, imageHeight-oldY, - amrPicturePtrArray[XPLANE]->ImageSizeV()); + amrPicturePtrArray[Amrvis::XPLANE]->ImageSizeV()); break; - case YPLANE: - XDrawLine(display, amrPicturePtrArray[XPLANE]->PictureWindow(), rbgc, - 0, oldY, amrPicturePtrArray[XPLANE]->ImageSizeH(), oldY); + case Amrvis::YPLANE: + XDrawLine(display, amrPicturePtrArray[Amrvis::XPLANE]->PictureWindow(), rbgc, + 0, oldY, amrPicturePtrArray[Amrvis::XPLANE]->ImageSizeH(), oldY); break; - default: // XPLANE - XDrawLine(display, amrPicturePtrArray[YPLANE]->PictureWindow(), rbgc, - 0, oldY, amrPicturePtrArray[YPLANE]->ImageSizeH(), oldY); + default: // Amrvis::XPLANE + XDrawLine(display, amrPicturePtrArray[Amrvis::YPLANE]->PictureWindow(), rbgc, + 0, oldY, amrPicturePtrArray[Amrvis::YPLANE]->ImageSizeH(), oldY); } #endif @@ -3514,33 +3509,33 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) tempi = max(0, min(imageHeight, nextEvent.xbutton.y)); amrPicturePtrArray[V]->SetHLine(tempi); #if (BL_SPACEDIM == 3) - if(V == ZPLANE) { - amrPicturePtrArray[XPLANE]->SetVLine(amrPicturePtrArray[XPLANE]-> + if(V == Amrvis::ZPLANE) { + amrPicturePtrArray[Amrvis::XPLANE]->SetVLine(amrPicturePtrArray[Amrvis::XPLANE]-> ImageSizeH()-1 - tempi); } - if(V == YPLANE) { - amrPicturePtrArray[XPLANE]->SetHLine(tempi); + if(V == Amrvis::YPLANE) { + amrPicturePtrArray[Amrvis::XPLANE]->SetHLine(tempi); } - if(V == XPLANE) { - amrPicturePtrArray[YPLANE]->SetHLine(tempi); + if(V == Amrvis::XPLANE) { + amrPicturePtrArray[Amrvis::YPLANE]->SetHLine(tempi); } if( ! ( (cbs->event->xbutton.state & ShiftMask) || (cbs->event->xbutton.state & ControlMask) ) ) { - if(V == ZPLANE) { - amrPicturePtrArray[YPLANE]-> - APChangeSlice((imageHeight - tempi)/scale + ivLowOffsetMAL[YDIR]); + if(V == Amrvis::ZPLANE) { + amrPicturePtrArray[Amrvis::YPLANE]-> + APChangeSlice((imageHeight - tempi)/scale + ivLowOffsetMAL[Amrvis::YDIR]); } - if(V == YPLANE) { - amrPicturePtrArray[ZPLANE]-> - APChangeSlice((imageHeight - tempi)/scale + ivLowOffsetMAL[ZDIR]); + if(V == Amrvis::YPLANE) { + amrPicturePtrArray[Amrvis::ZPLANE]-> + APChangeSlice((imageHeight - tempi)/scale + ivLowOffsetMAL[Amrvis::ZDIR]); } - if(V == XPLANE) { - amrPicturePtrArray[ZPLANE]-> - APChangeSlice((imageHeight - tempi)/scale + ivLowOffsetMAL[ZDIR]); + if(V == Amrvis::XPLANE) { + amrPicturePtrArray[Amrvis::ZPLANE]-> + APChangeSlice((imageHeight - tempi)/scale + ivLowOffsetMAL[Amrvis::ZDIR]); } - for(int np(0); np < NPLANES; ++np) { + for(int np(0); np < Amrvis::NPLANES; ++np) { amrPicturePtrArray[np]->DoExposePicture(); projPicturePtr->ChangeSlice(np, amrPicturePtrArray[np]->GetSlice()); } @@ -3556,21 +3551,21 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) } #endif - for(int np(0); np != NPLANES; ++np) { + for(int np(0); np != Amrvis::NPLANES; ++np) { amrPicturePtrArray[np]->DoExposePicture(); } if(oldY >= 0 && oldY <= imageHeight) { int sdir(-1); switch (V) { - case ZPLANE: - sdir = XDIR; + case Amrvis::ZPLANE: + sdir = Amrvis::XDIR; break; - case YPLANE: - sdir = XDIR; + case Amrvis::YPLANE: + sdir = Amrvis::XDIR; break; - case XPLANE: - sdir = YDIR; + case Amrvis::XPLANE: + sdir = Amrvis::YDIR; break; } XYPlotDataList *newlist = CreateLinePlot(V, sdir, mal, @@ -3579,7 +3574,7 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) if(newlist) { newlist->SetLevel(maxDrawnLevel); if(XYplotwin[sdir] == NULL) { - char cTempFN[BUFSIZ]; + char cTempFN[Amrvis::BUFSIZE]; strcpy(cTempFN, AVGlobals::StripSlashes(fileNames[currentFrame]).c_str()); XYplotwin[sdir] = new XYPlotWin(cTempFN, appContext, wAmrVisTopLevel, @@ -3604,17 +3599,17 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) XDrawLine(display, amrPicturePtrArray[V]->PictureWindow(), rbgc, oldX, 0, oldX, imageHeight); #if (BL_SPACEDIM == 3) - if(V == ZPLANE) { - XDrawLine(display, amrPicturePtrArray[YPLANE]->PictureWindow(), rbgc, - oldX, 0, oldX, amrPicturePtrArray[YPLANE]->ImageSizeV()); + if(V == Amrvis::ZPLANE) { + XDrawLine(display, amrPicturePtrArray[Amrvis::YPLANE]->PictureWindow(), rbgc, + oldX, 0, oldX, amrPicturePtrArray[Amrvis::YPLANE]->ImageSizeV()); } - if(V == YPLANE) { - XDrawLine(display, amrPicturePtrArray[ZPLANE]->PictureWindow(),rbgc, - oldX, 0, oldX, amrPicturePtrArray[ZPLANE]->ImageSizeV()); + if(V == Amrvis::YPLANE) { + XDrawLine(display, amrPicturePtrArray[Amrvis::ZPLANE]->PictureWindow(),rbgc, + oldX, 0, oldX, amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeV()); } - if(V == XPLANE) { - XDrawLine(display, amrPicturePtrArray[ZPLANE]->PictureWindow(), rbgc, - 0, imageWidth - oldX, amrPicturePtrArray[ZPLANE]->ImageSizeH(), + if(V == Amrvis::XPLANE) { + XDrawLine(display, amrPicturePtrArray[Amrvis::ZPLANE]->PictureWindow(), rbgc, + 0, imageWidth - oldX, amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeH(), imageWidth - oldX); } #endif @@ -3630,17 +3625,17 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) rbgc, oldX, 0, oldX, imageHeight); #if (BL_SPACEDIM == 3) // undraw in other planes - if(V == ZPLANE) { - XDrawLine(display, amrPicturePtrArray[YPLANE]->PictureWindow(), rbgc, - oldX, 0, oldX, amrPicturePtrArray[YPLANE]->ImageSizeV()); + if(V == Amrvis::ZPLANE) { + XDrawLine(display, amrPicturePtrArray[Amrvis::YPLANE]->PictureWindow(), rbgc, + oldX, 0, oldX, amrPicturePtrArray[Amrvis::YPLANE]->ImageSizeV()); } - if(V == YPLANE) { - XDrawLine(display, amrPicturePtrArray[ZPLANE]->PictureWindow(), rbgc, - oldX, 0, oldX, amrPicturePtrArray[ZPLANE]->ImageSizeV()); + if(V == Amrvis::YPLANE) { + XDrawLine(display, amrPicturePtrArray[Amrvis::ZPLANE]->PictureWindow(), rbgc, + oldX, 0, oldX, amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeV()); } - if(V == XPLANE) { - XDrawLine(display, amrPicturePtrArray[ZPLANE]->PictureWindow(), rbgc, - 0, imageWidth-oldX, amrPicturePtrArray[ZPLANE]->ImageSizeH(), + if(V == Amrvis::XPLANE) { + XDrawLine(display, amrPicturePtrArray[Amrvis::ZPLANE]->PictureWindow(), rbgc, + 0, imageWidth-oldX, amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeH(), imageWidth-oldX); } #endif @@ -3657,17 +3652,17 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) XDrawLine(display, amrPicturePtrArray[V]->PictureWindow(), rbgc, oldX, 0, oldX, imageHeight); #if (BL_SPACEDIM == 3) - if(V == ZPLANE) { - XDrawLine(display, amrPicturePtrArray[YPLANE]->PictureWindow(), rbgc, - oldX, 0, oldX, amrPicturePtrArray[YPLANE]->ImageSizeV()); + if(V == Amrvis::ZPLANE) { + XDrawLine(display, amrPicturePtrArray[Amrvis::YPLANE]->PictureWindow(), rbgc, + oldX, 0, oldX, amrPicturePtrArray[Amrvis::YPLANE]->ImageSizeV()); } - if(V == YPLANE) { - XDrawLine(display, amrPicturePtrArray[ZPLANE]->PictureWindow(), rbgc, - oldX, 0, oldX, amrPicturePtrArray[ZPLANE]->ImageSizeV()); + if(V == Amrvis::YPLANE) { + XDrawLine(display, amrPicturePtrArray[Amrvis::ZPLANE]->PictureWindow(), rbgc, + oldX, 0, oldX, amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeV()); } - if(V == XPLANE) { - XDrawLine(display, amrPicturePtrArray[ZPLANE]->PictureWindow(), rbgc, - 0, imageWidth - oldX, amrPicturePtrArray[ZPLANE]->ImageSizeH(), + if(V == Amrvis::XPLANE) { + XDrawLine(display, amrPicturePtrArray[Amrvis::ZPLANE]->PictureWindow(), rbgc, + 0, imageWidth - oldX, amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeH(), imageWidth - oldX); } #endif @@ -3679,34 +3674,34 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) tempi = max(0, min(imageWidth, nextEvent.xbutton.x)); amrPicturePtrArray[V]->SetVLine(tempi); #if (BL_SPACEDIM == 3) - if(V == ZPLANE) { - amrPicturePtrArray[YPLANE]->SetVLine(tempi); + if(V == Amrvis::ZPLANE) { + amrPicturePtrArray[Amrvis::YPLANE]->SetVLine(tempi); } - if(V == YPLANE) { - amrPicturePtrArray[ZPLANE]->SetVLine(tempi); + if(V == Amrvis::YPLANE) { + amrPicturePtrArray[Amrvis::ZPLANE]->SetVLine(tempi); } - if(V == XPLANE) { - amrPicturePtrArray[ZPLANE]->SetHLine(amrPicturePtrArray[ZPLANE]-> + if(V == Amrvis::XPLANE) { + amrPicturePtrArray[Amrvis::ZPLANE]->SetHLine(amrPicturePtrArray[Amrvis::ZPLANE]-> ImageSizeV()-1 - tempi); } if( ! ( (cbs->event->xbutton.state & ShiftMask) || (cbs->event->xbutton.state & ControlMask) ) ) { - if(V == ZPLANE) { - amrPicturePtrArray[XPLANE]-> - APChangeSlice((tempi / scale) + ivLowOffsetMAL[XDIR]); + if(V == Amrvis::ZPLANE) { + amrPicturePtrArray[Amrvis::XPLANE]-> + APChangeSlice((tempi / scale) + ivLowOffsetMAL[Amrvis::XDIR]); } - if(V == YPLANE) { - amrPicturePtrArray[XPLANE]-> - APChangeSlice((tempi / scale) + ivLowOffsetMAL[XDIR]); + if(V == Amrvis::YPLANE) { + amrPicturePtrArray[Amrvis::XPLANE]-> + APChangeSlice((tempi / scale) + ivLowOffsetMAL[Amrvis::XDIR]); } - if(V == XPLANE) { - amrPicturePtrArray[YPLANE]-> - APChangeSlice((tempi / scale) + ivLowOffsetMAL[YDIR]); + if(V == Amrvis::XPLANE) { + amrPicturePtrArray[Amrvis::YPLANE]-> + APChangeSlice((tempi / scale) + ivLowOffsetMAL[Amrvis::YDIR]); } - for(int np(0); np < NPLANES; ++np) { + for(int np(0); np < Amrvis::NPLANES; ++np) { amrPicturePtrArray[np]->DoExposePicture(); projPicturePtr->ChangeSlice(np, amrPicturePtrArray[np]->GetSlice()); } @@ -3722,21 +3717,21 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) } #endif - for(int np(0); np != NPLANES; ++np) { + for(int np(0); np != Amrvis::NPLANES; ++np) { amrPicturePtrArray[np]->DoExposePicture(); } if(oldX >= 0 && oldX <= imageWidth) { int sdir(-1); switch (V) { - case ZPLANE: - sdir = YDIR; + case Amrvis::ZPLANE: + sdir = Amrvis::YDIR; break; - case YPLANE: - sdir = ZDIR; + case Amrvis::YPLANE: + sdir = Amrvis::ZDIR; break; - case XPLANE: - sdir = ZDIR; + case Amrvis::XPLANE: + sdir = Amrvis::ZDIR; break; } XYPlotDataList *newlist = CreateLinePlot(V, sdir, mal, oldX / scale, @@ -3744,7 +3739,7 @@ void PltApp::DoRubberBanding(Widget, XtPointer client_data, XtPointer call_data) if(newlist) { newlist->SetLevel(maxDrawnLevel); if(XYplotwin[sdir] == NULL) { - char cTempFN[BUFSIZ]; + char cTempFN[Amrvis::BUFSIZE]; strcpy(cTempFN, AVGlobals::StripSlashes(fileNames[currentFrame]).c_str()); XYplotwin[sdir] = new XYPlotWin(cTempFN, appContext, wAmrVisTopLevel, @@ -3809,40 +3804,40 @@ void PltApp::DoDrawPointerLocation(Widget, XtPointer data, XtPointer cbe) { &rootX, &rootY, &newX, &newY, &inputMask); int iVertLoc, iHorizLoc; - char locText[LINELENGTH], locTextFormat[LINELENGTH]; + char locText[Amrvis::LINELENGTH], locTextFormat[Amrvis::LINELENGTH]; #if (BL_SPACEDIM == 3) int iPlaneLoc(amrPicturePtrArray[V]->GetSlice()); - double Xloc(gridOffset[XDIR]); - double Yloc(gridOffset[YDIR]); - double Zloc(gridOffset[ZDIR]); + double Xloc(gridOffset[Amrvis::XDIR]); + double Yloc(gridOffset[Amrvis::YDIR]); + double Zloc(gridOffset[Amrvis::ZDIR]); switch(V) { - case ZPLANE: + case Amrvis::ZPLANE: iVertLoc = ((amrPicturePtrArray[V]->ImageSizeV())/currentScale) - - 1 - (newY / currentScale) + ivLowOffsetMAL[YDIR]; - iHorizLoc = newX / currentScale + ivLowOffsetMAL[XDIR]; - Xloc += (0.5 + iHorizLoc) * finestDx[XDIR]; - Yloc += (0.5 + iVertLoc) * finestDx[YDIR]; - Zloc += (0.5 + iPlaneLoc) * finestDx[ZDIR]; + 1 - (newY / currentScale) + ivLowOffsetMAL[Amrvis::YDIR]; + iHorizLoc = newX / currentScale + ivLowOffsetMAL[Amrvis::XDIR]; + Xloc += (0.5 + iHorizLoc) * finestDx[Amrvis::XDIR]; + Yloc += (0.5 + iVertLoc) * finestDx[Amrvis::YDIR]; + Zloc += (0.5 + iPlaneLoc) * finestDx[Amrvis::ZDIR]; break; - case YPLANE: + case Amrvis::YPLANE: iVertLoc = ((amrPicturePtrArray[V]->ImageSizeV())/currentScale) - - 1 - (newY / currentScale) + ivLowOffsetMAL[ZDIR]; - iHorizLoc = newX / currentScale + ivLowOffsetMAL[XDIR]; - Xloc += (0.5 + iHorizLoc) * finestDx[XDIR]; - Yloc += (0.5 + iPlaneLoc) * finestDx[YDIR]; - Zloc += (0.5 + iVertLoc) * finestDx[ZDIR]; + 1 - (newY / currentScale) + ivLowOffsetMAL[Amrvis::ZDIR]; + iHorizLoc = newX / currentScale + ivLowOffsetMAL[Amrvis::XDIR]; + Xloc += (0.5 + iHorizLoc) * finestDx[Amrvis::XDIR]; + Yloc += (0.5 + iPlaneLoc) * finestDx[Amrvis::YDIR]; + Zloc += (0.5 + iVertLoc) * finestDx[Amrvis::ZDIR]; break; - case XPLANE: + case Amrvis::XPLANE: iVertLoc = ((amrPicturePtrArray[V]->ImageSizeV())/currentScale) - - 1 - (newY / currentScale) + ivLowOffsetMAL[ZDIR]; - iHorizLoc = newX / currentScale + ivLowOffsetMAL[YDIR]; - Xloc += (0.5 + iPlaneLoc) * finestDx[XDIR]; - Yloc += (0.5 + iHorizLoc) * finestDx[YDIR]; - Zloc += (0.5 + iVertLoc) * finestDx[ZDIR]; + 1 - (newY / currentScale) + ivLowOffsetMAL[Amrvis::ZDIR]; + iHorizLoc = newX / currentScale + ivLowOffsetMAL[Amrvis::YDIR]; + Xloc += (0.5 + iPlaneLoc) * finestDx[Amrvis::XDIR]; + Yloc += (0.5 + iHorizLoc) * finestDx[Amrvis::YDIR]; + Zloc += (0.5 + iVertLoc) * finestDx[Amrvis::ZDIR]; break; } string fstr = pltAppState->GetFormatString(); @@ -3850,10 +3845,10 @@ void PltApp::DoDrawPointerLocation(Widget, XtPointer data, XtPointer cbe) { sprintf(locText, locTextFormat, Xloc, Yloc, Zloc); #elif (BL_SPACEDIM == 2) iVertLoc = ((amrPicturePtrArray[V]->ImageSizeV())/currentScale) - - 1 - (newY / currentScale) + ivLowOffsetMAL[YDIR]; - iHorizLoc = newX / currentScale + ivLowOffsetMAL[XDIR]; - double Xloc(gridOffset[XDIR] + (0.5 + iHorizLoc) * finestDx[XDIR]); - double Yloc(gridOffset[YDIR] + (0.5 + iVertLoc) * finestDx[YDIR]); + 1 - (newY / currentScale) + ivLowOffsetMAL[Amrvis::YDIR]; + iHorizLoc = newX / currentScale + ivLowOffsetMAL[Amrvis::XDIR]; + double Xloc(gridOffset[Amrvis::XDIR] + (0.5 + iHorizLoc) * finestDx[Amrvis::XDIR]); + double Yloc(gridOffset[Amrvis::YDIR] + (0.5 + iVertLoc) * finestDx[Amrvis::YDIR]); string fstr = pltAppState->GetFormatString(); sprintf(locTextFormat, "(%s, %s)", fstr.c_str(), fstr.c_str()); sprintf(locText, locTextFormat, Xloc, Yloc); @@ -3886,13 +3881,13 @@ void PltApp::DoBackStep(int plane) { const AmrData &amrData = dataServicesPtr[currentFrame]->AmrDataRef(); int crrDiff(AVGlobals::CRRBetweenLevels(maxDrawnLev, maxAllowLev, amrData.RefRatio())); - AmrPicture *appX = amrPicturePtrArray[XPLANE]; - AmrPicture *appY = amrPicturePtrArray[YPLANE]; - AmrPicture *appZ = amrPicturePtrArray[ZPLANE]; + AmrPicture *appX = amrPicturePtrArray[Amrvis::XPLANE]; + AmrPicture *appY = amrPicturePtrArray[Amrvis::YPLANE]; + AmrPicture *appZ = amrPicturePtrArray[Amrvis::ZPLANE]; switch(plane) { - case XPLANE: + case Amrvis::XPLANE: if(appX->GetSlice() / crrDiff > - appX->GetSubDomain()[maxAllowLev].smallEnd(XDIR) / crrDiff) + appX->GetSubDomain()[maxAllowLev].smallEnd(Amrvis::XDIR) / crrDiff) { appZ->SetVLine(appZ->GetVLine() - currentScale * crrDiff); appZ->DoExposePicture(); @@ -3905,12 +3900,12 @@ void PltApp::DoBackStep(int plane) { appZ->DoExposePicture(); appY->SetVLine(appY->ImageSizeH() - 1); appY->DoExposePicture(); - appX-> APChangeSlice(appX->GetSubDomain()[maxAllowLev].bigEnd(XDIR)); + appX-> APChangeSlice(appX->GetSubDomain()[maxAllowLev].bigEnd(Amrvis::XDIR)); break; - case YPLANE: + case Amrvis::YPLANE: if(appY->GetSlice() / crrDiff > - appY->GetSubDomain()[maxAllowLev].smallEnd(YDIR) / crrDiff) + appY->GetSubDomain()[maxAllowLev].smallEnd(Amrvis::YDIR) / crrDiff) { appX->SetVLine(appX->GetVLine() - currentScale * crrDiff); appX->DoExposePicture(); @@ -3923,12 +3918,12 @@ void PltApp::DoBackStep(int plane) { appX->DoExposePicture(); appZ->SetHLine(0); appZ->DoExposePicture(); - appY->APChangeSlice(appY->GetSubDomain()[maxAllowLev].bigEnd(YDIR)); + appY->APChangeSlice(appY->GetSubDomain()[maxAllowLev].bigEnd(Amrvis::YDIR)); break; - case ZPLANE: + case Amrvis::ZPLANE: if(appZ->GetSlice() / crrDiff > - appZ->GetSubDomain()[maxAllowLev].smallEnd(ZDIR) / crrDiff) + appZ->GetSubDomain()[maxAllowLev].smallEnd(Amrvis::ZDIR) / crrDiff) { appX->SetHLine(appX->GetHLine() + currentScale * crrDiff); appX->DoExposePicture(); @@ -3941,7 +3936,7 @@ void PltApp::DoBackStep(int plane) { appX->DoExposePicture(); appY->SetHLine(0); appY->DoExposePicture(); - appZ->APChangeSlice(appZ->GetSubDomain()[maxAllowLev].bigEnd(ZDIR)); + appZ->APChangeSlice(appZ->GetSubDomain()[maxAllowLev].bigEnd(Amrvis::ZDIR)); } #if (BL_SPACEDIM == 3) @@ -3965,13 +3960,13 @@ void PltApp::DoForwardStep(int plane) { const AmrData &amrData = dataServicesPtr[currentFrame]->AmrDataRef(); int crrDiff(AVGlobals::CRRBetweenLevels(maxDrawnLev, maxAllowLev, amrData.RefRatio())); - AmrPicture *appX = amrPicturePtrArray[XPLANE]; - AmrPicture *appY = amrPicturePtrArray[YPLANE]; - AmrPicture *appZ = amrPicturePtrArray[ZPLANE]; + AmrPicture *appX = amrPicturePtrArray[Amrvis::XPLANE]; + AmrPicture *appY = amrPicturePtrArray[Amrvis::YPLANE]; + AmrPicture *appZ = amrPicturePtrArray[Amrvis::ZPLANE]; switch(plane) { - case XPLANE: + case Amrvis::XPLANE: if(appX->GetSlice() / crrDiff < - appX->GetSubDomain()[maxAllowLev].bigEnd(XDIR) / crrDiff) + appX->GetSubDomain()[maxAllowLev].bigEnd(Amrvis::XDIR) / crrDiff) { appZ->SetVLine(appZ->GetVLine() + currentScale * crrDiff); appZ->DoExposePicture(); @@ -3984,12 +3979,12 @@ void PltApp::DoForwardStep(int plane) { appZ->DoExposePicture(); appY->SetVLine(0); appY->DoExposePicture(); - appX->APChangeSlice(appX->GetSubDomain()[maxAllowLev].smallEnd(XDIR)); + appX->APChangeSlice(appX->GetSubDomain()[maxAllowLev].smallEnd(Amrvis::XDIR)); break; - case YPLANE: + case Amrvis::YPLANE: if(appY->GetSlice() / crrDiff < - appY->GetSubDomain()[maxAllowLev].bigEnd(YDIR) / crrDiff) + appY->GetSubDomain()[maxAllowLev].bigEnd(Amrvis::YDIR) / crrDiff) { appX->SetVLine(appX->GetVLine() + currentScale * crrDiff); appX->DoExposePicture(); @@ -4002,12 +3997,12 @@ void PltApp::DoForwardStep(int plane) { appX->DoExposePicture(); appZ->SetHLine(appX->ImageSizeV() - 1); appZ->DoExposePicture(); - appY->APChangeSlice(appY->GetSubDomain()[maxAllowLev].smallEnd(YDIR)); + appY->APChangeSlice(appY->GetSubDomain()[maxAllowLev].smallEnd(Amrvis::YDIR)); break; - case ZPLANE: + case Amrvis::ZPLANE: if(appZ->GetSlice() / crrDiff < - appZ->GetSubDomain()[maxAllowLev].bigEnd(ZDIR) / crrDiff) + appZ->GetSubDomain()[maxAllowLev].bigEnd(Amrvis::ZDIR) / crrDiff) { appX->SetHLine(appX->GetHLine() - currentScale * crrDiff); appX->DoExposePicture(); @@ -4020,7 +4015,7 @@ void PltApp::DoForwardStep(int plane) { appX->DoExposePicture(); appY->SetHLine(appY->ImageSizeV() - 1); appY->DoExposePicture(); - appZ->APChangeSlice(appZ->GetSubDomain()[maxAllowLev].smallEnd(ZDIR)); + appZ->APChangeSlice(appZ->GetSubDomain()[maxAllowLev].smallEnd(Amrvis::ZDIR)); } #if (BL_SPACEDIM == 3) projPicturePtr->ChangeSlice(plane, amrPicturePtrArray[plane]->GetSlice()); @@ -4042,9 +4037,9 @@ void PltApp::ChangePlane(Widget, XtPointer data, XtPointer cbs) { #if (BL_SPACEDIM == 3) if(which == WCSTOP) { - amrPicturePtrArray[XPLANE]->DoStop(); - amrPicturePtrArray[YPLANE]->DoStop(); - amrPicturePtrArray[ZPLANE]->DoStop(); + amrPicturePtrArray[Amrvis::XPLANE]->DoStop(); + amrPicturePtrArray[Amrvis::YPLANE]->DoStop(); + amrPicturePtrArray[Amrvis::ZPLANE]->DoStop(); return; } #endif @@ -4062,27 +4057,27 @@ void PltApp::ChangePlane(Widget, XtPointer data, XtPointer cbs) { if(cbstr->click_count > 1 || bShiftDown) { switch(which) { #if (BL_SPACEDIM == 3) - case WCXNEG: amrPicturePtrArray[XPLANE]->Sweep(ANIMNEGDIR); return; - case WCXPOS: amrPicturePtrArray[XPLANE]->Sweep(ANIMPOSDIR); return; - case WCYNEG: amrPicturePtrArray[YPLANE]->Sweep(ANIMNEGDIR); return; - case WCYPOS: amrPicturePtrArray[YPLANE]->Sweep(ANIMPOSDIR); return; - case WCZNEG: amrPicturePtrArray[ZPLANE]->Sweep(ANIMNEGDIR); return; - case WCZPOS: amrPicturePtrArray[ZPLANE]->Sweep(ANIMPOSDIR); return; + case WCXNEG: amrPicturePtrArray[Amrvis::XPLANE]->Sweep(Amrvis::ANIMNEGDIR); return; + case WCXPOS: amrPicturePtrArray[Amrvis::XPLANE]->Sweep(Amrvis::ANIMPOSDIR); return; + case WCYNEG: amrPicturePtrArray[Amrvis::YPLANE]->Sweep(Amrvis::ANIMNEGDIR); return; + case WCYPOS: amrPicturePtrArray[Amrvis::YPLANE]->Sweep(Amrvis::ANIMPOSDIR); return; + case WCZNEG: amrPicturePtrArray[Amrvis::ZPLANE]->Sweep(Amrvis::ANIMNEGDIR); return; + case WCZPOS: amrPicturePtrArray[Amrvis::ZPLANE]->Sweep(Amrvis::ANIMPOSDIR); return; #endif - case WCATNEG: Animate(ANIMNEGDIR); return; - case WCATPOS: Animate(ANIMPOSDIR); return; - case WCARGB: writingRGB = true; Animate(ANIMPOSDIR); return; + case WCATNEG: Animate(Amrvis::ANIMNEGDIR); return; + case WCATPOS: Animate(Amrvis::ANIMPOSDIR); return; + case WCARGB: writingRGB = true; Animate(Amrvis::ANIMPOSDIR); return; default: return; } } switch(which) { #if (BL_SPACEDIM == 3) - case WCXNEG: DoBackStep(XPLANE); return; - case WCXPOS: DoForwardStep(XPLANE); return; - case WCYNEG: DoBackStep(YPLANE); return; - case WCYPOS: DoForwardStep(YPLANE); return; - case WCZNEG: DoBackStep(ZPLANE); return; - case WCZPOS: DoForwardStep(ZPLANE); return; + case WCXNEG: DoBackStep(Amrvis::XPLANE); return; + case WCXPOS: DoForwardStep(Amrvis::XPLANE); return; + case WCYNEG: DoBackStep(Amrvis::YPLANE); return; + case WCYPOS: DoForwardStep(Amrvis::YPLANE); return; + case WCZNEG: DoBackStep(Amrvis::ZPLANE); return; + case WCZPOS: DoForwardStep(Amrvis::ZPLANE); return; #endif case WCATNEG: DoAnimBackStep(); return; case WCATPOS: DoAnimForwardStep(); return; @@ -4134,31 +4129,31 @@ void PltApp::ResetAnimation() { if( ! interfaceReady) { #if(BL_SPACEDIM == 2) int maLev(pltAppState->MaxAllowableLevel()); - AmrPicture *Tempap = amrPicturePtrArray[ZPLANE]; - XtRemoveEventHandler(wPlotPlane[ZPLANE], ExposureMask, false, + AmrPicture *Tempap = amrPicturePtrArray[Amrvis::ZPLANE]; + XtRemoveEventHandler(wPlotPlane[Amrvis::ZPLANE], ExposureMask, false, (XtEventHandler) &PltApp::StaticEvent, (XtPointer) Tempap); - Box fineDomain(amrPicturePtrArray[ZPLANE]->GetSubDomain()[maLev]); + Box fineDomain(amrPicturePtrArray[Amrvis::ZPLANE]->GetSubDomain()[maLev]); delete Tempap; const AmrData &amrData = dataServicesPtr[currentFrame]->AmrDataRef(); fineDomain.refine(AVGlobals::CRRBetweenLevels(maLev, amrData.FinestLevel(), amrData.RefRatio())); - amrPicturePtrArray[ZPLANE] = new AmrPicture(ZPLANE, gaPtr, fineDomain, + amrPicturePtrArray[Amrvis::ZPLANE] = new AmrPicture(Amrvis::ZPLANE, gaPtr, fineDomain, NULL, this, pltAppState, bCartGridSmoothing); - amrPicturePtrArray[ZPLANE]->SetRegion(startX, startY, endX, endY); + amrPicturePtrArray[Amrvis::ZPLANE]->SetRegion(startX, startY, endX, endY); //pltAppState->SetMaxDrawnLevel(maxDrawnLevel); //SetNumContours(false); - //XtRemoveEventHandler(wPlotPlane[ZPLANE], ExposureMask, false, + //XtRemoveEventHandler(wPlotPlane[Amrvis::ZPLANE], ExposureMask, false, //(XtEventHandler) &PltApp::StaticEvent, //(XtPointer) Tempap); //delete Tempap; - amrPicturePtrArray[ZPLANE]->CreatePicture(XtWindow(wPlotPlane[ZPLANE]), + amrPicturePtrArray[Amrvis::ZPLANE]->CreatePicture(XtWindow(wPlotPlane[Amrvis::ZPLANE]), pltPaletteptr); - AddStaticEventHandler(wPlotPlane[ZPLANE], ExposureMask, - &PltApp::PADoExposePicture, (XtPointer) ZPLANE); + AddStaticEventHandler(wPlotPlane[Amrvis::ZPLANE], ExposureMask, + &PltApp::PADoExposePicture, (XtPointer) Amrvis::ZPLANE); interfaceReady = true; #endif } @@ -4182,7 +4177,7 @@ void PltApp::StopAnimation() { // ------------------------------------------------------------------- -void PltApp::Animate(AnimDirection direction) { +void PltApp::Animate(Amrvis::AnimDirection direction) { StopAnimation(); animationIId = AddStaticTimeOut(frameSpeed, &PltApp::DoUpdateFrame); animDirection = direction; @@ -4210,7 +4205,7 @@ void PltApp::DirtyFrames() { // ------------------------------------------------------------------- void PltApp::DoUpdateFrame(Widget, XtPointer, XtPointer) { - if(animDirection == ANIMPOSDIR) { + if(animDirection == Amrvis::ANIMPOSDIR) { if(writingRGB) { DoCreateAnimRGBFile(); } @@ -4239,9 +4234,9 @@ void PltApp::ShowFrame() { UsingFileRange(currentRangeType)) { #if (BL_SPACEDIM == 2) - AmrPicture *tempapSF = amrPicturePtrArray[ZPLANE]; - Array domain = amrPicturePtrArray[ZPLANE]->GetSubDomain(); - XtRemoveEventHandler(wPlotPlane[ZPLANE], ExposureMask, false, + AmrPicture *tempapSF = amrPicturePtrArray[Amrvis::ZPLANE]; + Array domain = amrPicturePtrArray[Amrvis::ZPLANE]->GetSubDomain(); + XtRemoveEventHandler(wPlotPlane[Amrvis::ZPLANE], ExposureMask, false, (XtEventHandler) &PltApp::StaticEvent, (XtPointer) tempapSF); delete tempapSF; @@ -4250,27 +4245,27 @@ void PltApp::ShowFrame() { fineDomain.refine(AVGlobals::CRRBetweenLevels(pltAppState->MaxAllowableLevel(), amrData.FinestLevel(), amrData.RefRatio())); - amrPicturePtrArray[ZPLANE] = new AmrPicture(ZPLANE, gaPtr, fineDomain, + amrPicturePtrArray[Amrvis::ZPLANE] = new AmrPicture(Amrvis::ZPLANE, gaPtr, fineDomain, NULL, this, pltAppState, bCartGridSmoothing); - amrPicturePtrArray[ZPLANE]->SetRegion(startX, startY, endX, endY); + amrPicturePtrArray[Amrvis::ZPLANE]->SetRegion(startX, startY, endX, endY); - amrPicturePtrArray[ZPLANE]->CreatePicture(XtWindow(wPlotPlane[ZPLANE]), + amrPicturePtrArray[Amrvis::ZPLANE]->CreatePicture(XtWindow(wPlotPlane[Amrvis::ZPLANE]), pltPaletteptr); - AddStaticEventHandler(wPlotPlane[ZPLANE], ExposureMask, - &PltApp::PADoExposePicture, (XtPointer) ZPLANE); - frameBuffer[currentFrame] = amrPicturePtrArray[ZPLANE]->GetPictureXImage(); + AddStaticEventHandler(wPlotPlane[Amrvis::ZPLANE], ExposureMask, + &PltApp::PADoExposePicture, (XtPointer) Amrvis::ZPLANE); + frameBuffer[currentFrame] = amrPicturePtrArray[Amrvis::ZPLANE]->GetPictureXImage(); #endif readyFrames[currentFrame] = true; paletteDrawn = ! UsingFileRange(currentRangeType); bSyncFrame = false; } - XPutImage(display, XtWindow(wPlotPlane[ZPLANE]), xgc, + XPutImage(display, XtWindow(wPlotPlane[Amrvis::ZPLANE]), xgc, frameBuffer[currentFrame], 0, 0, 0, 0, - amrPicturePtrArray[ZPLANE]->ImageSizeH(), - amrPicturePtrArray[ZPLANE]->ImageSizeV()); + amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeH(), + amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeV()); if(AVGlobals::CacheAnimFrames() == false) { @@ -4281,14 +4276,14 @@ void PltApp::ShowFrame() { string fileName(fileNames[currentFrame]); - char cTempFN[BUFSIZ]; + char cTempFN[Amrvis::BUFSIZE]; strcpy(cTempFN, AVGlobals::StripSlashes(fileName).c_str()); XmString fileString = XmStringCreateSimple(cTempFN); XtVaSetValues(wWhichFileLabel, XmNlabelString, fileString, NULL); XmStringFree(fileString); - char tempTimeName[BUFSIZ]; - ostrstream tempTimeOut(tempTimeName, BUFSIZ); + char tempTimeName[Amrvis::BUFSIZE]; + ostrstream tempTimeOut(tempTimeName, Amrvis::BUFSIZE); tempTimeOut << "T=" << amrData.Time() << ends; XmString timeString = XmStringCreateSimple(tempTimeName); XtVaSetValues(wWhichTimeLabel, XmNlabelString, timeString, NULL); @@ -4298,9 +4293,9 @@ void PltApp::ShowFrame() { if(datasetShowing) { int hdir(-1), vdir(-1), sdir(-1); - if(activeView == ZPLANE) { hdir = XDIR; vdir = YDIR; sdir = ZDIR; } - if(activeView == YPLANE) { hdir = XDIR; vdir = ZDIR; sdir = YDIR; } - if(activeView == XPLANE) { hdir = YDIR; vdir = ZDIR; sdir = XDIR; } + if(activeView == Amrvis::ZPLANE) { hdir = Amrvis::XDIR; vdir = Amrvis::YDIR; sdir = Amrvis::ZDIR; } + if(activeView == Amrvis::YPLANE) { hdir = Amrvis::XDIR; vdir = Amrvis::ZDIR; sdir = Amrvis::YDIR; } + if(activeView == Amrvis::XPLANE) { hdir = Amrvis::YDIR; vdir = Amrvis::ZDIR; sdir = Amrvis::XDIR; } datasetPtr->DatasetRender(trueRegion, amrPicturePtrArray[activeView], this, pltAppState, hdir, vdir, sdir); datasetPtr->DoExpose(false); diff --git a/PltApp3D.cpp b/PltApp3D.cpp index 0350d3c..8792ea8 100644 --- a/PltApp3D.cpp +++ b/PltApp3D.cpp @@ -1,15 +1,10 @@ - -// -// $Id: PltApp3D.cpp,v 1.59 2007-05-02 20:47:37 vince Exp $ -// - // --------------------------------------------------------------- // PltApp3D.cpp // --------------------------------------------------------------- -#include "PltApp.H" -#include "PltAppState.H" -#include "ProjectionPicture.H" -#include "Quaternion.H" +#include +#include +#include +#include #include #include @@ -248,9 +243,9 @@ void PltApp::DoDetach(Widget, XtPointer, XtPointer) { wAttach = XtVaCreateManagedWidget("Attach", xmPushButtonWidgetClass, wDetachForm, XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNrightAttachment, XmATTACH_FORM, - XmNrightOffset, WOFFSET, + XmNrightOffset, Amrvis::WOFFSET, NULL); AddStaticCallback(wAttach, XmNactivateCallback, &PltApp::DoAttach); XtManageChild(wAttach); @@ -258,9 +253,9 @@ void PltApp::DoDetach(Widget, XtPointer, XtPointer) { wDOrientXY = XtVaCreateManagedWidget("XY", xmPushButtonWidgetClass, wDetachForm, XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, WOFFSET, NULL); + XmNtopOffset, Amrvis::WOFFSET, NULL); AddStaticCallback(wDOrientXY, XmNactivateCallback, &PltApp::DoOrient, (XtPointer) OXY); XtManageChild(wDOrientXY); @@ -269,9 +264,9 @@ void PltApp::DoDetach(Widget, XtPointer, XtPointer) { wDetachForm, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wDOrientXY, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, WOFFSET, NULL); + XmNtopOffset, Amrvis::WOFFSET, NULL); AddStaticCallback(wDOrientYZ, XmNactivateCallback, &PltApp::DoOrient, (XtPointer) OYZ); XtManageChild(wDOrientYZ); @@ -280,9 +275,9 @@ void PltApp::DoDetach(Widget, XtPointer, XtPointer) { wDetachForm, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wDOrientYZ, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, WOFFSET, NULL); + XmNtopOffset, Amrvis::WOFFSET, NULL); AddStaticCallback(wDOrientXZ, XmNactivateCallback, &PltApp::DoOrient, (XtPointer) OXZ); XtManageChild(wDOrientXZ); @@ -291,9 +286,9 @@ void PltApp::DoDetach(Widget, XtPointer, XtPointer) { wDetachForm, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wDOrientXZ, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, WOFFSET, NULL); + XmNtopOffset, Amrvis::WOFFSET, NULL); AddStaticCallback(wDLabelAxes, XmNactivateCallback, &PltApp::DoLabelAxes); XtManageChild(wDLabelAxes); @@ -303,9 +298,9 @@ void PltApp::DoDetach(Widget, XtPointer, XtPointer) { wDetachForm, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wDLabelAxes, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, NULL); AddStaticCallback(wDRender, XmNactivateCallback, &PltApp::DoRender); XtManageChild(wDRender); @@ -315,14 +310,14 @@ void PltApp::DoDetach(Widget, XtPointer, XtPointer) { wDetachForm, XmNtranslations, XtParseTranslationTable(trans), XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, wDOrientXY, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNrightAttachment, XmATTACH_FORM, - XmNrightOffset, WOFFSET, + XmNrightOffset, Amrvis::WOFFSET, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, NULL); projPicturePtr->SetDrawingArea(wTransDA); @@ -355,15 +350,15 @@ void PltApp::DoAttach(Widget, XtPointer, XtPointer) { wPlotArea, XmNtranslations, XtParseTranslationTable(trans), XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, wScrollArea[XPLANE], - XmNleftOffset, WOFFSET, + XmNleftWidget, wScrollArea[Amrvis::XPLANE], + XmNleftOffset, Amrvis::WOFFSET, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, wOrientXY, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNrightAttachment, XmATTACH_FORM, - XmNrightOffset, WOFFSET, + XmNrightOffset, Amrvis::WOFFSET, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, NULL); AddStaticCallback(wTransDA, XmNinputCallback, &PltApp::DoTransInput); AddStaticCallback(wTransDA, XmNresizeCallback, &PltApp::DoTransResize); @@ -556,9 +551,9 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { Widget wLWDoneButton = XtVaCreateManagedWidget(" Ok ", xmPushButtonGadgetClass, wLWForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); AddStaticCallback(wLWDoneButton, XmNactivateCallback, &PltApp::DoDoneLightingWindow); @@ -567,7 +562,7 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { Widget wLWApplyButton = XtVaCreateManagedWidget("Apply", xmPushButtonGadgetClass, wLWForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wLWDoneButton, NULL); @@ -577,7 +572,7 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { Widget wLWOpenButton = XtVaCreateManagedWidget("Open...", xmPushButtonGadgetClass, wLWForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wLWApplyButton, NULL); @@ -588,7 +583,7 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { Widget wLWSaveButton = XtVaCreateManagedWidget("Save...", xmPushButtonGadgetClass, wLWForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wLWOpenButton, NULL); @@ -599,9 +594,9 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { Widget wLWCancelButton = XtVaCreateManagedWidget("Cancel", xmPushButtonGadgetClass, wLWForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNrightAttachment, XmATTACH_FORM, - XmNrightOffset, WOFFSET, + XmNrightOffset, Amrvis::WOFFSET, NULL); AddStaticCallback(wLWCancelButton, XmNactivateCallback, &PltApp::DoCancelLightingWindow); @@ -614,11 +609,11 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { wTempLabel = XtVaCreateManagedWidget("ambient: ", xmLabelGadgetClass, wLWForm, XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 12, XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); char cNbuff[64]; @@ -626,11 +621,11 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { wLWambient = XtVaCreateManagedWidget("variable", xmTextFieldWidgetClass, wLWForm, XmNtopAttachment, XmATTACH_FORM, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 12, XmNrightAttachment, XmATTACH_FORM, - XmNrightOffset, WOFFSET, + XmNrightOffset, Amrvis::WOFFSET, XmNvalue, cNbuff, XmNcolumns, 6, NULL); @@ -638,11 +633,11 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { xmLabelGadgetClass, wLWForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, wLWambient, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 25, XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); sprintf(cNbuff, "%3.2f", volRenderPtr->GetDiffuse()); @@ -650,11 +645,11 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { xmTextFieldWidgetClass, wLWForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, wLWambient, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 25, XmNrightAttachment, XmATTACH_FORM, - XmNrightOffset, WOFFSET, + XmNrightOffset, Amrvis::WOFFSET, XmNvalue, cNbuff, XmNcolumns, 6, NULL); @@ -662,11 +657,11 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { xmLabelGadgetClass, wLWForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, wLWdiffuse, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 37, XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); sprintf(cNbuff, "%3.2f", volRenderPtr->GetSpecular()); @@ -674,11 +669,11 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { xmTextFieldWidgetClass, wLWForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, wLWdiffuse, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 37, XmNrightAttachment, XmATTACH_FORM, - XmNrightOffset, WOFFSET, + XmNrightOffset, Amrvis::WOFFSET, XmNvalue, cNbuff, XmNcolumns, 6, NULL); @@ -686,11 +681,11 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { xmLabelGadgetClass, wLWForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, wLWspecular, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 50, XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); sprintf(cNbuff, "%3.2f", volRenderPtr->GetShiny()); @@ -698,11 +693,11 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { xmTextFieldWidgetClass, wLWForm, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, wLWspecular, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 50, XmNrightAttachment, XmATTACH_FORM, - XmNrightOffset, WOFFSET, + XmNrightOffset, Amrvis::WOFFSET, XmNvalue, cNbuff, XmNcolumns, 6, NULL); @@ -711,24 +706,24 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { xmLabelGadgetClass, wLWForm, xmTextFieldWidgetClass, wLWForm, XmNtopAttachment, XmATTACH_WIDGET, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNtopWidget, wLWshiny, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 62, XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); sprintf(cNbuff, "%3.2f", volRenderPtr->GetMinRayOpacity()); wLWminOpacity = XtVaCreateManagedWidget("minray", xmTextFieldWidgetClass, wLWForm, XmNtopAttachment, XmATTACH_WIDGET, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNtopWidget, wLWshiny, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 62, XmNrightAttachment, XmATTACH_FORM, - XmNrightOffset, WOFFSET, + XmNrightOffset, Amrvis::WOFFSET, XmNvalue, cNbuff, XmNcolumns, 6, NULL); @@ -736,24 +731,24 @@ void PltApp::DoCreateLightingWindow(Widget, XtPointer, XtPointer) { wTempLabel = XtVaCreateManagedWidget("maxRayOpacity: ", xmLabelGadgetClass, wLWForm, XmNtopAttachment, XmATTACH_WIDGET, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNtopWidget, wLWminOpacity, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 75, XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); sprintf(cNbuff, "%3.2f", volRenderPtr->GetMaxRayOpacity()); wLWmaxOpacity = XtVaCreateManagedWidget("variable", xmTextFieldWidgetClass, wLWForm, XmNtopAttachment, XmATTACH_WIDGET, - XmNtopOffset, WOFFSET, + XmNtopOffset, Amrvis::WOFFSET, XmNtopWidget, wLWminOpacity, XmNbottomAttachment, XmATTACH_POSITION, XmNbottomPosition, 75, XmNrightAttachment, XmATTACH_FORM, - XmNrightOffset, WOFFSET, + XmNrightOffset, Amrvis::WOFFSET, XmNvalue, cNbuff, XmNcolumns, 6, NULL); diff --git a/PltAppOutput.cpp b/PltAppOutput.cpp index db9ca6e..93b359e 100644 --- a/PltAppOutput.cpp +++ b/PltAppOutput.cpp @@ -1,27 +1,22 @@ - -// -// $Id: PltAppOutput.cpp,v 1.39 2010-12-15 23:10:27 vince Exp $ -// - // --------------------------------------------------------------- // PltAppOutput.cpp // --------------------------------------------------------------- #include -#include "ParallelDescriptor.H" +#include #include #include #include #include -#include "PltApp.H" -#include "PltAppState.H" -#include "DataServices.H" -#include "ProjectionPicture.H" -#include "Output.H" -#include "XYPlotWin.H" +#include +#include +#include +#include +#include +#include using std::cout; using std::cerr; @@ -66,7 +61,7 @@ void PltApp::DoOutput(Widget w, XtPointer data, XtPointer) { XtSetSensitive(XmSelectionBoxGetChild(wGetFileName, XmDIALOG_HELP_BUTTON), false); - char tempstr[BUFSIZ], tempfilename[BUFSIZ]; + char tempstr[Amrvis::BUFSIZE], tempfilename[Amrvis::BUFSIZE]; if(animating2d) { strcpy(tempfilename, AVGlobals::StripSlashes(fileNames[currentFrame]).c_str()); } else { @@ -82,7 +77,7 @@ void PltApp::DoOutput(Widget w, XtPointer data, XtPointer) { // ------------------------------------------------------------------- void PltApp::DoCreatePSFile(Widget w, XtPointer, XtPointer call_data) { XmSelectionBoxCallbackStruct *cbs = (XmSelectionBoxCallbackStruct *) call_data; - char psfilename[BUFSIZ]; + char psfilename[Amrvis::BUFSIZE]; char *fileNameBase; int imageSizeX, imageSizeY; XImage *printImage; @@ -95,11 +90,11 @@ void PltApp::DoCreatePSFile(Widget w, XtPointer, XtPointer call_data) { XmStringGetLtoR(cbs->value, XmSTRING_DEFAULT_CHARSET, &fileNameBase); - // write the ZPLANE picture + // write the Amrvis::ZPLANE picture sprintf(psfilename, "%s_XY.ps", fileNameBase); - printImage = amrPicturePtrArray[ZPLANE]->GetPictureXImage(); - imageSizeX = amrPicturePtrArray[ZPLANE]->ImageSizeH(); - imageSizeY = amrPicturePtrArray[ZPLANE]->ImageSizeV(); + printImage = amrPicturePtrArray[Amrvis::ZPLANE]->GetPictureXImage(); + imageSizeX = amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeH(); + imageSizeY = amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeV(); WritePSFile(psfilename, printImage, imageSizeX, imageSizeY, *pltPaletteptr); #ifndef NDEBUG @@ -107,27 +102,27 @@ void PltApp::DoCreatePSFile(Widget w, XtPointer, XtPointer call_data) { const AmrData &amrData = dataServicesPtr[currentFrame]->AmrDataRef(); sprintf(psfilename, "%s_XY_new.ps", fileNameBase); bool bDrawBoxesIntoImage(false); - printImage = amrPicturePtrArray[ZPLANE]->GetPictureXImage(bDrawBoxesIntoImage); + printImage = amrPicturePtrArray[Amrvis::ZPLANE]->GetPictureXImage(bDrawBoxesIntoImage); Array< Array > gridBoxes; - amrPicturePtrArray[ZPLANE]->GetGridBoxes(gridBoxes, minDrawnLevel, maxDrawnLevel); + amrPicturePtrArray[Amrvis::ZPLANE]->GetGridBoxes(gridBoxes, minDrawnLevel, maxDrawnLevel); WriteNewPSFile(psfilename, printImage, imageSizeX, imageSizeY, *pltPaletteptr, amrData, minDrawnLevel, maxDrawnLevel, gridBoxes); */ #endif #if (BL_SPACEDIM==3) - // write the YPLANE picture + // write the Amrvis::YPLANE picture sprintf(psfilename, "%s_XZ.ps", fileNameBase); - printImage = amrPicturePtrArray[YPLANE]->GetPictureXImage(); - imageSizeX = amrPicturePtrArray[YPLANE]->ImageSizeH(); - imageSizeY = amrPicturePtrArray[YPLANE]->ImageSizeV(); + printImage = amrPicturePtrArray[Amrvis::YPLANE]->GetPictureXImage(); + imageSizeX = amrPicturePtrArray[Amrvis::YPLANE]->ImageSizeH(); + imageSizeY = amrPicturePtrArray[Amrvis::YPLANE]->ImageSizeV(); WritePSFile(psfilename, printImage, imageSizeX, imageSizeY, *pltPaletteptr); - // write the XPLANE picture + // write the Amrvis::XPLANE picture sprintf(psfilename, "%s_YZ.ps", fileNameBase); - printImage = amrPicturePtrArray[XPLANE]->GetPictureXImage(); - imageSizeX = amrPicturePtrArray[XPLANE]->ImageSizeH(); - imageSizeY = amrPicturePtrArray[XPLANE]->ImageSizeV(); + printImage = amrPicturePtrArray[Amrvis::XPLANE]->GetPictureXImage(); + imageSizeX = amrPicturePtrArray[Amrvis::XPLANE]->ImageSizeH(); + imageSizeY = amrPicturePtrArray[Amrvis::XPLANE]->ImageSizeV(); WritePSFile(psfilename, printImage, imageSizeX, imageSizeY, *pltPaletteptr); // write the iso picture @@ -165,7 +160,7 @@ void PltApp::DoCreatePSFile(Widget w, XtPointer, XtPointer call_data) { // ------------------------------------------------------------------- void PltApp::DoCreateRGBFile(Widget w, XtPointer, XtPointer call_data) { XmSelectionBoxCallbackStruct *cbs = (XmSelectionBoxCallbackStruct *) call_data; - char rgbfilename[BUFSIZ]; + char rgbfilename[Amrvis::BUFSIZE]; char *fileNameBase; int imageSizeX, imageSizeY; XImage *printImage; @@ -176,7 +171,7 @@ void PltApp::DoCreateRGBFile(Widget w, XtPointer, XtPointer call_data) { XmStringGetLtoR(cbs->value, XmSTRING_DEFAULT_CHARSET, &fileNameBase); - // write the ZPLANE picture + // write the Amrvis::ZPLANE picture char suffix[4]; if(AVGlobals::IsSGIrgbFile()) { strcpy(suffix, "rgb"); @@ -184,9 +179,9 @@ void PltApp::DoCreateRGBFile(Widget w, XtPointer, XtPointer call_data) { strcpy(suffix, "ppm"); } sprintf(rgbfilename, "%s_XY.%s", fileNameBase,suffix); - printImage = amrPicturePtrArray[ZPLANE]->GetPictureXImage(); - imageSizeX = amrPicturePtrArray[ZPLANE]->ImageSizeH(); - imageSizeY = amrPicturePtrArray[ZPLANE]->ImageSizeV(); + printImage = amrPicturePtrArray[Amrvis::ZPLANE]->GetPictureXImage(); + imageSizeX = amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeH(); + imageSizeY = amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeV(); if(AVGlobals::IsSGIrgbFile()) { WriteRGBFile(rgbfilename, printImage, imageSizeX, imageSizeY, *pltPaletteptr); } else { @@ -195,22 +190,22 @@ void PltApp::DoCreateRGBFile(Widget w, XtPointer, XtPointer call_data) { #if (BL_SPACEDIM==3) - // write the YPLANE picture + // write the Amrvis::YPLANE picture sprintf(rgbfilename, "%s_XZ.%s", fileNameBase, suffix); - printImage = amrPicturePtrArray[YPLANE]->GetPictureXImage(); - imageSizeX = amrPicturePtrArray[YPLANE]->ImageSizeH(); - imageSizeY = amrPicturePtrArray[YPLANE]->ImageSizeV(); + printImage = amrPicturePtrArray[Amrvis::YPLANE]->GetPictureXImage(); + imageSizeX = amrPicturePtrArray[Amrvis::YPLANE]->ImageSizeH(); + imageSizeY = amrPicturePtrArray[Amrvis::YPLANE]->ImageSizeV(); if(AVGlobals::IsSGIrgbFile()) { WriteRGBFile(rgbfilename, printImage, imageSizeX, imageSizeY, *pltPaletteptr); } else { WritePPMFile(rgbfilename, printImage, imageSizeX, imageSizeY, *pltPaletteptr); } - // write the XPLANE picture + // write the Amrvis::XPLANE picture sprintf(rgbfilename, "%s_YZ.%s", fileNameBase, suffix); - printImage = amrPicturePtrArray[XPLANE]->GetPictureXImage(); - imageSizeX = amrPicturePtrArray[XPLANE]->ImageSizeH(); - imageSizeY = amrPicturePtrArray[XPLANE]->ImageSizeV(); + printImage = amrPicturePtrArray[Amrvis::XPLANE]->GetPictureXImage(); + imageSizeX = amrPicturePtrArray[Amrvis::XPLANE]->ImageSizeH(); + imageSizeY = amrPicturePtrArray[Amrvis::XPLANE]->ImageSizeV(); if(AVGlobals::IsSGIrgbFile()) { WriteRGBFile(rgbfilename, printImage, imageSizeX, imageSizeY, *pltPaletteptr); } else { @@ -259,7 +254,7 @@ void PltApp::DoCreateRGBFile(Widget w, XtPointer, XtPointer call_data) { // ------------------------------------------------------------------- void PltApp::DoCreateFABFile(Widget w, XtPointer, XtPointer call_data) { XmSelectionBoxCallbackStruct *cbs = (XmSelectionBoxCallbackStruct *) call_data; - char fabfilename[BUFSIZ]; + char fabfilename[Amrvis::BUFSIZE]; char *fileNameBase; XmStringGetLtoR(cbs->value, XmSTRING_DEFAULT_CHARSET, &fileNameBase); sprintf(fabfilename, "%s.fab", fileNameBase); @@ -282,7 +277,7 @@ void PltApp::DoCreateFABFile(Widget w, XtPointer, XtPointer call_data) { // ------------------------------------------------------------------- void PltApp::DoCreateAnimRGBFile() { - char outFileName[BUFSIZ]; + char outFileName[Amrvis::BUFSIZE]; int imageSizeX, imageSizeY; XImage *printImage; @@ -301,9 +296,9 @@ void PltApp::DoCreateAnimRGBFile() { cout << "******* Creating file: " << outFileName << endl; // write the picture - printImage = amrPicturePtrArray[ZPLANE]->GetPictureXImage(); - imageSizeX = amrPicturePtrArray[ZPLANE]->ImageSizeH(); - imageSizeY = amrPicturePtrArray[ZPLANE]->ImageSizeV(); + printImage = amrPicturePtrArray[Amrvis::ZPLANE]->GetPictureXImage(); + imageSizeX = amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeH(); + imageSizeY = amrPicturePtrArray[Amrvis::ZPLANE]->ImageSizeV(); if(AVGlobals::IsSGIrgbFile()) { WriteRGBFile(outFileName, printImage, imageSizeX, imageSizeY, *pltPaletteptr); } else { diff --git a/PltAppState.H b/PltAppState.H index 9925e13..ce2ff67 100644 --- a/PltAppState.H +++ b/PltAppState.H @@ -13,9 +13,9 @@ #ifndef _PLTAPPSTATE_H_ #define _PLTAPPSTATE_H_ -#include "AmrvisConstants.H" -#include "Array.H" -#include "Box.H" +#include +#include +#include #include using std::string; @@ -80,28 +80,28 @@ public: void SetFormatString(const string &newformat) { formatString = newformat; } // ------------------------ contours - void SetContourType(ContourType newContourType) + void SetContourType(Amrvis::ContourType newContourType) { currentContourType = newContourType; } - ContourType GetContourType() const { return currentContourType; } + Amrvis::ContourType GetContourType() const { return currentContourType; } void SetNumContours(int ncontours) { nContours = ncontours; } int GetNumContours() const { Cnsy(nContours); return nContours; } // ------------------------ mins and maxes - MinMaxRangeType GetMinMaxRangeType() const { return currentMinMaxType; } - void SetMinMaxRangeType(MinMaxRangeType newmmrtype) + Amrvis::MinMaxRangeType GetMinMaxRangeType() const { return currentMinMaxType; } + void SetMinMaxRangeType(Amrvis::MinMaxRangeType newmmrtype) { currentMinMaxType = newmmrtype; } - void SetMinMax(const MinMaxRangeType mmrangetype, + void SetMinMax(const Amrvis::MinMaxRangeType mmrangetype, const int framenumber, const int derivednumber, const Real rmin, const Real rmax); - void GetMinMax(const MinMaxRangeType mmrangetype, + void GetMinMax(const Amrvis::MinMaxRangeType mmrangetype, const int framenumber, const int derivednumber, Real &rmin, Real &rmax); // this one uses the current frame, derived, and range type void GetMinMax(Real &rmin, Real &rmax); - bool IsSet(const MinMaxRangeType mmrangetype, const int framenumber, + bool IsSet(const Amrvis::MinMaxRangeType mmrangetype, const int framenumber, const int derivednumber); void PrintSetMap(); @@ -132,9 +132,9 @@ private: string currentDerived; int currentDerivedNumber; bool showBoxes; - ContourType currentContourType; + Amrvis::ContourType currentContourType; int nContours; - MinMaxRangeType currentMinMaxType; + Amrvis::MinMaxRangeType currentMinMaxType; string formatString; // mins and maxes diff --git a/PltAppState.cpp b/PltAppState.cpp index 8c17ff0..c99a458 100644 --- a/PltAppState.cpp +++ b/PltAppState.cpp @@ -1,7 +1,7 @@ // --------------------------------------------------------------- // PltAppState.cpp // --------------------------------------------------------------- -#include "PltAppState.H" +#include #include #include @@ -54,9 +54,9 @@ PltAppState::PltAppState(int numFrames, int numDerived) maxScale(NOTSETYET), currentFrame(0), currentDerivedNumber(NOTSETYET), - currentContourType(INVALIDCONTOURTYPE), + currentContourType(Amrvis::INVALIDCONTOURTYPE), nContours(NOTSETYET), - currentMinMaxType(INVALIDMINMAX), + currentMinMaxType(Amrvis::INVALIDMINMAX), minDrawnLevel(NOTSETYET), maxDrawnLevel(NOTSETYET), minAllowableLevel(NOTSETYET), @@ -67,7 +67,7 @@ PltAppState::PltAppState(int numFrames, int numDerived) for(int nf(0); nf < numFrames; ++nf) { minMax[nf].resize(numDerived); for(int nd(0); nd < numDerived; ++nd) { - minMax[nf][nd].resize(NUMBEROFMINMAX); + minMax[nf][nd].resize(Amrvis::NUMBEROFMINMAX); } } } @@ -115,7 +115,7 @@ PltAppState &PltAppState::operator=(const PltAppState &rhs) { // ------------------------------------------------------------------- -void PltAppState::SetMinMax(const MinMaxRangeType mmrangetype, +void PltAppState::SetMinMax(const Amrvis::MinMaxRangeType mmrangetype, const int framenumber, const int derivednumber, const Real rmin, const Real rmax) { @@ -124,7 +124,7 @@ void PltAppState::SetMinMax(const MinMaxRangeType mmrangetype, // ------------------------------------------------------------------- -void PltAppState::GetMinMax(const MinMaxRangeType mmrangetype, +void PltAppState::GetMinMax(const Amrvis::MinMaxRangeType mmrangetype, const int framenumber, const int derivednumber, Real &rmin, Real &rmax) { @@ -140,7 +140,7 @@ void PltAppState::GetMinMax(Real &rmin, Real &rmax) { // ------------------------------------------------------------------- -bool PltAppState::IsSet(const MinMaxRangeType mmrangetype, +bool PltAppState::IsSet(const Amrvis::MinMaxRangeType mmrangetype, const int framenumber, const int derivednumber) { return (minMax[framenumber][derivednumber][mmrangetype].IsSet()); diff --git a/Point.H b/Point.H index 2e909c8..32e5c31 100644 --- a/Point.H +++ b/Point.H @@ -1,8 +1,3 @@ - -// -// $Id: Point.H,v 1.8 2004-05-05 20:44:31 vince Exp $ -// - // --------------------------------------------------------------- // Point.H // --------------------------------------------------------------- @@ -11,9 +6,8 @@ #include #include -//using std::ostream; -#include "REAL.H" +#include class AmrQuaternion; class AmrSpherePoint; diff --git a/Point.cpp b/Point.cpp index 30d1637..c4ccb3c 100644 --- a/Point.cpp +++ b/Point.cpp @@ -1,15 +1,10 @@ - -// -// $Id: Point.cpp,v 1.10 2010-12-09 00:57:20 gpau Exp $ -// - // --------------------------------------------------------------- // Point.cpp // --------------------------------------------------------------- #include #include -#include "Point.H" +#include Real scale = 1.0; diff --git a/ProjectionPicture.H b/ProjectionPicture.H index 0699b4f..672b25f 100644 --- a/ProjectionPicture.H +++ b/ProjectionPicture.H @@ -1,8 +1,3 @@ - -// -// $Id: ProjectionPicture.H,v 1.24 2011-08-11 19:39:05 vince Exp $ -// - // --------------------------------------------------------------- // ProjectionPicture.H // --------------------------------------------------------------- @@ -12,12 +7,12 @@ #include #undef index -#include "AmrPicture.H" -#include "ViewTransform.H" -#include "Palette.H" +#include +#include +#include #ifdef BL_VOLUMERENDER -#include "VolRender.H" +#include #endif class PltApp; diff --git a/ProjectionPicture.cpp b/ProjectionPicture.cpp index fd37f17..2293093 100644 --- a/ProjectionPicture.cpp +++ b/ProjectionPicture.cpp @@ -1,20 +1,15 @@ - -// -// $Id: ProjectionPicture.cpp,v 1.56 2011-08-11 19:39:05 vince Exp $ -// - // --------------------------------------------------------------- // ProjectionPicture.cpp // --------------------------------------------------------------- -#include "ParallelDescriptor.H" +#include #include -#include "ProjectionPicture.H" -#include "PltApp.H" -#include "PltAppState.H" -#include "DataServices.H" -#include "Volume.H" +#include +#include +#include +#include +#include #include #include @@ -36,7 +31,7 @@ ProjectionPicture::ProjectionPicture(PltApp *pltappptr, ViewTransform *vtptr, { int lev; pltAppPtr = pltappptr; - amrPicturePtr = pltAppPtr->GetAmrPicturePtr(XY); + amrPicturePtr = pltAppPtr->GetAmrPicturePtr(Amrvis::XY); minDrawnLevel = pltAppPtr->GetPltAppState()->MinDrawnLevel(); maxDrawnLevel = pltAppPtr->GetPltAppState()->MaxDrawnLevel(); drawingArea = da; @@ -103,15 +98,15 @@ ProjectionPicture::ProjectionPicture(PltApp *pltappptr, ViewTransform *vtptr, LoadSlices(alignedBox); - xcenter = (theDomain[maxDataLevel].bigEnd(XDIR) - - theDomain[maxDataLevel].smallEnd(XDIR)) / 2 + - theDomain[maxDataLevel].smallEnd(XDIR); - ycenter = (theDomain[maxDataLevel].bigEnd(YDIR) - - theDomain[maxDataLevel].smallEnd(YDIR)) / 2 + - theDomain[maxDataLevel].smallEnd(YDIR); - zcenter = (theDomain[maxDataLevel].bigEnd(ZDIR) - - theDomain[maxDataLevel].smallEnd(ZDIR)) / 2 + - theDomain[maxDataLevel].smallEnd(ZDIR); // center of 3D object + xcenter = (theDomain[maxDataLevel].bigEnd(Amrvis::XDIR) - + theDomain[maxDataLevel].smallEnd(Amrvis::XDIR)) / 2 + + theDomain[maxDataLevel].smallEnd(Amrvis::XDIR); + ycenter = (theDomain[maxDataLevel].bigEnd(Amrvis::YDIR) - + theDomain[maxDataLevel].smallEnd(Amrvis::YDIR)) / 2 + + theDomain[maxDataLevel].smallEnd(Amrvis::YDIR); + zcenter = (theDomain[maxDataLevel].bigEnd(Amrvis::ZDIR) - + theDomain[maxDataLevel].smallEnd(Amrvis::ZDIR)) / 2 + + theDomain[maxDataLevel].smallEnd(Amrvis::ZDIR); // center of 3D object viewTransformPtr->SetObjCenter(xcenter, ycenter, zcenter); viewTransformPtr->SetScreenPosition(daWidth/2, daHeight/2); @@ -253,9 +248,9 @@ void ProjectionPicture::MakePicture() { #ifdef BL_VOLUMERENDER clock_t time0 = clock(); - scale[XDIR] = viewTransformPtr->GetScale(); - scale[YDIR] = viewTransformPtr->GetScale(); - scale[ZDIR] = viewTransformPtr->GetScale(); + scale[Amrvis::XDIR] = viewTransformPtr->GetScale(); + scale[Amrvis::YDIR] = viewTransformPtr->GetScale(); + scale[Amrvis::ZDIR] = viewTransformPtr->GetScale(); Real mvmat[4][4]; @@ -510,9 +505,9 @@ AVRealBox::AVRealBox() { //-------------------------------------------------------------------- AVRealBox::AVRealBox(const Box &theBox) { - Real dimensions[6] = { theBox.smallEnd(XDIR), theBox.smallEnd(YDIR), - theBox.smallEnd(ZDIR), theBox.bigEnd(XDIR)+1, - theBox.bigEnd(YDIR)+1, theBox.bigEnd(ZDIR)+1 }; + Real dimensions[6] = { theBox.smallEnd(Amrvis::XDIR), theBox.smallEnd(Amrvis::YDIR), + theBox.smallEnd(Amrvis::ZDIR), theBox.bigEnd(Amrvis::XDIR)+1, + theBox.bigEnd(Amrvis::YDIR)+1, theBox.bigEnd(Amrvis::ZDIR)+1 }; vertices[0] = RealPoint(dimensions[0], dimensions[1], dimensions[2]); vertices[1] = RealPoint(dimensions[3], dimensions[1], dimensions[2]); @@ -573,9 +568,9 @@ RealSlice::RealSlice(RealPoint p1, RealPoint p2, RealPoint p3, RealPoint p4) { //-------------------------------------------------------------------- RealSlice::RealSlice(int count, int slice, const Box &worldBox) { - Real dimensions[6] = { worldBox.smallEnd(XDIR), worldBox.smallEnd(YDIR), - worldBox.smallEnd(ZDIR), worldBox.bigEnd(XDIR)+1, - worldBox.bigEnd(YDIR)+1, worldBox.bigEnd(ZDIR)+1 }; + Real dimensions[6] = { worldBox.smallEnd(Amrvis::XDIR), worldBox.smallEnd(Amrvis::YDIR), + worldBox.smallEnd(Amrvis::ZDIR), worldBox.bigEnd(Amrvis::XDIR)+1, + worldBox.bigEnd(Amrvis::YDIR)+1, worldBox.bigEnd(Amrvis::ZDIR)+1 }; dirOfFreedom = count; if(dirOfFreedom == 0) { edges[0] = RealPoint(dimensions[0], dimensions[1], slice); diff --git a/Quaternion.H b/Quaternion.H index 2736e90..62d3837 100644 --- a/Quaternion.H +++ b/Quaternion.H @@ -1,8 +1,3 @@ - -// -// $Id: Quaternion.H,v 1.11 2004-05-05 20:47:19 vince Exp $ -// - // --------------------------------------------------------------- // Quaternion.H // --------------------------------------------------------------- @@ -10,9 +5,9 @@ #define _AMR_QUATERNION_H_ #include -//using std::ostream; -#include "REAL.H" -#include "Point.H" + +#include +#include /*************************************************************************** diff --git a/Quaternion.cpp b/Quaternion.cpp index 2cd595c..aedbcba 100644 --- a/Quaternion.cpp +++ b/Quaternion.cpp @@ -1,15 +1,10 @@ - -// -// $Id: Quaternion.cpp,v 1.14 2010-12-09 00:57:20 gpau Exp $ -// - // --------------------------------------------------------------- // Quaternion.cpp // --------------------------------------------------------------- #include #include -#include "Quaternion.H" +#include // --------------------------------------------------------------- // These constructors reduce smoothly to the identity when the input diff --git a/Trackball.H b/Trackball.H index 7303572..7356263 100644 --- a/Trackball.H +++ b/Trackball.H @@ -1,8 +1,3 @@ - -// -// $Id: Trackball.H,v 1.5 2002-02-07 23:59:02 vince Exp $ -// - // --------------------------------------------------------------- // TrackBall.H // --------------------------------------------------------------- diff --git a/Trackball.cpp b/Trackball.cpp index 45f9f4f..2271a7d 100644 --- a/Trackball.cpp +++ b/Trackball.cpp @@ -1,14 +1,9 @@ - -// -// $Id: Trackball.cpp,v 1.7 2002-02-19 20:39:41 vince Exp $ -// - // --------------------------------------------------------------- // Trackball.cpp // --------------------------------------------------------------- -#include "Quaternion.H" -#include "Point.H" -#include "REAL.H" +#include +#include +#include // --------------------------------------------------------------- static Real tb_project(Real x, Real y) { diff --git a/ViewTransform.H b/ViewTransform.H index 3e2c2ef..5607e57 100644 --- a/ViewTransform.H +++ b/ViewTransform.H @@ -1,8 +1,3 @@ - -// -// $Id: ViewTransform.H,v 1.17 2005-04-07 20:34:15 vince Exp $ -// - // --------------------------------------------------------------- // ViewTransform.H // --------------------------------------------------------------- @@ -11,8 +6,8 @@ #include -#include "REAL.H" -#include "Quaternion.H" +#include +#include typedef Real MatrixFour[4][4]; diff --git a/ViewTransform.cpp b/ViewTransform.cpp index 0539a7f..574734f 100644 --- a/ViewTransform.cpp +++ b/ViewTransform.cpp @@ -1,13 +1,8 @@ - -// -// $Id: ViewTransform.cpp,v 1.24 2004-05-05 20:39:11 vince Exp $ -// - // --------------------------------------------------------------- // ViewTransform.cpp // --------------------------------------------------------------- -#include "ViewTransform.H" -#include "Trackball.H" +#include +#include #include #include diff --git a/VolRender.H b/VolRender.H index e400303..d234235 100644 --- a/VolRender.H +++ b/VolRender.H @@ -1,8 +1,3 @@ - -// -// $Id: VolRender.H,v 1.30 2004-12-07 22:27:30 vince Exp $ -// - // --------------------------------------------------------------- // VolRender.H // --------------------------------------------------------------- @@ -13,12 +8,12 @@ #include using std::string; -#include "Array.H" -#include "REAL.H" -#include "Box.H" -#include "AmrvisConstants.H" -#include "Volume.H" -#include "Palette.H" +#include +#include +#include +#include +#include +#include #ifdef BL_VOLUMERENDER #include diff --git a/VolRender.cpp b/VolRender.cpp index 38b80eb..5da9ca6 100644 --- a/VolRender.cpp +++ b/VolRender.cpp @@ -1,15 +1,10 @@ - -// -// $Id: VolRender.cpp,v 1.55 2008-10-10 21:58:59 vince Exp $ -// - // --------------------------------------------------------------- // VolRender.cpp // --------------------------------------------------------------- -#include "VolRender.H" -#include "DataServices.H" -#include "GlobalUtilities.H" -#include "ParallelDescriptor.H" +#include +#include +#include +#include #include #include @@ -133,9 +128,9 @@ VolRender::VolRender(const Array &drawdomain, int mindrawnlevel, SetProperties(); - rows = drawnDomain[maxDataLevel].length(XDIR); - cols = drawnDomain[maxDataLevel].length(YDIR); - planes = drawnDomain[maxDataLevel].length(ZDIR); + rows = drawnDomain[maxDataLevel].length(Amrvis::XDIR); + cols = drawnDomain[maxDataLevel].length(Amrvis::YDIR); + planes = drawnDomain[maxDataLevel].length(Amrvis::ZDIR); // --- describe the layout of the volume vpResult vpret = vpSetVolumeSize(vpc, rows, cols, planes); @@ -246,34 +241,34 @@ void VolRender::MakeSWFData(DataServices *dataServicesPtr, Real *dataPoint = swfFabData.dataPtr(); int sindexbase; - int srows = swfDataBox.length(XDIR); - int scols = swfDataBox.length(YDIR); - //int splanes = swfDataBox.length(ZDIR); + int srows = swfDataBox.length(Amrvis::XDIR); + int scols = swfDataBox.length(Amrvis::YDIR); + //int splanes = swfDataBox.length(Amrvis::ZDIR); int scolssrowstmp = scols*srows; - int sstartr = swfDataBox.smallEnd(XDIR); - //int sstartc = swfDataBox.smallEnd(YDIR); - int sstartp = swfDataBox.smallEnd(ZDIR); - //int sendr = swfDataBox.bigEnd(XDIR); - int sendc = swfDataBox.bigEnd(YDIR); - //int sendp = swfDataBox.bigEnd(ZDIR); + int sstartr = swfDataBox.smallEnd(Amrvis::XDIR); + //int sstartc = swfDataBox.smallEnd(Amrvis::YDIR); + int sstartp = swfDataBox.smallEnd(Amrvis::ZDIR); + //int sendr = swfDataBox.bigEnd(Amrvis::XDIR); + int sendc = swfDataBox.bigEnd(Amrvis::YDIR); + //int sendp = swfDataBox.bigEnd(Amrvis::ZDIR); Box gbox(swfDataBox); Box goverlap(gbox & drawnDomain[maxDrawnLevel]); - int gstartr = gbox.smallEnd(XDIR); - int gstartc = gbox.smallEnd(YDIR); - int gstartp = gbox.smallEnd(ZDIR); + int gstartr = gbox.smallEnd(Amrvis::XDIR); + int gstartc = gbox.smallEnd(Amrvis::YDIR); + int gstartp = gbox.smallEnd(Amrvis::ZDIR); - int gostartr = goverlap.smallEnd(XDIR) - gstartr; - int gostartc = goverlap.smallEnd(YDIR) - gstartc; - int gostartp = goverlap.smallEnd(ZDIR) - gstartp; - int goendr = goverlap.bigEnd(XDIR) - gstartr; - int goendc = goverlap.bigEnd(YDIR) - gstartc; - int goendp = goverlap.bigEnd(ZDIR) - gstartp; + int gostartr = goverlap.smallEnd(Amrvis::XDIR) - gstartr; + int gostartc = goverlap.smallEnd(Amrvis::YDIR) - gstartc; + int gostartp = goverlap.smallEnd(Amrvis::ZDIR) - gstartp; + int goendr = goverlap.bigEnd(Amrvis::XDIR) - gstartr; + int goendc = goverlap.bigEnd(Amrvis::YDIR) - gstartc; + int goendp = goverlap.bigEnd(Amrvis::ZDIR) - gstartp; - int grows = gbox.length(XDIR); - int gcols = gbox.length(YDIR); - //int gplanes = gbox.length(ZDIR); + int grows = gbox.length(Amrvis::XDIR); + int gcols = gbox.length(Amrvis::YDIR); + //int gplanes = gbox.length(Amrvis::ZDIR); int gcolsgrowstmp(gcols * grows); int gpgcgrtmp, gcgrowstmp; @@ -318,33 +313,33 @@ void VolRender::MakeSWFData(DataServices *dataServicesPtr, for(int iGrid(0); iGrid < gridBoxes.size(); ++iGrid) { gbox = gridBoxes[iGrid]; // grow high end by one to eliminate overlap - //gbox.growHi(XDIR, 1); - //gbox.growHi(YDIR, 1); - //gbox.growHi(ZDIR, 1); + //gbox.growHi(Amrvis::XDIR, 1); + //gbox.growHi(Amrvis::YDIR, 1); + //gbox.growHi(Amrvis::ZDIR, 1); // Box goverlap(gbox & drawnDomain[lev]); grefbox = goverlap; grefbox.refine(crr); int gprev; - int gstartr(gbox.smallEnd(XDIR)); - int gstartc(gbox.smallEnd(YDIR)); - int gstartp(gbox.smallEnd(ZDIR)); + int gstartr(gbox.smallEnd(Amrvis::XDIR)); + int gstartc(gbox.smallEnd(Amrvis::YDIR)); + int gstartp(gbox.smallEnd(Amrvis::ZDIR)); - int gostartr(goverlap.smallEnd(XDIR) - gstartr); - int gostartc(goverlap.smallEnd(YDIR) - gstartc); - int gostartp(goverlap.smallEnd(ZDIR) - gstartp); - int goendr(goverlap.bigEnd(XDIR) - gstartr); - int goendc(goverlap.bigEnd(YDIR) - gstartc); - int goendp(goverlap.bigEnd(ZDIR) - gstartp); + int gostartr(goverlap.smallEnd(Amrvis::XDIR) - gstartr); + int gostartc(goverlap.smallEnd(Amrvis::YDIR) - gstartc); + int gostartp(goverlap.smallEnd(Amrvis::ZDIR) - gstartp); + int goendr(goverlap.bigEnd(Amrvis::XDIR) - gstartr); + int goendc(goverlap.bigEnd(Amrvis::YDIR) - gstartc); + int goendp(goverlap.bigEnd(Amrvis::ZDIR) - gstartp); - grows = gbox.length(XDIR); - gcols = gbox.length(YDIR); + grows = gbox.length(Amrvis::XDIR); + gcols = gbox.length(Amrvis::YDIR); if(crr != 1) { int gcolsgrowstmp(gcols * grows); - int ddsez(drawnDomain[lev].smallEnd(ZDIR)); - int ddbez(drawnDomain[lev].bigEnd(ZDIR)); + int ddsez(drawnDomain[lev].smallEnd(Amrvis::ZDIR)); + int ddbez(drawnDomain[lev].bigEnd(Amrvis::ZDIR)); for(gp = gostartp; gp <= goendp; ++gp) { gprev = ddsez + ddbez - (gp + gstartp); if(gp == gostartp || gp == goendp) { @@ -407,8 +402,8 @@ void VolRender::MakeSWFData(DataServices *dataServicesPtr, } // end for(gp...) } else { // crr == 1 - int ddsez(drawnDomain[lev].smallEnd(ZDIR)); - int ddbez(drawnDomain[lev].bigEnd(ZDIR)); + int ddsez(drawnDomain[lev].smallEnd(Amrvis::ZDIR)); + int ddbez(drawnDomain[lev].bigEnd(Amrvis::ZDIR)); for(gp = gostartp; gp <= goendp; ++gp) { gprev = ddsez + ddbez - (gp + gstartp); if(gp == gostartp || gp == goendp) { @@ -454,19 +449,19 @@ void VolRender::MakeSWFData(DataServices *dataServicesPtr, grefbox = goverlap; grefbox.refine(crr); - int gstartr(gbox.smallEnd(XDIR)); - int gstartc(gbox.smallEnd(YDIR)); - int gstartp(gbox.smallEnd(ZDIR)); + int gstartr(gbox.smallEnd(Amrvis::XDIR)); + int gstartc(gbox.smallEnd(Amrvis::YDIR)); + int gstartp(gbox.smallEnd(Amrvis::ZDIR)); - int gostartr(goverlap.smallEnd(XDIR) - gstartr); - int gostartc(goverlap.smallEnd(YDIR) - gstartc); - int gostartp(goverlap.smallEnd(ZDIR) - gstartp); - int goendr(goverlap.bigEnd(XDIR) - gstartr); - int goendc(goverlap.bigEnd(YDIR) - gstartc); - int goendp(goverlap.bigEnd(ZDIR) - gstartp); + int gostartr(goverlap.smallEnd(Amrvis::XDIR) - gstartr); + int gostartc(goverlap.smallEnd(Amrvis::YDIR) - gstartc); + int gostartp(goverlap.smallEnd(Amrvis::ZDIR) - gstartp); + int goendr(goverlap.bigEnd(Amrvis::XDIR) - gstartr); + int goendc(goverlap.bigEnd(Amrvis::YDIR) - gstartc); + int goendp(goverlap.bigEnd(Amrvis::ZDIR) - gstartp); - grows = gbox.length(XDIR); - gcols = gbox.length(YDIR); + grows = gbox.length(Amrvis::XDIR); + gcols = gbox.length(Amrvis::YDIR); if(crr != 1) { int gcolsgrowstmp(gcols * grows); @@ -588,29 +583,29 @@ void VolRender::MakeSWFData(DataServices *dataServicesPtr, Real *dataPoint = swfFabData.dataPtr(); Real vfeps = amrData.VfEps(maxDrawnLevel); int sindexbase; - int srows = swfDataBox.length(XDIR); - int scols = swfDataBox.length(YDIR); + int srows = swfDataBox.length(Amrvis::XDIR); + int scols = swfDataBox.length(Amrvis::YDIR); int scolssrowstmp = scols*srows; - int sstartr = swfDataBox.smallEnd(XDIR); - int sstartp = swfDataBox.smallEnd(ZDIR); - int sendc = swfDataBox.bigEnd(YDIR); + int sstartr = swfDataBox.smallEnd(Amrvis::XDIR); + int sstartp = swfDataBox.smallEnd(Amrvis::ZDIR); + int sendc = swfDataBox.bigEnd(Amrvis::YDIR); Box gbox(swfDataBox); Box goverlap(gbox & drawnDomain[maxDrawnLevel]); - int gstartr = gbox.smallEnd(XDIR); - int gstartc = gbox.smallEnd(YDIR); - int gstartp = gbox.smallEnd(ZDIR); + int gstartr = gbox.smallEnd(Amrvis::XDIR); + int gstartc = gbox.smallEnd(Amrvis::YDIR); + int gstartp = gbox.smallEnd(Amrvis::ZDIR); - int gostartr = goverlap.smallEnd(XDIR) - gstartr; - int gostartc = goverlap.smallEnd(YDIR) - gstartc; - int gostartp = goverlap.smallEnd(ZDIR) - gstartp; - int goendr = goverlap.bigEnd(XDIR) - gstartr; - int goendc = goverlap.bigEnd(YDIR) - gstartc; - int goendp = goverlap.bigEnd(ZDIR) - gstartp; + int gostartr = goverlap.smallEnd(Amrvis::XDIR) - gstartr; + int gostartc = goverlap.smallEnd(Amrvis::YDIR) - gstartc; + int gostartp = goverlap.smallEnd(Amrvis::ZDIR) - gstartp; + int goendr = goverlap.bigEnd(Amrvis::XDIR) - gstartr; + int goendc = goverlap.bigEnd(Amrvis::YDIR) - gstartc; + int goendp = goverlap.bigEnd(Amrvis::ZDIR) - gstartp; - int grows = gbox.length(XDIR); - int gcols = gbox.length(YDIR); + int grows = gbox.length(Amrvis::XDIR); + int gcols = gbox.length(Amrvis::YDIR); int gcolsgrowstmp(gcols * grows); int gpgcgrtmp, gcgrowstmp; @@ -786,18 +781,18 @@ void VolRender::MakeVPData() { // #define AV_LOWMEMRENDER #ifdef AV_LOWMEMRENDER int xStride(sizeof(RawVoxel)); - //int yStride(drawnDomain[maxDataLevel].length(XDIR) * sizeof(RawVoxel)); - int yStride(drawnDomain[maxDataLevel].length(XDIR)); - //int zStride(drawnDomain[maxDataLevel].length(XDIR) * - //drawnDomain[maxDataLevel].length(YDIR) * sizeof(RawVoxel)); - long int nrc(drawnDomain[maxDataLevel].length(YDIR) * - drawnDomain[maxDataLevel].length(ZDIR)); + //int yStride(drawnDomain[maxDataLevel].length(Amrvis::XDIR) * sizeof(RawVoxel)); + int yStride(drawnDomain[maxDataLevel].length(Amrvis::XDIR)); + //int zStride(drawnDomain[maxDataLevel].length(Amrvis::XDIR) * + //drawnDomain[maxDataLevel].length(Amrvis::YDIR) * sizeof(RawVoxel)); + long int nrc(drawnDomain[maxDataLevel].length(Amrvis::YDIR) * + drawnDomain[maxDataLevel].length(Amrvis::ZDIR)); RawVoxel *vscanline = volData; cout << "****** volData = " << volData << endl; cout << "****** classifying " << nrc << " scanlines." << endl; for(int ix(0); ix < nrc; ++ix) { - //for(int iz(0); iz < drawnDomain[maxDataLevel].length(ZDIR); ++iz) { - //for(int iy(0); iy < drawnDomain[maxDataLevel].length(YDIR); ++iy) { + //for(int iz(0); iz < drawnDomain[maxDataLevel].length(Amrvis::ZDIR); ++iz) { + //for(int iy(0); iy < drawnDomain[maxDataLevel].length(Amrvis::YDIR); ++iy) { if(ix % 100 == 0) { cout << "----- vscanline = " << ix << endl; } @@ -823,10 +818,10 @@ void VolRender::MakeVPData() { delete [] volData; volData = new RawVoxel[swfDataSize]; // volpack will delete this int xStride(sizeof(RawVoxel)); - //int yStride(drawnDomain[maxDataLevel].length(XDIR) * sizeof(RawVoxel)); - int yStride(drawnDomain[maxDataLevel].length(XDIR)); - int zStride(drawnDomain[maxDataLevel].length(XDIR) * - drawnDomain[maxDataLevel].length(YDIR) * sizeof(RawVoxel)); + //int yStride(drawnDomain[maxDataLevel].length(Amrvis::XDIR) * sizeof(RawVoxel)); + int yStride(drawnDomain[maxDataLevel].length(Amrvis::XDIR)); + int zStride(drawnDomain[maxDataLevel].length(Amrvis::XDIR) * + drawnDomain[maxDataLevel].length(Amrvis::YDIR) * sizeof(RawVoxel)); vpret = vpSetRawVoxels(vpc, volData, swfDataSize * sizeof(RawVoxel), xStride, yStride, zStride); CheckVP(vpret, 9.4); @@ -835,8 +830,8 @@ void VolRender::MakeVPData() { volData[vindex].density = swfData[vindex]; } - long int nrc(drawnDomain[maxDataLevel].length(YDIR) * - drawnDomain[maxDataLevel].length(ZDIR)); + long int nrc(drawnDomain[maxDataLevel].length(Amrvis::YDIR) * + drawnDomain[maxDataLevel].length(Amrvis::ZDIR)); RawVoxel *vscanline = volData; cout << "****** classifying " << nrc << " scanlines." << endl; for(int ix(0); ix < nrc; ++ix) { @@ -852,9 +847,9 @@ void VolRender::MakeVPData() { delete [] volData; volData = new RawVoxel[swfDataSize]; // volpack will delete this int xStride(sizeof(RawVoxel)); - int yStride(drawnDomain[maxDataLevel].length(XDIR) * sizeof(RawVoxel)); - int zStride(drawnDomain[maxDataLevel].length(XDIR) * - drawnDomain[maxDataLevel].length(YDIR) * sizeof(RawVoxel)); + int yStride(drawnDomain[maxDataLevel].length(Amrvis::XDIR) * sizeof(RawVoxel)); + int zStride(drawnDomain[maxDataLevel].length(Amrvis::XDIR) * + drawnDomain[maxDataLevel].length(Amrvis::YDIR) * sizeof(RawVoxel)); vpret = vpSetRawVoxels(vpc, volData, swfDataSize * sizeof(RawVoxel), xStride, yStride, zStride); CheckVP(vpret, 9.4); @@ -873,9 +868,9 @@ void VolRender::MakeVPData() { delete [] volData; volData = new RawVoxel[swfDataSize]; int xStride(sizeof(RawVoxel)); - int yStride(drawnDomain[maxDataLevel].length(XDIR) * sizeof(RawVoxel)); - int zStride(drawnDomain[maxDataLevel].length(XDIR) * - drawnDomain[maxDataLevel].length(YDIR) * sizeof(RawVoxel)); + int yStride(drawnDomain[maxDataLevel].length(Amrvis::XDIR) * sizeof(RawVoxel)); + int zStride(drawnDomain[maxDataLevel].length(Amrvis::XDIR) * + drawnDomain[maxDataLevel].length(Amrvis::YDIR) * sizeof(RawVoxel)); vpret = vpSetRawVoxels(vpc, volData, swfDataSize * sizeof(RawVoxel), xStride, yStride, zStride); CheckVP(vpret, 9.45); @@ -887,9 +882,9 @@ void VolRender::MakeVPData() { delete [] volData; volData = new RawVoxel[swfDataSize]; int xStride(sizeof(RawVoxel)); - int yStride(drawnDomain[maxDataLevel].length(XDIR) * sizeof(RawVoxel)); - int zStride(drawnDomain[maxDataLevel].length(XDIR) * - drawnDomain[maxDataLevel].length(YDIR) * sizeof(RawVoxel)); + int yStride(drawnDomain[maxDataLevel].length(Amrvis::XDIR) * sizeof(RawVoxel)); + int zStride(drawnDomain[maxDataLevel].length(Amrvis::XDIR) * + drawnDomain[maxDataLevel].length(Amrvis::YDIR) * sizeof(RawVoxel)); vpret = vpSetRawVoxels(vpc, volData, swfDataSize * sizeof(RawVoxel), xStride, yStride, zStride); CheckVP(vpret, 9.4); diff --git a/Volume.H b/Volume.H index 717132f..af7d3e6 100644 --- a/Volume.H +++ b/Volume.H @@ -1,8 +1,3 @@ - -// -// $Id: Volume.H,v 1.17 2003-11-12 01:21:46 vince Exp $ -// - // --------------------------------------------------------------- // Volume.H // --------------------------------------------------------------- diff --git a/WriteRGB.cpp b/WriteRGB.cpp index 1f99c2a..b620542 100644 --- a/WriteRGB.cpp +++ b/WriteRGB.cpp @@ -1,8 +1,3 @@ - -// -// $Id: WriteRGB.cpp,v 1.10 2001-10-17 17:53:33 lijewski Exp $ -// - // --------------------------------------------------------------- // WriteRGB.cpp // --------------------------------------------------------------- diff --git a/XYPlotDataList.cpp b/XYPlotDataList.cpp index 0c31ebe..e38c76e 100644 --- a/XYPlotDataList.cpp +++ b/XYPlotDataList.cpp @@ -1,8 +1,8 @@ // ------------------------------------------------------------------- // XYPlotDataList.cpp // ------------------------------------------------------------------- -#include "XYPlotDataList.H" -#include "GlobalUtilities.H" +#include +#include #include #include diff --git a/XYPlotParam.H b/XYPlotParam.H index 24c95b2..f4faa8d 100644 --- a/XYPlotParam.H +++ b/XYPlotParam.H @@ -1,5 +1,5 @@ // ------------------------------------------------------------------- -// XYPlotParam.H -- Class definition for XYPlotParameters +// XYPlotParam.H // ------------------------------------------------------------------- #ifndef _XYPLOT_PARAM_H #define _XYPLOT_PARAM_H @@ -90,8 +90,8 @@ typedef struct st_table_defn { st_table_entry **bins; } st_table; -#include "XYPlotDefaults.H" -#include "XYPlotWin.H" +#include +#include class GraphicsAttributes; class Palette; diff --git a/XYPlotParam.cpp b/XYPlotParam.cpp index d91a4c6..e072b34 100644 --- a/XYPlotParam.cpp +++ b/XYPlotParam.cpp @@ -1,15 +1,15 @@ // ------------------------------------------------------------------- -// XYPlotParam.cpp -- implementation of XYPlotParameters class +// XYPlotParam.cpp // ------------------------------------------------------------------- -#include "ParallelDescriptor.H" +#include #include #include #undef index -#include "XYPlotParam.H" -#include "Palette.H" -#include "GraphicsAttributes.H" +#include +#include +#include #include #include diff --git a/XYPlotWin.H b/XYPlotWin.H index 83dd571..192e6d9 100644 --- a/XYPlotWin.H +++ b/XYPlotWin.H @@ -10,19 +10,15 @@ #include using std::list; -#include "AmrvisConstants.H" -#include "XYPlotDataList.H" -#include "XYPlotParam.H" -#include "xgout.H" +#include +#include +#include +#include class PltApp; class GraphicsAttributes; class XYPlotParameters; -#ifndef BUFSIZE -#define BUFSIZE 1024 -#endif - #define LEFT_CODE 0x01 #define RIGHT_CODE 0x02 #define BOTTOM_CODE 0x04 diff --git a/XYPlotWin.cpp b/XYPlotWin.cpp index 0d99b66..6fd6112 100644 --- a/XYPlotWin.cpp +++ b/XYPlotWin.cpp @@ -1,7 +1,7 @@ // --------------------------------------------------------------- // XYPlotWin.cpp // --------------------------------------------------------------- -#include "ParallelDescriptor.H" +#include #include #include @@ -28,12 +28,12 @@ #include #include -#include "XYPlotWin.H" -#include "PltApp.H" -#include "PltAppState.H" -#include "GraphicsAttributes.H" -#include "AmrData.H" -#include "DataServices.H" +#include +#include +#include +#include +#include +#include #include #include @@ -134,7 +134,7 @@ XYPlotWin::XYPlotWin(char *title, XtAppContext app, Widget w, PltApp *parent, currFrame(curr_frame) { int idx; - char buffer[BUFSIZE]; + char buffer[Amrvis::BUFSIZE]; pltTitle = new char[strlen(title) + 1]; strcpy(pltTitle, title); params param_temp; // temporary parameter grabbing slot @@ -160,18 +160,20 @@ XYPlotWin::XYPlotWin(char *title, XtAppContext app, Widget w, PltApp *parent, iCurrHint = 1; + char testc[] = "WM_DELETE_WINDOW"; WM_DELETE_WINDOW = XmInternAtom(XtDisplay(wTopLevel), - "WM_DELETE_WINDOW", false); + //"WM_DELETE_WINDOW", false); + testc, false); // -------------------------------------------------------- main window int winOffsetX, winOffsetY; int winWidth = PM_INT("InitialWindowWidth"); int winHeight = PM_INT("InitialWindowHeight"); - if(whichType == XDIR) { + if(whichType == Amrvis::XDIR) { winOffsetX = PM_INT("InitialXWindowOffsetX"); winOffsetY = PM_INT("InitialXWindowOffsetY"); - } else if(whichType == YDIR) { + } else if(whichType == Amrvis::YDIR) { winOffsetX = PM_INT("InitialYWindowOffsetX"); winOffsetY = PM_INT("InitialYWindowOffsetY"); } else { @@ -403,9 +405,9 @@ XYPlotWin::XYPlotWin(char *title, XtAppContext app, Widget w, PltApp *parent, char *str; - if(whichType == XDIR) { + if(whichType == Amrvis::XDIR) { str = PM_STRING("XUnitTextX"); - } else if(whichType == YDIR) { + } else if(whichType == Amrvis::YDIR) { str = PM_STRING("XUnitTextY"); } else { str = PM_STRING("XUnitTextZ"); @@ -489,7 +491,7 @@ void XYPlotWin::InitializeAnimation(int curr_frame, int num_frames) { string sDerName = (*ptr)->XYPLIlist->DerivedName(); const AmrData &amrData = pltParent->GetDataServicesPtr()->AmrDataRef(); int snum = amrData.StateNumber(sDerName); - MinMaxRangeType mmrt = pas->GetMinMaxRangeType(); + Amrvis::MinMaxRangeType mmrt = pas->GetMinMaxRangeType(); for(int iframe(0); iframe < numFrames; ++iframe) { pas->GetMinMax(mmrt, iframe, snum, fmin, fmax); gmin = min(gmin, fmin); @@ -511,7 +513,7 @@ void XYPlotWin::InitializeAnimation(int curr_frame, int num_frames) { void XYPlotWin::UpdateFrame(int frame) { XYPlotDataList *tempList; int num_lists_changed(0); - char buffer[BUFSIZE]; + char buffer[Amrvis::BUFSIZE]; sprintf(buffer, "%s %c Value 1D plot", AVGlobals::StripSlashes(pltParent->GetFileName()).c_str(), whichType + 'X'); @@ -814,7 +816,7 @@ void XYPlotWin::AddDataList(XYPlotDataList *new_list, pltParent->GetPalettePtr()->SetWindowPalette(pltParent->GetPaletteName(), XtWindow(new_item->wid)); Widget wid, levelmenu; - char buffer[BUFSIZ]; + char buffer[Amrvis::BUFSIZE]; new_item->menu = XmCreatePopupMenu(new_item->wid, "popup", NULL, 0); if(new_list->MaxLevel() != 0) { XmString label_str = XmStringCreateSimple("Level"); @@ -1055,7 +1057,7 @@ void XYPlotWin::writeValue(char *str, char *fmt, double val, int expv) { void XYPlotWin::drawGridAndAxis() { int expX, expY; // Engineering powers int Yspot, Xspot; - char value[10], final[BUFSIZE + 10]; + char value[10], final[Amrvis::BUFSIZE + 10]; double dXIncr, dYIncr, dXStart, dYStart, dYIndex, dXIndex, dLarger; XSegment segs[2]; @@ -1537,7 +1539,7 @@ void XYPlotWin::DoASCIIDump(FILE *fs, const char *plotname) { return; } PltAppState *pas = pltParent->GetPltAppState(); - char format[LINELENGTH]; + char format[Amrvis::LINELENGTH]; sprintf(format, "%s %s\n", pas->GetFormatString().c_str(), pas->GetFormatString().c_str()); fprintf(fs, "TitleText: %s\n", plotname); @@ -1686,9 +1688,9 @@ void XYPlotWin::CBdoOptions(Widget, XtPointer, XtPointer) { XtVaCreateManagedWidget(" Ok ", xmPushButtonGadgetClass, wOptionsForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_FORM, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); AddStaticCallback(wOkButton, XmNactivateCallback, &XYPlotWin::CBdoOptionsOKButton, (XtPointer) 1); @@ -1697,10 +1699,10 @@ void XYPlotWin::CBdoOptions(Widget, XtPointer, XtPointer) { XtVaCreateManagedWidget(" Apply ", xmPushButtonGadgetClass, wOptionsForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wOkButton, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); AddStaticCallback(wApplyButton, XmNactivateCallback, &XYPlotWin::CBdoOptionsOKButton, (XtPointer) 1); @@ -1709,10 +1711,10 @@ void XYPlotWin::CBdoOptions(Widget, XtPointer, XtPointer) { XtVaCreateManagedWidget(" Cancel ", xmPushButtonGadgetClass, wOptionsForm, XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET, + XmNbottomOffset, Amrvis::WOFFSET, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wApplyButton, - XmNleftOffset, WOFFSET, + XmNleftOffset, Amrvis::WOFFSET, NULL); AddStaticCallback(wCancelButton, XmNactivateCallback, &XYPlotWin::CBdoOptionsOKButton, (XtPointer) 0); @@ -1722,10 +1724,10 @@ void XYPlotWin::CBdoOptions(Widget, XtPointer, XtPointer) { wOptionsForm, XmNset, tbool[6], XmNbottomAttachment, XmATTACH_FORM, - XmNbottomOffset, WOFFSET + 4, + XmNbottomOffset, Amrvis::WOFFSET + 4, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, wCancelButton, - XmNleftOffset, 2 * WOFFSET, + XmNleftOffset, 2 * Amrvis::WOFFSET, NULL); wOptionsWidgets[6] = wid; @@ -1808,9 +1810,9 @@ void XYPlotWin::CBdoOptionsOKButton(Widget, XtPointer data, XtPointer) { strcpy(formatY, input); XtFree(input); - if(whichType == XDIR) { + if(whichType == Amrvis::XDIR) { parameters->Set_Parameter("XUnitTextX", STR, XUnitText); - } else if(whichType == YDIR) { + } else if(whichType == Amrvis::YDIR) { parameters->Set_Parameter("XUnitTextY", STR, XUnitText); } else { parameters->Set_Parameter("XUnitTextZ", STR, XUnitText); @@ -1845,10 +1847,10 @@ void XYPlotWin::CBdoOptionsOKButton(Widget, XtPointer data, XtPointer) { NULL); sprintf(buf, "%d", winX); sprintf(buf2, "%d", winY); - if(whichType == XDIR) { + if(whichType == Amrvis::XDIR) { parameters->Set_Parameter("InitialXWindowOffsetX", INT, buf); parameters->Set_Parameter("InitialXWindowOffsetY", INT, buf2); - } else if(whichType == YDIR){ + } else if(whichType == Amrvis::YDIR){ parameters->Set_Parameter("InitialYWindowOffsetX", INT, buf); parameters->Set_Parameter("InitialYWindowOffsetY", INT, buf2); } else{