Actual source code: ex8.c
2: static char help[] = "Tests imbedding DMComposites inside DMComposites.\n\n";
4: #include petscda.h
6: typedef struct {
7: DM load;
8: DM L1,L2;
9: } Load;
11: PetscErrorCode LoadCreate(PetscInt n1, PetscInt n2, Load *load)
12: {
15: PetscNew(Load,&load);
16: DACreate1d(PETSC_COMM_SELF,DA_NONPERIODIC,n1,1,1,PETSC_NULL,(DA*)&load->L1);
17: DACreate1d(PETSC_COMM_SELF,DA_NONPERIODIC,n1,1,1,PETSC_NULL,(DA*)&load->L2);
18: DMCompositeCreate(PETSC_COMM_SELF,(DMComposite*)&load->load);
19: return(0);
20: }
22: typedef struct {
23: DM network;
24: DM n1,n2;
25: } Network;
27: typedef struct {
28: DM generator;
29: DM g1,g2;
30: } Generator;
32: typedef struct {
33: DM city;
34: Load load;
35: Network network;
36: Generator generator;
37: } City;
39: typedef struct {
40: DM state;
41: City *cities;
42: PetscInt n;
43: } State;
45: typedef struct {
46: DM unitedstates;
47: State *states;
48: PetscInt n;
49: } UnitedStates;
53: int main(int argc,char **argv)
54: {
56: UnitedStates unitedstates;
58: PetscInitialize(&argc,&argv,(char*)0,help);
60: PetscFinalize();
61: return 0;
62: }
63: