Actual source code: product.c

petsc-master 2019-12-13
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:     DMDestroy(&product->dm[d]);
 12:   }
 13:   PetscFree(product);
 14:   return(0);
 15: }

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

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

 23:   Level: advanced

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

 29: PETSC_EXTERN PetscErrorCode DMCreate_Product(DM dm)
 30: {
 32:   DM_Product     *product;
 33:   PetscInt       d;

 37:   PetscNewLog(dm,&product);
 38:   dm->data = product;

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

 43:   dm->ops->destroy            = DMDestroy_Product;
 44:   return(0);
 45: }