xref: /petsc/include/petscao.h (revision 4827ddca42da2d0ec0d1a0d9b26e4c5ddc271c44)
1 /*
2   An application ordering is mapping between an application-centric
3   ordering (the ordering that is "natural" for the application) and
4   the parallel ordering that PETSc uses.
5 */
6 #if !defined(__PETSCAO_H)
7 #define __PETSCAO_H
8 #include "petscis.h"
9 #include "petscmat.h"
10 PETSC_EXTERN_CXX_BEGIN
11 
12 /*S
13      AO - Abstract PETSc object that manages mapping between different global numbering
14 
15    Level: intermediate
16 
17   Concepts: global numbering
18 
19 .seealso:  AOCreateBasic(), AOCreateBasicIS(), AOPetscToApplication(), AOView(), AOApplicationToPetsc()
20 S*/
21 typedef struct _p_AO* AO;
22 
23 /*E
24     AOType - String with the name of a PETSc application ordering or the creation function
25        with an optional dynamic library name.
26 
27    Level: beginner
28 
29 .seealso: AOSetType(), AO
30 E*/
31 #define AOType char*
32 #define AOBASIC               "basic"
33 #define AOADVANCED            "advanced"
34 #define AOMAPPING             "mapping"
35 #define AOMEMORYSCALABLE      "memoryscalable"
36 
37 /* Logging support */
38 extern PetscClassId  AO_CLASSID;
39 
40 extern PetscErrorCode  AOInitializePackage(const char[]);
41 
42 extern PetscErrorCode  AOCreate(MPI_Comm,AO*);
43 extern PetscErrorCode  AOSetIS(AO,IS,IS);
44 extern PetscErrorCode  AOSetFromOptions(AO);
45 
46 extern PetscErrorCode  AOCreateBasic(MPI_Comm,PetscInt,const PetscInt[],const PetscInt[],AO*);
47 extern PetscErrorCode  AOCreateBasicIS(IS,IS,AO*);
48 extern PetscErrorCode  AOCreateMemoryScalable(MPI_Comm,PetscInt,const PetscInt[],const PetscInt[],AO*);
49 extern PetscErrorCode  AOCreateMemoryScalableIS(IS,IS,AO*);
50 extern PetscErrorCode  AOCreateMapping(MPI_Comm,PetscInt,const PetscInt[],const PetscInt[],AO*);
51 extern PetscErrorCode  AOCreateMappingIS(IS,IS,AO*);
52 
53 extern PetscErrorCode  AOView(AO,PetscViewer);
54 
55 extern PetscErrorCode  AODestroy_(AO);
56 #define AODestroy(a)  (AODestroy_(a) || (((a) = 0),0))
57 
58 /* Dynamic creation and loading functions */
59 extern PetscFList AOList;
60 extern PetscBool  AORegisterAllCalled;
61 extern PetscErrorCode  AOSetType(AO, const AOType);
62 extern PetscErrorCode  AOGetType(AO, const AOType *);
63 
64 extern PetscErrorCode  AORegister(const char [], const char [], const char [], PetscErrorCode (*)(AO));
65 extern PetscErrorCode  AORegisterAll(const char []);
66 extern PetscErrorCode  AORegisterDestroy(void);
67 
68 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
69 #define AORegisterDynamic(a,b,c,d) AORegister(a,b,c,0)
70 #else
71 #define AORegisterDynamic(a,b,c,d) AORegister(a,b,c,d)
72 #endif
73 
74 extern PetscErrorCode  AOPetscToApplication(AO,PetscInt,PetscInt[]);
75 extern PetscErrorCode  AOApplicationToPetsc(AO,PetscInt,PetscInt[]);
76 extern PetscErrorCode  AOPetscToApplicationIS(AO,IS);
77 extern PetscErrorCode  AOApplicationToPetscIS(AO,IS);
78 
79 extern PetscErrorCode  AOPetscToApplicationPermuteInt(AO, PetscInt, PetscInt[]);
80 extern PetscErrorCode  AOApplicationToPetscPermuteInt(AO, PetscInt, PetscInt[]);
81 extern PetscErrorCode  AOPetscToApplicationPermuteReal(AO, PetscInt, PetscReal[]);
82 extern PetscErrorCode  AOApplicationToPetscPermuteReal(AO, PetscInt, PetscReal[]);
83 
84 extern PetscErrorCode  AOMappingHasApplicationIndex(AO, PetscInt, PetscBool  *);
85 extern PetscErrorCode  AOMappingHasPetscIndex(AO, PetscInt, PetscBool  *);
86 
87 /* ----------------------------------------------------*/
88 PETSC_EXTERN_CXX_END
89 #endif
90