Date: 2022-08-02T03:14:14+00:00

Actual source code: dareg.c

      1: #include <petsc/private/dmdaimpl.h>

      3: extern PetscErrorCode  DMSetUp_DA_1D(DM);
      4: extern PetscErrorCode  DMSetUp_DA_2D(DM);
      5: extern PetscErrorCode  DMSetUp_DA_3D(DM);

      7: PetscErrorCode  DMSetUp_DA(DM da)
      8: {
      9:   DM_DA          *dd = (DM_DA*)da->data;

     15:   PetscCalloc1(dd->w+1,&dd->fieldname);
     16:   PetscCalloc1(da->dim,&dd->coordinatename);
     17:   if (da->dim == 1) {
     18:     DMSetUp_DA_1D(da);
     19:   } else if (da->dim == 2) {
     20:     DMSetUp_DA_2D(da);
     21:   } else if (da->dim == 3) {
     22:     DMSetUp_DA_3D(da);
     23:   } else SETERRQ(PetscObjectComm((PetscObject)da),PETSC_ERR_SUP,"DMs only supported for 1, 2, and 3d");
     24:   DMViewFromOptions(da,NULL,"-dm_view");
     25:   return 0;
     26: }