|
| 1 | +############################################################################## |
| 2 | +# Copyright (c) 2025, Met Office, on behalf of HMSO and Queen's Printer |
| 3 | +# For further details please refer to the file LICENCE.original which you |
| 4 | +# should have received as part of this distribution. |
| 5 | +############################################################################## |
| 6 | + |
| 7 | +''' |
| 8 | +Holds class with getter wrappers for global transformations which are |
| 9 | +pre-configured. Intended to reduce duplication when defining transformations. |
| 10 | +''' |
| 11 | + |
| 12 | + |
| 13 | +from psyclone.transformations import (OMPLoopTrans, OMPParallelTrans) |
| 14 | + |
| 15 | + |
| 16 | +class PropTrans: |
| 17 | + ''' |
| 18 | + Class to store pre-configured transformations with getters |
| 19 | + ''' |
| 20 | + def __init__(self): |
| 21 | + ''' |
| 22 | + Initialise class with default properties |
| 23 | + ''' |
| 24 | + |
| 25 | + # Setup transformations and their properties |
| 26 | + # OMP parallel do transformation |
| 27 | + self._omp_transform_par_do = OMPLoopTrans( |
| 28 | + omp_schedule="static", |
| 29 | + omp_directive="paralleldo") |
| 30 | + self._omp_parallel = OMPParallelTrans() |
| 31 | + self._omp_transform_do = OMPLoopTrans( |
| 32 | + omp_schedule="static", |
| 33 | + omp_directive="do") |
| 34 | + |
| 35 | + |
| 36 | + # Getters |
| 37 | + def omp_transform_par_do(self): |
| 38 | + ''' |
| 39 | + Get pre configured omp_transform_par_do |
| 40 | + ''' |
| 41 | + return self._omp_transform_par_do |
| 42 | + |
| 43 | + def omp_parallel(self): |
| 44 | + ''' |
| 45 | + Get pre configured omp_parallel |
| 46 | + ''' |
| 47 | + return self._omp_parallel |
| 48 | + |
| 49 | + def omp_transform_do(self): |
| 50 | + ''' |
| 51 | + Get pre configured omp_transform_do |
| 52 | + ''' |
| 53 | + return self._omp_transform_do |
0 commit comments