| 6 |
dsic.upv.es!jroman |
1 |
|
| 183 |
dsic.upv.es!antodo |
2 |
#include "slepc.h" /*I "slepc.h" I*/
|
| 341 |
dsic.upv.es!antodo |
3 |
#include "slepceps.h"
|
|
|
4 |
#include "slepcst.h"
|
| 6 |
dsic.upv.es!jroman |
5 |
|
|
|
6 |
#undef __FUNCT__
|
|
|
7 |
#define __FUNCT__ "SlepcPrintVersion"
|
|
|
8 |
/*
|
|
|
9 |
SlepcPrintVersion - Prints SLEPc version info.
|
|
|
10 |
|
|
|
11 |
Collective on MPI_Comm
|
|
|
12 |
*/
|
| 476 |
dsic.upv.es!antodo |
13 |
PetscErrorCode SlepcPrintVersion(MPI_Comm comm)
|
| 6 |
dsic.upv.es!jroman |
14 |
{
|
|
|
15 |
int info = 0;
|
|
|
16 |
|
|
|
17 |
PetscFunctionBegin;
|
|
|
18 |
|
|
|
19 |
info = (*PetscHelpPrintf)(comm,"--------------------------------------------\
|
|
|
20 |
------------------------------\n"); CHKERRQ(info);
|
|
|
21 |
info = (*PetscHelpPrintf)(comm,"\t %s\n",SLEPC_VERSION_NUMBER); CHKERRQ(info);
|
|
|
22 |
info = (*PetscHelpPrintf)(comm,"%s",SLEPC_AUTHOR_INFO); CHKERRQ(info);
|
| 761 |
dsic.upv.es!jroman |
23 |
info = (*PetscHelpPrintf)(comm,"See docs/manual.html for help. \n"); CHKERRQ(info);
|
| 6 |
dsic.upv.es!jroman |
24 |
#if !defined(PARCH_win32)
|
|
|
25 |
info = (*PetscHelpPrintf)(comm,"SLEPc libraries linked from %s\n",SLEPC_LIB_DIR); CHKERRQ(info);
|
|
|
26 |
#endif
|
|
|
27 |
info = (*PetscHelpPrintf)(comm,"--------------------------------------------\
|
|
|
28 |
------------------------------\n"); CHKERRQ(info);
|
|
|
29 |
|
|
|
30 |
PetscFunctionReturn(info);
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
#undef __FUNCT__
|
|
|
34 |
#define __FUNCT__ "SlepcPrintHelpIntro"
|
|
|
35 |
/*
|
|
|
36 |
SlepcPrintHelpIntro - Prints introductory SLEPc help info.
|
|
|
37 |
|
|
|
38 |
Collective on MPI_Comm
|
|
|
39 |
*/
|
| 476 |
dsic.upv.es!antodo |
40 |
PetscErrorCode SlepcPrintHelpIntro(MPI_Comm comm)
|
| 6 |
dsic.upv.es!jroman |
41 |
{
|
|
|
42 |
int info = 0;
|
|
|
43 |
|
|
|
44 |
PetscFunctionBegin;
|
|
|
45 |
|
|
|
46 |
info = (*PetscHelpPrintf)(comm,"--------------------------------------------\
|
|
|
47 |
------------------------------\n"); CHKERRQ(info);
|
|
|
48 |
info = (*PetscHelpPrintf)(comm,"SLEPc help information includes that for the PETSc libraries, which provide\n"); CHKERRQ(info);
|
|
|
49 |
info = (*PetscHelpPrintf)(comm,"low-level system infrastructure and linear algebra tools.\n"); CHKERRQ(info);
|
|
|
50 |
info = (*PetscHelpPrintf)(comm,"--------------------------------------------\
|
|
|
51 |
------------------------------\n"); CHKERRQ(info);
|
|
|
52 |
|
|
|
53 |
PetscFunctionReturn(info);
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
/* ------------------------Nasty global variables -------------------------------*/
|
|
|
57 |
/*
|
|
|
58 |
Indicates whether SLEPc started PETSc, or whether it was
|
|
|
59 |
already started before SLEPc was initialized.
|
|
|
60 |
*/
|
|
|
61 |
PetscTruth SlepcBeganPetsc = PETSC_FALSE;
|
|
|
62 |
PetscTruth SlepcInitializeCalled = PETSC_FALSE;
|
|
|
63 |
|
|
|
64 |
#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
|
|
|
65 |
extern PetscDLLibraryList DLLibrariesLoaded;
|
|
|
66 |
#endif
|
|
|
67 |
|
|
|
68 |
#undef __FUNCT__
|
|
|
69 |
#define __FUNCT__ "SlepcInitialize"
|
|
|
70 |
/*@C
|
|
|
71 |
SlepcInitialize - Initializes the SLEPc library. SlepcInitialize() calls
|
|
|
72 |
PetscInitialize() if that has not been called yet, so this routine should
|
|
|
73 |
always be called near the beginning of your program.
|
|
|
74 |
|
|
|
75 |
Collective on MPI_COMM_WORLD or PETSC_COMM_WORLD if it has been set
|
|
|
76 |
|
|
|
77 |
Input Parameters:
|
|
|
78 |
+ argc - count of number of command line arguments
|
|
|
79 |
. args - the command line arguments
|
|
|
80 |
. file - [optional] PETSc database file, defaults to ~username/.petscrc
|
|
|
81 |
(use PETSC_NULL for default)
|
|
|
82 |
- help - [optional] Help message to print, use PETSC_NULL for no message
|
|
|
83 |
|
|
|
84 |
Fortran Note:
|
|
|
85 |
Fortran syntax is very similar to that of PetscInitialize()
|
|
|
86 |
|
|
|
87 |
Level: beginner
|
|
|
88 |
|
|
|
89 |
.seealso: SlepcInitializeFortran(), SlepcFinalize(), PetscInitialize()
|
|
|
90 |
@*/
|
| 476 |
dsic.upv.es!antodo |
91 |
PetscErrorCode SlepcInitialize(int *argc,char ***args,char file[],const char help[])
|
| 6 |
dsic.upv.es!jroman |
92 |
{
|
| 842 |
dsic.upv.es!antodo |
93 |
PetscErrorCode ierr;
|
|
|
94 |
PetscErrorCode info=0;
|
| 373 |
dsic.upv.es!antodo |
95 |
#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
|
| 476 |
dsic.upv.es!antodo |
96 |
char libs[PETSC_MAX_PATH_LEN],dlib[PETSC_MAX_PATH_LEN];
|
|
|
97 |
PetscTruth found;
|
| 373 |
dsic.upv.es!antodo |
98 |
#endif
|
| 6 |
dsic.upv.es!jroman |
99 |
|
|
|
100 |
PetscFunctionBegin;
|
|
|
101 |
|
|
|
102 |
if (SlepcInitializeCalled==PETSC_TRUE) {
|
|
|
103 |
PetscFunctionReturn(0);
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
#if !defined(PARCH_t3d)
|
|
|
107 |
info = PetscSetHelpVersionFunctions(SlepcPrintHelpIntro,SlepcPrintVersion);CHKERRQ(info);
|
|
|
108 |
#endif
|
|
|
109 |
|
|
|
110 |
if (!PetscInitializeCalled) {
|
|
|
111 |
info = PetscInitialize(argc,args,file,help);CHKERRQ(info);
|
|
|
112 |
SlepcBeganPetsc = PETSC_TRUE;
|
|
|
113 |
}
|
|
|
114 |
|
|
|
115 |
/*
|
|
|
116 |
Load the dynamic libraries
|
|
|
117 |
*/
|
|
|
118 |
|
|
|
119 |
#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
|
|
|
120 |
ierr = PetscStrcpy(libs,SLEPC_LIB_DIR);CHKERRQ(ierr);
|
|
|
121 |
ierr = PetscStrcat(libs,"/libslepc");CHKERRQ(ierr);
|
|
|
122 |
ierr = PetscDLLibraryRetrieve(PETSC_COMM_WORLD,libs,dlib,1024,&found);CHKERRQ(ierr);
|
|
|
123 |
if (found) {
|
|
|
124 |
ierr = PetscDLLibraryAppend(PETSC_COMM_WORLD,&DLLibrariesLoaded,libs);CHKERRQ(ierr);
|
|
|
125 |
} else {
|
|
|
126 |
SETERRQ1(1,"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",libs);
|
|
|
127 |
}
|
|
|
128 |
#else
|
| 842 |
dsic.upv.es!antodo |
129 |
ierr = STInitializePackage(PETSC_NULL); CHKERRQ(ierr);
|
|
|
130 |
ierr = EPSInitializePackage(PETSC_NULL); CHKERRQ(ierr);
|
| 6 |
dsic.upv.es!jroman |
131 |
#endif
|
|
|
132 |
|
|
|
133 |
SlepcInitializeCalled = PETSC_TRUE;
|
| 1038 |
slepc |
134 |
PetscInfo(0,"SLEPc successfully started\n");
|
| 6 |
dsic.upv.es!jroman |
135 |
PetscFunctionReturn(info);
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
#undef __FUNCT__
|
|
|
139 |
#define __FUNCT__ "SlepcFinalize"
|
|
|
140 |
/*@
|
|
|
141 |
SlepcFinalize - Checks for options to be called at the conclusion
|
|
|
142 |
of the SLEPc program and calls PetscFinalize().
|
|
|
143 |
|
|
|
144 |
Collective on PETSC_COMM_WORLD
|
|
|
145 |
|
|
|
146 |
Level: beginner
|
|
|
147 |
|
|
|
148 |
.seealso: SlepcInitialize(), PetscFinalize()
|
|
|
149 |
@*/
|
| 476 |
dsic.upv.es!antodo |
150 |
PetscErrorCode SlepcFinalize(void)
|
| 6 |
dsic.upv.es!jroman |
151 |
{
|
| 572 |
dsic.upv.es!antodo |
152 |
PetscErrorCode info=0;
|
| 6 |
dsic.upv.es!jroman |
153 |
|
|
|
154 |
PetscFunctionBegin;
|
| 1038 |
slepc |
155 |
PetscInfo(0,"SLEPc successfully ended!\n");
|
| 6 |
dsic.upv.es!jroman |
156 |
|
|
|
157 |
if (SlepcBeganPetsc) {
|
|
|
158 |
info = PetscFinalize();CHKERRQ(info);
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
SlepcInitializeCalled = PETSC_FALSE;
|
|
|
162 |
|
|
|
163 |
PetscFunctionReturn(info);
|
|
|
164 |
}
|
|
|
165 |
|
| 842 |
dsic.upv.es!antodo |
166 |
#ifdef PETSC_USE_DYNAMIC_LIBRARIES
|
|
|
167 |
EXTERN_C_BEGIN
|
|
|
168 |
#undef __FUNCT__
|
|
|
169 |
#define __FUNCT__ "PetscDLLibraryRegister_slepc"
|
|
|
170 |
/*
|
|
|
171 |
PetscDLLibraryRegister - This function is called when the dynamic library
|
|
|
172 |
it is in is opened.
|
|
|
173 |
|
|
|
174 |
This one registers all the EPS and ST methods in the libslepc.a
|
|
|
175 |
library.
|
|
|
176 |
|
|
|
177 |
Input Parameter:
|
|
|
178 |
path - library path
|
|
|
179 |
*/
|
|
|
180 |
PetscErrorCode PetscDLLibraryRegister_slepc(char *path)
|
|
|
181 |
{
|
|
|
182 |
PetscErrorCode ierr;
|
|
|
183 |
|
|
|
184 |
ierr = PetscInitializeNoArguments(); if (ierr) return 1;
|
|
|
185 |
|
|
|
186 |
PetscFunctionBegin;
|
|
|
187 |
/*
|
|
|
188 |
If we got here then PETSc was properly loaded
|
|
|
189 |
*/
|
|
|
190 |
ierr = STInitializePackage(path); CHKERRQ(ierr);
|
|
|
191 |
ierr = EPSInitializePackage(path); CHKERRQ(ierr);
|
|
|
192 |
PetscFunctionReturn(0);
|
|
|
193 |
}
|
|
|
194 |
EXTERN_C_END
|
|
|
195 |
|
|
|
196 |
#endif /* PETSC_USE_DYNAMIC_LIBRARIES */
|