def getType = symbol.getType
}
+class FieldRef[T <: Type](symbol: FieldSymbol[T]) extends Expression[T] with LeafExpression {
+ def getSymbol = symbol
+ def getType = symbol.getType
+}
+
// Struct and array accesses
class FieldAccess[T <: Type](expression: Expression[StructType], field: FieldSymbol[T]) extends Expression[T] {
def foreach[U](f: Expression[_] => U) = f(expression)
import ofc.codegen._
class Laplacian(op: Field) extends Field {
- def getFragment(indices: Map[NamedIndex, Expression[IntType]]) = op.getFragment(indices)
+ def getFragment(indices: Map[NamedIndex, Expression[IntType]]) = op.getFragment(indices).toReciprocal
}
val fftbox = new DeclaredVarSymbol[ArrayType[FloatType]]("fftbox", new ArrayType[FloatType](3))
def setup(context: GenerationContext) {
+ import OnetepTypes.FFTBoxInfo
+
context.addDeclaration(fftbox)
+ context += new AllocateStatement(fftbox, for (dim <- 0 to 2) yield FFTBoxInfo.public % FFTBoxInfo.totalPts(dim))
}
def teardown(context: GenerationContext) {
+ context += new DeallocateStatement(fftbox)
}
}
def getFragment(indices: Map[NamedIndex, Expression[IntType]]) : FieldFragment =
new LocalFragment(this)
-
}