void MultisliceParameters::setBox(const Vector3R& minBox, const Vector3R& maxBox, Real deltaZ) { mMinBox = minBox; mMaxBox = maxBox; setSize(maxBox.x() - minBox.x(), maxBox.y() - minBox.y()); mDepth = maxBox.z() - minBox.z(); mDeltaZ = deltaZ; if (mDeltaZ <= 0) AURORA_THROW(EInvalidParameter, "deltaZ must be positive"); mMinBoxes.clear(); Real z = minBox.z(); const Real maxZ = maxBox.z(); mMinBoxes.push_back(Vector3R(minBox.x(), minBox.y(), z)); do { z += mDeltaZ; mMinBoxes.push_back(Vector3R(minBox.x(), minBox.y(), z)); } while (z < maxZ); if (verbosity >= 2) { for (size_t i = 0; i < numSlices(); ++i) { std::cout << " slice " << i << " (z1 = " << zStart(i) << ", z2 = " << zEnd(i) << ")\n"; } } if (verbosity >= 1) std::cout << "Number of Slices: " << numSlices() << std::endl; }
// Get multiple layers of a Benes permutation network. Returns in out[i][j] // the shift amount to move item j in the i'th layer. Also isID[i]=true if // the i'th layer is the identity (i.e., contains only 0 shift amounts). void ColPerm::getBenesShiftAmounts(Vec<Permut>& out, Vec<bool>& isID, const Vec<long>& benesLvls) const { // Go over the columns one by one. For each column extract the columns // permutation, prepare a Benes network for it, and then for every layer // compute the shift amounts for this columns. long n = getDim(dim); // the permutations are over [0,n-1] // Allocate space out.SetLength(benesLvls.length()); isID.SetLength(benesLvls.length()); for (long k=0; k<benesLvls.length(); k++) { out[k].SetLength(getSize()); isID[k] = true; } Vec<long> col; col.SetLength(n); for (long slice_index = 0; slice_index < numSlices(dim); slice_index++) { ConstCubeSlice<long> slice(*this, slice_index, dim); for (long col_index = 0; col_index < slice.numCols(); col_index++) { getHyperColumn(col, slice, col_index); GeneralBenesNetwork net(col); // build a Benes network for this column // Sanity checks: width of network == n, // and sum of benesLvls entries == # of levels assert(net.getSize()==n); {long sum=0; for (long k=0; k<benesLvls.length(); k++) sum+=benesLvls[k]; assert(net.getNumLevels()==sum); } // Compute the layers of the collapased network for this column for (long lvl=0,k=0; k<benesLvls.length(); lvl += benesLvls[k], k++) { // Returns in col the shift amounts for this layer in the network, // restricted to this column. Also returns true if the returned // permutation is the idendity, false otherwise. bool id = collapseBenesLevels(col, net, lvl, benesLvls[k]); isID[k] = isID[k] && id; CubeSlice<long> oslice(out[k], getSig()); CubeSlice<long> osubslice(oslice, slice_index, dim); setHyperColumn(col, osubslice, col_index); } // next collapsed layer } // next column } // next slice }
// ------------------------------------------------------------------------ bool DataContainer::linesAreLocked() { for(unsigned int i = 0; i < numImages(); i++) { for(unsigned int j = 0; j < numTimeSteps(i); j++) { for(unsigned int k = 0; k < numSlices(i,j); k++) { Line::Map &lines = data[i].images[j][k].lines; Line::Map::iterator mapIt = lines.begin(); while(mapIt != lines.end()) { if(!mapIt->second->isLocked()) return false; ++mapIt; } } } } return true; }