new FieldSymbol[PointerType[ArrayType[IntType]]]("ppd_list", fieldType)
}
+ val offset = new FieldSymbol[IntType]("offset")
+
def getFortranAttributes = Set("type(SPHERE)")
}
object CellInfo extends StructType {
val ppdWidth = {for (dim <- 1 to 3) yield new FieldSymbol[IntType]("n_pt"+dim)}.toSeq
val numPPDs = {for (dim <- 1 to 3) yield new FieldSymbol[IntType]("n_ppds_a"+dim)}.toSeq
+ val pointsInPPD = new FieldSymbol[IntType]("n_pts")
def getFortranAttributes = Set("type(CELL_INFO)")
}
val sphereIndex = producer.addIteration("sphere_index", 1, numSpheres)
val numPPDs = (~(basis % FunctionBasis.numPPDsInSphere)).readAt(sphereIndex)
val ppdIndex = producer.addIteration("ppd_index", 1, numPPDs)
- val ppdGlobalCount = (~((~(basis % FunctionBasis.spheres)).readAt(sphereIndex) % Sphere.ppdList)).readAt(ppdIndex, 1) - 1
+ val sphere = (~(basis % FunctionBasis.spheres)).readAt(sphereIndex)
+ val ppdGlobalCount = (~(sphere % Sphere.ppdList)).readAt(ppdIndex, 1) - 1
// The integer co-ordinates of the PPD (0-based)
val a3pos = producer.addExpression("ppd_pos1", ppdGlobalCount / (cellWidthInPPDs(0)*cellWidthInPPDs(1)))
// Loops for iterating over the PPD itself
val ppdIndices = for(dim <- 0 to 2) yield producer.addIteration("point"+(dim+1), loopStarts(dim), loopEnds(dim))
+ // Values exposed as indices and data
+ val positions = for(dim <- 0 to 2) yield
+ producer.addExpression("pos"+(dim+1), ppdPos(dim)*ppdWidths(dim) + ppdIndices(dim))
+
+ // TODO: We explicitly convert to Expression[IntType] here since we don't promote both sides of the addition for ppdDataIndex.
+ val ppdDataStart : Expression[IntType] =
+ producer.addExpression("ppd_data_start", (sphere % Sphere.offset) + (ppdIndex-1) * (pubCell % CellInfo.pointsInPPD))
+
+ val ppdDataIndex = producer.addExpression("ppd_data_index", ppdDataStart
+ + (ppdIndices(2)-1) * (pubCell % CellInfo.ppdWidth(1)) * (pubCell % CellInfo.ppdWidth(0))
+ + (ppdIndices(1)-1) * (pubCell % CellInfo.ppdWidth(0))
+ + (ppdIndices(0)-1))
+
+ val dataValue = producer.addExpression("data", data.readAt(ppdDataIndex))
+
producer
}