source: CIVL/examples/compare/PETSc/ex2Driver.c@ cc9073d

1.23 2.0 main test-branch
Last change on this file since cc9073d was 96f1f4c, checked in by Si Li <sili@…>, 10 years ago

minor change

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@3391 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.1 KB
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
11typedef 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
24PetscErrorCode FormFunctionLocal(DMDALocalInfo *,PetscScalar **,PetscScalar **,AppCtx *);
25
26int 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.