Actual source code: daimpl.h
1: /* $Id: daimpl.h,v 1.44 2001/08/06 21:18:31 bsmith Exp $ */
3: /*
4: Distributed arrays - communication tools for parallel, rectangular grids.
5: */
7: #if !defined(_DAIMPL_H)
8: #define _DAIMPL_H
10: #include petscda.h
12: /*
13: The DM interface is shared by DA, VecPack, and any other object that may
14: be used with the DMMG class. If you change this MAKE SURE you change
15: struct _DAOps and struct _VecPackOps!
16: */
17: typedef struct _DMOps *DMOps;
18: struct _DMOps {
19: int (*view)(DM,PetscViewer);
20: int (*createglobalvector)(DM,Vec*);
21: int (*getcoloring)(DM,ISColoringType,ISColoring*);
22: int (*getmatrix)(DM,MatType,Mat*);
23: int (*getinterpolation)(DM,DM,Mat*,Vec*);
24: int (*refine)(DM,MPI_Comm,DM*);
25: };
27: struct _p_DM {
28: PETSCHEADER(struct _DMOps)
29: };
31: typedef struct _DAOps *DAOps;
32: struct _DAOps {
33: int (*view)(DA,PetscViewer);
34: int (*createglobalvector)(DA,Vec*);
35: int (*getcoloring)(DA,ISColoringType,ISColoring*);
36: int (*getmatrix)(DA,MatType,Mat*);
37: int (*getinterpolation)(DA,DA,Mat*,Vec*);
38: int (*refine)(DA,MPI_Comm,DA*);
39: };
41: struct _p_DA {
42: PETSCHEADER(struct _DAOps)
43: int M,N,P; /* array dimensions */
44: int m,n,p; /* processor layout */
45: int w; /* degrees of freedom per node */
46: int s; /* stencil width */
47: int xs,xe,ys,ye,zs,ze; /* range of local values */
48: int Xs,Xe,Ys,Ye,Zs,Ze; /* range including ghost values
49: values above already scaled by w */
50: int *idx,Nl; /* local to global map */
51: int base; /* global number of 1st local node */
52: DAPeriodicType wrap; /* indicates type of periodic boundaries */
53: VecScatter gtol,ltog,ltol; /* scatters, see below for details */
54: Vec global,local; /* vectors that are discrete functions */
55: DAStencilType stencil_type; /* stencil, either box or star */
56: int dim; /* DA dimension (1,2, or 3) */
57: DAInterpolationType interptype;
59: AO ao; /* application ordering context */
61: ISLocalToGlobalMapping ltogmap,ltogmapb; /* local to global mapping for associated vectors */
62: Vec coordinates; /* coordinates (x,y,x) of local nodes, not including ghosts*/
63: char **fieldname; /* names of individual components in vectors */
65: int *lx,*ly,*lz; /* number of nodes in each partition block along 3 axis */
66: Vec natural; /* global vector for storing items in natural order */
67: VecScatter gton; /* vector scatter from global to natural */
69: ISColoring localcoloring; /* set by DAGetColoring() */
70: ISColoring ghostedcoloring;
72: #define DA_MAX_WORK_VECTORS 10 /* work vectors available to users via DAVecGetArray() */
73: Vec localin[DA_MAX_WORK_VECTORS],localout[DA_MAX_WORK_VECTORS];
74: Vec globalin[DA_MAX_WORK_VECTORS],globalout[DA_MAX_WORK_VECTORS];
76: int refine_x,refine_y,refine_z; /* ratio used in refining */
78: #define DA_MAX_AD_ARRAYS 2 /* work arrays for holding derivative type data, via DAGetAdicArray() */
79: void *adarrayin[DA_MAX_AD_ARRAYS],*adarrayout[DA_MAX_AD_ARRAYS];
80: void *adarrayghostedin[DA_MAX_AD_ARRAYS],*adarrayghostedout[DA_MAX_AD_ARRAYS];
81: void *adstartin[DA_MAX_AD_ARRAYS],*adstartout[DA_MAX_AD_ARRAYS];
82: void *adstartghostedin[DA_MAX_AD_ARRAYS],*adstartghostedout[DA_MAX_AD_ARRAYS];
83: int tdof,ghostedtdof;
85: /* work arrays for holding derivative type data, via DAGetAdicMFArray() */
86: void *admfarrayin[DA_MAX_AD_ARRAYS],*admfarrayout[DA_MAX_AD_ARRAYS];
87: void *admfarrayghostedin[DA_MAX_AD_ARRAYS],*admfarrayghostedout[DA_MAX_AD_ARRAYS];
88: void *admfstartin[DA_MAX_AD_ARRAYS],*admfstartout[DA_MAX_AD_ARRAYS];
89: void *admfstartghostedin[DA_MAX_AD_ARRAYS],*admfstartghostedout[DA_MAX_AD_ARRAYS];
91: #define DA_MAX_WORK_ARRAYS 2 /* work arrays for holding work via DAGetArray() */
92: void *arrayin[DA_MAX_WORK_ARRAYS],*arrayout[DA_MAX_WORK_ARRAYS];
93: void *arrayghostedin[DA_MAX_WORK_ARRAYS],*arrayghostedout[DA_MAX_WORK_ARRAYS];
94: void *startin[DA_MAX_WORK_ARRAYS],*startout[DA_MAX_WORK_ARRAYS];
95: void *startghostedin[DA_MAX_WORK_ARRAYS],*startghostedout[DA_MAX_WORK_ARRAYS];
97: DALocalFunction1 lf;
98: DALocalFunction1 lj;
99: DALocalFunction1 adic_lf;
100: DALocalFunction1 adicmf_lf;
101: DALocalFunction1 adifor_lf;
102: DALocalFunction1 adiformf_lf;
104: int (*lfi)(DALocalInfo*,MatStencil*,void*,PetscScalar*,void*);
105: int (*adic_lfi)(DALocalInfo*,MatStencil*,void*,void*,void*);
106: int (*adicmf_lfi)(DALocalInfo*,MatStencil*,void*,void*,void*);
107: };
109: /*
110: Vectors:
111: Global has on each processor the interior degrees of freedom and
112: no ghost points. This vector is what the solvers usually see.
113: Local has on each processor the ghost points as well. This is
114: what code to calculate Jacobians, etc. usually sees.
115: Vector scatters:
116: gtol - Global representation to local
117: ltog - Local representation to global (involves no communication)
118: ltol - Local representation to local representation, updates the
119: ghostpoint values in the second vector from (correct) interior
120: values in the first vector. This is good for explicit
121: nearest neighbor timestepping.
122: */
124: EXTERN int DAView_Binary(DA,PetscViewer);
125: EXTERN_C_BEGIN
126: EXTERN int VecView_MPI_DA(Vec,PetscViewer);
127: EXTERN int VecLoadIntoVector_Binary_DA(PetscViewer,Vec);
128: EXTERN_C_END
130: #endif