Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ If you need the developer version, you are on the right place.
* You don't need to install python. The program will detect if you have any pending package to install.
* If there's any missing package, use the GiD command line and execute:

`-np- W [GiD_Python_PipInstall [list $Kratos::pip_packages_required ] 1 ]`
`-np- W [GiD_Python_PipInstall [list $::Kratos::pip_packages_required ] 1 ]`
* 4.1- To execute Kratos using the standard pip packages:
* Python version recommended: 3.8, 3.9, 3.10, 3.11, 3.12
* Open a terminal and run
Expand Down
2 changes: 1 addition & 1 deletion kratos.gid/apps/DEM/xml/XmlController.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ proc ::DEM::xml::CustomTree { args } {
spdAux::SetValueOnTreeItem state hidden DEMTimeParameters StartTime

# 3D gravity
if {$Model::SpatialDimension eq "3D"} {
if {$::Model::SpatialDimension eq "3D"} {
catch {
spdAux::SetValueOnTreeItem v 0.0 DEMGravity Cy
spdAux::SetValueOnTreeItem v -1.0 DEMGravity Cz
Expand Down
4 changes: 2 additions & 2 deletions kratos.gid/apps/Dam/write/write.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ proc ::Dam::write::writeTables_dev { } {
proc ::Dam::write::GetPrinTables {} {

set root [customlib::GetBaseRoot]
if {$Kratos::kratos_private(UseFiles) eq 1} {FileSelector::CopyFilesIntoModel [file join [GiD_Info project ModelName] ".gid"]}
if {$::Kratos::kratos_private(UseFiles) eq 1} {FileSelector::CopyFilesIntoModel [file join [GiD_Info project ModelName] ".gid"]}
set tableid_list [list ]
set files_list [list ]
set num 0
Expand Down Expand Up @@ -301,7 +301,7 @@ proc ::Dam::write::GetPrinTables {} {
proc ::Dam::write::GetPrinTables_dev { } {

set root [customlib::GetBaseRoot]
if {$Kratos::kratos_private(UseFiles) eq 1} {FileSelector::CopyFilesIntoModel [file join [GiD_Info project ModelName] ".gid"]}
if {$::Kratos::kratos_private(UseFiles) eq 1} {FileSelector::CopyFilesIntoModel [file join [GiD_Info project ModelName] ".gid"]}
set tableid_list2 [list ]
set files_list2 [list ]
set num [llength [GetPrinTables]]
Expand Down
4 changes: 2 additions & 2 deletions kratos.gid/apps/EmbeddedFluid/write/write.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ proc EmbeddedFluid::write::writeDistances { } {
set length [objarray length $nodes_list]
if {$length eq "0"} {W "Warning: No distances detected! Check Preferences > Meshing > General > Mesh type > Embedded"}
write::WriteString "Begin NodalData DISTANCE"
incr write::current_mdpa_indent_level
incr ::write::current_mdpa_indent_level
set s [write::mdpaIndent]
for {set i 0} {$i < $length} {incr i } {
set node_id [objarray get $nodes_list $i]
set distance [objarray get $distances_list $i]
write::WriteString "$s$node_id 0 $distance"
}
incr write::current_mdpa_indent_level -1
incr ::write::current_mdpa_indent_level -1
write::WriteString "End NodalData"
}
}
Expand Down
2 changes: 1 addition & 1 deletion kratos.gid/apps/GeoMechanics/xml/XmlController.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ proc ::GeoMechanics::xml::ProcCheckNodalConditionStateGeoMechanics {domNode args
set condition [Model::getNodalConditionbyId $conditionId]
set cnd_dim [$condition getAttribute WorkingSpaceDimension]
if {$cnd_dim ne ""} {
if {$cnd_dim ne $Model::SpatialDimension} {return "hidden"}
if {$cnd_dim ne $::Model::SpatialDimension} {return "hidden"}
}
set elems [$domNode selectNodes "[spdAux::getRoute $parts_un]/condition/group/value\[@n='Element'\]"]
set elemnames [list ]
Expand Down
2 changes: 1 addition & 1 deletion kratos.gid/apps/PfemFluid/start.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ proc ::PfemFluid::Init { app } {
proc ::PfemFluid::CustomToolbarItems { } {
variable dir
# Reset the left toolbar
set Kratos::kratos_private(MenuItems) [dict create]
set ::Kratos::kratos_private(MenuItems) [dict create]
set img_dir [file join $dir images]
if {[gid_themes::GetCurrentTheme] eq "GiD_black"} {
set img_dir [file join $img_dir Black]
Expand Down
2 changes: 1 addition & 1 deletion kratos.gid/apps/PfemFluid/xml/XmlController.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ proc PfemFluid::xml::CustomTree { args } {
# spdAux::SetValueOnTreeItem icon select Restart RestartOptions

# 3D gravity
if {$Model::SpatialDimension eq "3D"} {
if {$::Model::SpatialDimension eq "3D"} {
catch {
spdAux::SetValueOnTreeItem v -9.81 PFEMFLUID_Gravity Cy
spdAux::SetValueOnTreeItem v 0.0 PFEMFLUID_Gravity Cz
Expand Down
4 changes: 2 additions & 2 deletions kratos.gid/apps/PfemThermic/start.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ proc ::PfemThermic::Init { app } {
proc ::PfemThermic::CustomToolbarItems { } {
variable dir
# Reset the left toolbar
set Kratos::kratos_private(MenuItems) [dict create]
set ::Kratos::kratos_private(MenuItems) [dict create]
set img_dir [file join $dir images]
if {[gid_themes::GetCurrentTheme] eq "GiD_black"} {
set img_dir [file join $img_dir Black]
Expand All @@ -36,7 +36,7 @@ proc ::PfemThermic::CustomToolbarItems { } {
Kratos::ToolbarAddItem "Stop" [file join $img_dir "cancelProcess.png"] {Utilities CancelProcess} [= "Cancel process"]
Kratos::ToolbarAddItem "Examples" "losta.png" [list -np- ::Examples::StartWindow [apps::getActiveAppId]] [= "Examples window"]
Kratos::ToolbarAddItem "SpacerApp1" "" "" ""
if {[info exists Kratos::kratos_private(UseFiles)] && $Kratos::kratos_private(UseFiles) == 1} {
if {[info exists ::Kratos::kratos_private(UseFiles)] && $::Kratos::kratos_private(UseFiles) == 1} {
Kratos::ToolbarAddItem "Files" "files.png" [list -np- spdAux::LaunchFileWindow] [= "File handler window"]
}
}
2 changes: 1 addition & 1 deletion kratos.gid/apps/PfemThermic/write/write.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ proc PfemThermic::write::getPropertiesList {parts_un {write_claw_name "True"} {m
set mat_dict [write::getMatDict]
set props_dict [dict create]
set props [list]
set doc $gid_groups_conds::doc
set doc $::gid_groups_conds::doc
set root [$doc documentElement]

set xp1 "[spdAux::getRoute $parts_un]/group"
Expand Down
2 changes: 1 addition & 1 deletion kratos.gid/apps/PfemThermic/xml/XmlController.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ proc PfemThermic::xml::CustomTree { args } {
set inlet_result_node [[$root parent] selectNodes "[spdAux::getRoute NodalResults]/value\[@n = 'INLET'\]"]
if { $inlet_result_node ne "" } { $inlet_result_node delete }

if {$Model::SpatialDimension eq "3D"} {
if {$::Model::SpatialDimension eq "3D"} {
catch {
spdAux::SetValueOnTreeItem v -9.81 PFEMFLUID_Gravity Cy
spdAux::SetValueOnTreeItem v 0.0 PFEMFLUID_Gravity Cz } }
Expand Down
2 changes: 1 addition & 1 deletion kratos.gid/apps/Structural/xml/XmlController.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ proc ::Structural::xml::ProcCheckNodalConditionStateStructural {domNode args} {
set condition [Model::getNodalConditionbyId $conditionId]
set cnd_dim [$condition getAttribute WorkingSpaceDimension]
if {$cnd_dim ne ""} {
if {$cnd_dim ne $Model::SpatialDimension} {return "hidden"}
if {$cnd_dim ne $::Model::SpatialDimension} {return "hidden"}
}
set parts_xpath [spdAux::getRoute $parts_un $domNode]
set elems [$domNode selectNodes "$parts_xpath/condition/group/value\[@n='Element'\]"]
Expand Down
28 changes: 14 additions & 14 deletions kratos.gid/kratos.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ proc Kratos::InitGlobalVariables {dir} {
# Version of the kratos executable
set kratos_private(exec_version) "dev"
# Allow logs -> 0 No | 1 Only local | 2 Share with dev team
set Kratos::kratos_private(allow_logs) 1
set ::Kratos::kratos_private(allow_logs) 1
# git hash of the problemtype
set Kratos::kratos_private(problemtype_git_hash) 0
set ::Kratos::kratos_private(problemtype_git_hash) 0
# Place were the logs will be placed
set Kratos::kratos_private(model_log_folder) ""
set ::Kratos::kratos_private(model_log_folder) ""
# Check exec/launch.json
set Kratos::kratos_private(configurations) [list ]
set Kratos::kratos_private(launch_configuration) ""
set ::Kratos::kratos_private(configurations) [list ]
set ::Kratos::kratos_private(launch_configuration) ""

# Variable to store the Kratos menu items
set kratos_private(MenuItems) [dict create]
Expand Down Expand Up @@ -228,7 +228,7 @@ proc Kratos::LoadModelSPD { filespd } {
update

# Dont open the init window. Saved models have already app and dimension
set spdAux::must_open_init_window 0
set ::spdAux::must_open_init_window 0

# Need this check for old gid compatibility. Sometimes this event was called by mistake.
Kratos::CheckProjectIsNew $filespd
Expand Down Expand Up @@ -483,8 +483,8 @@ proc Kratos::Event_InitGIDPostProcess {} {

proc Kratos::BeforeInitGIDPostProcess {} {
# In docker run, rename lst file
if {[info exists Kratos::kratos_private(launch_configuration)]} {
set launch_mode $Kratos::kratos_private(launch_configuration)
if {[info exists ::Kratos::kratos_private(launch_configuration)]} {
set launch_mode $::Kratos::kratos_private(launch_configuration)
if {$launch_mode eq "Docker"} {
set list_file [file join [GidUtils::GetDirectoryModel] model.post.lst]
if {[file exists $list_file]} {
Expand Down Expand Up @@ -528,8 +528,8 @@ proc Kratos::Event_BeforeRunCalculation { batfilename basename dir problemtypedi

proc Kratos::Event_SelectGIDBatFile { dir basename } {
set result ""
if {[info exists Kratos::kratos_private(launch_configuration)]} {
set launch_mode $Kratos::kratos_private(launch_configuration)
if {[info exists ::Kratos::kratos_private(launch_configuration)]} {
set launch_mode $::Kratos::kratos_private(launch_configuration)
::GidUtils::SetWarnLine "Launch mode: $launch_mode"
catch {set result [Kratos::ExecuteLaunchByMode $launch_mode]} error_msg
}
Expand All @@ -538,7 +538,7 @@ proc Kratos::Event_SelectGIDBatFile { dir basename } {

proc Kratos::Event_AfterWriteCalculationFile { filename errorflag } {
# Only write if required
if {$Kratos::must_write_calc_data} {
if {$::Kratos::must_write_calc_data} {
set errcode [Kratos::WriteCalculationFilesEvent $filename]
if {$errcode} {return "-cancel-"}
}
Expand All @@ -558,7 +558,7 @@ proc Kratos::WriteCalculationFilesEvent { {filename ""} } {
}
}
# The calculation process may need the files of the file selector entries inside the model folder
if {$Kratos::kratos_private(UseFiles) eq 1} {FileSelector::CopyFilesIntoModel [file dirname $filename]}
if {$::Kratos::kratos_private(UseFiles) eq 1} {FileSelector::CopyFilesIntoModel [file dirname $filename]}

# Start the write configuration clean
write::Init
Expand Down Expand Up @@ -597,13 +597,13 @@ proc Kratos::Event_SaveModelSPD { filespd } {
Kratos::RegisterEnvironment

# User files (in file selectors) copied into the model (if required)
if {$Kratos::kratos_private(UseFiles) eq 1} {FileSelector::CopyFilesIntoModel [file dirname $filespd]}
if {$::Kratos::kratos_private(UseFiles) eq 1} {FileSelector::CopyFilesIntoModel [file dirname $filespd]}

# Let the current app implement it's Save event
apps::ExecuteOnCurrentApp AfterSaveModel $filespd

# Log it
set Kratos::kratos_private(model_log_folder) [file join [GiD_Info Project ModelName].gid Logs]
set ::Kratos::kratos_private(model_log_folder) [file join [GiD_Info Project ModelName].gid Logs]
Kratos::Log "Save model [file tail $filespd ]"

}
Expand Down
8 changes: 4 additions & 4 deletions kratos.gid/scripts/Applications.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -388,16 +388,16 @@ proc apps::ActivateApp_do {app} {

# If theme is dark, set the Black images dir before the normal one, so images for dark theme are loaded first
if {[gid_themes::GetCurrentTheme] eq "GiD_black"} {
set gid_groups_conds::imagesdirList [lsearch -all -inline -not -exact $gid_groups_conds::imagesdirList [list [file join $dir images]]]
set ::gid_groups_conds::imagesdirList [lsearch -all -inline -not -exact $::gid_groups_conds::imagesdirList [list [file join $dir images]]]
gid_groups_conds::add_images_dir [file join $dir images Black]
}
gid_groups_conds::add_images_dir [file join $dir images]
}

proc apps::ApplyAppPreferences {app} {
if {[write::isBooleanTrue [$app getPermission stages]]} {set spdAux::UseStages 1} {set spdAux::UseStages 0}
if {[write::isBooleanTrue [$app getPermission open_tree]]} {set spdAux::TreeVisibility 1} {set spdAux::TreeVisibility 0}
if {[write::isBooleanTrue [$app getPermission show_toolbar]]} {set spdAux::ToolbarVisibility 1} {set spdAux::ToolbarVisibility 0}
if {[write::isBooleanTrue [$app getPermission stages]]} {set ::spdAux::UseStages 1} {set ::spdAux::UseStages 0}
if {[write::isBooleanTrue [$app getPermission open_tree]]} {set ::spdAux::TreeVisibility 1} {set ::spdAux::TreeVisibility 0}
if {[write::isBooleanTrue [$app getPermission show_toolbar]]} {set ::spdAux::ToolbarVisibility 1} {set ::spdAux::ToolbarVisibility 0}
if {[$app getProperty dimensions] ne ""} { set ::Model::ValidSpatialDimensions [$app getProperty dimensions] }
}

Expand Down
6 changes: 3 additions & 3 deletions kratos.gid/scripts/Controllers/ApplicationMarketWindow.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ proc spdAux::CreateInitialApplicationsWindow {} {

# Information panel
ttk::labelframe $w.info -text " Information " -relief ridge
ttk::label $w.info.text -textvariable spdAux::info_main_window_text
ttk::label $w.info.text -textvariable ::spdAux::info_main_window_text
grid $w.info.text

# Settings
Expand Down Expand Up @@ -161,9 +161,9 @@ proc spdAux::CreateLauncherWindow { current_launcher available_apps {window_text
grid $w.applications

# Information panel
set spdAux::info_main_window_text ""
set ::spdAux::info_main_window_text ""
ttk::labelframe $w.info -text " Information " -relief ridge
ttk::label $w.info.text -textvariable spdAux::info_main_window_text
ttk::label $w.info.text -textvariable ::spdAux::info_main_window_text
grid $w.info.text
grid $w.info -sticky we
}
Expand Down
4 changes: 2 additions & 2 deletions kratos.gid/scripts/Controllers/ExamplesWindow.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ proc Examples::StartWindow { {filter ""} } {
AddToScrolledCanvas $examples_window.center $fcenter
grid $examples_window.center -row 0 -column 0 -sticky nsew

set Examples::filter_entry $filter
set ::Examples::filter_entry $filter
set filter_txt [ttk::label $fcenter.filter_text -text [_ "Search an example:"]]
set filter_ent [ttk::entry $fcenter.filter_entry -textvariable Examples::filter_entry]
set filter_btn [ttk::button $fcenter.filter_button -text "Filter" -command [list Examples::PrintGroups]]
Expand Down Expand Up @@ -220,7 +220,7 @@ proc Examples::LaunchExample {example_app example_dim example_cmd} {
Kratos::ResetModel
Model::DestroyEverything
set ::problemtype_current(CustomLibAutomatic) 1
gid_common_problemtype_init_customlib_automatic $Kratos::kratos_private(Path)
gid_common_problemtype_init_customlib_automatic $::Kratos::kratos_private(Path)
set ::problemtype_current(CustomLibAutomatic) 0
spdAux::SetSpatialDimmension $example_dim
apps::setActiveApp $example_app
Expand Down
12 changes: 6 additions & 6 deletions kratos.gid/scripts/Launch.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ proc Kratos::InstallAllPythonDependencies { } {
if {[llength $missing_packages] > 0} {
exec $pip -m pip install --no-cache-dir --disable-pip-version-check {*}$missing_packages
}
exec $pip -m pip install --upgrade --no-cache-dir --disable-pip-version-check {*}$Kratos::pip_packages_required
exec $pip -m pip install --upgrade --no-cache-dir --disable-pip-version-check {*}$::Kratos::pip_packages_required
::GidUtils::SetWarnLine "Packages updated"
}

Expand Down Expand Up @@ -168,14 +168,14 @@ proc Kratos::ShowErrorsAndActions {errs} {
set py [Kratos::GetPythonExeName]
set python_exe_path [Kratos::ManagePreferences GetValue python_path]
W "Run the following command on a terminal (note: On Windows systems, use cmd, not PowerShell):"
W "$python_exe_path -m pip install --upgrade --force-reinstall --no-cache-dir $Kratos::pip_packages_required"
W "$python_exe_path -m pip install --upgrade --force-reinstall --no-cache-dir $::Kratos::pip_packages_required"
}
"MISSING_PIP_PACKAGES_GiDS_PYTHON" {
W "Kratos package was not found on your system."
set py [Kratos::GetPythonExeName]
set python_exe_path [Kratos::ManagePreferences GetValue python_path]
W "Run the following command on the GiD Command line:"
W "-np- W \[GiD_Python_PipInstall \[list $Kratos::pip_packages_required \] 1 \]"
W "-np- W \[GiD_Python_PipInstall \[list $::Kratos::pip_packages_required \] 1 \]"
}
"DOCKER_NOT_FOUND" {
W "Could not start docker. Please check if the Docker service is enabled."
Expand Down Expand Up @@ -265,15 +265,15 @@ proc Kratos::LoadConfigurationFile {config_file} {
}

proc Kratos::SetDefaultLaunchMode { } {
set curr_mode $Kratos::kratos_private(launch_configuration)
set curr_mode $::Kratos::kratos_private(launch_configuration)
set modes [list ]
set first ""
foreach mode $::Kratos::kratos_private(configurations) {
set mode_name [dict get $mode name]
lappend modes $mode_name
if {$first eq ""} {set first $mode_name}
}
if {$curr_mode ni $modes} {set Kratos::kratos_private(launch_configuration) $first}
if {$curr_mode ni $modes} {set ::Kratos::kratos_private(launch_configuration) $first}
}

proc Kratos::ExecuteLaunchByMode {launch_mode} {
Expand Down Expand Up @@ -313,7 +313,7 @@ proc Kratos::ExecuteLaunchByMode {launch_mode} {

proc Kratos::GetLaunchMode { {launch_mode "current"} } {
set curr_mode ""
if {$launch_mode eq "current"} {set launch_mode $Kratos::kratos_private(launch_configuration)}
if {$launch_mode eq "current"} {set launch_mode $::Kratos::kratos_private(launch_configuration)}
foreach mode $::Kratos::kratos_private(configurations) {
set mode_name [dict get $mode name]
if {$mode_name eq $launch_mode} {
Expand Down
Loading