Reference Guide  2.5.0
psyclone.domain.lfric.function_space.FunctionSpace Class Reference

Public Member Functions

def __init__ (self, name, kernel_args)
 
def orig_name (self)
 
def short_name (self)
 
def mangled_name (self)
 
def map_name (self)
 
def cbanded_map_name (self)
 
def cma_indirection_map_name (self)
 
def ndf_name (self)
 
def undf_name (self)
 
def get_basis_name (self, qr_var=None, on_space=None)
 
def get_diff_basis_name (self, qr_var=None, on_space=None)
 
def get_operator_name (self, operator_name, qr_var=None, on_space=None)
 
def field_on_space (self, arguments)
 
def cma_on_space (self, arguments)
 
def has_scalar_basis (self)
 
def has_vector_basis (self)
 
def has_scalar_diff_basis (self)
 
def has_vector_diff_basis (self)
 

Detailed Description

Manages the name of a function space. If it is an any_space or
any_discontinuous_space then its name is mangled such that it is unique
within the scope of an Invoke.

:param str name: original name of function space to create a \
                 mangled name for.
:param kernel_args: object encapsulating all arguments to the kernel, \
                    one or more of which are on this function space.
:type kernel_args: :py:class:`psyclone.dynamo0p3.DynKernelArguments`

:raises InternalError: if an unrecognised function space is encountered.

Definition at line 45 of file function_space.py.

Member Function Documentation

◆ cbanded_map_name()

def psyclone.domain.lfric.function_space.FunctionSpace.cbanded_map_name (   self)
:returns: the name of a column-banded dofmap for this FunctionSpace.
:rtype: str

Definition at line 213 of file function_space.py.

213  def cbanded_map_name(self):
214  ''':returns: the name of a column-banded dofmap for this FunctionSpace.
215  :rtype: str
216  '''
217  return "cbanded_map_" + self.mangled_name
218 

References psyclone.domain.lfric.function_space.FunctionSpace.mangled_name().

Here is the call graph for this function:

◆ cma_indirection_map_name()

def psyclone.domain.lfric.function_space.FunctionSpace.cma_indirection_map_name (   self)
:returns: the name of a CMA indirection dofmap for the supplied \
    FunctionSpace.
:rtype: str

Definition at line 220 of file function_space.py.

220  def cma_indirection_map_name(self):
221  ''':returns: the name of a CMA indirection dofmap for the supplied \
222  FunctionSpace.
223  :rtype: str
224  '''
225  return "cma_indirection_map_" + self.mangled_name
226 

References psyclone.domain.lfric.function_space.FunctionSpace.mangled_name().

Here is the call graph for this function:

◆ cma_on_space()

def psyclone.domain.lfric.function_space.FunctionSpace.cma_on_space (   self,
  arguments 
)
Returns the corresponding argument if the supplied list of
arguments contains a cma operator that maps to/from this FunctionSpace.
Otherwise this function returns None.

:param arguments: list of arguments to be tested.
:type arguments: :py:class:`psyclone.dynamo0p3.DynKernelArguments`

:returns: the argument from the supplied list of arguments that \
          contains a field that exists on this space or None.
:rtype: :py:class:`psyclone.dynamo0p3.DynKernelArgument` or None

Definition at line 339 of file function_space.py.

339  def cma_on_space(self, arguments):
340  '''Returns the corresponding argument if the supplied list of
341  arguments contains a cma operator that maps to/from this FunctionSpace.
342  Otherwise this function returns None.
343 
344  :param arguments: list of arguments to be tested.
345  :type arguments: :py:class:`psyclone.dynamo0p3.DynKernelArguments`
346 
347  :returns: the argument from the supplied list of arguments that \
348  contains a field that exists on this space or None.
349  :rtype: :py:class:`psyclone.dynamo0p3.DynKernelArgument` or None
350 
351  '''
352  if self.mangled_name in arguments.unique_fs_names:
353  for arg in arguments.args:
354  # First, test that arg is a CMA op as some argument objects
355  # won't have function spaces, e.g. scalars
356  if arg.argument_type == "gh_columnwise_operator" and \
357  self.orig_name in [arg.function_space_to.orig_name,
358  arg.function_space_from.orig_name]:
359  return arg
360  return None
361 

References psyclone.domain.lfric.function_space.FunctionSpace.mangled_name(), psyclone.domain.lfric.function_space.FunctionSpace.orig_name(), psyclone.dynamo0p3.DynamoPSy.orig_name(), and psyclone.psyir.symbols.interfaces.ImportInterface.orig_name().

Here is the call graph for this function:

◆ field_on_space()

def psyclone.domain.lfric.function_space.FunctionSpace.field_on_space (   self,
  arguments 
)
Returns the corresponding argument if the supplied list of
arguments contains a field that exists on this space. Otherwise this
function returns None.

