xref: /petsc/src/dm/impls/da/dareg.c (revision d7bf68aed858a02b69c3ac329d35f78f24359a6b)
1 #define PETSCDM_DLL
2 
3 #include "private/daimpl.h"    /*I "petscda.h"  I*/
4 
5 extern PetscErrorCode PETSCDM_DLLEXPORT DASetUp_1D(DA);
6 extern PetscErrorCode PETSCDM_DLLEXPORT DASetUp_2D(DA);
7 extern PetscErrorCode PETSCDM_DLLEXPORT DASetUp_3D(DA);
8 
9 #undef __FUNCT__
10 #define __FUNCT__ "DASetUp"
11 /*@C
12   DASetUp - Sets up the data structures for a DA
13 
14   Collective on DA
15 
16   Input Parameters:
17 . da     - The DA object
18 
19   Level: intermediate
20 
21 .keywords: DA, set, type
22 .seealso: DACreate()
23 @*/
24 PetscErrorCode PETSCDM_DLLEXPORT DASetUp(DA da)
25 {
26   PetscErrorCode ierr;
27   DM_DA          *dd = (DM_DA*)da->data;
28 
29   PetscFunctionBegin;
30   PetscValidHeaderSpecific(da, DM_CLASSID,1);
31   if (dd->dim == 1) {
32     ierr = DASetUp_1D(da);CHKERRQ(ierr);
33   } else if (dd->dim == 2) {
34     ierr = DASetUp_2D(da);CHKERRQ(ierr);
35   } else if (dd->dim == 3) {
36     ierr = DASetUp_3D(da);CHKERRQ(ierr);
37   } else SETERRQ(((PetscObject)da)->comm,PETSC_ERR_SUP,"DAs only supported for 1, 2, and 3d");
38   PetscFunctionReturn(0);
39 }
40 
41