Skip to content

Commit c984a21

Browse files
committed
Cleans commeted code. Compiles and passes tests
1 parent fb06317 commit c984a21

File tree

1 file changed

+6
-302
lines changed

1 file changed

+6
-302
lines changed

src_mtln/preprocess.F90

Lines changed: 6 additions & 302 deletions
Original file line numberDiff line numberDiff line change
@@ -676,54 +676,6 @@ function writeSeriesRLnode(node, termination, end_node) result(res)
676676

677677
end function
678678

679-
function writeRLsCpnode(node, termination, end_node) result(res)
680-
type(nw_node_t), intent(in) :: node
681-
type(termination_t), intent(in) :: termination
682-
character(len=*), intent(in) :: end_node
683-
character(len=256), allocatable :: res(:)
684-
character(len=256) :: buff
685-
character(20) :: termination_r, termination_l, termination_c, line_c, line_g
686-
687-
write(termination_r, *) termination%resistance
688-
write(termination_c, *) termination%capacitance
689-
write(termination_l, *) termination%inductance
690-
write(line_c, *) node%line_c_per_meter * node%step/2
691-
692-
allocate(res(0))
693-
694-
buff = trim("R" // node%name // " " // node%name // " " // node%name //"_R " // termination_r)
695-
call appendToStringArray(res, buff)
696-
if (termination%source%path_to_excitation /= "") then
697-
buff = trim("L" // node%name // " " // node%name // "_R " // node%name //"_S " // termination_l)
698-
call appendToStringArray(res, buff)
699-
buff = trim("C" // node%name // " " // node%name // " " // node%name //"_S " // termination_c)
700-
call appendToStringArray(res, buff)
701-
if (termination%source%source_type == SOURCE_TYPE_VOLTAGE) then
702-
buff = trim("V" // node%name // "_S " // node%name // "_S " // end_node //" dc 0" )
703-
call appendToStringArray(res, buff)
704-
else if (termination%source%source_type == SOURCE_TYPE_CURRENT) then
705-
buff = trim("I" // node%name // "_S " // end_node // " " //node%name // "_S dc 0" )
706-
call appendToStringArray(res, buff)
707-
end if
708-
else
709-
buff = trim("L" // node%name // " " // node%name // "_R " // end_node //" "// termination_l)
710-
call appendToStringArray(res, buff)
711-
buff = trim("C" // node%name // " " // node%name // " " // end_node //" "// termination_c)
712-
call appendToStringArray(res, buff)
713-
end if
714-
buff = trim("I" // node%name // " " // node%name// " 0 " // " dc 0")
715-
call appendToStringArray(res, buff)
716-
buff = trim("CL" // node%name // " " // node%name // " 0 " // line_c)
717-
call appendToStringArray(res, buff)
718-
719-
if (node%line_g_per_meter /= 0) then
720-
write(line_g, *) 1.0/(node%line_g_per_meter * node%step/2)
721-
buff = trim(trim("GL" // node%name) // " " // trim(node%name) // " 0 " // trim(line_g))
722-
call appendToStringArray(res, buff)
723-
end if
724-
725-
726-
end function
727679

728680
function writeSeriesNode(node, termination, end_node) result(res)
729681
type(nw_node_t), intent(in) :: node
@@ -818,246 +770,7 @@ function writeOpenNode(node, termination, end_node) result(res)
818770
end if
819771

820772
end function
821-
822-
function writeLsRCpNode(node, termination, end_node) result(res)
823-
type(nw_node_t), intent(in) :: node
824-
type(termination_t), intent(in) :: termination
825-
character(len=*), intent(in) :: end_node
826-
character(len=256), allocatable :: res(:)
827-
character(len=256) :: buff
828-
character(len=:), allocatable :: node_name
829-
character(20) :: termination_r, termination_l, termination_c, line_c, line_g
830-
831-
write(termination_r, *) termination%resistance
832-
write(termination_l, *) termination%inductance
833-
write(termination_c, *) termination%capacitance
834-
write(line_c, *) node%line_c_per_meter * node%step/2
835-
836-
allocate(res(0))
837-
res = [trim("L" // node%name // " " // node%name // " " // node%name //"_p " // termination_l)]
838-
if (termination%source%path_to_excitation /= "") then
839-
buff = trim("C" // node%name // " " // node%name // "_p " // node%name //"_V "// termination_c)
840-
call appendToStringArray(res, buff)
841-
buff = trim("R" // node%name // " " // node%name // "_p " // node%name //"_V "// termination_r)
842-
call appendToStringArray(res, buff)
843-
844-
if (termination%source%source_type == SOURCE_TYPE_VOLTAGE) then
845-
buff = trim("V" // node%name // "_S " // node%name // "_V " // end_node //" dc 0" )
846-
call appendToStringArray(res, buff)
847-
else if (termination%source%source_type == SOURCE_TYPE_CURRENT) then
848-
buff = trim("I" // node%name // "_S " //end_node // " "// node%name // "_V dc 0" )
849-
call appendToStringArray(res, buff)
850-
end if
851-
else
852-
buff = trim("C" // node%name // " " // node%name // "_p " // end_node //" "// termination_c)
853-
call appendToStringArray(res, buff)
854-
buff = trim("R" // node%name // " " // node%name // "_p " // end_node //" "// termination_r)
855-
call appendToStringArray(res, buff)
856-
end if
857-
buff = trim("I" // node%name // " " // node%name// " 0 " // " dc 0")
858-
call appendToStringArray(res, buff)
859-
buff = trim("CL" // node%name // " " // node%name // " 0 " // line_c)
860-
call appendToStringArray(res, buff)
861-
862-
if (node%line_g_per_meter /= 0) then
863-
write(line_g, *) 1.0/(node%line_g_per_meter * node%step/2)
864-
buff = trim(trim("GL" // node%name) // " " // trim(node%name) // " 0 " // trim(line_g))
865-
call appendToStringArray(res, buff)
866-
end if
867-
end function
868-
869-
function writeCsLRpNode(node, termination, end_node) result(res)
870-
type(nw_node_t), intent(in) :: node
871-
type(termination_t), intent(in) :: termination
872-
character(len=*), intent(in) :: end_node
873-
character(len=256), allocatable :: res(:)
874-
character(len=256) :: buff
875-
character(len=:), allocatable :: node_name
876-
character(20) :: termination_r, termination_l, termination_c, line_c, line_g
877-
878-
write(termination_r, *) termination%resistance
879-
write(termination_l, *) termination%inductance
880-
write(termination_c, *) termination%capacitance
881-
write(line_c, *) node%line_c_per_meter * node%step/2
882-
883-
allocate(res(0))
884-
res = [trim("C" // node%name // " " // node%name // " " // node%name //"_p " // termination_c)]
885-
if (termination%source%path_to_excitation /= "") then
886-
buff = trim("L" // node%name // " " // node%name // "_p " // node%name //"_V "// termination_l)
887-
call appendToStringArray(res, buff)
888-
buff = trim("R" // node%name // " " // node%name // "_p " // node%name //"_V "// termination_r)
889-
call appendToStringArray(res, buff)
890-
891-
if (termination%source%source_type == SOURCE_TYPE_VOLTAGE) then
892-
buff = trim("V" // node%name // "_S " // node%name // "_V " // end_node //" dc 0" )
893-
call appendToStringArray(res, buff)
894-
else if (termination%source%source_type == SOURCE_TYPE_CURRENT) then
895-
buff = trim("I" // node%name // "_S " //end_node // " "// node%name // "_V dc 0" )
896-
call appendToStringArray(res, buff)
897-
end if
898-
else
899-
buff = trim("L" // node%name // " " // node%name // "_p " // end_node //" "// termination_l)
900-
call appendToStringArray(res, buff)
901-
buff = trim("R" // node%name // " " // node%name // "_p " // end_node //" "// termination_r)
902-
call appendToStringArray(res, buff)
903-
end if
904-
buff = trim("I" // node%name // " " // node%name// " 0 " // " dc 0")
905-
call appendToStringArray(res, buff)
906-
buff = trim("CL" // node%name // " " // node%name // " 0 " // line_c)
907-
call appendToStringArray(res, buff)
908-
909-
if (node%line_g_per_meter /= 0) then
910-
write(line_g, *) 1.0/(node%line_g_per_meter * node%step/2)
911-
buff = trim(trim("GL" // node%name) // " " // trim(node%name) // " 0 " // trim(line_g))
912-
call appendToStringArray(res, buff)
913-
end if
914-
915-
end function
916-
917-
function writeRCsLpNode(node, termination, end_node) result(res)
918-
type(nw_node_t), intent(in) :: node
919-
type(termination_t), intent(in) :: termination
920-
character(len=*), intent(in) :: end_node
921-
character(len=256), allocatable :: res(:)
922-
character(len=256) :: buff
923-
character(len=:), allocatable :: node_name
924-
character(20) :: termination_r, termination_l, termination_c, line_c, line_g
925-
926-
write(termination_r, *) termination%resistance
927-
write(termination_l, *) termination%inductance
928-
write(termination_c, *) termination%capacitance
929-
write(line_c, *) node%line_c_per_meter * node%step/2
930-
931-
allocate(res(0))
932-
buff = trim("C" // node%name // " " // node%name // " " // node%name //"_C " // termination_c)
933-
call appendToStringArray(res, buff)
934-
if (termination%source%path_to_excitation /= "") then
935-
buff = trim("R" // node%name // " " // node%name // "_C " // node%name //"_S " // termination_r)
936-
call appendToStringArray(res, buff)
937-
buff = trim("L" // node%name // " " // node%name // " " // node%name //"_S " // termination_l)
938-
call appendToStringArray(res, buff)
939-
if (termination%source%source_type == SOURCE_TYPE_VOLTAGE) then
940-
buff = trim("V" // node%name // "_S " // node%name // "_S " // end_node //" dc 0" )
941-
call appendToStringArray(res, buff)
942-
else if (termination%source%source_type == SOURCE_TYPE_CURRENT) then
943-
buff = trim("I" // node%name // "_S " // end_node // " " //node%name // "_S dc 0" )
944-
call appendToStringArray(res, buff)
945-
end if
946-
else
947-
buff = trim("R" // node%name // " " // node%name // "_C " // end_node //" "// termination_r)
948-
call appendToStringArray(res, buff)
949-
buff = trim("L" // node%name // " " // node%name // " " // end_node //" "// termination_l)
950-
call appendToStringArray(res, buff)
951-
end if
952-
buff = trim("I" // node%name // " " // node%name// " 0 " // " dc 0")
953-
call appendToStringArray(res, buff)
954-
buff = trim("CL" // node%name // " " // node%name // " 0 " // line_c)
955-
call appendToStringArray(res, buff)
956-
957-
if (node%line_g_per_meter /= 0) then
958-
write(line_g, *) 1.0/(node%line_g_per_meter * node%step/2)
959-
buff = trim(trim("GL" // node%name) // " " // trim(node%name) // " 0 " // trim(line_g))
960-
call appendToStringArray(res, buff)
961-
end if
962-
end function
963773

964-
function writeLCsRpNode(node, termination, end_node) result(res)
965-
type(nw_node_t), intent(in) :: node
966-
type(termination_t), intent(in) :: termination
967-
character(len=*), intent(in) :: end_node
968-
character(len=256), allocatable :: res(:)
969-
character(len=256) :: buff
970-
character(len=:), allocatable :: node_name
971-
character(20) :: termination_r, termination_l, termination_c, line_c, line_g
972-
973-
write(termination_r, *) termination%resistance
974-
write(termination_l, *) termination%inductance
975-
write(termination_c, *) termination%capacitance
976-
write(line_c, *) node%line_c_per_meter * node%step/2
977-
978-
allocate(res(0))
979-
buff = trim("C" // node%name // " " // node%name // " " // node%name //"_C " // termination_c)
980-
call appendToStringArray(res, buff)
981-
if (termination%source%path_to_excitation /= "") then
982-
buff = trim("L" // node%name // " " // node%name // "_C " // node%name //"_S " // termination_l)
983-
call appendToStringArray(res, buff)
984-
buff = trim("R" // node%name // " " // node%name // " " // node%name //"_S " // termination_r)
985-
call appendToStringArray(res, buff)
986-
if (termination%source%source_type == SOURCE_TYPE_VOLTAGE) then
987-
buff = trim("V" // node%name // "_S " // node%name // "_S " // end_node //" dc 0" )
988-
call appendToStringArray(res, buff)
989-
else if (termination%source%source_type == SOURCE_TYPE_CURRENT) then
990-
buff = trim("I" // node%name // "_S " // end_node // " " //node%name // "_S dc 0" )
991-
call appendToStringArray(res, buff)
992-
end if
993-
else
994-
buff = trim("L" // node%name // " " // node%name // "_C " // end_node //" "// termination_l)
995-
call appendToStringArray(res, buff)
996-
buff = trim("R" // node%name // " " // node%name // " " // end_node //" "// termination_r)
997-
call appendToStringArray(res, buff)
998-
end if
999-
buff = trim("I" // node%name // " " // node%name// " 0 " // " dc 0")
1000-
call appendToStringArray(res, buff)
1001-
buff = trim("CL" // node%name // " " // node%name // " 0 " // line_c)
1002-
call appendToStringArray(res, buff)
1003-
1004-
if (node%line_g_per_meter /= 0) then
1005-
write(line_g, *) 1.0/(node%line_g_per_meter * node%step/2)
1006-
buff = trim(trim("GL" // node%name) // " " // trim(node%name) // " 0 " // trim(line_g))
1007-
call appendToStringArray(res, buff)
1008-
end if
1009-
1010-
end function
1011-
1012-
function writeRsLCpNode(node, termination, end_node) result(res)
1013-
type(nw_node_t), intent(in) :: node
1014-
type(termination_t), intent(in) :: termination
1015-
character(len=*), intent(in) :: end_node
1016-
character(len=256), allocatable :: res(:)
1017-
character(len=256) :: buff
1018-
character(len=:), allocatable :: node_name
1019-
character(20) :: termination_r, termination_l, termination_c, line_c, line_g
1020-
1021-
write(termination_r, *) termination%resistance
1022-
write(termination_l, *) termination%inductance
1023-
write(termination_c, *) termination%capacitance
1024-
write(line_c, *) node%line_c_per_meter * node%step/2
1025-
1026-
allocate(res(0))
1027-
res = [trim("R" // node%name // " " // node%name // " " // node%name //"_p " // termination_r)]
1028-
if (termination%source%path_to_excitation /= "") then
1029-
buff = trim("L" // node%name // " " // node%name // "_p " // node%name //"_V "// termination_l)
1030-
call appendToStringArray(res, buff)
1031-
buff = trim("C" // node%name // " " // node%name // "_p " // node%name //"_V "// termination_c)
1032-
call appendToStringArray(res, buff)
1033-
1034-
if (termination%source%source_type == SOURCE_TYPE_VOLTAGE) then
1035-
buff = trim("V" // node%name // "_S " // node%name // "_V " // end_node //" dc 0" )
1036-
call appendToStringArray(res, buff)
1037-
else if (termination%source%source_type == SOURCE_TYPE_CURRENT) then
1038-
buff = trim("I" // node%name // "_S " //end_node // " "// node%name // "_V dc 0" )
1039-
call appendToStringArray(res, buff)
1040-
end if
1041-
else
1042-
buff = trim("L" // node%name // " " // node%name // "_p " // end_node //" "// termination_l)
1043-
call appendToStringArray(res, buff)
1044-
buff = trim("C" // node%name // " " // node%name // "_p " // end_node //" "// termination_c)
1045-
call appendToStringArray(res, buff)
1046-
end if
1047-
buff = trim("I" // node%name // " " // node%name// " 0 " // " dc 0")
1048-
call appendToStringArray(res, buff)
1049-
buff = trim("CL" // node%name // " " // node%name // " 0 " // line_c)
1050-
call appendToStringArray(res, buff)
1051-
1052-
if (node%line_g_per_meter /= 0) then
1053-
write(line_g, *) 1.0/(node%line_g_per_meter * node%step/2)
1054-
buff = trim(trim("GL" // node%name) // " " // trim(node%name) // " 0 " // trim(line_g))
1055-
call appendToStringArray(res, buff)
1056-
end if
1057-
1058-
1059-
end function
1060-
1061774
function writeNodeDescription(node, termination, end_node) result(res)
1062775
type(nw_node_t), intent(in) :: node
1063776
type(termination_t), intent(in) :: termination
@@ -1068,27 +781,18 @@ function writeNodeDescription(node, termination, end_node) result(res)
1068781
res = writeSeriesNode(node, termination, end_node)
1069782
else if (termination%termination_type == TERMINATION_PARALLEL) then
1070783
res = writeParallelRLCNode(node, termination, end_node)
1071-
1072784
else if (termination%termination_type == TERMINATION_RsLCp) then
1073-
res = writeXsYZpNode(node, termination, end_node, "RLC")
1074-
! res = writeRsLCpNode(node, termination, end_node)
785+
res = writeXsYZpNode(node, termination, end_node, XYZ = "RLC")
1075786
else if (termination%termination_type == TERMINATION_LsRCp) then
1076-
res = writeXsYZpNode(node, termination, end_node, "LRC")
1077-
! res = writeLsRCpNode(node, termination, end_node)
787+
res = writeXsYZpNode(node, termination, end_node, XYZ = "LRC")
1078788
else if (termination%termination_type == TERMINATION_CsLRp) then
1079-
! res = writeCsLRpNode(node, termination, end_node)
1080-
res = writeXsYZpNode(node, termination, end_node, "CLR")
1081-
789+
res = writeXsYZpNode(node, termination, end_node, XYZ = "CLR")
1082790
else if (termination%termination_type == TERMINATION_RLsCp) then
1083-
! res = writeRLsCpNode(node, termination, end_node)
1084-
res = writeXYsZpNode(node, termination, end_node, "RLC")
791+
res = writeXYsZpNode(node, termination, end_node, XYZ = "RLC")
1085792
else if (termination%termination_type == TERMINATION_RCsLp) then
1086-
! res = writeRCsLpNode(node, termination, end_node)
1087-
res = writeXYsZpNode(node, termination, end_node, "RCL")
793+
res = writeXYsZpNode(node, termination, end_node, XYZ = "RCL")
1088794
else if (termination%termination_type == TERMINATION_LCsRp) then
1089-
! res = writeLCsRpNode(node, termination, end_node)
1090-
res = writeXYsZpNode(node, termination, end_node, "LCR")
1091-
795+
res = writeXYsZpNode(node, termination, end_node, XYZ = "LCR")
1092796
else if (termination%termination_type == TERMINATION_SHORT) then
1093797
res = writeShortNode(node, termination , end_node)
1094798
else if (termination%termination_type == TERMINATION_OPEN) then

0 commit comments

Comments
 (0)