1 #ifdef PETSC_RCS_HEADER 2 static char vcid[] = "$Id: snesregi.c,v 1.21 1997/10/19 03:29:25 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 .keywords: SNES, register, all 44 45 .seealso: SNESRegisterDestroy() 46 @*/ 47 int SNESRegisterAll(char *path) 48 { 49 int ierr; 50 51 PetscFunctionBegin; 52 SNESRegisterAllCalled = 1; 53 54 ierr = SNESRegister("ls", path,"SNESCreate_EQ_LS",SNESCreate_EQ_LS);CHKERRQ(ierr); 55 ierr = SNESRegister("tr", path,"SNESCreate_EQ_TR",SNESCreate_EQ_TR);CHKERRQ(ierr); 56 ierr = SNESRegister("test", path,"SNESCreate_Test", SNESCreate_Test);CHKERRQ(ierr); 57 ierr = SNESRegister("umtr", path,"SNESCreate_UM_TR",SNESCreate_UM_TR);CHKERRQ(ierr); 58 ierr = SNESRegister("umls", path,"SNESCreate_UM_LS",SNESCreate_UM_LS);CHKERRQ(ierr); 59 60 PetscFunctionReturn(0); 61 } 62 63