Actual source code: dm.c
1: /*$Id: dm.c,v 1.6 2001/06/21 21:19:29 bsmith Exp $*/
2:
3: #include src/dm/da/daimpl.h
5: /*
6: Provides an interface for functionality needed by the DAMG routines.
7: Currently this interface is supported by the DA and VecPack objects
8:
9: Note: this is actually no such thing as a DM object, rather it is
10: the common set of functions shared by DA and VecPack.
12: */
14: /*@C
15: DMDestroy - Destroys a vector packer or DA.
17: Collective on DM
19: Input Parameter:
20: . dm - the DM object to destroy
22: Level: developer
24: .seealso DMView(), DMCreateGlobalVector(), DMGetInterpolation(), DMGetColoring(), DMGetMatrix()
26: @*/
27: int DMDestroy(DM dm)
28: {
32: (*dm->bops->destroy)((PetscObject)dm);
33: return(0);
34: }
36: /*@C
37: DMView - Views a vector packer or DA.
39: Collective on DM
41: Input Parameter:
42: + dm - the DM object to view
43: - v - the viewer
45: Level: developer
47: .seealso DMDestroy(), DMCreateGlobalVector(), DMGetInterpolation(), DMGetColoring(), DMGetMatrix()
49: @*/
50: int DMView(DM dm,PetscViewer v)
51: {
55: if (dm->bops->view) {
56: (*dm->bops->view)((PetscObject)dm,v);
57: }
58: return(0);
59: }
61: /*@C
62: DMCreateGlobalVector - Creates a global vector from a DA or VecPack object
64: Collective on DM
66: Input Parameter:
67: . dm - the DM object
69: Output Parameter:
70: . vec - the global vector
72: Level: developer
74: .seealso DMDestroy(), DMView(), DMGetInterpolation(), DMGetColoring(), DMGetMatrix()
76: @*/
77: int DMCreateGlobalVector(DM dm,Vec *vec)
78: {
82: (*dm->ops->createglobalvector)(dm,vec);
83: return(0);
84: }
86: /*@C
87: DMGetInterpolation - Gets interpolation matrix between two DA or VecPack objects
89: Collective on DM
91: Input Parameter:
92: + dm1 - the DM object
93: - dm2 - the second, coarser DM object
95: Output Parameter:
96: + mat - the interpolation
97: - vec - the scaling (optional)
99: Level: developer
101: .seealso DMDestroy(), DMView(), DMCreateGlobalVector(), DMGetColoring(), DMGetMatrix()
103: @*/
104: int DMGetInterpolation(DM dm1,DM dm2,Mat *mat,Vec *vec)
105: {
109: (*dm1->ops->getinterpolation)(dm1,dm2,mat,vec);
110: return(0);
111: }
113: /*@C
114: DMGetColoring - Gets coloring and empty Jacobian for a DA or VecPack
116: Collective on DM
118: Input Parameter:
119: + dm - the DM object
120: - ctype - IS_COLORING_GHOSTED or IS_COLORING_LOCAL
122: Output Parameter:
123: . coloring - the coloring
125: Level: developer
127: .seealso DMDestroy(), DMView(), DMCreateGlobalVector(), DMGetInterpolation(), DMGetMatrix()
129: @*/
130: int DMGetColoring(DM dm,ISColoringType ctype,ISColoring *coloring)
131: {
135: (*dm->ops->getcoloring)(dm,ctype,coloring);
136: return(0);
137: }
139: /*@C
140: DMGetMatrix - Gets empty Jacobian for a DA or VecPack
142: Collective on DM
144: Input Parameter:
145: + dm - the DM object
146: - mtype - MATMPIAIJ or MATMPIBAIJ
148: Output Parameter:
149: . mat - the empty Jacobian
151: Level: developer
153: .seealso DMDestroy(), DMView(), DMCreateGlobalVector(), DMGetInterpolation(), DMGetMatrix()
155: @*/
156: int DMGetMatrix(DM dm,MatType mtype,Mat *mat)
157: {
161: (*dm->ops->getmatrix)(dm,mtype,mat);
162: return(0);
163: }
165: /*@C
166: DMRefine - Refines a DA or VecPack object
168: Collective on DM
170: Input Parameter:
171: + dm - the DM object
172: - comm - the communicator to contain the new DM object (or PETSC_NULL)
174: Output Parameter:
175: . dmf - the refined DM
177: Level: developer
179: .seealso DMDestroy(), DMView(), DMCreateGlobalVector(), DMGetInterpolation()
181: @*/
182: int DMRefine(DM dm,MPI_Comm comm,DM *dmf)
183: {
187: (*dm->ops->refine)(dm,comm,dmf);
188: return(0);
189: }