int c64h156_device::get_next_bit(attotime &tm, const attotime &limit) { int bit = 0; if (!cur_live.edge.is_never()) { attotime next = tm + m_period; if (cur_live.edge < next) { bit = 1; cur_live.zero_counter = 0; cur_live.cycles_until_random_flux = (rand() % 31) + 289; get_next_edge(next); } } if (cur_live.zero_counter >= cur_live.cycles_until_random_flux) { cur_live.zero_counter = 0; cur_live.cycles_until_random_flux = (rand() % 367) + 33; bit = 1; } return bit && cur_live.oe; }
void EdgeList::get_next_edge(Plane iplane, int& v0, int& v1, int& next_f, int& next_d) { DEBUG_START; int i0, i1; get_next_edge(iplane, v0, v1, i0, i1, next_f, next_d); DEBUG_END; }
int c2040_fdc_t::get_next_bit(attotime &tm, const attotime &limit) { attotime next = tm + m_period; int bit = (cur_live.edge.is_never() || cur_live.edge >= next) ? 0 : 1; if (bit) { get_next_edge(next); } return bit && cur_live.rw_sel; }
//Reverse all edge direction void GRAPH::rev_edges() { IS_TRUE(m_pool != NULL, ("not yet initialized.")); IS_TRUE(m_is_direction, ("graph is indirection")); LIST<EDGE*> list; EDGE * e; INT c; for (e = get_first_edge(c); e != NULL; e = get_next_edge(c)) { list.append_tail(e); } for (e = list.get_head(); e != NULL; e = list.get_next()) { rev_edge(e); } }
void write_PDB_dstring (JNIEnv *env, jobject graph, jobject elementRule, void *nGraph, int dimension, dstring *encoding) { char buffer [100], *element; int i, size; void *iterator; g_float *coord; jclass elementRuleClass; jmethodID getElement, getBytes; prepare_get_element (env, elementRule, &elementRuleClass, &getElement, &getBytes); clear_dstring (encoding); size = get_graph_size (nGraph); for (i = 1; i <= size; ++i) { coord = get_3d_coordinates (nGraph, i); element = get_element (env, elementRule, elementRuleClass, getElement, getBytes, graph, i); if (element == NULL) element = "X"; sprintf (buffer, "ATOM %5d %3s %8.3f%8.3f%8.3f \n", i, element, coord [0], coord [1], coord [2]); add_string (encoding, buffer); } for (i = 1; i <= size; ++i) { void *iterator; int k = 0; iterator = get_edge_iterator (nGraph, i); while (has_next_edge (iterator)) { int j; if (k % 6 == 0) { if (k > 0) add_char (encoding, '\n'); add_string (encoding, "CONECT"); sprintf (buffer, "%5d", i); add_string (encoding, buffer); } ++k; j = get_next_edge (iterator); sprintf (buffer, "%5d", j); add_string (encoding, buffer); } free (iterator); add_char (encoding, '\n'); } add_string (encoding, "END\n"); }
void c2040_fdc_t::rollback() { cur_live = checkpoint_live; get_next_edge(cur_live.tm); }
void c2040_fdc_t::checkpoint() { get_next_edge(machine().time()); checkpoint_live = cur_live; }
void c64h156_device::rollback() { cur_live = checkpoint_live; get_next_edge(cur_live.tm); }
void c64h156_device::checkpoint() { get_next_edge(machine().time()); checkpoint_live = cur_live; }
void write_CML_dstring (JNIEnv *env, jobject graph, jobject elementRule, void *nGraph, int dimension, dstring *encoding) { char buffer [100], *sep, *element; dstring from, to; int i, k, n; void *iterator; g_float **coordinate; jclass elementRuleClass; jmethodID getElement, getBytes; prepare_get_element (env, elementRule, &elementRuleClass, &getElement, &getBytes); clear_dstring (encoding); n = get_graph_size (nGraph); add_string (encoding, "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"); add_string (encoding, "<!DOCTYPE molecule SYSTEM \"cml.dtd\" []>\n"); add_string (encoding, "<molecule convention=\"MathGraph\">\n"); add_string (encoding, " <atomArray>\n"); add_string (encoding, " <stringArray builtin=\"id\">"); sep = ""; for (i = 1; i <= n; ++i) { add_string (encoding, sep); add_string (encoding, "a"); sprintf (buffer, "%d", i); add_string (encoding, buffer); sep = " "; } add_string (encoding, "</stringArray>\n"); add_string (encoding, " <stringArray builtin=\"elementType\">"); sep = ""; for (i = 1; i <= n; ++i) { element = get_element (env, elementRule, elementRuleClass, getElement, getBytes, graph, i); if (element == NULL) element = "X"; add_string (encoding, sep); add_string (encoding, element); sep = " "; } add_string (encoding, "</stringArray>\n"); coordinate = malloc (n * sizeof (*coordinate)); for (i = 0, k = 1; i < n; i = k++) { coordinate [i] = dimension == 2 ? get_2d_coordinates (nGraph, k) : get_3d_coordinates (nGraph, k); } for (k = 0; k < dimension; ++k) { add_string (encoding, " <floatArray builtin=\""); add_char (encoding, 'x' + k); sprintf (buffer, "%d", dimension); add_string (encoding, buffer); add_string (encoding, "\">"); sep = ""; for (i = 0; i < n; ++i) { add_string (encoding, sep); if (sizeof (g_float) == sizeof (float)) { sprintf (buffer, "%-g", coordinate [i][k]); } else { sprintf (buffer, "%-lg", coordinate [i][k]); } add_string (encoding, buffer); sep = " "; } add_string (encoding, "</floatArray>\n"); } add_string (encoding, " </atomArray>\n"); add_string (encoding, " <bondArray>\n"); from = new_dstring; to = new_dstring; sep = ""; for (i = 1; i <= n; ++i) { void *iterator; iterator = get_edge_iterator (nGraph, i); while (has_next_edge (iterator)) { int j = get_next_edge (iterator); if (j <= i) continue; sprintf (buffer, "%sa", sep); add_string (&from, buffer); add_string (&to, buffer); sprintf (buffer, "%d", i); add_string (&from, buffer); sprintf (buffer, "%d", j); add_string (&to, buffer); sep = " "; } } add_string (encoding, " <stringArray builtin=\"atomRef\">"); add_bytes (encoding, from.base, from.length); add_string (encoding, "</stringArray>\n"); add_string (encoding, " <stringArray builtin=\"atomRef\">"); add_bytes (encoding, to.base, to.length); add_string (encoding, "</stringArray>\n"); add_string (encoding, " </bondArray>\n"); add_string (encoding, "</molecule>\n"); clear_dstring (&from); clear_dstring (&to); }
void torvol() { facet_id f_id; /* main facet iterator */ body_id b_id; body_id b0_id,b1_id; /* facet adjacent bodies */ #ifdef NEWTORVOL struct qinfo f_info; /* for calling q_facet_torus_volume */ q_info_init(&f_info,METHOD_VALUE); #endif /* adjust body volumes to the invariant constant for each */ FOR_ALL_BODIES(b_id) set_body_volume(b_id,get_body_volconst(b_id),NOSETSTAMP); if ( web.representation == STRING ) FOR_ALL_FACETS(f_id) set_facet_area(f_id,0.0); FOR_ALL_FACETS(f_id) { REAL t; /* accumulator for this facet */ if ( get_fattr(f_id) & NONCONTENT ) continue; /* find adjacent bodies */ b0_id = get_facet_body(f_id); b1_id = get_facet_body(facet_inverse(f_id)); if ( !valid_id(b0_id) && !valid_id(b1_id) ) continue; #ifdef NEWTORVOL f_info.id = f_id; q_facet_setup(NULL,&f_info,NEED_SIDE|TORUS_MODULO_MUNGE|ORIENTABLE_METHOD); t = q_facet_torus_volume(&f_info); if ( valid_id(b0_id) ) add_body_volume(b0_id,t); if ( valid_id(b1_id) ) add_body_volume(b1_id,-t); #else REAL *v[FACET_VERTS]; /* pointers to three vertex coordinates */ facetedge_id fe; int i; REAL adj[FACET_EDGES][MAXCOORD]; /* torus wrap adjustments for edge */ /* get basic info */ fe = get_facet_fe(f_id); for ( i = 0 ; i < FACET_EDGES ; i ++ ) { v[i] = get_coord(get_fe_tailv(fe)); get_edge_adjust(get_fe_edge(fe),adj[i]); fe = get_next_edge(fe); } /* basic tetrahedron */ t = triple_prod(v[0],v[1],v[2]); /* torus wrap corrections */ for ( i = 0 ; i < FACET_EDGES ; i++ ) { /* two-vertex term */ t += triple_prod(adj[(i+1)%FACET_EDGES],v[i],v[(i+1)%FACET_EDGES])/2; t -= triple_prod(adj[(i+2)%FACET_EDGES],v[i],v[(i+1)%FACET_EDGES])/2; /* one-vertex term */ t += triple_prod(v[i],adj[(i+2)%FACET_EDGES],adj[i]); } if ( valid_id(b0_id) ) add_body_volume(b0_id,t/6); if ( valid_id(b1_id) ) add_body_volume(b1_id,-t/6); #endif } #ifdef NEWTORVOL q_info_free(&f_info); #endif }