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: #undef __FUNCT__  
 16: /*@C
 17:     DMDestroy - Destroys a vector packer or DA.

 19:     Collective on DM

 21:     Input Parameter:
 22: .   dm - the DM object to destroy

 24:     Level: developer

 26: .seealso DMView(), DMCreateGlobalVector(), DMGetInterpolation(), DMGetColoring(), DMGetMatrix()

 28: @*/
 29: int DMDestroy(DM dm)
 30: {

 34:   (*dm->bops->destroy)((PetscObject)dm);
 35:   return(0);
 36: }

 38: #undef __FUNCT__  
 40: /*@C
 41:     DMView - Views a vector packer or DA.

 43:     Collective on DM

 45:     Input Parameter:
 46: +   dm - the DM object to view
 47: -   v - the viewer

 49:     Level: developer

 51: .seealso DMDestroy(), DMCreateGlobalVector(), DMGetInterpolation(), DMGetColoring(), DMGetMatrix()

 53: @*/
 54: int DMView(DM dm,PetscViewer v)
 55: {

 59:   if (dm->bops->view) {
 60:     (*dm->bops->view)((PetscObject)dm,v);
 61:   }
 62:   return(0);
 63: }

 65: #undef __FUNCT__  
 67: /*@C
 68:     DMCreateGlobalVector - Creates a global vector from a DA or VecPack object

 70:     Collective on DM

 72:     Input Parameter:
 73: .   dm - the DM object

 75:     Output Parameter:
 76: .   vec - the global vector

 78:     Level: developer

 80: .seealso DMDestroy(), DMView(), DMGetInterpolation(), DMGetColoring(), DMGetMatrix()

 82: @*/
 83: int DMCreateGlobalVector(DM dm,Vec *vec)
 84: {

 88:   (*dm->ops->createglobalvector)(dm,vec);
 89:   return(0);
 90: }

 92: #undef __FUNCT__  
 94: /*@C
 95:     DMGetInterpolation - Gets interpolation matrix between two DA or VecPack objects

 97:     Collective on DM

 99:     Input Parameter:
100: +   dm1 - the DM object
101: -   dm2 - the second, coarser DM object

103:     Output Parameter:
104: +  mat - the interpolation
105: -  vec - the scaling (optional)

107:     Level: developer

109: .seealso DMDestroy(), DMView(), DMCreateGlobalVector(), DMGetColoring(), DMGetMatrix()

111: @*/
112: int DMGetInterpolation(DM dm1,DM dm2,Mat *mat,Vec *vec)
113: {

117:   (*dm1->ops->getinterpolation)(dm1,dm2,mat,vec);
118:   return(0);
119: }

121: #undef __FUNCT__  
123: /*@C
124:     DMGetColoring - Gets coloring and empty Jacobian for a DA or VecPack

126:     Collective on DM

128:     Input Parameter:
129: +   dm - the DM object
130: -   ctype - IS_COLORING_GHOSTED or IS_COLORING_LOCAL

132:     Output Parameter:
133: .   coloring - the coloring

135:     Level: developer

137: .seealso DMDestroy(), DMView(), DMCreateGlobalVector(), DMGetInterpolation(), DMGetMatrix()

139: @*/
140: int DMGetColoring(DM dm,ISColoringType ctype,ISColoring *coloring)
141: {

145:   (*dm->ops->getcoloring)(dm,ctype,coloring);
146:   return(0);
147: }

149: #undef __FUNCT__  
151: /*@C
152:     DMGetMatrix - Gets empty Jacobian for a DA or VecPack

154:     Collective on DM

156:     Input Parameter:
157: +   dm - the DM object
158: -   mtype - MATMPIAIJ or MATMPIBAIJ

160:     Output Parameter:
161: .   mat - the empty Jacobian 

163:     Level: developer

165: .seealso DMDestroy(), DMView(), DMCreateGlobalVector(), DMGetInterpolation(), DMGetMatrix()

167: @*/
168: int DMGetMatrix(DM dm,MatType mtype,Mat *mat)
169: {

173:   (*dm->ops->getmatrix)(dm,mtype,mat);
174:   return(0);
175: }

177: #undef __FUNCT__  
179: /*@C
180:     DMRefine - Refines a DA or VecPack object

182:     Collective on DM

184:     Input Parameter:
185: +   dm - the DM object
186: -   comm - the communicator to contain the new DM object (or PETSC_NULL)

188:     Output Parameter:
189: .   dmf - the refined DM

191:     Level: developer

193: .seealso DMDestroy(), DMView(), DMCreateGlobalVector(), DMGetInterpolation()

195: @*/
196: int DMRefine(DM dm,MPI_Comm comm,DM *dmf)
197: {

201:   (*dm->ops->refine)(dm,comm,dmf);
202:   return(0);
203: }