aboutsummaryrefslogtreecommitdiff
path: root/src/utils.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-07-13 14:36:43 +0200
committerThomas White <taw@physics.org>2012-02-22 15:26:53 +0100
commit864acfc1096a75478c792289cc178e8d345fc689 (patch)
treee70066cf59196b580911c7042651ecd0323b86e4 /src/utils.c
parentdcdc5ea10c6525434bb2058fbc09e0159c8fcba5 (diff)
Take the union of available twin ops, not just the subgroup with the highest number
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index 1e54f923..21ba882f 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -363,6 +363,17 @@ int find_item(ReflItemList *items,
}
+static int find_op(ReflItemList *items, int op)
+{
+ int i;
+
+ for ( i=0; i<items->n_items; i++ ) {
+ if ( items->items[i].op == op ) return 1;
+ }
+ return 0;
+}
+
+
struct refl_item *get_item(ReflItemList *items, int i)
{
if ( i >= items->n_items ) return NULL;
@@ -391,3 +402,19 @@ unsigned int *items_to_counts(ReflItemList *items)
return c;
}
+
+
+void union_op_items(ReflItemList *items, ReflItemList *newi)
+{
+ int n, i;
+
+ n = num_items(newi);
+ for ( i=0; i<n; i++ ) {
+
+ struct refl_item *r = get_item(newi, i);
+ if ( find_op(items, r->op) ) continue;
+
+ add_item_with_op(items, r->h, r->k, r->l, r->op);
+
+ }
+}