def __init__(self, ast, name): self._schedule = None self._name = name # Store the whole fparser2 AST self._ast = ast # A temporary workaround for the fact that we don't yet have a # symbol table to store information on the variable declarations. # TODO (#255) remove this workaround. self._loop_vars = [] self._name_space_manager = NameSpaceFactory().create() from fparser.two.Fortran2003 import Execution_Part, Specification_Part # Find the section of the tree containing the execution part # of the code exe_part = get_child(ast, Execution_Part) if not exe_part: # This subroutine has no execution part so we skip it # TODO log this event return # Store the root of this routine's specification in the AST self._spec_part = get_child(ast, Specification_Part) # We now walk through the AST produced by fparser2 and construct a # new AST using objects from the nemo module. self._schedule = NemoSchedule(self, exe_part)
def __init__(self): self._name_space_manager = NameSpaceFactory().create() # Look=up/create the name of the loop variable for the loop over DoFs self._idx_name = self._name_space_manager.\ create_name(root_name="df", context="PSyVars", label="dof_loop_idx") BuiltIn.__init__(self)
def __init__(self, children=None, parent=None): Node.__init__(self, children=children, parent=parent) # Store the name of the profile variable that is used for this # profile name. This allows to show the variable name in __str__ # (and also if we would call create_name in gen(), the name would # change every time gen() is called). self._var_name = NameSpaceFactory().create().create_name("profile") # Name of the region. In general at constructor time we might not # have a parent subroutine or a child for the kernel, so we leave # the name empty for now. The region and module names are set the # first time gen() is called (and then remain unchanged). self._region_name = None self._module_name = None
def __init__(self, children=None, parent=None): '''Constructor for a ProfileNode that is inserted in a schedule. Parameters: :param children: A list of children nodes for this node. :type children: A list of :py::class::`psyclone.psyGen.Node` \ or derived classes. :param parent: The parent of this node. :type parent: A :py::class::`psyclone.psyGen.Node`. ''' Node.__init__(self, children=children, parent=parent) # Store the name of the profile variable that is used for this # profile name. This allows to show the variable name in __str__ # (and also if we would call create_name in gen(), the name would # change every time gen() is called). self._var_name = NameSpaceFactory().create().create_name("profile") # Name of the region. In general at constructor time we might not # have a parent subroutine or a child for the kernel, so we leave # the name empty for now. The region and module names are set the # first time gen() is called (and then remain unchanged). self._region_name = None self._module_name = None