Actual source code: aoreg.c
2: #include <../src/vec/is/ao/aoimpl.h>
4: PetscFunctionList AOList = NULL;
5: PetscBool AORegisterAllCalled = PETSC_FALSE;
7: /*@C
8: AOSetType - Builds an application ordering for a particular implementation.
10: Collective on AO
12: Input Parameters:
13: + ao - The AO object
14: - method - The name of the AO type
16: Options Database Key:
17: . -ao_type <type> - Sets the AO type; use -help for a list of available types
19: Notes:
20: See "petsc/include/petscao.h" for available AO types (for instance, AOBASIC and AOMEMORYSCALABLE).
22: Level: intermediate
24: .seealso: AOGetType(), AOCreate()
25: @*/
26: PetscErrorCode AOSetType(AO ao, AOType method)
27: {
28: PetscErrorCode (*r)(AO);
29: PetscBool match;
32: PetscObjectTypeCompare((PetscObject)ao, method, &match);
33: if (match) return 0;
35: AORegisterAll();
36: PetscFunctionListFind(AOList,method,&r);
38: if (ao->ops->destroy) {
39: (*ao->ops->destroy)(ao);
40: ao->ops->destroy = NULL;
41: }
43: (*r)(ao);
44: return 0;
45: }
47: /*@C
48: AOGetType - Gets the AO type name (as a string) from the AO.
50: Not Collective
52: Input Parameter:
53: . ao - The vector
55: Output Parameter:
56: . type - The AO type name
58: Level: intermediate
60: .seealso: AOSetType(), AOCreate()
61: @*/
62: PetscErrorCode AOGetType(AO ao, AOType *type)
63: {
66: AORegisterAll();
67: *type = ((PetscObject)ao)->type_name;
68: return 0;
69: }
71: /*--------------------------------------------------------------------------------------------------------------------*/
73: /*@C
74: AORegister - Register an application ordering method
76: Not Collective
78: Input Parameters:
79: + sname - the name of the AO scheme
80: - function - the create routine for the application ordering method
82: Level: advanced
84: .seealso: AOCreate(), AORegisterAll(), AOBASIC, AOADVANCED, AOMAPPING, AOMEMORYSCALABLE
86: @*/
87: PetscErrorCode AORegister(const char sname[], PetscErrorCode (*function)(AO))
88: {
89: AOInitializePackage();
90: PetscFunctionListAdd(&AOList,sname,function);
91: return 0;
92: }