Actual source code: dm.c

  1: /*$Id: dm.c,v 1.5 2001/04/10 19:37:31 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()

 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()

 49: @*/
 50: int DMView(DM dm,PetscViewer v)
 51: {

 55:   (*dm->bops->view)((PetscObject)dm,v);
 56:   return(0);
 57: }

 59: /*@C
 60:     DMCreateGlobalVector - Creates a global vector from a DA or VecPack object

 62:     Collective on DM

 64:     Input Parameter:
 65: .   dm - the DM object

 67:     Output Parameter:
 68: .   vec - the global vector

 70:     Level: developer

 72: .seealso DMDestroy(), DMView(), DMGetInterpolation(), DMGetColoring()

 74: @*/
 75: int DMCreateGlobalVector(DM dm,Vec *vec)
 76: {

 80:   (*dm->ops->createglobalvector)(dm,vec);
 81:   return(0);
 82: }

 84: /*@C
 85:     DMGetInterpolation - Gets interpolation matrix between two DA or VecPack objects

 87:     Collective on DM

 89:     Input Parameter:
 90: +   dm1 - the DM object
 91: -   dm2 - the second, coarser DM object

 93:     Output Parameter:
 94: +  mat - the interpolation
 95: -  vec - the scaling (optional)

 97:     Level: developer

 99: .seealso DMDestroy(), DMView(), DMCreateGlobalVector(), DMGetColoring()

101: @*/
102: int DMGetInterpolation(DM dm1,DM dm2,Mat *mat,Vec *vec)
103: {

107:   (*dm1->ops->getinterpolation)(dm1,dm2,mat,vec);
108:   return(0);
109: }

111: /*@C
112:     DMGetColoring - Gets coloring and empty Jacobian for a DA or VecPack

114:     Collective on DM

116:     Input Parameter:
117: +   dm - the DM object
118: .   ctype - IS_COLORING_LOCAL or IS_COLORING_GLOBAL
119: -   mtype - MATMPIAIJ or MATMPIBAIJ

121:     Output Parameter:
122: +   coloring - the coloring (optional)
123: -   mat - the Jacobian (optional)

125:     Level: developer

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

129: @*/
130: int DMGetColoring(DM dm,ISColoringType ctype,MatType mtype,ISColoring *coloring,Mat *mat)
131: {

135:   (*dm->ops->getcoloring)(dm,ctype,mtype,coloring,mat);
136:   return(0);
137: }

139: /*@C
140:     DMRefine - Refines a DA or VecPack object

142:     Collective on DM

144:     Input Parameter:
145: +   dm - the DM object
146: -   comm - the communicator to contain the new DM object (or PETSC_NULL)

148:     Output Parameter:
149: .   dmf - the refined DM

151:     Level: developer

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

155: @*/
156: int DMRefine(DM dm,MPI_Comm comm,DM *dmf)
157: {

161:   (*dm->ops->refine)(dm,comm,dmf);
162:   return(0);
163: }