From 7583c1f9d2bcab7833f3ad741e089e4a96918fac Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 30 Aug 2004 16:55:16 +0000 Subject: Bring development version in sync with stable version from /packages/FlexIO. git-svn-id: http://svn.cactuscode.org/arrangements/CactusExternal/FlexIO/trunk@68 21a6bef8-4479-4f54-8f8d-0db94a2919ef --- src/AMRHierLib/AMRGrid.cc | 612 +++++++++++ src/AMRHierLib/AMRGrid.hh | 327 ++++++ src/AMRHierLib/AMRGrid.icc | 194 ++++ src/AMRHierLib/AMRGridCell.cc | 32 + src/AMRHierLib/AMRGridCell.hh | 130 +++ src/AMRHierLib/AMRGridCell.icc | 47 + src/AMRHierLib/AMRGridStitcher.cc | 1936 ++++++++++++++++++++++++++++++++++ src/AMRHierLib/AMRGridStitcher.hh | 141 +++ src/AMRHierLib/AMRHierarchy.cc | 189 ++++ src/AMRHierLib/AMRHierarchy.hh | 127 +++ src/AMRHierLib/AMRHierarchy.icc | 93 ++ src/AMRHierLib/AMRLevel.cc | 152 +++ src/AMRHierLib/AMRLevel.hh | 169 +++ src/AMRHierLib/AMRLevel.icc | 78 ++ src/AMRHierLib/COPYRIGHT | 42 + src/AMRHierLib/Makefile | 138 +++ src/AMRHierLib/PrintAMRHier.cc | 24 + src/AMRHierLib/README | 28 + src/AMRHierLib/StitchCellWriter.cc | 188 ++++ src/AMRHierLib/StitchCellWriter.hh | 111 ++ src/AMRHierLib/StitchCellWriter.icc | 26 + src/AMRHierLib/Vol2IEEEIO.cc | 66 ++ src/AMRHierLib/VtxOrder.fig | 137 +++ src/AMRHierLib/VtxOrder.pdf | Bin 0 -> 3069 bytes src/AMRHierLib/WriteStitchCells.cc | 53 + src/AMRPlus/AMRPlusConv.C | 4 +- src/AMRPlus/AMRfilereaderPlus.C | 11 +- src/AMRPlus/AMRfilereaderPlus.h | 4 + src/AMRPlus/AMRgridreaderPlus.C | 38 +- src/AMRPlus/AMRreaderPlus.C | 3 +- src/AMRPlus/Dpndfile | 193 ---- src/AMRPlus/config.guess | 1368 ++++++++++++++++++++++++ src/AMRPlus/config.h.in | 3 + src/AMRPlus/config.sub | 1367 ++++++++++++++++++++++++ src/AMRPlus/configure | 1450 +++++++++++++++++++++++++ src/AMRPlus/configure.in | 143 +++ src/AMRPlus/install-sh | 251 +++++ src/AMRPlus/libAMRPlus.a | Bin 0 -> 35310 bytes src/AMRPlus/makefile | 69 +- src/AMRPlus/makefile.in | 81 ++ src/AmrFileReader.hh | 1 + src/Arch.h | 4 + src/GNUmakefile | 18 +- src/H5IO.cc | 108 +- src/HDFIO.cc | 8 +- src/IOspeed.cc | 85 +- src/MPIutils.hh | 3 + src/SampleAmrReader.cc | 1 + src/config.guess | 1368 ++++++++++++++++++++++++ src/config.h.in | 9 + src/config.sub | 1367 ++++++++++++++++++++++++ src/configure | 1567 +++++++++++++++++++++++++++ src/configure.in | 228 ++++ src/install-sh | 251 +++++ src/ioconvert.cc | 56 +- src/ioinfo.cc | 10 +- src/vtkAMRStructuredPointsReader.cxx | 327 ++++++ src/vtkAMRStructuredPointsReader.h | 65 ++ src/writef77.f | 2 +- src/xmlview.cc | 2 +- 60 files changed, 15172 insertions(+), 333 deletions(-) create mode 100644 src/AMRHierLib/AMRGrid.cc create mode 100644 src/AMRHierLib/AMRGrid.hh create mode 100644 src/AMRHierLib/AMRGrid.icc create mode 100644 src/AMRHierLib/AMRGridCell.cc create mode 100644 src/AMRHierLib/AMRGridCell.hh create mode 100644 src/AMRHierLib/AMRGridCell.icc create mode 100644 src/AMRHierLib/AMRGridStitcher.cc create mode 100644 src/AMRHierLib/AMRGridStitcher.hh create mode 100644 src/AMRHierLib/AMRHierarchy.cc create mode 100644 src/AMRHierLib/AMRHierarchy.hh create mode 100644 src/AMRHierLib/AMRHierarchy.icc create mode 100644 src/AMRHierLib/AMRLevel.cc create mode 100644 src/AMRHierLib/AMRLevel.hh create mode 100644 src/AMRHierLib/AMRLevel.icc create mode 100644 src/AMRHierLib/COPYRIGHT create mode 100644 src/AMRHierLib/Makefile create mode 100644 src/AMRHierLib/PrintAMRHier.cc create mode 100644 src/AMRHierLib/README create mode 100644 src/AMRHierLib/StitchCellWriter.cc create mode 100644 src/AMRHierLib/StitchCellWriter.hh create mode 100644 src/AMRHierLib/StitchCellWriter.icc create mode 100644 src/AMRHierLib/Vol2IEEEIO.cc create mode 100644 src/AMRHierLib/VtxOrder.fig create mode 100644 src/AMRHierLib/VtxOrder.pdf create mode 100644 src/AMRHierLib/WriteStitchCells.cc create mode 100755 src/AMRPlus/config.guess create mode 100644 src/AMRPlus/config.h.in create mode 100755 src/AMRPlus/config.sub create mode 100755 src/AMRPlus/configure create mode 100644 src/AMRPlus/configure.in create mode 100755 src/AMRPlus/install-sh create mode 100644 src/AMRPlus/libAMRPlus.a create mode 100644 src/AMRPlus/makefile.in create mode 100755 src/config.guess create mode 100644 src/config.h.in create mode 100755 src/config.sub create mode 100755 src/configure create mode 100644 src/configure.in create mode 100755 src/install-sh create mode 100755 src/vtkAMRStructuredPointsReader.cxx create mode 100755 src/vtkAMRStructuredPointsReader.h diff --git a/src/AMRHierLib/AMRGrid.cc b/src/AMRHierLib/AMRGrid.cc new file mode 100644 index 0000000..8e429b9 --- /dev/null +++ b/src/AMRHierLib/AMRGrid.cc @@ -0,0 +1,612 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +#include "AMRGrid.hh" + +// Standard C/C++ Includes +#include +#include + +// Own basic includes +#include +#include + +// AMR related includes +#include +#include + +namespace AMRGridAuxFct { + inline char *dataTypeToStr(IObase::DataType dt) { + switch (dt) { + case 0: + return "Byte/Int8"; break; + case 1: + return "Int16"; break; + case 2: + return "Int32"; break; + case 3: + return "Int64"; break; + case 4: + return "Float32"; break; + case 5: + return "Float64"; break; + case 6: + return "uInt8/uChar"; break; + case 7: + return "uInt16"; break; + case 8: + return "uInt32"; break; + case 9: + return "uInt64"; break; + case 10: + return "Char/Char8/String"; break; + case 11: + return "Unicode/Char16"; break; + default: + return "UNKNOWN/ERROR"; break; + } + } + + inline int ceilDiv(int divident, int divisor) + { + return (divident / divisor) + ((divident % divisor) == 0 ? 0 : 1); + } + + std::ostream& operator<<(std::ostream &os, const int v[3]) + { + os << "(" << v[0] << ", " << v[1] << ", " << v[2] << ")"; + return os; + } + std::ostream& operator<<(std::ostream &os, const double v[3]) + { + os << "(" << v[0] << ", " << v[1] << ", " << v[2] << ")"; + return os; + } +} + +AMRGrid::GridProperty::~GridProperty() +{ +} + +AMRGrid::IntersectionMap::IntersectionMap(int iRes, int jRes, int kRes, int subCellIRes, int subCellJRes, int subCellKRes, MapType mapType) : mMapType(mapType), mIRes(iRes), mJRes(jRes), mKRes(kRes), mIntersectingGridIndices(new int[mIRes*mJRes*mKRes]), mSubCellIRes(subCellIRes), mSubCellJRes(subCellJRes), mSubCellKRes(subCellKRes), mRefinementMaps(new IntersectionMap*[mIRes*mJRes*mKRes]) +{ + init(); +} + +AMRGrid::IntersectionMap::~IntersectionMap() +{ + delete[] mIntersectingGridIndices; + for (int i=0; i::iterator it = mGridProperties.begin(); it != mGridProperties.end(); ++it) + delete it->second; +} + +bool AMRGrid::loadCells() +{ + if (datatype!=IObase::Float32) { + std::cerr << "Error: Grid data is in " << AMRGridAuxFct::dataTypeToStr(IObase::DataType(datatype)) << " format. Currently only Float32 datasets are supported" << std::endl; + return false; + } + if (data==NULL) + mAmrGridReader->getGridData(*this, mGridIndex); + return true; +} + +void AMRGrid::loadCellsForAllRefiningGrids() +{ + for (AMRRefiningGridIterator refGridIt=refiningGridsBegin(); refGridIt!=refiningGridsEnd(); ++refGridIt) + (*refGridIt)->loadCells(); +} + +bool AMRGrid::overlaps(const AMRGrid &otherGrid) const +{ + for (int i=0; i refiningGridsOfInterest; + int calculationRefinement[3] = { 1, 1, 1 }; + for (AMRRefiningGridConstIterator refiningCandIter=refiningGridsBegin(); + refiningCandIter!=refiningGridsEnd(); + ++refiningCandIter) { + if (considerAllGrids || gridsOfInterest.getBitValue((*refiningCandIter)->index())) { + refiningGridsOfInterest.push_back(*refiningCandIter); + // The following choice of calculationRefinement assumes, + // that spatial refinement and grid placement refinement of all + // refining grids are integer multiples of each other and of spatial + // and grid placment refinement of the current grid. + calculationRefinement[0] = std::max(calculationRefinement[0], + std::max((*refiningCandIter)->gridplacementrefinement[0], (*refiningCandIter)->spatialrefinement[0])); + calculationRefinement[1] = std::max(calculationRefinement[1], + std::max((*refiningCandIter)->gridplacementrefinement[1], (*refiningCandIter)->spatialrefinement[1])); + calculationRefinement[2] = std::max(calculationRefinement[2], + std::max((*refiningCandIter)->gridplacementrefinement[2], (*refiningCandIter)->spatialrefinement[2])); + // + } + } + + int thisSpatialFactor [3]; + thisSpatialFactor[0] = calculationRefinement[0]/spatialrefinement[0]; + thisSpatialFactor[1] = calculationRefinement[1]/spatialrefinement[1]; + thisSpatialFactor[2] = calculationRefinement[2]/spatialrefinement[2]; + assert(calculationRefinement[0]%spatialrefinement[0]==0); + assert(calculationRefinement[1]%spatialrefinement[1]==0); + assert(calculationRefinement[2]%spatialrefinement[2]==0); + + int thisPlacementFactor[3]; + thisPlacementFactor[0] = calculationRefinement[0]/gridplacementrefinement[0]; + thisPlacementFactor[1] = calculationRefinement[1]/gridplacementrefinement[1]; + thisPlacementFactor[2] = calculationRefinement[2]/gridplacementrefinement[2]; + assert(calculationRefinement[0]%gridplacementrefinement[0]==0); + assert(calculationRefinement[1]%gridplacementrefinement[1]==0); + assert(calculationRefinement[2]%gridplacementrefinement[2]==0); + + IntersectionMap* theIntersectionMap = new IntersectionMap(dims[0], dims[1], dims[2], + thisSpatialFactor[0], thisSpatialFactor[1], thisSpatialFactor[2], mapType); + + for (std::list::iterator refiningIter=refiningGridsOfInterest.begin(); + refiningIter!=refiningGridsOfInterest.end(); + ++refiningIter) { + int otherSpatialFactor [3]; + otherSpatialFactor[0] = calculationRefinement[0]/(*refiningIter)->spatialrefinement[0]; + otherSpatialFactor[1] = calculationRefinement[1]/(*refiningIter)->spatialrefinement[1]; + otherSpatialFactor[2] = calculationRefinement[2]/(*refiningIter)->spatialrefinement[2]; + assert(calculationRefinement[0]%(*refiningIter)->spatialrefinement[0]==0); + assert(calculationRefinement[1]%(*refiningIter)->spatialrefinement[1]==0); + assert(calculationRefinement[2]%(*refiningIter)->spatialrefinement[2]==0); + int otherPlacementFactor[3]; + otherPlacementFactor[0] = calculationRefinement[0]/(*refiningIter)->gridplacementrefinement[0]; + otherPlacementFactor[1] = calculationRefinement[1]/(*refiningIter)->gridplacementrefinement[1]; + otherPlacementFactor[2] = calculationRefinement[2]/(*refiningIter)->gridplacementrefinement[2]; + assert(calculationRefinement[0]%(*refiningIter)->gridplacementrefinement[0]==0); + assert(calculationRefinement[1]%(*refiningIter)->gridplacementrefinement[1]==0); + assert(calculationRefinement[2]%(*refiningIter)->gridplacementrefinement[2]==0); + + int minExt[3]; + minExt[0] = (*refiningIter)->iorigin[0]*otherPlacementFactor[0] - iorigin[0]*thisPlacementFactor[0]; + minExt[1] = (*refiningIter)->iorigin[1]*otherPlacementFactor[1] - iorigin[1]*thisPlacementFactor[1]; + minExt[2] = (*refiningIter)->iorigin[2]*otherPlacementFactor[2] - iorigin[2]*thisPlacementFactor[2]; + // Clip + if (minExt[0] < 0) minExt[0]=0; + if (minExt[1] < 0) minExt[1]=0; + if (minExt[2] < 0) minExt[2]=0; + + int maxExt[3]; + maxExt[0] = minExt[0] + (*refiningIter)->dims[0]*otherSpatialFactor[0] - 1; + maxExt[1] = minExt[1] + (*refiningIter)->dims[1]*otherSpatialFactor[1] - 1; + maxExt[2] = minExt[2] + (*refiningIter)->dims[2]*otherSpatialFactor[2] - 1; + // Clip + if (maxExt[0] > dims[0] * thisSpatialFactor[0] - 1) maxExt[0] = dims[0] * thisSpatialFactor[0] - 1; + if (maxExt[1] > dims[1] * thisSpatialFactor[1] - 1) maxExt[1] = dims[1] * thisSpatialFactor[1] - 1; + if (maxExt[2] > dims[2] * thisSpatialFactor[2] - 1) maxExt[2] = dims[2] * thisSpatialFactor[2] - 1; + + if (mapType == IntersectionMap::RefinedInnerCells) { + minExt[0]++; + minExt[1]++; + minExt[2]++; + maxExt[0]--; + maxExt[1]--; + maxExt[2]--; + if (!(maxExt[0]>minExt[0] && maxExt[1]>minExt[1] && maxExt[2]>minExt[2])) + // Skip this grid, no inner cells! + continue; + } + + int minExtCell[3]; + minExtCell[0] = minExt[0] / thisSpatialFactor[0]; // "Rounds" to floor(x), because >=0 !!! + minExtCell[1] = minExt[1] / thisSpatialFactor[1]; // "Rounds" to floor(x), because >=0 !!! + minExtCell[2] = minExt[2] / thisSpatialFactor[2]; // "Rounds" to floor(x), because >=0 !!! + int minExtSubCell[3]; + minExtSubCell[0] = minExt[0] % thisSpatialFactor[0]; + minExtSubCell[1] = minExt[1] % thisSpatialFactor[1]; + minExtSubCell[2] = minExt[2] % thisSpatialFactor[2]; + int maxExtCell[3]; + maxExtCell[0] = maxExt[0] / thisSpatialFactor[0]; + maxExtCell[1] = maxExt[1] / thisSpatialFactor[1]; + maxExtCell[2] = maxExt[2] / thisSpatialFactor[2]; + int maxExtSubCell[3]; + maxExtSubCell[0] = maxExt[0] % thisSpatialFactor[0]; + maxExtSubCell[1] = maxExt[1] % thisSpatialFactor[1]; + maxExtSubCell[2] = maxExt[2] % thisSpatialFactor[2]; + // Create the low-res intersection information + if (mapType == IntersectionMap::BorderCells) { + for (int i=minExtCell[0]; i<=maxExtCell[0]; ++i) { + for (int j=minExtCell[1]; j<=maxExtCell[1]; ++j) { + (*theIntersectionMap)(i,j,minExtCell[2]) = (*refiningIter)->mGridIndex; + (*theIntersectionMap)(i,j,maxExtCell[2]) = (*refiningIter)->mGridIndex; + } + } + for (int i=minExtCell[0]; i<=maxExtCell[0]; ++i) { + for (int k=minExtCell[2]; k<=maxExtCell[2]; ++k) { + (*theIntersectionMap)(i,minExtCell[1],k) = (*refiningIter)->mGridIndex; + (*theIntersectionMap)(i,maxExtCell[1],k) = (*refiningIter)->mGridIndex; + } + } + for (int j=minExtCell[1]; j<=maxExtCell[1]; ++j) { + for (int k=minExtCell[2]; k<=maxExtCell[2]; ++k) { + (*theIntersectionMap)(minExtCell[0],j,k) = (*refiningIter)->mGridIndex; + (*theIntersectionMap)(maxExtCell[0],j,k) = (*refiningIter)->mGridIndex; + } + } + } + else if (mapType == IntersectionMap::RefinedCells || mapType == IntersectionMap::RefinedInnerCells) { + for (int i=minExtCell[0]; i<=maxExtCell[0]; ++i) { + for (int j=minExtCell[1]; j<=maxExtCell[1]; ++j) { + for (int k=minExtCell[2]; k<=maxExtCell[2]; ++k) { + (*theIntersectionMap)(i,j,k) = (*refiningIter)->mGridIndex; + } + } + } + } + /* + // Assumption: Each grid covers at least two cells in each extend + assume(minExtCell[0]!=maxExtCell[0]); + assume(minExtCell[1]!=maxExtCell[1]); + assume(minExtCell[2]!=maxExtCell[2]); + */ + + // Create subcells, where necessary + int subCellIRes = thisSpatialFactor[0]; + int subCellJRes = thisSpatialFactor[1]; + int subCellKRes = thisSpatialFactor[2]; + + if (minExtSubCell[2]) { + for (int i=minExtCell[0]; i<=maxExtCell[0]; ++i) { + for (int j=minExtCell[1]; j<=maxExtCell[1]; ++j) { + // + // This isn't nice but avoids checking for serveral special cases + int subIMin = (i==minExtCell[0] ? minExtSubCell[0] : 0); + int subIMax = (i==maxExtCell[0] ? maxExtSubCell[0] : subCellIRes-1); + int subJMin = (j==minExtCell[1] ? minExtSubCell[1] : 0); + int subJMax = (j==maxExtCell[1] ? maxExtSubCell[1] : subCellJRes-1); + // + theIntersectionMap->createBlockRefined(i, j, minExtCell[2], subIMin, subIMax, subJMin, subJMax, minExtSubCell[2], subCellKRes-1, (*refiningIter)->mGridIndex); + } + } + } + if (maxExtSubCell[2]!=subCellKRes-1) { + for (int i=minExtCell[0]; i<=maxExtCell[0]; ++i) { + for (int j=minExtCell[1]; j<=maxExtCell[1]; ++j) { + // + // This isn't nice but avoids checking for serveral special cases + int subIMin = (i==minExtCell[0] ? minExtSubCell[0] : 0); + int subIMax = (i==maxExtCell[0] ? maxExtSubCell[0] : subCellIRes-1); + int subJMin = (j==minExtCell[1] ? minExtSubCell[1] : 0); + int subJMax = (j==maxExtCell[1] ? maxExtSubCell[1] : subCellJRes-1); + // + theIntersectionMap->createBlockRefined(i, j, maxExtCell[2], subIMin, subIMax, subJMin, subJMax, 0, maxExtSubCell[2], (*refiningIter)->mGridIndex); + } + } + } + if (minExtSubCell[1]) { + for (int i=minExtCell[0]; i<=maxExtCell[0]; ++i) { + for (int k=minExtCell[2]; k<=maxExtCell[2]; ++k) { + // + // This isn't nice but avoids checking for serveral special cases + int subIMin = (i==minExtCell[0] ? minExtSubCell[0] : 0); + int subIMax = (i==maxExtCell[0] ? maxExtSubCell[0] : subCellIRes-1); + int subKMin = (k==minExtCell[2] ? minExtSubCell[2] : 0); + int subKMax = (k==maxExtCell[2] ? maxExtSubCell[2] : subCellKRes-1); + // + theIntersectionMap->createBlockRefined(i, minExtCell[1], k, subIMin, subIMax, minExtSubCell[1], subCellJRes-1, subKMin, subKMax, (*refiningIter)->mGridIndex); + } + } + } + if (maxExtSubCell[1]!=subCellJRes-1) { + for (int i=minExtCell[0]; i<=maxExtCell[0]; ++i) { + for (int k=minExtCell[2]; k<=maxExtCell[2]; ++k) { + // + // This isn't nice but avoids checking for serveral special cases + int subIMin = (i==minExtCell[0] ? minExtSubCell[0] : 0); + int subIMax = (i==maxExtCell[0] ? maxExtSubCell[0] : subCellIRes-1); + int subKMin = (k==minExtCell[2] ? minExtSubCell[2] : 0); + int subKMax = (k==maxExtCell[2] ? maxExtSubCell[2] : subCellKRes-1); + // + theIntersectionMap->createBlockRefined(i, maxExtCell[1], k, subIMin, subIMax, 0, maxExtSubCell[1], subKMin, subKMax, (*refiningIter)->mGridIndex); + } + } + } + if (minExtSubCell[0]) { + for (int j=minExtCell[1]; j<=maxExtCell[1]; ++j) { + for (int k=minExtCell[2]; k<=maxExtCell[2]; ++k) { + // + // This isn't nice but avoids checking for serveral special cases + int subJMin = (j==minExtCell[1] ? minExtSubCell[1] : 0); + int subJMax = (j==maxExtCell[1] ? maxExtSubCell[1] : subCellJRes-1); + int subKMin = (k==minExtCell[2] ? minExtSubCell[2] : 0); + int subKMax = (k==maxExtCell[2] ? maxExtSubCell[2] : subCellKRes-1); + // + theIntersectionMap->createBlockRefined(minExtCell[0], j, k, minExtSubCell[0], subCellIRes-1, subJMin, subJMax, subKMin, subKMax, (*refiningIter)->mGridIndex); + } + } + } + if (maxExtSubCell[0]!=subCellIRes-1) { + for (int j=minExtCell[1]; j<=maxExtCell[1]; ++j) { + for (int k=minExtCell[2]; k<=maxExtCell[2]; ++k) { + // + // This isn't nice but avoids checking for serveral special cases + int subJMin = (j==minExtCell[1] ? minExtSubCell[1] : 0); + int subJMax = (j==maxExtCell[1] ? maxExtSubCell[1] : subCellJRes-1); + int subKMin = (k==minExtCell[2] ? minExtSubCell[2] : 0); + int subKMax = (k==maxExtCell[2] ? maxExtSubCell[2] : subCellKRes-1); + // + theIntersectionMap->createBlockRefined(maxExtCell[0], j, k, 0, maxExtSubCell[0], subJMin, subJMax, subKMin, subKMax, (*refiningIter)->mGridIndex); + } + } + } + } + return theIntersectionMap; +} + +AMRGrid::AMRRefinementInfo *AMRGrid::getRefinementInfo(const AMRGrid *refiningGrid) const +{ + if(level != refiningGrid->level-1) return 0; + + int calculationRefinement[3]; + calculationRefinement[0] = std::min(refiningGrid->spatialrefinement[0], refiningGrid->gridplacementrefinement[0]); + calculationRefinement[1] = std::min(refiningGrid->spatialrefinement[1], refiningGrid->gridplacementrefinement[1]); + calculationRefinement[2] = std::min(refiningGrid->spatialrefinement[2], refiningGrid->gridplacementrefinement[2]); + + // Assume that gridplacementrefinement and spatialrefinement can be expressed + // as integer ratios with respect to each other and the factors of the parent level + assume(calculationRefinement[0] % refiningGrid->spatialrefinement[0] == 0); + assume(calculationRefinement[1] % refiningGrid->spatialrefinement[1] == 0); + assume(calculationRefinement[2] % refiningGrid->spatialrefinement[2] == 0); + assume(calculationRefinement[0] % refiningGrid->gridplacementrefinement[0] == 0); + assume(calculationRefinement[1] % refiningGrid->gridplacementrefinement[1] == 0); + assume(calculationRefinement[2] % refiningGrid->gridplacementrefinement[2] == 0); + assume(calculationRefinement[0] % spatialrefinement[0] == 0); + assume(calculationRefinement[1] % spatialrefinement[1] == 0); + assume(calculationRefinement[2] % spatialrefinement[2] == 0); + assume(calculationRefinement[0] % gridplacementrefinement[0] == 0); + assume(calculationRefinement[1] % gridplacementrefinement[1] == 0); + assume(calculationRefinement[2] % gridplacementrefinement[2] == 0); + + int refiningPlacementFactor[3]; + refiningPlacementFactor[0] = calculationRefinement[0] / refiningGrid->gridplacementrefinement[0]; + refiningPlacementFactor[1] = calculationRefinement[1] / refiningGrid->gridplacementrefinement[1]; + refiningPlacementFactor[2] = calculationRefinement[2] / refiningGrid->gridplacementrefinement[2]; + int refiningSpatialFactor[3]; + refiningSpatialFactor[0] = calculationRefinement[0] / refiningGrid->spatialrefinement[0]; + refiningSpatialFactor[1] = calculationRefinement[1] / refiningGrid->spatialrefinement[1]; + refiningSpatialFactor[2] = calculationRefinement[2] / refiningGrid->spatialrefinement[2]; + int refinedPlacementFactor[3]; + refinedPlacementFactor[0] = calculationRefinement[0] / gridplacementrefinement[0]; + refinedPlacementFactor[1] = calculationRefinement[1] / gridplacementrefinement[1]; + refinedPlacementFactor[2] = calculationRefinement[2] / gridplacementrefinement[2]; + int refinedSpatialFactor[3]; + refinedSpatialFactor[0] = calculationRefinement[0] / spatialrefinement[0]; + refinedSpatialFactor[1] = calculationRefinement[1] / spatialrefinement[1]; + refinedSpatialFactor[2] = calculationRefinement[2] / spatialrefinement[2]; + int minExt[3]; + minExt[0] = refiningGrid->iorigin[0]*refiningPlacementFactor[0] - iorigin[0]*refinedPlacementFactor[0]; + minExt[1] = refiningGrid->iorigin[1]*refiningPlacementFactor[1] - iorigin[1]*refinedPlacementFactor[1]; + minExt[2] = refiningGrid->iorigin[2]*refiningPlacementFactor[2] - iorigin[2]*refinedPlacementFactor[2]; + int maxExt[3]; + maxExt[0] = minExt[0]+(refiningGrid->dims[0]-1)*refiningSpatialFactor[0]; + maxExt[1] = minExt[1]+(refiningGrid->dims[1]-1)*refiningSpatialFactor[1]; + maxExt[2] = minExt[2]+(refiningGrid->dims[2]-1)*refiningSpatialFactor[2]; + + int refinedCellsMin[3]; + refinedCellsMin[0] = minExt[0] / refinedSpatialFactor[0]; + refinedCellsMin[1] = minExt[1] / refinedSpatialFactor[1]; + refinedCellsMin[2] = minExt[2] / refinedSpatialFactor[2]; + int refinedCellsSubMin[3]; + refinedCellsSubMin[0] = minExt[0] % refinedSpatialFactor[0]; + refinedCellsSubMin[1] = minExt[1] % refinedSpatialFactor[1]; + refinedCellsSubMin[2] = minExt[2] % refinedSpatialFactor[2]; + int refinedCellsMax[3]; + refinedCellsMax[0] = maxExt[0] / refinedSpatialFactor[0]; + refinedCellsMax[1] = maxExt[1] / refinedSpatialFactor[1]; + refinedCellsMax[2] = maxExt[2] / refinedSpatialFactor[2]; + int refinedCellsSubMax[3]; + refinedCellsSubMax[0] = maxExt[0] % refinedSpatialFactor[0]; + refinedCellsSubMax[1] = maxExt[1] % refinedSpatialFactor[1]; + refinedCellsSubMax[2] = maxExt[2] % refinedSpatialFactor[2]; + + int completelyRefinedCellsMin[3]; + completelyRefinedCellsMin[0] = refinedCellsMin[0] + (refinedCellsSubMin[0] == 0 ? 0 : 1); + completelyRefinedCellsMin[1] = refinedCellsMin[1] + (refinedCellsSubMin[1] == 0 ? 0 : 1); + completelyRefinedCellsMin[2] = refinedCellsMin[2] + (refinedCellsSubMin[2] == 0 ? 0 : 1); + int completelyRefinedCellsMax[3]; + completelyRefinedCellsMax[0] = refinedCellsMax[0] - (refinedCellsSubMax[0] != refinedSpatialFactor[0]-1 ? 1 : 0); + completelyRefinedCellsMax[1] = refinedCellsMax[1] - (refinedCellsSubMax[1] != refinedSpatialFactor[1]-1 ? 1 : 0); + completelyRefinedCellsMax[2] = refinedCellsMax[2] - (refinedCellsSubMax[2] != refinedSpatialFactor[2]-1 ? 1 : 0); + + int refiningCellsMin[3]; + refiningCellsMin[0] = (completelyRefinedCellsMin[0] * refinedSpatialFactor[0] - minExt[0]) / refiningSpatialFactor[0]; + refiningCellsMin[1] = (completelyRefinedCellsMin[1] * refinedSpatialFactor[1] - minExt[1]) / refiningSpatialFactor[1]; + refiningCellsMin[2] = (completelyRefinedCellsMin[2] * refinedSpatialFactor[2] - minExt[2]) / refiningSpatialFactor[2]; + assume((completelyRefinedCellsMin[0] * refinedSpatialFactor[0] - minExt[0]) % refiningSpatialFactor[0] == 0); + assume((completelyRefinedCellsMin[1] * refinedSpatialFactor[1] - minExt[1]) % refiningSpatialFactor[1] == 0); + assume((completelyRefinedCellsMin[2] * refinedSpatialFactor[2] - minExt[2]) % refiningSpatialFactor[2] == 0); + int refiningCellsMax[3]; + refiningCellsMax[0] = ((completelyRefinedCellsMax[0]+1)*refinedSpatialFactor[0]-minExt[0]) / refiningSpatialFactor[0] - 1; + refiningCellsMax[1] = ((completelyRefinedCellsMax[1]+1)*refinedSpatialFactor[1]-minExt[1]) / refiningSpatialFactor[1] - 1; + refiningCellsMax[2] = ((completelyRefinedCellsMax[2]+1)*refinedSpatialFactor[2]-minExt[2]) / refiningSpatialFactor[2] - 1; + assume((completelyRefinedCellsMax[0]*refinedSpatialFactor[0] - minExt[0] + 1) % refiningSpatialFactor[0] == 0); + assume((completelyRefinedCellsMax[1]*refinedSpatialFactor[1] - minExt[1] + 1) % refiningSpatialFactor[1] == 0); + assume((completelyRefinedCellsMax[2]*refinedSpatialFactor[2] - minExt[2] + 1) % refiningSpatialFactor[2] == 0); + + int mSpatialRefinementWRTParent[3]; + mSpatialRefinementWRTParent[0] = refiningGrid->spatialrefinement[0]/spatialrefinement[0]; + mSpatialRefinementWRTParent[1] = refiningGrid->spatialrefinement[1]/spatialrefinement[1]; + mSpatialRefinementWRTParent[2] = refiningGrid->spatialrefinement[2]/spatialrefinement[2]; + assume(refiningGrid->spatialrefinement[0]%spatialrefinement[0]==0); + assume(refiningGrid->spatialrefinement[1]%spatialrefinement[1]==0); + assume(refiningGrid->spatialrefinement[2]%spatialrefinement[2]==0); + + return new AMRRefinementInfo( + AxisAlignedBox(completelyRefinedCellsMin, completelyRefinedCellsMax), + AxisAlignedBox(refiningCellsMin, refiningCellsMax), + AxisAlignedBox(refinedCellsMin, refinedCellsMax), + AxisAlignedBox(refinedCellsSubMin, refinedCellsSubMax), + mSpatialRefinementWRTParent + ); +} + +AxisAlignedBox AMRGrid::getRefiningCells(const AMRGrid *otherGrid, int i, int j, int k) const +{ + if (otherGrid->level > level) return otherGrid->getRefiningCells(this, i, j, k); + assume(spatialrefinement[0] == gridplacementrefinement[0]); + assume(spatialrefinement[1] == gridplacementrefinement[1]); + assume(spatialrefinement[2] == gridplacementrefinement[2]); + int relativeRefinement[3]; + relativeRefinement[0] = spatialrefinement[0] / otherGrid->spatialrefinement[0]; + relativeRefinement[1] = spatialrefinement[1] / otherGrid->spatialrefinement[1]; + relativeRefinement[2] = spatialrefinement[2] / otherGrid->spatialrefinement[2]; + assume(spatialrefinement[0] % otherGrid->spatialrefinement[0] == 0); + assume(spatialrefinement[1] % otherGrid->spatialrefinement[1] == 0); + assume(spatialrefinement[2] % otherGrid->spatialrefinement[2] == 0); + int start[3]; + start[0] = (otherGrid->iorigin[0]+i) * relativeRefinement[0] - iorigin[0]; + start[1] = (otherGrid->iorigin[1]+j) * relativeRefinement[1] - iorigin[1]; + start[2] = (otherGrid->iorigin[2]+k) * relativeRefinement[2] - iorigin[2]; + int end[3]; + end[0] = start[0] + relativeRefinement[0] - 1; + end[1] = start[1] + relativeRefinement[1] - 1; + end[2] = start[2] + relativeRefinement[2] - 1; + return AxisAlignedBox(start, end); +} + +AMRHierarchy::GridId AMRGrid::getCellRefiningGridId(int i, int j, int k) const +{ + // Get handle for next level + AMRLevel *nextLevel = mAMRHierarchy->getLevel(level+1); + + if (nextLevel) { + // Convert into absoulte level coordinates of next level + // This assumes spatialrefinment == gridplacementrefinment + int absIdxInNextLevel[3]; + absIdxInNextLevel[xAxis] = (i + iorigin[xAxis])*(nextLevel->getSpatialRefinement(xAxis)/spatialrefinement[xAxis]); + absIdxInNextLevel[yAxis] = (j + iorigin[yAxis])*(nextLevel->getSpatialRefinement(yAxis)/spatialrefinement[yAxis]); + absIdxInNextLevel[zAxis] = (k + iorigin[zAxis])*(nextLevel->getSpatialRefinement(zAxis)/spatialrefinement[zAxis]); + + return nextLevel->getGridId(absIdxInNextLevel); + } + else + return AMRGrid::NoGrid; +} + +void AMRGrid::addProperty(const char* name, AMRGrid::GridProperty* property) +{ + mGridProperties[name] = property; +} + +AMRGrid::GridProperty* AMRGrid::getProperty(const char *name) const +{ + std_ext::hash_map::const_iterator pos = mGridProperties.find(name); + if (pos == mGridProperties.end()) + return 0; + else + return pos->second; +} + +void AMRGrid::removeProperty(const char* name) +{ + mGridProperties.erase(name); +} + +void AMRGrid::computeValueRange() +{ + bool cellsAlreadyLoaded = (data != 0); + if (loadCells()) { + assert(data); + mValueRange.min = getValue(0); + mValueRange.max = mValueRange.min; + for (int i = 0; i < dims[0] * dims[1] * dims[2]; ++i) { + float val = getValue(i); + if ( val < mValueRange.min) + mValueRange.min = val; + else if (val > mValueRange.max) + mValueRange.max = val; + } + } + else { + std::cerr << "Error: Couldn't calculate value range. No data!" << std::endl; + } + if (!cellsAlreadyLoaded) unloadCells(); +} diff --git a/src/AMRHierLib/AMRGrid.hh b/src/AMRHierLib/AMRGrid.hh new file mode 100644 index 0000000..f4b799c --- /dev/null +++ b/src/AMRHierLib/AMRGrid.hh @@ -0,0 +1,327 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +/* + * Copyright (C) 2001, The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Visualization + * Group at Lawrence Berkeley National Laboratory. + * 4. Neither the name of the University of California, Berkeley nor of the + * Lawrence Berkeley National Laboratory may be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * + * This work is supported by the U. S. Department of Energy under contract + * number DE-AC03-76SF00098 between the U. S. Department of Energy and the + * University of California. + * + * Author: Gunther H Weber + * Lawrence Berkeley National Laboratory + * Berkeley, California + * + * "this software is 100% hand-crafted by a human being in the USA and Germany" + * + */ + +#ifndef _GHW_AMRGRID_H_ +#define _GHW_AMRGRID_H_ + +// Standard C/C++-Includes +#include +#include +#if (__GNUC__< 3) +#include +#define std_ext std +#else +#include +#define std_ext __gnu_cxx +#endif +#include +#include + +// AMR related includes +#include +#include + +// Own includes +#include +#include +#include + +class AmrGridReader; + +/** + * One grid of an AMR hierarchy + * Holds one grid of the AMRHierarchy together with inforamtion about how + * it is related to the other grids. + */ +class AMRGrid : public AmrGrid { + public: + /** + * Property attached to a grid + * Base class for 'properties' (additional information) that can be + * associated with a grid. + */ + class GridProperty { + public: + virtual ~GridProperty() = 0; + }; + static const int NoGrid = -1; /** Grid ID indicating 'no grid' */ + static const int Unknown = -2; /** Grid ID indicationg that no information about a grid ID is present */ + class AMRRefinementInfo { + public: + /** Information about relationship between a refining and a refined grid + * Class containing detailed information about how a given grid refines another + * grid. + */ + AMRRefinementInfo(const AxisAlignedBox& complRefinedCells, + const AxisAlignedBox& complRefiningCells, + const AxisAlignedBox& refinedCells, + const AxisAlignedBox& refinedSubCells, + int refiningSpatialRefinementWRTRefined[3]) : + mCompletelyRefinedCells(complRefinedCells), + mCompletelyRefiningCells(complRefiningCells), + mRefinedCells(refinedCells), + mRefinedSubCells(refinedSubCells) + { mRefiningSpatialRefinementWRTRefined[0] = refiningSpatialRefinementWRTRefined[0]; + mRefiningSpatialRefinementWRTRefined[1] = refiningSpatialRefinementWRTRefined[1]; + mRefiningSpatialRefinementWRTRefined[2] = refiningSpatialRefinementWRTRefined[2]; + } + const AxisAlignedBox& completelyRefinedCells() { return mCompletelyRefinedCells; } + const AxisAlignedBox& completelyRefiningCells() { return mCompletelyRefiningCells; } + const AxisAlignedBox& refinedCells() { return mRefinedCells; } + const AxisAlignedBox& refinedSubCells() { return mRefinedSubCells; } + int refiningSpatialRefinementWRTRefined(int dim) { assert(0<=dim && dim<3); return mRefiningSpatialRefinementWRTRefined[dim]; } + private: + AxisAlignedBox mCompletelyRefinedCells; + AxisAlignedBox mCompletelyRefiningCells; + AxisAlignedBox mRefinedCells; + AxisAlignedBox mRefinedSubCells; + int mRefiningSpatialRefinementWRTRefined[3]; + }; + /** Map from grid cells to IDs of grids refining them + * The intersection map is an array that contains an entry for each cell of a + * given grid specifying which grid (if there is any) refines it. + */ + class IntersectionMap { + public: + // The type of the map: + // BorderCells - only the on the border of the intersecting grids are marked + // RefinedCells - all cells overlapped by a grid in the next level are marked + + enum MapType { BorderCells, RefinedCells, RefinedInnerCells, RefinementMap }; + IntersectionMap(int iRes, int jRes, int kRes, int iSubCellRes, int jSubCellRes, int kSubCellRes, MapType mapType); + ~IntersectionMap(); + void init(); + const AMRHierarchy::GridId& operator()(int i, int j, int k) const { return mIntersectingGridIndices[idxForTriple(i,j,k)]; } + AMRHierarchy::GridId& operator()(int i, int j, int k) { return mIntersectingGridIndices[idxForTriple(i,j,k)]; } + const AMRHierarchy::GridId& operator()(int idx[3]) const { return mIntersectingGridIndices[idxForTriple(idx[0], idx[1], idx[2])]; } + AMRHierarchy::GridId& operator()(int idx[3]) { return mIntersectingGridIndices[idxForTriple(idx[0], idx[1], idx[2])]; } + IntersectionMap& refineCell(int i, int j, int k); + void createBlockRefined(int i, int j, int k, int iMin, int iMax, int jMin, int jMax, int kMin, int kMax, AMRHierarchy::GridId gridIdx); + MapType getMapType() const { return mMapType; } + const IntersectionMap* subCells(int i, int j, int k) const { return mRefinementMaps[idxForTriple(i, j, k)]; } + int getIRes() const { return mIRes; } + int getJRes() const { return mJRes; } + int getKRes() const { return mKRes; } + private: + MapType mMapType; + int mIRes, mJRes, mKRes; // Extends of this map + AMRHierarchy::GridId *mIntersectingGridIndices; // The actual map, each cell has an entry which in + int mSubCellIRes, mSubCellJRes, mSubCellKRes; + IntersectionMap **mRefinementMaps; + IntersectionMap(const IntersectionMap&); // Prevent copying + IntersectionMap& operator=(const IntersectionMap&); // Prevent copying + int idxForTriple(int i, int j, int k) const { assert (0<=i && i::iterator AMRRefiningGridIterator; /** Iterator for iterating through refining grids */ + typedef std::list::iterator AMRRefinedGridIterator; /** Iterator for iterating through refined grids */ + typedef std::list::const_iterator AMRRefiningGridConstIterator; /** Constant iterator for iterating through refining grids */ + typedef std::list::const_iterator AMRRefinedGridConstIterator; /** Constant iterator for iterating through refined grids */ + // Get iterator for iterating through refining and refined grids. A refining grid is a grid + // that overlaps the current grid on the next finer level and thus provides a more detailed + // description of a grid sub-region. A refined grid is a grid for which the current gird + // provides a more detailed description. + AMRRefiningGridIterator refiningGridsBegin(); + AMRRefiningGridIterator refiningGridsEnd(); + AMRRefinedGridIterator refinedGridsBegin(); + AMRRefinedGridIterator refinedGridsEnd(); + AMRRefiningGridConstIterator refiningGridsBegin() const; + AMRRefiningGridConstIterator refiningGridsEnd() const; + AMRRefinedGridConstIterator refinedGridsBegin() const; + AMRRefinedGridConstIterator refinedGridsEnd() const; + + // Get the index (unique grid identifier in AMR Hierarchy) of the grid + AMRHierarchy::GridId index() const; + // Get value for a cell specified by its index + float getValue(int i, int j, int k) const; + // Get an interpolated value for an arbitrary point covered by the grid + float getInterpolatedValue(double x, double y, double z) const; + // Get the range of all scalar values within the grid + const Range& getValueRange() const; + // Compute the IntersectionMap (see above) + IntersectionMap* computeIntersectionMap(IntersectionMap::MapType mapType, const PrimitiveBitSet& gridsOfInterest, bool considerAllGrids=false) const; + IntersectionMap* computeIntersectionMap(IntersectionMap::MapType mapType) const; + // Is this grid refined by any grids? Are there grids in the next finer level that + // overlap the region covered by this grid + bool refinementAvailable() const; + // Is this grid refining any other grids (should only be false for grids in the root level) + bool isRefinement() const; + // Get information about how a given grid refines this grid + AMRRefinementInfo *getRefinementInfo(const AMRGrid *refiningGrid) const; + // Which cells of otherGrid overlap cell (i, j, k) of this grid + AxisAlignedBox getRefiningCells(const AMRGrid *otherGrid, int i, int j, int k) const; + AMRHierarchy::GridId getCellRefiningGridId(int i, int j, int k) const; + AMRHierarchy::GridId getCellRefiningGridId(const int idx[3]) const; + // Manage grid properties (auxilliary information attached to a grid) + void addProperty(const char* name, GridProperty* property); + GridProperty* getProperty(const char* name) const; + void removeProperty(const char* name); + + private: + friend class AMRHierarchy; + AMRHierarchy::GridId mGridIndex; // Index of grid within hierarchy + AMRHierarchy *mAMRHierarchy; + // Relationship between grids + std::list mRefiningGrids; // List of grids that refine this grid + std::list mRefinedGrids; // List of grids that are refined by this grid + AMRGrid *mNextGridInLevel; // Next Grid in same level + AMRGrid *mPrevGridInLevel; // Previous grid in same level + AmrGridReader *mAmrGridReader; // Pointer to the AMRGridReader used to load cell data + Range mValueRange; // Range of values in the grid + std_ext::hash_map mGridProperties; // Pointer to properties (additional information) attached to this grid + void computeValueRange(); + float getValue(int i) const; // Get data value at given array-idx + + // As seen in Scott Meyer's Effective C++: If you don't want to specify copy constructor + // and assignment operator, make them inaccessible to prevent them from being called accidently. + // NOTE: Even though declared here, they are not defined (causes link error when accidently needed + // within class). + AMRGrid(const AMRGrid&); // Prevent copying + AMRGrid& operator=(const AMRGrid&); // Prevent copying +}; + +#include "AMRGrid.icc" + +#endif diff --git a/src/AMRHierLib/AMRGrid.icc b/src/AMRHierLib/AMRGrid.icc new file mode 100644 index 0000000..c634f1e --- /dev/null +++ b/src/AMRHierLib/AMRGrid.icc @@ -0,0 +1,194 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +/* WARNING: This software is EXPERIMENTAL. The authors give no guaranty + * about stability or correctness of the provided source! + * + * Copyright (C) 2001, The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Visualization + * Group at Lawrence Berkeley National Laboratory. + * 4. Neither the name of the University of California, Berkeley nor of the + * Lawrence Berkeley National Laboratory may be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * + * This work is supported by the U. S. Department of Energy under contract + * number DE-AC03-76SF00098 between the U. S. Department of Energy and the + * University of California. + * + * Author: Gunther H Weber + * Lawrence Berkeley National Laboratory + * Berkeley, California + * + * "this software is 100% hand-crafted by a human being in the USA [and Germany :-)]" + * + */ + +inline float AMRGrid::getValue(int i) const +{ + // Maybe it is possible to integrate some type of conversion here, if the + // grid is not Float32. + // Maybe it is possible to switch here between logaritmic and normal grid rep. + // +#ifdef LOG_GETVALUE + return logf(static_cast(data)[i]); +#else + return static_cast(data)[i]; +#endif +} + +inline float AMRGrid::getValue(int i, int j, int k) const +{ + //if (0<=i && i& AMRGrid::getValueRange() const +{ + return mValueRange; +} + +inline AMRGrid::IntersectionMap* AMRGrid::computeIntersectionMap(IntersectionMap::MapType mapType) const +{ + return computeIntersectionMap(mapType, PrimitiveBitSet(1), true); +} + +inline bool AMRGrid::refinementAvailable() const +{ + return !mRefiningGrids.empty(); +} + +inline bool AMRGrid::isRefinement() const +{ + return !mRefinedGrids.empty(); +} + +inline AMRHierarchy::GridId AMRGrid::getCellRefiningGridId(const int idx[3]) const +{ + return getCellRefiningGridId(idx[0], idx[1], idx[2]); +} diff --git a/src/AMRHierLib/AMRGridCell.cc b/src/AMRHierLib/AMRGridCell.cc new file mode 100644 index 0000000..6d6cdf1 --- /dev/null +++ b/src/AMRHierLib/AMRGridCell.cc @@ -0,0 +1,32 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +#include + +AMRGridCell::AMRGridCell(AMRGrid *g, int i, int j, int k, int id) : mGrid(g), mRefiningGridId(id) +{ + mIdx[0] = i; + mIdx[1] = j; + mIdx[2] = k; + assert(0<=i && idims[0]); + assert(0<=j && jdims[1]); + assert(0<=k && kdims[2]); +} + +AMRGridCell::AMRGridCell(AMRGrid *g, int i[3], int id) : mGrid(g), mRefiningGridId(id) +{ + mIdx[0] = i[0]; + mIdx[1] = i[1]; + mIdx[2] = i[2]; + assert(0<=i[0] && i[0]dims[0]); + assert(0<=i[1] && i[1]dims[1]); + assert(0<=i[2] && i[2]dims[2]); +} diff --git a/src/AMRHierLib/AMRGridCell.hh b/src/AMRHierLib/AMRGridCell.hh new file mode 100644 index 0000000..8a09c58 --- /dev/null +++ b/src/AMRHierLib/AMRGridCell.hh @@ -0,0 +1,130 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +/* + * Copyright (C) 2001, The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Visualization + * Group at Lawrence Berkeley National Laboratory. + * 4. Neither the name of the University of California, Berkeley nor of the + * Lawrence Berkeley National Laboratory may be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * + * This work is supported by the U. S. Department of Energy under contract + * number DE-AC03-76SF00098 between the U. S. Department of Energy and the + * University of California. + * + * Author: Gunther H Weber + * Lawrence Berkeley National Laboratory + * Berkeley, California + * + * "this software is 100% hand-crafted by a human being in the USA and Germany" + * + */ + +#ifndef _GHW_GRIDCELL_ +#define _GHW_GRIDCELL_ + +// Own Misc. Helper Includes +#include +#include + +// AMR Related Includes +#include + +/** + * Describe a grid cell + * Describe a grid cell via pointer to grid containing it and its + * index within that grid. + */ +class AMRGridCell { + public: + /** + * Construct a GridCell + * Consturct a new GridCell + * \param g pointer to grid containing the cell + * \param i index of cell along x-Axis + * \param j index of cell along y-Axis + * \param k index of cell along z-Axis + * \param id ID of grid refining this cell, if known + */ + AMRGridCell(AMRGrid *g, int i, int j, int k, AMRHierarchy::GridId id=AMRGrid::Unknown); + /** + * Construct a GridCell + * Consturct a new GridCell + * \param g pointer to grid containing the cell + * \param i index of cell + * \param id ID of grid refining this cell, if known + */ + AMRGridCell(AMRGrid *g, int i[3], AMRHierarchy::GridId id=AMRGrid::Unknown); + /** + * Get absolute position of center of the grid cell + * Calaculate the absoulte position of the center of the grid cell, i.e. the + * location associated with the grid cell sample value. + */ + Vertex pos() const; + /** + * Get value associated with grid point + * Get the scalar value that is stored in the grid for the given grid point. + */ + double val() const; + /** + * Get index of grid containing the grid-cell + * Get the index/ID of the grid that contains this grid cell + */ + int containingId() const; + /** + * Get index of grid refining the grid-cell + * Get the index/ID of the grid that refines this grid cell + */ + int refiningId() const; + /** + * Get a pointer to the AMRGrid containing the cell + */ + AMRGrid *grid() const; + /** + * Get index in 'grid coordinates' + */ + int idx(AxisType axis) const; + private: + AMRGrid *mGrid; // Pointer to the grid containing the cell + int mIdx[3]; // Index of the cell + mutable int mRefiningGridId; // Index of the grid that refines this grid cell +}; + +#include + +#endif diff --git a/src/AMRHierLib/AMRGridCell.icc b/src/AMRHierLib/AMRGridCell.icc new file mode 100644 index 0000000..4365728 --- /dev/null +++ b/src/AMRHierLib/AMRGridCell.icc @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +inline Vertex AMRGridCell::pos() const +{ + return Vertex( + mGrid->origin[0] + (mIdx[0]+0.5) * mGrid->delta[0], + mGrid->origin[1] + (mIdx[1]+0.5) * mGrid->delta[1], + mGrid->origin[2] + (mIdx[2]+0.5) * mGrid->delta[2] + ); +} + +inline double AMRGridCell::val() const +{ + return mGrid->getValue(mIdx[0], mIdx[1], mIdx[2]); +} + +inline AMRHierarchy::GridId AMRGridCell::containingId() const +{ + return mGrid->index(); +} + +inline AMRHierarchy::GridId AMRGridCell::refiningId() const +{ + if (mRefiningGridId == AMRGrid::Unknown) { + mRefiningGridId = mGrid->getCellRefiningGridId(mIdx); + } + return mRefiningGridId; +} + +inline AMRGrid* AMRGridCell::grid() const +{ + return mGrid; +} + +inline int AMRGridCell::idx(AxisType axis) const +{ + return mIdx[axis]; +} diff --git a/src/AMRHierLib/AMRGridStitcher.cc b/src/AMRHierLib/AMRGridStitcher.cc new file mode 100644 index 0000000..61817e4 --- /dev/null +++ b/src/AMRHierLib/AMRGridStitcher.cc @@ -0,0 +1,1936 @@ +//------------------------------------------------------------------------------ +// +// Project: Crack-free Isosurfaces for AMR Data +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +#include "AMRGridStitcher.hh" + +// Own Helper Includes +#include +#include + +// AMR Specific Includes +#include +#include + +namespace AMRGridStitcherAuxFct +{ + template + inline void generateCellsForDeformedTrianglePrism045(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4, const AMRGridCell& p5) + { + stitchCellHandler.handleTetrahedronCell(p3, p2, p5, p0); + stitchCellHandler.handlePyramidCell(p1, p4, p5, p2, p0); + } + + template + inline void generateCellsForDeformedTrianglePrism145(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4, const AMRGridCell& p5) + { + stitchCellHandler.handleTetrahedronCell(p3, p2, p5, p1); + stitchCellHandler.handlePyramidCell(p0, p3, p5, p4, p1); + } + + template + inline void generateCellsForDeformedTrianglePrism245(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4, const AMRGridCell& p5) + { + generateCellsForDeformedTrianglePrism045(stitchCellHandler, p2, p3, p0, p1, p5, p4); + } + + template + inline void generateCellsForDeformedTrianglePrism345(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4, const AMRGridCell& p5) + { + generateCellsForDeformedTrianglePrism145(stitchCellHandler, p2, p3, p0, p1, p5, p4); + } + + template + inline void generateCellsForDeformedTrianglePrism0145(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4, const AMRGridCell& p5) + { + stitchCellHandler.handleTetrahedronCell(p0, p4, p1, p5); + stitchCellHandler.handlePyramidCell(p0, p1, p2, p3, p5); + } + + template + inline void generateCellsForDeformedTrianglePrism2345(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4, const AMRGridCell& p5) + { + generateCellsForDeformedTrianglePrism0145(stitchCellHandler, p2, p3, p0, p1, p5, p4); + } + + template + inline void generateCellsForDeformedTrianglePrism12345(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4, const AMRGridCell& p5) + { + stitchCellHandler.handleTetrahedronCell(p0, p4, p1, p3); + stitchCellHandler.handlePyramidCell(p1, p4, p5, p2, p3); + } + template + inline void generateCellsForDeformedTrianglePrism02345(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4, const AMRGridCell& p5) + { + stitchCellHandler.handleTetrahedronCell(p0, p4, p1, p2); + stitchCellHandler.handlePyramidCell(p0, p3, p5, p4, p2); + } + + template + inline void generateCellsForDeformedTrianglePrism01345(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4, const AMRGridCell& p5) + { + generateCellsForDeformedTrianglePrism12345(stitchCellHandler, p2, p3, p0, p1, p5, p4); + } + + template + inline void generateCellsForDeformedTrianglePrism01245(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4, const AMRGridCell& p5) + { + generateCellsForDeformedTrianglePrism02345(stitchCellHandler, p2, p3, p0, p1, p5, p4); + } + template + inline void generateCellsForDeformedPyramid04(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4) + { + stitchCellHandler.handleTetrahedronCell(p0, p1, p2, p4); + stitchCellHandler.handleTetrahedronCell(p0, p2, p3, p4); + } + + template + inline void generateCellsForDeformedPyramid023(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4) + { + stitchCellHandler.handleTetrahedronCell(p0, p1, p2, p4); + stitchCellHandler.handleTetrahedronCell(p0, p2, p3, p4); + } + + template + inline void generateCellsForDeformedPyramid024(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4) + { + stitchCellHandler.handleTetrahedronCell(p0, p1, p2, p4); + stitchCellHandler.handleTetrahedronCell(p0, p2, p3, p4); + } + + template + inline void generateCellsForDeformedPyramid1234(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4) + { + stitchCellHandler.handleTetrahedronCell(p0, p1, p3, p4); + stitchCellHandler.handleTetrahedronCell(p1, p2, p3, p4); + } + + template + inline void generateCellsForDeformedCube024567(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4, const AMRGridCell& p5, const AMRGridCell& p6, const AMRGridCell& p7) + { + generateCellsForDeformedPyramid1234(stitchCellHandler, p3, p7, p4, p0, p2); + generateCellsForDeformedPyramid1234(stitchCellHandler, p1, p0, p4, p5, p2); + stitchCellHandler.handlePyramidCell(p4, p7, p6, p5, p2); + } + + Vertex centroid(const Vertex& v0, const Vertex& v1, const Vertex& v2, const Vertex& v3, const Vertex& v4, const Vertex& v5, const Vertex& v6) + { + return affineCombination(7, &v0, 1.0/7.0, &v1, 1.0/7.0, &v2, 1.0/7.0, &v3, 1.0/7.0, &v4, 1.0/7.0, &v5, 1.0/7.0, &v6, 1.0/7.0); + } + + template + inline void generateCellsForDeformedCube1234567(StitchCellHandler& stitchCellHandler, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3, const AMRGridCell& p4, const AMRGridCell& p5, const AMRGridCell& p6, const AMRGridCell& p7) + { + stitchCellHandler.handleTetrahedronCell(p3, p1, p4, p0); + std::cout << "Inserting vertex to avoid illegal tesselation." << std::endl; + Vertex newPos = AMRGridStitcherAuxFct::centroid(p1.pos(), p2.pos(), p3.pos(), p4.pos(), p5.pos(), p6.pos(), p7.pos()); + double newVal = p1.val() + p2.val() + p3.val() + p4.val() + p5.val() + p6.val() + p7.val(); + newVal /= 7; + stitchCellHandler.handleTetrahedronCell(p3, p4, p1, newPos, newVal); + stitchCellHandler.handleTetrahedronCell(p4, p3, p7, newPos, newVal); + stitchCellHandler.handlePyramidCell(p4, p7, p6, p5, newPos, newVal); + stitchCellHandler.handlePyramidCell(p3, p2, p6, p7, newPos, newVal); + stitchCellHandler.handleTetrahedronCell(p1, p2, p3, newPos, newVal); + stitchCellHandler.handlePyramidCell(p1, p5, p6, p2, newPos, newVal); + stitchCellHandler.handleTetrahedronCell(p1, p4, p5, newPos, newVal); + } +} + +template +AMRGridStitcher::AMRGridStitcher(StitchCellHandler& stitchCellHandler, AMRHierarchy& amrHier, AMRGrid *stitchGrid, bool considerNextLevel) +: mStitchCellHandler(stitchCellHandler), mAMRDataSet(amrHier), mStitchGrid(stitchGrid), mConsiderNextLevel(considerNextLevel), mParentLevel(mAMRDataSet.getLevel(stitchGrid->level-1)) +{ + assert(mParentLevel != 0); + // Assume spatialrefinement == gridplacementrefinement + // Assume spatialrefinement % parentLevel->getSpatialRefinemet == 0 + int refinementWRTParentLevel[3]; + refinementWRTParentLevel[xAxis] = mStitchGrid->spatialrefinement[xAxis] / mParentLevel->getSpatialRefinement(xAxis); + refinementWRTParentLevel[yAxis] = mStitchGrid->spatialrefinement[yAxis] / mParentLevel->getSpatialRefinement(yAxis); + refinementWRTParentLevel[zAxis] = mStitchGrid->spatialrefinement[zAxis] / mParentLevel->getSpatialRefinement(zAxis); + + mOriginInParentLevel[xAxis] = mStitchGrid->iorigin[xAxis] / refinementWRTParentLevel[xAxis]; + mOriginInParentLevel[yAxis] = mStitchGrid->iorigin[yAxis] / refinementWRTParentLevel[yAxis]; + mOriginInParentLevel[zAxis] = mStitchGrid->iorigin[zAxis] / refinementWRTParentLevel[zAxis]; + // Assume refined grid starts at cell boundaries of parent level + assume(mStitchGrid->iorigin[xAxis] % refinementWRTParentLevel[xAxis] == 0); + assume(mStitchGrid->iorigin[yAxis] % refinementWRTParentLevel[yAxis] == 0); + assume(mStitchGrid->iorigin[zAxis] % refinementWRTParentLevel[zAxis] == 0); + + mMaxExtInParentLevel[xAxis] = mOriginInParentLevel[xAxis] + (mStitchGrid->dims[xAxis] / refinementWRTParentLevel[xAxis]) -1; + mMaxExtInParentLevel[yAxis] = mOriginInParentLevel[yAxis] + (mStitchGrid->dims[yAxis] / refinementWRTParentLevel[yAxis]) -1; + mMaxExtInParentLevel[zAxis] = mOriginInParentLevel[zAxis] + (mStitchGrid->dims[zAxis] / refinementWRTParentLevel[zAxis]) -1; + // Assume refined grid ends at cell boundaries of parent level + assume(mStitchGrid->dims[xAxis] % refinementWRTParentLevel[xAxis] == 0); + assume(mStitchGrid->dims[yAxis] % refinementWRTParentLevel[yAxis] == 0); + assume(mStitchGrid->dims[zAxis] % refinementWRTParentLevel[zAxis] == 0); + + // Load all grids necessary + AMRLevel *thisLevel = mAMRDataSet.getLevel(mStitchGrid->level); + for (AMRGrid *currGridPtr = thisLevel->getFirstGrid(); currGridPtr != 0; currGridPtr = currGridPtr->getNextGridInLevel()) + currGridPtr->loadCells(); + + for (AMRGrid *currGridPtr = mParentLevel->getFirstGrid(); currGridPtr != 0; currGridPtr = currGridPtr->getNextGridInLevel()) + currGridPtr->loadCells(); +} + +template +AMRGridStitcher::~AMRGridStitcher() +{ +} + +template +void AMRGridStitcher::generateStitchCells(bool xyMin, bool xyMax, bool yzMin, bool yzMax, bool xzMin, bool xzMax) +{ + if (xyMin) generateCellsForFace(xAxis, yAxis, zAxis, min); + if (xzMin) generateCellsForFace(zAxis, xAxis, yAxis, min); + if (yzMin) generateCellsForFace(yAxis, zAxis, xAxis, min); + if (xyMax) generateCellsForFace(yAxis, xAxis, zAxis, max); + if (xzMax) generateCellsForFace(xAxis, zAxis, yAxis, max); + if (yzMax) generateCellsForFace(zAxis, yAxis, xAxis, max); + if (xyMin || xzMin) generateCellsForEdge(xAxis, yAxis, min, zAxis, min); + if (xyMax || xzMin) generateCellsForEdge(xAxis, yAxis, min, zAxis, max); + if (xyMin || xzMax) generateCellsForEdge(xAxis, yAxis, max, zAxis, min); + if (xyMax || xzMax) generateCellsForEdge(xAxis, yAxis, max, zAxis, max); + if (xyMin || yzMin) generateCellsForEdge(yAxis, zAxis, min, xAxis, min); + if (xyMin || yzMax) generateCellsForEdge(yAxis, zAxis, min, xAxis, max); + if (xyMax || yzMin) generateCellsForEdge(yAxis, zAxis, max, xAxis, min); + if (xyMax || yzMax) generateCellsForEdge(yAxis, zAxis, max, xAxis, max); + if (xzMin || yzMin) generateCellsForEdge(zAxis, xAxis, min, yAxis, min); + if (xzMin || yzMax) generateCellsForEdge(zAxis, xAxis, min, yAxis, max); + if (xzMax || yzMin) generateCellsForEdge(zAxis, xAxis, max, yAxis, min); + if (xzMax || yzMax) generateCellsForEdge(zAxis, xAxis, max, yAxis, max); + generateCellsForVertex(xAxis, yAxis, zAxis, min, min, min); + generateCellsForVertex(zAxis, yAxis, xAxis, min, min, max); + generateCellsForVertex(xAxis, yAxis, zAxis, max, min, max); + generateCellsForVertex(zAxis, yAxis, xAxis, max, min, min); + generateCellsForVertex(zAxis, yAxis, xAxis, min, max, min); + generateCellsForVertex(xAxis, yAxis, zAxis, max, max, min); + generateCellsForVertex(zAxis, yAxis, xAxis, max, max, max); + generateCellsForVertex(xAxis, yAxis, zAxis, min, max, max); +} + +template +void AMRGridStitcher::connectQuadToVertex(const AMRGridCell& qp0, const AMRGridCell& qp1, const AMRGridCell& qp2, const AMRGridCell& qp3, const AMRGridCell& vp, AxisType axis0, AxisType axis1, AxisType axis2, MinMaxType faceType) +{ + // If the coarse grid points are from different grids, i.e. the quad results from several + // coarse grids rather than a single one, only generate stitch cells if we are stitching + // the grid with the smallest index. + if (qp0.containingId() < mStitchGrid->index() || qp1.containingId() < mStitchGrid->index() || + qp2.containingId() < mStitchGrid->index() || qp3.containingId() < mStitchGrid->index()) return; + + if (vp.refiningId() != AMRGrid::NoGrid) { + if (mStitchGrid->index() <= vp.refiningId()) { + // No cell bounadaries are crossed, check only one cell for refinement + AMRGrid *otherGrid = mAMRDataSet.getGridByIndex(vp.refiningId()); + AxisAlignedBox refiningCells = otherGrid->getRefiningCells(vp.grid(), vp.idx(xAxis), vp.idx(yAxis), vp.idx(zAxis)); + int oIdx00[3]; + oIdx00[axis0] = refiningCells.min(axis0); + oIdx00[axis1] = refiningCells.min(axis1); + oIdx00[axis2] = faceType == min ? refiningCells.max(axis2) : refiningCells.min(axis2); + + int oIdx01[3]; + oIdx01[axis0] = oIdx00[axis0] + 1; + oIdx01[axis1] = oIdx00[axis1]; + oIdx01[axis2] = oIdx00[axis2]; + + int oIdx10[3]; + oIdx10[axis0] = oIdx00[axis0]; + oIdx10[axis1] = oIdx00[axis1] + 1; + oIdx10[axis2] = oIdx00[axis2]; + + int oIdx11[3]; + oIdx11[axis0] = oIdx00[axis0] + 1; + oIdx11[axis1] = oIdx00[axis1] + 1; + oIdx11[axis2] = oIdx00[axis2]; + + AMRGridCell vpRef0(otherGrid, oIdx00); + AMRGridCell vpRef1(otherGrid, oIdx10); + AMRGridCell vpRef2(otherGrid, oIdx11); + AMRGridCell vpRef3(otherGrid, oIdx01); + + if (!mConsiderNextLevel || + vpRef0.refiningId() == AMRGrid::NoGrid && + vpRef1.refiningId() == AMRGrid::NoGrid && + vpRef2.refiningId() == AMRGrid::NoGrid && + vpRef3.refiningId() == AMRGrid::NoGrid) + // Only add stitch cell when no stitch cells for next level are generated (i.e. + // one of the refining cells is refined itself by an even finer grid) + mStitchCellHandler.handleHexahedronCell(qp0, qp1, qp2, qp3, vpRef0, vpRef1, vpRef2, vpRef3); + } + // else Do nothing! + } + else { + mStitchCellHandler.handlePyramidCell(qp0, qp1, qp2, qp3, vp); + } +} + +template +void AMRGridStitcher::connectQuadToEdge(const AMRGridCell& qp0, const AMRGridCell& qp1, const AMRGridCell& qp2, const AMRGridCell& qp3, const AMRGridCell& ep0, const AMRGridCell& ep1, AxisType axis01, AxisType axis03, AxisType axisPerp0123, MinMaxType qp0Axis01Type, MinMaxType qp0Axis03Type, MinMaxType quadFaceType) +{ + // If the coarse grid points are from different grids, i.e. the quad results from several + // coarse grids rather than a single one, only generate stitch cells if we are stitching + // the grid with the smallest index. + if (qp0.containingId() < mStitchGrid->index() || qp1.containingId() < mStitchGrid->index() || + qp2.containingId() < mStitchGrid->index() || qp3.containingId() < mStitchGrid->index()) return; + + int connectCase = 0; + + AMRGridCell *epRef0 = 0; + AMRGridCell *epRef1 = 0; + if (ep0.refiningId() != AMRGrid::NoGrid) { + connectCase |= 1; + + AMRGrid *otherGrid0 = mAMRDataSet.getGridByIndex(ep0.refiningId()); + AxisAlignedBox refiningCells0 = otherGrid0->getRefiningCells(ep0.grid(), ep0.idx(xAxis), ep0.idx(yAxis), ep0.idx(zAxis)); + + int oIdx0[3]; + oIdx0[axis01] = qp0Axis01Type == min ? refiningCells0.min(axis01) : refiningCells0.max(axis01); + oIdx0[axis03] = qp0Axis03Type == min ? refiningCells0.min(axis03) : refiningCells0.max(axis03); + oIdx0[axisPerp0123] = quadFaceType == min ? refiningCells0.max(axisPerp0123) : refiningCells0.min(axisPerp0123); + epRef0 = new AMRGridCell(otherGrid0, oIdx0); + + int oIdx1[3]; + oIdx1[axis01] = qp0Axis01Type == max ? refiningCells0.min(axis01) : refiningCells0.max(axis01); + oIdx1[axis03] = qp0Axis03Type == min ? refiningCells0.min(axis03) : refiningCells0.max(axis03); + oIdx1[axisPerp0123] = quadFaceType == min ? refiningCells0.max(axisPerp0123) : refiningCells0.min(axisPerp0123); + epRef1 = new AMRGridCell(otherGrid0, oIdx1); + } + + AMRGridCell *epRef2 = 0; + AMRGridCell *epRef3 = 0; + if (ep1.refiningId() != AMRGrid::NoGrid) { + connectCase |= 2; + + AMRGrid *otherGrid1 = mAMRDataSet.getGridByIndex(ep1.refiningId()); + AxisAlignedBox refiningCells1 = otherGrid1->getRefiningCells(ep1.grid(), ep1.idx(xAxis), ep1.idx(yAxis), ep1.idx(zAxis)); + + int oIdx2[3]; + oIdx2[axis01] = qp0Axis01Type == max ? refiningCells1.min(axis01) : refiningCells1.max(axis01); + oIdx2[axis03] = qp0Axis03Type == max ? refiningCells1.min(axis03) : refiningCells1.max(axis03); + oIdx2[axisPerp0123] = quadFaceType == min ? refiningCells1.max(axisPerp0123) : refiningCells1.min(axisPerp0123); + epRef2 = new AMRGridCell(otherGrid1, oIdx2); + + int oIdx3[3]; + oIdx3[axis01] = qp0Axis01Type == min ? refiningCells1.min(axis01) : refiningCells1.max(axis01); + oIdx3[axis03] = qp0Axis03Type == max ? refiningCells1.min(axis03) : refiningCells1.max(axis03); + oIdx3[axisPerp0123] = quadFaceType == min ? refiningCells1.max(axisPerp0123) : refiningCells1.min(axisPerp0123); + epRef3 = new AMRGridCell(otherGrid1, oIdx3); + } + + switch (connectCase) { + case 0: + mStitchCellHandler.handleTrianglePrismCell(qp0, qp1, qp2, qp3, ep0, ep1); + break; + case 1: + assert(epRef0->refiningId() == AMRGrid::NoGrid && + epRef1->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= ep0.refiningId()) { + mStitchCellHandler.handlePyramidCell(*epRef0, *epRef1, qp2, qp3, ep1); + mStitchCellHandler.handleTrianglePrismCell(qp3, qp0, qp1, qp2, *epRef0, *epRef1); + } + break; + case 2: + assert(epRef2->refiningId() == AMRGrid::NoGrid && + epRef3->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= ep1.refiningId()) { + mStitchCellHandler.handlePyramidCell(qp0, qp1, *epRef2, *epRef3, ep0); + mStitchCellHandler.handleTrianglePrismCell(qp1, qp2, qp3, qp0, *epRef2, *epRef3); + } + break; + case 3: + if (!mConsiderNextLevel || + epRef0->refiningId() == AMRGrid::NoGrid && + epRef1->refiningId() == AMRGrid::NoGrid && + epRef2->refiningId() == AMRGrid::NoGrid && + epRef3->refiningId() == AMRGrid::NoGrid) + if (mStitchGrid->index() <= ep0.refiningId() && mStitchGrid->index() <= ep1.refiningId()) { + mStitchCellHandler.handleHexahedronCell(qp0, qp1, qp2, qp3, *epRef0, *epRef1, *epRef2, *epRef3); + } + break; + default: + assert(false); + break; + } + delete epRef0; + delete epRef1; + delete epRef2; + delete epRef3; +} + +template +void AMRGridStitcher::connectQuadToQuad(const AMRGridCell& qp0, const AMRGridCell& qp1, const AMRGridCell& qp2, const AMRGridCell& qp3, const AMRGridCell& oqp0, const AMRGridCell& oqp1, const AMRGridCell& oqp2, const AMRGridCell& oqp3, AxisType axis01, AxisType axis03, AxisType axisPerp0123, MinMaxType qp0Axis01Type, MinMaxType qp0Axis03Type, MinMaxType quadFaceType) +{ + // If the coarse grid points are from different grids, i.e. the quad results from several + // coarse grids rather than a single one, only generate stitch cells if we are stitching + // the grid with the smallest index. + if (qp0.containingId() < mStitchGrid->index() || qp1.containingId() < mStitchGrid->index() || + qp2.containingId() < mStitchGrid->index() || qp3.containingId() < mStitchGrid->index()) return; + + + int connectCase = 0; + + AMRGridCell *oqp0Ref = 0; + if (oqp0.refiningId() != AMRGrid::NoGrid) { + connectCase |= 1; + AMRGrid *otherGrid0 = mAMRDataSet.getGridByIndex(oqp0.refiningId()); + AxisAlignedBox refiningCells0 = otherGrid0->getRefiningCells(oqp0.grid(), oqp0.idx(xAxis), oqp0.idx(yAxis), oqp0.idx(zAxis)); + int oIdx0[3]; + oIdx0[axis01] = qp0Axis01Type == max ? refiningCells0.max(axis01) : refiningCells0.min(axis01); + oIdx0[axis03] = qp0Axis03Type == max ? refiningCells0.max(axis03) : refiningCells0.min(axis03); + oIdx0[axisPerp0123] = quadFaceType == min ? refiningCells0.max(axisPerp0123) : refiningCells0.min(axisPerp0123); + oqp0Ref = new AMRGridCell(otherGrid0, oIdx0); + } + + AMRGridCell *oqp1Ref = 0; + if (oqp1.refiningId() != AMRGrid::NoGrid) { + connectCase |= 2; + AMRGrid *otherGrid1 = mAMRDataSet.getGridByIndex(oqp1.refiningId()); + AxisAlignedBox refiningCells1 = otherGrid1->getRefiningCells(oqp1.grid(), oqp1.idx(xAxis), oqp1.idx(yAxis), oqp1.idx(zAxis)); + int oIdx1[3]; + oIdx1[axis01] = qp0Axis01Type == max ? refiningCells1.min(axis01) : refiningCells1.max(axis01); + oIdx1[axis03] = qp0Axis03Type == max ? refiningCells1.max(axis03) : refiningCells1.min(axis03); + oIdx1[axisPerp0123] = quadFaceType == min ? refiningCells1.max(axisPerp0123) : refiningCells1.min(axisPerp0123); + oqp1Ref = new AMRGridCell(otherGrid1, oIdx1); + } + + AMRGridCell *oqp2Ref = 0; + if (oqp2.refiningId() != AMRGrid::NoGrid) { + connectCase |= 4; + AMRGrid *otherGrid2 = mAMRDataSet.getGridByIndex(oqp2.refiningId()); + AxisAlignedBox refiningCells2 = otherGrid2->getRefiningCells(oqp2.grid(), oqp2.idx(xAxis), oqp2.idx(yAxis), oqp2.idx(zAxis)); + int oIdx2[3]; + oIdx2[axis01] = qp0Axis01Type == max ? refiningCells2.min(axis01) : refiningCells2.max(axis01); + oIdx2[axis03] = qp0Axis03Type == max ? refiningCells2.min(axis03) : refiningCells2.max(axis03); + oIdx2[axisPerp0123] = quadFaceType == min ? refiningCells2.max(axisPerp0123) : refiningCells2.min(axisPerp0123); + oqp2Ref = new AMRGridCell(otherGrid2, oIdx2); + } + + AMRGridCell *oqp3Ref = 0; + if (oqp3.refiningId() != AMRGrid::NoGrid) { + connectCase |= 8; + AMRGrid *otherGrid3 = mAMRDataSet.getGridByIndex(oqp3.refiningId()); + AxisAlignedBox refiningCells3 = otherGrid3->getRefiningCells(oqp3.grid(), oqp3.idx(xAxis), oqp3.idx(yAxis), oqp3.idx(zAxis)); + int oIdx3[3]; + oIdx3[axis01] = qp0Axis01Type == max ? refiningCells3.max(axis01) : refiningCells3.min(axis01); + oIdx3[axis03] = qp0Axis03Type == max ? refiningCells3.min(axis03) : refiningCells3.max(axis03); + oIdx3[axisPerp0123] = quadFaceType == min ? refiningCells3.max(axisPerp0123) : refiningCells3.min(axisPerp0123); + oqp3Ref = new AMRGridCell(otherGrid3, oIdx3); + } + + switch (connectCase) { + case 0: + mStitchCellHandler.handleHexahedronCell(qp0, qp1, qp2, qp3, oqp0, oqp1, oqp2, oqp3); + break; + case 1: + assert(oqp0Ref->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= oqp0.refiningId()) { + mStitchCellHandler.handlePyramidCell(qp0, qp1, qp2, qp3, *oqp0Ref); + mStitchCellHandler.handlePyramidCell(qp3, qp2, oqp2, oqp3, *oqp0Ref); + mStitchCellHandler.handlePyramidCell(qp2, qp1, oqp1, oqp2, *oqp0Ref); + } + break; + case 2: + assert(oqp1Ref->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= oqp1.refiningId()) { + mStitchCellHandler.handlePyramidCell(qp0, qp1, qp2, qp3, *oqp1Ref); + mStitchCellHandler.handlePyramidCell(qp0, qp3, oqp3, oqp0, *oqp1Ref); + mStitchCellHandler.handlePyramidCell(qp3, qp2, oqp2, oqp3, *oqp1Ref); + } + break; + case 3: + assert(oqp0Ref->refiningId() == AMRGrid::NoGrid); + assert(oqp1Ref->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= oqp0.refiningId() && mStitchGrid->index() <= oqp1.refiningId()) { + mStitchCellHandler.handleTrianglePrismCell(qp1, qp2, qp3, qp0, *oqp1Ref, *oqp0Ref); + mStitchCellHandler.handleTrianglePrismCell(qp2, oqp2, oqp3, qp3,*oqp1Ref, *oqp0Ref); + } + break; + case 4: + assert(oqp2Ref->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= oqp2.refiningId()) { + mStitchCellHandler.handlePyramidCell(qp0, qp1, qp2, qp3, *oqp2Ref); + mStitchCellHandler.handlePyramidCell(qp1, qp0, oqp0, oqp1, *oqp2Ref); + mStitchCellHandler.handlePyramidCell(qp0, qp3, oqp3, oqp0, *oqp2Ref); + } + break; + case 5: + assert(oqp0Ref->refiningId() == AMRGrid::NoGrid); + assert(oqp2Ref->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= oqp0.refiningId() && mStitchGrid->index() <= oqp2.refiningId()) { + AMRGridStitcherAuxFct::generateCellsForDeformedCube024567(mStitchCellHandler, *oqp0Ref, oqp3, *oqp2Ref, oqp1, qp0, qp3, qp2, qp1); + } + break; + case 6: + assert(oqp1Ref->refiningId() == AMRGrid::NoGrid); + assert(oqp2Ref->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= oqp1.refiningId() && mStitchGrid->index() <= oqp2.refiningId()) { + mStitchCellHandler.handleTrianglePrismCell(qp0, qp1, qp2, qp3, *oqp1Ref, *oqp2Ref); + mStitchCellHandler.handleTrianglePrismCell(oqp0, qp0, qp3, oqp3, *oqp1Ref, *oqp2Ref); + } + break; + case 7: + assert(oqp0Ref->refiningId() == AMRGrid::NoGrid); + assert(oqp1Ref->refiningId() == AMRGrid::NoGrid); + assert(oqp2Ref->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= oqp2.refiningId() && mStitchGrid->index() <= oqp1.refiningId() && mStitchGrid->index() <= oqp0.refiningId()) { + AMRGridStitcherAuxFct::generateCellsForDeformedCube1234567(mStitchCellHandler, oqp3, *oqp2Ref, *oqp1Ref, *oqp0Ref, qp3, qp2, qp1, qp0); + } + break; + case 8: + assert(oqp3Ref->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= oqp3.refiningId()) { + mStitchCellHandler.handlePyramidCell(qp0, qp1, qp2, qp3, *oqp3Ref); + mStitchCellHandler.handlePyramidCell(qp1, qp0, oqp0, oqp1, *oqp3Ref); + mStitchCellHandler.handlePyramidCell(qp2, qp1, oqp1, oqp2, *oqp3Ref); + } + break; + case 9: + assert(oqp0Ref->refiningId() == AMRGrid::NoGrid); + assert(oqp3Ref->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= oqp0.refiningId() && mStitchGrid->index() <= oqp3.refiningId()) { + mStitchCellHandler.handleTrianglePrismCell(qp0, qp1, qp2, qp3, *oqp0Ref, *oqp3Ref); + mStitchCellHandler.handleTrianglePrismCell(qp1, oqp1, oqp2, qp2, *oqp0Ref, *oqp3Ref); + } + break; + case 10: + assert(oqp1Ref->refiningId() == AMRGrid::NoGrid); + assert(oqp3Ref->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= oqp1.refiningId() && mStitchGrid->index() <= oqp3.refiningId()) { + AMRGridStitcherAuxFct::generateCellsForDeformedCube024567(mStitchCellHandler, *oqp1Ref, oqp0, *oqp3Ref, oqp2, qp1, qp0, qp3, qp2); + } + break; + case 11: + assert(oqp0Ref->refiningId() == AMRGrid::NoGrid); + assert(oqp1Ref->refiningId() == AMRGrid::NoGrid); + assert(oqp3Ref->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= oqp3.refiningId() && mStitchGrid->index() <= oqp1.refiningId() && mStitchGrid->index() <= oqp0.refiningId()) { + AMRGridStitcherAuxFct::generateCellsForDeformedCube1234567(mStitchCellHandler, oqp2, *oqp1Ref, *oqp0Ref, *oqp3Ref, qp2, qp1, qp0, qp3); + } + break; + case 12: + assert(oqp2Ref->refiningId() == AMRGrid::NoGrid); + assert(oqp3Ref->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= oqp2.refiningId() && mStitchGrid->index() <= oqp3.refiningId()) { + mStitchCellHandler.handleTrianglePrismCell(qp1, qp2, qp3, qp0, *oqp2Ref, *oqp3Ref); + mStitchCellHandler.handleTrianglePrismCell(oqp1, qp1, qp0, oqp0, *oqp2Ref, *oqp3Ref); + } + break; + case 13: + assert(oqp0Ref->refiningId() == AMRGrid::NoGrid); + assert(oqp2Ref->refiningId() == AMRGrid::NoGrid); + assert(oqp3Ref->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= oqp3.refiningId() && mStitchGrid->index() <= oqp2.refiningId() && mStitchGrid->index() <= oqp0.refiningId()) { + AMRGridStitcherAuxFct::generateCellsForDeformedCube1234567(mStitchCellHandler, oqp1, *oqp0Ref, *oqp3Ref, *oqp2Ref, qp1, qp0, qp3, qp2); + } + break; + case 14: + assert(oqp1Ref->refiningId() == AMRGrid::NoGrid); + assert(oqp2Ref->refiningId() == AMRGrid::NoGrid); + assert(oqp3Ref->refiningId() == AMRGrid::NoGrid); + if (mStitchGrid->index() <= oqp3.refiningId() && mStitchGrid->index() <= oqp2.refiningId() && mStitchGrid->index() <= oqp1.refiningId()) { + AMRGridStitcherAuxFct::generateCellsForDeformedCube1234567(mStitchCellHandler, oqp0, *oqp3Ref, *oqp2Ref, *oqp1Ref, qp0, qp3, qp2, qp1); + } + break; + case 15: + if (!mConsiderNextLevel || + oqp0Ref->refiningId() == AMRGrid::NoGrid && + oqp1Ref->refiningId() == AMRGrid::NoGrid && + oqp2Ref->refiningId() == AMRGrid::NoGrid && + oqp3Ref->refiningId() == AMRGrid::NoGrid) + if (mStitchGrid->index() <= oqp0.refiningId() && mStitchGrid->index() <= oqp1.refiningId() && mStitchGrid->index() <= oqp2.refiningId() && mStitchGrid->index() <= oqp3.refiningId()) { + mStitchCellHandler.handleHexahedronCell(qp0, qp1, qp2, qp3, *oqp0Ref, *oqp1Ref, *oqp2Ref, *oqp3Ref); + } + break; + default: + assert(false); + } +} + +template +void AMRGridStitcher::connectEdgeSegmentToEdges(const AMRGridCell& ep0, const AMRGridCell& ep1, const AMRGridCell& cp0, const AMRGridCell& cp1, const AMRGridCell& cp2, AxisType edgeAxis, AxisType edgeAxis01, MinMaxType edgeAxis01Type, AxisType edgeAxis02, MinMaxType edgeAxis02Type) +{ + if (ep0.containingId() < mStitchGrid->index() || ep1.containingId() < mStitchGrid->index()) return; + + if (cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + mStitchCellHandler.handleTetrahedronCell(ep0, ep1, cp0, cp1); + mStitchCellHandler.handleTetrahedronCell(ep0, cp0, ep1, cp2); + } + else if (cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + if (mStitchGrid->index() <= cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0Ref0Idx[3]; + cp0Ref0Idx[edgeAxis] = cp0RefiningCells.min(edgeAxis); + cp0Ref0Idx[edgeAxis01] = edgeAxis01Type == min ? cp0RefiningCells.max(edgeAxis01) : cp0RefiningCells.min(edgeAxis01); + cp0Ref0Idx[edgeAxis02] = edgeAxis02Type == min ? cp0RefiningCells.max(edgeAxis01) : cp0RefiningCells.min(edgeAxis01); + AMRGridCell cp0Ref0(cp0RefiningGrid, cp0Ref0Idx[0], cp0Ref0Idx[1], cp0Ref0Idx[2]); + int cp0Ref1Idx[3]; + cp0Ref1Idx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0Ref1Idx[edgeAxis01] = cp0Ref0Idx[edgeAxis01]; + cp0Ref1Idx[edgeAxis02] = cp0Ref0Idx[edgeAxis02]; + AMRGridCell cp0Ref1(cp0RefiningGrid, cp0Ref1Idx[0], cp0Ref1Idx[1], cp0Ref1Idx[2]); + mStitchCellHandler.handlePyramidCell(ep0, ep1, cp0Ref1, cp0Ref0, cp1); + mStitchCellHandler.handlePyramidCell(ep0, cp0Ref0, cp0Ref1, ep1, cp2); + } + } + else if (cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid) { + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1Ref0Idx[3]; + cp1Ref0Idx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1Ref0Idx[edgeAxis01] = edgeAxis01Type == min ? cp1RefiningCells.min(edgeAxis01) : cp1RefiningCells.max(edgeAxis01); + cp1Ref0Idx[edgeAxis02] = edgeAxis02Type == min ? cp1RefiningCells.max(edgeAxis02) : cp1RefiningCells.min(edgeAxis02); + AMRGridCell cp1Ref0(cp1RefiningGrid, cp1Ref0Idx[0], cp1Ref0Idx[1], cp1Ref0Idx[2]); + int cp1Ref1Idx[3]; + cp1Ref1Idx[edgeAxis] = cp1RefiningCells.max(edgeAxis); + cp1Ref1Idx[edgeAxis01] = cp1Ref0Idx[edgeAxis01]; + cp1Ref1Idx[edgeAxis02] = cp1Ref0Idx[edgeAxis02]; + AMRGridCell cp1Ref1(cp1RefiningGrid, cp1Ref1Idx[0], cp1Ref1Idx[1], cp1Ref1Idx[2]); + connectQuadToEdge(cp1Ref0, cp1Ref1, ep1, ep0, cp0, cp2, edgeAxis, edgeAxis02, edgeAxis01, min, edgeAxis02Type == min ? max : min, edgeAxis01Type); + } + else { + assert(cp2.refiningId() != AMRGrid::NoGrid); + AMRGrid *cp2RefiningGrid = mAMRDataSet.getGridByIndex(cp2.refiningId()); + AxisAlignedBox cp2RefiningCells = cp2RefiningGrid->getRefiningCells(cp2.grid(), cp2.idx(xAxis), cp2.idx(yAxis), cp2.idx(zAxis)); + int cp2Ref0Idx[3]; + cp2Ref0Idx[edgeAxis] = cp2RefiningCells.min(edgeAxis); + cp2Ref0Idx[edgeAxis01] = edgeAxis01Type == min ? cp2RefiningCells.max(edgeAxis01) : cp2RefiningCells.min(edgeAxis01); + cp2Ref0Idx[edgeAxis02] = edgeAxis02Type == min ? cp2RefiningCells.min(edgeAxis02) : cp2RefiningCells.max(edgeAxis02); + AMRGridCell cp2Ref0(cp2RefiningGrid, cp2Ref0Idx[0], cp2Ref0Idx[1], cp2Ref0Idx[2]); + int cp2Ref1Idx[3]; + cp2Ref1Idx[edgeAxis] = cp2RefiningCells.max(edgeAxis); + cp2Ref1Idx[edgeAxis01] = cp2Ref0Idx[edgeAxis01]; + cp2Ref1Idx[edgeAxis02] = cp2Ref0Idx[edgeAxis02]; + AMRGridCell cp2Ref1(cp2RefiningGrid, cp2Ref1Idx[0], cp2Ref1Idx[1], cp2Ref1Idx[2]); + connectQuadToEdge(cp2Ref1, cp2Ref0, ep0, ep1, cp0, cp1, edgeAxis, edgeAxis01, edgeAxis02, max, edgeAxis01Type == min ? max : min, edgeAxis02Type); + } +} + +template +void AMRGridStitcher::connectEdgeSegmentToQuads(const AMRGridCell& ep0, const AMRGridCell& ep1, const AMRGridCell& cp0, const AMRGridCell& cp1, const AMRGridCell& cp2, const AMRGridCell& cp3, const AMRGridCell& cp4, const AMRGridCell& cp5, AxisType edgeAxis, AxisType addAxis0132, MinMaxType edgeAxis0132Type, AxisType addAxis0451, MinMaxType edgeAxis0451Type) +{ + if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 0 + mStitchCellHandler.handleTrianglePrismCell(cp2, cp0, cp1, cp3, ep0, ep1); + mStitchCellHandler.handleTrianglePrismCell(cp0, cp4, cp5, cp1, ep0, ep1); + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 1 + if (mStitchGrid->index() <= cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism145(mStitchCellHandler, cp2, cp0Ref, cp1, cp3, ep0, ep1); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism045(mStitchCellHandler, cp0Ref, cp4, cp5, cp1, ep0, ep1); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 2 + if (mStitchGrid->index() <= cp1.refiningId()) { + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism245(mStitchCellHandler, cp2, cp0, cp1Ref, cp3, ep0, ep1); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism345(mStitchCellHandler, cp0, cp4, cp5, cp1Ref, ep0, ep1); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 3 + if (mStitchGrid->index() <= cp1.refiningId() && mStitchGrid->index() <= cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + mStitchCellHandler.handleTrianglePrismCell(cp0Ref, ep0, ep1, cp1Ref, cp2, cp3); + mStitchCellHandler.handleTrianglePrismCell(ep0, cp0Ref, cp1Ref, ep1, cp4, cp5); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() != AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 4 + if (mStitchGrid->index() <= cp2.refiningId()) { + AMRGrid *cp2RefiningGrid = mAMRDataSet.getGridByIndex(cp2.refiningId()); + AxisAlignedBox cp2RefiningCells = cp2RefiningGrid->getRefiningCells(cp2.grid(), cp2.idx(xAxis), cp2.idx(yAxis), cp2.idx(zAxis)); + int cp2RefIdx[3]; + cp2RefIdx[edgeAxis] = cp2RefiningCells.max(edgeAxis); + cp2RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp2RefiningCells.min(addAxis0132) : cp2RefiningCells.max(addAxis0132); + cp2RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp2RefiningCells.max(addAxis0451) : cp2RefiningCells.min(addAxis0451); + AMRGridCell cp2Ref(cp2RefiningGrid, cp2RefIdx); + mStitchCellHandler.handleTetrahedronCell(ep1, cp1, cp2Ref, cp3); + std::cout << "Inserting vertex to avoid illegal tesselation (Case 4)." << std::endl; + Vertex newPos = AMRGridStitcherAuxFct::centroid(ep0.pos(), ep1.pos(), cp0.pos(), cp1.pos(), cp2Ref.pos(), cp4.pos(), cp5.pos()); + double newVal = ep0.val() + ep1.val() + cp0.val() + cp1.val() + cp2Ref.val() + cp4.val() + cp5.val(); + newVal /= 7; + mStitchCellHandler.handlePyramidCell(ep0, cp4, cp0, cp2Ref, newPos, newVal); + mStitchCellHandler.handlePyramidCell(ep0, ep1, cp5, cp4, newPos, newVal); + mStitchCellHandler.handlePyramidCell(cp0, cp4, cp5, cp1, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(ep1, cp1, cp5, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(ep1, cp2Ref, cp1, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(cp0, cp1, cp2Ref, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(ep0, cp2Ref, ep1, newPos, newVal); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() != AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 5 + if (mStitchGrid->index() <= cp2.refiningId() && mStitchGrid->index() <= cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp2RefiningGrid = mAMRDataSet.getGridByIndex(cp2.refiningId()); + AxisAlignedBox cp2RefiningCells = cp2RefiningGrid->getRefiningCells(cp2.grid(), cp2.idx(xAxis), cp2.idx(yAxis), cp2.idx(zAxis)); + int cp2RefIdx[3]; + cp2RefIdx[edgeAxis] = cp2RefiningCells.max(edgeAxis); + cp2RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp2RefiningCells.min(addAxis0132) : cp2RefiningCells.max(addAxis0132); + cp2RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp2RefiningCells.max(addAxis0451) : cp2RefiningCells.min(addAxis0451); + AMRGridCell cp2Ref(cp2RefiningGrid, cp2RefIdx); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism0145(mStitchCellHandler, cp2Ref, cp0Ref, cp1, cp3, ep0, ep1); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism045(mStitchCellHandler, cp0Ref, cp4, cp5, cp1, ep0, ep1); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() != AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 6 + if (mStitchGrid->index() <= cp2.refiningId() && mStitchGrid->index() <= cp1.refiningId()) { + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp2RefiningGrid = mAMRDataSet.getGridByIndex(cp2.refiningId()); + AxisAlignedBox cp2RefiningCells = cp2RefiningGrid->getRefiningCells(cp2.grid(), cp2.idx(xAxis), cp2.idx(yAxis), cp2.idx(zAxis)); + int cp2RefIdx[3]; + cp2RefIdx[edgeAxis] = cp2RefiningCells.max(edgeAxis); + cp2RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp2RefiningCells.min(addAxis0132) : cp2RefiningCells.max(addAxis0132); + cp2RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp2RefiningCells.max(addAxis0451) : cp2RefiningCells.min(addAxis0451); + AMRGridCell cp2Ref(cp2RefiningGrid, cp2RefIdx); + mStitchCellHandler.handlePyramidCell(ep0, cp4, cp0, cp2Ref, cp1Ref); + mStitchCellHandler.handlePyramidCell(ep0, ep1, cp5, cp4, cp1Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid1234(mStitchCellHandler, cp3, ep1, ep0, cp2Ref, cp1Ref); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() != AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 7 + if (mStitchGrid->index() <= cp2.refiningId() && mStitchGrid->index() <= cp1.refiningId() && mStitchGrid->index() <= cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp2RefiningGrid = mAMRDataSet.getGridByIndex(cp2.refiningId()); + AxisAlignedBox cp2RefiningCells = cp2RefiningGrid->getRefiningCells(cp2.grid(), cp2.idx(xAxis), cp2.idx(yAxis), cp2.idx(zAxis)); + int cp2RefIdx[3]; + cp2RefIdx[edgeAxis] = cp2RefiningCells.max(edgeAxis); + cp2RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp2RefiningCells.min(addAxis0132) : cp2RefiningCells.max(addAxis0132); + cp2RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp2RefiningCells.max(addAxis0451) : cp2RefiningCells.min(addAxis0451); + AMRGridCell cp2Ref(cp2RefiningGrid, cp2RefIdx); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism01245(mStitchCellHandler, cp2Ref, cp0Ref, cp1Ref, cp3, ep0, ep1); + mStitchCellHandler.handleTrianglePrismCell(cp0Ref, cp4, cp5, cp1Ref, ep0, ep1); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() != AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 8 + if (mStitchGrid->index() <= cp3.refiningId()) { + AMRGrid *cp3RefiningGrid = mAMRDataSet.getGridByIndex(cp3.refiningId()); + AxisAlignedBox cp3RefiningCells = cp3RefiningGrid->getRefiningCells(cp3.grid(), cp3.idx(xAxis), cp3.idx(yAxis), cp3.idx(zAxis)); + int cp3RefIdx[3]; + cp3RefIdx[edgeAxis] = cp3RefiningCells.min(edgeAxis); + cp3RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp3RefiningCells.min(addAxis0132) : cp3RefiningCells.max(addAxis0132); + cp3RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp3RefiningCells.max(addAxis0451) : cp3RefiningCells.min(addAxis0451); + AMRGridCell cp3Ref(cp3RefiningGrid, cp3RefIdx); + mStitchCellHandler.handleTetrahedronCell(ep0, cp3Ref, cp0, cp2); + std::cout << "Inserting vertex to avoid illegal tesselation (Case 8)." << std::endl; + Vertex newPos = AMRGridStitcherAuxFct::centroid(ep0.pos(), ep1.pos(), cp0.pos(), cp1.pos(), cp3Ref.pos(), cp4.pos(), cp5.pos()); + double newVal = ep0.val() + ep1.val() + cp0.val() + cp1.val() + cp3Ref.val() + cp4.val() + cp5.val(); + newVal /= 7; + mStitchCellHandler.handlePyramidCell(cp0, cp4, cp5, cp1, newPos, newVal); + mStitchCellHandler.handlePyramidCell(ep0, ep1, cp5, cp4, newPos, newVal); + mStitchCellHandler.handlePyramidCell(ep1, cp3Ref, cp1, cp5, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(ep0, cp4, cp0, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(ep0, cp0, cp3Ref, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(cp0, cp1, cp3Ref, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(ep0, cp3Ref, ep1, newPos, newVal); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() != AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 9 + if (mStitchGrid->index() <= cp3.refiningId() && mStitchGrid->index() <= cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + + AMRGrid *cp3RefiningGrid = mAMRDataSet.getGridByIndex(cp3.refiningId()); + AxisAlignedBox cp3RefiningCells = cp3RefiningGrid->getRefiningCells(cp3.grid(), cp3.idx(xAxis), cp3.idx(yAxis), cp3.idx(zAxis)); + int cp3RefIdx[3]; + cp3RefIdx[edgeAxis] = cp3RefiningCells.min(edgeAxis); + cp3RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp3RefiningCells.min(addAxis0132) : cp3RefiningCells.max(addAxis0132); + cp3RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp3RefiningCells.max(addAxis0451) : cp3RefiningCells.min(addAxis0451); + AMRGridCell cp3Ref(cp3RefiningGrid, cp3RefIdx); + + mStitchCellHandler.handlePyramidCell(cp1, cp5, ep1, cp3Ref, cp0Ref); + mStitchCellHandler.handlePyramidCell(ep0, ep1, cp5, cp4, cp0Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid1234(mStitchCellHandler, cp2, cp3Ref, ep1, ep0, cp0Ref); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() != AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 10 + if (mStitchGrid->index() <= cp3.refiningId() && mStitchGrid->index() <= cp1.refiningId()) { + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + + AMRGrid *cp3RefiningGrid = mAMRDataSet.getGridByIndex(cp3.refiningId()); + AxisAlignedBox cp3RefiningCells = cp3RefiningGrid->getRefiningCells(cp3.grid(), cp3.idx(xAxis), cp3.idx(yAxis), cp3.idx(zAxis)); + int cp3RefIdx[3]; + cp3RefIdx[edgeAxis] = cp3RefiningCells.min(edgeAxis); + cp3RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp3RefiningCells.min(addAxis0132) : cp3RefiningCells.max(addAxis0132); + cp3RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp3RefiningCells.max(addAxis0451) : cp3RefiningCells.min(addAxis0451); + AMRGridCell cp3Ref(cp3RefiningGrid, cp3RefIdx); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism2345(mStitchCellHandler, cp2, cp0, cp1Ref, cp3Ref, ep0, ep1); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism345(mStitchCellHandler, cp0, cp4, cp5, cp1Ref, ep0, ep1); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() != AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 11 + if (mStitchGrid->index() <= cp3.refiningId() && mStitchGrid->index() <= cp1.refiningId() && mStitchGrid->index() <= cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp3RefiningGrid = mAMRDataSet.getGridByIndex(cp3.refiningId()); + AxisAlignedBox cp3RefiningCells = cp3RefiningGrid->getRefiningCells(cp3.grid(), cp3.idx(xAxis), cp3.idx(yAxis), cp3.idx(zAxis)); + int cp3RefIdx[3]; + cp3RefIdx[edgeAxis] = cp3RefiningCells.min(edgeAxis); + cp3RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp3RefiningCells.min(addAxis0132) : cp3RefiningCells.max(addAxis0132); + cp3RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp3RefiningCells.max(addAxis0451) : cp3RefiningCells.min(addAxis0451); + AMRGridCell cp3Ref(cp3RefiningGrid, cp3RefIdx); + + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism12345(mStitchCellHandler, cp2, cp0Ref, cp1Ref, cp3Ref, ep0, ep1); + mStitchCellHandler.handleTrianglePrismCell(cp0Ref, cp4, cp5, cp1Ref, ep0, ep1); + } + } + else if (!(cp5.refiningId() != AMRGrid::NoGrid && cp4.refiningId() != AMRGrid::NoGrid) && cp3.refiningId() != AMRGrid::NoGrid && cp2.refiningId() != AMRGrid::NoGrid) { + // Case 12 ... 15, Case 28 ... 31, Case 44 ... 47 + AMRGrid *cp2RefiningGrid = mAMRDataSet.getGridByIndex(cp2.refiningId()); + AxisAlignedBox cp2RefiningCells = cp2RefiningGrid->getRefiningCells(cp2.grid(), cp2.idx(xAxis), cp2.idx(yAxis), cp2.idx(zAxis)); + int cp2RefIdx[3]; + cp2RefIdx[edgeAxis] = cp2RefiningCells.max(edgeAxis); + cp2RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp2RefiningCells.min(addAxis0132) : cp2RefiningCells.max(addAxis0132); + cp2RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp2RefiningCells.max(addAxis0451) : cp2RefiningCells.min(addAxis0451); + AMRGridCell cp2Ref(cp2RefiningGrid, cp2RefIdx); + AMRGrid *cp3RefiningGrid = mAMRDataSet.getGridByIndex(cp3.refiningId()); + AxisAlignedBox cp3RefiningCells = cp3RefiningGrid->getRefiningCells(cp3.grid(), cp3.idx(xAxis), cp3.idx(yAxis), cp3.idx(zAxis)); + int cp3RefIdx[3]; + cp3RefIdx[edgeAxis] = cp3RefiningCells.min(edgeAxis); + cp3RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp3RefiningCells.min(addAxis0132) : cp3RefiningCells.max(addAxis0132); + cp3RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp3RefiningCells.max(addAxis0451) : cp3RefiningCells.min(addAxis0451); + AMRGridCell cp3Ref(cp3RefiningGrid, cp3RefIdx); + connectQuadToQuad(ep0, cp2Ref, cp3Ref, ep1, cp4, cp0, cp1, cp5, addAxis0451, edgeAxis, addAxis0132, edgeAxis0451Type, max, edgeAxis0132Type); + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() != AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 16 + if (mStitchGrid->index() <= cp4.refiningId()) { + AMRGrid *cp4RefiningGrid = mAMRDataSet.getGridByIndex(cp4.refiningId()); + AxisAlignedBox cp4RefiningCells = cp4RefiningGrid->getRefiningCells(cp4.grid(), cp4.idx(xAxis), cp4.idx(yAxis), cp4.idx(zAxis)); + int cp4RefIdx[3]; + cp4RefIdx[edgeAxis] = cp4RefiningCells.max(edgeAxis); + cp4RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp4RefiningCells.max(addAxis0132) : cp4RefiningCells.min(addAxis0132); + cp4RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp4RefiningCells.min(addAxis0451) : cp4RefiningCells.max(addAxis0451); + AMRGridCell cp4Ref(cp4RefiningGrid, cp4RefIdx); + mStitchCellHandler.handleTetrahedronCell(ep1, cp4Ref, cp1, cp5); + std::cout << "Inserting vertex to avoid illegal tesselation (Case 16)." << std::endl; + Vertex newPos = AMRGridStitcherAuxFct::centroid(ep0.pos(), ep1.pos(), cp0.pos(), cp1.pos(), cp2.pos(), cp3.pos(), cp4Ref.pos()); + double newVal = ep0.val() + ep1.val() + cp0.val() + cp1.val() + cp2.val() + cp3.val() + cp4Ref.val(); + newVal /= 7; + mStitchCellHandler.handlePyramidCell(ep0, cp4Ref, cp0, cp2, newPos, newVal); + mStitchCellHandler.handlePyramidCell(cp0, cp1, cp3, cp2, newPos, newVal); + mStitchCellHandler.handlePyramidCell(ep0, cp2, cp3, ep1, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(ep0, ep1, cp4Ref, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(ep1, cp1, cp4Ref, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(ep1, cp3, cp1, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(cp0, cp4Ref, cp1, newPos, newVal); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() != AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 17 + if (mStitchGrid->index() <= cp4.refiningId() && mStitchGrid->index() <= cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp4RefiningGrid = mAMRDataSet.getGridByIndex(cp4.refiningId()); + AxisAlignedBox cp4RefiningCells = cp4RefiningGrid->getRefiningCells(cp4.grid(), cp4.idx(xAxis), cp4.idx(yAxis), cp4.idx(zAxis)); + int cp4RefIdx[3]; + cp4RefIdx[edgeAxis] = cp4RefiningCells.max(edgeAxis); + cp4RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp4RefiningCells.max(addAxis0132) : cp4RefiningCells.min(addAxis0132); + cp4RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp4RefiningCells.min(addAxis0451) : cp4RefiningCells.max(addAxis0451); + AMRGridCell cp4Ref(cp4RefiningGrid, cp4RefIdx); + + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism145(mStitchCellHandler, cp2, cp0Ref, cp1, cp3, ep0, ep1); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism0145(mStitchCellHandler, cp0Ref, cp4Ref, cp5, cp1, ep0, ep1); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() != AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 18 + if (mStitchGrid->index() <= cp4.refiningId() && mStitchGrid->index() <= cp1.refiningId()) { + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp4RefiningGrid = mAMRDataSet.getGridByIndex(cp4.refiningId()); + AxisAlignedBox cp4RefiningCells = cp4RefiningGrid->getRefiningCells(cp4.grid(), cp4.idx(xAxis), cp4.idx(yAxis), cp4.idx(zAxis)); + int cp4RefIdx[3]; + cp4RefIdx[edgeAxis] = cp4RefiningCells.max(edgeAxis); + cp4RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp4RefiningCells.max(addAxis0132) : cp4RefiningCells.min(addAxis0132); + cp4RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp4RefiningCells.min(addAxis0451) : cp4RefiningCells.max(addAxis0451); + AMRGridCell cp4Ref(cp4RefiningGrid, cp4RefIdx); + + mStitchCellHandler.handlePyramidCell(ep0, cp2, cp3, ep1, cp1Ref); + mStitchCellHandler.handlePyramidCell(ep0, cp4Ref, cp0, cp2, cp1Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid1234(mStitchCellHandler, cp5, cp4Ref, ep0, ep1, cp1Ref); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() != AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 19 + if (mStitchGrid->index() <= cp4.refiningId() && mStitchGrid->index() <= cp1.refiningId() && mStitchGrid->index() <=cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp4RefiningGrid = mAMRDataSet.getGridByIndex(cp4.refiningId()); + AxisAlignedBox cp4RefiningCells = cp4RefiningGrid->getRefiningCells(cp4.grid(), cp4.idx(xAxis), cp4.idx(yAxis), cp4.idx(zAxis)); + int cp4RefIdx[3]; + cp4RefIdx[edgeAxis] = cp4RefiningCells.max(edgeAxis); + cp4RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp4RefiningCells.max(addAxis0132) : cp4RefiningCells.min(addAxis0132); + cp4RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp4RefiningCells.min(addAxis0451) : cp4RefiningCells.max(addAxis0451); + AMRGridCell cp4Ref(cp4RefiningGrid, cp4RefIdx); + mStitchCellHandler.handleTrianglePrismCell(cp2, cp0Ref, cp1Ref, cp3, ep0, ep1); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism01345(mStitchCellHandler, cp0Ref, cp4Ref, cp5, cp1Ref, ep0, ep1); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() != AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() != AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 20 + if (mStitchGrid->index() <= cp4.refiningId() && mStitchGrid->index() <= cp2.refiningId()) { + AMRGrid *cp2RefiningGrid = mAMRDataSet.getGridByIndex(cp2.refiningId()); + AxisAlignedBox cp2RefiningCells = cp2RefiningGrid->getRefiningCells(cp2.grid(), cp2.idx(xAxis), cp2.idx(yAxis), cp2.idx(zAxis)); + int cp2RefIdx[3]; + cp2RefIdx[edgeAxis] = cp2RefiningCells.max(edgeAxis); + cp2RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp2RefiningCells.min(addAxis0132) : cp2RefiningCells.max(addAxis0132); + cp2RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp2RefiningCells.max(addAxis0451) : cp2RefiningCells.min(addAxis0451); + AMRGridCell cp2Ref(cp2RefiningGrid, cp2RefIdx); + AMRGrid *cp4RefiningGrid = mAMRDataSet.getGridByIndex(cp4.refiningId()); + AxisAlignedBox cp4RefiningCells = cp4RefiningGrid->getRefiningCells(cp4.grid(), cp4.idx(xAxis), cp4.idx(yAxis), cp4.idx(zAxis)); + int cp4RefIdx[3]; + cp4RefIdx[edgeAxis] = cp4RefiningCells.max(edgeAxis); + cp4RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp4RefiningCells.max(addAxis0132) : cp4RefiningCells.min(addAxis0132); + cp4RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp4RefiningCells.min(addAxis0451) : cp4RefiningCells.max(addAxis0451); + AMRGridCell cp4Ref(cp4RefiningGrid, cp4RefIdx); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid1234(mStitchCellHandler, cp3, ep1, ep0, cp2Ref, cp4Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid04(mStitchCellHandler, cp2Ref, cp0, cp1, cp3, cp4Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid04(mStitchCellHandler, ep1, cp3, cp1, cp5, cp4Ref); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() != AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() != AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 21 + if (mStitchGrid->index() <= cp4.refiningId() && mStitchGrid->index() <= cp2.refiningId() && mStitchGrid->index() <= cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp2RefiningGrid = mAMRDataSet.getGridByIndex(cp2.refiningId()); + AxisAlignedBox cp2RefiningCells = cp2RefiningGrid->getRefiningCells(cp2.grid(), cp2.idx(xAxis), cp2.idx(yAxis), cp2.idx(zAxis)); + int cp2RefIdx[3]; + cp2RefIdx[edgeAxis] = cp2RefiningCells.max(edgeAxis); + cp2RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp2RefiningCells.min(addAxis0132) : cp2RefiningCells.max(addAxis0132); + cp2RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp2RefiningCells.max(addAxis0451) : cp2RefiningCells.min(addAxis0451); + AMRGridCell cp2Ref(cp2RefiningGrid, cp2RefIdx); + AMRGrid *cp4RefiningGrid = mAMRDataSet.getGridByIndex(cp4.refiningId()); + AxisAlignedBox cp4RefiningCells = cp4RefiningGrid->getRefiningCells(cp4.grid(), cp4.idx(xAxis), cp4.idx(yAxis), cp4.idx(zAxis)); + int cp4RefIdx[3]; + cp4RefIdx[edgeAxis] = cp4RefiningCells.max(edgeAxis); + cp4RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp4RefiningCells.max(addAxis0132) : cp4RefiningCells.min(addAxis0132); + cp4RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp4RefiningCells.min(addAxis0451) : cp4RefiningCells.max(addAxis0451); + AMRGridCell cp4Ref(cp4RefiningGrid, cp4RefIdx); + mStitchCellHandler.handlePyramidCell(ep0, cp4Ref, cp0Ref, cp2Ref, ep1); + mStitchCellHandler.handlePyramidCell(cp0Ref, cp4Ref, cp5, cp1, ep1); + mStitchCellHandler.handlePyramidCell(cp0Ref, cp1, cp3, cp2Ref, ep1); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() != AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() != AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 22 + if (mStitchGrid->index() <= cp4.refiningId() && mStitchGrid->index() <= cp2.refiningId() && mStitchGrid->index() <= cp1.refiningId()) { + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp2RefiningGrid = mAMRDataSet.getGridByIndex(cp2.refiningId()); + AxisAlignedBox cp2RefiningCells = cp2RefiningGrid->getRefiningCells(cp2.grid(), cp2.idx(xAxis), cp2.idx(yAxis), cp2.idx(zAxis)); + int cp2RefIdx[3]; + cp2RefIdx[edgeAxis] = cp2RefiningCells.max(edgeAxis); + cp2RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp2RefiningCells.min(addAxis0132) : cp2RefiningCells.max(addAxis0132); + cp2RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp2RefiningCells.max(addAxis0451) : cp2RefiningCells.min(addAxis0451); + AMRGridCell cp2Ref(cp2RefiningGrid, cp2RefIdx); + AMRGrid *cp4RefiningGrid = mAMRDataSet.getGridByIndex(cp4.refiningId()); + AxisAlignedBox cp4RefiningCells = cp4RefiningGrid->getRefiningCells(cp4.grid(), cp4.idx(xAxis), cp4.idx(yAxis), cp4.idx(zAxis)); + int cp4RefIdx[3]; + cp4RefIdx[edgeAxis] = cp4RefiningCells.max(edgeAxis); + cp4RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp4RefiningCells.max(addAxis0132) : cp4RefiningCells.min(addAxis0132); + cp4RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp4RefiningCells.min(addAxis0451) : cp4RefiningCells.max(addAxis0451); + AMRGridCell cp4Ref(cp4RefiningGrid, cp4RefIdx); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid024(mStitchCellHandler, ep1, cp3, cp1Ref, cp5, cp4Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid024(mStitchCellHandler, cp1Ref, cp3, cp2Ref, cp0, cp4Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid1234(mStitchCellHandler, cp3, ep1, ep0, cp2Ref, cp4Ref); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() != AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() != AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 23 + if (mStitchGrid->index() <= cp4.refiningId() && mStitchGrid->index() <= cp2.refiningId() && mStitchGrid->index() <= cp1.refiningId() && mStitchGrid->index() <= cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp2RefiningGrid = mAMRDataSet.getGridByIndex(cp2.refiningId()); + AxisAlignedBox cp2RefiningCells = cp2RefiningGrid->getRefiningCells(cp2.grid(), cp2.idx(xAxis), cp2.idx(yAxis), cp2.idx(zAxis)); + int cp2RefIdx[3]; + cp2RefIdx[edgeAxis] = cp2RefiningCells.max(edgeAxis); + cp2RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp2RefiningCells.min(addAxis0132) : cp2RefiningCells.max(addAxis0132); + cp2RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp2RefiningCells.max(addAxis0451) : cp2RefiningCells.min(addAxis0451); + AMRGridCell cp2Ref(cp2RefiningGrid, cp2RefIdx); + AMRGrid *cp4RefiningGrid = mAMRDataSet.getGridByIndex(cp4.refiningId()); + AxisAlignedBox cp4RefiningCells = cp4RefiningGrid->getRefiningCells(cp4.grid(), cp4.idx(xAxis), cp4.idx(yAxis), cp4.idx(zAxis)); + int cp4RefIdx[3]; + cp4RefIdx[edgeAxis] = cp4RefiningCells.max(edgeAxis); + cp4RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp4RefiningCells.max(addAxis0132) : cp4RefiningCells.min(addAxis0132); + cp4RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp4RefiningCells.min(addAxis0451) : cp4RefiningCells.max(addAxis0451); + AMRGridCell cp4Ref(cp4RefiningGrid, cp4RefIdx); + mStitchCellHandler.handlePyramidCell(cp0Ref, cp2Ref, ep0, cp4Ref, cp1Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid1234(mStitchCellHandler, cp3, ep1, ep0, cp2Ref, cp1Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid1234(mStitchCellHandler, cp5, cp4Ref, ep0, ep1, cp1Ref); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() != AMRGrid::NoGrid && cp3.refiningId() != AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 24 + if (mStitchGrid->index() <= cp4.refiningId() && mStitchGrid->index() <= cp3.refiningId() && mStitchGrid->index()) { + AMRGrid *cp3RefiningGrid = mAMRDataSet.getGridByIndex(cp3.refiningId()); + AxisAlignedBox cp3RefiningCells = cp3RefiningGrid->getRefiningCells(cp3.grid(), cp3.idx(xAxis), cp3.idx(yAxis), cp3.idx(zAxis)); + int cp3RefIdx[3]; + cp3RefIdx[edgeAxis] = cp3RefiningCells.min(edgeAxis); + cp3RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp3RefiningCells.min(addAxis0132) : cp3RefiningCells.max(addAxis0132); + cp3RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp3RefiningCells.max(addAxis0451) : cp3RefiningCells.min(addAxis0451); + AMRGridCell cp3Ref(cp3RefiningGrid, cp3RefIdx); + AMRGrid *cp4RefiningGrid = mAMRDataSet.getGridByIndex(cp4.refiningId()); + AxisAlignedBox cp4RefiningCells = cp4RefiningGrid->getRefiningCells(cp4.grid(), cp4.idx(xAxis), cp4.idx(yAxis), cp4.idx(zAxis)); + int cp4RefIdx[3]; + cp4RefIdx[edgeAxis] = cp4RefiningCells.max(edgeAxis); + cp4RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp4RefiningCells.max(addAxis0132) : cp4RefiningCells.min(addAxis0132); + cp4RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp4RefiningCells.min(addAxis0451) : cp4RefiningCells.max(addAxis0451); + AMRGridCell cp4Ref(cp4RefiningGrid, cp4RefIdx); + mStitchCellHandler.handlePyramidCell(cp0, cp2, ep0, cp4Ref, cp3Ref); + mStitchCellHandler.handleTetrahedronCell(cp0, cp4Ref, cp1, cp3Ref); + mStitchCellHandler.handlePyramidCell(ep1, cp3Ref, cp1, cp5, cp4Ref); + mStitchCellHandler.handleTetrahedronCell(ep0, cp3Ref, ep1, cp4Ref); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() != AMRGrid::NoGrid && cp3.refiningId() != AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 25 + if (mStitchGrid->index() <= cp4.refiningId() && mStitchGrid->index() <= cp3.refiningId() && mStitchGrid->index() && cp0.refiningId() <= mStitchGrid->index()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp3RefiningGrid = mAMRDataSet.getGridByIndex(cp3.refiningId()); + AxisAlignedBox cp3RefiningCells = cp3RefiningGrid->getRefiningCells(cp3.grid(), cp3.idx(xAxis), cp3.idx(yAxis), cp3.idx(zAxis)); + int cp3RefIdx[3]; + cp3RefIdx[edgeAxis] = cp3RefiningCells.min(edgeAxis); + cp3RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp3RefiningCells.min(addAxis0132) : cp3RefiningCells.max(addAxis0132); + cp3RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp3RefiningCells.max(addAxis0451) : cp3RefiningCells.min(addAxis0451); + AMRGridCell cp3Ref(cp3RefiningGrid, cp3RefIdx); + AMRGrid *cp4RefiningGrid = mAMRDataSet.getGridByIndex(cp4.refiningId()); + AxisAlignedBox cp4RefiningCells = cp4RefiningGrid->getRefiningCells(cp4.grid(), cp4.idx(xAxis), cp4.idx(yAxis), cp4.idx(zAxis)); + int cp4RefIdx[3]; + cp4RefIdx[edgeAxis] = cp4RefiningCells.max(edgeAxis); + cp4RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp4RefiningCells.max(addAxis0132) : cp4RefiningCells.min(addAxis0132); + cp4RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp4RefiningCells.min(addAxis0451) : cp4RefiningCells.max(addAxis0451); + AMRGridCell cp4Ref(cp4RefiningGrid, cp4RefIdx); + mStitchCellHandler.handleTrianglePrismCell(cp3Ref, cp1, cp5, ep1, cp0Ref, cp4Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism12345(mStitchCellHandler, cp2, cp3Ref, ep1, ep0, cp0Ref, cp4Ref); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() != AMRGrid::NoGrid && cp3.refiningId() != AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 26 + if (mStitchGrid->index() <= cp4.refiningId() && mStitchGrid->index() <= cp3.refiningId() && mStitchGrid->index() && cp1.refiningId() <= mStitchGrid->index()) { + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp3RefiningGrid = mAMRDataSet.getGridByIndex(cp3.refiningId()); + AxisAlignedBox cp3RefiningCells = cp3RefiningGrid->getRefiningCells(cp3.grid(), cp3.idx(xAxis), cp3.idx(yAxis), cp3.idx(zAxis)); + int cp3RefIdx[3]; + cp3RefIdx[edgeAxis] = cp3RefiningCells.min(edgeAxis); + cp3RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp3RefiningCells.min(addAxis0132) : cp3RefiningCells.max(addAxis0132); + cp3RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp3RefiningCells.max(addAxis0451) : cp3RefiningCells.min(addAxis0451); + AMRGridCell cp3Ref(cp3RefiningGrid, cp3RefIdx); + AMRGrid *cp4RefiningGrid = mAMRDataSet.getGridByIndex(cp4.refiningId()); + AxisAlignedBox cp4RefiningCells = cp4RefiningGrid->getRefiningCells(cp4.grid(), cp4.idx(xAxis), cp4.idx(yAxis), cp4.idx(zAxis)); + int cp4RefIdx[3]; + cp4RefIdx[edgeAxis] = cp4RefiningCells.max(edgeAxis); + cp4RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp4RefiningCells.max(addAxis0132) : cp4RefiningCells.min(addAxis0132); + cp4RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp4RefiningCells.min(addAxis0451) : cp4RefiningCells.max(addAxis0451); + AMRGridCell cp4Ref(cp4RefiningGrid, cp4RefIdx); + + mStitchCellHandler.handleTrianglePrismCell(cp4Ref, cp0, cp2, ep0, cp1Ref, cp3Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism12345(mStitchCellHandler, cp5, cp4Ref, ep0, ep1, cp1Ref, cp3Ref); + } + } + else if (cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() != AMRGrid::NoGrid && cp3.refiningId() != AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 27 + if (mStitchGrid->index() <= cp4.refiningId() && mStitchGrid->index() <= cp3.refiningId() && mStitchGrid->index() && cp1.refiningId() <= mStitchGrid->index() && cp0.refiningId() <= mStitchGrid->index()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp3RefiningGrid = mAMRDataSet.getGridByIndex(cp3.refiningId()); + AxisAlignedBox cp3RefiningCells = cp3RefiningGrid->getRefiningCells(cp3.grid(), cp3.idx(xAxis), cp3.idx(yAxis), cp3.idx(zAxis)); + int cp3RefIdx[3]; + cp3RefIdx[edgeAxis] = cp3RefiningCells.min(edgeAxis); + cp3RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp3RefiningCells.min(addAxis0132) : cp3RefiningCells.max(addAxis0132); + cp3RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp3RefiningCells.max(addAxis0451) : cp3RefiningCells.min(addAxis0451); + AMRGridCell cp3Ref(cp3RefiningGrid, cp3RefIdx); + AMRGrid *cp4RefiningGrid = mAMRDataSet.getGridByIndex(cp4.refiningId()); + AxisAlignedBox cp4RefiningCells = cp4RefiningGrid->getRefiningCells(cp4.grid(), cp4.idx(xAxis), cp4.idx(yAxis), cp4.idx(zAxis)); + int cp4RefIdx[3]; + cp4RefIdx[edgeAxis] = cp4RefiningCells.max(edgeAxis); + cp4RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp4RefiningCells.max(addAxis0132) : cp4RefiningCells.min(addAxis0132); + cp4RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp4RefiningCells.min(addAxis0451) : cp4RefiningCells.max(addAxis0451); + AMRGridCell cp4Ref(cp4RefiningGrid, cp4RefIdx); + + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism12345(mStitchCellHandler, cp2, cp0Ref, cp1Ref, cp3Ref, ep0, ep1); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism01345(mStitchCellHandler, cp0Ref, cp4Ref, cp5, cp1Ref, ep0, ep1); + } + } + // Case 28 ... 31 see Case 12 ... 15 + else if (cp5.refiningId() != AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 32 + if (mStitchGrid->index() <= cp5.refiningId()) { + AMRGrid *cp5RefiningGrid = mAMRDataSet.getGridByIndex(cp5.refiningId()); + AxisAlignedBox cp5RefiningCells = cp5RefiningGrid->getRefiningCells(cp5.grid(), cp5.idx(xAxis), cp5.idx(yAxis), cp5.idx(zAxis)); + int cp5RefIdx[3]; + cp5RefIdx[edgeAxis] = cp5RefiningCells.min(edgeAxis); + cp5RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp5RefiningCells.max(addAxis0132) : cp5RefiningCells.min(addAxis0132); + cp5RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp5RefiningCells.min(addAxis0451) : cp5RefiningCells.max(addAxis0451); + AMRGridCell cp5Ref(cp5RefiningGrid, cp5RefIdx); + mStitchCellHandler.handleTetrahedronCell(ep0, cp0, cp5Ref, cp4); + std::cout << "Inserting vertex to avoid illegal tesselation (Case 32)." << std::endl; + Vertex newPos = AMRGridStitcherAuxFct::centroid(ep0.pos(), ep1.pos(), cp0.pos(), cp1.pos(), cp2.pos(), cp3.pos(), cp5Ref.pos()); + double newVal = ep0.val() + ep1.val() + cp0.val() + cp1.val() + cp2.val() + cp3.val() + cp5Ref.val(); + newVal /= 7; + mStitchCellHandler.handlePyramidCell(ep0, cp2, cp3, ep1, newPos, newVal); + mStitchCellHandler.handlePyramidCell(cp0, cp1, cp3, cp2, newPos, newVal); + mStitchCellHandler.handlePyramidCell(ep1, cp3, cp1, cp5Ref, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(ep0, ep1, cp5Ref, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(ep0, cp5Ref, cp0, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(ep0, cp0, cp2, newPos, newVal); + mStitchCellHandler.handleTetrahedronCell(cp0, cp5Ref, cp1, newPos, newVal); + } + } + else if (cp5.refiningId() != AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 33 + if (mStitchGrid->index() <= cp5.refiningId() && mStitchGrid->index() <= cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp5RefiningGrid = mAMRDataSet.getGridByIndex(cp5.refiningId()); + AxisAlignedBox cp5RefiningCells = cp5RefiningGrid->getRefiningCells(cp5.grid(), cp5.idx(xAxis), cp5.idx(yAxis), cp5.idx(zAxis)); + int cp5RefIdx[3]; + cp5RefIdx[edgeAxis] = cp5RefiningCells.min(edgeAxis); + cp5RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp5RefiningCells.max(addAxis0132) : cp5RefiningCells.min(addAxis0132); + cp5RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp5RefiningCells.min(addAxis0451) : cp5RefiningCells.max(addAxis0451); + AMRGridCell cp5Ref(cp5RefiningGrid, cp5RefIdx); + + mStitchCellHandler.handlePyramidCell(cp1, cp5Ref, ep1, cp3, cp0Ref); + mStitchCellHandler.handlePyramidCell(ep0, cp2, cp3, ep1, cp0Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid1234(mStitchCellHandler, cp4, ep0, ep1, cp5Ref, cp0Ref); + } + } + else if (cp5.refiningId() != AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 34 + if (mStitchGrid->index() <= cp5.refiningId() && mStitchGrid->index() <= cp1.refiningId()) { + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp5RefiningGrid = mAMRDataSet.getGridByIndex(cp5.refiningId()); + AxisAlignedBox cp5RefiningCells = cp5RefiningGrid->getRefiningCells(cp5.grid(), cp5.idx(xAxis), cp5.idx(yAxis), cp5.idx(zAxis)); + int cp5RefIdx[3]; + cp5RefIdx[edgeAxis] = cp5RefiningCells.min(edgeAxis); + cp5RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp5RefiningCells.max(addAxis0132) : cp5RefiningCells.min(addAxis0132); + cp5RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp5RefiningCells.min(addAxis0451) : cp5RefiningCells.max(addAxis0451); + AMRGridCell cp5Ref(cp5RefiningGrid, cp5RefIdx); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism245(mStitchCellHandler, cp2, cp0, cp1Ref, cp3, ep0, ep1); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism2345(mStitchCellHandler, cp0, cp4, cp5Ref, cp1Ref, ep0, ep1); + } + } + else if (cp5.refiningId() != AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 35 + if (mStitchGrid->index() <= cp5.refiningId() && mStitchGrid->index() <= cp1.refiningId() && mStitchGrid->index() <= cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp5RefiningGrid = mAMRDataSet.getGridByIndex(cp5.refiningId()); + AxisAlignedBox cp5RefiningCells = cp5RefiningGrid->getRefiningCells(cp5.grid(), cp5.idx(xAxis), cp5.idx(yAxis), cp5.idx(zAxis)); + int cp5RefIdx[3]; + cp5RefIdx[edgeAxis] = cp5RefiningCells.min(edgeAxis); + cp5RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp5RefiningCells.max(addAxis0132) : cp5RefiningCells.min(addAxis0132); + cp5RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp5RefiningCells.min(addAxis0451) : cp5RefiningCells.max(addAxis0451); + AMRGridCell cp5Ref(cp5RefiningGrid, cp5RefIdx); + + mStitchCellHandler.handleTrianglePrismCell(cp2, cp0Ref, cp1Ref, cp3, ep0, ep1); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism02345(mStitchCellHandler, cp0Ref, cp4, cp5Ref, cp1Ref, ep0, ep1); + } + } + else if (cp5.refiningId() != AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() != AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 36 + if (mStitchGrid->index() <= cp5.refiningId() && mStitchGrid->index() <= cp2.refiningId()) { + AMRGrid *cp2RefiningGrid = mAMRDataSet.getGridByIndex(cp2.refiningId()); + AxisAlignedBox cp2RefiningCells = cp2RefiningGrid->getRefiningCells(cp2.grid(), cp2.idx(xAxis), cp2.idx(yAxis), cp2.idx(zAxis)); + int cp2RefIdx[3]; + cp2RefIdx[edgeAxis] = cp2RefiningCells.max(edgeAxis); + cp2RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp2RefiningCells.min(addAxis0132) : cp2RefiningCells.max(addAxis0132); + cp2RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp2RefiningCells.max(addAxis0451) : cp2RefiningCells.min(addAxis0451); + AMRGridCell cp2Ref(cp2RefiningGrid, cp2RefIdx); + AMRGrid *cp5RefiningGrid = mAMRDataSet.getGridByIndex(cp5.refiningId()); + AxisAlignedBox cp5RefiningCells = cp5RefiningGrid->getRefiningCells(cp5.grid(), cp5.idx(xAxis), cp5.idx(yAxis), cp5.idx(zAxis)); + int cp5RefIdx[3]; + cp5RefIdx[edgeAxis] = cp5RefiningCells.min(edgeAxis); + cp5RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp5RefiningCells.max(addAxis0132) : cp5RefiningCells.min(addAxis0132); + cp5RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp5RefiningCells.min(addAxis0451) : cp5RefiningCells.max(addAxis0451); + AMRGridCell cp5Ref(cp5RefiningGrid, cp5RefIdx); + + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism145(mStitchCellHandler, cp3, cp2Ref, cp0, cp1, ep1, cp5Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism0145(mStitchCellHandler, cp2Ref, ep0, cp4, cp0, ep1, cp5Ref); + } + } + else if (cp5.refiningId() != AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() != AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 37 + if (mStitchGrid->index() <= cp5.refiningId() && mStitchGrid->index() <= cp2.refiningId() && mStitchGrid->index() <= cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp2RefiningGrid = mAMRDataSet.getGridByIndex(cp2.refiningId()); + AxisAlignedBox cp2RefiningCells = cp2RefiningGrid->getRefiningCells(cp2.grid(), cp2.idx(xAxis), cp2.idx(yAxis), cp2.idx(zAxis)); + int cp2RefIdx[3]; + cp2RefIdx[edgeAxis] = cp2RefiningCells.max(edgeAxis); + cp2RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp2RefiningCells.min(addAxis0132) : cp2RefiningCells.max(addAxis0132); + cp2RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp2RefiningCells.max(addAxis0451) : cp2RefiningCells.min(addAxis0451); + AMRGridCell cp2Ref(cp2RefiningGrid, cp2RefIdx); + AMRGrid *cp5RefiningGrid = mAMRDataSet.getGridByIndex(cp5.refiningId()); + AxisAlignedBox cp5RefiningCells = cp5RefiningGrid->getRefiningCells(cp5.grid(), cp5.idx(xAxis), cp5.idx(yAxis), cp5.idx(zAxis)); + int cp5RefIdx[3]; + cp5RefIdx[edgeAxis] = cp5RefiningCells.min(edgeAxis); + cp5RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp5RefiningCells.max(addAxis0132) : cp5RefiningCells.min(addAxis0132); + cp5RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp5RefiningCells.min(addAxis0451) : cp5RefiningCells.max(addAxis0451); + AMRGridCell cp5Ref(cp5RefiningGrid, cp5RefIdx); + + mStitchCellHandler.handleTrianglePrismCell(cp3, cp2Ref, cp0Ref, cp1, ep1, cp5Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism01345(mStitchCellHandler, cp2Ref, ep0, cp4, cp0Ref, ep1, cp5Ref); + } + } + else if (cp5.refiningId() != AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() != AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 38 + if (mStitchGrid->index() <= cp5.refiningId() && mStitchGrid->index() <= cp2.refiningId() && mStitchGrid->index() <= cp1.refiningId()) { + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp2RefiningGrid = mAMRDataSet.getGridByIndex(cp2.refiningId()); + AxisAlignedBox cp2RefiningCells = cp2RefiningGrid->getRefiningCells(cp2.grid(), cp2.idx(xAxis), cp2.idx(yAxis), cp2.idx(zAxis)); + int cp2RefIdx[3]; + cp2RefIdx[edgeAxis] = cp2RefiningCells.max(edgeAxis); + cp2RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp2RefiningCells.min(addAxis0132) : cp2RefiningCells.max(addAxis0132); + cp2RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp2RefiningCells.max(addAxis0451) : cp2RefiningCells.min(addAxis0451); + AMRGridCell cp2Ref(cp2RefiningGrid, cp2RefIdx); + AMRGrid *cp5RefiningGrid = mAMRDataSet.getGridByIndex(cp5.refiningId()); + AxisAlignedBox cp5RefiningCells = cp5RefiningGrid->getRefiningCells(cp5.grid(), cp5.idx(xAxis), cp5.idx(yAxis), cp5.idx(zAxis)); + int cp5RefIdx[3]; + cp5RefIdx[edgeAxis] = cp5RefiningCells.min(edgeAxis); + cp5RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp5RefiningCells.max(addAxis0132) : cp5RefiningCells.min(addAxis0132); + cp5RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp5RefiningCells.min(addAxis0451) : cp5RefiningCells.max(addAxis0451); + AMRGridCell cp5Ref(cp5RefiningGrid, cp5RefIdx); + + mStitchCellHandler.handleTrianglePrismCell(ep0, cp4, cp0, cp2Ref, cp5Ref, cp1Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism01245(mStitchCellHandler, ep1, ep0, cp2Ref, cp3, cp5Ref, cp1Ref); + } + } + else if (cp5.refiningId() != AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() != AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 39 + if (mStitchGrid->index() <= cp5.refiningId() && mStitchGrid->index() <= cp2.refiningId() && mStitchGrid->index() <= cp1.refiningId() && cp0.refiningId() <= mStitchGrid->index()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp2RefiningGrid = mAMRDataSet.getGridByIndex(cp2.refiningId()); + AxisAlignedBox cp2RefiningCells = cp2RefiningGrid->getRefiningCells(cp2.grid(), cp2.idx(xAxis), cp2.idx(yAxis), cp2.idx(zAxis)); + int cp2RefIdx[3]; + cp2RefIdx[edgeAxis] = cp2RefiningCells.max(edgeAxis); + cp2RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp2RefiningCells.min(addAxis0132) : cp2RefiningCells.max(addAxis0132); + cp2RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp2RefiningCells.max(addAxis0451) : cp2RefiningCells.min(addAxis0451); + AMRGridCell cp2Ref(cp2RefiningGrid, cp2RefIdx); + AMRGrid *cp5RefiningGrid = mAMRDataSet.getGridByIndex(cp5.refiningId()); + AxisAlignedBox cp5RefiningCells = cp5RefiningGrid->getRefiningCells(cp5.grid(), cp5.idx(xAxis), cp5.idx(yAxis), cp5.idx(zAxis)); + int cp5RefIdx[3]; + cp5RefIdx[edgeAxis] = cp5RefiningCells.min(edgeAxis); + cp5RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp5RefiningCells.max(addAxis0132) : cp5RefiningCells.min(addAxis0132); + cp5RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp5RefiningCells.min(addAxis0451) : cp5RefiningCells.max(addAxis0451); + AMRGridCell cp5Ref(cp5RefiningGrid, cp5RefIdx); + + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism02345(mStitchCellHandler, ep0, cp4, cp0Ref, cp2Ref, cp5Ref, cp1Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedTrianglePrism01245(mStitchCellHandler, ep1, ep0, cp2Ref, cp3, cp5Ref, cp1Ref); + } + } + else if (cp5.refiningId() != AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() != AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 40 + if (mStitchGrid->index() <= cp5.refiningId() && mStitchGrid->index() <= cp3.refiningId()) { + AMRGrid *cp3RefiningGrid = mAMRDataSet.getGridByIndex(cp3.refiningId()); + AxisAlignedBox cp3RefiningCells = cp3RefiningGrid->getRefiningCells(cp3.grid(), cp3.idx(xAxis), cp3.idx(yAxis), cp3.idx(zAxis)); + int cp3RefIdx[3]; + cp3RefIdx[edgeAxis] = cp3RefiningCells.min(edgeAxis); + cp3RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp3RefiningCells.min(addAxis0132) : cp3RefiningCells.max(addAxis0132); + cp3RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp3RefiningCells.max(addAxis0451) : cp3RefiningCells.min(addAxis0451); + AMRGridCell cp3Ref(cp3RefiningGrid, cp3RefIdx); + AMRGrid *cp5RefiningGrid = mAMRDataSet.getGridByIndex(cp5.refiningId()); + AxisAlignedBox cp5RefiningCells = cp5RefiningGrid->getRefiningCells(cp5.grid(), cp5.idx(xAxis), cp5.idx(yAxis), cp5.idx(zAxis)); + int cp5RefIdx[3]; + cp5RefIdx[edgeAxis] = cp5RefiningCells.min(edgeAxis); + cp5RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp5RefiningCells.max(addAxis0132) : cp5RefiningCells.min(addAxis0132); + cp5RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp5RefiningCells.min(addAxis0451) : cp5RefiningCells.max(addAxis0451); + AMRGridCell cp5Ref(cp5RefiningGrid, cp5RefIdx); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid04(mStitchCellHandler, ep0, cp4, cp0, cp2, cp5Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid04(mStitchCellHandler, cp3Ref, cp2, cp0, cp1, cp5Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid1234(mStitchCellHandler, cp2, cp3Ref, ep1, ep0, cp5Ref); + } + } + else if (cp5.refiningId() != AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() != AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 41 + if (mStitchGrid->index() <= cp5.refiningId() && mStitchGrid->index() <= cp3.refiningId() && cp0.refiningId() <= mStitchGrid->index()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp3RefiningGrid = mAMRDataSet.getGridByIndex(cp3.refiningId()); + AxisAlignedBox cp3RefiningCells = cp3RefiningGrid->getRefiningCells(cp3.grid(), cp3.idx(xAxis), cp3.idx(yAxis), cp3.idx(zAxis)); + int cp3RefIdx[3]; + cp3RefIdx[edgeAxis] = cp3RefiningCells.min(edgeAxis); + cp3RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp3RefiningCells.min(addAxis0132) : cp3RefiningCells.max(addAxis0132); + cp3RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp3RefiningCells.max(addAxis0451) : cp3RefiningCells.min(addAxis0451); + AMRGridCell cp3Ref(cp3RefiningGrid, cp3RefIdx); + AMRGrid *cp5RefiningGrid = mAMRDataSet.getGridByIndex(cp5.refiningId()); + AxisAlignedBox cp5RefiningCells = cp5RefiningGrid->getRefiningCells(cp5.grid(), cp5.idx(xAxis), cp5.idx(yAxis), cp5.idx(zAxis)); + int cp5RefIdx[3]; + cp5RefIdx[edgeAxis] = cp5RefiningCells.min(edgeAxis); + cp5RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp5RefiningCells.max(addAxis0132) : cp5RefiningCells.min(addAxis0132); + cp5RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp5RefiningCells.min(addAxis0451) : cp5RefiningCells.max(addAxis0451); + AMRGridCell cp5Ref(cp5RefiningGrid, cp5RefIdx); + + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid024(mStitchCellHandler, ep0, cp4, cp0Ref, cp2, cp5Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid024(mStitchCellHandler, cp3Ref, cp2, cp0Ref, cp1, cp5Ref); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid1234(mStitchCellHandler, cp2, cp3Ref, ep1, ep0, cp5Ref); + } + } + else if (cp5.refiningId() != AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() != AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + // Case 42 + if (mStitchGrid->index() <= cp5.refiningId() && mStitchGrid->index() <= cp3.refiningId() && mStitchGrid->index() <= cp1.refiningId()) { + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp3RefiningGrid = mAMRDataSet.getGridByIndex(cp3.refiningId()); + AxisAlignedBox cp3RefiningCells = cp3RefiningGrid->getRefiningCells(cp3.grid(), cp3.idx(xAxis), cp3.idx(yAxis), cp3.idx(zAxis)); + int cp3RefIdx[3]; + cp3RefIdx[edgeAxis] = cp3RefiningCells.min(edgeAxis); + cp3RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp3RefiningCells.min(addAxis0132) : cp3RefiningCells.max(addAxis0132); + cp3RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp3RefiningCells.max(addAxis0451) : cp3RefiningCells.min(addAxis0451); + AMRGridCell cp3Ref(cp3RefiningGrid, cp3RefIdx); + AMRGrid *cp5RefiningGrid = mAMRDataSet.getGridByIndex(cp5.refiningId()); + AxisAlignedBox cp5RefiningCells = cp5RefiningGrid->getRefiningCells(cp5.grid(), cp5.idx(xAxis), cp5.idx(yAxis), cp5.idx(zAxis)); + int cp5RefIdx[3]; + cp5RefIdx[edgeAxis] = cp5RefiningCells.min(edgeAxis); + cp5RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp5RefiningCells.max(addAxis0132) : cp5RefiningCells.min(addAxis0132); + cp5RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp5RefiningCells.min(addAxis0451) : cp5RefiningCells.max(addAxis0451); + AMRGridCell cp5Ref(cp5RefiningGrid, cp5RefIdx); + mStitchCellHandler.handlePyramidCell(ep1, cp3Ref, cp1Ref, cp5Ref, ep0); + mStitchCellHandler.handlePyramidCell(cp0, cp4, cp5Ref, cp1Ref, ep0); + mStitchCellHandler.handlePyramidCell(cp0, cp1Ref, cp3Ref, cp2, ep0); + } + } + else if (cp5.refiningId() != AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() != AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() != AMRGrid::NoGrid && cp0.refiningId() != AMRGrid::NoGrid) { + // Case 43 + if (mStitchGrid->index() <= cp5.refiningId() && mStitchGrid->index() <= cp3.refiningId() && mStitchGrid->index() <= cp1.refiningId() && mStitchGrid->index() <= cp0.refiningId()) { + AMRGrid *cp0RefiningGrid = mAMRDataSet.getGridByIndex(cp0.refiningId()); + AxisAlignedBox cp0RefiningCells = cp0RefiningGrid->getRefiningCells(cp0.grid(), cp0.idx(xAxis), cp0.idx(yAxis), cp0.idx(zAxis)); + int cp0RefIdx[3]; + cp0RefIdx[edgeAxis] = cp0RefiningCells.max(edgeAxis); + cp0RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp0RefiningCells.max(addAxis0132) : cp0RefiningCells.min(addAxis0132); + cp0RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp0RefiningCells.max(addAxis0451) : cp0RefiningCells.min(addAxis0451); + AMRGridCell cp0Ref(cp0RefiningGrid, cp0RefIdx); + AMRGrid *cp1RefiningGrid = mAMRDataSet.getGridByIndex(cp1.refiningId()); + AxisAlignedBox cp1RefiningCells = cp1RefiningGrid->getRefiningCells(cp1.grid(), cp1.idx(xAxis), cp1.idx(yAxis), cp1.idx(zAxis)); + int cp1RefIdx[3]; + cp1RefIdx[edgeAxis] = cp1RefiningCells.min(edgeAxis); + cp1RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp1RefiningCells.max(addAxis0132) : cp1RefiningCells.min(addAxis0132); + cp1RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp1RefiningCells.max(addAxis0451) : cp1RefiningCells.min(addAxis0451); + AMRGridCell cp1Ref(cp1RefiningGrid, cp1RefIdx); + AMRGrid *cp3RefiningGrid = mAMRDataSet.getGridByIndex(cp3.refiningId()); + AxisAlignedBox cp3RefiningCells = cp3RefiningGrid->getRefiningCells(cp3.grid(), cp3.idx(xAxis), cp3.idx(yAxis), cp3.idx(zAxis)); + int cp3RefIdx[3]; + cp3RefIdx[edgeAxis] = cp3RefiningCells.min(edgeAxis); + cp3RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp3RefiningCells.min(addAxis0132) : cp3RefiningCells.max(addAxis0132); + cp3RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp3RefiningCells.max(addAxis0451) : cp3RefiningCells.min(addAxis0451); + AMRGridCell cp3Ref(cp3RefiningGrid, cp3RefIdx); + AMRGrid *cp5RefiningGrid = mAMRDataSet.getGridByIndex(cp5.refiningId()); + AxisAlignedBox cp5RefiningCells = cp5RefiningGrid->getRefiningCells(cp5.grid(), cp5.idx(xAxis), cp5.idx(yAxis), cp5.idx(zAxis)); + int cp5RefIdx[3]; + cp5RefIdx[edgeAxis] = cp5RefiningCells.min(edgeAxis); + cp5RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp5RefiningCells.max(addAxis0132) : cp5RefiningCells.min(addAxis0132); + cp5RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp5RefiningCells.min(addAxis0451) : cp5RefiningCells.max(addAxis0451); + AMRGridCell cp5Ref(cp5RefiningGrid, cp5RefIdx); + mStitchCellHandler.handlePyramidCell(ep1, cp3Ref, cp1Ref, cp5Ref, ep0); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid1234(mStitchCellHandler, cp4, cp5Ref, cp1Ref, cp0Ref, ep0); + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid1234(mStitchCellHandler, cp2, cp0Ref, cp1Ref, cp3Ref, ep0); + } + } + else if (cp5.refiningId() != AMRGrid::NoGrid && cp4.refiningId() != AMRGrid::NoGrid) { + // Case 48 ... 63 + AMRGrid *cp4RefiningGrid = mAMRDataSet.getGridByIndex(cp4.refiningId()); + AxisAlignedBox cp4RefiningCells = cp4RefiningGrid->getRefiningCells(cp4.grid(), cp4.idx(xAxis), cp4.idx(yAxis), cp4.idx(zAxis)); + int cp4RefIdx[3]; + cp4RefIdx[edgeAxis] = cp4RefiningCells.max(edgeAxis); + cp4RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp4RefiningCells.max(addAxis0132) : cp4RefiningCells.min(addAxis0132); + cp4RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp4RefiningCells.min(addAxis0451) : cp4RefiningCells.max(addAxis0451); + AMRGridCell cp4Ref(cp4RefiningGrid, cp4RefIdx); + AMRGrid *cp5RefiningGrid = mAMRDataSet.getGridByIndex(cp5.refiningId()); + AxisAlignedBox cp5RefiningCells = cp5RefiningGrid->getRefiningCells(cp5.grid(), cp5.idx(xAxis), cp5.idx(yAxis), cp5.idx(zAxis)); + int cp5RefIdx[3]; + cp5RefIdx[edgeAxis] = cp5RefiningCells.min(edgeAxis); + cp5RefIdx[addAxis0132] = edgeAxis0132Type == min ? cp5RefiningCells.max(addAxis0132) : cp5RefiningCells.min(addAxis0132); + cp5RefIdx[addAxis0451] = edgeAxis0451Type == min ? cp5RefiningCells.min(addAxis0451) : cp5RefiningCells.max(addAxis0451); + AMRGridCell cp5Ref(cp5RefiningGrid, cp5RefIdx); + connectQuadToQuad(ep0, ep1, cp5Ref, cp4Ref, cp2, cp3, cp1, cp0, edgeAxis, addAxis0132, addAxis0451, max, edgeAxis0132Type, edgeAxis0451Type); + } + else { + assert(false); + } +} + + template +void AMRGridStitcher::connectVertexToQuad(const AMRGridCell& vtx, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3) +{ + assert(p0.refiningId() == AMRGrid::NoGrid); + if (p1.refiningId() == AMRGrid::NoGrid && p2.refiningId() == AMRGrid::NoGrid && p3.refiningId() == AMRGrid::NoGrid) { + mStitchCellHandler.handlePyramidCell(p0, p1, p2, p3, vtx); + } + else if (p1.refiningId() != AMRGrid::NoGrid && p2.refiningId() == AMRGrid::NoGrid && p3.refiningId() == AMRGrid::NoGrid) { + if (mStitchGrid->index() <= p1.refiningId()) { + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid04(mStitchCellHandler, p1, p2, p3, p0, vtx); + } + } + else if (p1.refiningId() == AMRGrid::NoGrid && p2.refiningId() != AMRGrid::NoGrid && p3.refiningId() == AMRGrid::NoGrid) { + if (mStitchGrid->index() <= p2.refiningId()) { + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid04(mStitchCellHandler, p2, p3, p0, p1, vtx); + } + } + else if (p1.refiningId() == AMRGrid::NoGrid && p2.refiningId() == AMRGrid::NoGrid && p3.refiningId() != AMRGrid::NoGrid) { + if (mStitchGrid->index() <= p3.refiningId()) { + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid04(mStitchCellHandler, p3, p0, p1, p2, vtx); + } + } + else if (p1.refiningId() != AMRGrid::NoGrid && p2.refiningId() != AMRGrid::NoGrid && p3.refiningId() == AMRGrid::NoGrid) { + if (mStitchGrid->index() <= p1.refiningId() && mStitchGrid->index() <= p2.refiningId()) { + mStitchCellHandler.handlePyramidCell(p0, p1, p2, p3, vtx); + } + } + else if (p1.refiningId() != AMRGrid::NoGrid && p2.refiningId() == AMRGrid::NoGrid && p3.refiningId() != AMRGrid::NoGrid) { + if (mStitchGrid->index() <= p1.refiningId() && mStitchGrid->index() <= p3.refiningId()) { + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid024(mStitchCellHandler, p1, p2, p3, p0, vtx); + } + } + else if (p1.refiningId() == AMRGrid::NoGrid && p2.refiningId() != AMRGrid::NoGrid && p3.refiningId() != AMRGrid::NoGrid) { + if (mStitchGrid->index() <= p1.refiningId() && mStitchGrid->index() <= p2.refiningId()) { + mStitchCellHandler.handlePyramidCell(p0, p1, p2, p3, vtx); + } + } + else if (p1.refiningId() != AMRGrid::NoGrid && p2.refiningId() != AMRGrid::NoGrid && p3.refiningId() != AMRGrid::NoGrid) { + if (mStitchGrid->index() <= p1.refiningId() && mStitchGrid->index() <= p2.refiningId() && mStitchGrid->index() <= p3.refiningId()) { + AMRGridStitcherAuxFct::generateCellsForDeformedPyramid1234(mStitchCellHandler, p0, p1, p2, p3, vtx); + } + } + else { + assert(false); + } + +} + + template +void AMRGridStitcher::generateCellsForFace(AxisType axis0, AxisType axis1, AxisType axis2, MinMaxType faceType) +{ + assert(axis0 != axis1 && axis0 != axis2 && axis1 != axis2); + + try { + // Here for k=0. k=refiningGrid->dims[2]-1 analogous + // In this step we connect the faces of the refining grid with points in the + // refined grid. + for (int fFaceIdx0=0; fFaceIdx0dims[axis0]-1; ++fFaceIdx0) + for (int fFaceIdx1=0; fFaceIdx1dims[axis1]-1; ++fFaceIdx1) { + int cIdx00[3]; + cIdx00[axis0] = mOriginInParentLevel[axis0] + fFaceIdx0/2; + cIdx00[axis1] = mOriginInParentLevel[axis1] + fFaceIdx1/2; + if (faceType == min) + cIdx00[axis2] = mOriginInParentLevel[axis2] - 1; + else + cIdx00[axis2] = mMaxExtInParentLevel[axis2] + 1; + AMRGridCell cp0 = mParentLevel->getGridCell(cIdx00); + + int cIdx01[3]; + cIdx01[axis0] = cIdx00[axis0] + 1; + cIdx01[axis1] = cIdx00[axis1]; + cIdx01[axis2] = cIdx00[axis2]; + AMRGridCell cp3 = mParentLevel->getGridCell(cIdx01); + + int cIdx10[3]; + cIdx10[axis0] = cIdx00[axis0]; + cIdx10[axis1] = cIdx00[axis1] + 1; + cIdx10[axis2] = cIdx00[axis2]; + AMRGridCell cp1 = mParentLevel->getGridCell(cIdx10); + + int cIdx11[3]; + cIdx11[axis0] = cIdx00[axis0] + 1; + cIdx11[axis1] = cIdx00[axis1] + 1; + cIdx11[axis2] = cIdx00[axis2]; + AMRGridCell cp2 = mParentLevel->getGridCell(cIdx11);; + + int fIdx00[3]; + fIdx00[axis0] = fFaceIdx0; + fIdx00[axis1] = fFaceIdx1; + if (faceType == min) + fIdx00[axis2] = 0; + else + fIdx00[axis2] = mStitchGrid->dims[axis2] - 1; + AMRGridCell fp0(mStitchGrid, fIdx00[0], fIdx00[1], fIdx00[2]); + + int fIdx01[3]; + fIdx01[axis0] = fIdx00[axis0] + 1; + fIdx01[axis1] = fIdx00[axis1]; + fIdx01[axis2] = fIdx00[axis2]; + AMRGridCell fp3(mStitchGrid, fIdx01[0], fIdx01[1], fIdx01[2]); + + int fIdx10[3]; + fIdx10[axis0] = fIdx00[axis0]; + fIdx10[axis1] = fIdx00[axis1] + 1; + fIdx10[axis2] = fIdx00[axis2]; + AMRGridCell fp1(mStitchGrid, fIdx10[0], fIdx10[1], fIdx10[2]); + + int fIdx11[3]; + fIdx11[axis0] = fIdx00[axis0] + 1; + fIdx11[axis1] = fIdx00[axis1] + 1; + fIdx11[axis2] = fIdx00[axis2]; + AMRGridCell fp2(mStitchGrid, fIdx11[0], fIdx11[1], fIdx11[2]); + + // Compute combination from 2D case. If i is even, we connect with the corresponding + // point, if it is odd, we connect with the corresponding edge. The same for j. + // The combination yields: + // Axis 1 Axis 0 Result + // ====================== + // point point point + // point edge edge 0 (parallel axis 0) + // edge point edge 1 (parallel to axis 1) + // edge edge quad + enum ConnectionTypeType { Point = 0, Edge0 = 1, Edge1 = 2, Quad = 3 }; + ConnectionTypeType connectionType = ConnectionTypeType((fFaceIdx1%2) << 1 | fFaceIdx0%2); + switch (connectionType) { + case Point: + connectQuadToVertex(fp0, fp1, fp2, fp3, cp0, axis0, axis1, axis2, faceType); + break; + case Edge0: + //connectQuadToAxis0Edge(fp0, fp1, fp2, fp3, cp0, cp3, axis0, axis1, axis2, faceType); + connectQuadToEdge(fp0, fp1, fp2, fp3, cp0, cp3, axis1, axis0, axis2, min, max, faceType); + break; + case Edge1: + //connectQuadToAxis1Edge(fp0, fp1, fp2, fp3, cp0, cp1, axis0, axis1, axis2, faceType); + connectQuadToEdge(fp3, fp0, fp1, fp2, cp0, cp1, axis0, axis1, axis2, max, max, faceType); + break; + case Quad: + connectQuadToQuad(fp0, fp1, fp2, fp3, cp0, cp1, cp2, cp3, axis1, axis0, axis2, max, max, faceType); + break; + default: + std::cerr << "Internal Error (generateCellsForFace(AxisType, AxisType, AxisType)): Invalid enum value." << std::endl; + abort(); + } + } + } + catch (AMRLevel::NoGrid ng) { + std::cerr << "Error (AMRGridStitcher::generateCellsForFace(AxisType, AxisType, AxisType, MinMaxType): " << ng << std::endl; + } +} + + template +void AMRGridStitcher::generateCellsForEdge(AxisType edgeAxis, AxisType nonEdgeAxis0, MinMaxType nonEdgeAxis0Type, AxisType nonEdgeAxis1, MinMaxType nonEdgeAxis1Type) +{ + AxisType addAxis0132; + AxisType addAxis0451; + MinMaxType addAxis0132Type; + MinMaxType addAxis0451Type; + if (nonEdgeAxis1Type == min && nonEdgeAxis0Type == min) { + addAxis0132 = nonEdgeAxis0; + addAxis0451 = nonEdgeAxis1; + addAxis0132Type = min; + addAxis0451Type = min; + } + else if (nonEdgeAxis1Type == min && nonEdgeAxis0Type == max) { + addAxis0132 = nonEdgeAxis1; + addAxis0451 = nonEdgeAxis0; + addAxis0132Type = min; + addAxis0451Type = max; + } + if (nonEdgeAxis1Type == max && nonEdgeAxis0Type == min) { + addAxis0132 = nonEdgeAxis1; + addAxis0451 = nonEdgeAxis0; + addAxis0132Type = max; + addAxis0451Type = min; + } + if (nonEdgeAxis1Type == max && nonEdgeAxis0Type == max) { + addAxis0132 = nonEdgeAxis0; + addAxis0451 = nonEdgeAxis1; + addAxis0132Type = max; + addAxis0451Type = max; + } + + try { + for (int edgeIdx=0; edgeIdxdims[edgeAxis]-1; ++edgeIdx) { + int cIdx0[3]; + cIdx0[edgeAxis] = mOriginInParentLevel[edgeAxis] + edgeIdx/2; + if (nonEdgeAxis0Type == min) + cIdx0[nonEdgeAxis0] = mOriginInParentLevel[nonEdgeAxis0] - 1; + else + cIdx0[nonEdgeAxis0] = mMaxExtInParentLevel[nonEdgeAxis0] + 1; + if (nonEdgeAxis1Type == min) + cIdx0[nonEdgeAxis1] = mOriginInParentLevel[nonEdgeAxis1] - 1; + else + cIdx0[nonEdgeAxis1] = mMaxExtInParentLevel[nonEdgeAxis1] + 1; + AMRGridCell cp0 = mParentLevel->getGridCell(cIdx0); + + int cIdx1[3]; + cIdx1[edgeAxis] = cIdx0[edgeAxis] + 1; + cIdx1[nonEdgeAxis0] = cIdx0[nonEdgeAxis0]; + cIdx1[nonEdgeAxis1] = cIdx0[nonEdgeAxis1]; + AMRGridCell cp1 = mParentLevel->getGridCell(cIdx1); + + int cIdx2[3]; + cIdx2[edgeAxis] = cIdx0[edgeAxis]; + if (addAxis0132Type == min) + cIdx2[addAxis0132] = cIdx0[addAxis0132] + 1; + else + cIdx2[addAxis0132] = cIdx0[addAxis0132] - 1; + cIdx2[addAxis0451] = cIdx0[addAxis0451]; + AMRGridCell cp2 = mParentLevel->getGridCell(cIdx2); + + int cIdx3[3]; + cIdx3[edgeAxis] = cIdx2[edgeAxis] + 1; + cIdx3[addAxis0132] = cIdx2[addAxis0132]; + cIdx3[addAxis0451] = cIdx2[addAxis0451]; + AMRGridCell cp3 = mParentLevel->getGridCell(cIdx3); + + int cIdx4[3]; + cIdx4[edgeAxis] = cIdx0[edgeAxis]; + cIdx4[addAxis0132] = cIdx0[addAxis0132]; + if (addAxis0451Type == min) + cIdx4[addAxis0451] = cIdx0[addAxis0451] + 1; + else + cIdx4[addAxis0451] = cIdx0[addAxis0451] - 1; + AMRGridCell cp4 = mParentLevel->getGridCell(cIdx4); + + int cIdx5[3]; + cIdx5[edgeAxis] = cIdx4[edgeAxis] + 1; + cIdx5[addAxis0132] = cIdx4[addAxis0132]; + cIdx5[addAxis0451] = cIdx4[addAxis0451]; + AMRGridCell cp5 = mParentLevel->getGridCell(cIdx5); + + int eIdx0[3]; + eIdx0[edgeAxis] = edgeIdx; + if (nonEdgeAxis0Type == min) + eIdx0[nonEdgeAxis0] = 0; + else + eIdx0[nonEdgeAxis0] = mStitchGrid->dims[nonEdgeAxis0]-1; + if (nonEdgeAxis1Type == min) + eIdx0[nonEdgeAxis1] = 0; + else + eIdx0[nonEdgeAxis1] = mStitchGrid->dims[nonEdgeAxis1]-1; + AMRGridCell ep0(mStitchGrid, eIdx0[0], eIdx0[1], eIdx0[2]); + + int eIdx1[3]; + eIdx1[edgeAxis] = eIdx0[edgeAxis] + 1; + eIdx1[nonEdgeAxis0] = eIdx0[nonEdgeAxis0]; + eIdx1[nonEdgeAxis1] = eIdx0[nonEdgeAxis1]; + AMRGridCell ep1(mStitchGrid, eIdx1[0], eIdx1[1], eIdx1[2]); + + if (edgeIdx % 2) { + connectEdgeSegmentToQuads(ep0, ep1, cp0, cp1, cp2, cp3, cp4, cp5, edgeAxis, addAxis0132, addAxis0132Type, addAxis0451, addAxis0451Type); + } + else { + connectEdgeSegmentToEdges(ep0, ep1, cp0, cp2, cp4, edgeAxis, addAxis0132, addAxis0132Type, addAxis0451, addAxis0451Type); + } + } + } + catch (AMRLevel::NoGrid ng) { + std::cerr << "Error (AMRGridStitcher::generateCellsForEdge(AxisType, AxisType, MinMaxType, AxisType, MinMaxType): " << ng << std::endl; + } +} + + template +void AMRGridStitcher::generateCellsForVertex(AxisType axis0, AxisType axis1, AxisType axis2, MinMaxType axis0VertexType, MinMaxType axis1VertexType, MinMaxType axis2VertexType) +{ + try { + int fIdx[3]; + fIdx[axis0] = axis0VertexType == min ? 0 : mStitchGrid->dims[axis0] - 1; + fIdx[axis1] = axis1VertexType == min ? 0 : mStitchGrid->dims[axis1] - 1; + fIdx[axis2] = axis2VertexType == min ? 0 : mStitchGrid->dims[axis2] - 1; + AMRGridCell fp(mStitchGrid, fIdx); + + int cp0Idx[3]; + cp0Idx[axis0] = axis0VertexType == min ? mOriginInParentLevel[axis0] - 1 : mMaxExtInParentLevel[axis0] + 1; + cp0Idx[axis1] = axis1VertexType == min ? mOriginInParentLevel[axis1] - 1 : mMaxExtInParentLevel[axis1] + 1; + cp0Idx[axis2] = axis2VertexType == min ? mOriginInParentLevel[axis2] - 1 : mMaxExtInParentLevel[axis2] + 1; + AMRGridCell cp0 = mParentLevel->getGridCell(cp0Idx); + + int cp1Idx[3]; + cp1Idx[axis0] = cp0Idx[axis0]; + cp1Idx[axis1] = axis1VertexType == min ? cp0Idx[axis1] + 1 : cp0Idx[axis1] - 1; + cp1Idx[axis2] = cp0Idx[axis2]; + AMRGridCell cp1 = mParentLevel->getGridCell(cp1Idx); + + int cp2Idx[3]; + cp2Idx[axis0] = axis0VertexType == min ? cp0Idx[axis0] + 1 : cp0Idx[axis0] - 1; + cp2Idx[axis1] = cp0Idx[axis1]; + cp2Idx[axis2] = cp0Idx[axis2]; + AMRGridCell cp2 = mParentLevel->getGridCell(cp2Idx); + + int cp3Idx[3]; + cp3Idx[axis0] = axis0VertexType == min ? cp1Idx[axis0] + 1 : cp1Idx[axis0] - 1; + cp3Idx[axis1] = cp1Idx[axis1]; + cp3Idx[axis2] = cp1Idx[axis2]; + AMRGridCell cp3 = mParentLevel->getGridCell(cp3Idx); + + int cp4Idx[3]; + cp4Idx[axis0] = cp0Idx[axis0]; + cp4Idx[axis1] = cp0Idx[axis1]; + cp4Idx[axis2] = axis2VertexType == min ? cp0Idx[axis2] + 1 : cp0Idx[axis2] - 1; + AMRGridCell cp4 = mParentLevel->getGridCell(cp4Idx); + + int cp5Idx[3]; + cp5Idx[axis0] = cp1Idx[axis0]; + cp5Idx[axis1] = cp1Idx[axis1]; + cp5Idx[axis2] = axis2VertexType == min ? cp1Idx[axis2] + 1 : cp1Idx[axis2] - 1; + AMRGridCell cp5 = mParentLevel->getGridCell(cp5Idx); + + int cp6Idx[3]; + cp6Idx[axis0] = cp2Idx[axis0]; + cp6Idx[axis1] = cp0Idx[axis1]; + cp6Idx[axis2] = cp4Idx[axis2]; + AMRGridCell cp6 = mParentLevel->getGridCell(cp6Idx); + + if (cp6.refiningId() == AMRGrid::NoGrid && cp5.refiningId() == AMRGrid::NoGrid && cp4.refiningId() == AMRGrid::NoGrid && cp3.refiningId() == AMRGrid::NoGrid && cp2.refiningId() == AMRGrid::NoGrid && cp1.refiningId() == AMRGrid::NoGrid && cp0.refiningId() == AMRGrid::NoGrid) { + mStitchCellHandler.handlePyramidCell(cp0, cp2, cp3, cp1, fp); + mStitchCellHandler.handlePyramidCell(cp0, cp1, cp5, cp4, fp); + mStitchCellHandler.handlePyramidCell(cp0, cp4, cp6, cp2, fp); + } + else if (!(cp3.refiningId() != AMRGrid::NoGrid || cp5.refiningId() != AMRGrid::NoGrid || cp6.refiningId() != AMRGrid::NoGrid)) { + connectVertexToQuad(fp, cp3, cp1, cp0, cp2); + connectVertexToQuad(fp, cp5, cp4, cp0, cp1); + connectVertexToQuad(fp, cp6, cp2, cp0, cp4); + } + else if (cp3.refiningId() != AMRGrid::NoGrid) { + AMRGrid *cp3RefiningGrid = mAMRDataSet.getGridByIndex(cp3.refiningId()); + AxisAlignedBox cp3RefiningCells = cp3RefiningGrid->getRefiningCells(cp3.grid(), cp3.idx(xAxis), cp3.idx(yAxis), cp3.idx(zAxis)); + int cp3RefIdx[3]; + cp3RefIdx[axis0] = axis0VertexType == min ? cp3RefiningCells.min(axis0) : cp3RefiningCells.max(axis0); + cp3RefIdx[axis1] = axis1VertexType == min ? cp3RefiningCells.min(axis1) : cp3RefiningCells.max(axis1); + cp3RefIdx[axis2] = axis2VertexType == min ? cp3RefiningCells.max(axis2) : cp3RefiningCells.min(axis2); + AMRGridCell cp3Ref(cp3RefiningGrid, cp3RefIdx); + if (axis2VertexType == min) + connectEdgeSegmentToQuads(cp3Ref, fp, cp0, cp4, cp2, cp6, cp1, cp5, axis2, axis0, axis0VertexType, axis1, axis1VertexType); + else + connectEdgeSegmentToQuads(fp, cp3Ref, cp4, cp0, cp5, cp1, cp6, cp2, axis2, axis1, axis1VertexType, axis0, axis0VertexType); + } + else if (cp5.refiningId() != AMRGrid::NoGrid) { + AMRGrid *cp5RefiningGrid = mAMRDataSet.getGridByIndex(cp5.refiningId()); + AxisAlignedBox cp5RefiningCells = cp5RefiningGrid->getRefiningCells(cp5.grid(), cp5.idx(xAxis), cp5.idx(yAxis), cp5.idx(zAxis)); + int cp5RefIdx[3]; + cp5RefIdx[axis0] = axis0VertexType == min ? cp5RefiningCells.max(axis0) : cp5RefiningCells.min(axis0); + cp5RefIdx[axis1] = axis1VertexType == min ? cp5RefiningCells.min(axis1) : cp5RefiningCells.max(axis1); + cp5RefIdx[axis2] = axis2VertexType == min ? cp5RefiningCells.min(axis2) : cp5RefiningCells.max(axis2); + AMRGridCell cp5Ref(cp5RefiningGrid, cp5RefIdx); + if (axis0VertexType == min) + connectEdgeSegmentToQuads(cp5Ref, fp, cp0, cp2, cp1, cp3, cp4, cp6, axis0, axis1, axis1VertexType, axis2, axis2VertexType); + else + connectEdgeSegmentToQuads(fp, cp5Ref, cp2, cp0, cp6, cp4, cp3, cp1, axis0, axis2, axis2VertexType, axis1, axis1VertexType); + } + else if (cp6.refiningId() != AMRGrid::NoGrid) { + AMRGrid *cp6RefiningGrid = mAMRDataSet.getGridByIndex(cp6.refiningId()); + AxisAlignedBox cp6RefiningCells = cp6RefiningGrid->getRefiningCells(cp6.grid(), cp6.idx(xAxis), cp6.idx(yAxis), cp6.idx(zAxis)); + int cp6RefIdx[3]; + cp6RefIdx[axis0] = axis0VertexType == min ? cp6RefiningCells.min(axis0) : cp6RefiningCells.max(axis0); + cp6RefIdx[axis1] = axis1VertexType == min ? cp6RefiningCells.max(axis1) : cp6RefiningCells.min(axis1); + cp6RefIdx[axis2] = axis2VertexType == min ? cp6RefiningCells.min(axis2) : cp6RefiningCells.max(axis2); + AMRGridCell cp6Ref(cp6RefiningGrid, cp6RefIdx); + if (axis0VertexType == min) + connectEdgeSegmentToQuads(cp6Ref, fp, cp0, cp1, cp4, cp5, cp2, cp3, axis1, axis2, axis2VertexType, axis0, axis0VertexType); + else + connectEdgeSegmentToQuads(fp, cp6Ref, cp1, cp0, cp3, cp2, cp5, cp4, axis1, axis0, axis0VertexType, axis2, axis2VertexType); + } + } + catch (AMRLevel::NoGrid ng) { + std::cerr << "Error (AMRGridStitcher::generateCellsForVertex(AxisType, AxisType, AxisType, MinMaxType, MinMaxType, MinMaxType): " << ng << std::endl; + } +} diff --git a/src/AMRHierLib/AMRGridStitcher.hh b/src/AMRHierLib/AMRGridStitcher.hh new file mode 100644 index 0000000..a4c4e8f --- /dev/null +++ b/src/AMRHierLib/AMRGridStitcher.hh @@ -0,0 +1,141 @@ +//------------------------------------------------------------------------------ +// +// Project: Crackfree Isosurfaces for AMR data +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +/* + * Copyright (C) 2001, The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Visualization + * Group at Lawrence Berkeley National Laboratory. + * 4. Neither the name of the University of California, Berkeley nor of the + * Lawrence Berkeley National Laboratory may be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * + * This work is supported by the U. S. Department of Energy under contract + * number DE-AC03-76SF00098 between the U. S. Department of Energy and the + * University of California. + * + * Author: Gunther H Weber + * Lawrence Berkeley National Laboratory + * Berkeley, California + * + * "this software is 100% hand-crafted by a human being in the USA and Germany" + * + */ + +#ifndef _GHW_AMRGRIDSTITCHER_HH_ +#define _GHW_AMRGRIDSTITCHER_HH_ + +// Standard C/C++ Includes +#include +#include +#include + +// Support Classes +#include + +// AMR Specific Includes +#include +#include + +class AMRGrid; + +// AMRGridStitcher: +// Connect Grids in AMR Hierarchy via stitch cells, +// see WriteStitchCells for an example +// AMRGridStitcher is a template of a class which is supposed to +// handle the stitch cells and do something with them, e.g. write them +// to a file (as StitchCellWriter in the WriteStitchCells example does) +// This class must implement the following methods: +// void handleTetrahedronCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const Vertex& p3, double v3); +// --> Handle a tetrahedron cell with one Vertex that is not an original data value (computed as centroid of original data vertices) +// void handleTetrahedronCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3); +// --> Handle a tetrahedron cell with vertices described by GridCells, i.e. one only using original data points +// void handlePyramidCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3, const Vertex& p4, double v4); +// --> Handle a pyramid cell with one Vertex that is not an original data value (computed as centroid of original data vertices) +// void handlePyramidCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3, const AMRGridCell& c4); +// --> Handle a pyramid cell with vertices described by GridCells, i.e. one only using original data points +// void handleTrianglePrismCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3, const AMRGridCell& c4, const AMRGridCell& c5); +// --> Handle a triangle prism cell with vertices described by GridCells, i.e. one only using original data points +// void handleHexahedronCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3, const AMRGridCell& c4, const AMRGridCell& c5, const AMRGridCell& c6, const AMRGridCell& c7); +// --> Handle a hexahedron cell with vertices described by GridCells, i.e. one only using original data points +// Concerning the ordering scheme of vertices of the stitch-cells see VtxOrder.pdf or VtxOrder.png + +template +class AMRGridStitcher { + public: + // Generate a grid stitcher: + // stitchCellHandler - object which uses the generated cells + // amrHier - the AMR hierarchy + // stitchGrid - Grid that should be stitched into the parent level + // considerNextLevel - if true: do not generate those stitch cells that would be covered by cells/stitch cells of a next level, + // i.e., when cells connecting two grids are generated and this is set to true, all cells that are overlaped by grids of + // the next level are ignored. If false: any effects a next level may have are ignored + AMRGridStitcher(StitchCellHandler& stitchCellHandler, AMRHierarchy& amrHier, AMRGrid *stitchGrid, bool considerNextLevel=false); + ~AMRGridStitcher(); + // Start the stitching process + void generateStitchCells(bool xyMin = true, bool xyMax = true, bool yzMin = true, bool yzMax = true, bool xzMin = true, bool xzMax = true); + + private: // Helper functions and data types + enum MinMaxType { min, max }; + + void connectQuadToVertex(const AMRGridCell& qp0, const AMRGridCell& qp1, const AMRGridCell& qp2, const AMRGridCell& qp3, const AMRGridCell& vp, AxisType axis0, AxisType axis1, AxisType axis2, MinMaxType faceType); + void connectQuadToEdge(const AMRGridCell& qp0, const AMRGridCell& qp1, const AMRGridCell& qp2, const AMRGridCell& qp3, const AMRGridCell& ep0, const AMRGridCell& ep1, AxisType axis01, AxisType axis03, AxisType axisPerp0123, MinMaxType qp0Axis01Type, MinMaxType qp0Axis03Type, MinMaxType quadFaceType); + void connectQuadToQuad(const AMRGridCell& qp0, const AMRGridCell& qp1, const AMRGridCell& qp2, const AMRGridCell& qp3, const AMRGridCell& oqp0, const AMRGridCell& oqp1, const AMRGridCell& oqp2, const AMRGridCell& oqp3, AxisType axis01, AxisType axis03, AxisType axisPerp0123, MinMaxType qp0Axis01Type, MinMaxType qp0Axis03Type, MinMaxType quadFaceType); + + void connectEdgeSegmentToEdges(const AMRGridCell& ep0, const AMRGridCell& ep1, const AMRGridCell& cp0, const AMRGridCell& cp1, const AMRGridCell& cp2, AxisType edgeAxis, AxisType edge01Axis, MinMaxType edgeAxis01Type, AxisType edge02Axis, MinMaxType edgeAxis02Type); + void connectEdgeSegmentToQuads(const AMRGridCell& ep0, const AMRGridCell& ep1, const AMRGridCell& cp0, const AMRGridCell& cp1, const AMRGridCell& cp2, const AMRGridCell& cp3, const AMRGridCell& cp4, const AMRGridCell& cp5, AxisType edgeAxis, AxisType addAxis0132, MinMaxType edgeAxis0132Type, AxisType addAxis0451, MinMaxType edgeAxis0451Type); + + void connectVertexToQuad(const AMRGridCell& vtx, const AMRGridCell& p0, const AMRGridCell& p1, const AMRGridCell& p2, const AMRGridCell& p3); + + void generateCellsForFace(AxisType axis1, AxisType axis2, AxisType axis3, MinMaxType faceType); + void generateCellsForEdge(AxisType edgeAxis, AxisType nonEdgeAxis1, MinMaxType nonEdgeAxis1Type, AxisType nonEdgeAxis2, MinMaxType nonEdgeAxis2Type); + void generateCellsForVertex(AxisType axis0, AxisType axis1, AxisType axis2, MinMaxType axis0VertexType, MinMaxType axis1VertexType, MinMaxType axis2VertexType); + + private: // Data members + StitchCellHandler &mStitchCellHandler; + AMRHierarchy &mAMRDataSet; + AMRGrid *mStitchGrid; + bool mConsiderNextLevel; + AMRLevel *mParentLevel; + int mOriginInParentLevel[3]; + int mMaxExtInParentLevel[3]; +}; + +#ifdef __GNUC__ +#include "AMRGridStitcher.cc" +#endif + +#endif diff --git a/src/AMRHierLib/AMRHierarchy.cc b/src/AMRHierLib/AMRHierarchy.cc new file mode 100644 index 0000000..aabf16b --- /dev/null +++ b/src/AMRHierLib/AMRHierarchy.cc @@ -0,0 +1,189 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +/* WARNING: This software is EXPERIMENTAL. The authors give no guaranty + * about stability or correctness of the provided source! + * + * Copyright (C) 2001, The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Visualization + * Group at Lawrence Berkeley National Laboratory. + * 4. Neither the name of the University of California, Berkeley nor of the + * Lawrence Berkeley National Laboratory may be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * + * This work is supported by the U. S. Department of Energy under contract + * number DE-AC03-76SF00098 between the U. S. Department of Energy and the + * University of California. + * + * Author: Gunther H Weber + * Lawrence Berkeley National Laboratory + * Berkeley, California + * + * "this software is 100% hand-crafted by a human being in the USA [and Germany :-)]" + * + */ + +#include "AMRHierarchy.hh" + +// Standard C/C++-Includes +#include +#include + +// AMR related includes +#include +#include +#include +#include + +AMRHierarchy::AMRHierarchy() : mAmrFile(NULL), mAmrGridReader(NULL), mNoLevels(0), mNoGrids(0), mAMRLevel(NULL), mIndexToGridPtrMap(NULL), mValueRange(0.0,0.0) {} + +AMRHierarchy::~AMRHierarchy() +{ + clear(); +} + + +bool AMRHierarchy::readIEEEFile(const char *filename) +{ + // Create the object for file-access. This allows AmrGridReader to read different + // file formats. + IEEEIO *theAmrFile = new IEEEIO(filename, IObase::Read); + if (!(theAmrFile!=NULL && theAmrFile->isValid())) { + std::cerr << "Error in AMRHierarchy::readIEEEFile(char *): Couldn't open AMR-file" << filename << " for reading" << std::endl; + return false; + } + return readFromFile(theAmrFile); +} + +bool AMRHierarchy::readFromFile(IObase *theAmrFile) +{ + // Clear old grid data + clear(); + + mAmrFile = theAmrFile; + + // Create the object for reading the AMR Hierarchy + mAmrGridReader = new AmrGridReader(*mAmrFile); + + GridId currentGridIdx=0; // This is the index of the current grid within the AMR file + std::listallGrids; // List of all AMR Grids + + AMRGrid *newGrid = new AMRGrid(currentGridIdx, this, mAmrGridReader); + while (mAmrGridReader->getGridInfo(*newGrid, currentGridIdx)) { + newGrid->computeValueRange(); + std::cout << "Read grid " << currentGridIdx << std::endl; + // + // This is because the iorigin in the data set isn't always correct.... + newGrid->iorigin[0] = int(newGrid->origin[0]/(newGrid->delta[0])+0.5); + newGrid->iorigin[1] = int(newGrid->origin[1]/(newGrid->delta[1])+0.5); + newGrid->iorigin[2] = int(newGrid->origin[2]/(newGrid->delta[2])+0.5); + // + if (newGrid->level+1>mNoLevels) mNoLevels=newGrid->level+1; + allGrids.push_back(newGrid); + ++currentGridIdx; + newGrid = new AMRGrid(currentGridIdx, this, mAmrGridReader); + } + delete newGrid; // Space allocated for a grid which couldn't be read + + // Create the list of levels + AMRGrid **firstGridInLevel = new AMRGrid*[mNoLevels]; + for (int currLevel=0; currLevel::iterator gridIter; + for (gridIter=allGrids.begin(); gridIter!=allGrids.end(); ++gridIter) { + int level = (*gridIter)->level; + (*gridIter)->mNextGridInLevel = firstGridInLevel[level]; + firstGridInLevel[level] = (*gridIter); + } + + // Create tree/graph structure + for (int currLevel=0; currLevelmNextGridInLevel) { + for (AMRGrid *currPotentialChild=firstGridInLevel[currLevel+1]; + currPotentialChild!=NULL; + currPotentialChild=currPotentialChild->mNextGridInLevel) { + if (currPotentialChild->overlaps(*currParent)) { + currParent->mRefiningGrids.push_back(currPotentialChild); + currPotentialChild->mRefinedGrids.push_back(currParent); + } // if + } // for (currPotentialChild...) + } // for (currParent...) + } // for (currLevel...) + + // Create AMRLevel + mAMRLevel = new AMRLevel*[mNoLevels]; + for (int currLevel=0; currLevelindex() < mNoGrids); + mIndexToGridPtrMap[(*gridIter)->index()] = *gridIter; + } + + mValueRange = mIndexToGridPtrMap[0]->getValueRange(); + for (GridId currGridIdx = 1; currGridIdx < mNoGrids; ++currGridIdx) { + mValueRange.combine(mIndexToGridPtrMap[currGridIdx]->getValueRange()); + } + std::cout << "Value range " << mValueRange.min << " to " << mValueRange.max << std::endl; + + return true; +} + +void AMRHierarchy::clear() +{ + delete mAmrFile; + mAmrFile = NULL; + delete mAmrGridReader; + mAmrGridReader = NULL; + + for (int currLevel=0; currLevel < mNoLevels; ++currLevel) + delete mAMRLevel[currLevel]; + delete[] mAMRLevel; + mAMRLevel = NULL; + mNoLevels = 0; + for (int i=0; i + +// AMR related includes +#include + +class AMRLevel; +class AMRGrid; +class AmrGridReader; + +/* + * Access to the hierarchy of an AMR data set: + * This class is a wrapper to the AMR structures + */ +class AMRHierarchy { + public: + typedef int GridId; + // Read an AMR File in John's IEEE format from disk + bool readIEEEFile(const char *filename); + // Read arbitrary AMR file formats, if a reader is given. This is currently + // only used on readIEEEFile. See that function for details. + bool readFromFile(IObase *theAmrFile); + // Erase hierarchy + void clear(); + // How many levels are in the hierarchy? + int numLevels() const; + // How many grids? + int numGrids() const; + // Each grid in the hierachy has an index 0 <= gridIndex < numGrids(). This + // function allows to get a grid without any regard to its position in the hierarchy. + AMRGrid* getGridByIndex(GridId gridIndex) const; + // Get an AMRLevel object (see corresponding header). This gives access to a list of grids + // of that level. AMRLevel also provides some helper functions, e.g. translating a global + // level index to a pointer to a grid and an index within that grid. + AMRLevel* getLevel(int levelNo) const; + // Gets the value range in the entire hierarchy + const Range &getValueRange() const; + // Create an empty hierarchy object + AMRHierarchy(); + // Clean up. + ~AMRHierarchy(); + private: + friend class AMRGrid; + // Accessing the data on disk: + IObase *mAmrFile; + AmrGridReader *mAmrGridReader; + + // Accessing the data in memory: + int mNoLevels; // Number of levels in hierarchy + int mNoGrids; // Number of grids in hierarchy (all levels!) + AMRLevel **mAMRLevel; // Array 0..mNumLevels-1 of pointers to AMRLevel objects + AMRGrid **mIndexToGridPtrMap; // Array that maps each grid index to a pointer to the corresponding grid + + // Additional Info about grid-data: + Range mValueRange; // Range of values in all grids + + // As seen in Scott Meyer's Effective C++: If you don't want to specify copy constructor + // and assignment operator, make them inaccessible to prevent them from being called accidently. + // NOTE: Even though declared here, they are not defined (causes link error when accidently needed + // within class). + AMRHierarchy(const AMRHierarchy&); // Prevent copying + AMRHierarchy& operator=(const AMRHierarchy&); // Prevent assignment +}; + +#include "AMRHierarchy.icc" + +#endif diff --git a/src/AMRHierLib/AMRHierarchy.icc b/src/AMRHierLib/AMRHierarchy.icc new file mode 100644 index 0000000..0b2e9d8 --- /dev/null +++ b/src/AMRHierLib/AMRHierarchy.icc @@ -0,0 +1,93 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +/* WARNING: This software is EXPERIMENTAL. The authors give no guaranty + * about stability or correctness of the provided source! + * + * Copyright (C) 2001, The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Visualization + * Group at Lawrence Berkeley National Laboratory. + * 4. Neither the name of the University of California, Berkeley nor of the + * Lawrence Berkeley National Laboratory may be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * + * This work is supported by the U. S. Department of Energy under contract + * number DE-AC03-76SF00098 between the U. S. Department of Energy and the + * University of California. + * + * Author: Gunther H Weber + * Lawrence Berkeley National Laboratory + * Berkeley, California + * + * "this software is 100% hand-crafted by a human being in the USA [and Germany :-)]" + * + */ + +inline int AMRHierarchy::numLevels() const +{ + return mNoLevels; +} + +inline int AMRHierarchy::numGrids() const +{ + return mNoGrids; +} + +inline AMRGrid* AMRHierarchy::getGridByIndex(GridId index) const +{ + if (0 <= index && index < mNoGrids) { + return mIndexToGridPtrMap[index]; + } + else + return 0; +} + +inline AMRLevel* AMRHierarchy::getLevel(int levelNo) const +{ + if (0 <= levelNo && levelNo < mNoLevels) { + return mAMRLevel[levelNo]; + } + else { + return 0; + } +} + +inline const Range &AMRHierarchy::getValueRange() const +{ + return mValueRange; +} + diff --git a/src/AMRHierLib/AMRLevel.cc b/src/AMRHierLib/AMRLevel.cc new file mode 100644 index 0000000..bec1631 --- /dev/null +++ b/src/AMRHierLib/AMRLevel.cc @@ -0,0 +1,152 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +/* WARNING: This software is EXPERIMENTAL. The authors give no guaranty + * about stability or correctness of the provided source! + * + * Copyright (C) 2001, The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Visualization + * Group at Lawrence Berkeley National Laboratory. + * 4. Neither the name of the University of California, Berkeley nor of the + * Lawrence Berkeley National Laboratory may be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * + * This work is supported by the U. S. Department of Energy under contract + * number DE-AC03-76SF00098 between the U. S. Department of Energy and the + * University of California. + * + * Author: Gunther H Weber + * Lawrence Berkeley National Laboratory + * Berkeley, California + * + * "this software is 100% hand-crafted by a human being in the USA [and Germany :-)]" + * + */ + +#include + +// Standard C/C++ Includes +#include +#include + +// Own Misc. Helper Includes +#include + +// AMR Related Includes +#include +#include + +AMRLevel::AMRLevel(AMRGrid *firstGridInLevel) : mFirstGridInLevel(firstGridInLevel), mLevelNo(mFirstGridInLevel->level) +{ + // All grids in any given level must have the same spatial- and placement-refinement + // Thus, take these values from the first grid. + mSpatialRefinement[0] = mFirstGridInLevel->spatialrefinement[0]; + mSpatialRefinement[1] = mFirstGridInLevel->spatialrefinement[1]; + mSpatialRefinement[2] = mFirstGridInLevel->spatialrefinement[2]; + mPlacementRefinement[0] = mFirstGridInLevel->gridplacementrefinement[0]; + mPlacementRefinement[1] = mFirstGridInLevel->gridplacementrefinement[1]; + mPlacementRefinement[2] = mFirstGridInLevel->gridplacementrefinement[2]; + +#ifndef NDEBUG + // Perform a sanity check, whether above condition (same refinement ratio + // for all grids in a level) is true. + for (AMRGrid *currGridPtr=mFirstGridInLevel; currGridPtr!=0; currGridPtr=currGridPtr->getNextGridInLevel()) { + assert(mSpatialRefinement[0] == currGridPtr->spatialrefinement[0]); + assert(mSpatialRefinement[1] == currGridPtr->spatialrefinement[1]); + assert(mSpatialRefinement[2] == currGridPtr->spatialrefinement[2]); + assert(mPlacementRefinement[0] == currGridPtr->gridplacementrefinement[0]); + assert(mPlacementRefinement[1] == currGridPtr->gridplacementrefinement[1]); + assert(mPlacementRefinement[2] == currGridPtr->gridplacementrefinement[2]); + } +#endif + + // Check if the assumpution spatialrefinement == gridplacementrefinement holds. We rely + // on this throughout further computations. + assume(mSpatialRefinement[0] == mPlacementRefinement[0]); + assume(mSpatialRefinement[1] == mPlacementRefinement[1]); + assume(mSpatialRefinement[2] == mPlacementRefinement[2]); + + // Build a data structure enabling efficient access to a grid containing a given location + // TODO: Finalize planing of acceleration structure and implement +} + +AMRGridCell AMRLevel::getGridCell(int i, int j, int k) const +{ + for (AMRGrid *currGridPtr=mFirstGridInLevel; currGridPtr!=0; currGridPtr=currGridPtr->getNextGridInLevel()) { + int idx[3]; + idx[0] = i - currGridPtr->iorigin[0]; + idx[1] = j - currGridPtr->iorigin[1]; + idx[2] = k - currGridPtr->iorigin[2]; + if (0 <= idx[0] && idx[0] < currGridPtr->dims[0] && + 0 <= idx[1] && idx[1] < currGridPtr->dims[1] && + 0 <= idx[2] && idx[2] < currGridPtr->dims[2]) { + return AMRGridCell(currGridPtr, idx, AMRGrid::Unknown); // Lazy evaluation + } + } + throw NoGrid(i, j, k); +} + +AMRHierarchy::GridId AMRLevel::getGridId(int i, int j, int k) const +{ + // TODO: Add spatial search structure and make grid lookup more efficient enabling the use + // for really large datasets. + for (AMRGrid *currGridPtr=mFirstGridInLevel; currGridPtr!=0; currGridPtr=currGridPtr->getNextGridInLevel()) { + int idx[3]; + idx[0] = i - currGridPtr->iorigin[0]; + idx[1] = j - currGridPtr->iorigin[1]; + idx[2] = k - currGridPtr->iorigin[2]; + if (0 <= idx[0] && idx[0] < currGridPtr->dims[0] && + 0 <= idx[1] && idx[1] < currGridPtr->dims[1] && + 0 <= idx[2] && idx[2] < currGridPtr->dims[2]) { + return currGridPtr->index(); + } + } + return AMRGrid::NoGrid; +} + +AMRLevel::NoGrid::NoGrid(int i, int j, int k) +{ + mPos[0] = i; + mPos[1] = j; + mPos[2] = k; +} + +std::ostream& operator<<(std::ostream& os, const AMRLevel::NoGrid &ng) +{ + os << "No grid present at (" << ng.mPos[0] << ", " << ng.mPos[1] << ", " << ng.mPos[2] << ")"; + return os; +} diff --git a/src/AMRHierLib/AMRLevel.hh b/src/AMRHierLib/AMRLevel.hh new file mode 100644 index 0000000..eaf7501 --- /dev/null +++ b/src/AMRHierLib/AMRLevel.hh @@ -0,0 +1,169 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +/* + * Copyright (C) 2001, The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Visualization + * Group at Lawrence Berkeley National Laboratory. + * 4. Neither the name of the University of California, Berkeley nor of the + * Lawrence Berkeley National Laboratory may be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * + * This work is supported by the U. S. Department of Energy under contract + * number DE-AC03-76SF00098 between the U. S. Department of Energy and the + * University of California. + * + * Author: Gunther H Weber + * Lawrence Berkeley National Laboratory + * Berkeley, California + * + * "this software is 100% hand-crafted by a human being in the USA [and Germany :-)]" + * + */ + +#ifndef _GHW_AMRLEVEL_HH_ +#define _GHW_AMRLEVEL_HH_ + +// Standard C/C++ Includes +#include + +// Own Misc. Helper Includes +#include + +// AMR Related Includes +#include +#include + +class AMRGrid; + +/** + * One level of an AMR hierarchy. + * Holds one level of the AMR hierarchy and enables queries over an entire + * level rather than single grids. + * + */ +class AMRLevel { + public: + /** + * Construct an AMR level + * Construct an AMR level from a linked list of grids. + * \param firstGridInLevel pointer to the first grid in this level. + * Each grid contains has method getNextGridInLevel() that returns + * the next grid in the level. The list must already be complete when + * this constructor is called. + */ + AMRLevel(AMRGrid *firstGridInLevel); + /** + * Get GridPoint for given position + * Get structure containing pointer to grid containing the given location + * and index of that location within that grid. + * \param i Index along x-Axis within level + * \param j Index along y-Axis within level + * \param k Index along z-Axis within level + * \return Pointer to \see{GridPoint} structure or NULL, if no grid contains + * the given location + */ + AMRGridCell getGridCell(int i, int j, int k) const; + /** + * Get GridPoint for given position + * Get structure containing pointer to grid containing the given location + * and index of that location within that grid. + * \param idx Array containing indices within level + * \return Pointer to \see{GridPoint} structure or NULL, if no grid contains + * the given location + */ + AMRGridCell getGridCell(int idx[3]) const; + /** + * Get index of grid containing absolutes position. + * Gets the index of a grid that contains the position given in level + * coordsinates. + * \param i Index along x-Axis within level + * \param j Index along y-Axis within level + * \param k Index along z-Axis within level + * \return GridId of grid containing that location in the level, or AMRGrid::NoGrid (-1) + * if no grid contains that location. + */ + AMRHierarchy::GridId getGridId(int i, int j, int k) const; + /** + * Get index of grid containing absolutes position. + * Gets the index of a grid that contains the position given in level + * coordsinates. + * \param idx Array containing indicrs within level> + * \return GridId of grid containing that location in the level, or AMRGrid::NoGrid (-1) + * if no grid contains that location. + */ + AMRHierarchy::GridId getGridId(int idx[3]) const; + + /** + * Get pointer to first grid in this level + * Get pointer to first grid in this level. + * \return Pointer to first grid in that level. + */ + AMRGrid* getFirstGrid() const; + + /** + * Get spatial refinement along a given axis. + */ + int getSpatialRefinement(AxisType axis) const; + + /** + * Exception indicating no grid + */ + class NoGrid { + public: + NoGrid(int i, int j, int k); + private: + friend std::ostream& operator<<(std::ostream& os, const AMRLevel::NoGrid &ng); + int mPos[3]; + }; + + private: + // Pointer to the first grid of this level. All grids are + // stored in a linked list. The pointer to the next grid + // in this level is AMRGrid::mNextGridInLevel and can be + // accessed by AMRGrid::getNextGridInLevel. + AMRGrid* mFirstGridInLevel; + // This information is also found in the individual grids. + // It is also stored here for convinience. + int mLevelNo; + int mSpatialRefinement[3]; + int mPlacementRefinement[3]; +}; + +#include + +#endif diff --git a/src/AMRHierLib/AMRLevel.icc b/src/AMRHierLib/AMRLevel.icc new file mode 100644 index 0000000..70951a8 --- /dev/null +++ b/src/AMRHierLib/AMRLevel.icc @@ -0,0 +1,78 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +/* WARNING: This software is EXPERIMENTAL. The authors give no guaranty + * about stability or correctness of the provided source! + * + * Copyright (C) 2001, The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Visualization + * Group at Lawrence Berkeley National Laboratory. + * 4. Neither the name of the University of California, Berkeley nor of the + * Lawrence Berkeley National Laboratory may be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * + * This work is supported by the U. S. Department of Energy under contract + * number DE-AC03-76SF00098 between the U. S. Department of Energy and the + * University of California. + * + * Author: Gunther H Weber + * Lawrence Berkeley National Laboratory + * Berkeley, California + * + * "this software is 100% hand-crafted by a human being in the USA [and Germany :-)]" + * + */ + +inline AMRGrid* AMRLevel::getFirstGrid() const +{ + return mFirstGridInLevel; +} + +inline AMRGridCell AMRLevel::getGridCell(int idx[3]) const +{ + return getGridCell(idx[0], idx[1], idx[2]); +} + +inline AMRHierarchy::GridId AMRLevel::getGridId(int idx[3]) const +{ + return getGridId(idx[0], idx[1], idx[2]); +} + +inline int AMRLevel::getSpatialRefinement(AxisType axis) const +{ + return mSpatialRefinement[axis]; +} diff --git a/src/AMRHierLib/COPYRIGHT b/src/AMRHierLib/COPYRIGHT new file mode 100644 index 0000000..700db96 --- /dev/null +++ b/src/AMRHierLib/COPYRIGHT @@ -0,0 +1,42 @@ +Copyright (C) 2001, The Regents of the University of California. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by the Visualization + Group at Lawrence Berkeley National Laboratory. +4. Neither the name of the University of California, Berkeley nor of the + Lawrence Berkeley National Laboratory may be used to endorse or + promote products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + + +This work is supported by the U. S. Department of Energy under contract +number DE-AC03-76SF00098 between the U. S. Department of Energy and the +University of California. + +Author: Gunther H Weber + Lawrence Berkeley National Laboratory + Berkeley, California + +"this software is 100% hand-crafted by a human being in the USA and Germany" diff --git a/src/AMRHierLib/Makefile b/src/AMRHierLib/Makefile new file mode 100644 index 0000000..ed7714d --- /dev/null +++ b/src/AMRHierLib/Makefile @@ -0,0 +1,138 @@ +#!gmake +# Include common defines + +#Change this to SHARED to build and install shared version +BUILDVERSION = STATIC + +# FlexIO +# Set this to your location of FlexIO +FLEXIO_INCPATH = -I.. +FLEXIO_LIBPATH = -L.. + +# Support Libs +# Set this to your location of the support libs (here: subdirectory Support) +ifneq ($(USE_INSTALLED_SUPPORT_LIBS), 1) +SUPPORT_INCPATH = -ISupport/include +SUPPORT_LIBPATH = -LSupport/lib +endif + +# If needed: System specific LIBPATH. Here: We need to include the lib dir of our custom gcc-3.1.1 installation +SYSTEM_LIBPATH = -Wl,--rpath,/usr/global/packages/languages/gcc-3.1.1/lib + +# Programs +CC = gcc3.1 +CXX = g++3.1 +AR = ar +INSTALL = install +RM = rm + +# Options +OPTFLAGS = -g +#OPTFLAGS = -O2 +SOPOSOPT = -Wl,--rpath -Wl, +AR_CREATEFLAGS = rv + +# Directories +OBJDIR = objLinux + +# Where to install +INSTALLPREFIX = $(HOME)/WorkCVS +INSTALLARCHDEPPREFIX = $(INSTALLPREFIX) +INSTALLBINPATH = $(INSTALLARCHDEPPREFIX)/bin +INSTALLLIBPATH = $(INSTALLARCHDEPPREFIX)/lib-g++3.1 +INSTALLINCPATH = $(INSTALLPREFIX)/include + +ifeq ($(USE_INSTALLED_SUPPORT_LIBS), 1) +INCPATH = -I. -I$(INSTALLINCPATH) $(FLEXIO_INCPATH) +LIBPATH = -L$(INSTALLLIBPATH) $(SOPOSOPT)$(INSTALLLIBPATH) $(FLEXIO_LIBPATH) $(SYSTEM_LIBPATH) +else +INCPATH = -I. $(FLEXIO_INCPATH) $(SUPPORT_INCPATH) -I$(INSTALLINCPATH) +LIBPATH = -L$(INSTALLLIBPATH) $(SOPOSOPT)$(INSTALLLIBPATH) $(FLEXIO_LIBPATH) $(SUPPORT_LIBPATH) $(SYSTEM_LIBPATH) +endif +CPPFLAGS = $(OPTFLAGS) $(INCPATH) -Wall +CXXFLAGS = $(PROJ_CXXFLAGS) + +GeometryLib = -lGeometry +MathLib = -lm +#FlexIOLibs = -lAMR -lieeeio -lhdfio -ldf +FlexIOLibs = -lAMR -lieeeio +AMRHierLib = -lAMRHier + +AMRHLIB_STATIC = libAMRHier.a +AMRHLIB_SHARED = libAMRHier.so +ifeq ($(BUILDVERSION), SHARED) +AMRHLIB = $(AMRHLIB_SHARED) +else +AMRHLIB = $(AMRHLIB_STATIC) +endif +AMRHLIB_SRC.CC = AMRHierarchy.cc AMRGrid.cc AMRLevel.cc AMRGridCell.cc +AMRHLIB_INC = AMRHierarchy.hh AMRHierarchy.icc AMRGrid.hh AMRGrid.icc AMRLevel.hh AMRLevel.icc AMRGridCell.hh AMRGridCell.icc AMRGridStitcher.hh AMRGridStitcher.cc +AMRHLIB_OBJ = $(addprefix $(OBJDIR)/, $(AMRHLIB_SRC.CC:.cc=.o)) + +PAMRH = PrintAMRHier +PAMRH_SRC.CC = PrintAMRHier.cc +PAMRH_OBJ = $(addprefix $(OBJDIR)/, $(PAMRH_SRC.CC:.cc=.o)) +PAMRH_LIBS = $(AMRHierLib) $(FlexIOLibs) $(MathLib) + +WSC = WriteStitchCells +WSC_SRC.CC = WriteStitchCells.cc StitchCellWriter.cc +WSC_OBJ = $(addprefix $(OBJDIR)/, $(WSC_SRC.CC:.cc=.o)) +ifeq ($(USE_INSTALLED_SUPPORT_LIBS), 1) +WSC_LIBS = $(AMRHierLib) $(FlexIOLibs) $(GeometryLib) $(MathLib) +else +WSC_LIBS = $(AMRHierLib) $(FlexIOLibs) $(MathLib) +endif + +VOL2IEEEIO = Vol2IEEEIO +VOL2IEEEIO_SRC.CC= Vol2IEEEIO.cc +VOL2IEEEIO_OBJ = $(addprefix $(OBJDIR)/, $(VOL2IEEEIO_SRC.CC:.cc=.o)) +VOL2IEEEIO_LIBS = $(FlexIOLibs) -lz + +DEPENDENCIES = $(AMRHLIB_OBJ:.o=.d) $(PAMRH_OBJ:.o=.d) $(WDPF_OBJ:.o=.c) + +PROJ_TARGETS = $(AMRHLIB) $(PAMRH) $(WSC) $(VOL2IEEEIO) + +all: $(PROJ_TARGETS) + +# Implicit Rules +$(OBJDIR)/%.o: %.cc + @rm -f $(OBJDIR)/$*.d + $(COMPILE.cc) -Wp,-MD,$(OBJDIR)/$*.P $(OUTPUT_OPTION) $< + @sed -e 's/$*\.o/$(OBJDIR)\/$*.o/g' -e 's/moc_[^.]*\.cc//g' <$(OBJDIR)/$*.P >$(OBJDIR)/$*.d + @rm -f $(OBJDIR)/$*.P + +# Project Rules +$(AMRHLIB_STATIC): $(AMRHLIB_OBJ) + $(AR) $(ARFLAGS) $@ $(AMRHLIB_OBJ) + +$(AMRHLIB_SHARED): $(AMRHLIB_OBJ) + $(CXX) $(OPTFLAGS) -shared $(AMRHLIB_OBJ) $(AMRLib) $(IEEEIOLib) $(MathLib) -o $@ + +$(PAMRH): $(PAMRH_OBJ) $(AMRHLIB) + $(CXX) $(CXXFLAGS) $(PAMRH_OBJ) -L. $(LIBPATH) -o $@ $(PAMRH_LIBS) + +$(WSC): $(WSC_OBJ) $(AMRHLIB) + $(CXX) $(CXXFLAGS) $(WSC_OBJ) -L. $(LIBPATH) -o $@ $(WSC_LIBS) + +$(VOL2IEEEIO): $(VOL2IEEEIO_OBJ) $(AMRHLIB) + $(CXX) $(CXXFLAGS) $(VOL2IEEEIO_OBJ) -L. $(LIBPATH) -o $@ $(VOL2IEEEIO_LIBS) + +install: $(TARGETS) + $(INSTALL) -d $(INSTALLINCPATH) $(INSTALLLIBPATH) + $(INSTALL) -m 644 $(AMRHLIB) $(INSTALLLIBPATH) + $(INSTALL) -m 644 $(AMRHLIB_INC) $(INSTALLINCPATH) + +clean: + $(RM) -rf $(OBJDIR) core Makedepend.$(TARGET_OS) tags + +setup: + mkdir $(OBJDIR) + +distclean: clean + $(RM) -f $(PROJ_TARGETS) + +ifeq ($(CXX), g++) +sinclude $(DEPENDENCIES) +else +sinclude Makedepend.$(TARGET_OS) +endif diff --git a/src/AMRHierLib/PrintAMRHier.cc b/src/AMRHierLib/PrintAMRHier.cc new file mode 100644 index 0000000..7201d05 --- /dev/null +++ b/src/AMRHierLib/PrintAMRHier.cc @@ -0,0 +1,24 @@ +#include +#include "AMRHierarchy.hh" +#include "AMRLevel.hh" +#include "AMRGrid.hh" + +int main(int argc, char *argv[]) +{ + AMRHierarchy theAMRHier; + + if (argc!=2) { + std::cerr << "Usage: " << argv[0] << " " << std::endl; + return 27; + } + + if (!theAMRHier.readIEEEFile(argv[1])) { + std::cerr << "Could not read AMR file " << argv[1] << std::endl; + } + + for (int levelNo=0; levelNogetFirstGrid(); currGridPtr != 0; currGridPtr = currGridPtr->getNextGridInLevel()) + currGridPtr->printInfo(std::cout); + } +} diff --git a/src/AMRHierLib/README b/src/AMRHierLib/README new file mode 100644 index 0000000..011d37d --- /dev/null +++ b/src/AMRHierLib/README @@ -0,0 +1,28 @@ +These classes are intended to give a higher level access to AMR hierarchies in +FlexIO format. Unfortunately they grew as I just became accustomed to the AMR +format and still contain provisions due to some initial misconceptions on my +part (i.e. trying to handle incompletely refined grid cells being the severest +example). They were left in the library because they sometimes come in handy +when experimenting with AMR data (e.g. throwing away boundary cells for higher +order interpolation, etc.). Ultimately they should be discarded. + +All this is work in progress and still needs to be tweaked to work. It was +sufficient to generate the images in the papers I wrote, but I may have broken +one thing or the other when I made changes. So take these sources as they are +and expect some problems when using them. + +The grid stitching code can be found in AMRGridStitcher.hh and AMRGridStitcher.cc. +WriteStitchCells.cc and StitchCellWriter.hh, StitchCellWriter.cc is an example +for using it to write the stitch cells to a file. A description of the grid +stitching can be found in: + +Weber, G.H., Kreylos, O., Ligocki, T.J., Shalf, J.M., Hagen, H., Hamann, B. +and Joy, K.I. (2002), "Extraction of crack-free isosurfaces from adaptive +mesh refinement data," to appear in: Farin, G., Hagen, H. and Hamann, B., +eds., Hierarchical and Geometrical Methods in Scientific Visualization, +Springer-Verlag, Heidelberg, Germany. + +A pdf version of the paper is available at +http://graphics.cs.ucdavis.edu/~hamann/WeberKreylosLigockiShalfHagenHamannJoy2002.pdf + +Gunther H Weber (weber@informatik.uni-kl.de) diff --git a/src/AMRHierLib/StitchCellWriter.cc b/src/AMRHierLib/StitchCellWriter.cc new file mode 100644 index 0000000..3f86dae --- /dev/null +++ b/src/AMRHierLib/StitchCellWriter.cc @@ -0,0 +1,188 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +#include "StitchCellWriter.hh" + +// Standard C/C++ Includes +#include + +// Own Misc. Helper Includes +#include + +// AMR Includes +#include +#include +#include + +StitchCellWriter::StitchCellWriter(const AMRHierarchy& amrHier, const char* baseFilename, int maxLevel) + : mMaxLevel(maxLevel), + mGridStartPointIdx(new int[amrHier.numGrids()+1]), + mPositionStream((std::string(baseFilename) + std::string(".pts")).c_str()), + mValueStream((std::string(baseFilename) + std::string(".vals")).c_str()), + mNumPoints(0), + mTetStream((std::string(baseFilename) + std::string(".tets")).c_str()), + mNumTets(0), + mPyramidStream((std::string(baseFilename) + std::string(".pyramids")).c_str()), + mNumPyramids(0), + mTrianglePrismStream((std::string(baseFilename) + std::string(".triangleprisms")).c_str()), + mNumTrianglePrisms(0), + mHexahedronStream((std::string(baseFilename) + std::string(".hexahedra")).c_str()), + mNumHexahedra(0) +{ + // Write 0 as number of points, tets, ... + // Destructor seeks back and writes actual numbers when they are known (no more points, + // tets, ...) added + BinStream::binaryOut(mPositionStream, mNumPoints); + BinStream::binaryOut(mTetStream, mNumTets); + BinStream::binaryOut(mPyramidStream, mNumPyramids); + BinStream::binaryOut(mTrianglePrismStream, mNumTrianglePrisms); + BinStream::binaryOut(mHexahedronStream, mNumHexahedra); + + mGridStartPointIdx[0] = 0; + for (int currGridIdx=0; currGridIdx < amrHier.numGrids(); ++currGridIdx) { + AMRGrid *currGrid = amrHier.getGridByIndex(currGridIdx); + + if (currGrid->level > mMaxLevel) { + // Skip grid + std::cout << "Skipping grid " << currGrid->index() << ", level " << currGrid->level << " > " << mMaxLevel << std::endl; + mGridStartPointIdx[currGridIdx+1] = mGridStartPointIdx[currGridIdx]; + } + else { + currGrid->loadCells(); + // Write data points + Vertex pos; + int i, j, k; + OutputFPType out; + // (i, j, k) -> mGridStartPointIdx[gridIdx] + (k * dims[1] + j) * dims[0] + i + for (k=0, pos.z = currGrid->origin[2]+0.5*currGrid->delta[2]; k < currGrid->dims[2]; ++k, pos.z += currGrid->delta[2]) + for (j=0, pos.y = currGrid->origin[1]+0.5*currGrid->delta[1]; j < currGrid->dims[1]; ++j, pos.y += currGrid->delta[1]) + for (i=0, pos.x = currGrid->origin[0]+0.5*currGrid->delta[0]; i < currGrid->dims[0]; ++i, pos.x += currGrid->delta[0]) { + out = pos.x; BinStream::binaryOut(mPositionStream, out); + out = pos.y; BinStream::binaryOut(mPositionStream, out); + out = pos.z; BinStream::binaryOut(mPositionStream, out); + out = currGrid->getValue(i, j, k); BinStream::binaryOut(mValueStream, out); + } + int numPointsThisGrid = currGrid->dims[0]*currGrid->dims[1]*currGrid->dims[2]; + mGridStartPointIdx[currGridIdx+1] = mGridStartPointIdx[currGridIdx] + numPointsThisGrid; + mNumPoints += numPointsThisGrid; + + AMRGrid::IntersectionMap *intersectionMap = currGrid->computeIntersectionMap(AMRGrid::IntersectionMap::RefinedCells); + // Write dual grid + for (i=0; idims[0]-1; ++i) + for (j=0; jdims[1]-1; ++j) + for (k=0; kdims[2]-1; ++k) + if (((*intersectionMap)(i , j , k ) == -1) && ((*intersectionMap)(i , j , k+1) == -1) && + ((*intersectionMap)(i , j+1, k ) == -1) && ((*intersectionMap)(i , j+1, k+1) == -1) && + ((*intersectionMap)(i+1, j , k ) == -1) && ((*intersectionMap)(i+1, j , k+1) == -1) && + ((*intersectionMap)(i+1, j+1, k ) == -1) && ((*intersectionMap)(i+1, j+1, k+1) == -1) + || currGrid->level == maxLevel) + handleHexahedronCell( + AMRGridCell(currGrid, i , j , k ), + AMRGridCell(currGrid, i+1, j , k ), + AMRGridCell(currGrid, i+1, j+1, k ), + AMRGridCell(currGrid, i , j+1, k ), + AMRGridCell(currGrid, i , j , k+1), + AMRGridCell(currGrid, i+1, j , k+1), + AMRGridCell(currGrid, i+1, j+1, k+1), + AMRGridCell(currGrid, i , j+1, k+1) + ); + delete intersectionMap; + } + } +} + +StitchCellWriter::~StitchCellWriter() +{ + // Write actual number of points, tets, ... + mPositionStream.seekp(0); + BinStream::binaryOut(mPositionStream, mNumPoints); + std::cout << "Wrote " << mNumPoints << " positions and values." << std::endl; + mTetStream.seekp(0); + BinStream::binaryOut(mTetStream, mNumTets); + std::cout << "Wrote " << mNumTets << " tetrahedra." << std::endl; + mPyramidStream.seekp(0); + BinStream::binaryOut(mPyramidStream, mNumPyramids); + std::cout << "Wrote " << mNumPyramids << " pyramids." << std::endl; + mTrianglePrismStream.seekp(0); + BinStream::binaryOut(mTrianglePrismStream, mNumTrianglePrisms); + std::cout << "Wrote " << mNumTrianglePrisms << " triangle prisms." << std::endl; + mHexahedronStream.seekp(0); + BinStream::binaryOut(mHexahedronStream, mNumHexahedra); + std::cout << "Wrote " << mNumHexahedra << " hexahedra." << std::endl; +} + +void StitchCellWriter::handleTetrahedronCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const Vertex& p3, double v3) +{ + // Adapt vertex ordering to Nelson Max's ordering scheme + BinStream::binaryOut(mTetStream, pointIdxForGridCell(c0)); + BinStream::binaryOut(mTetStream, pointIdxForGridCell(c2)); + BinStream::binaryOut(mTetStream, pointIdxForGridCell(c1)); + BinStream::binaryOut(mTetStream, addPoint(p3, v3)); + ++mNumTets; +} + +void StitchCellWriter::handleTetrahedronCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3) +{ + // Adapt vertex ordering to Nelson Max's ordering scheme + BinStream::binaryOut(mTetStream, pointIdxForGridCell(c0)); + BinStream::binaryOut(mTetStream, pointIdxForGridCell(c2)); + BinStream::binaryOut(mTetStream, pointIdxForGridCell(c1)); + BinStream::binaryOut(mTetStream, pointIdxForGridCell(c3)); + ++mNumTets; +} + +void StitchCellWriter::handlePyramidCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3, const Vertex& p4, double v4) +{ + // Adapt vertex ordering to Nelson Max's ordering scheme + BinStream::binaryOut(mPyramidStream, pointIdxForGridCell(c0)); + BinStream::binaryOut(mPyramidStream, pointIdxForGridCell(c1)); + BinStream::binaryOut(mPyramidStream, pointIdxForGridCell(c2)); + BinStream::binaryOut(mPyramidStream, pointIdxForGridCell(c3)); + BinStream::binaryOut(mPyramidStream, addPoint(p4, v4)); + ++mNumPyramids; +} + +void StitchCellWriter::handlePyramidCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3, const AMRGridCell& c4) +{ + // Adapt vertex ordering to Nelson Max's ordering scheme + BinStream::binaryOut(mPyramidStream, pointIdxForGridCell(c0)); + BinStream::binaryOut(mPyramidStream, pointIdxForGridCell(c1)); + BinStream::binaryOut(mPyramidStream, pointIdxForGridCell(c2)); + BinStream::binaryOut(mPyramidStream, pointIdxForGridCell(c3)); + BinStream::binaryOut(mPyramidStream, pointIdxForGridCell(c4)); + ++mNumPyramids; +} + +void StitchCellWriter::handleTrianglePrismCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3, const AMRGridCell& c4, const AMRGridCell& c5) +{ + // Adapt vertex ordering to Nelson Max's ordering scheme + BinStream::binaryOut(mTrianglePrismStream, pointIdxForGridCell(c1)); + BinStream::binaryOut(mTrianglePrismStream, pointIdxForGridCell(c2)); + BinStream::binaryOut(mTrianglePrismStream, pointIdxForGridCell(c3)); + BinStream::binaryOut(mTrianglePrismStream, pointIdxForGridCell(c0)); + BinStream::binaryOut(mTrianglePrismStream, pointIdxForGridCell(c4)); + BinStream::binaryOut(mTrianglePrismStream, pointIdxForGridCell(c5)); + ++mNumTrianglePrisms; +} + +void StitchCellWriter::handleHexahedronCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3, const AMRGridCell& c4, const AMRGridCell& c5, const AMRGridCell& c6, const AMRGridCell& c7) +{ + // Adapt vertex ordering to Nelson Max's ordering scheme + BinStream::binaryOut(mHexahedronStream, pointIdxForGridCell(c7)); + BinStream::binaryOut(mHexahedronStream, pointIdxForGridCell(c6)); + BinStream::binaryOut(mHexahedronStream, pointIdxForGridCell(c2)); + BinStream::binaryOut(mHexahedronStream, pointIdxForGridCell(c1)); + BinStream::binaryOut(mHexahedronStream, pointIdxForGridCell(c4)); + BinStream::binaryOut(mHexahedronStream, pointIdxForGridCell(c5)); + BinStream::binaryOut(mHexahedronStream, pointIdxForGridCell(c3)); + BinStream::binaryOut(mHexahedronStream, pointIdxForGridCell(c0)); + ++mNumHexahedra; +} diff --git a/src/AMRHierLib/StitchCellWriter.hh b/src/AMRHierLib/StitchCellWriter.hh new file mode 100644 index 0000000..d19ce93 --- /dev/null +++ b/src/AMRHierLib/StitchCellWriter.hh @@ -0,0 +1,111 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +/* + * Copyright (C) 2001, The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the Visualization + * Group at Lawrence Berkeley National Laboratory. + * 4. Neither the name of the University of California, Berkeley nor of the + * Lawrence Berkeley National Laboratory may be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * + * This work is supported by the U. S. Department of Energy under contract + * number DE-AC03-76SF00098 between the U. S. Department of Energy and the + * University of California. + * + * Author: Gunther H Weber + * Lawrence Berkeley National Laboratory + * Berkeley, California + * + * "this software is 100% hand-crafted by a human being in the USA and Germany" + * + */ + +#ifndef _GHW_STITCHCELLWRITER_HH_ +#define _GHW_STITCHCELLWRITER_HH_ + +// Standard C/C++ Includes +#include + +// Own Helper Includes +#include + +// AMR Related Includes +#include +#include + +// A StitchCellCollector that writes all stitch cells to files +class StitchCellWriter { + public: + // Construction/Destruction + StitchCellWriter(const AMRHierarchy& amrHier, const char* baseFilename, int maxLevel); + ~StitchCellWriter(); + + // Cell Types + void handleTetrahedronCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const Vertex& p3, double v3); + void handleTetrahedronCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3); + void handlePyramidCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3, const Vertex& p4, double v4); + void handlePyramidCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3, const AMRGridCell& c4); + void handleTrianglePrismCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3, const AMRGridCell& c4, const AMRGridCell& c5); + void handleHexahedronCell(const AMRGridCell& c0, const AMRGridCell& c1, const AMRGridCell& c2, const AMRGridCell& c3, const AMRGridCell& c4, const AMRGridCell& c5, const AMRGridCell& c6, const AMRGridCell& c7); + private: + // Private Types + typedef float OutputFPType; + + // Private Memeber Functions + int pointIdxForGridCell(const AMRGridCell& c); + int addPoint(const Vertex& p, double v); + + // Private Data Members + int mMaxLevel; + int *mGridStartPointIdx; + std::ofstream mPositionStream; + std::ofstream mValueStream; + int mNumPoints; + std::ofstream mTetStream; + int mNumTets; + std::ofstream mPyramidStream; + int mNumPyramids; + std::ofstream mTrianglePrismStream; + int mNumTrianglePrisms; + std::ofstream mHexahedronStream; + int mNumHexahedra; +}; + +#include "StitchCellWriter.icc" + +#endif diff --git a/src/AMRHierLib/StitchCellWriter.icc b/src/AMRHierLib/StitchCellWriter.icc new file mode 100644 index 0000000..d91ec06 --- /dev/null +++ b/src/AMRHierLib/StitchCellWriter.icc @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +inline int StitchCellWriter::pointIdxForGridCell(const AMRGridCell& gc) +{ + // (i, j, k) -> mGridStartPointIdx[gridIdx] + (k * dims[1] + j) * dims[0] + i + AMRGrid *g = gc.grid(); + return mGridStartPointIdx[g->index()] + (gc.idx(zAxis) * g->dims[1] + gc.idx(yAxis)) * g->dims[0] + gc.idx(xAxis); +} + +inline int StitchCellWriter::addPoint(const Vertex& p, double v) +{ + OutputFPType out = p.x; BinStream::binaryOut(mPositionStream, out); + out = p.y; BinStream::binaryOut(mPositionStream, out); + out = p.z; BinStream::binaryOut(mPositionStream, out); + out = v; BinStream::binaryOut(mValueStream, out); + return mNumPoints++; +} diff --git a/src/AMRHierLib/Vol2IEEEIO.cc b/src/AMRHierLib/Vol2IEEEIO.cc new file mode 100644 index 0000000..6247eb9 --- /dev/null +++ b/src/AMRHierLib/Vol2IEEEIO.cc @@ -0,0 +1,66 @@ +//------------------------------------------------------------------------------ +// +// Project: AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +#include +#include +#include +#include +#include + +int main(int argc, char* argv[]) +{ + if (argc!=3) { + std::cerr << "Usage: " << argv[0] << " " << std::endl; + return 42; + } + + gzFile in; + if ((in = gzopen(argv[1], "rb"))) { + int dims[3]; + double delta[3]; + bool success = true; + success = success && gzread(in, &dims[0], sizeof(int)) == sizeof(int); + success = success && gzread(in, &dims[1], sizeof(int)) == sizeof(int); + success = success && gzread(in, &dims[2], sizeof(int)) == sizeof(int); + success = success && gzread(in, &delta[0], sizeof(double)) == sizeof(double); + success = success && gzread(in, &delta[1], sizeof(double)) == sizeof(double); + success = success && gzread(in, &delta[2], sizeof(double)) == sizeof(double); + if (success) { + unsigned char* bytedata = new unsigned char[dims[0]*dims[1]*dims[2]]; + if (gzread(in, bytedata, dims[0]*dims[1]*dims[2]*sizeof(unsigned char)) == dims[0]*dims[1]*dims[2]*sizeof(unsigned char)) { + float *data = new float[dims[0]*dims[1]*dims[2]]; + for (int i=0; iwrite(IObase::Float32, rank, dims, data); + double origin[3] = {0.0, 0.0, 0.0}; + writer->writeAttribute("origin", IObase::Float64,3,origin); + writer->writeAttribute("min_ext", IObase::Float64,3,origin); + double maxExt[3] = {(dims[0]+1)*delta[0],(dims[1]+1)*delta[1],(dims[2]+1)*delta[2]}; + writer->writeAttribute("max_ext", IObase::Float64,3,maxExt); + int level = 0; + writer->writeAttribute("level", IObase::Int32, 1, &level); + writer->writeAttribute("delta", IObase::Float64, 3, delta); + int refine[3] = { 1, 1, 1 }; + writer->writeAttribute("spatial_refinement", IObase::Int32, 3, refine); + writer->writeAttribute("grid_placement_refinement", IObase::Int32, 3, refine); + int iorigin[3] = { 0, 0, 0 }; + writer->writeAttribute("iorigin", IObase::Int32,3,iorigin); + delete data; + delete writer; + } + delete bytedata; + } + gzclose(in); + } +} diff --git a/src/AMRHierLib/VtxOrder.fig b/src/AMRHierLib/VtxOrder.fig new file mode 100644 index 0000000..e37d6e6 --- /dev/null +++ b/src/AMRHierLib/VtxOrder.fig @@ -0,0 +1,137 @@ +#FIG 3.2 +Landscape +Center +Inches +Letter +100.00 +Single +-2 +1200 2 +6 375 3225 3975 5850 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 1650 4950 75 75 1650 4950 1725 4950 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 450 5475 75 75 450 5475 525 5475 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 2550 5475 75 75 2550 5475 2625 5475 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 3750 4950 75 75 3750 4950 3825 4950 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 2400 3675 75 75 2400 3675 2475 3675 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 3752 4954 2552 5479 +2 1 0 1 0 7 50 0 -1 4.000 0 0 7 0 0 2 + 450 5475 2475 5475 +2 1 0 1 0 0 50 0 20 4.000 0 0 -1 0 0 2 + 450 5475 2400 3675 +2 1 0 1 0 0 50 0 20 4.000 0 0 -1 0 0 2 + 2400 3675 2550 5475 +2 1 0 1 0 0 50 0 20 4.000 0 0 -1 0 0 2 + 2400 3675 3750 4950 +2 1 1 1 0 0 50 0 20 4.000 0 0 7 0 0 2 + 1650 4950 450 5475 +2 1 1 1 0 0 50 0 20 4.000 0 0 7 0 0 2 + 1725 4950 3750 4950 +2 1 1 1 0 0 50 0 20 4.000 0 0 7 0 0 2 + 2400 3675 1650 4950 +4 0 0 50 0 0 24 0.0000 4 255 180 1725 5250 0\001 +4 0 0 50 0 0 24 0.0000 4 255 180 450 5850 1\001 +4 0 0 50 0 0 24 0.0000 4 255 180 2550 5850 2\001 +4 0 0 50 0 0 24 0.0000 4 255 180 3750 5325 3\001 +4 0 0 50 0 0 24 0.0000 4 255 180 2325 3525 4\001 +-6 +6 4800 3075 7200 5700 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 6075 4800 75 75 6075 4800 6150 4800 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 4875 5325 75 75 4875 5325 4950 5325 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 6975 5325 75 75 6975 5325 7050 5325 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 5925 3525 75 75 5925 3525 6000 3525 +2 1 0 1 0 7 50 0 -1 4.000 0 0 7 0 0 2 + 4875 5325 6900 5325 +2 1 0 1 0 0 50 0 20 4.000 0 0 -1 0 0 2 + 4875 5325 5925 3525 +2 1 0 1 0 0 50 0 20 4.000 0 0 -1 0 0 2 + 5925 3525 6975 5325 +2 1 1 1 0 0 50 0 20 4.000 0 0 7 0 0 2 + 6075 4800 4875 5325 +2 1 1 1 0 0 50 0 20 4.000 0 0 7 0 0 2 + 5925 3525 6075 4800 +2 1 1 1 0 0 50 0 20 4.000 0 0 -1 0 0 2 + 6075 4800 6975 5325 +4 0 0 50 0 0 24 0.0000 4 255 180 4875 5700 1\001 +4 0 0 50 0 0 24 0.0000 4 255 180 6975 5700 2\001 +4 0 0 50 0 0 24 0.0000 4 255 180 5850 3375 3\001 +4 0 0 50 0 0 24 0.0000 4 255 180 6150 4725 0\001 +-6 +6 3750 3075 5025 4500 +2 1 0 1 0 0 50 0 20 4.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 4050 3975 4725 3975 +2 1 0 1 0 0 50 0 20 4.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 4125 4125 4125 3375 +2 1 0 1 0 0 50 0 20 4.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 4200 3900 3900 4275 +4 0 0 50 0 0 24 0.0000 4 180 195 4800 4050 x\001 +4 0 0 50 0 0 24 0.0000 4 255 165 4125 3300 y\001 +4 0 0 50 0 0 24 0.0000 4 180 150 3750 4500 z\001 +-6 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 750 2550 75 75 750 2550 825 2550 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 2850 2550 75 75 2850 2550 2925 2550 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 3975 2025 75 75 3975 2025 4050 2025 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 1950 2025 75 75 1950 2025 2025 2025 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 750 675 75 75 750 675 825 675 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 1950 150 75 75 1950 150 2025 150 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 4050 150 75 75 4050 150 4125 150 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 2850 675 75 75 2850 675 2925 675 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 5475 525 75 75 5475 525 5550 525 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 7575 525 75 75 7575 525 7650 525 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 6075 1950 75 75 6075 1950 6150 1950 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 4875 2475 75 75 4875 2475 4950 2475 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 6975 2475 75 75 6975 2475 7050 2475 +1 3 0 1 0 0 50 0 20 4.000 1 0.0000 8175 1950 75 75 8175 1950 8250 1950 +2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5 + 750 675 2850 675 2850 2550 750 2550 750 675 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 750 675 1950 150 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 2849 658 4049 133 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 2859 2541 4059 2016 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 4035 2025 4035 150 +2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 2 + 4020 150 1905 150 +2 1 1 1 0 7 50 0 -1 4.000 0 0 7 0 0 2 + 1950 2025 4035 2025 +2 1 1 1 0 7 50 0 -1 4.000 0 0 7 0 0 2 + 1920 135 1920 1995 +2 1 1 1 0 7 50 0 -1 4.000 0 0 7 0 0 2 + 744 2541 1944 2016 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 8177 1954 6977 2479 +2 1 0 1 0 7 50 0 -1 4.000 0 0 7 0 0 2 + 4875 2475 6900 2475 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 4875 2475 5475 525 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 6975 2475 7575 525 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 7578 524 8178 1949 +2 1 0 1 0 7 50 0 -1 4.000 0 0 -1 0 0 2 + 5475 525 7575 525 +2 1 1 1 0 0 50 0 20 4.000 0 0 7 0 0 2 + 6150 1950 8175 1950 +2 1 1 1 0 0 50 0 20 4.000 0 0 7 0 0 2 + 6075 1950 4875 2475 +2 1 1 1 0 0 50 0 20 4.000 0 0 7 0 0 2 + 5475 525 6075 1950 +4 0 0 50 0 0 24 0.0000 4 255 180 1950 2400 0\001 +4 0 0 50 0 0 24 0.0000 4 255 180 3975 2400 1\001 +4 0 0 50 0 0 24 0.0000 4 255 180 4125 525 2\001 +4 0 0 50 0 0 24 0.0000 4 255 180 2025 525 3\001 +4 0 0 50 0 0 24 0.0000 4 255 180 525 2925 4\001 +4 0 0 50 0 0 24 0.0000 4 255 180 2700 2925 5\001 +4 0 0 50 0 0 24 0.0000 4 255 180 2925 1050 6\001 +4 0 0 50 0 0 24 0.0000 4 255 180 825 1050 7\001 +4 0 0 50 0 0 24 0.0000 4 255 180 6150 2250 0\001 +4 0 0 50 0 0 24 0.0000 4 255 180 4875 2850 1\001 +4 0 0 50 0 0 24 0.0000 4 255 180 6975 2850 2\001 +4 0 0 50 0 0 24 0.0000 4 255 180 8175 2325 3\001 +4 0 0 50 0 0 24 0.0000 4 255 180 7500 375 5\001 +4 0 0 50 0 0 24 0.0000 4 255 180 5400 375 4\001 diff --git a/src/AMRHierLib/VtxOrder.pdf b/src/AMRHierLib/VtxOrder.pdf new file mode 100644 index 0000000..a2584cc Binary files /dev/null and b/src/AMRHierLib/VtxOrder.pdf differ diff --git a/src/AMRHierLib/WriteStitchCells.cc b/src/AMRHierLib/WriteStitchCells.cc new file mode 100644 index 0000000..0becef4 --- /dev/null +++ b/src/AMRHierLib/WriteStitchCells.cc @@ -0,0 +1,53 @@ +//------------------------------------------------------------------------------ +// +// Project: Tools for AMR Visualization +// Module: $RCSfile$ +// Language: C++ +// Date: $Date$ +// Author: $Author$ +// Version: $Revision$ +// +//------------------------------------------------------------------------------ + +// Standard C/C++ Includes +#include +#include + +// AMR Related Includes +#include +#include +#include + +// Project specific Includes +#include "StitchCellWriter.hh" + +int main(int argc, char* argv[]) +{ + if (argc != 4) { + std::cerr << "Usage: " << argv[0] << " " << std::endl; + return 42; + } + AMRHierarchy theAMRHier; + theAMRHier.readIEEEFile(argv[1]); + int maxLevel = std::min(atoi(argv[3]) - 1, theAMRHier.numLevels() - 1);; + StitchCellWriter writer(theAMRHier, argv[2], maxLevel); + + if (maxLevel > 0) { + for (int currLevelNo = 1; currLevelNo < maxLevel; ++currLevelNo) + { + std::cout << "Start level " << currLevelNo << std::endl; + AMRLevel *currLevel = theAMRHier.getLevel(currLevelNo); + for (AMRGrid *currGridPtr = currLevel->getFirstGrid(); currGridPtr != 0; currGridPtr = currGridPtr->getNextGridInLevel()) { + std::cout << "Stitching grid #" << currGridPtr->index() << std::endl; + AMRGridStitcher gridStitcher(writer, theAMRHier, currGridPtr, true); + gridStitcher.generateStitchCells(); + } + } + AMRLevel *lastLevel = theAMRHier.getLevel(maxLevel); + for (AMRGrid *currGridPtr = lastLevel->getFirstGrid(); currGridPtr != 0; currGridPtr = currGridPtr->getNextGridInLevel()) { + std::cout << "Stitching grid #" << currGridPtr->index() << std::endl; + AMRGridStitcher gridStitcher(writer, theAMRHier, currGridPtr, false); + gridStitcher.generateStitchCells(); + } + } +} diff --git a/src/AMRPlus/AMRPlusConv.C b/src/AMRPlus/AMRPlusConv.C index 7785342..4d1c137 100644 --- a/src/AMRPlus/AMRPlusConv.C +++ b/src/AMRPlus/AMRPlusConv.C @@ -71,9 +71,9 @@ int main(int argc, char** argv) { FlexArray levmask; int lcnt=numlev, tflag=2, tstep=0; double t1, t2, tdiff=0, finetimeref=1.0; - int ts1; + int ts1,ii; levmask.setSize(numlev); - for(int ii=0;iiscal)?range[1]:scal; + } + } break; + case IObase::Float64:{ + long nscal=g.nbytes/sizeof(double); + double *scalars=(double *)g.data; + + range[0]=range[1]=scalars[0]; + for (int ii=1;iiscal)?range[1]:scal; + } + } break; + default: + cout<<"Data type is not float or double."<. +# Please send patches to . +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break + fi + done + rm -f $dummy.c $dummy.o $dummy.rel + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i?86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + cat >$dummy.c < /* for printf() prototype */ +int main (int argc, char *argv[]) { +#else +int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __MIPSEB__ + printf ("%s-unknown-linux-gnu\n", argv[1]); +#endif +#ifdef __MIPSEL__ + printf ("%sel-unknown-linux-gnu\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + ;; + ppc:Linux:*:*) + # Determine Lib Version + cat >$dummy.c < +#if defined(__GLIBC__) +extern char __libc_version[]; +extern char __libc_release[]; +#endif +main(argc, argv) + int argc; + char *argv[]; +{ +#if defined(__GLIBC__) + printf("%s %s\n", __libc_version, __libc_release); +#else + printf("unknown\n"); +#endif + return 0; +} +EOF + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then LIBC="libc1" ; fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} + exit 0 ;; + alpha:Linux:*:*) + cat <$dummy.s + .data + \$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + .text + .globl main + .align 4 + .ent main + main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + LIBC="" + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) UNAME_MACHINE="alpha" ;; + 1-0) UNAME_MACHINE="alphaev5" ;; + 1-1) UNAME_MACHINE="alphaev56" ;; + 1-101) UNAME_MACHINE="alphapca56" ;; + 2-303) UNAME_MACHINE="alphaev6" ;; + 2-307) UNAME_MACHINE="alphaev67" ;; + esac + objdump --private-headers $dummy | \ + grep ld.so.1 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i?86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_supported_emulations=`cd /; ld --help 2>&1 \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + i?86linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 + ;; + elf_i?86) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + i?86coff) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 + ;; + esac + # Either a pre-BFD a.out linker (linux-gnuoldld) + # or one that does not give us useful --help. + # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. + # If ld does not provide *any* "supported emulations:" + # that means it is gnuoldld. + test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + case "${UNAME_MACHINE}" in + i?86) + VENDOR=pc; + ;; + *) + VENDOR=unknown; + ;; + esac + # Determine whether the default compiler is a.out or elf + cat >$dummy.c < +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; +# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +# are messed up and put the nodename in both sysname and nodename. + i?86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i?86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i?86:*:5:7*) + # Fixed at (any) Pentium or better + UNAME_MACHINE=i586 + if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then + echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i?86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i?86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/AMRPlus/config.h.in b/src/AMRPlus/config.h.in new file mode 100644 index 0000000..14713dc --- /dev/null +++ b/src/AMRPlus/config.h.in @@ -0,0 +1,3 @@ +#undef OPENGL +#undef WITH_HDF4 +#undef WITH_HDF5 diff --git a/src/AMRPlus/config.sub b/src/AMRPlus/config.sub new file mode 100755 index 0000000..adf6cf7 --- /dev/null +++ b/src/AMRPlus/config.sub @@ -0,0 +1,1367 @@ +#! /bin/sh +# +# CCTK_MODIFICATION: 11/5/2001 Added info for sx5-nec. Tom Goodale +# +# +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-03-09' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ + | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ + | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | hppa64 \ + | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ + | alphaev6[78] \ + | we32k | ns16k | clipper | i370 | sh | sh[34] \ + | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp10 | pdp11 \ + | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ + | thumb | d10v | d30v | fr30 | avr | openrisc) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i[234567]86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ + | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ + | hppa2.0n-* | hppa64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ + | alphaev6[78]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ + | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ + | [cjt]90-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ + | bs2000-* | tic54x-* | c54x-* | x86_64-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [cjt]90) + basic_machine=${basic_machine}-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[34567]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[34567]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[34567]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[34567]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4) + basic_machine=sh-unknown + ;; + sparc | sparcv9) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-nec) + basic_machine=sx5-nec + os=-superux + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i[34567]86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -superux) + os=-superux + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/AMRPlus/configure b/src/AMRPlus/configure new file mode 100755 index 0000000..71bf6b0 --- /dev/null +++ b/src/AMRPlus/configure @@ -0,0 +1,1450 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help +--with-mips3 put this in if you want mips3 -n32 set to no if you want mips4 -64" +ac_help="$ac_help +--with-mips3 put this in if you want mips3 -n32 set to no if you want mips4 -64" +ac_help="$ac_help +--with-ieeeio Provide path to your IEEEIO installation" +ac_help="$ac_help +--with-hdf4 Provide path to your hdf4 installation" +ac_help="$ac_help +--with-hdf5 Provide path to your hdf5 installation" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file= + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:562: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:584: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:613: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:643: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:694: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:726: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 737 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:768: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:773: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:801: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:837: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CXX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX="$ac_cv_prog_CXX" +if test -n "$CXX"; then + echo "$ac_t""$CXX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$CXX" && break +done +test -n "$CXX" || CXX="gcc" + + +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:869: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 + +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +cat > conftest.$ac_ext << EOF + +#line 880 "configure" +#include "confdefs.h" + +int main(){return(0);} +EOF +if { (eval echo configure:885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cxx_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cxx_cross=no + else + ac_cv_prog_cxx_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cxx_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 +if test $ac_cv_prog_cxx_works = no; then + { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:911: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 +cross_compiling=$ac_cv_prog_cxx_cross + +echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 +echo "configure:916: checking whether we are using GNU C++" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.C <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gxx=yes +else + ac_cv_prog_gxx=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gxx" 1>&6 + +if test $ac_cv_prog_gxx = yes; then + GXX=yes +else + GXX= +fi + +ac_test_CXXFLAGS="${CXXFLAGS+set}" +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS= +echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 +echo "configure:944: checking whether ${CXX-g++} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_cxx_g=yes +else + ac_cv_prog_cxx_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS="$ac_save_CXXFLAGS" +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi + +for ac_prog in ar +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:980: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$AR" in + /*) + ac_cv_path_AR="$AR" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_AR="$AR" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_AR="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +AR="$ac_cv_path_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$AR" && break +done + + + +case "$host" in +*linux*) + ARCH_FLAGS="" + XTRALIBS='-lpthread' + GLLIBS="-lGL" + XLIBS="-L/usr/X11R6/lib -lXext -lXt -lX11 -lm";; +*darwin*) + ARCH_FLAGS="" + XTRALIBS='-lpthread' + GLLIBS="-lGL" + XLIBS="-L/usr/X11R6/lib -lXext -lXt -lX11 -lm";; +*irix*) + IRIX_CPU=`hinv -t cpu` + case "$IRIX_CPU" in + *4???*) + echo 4 + ARCH_FLAGS="-mips3 -n32 -c -float" ;; + *8???*) + echo 8 + ARCH_FLAGS="-mips3 -n32 -c -float" ;; + *10???*) + echo 10 + # Check whether --with-mips3 or --without-mips3 was given. +if test "${with_mips3+set}" = set; then + withval="$with_mips3" + + if test "$withval" = no ; then + ARCH_FLAGS="-mips4 -r10000 -64 -IPA -LNO -c -float" ; + else + ARCH_FLAGS="-mips3 -n32 -c -float" ; + fi + + +fi +;; + *12???*) + echo 12 + # Check whether --with-mips3 or --without-mips3 was given. +if test "${with_mips3+set}" = set; then + withval="$with_mips3" + + if test "$withval" = no ; then + ARCH_FLAGS="-mips4 -r12000 -64 -IPA -LNO -c -float" ; + else + ARCH_FLAGS="-mips3 -n32 -c -float" ; + fi + + +fi +;; + *) + echo whatever + ARCH_FLAGS="-mips3 -n32 -c -float" ;; + esac + + XTRALIBS="" + GLLIBS="-lGL" + XLIBS="-lXext -lXt -lX11 -lm";; +*) + echo "operating system type not recognized" + exit 1;; +esac + + + + +DEBUG_FLAGS="-g" + + + + +cat >> confdefs.h <<\EOF +#define OPENGL 1 +EOF + + +# Check whether --with-ieeeio or --without-ieeeio was given. +if test "${with_ieeeio+set}" = set; then + withval="$with_ieeeio" + +if test -n "$withval" ; then + IEEEHOME="$withval" + IEEEINCLUDE='-I$(IEEEHOME)/include' + IEEELIB='-L$(IEEEHOME)/lib -lAMR -lhlio -lieeeio' +else + IEEEHOME="" + IEEEINCLUDE="" + IEEELIB="" +fi + + +fi + + + +# Check whether --with-hdf4 or --without-hdf4 was given. +if test "${with_hdf4+set}" = set; then + withval="$with_hdf4" + +if test -n "$withval" ; then + cat >> confdefs.h <<\EOF +#define WITH_HDF4 1 +EOF + + HDFHOME="$withval" + HDFINCLUDE='-I$(HDFHOME)/include' + HDFLIB='-L$(HDFHOME)/lib -lhdfio -lmfhdf -ldf -ljpeg -lz' +else + HDFHOME="" + HDFINCLUDE="" + HDFLIB="" +fi + + +fi + + + +# Check whether --with-hdf5 or --without-hdf5 was given. +if test "${with_hdf5+set}" = set; then + withval="$with_hdf5" + +if test -n "$withval" ; then + cat >> confdefs.h <<\EOF +#define WITH_HDF5 1 +EOF + + H5HOME="$withval" + H5INCLUDE='-I$(H5HOME)/include' + H5LIB='-L$(H5HOME)/lib -lh5io -lhdf5' +else + H5HOME="" + H5INCLUDE="" + H5LIB="" +fi + + +fi + + + + + + + + + + + + + + + + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir + +trap 'rm -fr `echo "makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@CXX@%$CXX%g +s%@AR@%$AR%g +s%@XTRALIBS@%$XTRALIBS%g +s%@GLLIBS@%$GLLIBS%g +s%@DEBUG_FLAGS@%$DEBUG_FLAGS%g +s%@ARCH_FLAGS@%$ARCH_FLAGS%g +s%@IEEEHOME@%$IEEEHOME%g +s%@IEEEINCLUDE@%$IEEEINCLUDE%g +s%@IEEELIB@%$IEEELIB%g +s%@HDFHOME@%$HDFHOME%g +s%@HDFINCLUDE@%$HDFINCLUDE%g +s%@HDFLIB@%$HDFLIB%g +s%@H5HOME@%$H5HOME%g +s%@H5INCLUDE@%$H5INCLUDE%g +s%@H5LIB@%$H5LIB%g +s%@XLIBS@%$XLIBS%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + + + + diff --git a/src/AMRPlus/configure.in b/src/AMRPlus/configure.in new file mode 100644 index 0000000..f48eb48 --- /dev/null +++ b/src/AMRPlus/configure.in @@ -0,0 +1,143 @@ +AC_INIT() + +AC_CANONICAL_HOST + +AC_PROG_MAKE_SET +AC_PROG_CC +AC_PROG_CXX +AC_PATH_PROGS(AR,ar) + + +case "$host" in +*linux*) + ARCH_FLAGS="" + XTRALIBS='-lpthread' + GLLIBS="-lGL" + XLIBS="-L/usr/X11R6/lib -lXext -lXt -lX11 -lm";; +*darwin*) + ARCH_FLAGS="" + XTRALIBS='-lpthread' + GLLIBS="-lGL" + XLIBS="-L/usr/X11R6/lib -lXext -lXt -lX11 -lm";; +*irix*) + IRIX_CPU=`hinv -t cpu` + case "$IRIX_CPU" in + *4???*) + echo 4 + ARCH_FLAGS="-mips3 -n32 -c -float" ;; + *8???*) + echo 8 + ARCH_FLAGS="-mips3 -n32 -c -float" ;; + *10???*) + echo 10 + AC_ARG_WITH(mips3, --with-mips3 put this in if you want mips3 -n32 set to no if you want mips4 -64, + [ + if test "$withval" = no ; then + ARCH_FLAGS="-mips4 -r10000 -64 -IPA -LNO -c -float" ; + else + ARCH_FLAGS="-mips3 -n32 -c -float" ; + fi + ] + );; + *12???*) + echo 12 + AC_ARG_WITH(mips3, --with-mips3 put this in if you want mips3 -n32 set to no if you want mips4 -64, + [ + if test "$withval" = no ; then + ARCH_FLAGS="-mips4 -r12000 -64 -IPA -LNO -c -float" ; + else + ARCH_FLAGS="-mips3 -n32 -c -float" ; + fi + ] + );; + *) + echo whatever + ARCH_FLAGS="-mips3 -n32 -c -float" ;; + esac + + XTRALIBS="" + GLLIBS="-lGL" + XLIBS="-lXext -lXt -lX11 -lm";; +*) + echo "operating system type not recognized" + exit 1;; +esac + +AC_SUBST(XTRALIBS) +AC_SUBST(GLLIBS) + +DEBUG_FLAGS="-g" + +AC_SUBST(DEBUG_FLAGS) +AC_SUBST(ARCH_FLAGS) + +AC_DEFINE(OPENGL) + +AC_ARG_WITH(ieeeio, --with-ieeeio Provide path to your IEEEIO installation, +[ +if test -n "$withval" ; then + IEEEHOME="$withval" + IEEEINCLUDE='-I$(IEEEHOME)/include' + IEEELIB='-L$(IEEEHOME)/lib -lAMR -lhlio -lieeeio' +else + IEEEHOME="" + IEEEINCLUDE="" + IEEELIB="" +fi +] +) + + +AC_ARG_WITH(hdf4, --with-hdf4 Provide path to your hdf4 installation, +[ +if test -n "$withval" ; then + AC_DEFINE(WITH_HDF4) + HDFHOME="$withval" + HDFINCLUDE='-I$(HDFHOME)/include' + HDFLIB='-L$(HDFHOME)/lib -lhdfio -lmfhdf -ldf -ljpeg -lz' +else + HDFHOME="" + HDFINCLUDE="" + HDFLIB="" +fi +] +) + + +AC_ARG_WITH(hdf5, --with-hdf5 Provide path to your hdf5 installation, +[ +if test -n "$withval" ; then + AC_DEFINE(WITH_HDF5) + H5HOME="$withval" + H5INCLUDE='-I$(H5HOME)/include' + H5LIB='-L$(H5HOME)/lib -lh5io -lhdf5' +else + H5HOME="" + H5INCLUDE="" + H5LIB="" +fi +] +) + +AC_SUBST(IEEEHOME) +AC_SUBST(IEEEINCLUDE) +AC_SUBST(IEEELIB) + +AC_SUBST(HDFHOME) +AC_SUBST(HDFINCLUDE) +AC_SUBST(HDFLIB) + +AC_SUBST(H5HOME) +AC_SUBST(H5INCLUDE) +AC_SUBST(H5LIB) + + + +AC_SUBST(XLIBS) + + +AC_OUTPUT(makefile) + + + + diff --git a/src/AMRPlus/install-sh b/src/AMRPlus/install-sh new file mode 100755 index 0000000..e9de238 --- /dev/null +++ b/src/AMRPlus/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/src/AMRPlus/libAMRPlus.a b/src/AMRPlus/libAMRPlus.a new file mode 100644 index 0000000..b25e7c5 Binary files /dev/null and b/src/AMRPlus/libAMRPlus.a differ diff --git a/src/AMRPlus/makefile b/src/AMRPlus/makefile index 56b24de..5cbb309 100644 --- a/src/AMRPlus/makefile +++ b/src/AMRPlus/makefile @@ -1,45 +1,55 @@ +CC = cc +CPP = @CPP@ +CXX = c++ +AR = /usr/bin/ar + +DEBUG_FLAGS = -g +ARCH_FLAGS = + +IEEEHOME = /usr/local/apps/FlexIO +HDFHOME = /usr/local/apps/HDF4.1r4 +H5HOME = /usr/local/apps/hdf5 + +ALL_INC = -I$(IEEEHOME)/include -I$(HDFHOME)/include -I$(H5HOME)/include + +CFLAGS = $(DEBUG_FLAGS) $(ARCH_FLAGS) -DOPENGL=1 -DWITH_HDF4=1 -DWITH_HDF5=1 +COMP_FLAGS = $(DEBUG_FLAGS) +CXXFLAGS = $(CFLAGS) + +LIBS = -L. -L$(IEEEHOME)/lib -lAMR -lhlio -lieeeio -L$(HDFHOME)/lib -lhdfio -lmfhdf -ldf -ljpeg -lz -L$(H5HOME)/lib -lh5io -lhdf5 -L/usr/X11R6/lib -lXext -lXt -lX11 -lm -lGL -lpthread + + SRCS= \ AMRwriterPlus.C \ AMRgridreaderPlus.C \ AMRfilereaderPlus.C \ flexset.C \ AMRreaderPlus.C - + OBJS = $(SRCS:.C=.o) -DEPEND = Dpndfile +#DEPEND = Dpndfile #################### SHELL = /bin/sh -IEEE_ROOT=/nfs/zeus/lcascr1/mahall/AmrProject/FlexIO - - -ALL_INC = -I$(IEEE_ROOT)/include -I$(HDF_ROOT)/include - -DEFS = -CC = cc -#COMP_FLAGS = -n32 -mips4 -LNO -IPA -Ofast -COMP_FLAGS = -64 -mips4 -g - -CFLAGS = -c -float ${COMP_FLAGS} -DOPENGL \ - -I$(IEEE_ROOT)/include \ - -DVTK21 $(VTKINCD) -noinline -woff 1681-1682,3322 -CXXFLAGS = ${CFLAGS} +AMRwriterPlus.o: AMRwriterPlus.C + $(CXX) $(CXXFLAGS) $(ALL_INC) -c AMRwriterPlus.C +AMRgridreaderPlus.o: AMRgridreaderPlus.C + $(CXX) $(CXXFLAGS) $(ALL_INC) -c AMRgridreaderPlus.C -LINK = ${CPP} -LIBS = -L$(IEEE_ROOT)/lib -L$(HDF_ROOT)/lib -L. \ - -lhlio -lieeeio -lAMR \ - -lX11 -lm \ - -lGL -lICE -lXt +AMRfilereaderPlus.o: AMRfilereaderPlus.C + $(CXX) $(CXXFLAGS) $(ALL_INC) -c AMRfilereaderPlus.C -.C: $@.o ${OBJS} - $(CXX) ${COMP_FLAGS} -o $@ \ - ${OBJS} $@.o $(LIBS) +flexset.o: flexset.C + $(CXX) $(CXXFLAGS) $(ALL_INC) -c flexset.C +AMRreaderPlus.o: AMRreaderPlus.C + $(CXX) $(CXXFLAGS) $(ALL_INC) -c AMRreaderPlus.C -include $(DEPEND) +AMRPlusConv.o: AMRPlusConv.C + $(CXX) $(CXXFLAGS) $(ALL_INC) -c AMRPlusConv.C AMRPlusConv: AMRPlusConv.o libAMRPlus.a $(CXX) ${COMP_FLAGS} -o $@ \ @@ -53,17 +63,18 @@ readtest: readtest.o libAMRPlus.a $(CXX) ${COMP_FLAGS} -o $@ \ $@.o -lAMRPlus $(LIBS) -filereadtest:filereadtest.o libAMRPlus.a +filereadtest:filereadtest.o libAMRPlus.a $(CXX) ${COMP_FLAGS} -o $@ \ $@.o -lAMRPlus $(LIBS) + libAMRPlus.a: ${OBJS} rm -f libAMRPlus ar r libAMRPlus.a ${OBJS} -dep: $(SRCS) - CC -M ${ALL_INC} $(SRCS) readtest.C > $(DEPEND) - smake +#dep: $(SRCS) +# gcc -M ${ALL_INC} $(SRCS) readtest.C > $(DEPEND) +# gmake clean: diff --git a/src/AMRPlus/makefile.in b/src/AMRPlus/makefile.in new file mode 100644 index 0000000..00e67eb --- /dev/null +++ b/src/AMRPlus/makefile.in @@ -0,0 +1,81 @@ +CC = @CC@ +CPP = @CPP@ +CXX = @CXX@ +AR = @AR@ + +DEBUG_FLAGS = @DEBUG_FLAGS@ +ARCH_FLAGS = @ARCH_FLAGS@ + +IEEEHOME = @IEEEHOME@ +HDFHOME = @HDFHOME@ +H5HOME = @H5HOME@ + +ALL_INC = @IEEEINCLUDE@ @HDFINCLUDE@ @H5INCLUDE@ + +CFLAGS = $(DEBUG_FLAGS) $(ARCH_FLAGS) @DEFS@ +COMP_FLAGS = $(DEBUG_FLAGS) +CXXFLAGS = $(CFLAGS) + +LIBS = -L. @IEEELIB@ @HDFLIB@ @H5LIB@ @XLIBS@ @GLLIBS@ @XTRALIBS@ + + +SRCS= \ + AMRwriterPlus.C \ + AMRgridreaderPlus.C \ + AMRfilereaderPlus.C \ + flexset.C \ + AMRreaderPlus.C + +OBJS = $(SRCS:.C=.o) +#DEPEND = Dpndfile +#################### + +SHELL = /bin/sh + + +AMRwriterPlus.o: AMRwriterPlus.C + $(CXX) $(CXXFLAGS) $(ALL_INC) -c AMRwriterPlus.C + +AMRgridreaderPlus.o: AMRgridreaderPlus.C + $(CXX) $(CXXFLAGS) $(ALL_INC) -c AMRgridreaderPlus.C + +AMRfilereaderPlus.o: AMRfilereaderPlus.C + $(CXX) $(CXXFLAGS) $(ALL_INC) -c AMRfilereaderPlus.C + +flexset.o: flexset.C + $(CXX) $(CXXFLAGS) $(ALL_INC) -c flexset.C + +AMRreaderPlus.o: AMRreaderPlus.C + $(CXX) $(CXXFLAGS) $(ALL_INC) -c AMRreaderPlus.C + +AMRPlusConv.o: AMRPlusConv.C + $(CXX) $(CXXFLAGS) $(ALL_INC) -c AMRPlusConv.C + +AMRPlusConv: AMRPlusConv.o libAMRPlus.a + $(CXX) ${COMP_FLAGS} -o $@ \ + $@.o -lAMRPlus $(LIBS) + +gridreadtest: gridreadtest.o libAMRPlus.a + $(CXX) ${COMP_FLAGS} -o $@ \ + $@.o -lAMRPlus $(LIBS) + +readtest: readtest.o libAMRPlus.a + $(CXX) ${COMP_FLAGS} -o $@ \ + $@.o -lAMRPlus $(LIBS) + +filereadtest:filereadtest.o libAMRPlus.a + $(CXX) ${COMP_FLAGS} -o $@ \ + $@.o -lAMRPlus $(LIBS) + + +libAMRPlus.a: ${OBJS} + rm -f libAMRPlus + ar r libAMRPlus.a ${OBJS} + +#dep: $(SRCS) +# gcc -M ${ALL_INC} $(SRCS) readtest.C > $(DEPEND) +# gmake + + +clean: + rm *.o diff --git a/src/AmrFileReader.hh b/src/AmrFileReader.hh index a771ca7..f8cdbe0 100644 --- a/src/AmrFileReader.hh +++ b/src/AmrFileReader.hh @@ -31,6 +31,7 @@ public: int getActiveIndex(int ii){ return activeGrids[ii];} int getNumLevels(){ return maxlevel+1; } void getTimeRange(int &min,int &max){ + printf("This mintime,maxtime=%d:%d\n",mintime,maxtime); min=mintime; max=maxtime; } diff --git a/src/Arch.h b/src/Arch.h index e6b5bcd..c3ad325 100644 --- a/src/Arch.h +++ b/src/Arch.h @@ -7,6 +7,10 @@ #define PROTO(x) () #endif +#ifdef sgi +#define SGI +#endif + #if defined(SGI) || defined(CM5) || defined (DEC) #define F77NAME(a,b,c) a #else diff --git a/src/GNUmakefile b/src/GNUmakefile index b9fcc49..92ce0fc 100644 --- a/src/GNUmakefile +++ b/src/GNUmakefile @@ -4,9 +4,17 @@ # # http://amira.zib.de/make/ # -# $Revision: 1.1.1.1 $ -# $Date: 2000-09-13 13:49:09 $ +# $Revision: 1.2 $ +# $Date: 2004-08-30 16:55:16 $ # $Log: not supported by cvs2svn $ +# Revision 1.6 2003/07/16 14:46:47 werner +# Adjusted flags to make optional use of an external HDF5Open call, which is +# bundled into an `hdf5wrap' library. It is used in the context of Amira to +# enable globus/remote HDF5 for an existing binary without recompiling. +# +# Revision 1.5 2003/02/13 21:14:49 werner +# Adjusted makefile to new Amira CVS structure. Doesn't influence anyone else. +# # Revision 1.4 2000/05/29 14:06:11 werner # Using VPATH instead of PWD is much saver. # @@ -53,10 +61,14 @@ RULEFILE = $(shell if [ -r $(VPATH)../GNUmakefile.rules ] ; then echo $(VPATH).. include $(RULEFILE) CXXFLAGS += $(hdf5_FLAGS) $(hdf4_FLAGS) -I$(VPATH)./ -LIBS += $(hdf5_LIB) $(hdf4_LIB) -lm +LIBS += $(hdf5_LIB) $(hdf4_LIB) -lm $(hdf5wrap_LIB) # # Add a variable to the makefile configuration # +ifdef AMIRA_NUMREL +TARGET_FLAGS=-I$$(MAKE_LOCAL)/src/numrel/FlexIO -I$$(MAKE_ROOT)/src/numrel/FlexIO $(hdf5_FLAGS) $(hdf4_FLAGS) +else TARGET_FLAGS=-I$$(MAKE_LOCAL)/external/FlexIO -I$$(MAKE_ROOT)/external/FlexIO $(hdf5_FLAGS) $(hdf4_FLAGS) +endif diff --git a/src/H5IO.cc b/src/H5IO.cc index 117b17d..e457f99 100644 --- a/src/H5IO.cc +++ b/src/H5IO.cc @@ -5,6 +5,10 @@ #include "H5IO.hh" +#ifdef WITH_HDF5WRAP +#include +#endif + hid_t H5IO::DataType2H5(IObase::DataType nt){ switch(nt){ case Int8: @@ -37,14 +41,14 @@ hid_t H5IO::DataType2H5(IObase::DataType nt){ } } -IObase::DataType H5IO::H5DataType2DataType(hid_t nt){ +IObase::DataType H5IO::H5DataType2DataType(hid_t nt){ H5T_class_t typeclass; size_t typesize; - + typeclass = H5Tget_class(nt); typesize = H5Tget_size(nt); //fprintf(stderr,"class=%d size=%d\n",typeclass,typesize); - + switch(typeclass){ case H5T_INTEGER: // printf("Int %d bytes\n",typesize); @@ -98,7 +102,7 @@ IObase::DataType H5IO::H5DataType2DataType(hid_t nt){ case H5T_OPAQUE: puts("Cannot convert type Opaque"); break; - case H5T_COMPOUND: + case H5T_COMPOUND: default: puts("Cannot convert type Unknown"); break; @@ -136,7 +140,7 @@ IObase::DataType H5IO::H52DataType(hid_t &nt){ fprintf(stderr,"H5IO::H52DataType(): Don't recognize type %d\n",(int)nt); return Error; } -#endif +#endif int H5IO::createdataspace(int rank,CONST int *dims){ if(dataspacevalid && rankf==(hsize_t) rank){ // lets compare dims @@ -170,8 +174,8 @@ int H5IO::createdatatype(IObase::DataType dt){ int H5IO::selectdataset(int i){ // printf("datasetvalid=%u i=%d index=%d nitems=%d\n",datasetvalid,i,index,nitems); - - if(index==i && datasetvalid) + + if(index==i && datasetvalid) return index; index=i; if(index>=nitems) index=nitems-1; @@ -201,23 +205,23 @@ int H5IO::selectdataset(int i){ } herr_t H5IOcounter(hid_t group_id, - const char *member_name, - void *operator_data){ + const char *member_name, + void *operator_data){ int *count = (int*)operator_data; /* typedef struct H5G_stat_t { unsigned long fileno[2]; - unsigned long objno[2]; - unsigned nlink; - int type; - time_t mtime; + unsigned long objno[2]; + unsigned nlink; + int type; + time_t mtime; size_t linklen; } H5G_stat_t */ H5G_stat_t objinfo; // request info about the type of objects in root group - if(H5Gget_objinfo(group_id, - member_name, - 1 /* follow links */, - &objinfo)<0) { + if(H5Gget_objinfo(group_id, + member_name, + 1 /* follow links */, + &objinfo)<0) { //fprintf(stderr,"\tcounter: Bad Info [%s] count=%u\n",member_name,*count); return 0; // error (probably bad symlink) } @@ -247,7 +251,7 @@ herr_t H5IOgetname(hid_t group_id, 1 /* follow links */, &objinfo)<0) return 0; // error (probably bad symlink) // only count objects that are datasets (not subgroups) - if(objinfo.type!=H5G_DATASET) + if(objinfo.type!=H5G_DATASET) return 0; // do not increment count if it isn't a dataset. if(getn->index==getn->count){ strcpy(getn->name,member_name); @@ -355,7 +359,16 @@ H5IO::H5IO(CONST char *fname,AccessMode access):IObase(fname,access),filevalid(0 nitems = 0; switch(accessmode){ case Read: +#ifdef WITH_HDF5WRAP + { +hid_t proplist = H5Pcreate (H5P_FILE_ACCESS); + HDF5Open(filename, proplist); + file = H5Fopen(filename, H5F_ACC_RDONLY, proplist); + H5Pclose (proplist); + } +#else file=H5Fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT); +#endif if (file >= 0) nitems = getndatasets(); break; case Write: @@ -402,7 +415,7 @@ int H5IO::write(IObase::DataType typeID,int rank,CONST int *dims,const void *dat //} int H5IO::readInfo(char *name,IObase::DataType &typeID,int &rank,int *dims,int maxdims){ - + // name shouls be attribute "long_name"); if(hasread){ //printf("hasread=1, so get next dataset index %u\n",index+1); @@ -494,7 +507,7 @@ int H5IO::readAnnotation(int number,char *annotation,int maxlen){ #endif if(maxlen>30) sprintf(annotation,"not-implemented"); - else if(annotation) + else if(annotation) *annotation=0; return 1; } @@ -505,7 +518,7 @@ int H5IO::nAnnotations(){ select(index); int32 ref=SDidtoref(sid); if(DFANgetlablen(filename,DFTAG_NDG,ref)<=0) return 0; // no labels found - return 1; // always 1 annotation per object limit for H5 is appears + return 1; // always 1 annotation per object limit for H5 is appears #endif return 0; } @@ -515,6 +528,15 @@ int H5IO::writeAttribute(CONST char *name,IObase::DataType typeID,Long length,co selectdataset(index); // make sure it is selected //printf("\tindex=%u\n",index); // create a datashape +#if 0 + hsize_t dimsa[2]={0,0}; + dimsa[0]=length; + hid_t shape = H5Screate_simple(1, dimsa, NULL); + hid_t attrib = H5Acreate(dataset,name,DataType2H5(typeID),shape,H5P_DEFAULT); + H5Awrite(attrib, DataType2H5(typeID), const_cast(data) ); + H5Aclose(attrib); + H5Sclose(shape); +#else hid_t datatype = DataType2H5(typeID); int is_string = datatype == H5T_NATIVE_CHAR; if (is_string) @@ -535,6 +557,7 @@ int H5IO::writeAttribute(CONST char *name,IObase::DataType typeID,Long length,co { H5Tclose (datatype); } +#endif return 1; } @@ -544,6 +567,19 @@ int H5IO::readAttributeInfo(int number,char *name,IObase::DataType &typeID,Long hid_t atype = H5Aget_type(attrib); hid_t ashape = H5Aget_space(attrib); H5Aget_name(attrib,maxnamelen,name); +#if 0 + /* hsize_t ranka = */ H5Sget_simple_extent_ndims(ashape); + // rank should always be 1; + hsize_t dimsa[5]={0,0,0,0,0},ndimsa=0,npointsa; + if(H5Sget_simple_extent_dims(ashape,dimsa,NULL)<0) dimsa[0]=0; + ndimsa=H5Sget_simple_extent_ndims(ashape); + npointsa=H5Sget_simple_extent_npoints(ashape); + // fprintf(stderr,"dimsa[0]=%d ndimsa=%d npoints=%u\n",dimsa[0],ndimsa,npointsa); + typeID = H5DataType2DataType(atype); + if(typeID==Char8 && dimsa[0]==0) // special case for strings + dimsa[0] = H5Tget_size(atype); + nelem = dimsa[0]; // single-dimensional array for attributes +#else // rank should always be 0 for scalars and 1 for arrays; hsize_t arank = H5Sget_simple_extent_ndims(ashape); hsize_t adims; @@ -558,7 +594,7 @@ int H5IO::readAttributeInfo(int number,char *name,IObase::DataType &typeID,Long { nelem = H5Tget_size(atype); } - +#endif H5Tclose(atype); H5Sclose(ashape); H5Aclose(attrib); @@ -574,7 +610,7 @@ herr_t H5IOattr_name2index(hid_t group_id, void *operator_data){ H5IOatt_name2index_t *s=(H5IOatt_name2index_t*)operator_data; s->count++; - if(!strcmp(member_name,s->name)) + if(!strcmp(member_name,s->name)) return s->count; else{ return 0; @@ -602,21 +638,15 @@ int H5IO::readAttributeInfo(CONST char *name,IObase::DataType &typeID,Long &nele hid_t attrib = H5Aopen_name(dataset,name); hid_t atype = H5Aget_type(attrib); hid_t ashape = H5Aget_space(attrib); - // rank should always be 0 for scalars and 1 for arrays; - hsize_t arank = H5Sget_simple_extent_ndims(ashape); - hsize_t adims; - if ((arank != 0 && arank != 1) || - H5Sget_simple_extent_dims (ashape, &adims, NULL) < 0) - { - return (0); - } + /* hsize_t ranka = */ H5Sget_simple_extent_ndims(ashape); + // rank should always be 1; + hsize_t dimsa[5]; + H5Sget_simple_extent_dims(ashape,dimsa,NULL); typeID = H5DataType2DataType(atype); - nelem = arank ? adims : 1; // single-dimensional array for attributes - if (H5Tget_class (atype) == H5T_STRING) - { - nelem = H5Tget_size(atype); - } - + if(typeID==Char8 && dimsa[0]==0) // special case for strings + dimsa[0] = H5Tget_size(atype); + nelem = dimsa[0]; // single-dimensional array for attributes + H5Tclose(atype); H5Sclose(ashape); H5Aclose(attrib); @@ -655,7 +685,7 @@ int H5IO::reserveChunk(IObase::DataType typeID,int rank,CONST int *dims){ create(rank,dims,typeID); current_rank=rank; return 1; -#endif +#endif return 1; } @@ -703,7 +733,7 @@ Long8 f_h5_open (char *file,char *accessname,int flen,int alen){ return 0; } IObase *fid=new H5IO(file,mode); - if(fid->isValid()) + if(fid->isValid()) return (Long8)fid; else delete fid; // file open failed diff --git a/src/HDFIO.cc b/src/HDFIO.cc index afae3f9..0cb31a1 100644 --- a/src/HDFIO.cc +++ b/src/HDFIO.cc @@ -118,7 +118,7 @@ HDFIO::~HDFIO(){ int HDFIO::isValid() { if(fid>=0) return 1; else return 0; } -int HDFIO::write(IObase::DataType typeID,int rank,CONST int *dims,const void *data){ +int HDFIO::write(IObase::DataType typeID,int rank,CONST int *dims,CONST void *data){ int32 origin[5]={0,0,0,0,0}; int32 stride[5]={1,1,1,1,1}; // kludge... we'll fix later int32 hdims[5]={0,0,0,0,0}; @@ -212,7 +212,7 @@ int HDFIO::nAnnotations(){ return 1; // always 1 annotation per object limit for HDF is appears } -int HDFIO::writeAttribute(CONST char *name,IObase::DataType typeID,Long length,const void *data){ +int HDFIO::writeAttribute(CONST char *name,IObase::DataType typeID,Long length,CONST void *data){ select(index); // select if not already selected //printf("write attrib: sdsid=%u index=%u\n",sid,index); return (int)SDsetattr(sid,(char*)name,DataType2HDF(typeID),(int32)length,data); @@ -261,7 +261,7 @@ int HDFIO::reserveChunk(IObase::DataType typeID,int rank,CONST int *dims){ return 1; } -int HDFIO::writeChunk(CONST int *dims,CONST int *origin,const void *data){ +int HDFIO::writeChunk(CONST int *dims,CONST int *origin,CONST void *data){ int32 horigin[5]={0,0,0,0,0}; int32 stride[5]={1,1,1,1,1}; // kludge... we'll fix later int32 hdims[5]={0,0,0,0,0}; @@ -314,7 +314,7 @@ int HDFIO::readDim(int dimnumber, void *dim){ return 1; } -int HDFIO::writeDim(int dimnumber,IObase::DataType datatype,int length,const void *dim){ +int HDFIO::writeDim(int dimnumber,IObase::DataType datatype,int length,CONST void *dim){ if(sid<0) return -1; int32 dim_id = SDgetdimid(sid,dimnumber); if(dim_id<0) return -1; diff --git a/src/IOspeed.cc b/src/IOspeed.cc index a0003e4..832e82c 100644 --- a/src/IOspeed.cc +++ b/src/IOspeed.cc @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -8,6 +9,7 @@ #include "IO.hh" #include "IEEEIO.hh" #include "HDFIO.hh" +#include "H5IO.hh" #include "FlexArrayTmpl.H" #define f_openf77 F77NAME(openf77_,openf77,OPENF77) @@ -57,15 +59,22 @@ void ResultRecordList::append(ResultRecord &rec){ average_results.megs_per_second = (average_results.megs_per_second*nrecs+rec.megs_per_second)/(nrecs+1); } -void main(int argc,char *argv[]){ - double data[64*64*64]; - int dims[3]={64,64,64}; +double ComputeRealTime(timeval &etmv,timeval &stmv){ + double t = (double)(etmv.tv_sec-stmv.tv_sec); + double mt = (double)(etmv.tv_usec - stmv.tv_usec); + mt /= 1000000.0L; + return t+mt; +} + +int main(int argc,char *argv[]){ + double *data; + int dims[3]={128,128,128}; int i,nds; int ntests; struct tms stms,etms; struct timeval stmv,etmv; double srt,ert; - ResultRecordList ieeeio_results,f77_results,hdf_results; + ResultRecordList ieeeio_results,f77_results,hdf_results,h5_results; if(argc>1){ ntests=atoi(argv[1]); @@ -74,6 +83,11 @@ void main(int argc,char *argv[]){ else { ntests=1; } + data = new double[dims[0]*dims[1]*dims[2]]; + if(!data){ + perror("malloc failed"); + exit(0); + } for(int tst=0;tst "); times(&stms); - gettimeofday(&stmv); + gettimeofday(&stmv,0); IObase *file = new IEEEIO("speed.raw",IObase::Write); fprintf(stderr,"Write %2u datasets:",nds); for(int n=0;nwrite(IObase::Float64,3,dims,data); } delete file; - gettimeofday(&etmv); + gettimeofday(&etmv,0); times(&etms); // times after close to account for buffer flushing puts(""); - ert=(double)etmv.tv_sec + (double)etmv.tv_usec/1000000.0L; - srt=(double)stmv.tv_sec + (double)stmv.tv_usec/1000000.0L; - results.realtime = ert-srt; + results.realtime = ComputeRealTime(etmv,stmv); results.usertime = (float)(etms.tms_utime-stms.tms_utime)/CLK_TCK; results.systemtime = (float)(etms.tms_stime-stms.tms_stime)/CLK_TCK; results.combined = (float)(etms.tms_utime-stms.tms_utime+ @@ -104,11 +116,11 @@ void main(int argc,char *argv[]){ results.nbytes = (float)(nds*IObase::nBytes(IObase::Float64,3,dims)); ieeeio_results.append(results); } - puts("--------------HDF---------------"); + puts("--------------HDF4--------------"); for(i=0,nds=5;i<8;i++,nds+=5){ fprintf(stderr,"HDF "); times(&stms); - gettimeofday(&stmv); + gettimeofday(&stmv,0); IObase *file = new HDFIO("speed.hdf",IObase::Write); fprintf(stderr,"Write %2u datasets:",nds); for(int n=0;nwrite(IObase::Float64,3,dims,data); } delete file; - gettimeofday(&etmv); + gettimeofday(&etmv,0); times(&etms); // times after close to account for buffer flushing puts(""); - ert=(double)etmv.tv_sec + (double)etmv.tv_usec/1000000.0L; - srt=(double)stmv.tv_sec + (double)stmv.tv_usec/1000000.0L; - results.realtime = ert-srt; + results.realtime = ComputeRealTime(etmv,stmv); results.usertime = (float)(etms.tms_utime-stms.tms_utime)/CLK_TCK; results.systemtime = (float)(etms.tms_stime-stms.tms_stime)/CLK_TCK; results.combined = (float)(etms.tms_utime-stms.tms_utime+ @@ -129,11 +139,36 @@ void main(int argc,char *argv[]){ results.nbytes = (float)(nds*IObase::nBytes(IObase::Float64,3,dims)); hdf_results.append(results); } + puts("--------------HDF5--------------"); + for(i=0,nds=5;i<8;i++,nds+=5){ + fprintf(stderr,"HDF5 "); + times(&stms); + gettimeofday(&stmv,0); + IObase *file = new H5IO("speed.h5",IObase::Write); + fprintf(stderr,"Write %2u datasets:",nds); + for(int n=0;nwrite(IObase::Float64,3,dims,data); + } + delete file; + gettimeofday(&etmv,0); + times(&etms); // times after close to account for buffer flushing + puts(""); + ert=(double)etmv.tv_sec + (double)etmv.tv_usec/1000000.0L; + srt=(double)stmv.tv_sec + (double)stmv.tv_usec/1000000.0L; + results.realtime = ComputeRealTime(etmv,stmv); + results.usertime = (float)(etms.tms_utime-stms.tms_utime)/CLK_TCK; + results.systemtime = (float)(etms.tms_stime-stms.tms_stime)/CLK_TCK; + results.combined = (float)(etms.tms_utime-stms.tms_utime+ + etms.tms_stime-stms.tms_stime)/CLK_TCK; + results.nbytes = (float)(nds*IObase::nBytes(IObase::Float64,3,dims)); + h5_results.append(results); + } puts("-------------F77 Unformatted---------------"); for(i=0,nds=5;i<8;i++,nds+=5){ fprintf(stderr,"F77 Unf "); times(&stms); - gettimeofday(&stmv); + gettimeofday(&stmv,0); f_openf77(); fprintf(stderr,"Write %2u datasets:",nds); for(int n=0;nsetDataLoadingOff(); printf("Number of Levels = %u\n\n",amrfile->nLevels()); diff --git a/src/config.guess b/src/config.guess new file mode 100755 index 0000000..71de137 --- /dev/null +++ b/src/config.guess @@ -0,0 +1,1368 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-03-16' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# Please send patches to . +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break + fi + done + rm -f $dummy.c $dummy.o $dummy.rel + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # Netbsd (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i?86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + cat >$dummy.c < /* for printf() prototype */ +int main (int argc, char *argv[]) { +#else +int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __MIPSEB__ + printf ("%s-unknown-linux-gnu\n", argv[1]); +#endif +#ifdef __MIPSEL__ + printf ("%sel-unknown-linux-gnu\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + ;; + ppc:Linux:*:*) + # Determine Lib Version + cat >$dummy.c < +#if defined(__GLIBC__) +extern char __libc_version[]; +extern char __libc_release[]; +#endif +main(argc, argv) + int argc; + char *argv[]; +{ +#if defined(__GLIBC__) + printf("%s %s\n", __libc_version, __libc_release); +#else + printf("unknown\n"); +#endif + return 0; +} +EOF + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then LIBC="libc1" ; fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} + exit 0 ;; + alpha:Linux:*:*) + cat <$dummy.s + .data + \$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + .text + .globl main + .align 4 + .ent main + main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + LIBC="" + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) UNAME_MACHINE="alpha" ;; + 1-0) UNAME_MACHINE="alphaev5" ;; + 1-1) UNAME_MACHINE="alphaev56" ;; + 1-101) UNAME_MACHINE="alphapca56" ;; + 2-303) UNAME_MACHINE="alphaev6" ;; + 2-307) UNAME_MACHINE="alphaev67" ;; + esac + objdump --private-headers $dummy | \ + grep ld.so.1 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i?86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_supported_emulations=`cd /; ld --help 2>&1 \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + i?86linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 + ;; + elf_i?86) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + i?86coff) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 + ;; + esac + # Either a pre-BFD a.out linker (linux-gnuoldld) + # or one that does not give us useful --help. + # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. + # If ld does not provide *any* "supported emulations:" + # that means it is gnuoldld. + test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + case "${UNAME_MACHINE}" in + i?86) + VENDOR=pc; + ;; + *) + VENDOR=unknown; + ;; + esac + # Determine whether the default compiler is a.out or elf + cat >$dummy.c < +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; +# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +# are messed up and put the nodename in both sysname and nodename. + i?86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i?86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i?86:*:5:7*) + # Fixed at (any) Pentium or better + UNAME_MACHINE=i586 + if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then + echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i?86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i?86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..94568dd --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,9 @@ +#undef ANSI +#undef SUN +#undef SOLARIS +#undef WITH_HDF4 +#undef SGI +#undef WITH_HDF5 +#undef HP +#undef WIN32 +#undef T3E \ No newline at end of file diff --git a/src/config.sub b/src/config.sub new file mode 100755 index 0000000..adf6cf7 --- /dev/null +++ b/src/config.sub @@ -0,0 +1,1367 @@ +#! /bin/sh +# +# CCTK_MODIFICATION: 11/5/2001 Added info for sx5-nec. Tom Goodale +# +# +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-03-09' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ + | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ + | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | hppa64 \ + | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ + | alphaev6[78] \ + | we32k | ns16k | clipper | i370 | sh | sh[34] \ + | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp10 | pdp11 \ + | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ + | thumb | d10v | d30v | fr30 | avr | openrisc) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i[234567]86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ + | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ + | hppa2.0n-* | hppa64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ + | alphaev6[78]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ + | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ + | [cjt]90-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ + | bs2000-* | tic54x-* | c54x-* | x86_64-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [cjt]90) + basic_machine=${basic_machine}-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[34567]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[34567]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[34567]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[34567]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4) + basic_machine=sh-unknown + ;; + sparc | sparcv9) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-nec) + basic_machine=sx5-nec + os=-superux + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i[34567]86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -superux) + os=-superux + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/configure b/src/configure new file mode 100755 index 0000000..cffd857 --- /dev/null +++ b/src/configure @@ -0,0 +1,1567 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help +--with-mips3 put this in if you want mips3 -n32 set to no if you want mips4 -64" +ac_help="$ac_help +--with-mips3 put this in if you want mips3 -n32 set to no if you want mips4 -64" +ac_help="$ac_help +--with-hdf4 Provide path to your HDF4 installation" +ac_help="$ac_help +--with-hdf5 Provide path to your HDF5 installation" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file= + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:560: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:582: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:611: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:641: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:692: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:724: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 735 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:766: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:771: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:799: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:835: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CXX="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CXX="$ac_cv_prog_CXX" +if test -n "$CXX"; then + echo "$ac_t""$CXX" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$CXX" && break +done +test -n "$CXX" || CXX="gcc" + + +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:867: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 + +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cxx_cross + +cat > conftest.$ac_ext << EOF + +#line 878 "configure" +#include "confdefs.h" + +int main(){return(0);} +EOF +if { (eval echo configure:883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cxx_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cxx_cross=no + else + ac_cv_prog_cxx_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cxx_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 +if test $ac_cv_prog_cxx_works = no; then + { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:909: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 +cross_compiling=$ac_cv_prog_cxx_cross + +echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 +echo "configure:914: checking whether we are using GNU C++" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.C <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gxx=yes +else + ac_cv_prog_gxx=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gxx" 1>&6 + +if test $ac_cv_prog_gxx = yes; then + GXX=yes +else + GXX= +fi + +ac_test_CXXFLAGS="${CXXFLAGS+set}" +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS= +echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 +echo "configure:942: checking whether ${CXX-g++} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_cxx_g=yes +else + ac_cv_prog_cxx_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS="$ac_save_CXXFLAGS" +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi + +#AC_PROG_F77 +for ac_prog in ar +do +# Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:979: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$AR" in + /*) + ac_cv_path_AR="$AR" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_AR="$AR" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_AR="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +AR="$ac_cv_path_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$AR" && break +done + + + +case "$host" in +*sun*) + # SUN + cat >> confdefs.h <<\EOF +#define ANSI 1 +EOF + + cat >> confdefs.h <<\EOF +#define SUN 1 +EOF + + cat >> confdefs.h <<\EOF +#define SOLARIS 1 +EOF + + XTRALIBS='-lrpcsvc -lnsl' + INCLUDES='-I.' + XTRAFLAGS='-pto' + LIBS='-L. -lieeeio' + CFLAGS='-O' + FFLAGS=$(CFLAGS) + ARFLAGS='crs' + OBJ_SUFF='.o' + C2OBJ='-c' + MPILIB='-L/usr/local/lib -lmpi';; +*irix*) + # IRIX system + IRIX_CPU=`hinv -t cpu` + case "$IRIX_CPU" in + *4???*) + echo 4 + XTRAFLAGS="-mips3 -n32 -prelink -w -ptused" ;; + *8???*) + echo 8 + XTRAFLAGS="-mips3 -n32 -prelink -w -ptused" ;; + *10???*) + echo 10 + # Check whether --with-mips3 or --without-mips3 was given. +if test "${with_mips3+set}" = set; then + withval="$with_mips3" + + if test "$withval" = no ; then + XTRAFLAGS="-mips4 -r10000 -64 -IPA -LNO -prelink -w -ptused" ; + else + XTRAFLAGS="-mips3 -n32 -prelink -w -ptused" ; + fi + + +fi +;; + *12???*) + echo 12 + # Check whether --with-mips3 or --without-mips3 was given. +if test "${with_mips3+set}" = set; then + withval="$with_mips3" + + if test "$withval" = no ; then + XTRAFLAGS="-mips4 -r12000 -64 -IPA -LNO -prelink -w -ptused" ; + else + XTRAFLAGS="-mips3 -n32 -prelink -w -ptused" ; + fi + + +fi +;; + *) + echo whatever + XTRAFLAGS="-mips3 -n32 -prelink -w -ptused" ;; + esac + cat >> confdefs.h <<\EOF +#define SGI 1 +EOF + + cat >> confdefs.h <<\EOF +#define ANSI 1 +EOF + + XTRALIBS='' + INCLUDES='-I.' + LIBS='-L. -lieeeio' + ARFLAGS='crs' + OBJ_SUFF='.o' + C2OBJ='-c' + MPILIB='-L/usr/local/lib -lmpi';; +*hp*) + # HP-UX + cat >> confdefs.h <<\EOF +#define ANSI 1 +EOF + + cat >> confdefs.h <<\EOF +#define HP 1 +EOF + + XTRALIBS='' + INCLUDES='-I.' + XTRAFLAGS='' + LIBS='-L. -lieeeio' + CFLAGS='-O +a1' + FFLAGS='-O' + ARFLAGS='crs' + OBJ_SUFF='.o' + C2OBJ='-c' + MPILIB='-L/usr/local/lib -lmpi';; +*dec*) + # DEC Alpha + cat >> confdefs.h <<\EOF +#define ANSI 1 +EOF + + XTRALIBS="" + INCLUDES='-I.' + XTRAFLAGS="" + LIBS='-L. -lieeeio' + CFLAGS='-O' + FFLAGS='-O' + ARFLAGS='crs' + OBJ_SUFF=".o" + C2OBJ='-c' + MPILIB='-L/usr/local/lib -lmpi';; +*linux*) + # LINUX system + cat >> confdefs.h <<\EOF +#define ANSI 1 +EOF + + XTRALIBS="" + INCLUDES='-I.' + XTRAFLAGS="" + LIBS='-L. -lieeeio' + CFLAGS='-O2 -g' + FFLAGS='-O2 -g' + ARFLAGS='crs' + OBJ_SUFF=".o" + C2OBJ='-c' + MPILIB='-L/usr/local/lib -lmpich';; +*darwin*) + # Macintosh / DarwinOS + cat >> confdefs.h <<\EOF +#define ANSI 1 +EOF + + XTRALIBS="" + INCLUDES='-I.' + XTRAFLAGS="" + LIBS='-L. -lieeeio' + CFLAGS='-O2 -g -fpermissive' + FFLAGS='-O2 -g' + ARFLAGS='cr' + OBJ_SUFF=".o" + C2OBJ='-c' + MPILIB='-L/usr/local/lib -lmpich';; +*cygwin*) + # Win32 system + cat >> confdefs.h <<\EOF +#define ANSI 1 +EOF + + cat >> confdefs.h <<\EOF +#define WIN32 1 +EOF + + XTRALIBS="" + INCLUDES="" + XTRAFLAGS="" + LIBS='-L. -lieeeio' + CFLAGS="" + FFLAGS="" + ARFLAGS='crs' + OBJ_SUFF=".obj" + C2OBJ='-c /Tp' + MPILIB='-L/usr/local/lib -lmpich';; +*T3E*) + # Cray T3E + cat >> confdefs.h <<\EOF +#define ANSI 1 +EOF + + cat >> confdefs.h <<\EOF +#define T3E 1 +EOF + + XTRALIBS="" + INCLUDES="-I." + XTRAFLAGS="" + LIBS='-L. -lieeeio' + CFLAGS='-hinstantiate=used' + FFLAGS="" + ARFLAGS='crs' + OBJ_SUFF=".o" + C2OBJ='-c' + MPILIB='-lmpi';; + +*) + echo "OS not recognized" + exit 1;; +esac + + + + + + + + + + + + +# Check whether --with-hdf4 or --without-hdf4 was given. +if test "${with_hdf4+set}" = set; then + withval="$with_hdf4" + +if test -n "$withval" ; then + HDFROOT="$withval" + HDFINCLUDE='-I$(HDFROOT)/include' + HDFLIBPATH='$(HDFROOT)/lib' + HDFLIBS='-L$(HDFROOT)/lib -lmfhdf -ldf -lz -ljpeg' + DRIVER_LIBS4='-lhdfio' + DRIVER_LIBDEPS4='libhdfio.a' + DEFINE_DRIVERS4='-DWITH_HDF4' +else + HDFROOT="" + HDFINCLUDE="" + HDFLIBPATH="" + HDFLIBS="" + DRIVER_LIBS4="" + DRIVER_LIBDEPS4="" + DEFINE_DRIVERS4="" +fi + + +fi + + + + + + + + + + +# Check whether --with-hdf5 or --without-hdf5 was given. +if test "${with_hdf5+set}" = set; then + withval="$with_hdf5" + +if test -n "$withval" ; then + H5ROOT="$withval" + H5INCLUDES='-I$(H5ROOT)/include' + H5LIBS='-L$(H5ROOT)/lib -lhdf5 -lm -lz' + DRIVER_LIBS5='-lh5io' + DRIVER_LIBDEPS5='libh5io.a' + DEFINE_DRIVERS5='-DWITH_HDF5' +else + H5ROOT="" + H5INCLUDES="" + H5LIBS="" + DRIVER_LIBS5="" + DRIVER_LIBDEPS5="" + DEFINE_DRIVERS5="" +fi + + +fi + + + + + + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir + +trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CC@%$CC%g +s%@CXX@%$CXX%g +s%@AR@%$AR%g +s%@XTRALIBS@%$XTRALIBS%g +s%@INCLUDES@%$INCLUDES%g +s%@XTRAFLAGS@%$XTRAFLAGS%g +s%@ARFLAGS@%$ARFLAGS%g +s%@OBJ_SUFF@%$OBJ_SUFF%g +s%@C2OBJ@%$C2OBJ%g +s%@MPILIB@%$MPILIB%g +s%@HDFROOT@%$HDFROOT%g +s%@HDFINCLUDE@%$HDFINCLUDE%g +s%@HDFLIBPATH@%$HDFLIBPATH%g +s%@HDFLIBS@%$HDFLIBS%g +s%@DEFINE_DRIVERS4@%$DEFINE_DRIVERS4%g +s%@DRIVER_LIBS4@%$DRIVER_LIBS4%g +s%@DRIVER_LIBDEPS4@%$DRIVER_LIBDEPS4%g +s%@H5ROOT@%$H5ROOT%g +s%@H5INCLUDES@%$H5INCLUDES%g +s%@H5LIBS@%$H5LIBS%g +s%@DEFINE_DRIVERS5@%$DEFINE_DRIVERS5%g +s%@DRIVER_LIBS5@%$DRIVER_LIBS5%g +s%@DRIVER_LIBDEPS5@%$DRIVER_LIBDEPS5%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 diff --git a/src/configure.in b/src/configure.in new file mode 100644 index 0000000..33dac59 --- /dev/null +++ b/src/configure.in @@ -0,0 +1,228 @@ +AC_INIT() + +AC_CANONICAL_HOST + +AC_PROG_MAKE_SET +AC_PROG_CC +AC_PROG_CXX +#AC_PROG_F77 +AC_PATH_PROGS(AR,ar) + + +case "$host" in +*sun*) + # SUN + AC_DEFINE(ANSI) + AC_DEFINE(SUN) + AC_DEFINE(SOLARIS) + XTRALIBS='-lrpcsvc -lnsl' + INCLUDES='-I.' + XTRAFLAGS='-pto' + LIBS='-L. -lieeeio' + CFLAGS='-O' + FFLAGS=$(CFLAGS) + ARFLAGS='crs' + OBJ_SUFF='.o' + C2OBJ='-c' + MPILIB='-L/usr/local/lib -lmpi';; +*irix*) + # IRIX system + IRIX_CPU=`hinv -t cpu` + case "$IRIX_CPU" in + *4???*) + echo 4 + XTRAFLAGS="-mips3 -n32 -prelink -w -ptused" ;; + *8???*) + echo 8 + XTRAFLAGS="-mips3 -n32 -prelink -w -ptused" ;; + *10???*) + echo 10 + AC_ARG_WITH(mips3, --with-mips3 put this in if you want mips3 -n32 set to no if you want mips4 -64, + [ + if test "$withval" = no ; then + XTRAFLAGS="-mips4 -r10000 -64 -IPA -LNO -prelink -w -ptused" ; + else + XTRAFLAGS="-mips3 -n32 -prelink -w -ptused" ; + fi + ] + );; + *12???*) + echo 12 + AC_ARG_WITH(mips3, --with-mips3 put this in if you want mips3 -n32 set to no if you want mips4 -64, + [ + if test "$withval" = no ; then + XTRAFLAGS="-mips4 -r12000 -64 -IPA -LNO -prelink -w -ptused" ; + else + XTRAFLAGS="-mips3 -n32 -prelink -w -ptused" ; + fi + ] + );; + *) + echo whatever + XTRAFLAGS="-mips3 -n32 -prelink -w -ptused" ;; + esac + AC_DEFINE(SGI) + AC_DEFINE(ANSI) + XTRALIBS='' + INCLUDES='-I.' + LIBS='-L. -lieeeio' + ARFLAGS='crs' + OBJ_SUFF='.o' + C2OBJ='-c' + MPILIB='-L/usr/local/lib -lmpi';; +*hp*) + # HP-UX + AC_DEFINE(ANSI) + AC_DEFINE(HP) + XTRALIBS='' + INCLUDES='-I.' + XTRAFLAGS='' + LIBS='-L. -lieeeio' + CFLAGS='-O +a1' + FFLAGS='-O' + ARFLAGS='crs' + OBJ_SUFF='.o' + C2OBJ='-c' + MPILIB='-L/usr/local/lib -lmpi';; +*dec*) + # DEC Alpha + AC_DEFINE(ANSI) + XTRALIBS="" + INCLUDES='-I.' + XTRAFLAGS="" + LIBS='-L. -lieeeio' + CFLAGS='-O' + FFLAGS='-O' + ARFLAGS='crs' + OBJ_SUFF=".o" + C2OBJ='-c' + MPILIB='-L/usr/local/lib -lmpi';; +*linux*) + # LINUX system + AC_DEFINE(ANSI) + XTRALIBS="" + INCLUDES='-I.' + XTRAFLAGS="" + LIBS='-L. -lieeeio' + CFLAGS='-O2 -g' + FFLAGS='-O2 -g' + ARFLAGS='crs' + OBJ_SUFF=".o" + C2OBJ='-c' + MPILIB='-L/usr/local/lib -lmpich';; +*darwin*) + # Macintosh / DarwinOS + AC_DEFINE(ANSI) + XTRALIBS="" + INCLUDES='-I.' + XTRAFLAGS="" + LIBS='-L. -lieeeio' + CFLAGS='-O2 -g -fpermissive' + FFLAGS='-O2 -g' + ARFLAGS='cr' + OBJ_SUFF=".o" + C2OBJ='-c' + MPILIB='-L/usr/local/lib -lmpich';; +*cygwin*) + # Win32 system + AC_DEFINE(ANSI) + AC_DEFINE(WIN32) + XTRALIBS="" + INCLUDES="" + XTRAFLAGS="" + LIBS='-L. -lieeeio' + CFLAGS="" + FFLAGS="" + ARFLAGS='crs' + OBJ_SUFF=".obj" + C2OBJ='-c /Tp' + MPILIB='-L/usr/local/lib -lmpich';; +*T3E*) + # Cray T3E + AC_DEFINE(ANSI) + AC_DEFINE(T3E) + XTRALIBS="" + INCLUDES="-I." + XTRAFLAGS="" + LIBS='-L. -lieeeio' + CFLAGS='-hinstantiate=used' + FFLAGS="" + ARFLAGS='crs' + OBJ_SUFF=".o" + C2OBJ='-c' + MPILIB='-lmpi';; + +*) + echo "OS not recognized" + exit 1;; +esac + +AC_SUBST(XTRALIBS) +AC_SUBST(INCLUDES) +AC_SUBST(XTRAFLAGS) +AC_SUBST(LIBS) +AC_SUBST(CFLAGS) +AC_SUBST(FFLAGS) +AC_SUBST(ARFLAGS) +AC_SUBST(OBJ_SUFF) +AC_SUBST(C2OBJ) +AC_SUBST(MPILIB) + +AC_ARG_WITH(hdf4, --with-hdf4 Provide path to your HDF4 installation, +[ +if test -n "$withval" ; then + HDFROOT="$withval" + HDFINCLUDE='-I$(HDFROOT)/include' + HDFLIBPATH='$(HDFROOT)/lib' + HDFLIBS='-L$(HDFROOT)/lib -lmfhdf -ldf -lz -ljpeg' + DRIVER_LIBS4='-lhdfio' + DRIVER_LIBDEPS4='libhdfio.a' + DEFINE_DRIVERS4='-DWITH_HDF4' +else + HDFROOT="" + HDFINCLUDE="" + HDFLIBPATH="" + HDFLIBS="" + DRIVER_LIBS4="" + DRIVER_LIBDEPS4="" + DEFINE_DRIVERS4="" +fi +] +) + +AC_SUBST(HDFROOT) +AC_SUBST(HDFINCLUDE) +AC_SUBST(HDFLIBPATH) +AC_SUBST(HDFLIBS) +AC_SUBST(DEFINE_DRIVERS4) +AC_SUBST(DRIVER_LIBS4) +AC_SUBST(DRIVER_LIBDEPS4) + +AC_ARG_WITH(hdf5, --with-hdf5 Provide path to your HDF5 installation, +[ +if test -n "$withval" ; then + H5ROOT="$withval" + H5INCLUDES='-I$(H5ROOT)/include' + H5LIBS='-L$(H5ROOT)/lib -lhdf5 -lm -lz' + DRIVER_LIBS5='-lh5io' + DRIVER_LIBDEPS5='libh5io.a' + DEFINE_DRIVERS5='-DWITH_HDF5' +else + H5ROOT="" + H5INCLUDES="" + H5LIBS="" + DRIVER_LIBS5="" + DRIVER_LIBDEPS5="" + DEFINE_DRIVERS5="" +fi +] +) + +AC_SUBST(H5ROOT) +AC_SUBST(H5INCLUDES) +AC_SUBST(H5LIBS) +AC_SUBST(DEFINE_DRIVERS5) +AC_SUBST(DRIVER_LIBS5) +AC_SUBST(DRIVER_LIBDEPS5) + +AC_OUTPUT(Makefile) \ No newline at end of file diff --git a/src/install-sh b/src/install-sh new file mode 100755 index 0000000..e9de238 --- /dev/null +++ b/src/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/src/ioconvert.cc b/src/ioconvert.cc index 0b1f823..96e5bb1 100644 --- a/src/ioconvert.cc +++ b/src/ioconvert.cc @@ -3,9 +3,11 @@ #include #include "IO.hh" #include "IEEEIO.hh" + #ifdef WITH_HDF4 #include "HDFIO.hh" #endif + #ifdef WITH_HDF5 #include "H5IO.hh" #endif @@ -25,9 +27,10 @@ int main(int argc,char *argv[]){ int sindex=0,dindex=0,findex=0; IObase *infile,*outfile; #ifdef WITH_HDF4 - HDFIO *hdffile = NULL; - int hdfin=0; + HDFIO *hdffile; #endif + int hdfin=0; + int h5in=0; for(i=1;iisValid()) fprintf(stderr,"**** not hdf5 input?\n"); + h5in=1; } - else #endif - { - // assume its raw - infile=new IEEEIO(argv[sindex],IObase::Read); - } if(!infile->isValid()){ printf("cant read %s\n",argv[sindex]); usage(); } - // for the outfile, + // for the outfile, + if(d_ext && (!strcmp(d_ext,".ieee") || !strcmp(d_ext,".raw"))){ + outfile=new IEEEIO(argv[dindex],IObase::Create,swap); // swap only affects IEEEIO output + } #ifdef WITH_HDF4 - if(d_ext && !strcmp(d_ext,".hdf")) - { + else if(d_ext && !strcmp(d_ext,".hdf")){ outfile=new HDFIO(argv[dindex],IObase::Create); } - else #endif #ifdef WITH_HDF5 - if(d_ext && !strcmp(d_ext,".h5")) - { - outfile=new H5IO(argv[dindex],IObase::Create); + else if(d_ext && (!strcmp(d_ext,".h5") || !strcmp(d_ext,".hdf5"))){ + outfile = new H5IO(argv[dindex],IObase::Create); } - else #endif - { - // assume its raw - outfile=new IEEEIO(argv[dindex],IObase::Create,swap); // swap only affects IEEEIO output - } + if(!outfile->isValid()){ printf("cant write %s\n",argv[dindex]); delete infile; @@ -100,10 +94,8 @@ int main(int argc,char *argv[]){ IObase::DataType type; char *data; infile->seek(i); -#ifdef WITH_HDF4 if(hdfin && hdffile->isCoord()) continue; // skip coord vars -#endif - // fprintf(stderr,".%u",i); + fprintf(stderr,".%u",i); infile->readInfo(type,rank,dims); { int j,sz; @@ -117,7 +109,7 @@ int main(int argc,char *argv[]){ for(int j=0;jnAttributes();j++){ char name[256]; // should be big enough int length; - // fprintf(stderr,"a"); + fprintf(stderr,"a"); infile->readAttributeInfo(j,name,type,length); data = new char[length * IObase::sizeOf(type)]; infile->readAttribute(j,data); @@ -127,6 +119,6 @@ int main(int argc,char *argv[]){ } puts(""); delete outfile; - // delete infile; + delete infile; return 0; // success code } diff --git a/src/ioinfo.cc b/src/ioinfo.cc index b1f8460..d813662 100644 --- a/src/ioinfo.cc +++ b/src/ioinfo.cc @@ -211,12 +211,14 @@ int main(int argc,char *argv[]){ j,attribname,Typename(datatype),length); if(cmdln.showattribmax || cmdln.showattribstats){ //printf("Length of Attribute=%u for total bytes=%u\n",length,IObase::sizeOf(datatype)); - if(! (IObase::sizeOf(datatype)>0 && length>0)) - { + void *dataptr; + dataptr=0; + if(IObase::sizeOf(datatype)>0 && length>0) + dataptr=new char[length * IObase::sizeOf(datatype)]; + else { //puts("no data to display"); continue; // no data to display } - void *const dataptr=new char[length * IObase::sizeOf(datatype)]; infile->readAttribute(j,dataptr); switch(datatype){ @@ -267,7 +269,7 @@ int main(int argc,char *argv[]){ break; } if(dataptr) - delete[] ((char *) dataptr); + delete (char*)dataptr; } } } diff --git a/src/vtkAMRStructuredPointsReader.cxx b/src/vtkAMRStructuredPointsReader.cxx new file mode 100755 index 0000000..80b08d0 --- /dev/null +++ b/src/vtkAMRStructuredPointsReader.cxx @@ -0,0 +1,327 @@ +#include "vtkAMRStructuredPointsReader.h" +#include "vtkScalars.h" +#include "vtkFloatArray.h" +#include "vtkIntArray.h" +#include "vtkShortArray.h" +#include "vtkUnsignedShortArray.h" +#include "vtkUnsignedCharArray.h" +#include +#include + +vtkAMRStructuredPointsReader::vtkAMRStructuredPointsReader():hdf_file(0),file(0),index(0){ + filename[0]='\0'; + skipmap=0; + curset=curtime=curlevel=0; + maxset=maxtime=maxlevel=0; + myreader=NULL; + SetLoggedOff(); + fprintf(stderr,"before loggedrange\n"); + loggedmax=0.0; + loggedmin=0.0; + fprintf(stderr,"after loggedrange\n"); +} + + +unsigned long vtkAMRStructuredPointsReader::GetMTime() +{ + unsigned long dtime = this->vtkSource::GetMTime(); + // get last modification time... need to set this myself... + //unsigned long rtime = this->Reader.GetMTime(); + //return (dtime > rtime ? dtime : rtime); + return dtime; +} + +// Description: +// Specify file name of vtk polygonal data file to read. +// immediately constructs the file handle, but reading +// doesn't occur until Execute is called (through Update method). + +void vtkAMRStructuredPointsReader::SetFileName(char *name) { + if(file) delete file; // reopen for new filename + file=0; + hdf_file=0; + if(!name){ + vtkErrorMacro(<<"Null Datafile!"); + return; + } + // statically allocating filename for right now + strncpy(filename,name,sizeof(filename)); // copy the name (for printing info) + filename[sizeof(filename)-1]='\0'; // cap it off; + file = new IEEEIO(name,IObase::Read); + if(!file->isValid()){ + delete file; + file=0; + file = hdf_file = new HDFIO(name,IObase::Read); + if(!file->isValid()){ + vtkErrorMacro(<<"Not a valid IEEEIO or HDF-SDS file: "<nDatasets(); + skipmap = new int[nds]; + for(index=0,maxindex=0;indexseek(index); + if(!hdf_file || hdf_file->isCoord()) continue; + else skipmap[maxindex++] = index; + } + maxindex--; + index = skipmap[0]; // reset the file index to 0; (should scan for datasets) + myreader=new Brads_AmrFileReader(*file); + if (myreader==NULL){ + vtkErrorMacro(<<"Not a valid AMR file: "<setDataLoadingOff(); + maxlevel=myreader->getNumLevels()-1; + myreader->getTimeRange(mintime,maxtime); + int ii=0; + for (ii;ii<=maxlevel;ii++) myreader->hideLevel(ii); + myreader->showLevel(curlevel); + myreader->setTime(curtime); + maxset=myreader->getNumGrids(); + Modified(); // this has been modified +} + +int vtkAMRStructuredPointsReader::SelectTimeStep(int timestep){ + if (timestepmaxtime){ + vtkErrorMacro(<<"Timestep out of range"); + return 0; + } + myreader->setTime(timestep); + curtime=timestep; + maxset=myreader->getNumGrids(); + Modified(); +} + +int vtkAMRStructuredPointsReader::SelectLevel(int level){ + if (level<0 || level>maxlevel){ + vtkErrorMacro(<<"Level out of range"); + return 0; + } + curlevel=level; + int ii=0; + for (ii;ii<=maxlevel;ii++) myreader->hideLevel(ii); + myreader->showLevel(curlevel); + SelectTimeStep(curtime); + Modified(); +} + +int vtkAMRStructuredPointsReader::SelectDataset(int dataset){ + if (dataset<0 || dataset>=maxset){ + vtkErrorMacro(<<"Dataset out of range"); + return 0; + } + curset=dataset; + index=file->seek(myreader->getActiveIndex(curset)); + Modified(); +} + + + +void vtkAMRStructuredPointsReader::Execute(){ + + //fprintf(stderr,"in execute\n"); + //puts("vtkAMR:execute()"); + int numPts=0,i; + char line[256]; + int dimsRead=0; +#ifdef VTK31 + vtkStructuredPoints *output=(vtkStructuredPoints *)this->Outputs[0]; +#else + vtkStructuredPoints *output=(vtkStructuredPoints *)this->Output; +#endif + + if(!file || !(file->isValid())) { + vtkErrorMacro(<<"Invalid Data File (cannot read)!"); + return; + } + // seek to current + file->seek(index); + // read dimensions + int rank,dims[3]={1,1,1}; + IObase::DataType datatype; + i=file->readInfo(datatype,rank,dims,3); + //printf("ReadInfo: type=%u rank=%u dims[0]=%u dims[1]=%u dims[2]=%u retval=%u\n",(int)datatype,rank,dims[0],dims[1],dims[2],i); + //for(i=0,numPts=1;iSetDimensions(dims); + // danger if file is >3 dimensions!!! + + // read x,y, and z coordinates + // for now, lets just set them to to the dimensions of the dataset + // ReadCoordinates(output,,ncoords) + // ReadPointData(output,npoints) + // for now, we only support two different types + { // push stack + void *ptr; + vtkScalars *scalars = vtkScalars::New(); + scalars->Allocate(numPts*8); // bogus? + + switch(datatype){ + case IObase::Float32: + { + scalars->SetDataTypeToFloat(); + vtkFloatArray *farray = (vtkFloatArray*)scalars->GetData(); + ptr = (void*)farray->WritePointer(0, numPts); + } + break; + case IObase::Char: + case IObase::uChar: + { + scalars->SetDataTypeToUnsignedChar(); + vtkUnsignedCharArray *ucarray = + (vtkUnsignedCharArray*)scalars->GetData(); + ptr = (void*)ucarray->WritePointer(0, numPts); + } + break; + case IObase::Int16: + { + scalars->SetDataTypeToShort(); + vtkShortArray *sarray = (vtkShortArray*)scalars->GetData(); + ptr = (void*)sarray->WritePointer(0, numPts); + } + break; + case IObase::uInt16: + { + scalars->SetDataTypeToUnsignedShort(); + vtkUnsignedShortArray *usarray = + (vtkUnsignedShortArray*)scalars->GetData(); + ptr = (void*)usarray->WritePointer(0, numPts); + } + break; + case IObase::Int32: + { + scalars->SetDataTypeToInt(); + vtkIntArray *iarray = (vtkIntArray*)scalars->GetData(); + ptr = (void*)iarray->WritePointer(0, numPts); + } + break; + } + + file->read(ptr); // read it directly into vtk pre-allocated buffer + + // in case the data is logged. -BPM + //fprintf(stderr,"in execute\n"); + if(logged){ + double scalar; + int n = scalars->GetNumberOfScalars(); + float maxscalar = scalars->GetRange()[1]; + + int i=0; + for(i;iGetScalar(i); + + if (scalar > 0.0) { + scalar = log10((double)scalars->GetScalar(i)); + scalars->InsertScalar(i, (float) scalar); + } + else { + if (scalar == 0.0) { + scalar = log10((double) (maxscalar*1.0e-10)); + scalars->InsertScalar(i, (float) scalar); + } + else { + logged=-1; + vtkErrorMacro(<<"Negative value!"); + return; + } + } + } + + scalars->Modified(); + float* scarange = scalars->GetRange(); + if(scarange[0]loggedmax) + loggedmax=scarange[1]; + } + //fprintf(stderr,"in execute\n"); + // printf("read %u points\n",numPts); + + output->GetPointData()->SetScalars(scalars); // should set ->Modified() and Refcount() + scalars->Delete(); // remove local copy of reference counted data + } + { // push the stack... + // check for coord info (read for xcoordinate) + float min_ext[5],max_ext[5]; + int use_extents=0; + int nelements; + int minindex,maxindex; + IObase::DataType dtype; + + if((minindex=file->readAttributeInfo("min_ext",dtype,nelements))>0 && + (maxindex=file->readAttributeInfo("max_ext",dtype,nelements))>0 && + (dtype==IObase::Float32 || dtype==IObase::Float64)) { + if(dtype==IObase::Float32){ + file->readAttribute(maxindex,min_ext); + file->readAttribute(minindex,max_ext); + } + else if(dtype==IObase::Float64){ + double maxext[5],minext[5]; + file->readAttribute(maxindex,maxext); + file->readAttribute(minindex,minext); + int i=0; + for(i;iSetOrigin(min_ext); + int i=0; + for(i;i 0) + max_ext[i]/=(float)(dims[i]-1); + } + output->SetSpacing(max_ext); + //use_extents=1; + } //***** OK, if we cant find extents, then try origin & delta + else if((minindex=file->readAttributeInfo("origin",dtype,nelements))>0 && + (maxindex=file->readAttributeInfo("delta",dtype,nelements))>0 && + (dtype==IObase::Float32 || dtype==IObase::Float64)) { + if(dtype==IObase::Float32){ + file->readAttribute(maxindex,min_ext); + file->readAttribute(minindex,max_ext); + output->SetOrigin(min_ext); + output->SetSpacing(max_ext); + } + else if(dtype==IObase::Float64){ + double maxext[5],minext[5]; + file->readAttribute(maxindex,maxext); + file->readAttribute(minindex,minext); + int i=0; + for(i;iSetOrigin(min_ext); + output->SetSpacing(max_ext); + } + } + else{ + int i=0; + for(i;iSetOrigin(min_ext); + output->SetSpacing(max_ext); + } + } +} + +void vtkAMRStructuredPointsReader::PrintSelf(ostream& os, vtkIndent indent) +{ + os << indent << "AMR File Name: " << (this->filename) << "\n"; + os << indent << "CurrentIndex: " << (this->index) << "\n"; + //output->PrintSelf(os,indent); + vtkStructuredPointsSource::PrintSelf(os,indent); +} + + diff --git a/src/vtkAMRStructuredPointsReader.h b/src/vtkAMRStructuredPointsReader.h new file mode 100755 index 0000000..c344967 --- /dev/null +++ b/src/vtkAMRStructuredPointsReader.h @@ -0,0 +1,65 @@ +// .NAME vtkAMRStructuredPointsReader - read structured point data from AMR datafile. +// .SECTION Description +// vtkAMRStructuredPointsReader is a source object that reads AMR +// data files. See text for format details. +// .SECTION Caveats +// Data stored in AMR format is binary (compact) and system independent. +// Information on AMR can be found at http://hdf.ncsa.uiuc.edu +// Information on HDFIO/IEEEIO can be found at http://bach.ncsa.uiuc.edu/IEEEIO + +#ifndef __vtkAMRStructuredPointsReader_h +#define __vtkAMRStructuredPointsReader_h + +#include "Brads_AmrFileReader.hh" +#include +#include +#include +//#include + +class VTK_EXPORT vtkAMRStructuredPointsReader : public vtkStructuredPointsSource +{ + public: + + + vtkAMRStructuredPointsReader(); + int logged; + float loggedmin,loggedmax; + void SetLoggedOn(){logged=1;} + void SetLoggedOff(){logged=0;} + // will need to replace with vtkIntArray and vtkString to be safe!! + ~vtkAMRStructuredPointsReader(){ + if(file) delete file; // close file if it is open + if(skipmap) delete skipmap; + if (myreader) delete myreader; + } + static vtkAMRStructuredPointsReader *New() {return new vtkAMRStructuredPointsReader;}; + const char *GetClassName() {return "vtkAMRStructuredPointsReader";} + void PrintSelf(ostream& os, vtkIndent indent); + + // overload because of vtkDataReader ivar + virtual unsigned long GetMTime(); + + void SetFileName(char *name); + char *GetFileName(){return filename;} + //----------Johns stuff + + int GetNumTimeSteps(){return maxtime-mintime;} + int SelectTimeStep(int timestep); + int GetNumLevels(){return maxlevel+1;}; + int SelectLevel(int level); + int GetNumDatasets(){return maxset;}; + int SelectDataset(int dataset); + Brads_AmrFileReader *myreader; +protected: + void Execute(); + IObase *file; + HDFIO *hdf_file; // for HDF/NetCDF specific features + int curtime, curlevel, curset, index; + int maxtime, mintime, maxlevel, maxset, maxindex; + + int *skipmap; + char filename[256]; // static buffer for filename... maybe use newstring() +}; + +#endif + diff --git a/src/writef77.f b/src/writef77.f index 36a1310..e3d7639 100644 --- a/src/writef77.f +++ b/src/writef77.f @@ -5,7 +5,7 @@ END subroutine writef77(array) - REAL*8 array(64,64,64) + REAL*8 array(128,128,128) WRITE(10) array RETURN END diff --git a/src/xmlview.cc b/src/xmlview.cc index bad9443..ff9c15e 100644 --- a/src/xmlview.cc +++ b/src/xmlview.cc @@ -268,5 +268,5 @@ void PrintRangeXML(char *tab,IObase::DataType datatype,int nelem,char *buffer){ // now compute the range in a datatype-dependent manner double min,max; GetRangeXML(datatype,nelem,buffer,min,max); - printf("%s%lf,%lf\n",tab,min,max); + printf("%s%g,%g\n",tab,min,max); } -- cgit v1.2.3