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) {
10: DMDestroy(&product->dm[d]);
11: }
12: PetscFree(product);
13: return 0;
14: }
16: /*MC
17: DMPRODUCT = "product" - a DM representing a local Cartesian product of other DMs
19: For each of dim dimensions, stores a sub-DM (need not be unique) and a dimension index. This specifies
20: which dimension of the sub-DM corresponds to each dimension of the DMProduct.
22: Level: advanced
24: .seealso: DM, DMSTAG, DMProductGetDM(), DMProductSetDimensionIndex(), DMProductSetDM(), DMStagSetUniformCoordinatesProduct(),
25: DMStagGetProductCoordinateArrays(), DMStagGetProductCoordinateArraysRead()
26: M*/
28: PETSC_EXTERN PetscErrorCode DMCreate_Product(DM dm)
29: {
30: DM_Product *product;
31: PetscInt d;
34: PetscNewLog(dm,&product);
35: dm->data = product;
37: for (d=0; d<DMPRODUCT_MAX_DIM; ++d) product->dm[d] = NULL;
38: for (d=0; d<DMPRODUCT_MAX_DIM; ++d) product->dim[d] = -1;
40: dm->ops->destroy = DMDestroy_Product;
41: return 0;
42: }