From: yu.dongliang <18588496441@163.com> Date: Wed, 15 Nov 2023 11:54:05 +0000 (+0800) Subject: ses_paths_find_flow() X-Git-Url: http://baseworks.info/?a=commitdiff_plain;h=2f033721954d52cb51662da12f6c251439d370e3;p=ses.git ses_paths_find_flow() --- diff --git a/ses_step_va_balance.c b/ses_step_va_balance.c index f298c0a..7dae08b 100644 --- a/ses_step_va_balance.c +++ b/ses_step_va_balance.c @@ -1,48 +1,5 @@ #include"ses_core.h" -int ses_paths_find_flow(ses_flow_t* flow, scf_vector_t* paths, ScfEpin* vip, ses_path_t* bridge) -{ - ses_path_t* path; - ScfEpin* p; - - int i; - int j; - - for (i = 0; i < paths->size; i++) { - path = paths->data[i]; - - if (path == bridge) - continue; - - for (j = 0; j < path->pins->size; j++) { - p = path->pins->data[j]; - - if (vip ->lid == p->lid) { - flow->vip = p; - - if (scf_vector_add(flow->paths, path) < 0) - return -1; - return 1; - } - } - - if (!path->childs) - continue; - - int ret = ses_paths_find_flow(flow, path->childs, vip, bridge); - if (ret < 0) - return ret; - - if (1 == ret) { - if (scf_vector_add(flow->paths, path) < 0) - return -1; - return 1; - } - } - - return 0; -} - static void inline __ses_bridge_i(double* i0, double* i1, double* i2, double* i3, double* i4, double* v0, double* v1, double* v4, double V, double R0, double R1, double R2, double R3, double R4, diff --git a/ses_utils.c b/ses_utils.c index b098854..bab07ef 100644 --- a/ses_utils.c +++ b/ses_utils.c @@ -25,6 +25,49 @@ void ses_flow_free(ses_flow_t* flow) } } +int ses_paths_find_flow(ses_flow_t* flow, scf_vector_t* paths, ScfEpin* vip, ses_path_t* bridge) +{ + ses_path_t* path; + ScfEpin* p; + + int i; + int j; + + for (i = 0; i < paths->size; i++) { + path = paths->data[i]; + + if (path == bridge) + continue; + + for (j = 0; j < path->pins->size; j++) { + p = path->pins->data[j]; + + if (vip ->lid == p->lid) { + flow->vip = p; + + if (scf_vector_add(flow->paths, path) < 0) + return -1; + return 1; + } + } + + if (!path->childs) + continue; + + int ret = ses_paths_find_flow(flow, path->childs, vip, bridge); + if (ret < 0) + return ret; + + if (1 == ret) { + if (scf_vector_add(flow->paths, path) < 0) + return -1; + return 1; + } + } + + return 0; +} + void ses_flow_v_pos(ses_flow_t* flow, double a, double ja) { if (!flow || !flow->paths || flow->paths->size <= 0 || !flow->vip)