| 986 |
slepc |
1 |
/*
|
|
|
2 |
This file contains the Fortran version of SlepcInitialize().
|
| 1376 |
slepc |
3 |
|
|
|
4 |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
5 |
SLEPc - Scalable Library for Eigenvalue Problem Computations
|
|
|
6 |
Copyright (c) 2002-2007, Universidad Politecnica de Valencia, Spain
|
|
|
7 |
|
|
|
8 |
This file is part of SLEPc. See the README file for conditions of use
|
|
|
9 |
and additional information.
|
|
|
10 |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| 986 |
slepc |
11 |
*/
|
|
|
12 |
|
| 1469 |
slepc |
13 |
#include "private/fortranimpl.h"
|
| 986 |
slepc |
14 |
#include "slepc.h"
|
|
|
15 |
#include "slepcst.h"
|
|
|
16 |
#include "slepceps.h"
|
| 1375 |
slepc |
17 |
#include "slepcsvd.h"
|
|
|
18 |
#include "slepcip.h"
|
| 986 |
slepc |
19 |
|
|
|
20 |
extern PetscTruth SlepcBeganPetsc;
|
|
|
21 |
|
| 1409 |
slepc |
22 |
extern PetscTruth SlepcInitializeCalled;
|
| 986 |
slepc |
23 |
|
|
|
24 |
#ifdef PETSC_HAVE_FORTRAN_CAPS
|
|
|
25 |
#define petscinitialize_ PETSCINITIALIZE
|
|
|
26 |
#define slepcinitialize_ SLEPCINITIALIZE
|
|
|
27 |
#elif !defined(PETSC_HAVE_FORTRAN_UNDERSCORE)
|
|
|
28 |
#define petscinitialize_ petscinitialize
|
|
|
29 |
#define slepcinitialize_ slepcinitialize
|
|
|
30 |
#endif
|
|
|
31 |
|
|
|
32 |
EXTERN_C_BEGIN
|
| 1021 |
slepc |
33 |
extern void PETSC_STDCALL petscinitialize_(CHAR filename PETSC_MIXED_LEN(len),PetscErrorCode *ierr PETSC_END_LEN(len));
|
| 986 |
slepc |
34 |
EXTERN_C_END
|
|
|
35 |
|
|
|
36 |
#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
|
| 1363 |
slepc |
37 |
extern PetscDLLibrary DLLibrariesLoaded;
|
| 986 |
slepc |
38 |
#endif
|
|
|
39 |
|
|
|
40 |
EXTERN_C_BEGIN
|
|
|
41 |
/*
|
|
|
42 |
SlepcInitialize - Version called from Fortran.
|
|
|
43 |
|
|
|
44 |
Notes:
|
|
|
45 |
Since this routine is called from Fortran it does not return error codes.
|
|
|
46 |
*/
|
|
|
47 |
void PETSC_STDCALL slepcinitialize_(CHAR filename PETSC_MIXED_LEN(len),int *ierr PETSC_END_LEN(len))
|
|
|
48 |
{
|
|
|
49 |
#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
|
|
|
50 |
char libs[PETSC_MAX_PATH_LEN],dlib[PETSC_MAX_PATH_LEN];
|
|
|
51 |
PetscTruth found;
|
|
|
52 |
#endif
|
|
|
53 |
*ierr = 1;
|
|
|
54 |
if (SlepcInitializeCalled) {*ierr = 0; return;}
|
|
|
55 |
|
|
|
56 |
if (!PetscInitializeCalled) {
|
| 1021 |
slepc |
57 |
#if defined(PETSC_HAVE_FORTRAN_MIXED_STR_ARG)
|
| 986 |
slepc |
58 |
petscinitialize_(filename,len,ierr);
|
|
|
59 |
#else
|
|
|
60 |
petscinitialize_(filename,ierr,len);
|
|
|
61 |
#endif
|
| 1021 |
slepc |
62 |
if (*ierr) { (*PetscErrorPrintf)("SlepcInitialize:PetscInitialize failed");return;}
|
| 986 |
slepc |
63 |
SlepcBeganPetsc = PETSC_TRUE;
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
|
|
|
67 |
*ierr = PetscStrcpy(libs,SLEPC_LIB_DIR);if (*ierr) return;
|
|
|
68 |
*ierr = PetscStrcat(libs,"/libslepc");if (*ierr) return;
|
|
|
69 |
*ierr = PetscDLLibraryRetrieve(PETSC_COMM_WORLD,libs,dlib,1024,&found);if (*ierr) return;
|
|
|
70 |
if (found) {
|
|
|
71 |
*ierr = PetscDLLibraryAppend(PETSC_COMM_WORLD,&DLLibrariesLoaded,libs);if (*ierr) return;
|
|
|
72 |
} else {
|
|
|
73 |
*ierr = 1;
|
|
|
74 |
(*PetscErrorPrintf)("Unable to locate SLEPc dynamic library %s \n You cannot move the dynamic libraries!\n or remove USE_DYNAMIC_LIBRARIES from ${PETSC_DIR}/bmake/$PETSC_ARCH/petscconf.h\n and rebuild libraries before moving\n",libs);
|
|
|
75 |
return;
|
|
|
76 |
}
|
|
|
77 |
#else
|
| 1021 |
slepc |
78 |
*ierr = STInitializePackage(PETSC_NULL); if (*ierr) { (*PetscErrorPrintf)("SlepcInitialize:Initializing ST package");return;}
|
|
|
79 |
*ierr = EPSInitializePackage(PETSC_NULL); if (*ierr) { (*PetscErrorPrintf)("SlepcInitialize:Initializing EPS package");return;}
|
| 1375 |
slepc |
80 |
*ierr = SVDInitializePackage(PETSC_NULL); if (*ierr) { (*PetscErrorPrintf)("SlepcInitialize:Initializing SVD package");return;}
|
|
|
81 |
*ierr = IPInitializePackage(PETSC_NULL); if (*ierr) { (*PetscErrorPrintf)("SlepcInitialize:Initializing IP package");return;}
|
| 986 |
slepc |
82 |
#endif
|
|
|
83 |
|
|
|
84 |
SlepcInitializeCalled = PETSC_TRUE;
|
| 1038 |
slepc |
85 |
*ierr = PetscInfo(0,"SLEPc successfully started from Fortran\n");
|
| 1037 |
slepc |
86 |
if (*ierr) { (*PetscErrorPrintf)("SlepcInitialize:Calling PetscInfo()");return;}
|
| 986 |
slepc |
87 |
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
EXTERN_C_END
|