1.23
2.0
main
test-branch
| Line | |
|---|
| 1 | /* PETSc example driver for ex2a.c, ex2b.c,ex2c.c,ex2d.c,
|
|---|
| 2 | * https://repo.anl-external.org/repos/provesa/codes/mxm/
|
|---|
| 3 | */
|
|---|
| 4 |
|
|---|
| 5 | #include <civlc.cvh>
|
|---|
| 6 | #include <stdio.h>
|
|---|
| 7 | #include <stdlib.h>
|
|---|
| 8 | #include "petsc.h"
|
|---|
| 9 |
|
|---|
| 10 | typedef struct {
|
|---|
| 11 | PassiveReal param; /* test problem parameter */
|
|---|
| 12 | } AppCtx;
|
|---|
| 13 |
|
|---|
| 14 | $input PetscScalar x_data[5][5];
|
|---|
| 15 | $input PetscScalar f_data[5][5];
|
|---|
| 16 | $input AppCtx user[5];
|
|---|
| 17 | $input DMDALocalInfo info[5];
|
|---|
| 18 |
|
|---|
| 19 | PetscErrorCode FormFunctionLocal(DMDALocalInfo *,PetscScalar **,PetscScalar **,AppCtx *);
|
|---|
| 20 |
|
|---|
| 21 | int main() {
|
|---|
| 22 | PetscScalar **x, **f;
|
|---|
| 23 |
|
|---|
| 24 | x = (double **)malloc(5*sizeof(double *));
|
|---|
| 25 | for (int i = 0; i < 5 ; i++) {
|
|---|
| 26 | x[i] = (double *)malloc(5*sizeof(double));
|
|---|
| 27 | //x[i] = $havoc(&x[i])
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | f = (double **)malloc(5*sizeof(double *));
|
|---|
| 31 | for (int i = 0; i < 5 ; i++) {
|
|---|
| 32 | f[i] = (double *)malloc(5*sizeof(double));
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | for (int i = 0; i < 5 ; i++)
|
|---|
| 36 | for (int j = 0; j < 5 ; j++) {
|
|---|
| 37 | x[i][j] = x_data[i][j];
|
|---|
| 38 | f[i][j] = f_data[i][j];
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | FormFunctionLocal(info, x, f, user);
|
|---|
| 42 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.