From: Francis Russell Date: Mon, 30 Jan 2012 19:10:44 +0000 (+0000) Subject: Minor changes to index handling. X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=81a209a47173bc53d65fba55f8b14567e7e7d137;p=francis%2Fofc.git Minor changes to index handling. --- diff --git a/src/ofc/generators/onetep/Tree.scala b/src/ofc/generators/onetep/Tree.scala index 1d5b22e..93ba521 100644 --- a/src/ofc/generators/onetep/Tree.scala +++ b/src/ofc/generators/onetep/Tree.scala @@ -19,13 +19,13 @@ trait DiscreteIndex extends Index trait IterationSpace { def getAccessExpression(indexNames: NameManager) : String - def getOperands() : List[IterationSpace] - def getSpatialIndices() : List[SpatialIndex] - def getDiscreteIndices() : List[DiscreteIndex] + def getOperands : List[IterationSpace] + def getSpatialIndices : List[SpatialIndex] + def getDiscreteIndices : List[DiscreteIndex] } trait DataSpace extends IterationSpace { - def getOperands() = Nil + def getOperands = Nil } trait Matrix extends DataSpace @@ -41,9 +41,9 @@ class Assignment(indexBindings: IndexBindings, lhs: DataSpace, rhs: IterationSpa } class Scalar(value: Double) extends IterationSpace { - def getOperands() = Nil - def getSpatialIndices() = Nil - def getDiscreteIndices() = Nil + def getOperands = Nil + def getSpatialIndices = Nil + def getDiscreteIndices = Nil def getAccessExpression(indexNames: NameManager) = throw new UnimplementedException("Access failed") } @@ -82,8 +82,8 @@ class GeneralInnerProduct(operands: List[IterationSpace], removedIndices: Set[In new DenseDiscreteIndex(this, index) def getOperands = operands - def getSpatialIndices() = spatialIndices - def getDiscreteIndices() = discreteIndices + def getSpatialIndices = spatialIndices + def getDiscreteIndices = discreteIndices def getAccessExpression(indexNames: NameManager) = throw new UnimplementedException("Access failed") } @@ -98,18 +98,18 @@ class Reciprocal(op: IterationSpace) extends IterationSpace { } val spatialIndices = for (dimension <- 0 until op.getSpatialIndices.size) yield - new BlockIndex(this, dimension, op.getSpatialIndices()(dimension)) + new BlockIndex(this, dimension, op.getSpatialIndices(dimension)) def getOperands = List(op) - def getSpatialIndices() = spatialIndices.toList - def getDiscreteIndices() = op.getDiscreteIndices + def getSpatialIndices = spatialIndices.toList + def getDiscreteIndices = op.getDiscreteIndices def getAccessExpression(indexNames: NameManager) = throw new UnimplementedException("Access failed") } class Laplacian(op: IterationSpace) extends IterationSpace { - def getOperands() = List(op) - def getSpatialIndices() = op.getSpatialIndices - def getDiscreteIndices() = op.getDiscreteIndices + def getOperands = List(op) + def getSpatialIndices = op.getSpatialIndices + def getDiscreteIndices = op.getDiscreteIndices def getAccessExpression(indexNames: NameManager) = throw new UnimplementedException("Access failed") } @@ -126,9 +126,9 @@ class SpatialRestriction(op: IterationSpace) extends IterationSpace { val spatialIndices = for (dimension <- 0 until op.getSpatialIndices.size) yield new RestrictedIndex(this, dimension) - def getOperands() = List(op) - def getSpatialIndices() = spatialIndices.toList - def getDiscreteIndices() = op.getDiscreteIndices + def getOperands = List(op) + def getSpatialIndices = spatialIndices.toList + def getDiscreteIndices = op.getDiscreteIndices def getAccessExpression(indexNames: NameManager) = throw new UnimplementedException("Access failed") } @@ -169,8 +169,8 @@ class SPAM3(name : String) extends Matrix { val rowIndex = new RowIndex(this) val colIndex = new ColIndex(this) - def getSpatialIndices() = Nil - def getDiscreteIndices() = List(rowIndex, colIndex) + def getSpatialIndices = Nil + def getDiscreteIndices = List(rowIndex, colIndex) def getAccessExpression(indexNames: NameManager) = throw new UnimplementedException("Access failed") } @@ -193,7 +193,7 @@ class PPDFunctionSet(val basis : String, data : String) extends FunctionSet { var denseIndexNames : List[String] = Nil def getName = "ppd_index" - def getDependencies = Set[Index](parent.getSphereIndex()) + def getDependencies = Set[Index](parent.getSphereIndex) def getDensePPDIndices = denseIndexNames //TODO: def getDenseWidth = parent.getSphereIndex.getSphere + "%n_ppds_sphere" @@ -235,12 +235,12 @@ class PPDFunctionSet(val basis : String, data : String) extends FunctionSet { val sphereIndex = new SphereIndex(this) val spatialIndices = for (dimension <- 0 to 2) yield new IntraPPDIndex(this, dimension) - def getPPDIndex() = ppdIndex - def getSphereIndex() = sphereIndex + def getPPDIndex = ppdIndex + def getSphereIndex = sphereIndex def getSphere(names: NameManager) = basis + "%spheres("+names(getSphereIndex)+")" - def getSpatialIndices() = spatialIndices.toList - def getDiscreteIndices() = List(getSphereIndex(), getPPDIndex()) + def getSpatialIndices = spatialIndices.toList + def getDiscreteIndices = List(getSphereIndex) def getAccessExpression(indexNames: NameManager) = { val index = getSphere(indexNames)+"%offset + &\n" +