:param arguments: list of arguments to be tested.
:type arguments: :py:class:`psyclone.dynamo0p3.DynKernelArguments`

:returns: the argument from the supplied list of arguments that \
          contains a field that exists on this space or None.
:rtype: :py:class:`psyclone.dynamo0p3.DynKernelArgument` or None

Definition at line 317 of file function_space.py.

317  def field_on_space(self, arguments):
318  '''Returns the corresponding argument if the supplied list of
319  arguments contains a field that exists on this space. Otherwise this
320  function returns None.
321 
322  :param arguments: list of arguments to be tested.
323  :type arguments: :py:class:`psyclone.dynamo0p3.DynKernelArguments`
324 
325  :returns: the argument from the supplied list of arguments that \
326  contains a field that exists on this space or None.
327  :rtype: :py:class:`psyclone.dynamo0p3.DynKernelArgument` or None
328 
329  '''
330  if self.mangled_name in arguments.unique_fs_names:
331  for arg in arguments.args:
332  # First, test that argument is a field as some argument
333  # objects won't have function spaces, e.g. scalars
334  if arg.is_field and \
335  arg.function_space.orig_name == self.orig_name:
336  return arg
337  return None
338 

References psyclone.domain.lfric.function_space.FunctionSpace.mangled_name(), psyclone.domain.lfric.function_space.FunctionSpace.orig_name(), psyclone.dynamo0p3.DynamoPSy.orig_name(), and psyclone.psyir.symbols.interfaces.ImportInterface.orig_name().

Here is the call graph for this function:

◆ get_basis_name()

def psyclone.domain.lfric.function_space.FunctionSpace.get_basis_name (   self,
  qr_var = None,
  on_space = None 
)
Returns a name for the basis function on this FunctionSpace. If
the name of an associated quadrature object is supplied then this
is appended to the returned name. Similarly, if the function space
at which the basis is to be evaluated is supplied then this is
also appended to the name.

:param string qr_var: the name of the Quadrature Object for which the \
                      basis functions are required
:param on_space: the function space at which the basis functions \
                 will be evaluated
:type on_space: :py:class:`psyclone.domain.lfric.FunctionSpace`
:returns: name for the Fortran array holding the basis function
:rtype: str

Definition at line 241 of file function_space.py.

241  def get_basis_name(self, qr_var=None, on_space=None):
242  '''
243  Returns a name for the basis function on this FunctionSpace. If
244  the name of an associated quadrature object is supplied then this
245  is appended to the returned name. Similarly, if the function space
246  at which the basis is to be evaluated is supplied then this is
247  also appended to the name.
248 
249  :param string qr_var: the name of the Quadrature Object for which the \
250  basis functions are required
251  :param on_space: the function space at which the basis functions \
252  will be evaluated
253  :type on_space: :py:class:`psyclone.domain.lfric.FunctionSpace`
254  :returns: name for the Fortran array holding the basis function
255  :rtype: str
256 
257  '''
258  name = "_".join(["basis", self.mangled_name])
259  if qr_var:
260  name += "_" + qr_var
261  if on_space:
262  name += "_on_" + on_space.mangled_name
263  return name
264 

References psyclone.domain.lfric.function_space.FunctionSpace.mangled_name().

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

◆ get_diff_basis_name()

def psyclone.domain.lfric.function_space.FunctionSpace.get_diff_basis_name (   self,
  qr_var = None,
  on_space = None 
)
Returns a name for the differential basis function on this
FunctionSpace.  If the name of an associated quadrature object is
supplied then this is appended to the returned name. Similarly, if the
function space at which the basis is to be evaluated is supplied then
this is also appended to the name.

:param str qr_var: the name of the Quadrature Object for which the \
                   differential basis functions are required.
:param on_space: the function space at which the differential basis \
                 functions will be evaluated
:type on_space: :py:class:`psyclone.dynamo0p3.domain.lfric.\
                FunctionSpace`
:returns: name for the Fortran array holding the differential basis \
          function
:rtype: str

Definition at line 265 of file function_space.py.

265  def get_diff_basis_name(self, qr_var=None, on_space=None):
266  '''
267  Returns a name for the differential basis function on this
268  FunctionSpace. If the name of an associated quadrature object is
269  supplied then this is appended to the returned name. Similarly, if the
270  function space at which the basis is to be evaluated is supplied then
271  this is also appended to the name.
272 
273  :param str qr_var: the name of the Quadrature Object for which the \
274  differential basis functions are required.
275  :param on_space: the function space at which the differential basis \
276  functions will be evaluated
277  :type on_space: :py:class:`psyclone.dynamo0p3.domain.lfric.\
278  FunctionSpace`
279  :returns: name for the Fortran array holding the differential basis \
280  function
281  :rtype: str
282 
283  '''
284  name = "diff_basis_" + self.mangled_name
285  if qr_var:
286  name += "_" + qr_var
287  if on_space:
288  name += "_on_" + on_space.mangled_name
289  return name
290 

