]> git.unchartedbackwaters.co.uk Git - francis/ofc.git/commitdiff
Decompose second-level value type into scalar, position & momentum.
authorFrancis Russell <francis@unchartedbackwaters.co.uk>
Thu, 1 Nov 2012 18:55:07 +0000 (18:55 +0000)
committerFrancis Russell <francis@unchartedbackwaters.co.uk>
Thu, 1 Nov 2012 18:55:07 +0000 (18:55 +0000)
OFC/SecondLevel.hs

index 1c9a1a0a5f15cb3c6114a9401b85abc297e0e491..97cc475f916a4c60b54e3720e138ad3327cbceb3 100644 (file)
@@ -34,13 +34,25 @@ data SymbolType =
   deriving Show
 
 data ValueType = 
+  ScalarT ScalarType |
+  PositionT PositionFieldType |
+  MomentumT MomentumFieldType
+  deriving Show
+
+data ScalarType =
   RealType | 
   ComplexType |
-  IntegerType |
+  IntegerType
+  deriving Show
+
+data PositionFieldType =
   Psinc Integer |
+  AnalyticPositionType
+  deriving Show
+
+data MomentumFieldType =
   PsincReciprocal Integer |
-  PositionFunction |
-  MomentumFunction
+  AnalyticMomentumType
   deriving Show
 
 data PsincE
@@ -256,18 +268,18 @@ addValue ofl table name = Map.insert name symbolType table where
   indexTypes = TopLevel.getIndices ofl name
 
 getTargetValueType :: TM.TargetType -> ValueType
-getTargetValueType (TM.PPDFunctionSet _) = Psinc 1
+getTargetValueType (TM.PPDFunctionSet _) = PositionT $ Psinc 1
 getTargetValueType (TM.FortranParameter properties) = case TM.findSpace properties of
-  Just (TM.CoarsePsinc _) -> Psinc 1
-  Just (TM.FinePsinc _) -> Psinc 2
+  Just (TM.CoarsePsinc _) -> PositionT $ Psinc 1
+  Just (TM.FinePsinc _) -> PositionT $ Psinc 2
   Nothing -> case TM.findParamType properties of
     Just fortranType -> fortranToValueType fortranType
     Nothing -> error $ "Unable to infer type from supplied properties: " ++ show properties
     where 
-    fortranToValueType TM.SPAM3 = RealType
-    fortranToValueType TM.Double = RealType
+    fortranToValueType TM.SPAM3 = ScalarT $ RealType
+    fortranToValueType TM.Double = ScalarT $ RealType
     fortranToValueType TM.FunctionBasis = error "ONETEP function basis cannot be mapped to value types."
-    fortranToValueType TM.Integer = IntegerType
+    fortranToValueType TM.Integer = ScalarT $ IntegerType
     fortranToValueType (TM.Array t _) = fortranToValueType t
 
 buildAssignment :: OFL -> OFL2 -> TopLevel.Assignment -> Assignment