main
test-branch
|
Last change
on this file since beab7f2 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:
720 bytes
|
| Line | |
|---|
| 1 | #include<mpi.h>
|
|---|
| 2 | #include<civlc.cvh>
|
|---|
| 3 |
|
|---|
| 4 | #pragma CIVL ACSL
|
|---|
| 5 | #define DATA_LIMIT 1024
|
|---|
| 6 |
|
|---|
| 7 | int nxl;
|
|---|
| 8 | double * u, * u_new, k;
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 | /*@ requires \valid(u + (0 .. (nxl + 1)));
|
|---|
| 12 | @ requires \valid(u_new + (0 .. (nxl + 1)));
|
|---|
| 13 | @ requires k > 0 && nxl > 0;
|
|---|
| 14 | @ assigns u[1 .. nxl];
|
|---|
| 15 | @ ensures \forall int i; 0< i && i <= nxl
|
|---|
| 16 | @ ==>
|
|---|
| 17 | @ u[i] == \old(u[i] + k*(u[i+1] + u[i-1] - 2*u[i])) + 1;
|
|---|
| 18 | @*/
|
|---|
| 19 | void update() {
|
|---|
| 20 | /*@ loop invariant 1 <= i && i <= nxl + 1;
|
|---|
| 21 | @ loop invariant \forall int j; 1 <= j && j < i ==>
|
|---|
| 22 | @ u_new[j] == u[j] + k*(u[j+1] + u[j-1] - 2*u[j]);
|
|---|
| 23 | @*/
|
|---|
| 24 | for (int i = 1; i <= nxl; i++)
|
|---|
| 25 | u_new[i] = u[i] + k*(u[i+1] + u[i-1] - 2*u[i]) + 1;
|
|---|
| 26 |
|
|---|
| 27 | double * tmp = u_new; u_new=u; u=tmp;
|
|---|
| 28 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.