1a5eb4965SSatish Balay #ifdef PETSC_RCS_HEADER 2*82bf6240SBarry Smith static char vcid[] = "$Id: snesregi.c,v 1.21 1997/10/19 03:29:25 bsmith Exp bsmith $"; 3eaa2832dSBarry Smith #endif 4eaa2832dSBarry Smith 570f55243SBarry Smith #include "src/snes/snesimpl.h" /*I "snes.h" I*/ 640191667SLois Curfman McInnes extern int SNESCreate_EQ_LS(SNES); 740191667SLois Curfman McInnes extern int SNESCreate_EQ_TR(SNES); 840191667SLois Curfman McInnes extern int SNESCreate_UM_TR(SNES); 940191667SLois Curfman McInnes extern int SNESCreate_UM_LS(SNES); 10c6abb9f5SBarry Smith extern int SNESCreate_Test(SNES); 11eaa2832dSBarry Smith 12*82bf6240SBarry Smith #if defined(USE_DYNAMIC_LIBRARIES) 13*82bf6240SBarry Smith #define SNESRegister(a,b,c,d) SNESRegister_Private(a,b,c,0) 14*82bf6240SBarry Smith #else 15*82bf6240SBarry Smith #define SNESRegister(a,b,c,d) SNESRegister_Private(a,b,c,d) 16*82bf6240SBarry Smith #endif 17*82bf6240SBarry Smith 18*82bf6240SBarry Smith #undef __FUNC__ 19*82bf6240SBarry Smith #define __FUNC__ "SNESRegister_Private" 20*82bf6240SBarry Smith static int SNESRegister_Private(char *sname,char *path,char *name,int (*function)(SNES)) 21*82bf6240SBarry Smith { 22*82bf6240SBarry Smith char fullname[256]; 23*82bf6240SBarry Smith int ierr; 24*82bf6240SBarry Smith 25*82bf6240SBarry Smith PetscFunctionBegin; 26*82bf6240SBarry Smith PetscStrcpy(fullname,path); PetscStrcat(fullname,":");PetscStrcat(fullname,name); 27*82bf6240SBarry Smith ierr = DLRegister(&SNESList,sname,fullname, (int (*)(void*))function);CHKERRQ(ierr); 28*82bf6240SBarry Smith PetscFunctionReturn(0); 29*82bf6240SBarry Smith } 30*82bf6240SBarry Smith 31*82bf6240SBarry Smith /* 32*82bf6240SBarry Smith This is used by SNESSetType() to make sure that at least one 33*82bf6240SBarry Smith SNESRegisterAll() is called. In general, if there is more than one 34*82bf6240SBarry Smith DLL then SNESRegisterAll() may be called several times. 35*82bf6240SBarry Smith */ 36*82bf6240SBarry Smith extern int SNESRegisterAllCalled; 37*82bf6240SBarry Smith 385615d1e5SSatish Balay #undef __FUNC__ 39d4bb536fSBarry Smith #define __FUNC__ "SNESRegisterAll" 4083f0b094SBarry Smith /*@C 41*82bf6240SBarry Smith SNESRegisterAll - Registers all of the nonlinear solver methods in the SNES package. 42eaa2832dSBarry Smith 43*82bf6240SBarry Smith .keywords: SNES, register, all 44eaa2832dSBarry Smith 45*82bf6240SBarry Smith .seealso: SNESRegisterDestroy() 46eaa2832dSBarry Smith @*/ 47*82bf6240SBarry Smith int SNESRegisterAll(char *path) 48eaa2832dSBarry Smith { 49*82bf6240SBarry Smith int ierr; 50*82bf6240SBarry Smith 513a40ed3dSBarry Smith PetscFunctionBegin; 5284cb2905SBarry Smith SNESRegisterAllCalled = 1; 53*82bf6240SBarry Smith 54*82bf6240SBarry Smith ierr = SNESRegister("ls", path,"SNESCreate_EQ_LS",SNESCreate_EQ_LS);CHKERRQ(ierr); 55*82bf6240SBarry Smith ierr = SNESRegister("tr", path,"SNESCreate_EQ_TR",SNESCreate_EQ_TR);CHKERRQ(ierr); 56*82bf6240SBarry Smith ierr = SNESRegister("test", path,"SNESCreate_Test", SNESCreate_Test);CHKERRQ(ierr); 57*82bf6240SBarry Smith ierr = SNESRegister("umtr", path,"SNESCreate_UM_TR",SNESCreate_UM_TR);CHKERRQ(ierr); 58*82bf6240SBarry Smith ierr = SNESRegister("umls", path,"SNESCreate_UM_LS",SNESCreate_UM_LS);CHKERRQ(ierr); 59*82bf6240SBarry Smith 603a40ed3dSBarry Smith PetscFunctionReturn(0); 61eaa2832dSBarry Smith } 62*82bf6240SBarry Smith 63