main
|
Last change
on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | #include <stdio.h>
|
|---|
| 2 | #ifdef _CIVL
|
|---|
| 3 | #include <civlc.cvh>
|
|---|
| 4 | #pragma CIVL ACSL
|
|---|
| 5 | #endif
|
|---|
| 6 |
|
|---|
| 7 | #ifdef _CIVL
|
|---|
| 8 | $input int ni,nj;
|
|---|
| 9 | $assume(ni>1);
|
|---|
| 10 | //$assume(ni<10);
|
|---|
| 11 | $assume(nj>1);
|
|---|
| 12 | //$assume(nj<10);
|
|---|
| 13 | $input double uin[ni][nj];
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 | int main(int argc, char** argv) {
|
|---|
| 17 | int i,j,ir,jr;
|
|---|
| 18 | double u1[ni][nj];
|
|---|
| 19 | double u2[ni][nj];
|
|---|
| 20 |
|
|---|
| 21 | $havoc(&i); $havoc(&j);
|
|---|
| 22 | // remainder
|
|---|
| 23 | if(i==ni-2) {
|
|---|
| 24 | /*@ loop invariant 1 <= jr && jr <= nj-1;
|
|---|
| 25 | @ loop invariant \forall int t; 1 <= t && t < jr ==>
|
|---|
| 26 | @ u2[i][t] == uin[i][t]*uin[i][t];
|
|---|
| 27 | @ loop assigns jr, u2[i][1 .. nj-2];
|
|---|
| 28 | @*/
|
|---|
| 29 | for(jr=1;jr<nj-1;jr++) {
|
|---|
| 30 | u2[i][jr] = uin[i][jr]*uin[i][jr];
|
|---|
| 31 | }
|
|---|
| 32 | }
|
|---|
| 33 | if(j==nj-2) {
|
|---|
| 34 | /*@ loop invariant 1 <= ir && ir <= ni-1;
|
|---|
| 35 | @ loop invariant \forall int t; 1 <= t && t < ir ==>
|
|---|
| 36 | @ u2[t][j] == uin[t][j]*uin[t][j];
|
|---|
| 37 | @ loop assigns ir, u2[1 .. ni-2][j];
|
|---|
| 38 | @*/
|
|---|
| 39 | for(ir=1;ir<ni-1;ir++) {
|
|---|
| 40 | u2[ir][j] = uin[ir][j]*uin[ir][j];
|
|---|
| 41 | }
|
|---|
| 42 | }
|
|---|
| 43 | if(i==ni-2 && j==nj-2) u2[i][j] = uin[i][j]*uin[i][j];
|
|---|
| 44 |
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.