コード例 #1
0
 def __init__(self, tree, model=None, name=None):
     CodeGenerator.__init__(self)
     JavaRules.__init__(self)
     self.tree = tree
     self.model = model
     self.name = name
     self.indent_with = ' ' * 4
     self.initialValue = []
     self.index = False
     self.z = middleware(self.tree)
     self.z.transform(self.tree)
     self.therearedate = False
     if self.model:
         self.doc = DocGenerator(model, '//')
         self.generator = JavaTrans([model])
         self.generator.model2Node()
         self.states = [st.name for st in self.generator.states]
         self.rates = [rt.name for rt in self.generator.rates]
         self.auxiliary = [au.name for au in self.generator.auxiliary]
         self.node_param = self.generator.node_param
         self.modparam = [param.name for param in self.node_param]
     self.funcname = ""
     self.write(
         u"import  java.io.*;\nimport  java.util.*;\nimport java.text.ParseException;\nimport java.text.SimpleDateFormat;\nimport javafx.util.*;\n"
     )
コード例 #2
0
 def visit_function_definition(self, node):
     self.newline(node)
     self.nb = 0
     self.funcname = node.name
     self.recursive = node.recursive
     self.z = middleware(node)
     self.z.transform(node)
     if node.name.startswith("model_") or node.name.startswith("init_"):
         node.type = "subroutine_def"
     elif node.recursive or self.z.returns[0].value.type != "tuple":
         node.type = "function"
     else:
         node.type = "subroutine_def"
     self.visit(node)
コード例 #3
0
 def __init__(self, tree, model=None, name=None):
     CodeGenerator.__init__(self)
     FortranRules.__init__(self)
     self.tree = tree
     self.indent_with = ' ' * 4
     self.model = model  # crop2ml models
     self.name = name
     self.initialValue = []
     self.z = middleware(self.tree)
     self.z.transform(self.tree)
     self.mod_parameters = []
     self.index = []
     if self.model:
         self.doc = DocGenerator(model, '!')
         '''for inp in self.model.inputs: # get constant parameters in models
コード例 #4
0
 def __init__(self, tree, model=None):
     CodeGenerator.__init__(self)
     FortranRules.__init__(self)
     self.tree = tree
     self.indent_with = ' ' * 4
     self.model = model  # crop2ml models
     self.initialValue = []
     self.z = middleware(self.tree)
     self.z.transform(self.tree)
     self.mod_parameters = []
     self.index = []
     if self.model:
         self.doc = DocGenerator(model, '!')
         for inp in self.model.inputs:  # get constant parameters in models
             if inp.inputtype == "parameter":
                 #print(inp.name, model.name)
                 if inp.parametercategory == "constant":
                     self.mod_parameters.append(inp.name)
コード例 #5
0
 def __init__(self, tree, model=None, name=None):
     CodeGenerator.__init__(self)
     FortranRules.__init__(self)
     self.tree = tree
     self.indent_with = ' ' * 4
     self.model = model  # crop2ml models
     self.name = name
     self.initialValue = []
     self.z = middleware(self.tree)
     self.z.transform(self.tree)
     self.mod_parameters = []
     self.index = []
     self.params = []
     self.recursive = False
     if self.model:
         self.doc = DocGenerator(model, '!')
     self.funcname = ""
     dir_lib = Path(os.path.dirname(lib.__file__))
     self.f_src = dir_lib / "f90" / "list_sub.f90"
     if self.model:
         self.f_dest = os.path.join(self.model.path, "src", "f90",
                                    "list_sub.f90")
コード例 #6
0
 def __init__(self, tree, model=None, name=None):
     CodeGenerator.__init__(self)
     CsharpRules.__init__(self)
     self.tree = tree
     self.model = model
     self.indent_with = ' ' * 4
     self.initialValue = []
     self.write(
         u"using System;\nusing System.Collections.Generic;\nusing System.Linq;\n"
     )
     self.name = name
     self.z = middleware(self.tree)
     self.z.transform(self.tree)
     if self.model:
         self.doc = DocGenerator(model, '//')
         self.generator = CsharpTrans([model])
         self.generator.model2Node()
         self.states = [st.name for st in self.generator.states]
         self.rates = [rt.name for rt in self.generator.rates]
         self.auxiliary = [au.name for au in self.generator.auxiliary]
         self.node_param = self.generator.node_param
         self.modparam = [param.name for param in self.node_param]
     self.funcname = ""