Reference Guide  2.5.0
psyclone.parse.kernel.KernelTypeFactory Class Reference
Inheritance diagram for psyclone.parse.kernel.KernelTypeFactory:

Public Member Functions

def __init__ (self, api="")
 
def create (self, parse_tree, name=None)
 

Detailed Description

Factory to create the required API-specific information about
coded-kernel metadata and a reference to its code.

:param str api: The API for which this factory is to create Kernel \
information. If it is not supplied then the default API, as \
specified in the PSyclone config file, is used.

Definition at line 210 of file kernel.py.

Member Function Documentation

◆ create()

def psyclone.parse.kernel.KernelTypeFactory.create (   self,
  parse_tree,
  name = None 
)
Create API-specific information about the kernel metadata and a
reference to its code. The API is set when the factory is
created.

:param parse_tree: The fparser1 parse tree for the Kernel code.
:type parse_tree: :py:class:`fparser.one.block_statements.BeginSource`

:param name: the name of the Kernel. Defaults to None if \
one is not provided.
:type name: str or NoneType

:raises ParseError: if the supplied API is not supported.

Definition at line 227 of file kernel.py.

227  def create(self, parse_tree, name=None):
228  '''Create API-specific information about the kernel metadata and a
229  reference to its code. The API is set when the factory is
230  created.
231 
232  :param parse_tree: The fparser1 parse tree for the Kernel code.
233  :type parse_tree: :py:class:`fparser.one.block_statements.BeginSource`
234 
235  :param name: the name of the Kernel. Defaults to None if \
236  one is not provided.
237  :type name: str or NoneType
238 
239  :raises ParseError: if the supplied API is not supported.
240 
241  '''
242  # Avoid circular import
243  # pylint: disable=import-outside-toplevel
244  if self._type == "dynamo0.3":
245  from psyclone.domain.lfric import LFRicKernMetadata
246  return LFRicKernMetadata(parse_tree, name=name)
247  if self._type == "gocean1.0":
248  from psyclone.gocean1p0 import GOKernelType1p0
249  return GOKernelType1p0(parse_tree, name=name)
250  raise ParseError(
251  f"KernelTypeFactory:create: Unsupported kernel type '{self._type}'"
252  f" found.")
253 
254 

References psyclone.parse.kernel.KernelTypeFactory._type, and psyclone.psyGen.PSyFactory._type.

Here is the caller graph for this function:

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