Back to home page

darwin3

 
 

    


File indexing completed on 2024-12-17 18:40:00 UTC

view on githubraw file Latest commit 8fbfd1f3 on 2018-02-26 18:39:21 UTC
8fbfd1f382 Oliv*0001 '''
                0002 Generates lists of the names of ptracers used by the darwin package.
                0003 Separate lists are created for numbered tracers (like biomasses of a sequence
                0004 of plankton types) and others.  These lists are used for code generation
                0005 in the darwin package.
                0006 '''
                0007 
                0008 __all__ = ['checkflds', 'checklflds']
                0009 
                0010 import fortran
                0011 
                0012 p,conds = fortran.readparameters('DARWIN_SIZE.h', 'DARWIN_INDICES.h', conditions=True)
                0013 conditional = {}
                0014 for k,v in conds.items():
                0015     v = [c for c in v if not c.endswith('ALLOW_DARWIN\n')]
                0016     if k[0] == 'i' and len(v):
                0017         conditional[k[1:]] = (''.join(v), len(v)*'#endif\n')
                0018 
                0019 checkflds = []
                0020 checklflds = []
                0021 for k in p:
                0022     if k[0] == 'i' and k[1:4] not in ['Min', 'Max']:
                0023         name = k[1:]
                0024         pre,suf = conditional.get(name.lower(), ('', ''))
                0025         if 'e'+name in p:
                0026             checklflds.append((name, '{0:<5s}'.format(name), pre, suf))
                0027         else:
                0028             checkflds.append((name, '{0:<6s}'.format(name), pre, suf))
                0029