/usr/share/elmerfront/tcl/ecif_tk_procsInterface.tcl is in elmer-common 6.1.0.svn.5396.dfsg-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 | #/*****************************************************************************/
# *
# * Elmer, A Finite Element Software for Multiphysical Problems
# *
# * Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland
# *
# * This program is free software; you can redistribute it and/or
# * modify it under the terms of the GNU General Public License
# * as published by the Free Software Foundation; either version 2
# * of the License, or (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program (in file fem/GPL-2); if not, write to the
# * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# * Boston, MA 02110-1301, USA.
# *
# *****************************************************************************/
#***********************************************************************
#Program: ELMER Front
#Module: ecif_tk_procsInterface.tcl
#Language: Tcl
#Date: 28.10.98
#Version: 1.00
#Author(s): Martti Verho
#Revisions:
#
#Abstract: Cpp-->tcl interface procedures
#
#************************************************************************
proc Interface::acceptParameters {} {
global Info
set data [split $Info(arguments) $Info(argSeparator)]
set msg [lindex $data 0]
set pdatas [lindex $data 1]
set pdatas [split $pdatas $Info(objectSeparator)]
set Info(results) ""
set w .copyParamsW
set wgeom -100+100
toplevel $w
focus $w
#--Window properties
wm title $w $msg
wm geometry $w $wgeom
set Info(results) [CheckBoxList::create $w $pdatas "" 40 15]
MenuBuild::configureMenuButtonOption File copy_parameters state normal
}
#-Procedure reads all parameter data when called from cpp-environment
#
proc Interface::applyAllParameterDataPre {} {
global Info Common Model ModelFlags Boundary
global ModelParameter SimulationParameter
global Constant Coordinate Datafile
global BodyParameter BoundaryParameter
global BodyForce BoundaryCondition Constant Coordinate Datafile
global Equation EquationVariable GridH GridParameter InitialCondition
global Material ModelProperty Solver SolverControl Timestep UserSetting
set Info(informAboutRemovedFields) 1
set Model(removedFieldsList) ""
# Init non-standard panels (except Solver). This also sets
# default values for possible new fields and drops possible
# obsolate fields from parameters!
# NOTE: These are parameters which have only one active
# parameter id at a time. That is why we initialize also the
# fields, so that clients can right away call Coordinate(COORDINATE_SYSTEM)
# etc.
# ==============================================
# Possible pre converse of older version data!!!
# ==============================================
set Info(doConversion) 0
foreach globArray $Common(allPanelArries) {
set msg ""
if { [catch { Interface::preConverseInputData $globArray } msg] } {
set msg [string map {"\"" " "} $msg]
set aname [string toupper $globArray]
set msg [list "NOTE: Old version data for $aname was not pre-converted because:\n" $msg]
Message::dispMessage $msg
}
}
# ==============================================
set Info(markMainWindowTitle) 0
GridH::updateObjectParameterId
GridParameter::updateObjectParameterId
set mmodified 0 ;# Model modfied
set pmodified 0 ;# Paramters modified
# These arries need at least one parameter instance to be saved or
# at least instantiated !!!
# 0 <--> do not save
#
set arr_defs { Constant Coordinate Datafile SimulationParameter
SolverControl Timestep {EquationVariable 0}
}
foreach arr_def $arr_defs {
set arr [lindex $arr_def 0]
set save 1
if { 1 < [llength $arr_def] } {
set save [lindex $arr_def 1]
}
upvar #0 $arr theArr
set theArr(dataChanged) 0
set theArr(dataModified) 0
set active_id 1
foreach id $theArr(ids) {
# Last active will be the active!
if { "True" == [DataField::getFieldValue $arr $id ACTIVE] } {
set active_id $id
}
set mask [Util::getArrayValue $arr targetMask]
set pmodified1 0
set theArr($id,data) [DataField::checkParameterData $arr $id pmodified1 $mask]
if {$pmodified1} {
set pmodified 1
}
}
# If no parameter define, form at least one!
#
if { $theArr(ids) == "" || $theArr(1,data) == "" } {
Panel::initFields $arr
DataField::formDefaultNonStandardParameter $arr 1
set theArr(ids) 1
}
Panel::resetFields $arr
Panel::initFields $arr
# Create data fields from the active paramter!
set theArr(parameterId) $active_id
DataField::formDataFields $arr $theArr($theArr(parameterId),data)
if { $save } {
execNsProc $arr panelSave 0
}
} ;#--For each instantiated
# What is the idea here??? Is a grid parameter really needed
# if we have a mesh?
# Inactivated because it causes an error when parameters are copied
# to a model which has a mesh, MVe 1.2.2003
#
if { $ModelFlags(GEOMETRY_TYPE_CAD) &&
$Model(Mesh,exists) &&
!$Model(Mesh,hasParameter)
} {
#MeshDefine::panelSave 0
}
set Info(markMainWindowTitle) 1
if { $mmodified || $pmodified } {
set Model(Front,needsUpdate) 1
if { $mmodified } {
Util::setMainWindowTitle
}
} else {
MenuExec::resetUpdateFlags
}
}
proc Interface::applyAllParameterDataPost {} {
global Info Common Model ModelFlags Boundary
global ModelParameter SimulationParameter
global Constant Coordinate Datafile
global BodyParameter BoundaryParameter
global BodyForce BoundaryCondition Constant Coordinate Datafile
global Equation EquationVariable GridH GridParameter InitialCondition
global Material ModelProperty Solver SolverControl Timestep UserSetting
set Info(informAboutRemovedFields) 1
set Model(removedFieldsList) ""
#-EquationVariable data needs special handling because
# model-file variables may not contain the new (default) equation
# variables given in user definitions (this problem results normally
# if the user has changed the name of an equation variable compared to what
# is saved in the model file
#
set times ""
set t ""
set t1 [clock clicks -milliseconds]
#set t2 [clock clicks -milliseconds]; set t [expr $t2 - $t1]
#MSG "- EquationVariable::updateFieldData $t"
EquationVariable::updateFieldData
#set t2 [clock clicks -milliseconds]; set t [expr $t2 - $t1]; lappend times $t
#MSG "- EquationVariable::formActiveParameter $t"
EquationVariable::formActiveParameter
#set t2 [clock clicks -milliseconds]; set t [expr $t2 - $t1]; lappend times $t
#MSG "- Util::cpp_exec equationVariablesPanelOk $t"
Util::cpp_exec equationVariablesPanelOk
#set t2 [clock clicks -milliseconds]; set t [expr $t2 - $t1]; lappend times $t
#MSG "- EquationVariable::updateAllVariableNames $t"
EquationVariable::updateAllVariableNames
#-Set default coordinate system if not given
if { $Coordinate(COORDINATE_SYSTEM) == "None" } {
Coordinate::setDefaultCoordinateSystem
}
#-Apply coord-system (eg. Model(SIMULATION_DIMENSION)!)
Coordinate::applyCoordinateDimension $Coordinate(COORDINATE_SYSTEM)
#set t2 [clock clicks -milliseconds]; set t [expr $t2 - $t1]; lappend times $t
#MSG "- Equation::setOtherMasks $t"
#-Dimension and bc masks
Equation::setOtherMasks
#set t2 [clock clicks -milliseconds]; set t [expr $t2 - $t1]; lappend times $t
#MSG "- DataField::setVariables $t"
#-Update variable components
DataField::setVariables
#-Expand fields which depend on an "indexing" variables
# (eg. a variable defined in EquationVariable)
DataField::setAllFields $Common(allPanelArries)
#set t2 [clock clicks -milliseconds]; set t [expr $t2 - $t1]; lappend times $t
#MSG "- StdPanelInit::updateEquationDataAndMasks $t"
#-Create Equation parameter masks
StdPanelInit::updateEquationDataAndMasks
#set t2 [clock clicks -milliseconds]; set t [expr $t2 - $t1]; lappend times $t
#MSG "- StdPanelInit::createObjectTableMasks $t"
#-Create ObjectTable masks
StdPanelInit::createObjectTableMasks
#set t2 [clock clicks -milliseconds]; set t [expr $t2 - $t1]; lappend times $t
#MSG "- Equation::constructProblemMask $t"
#-Set current problem mask value
Equation::constructProblemMask
#-Set problem indices based on body masks
Equation::updateEquationIndices
#set t2 [clock clicks -milliseconds]; set t [expr $t2 - $t1]; lappend times $t
#MSG "- StdPanelInit::createObjectAndBoundaryLists $t"
#-Init all mask related panels and check parameters
foreach arr $Common(maskedParameters) {
StdPanelInit::createObjectAndBoundaryLists $arr
}
#set t2 [clock clicks -milliseconds]; set t [expr $t2 - $t1]; lappend times $t
#MSG "- Panel::checkInputParameters $t"
# Remove all non-input fields from all parameters
Panel::checkInputParameters $Common(allPanelArries) "allFields"
#set t2 [clock clicks -milliseconds]; set t [expr $t2 - $t1]; lappend times $t
#MSG "- Panel::checkParameters $t"
set pmodified 0 ;# Parameters modified
Panel::checkParameters $Common(maskedParameters) pmodified
# ===============================================
# Possible post converse of older version data!!!
# ===============================================
if { $Info(doConversion) } {
foreach globArray $Common(allPanelArries) {
set msg ""
if { [catch { Interface::postConverseInputData $globArray } msg] } {
set msg [string map {"\"" " "} $msg]
set aname [string toupper $globArray]
set msg [list "NOTE: Old version data for $aname was not post-converted because:\n" $msg]
Message::dispMessage $msg
}
}
}
# ==============================================
#set t2 [clock clicks -milliseconds]; set t [expr $t2 - $t1]; lappend times $t
#MSG "- Solver::checkSolverData $t"
#-Solver data need special handling because there can be many solvers
# contrary to other non-standard panel objects
#
set smodified 0 ;# Solvers modified
Solver::checkSolverData $Equation(activeIndices) smodified
Util::updateFlagNameValues
# Replace possible old value with Newmark stuff
Timestep::checkTimesteppingMethodValue
if { $Timestep(dataModified) } {
Message::showMessage "NOTE: An obsolete Timestepping keyword has been changed!"
Message::showMessage "Saving the model file recommended!"
Timestep::panelSave 1
}
#-Other globals
set Boundary(firstTime) 1
set Boundary(isUpdated) 0
set Info(markMainWindowTitle) 1
if { $pmodified || $smodified } {
set Model(Front,needsUpdate) 1
Util::setMainWindowTitle
} else {
MenuExec::resetUpdateFlags
}
# If some fields were removed from the model!
# ===========================================
if { $Model(removedFieldsList) != "" &&
$Model(hasUserDefinitions)
} {
set msg ""
lappend msg "WARNING: The following panel fields were removed from the model!\n\n"
lappend msg "(Possibly a definition file should be loaded BEFORE reading the model file)\n\n"
DataField::informAboutRemovedFields $msg
}
set Info(informAboutRemovedFields) 0
#set Model(removedFieldsList) ""
#set t2 [clock clicks -milliseconds]; set t [expr $t2 - $t1]; lappend times $t
#MSG "- List: $times"
#MSG "- All done $t"
}
#-Procedure reads all body-level data when called from cpp-environment
#
proc Interface::applyBodyData {} {
global ObjectTable
foreach id $ObjectTable(ids) {
if { $ObjectTable($id,tp) != "B" } {
continue
}
set cpp_color $ObjectTable($id,clr)
set ObjectTable($id,clr) "#$cpp_color"
set ObjectTable($id,dspl) 1
}
}
#-Procedure to read inner/outer boundary-level data
#
proc Interface::applyBoundaryData {} {
global Model ObjectTable
# Edges as subobjects of Faces
# Vertices as subobjects of Faces if no edges defined
#
if { $Model(GEOMETRY_DIMENSION) == "3D" } {
#StdPanelInit::setObjectTableSubIds "F" "E" 0
#StdPanelInit::setObjectTableSubIds "F" "V" 1
# Vertices as subobjects of Edges
#
} else {
#StdPanelInit::setObjectTableSubIds "E" "V"
}
# Set display mode
#
foreach id $ObjectTable(ids) {
if { $Model(GEOMETRY_DIMENSION) == "3D" } {
if { $ObjectTable($id,tp) != "F" &&
$ObjectTable($id,tp) != "V"
} {
continue
}
} else {
if { $ObjectTable($id,tp) != "E" &&
$ObjectTable($id,tp) != "V"
} {
continue
}
}
set ObjectTable($id,dspl) 1
}
}
#-Procedure reads all model-level data when called from cpp-environment
#
proc Interface::applyModelData {} {
global Info MeshDefine Model ModelProperty
# Check that input file version is sensible
set mfn $Info(FRONT_INPUT_VERSION_NBR) ;# Input model file version
set efn $Info(FRONT_MAIN_VERSION_NBR) ;# Current Elmer Front main version
if { $mfn > $efn } {
set msg "WARNING: Elmer Front version ($efn) is older than the model file version ($mfn) !"
Message::dispOkMessage $msg"
}
#--Pick possible current mesh name
if { $Model(meshNames) != "" &&
$Model(currentMeshIndex) != $Info(NO_INDEX)
} {
set old_current_mesh [lindex $Model(meshNames) $Model(currentMeshIndex)]
} else {
set old_current_mesh ""
}
set old_mesh_names $Model(meshNames)
#--Find active mesh names
#set Model(meshNames) [ModelProperty::findModelMeshNames]
#--Find old mesh data by the new mesh name list
set old2new_indices ""
if { $old_mesh_names != "" } {
foreach old_name $old_mesh_names {
lappend old2new_indices [lsearch $Model(meshNames) $old_name]
}
}
#--Form mesh-hs, mesh-fs anf bg-mesh var values for
# current meshes
set mesh_hs ""
set mesh_fs ""
set mesh_bg ""
set mesh_bg_act ""
set mesh_bg_ctrl ""
# These parameter values means that a mesh
# was not identified!
set def_h -1
set def_f -1
set def_bg ""
set def_bg_act 0
set def_bg_ctrl 0
# "Sparse" Model-array lists
foreach mn $Model(meshNames) {
lappend mesh_hs $def_h
lappend mesh_fs $def_f
lappend mesh_bg $def_bg
lappend mesh_bg_act $def_bg_act
lappend mesh_bg_ctrl $def_bg_ctrl
}
foreach idx $old2new_indices \
mh $Model(meshHs) \
mf $Model(meshFs) {
# If old mesh not found any more
if { $idx == -1 || $idx == "" } {
continue
}
# Use model values if they are "actual"
if { $mh != "" && $mf != "" } {
set mesh_hs [lreplace $mesh_hs $idx $idx $mh]
set mesh_fs [lreplace $mesh_fs $idx $idx $mf]
# Update "sparse" bg-lists from indexed input lists!!!
#
set bg_idx [lsearch $Model(meshBgMeshFileIndices) $idx]
if { $bg_idx == -1 } {
continue
}
set mesh_bg [ lreplace $mesh_bg $idx $idx [lindex $Model(meshBgMeshFiles) $bg_idx] ]
set mesh_bg_act [ lreplace $mesh_bg_act $idx $idx [lindex $Model(meshBgMeshActives) $bg_idx] ]
set mesh_bg_ctrl [ lreplace $mesh_bg_ctrl $idx $idx [lindex $Model(meshBgMeshControls) $bg_idx] ]
}
}
set Model(meshHs) $mesh_hs
set Model(meshFs) $mesh_fs
set Model(meshBgMeshFiles) $mesh_bg
set Model(meshBgMeshActives) $mesh_bg_act
set Model(meshBgMeshControls) $mesh_bg_ctrl
# Init current mesh name, if missing
if { $old_current_mesh == "" } {
set old_current_mesh [lindex $Model(meshNames) 0]
}
#--Set current mesh index and name
set mesh_index [lsearch $Model(meshNames) $old_current_mesh]
if { $mesh_index != -1 } {
set Model(currentMeshIndex) $mesh_index
set Model(currentMeshName) [lindex $Model(meshNames) $mesh_index]
} else {
set Model(currentMeshIndex) $Info(NO_INDEX)
set Model(currentMeshName) ""
}
#--Set directory info
ModelProperty::setModelCaseName
ModelProperty::setCurrentMeshDirectory
}
proc Interface::applyModelFlags {} {
global ModelFlags
if { $ModelFlags(DRAW_TARGET_BODIES) } {
set ModelFlags(DRAW_TARGET) "DRAW_TARGET_BODIES"
} elseif { $ModelFlags(DRAW_TARGET_SURFACES) } {
set ModelFlags(DRAW_TARGET) "DRAW_TARGET_SURFACES"
} else {
set ModelFlags(DRAW_TARGET) "DRAW_TARGET_EDGES"
}
}
proc Interface::applyModelGeometryDimension {} {
global Info Model
if { $Model(GEOMETRY_DIMENSION) == "2D" } {
set Info(drawEdges) 1
} else {
set Info(drawSurfaces) 1
}
Message::showMessage "Model dimension: $Model(GEOMETRY_DIMENSION)"
}
# Apply model status
# 0 <--> ok, !0 <--> some error
#
proc Interface::applyModelStatus {} {
global Model
if { $Model(status) == 0 } {
set Model(statusMessage) ""
} else {
Util::cpp_exec putModelStatusMessage
}
}
proc Interface::applyObjectTableData {} {
}
proc Interface::applyStatsData {} {
global Model
if { $Model(minEdgeSize) > 1e+010 } {
set Model(minEdgeSize) ""
}
}
#---Generic Debug command
#
proc Interface::debug {} {
global UserSetting
Message::showMessage "Models dir = $UserSetting(DEFAULT_MODEL_DIRECTORY)"
}
#---Initalization commands
proc Interface::activateFileMenus {} {
MenuBuild::activateFileMenus
}
proc Interface::checkmeshInfoTs {} {
global Info
set ts $Info(arguments)
}
# Set option value in one button
#
proc Interface::configureButtonOption {} {
global Info
set arg_list [split $Info(arguments) $Info(argSeparator)]
set button [lindex $arg_list 0]
set option [lindex $arg_list 1]
set value [lindex $arg_list 2]
MenuBuild::configureButtonOption $button $option $value
}
# Configure one or more buttons state
#
proc Interface::configureButtons {} {
global Info
set arg_list [split $Info(arguments) $Info(argSeparator)]
set buttons [lindex $arg_list 0]
set value [lindex $arg_list 1]
MenuBuild::configureButtons $buttons $value
}
# Set state for the menu commands in a group "menu"
#
proc Interface::configureMenuButtons {} {
global Info
set arg_list [split $Info(arguments) $Info(argSeparator)]
set menu [lindex $arg_list 0]
set buttons [lindex $arg_list 1]
set value [lindex $arg_list 2]
MenuBuild::configureMenuButtons $menu $buttons $value
}
# Set option value in one menu button (command)
#
proc Interface::configureMenuButton {} {
global Info
set arg_list [split $Info(arguments) $Info(argSeparator)]
set menu [lindex $arg_list 0]
set button [lindex $arg_list 1]
set option [lindex $arg_list 2]
set value [lindex $arg_list 2]
MenuBuild::configureMenuButton $menu $button $option $value
}
proc Interface::createBodiesMenus {} {
global gMW
MenuBuild::createBodyListMenu $gMW(Model,bodyList) ""
}
# Receive command to display error-message
#
proc Interface::displayErrorMsg {} {
global Info __GUIServerPort
set sep $Info(argSeparator)
set data [split $Info(arguments) $sep]
set err_level [lindex $data 0]
if { $err_level == 0 } {
set Info(messageIcon) warning
} else {
set Info(messageIcon) error
}
set msg [lindex $data 1]
Message::dispOkMessage $msg
# ERROR LEVEL 99 <===> STOPPING FRONT PROGRAM !!!
if {$err_level == 99} {
Util::cpp_exec cpp_exit
exit
}
}
proc Interface::displayBodySelectPanel {} {
Util::execProc BodyDisplay::openPanel
}
proc Interface::displayBoundarySelectPanel {} {
Util::execProc BoundaryDisplay::openPanel
}
proc Interface::displayLabelSelectPanel {} {
Util::execProc LabelDisplay::openPanel
}
proc Interface::fieldNameGuiToSif {} {
global Info
set gui_name $Info(arguments)
set Info(results) [DataField::fieldNameGuiToSif $gui_name]
}
proc Interface::fieldNameSifToGui {} {
global Info
set sif_name $Info(arguments)
set Info(results) [DataField::fieldNameSifToGui $sif_name]
}
proc Interface::getColorName {} {
global Info
}
# Check if an equation panel field (possibly for a specific equation) should
# be output into a solver section
#
proc Interface::getIsSolverTargetField {} {
global Info
set arg_list [split $Info(arguments) $Info(argSeparator)]
set eq_name [lindex $arg_list 0]
set fld_name [lindex $arg_list 1]
set Info(results) 0
set field_target [DataField::getFieldProperty Equation $fld_name FieldTarget]
# Is not a redirected field
#
if { $field_target == "" } {
set Info(results) 0
return
}
# Ok, is redirected and equation name does not matter
if { $eq_name == "" } {
set Info(results) 1
return
}
set eq_field [DataField::fieldNameSifToGui $eq_name]
set emask [DataField::getFieldProperty Equation $eq_field EquationMask]
# Is redirected but equation name does not match
if { ![DataField::fieldDisplayMaskMatches Equation $fld_name $emask] } {
set Info(results) 0
return
}
set Info(results) 1
}
# Get mif-file name
#
proc Interface::getMeshInputFileName {} {
global Info
set Info(results) [MenuExec::getMeshInputFileName]
}
proc Interface::getNextActiveSelectionTolerance {} {
global Info Model
set Info(nextActiveSelectionTolerance) $Info(arguments)
set Info(NEXT_ACTIVE_SELECTION_TOLERANCE) $Info(arguments)
}
proc Interface::getParallelInfo {} {
global Info Processor
set arg_list [split $Info(arguments) $Info(fieldSeparator)]
set index 0
foreach var $Processor(allFields) {
set Processor($var) [lindex $arg_list $index]
incr index
}
}
proc Interface::getParameterFieldInfo {} {
global Info
set arg_list [split $Info(arguments) $Info(argSeparator)]
set globArray [lindex $arg_list 0]
set fld [lindex $arg_list 1]
set sif_name [DataField::getFieldProperty $globArray $fld SifName "" 0]
set vtype [DataField::getFieldProperty $globArray $fld FieldValueType]
set output_sif_type [DataField::getFieldProperty $globArray $fld OutputSifType]
set always_output [DataField::getFieldProperty $globArray $fld AlwaysOutput]
set dtype [DataField::getFieldProperty $globArray $fld FieldDataType]
# NOTE: Argument order in the list is fixed!!!
# (ref. UserInterface_TCL::getParameterInfo() in cpp side)
#
set Info(results) ""
#--1. Possible specially set Sif-name
lappend Info(results) $sif_name
#--2. Field value type (Integer Real etc.)
lappend Info(results) $vtype
#--3. Is sif output field (0/1)
if { [Panel::isSifField $globArray $fld] } {
lappend Info(results) 1
} else {
lappend Info(results) 0
}
#--4. Output field value type to sif (0/1)
lappend Info(results) $output_sif_type
#--5. Is field should be always output (even when value is (False/None)) (0/1)
lappend Info(results) $always_output
#--6. Is array (0/1)
if { $dtype == "Scalar" } {
lappend Info(results) 0
} else {
lappend Info(results) 1
}
#--7. Is quoted (0/1)
if { $vtype == "String" } {
lappend Info(results) 1
} else {
lappend Info(results) 0
}
#--8. Is file name (0/1)
if { $vtype == "File" } {
lappend Info(results) 1
} else {
lappend Info(results) 0
}
#--9. Is procedure name (0/1)
if { $vtype == "Procedure" } {
lappend Info(results) 1
} else {
lappend Info(results) 0
}
}
# Check from array SKWD if value type is given for
# a keyword in a solver section
# Section and keyword are given from cpp-side via the
# Info(arguments) and result is returned using
# the global Info(results) transfer variable
#
proc Interface::getSolverKeywordTypeGiven {} {
global Info SKWD
set arg_list [split $Info(arguments) $Info(argSeparator)]
set section [lindex $arg_list 0]
set kwd [lindex $arg_list 1]
set section [string tolower $section]
set kwd [string tolower $kwd]
set sec ""
switch $section {
"simulation" {set sec "SI"}
"constants" {set sec "CN"}
"body force" {set sec "BF"}
"initial condition" {set sec "IC"}
"boundary condition" {set sec "BC"}
"equation" {set sec "EQ"}
"material" {set sec "MT"}
"solver" {set sec "SL"}
"body" {set sec "BO"}
"boundary" {set sec "BA"}
}
if { $sec == "" || ![info exists SKWD($sec,$kwd) ] } {
set Info(results) 0
} else {
set Info(results) $SKWD($sec,$kwd)
}
}
proc Interface::getUseVariableNameInEquationName {} {
global Info
set eq_index $Info(arguments)
set Info(results) [Equation::useVariableNameInEquationName $eq_index]
}
proc Interface::initEquationedPanels {} {
set reset 0
StdPanelInit::initPanelData InitialCondition $reset
StdPanelInit::initPanelData BoundaryCondition $reset
StdPanelInit::initPanelData BodyForce $reset
StdPanelInit::initPanelData Material $reset
}
# Inform gui about a Matc-file which was read by the model
#
proc Interface::matcFileWasRead {} {
global Info
set fname $Info(arguments);
# Store filename in info-list
Util::addToFileList Info(matcFiles) $fname
set msg "***MATC file loaded: $fname"
Message::showMessage $msg $Info(remMsgColor)
}
# Inform gui about a color-file which was read by the model
#
proc Interface::colorFileWasRead {} {
global Info
set fname $Info(arguments);
# Store filename in info-list
Util::addToFileList Info(colorFiles) $fname
set msg "***Color file loaded: $fname"
Message::showMessage $msg $Info(remMsgColor)
}
# For debugging!
#
proc Interface::printFlags {} {
global ModelFlags
set flags {
GEOMETRY_TYPE_CAD GEOMETRY_TYPE_MESH
DRAW_SOURCE_CAD DRAW_SOURCE_MESH
DRAW_TARGET_BODIES DRAW_TARGET_SURFACES
}
foreach flag $flags {
set var "ModelFlags($flag"
append var ")"
set var [set $var]
Message::showMessage "$flag = $var"
}
}
proc Interface::resetObjectTable {} {
MenuExec::resetObjectTable
}
proc Interface::resetObjectTableByType {} {
global Info
set type [string toupper $Info(arguments)]
MenuExec::resetObjectTableByType $type
}
### Update FLAGS ###
# If there was a change data related to the target
#
proc Interface::setNeedsUpdate {} {
global Model Info
set target $Info(arguments)
#print "$target needs update!"
set Model($target,needsUpdate) 1
}
# If target data was updated
#
proc Interface::setWasUpdated {} {
global Model Info
set target $Info(arguments)
#print "$target was updated!"
set Model($target,needsUpdate) 0
}
# If a mesh has been generated for the model
#
proc Interface::setModelHasElmerMesh {} {
global Model
set Model(Mesh,exists) 1
}
# If any (applied) mesh parameter set
#
proc Interface::setModelHasMeshParameter {} {
global Model
set Model(Mesh,hasParameter) 1
}
# If model has any geometry related Matc-definitions
#
proc Interface::setModelHasMatcDefinitions {} {
global Model
set Model(hasMatcDefinitions) 1
MenuBuild::configureMenuButtonOption Edit updateCadGeometry state normal
MenuBuild::configureMenuButtonOption Edit dropMatcDefinitions state normal
}
# If Mesh was edited
#
proc Interface::setMeshEdited {} {
global Model
set Model(Mesh,edited) 1
}
# If (internal or external) Mesh exists
#
proc Interface::setMeshExists {} {
global Model
set Model(Mesh,exists) 1
}
proc Interface::setMeshInputUnit {} {
global Info Model
set unit [lindex $Info(arguments) 0]
if { $unit > 0 } {
set Model(meshInputUnit) $unit
} else {
set Model(meshInputUnit) 1.0
}
}
##### MISCELLANOUS DATA UPDATE
proc Interface::saveModelPropertyData {} {
ModelProperty::panelSave
}
proc Interface::selectBody {} {
global Info BodyDisplay
set sp $Info(fieldSeparator)
set bd1_id [lindex $Info(arguments) 0]
set lr1_id [lindex $Info(arguments) 1]
set bd2_id [lindex $Info(arguments) 2]
set lr2_id [lindex $Info(arguments) 3]
set mode [lindex $Info(arguments) 4]
ListBox::selectBody $bd1_id $lr1_id $bd2_id $lr2_id $mode
# NOTE: For bodies we do not actually know the selection mode
# but the client can toggle when handling this call!
#
if { [winfo exist $BodyDisplay(winName)] } {
BodyDisplay::setSelectionMode $bd1_id
BodyDisplay::setSelectionMode $bd2_id
}
}
# Set element selected in the list box
#
proc Interface::selectBoundary {} {
global Info
set bndr_id [lindex $Info(arguments) 0]
set bd1_id [lindex $Info(arguments) 1]
set lr1_id [lindex $Info(arguments) 2]
set bd2_id [lindex $Info(arguments) 3]
set lr2_id [lindex $Info(arguments) 4]
set extend [lindex $Info(arguments) 5]
ListBox::selectBoundary $bndr_id $bd1_id $lr1_id $bd2_id $lr2_id $extend
}
proc Interface::setBoundarySelectionMode {} {
global Info BoundaryDisplay VertexDisplay
set bndr_id [lindex $Info(arguments) 0]
set mode [lindex $Info(arguments) 1]
set do_upd [lindex $Info(arguments) 2]
Object::setBoundarySelectionMode $bndr_id $mode
set tp [Object::getType $bndr_id]
if { ($tp == "F" || $tp == "FG" || $tp == "E" || $tp == "EG") &&
[winfo exist $BoundaryDisplay(winName)]
} {
BoundaryDisplay::setSelectionMode $bndr_id $mode $do_upd
} elseif { ($tp == "V" || $tp == "VG") &&
[winfo exist $VertexDisplay(winName)]
} {
VertexDisplay::setSelectionMode $bndr_id $mode $do_upd
}
}
proc Interface::selectBoundary2 {} {
global Info
#MSG "SelectElements received: $Info(arguments)"
}
proc Interface::selectBoundaries {} {
global Info
#MSG "SelectBoundaries received: $Info(arguments)"
}
proc Interface::markSelectedBoundaries {} {
ListBox::markSelectedBoundaries
}
proc Interface::rendererReset {} {
MenuExec::rendererReset
}
proc Interface::setCurrentTimestamp {} {
Util::setCurrentTimestamp
}
proc Interface::setCurrentMeshH {} {
global Info Model
set mesh_h $Info(arguments)
set index $Model(curentMeshIndex)
set $Model(meshHs) [lreplace $Model(meshHs) $index $index $mesh_h]
}
proc Interface::setCurrentMeshF {} {
global Info Model
set mesh_f $Info(arguments)
set index $Model(curentMeshIndex)
set $Model(meshFs) [lreplace $Model(meshFs) $index $index $mesh_f]
}
proc Interface::setInitialMeshH {} {
global Info MeshDefine
set MeshDefine(MESH_H,default) $Info(arguments)
set MeshDefine(MESH_F,default) 1.0
}
proc Interface::setInitialState {} {
# Init timestep data
Panel::initFields Timestep
Timestep::applyTimestepType
}
# EMF_FILE name is set to be the same as
# inModelFile (when it is checked in cpp-environment)
#
proc Interface::setModelFilePath {} {
global Model
if {$Model(inModelFile) != ""} {
# By default in/out names the same (of course :-)
set Model(EMF_PATH_IN) $Model(inModelFile)
# Check that model file name extension is .emf
set mfn [file root $Model(inModelFile)]
append mfn ".emf"
set Model(EMF_PATH) $mfn
set Model(EMF_FILE) [file tail $Model(EMF_PATH)]
}
}
# Activated form cpp if change in Emissivity
# boundary condition has been noticed
# NOT called currently MVe 05.11.97
#
proc Interface::setParameterFieldValueState {} {
global Info Model
set arg_list [split $Info(arguments) $Info(argSeparator)]
set parameter_id [lindex $arg_list 0]
set field_name [lindex $arg_list 1]
set has_value [lindex $arg_list 2]
set value_is_changed [lindex $arg_list 3]
if { $field_name == "EMISSIVITY" } {
set Model(Emissivity,hasValue) \
[$Model(Emissivity,hasValue) || $has_value]
set Model(Emissivity,valueHasChanged) \
[$Model(Emissivity,valueHasChanged) || $value_has_changed]
if { $Model(Emissivity,valueHasChanged) } {
set Model(GebhardtFactors,needsUpdate,data)
}
}
#print "Gui: Emissivity has changed"
}
proc Interface::setRotatePriority {} {
global Info
set axis $Info(arguments)
MenuExec::setRotatePriority $axis
}
# Set body force field in the status area
proc Interface::setStatusBodyForces {} {
global Model Status
set fld "bodyForces"
set count $Model(nofBodiesWithBodyForce)
if { $Status(useAbsoluteBase) } {
set base $Model(nofBodies)
} else {
set base $Model(nofBodiesWithEquation)
}
if { $count == 0} {
set st "None"
} else {
set st "$count / $base"
}
set Status($fld) $st
Widget::configure1 $Status($fld,entryWidget) -fg "Black"
}
# Set inner boundary condtion field in the status area
proc Interface::setStatusInnerBoundaryConditions {} {
global Info Model ObjectTable Status
set fld "innerBoundaryConditions"
set count $Model(nofInnerBoundariesWithCondition)
set missing_param 0
set ib_count 0
if { $Model(GEOMETRY_DIMENSION) =="3D" } {
set btp "F"
} else {
set btp "E"
}
foreach id $ObjectTable(ids) {
if { $ObjectTable($id,tp) != $btp } {
continue
}
set pr_id $ObjectTable($id,prId)
# An inner boundary
if { $ObjectTable($pr_id,tp) == "BP" } {
set bd1_id $ObjectTable($pr_id,pr1Id)
set bd2_id $ObjectTable($pr_id,pr2Id)
# If both bodies have an equation but the boundary
# does not have a condition
if { $ObjectTable($bd1_id,eq) != $Info(NO_INDEX) &&
$ObjectTable($bd2_id,eq) != $Info(NO_INDEX)
} {
incr ib_count
if { $ObjectTable($id,bc) == $Info(NO_INDEX) } {
set missing_param 1
}
}
}
}
if { $Status(useAbsoluteBase) } {
set base $Model(nofInnerBoundaries)
} else {
set base $ib_count
}
if { $count == 0} {
set st "None"
} else {
set st "$count / $base"
}
set Status($fld) $st
# NOTE: We do not mark missing parameter definitons
# for inner boundaries, it is a bit hard to know
# when it really is missing!
Widget::configure1 $Status($fld,entryWidget) -fg "Black"
}
# Set outer boundary condtion field in the status area
#
proc Interface::setStatusOuterBoundaryConditions {} {
global Info Model ObjectTable Status
set fld "outerBoundaryConditions"
set count $Model(nofOuterBoundariesWithCondition)
set missing_param 0
set ob_count 0
if { $Model(GEOMETRY_DIMENSION) =="3D" } {
set btp "F"
} else {
set btp "E"
}
foreach id $ObjectTable(ids) {
if { $ObjectTable($id,tp) != $btp } {
continue
}
set pr_id $ObjectTable($id,prId)
# An outer boundary
if { $ObjectTable($pr_id,tp) == "B" } {
# If the body has an equation but boundary
# does not have a condition
#
if { $ObjectTable($pr_id,eq) != $Info(NO_INDEX) } {
incr ob_count
if { $ObjectTable($id,bc) == $Info(NO_INDEX) } {
set missing_param 1
}
}
}
}
if { $Status(useAbsoluteBase) } {
set base $Model(nofOuterBoundaries)
} else {
set base $ob_count
}
if { $count == 0} {
set st "None"
} else {
set st "$count / $base"
}
set Status($fld) $st
if {$missing_param} {
Widget::configure1 $Status($fld,entryWidget) -fg "Red"
} else {
Widget::configure1 $Status($fld,entryWidget) -fg "Black"
}
}
# Set equation field in the status area
#
proc Interface::setStatusEquations {} {
global Equation Info Model Status
set pmask $Equation(problemMask)
set fld "equations"
set count $Model(nofBodiesWithEquation)
set base $Model(nofBodies)
#-No equations attached
if { $count == 0 } {
set st "None"
#-Equations attached
} else {
set st "$count / $base"
append st " "
foreach ename $Equation(allFields) {
if { ![Equation::isEquation $ename] } {
continue
}
set emask [DataField::getFieldProperty Equation $ename EquationMask]
if { [Util::patternMatchesString $emask $pmask 0] } {
set sl_nm [DataField::getFieldProperty Equation $ename StatusLineName]
append st "$sl_nm "
}
}
}
set Status($fld) $st
if { $count <= 0 } {
Widget::configure1 $Status($fld,entryWidget) -fg "Red"
} else {
Widget::configure1 $Status($fld,entryWidget) -fg "Black"
}
}
# Set initialy condtion field in the status area
#
proc Interface::setStatusInitialConditions {} {
global Info Model ObjectTable Status Timestep
set fld initialConditions
set count $Model(nofBodiesWithInitialCondition)
set missing_param 0
foreach id $ObjectTable(ids) {
if { $ObjectTable($id,tp) != "B" } {
continue
}
if { $ObjectTable($id,eq) != $Info(NO_INDEX) &&
$ObjectTable($id,ic) == $Info(NO_INDEX)
} {
set missing_param 1
break
}
}
if { $Status(useAbsoluteBase) } {
set base $Model(nofBodies)
} else {
set base $Model(nofBodiesWithEquation)
}
if { $count == 0} {
set st "None"
} else {
set st "$count / $base"
}
set Status($fld) $st
if { $missing_param &&
$Timestep(SIMULATION_TYPE) != "Steady State"
} {
Widget::configure1 $Status($fld,entryWidget) -fg "Red"
} else {
Widget::configure1 $Status($fld,entryWidget) -fg "Black"
}
}
# Set material field in the status area
proc Interface::setStatusMaterials {} {
global Info Model ObjectTable Status
set fld "materials"
set count $Model(nofBodiesWithMaterial)
set missing_param 0
foreach id $ObjectTable(ids) {
if { $ObjectTable($id,tp) != "B" } {
continue
}
if { $ObjectTable($id,eq) != $Info(NO_INDEX) &&
$ObjectTable($id,mt) == $Info(NO_INDEX)
} {
set missing_param 1
break
}
}
if { $Status(useAbsoluteBase) } {
set base $Model(nofBodies)
} else {
set base $Model(nofBodiesWithEquation)
}
if { $count == 0} {
set st "None"
} else {
set st "$count / $base"
}
set Status($fld) $st
if {$missing_param} {
Widget::configure1 $Status($fld,entryWidget) -fg "Red"
} else {
Widget::configure1 $Status($fld,entryWidget) -fg "Black"
}
}
# Set nof active meshes field in the status area
#
proc Interface::setStatusMeshes {} {
global Model ModelFlags Status
set fld "meshes"
set nof_meshes [llength $Model(activeMeshNames)]
if { $nof_meshes == 0} {
set st "None"
} else {
set st $nof_meshes
}
set Status($fld) $st
if { $Model(nofBodiesWithEquation) > 0 &&
$ModelFlags(GEOMETRY_TYPE_CAD) && $nof_meshes == 0
} {
Widget::configure1 $Status($fld,entryWidget) -fg "Red"
} else {
Widget::configure1 $Status($fld,entryWidget) -fg "Black"
}
}
# Set timestep field in the status area
#
proc Interface::setStatusTimestamps {} {
global Model Status Timestep
set fld "timesteps"
if { $Model(nofTimesteps) == 0 } {
set Status($fld) "None"
} elseif { $Timestep(SIMULATION_TYPE) == "Steady State" } {
set Status($fld) "Max $Model(nofTimesteps)"
} else {
set Status($fld) $Model(nofTimesteps)
}
Widget::configure1 $Status($fld,entryWidget) -fg "Black"
}
# Receive command to display message in the
# main message window
#
proc Interface::showMessage {} {
global Info __GUIServerPort
set sep $Info(argSeparator)
set data [split $Info(arguments) $sep]
set msg [lindex $data 0]
# Try to unfold the if it happens to be a list
# NOTE: Character like "\{\[" could induce an error
# when applying the join-command, so we use catch!
#
if { [catch { set message [join $msg] } ] } {
set message $msg
}
set message [string trim $message]
set nof_line_feeds [lindex $data 1]
set append [lindex $data 2]
# Try to give some time for gui if we are
# in a lengthy process!
Util::updateGui
Util::updateGui 0
# Color for error/warning/note lines!
if { 0 == [string compare -nocase -length 6 "***ERR" $message] } {
set color $Info(errMsgColor)
} elseif { 0 == [string compare -nocase -length 13 "***MATC ERROR" $message] } {
set color $Info(errMsgColor)
} elseif { 0 == [string compare -nocase -length 10 "MATC ERROR" $message] } {
set color $Info(errMsgColor)
} elseif { 0 == [string compare -nocase -length 7 "***WARN" $message] } {
set color $Info(wrnMsgColor)
} elseif { 0 == [string compare -nocase -length 3 "***" $message] } {
set color $Info(remMsgColor)
} else {
set color ""
}
Message::showMessage $message $color $nof_line_feeds $append
}
proc Interface::variableNameGuiToSif {} {
global Info
set gui_name $Info(arguments)
set Info(results) [DataField::variableNameGuiToSif $gui_name]
}
proc Interface::variableNameSifToGui {} {
global Info
set sif_name $Info(arguments)
set Info(results) [DataField::variableNameSifToGui $sif_name]
}
# ================================
# ================================
# CONVERSION OF OLDER VERSION DATA
# ================================
# ================================
# ============
# Pre Converse
# ============
# Possible pre converse of older version data
#
proc Interface::preConverseInputData {globArray} {
global Info
upvar #0 $globArray theArray
set theArray(doConversion) 0
if { $Info(FRONT_INPUT_VERSION_NBR) < 0 } {
return
}
Interface::preConverseInputDataTo6 $globArray
Interface::preConverseInputDataTo7 $globArray
Interface::preConverseInputDataTo9 $globArray
}
# Pre-converse to version 6
#
proc Interface::preConverseInputDataTo6 {globArray} {
global Info Common
upvar #0 $globArray theArray
if { $Info(FRONT_INPUT_VERSION_NBR) >= 6 } {
return
}
# Only Equation data needs pre conversion
# =======================================
if { $globArray != $Common(panelArray,EQ) } {
return
}
global Equation
set modified 0
foreach pid $Equation(ids) {
# Converse DIFFUSION_VARIABLES --> AD_VAR
#
set data1 $Equation($pid,data)
set data2 [string map {">DIFFUSION_VARIABLES=" ">AD_VAR="} $data1]
set Equation($pid,data) $data2
if { $data1 != $data2 } {
set modified 1
Message::showMessage "Equation parameter $pid modified!"
}
}
if { $modified } {
set theArray(doConversion) 1
set Info(doConversion) 1
}
}
# Pre-converse to version 7
#
proc Interface::preConverseInputDataTo7 {globArray} {
global Info Common
upvar #0 $globArray theArray
if { $Info(FRONT_INPUT_VERSION_NBR) >= 7 } {
return
}
# Only BoundaryCondition,Equation and Solver data needs pre conversion
# ==================================================
if { $globArray != $Common(panelArray,BC) &&
$globArray != $Common(panelArray,EQ) &&
$globArray != $Common(panelArray,SL)
} {
return
}
if { $globArray == $Common(panelArray,BC) } {
global BoundaryCondition
set modified 0
foreach pid $BoundaryCondition(ids) {
# Converse NORMAL_TANGENTIAL_DISPLACEMENT --> NORMAL-TANGENTIAL_DISPLACEMENT
# Converse NORMAL_TANGENTIAL_VELOCITY --> NORMAL-TANGENTIAL_VELOCITY
#
set data1 $BoundaryCondition($pid,data)
set data2 [string map {"NORMAL_TANGENTIAL_DISPLACEMENT=" "NORMAL-TANGENTIAL_DISPLACEMENT="} $data1]
set data2 [string map {"NORMAL_TANGENTIAL_VELOCITY=" "NORMAL-TANGENTIAL_VELOCITY="} $data2]
set BoundaryCondition($pid,data) $data2
if { $data1 != $data2 } {
set modified 1
Message::showMessage "Boundary Condition parameter $pid modified!"
}
}
}
if { $globArray == "Equation" } {
global Equation
set modified 0
foreach pid $Equation(ids) {
# Converse NAVIER_STOKES --> NAVIER-STOKES
# Converse AD_VARS --> ADVECTION_DIFFUSION_EQUATION_vars
#
set data1 $Equation($pid,data)
set data2 [string map {"NAVIER_STOKES=" "NAVIER-STOKES="} $data1]
set data2 [string map {"AD_VARS=" "ADVECTION_DIFFUSION_EQUATION_vars="} $data2]
set Equation($pid,data) $data2
if { $data1 != $data2 } {
set modified 1
Message::showMessage "Equation parameter $pid modified!"
}
}
}
if { $globArray == $Common(panelArray,SL) } {
global Solver
set modified 0
foreach pid $Solver(ids) {
# Converse field name EQUATION_NAME --> EQUATION
# Converse field name SOLVER_MESH --> MESH
# Converse field value KE_Turbulence --> KE Turbulence (in EQUATION_NAME)
# Converse field value Heat_Equation --> Heat Equation (in EQUATION_NAME)
# Converse field value Stress_Analysis --> Stress Analysis (in EQUATION_NAME)
# Converse field value Advection_Diffusion_Equation --> Advection Diffusion Equation (in EQUATION_NAME)
#
set data1 $Solver($pid,data)
set data2 [string map {"EQUATION_NAME=" "EQUATION="} $data1]
set data2 [string map {"SOLVER_MESH=" "MESH="} $data2]
set data2 [string map {"KE_Turbulence" "KE Turbulence"} $data2]
set data2 [string map {"Heat_Equation" "Heat Equation"} $data2]
set data2 [string map {"Stress_Analysis" "Stress Analysis"} $data2]
set data2 [string map {"Advection_Diffusion_Equation" "Advection Diffusion Equation"} $data2]
set Solver($pid,data) $data2
if { $data1 != $data2 } {
set modified 1
Message::showMessage "Solver parameter $pid modified!"
}
}
}
if { $modified } {
set theArray(doConversion) 1
set Info(doConversion) 1
}
}
# Pre-converse to version 9
#
proc Interface::preConverseInputDataTo9 {globArray} {
global Info Common
upvar #0 $globArray theArray
if { $Info(FRONT_INPUT_VERSION_NBR) >= 9 } {
return
}
# Only Solver data needs pre conversion
# ==================================================
if { $globArray != $Common(panelArray,SL) } {
return
}
global Solver
set modified 0
foreach pid $Solver(ids) {
# Converse field name MULTIGRID_LEVELS --> MG_LEVELS
#
set data1 $Solver($pid,data)
set data2 [string map {"MULTIGRID_LEVELS=" "MG_LEVELS="} $data1]
set Solver($pid,data) $data2
if { $data1 != $data2 } {
set modified 1
Message::showMessage "Solver parameter $pid modified!"
}
}
if { $modified } {
set theArray(doConversion) 1
set Info(doConversion) 1
}
}
# =============
# Post Converse
# =============
# Possible post converse of older version data
#
proc Interface::postConverseInputData {globArray} {
global Info
upvar #0 $globArray theArray
if { $Info(FRONT_INPUT_VERSION_NBR) < 0 } {
return
}
if { !$theArray(doConversion) } {
return
}
Interface::postConverseInputDataTo7 $globArray
}
# Post-converse to version 7
#
proc Interface::postConverseInputDataTo7 {globArray} {
global Info Common
upvar #0 $globArray theArray
if { $Info(FRONT_INPUT_VERSION_NBR) >= 7 } {
return
}
# Only Equation data needs post conversion
# ========================================
if { $globArray != $Common(panelArray,EQ) } {
return
}
global Equation
foreach pid $Equation(ids) {
Panel::resetFields Equation
StdPanelInit::initFieldValues Equation
# Create the updated equation paramter line
# -----------------------------------------
DataField::formDataFields Equation $Equation($pid,data)
Equation(NAVIER-STOKES,fillProc)
Equation(HEAT_EQUATION,fillProc)
Equation(STRESS_ANALYSIS,fillProc)
Equation(ADVECTION_DIFFUSION_EQUATION,fillProc)
set Equation($pid,data) [DataField::formParameterLine Equation]
#Panel::unsetFields $arr
Panel::unsetAllFieldData $globArray
}
# Store updated data into model (Note: this does not save the model file, the user
# has to save it actively!)
#
Util::cpp_exec readConvertedEquationData
}
# end ecif_tk_procsInterface.tcl
# ******************************
|