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 | * command: civl verify ex2Driver.c ex2a.c
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | #include <civlc.cvh>
|
|---|
| 7 | #include <stdio.h>
|
|---|
| 8 | #include <stdlib.h>
|
|---|
| 9 | #include "petsc.h"
|
|---|
| 10 |
|
|---|
| 11 | typedef struct {
|
|---|
| 12 | PassiveReal param; /* test problem parameter */
|
|---|
| 13 | } AppCtx;
|
|---|
| 14 |
|
|---|
| 15 | #define M 5
|
|---|
| 16 | #define N 5
|
|---|
| 17 | #define K 3
|
|---|
| 18 | #define L 3
|
|---|
| 19 | $input PetscScalar x_data[M][N];
|
|---|
| 20 | $input PetscScalar f_data[M][N];
|
|---|
| 21 | $input AppCtx user[K];
|
|---|
| 22 | $input DMDALocalInfo info[L];
|
|---|
| 23 |
|
|---|
| 24 | PetscErrorCode FormFunctionLocal(DMDALocalInfo *,PetscScalar **,PetscScalar **,AppCtx *);
|
|---|
| 25 |
|
|---|
| 26 | int main() {
|
|---|
| 27 | PetscScalar **x, **f;
|
|---|
| 28 |
|
|---|
| 29 | x = (double **)malloc(M*sizeof(double *));
|
|---|
| 30 | for (int i = 0; i < M ; i++) {
|
|---|
| 31 | x[i] = (double *)malloc(N*sizeof(double));
|
|---|
| 32 | //x[i] = $havoc(&x[i])
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | f = (double **)malloc(M*sizeof(double *));
|
|---|
| 36 | for (int i = 0; i < M ; i++) {
|
|---|
| 37 | f[i] = (double *)malloc(N*sizeof(double));
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | for (int i = 0; i < M ; i++)
|
|---|
| 41 | for (int j = 0; j < N ; j++) {
|
|---|
| 42 | x[i][j] = x_data[i][j];
|
|---|
| 43 | f[i][j] = f_data[i][j];
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | FormFunctionLocal(info, x, f, user);
|
|---|
| 47 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.