Reference Guide  2.5.0
psyclone.psyir.nodes.container.Container Class Reference
Inheritance diagram for psyclone.psyir.nodes.container.Container:
Collaboration diagram for psyclone.psyir.nodes.container.Container:

Public Member Functions

def __init__ (self, name, **kwargs)
 
def __eq__ (self, other)
 
def create (cls, name, symbol_table, children)
 
def name (self)
 
def name (self, new_name)
 
def node_str (self, colour=True)
 
def __str__ (self)
 
def get_routine_psyir (self, name)
 
- Public Member Functions inherited from psyclone.psyir.nodes.scoping_node.ScopingNode
def __init__ (self, children=None, parent=None, symbol_table=None)
 
def symbol_table (self)
 
- Public Member Functions inherited from psyclone.psyir.nodes.node.Node
def __init__ (self, ast=None, children=None, parent=None, annotations=None)
 
def coloured_name (self, colour=True)
 
def ast (self)
 
def ast_end (self)
 
def ast (self, ast)
 
def ast_end (self, ast_end)
 
def annotations (self)
 
def dag (self, file_name='dag', file_format='svg')
 
def dag_gen (self, graph)
 
def dag_name (self)
 
def args (self)
 
def backward_dependence (self)
 
def forward_dependence (self)
 
def is_valid_location (self, new_node, position="before")
 
def depth (self)
 
def view (self, depth=0, colour=True, indent=" ", _index=None)
 
def addchild (self, child, index=None)
 
def children (self)
 
def children (self, my_children)
 
def parent (self)
 
def siblings (self)
 
def has_constructor_parent (self)
 
def position (self)
 
def abs_position (self)
 
def root (self)
 
def sameParent (self, node_2)
 
def walk (self, my_type, stop_type=None, depth=None)
 
def get_sibling_lists (self, my_type, stop_type=None)
 
def ancestor (self, my_type, excluding=None, include_self=False, limit=None, shared_with=None)
 
def kernels (self)
 
def following (self, routine=True)
 
def preceding (self, reverse=False, routine=True)
 
def immediately_precedes (self, node_2)
 
def immediately_follows (self, node_1)
 
def coded_kernels (self)
 
def loops (self)
 
def reductions (self, reprod=None)
 
def is_openmp_parallel (self)
 
def lower_to_language_level (self)
 
def reference_accesses (self, var_accesses)
 
def scope (self)
 
def replace_with (self, node, keep_name_in_context=True)
 
def pop_all_children (self)
 
def detach (self)
 
def copy (self)
 
def validate_global_constraints (self)
 
def debug_string (self)
 
def origin_string (self)
 
def update_signal (self)
 
def path_from (self, ancestor)
 
- Public Member Functions inherited from psyclone.psyir.nodes.commentable_mixin.CommentableMixin
def preceding_comment (self)
 
def preceding_comment (self, comment)
 
def inline_comment (self)
 
def inline_comment (self, comment)
 

Public Attributes

 name
 
- Public Attributes inherited from psyclone.psyir.nodes.scoping_node.ScopingNode
 symbol_table
 
- Public Attributes inherited from psyclone.psyir.nodes.node.Node
 position
 

Additional Inherited Members

- Static Public Attributes inherited from psyclone.psyir.nodes.node.Node
int START_DEPTH = 0
 
int START_POSITION = 0
 
 valid_annotations = tuple()
 

Detailed Description

Node representing a set of Routine and/or Container nodes, as well
as a name and a SymbolTable. This construct can be used to scope
symbols of variables, Routine names and Container names. In
Fortran a container would naturally represent a module or a
submodule.

:param str name: the name of the container.
:param parent: optional parent node of this Container in the PSyIR.
:type parent: :py:class:`psyclone.psyir.nodes.Node`
:param symbol_table: initialise the node with a given symbol table.
:type symbol_table: :py:class:`psyclone.psyir.symbols.SymbolTable` or \
        NoneType

Definition at line 49 of file container.py.

Member Function Documentation

◆ __eq__()

def psyclone.psyir.nodes.container.Container.__eq__ (   self,
  other 
)
Checks the equality of this Container with other. Containers are
equal if they are the same type, and have the same name.

:param object other: the object to check equality to.

:returns: whether other is equal to self.
:rtype: bool

