1: #include <petsc/private/dmproductimpl.h> 3: static PetscErrorCode DMDestroy_Product(DM dm) 4: { 5: DM_Product *product = (DM_Product *)dm->data; 6: PetscInt d; 9: for (d = 0; d < DMPRODUCT_MAX_DIM; ++d) DMDestroy(&product->dm[d]); 10: PetscFree(product); 11: return 0; 12: } 14: /*MC 15: DMPRODUCT = "product" - a DM representing a local Cartesian product of other DMs 17: For each of dim dimensions, stores a sub-DM (need not be unique) and a dimension index. This specifies 18: which dimension of the sub-DM corresponds to each dimension of the DMProduct. 20: Level: advanced 22: .seealso: `DM`, `DMSTAG`, `DMProductGetDM()`, `DMProductSetDimensionIndex()`, `DMProductSetDM()`, `DMStagSetUniformCoordinatesProduct()`, 23: `DMStagGetProductCoordinateArrays()`, `DMStagGetProductCoordinateArraysRead()` 24: M*/ 26: PETSC_EXTERN PetscErrorCode DMCreate_Product(DM dm) 27: { 28: DM_Product *product; 29: PetscInt d; 32: PetscNew(&product); 33: dm->data = product; 35: for (d = 0; d < DMPRODUCT_MAX_DIM; ++d) product->dm[d] = NULL; 36: for (d = 0; d < DMPRODUCT_MAX_DIM; ++d) product->dim[d] = -1; 38: dm->ops->destroy = DMDestroy_Product; 39: return 0; 40: }