Skip to content

Commit

Permalink
Param.m: Move calculation and common parameter structures into their …
Browse files Browse the repository at this point in the history
…own functions

This changes the ordering of entries in param.ccl.
  • Loading branch information
ianhinder committed Sep 11, 2013
1 parent 40d2ed8 commit 9aece0e
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions Tools/CodeGen/Param.m
Expand Up @@ -331,46 +331,46 @@
integerParameterDefinitions[parameters]],
Map[krancKeywordParamStruct, keywordParameterDefinitions[parameters]]]];

DefFn[
commonParameterStructures[evolutionTimelevels_] :=
{ krancParamStruct[{Name -> "verbose", Default -> 0, Steerable -> Always}, "CCTK_INT", False],

Options[CreateKrancParam] = ThornOptions;
CreateKrancParam[evolvedGroups_, nonevolvedGroups_,
evolvedODEGroups_, nonevolvedODEGroups_, groups_, thornName_,
parameters_,
evolutionTimelevels_, defaultEvolutionTimelevels_,
calcs_, opts:OptionsPattern[]] :=
Module[
{otherTimelevelsParam, genericfdStruct, verboseStruct, calcEveryStructs, calcOffsetStructs,
allInherited, allExtended, implementationNames,
userImplementations, userImplementations2, implementations,
params, paramspec, param},

(* reals and ints are symbols containing parameter names. The
inherited ones have implementation names as well *)

otherTimelevelsParam =
{
Name -> "other_timelevels",
{ Name -> "other_timelevels",
Type -> "CCTK_INT",
Default -> 1,
Description -> "Number of active timelevels for non-evolved grid functions",
Visibility -> "restricted",
AllowedValues -> {{Value -> ToString[0] <> ":" <> ToString[evolutionTimelevels],
Description -> ""}},
Steerable -> Recover
};
Steerable -> Recover}}];

DefFn[
calculationParameterStructures[calcs_List] :=
Join[
Map[krancParamStruct[{Name -> lookup[#, Name] <> "_calc_every",
Default -> 1,
Steerable -> Always}, "CCTK_INT", False] &,
calcs],
Map[krancParamStruct[{Name -> lookup[#, Name] <> "_calc_offset",
Default -> 0,
Steerable -> Always}, "CCTK_INT", False] &,
calcs]]];

verboseStruct = krancParamStruct[{Name -> "verbose", Default -> 0, Steerable -> Always}, "CCTK_INT", False];
calcEveryStructs = Map[krancParamStruct[{Name -> lookup[#, Name] <> "_calc_every", Default -> 1, Steerable -> Always}, "CCTK_INT", False] &, calcs];
calcOffsetStructs = Map[krancParamStruct[{Name -> lookup[#, Name] <> "_calc_offset", Default -> 0, Steerable -> Always}, "CCTK_INT", False] &, calcs];
Options[CreateKrancParam] = ThornOptions;
CreateKrancParam[evolvedGroups_, nonevolvedGroups_,
evolvedODEGroups_, nonevolvedODEGroups_, groups_, thornName_,
parameters_,
evolutionTimelevels_, defaultEvolutionTimelevels_,
calcs_, opts:OptionsPattern[]] :=
Module[
{params, paramspec, param},

params = Join[{verboseStruct},
params = Join[commonParameterStructures[evolutionTimelevels],
userParameterStructs[parameters],
MoLParameterStructures[
thornName, evolvedGroups, evolvedODEGroups, groups,
evolutionTimelevels, defaultEvolutionTimelevels],
{otherTimelevelsParam},
calcEveryStructs,
calcOffsetStructs,
calculationParameterStructures[calcs],
CactusBoundary`GetParameters[variablesFromGroups[evolvedGroups, groups], evolvedGroups]];

paramspec = {Implementations -> usedParameters[parameters, opts],
Expand Down

0 comments on commit 9aece0e

Please sign in to comment.