Actual source code: product.c

petsc-3.11.3 2019-06-26
Report Typos and Errors
  1:  #include <petsc/private/dmproductimpl.h>

  3: static PetscErrorCode DMDestroy_Product(DM dm)
  4: {
  6:   DM_Product     *product = (DM_Product*)dm->data;
  7:   PetscInt       d;

 10:   for (d=0; d<DMPRODUCT_MAX_DIM; ++d) {
 11:     if (product->dm[d]) {
 12:       DMDestroy(&product->dm[d]);
 13:     }
 14:   }
 15:   PetscFree(product);
 16:   return(0);
 17: }

 19: /*MC
 20:   DMPRODUCT = "product" - a DM representing a local Cartesian product of other DMs

 22:   For each of dim dimensions, stores a sub-DM (need not be unique) and a dimension index. This specifies
 23:   which dimension of the sub-DM corresponds to each dimension of the DMProduct.

 25:   Level: advanced

 27: .seealso: DM, DMSTAG, DMProductGetDM(), DMProductSetDimensionIndex(), DMProductSetDM(), DMStagSetUniformCoordinatesProduct(),
 28:           DMStagGet1dCoordinateArraysDOFRead()
 29: M*/

 31: PETSC_EXTERN PetscErrorCode DMCreate_Product(DM dm)
 32: {
 34:   DM_Product     *product;
 35:   PetscInt       d;

 39:   PetscNewLog(dm,&product);
 40:   dm->data = product;
 41:   PetscObjectChangeTypeName((PetscObject)dm,DMPRODUCT);

 43:   for (d=0; d<DMPRODUCT_MAX_DIM; ++d) product->dm[d]  = NULL;
 44:   for (d=0; d<DMPRODUCT_MAX_DIM; ++d) product->dim[d] = -1;

 46:   dm->ops->destroy            = DMDestroy_Product;
 47:   return(0);
 48: }