Problem with locking fixed. New problem arises with Vertex not in cell or segfault
| | |
| | | ts_double projArea; |
| | | ts_double relR; |
| | | ts_double solAngle; |
| | | ts_int locked; |
| | | ts_uint *locked; |
| | | }; |
| | | typedef struct ts_vertex ts_vertex; |
| | | |
| | |
| | | for(i=0;i<vesicle->vlist->n;i++){ |
| | | vertex_taint(vesicle->vlist->vtx[i],1); |
| | | vertex_untaint(vesicle->vlist->vtx[i],1); |
| | | printf("%d taint amount %d\n",i,vesicle->vlist->vtx[i]->locked); |
| | | printf("%d taint amount %u\n",i,*(vesicle->vlist->vtx[i]->locked)); |
| | | if(vertex_tainted(vesicle->vlist->vtx[i], 0, 1)) printf("Ooops, Main %d is tainted!\n",i); |
| | | for(j=0;j<vesicle->vlist->vtx[i]->neigh_no;j++){ |
| | | if(vertex_tainted(vesicle->vlist->vtx[i]->neigh[j], 0, 1)){ |
| | |
| | | quiet=false |
| | | |
| | | #what type of multiprocessing? (*none, smp, cluster, distributed, cuda, auto) |
| | | #currently only none makes sense. |
| | | #currently only none and smp makes sense. If set to none, smp_cores defaults to 1 |
| | | multiprocessing=smp |
| | | #how many cores are allowed to process in SMP? |
| | | smp_cores=4 |
| | | #how many cores are allowed to process in SMP? If smp_cores=0, then number of threads will corespond with number of harware processor cores. |
| | | smp_cores=6 |
| | | #how many nodes in cluster? |
| | | cluster_nodes=50 |
| | | #max number of processes in distributed (voluntary) environment |
| | |
| | | for(i=0;i<N;i++) { |
| | | vlist->vtx[i]=(ts_vertex *)calloc(1,sizeof(ts_vertex)); |
| | | vlist->vtx[i]->idx=i; |
| | | |
| | | vlist->vtx[i]->locked=(ts_uint *)calloc(1,sizeof(ts_vertex)); |
| | | /* initialize Ylm for spherical hamonics DONE in sh.c */ |
| | | /* for(i=0;i<l;i++){ |
| | | vlist->vtx[i]->Ylm[i]=(ts_double **)calloc(2*i+1,sizeof(ts_double *)); |
| | |
| | | |
| | | ts_bool vertex_taint(ts_vertex *vtx, ts_uint level){ |
| | | ts_uint i; |
| | | vtx->locked++; //lock current vertex |
| | | (*(vtx->locked))++; //lock current vertex |
| | | if(level==0){ //if we reach last in recursion exit |
| | | return TS_SUCCESS; |
| | | } |
| | |
| | | } |
| | | |
| | | ts_bool vertex_untaint(ts_vertex *vtx, ts_uint level){ |
| | | vtx->locked--; |
| | | (*(vtx->locked))--; |
| | | if(level==0){ |
| | | return TS_SUCCESS; |
| | | } |
| | |
| | | } |
| | | |
| | | inline ts_bool vertex_tainted(ts_vertex *vtx, ts_uint level, ts_uint amount){ |
| | | if(vtx->locked>amount) return 1; |
| | | if(*(vtx->locked)>amount) return 1; |
| | | if(level==0){ |
| | | return 0; |
| | | } |