19 #ifndef SPOT_FASTTGBAALGOS_EC_CONCUR_UF_HH
20 # define SPOT_FASTTGBAALGOS_EC_CONCUR_UF_HH
22 #include "fasttgba/fasttgba.hh"
30 #include "fasttgbaalgos/ec/concur/unionfind.h"
42 fasttgba_state_ptrint_cmp_wrapper(
void *hash1,
void *hash2)
51 fasttgba_state_ptrint_hash_wrapper(
void *elt,
void *ctx)
61 fasttgba_state_ptrint_clone_wrapper(
void *key,
void *ctx)
70 fasttgba_state_ptrint_free_wrapper(
void *elt)
78 const size_t INIT_SCALE = 12;
79 static const datatype_t DATATYPE_INT_PTRINT =
81 fasttgba_state_ptrint_cmp_wrapper,
82 fasttgba_state_ptrint_hash_wrapper,
83 fasttgba_state_ptrint_clone_wrapper,
84 fasttgba_state_ptrint_free_wrapper
102 uf(
int thread_number) : thread_number_(thread_number), size_(0)
104 effective_uf = uf_alloc(&DATATYPE_INT_PTRINT, INIT_SCALE, thread_number);
109 uf_free (effective_uf,
true, thread_number_);
122 uf_make_set(effective_uf, (map_key_t) key, &inserted, tn);
135 uf_node_t* node = (uf_node_t*)
136 ht_get(effective_uf->table, (map_key_t) key);
137 uf_make_dead(effective_uf, node);
151 uf_node_t* l = (uf_node_t*)
152 ht_get(effective_uf->table, (map_key_t) left);
153 uf_node_t* r = (uf_node_t*)
154 ht_get(effective_uf->table, (map_key_t) right);
155 unsigned long ret_acc = 0;
157 uf_node_t* fast_ret = uf_unite (effective_uf, l, r, &ret_acc);
158 *is_dead = fast_ret == effective_uf->dead_;
160 unsigned long tmp = acc.to_ulong();
164 if (!tmp || *is_dead || ret_acc == tmp)
168 unsigned long res = uf_add_acc(effective_uf, fast_ret, tmp);
172 if (!res || tmp == res)
180 uf_node_t* node = (uf_node_t*)
181 ht_get(effective_uf->table, (map_key_t) key);
183 if (node == DOES_NOT_EXIST)
185 return uf_is_dead(effective_uf, node);
196 std::atomic<int> size_;
199 #endif // SPOT_FASTTGBAALGOS_EC_CONCUR_UF_HH
This class act as an interface for all classes.
Definition: fasttgba_state.hh:30
virtual int compare(const fasttgba_state *other) const =0
Compares two states (that come from the same automaton).
bool make_set(const fasttgba_state *key, int tn)
insert a new element in the union find
Definition: uf.hh:113
void make_dead(const fasttgba_state *key)
Mark an elemnent as dead.
Definition: uf.hh:129
bool is_dead(const fasttgba_state *key)
check wether an element is linked to dead
Definition: uf.hh:178
markset unite(const fasttgba_state *left, const fasttgba_state *right, const markset acc, bool *is_dead)
Mark two states in the same set.
Definition: uf.hh:148
virtual size_t hash() const =0
Hash a state.
This class represents a set of acceptance marks.
Definition: markset.hh:35