References psyclone.domain.lfric.function_space.FunctionSpace.mangled_name().

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

◆ get_operator_name()

def psyclone.domain.lfric.function_space.FunctionSpace.get_operator_name (   self,
  operator_name,
  qr_var = None,
  on_space = None 
)
Returns the name of the specified operator (basis or differential
basis) for this FunctionSpace.

:param str operator_name: name (type) of the operator.
:param str qr_var: the name of the Quadrature Object for which the \
                   operator is required.
:param on_space: the function space at which the operator is required.
:type on_space: :py:class:`psyclone.domain.lfric.FunctionSpace`

:returns: name for the Fortran arry holding the named operator \
          for the specified function space.
:rtype: str

Definition at line 291 of file function_space.py.

291  def get_operator_name(self, operator_name, qr_var=None, on_space=None):
292  '''
293  Returns the name of the specified operator (basis or differential
294  basis) for this FunctionSpace.
295 
296  :param str operator_name: name (type) of the operator.
297  :param str qr_var: the name of the Quadrature Object for which the \
298  operator is required.
299  :param on_space: the function space at which the operator is required.
300  :type on_space: :py:class:`psyclone.domain.lfric.FunctionSpace`
301 
302  :returns: name for the Fortran arry holding the named operator \
303  for the specified function space.
304  :rtype: str
305 
306  '''
307  if operator_name == "gh_basis":
308  return self.get_basis_name(qr_var=qr_var, on_space=on_space)
309  if operator_name == "gh_diff_basis":
310  return self.get_diff_basis_name(qr_var=qr_var, on_space=on_space)
311 
312  const = LFRicConstants()
313  raise GenerationError(
314  f"Unsupported name '{operator_name}' found. Expected one of "
315  f"{const.VALID_METAFUNC_NAMES}")
316 

References psyclone.domain.lfric.function_space.FunctionSpace.get_basis_name(), and psyclone.domain.lfric.function_space.FunctionSpace.get_diff_basis_name().

Here is the call graph for this function:

◆ has_scalar_basis()

def psyclone.domain.lfric.function_space.FunctionSpace.has_scalar_basis (   self)
:returns: True if this function space has scalar basis functions.
:rtype: bool

Definition at line 363 of file function_space.py.

363  def has_scalar_basis(self):
364  ''':returns: True if this function space has scalar basis functions.
365  :rtype: bool
366  '''
367  const = LFRicConstants()
368  return self.orig_name.lower() in const.SCALAR_BASIS_SPACE_NAMES
369 

References psyclone.domain.lfric.function_space.FunctionSpace.orig_name(), psyclone.dynamo0p3.DynamoPSy.orig_name(), and psyclone.psyir.symbols.interfaces.ImportInterface.orig_name().

Here is the call graph for this function:

◆ has_scalar_diff_basis()

def psyclone.domain.lfric.function_space.FunctionSpace.has_scalar_diff_basis (   self)
:returns: True if this function space has scalar differential
    basis functions.
:rtype: bool

Definition at line 379 of file function_space.py.

379  def has_scalar_diff_basis(self):
380  ''':returns: True if this function space has scalar differential
381  basis functions.
382  :rtype: bool
383  '''
384  const = LFRicConstants()
385  return self.orig_name.lower() in const.SCALAR_DIFF_BASIS_SPACE_NAMES
386 

References psyclone.domain.lfric.function_space.FunctionSpace.orig_name(), psyclone.dynamo0p3.DynamoPSy.orig_name(), and psyclone.psyir.symbols.interfaces.ImportInterface.orig_name().

Here is the call graph for this function:

◆ has_vector_basis()

def psyclone.domain.lfric.function_space.FunctionSpace.has_vector_basis (   self)
:returns: True if this function space has vector basis functions.
:rtype: bool

Definition at line 371 of file function_space.py.

371  def has_vector_basis(self):
372  ''':returns: True if this function space has vector basis functions.
373  :rtype: bool
374  '''
375  const = LFRicConstants()
376  return self.orig_name.lower() in const.VECTOR_BASIS_SPACE_NAMES
377 

References psyclone.domain.lfric.function_space.FunctionSpace.orig_name(), psyclone.dynamo0p3.DynamoPSy.orig_name(), and psyclone.psyir.symbols.interfaces.ImportInterface.orig_name().

Here is the call graph for this function:

◆ has_vector_diff_basis()

def psyclone.domain.lfric.function_space.FunctionSpace.has_vector_diff_basis (   self)
:returns: True if this function space has vector differential
    basis functions.
:rtype: bool

Definition at line 388 of file function_space.py.

