Skip to content

Commit ea2c7d1

Browse files
committed
Merge branch 'jose/minor-fortran-stub-cleanup' into 'main'
More improvements to Fortran stubs and interfaces See merge request slepc/slepc!668
2 parents a92d577 + f411c61 commit ea2c7d1

File tree

59 files changed

+124
-2489
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+124
-2489
lines changed

config/packages/sowing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def __init__(self,argdb,log):
1919
self.downloadable = True
2020
self.inplace = False
2121
#self.gitcommit = '3a410fa51a7bb531676f16deb8bc0c1ded8293c3'
22-
self.version = '1.1.26.11'
22+
self.version = '1.1.26.12'
2323
obj = self.version if hasattr(self,'version') else self.gitcommit
2424
self.url = 'https://bitbucket.org/petsc/pkg-sowing/get/'+('v'+obj if hasattr(self,'version') else obj)+'.tar.gz'
2525
self.archive = 'sowing-'+obj+'.tar.gz'
@@ -69,7 +69,7 @@ def Process(self,slepcconf,slepcvars,slepcrules,slepc,petsc,archdir=''):
6969
self.log.write('Using BFORT='+bfort)
7070
sys.path.insert(0, os.path.abspath(os.path.join('lib','slepc','bin','maint')))
7171
import generatefortranstubs
72-
generatefortranstubs.main(slepc.dir,'' if self.inplace else petsc.archname,bfort,os.path.join(slepc.dir,'src'),0)
72+
generatefortranstubs.main(slepc.dir,'' if self.inplace else petsc.archname,bfort,slepc.dir,0)
7373
generatefortranstubs.processf90interfaces(slepc.dir,'' if self.inplace else petsc.archname,0)
7474
except:
7575
self.log.Exit('Try configuring with --download-sowing or use a Git version of PETSc')

include/slepc/private/slepcimpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
SLEPC_INTERN PetscBool SlepcBeganPetsc;
1919

