From 21b0cb9ad4d048bdc46afec05ef49d1223423063 Mon Sep 17 00:00:00 2001 From: Ian Hinder Date: Wed, 11 Sep 2013 14:12:43 +0200 Subject: Param.m: Move details of MoL parameters into MoL.m --- Tools/CodeGen/MoL.m | 54 +++++++++++++++++++++++++++++++++++ Tools/CodeGen/Param.m | 78 ++++----------------------------------------------- 2 files changed, 59 insertions(+), 73 deletions(-) diff --git a/Tools/CodeGen/MoL.m b/Tools/CodeGen/MoL.m index 0425412..cd91eca 100644 --- a/Tools/CodeGen/MoL.m +++ b/Tools/CodeGen/MoL.m @@ -35,6 +35,7 @@ MoLRHSGroupDefinitions; MoLRHSODEGroupDefinitions; MoLUsedFunctions; MoLProcessGroups; +MoLParameterStructures; Begin["`Private`"]; @@ -611,6 +612,59 @@ DefFn[ #] &, groups]; groups2]]; +DefFn[ + MoLParameterStructures[thornName_, evolvedGroups_, evolvedODEGroups_, groups_, evolutionTimelevels_, + defaultEvolutionTimelevels_] := + Module[ + {nEvolved, nevolvedODE}, + nEvolved = Length[variablesFromGroups[evolvedGroups, groups]]; +(* nPrimitive = Length[variablesFromGroups[nonevolvedGroups, groups]];*) +(* nPrimitive = Length[getConstrainedVariables[evolvedGroups, groups]];*) + nEvolvedODE = Length[variablesFromGroups[evolvedODEGroups, groups]]; + + {{ Name -> thornName <> "_MaxNumEvolvedVars", + Type -> "CCTK_INT", + Default -> nEvolved, + Description -> "Number of evolved variables used by this thorn", + Visibility -> "restricted", + AccumulatorBase -> "MethodofLines::MoL_Num_Evolved_Vars", + AllowedValues -> {{Value -> ToString[nEvolved] <> ":" <> ToString[nEvolved] , + Description -> "Number of evolved variables used by this thorn"}}, + Steerable -> Recover}, + { Name -> thornName <> "_MaxNumArrayEvolvedVars", + Type -> "CCTK_INT", + Default -> nEvolvedODE, + Description -> "Number of Array evolved variables used by this thorn", + Visibility -> "restricted", + AccumulatorBase -> "MethodofLines::MoL_Num_ArrayEvolved_Vars", + AllowedValues -> {{Value -> ToString[nEvolvedODE] <> ":" <> ToString[nEvolvedODE] , + Description -> "Number of Array evolved variables used by this thorn"}}, + Steerable -> Recover}, + { Name -> "timelevels", (* For evolved variables, kind of *) + Type -> "CCTK_INT", + Default -> defaultEvolutionTimelevels, + Description -> "Number of active timelevels", + Visibility -> "restricted", + AllowedValues -> {{Value -> ToString[0] <> ":" <> ToString[evolutionTimelevels], + Description -> ""}}, + Steerable -> Recover}, + (* { Name -> thornName <> "_MaxNumConstrainedVars", *) + (* Type -> "CCTK_INT", *) + (* Default -> nPrimitive, *) + (* Description -> "Number of constrained variables used by this thorn", *) + (* Visibility -> "restricted", *) + (* AccumulatorBase -> "MethodofLines::MoL_Num_Constrained_Vars", *) + (* AllowedValues -> {{Value -> ToString[nPrimitive] <> ":" <> ToString[nPrimitive] , *) + (* Description -> "Number of constrained variables used by this thorn"}}}, *) + { Name -> "rhs_timelevels", + Type -> "CCTK_INT", + Default -> 1, + Description -> "Number of active RHS timelevels", + Visibility -> "restricted", + AllowedValues -> {{Value -> ToString[0] <> ":" <> ToString[evolutionTimelevels], + Description -> ""}}, + Steerable -> Recover}}]]; + End[]; EndPackage[]; diff --git a/Tools/CodeGen/Param.m b/Tools/CodeGen/Param.m index c85460f..ba743e1 100644 --- a/Tools/CodeGen/Param.m +++ b/Tools/CodeGen/Param.m @@ -20,7 +20,7 @@ BeginPackage["Param`", {"Thorn`", "Errors`", "Helpers`", "MapLookup`", "KrancGroups`", "Kranc`", "Jacobian`", "CodeGenParam`", - "ConservationCalculation`"}]; + "ConservationCalculation`", "MoL`"}]; CreateKrancParam; MakeFullParamDefs; @@ -294,76 +294,6 @@ CreateKrancParam[evolvedGroups_, nonevolvedGroups_, evolvedGFs = variablesFromGroups[evolvedGroups, groups]; - nEvolved = Length[variablesFromGroups[evolvedGroups, groups]]; -(* nPrimitive = Length[variablesFromGroups[nonevolvedGroups, groups]];*) -(* nPrimitive = Length[getConstrainedVariables[evolvedGroups, groups]];*) - - evolvedMoLParam = - { - Name -> thornName <> "_MaxNumEvolvedVars", - Type -> "CCTK_INT", - Default -> nEvolved, - Description -> "Number of evolved variables used by this thorn", - Visibility -> "restricted", - AccumulatorBase -> "MethodofLines::MoL_Num_Evolved_Vars", - AllowedValues -> {{Value -> ToString[nEvolved] <> ":" <> ToString[nEvolved] , - Description -> "Number of evolved variables used by this thorn"}}, - Steerable -> Recover - }; - - nEvolvedODE = Length[variablesFromGroups[evolvedODEGroups, groups]]; - - evolvedODEMoLParam = - { - Name -> thornName <> "_MaxNumArrayEvolvedVars", - Type -> "CCTK_INT", - Default -> nEvolvedODE, - Description -> "Number of Array evolved variables used by this thorn", - Visibility -> "restricted", - AccumulatorBase -> "MethodofLines::MoL_Num_ArrayEvolved_Vars", - AllowedValues -> {{Value -> ToString[nEvolvedODE] <> ":" <> ToString[nEvolvedODE] , - Description -> "Number of Array evolved variables used by this thorn"}}, - Steerable -> Recover - }; - - (* - constrainedMoLParam = - { - Name -> thornName <> "_MaxNumConstrainedVars", - Type -> "CCTK_INT", - Default -> nPrimitive, - Description -> "Number of constrained variables used by this thorn", - Visibility -> "restricted", - AccumulatorBase -> "MethodofLines::MoL_Num_Constrained_Vars", - AllowedValues -> {{Value -> ToString[nPrimitive] <> ":" <> ToString[nPrimitive] , - Description -> "Number of constrained variables used by this thorn"}} - }; - *) - - timelevelsParam = - { - Name -> "timelevels", - Type -> "CCTK_INT", - Default -> defaultEvolutionTimelevels, - Description -> "Number of active timelevels", - Visibility -> "restricted", - AllowedValues -> {{Value -> ToString[0] <> ":" <> ToString[evolutionTimelevels], - Description -> ""}}, - Steerable -> Recover - }; - - rhsTimelevelsParam = - { - Name -> "rhs_timelevels", - Type -> "CCTK_INT", - Default -> 1, - Description -> "Number of active RHS timelevels", - Visibility -> "restricted", - AllowedValues -> {{Value -> ToString[0] <> ":" <> ToString[evolutionTimelevels], - Description -> ""}}, - Steerable -> Recover - }; - otherTimelevelsParam = { Name -> "other_timelevels", @@ -430,8 +360,10 @@ CreateKrancParam[evolvedGroups_, nonevolvedGroups_, userImplementations2 = If[userImplementations2=={{}},{},userImplementations2]; implementations = Join[userImplementations, userImplementations2, {genericfdStruct, molImplementation}]; - params = Join[{verboseStruct}, realStructs, intStructs, keywordStructs, {evolvedMoLParam, - evolvedODEMoLParam, (*constrainedMoLParam,*) timelevelsParam, rhsTimelevelsParam, otherTimelevelsParam}, + params = Join[{verboseStruct}, realStructs, intStructs, keywordStructs, + MoLParameterStructures[thornName, evolvedGroups, evolvedODEGroups, groups, + evolutionTimelevels, defaultEvolutionTimelevels], + {otherTimelevelsParam}, calcEveryStructs, calcOffsetStructs, CactusBoundary`GetParameters[evolvedGFs, evolvedGroups]]; -- cgit v1.2.3