Reimplemented from psyclone.psyir.nodes.scoping_node.ScopingNode.

Definition at line 73 of file container.py.

73  def __eq__(self, other):
74  '''Checks the equality of this Container with other. Containers are
75  equal if they are the same type, and have the same name.
76 
77  :param object other: the object to check equality to.
78 
79  :returns: whether other is equal to self.
80  :rtype: bool
81  '''
82  is_eq = super().__eq__(other)
83  is_eq = is_eq and self.name == other.name
84  return is_eq
85 

References psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg.name, psyclone.domain.gocean.transformations.gocean_const_loop_bounds_trans.GOConstLoopBoundsTrans.name(), psyclone.domain.gocean.transformations.gocean_move_iteration_boundaries_inside_kernel_trans.GOMoveIterationBoundariesInsideKernelTrans.name(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans.name(), psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata.name, psyclone.domain.nemo.transformations.create_nemo_invoke_schedule_trans.CreateNemoInvokeScheduleTrans.name(), psyclone.domain.nemo.transformations.create_nemo_psy_trans.CreateNemoPSyTrans.name(), psyclone.domain.nemo.transformations.nemo_allarrayrange2loop_trans.NemoAllArrayRange2LoopTrans.name(), psyclone.domain.nemo.transformations.nemo_arrayrange2loop_trans.NemoArrayRange2LoopTrans.name(), psyclone.domain.nemo.transformations.nemo_outerarrayrange2loop_trans.NemoOuterArrayRange2LoopTrans.name(), psyclone.dynamo0p3.DynamoPSy.name(), psyclone.expression.FunctionVar.name, psyclone.expression.NamedArg.name(), psyclone.gocean1p0.GOKernelGridArgument.name(), psyclone.gocean1p0.GOStencil.name(), psyclone.parse.algorithm.FileInfo.name(), psyclone.parse.algorithm.InvokeCall.name(), psyclone.parse.kernel.KernelProcedure.name(), psyclone.parse.kernel.KernelType.name(), psyclone.parse.module_info.ModuleInfo.name(), psyclone.psyad.transformations.assignment_trans.AssignmentTrans.name(), psyclone.psyGen.PSy.name(), psyclone.psyGen.Invoke.name(), psyclone.psyGen.Kern.name(), psyclone.psyGen.CodedKern.name, psyclone.psyGen.Argument.name(), psyclone.psyGen.Transformation.name(), psyclone.psyGen.DummyTransformation.name(), psyclone.psyir.nodes.container.Container.name, psyclone.psyir.nodes.member.Member.name, psyclone.psyir.nodes.reference.Reference.name(), psyclone.psyir.nodes.routine.Routine.name, psyclone.psyir.symbols.symbol.Symbol.name(), psyclone.psyir.transformations.allarrayaccess2loop_trans.AllArrayAccess2LoopTrans.name(), psyclone.psyir.transformations.arrayrange2loop_trans.ArrayRange2LoopTrans.name(), psyclone.psyir.transformations.fold_conditional_return_expressions_trans.FoldConditionalReturnExpressionsTrans.name(), psyclone.psyir.transformations.loop_trans.LoopTrans.name(), psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans.name(), psyclone.psyir.transformations.psy_data_trans.PSyDataTrans.name(), psyclone.transformations.OMPSingleTrans.name(), psyclone.transformations.OMPMasterTrans.name(), psyclone.transformations.OMPParallelTrans.name(), psyclone.transformations.MoveTrans.name(), psyclone.transformations.Dynamo0p3AsyncHaloExchangeTrans.name(), psyclone.transformations.Dynamo0p3KernelConstTrans.name(), psyclone.transformations.ACCEnterDataTrans.name(), psyclone.transformations.ACCRoutineTrans.name(), psyclone.transformations.ACCKernelsTrans.name(), psyclone.transformations.ACCDataTrans.name(), and psyclone.transformations.KernelImportsToArguments.name().

Here is the call graph for this function:

◆ create()

def psyclone.psyir.nodes.container.Container.create (   cls,
  name,
  symbol_table,
  children 
)
Create a Container instance given a name, a symbol table and a
list of child nodes.

:param str name: the name of the Container.
:param symbol_table: the symbol table associated with this \
    Container.
:type symbol_table: :py:class:`psyclone.psyir.symbols.SymbolTable`
:param children: a list of PSyIR nodes contained in the \
    Container. These must be Containers or Routines.
:type children: list of :py:class:`psyclone.psyir.nodes.Container` \
    or :py:class:`psyclone.psyir.nodes.Routine`

:returns: an instance of `cls`.
:rtype: :py:class:`psyclone.psyir.nodes.Container` or subclass
    thereof

:raises GenerationError: if the arguments to the create method \
    are not of the expected type.

Definition at line 101 of file container.py.

101  def create(cls, name, symbol_table, children):
102  '''Create a Container instance given a name, a symbol table and a
103  list of child nodes.
104 
105  :param str name: the name of the Container.
106  :param symbol_table: the symbol table associated with this \
107  Container.
108  :type symbol_table: :py:class:`psyclone.psyir.symbols.SymbolTable`
109  :param children: a list of PSyIR nodes contained in the \
110  Container. These must be Containers or Routines.
111  :type children: list of :py:class:`psyclone.psyir.nodes.Container` \
112  or :py:class:`psyclone.psyir.nodes.Routine`
113 
114  :returns: an instance of `cls`.
115  :rtype: :py:class:`psyclone.psyir.nodes.Container` or subclass
116  thereof
117 
118  :raises GenerationError: if the arguments to the create method \
119  are not of the expected type.
120 
121  '''
122  if not isinstance(name, str):
123  raise GenerationError(
124  f"name argument in create method of Container class "
125  f"should be a string but found '{type(name).__name__}'.")
126  if not isinstance(symbol_table, SymbolTable):
127  raise GenerationError(
128  f"symbol_table argument in create method of Container class "
129  f"should be a SymbolTable but found "
130  f"'{type(symbol_table).__name__}'.")
131  if not isinstance(children, list):
132  raise GenerationError(
133  f"children argument in create method of Container class "
134  f"should be a list but found '{type(children).__name__}'.")
135 
136  container = cls(name, symbol_table=symbol_table)
137  container.children = children
138  return container
139 
Here is the caller graph for this function:

◆ get_routine_psyir()

def psyclone.psyir.nodes.container.Container.get_routine_psyir (   self,
  name 
)
Returns the PSyIR for the routine with the given name, or None
if a routine with this name does not exist.

:param str name: name of the routine to find.

:returns: the PSyIR Routine instance of the subroutine, or None if
    there is no routine with that name in this container.
:rtype: Union[None, psyclone.psyir.nodes.Routine]

Definition at line 173 of file container.py.

173  def get_routine_psyir(self, name):
174  '''Returns the PSyIR for the routine with the given name, or None
175  if a routine with this name does not exist.
176 
177  :param str name: name of the routine to find.
178 
179  :returns: the PSyIR Routine instance of the subroutine, or None if
180  there is no routine with that name in this container.
181  :rtype: Union[None, psyclone.psyir.nodes.Routine]
182 
183  '''
184  name = name.lower()
185  for routine in self.walk(Routine):
186  if routine.name.lower() == name:
187  return routine
188  return None
189 
190 
191 # For AutoAPI documentation generation

References psyclone.psyir.nodes.node.Node.walk().

Here is the call graph for this function:

◆ name() [1/2]

◆ name() [2/2]

◆ node_str()

def psyclone.psyir.nodes.container.Container.node_str (   self,
  colour = True 
)
Returns the name of this node with appropriate control codes
to generate coloured output in a terminal that supports it.

:param bool colour: whether or not to include colour control codes.

:returns: description of this node, possibly coloured.
:rtype: str

Reimplemented from psyclone.psyir.nodes.node.Node.

Reimplemented in psyclone.psyir.nodes.file_container.FileContainer.

Definition at line 158 of file container.py.

158  def node_str(self, colour=True):
159  '''
160  Returns the name of this node with appropriate control codes
161  to generate coloured output in a terminal that supports it.
162 
163  :param bool colour: whether or not to include colour control codes.
164 
165  :returns: description of this node, possibly coloured.
166  :rtype: str
167  '''
168  return self.coloured_name(colour) + f"[{self.name}]"
169 

References psyclone.psyir.nodes.node.Node.coloured_name().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: