xref: /petsc/src/snes/interface/snesregi.c (revision fee21e364a2af8f69c0e7984443fdef19f844ae9)
1 #ifdef PETSC_RCS_HEADER
2 static char vcid[] = "$Id: snesregi.c,v 1.22 1998/03/06 00:18:38 bsmith Exp bsmith $";
3 #endif
4 
5 #include "src/snes/snesimpl.h"     /*I  "snes.h"  I*/
6 extern int SNESCreate_EQ_LS(SNES);
7 extern int SNESCreate_EQ_TR(SNES);
8 extern int SNESCreate_UM_TR(SNES);
9 extern int SNESCreate_UM_LS(SNES);
10 extern int SNESCreate_Test(SNES);
11 
12 #if defined(USE_DYNAMIC_LIBRARIES)
13 #define SNESRegister(a,b,c,d) SNESRegister_Private(a,b,c,0)
14 #else
15 #define SNESRegister(a,b,c,d) SNESRegister_Private(a,b,c,d)
16 #endif
17 
18 #undef __FUNC__
19 #define __FUNC__ "SNESRegister_Private"
20 static int SNESRegister_Private(char *sname,char *path,char *name,int (*function)(SNES))
21 {
22   char fullname[256];
23   int  ierr;
24 
25   PetscFunctionBegin;
26   PetscStrcpy(fullname,path); PetscStrcat(fullname,":");PetscStrcat(fullname,name);
27   ierr = DLRegister(&SNESList,sname,fullname, (int (*)(void*))function);CHKERRQ(ierr);
28   PetscFunctionReturn(0);
29 }
30 
31 /*
32       This is used by SNESSetType() to make sure that at least one
33     SNESRegisterAll() is called. In general, if there is more than one
34     DLL then SNESRegisterAll() may be called several times.
35 */
36 extern int SNESRegisterAllCalled;
37 
38 #undef __FUNC__
39 #define __FUNC__ "SNESRegisterAll"
40 /*@C
41   SNESRegisterAll - Registers all of the nonlinear solver methods in the SNES package.
42 
43   Not Collective
44 
45 .keywords: SNES, register, all
46 
47 .seealso:  SNESRegisterDestroy()
48 @*/
49 int SNESRegisterAll(char *path)
50 {
51   int ierr;
52 
53   PetscFunctionBegin;
54   SNESRegisterAllCalled = 1;
55 
56   ierr = SNESRegister("ls",   path,"SNESCreate_EQ_LS",SNESCreate_EQ_LS);CHKERRQ(ierr);
57   ierr = SNESRegister("tr",   path,"SNESCreate_EQ_TR",SNESCreate_EQ_TR);CHKERRQ(ierr);
58   ierr = SNESRegister("test", path,"SNESCreate_Test", SNESCreate_Test);CHKERRQ(ierr);
59   ierr = SNESRegister("umtr", path,"SNESCreate_UM_TR",SNESCreate_UM_TR);CHKERRQ(ierr);
60   ierr = SNESRegister("umls", path,"SNESCreate_UM_LS",SNESCreate_UM_LS);CHKERRQ(ierr);
61 
62   PetscFunctionReturn(0);
63 }
64 
65