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