source: CIVL/examples/library/civlc/elaborateDomain.cvl

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: 666 bytes
RevLine 
[7b92a9d]1#include<civlc.cvh>
2#include<domain.cvh>
3#include<stdio.h>
4
5#define N 2
6$input int X, Y, K, L;
7$assume(0 < X && X <= N);
8$assume(0 < Y && Y <= N);
9$assume(1 < K && K <= N+1);
10$assume(1 < L && L <= N+1);
11
12int main(){
13 $range r1=1 .. X # 1, r2=1 .. Y, r3=1 .. K, r4=1 .. L;
14 $domain(2) domPar=($domain(2)){r1, r2};
15 $domain(2) domFor=($domain(2)){r3, r4};
16
17 void thread(int x, int y){
18 printf("x=%d,y=%d,X=%d,Y=%d\n", x, y, X, Y);
19 }
20
21 // domFor is elaborated implicitly before $for
22 $for(int i,j: domFor){
23 printf("i=%d,j=%d,K=%d,L=%d\n", i, j, K, L);
24 }
25 // domPar is elaborated implicitly before $parfor
26 $parfor(int x,y: domPar)
27 thread(x, y);
28}
Note: See TracBrowser for help on using the repository browser.