diff options
author | Helen Ginn <helen@strubi.ox.ac.uk> | 2018-04-22 01:08:26 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2018-05-02 09:46:13 +0200 |
commit | 8f14adf07254041401a81fbf50f5d3a2912704ab (patch) | |
tree | 578fb49c4782c0dc5c5cc49bb0c0ad8060763cbf | |
parent | 8d41a4d4dc0ffca5af573fa520638eab2eaa7c93 (diff) |
Search through entire vector array each time
-rw-r--r-- | libcrystfel/src/taketwo.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/libcrystfel/src/taketwo.c b/libcrystfel/src/taketwo.c index 18f8365e..8303016e 100644 --- a/libcrystfel/src/taketwo.c +++ b/libcrystfel/src/taketwo.c @@ -120,6 +120,7 @@ struct SpotVec struct rvec obsvec; struct TheoryVec *matches; int match_num; + int in_network; double distance; struct rvec *her_rlp; struct rvec *his_rlp; @@ -957,6 +958,12 @@ static signed int find_next_index(gsl_matrix *rot, int *obs_members, for ( i=start; i<obs_vec_count; i++ ) { + /* If we've considered this vector before, ignore it */ + if (obs_vecs[i].in_network == 1) + { + continue; + } + /* first we check for a shared spot - harshest condition */ int shared = obs_shares_spot_w_array(obs_vecs, i, obs_members, member_num); @@ -1060,6 +1067,13 @@ static int grow_network(gsl_matrix *rot, int obs_idx1, int obs_idx2, int *obs_members; int *match_members; + /* Clear the in_network status of all vectors to start */ + int i; + for (i = 0; i < obs_vec_count; i++) + { + obs_vecs[i].in_network = 0; + } + /* indices of members of the self-consistent network of vectors */ obs_members = malloc((cell->member_thresh+3)*sizeof(int)); match_members = malloc((cell->member_thresh+3)*sizeof(int)); @@ -1095,7 +1109,7 @@ static int grow_network(gsl_matrix *rot, int obs_idx1, int obs_idx2, signed int next_index = find_next_index(rot, obs_members, match_members, - start, member_num, + 0, member_num, &match_found, cell); if ( member_num < 2 ) { @@ -1114,13 +1128,13 @@ static int grow_network(gsl_matrix *rot, int obs_idx1, int obs_idx2, /* We have not had too many dead ends. Try removing the last member and continue. */ - start = obs_members[member_num - 1] + 1; member_num--; dead_ends++; continue; } + obs_vecs[next_index].in_network = 1; obs_members[member_num] = next_index; match_members[member_num] = match_found; |