From 736c83a07132077aa543d5aa307959a8b3b87b83 Mon Sep 17 00:00:00 2001 From: Francis Russell Date: Thu, 1 Nov 2012 18:55:07 +0000 Subject: [PATCH] Decompose second-level value type into scalar, position & momentum. --- OFC/SecondLevel.hs | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/OFC/SecondLevel.hs b/OFC/SecondLevel.hs index 1c9a1a0..97cc475 100644 --- a/OFC/SecondLevel.hs +++ b/OFC/SecondLevel.hs @@ -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 -- 2.47.3