20-
/*@C
20+
/*MC
2121
SlepcHeaderCreate - Creates a SLEPc object
2222
2323
Input Parameters:
@@ -37,7 +37,7 @@ SLEPC_INTERN PetscBool SlepcBeganPetsc;
3737
has been called.
3838
3939
Level: developer
40-
@*/
40+
M*/
4141
#define SlepcHeaderCreate(h,classid,class_name,descr,mansec,comm,destroy,view) \
4242
((PetscErrorCode)((!SlepcInitializeCalled && \
4343
PetscError(comm,__LINE__,PETSC_FUNCTION_NAME,__FILE__,PETSC_ERR_ORDER,PETSC_ERROR_INITIAL, \

lib/slepc/bin/maint/generatefortranstubs.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def findLineCol(filename, string):
2828

2929
data = re.subn('\00','',data)[0]
3030
data = re.subn('\nvoid ','\nSLEPC_EXTERN void ',data)[0]
31-
data = re.subn('\nPetscErrorCode ','\nSLEPC_EXTERN void ',data)[0]
31+
data = re.subn('\n[ ]*PetscErrorCode ','\nSLEPC_EXTERN void ',data)[0]
3232
data = re.subn(r'Petsc([ToRm]*)Pointer\(int\)','Petsc\\1Pointer(void*)',data)[0]
3333
data = re.subn(r'PetscToPointer\(a\) \(a\)','PetscToPointer(a) (a ? *(PetscFortranAddr *)(a) : 0)',data)[0]
3434
data = re.subn(r'PetscFromPointer\(a\) \(int\)\(a\)','PetscFromPointer(a) (PetscFortranAddr)(a)',data)[0]
@@ -115,6 +115,10 @@ def FixDir(petscdir,petscarch,parentdir,dir,verbose):
115115
if line.find('MANSEC') >=0 and not line.find('SUBMANSEC') >=0:
116116
mansec = line.split('=')[1].lower().strip()
117117

118+
# this is a hack for the include directory and will be wrong for any
119+
# non-sys static include functions
120+
if mansec == 'unknown': mansec = 'sys'
121+
if submansec == 'unknown': submansec = 'sys'
118122
if not bfortsubmansec == 'unknown':
119123
submansec = bfortsubmansec
120124

@@ -135,7 +139,6 @@ def FixDir(petscdir,petscarch,parentdir,dir,verbose):
135139
txt = fd.read()
136140
fd.close()
137141
if txt:
138-
if mansec == 'unknown': raise RuntimeError("Cannot have unknown mansec in " + parentdir)
139142
if mansec in ['bv','ds','fn','rg','st']:
140143
basedir = os.path.join(petscdir,petscarch,'src','sys','classes',mansec,'f90-mod','ftn-auto-interfaces')
141144
else:
@@ -165,6 +168,7 @@ def processDir(petscdir, petscarch, bfort, verbose, dirpath, dirnames, filenames
165168
''' Runs bfort on a directory and then fixes the files generated by bfort including moving generated F90 fortran interface files'''
166169
if not dirpath.startswith(petscdir): raise RuntimeError("Error, the directory being processed "+dirpath+" does not begin with SLEPC_DIR "+petscdir)
167170
sdirpath = dirpath.replace(petscdir+'/','')
171+
if sdirpath == 'include': sdirpath = os.path.join('src','sys')
168172
outdir = os.path.join(petscdir,petscarch,sdirpath,'ftn-auto')
169173
if filenames:
170174
PrepFtnDir(outdir)
@@ -263,10 +267,11 @@ def processf90interfaces(petscdir,petscarch,verbose):
263267
return
264268

265269
def main(petscdir,petscarch,bfort,dir,verbose):
266-
for dirpath, dirnames, filenames in os.walk(dir, topdown=True):
267-
filenames = [i for i in filenames if not i.find('#') > -1 and os.path.splitext(i)[1] in ['.c','.h','.cxx','.cu']]
268-
dirnames[:] = [d for d in dirnames if d not in ['output','tutorials','tests','binding','benchmarks'] and not d.startswith('ftn-') and not d.startswith('f90-')]
269-
processDir(petscdir, petscarch,bfort, verbose, dirpath, dirnames, filenames)
270+
for p in [ os.path.join(dir,'include'), os.path.join(dir,'src') ]:
271+
for dirpath, dirnames, filenames in os.walk(p, topdown=True):
272+
filenames = [i for i in filenames if not i.find('#') > -1 and os.path.splitext(i)[1] in ['.c','.h','.cxx','.cu']]
273+
dirnames[:] = [d for d in dirnames if d not in ['output', 'binding', 'tests', 'tutorials', 'yaml']]
274+
processDir(petscdir, petscarch,bfort, verbose, dirpath, dirnames, filenames)
270275
return
271276
#
272277
# generatefortranstubs bfortexectuable -verbose ----- generates fortran stubs for a directory and all its children
@@ -312,5 +317,5 @@ def not_empty(v):
312317
assert isinstance(args.bfort, (list, tuple))
313318
bfort_exec = args.bfort[0]
314319
assert isinstance(bfort_exec, str)
315-
ret = main(args.slepc_dir, args.petsc_arch, bfort_exec, os.path.join(args.slepc_dir, 'src'), args.verbose)
320+
ret = main(args.slepc_dir, args.petsc_arch, bfort_exec, args.slepc_dir, args.verbose)
316321
sys.exit(ret)

lib/slepc/conf/bfort-petsc.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
# petscao.h
44
nativeptr AO
55

6-
# petscbag.h
6+
# petscbag.h This is not a PETSc object
77
nativeptr PetscBag
88

9+
# this is not a PETSc object
10+
native PetscSFNode
11+
912
# petscdt.h
1013
native PetscDTNodeType
1114

@@ -46,8 +49,6 @@ native DMDALocalInfo
4649
native DMDAInterpolationType
4750
native DMDAElementType
4851

49-
nativeptr PetscGLL
50-
5152
# dmlabel.h
5253
nativeptr DMLabel
5354

@@ -144,7 +145,6 @@ native MatSTRUMPACKCompressionType
144145

145146
# petscpc.h
146147
nativeptr PC
147-
nativeptr PCType
148148

149149
native PCSide
150150
native PCJacobiType
@@ -176,7 +176,7 @@ nativeptr PetscConvEst
176176
native SNESConvergedReason
177177
native SNESLineSearchReason
178178
nativeptr MatMFFD
179-
nativeptr MatMFFDType
179+
native MatMFFDType
180180
nativeptr SNESLineSearch
181181
native SNESLineSearchOrder
182182
native SNESNormSchedule

0 commit comments

Comments
 (0)