]> www.ljiriste.work Git - FET_sim.git/commitdiff
Implement transfer of loaded graph
authorLukáš Jiřiště <redacted>
Tue, 30 Dec 2025 06:41:45 +0000 (07:41 +0100)
committerLukáš Jiřiště <redacted>
Tue, 30 Dec 2025 06:41:45 +0000 (07:41 +0100)
src/c_load.c

index 64142e8531e8e94b94662e1dac18c82c3d140a70..05e752e5ffbf98b19feb258ed0a71af992f226bf 100644 (file)
@@ -1335,6 +1335,20 @@ int      build_main_graph(t_catalog *part_catalog)
        return (build_part_graph(main_part));
 }
 
+int    transfer_main(t_catalog *part_catalog, t_vec *nodes, t_vec *mosfets)
+{
+       t_part                          *main_part;
+
+       main_part = access_catalog(part_catalog, "main");
+       if (!main_part)
+               return (1);
+       *nodes = main_part->nodes;
+       *mosfets = main_part->mosfets;
+       ft_vec_init(&main_part->nodes, sizeof(t_node));
+       ft_vec_init(&main_part->mosfets, sizeof(t_mosfet));
+       return (0);
+}
+
 int    construct_new_graph(t_parse_tree_node *parse_tree, __attribute__((unused)) t_vec *nodes, __attribute__((unused)) t_vec *mosfets)
 {
        t_catalog       part_catalog;
@@ -1343,7 +1357,7 @@ int       construct_new_graph(t_parse_tree_node *parse_tree, __attribute__((unused)) t
        extract_used_names(&part_catalog, parse_tree);
        rebind_names_to_parts(&part_catalog);
        build_main_graph(&part_catalog);
-       //transfer_main(&part_catalog, nodes, mosfets);
+       transfer_main(&part_catalog, nodes, mosfets);
        free_catalog(&part_catalog);
        return (0);
 }