#include"ses_core.h"
-static int __ses_path_va_flow(ScfEfunction* f, ses_path_t* bridge, int* changed, scf_vector_t* paths)
-{
- ses_flow_t* flow0;
- ses_flow_t* flow1;
-
- ScfEpin* p0;
- ScfEpin* p1;
-
- flow0 = ses_flow_alloc();
- if (!flow0)
- return -ENOMEM;
-
- flow1 = ses_flow_alloc();
- if (!flow1) {
- ses_flow_free(flow0);
- return -ENOMEM;
- }
-
- p0 = bridge->pins->data[0];
- p1 = bridge->pins->data[bridge->pins->size - 1];
-
- int ret = ses_paths_find_flow(flow0, paths, p0, bridge);
- if (ret < 0)
- return ret;
-
- ret = ses_paths_find_flow(flow1, paths, p1, bridge);
- if (ret < 0)
- return ret;
-
- ses_flow_print(flow0);
- ses_flow_jr(flow0);
- printf("\n");
-
- ses_flow_print(flow1);
- ses_flow_jr(flow1);
- printf("\n");
- return 0;
-}
-
static int __ses_path_va_bridge(ScfEfunction* f, ses_path_t* bridge, int* changed, scf_vector_t* paths)
{
if (!bridge)
return -EINVAL;
}
+ ses_flow_t* flow;
+
ScfEcomponent* B;
ScfEline* el;
ScfEpin* Bp;
scf_logw("bridge: %d, c%ldp%ld--c%ldp%ld, v: %lg, p0->v: %lg, p1->v: %lg, n_diodes: %d, p0->a: %lg, p1->a: %lg\n",
bridge->index, p0->cid, p0->id, p1->cid, p1->id, v, p0->v, p1->v, bridge->n_diodes, p0->a, p1->a);
- return __ses_path_va_flow(f, bridge, changed, paths);
+ flow = ses_flow_alloc();
+ if (!flow)
+ return -ENOMEM;
+
+ ret = ses_paths_find_flow(flow, paths, p0, bridge);
+ if (ret < 0) {
+ ses_flow_free(flow);
+ return ret;
+ }
+
+ ses_flow_print(flow);
+ ses_flow_jr(flow);
+
+ return 0;
}
static int ses_path_va_bridge(ScfEfunction* f, ses_path_t* path, int* changed, scf_vector_t* paths)