]> git.unchartedbackwaters.co.uk Git - francis/ofc.git/commitdiff
Ignore negative frequencies on converting from reciprocal to psinc.
authorFrancis Russell <francis@unchartedbackwaters.co.uk>
Sat, 19 May 2012 10:36:52 +0000 (11:36 +0100)
committerFrancis Russell <francis@unchartedbackwaters.co.uk>
Sat, 19 May 2012 10:36:52 +0000 (11:36 +0100)
src/ofc/generators/onetep/ReciprocalToPsinc.scala

index f6b926367184cb202c03d7aa1cf3e202f6f0b44e..db36039967d340c25a4f223e0833a216cf09e1b8 100644 (file)
@@ -3,17 +3,20 @@ import ofc.codegen._
 
 class ReciprocalToPsinc(op: ReciprocalFragment) extends DensePsincFragment {
   val fftbox = new DeclaredVarSymbol[ArrayType[FloatType]]("fftbox", new ArrayType[FloatType](3))
+  val dummybox = new DeclaredVarSymbol[ArrayType[FloatType]]("dummybox", new ArrayType[FloatType](3))
 
   def toReciprocal = op
 
   def setup(context: GenerationContext) {
     op.setup(context)
     context.addDeclaration(fftbox)
+    context.addDeclaration(dummybox)
     
     val fftboxSize : Seq[Expression[IntType]] = getSize
     context += new AllocateStatement(fftbox, fftboxSize)
+    context += new AllocateStatement(dummybox, fftboxSize)
     
-    val fourierParams : Seq[Expression[_]] = Seq(new CharLiteral('C'), new CharLiteral('B'), fftbox, fftbox, op.getBuffer)
+    val fourierParams : Seq[Expression[_]] = Seq(new CharLiteral('C'), new CharLiteral('B'), fftbox, dummybox, op.getBuffer)
     context += new FunctionCallStatement(new FunctionCall(OnetepFunctions.fourier_apply_box_pair, fourierParams))
 
     op.teardown(context)
@@ -21,6 +24,7 @@ class ReciprocalToPsinc(op: ReciprocalFragment) extends DensePsincFragment {
 
   def teardown(context: GenerationContext) {
     context += new DeallocateStatement(fftbox)
+    context += new DeallocateStatement(dummybox)
   }
 
   def getSize = for (dim <- 0 to 2) yield OnetepTypes.FFTBoxInfo.public % OnetepTypes.FFTBoxInfo.totalPts(dim)