xref: /petsc/src/snes/interface/snesregi.c (revision fee21e364a2af8f69c0e7984443fdef19f844ae9)
1a5eb4965SSatish Balay #ifdef PETSC_RCS_HEADER
2*fee21e36SBarry Smith static char vcid[] = "$Id: snesregi.c,v 1.22 1998/03/06 00:18:38 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 
1282bf6240SBarry Smith #if defined(USE_DYNAMIC_LIBRARIES)
1382bf6240SBarry Smith #define SNESRegister(a,b,c,d) SNESRegister_Private(a,b,c,0)
1482bf6240SBarry Smith #else
1582bf6240SBarry Smith #define SNESRegister(a,b,c,d) SNESRegister_Private(a,b,c,d)
1682bf6240SBarry Smith #endif
1782bf6240SBarry Smith 
1882bf6240SBarry Smith #undef __FUNC__
1982bf6240SBarry Smith #define __FUNC__ "SNESRegister_Private"
2082bf6240SBarry Smith static int SNESRegister_Private(char *sname,char *path,char *name,int (*function)(SNES))
2182bf6240SBarry Smith {
2282bf6240SBarry Smith   char fullname[256];
2382bf6240SBarry Smith   int  ierr;
2482bf6240SBarry Smith 
2582bf6240SBarry Smith   PetscFunctionBegin;
2682bf6240SBarry Smith   PetscStrcpy(fullname,path); PetscStrcat(fullname,":");PetscStrcat(fullname,name);
2782bf6240SBarry Smith   ierr = DLRegister(&SNESList,sname,fullname, (int (*)(void*))function);CHKERRQ(ierr);
2882bf6240SBarry Smith   PetscFunctionReturn(0);
2982bf6240SBarry Smith }
3082bf6240SBarry Smith 
3182bf6240SBarry Smith /*
3282bf6240SBarry Smith       This is used by SNESSetType() to make sure that at least one
3382bf6240SBarry Smith     SNESRegisterAll() is called. In general, if there is more than one
3482bf6240SBarry Smith     DLL then SNESRegisterAll() may be called several times.
3582bf6240SBarry Smith */
3682bf6240SBarry Smith extern int SNESRegisterAllCalled;
3782bf6240SBarry Smith 
385615d1e5SSatish Balay #undef __FUNC__
39d4bb536fSBarry Smith #define __FUNC__ "SNESRegisterAll"
4083f0b094SBarry Smith /*@C
4182bf6240SBarry Smith   SNESRegisterAll - Registers all of the nonlinear solver methods in the SNES package.
42eaa2832dSBarry Smith 
43*fee21e36SBarry Smith   Not Collective
44*fee21e36SBarry Smith 
4582bf6240SBarry Smith .keywords: SNES, register, all
46eaa2832dSBarry Smith 
4782bf6240SBarry Smith .seealso:  SNESRegisterDestroy()
48eaa2832dSBarry Smith @*/
4982bf6240SBarry Smith int SNESRegisterAll(char *path)
50eaa2832dSBarry Smith {
5182bf6240SBarry Smith   int ierr;
5282bf6240SBarry Smith 
533a40ed3dSBarry Smith   PetscFunctionBegin;
5484cb2905SBarry Smith   SNESRegisterAllCalled = 1;
5582bf6240SBarry Smith 
5682bf6240SBarry Smith   ierr = SNESRegister("ls",   path,"SNESCreate_EQ_LS",SNESCreate_EQ_LS);CHKERRQ(ierr);
5782bf6240SBarry Smith   ierr = SNESRegister("tr",   path,"SNESCreate_EQ_TR",SNESCreate_EQ_TR);CHKERRQ(ierr);
5882bf6240SBarry Smith   ierr = SNESRegister("test", path,"SNESCreate_Test", SNESCreate_Test);CHKERRQ(ierr);
5982bf6240SBarry Smith   ierr = SNESRegister("umtr", path,"SNESCreate_UM_TR",SNESCreate_UM_TR);CHKERRQ(ierr);
6082bf6240SBarry Smith   ierr = SNESRegister("umls", path,"SNESCreate_UM_LS",SNESCreate_UM_LS);CHKERRQ(ierr);
6182bf6240SBarry Smith 
623a40ed3dSBarry Smith   PetscFunctionReturn(0);
63eaa2832dSBarry Smith }
6482bf6240SBarry Smith 
65