388  def has_vector_diff_basis(self):
389  ''':returns: True if this function space has vector differential
390  basis functions.
391  :rtype: bool
392  '''
393  const = LFRicConstants()
394  return self.orig_name.lower() in const.VECTOR_DIFF_BASIS_SPACE_NAMES

References psyclone.domain.lfric.function_space.FunctionSpace.orig_name(), psyclone.dynamo0p3.DynamoPSy.orig_name(), and psyclone.psyir.symbols.interfaces.ImportInterface.orig_name().

Here is the call graph for this function:

◆ mangled_name()

def psyclone.domain.lfric.function_space.FunctionSpace.mangled_name (   self)
Returns the mangled name of this function space such that it is
unique within the scope of an invoke. If the mangled name has not
been generated then we do that the first time we are called.

:returns: mangled name of this function space.
:rtype: str

Definition at line 112 of file function_space.py.

112  def mangled_name(self):
113  '''
114  Returns the mangled name of this function space such that it is
115  unique within the scope of an invoke. If the mangled name has not
116  been generated then we do that the first time we are called.
117 
118  :returns: mangled name of this function space.
119  :rtype: str
120 
121  '''
122  if self._mangled_name:
123  return self._mangled_name
124  # Cannot use kernel_args.field_on_space(x) here because that
125  # routine itself requires the mangled name in order to identify
126  # whether the space is present in the kernel call.
127  self._mangled_name = self._mangle_fs_name()
128  return self._mangled_name
129 

References psyclone.domain.lfric.function_space.FunctionSpace._kernel_args, psyclone.dynamo0p3.DynKernelArgument._kernel_args, psyclone.domain.lfric.function_space.FunctionSpace._mangle_fs_name(), psyclone.domain.lfric.function_space.FunctionSpace._mangled_name, psyclone.domain.lfric.function_space.FunctionSpace._orig_name, psyclone.psyGen.Argument._orig_name, psyclone.psyir.symbols.interfaces.ImportInterface._orig_name, and psyclone.domain.lfric.function_space.FunctionSpace._short_name.

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

◆ map_name()

def psyclone.domain.lfric.function_space.FunctionSpace.map_name (   self)
:returns: a dofmap name for the supplied FunctionSpace.
:rtype: str

Definition at line 206 of file function_space.py.

206  def map_name(self):
207  ''':returns: a dofmap name for the supplied FunctionSpace.
208  :rtype: str
209  '''
210  return "map_" + self.mangled_name
211 

References psyclone.domain.lfric.function_space.FunctionSpace.mangled_name().

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

◆ ndf_name()

def psyclone.domain.lfric.function_space.FunctionSpace.ndf_name (   self)
:returns: a ndf name for this FunctionSpace object.
:rtype: str

Definition at line 228 of file function_space.py.

228  def ndf_name(self):
229  ''':returns: a ndf name for this FunctionSpace object.
230  :rtype: str
231  '''
232  return "ndf_" + self.mangled_name
233 

References psyclone.domain.lfric.function_space.FunctionSpace.mangled_name().

Here is the call graph for this function:

◆ orig_name()

def psyclone.domain.lfric.function_space.FunctionSpace.orig_name (   self)
Returns the name of this function space as declared in the
kernel meta-data.

:returns: original name of this function space.
:rtype: str

Definition at line 88 of file function_space.py.

88  def orig_name(self):
89  '''
90  Returns the name of this function space as declared in the
91  kernel meta-data.
92 
93  :returns: original name of this function space.
94  :rtype: str
95 
96  '''
97  return self._orig_name
98 

References psyclone.domain.lfric.function_space.FunctionSpace._orig_name, psyclone.psyGen.Argument._orig_name, and psyclone.psyir.symbols.interfaces.ImportInterface._orig_name.

Here is the caller graph for this function:

◆ short_name()

def psyclone.domain.lfric.function_space.FunctionSpace.short_name (   self)
Returns the short name of this function space (original name for a
valid LFRic function space and condensed name for any_*_spaces).

:returns: short name of this function space.
:rtype: str

Definition at line 100 of file function_space.py.

100  def short_name(self):
101  '''
102  Returns the short name of this function space (original name for a
103  valid LFRic function space and condensed name for any_*_spaces).
104 
105  :returns: short name of this function space.
106  :rtype: str
107 
108  '''
109  return self._short_name
110 

References psyclone.domain.lfric.function_space.FunctionSpace._short_name.

◆ undf_name()

def psyclone.domain.lfric.function_space.FunctionSpace.undf_name (   self)
:returns: a undf name for this FunctionSpace object.
:rtype: str

Definition at line 235 of file function_space.py.

235  def undf_name(self):
236  ''':returns: a undf name for this FunctionSpace object.
237  :rtype: str
238  '''
239  return "undf_" + self.mangled_name
240 

References psyclone.domain.lfric.function_space.FunctionSpace.mangled_name().

Here is the call graph for this function:

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