Actual source code: ex8.c
petsc-3.3-p7 2013-05-11
2: static char help[] = "Tests imbedding DMComposites inside DMComposites.\n\n";
4: #include <petscdmda.h>
5: #include <petscdmcomposite.h>
7: typedef struct {
8: DM load;
9: DM L1,L2;
10: } Load;
12: PetscErrorCode LoadCreate(PetscInt n1, PetscInt n2, Load *load)
13: {
16: PetscNew(Load,&load);
17: DMDACreate1d(PETSC_COMM_SELF,DMDA_BOUNDARY_NONE,n1,1,1,PETSC_NULL,&load->L1);
18: DMDACreate1d(PETSC_COMM_SELF,DMDA_BOUNDARY_NONE,n1,1,1,PETSC_NULL,&load->L2);
19: DMCompositeCreate(PETSC_COMM_SELF,&load->load);
20: return(0);
21: }
23: typedef struct {
24: DM network;
25: DM n1,n2;
26: } Network;
28: typedef struct {
29: DM generator;
30: DM g1,g2;
31: } Generator;
33: typedef struct {
34: DM city;
35: Load load;
36: Network network;
37: Generator generator;
38: } City;
40: typedef struct {
41: DM state;
42: City *cities;
43: PetscInt n;
44: } State;
46: typedef struct {
47: DM unitedstates;
48: State *states;
49: PetscInt n;
50: } UnitedStates;
54: int main(int argc,char **argv)
55: {
57: UnitedStates unitedstates;
59: PetscInitialize(&argc,&argv,(char*)0,help);
61: PetscFinalize();
62: return 0;
63: }
64: