)
- if {[GetAttribute writeCoordinatesByGroups]} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates}
-
- # Element connectivities (groups in FLParts)
- write::writeElementConnectivities
-
- # Nodal conditions and conditions
- Fluid::write::writeConditions
-
- # SubmodelParts
- Fluid::write::writeMeshes
+ Fluid::write::writeModelPartEvent
}
proc PotentialFluid::write::writeCustomFilesEvent { } {
# Write the fluid materials json file
- write::writePropertiesJsonFile [GetAttribute parts_un] [GetAttribute materials_file] False
-
- write::CopyFileIntoModel "python/KratosPotentialFluid.py"
- write::RenameFileInModel "KratosPotentialFluid.py" "MainKratos.py"
+ write::writePropertiesJsonFile [GetAttribute parts_un] [GetAttribute materials_file] False [GetAttribute model_part_name]
+ write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file]
}
-
proc PotentialFluid::write::GetAttribute {att} {
variable writeAttributes
return [dict get $writeAttributes $att]
diff --git a/kratos.gid/apps/PotentialFluid/xml/Materials.spd b/kratos.gid/apps/PotentialFluid/xml/Materials.spd
index 1b3e404c1..f351f7613 100644
--- a/kratos.gid/apps/PotentialFluid/xml/Materials.spd
+++ b/kratos.gid/apps/PotentialFluid/xml/Materials.spd
@@ -1,4 +1,4 @@
-
+
diff --git a/kratos.gid/apps/PotentialFluid/xml/Materials.xml b/kratos.gid/apps/PotentialFluid/xml/Materials.xml
index be3d18b3b..1b2f8262b 100644
--- a/kratos.gid/apps/PotentialFluid/xml/Materials.xml
+++ b/kratos.gid/apps/PotentialFluid/xml/Materials.xml
@@ -4,13 +4,13 @@
-
+
-
+
diff --git a/kratos.gid/apps/PotentialFluid/xml/Procs.spd b/kratos.gid/apps/PotentialFluid/xml/Procs.spd
index cf2089264..4f9570707 100644
--- a/kratos.gid/apps/PotentialFluid/xml/Procs.spd
+++ b/kratos.gid/apps/PotentialFluid/xml/Procs.spd
@@ -35,4 +35,9 @@
return $r
]]>
+
+
+
\ No newline at end of file
diff --git a/kratos.gid/apps/PotentialFluid/xml/XmlController.tcl b/kratos.gid/apps/PotentialFluid/xml/XmlController.tcl
index f0a8f2cf2..5a8cdc3a7 100644
--- a/kratos.gid/apps/PotentialFluid/xml/XmlController.tcl
+++ b/kratos.gid/apps/PotentialFluid/xml/XmlController.tcl
@@ -1,6 +1,8 @@
-namespace eval PotentialFluid::xml {
+namespace eval ::PotentialFluid::xml {
+ namespace path ::PotentialFluid
+ Kratos::AddNamespace [namespace current]
+
# Namespace variables declaration
- variable dir
variable lastImportMeshSize
variable export_dir
@@ -8,9 +10,8 @@ namespace eval PotentialFluid::xml {
proc PotentialFluid::xml::Init { } {
# Namespace variables inicialization
- variable dir
Model::DestroyEverything
- Model::InitVariables dir $PotentialFluid::dir
+ Model::InitVariables dir [apps::getMyDir "PotentialFluid"]
Model::getSolutionStrategies Strategies.xml
Model::getElements Elements.xml
@@ -28,12 +29,12 @@ proc PotentialFluid::xml::Init { } {
proc PotentialFluid::xml::MultiAppEvent {args} {
if {$args eq "init"} {
spdAux::parseRoutes
- spdAux::ConvertAllUniqueNames FL ${::PotentialFluid::prefix}
+ spdAux::ConvertAllUniqueNames [::Fluid::GetAttribute prefix] [::PotentialFluid::GetAttribute prefix]
}
}
proc PotentialFluid::xml::getUniqueName {name} {
- return ${::PotentialFluid::prefix}${name}
+ return [::PotentialFluid::GetAttribute prefix]${name}
}
proc PotentialFluid::xml::CustomTree { args } {
@@ -51,4 +52,3 @@ proc spdAux::injectConditions { basenode args} {
$basenode delete
}
-PotentialFluid::xml::Init
diff --git a/kratos.gid/apps/ShallowWater/app.json b/kratos.gid/apps/ShallowWater/app.json
new file mode 100644
index 000000000..72023b669
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/app.json
@@ -0,0 +1,46 @@
+{
+ "id": "ShallowWater",
+ "name": "Shallow water",
+ "prefix": "SW",
+ "themed": false,
+ "kratos_name": "ShallowWaterApplication",
+ "dimensions": [
+ "2D"
+ ],
+ "script_files": [
+ "start.tcl",
+ "xml/XmlController.tcl",
+ "write/write.tcl",
+ "write/writeProjectParameters.tcl",
+ "examples/examples.tcl",
+ "examples/DamBreak.tcl",
+ "examples/HydraulicJump.tcl"
+ ],
+ "start_script": "::ShallowWater::Init",
+ "requeriments":{
+ "apps":[],
+ "minimum_gid_version":"15.1.3d"
+ },
+ "permissions": {
+ "open_tree": true,
+ "show_toolbar": true,
+ "intervals": true,
+ "wizard": false
+ },
+ "unique_names": {
+ "parts": "SWParts",
+ "materials": "SWMaterials",
+ "topography_data": "SWTopographicData",
+ "initial_conditions": "SWInitialConditions",
+ "conditions": "SWConditions"
+ },
+ "write": {
+ "coordinates": "all",
+ "materials_file": "TopographyMaterials.json",
+ "properties_location": "json",
+ "model_part_name": "main_model_part",
+ "output_model_part_name": "main_model_part"
+ },
+ "main_launch_file": "../../exec/MainKratos.py",
+ "description": "Tools for the simulation of free surface flows under the shallow water assumptions."
+}
\ No newline at end of file
diff --git a/kratos.gid/apps/ShallowWater/examples/DamBreak.tcl b/kratos.gid/apps/ShallowWater/examples/DamBreak.tcl
new file mode 100644
index 000000000..eb495c050
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/examples/DamBreak.tcl
@@ -0,0 +1,157 @@
+namespace eval ::ShallowWater::examples::DamBreak {
+ namespace path ::ShallowWater::examples
+ Kratos::AddNamespace [namespace current]
+}
+
+proc ::ShallowWater::examples::DamBreak::Init {args} {
+ if {![Kratos::IsModelEmpty]} {
+ set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
+ set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
+ if { $retval == "cancel" } { return }
+ }
+ DrawGeometry
+ AssignGroups
+ TreeAssignation
+
+ GiD_Process 'Redraw
+ GidUtils::UpdateWindow GROUPS
+ GidUtils::UpdateWindow LAYER
+ GiD_Process 'Zoom Frame
+}
+
+proc ::ShallowWater::examples::DamBreak::DrawGeometry {args} {
+ Kratos::ResetModel
+ GiD_Layers create main_layer
+ GiD_Layers edit to_use main_layer
+
+ # Geometry creation
+ ## Points ##
+ set coordinates_left [list 0 0 0 5 0 0 5 1 0 0 1 0]
+ set geom_points_left [list ]
+ foreach {x y z} $coordinates_left {
+ lappend geom_points_left [GiD_Geometry create point append main_layer $x $y $z]
+ }
+
+ set coordinates_right [list 5 0 0 10 0 0 10 1 0 5 1 0]
+ set geom_points_right [list ]
+ foreach {x y z} $coordinates_right {
+ lappend geom_points_right [GiD_Geometry create point append main_layer $x $y $z]
+ }
+
+ ## Lines ##
+ set geom_lines_left [list ]
+ set initial [lindex $geom_points_left 0]
+ foreach point [lrange $geom_points_left 1 end] {
+ lappend geom_lines_left [GiD_Geometry create line append stline main_layer $initial $point]
+ set initial $point
+ }
+ lappend geom_lines_left [GiD_Geometry create line append stline main_layer $initial [lindex $geom_points_left 0]]
+
+ set geom_lines_right [list ]
+ set initial [lindex $geom_points_right 0]
+ foreach point [lrange $geom_points_right 1 end] {
+ lappend geom_lines_right [GiD_Geometry create line append stline main_layer $initial $point]
+ set initial $point
+ }
+ lappend geom_lines_right [GiD_Geometry create line append stline main_layer $initial [lindex $geom_points_right 0]]
+
+ ## Surface ##
+ GiD_Process Mescape Geometry Create NurbsSurface {*}$geom_lines_left escape escape
+ GiD_Process Mescape Geometry Create NurbsSurface {*}$geom_lines_right escape escape
+
+ ## Remove the duplicated line
+ GiD_Process Mescape Utilities Collapse model Yes
+}
+
+proc ::ShallowWater::examples::DamBreak::AssignGroups {args} {
+ # Create and assign the groups
+ GiD_Groups create Body
+ GiD_Groups edit color Body "#26d1a8ff"
+ GiD_EntitiesGroups assign Body surfaces {1 2}
+
+ GiD_Groups create Reservoir
+ GiD_Groups edit color Reservoir "#26d1a8ff"
+ GiD_EntitiesGroups assign Reservoir surfaces 1
+
+ GiD_Groups create Channel
+ GiD_Groups edit color Channel "#26d1a8ff"
+ GiD_EntitiesGroups assign Channel surfaces 2
+
+ GiD_Groups create Walls
+ GiD_Groups edit color Walls "#3b3b3bff"
+ GiD_EntitiesGroups assign Walls lines {1 3 5 7}
+
+ GiD_Groups create Left
+ GiD_Groups edit color Left "#3b3b3bff"
+ GiD_EntitiesGroups assign Left lines 4
+
+ GiD_Groups create Right
+ GiD_Groups edit color Right "#3b3b3bff"
+ GiD_EntitiesGroups assign Right lines 6
+}
+
+proc ::ShallowWater::examples::DamBreak::TreeAssignation {args} {
+
+ # Parts
+ set parts [spdAux::getRoute "SWParts"]
+ set part_node [customlib::AddConditionGroupOnXPath $parts Body]
+ set props [list Element GENERIC_ELEMENT Material Concrete]
+ spdAux::SetValuesOnBaseNode $part_node $props
+
+ # Topography data
+ set topography_conditions [spdAux::getRoute "SWTopographicData"]
+ set topography_cond "$topography_conditions/condition\[@n='Topography'\]"
+ set topography_node [customlib::AddConditionGroupOnXPath $topography_cond Body]
+ $topography_node setAttribute ov surface
+ set props [list value 0.0]
+ spdAux::SetValuesOnBaseNode $topography_node $props
+
+ # Initial conditions
+ set initial_conditions [spdAux::getRoute "SWInitialConditions"]
+ set initial_cond "$initial_conditions/condition\[@n='InitialWaterLevel'\]"
+ spdAux::AddIntervalGroup Reservoir "Reservoir//Initial"
+ set initial_node [customlib::AddConditionGroupOnXPath $initial_cond "Reservoir//Initial"]
+ $initial_node setAttribute ov surface
+ set props [list value 1.0 Interval Initial]
+ spdAux::SetValuesOnBaseNode $initial_node $props
+
+ spdAux::AddIntervalGroup Channel "Channel//Initial"
+ set initial_node [customlib::AddConditionGroupOnXPath $initial_cond "Channel//Initial"]
+ $initial_node setAttribute ov surface
+ set props [list value 0.8 Interval Initial]
+ spdAux::SetValuesOnBaseNode $initial_node $props
+
+ # Conditions
+ set boundary_conditions [spdAux::getRoute "SWConditions"]
+ set flow_rate_cond "$boundary_conditions/condition\[@n='ImposedFlowRate'\]"
+ spdAux::AddIntervalGroup Walls "Walls//Total"
+ set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Walls//Total"]
+ $flow_rate_node setAttribute ov line
+ set props [list selector_component_X Not value_component_Y 0.0 selector_component_Z Not Interval Total]
+ spdAux::SetValuesOnBaseNode $flow_rate_node $props
+
+ spdAux::AddIntervalGroup Right "Right//Total"
+ set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Right//Total"]
+ $flow_rate_node setAttribute ov line
+ set props [list value_component_X 0.0 selector_component_Y Not selector_component_Z Not Interval Total]
+ spdAux::SetValuesOnBaseNode $flow_rate_node $props
+
+ spdAux::AddIntervalGroup Left "Left//Total"
+ set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Left//Total"]
+ $flow_rate_node setAttribute ov line
+ set props [list value_component_X 0.0 selector_component_Y Not selector_component_Z Not Interval Total]
+ spdAux::SetValuesOnBaseNode $flow_rate_node $props
+
+ # Time parameters
+ set parameters [list EndTime 2.0]
+ set xpath [spdAux::getRoute "SWTimeParameters"]
+ spdAux::SetValuesOnBasePath $xpath $parameters
+
+ # Output
+ set parameters [list OutputControlType time OutputDeltaTime 0.1]
+ set xpath "[spdAux::getRoute Results]/container\[@n='GiDOutput'\]/container\[@n='GiDOptions'\]"
+ spdAux::SetValuesOnBasePath $xpath $parameters
+
+ # Refresh
+ spdAux::RequestRefresh
+}
diff --git a/kratos.gid/apps/ShallowWater/examples/HydraulicJump.tcl b/kratos.gid/apps/ShallowWater/examples/HydraulicJump.tcl
new file mode 100644
index 000000000..66b8d82fd
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/examples/HydraulicJump.tcl
@@ -0,0 +1,127 @@
+namespace eval ::ShallowWater::examples::HydraulicJump {
+ namespace path ::ShallowWater::examples
+ Kratos::AddNamespace [namespace current]
+}
+
+proc ::ShallowWater::examples::HydraulicJump::Init {args} {
+ if {![Kratos::IsModelEmpty]} {
+ set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
+ set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
+ if { $retval == "cancel" } { return }
+ }
+ DrawGeometry
+ AssignGroups
+ TreeAssignation
+
+ GiD_Process 'Redraw
+ GidUtils::UpdateWindow GROUPS
+ GidUtils::UpdateWindow LAYER
+ GiD_Process 'Zoom Frame
+}
+
+proc ::ShallowWater::examples::HydraulicJump::DrawGeometry {args} {
+ Kratos::ResetModel
+ GiD_Layers create main_layer
+ GiD_Layers edit to_use main_layer
+
+ # Geometry creation
+ ## Points ##
+ set coordinates [list 0 0 0 100 0 0 100 4 0 0 4 0]
+ set geom_points [list ]
+ foreach {x y z} $coordinates {
+ lappend geom_points [GiD_Geometry create point append main_layer $x $y $z]
+ }
+
+ ## Lines ##
+ set geom_lines [list ]
+ set initial [lindex $geom_points 0]
+ foreach point [lrange $geom_points 1 end] {
+ lappend geom_lines [GiD_Geometry create line append stline main_layer $initial $point]
+ set initial $point
+ }
+ lappend geom_lines [GiD_Geometry create line append stline main_layer $initial [lindex $geom_points 0]]
+
+ ## Surface ##
+ GiD_Process Mescape Geometry Create NurbsSurface {*}$geom_lines escape escape
+}
+
+proc ::ShallowWater::examples::HydraulicJump::AssignGroups {args} {
+ # Create and assign the groups
+ GiD_Groups create Channel
+ GiD_Groups edit color Channel "#26d1a8ff"
+ GiD_EntitiesGroups assign Channel surfaces 1
+
+ GiD_Groups create Walls
+ GiD_Groups edit color Walls "#3b3b3bff"
+ GiD_EntitiesGroups assign Walls lines {1 3}
+
+ GiD_Groups create Upstream
+ GiD_Groups edit color Upstream "#3b3b3bff"
+ GiD_EntitiesGroups assign Upstream lines 4
+
+ GiD_Groups create Downstream
+ GiD_Groups edit color Downstream "#3b3b3bff"
+ GiD_EntitiesGroups assign Downstream lines 2
+}
+
+proc ::ShallowWater::examples::HydraulicJump::TreeAssignation {args} {
+
+ # Parts
+ set parts [spdAux::getRoute "SWParts"]
+ set part_node [customlib::AddConditionGroupOnXPath $parts Channel]
+ set props [list Element GENERIC_ELEMENT Material Concrete]
+ spdAux::SetValuesOnBaseNode $part_node $props
+
+ # Topography data
+ set topography_conditions [spdAux::getRoute "SWTopographicData"]
+ set topography_cond "$topography_conditions/condition\[@n='Topography'\]"
+ set topography_node [customlib::AddConditionGroupOnXPath $topography_cond Channel]
+ $topography_node setAttribute ov surface
+ set props [list ByFunction Yes function_value "4.49449786e-09*x**5 -8.78489155e-07*x**4 +5.11763010e-05*x**3 -1.12368582e-03*x**2 +4.70535924e-03*x +2.58777553"]
+ spdAux::SetValuesOnBaseNode $topography_node $props
+
+ # Initial conditions
+ set initial_conditions [spdAux::getRoute "SWInitialConditions"]
+ set initial_cond "$initial_conditions/condition\[@n='InitialWaterLevel'\]"
+ spdAux::AddIntervalGroup Channel "Channel//Initial"
+ set initial_node [customlib::AddConditionGroupOnXPath $initial_cond "Channel//Initial"]
+ $initial_node setAttribute ov surface
+ set props [list variable_name FREE_SURFACE_ELEVATION value 2.8 Interval Initial set_minimum_height 1 minimum_height_value 1]
+ spdAux::SetValuesOnBaseNode $initial_node $props
+
+ # Conditions
+ set boundary_conditions [spdAux::getRoute "SWConditions"]
+ set flow_rate_cond "$boundary_conditions/condition\[@n='ImposedFlowRate'\]"
+ set water_height_cond "$boundary_conditions/condition\[@n='ImposedFreeSurface'\]"
+
+ spdAux::AddIntervalGroup Walls "Walls//Total"
+ set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Walls//Total"]
+ $flow_rate_node setAttribute ov line
+ set props [list selector_component_X Not value_component_Y 0.0 selector_component_Z Not Interval Total]
+ spdAux::SetValuesOnBaseNode $flow_rate_node $props
+
+ spdAux::AddIntervalGroup Upstream "Upstream//Total"
+ set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Upstream//Total"]
+ $flow_rate_node setAttribute ov line
+ set props [list value_component_X 2.0 selector_component_Y 0.0 selector_component_Z Not Interval Total]
+ spdAux::SetValuesOnBaseNode $flow_rate_node $props
+
+ spdAux::AddIntervalGroup Downstream "Downstream//Total"
+ set free_surface_node [customlib::AddConditionGroupOnXPath $water_height_cond "Downstream//Total"]
+ $free_surface_node setAttribute ov line
+ set props [list value 2.8 Interval Total]
+ spdAux::SetValuesOnBaseNode $free_surface_node $props
+
+ # Time parameters
+ set parameters [list EndTime 50.0]
+ set xpath [spdAux::getRoute "SWTimeParameters"]
+ spdAux::SetValuesOnBasePath $xpath $parameters
+
+ # Output
+ set parameters [list OutputControlType time OutputDeltaTime 1.0]
+ set xpath "[spdAux::getRoute Results]/container\[@n='GiDOutput'\]/container\[@n='GiDOptions'\]"
+ spdAux::SetValuesOnBasePath $xpath $parameters
+
+ # Refresh
+ spdAux::RequestRefresh
+}
diff --git a/kratos.gid/apps/ShallowWater/examples/Waves.tcl b/kratos.gid/apps/ShallowWater/examples/Waves.tcl
new file mode 100644
index 000000000..aaa181388
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/examples/Waves.tcl
@@ -0,0 +1,99 @@
+namespace eval ::ShallowWater::examples::Waves {
+ namespace path ::ShallowWater::examples
+ Kratos::AddNamespace [namespace current]
+}
+
+proc ::ShallowWater::examples::Waves::Init {args} {
+ if {![Kratos::IsModelEmpty]} {
+ set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
+ set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
+ if { $retval == "cancel" } { return }
+ }
+ DrawGeometry
+ AssignGroups
+ TreeAssignation
+
+ GiD_Process 'Redraw
+ GidUtils::UpdateWindow GROUPS
+ GidUtils::UpdateWindow LAYER
+ GiD_Process 'Zoom Frame
+}
+
+proc ::ShallowWater::examples::Waves::DrawGeometry {args} {
+ Kratos::ResetModel
+ GiD_Layers create main_layer
+ GiD_Layers edit to_use main_layer
+
+ # Geometry creation
+ ## Points ##
+ set coordinates [list 0 0 0 10 0 0 10 10 0 0 10 0]
+ set geom_points [list ]
+ foreach {x y z} $coordinates {
+ lappend geom_points [GiD_Geometry create point append main_layer $x $y $z]
+ }
+
+ ## Lines ##
+ set geom_lines [list ]
+ set initial [lindex $geom_points 0]
+ foreach point [lrange $geom_points 1 end] {
+ lappend geom_lines [GiD_Geometry create line append stline main_layer $initial $point]
+ set initial $point
+ }
+ lappend geom_lines [GiD_Geometry create line append stline main_layer $initial [lindex $geom_points_left 0]]
+
+ ## Surface ##
+ GiD_Process Mescape Geometry Create NurbsSurface {*}$geom_lines escape escape
+}
+
+proc ::ShallowWater::examples::Waves::AssignGroups {args} {
+ # Create and assign the groups
+ GiD_Groups create Body
+ GiD_Groups edit color Body "#26d1a8ff"
+ GiD_EntitiesGroups assign Body surfaces 1
+
+ GiD_Groups create Walls
+ GiD_Groups edit color Walls "#3b3b3bff"
+ GiD_EntitiesGroups assign Walls lines {1 2 3 4}
+}
+
+proc ::ShallowWater::examples::Waves::TreeAssignation {args} {
+
+ # Parts
+ set parts [spdAux::getRoute "SWParts"]
+ set part_node [customlib::AddConditionGroupOnXPath $parts Body]
+ set props [list Element GENERIC_ELEMENT Material Concrete]
+ spdAux::SetValuesOnBaseNode $part_node $props
+
+ # Initial conditions
+ set initial_conditions [spdAux::getRoute "SWInitialConditions"]
+ set initial_cond "$initial_conditions/condition\[@n='InitialWaterLevel'\]"
+ spdAux::AddIntervalGroup Body "Body//Initial"
+ set initial_node [customlib::AddConditionGroupOnXPath $initial_cond "Body//Initial"]
+ $initial_node setAttribute ov surface
+ set props [list value 1.0 Interval Initial]
+ spdAux::SetValuesOnBaseNode $initial_node $props
+
+ # Conditions
+ set boundary_conditions [spdAux::getRoute "SWConditions"]
+ set flow_rate_cond "$boundary_conditions/condition\[@n='ImposedFlowRate'\]"
+ spdAux::AddIntervalGroup Walls "Walls//Total"
+ set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Walls//Total"]
+ $flow_rate_node setAttribute ov line
+ set props [list selector_component_X Not value_component_Y 0.0 Interval Total]
+ spdAux::SetValuesOnBaseNode $flow_rate_node $props
+
+ # spdAux::AddIntervalGroup Right "Right//Total"
+ # set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Right//Total"]
+ # $flow_rate_node setAttribute ov line
+ # set props [list value_component_X 0.0 selector_component_Y Not Interval Total]
+ # spdAux::SetValuesOnBaseNode $flow_rate_node $props
+
+ # spdAux::AddIntervalGroup Left "Left//Total"
+ # set flow_rate_node [customlib::AddConditionGroupOnXPath $flow_rate_cond "Left//Total"]
+ # $flow_rate_node setAttribute ov line
+ # set props [list value_component_X 0.0 selector_component_Y Not Interval Total]
+ # spdAux::SetValuesOnBaseNode $flow_rate_node $props
+
+ # Refresh
+ spdAux::RequestRefresh
+}
diff --git a/kratos.gid/apps/ShallowWater/examples/examples.tcl b/kratos.gid/apps/ShallowWater/examples/examples.tcl
new file mode 100644
index 000000000..a5d7ee15a
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/examples/examples.tcl
@@ -0,0 +1,4 @@
+namespace eval ::ShallowWater::examples {
+ namespace path ::ShallowWater
+ Kratos::AddNamespace [namespace current]
+}
diff --git a/kratos.gid/apps/ShallowWater/examples/examples.xml b/kratos.gid/apps/ShallowWater/examples/examples.xml
new file mode 100644
index 000000000..6ddac7034
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/examples/examples.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/images/channel_inlet.png b/kratos.gid/apps/ShallowWater/images/channel_inlet.png
new file mode 100644
index 000000000..90e01dafd
Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/channel_inlet.png differ
diff --git a/kratos.gid/apps/ShallowWater/images/dam_break.png b/kratos.gid/apps/ShallowWater/images/dam_break.png
new file mode 100644
index 000000000..df3929487
Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/dam_break.png differ
diff --git a/kratos.gid/apps/ShallowWater/images/gravity_vector.png b/kratos.gid/apps/ShallowWater/images/gravity_vector.png
new file mode 100644
index 000000000..9a582f9ae
Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/gravity_vector.png differ
diff --git a/kratos.gid/apps/ShallowWater/images/jump.png b/kratos.gid/apps/ShallowWater/images/jump.png
new file mode 100644
index 000000000..08d10334a
Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/jump.png differ
diff --git a/kratos.gid/apps/ShallowWater/images/land.png b/kratos.gid/apps/ShallowWater/images/land.png
new file mode 100644
index 000000000..437c97880
Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/land.png differ
diff --git a/kratos.gid/apps/ShallowWater/images/logo.png b/kratos.gid/apps/ShallowWater/images/logo.png
new file mode 100644
index 000000000..2cd317722
Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/logo.png differ
diff --git a/kratos.gid/apps/ShallowWater/images/logo_old.png b/kratos.gid/apps/ShallowWater/images/logo_old.png
new file mode 100644
index 000000000..b44d924e7
Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/logo_old.png differ
diff --git a/kratos.gid/apps/ShallowWater/images/topography.png b/kratos.gid/apps/ShallowWater/images/topography.png
new file mode 100644
index 000000000..d851fc854
Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/topography.png differ
diff --git a/kratos.gid/apps/ShallowWater/images/wave.png b/kratos.gid/apps/ShallowWater/images/wave.png
new file mode 100644
index 000000000..633ccc28b
Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/wave.png differ
diff --git a/kratos.gid/apps/ShallowWater/images/waves.png b/kratos.gid/apps/ShallowWater/images/waves.png
new file mode 100644
index 000000000..d4c65fe21
Binary files /dev/null and b/kratos.gid/apps/ShallowWater/images/waves.png differ
diff --git a/kratos.gid/apps/ShallowWater/start.tcl b/kratos.gid/apps/ShallowWater/start.tcl
new file mode 100644
index 000000000..68eb33a08
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/start.tcl
@@ -0,0 +1,22 @@
+namespace eval ::ShallowWater {
+ Kratos::AddNamespace [namespace current]
+
+ # Variable declaration
+ variable _app
+ variable dir
+
+ proc GetAttribute {name} {variable _app; return [$_app getProperty $name]}
+ proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]}
+ proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]}
+}
+
+proc ::ShallowWater::Init {app} {
+ # Variable initialization
+ variable _app
+ variable dir
+ set _app $app
+ set dir [apps::getMyDir "ShallowWater"]
+
+ ::ShallowWater::xml::Init
+ ::ShallowWater::write::Init
+}
diff --git a/kratos.gid/apps/ShallowWater/write/write.tcl b/kratos.gid/apps/ShallowWater/write/write.tcl
new file mode 100644
index 000000000..73a7d3213
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/write/write.tcl
@@ -0,0 +1,114 @@
+namespace eval ::ShallowWater::write {
+ namespace path ::ShallowWater
+ Kratos::AddNamespace [namespace current]
+
+ variable ConditionsDictGroupIterators
+ variable writeAttributes
+}
+
+proc ::ShallowWater::write::Init { } {
+ variable ConditionsDictGroupIterators
+ set ConditionsDictGroupIterators [dict create ]
+ variable writeAttributes
+ set writeAttributes [dict create]
+
+ SetAttribute parts_un [GetUniqueName parts]
+ SetAttribute materials_un [GetUniqueName materials]
+ SetAttribute initial_conditions_un [GetUniqueName initial_conditions]
+ SetAttribute topography_data_un [GetUniqueName topography_data]
+ SetAttribute conditions_un [GetUniqueName conditions]
+
+ SetAttribute main_launch_file [ShallowWater::GetAttribute main_launch_file]
+ SetAttribute properties_location [GetWriteProperty properties_location]
+ SetAttribute materials_file [GetWriteProperty materials_file]
+ SetAttribute model_part_name [GetWriteProperty model_part_name]
+}
+
+proc ::ShallowWater::write::writeModelPartEvent { } {
+ # Validation
+ set err [Validate]
+ if {$err ne ""} {error $err}
+
+ # Init data
+ ::write::initWriteConfiguration [GetAttributes]
+
+ # Headers
+ ::write::writeModelPartData
+ ::write::WriteString "Begin Properties 0"
+ ::write::WriteString "End Properties"
+ ::write::WriteString ""
+
+ # Nodal Coordinates
+ ::write::writeNodalCoordinates
+
+ # Element connectivities
+ ::write::writeElementConnectivities
+
+ # Conditions connectivities
+ writeConditions
+
+ # SubmodelParts
+ writeSubModelParts
+}
+
+proc ::ShallowWater::write::Validate {} {
+ set err ""
+ return $err
+}
+
+proc ::ShallowWater::write::writeConditions { } {
+ variable ConditionsDictGroupIterators
+ set ConditionsDictGroupIterators [::write::writeConditions [GetAttribute conditions_un] ]
+}
+
+proc ::ShallowWater::write::writeSubModelParts {} {
+ ::write::writePartSubModelPart
+ ::write::writeNodalConditions [GetAttribute topography_data_un]
+ ::write::writeNodalConditions [GetAttribute initial_conditions_un]
+ WriteConditionsSubModelParts
+}
+
+proc ::ShallowWater::write::WriteConditionsSubModelParts { } {
+ variable ConditionsDictGroupIterators
+ set root [customlib::GetBaseRoot]
+ set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition/group"
+ foreach group [$root selectNodes $xp1] {
+ set groupid [$group @n]
+ set groupid [write::GetWriteGroupName $groupid]
+ if {$groupid in [dict keys $ConditionsDictGroupIterators]} {
+ ::write::writeGroupSubModelPart [[$group parent] @n] $groupid "Conditions" [dict get $ConditionsDictGroupIterators $groupid]
+ } else {
+ ::write::writeGroupSubModelPart [[$group parent] @n] $groupid "nodal"
+ }
+ }
+}
+
+proc ::ShallowWater::write::writeCustomFilesEvent { } {
+ write::writePropertiesJsonFile [GetAttribute parts_un] [GetAttribute materials_file] false [GetAttribute model_part_name]
+ write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file]
+}
+
+proc ::ShallowWater::write::GetAttribute {att} {
+ variable writeAttributes
+ return [dict get $writeAttributes $att]
+}
+
+proc ::ShallowWater::write::GetAttributes {} {
+ variable writeAttributes
+ return $writeAttributes
+}
+
+proc ::ShallowWater::write::SetAttribute {att val} {
+ variable writeAttributes
+ dict set writeAttributes $att $val
+}
+
+proc ::ShallowWater::write::AddAttribute {att val} {
+ variable writeAttributes
+ dict lappend writeAttributes $att $val
+}
+
+proc ::ShallowWater::write::AddAttributes {configuration} {
+ variable writeAttributes
+ set writeAttributes [dict merge $writeAttributes $configuration]
+}
diff --git a/kratos.gid/apps/ShallowWater/write/writeProjectParameters.tcl b/kratos.gid/apps/ShallowWater/write/writeProjectParameters.tcl
new file mode 100644
index 000000000..e267c7bb3
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/write/writeProjectParameters.tcl
@@ -0,0 +1,90 @@
+# Project Parameters
+proc ::ShallowWater::write::writeParametersEvent { } {
+ write::WriteJSON [getParametersDict]
+}
+
+proc ::ShallowWater::write::getParametersDict { } {
+ set projectParametersDict [dict create]
+
+ # Analysis stage field
+ dict set projectParametersDict analysis_stage "KratosMultiphysics.ShallowWaterApplication.shallow_water_analysis"
+
+ # Set the problem data section
+ dict set projectParametersDict problem_data [GetProblemDataDict]
+
+ # Solver settings
+ dict set projectParametersDict solver_settings [GetSolverSettingsDict]
+
+ # Regular processes
+ set processes [dict create]
+ dict set processes topography_process_list [write::getConditionsParametersDict [GetAttribute topography_data_un] "Nodal"]
+ dict set processes initial_conditions_process_list [write::getConditionsParametersDict [GetAttribute initial_conditions_un] "Nodal"]
+ dict set processes boundary_conditions_process_list [write::getConditionsParametersDict [GetAttribute conditions_un]]
+ dict set projectParametersDict processes $processes
+
+ # Output processes
+ dict set projectParametersDict output_processes [write::GetDefaultOutputProcessDict]
+
+ return $projectParametersDict
+}
+
+proc ::ShallowWater::write::GetProblemDataDict { } {
+
+ # First section -> Problem data
+ set problem_data_dict [dict create]
+ set model_name [Kratos::GetModelName]
+ dict set problem_data_dict problem_name $model_name
+
+ # Parallelization
+ set paralleltype [write::getValue ParallelType]
+ dict set problem_data_dict parallel_type $paralleltype
+
+ # Time settings
+ set timeSteppingDict [dict create]
+ dict set problem_data_dict start_time [write::getValue SWTimeParameters StartTime]
+ dict set problem_data_dict end_time [write::getValue SWTimeParameters EndTime]
+
+ # Write the echo level in the problem data section
+ set echo_level [write::getValue Results EchoLevel]
+ dict set problem_data_dict echo_level $echo_level
+
+ return $problem_data_dict
+}
+
+proc ::ShallowWater::write::GetSolverSettingsDict { } {
+ # General data
+ set solverSettingsDict [dict create]
+ dict set solverSettingsDict solver_type [write::getValue SWSolStrat]
+ dict set solverSettingsDict model_part_name [GetAttribute model_part_name]
+ dict set solverSettingsDict domain_size 2
+ dict set solverSettingsDict gravity [write::getValue SWGravity]
+
+ # Model import settings
+ set modelImportDict [dict create]
+ dict set modelImportDict input_type "mdpa"
+ dict set modelImportDict input_filename [Kratos::GetModelName]
+ dict set solverSettingsDict model_import_settings $modelImportDict
+
+ # Materials
+ set materialsDict [dict create]
+ dict set materialsDict materials_filename [GetAttribute materials_file]
+ dict set solverSettingsDict material_import_settings $materialsDict
+
+ # Strategy, scheme and linear solver settings
+ set solverSettingsDict [dict merge $solverSettingsDict [write::getSolutionStrategyParametersDict SWSolStrat SWScheme SWStrategyParams] ]
+ set solverSettingsDict [dict merge $solverSettingsDict [write::getSolversParametersDict ShallowWater] ]
+
+ # Time stepping settings
+ set timeSteppingDict [dict create]
+ dict set timeSteppingDict automatic_time_step [write::getValue SWAutomaticDeltaTime]
+ if {[write::getValue SWAutomaticDeltaTime] eq "Yes"} {
+ dict set timeSteppingDict courant_number [write::getValue SWTimeParameters CFLNumber]
+ dict set timeSteppingDict maximum_delta_time [write::getValue SWTimeParameters MaximumDeltaTime]
+ dict set timeSteppingDict minimum_delta_time [write::getValue SWTimeParameters MinimumDeltaTime]
+ } else {
+ dict set timeSteppingDict time_step [write::getValue SWTimeParameters DeltaTime]
+ }
+ dict set solverSettingsDict time_stepping $timeSteppingDict
+
+ return $solverSettingsDict
+}
diff --git a/kratos.gid/apps/ShallowWater/xml/BoundaryConditions.spd b/kratos.gid/apps/ShallowWater/xml/BoundaryConditions.spd
new file mode 100644
index 000000000..ee44e459b
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/BoundaryConditions.spd
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/xml/Conditions.xml b/kratos.gid/apps/ShallowWater/xml/Conditions.xml
new file mode 100644
index 000000000..5a24d0715
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/Conditions.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/xml/InitialConditions.spd b/kratos.gid/apps/ShallowWater/xml/InitialConditions.spd
new file mode 100644
index 000000000..ffa8646a7
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/InitialConditions.spd
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/xml/Main.spd b/kratos.gid/apps/ShallowWater/xml/Main.spd
new file mode 100644
index 000000000..a4c50f049
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/Main.spd
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/xml/Materials.spd b/kratos.gid/apps/ShallowWater/xml/Materials.spd
new file mode 100644
index 000000000..827c138ed
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/Materials.spd
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/xml/Materials.xml b/kratos.gid/apps/ShallowWater/xml/Materials.xml
new file mode 100644
index 000000000..b3887d682
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/Materials.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/xml/NodalConditions.xml b/kratos.gid/apps/ShallowWater/xml/NodalConditions.xml
new file mode 100644
index 000000000..a05261b97
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/NodalConditions.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/xml/Parts.spd b/kratos.gid/apps/ShallowWater/xml/Parts.spd
new file mode 100644
index 000000000..a6c9464bf
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/Parts.spd
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/xml/Processes.xml b/kratos.gid/apps/ShallowWater/xml/Processes.xml
new file mode 100644
index 000000000..fac3a3af3
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/Processes.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/xml/Procs.spd b/kratos.gid/apps/ShallowWater/xml/Procs.spd
new file mode 100644
index 000000000..da863d2cf
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/Procs.spd
@@ -0,0 +1,3 @@
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/xml/SolutionStrategy.spd b/kratos.gid/apps/ShallowWater/xml/SolutionStrategy.spd
new file mode 100644
index 000000000..0c3087dcc
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/SolutionStrategy.spd
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/xml/Strategies.xml b/kratos.gid/apps/ShallowWater/xml/Strategies.xml
new file mode 100644
index 000000000..0019d74a5
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/Strategies.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/xml/Strategy.spd b/kratos.gid/apps/ShallowWater/xml/Strategy.spd
new file mode 100644
index 000000000..83fac0401
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/Strategy.spd
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/xml/TopographicData.spd b/kratos.gid/apps/ShallowWater/xml/TopographicData.spd
new file mode 100644
index 000000000..3c6444596
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/TopographicData.spd
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/kratos.gid/apps/ShallowWater/xml/XmlController.tcl b/kratos.gid/apps/ShallowWater/xml/XmlController.tcl
new file mode 100644
index 000000000..d624577eb
--- /dev/null
+++ b/kratos.gid/apps/ShallowWater/xml/XmlController.tcl
@@ -0,0 +1,37 @@
+namespace eval ::ShallowWater::xml {
+ namespace path ::ShallowWater
+ Kratos::AddNamespace [namespace current]
+}
+
+proc ::ShallowWater::xml::Init {} {
+ Model::InitVariables dir $::ShallowWater::dir
+
+ Model::getSolutionStrategies Strategies.xml
+ Model::getElements "../../Common/xml/Elements.xml"
+ Model::getConditions Conditions.xml
+ Model::getMaterials Materials.xml
+ Model::getNodalConditions NodalConditions.xml
+ Model::getProcesses "../../Common/xml/Processes.xml"
+ Model::getProcesses Processes.xml
+ Model::getSolvers "../../Common/xml/Solvers.xml"
+}
+
+proc ::ShallowWater::xml::getUniqueName {name} {
+ return [GetAttribute prefix]${name}
+}
+
+proc ::ShallowWater::xml::CustomTree {args} {
+ # Set the nodal conditions active
+ gid_groups_conds::setAttributes "[spdAux::getRoute SWTopographicData]/condition" [list state normal]
+ gid_groups_conds::setAttributes "[spdAux::getRoute SWInitialConditions]/condition" [list state normal]
+
+ # Register the primary outputs from topography data
+ gid_groups_conds::setAttributes "[spdAux::getRoute NodalResults]/value\[@n = 'MOMENTUM'\]" [list state normal]
+ gid_groups_conds::setAttributes "[spdAux::getRoute NodalResults]/value\[@n = 'VELOCITY'\]" [list state normal]
+ gid_groups_conds::setAttributes "[spdAux::getRoute NodalResults]/value\[@n = 'HEIGHT'\]" [list state normal]
+ gid_groups_conds::setAttributes "[spdAux::getRoute NodalResults]/value\[@n = 'FREE_SURFACE_ELEVATION'\]" [list state normal]
+
+ # Set the default value for the Z component in the boundary conditions
+ gid_groups_conds::setAttributes "[spdAux::getRoute SWConditions]/condition\[@n = 'ImposedFlowRate'\]/value\[@n = 'selector_component_Z'\]" [list v Not]
+ gid_groups_conds::setAttributes "[spdAux::getRoute SWConditions]/condition\[@n = 'ImposedVelocity'\]/value\[@n = 'selector_component_Z'\]" [list v Not]
+}
diff --git a/kratos.gid/apps/Solid/examples/CircularTank.tcl b/kratos.gid/apps/Solid/examples/CircularTank.tcl
deleted file mode 100644
index a1be5e5e9..000000000
--- a/kratos.gid/apps/Solid/examples/CircularTank.tcl
+++ /dev/null
@@ -1,297 +0,0 @@
-
-proc ::Solid::examples::CircularTank {args} {
- if {![Kratos::IsModelEmpty]} {
- set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
- set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
- if { $retval == "cancel" } { return }
- }
- DrawCircularTankGeometry$::Model::SpatialDimension
- TreeAssignationCircularTank$::Model::SpatialDimension
-
- GiD_Process 'Redraw
- GidUtils::UpdateWindow GROUPS
- GidUtils::UpdateWindow LAYER
- GiD_Process 'Zoom Frame
-}
-
-
-# Draw Geometry
-proc Solid::examples::DrawCircularTankGeometry3D {args} {
- Kratos::ResetModel
- set dir [apps::getMyDir "Solid"]
- set problemfile [file join $dir examples CircularTank3D.gid]
- GiD_Process Mescape Files InsertGeom $problemfile
-}
-proc Solid::examples::DrawCircularTankGeometry2Da {args} {
- Kratos::ResetModel
- set dir [apps::getMyDir "Solid"]
- set problemfile [file join $dir examples CircularTank2Da.gid]
- GiD_Process Mescape Files InsertGeom $problemfile
-}
-proc Solid::examples::DrawCircularTankGeometry2D {args} {
- Kratos::ResetModel
-}
-# Mesh sizes
-
-
-# Tree assign
-proc Solid::examples::TreeAssignationCircularTank3D {args} {
- set nd $::Model::SpatialDimension
- set root [customlib::GetBaseRoot]
-
- set condtype line
- if {$nd eq "3D"} { set condtype surface }
-
- # Static solution strategy set
- spdAux::SetValueOnTreeItem v "Static" SLSoluType
-
- # Time parameters
- set time_parameters [list EndTime 1.0 DeltaTime 1.0]
- set time_params_path [spdAux::getRoute SLTimeParameters]
- foreach {name value} $time_parameters {
- set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"]
- if {$node ne ""} {
- $node setAttribute v $value
- } else {
- W "Couldn't find $name - Check example script"
- }
- }
-
- # Solid Parts
- set solidParts [spdAux::getRoute "SLParts"]
- set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Solid]
- $solidPartsNode setAttribute ov volume
- set props [list Element SmallDisplacementElement$nd ConstitutiveLaw SmallStrain3DLaw.LinearElasticModel]
- foreach {prop val} $props {
- set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- set solidConditions [spdAux::getRoute "SLNodalConditions"]
-
- # Solid Constraint
- GiD_Groups clone ConstraintX Total
- GiD_Groups edit parent Total ConstraintX
- spdAux::AddIntervalGroup ConstraintX "ConstraintX//Total"
- GiD_Groups edit state "ConstraintX//Total" hidden
- set solidConstraintX {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintXNode [customlib::AddConditionGroupOnXPath $solidConstraintX "ConstraintX//Total"]
- $solidConstraintXNode setAttribute ov surface
- set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y Not selector_component_Z Not Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintXNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone ConstraintZ Total
- GiD_Groups edit parent Total ConstraintZ
- spdAux::AddIntervalGroup ConstraintZ "ConstraintZ//Total"
- GiD_Groups edit state "ConstraintZ//Total" hidden
- set solidConstraintZ {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintZNode [customlib::AddConditionGroupOnXPath $solidConstraintZ "ConstraintZ//Total"]
- $solidConstraintZNode setAttribute ov surface
- set props [list selector_component_X Not selector_component_Y Not selector_component_Z ByValue value_component_Z 0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintZNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Solid Loads
- GiD_Groups clone SelfWeight Total
- GiD_Groups edit parent Total SelfWeight
- spdAux::AddIntervalGroup SelfWeight "SelfWeight//Total"
- GiD_Groups edit state "SelfWeight//Total" hidden
- set solidLoad "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='SelfWeight$nd'\]"
- set solidLoadNode [customlib::AddConditionGroupOnXPath $solidLoad "SelfWeight//Total"]
- $solidLoadNode setAttribute ov volume
- set props [list ByFunction No modulus 9.81 direction 0.0,-1.0,0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidLoadNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone Pressure Total
- GiD_Groups edit parent Total Pressure
- spdAux::AddIntervalGroup Pressure "Pressure//Total"
- GiD_Groups edit state "Pressure//Total" hidden
- set solidPressure "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Pressure$nd'\]"
- set solidPressureNode [customlib::AddConditionGroupOnXPath $solidPressure "Pressure//Total"]
- $solidPressureNode setAttribute ov surface
- set props [list ByFunction Yes function_value "9.81*1000*(2.5-y)" Interval Total]
- foreach {prop val} $props {
- set propnode [$solidPressureNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone Ballast Total
- GiD_Groups edit parent Total Ballast
- spdAux::AddIntervalGroup Ballast "Ballast//Total"
- GiD_Groups edit state "Ballast//Total" hidden
- set solidBallast "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Ballast$nd'\]"
- set solidBallastNode [customlib::AddConditionGroupOnXPath $solidBallast "Ballast//Total"]
- $solidBallastNode setAttribute ov surface
- set props [list ByFunction No value 50e6 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidBallastNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Parallelism
- set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4]
- set time_params_path [spdAux::getRoute "Parallelization"]
- foreach {n v} $time_parameters {
- [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v
- }
-
- # Solver
- set solver_parameters [list Solver amgcl max_iteration 2000 tolerance 1e-6 krylov_type cg]
- set solver_params_path [spdAux::getRoute "SLStaticlinear_solver_settings"]
- foreach {n v} $solver_parameters {
- [$root selectNodes "$solver_params_path/value\[@n = '$n'\]"] setAttribute v $v
- }
-
- spdAux::RequestRefresh
-}
-proc Solid::examples::TreeAssignationCircularTank2Da {args} {
- set nd $::Model::SpatialDimension
- set root [customlib::GetBaseRoot]
-
- set condtype line
- if {$nd eq "3D"} { set condtype surface }
-
- # Static solution strategy set
- spdAux::SetValueOnTreeItem v "Static" SLSoluType
-
- # Time parameters
- set time_parameters [list EndTime 1.0 DeltaTime 1.0]
- set time_params_path [spdAux::getRoute SLTimeParameters]
- foreach {name value} $time_parameters {
- set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"]
- if {$node ne ""} {
- $node setAttribute v $value
- } else {
- W "Couldn't find $name - Check example script"
- }
-
- }
- # Solid Parts
- set solidParts [spdAux::getRoute "SLParts"]
- set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Solid]
- $solidPartsNode setAttribute ov surface
- set props [list Element SmallDisplacementElement$nd ConstitutiveLaw SmallStrainAxisymmetric2DLaw.LinearElasticModel]
- foreach {prop val} $props {
- set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- set solidConditions [spdAux::getRoute "SLNodalConditions"]
-
- # Solid Constraint
- GiD_Groups clone Constraint Total
- GiD_Groups edit parent Total Constraint
- spdAux::AddIntervalGroup Constraint "Constraint//Total"
- GiD_Groups edit state "Constraint//Total" hidden
- set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Constraint//Total"]
- $solidConstraintNode setAttribute ov line
- set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y Not selector_component_Z Not Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Solid Loads
- GiD_Groups clone SelfWeight Total
- GiD_Groups edit parent Total SelfWeight
- spdAux::AddIntervalGroup SelfWeight "SelfWeight//Total"
- GiD_Groups edit state "SelfWeight//Total" hidden
- set solidLoad "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='SelfWeight$nd'\]"
- set solidLoadNode [customlib::AddConditionGroupOnXPath $solidLoad "SelfWeight//Total"]
- $solidLoadNode setAttribute ov surface
- set props [list ByFunction No modulus 9.81 direction 0.0,-1.0,0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidLoadNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone Pressure Total
- GiD_Groups edit parent Total Pressure
- spdAux::AddIntervalGroup Pressure "Pressure//Total"
- GiD_Groups edit state "Pressure//Total" hidden
- set solidPressure "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Pressure$nd'\]"
- set solidPressureNode [customlib::AddConditionGroupOnXPath $solidPressure "Pressure//Total"]
- $solidPressureNode setAttribute ov line
- set props [list ByFunction Yes function_value "9.81*1000*(2.5-y)" Interval Total]
- foreach {prop val} $props {
- set propnode [$solidPressureNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone Ballast Total
- GiD_Groups edit parent Total Ballast
- spdAux::AddIntervalGroup Ballast "Ballast//Total"
- GiD_Groups edit state "Ballast//Total" hidden
- set solidBallast "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Ballast$nd'\]"
- set solidBallastNode [customlib::AddConditionGroupOnXPath $solidBallast "Ballast//Total"]
- $solidBallastNode setAttribute ov line
- set props [list ByFunction No value 50e6 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidBallastNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Parallelism
- set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4]
- set time_params_path [spdAux::getRoute "Parallelization"]
- foreach {n v} $time_parameters {
- [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v
- }
- spdAux::RequestRefresh
-}
-proc Solid::examples::TreeAssignationCircularTank2D {args} {
- Kratos::ResetModel
-}
diff --git a/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.geo b/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.geo
deleted file mode 100644
index 2ae4c7227..000000000
Binary files a/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.geo and /dev/null differ
diff --git a/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.prj b/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.prj
deleted file mode 100644
index 5ee745466..000000000
--- a/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.prj
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1 3 6 7 15 16 18 19
- 1x8
- 5 2 1x4 2 2
-
-
- 2 5 7 9:11
- 2x6
- 4 3 4 3 4 3 4 3 4 3 4 3
-
-
-
-
diff --git a/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.vv b/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.vv
deleted file mode 100644
index fe66fee6e..000000000
--- a/kratos.gid/apps/Solid/examples/CircularTank2Da.gid/CircularTank2Da.vv
+++ /dev/null
@@ -1,37 +0,0 @@
-BeginZE /home/cpuigbo/Desktop/CircularTank2Da.gid/CircularTank2Da.vv
- x -2.27358531951904297 7.77358531951904297
- y 4.63604164123535156 -2.13604164123535156
- z -4.54599666595458984 4.54599666595458984
- e 3.38604164123535156
- v 0 0 0
- r 1
- m 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
- c 3.74545454978942871 0.654545426368713379 0
- pd 0
- pno 0
- pfo 0
- pf 4
- pv 0
- NowUse 0
- DrawingType 1
- LightVector 90 90 150 0
- OGLShadow(UseShadows) 0
- OGLShadow(RenderMode) RenderNice
- OGLShadow(ShadowBias) -0.002
- OGLShadow(AmbientShadows) 1
- OGLShadow(UseFBO) 0
- OGLShadow(FBOSize) 2048
- OGLShadow(DimmedLightFactor) 0.02
- OGLStereo(UseStereo) 0
- OGLStereo(RelativeEyeDistance) 1
- OGLStereo(FlipEyes) 0
- OGLStereo(StereoMode) AnaglyphColors
- OGLStereo(EyeDistance) 0.075
- OGLStereo(LeftEyeDistance) 1 0 0 1
- OGLStereo(RightEyeDistance) 0 1 1 1
-EndZE /home/cpuigbo/Desktop/CircularTank2Da.gid/CircularTank2Da.vv
-
-BeginMirror
- Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror
-EndMirror
-
diff --git a/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.geo b/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.geo
deleted file mode 100644
index 458181829..000000000
Binary files a/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.geo and /dev/null differ
diff --git a/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.prj b/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.prj
deleted file mode 100644
index 372744322..000000000
--- a/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.prj
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1:3 6:8 12
- 1x7
- 3 6 6 5x3 2
-
-
- 1
- 2
- 1 4
-
-
-
-
diff --git a/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.vv b/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.vv
deleted file mode 100644
index 6a5d81bac..000000000
--- a/kratos.gid/apps/Solid/examples/CircularTank3D.gid/CircularTank3D.vv
+++ /dev/null
@@ -1,37 +0,0 @@
-BeginZE /home/cpuigbo/Desktop/CircularTank3D.gid/CircularTank3D.vv
- x -4.36261892318725586 9.74696636199951172
- y 5.52431821823120117 -3.00504279136657715
- z -2.05847859382629395 7.42126178741455078
- e 4.26468038558959961
- v -0.150687560439109802 -0.215787529945373535 -0.0511590689420700073
- r 0.963385581970214844
- m 0.901636958122253418 0.163604810833930969 -0.400355130434036255 0 -0.0335388220846652985 0.949352025985717773 0.31241944432258606 0 0.43119126558303833 -0.268261492252349854 0.861458003520965576 0 0 0 0 1
- c 2.68139147758483887 0.784821450710296631 -2.68139147758483887
- pd 0
- pno 0
- pfo 0
- pf 4
- pv 0
- NowUse 0
- DrawingType 1
- LightVector 90 90 150 0
- OGLShadow(UseShadows) 0
- OGLShadow(RenderMode) RenderNice
- OGLShadow(ShadowBias) -0.002
- OGLShadow(AmbientShadows) 1
- OGLShadow(UseFBO) 0
- OGLShadow(FBOSize) 2048
- OGLShadow(DimmedLightFactor) 0.02
- OGLStereo(UseStereo) 0
- OGLStereo(RelativeEyeDistance) 1
- OGLStereo(FlipEyes) 0
- OGLStereo(StereoMode) AnaglyphColors
- OGLStereo(EyeDistance) 0.075
- OGLStereo(LeftEyeDistance) 1 0 0 1
- OGLStereo(RightEyeDistance) 0 1 1 1
-EndZE /home/cpuigbo/Desktop/CircularTank3D.gid/CircularTank3D.vv
-
-BeginMirror
- Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror
-EndMirror
-
diff --git a/kratos.gid/apps/Solid/examples/DynamicBeam.tcl b/kratos.gid/apps/Solid/examples/DynamicBeam.tcl
deleted file mode 100644
index 61becb49e..000000000
--- a/kratos.gid/apps/Solid/examples/DynamicBeam.tcl
+++ /dev/null
@@ -1,141 +0,0 @@
-
-proc ::Solid::examples::DynamicBeam {args} {
- if {![Kratos::IsModelEmpty]} {
- set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
- set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
- if { $retval == "cancel" } { return }
- }
- DrawDynamicBeamGeometry$::Model::SpatialDimension
- TreeAssignationDynamicBeam$::Model::SpatialDimension
-
- GiD_Process 'Redraw
- GidUtils::UpdateWindow GROUPS
- GidUtils::UpdateWindow LAYER
- GiD_Process 'Zoom Frame
-}
-
-
-# Draw Geometry
-proc Solid::examples::DrawDynamicBeamGeometry3D {args} {
- Kratos::ResetModel
- set dir [apps::getMyDir "Solid"]
- set problemfile [file join $dir examples DynamicBeam3D.gid]
- GiD_Process Mescape Files InsertGeom $problemfile
-}
-proc Solid::examples::DrawDynamicBeamGeometry2Da {args} {
- Kratos::ResetModel
-}
-proc Solid::examples::DrawDynamicBeamGeometry2D {args} {
- Kratos::ResetModel
-}
-# Mesh sizes
-
-
-# Tree assign
-proc Solid::examples::TreeAssignationDynamicBeam3D {args} {
- set nd $::Model::SpatialDimension
- set root [customlib::GetBaseRoot]
-
- set condtype point
-
- # Static solution strategy set
- spdAux::SetValueOnTreeItem v "Dynamic" SLSoluType
- spdAux::SetValueOnTreeItem v "SimoStep" SLScheme
-
- # Time parameters
- set time_parameters [list EndTime 5.0 DeltaTime 0.05]
- set time_params_path [spdAux::getRoute SLTimeParameters]
- foreach {name value} $time_parameters {
- set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"]
- if {$node ne ""} {
- $node setAttribute v $value
- } else {
- W "Couldn't find $name - Check example script"
- }
- }
-
- # Solid Parts
- set solidParts [spdAux::getRoute "SLParts"]
- set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Solid]
- $solidPartsNode setAttribute ov line
- set props [list Element LargeDisplacementBeamElement3D ConstitutiveLaw CircularSection3D DIAMETER 0.05 YOUNG_MODULUS 206.9e8]
- foreach {prop val} $props {
- set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- spdAux::RequestRefresh
- set solidConditions [spdAux::getRoute "SLNodalConditions"]
-
- # Solid Constraint
- GiD_Groups clone Constraint Total
- GiD_Groups edit parent Total Constraint
- spdAux::AddIntervalGroup Constraint "Constraint//Total"
- GiD_Groups edit state "Constraint//Total" hidden
- set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Constraint//Total"]
- $solidConstraintNode setAttribute ov point
- set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y ByValue value_component_Y 0.0 selector_component_Z ByValue value_component_Z 0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone AngularConstraint Total
- GiD_Groups edit parent Total AngularConstraint
- spdAux::AddIntervalGroup AngularConstraint "AngularConstraint//Total"
- GiD_Groups edit state "AngularConstraint//Total" hidden
- set solidAngularConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='ANGULAR_VELOCITY']}
- set solidAngularConstraintNode [customlib::AddConditionGroupOnXPath $solidAngularConstraint "AngularConstraint//Total"]
- $solidAngularConstraintNode setAttribute ov point
- set props [list selector_component_X ByValue value_component_X 2.0 selector_component_Y ByValue value_component_Y 0.0 selector_component_Z ByValue value_component_Z 0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidAngularConstraintNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Solid Loads
- GiD_Groups clone SelfWeight Total
- GiD_Groups edit parent Total SelfWeight
- spdAux::AddIntervalGroup SelfWeight "SelfWeight//Total"
- GiD_Groups edit state "SelfWeight//Total" hidden
- set solidLoad "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='SelfWeight$nd'\]"
- set solidLoadNode [customlib::AddConditionGroupOnXPath $solidLoad "SelfWeight//Total"]
- $solidLoadNode setAttribute ov line
- set props [list ByFunction No modulus 9.81 direction 0.0,-1.0,0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidLoadNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Parallelism
- set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4]
- set time_params_path [spdAux::getRoute "Parallelization"]
- foreach {n v} $time_parameters {
- [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v
- }
-
- spdAux::RequestRefresh
-}
-proc Solid::examples::TreeAssignationDynamicBeam2Da {args} {
- Kratos::ResetModel
-}
-proc Solid::examples::TreeAssignationDynamicBeam2D {args} {
- Kratos::ResetModel
-}
diff --git a/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.geo b/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.geo
deleted file mode 100644
index c8f5c092f..000000000
Binary files a/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.geo and /dev/null differ
diff --git a/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.prj b/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.prj
deleted file mode 100644
index 17cf51e35..000000000
--- a/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.prj
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- 1
- 3
- 3 1 4
-
-
- 1 2
- 2 2
- 1 2 1 2
-
-
-
-
diff --git a/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.vv b/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.vv
deleted file mode 100644
index d30c49831..000000000
--- a/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.vv
+++ /dev/null
@@ -1,37 +0,0 @@
-BeginZE /home/cpuigbo/GiDInterface/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.vv
- x 0.582600831985473633 3.13705992698669434
- y 0.753371059894561768 -1.3496021032333374
- z -1.89401459693908691 1.89401459693908691
- e 1.65831243991851807
- v 0.0429526552950176832 0.875547797747364354 0.149245509813539512
- r -0.457489782468801232
- m -0.577716350555419922 0.211770802736282349 -0.788287341594696045 0 -0.0613423846662044525 0.951761722564697266 0.300643950700759888 0 0.813929319381713867 0.222042351961135864 -0.536857724189758301 0 0 0 0 1
- c 1.66666662693023682 -0.333333343267440796 0
- pd 0
- pno 0
- pfo 0
- pf 4
- pv 0
- NowUse 0
- DrawingType 0
- LightVector 90 90 150 0
- OGLShadow(UseShadows) 0
- OGLShadow(RenderMode) RenderNice
- OGLShadow(ShadowBias) -0.002
- OGLShadow(AmbientShadows) 1
- OGLShadow(UseFBO) 0
- OGLShadow(FBOSize) 2048
- OGLShadow(DimmedLightFactor) 0.02
- OGLStereo(UseStereo) 0
- OGLStereo(RelativeEyeDistance) 1
- OGLStereo(FlipEyes) 0
- OGLStereo(StereoMode) AnaglyphColors
- OGLStereo(EyeDistance) 0.075
- OGLStereo(LeftEyeDistance) 1 0 0 1
- OGLStereo(RightEyeDistance) 0 1 1 1
-EndZE /home/cpuigbo/GiDInterface/kratos.gid/apps/Solid/examples/DynamicBeam3D.gid/DynamicBeam3D.vv
-
-BeginMirror
- Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror
-EndMirror
-
diff --git a/kratos.gid/apps/Solid/examples/DynamicRod.tcl b/kratos.gid/apps/Solid/examples/DynamicRod.tcl
deleted file mode 100644
index 90de1106f..000000000
--- a/kratos.gid/apps/Solid/examples/DynamicRod.tcl
+++ /dev/null
@@ -1,206 +0,0 @@
-
-proc ::Solid::examples::DynamicRod {args} {
- if {![Kratos::IsModelEmpty]} {
- set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
- set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
- if { $retval == "cancel" } { return }
- }
- DrawDynamicRodGeometry$::Model::SpatialDimension
- TreeAssignationDynamicRod$::Model::SpatialDimension
-
- GiD_Process 'Redraw
- GidUtils::UpdateWindow GROUPS
- GidUtils::UpdateWindow LAYER
- GiD_Process 'Zoom Frame
-}
-
-
-# Draw Geometry
-proc Solid::examples::DrawDynamicRodGeometry3D {args} {
- Kratos::ResetModel
- set dir [apps::getMyDir "Solid"]
- set problemfile [file join $dir examples DynamicRod3D.gid]
- GiD_Process Mescape Files InsertGeom $problemfile
-}
-proc Solid::examples::DrawDynamicRodGeometry2D {args} {
- Kratos::ResetModel
- set dir [apps::getMyDir "Solid"]
- set problemfile [file join $dir examples DynamicRod2D.gid]
- GiD_Process Mescape Files InsertGeom $problemfile
-}
-proc Solid::examples::DrawDynamicRodGeometry2Da {args} {
- Kratos::ResetModel
-}
-# Mesh sizes
-
-
-# Tree assign
-proc Solid::examples::TreeAssignationDynamicRod3D {args} {
- set nd $::Model::SpatialDimension
- set root [customlib::GetBaseRoot]
-
- set condtype line
- if {$nd eq "3D"} { set condtype surface }
-
- # Dynamic solution strategy set
- spdAux::SetValueOnTreeItem v "Dynamic" SLSoluType
-
- # Time parameters
- set time_parameters [list EndTime 1.06 DeltaTime 0.01]
- set time_params_path [spdAux::getRoute SLTimeParameters]
- foreach {name value} $time_parameters {
- set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"]
- if {$node ne ""} {
- $node setAttribute v $value
- } else {
- W "Couldn't find $name - Check example script"
- }
-
- }
-
- # Solid Parts
- set solidParts [spdAux::getRoute "SLParts"]
- set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Solid]
- $solidPartsNode setAttribute ov volume
- set props [list Element TotalLagrangianElement$nd ConstitutiveLaw LargeStrain3DLaw.SaintVenantKirchhoffModel]
- foreach {prop val} $props {
- set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- set solidConditions [spdAux::getRoute "SLNodalConditions"]
-
- # Solid Constraint
- GiD_Groups clone Constraint Total
- GiD_Groups edit parent Total Constraint
- spdAux::AddIntervalGroup Constraint "Constraint//Total"
- GiD_Groups edit state "Constraint//Total" hidden
- set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Constraint//Total"]
- $solidConstraintNode setAttribute ov line
- set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y ByValue value_component_Y 0.0 selector_component_Z ByValue value_component_Z 0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Solid Loads
- GiD_Groups clone SelfWeight Total
- GiD_Groups edit parent Total SelfWeight
- spdAux::AddIntervalGroup SelfWeight "SelfWeight//Total"
- GiD_Groups edit state "SelfWeight//Total" hidden
- set solidLoad "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='SelfWeight$nd'\]"
- set solidLoadNode [customlib::AddConditionGroupOnXPath $solidLoad "SelfWeight//Total"]
- $solidLoadNode setAttribute ov volume
- set props [list ByFunction No modulus 9.81 direction 0.0,-1.0,0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidLoadNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Parallelism
- set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4]
- set time_params_path [spdAux::getRoute "Parallelization"]
- foreach {n v} $time_parameters {
- [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v
- }
-
-
- spdAux::RequestRefresh
-}
-proc Solid::examples::TreeAssignationDynamicRod2D {args} {
- set nd $::Model::SpatialDimension
- set root [customlib::GetBaseRoot]
-
- set condtype line
- if {$nd eq "3D"} { set condtype surface }
-
- # Dynamic solution strategy set
- spdAux::SetValueOnTreeItem v "Dynamic" SLSoluType
-
- # Time parameters
- set time_parameters [list EndTime 1.06 DeltaTime 0.01]
- set time_params_path [spdAux::getRoute SLTimeParameters]
- foreach {name value} $time_parameters {
- set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"]
- if {$node ne ""} {
- $node setAttribute v $value
- } else {
- W "Couldn't find $name - Check example script"
- }
- }
-
- # Solid Parts
- set solidParts [spdAux::getRoute "SLParts"]
- set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Solid]
- $solidPartsNode setAttribute ov surface
- set props [list Element TotalLagrangianElement$nd ConstitutiveLaw LargeStrain3DLaw.SaintVenantKirchhoffModel]
- foreach {prop val} $props {
- set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- set solidConditions [spdAux::getRoute "SLNodalConditions"]
-
- # Solid Constraint
- GiD_Groups clone Constraint Total
- GiD_Groups edit parent Total Constraint
- spdAux::AddIntervalGroup Constraint "Constraint//Total"
- GiD_Groups edit state "Constraint//Total" hidden
- set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Constraint//Total"]
- $solidConstraintNode setAttribute ov point
- set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y ByValue value_component_Y 0.0 selector_component_Z ByValue value_component_Z 0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Solid Loads
- GiD_Groups clone SelfWeight Total
- GiD_Groups edit parent Total SelfWeight
- spdAux::AddIntervalGroup SelfWeight "SelfWeight//Total"
- GiD_Groups edit state "SelfWeight//Total" hidden
- set solidLoad "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='SelfWeight$nd'\]"
- set solidLoadNode [customlib::AddConditionGroupOnXPath $solidLoad "SelfWeight//Total"]
- $solidLoadNode setAttribute ov surface
- set props [list ByFunction No modulus 9.81 direction 0.0,-1.0,0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidLoadNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Parallelism
- set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4]
- set time_params_path [spdAux::getRoute "Parallelization"]
- foreach {n v} $time_parameters {
- [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v
- }
-}
-proc Solid::examples::TreeAssignationDynamicRod2Da {args} {
- Kratos::ResetModel
-}
diff --git a/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.geo b/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.geo
deleted file mode 100644
index 27f7e44aa..000000000
Binary files a/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.geo and /dev/null differ
diff --git a/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.prj b/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.prj
deleted file mode 100644
index bb151ffae..000000000
--- a/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.prj
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- 85
- 1
- 4
-
-
- 1:3
- 2x3
- 2 3 2 3 2 3
-
-
-
-
diff --git a/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.vv b/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.vv
deleted file mode 100644
index bb19ca5af..000000000
--- a/kratos.gid/apps/Solid/examples/DynamicRod2D.gid/DynamicRod2D.vv
+++ /dev/null
@@ -1,37 +0,0 @@
-BeginZE /home/jmaria/Tests/DynamicRod2D.gid/DynamicRod2D.vv
- x -0.0860478430986404419 0.338547825813293457
- y 0.147866189479827881 -0.147866189479827881
- z -0.443598568439483643 0.443598568439483643
- e 0.147866189479827881
- v 0 0 0
- r 1
- m 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
- c 0.126249998807907104 0 -6.32091712304827524e-09
- pd 0
- pno 0
- pfo 0
- pf 4
- pv 0
- NowUse 0
- DrawingType 1
- LightVector 90 90 150 0
- OGLShadow(UseShadows) 0
- OGLShadow(RenderMode) RenderNice
- OGLShadow(ShadowBias) -0.002
- OGLShadow(AmbientShadows) 1
- OGLShadow(UseFBO) 1
- OGLShadow(FBOSize) 2048
- OGLShadow(DimmedLightFactor) 0.02
- OGLStereo(UseStereo) 0
- OGLStereo(RelativeEyeDistance) 1
- OGLStereo(FlipEyes) 0
- OGLStereo(StereoMode) AnaglyphColors
- OGLStereo(EyeDistance) 0.075
- OGLStereo(LeftEyeDistance) 1 0 0 1
- OGLStereo(RightEyeDistance) 0 1 1 1
-EndZE /home/jmaria/Tests/DynamicRod2D.gid/DynamicRod2D.vv
-
-BeginMirror
- Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror
-EndMirror
-
diff --git a/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.geo b/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.geo
deleted file mode 100644
index bf48e089e..000000000
Binary files a/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.geo and /dev/null differ
diff --git a/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.prj b/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.prj
deleted file mode 100644
index 310a40a41..000000000
--- a/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.prj
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- 116
- 1
- 2
-
-
- 8:19 31:33 40 53:56
- 1x20
- 1x20
-
-
- 1
- 2
- 3 4
-
-
-
-
diff --git a/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.vv b/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.vv
deleted file mode 100644
index dacde8124..000000000
--- a/kratos.gid/apps/Solid/examples/DynamicRod3D.gid/DynamicRod3D.vv
+++ /dev/null
@@ -1,37 +0,0 @@
-BeginZE /home/jmaria/Tests/DynamicRod3D.gid/DynamicRod3D.vv
- x -0.0906996056437492371 0.33330225944519043
- y 0.143511354923248291 -0.152221024036407471
- z -0.418598592281341553 0.468598544597625732
- e 0.147866189479827881
- v -0.155974417924880981 0.326733916997909546 0.115599974989891052
- r 0.924961388111114502
- m 0.759763181209564209 -0.315775305032730103 0.568371236324310303 0 0.111926771700382233 0.924617230892181396 0.364081501960754395 0 -0.640493810176849365 -0.21299976110458374 0.737833857536315918 0 0 0 0 1
- c 0.110273361206054688 6.73620590418977372e-08 -0.0249999910593032837
- pd 0
- pno 0
- pfo 0
- pf 4
- pv 0
- NowUse 0
- DrawingType 1
- LightVector 90 90 150 0
- OGLShadow(UseShadows) 0
- OGLShadow(RenderMode) RenderNice
- OGLShadow(ShadowBias) -0.002
- OGLShadow(AmbientShadows) 1
- OGLShadow(UseFBO) 1
- OGLShadow(FBOSize) 2048
- OGLShadow(DimmedLightFactor) 0.02
- OGLStereo(UseStereo) 0
- OGLStereo(RelativeEyeDistance) 1
- OGLStereo(FlipEyes) 0
- OGLStereo(StereoMode) AnaglyphColors
- OGLStereo(EyeDistance) 0.075
- OGLStereo(LeftEyeDistance) 1 0 0 1
- OGLStereo(RightEyeDistance) 0 1 1 1
-EndZE /home/jmaria/Tests/DynamicRod3D.gid/DynamicRod3D.vv
-
-BeginMirror
- Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror
-EndMirror
-
diff --git a/kratos.gid/apps/Solid/examples/EccentricColumn.tcl b/kratos.gid/apps/Solid/examples/EccentricColumn.tcl
deleted file mode 100644
index f6301d3f2..000000000
--- a/kratos.gid/apps/Solid/examples/EccentricColumn.tcl
+++ /dev/null
@@ -1,181 +0,0 @@
-
-proc ::Solid::examples::EccentricColumn {args} {
- if {![Kratos::IsModelEmpty]} {
- set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
- set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
- if { $retval == "cancel" } { return }
- }
- DrawEccentricColumnGeometry$::Model::SpatialDimension
- TreeAssignationEccentricColumn$::Model::SpatialDimension
-
- GiD_Process 'Redraw
- GidUtils::UpdateWindow GROUPS
- GidUtils::UpdateWindow LAYER
- GiD_Process 'Zoom Frame
-}
-
-
-# Draw Geometry
-proc Solid::examples::DrawEccentricColumnGeometry3D {args} {
- Kratos::ResetModel
- set dir [apps::getMyDir "Solid"]
- set problemfile [file join $dir examples EccentricColumn3D.gid]
- GiD_Process Mescape Files InsertGeom $problemfile
-}
-proc Solid::examples::DrawEccentricColumnGeometry2Da {args} {
- Kratos::ResetModel
-}
-proc Solid::examples::DrawEccentricColumnGeometry2D {args} {
- Kratos::ResetModel
-}
-# Mesh sizes
-
-
-# Tree assign
-proc Solid::examples::TreeAssignationEccentricColumn3D {args} {
- set nd $::Model::SpatialDimension
- set root [customlib::GetBaseRoot]
-
- set condtype line
- if {$nd eq "3D"} { set condtype surface }
-
- # Static solution strategy set
- spdAux::SetValueOnTreeItem v "Static" SLSoluType
-
- # Time parameters
- set time_parameters [list EndTime 1.0 DeltaTime 1.0]
- set time_params_path [spdAux::getRoute SLTimeParameters]
- foreach {name value} $time_parameters {
- set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"]
- if {$node ne ""} {
- $node setAttribute v $value
- } else {
- W "Couldn't find $name - Check example script"
- }
- }
-
- # Solid Parts
- set solidParts [spdAux::getRoute "SLParts"]
- set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Solid]
- $solidPartsNode setAttribute ov volume
- set props [list Element SmallDisplacementElement$nd ConstitutiveLaw SmallStrain3DLaw.LinearElasticModel]
- foreach {prop val} $props {
- set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- set solidConditions [spdAux::getRoute "SLNodalConditions"]
-
- # Solid Constraint
- GiD_Groups clone ConstraintX Total
- GiD_Groups edit parent Total ConstraintX
- spdAux::AddIntervalGroup ConstraintX "ConstraintX//Total"
- GiD_Groups edit state "ConstraintX//Total" hidden
- set solidConstraintX {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintXNode [customlib::AddConditionGroupOnXPath $solidConstraintX "ConstraintX//Total"]
- $solidConstraintXNode setAttribute ov line
- set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y Not selector_component_Z Not Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintXNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone ConstraintZ Total
- GiD_Groups edit parent Total ConstraintZ
- spdAux::AddIntervalGroup ConstraintZ "ConstraintZ//Total"
- GiD_Groups edit state "ConstraintZ//Total" hidden
- set solidConstraintZ {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintZNode [customlib::AddConditionGroupOnXPath $solidConstraintZ "ConstraintZ//Total"]
- $solidConstraintZNode setAttribute ov line
- set props [list selector_component_X Not selector_component_Y Not selector_component_Z ByValue value_component_Z 0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintZNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Solid Loads
- GiD_Groups clone SelfWeight Total
- GiD_Groups edit parent Total SelfWeight
- spdAux::AddIntervalGroup SelfWeight "SelfWeight//Total"
- GiD_Groups edit state "SelfWeight//Total" hidden
- set solidLoad "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='SelfWeight$nd'\]"
- set solidLoadNode [customlib::AddConditionGroupOnXPath $solidLoad "SelfWeight//Total"]
- $solidLoadNode setAttribute ov volume
- set props [list ByFunction No modulus 9.81 direction 0.0,-1.0,0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidLoadNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone Load Total
- GiD_Groups edit parent Total Load
- spdAux::AddIntervalGroup Load "Load//Total"
- GiD_Groups edit state "Load//Total" hidden
- set solidLoad "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Load$nd'\]"
- set solidLoadNode [customlib::AddConditionGroupOnXPath $solidLoad "Load//Total"]
- $solidLoadNode setAttribute ov surface
- set props [list ByFunction No modulus 4.44e6 direction 0.0,-1.0,0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidLoadNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone Spring Total
- GiD_Groups edit parent Total Spring
- spdAux::AddIntervalGroup Spring "Spring//Total"
- GiD_Groups edit state "Spring//Total" hidden
- set solidSpring "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Spring$nd'\]"
- set solidSpringNode [customlib::AddConditionGroupOnXPath $solidSpring "Spring//Total"]
- $solidSpringNode setAttribute ov surface
- set props [list ByFunction No modulus 50e6 direction 0.0,1.0,0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidSpringNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Parallelism
- set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4]
- set time_params_path [spdAux::getRoute "Parallelization"]
- foreach {n v} $time_parameters {
- [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v
- }
-
- # Solver
- set solver_parameters [list Solver amgcl max_iteration 2000 tolerance 1e-6 krylov_type cg]
- set solver_params_path [spdAux::getRoute "SLStaticlinear_solver_settings"]
- foreach {n v} $solver_parameters {
- [$root selectNodes "$solver_params_path/value\[@n = '$n'\]"] setAttribute v $v
- }
-
- spdAux::RequestRefresh
-}
-proc Solid::examples::TreeAssignationEccentricColumn2Da {args} {
- Kratos::ResetModel
-}
-proc Solid::examples::TreeAssignationEccentricColumn2D {args} {
- Kratos::ResetModel
-}
diff --git a/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.geo b/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.geo
deleted file mode 100644
index 59e6badc1..000000000
Binary files a/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.geo and /dev/null differ
diff --git a/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.prj b/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.prj
deleted file mode 100644
index 29a1ac92a..000000000
--- a/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.prj
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 10 12
- 1 1
- 6 5
-
-
- 4 6 7 25 35
- 1x5
- 4x4 2
-
-
- 2:9
- 2x8
- 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3
-
-
-
-
diff --git a/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.vv b/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.vv
deleted file mode 100644
index 97c55a377..000000000
--- a/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.vv
+++ /dev/null
@@ -1,37 +0,0 @@
-BeginZE /home/cpuigbo/GiDInterface/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.vv
- x -3.94726991653442383 5.74480867385864258
- y 6.39163064956665039 -1.58742785453796387
- z -2.95716428756713867 3.97514200210571289
- e 2.76385402679443359
- v -0.0793274012290671182 0.899682501223218134 0.174501511325530018
- r 0.392208881101695939
- m -0.679758787155151367 -0.279621034860610962 0.678041458129882812 0 -0.00585686462000012398 0.926512777805328369 0.37621772289276123 0 -0.733412444591522217 0.251766085624694824 -0.631442904472351074 0 0 0 0 1
- c 0.508988738059997559 1.8859550952911377 -0.508988738059997559
- pd 0
- pno 0
- pfo 0
- pf 4
- pv 0
- NowUse 0
- DrawingType 1
- LightVector 90 90 150 0
- OGLShadow(UseShadows) 0
- OGLShadow(RenderMode) RenderNice
- OGLShadow(ShadowBias) -0.002
- OGLShadow(AmbientShadows) 1
- OGLShadow(UseFBO) 0
- OGLShadow(FBOSize) 2048
- OGLShadow(DimmedLightFactor) 0.02
- OGLStereo(UseStereo) 0
- OGLStereo(RelativeEyeDistance) 1
- OGLStereo(FlipEyes) 0
- OGLStereo(StereoMode) AnaglyphColors
- OGLStereo(EyeDistance) 0.075
- OGLStereo(LeftEyeDistance) 1 0 0 1
- OGLStereo(RightEyeDistance) 0 1 1 1
-EndZE /home/cpuigbo/GiDInterface/kratos.gid/apps/Solid/examples/EccentricColumn3D.gid/EccentricColumn3D.vv
-
-BeginMirror
- Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror
-EndMirror
-
diff --git a/kratos.gid/apps/Solid/examples/NotchedBeam.tcl b/kratos.gid/apps/Solid/examples/NotchedBeam.tcl
deleted file mode 100644
index acd3a3688..000000000
--- a/kratos.gid/apps/Solid/examples/NotchedBeam.tcl
+++ /dev/null
@@ -1,164 +0,0 @@
-
-proc ::Solid::examples::NotchedBeam {args} {
- if {![Kratos::IsModelEmpty]} {
- set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
- set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
- if { $retval == "cancel" } { return }
- }
- DrawNotchedBeamGeometry$::Model::SpatialDimension
- TreeAssignationNotchedBeam$::Model::SpatialDimension
-
- GiD_Process 'Redraw
- GidUtils::UpdateWindow GROUPS
- GidUtils::UpdateWindow LAYER
- GiD_Process 'Zoom Frame
-}
-
-
-# Draw Geometry
-proc Solid::examples::DrawNotchedBeamGeometry3D {args} {
- Kratos::ResetModel
-}
-proc Solid::examples::DrawNotchedBeamGeometry2D {args} {
- Kratos::ResetModel
- set dir [apps::getMyDir "Solid"]
- set problemfile [file join $dir examples NotchedBeam2D.gid]
- GiD_Process Mescape Files InsertGeom $problemfile
-}
-proc Solid::examples::DrawNotchedBeamGeometry2Da {args} {
- Kratos::ResetModel
-}
-# Mesh sizes
-
-
-# Tree assign
-proc Solid::examples::TreeAssignationNotchedBeam3D {args} {
- Kratos::ResetModel
-}
-proc Solid::examples::TreeAssignationNotchedBeam2D {args} {
- set nd $::Model::SpatialDimension
- set root [customlib::GetBaseRoot]
-
- set condtype line
- if {$nd eq "3D"} { set condtype surface }
-
- # Quasi-static solution strategy set
- spdAux::SetValueOnTreeItem v "Quasi-static" SLSoluType
- spdAux::SetValueOnTreeItem v "Non-linear" SLAnalysisType
-
- # Time parameters
- set time_parameters [list EndTime 200 DeltaTime 1]
- set time_params_path [spdAux::getRoute SLTimeParameters]
- foreach {name value} $time_parameters {
- set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"]
- if {$node ne ""} {
- $node setAttribute v $value
- } else {
- W "Couldn't find $name - Check example script"
- }
- }
-
- # Solid Parts
- set solidParts [spdAux::getRoute "SLParts"]
- set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Solid]
- $solidPartsNode setAttribute ov surface
- set props [list Element SmallDisplacementElement$nd ConstitutiveLaw SmallStrainPlaneStress2DLaw.SimoJuExponentialDamageModel DENSITY 2500 YOUNG_MODULUS 2.8e10 POISSON_RATIO 0.1 THICKNESS 0.1 DAMAGE_THRESHOLD 19.1237 STRENGTH_RATIO 10.9375 FRACTURE_ENERGY 140]
- foreach {prop val} $props {
- set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- set solidConditions [spdAux::getRoute "SLNodalConditions"]
-
- # Solid Constraint
- GiD_Groups clone ConstraintXY Total
- GiD_Groups edit parent Total ConstraintXY
- spdAux::AddIntervalGroup ConstraintXY "ConstraintXY//Total"
- GiD_Groups edit state "ConstraintXY//Total" hidden
- set solidConstraintXY {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintXYNode [customlib::AddConditionGroupOnXPath $solidConstraintXY "ConstraintXY//Total"]
- $solidConstraintXYNode setAttribute ov line
- set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y ByValue value_component_Y 0.0 selector_component_Z Not Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintXYNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Solid Constraint
- GiD_Groups clone ConstraintY Total
- GiD_Groups edit parent Total ConstraintY
- spdAux::AddIntervalGroup ConstraintY "ConstraintY//Total"
- GiD_Groups edit state "ConstraintY//Total" hidden
- set solidConstraintY {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintYNode [customlib::AddConditionGroupOnXPath $solidConstraintY "ConstraintY//Total"]
- $solidConstraintYNode setAttribute ov line
- set props [list selector_component_X Not selector_component_Y Not selector_component_Z ByValue value_component_Z 0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintYNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Solid Loads
- GiD_Groups clone LoadY Total
- GiD_Groups edit parent Total LoadY
- spdAux::AddIntervalGroup LoadY "LoadY//Total"
- GiD_Groups edit state "LoadY//Total" hidden
- set solidLoadY "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Load$nd'\]"
- set solidLoadYNode [customlib::AddConditionGroupOnXPath $solidLoadY "LoadY//Total"]
- $solidLoadYNode setAttribute ov line
- set props [list ByFunction Yes function_modulus "3000*t" direction 0.0,-1.0,0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidLoadYNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone LoadYY Total
- GiD_Groups edit parent Total LoadYY
- spdAux::AddIntervalGroup LoadYY "LoadYY//Total"
- GiD_Groups edit state "LoadYY//Total" hidden
- set solidLoadYY "container\[@n='Solid'\]/container\[@n='Loads'\]/condition\[@n='Load$nd'\]"
- set solidLoadYYNode [customlib::AddConditionGroupOnXPath $solidLoadYY "LoadYY//Total"]
- $solidLoadYYNode setAttribute ov line
- set props [list ByFunction Yes function_modulus "30000*t" direction 0.0,-1.0,0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidLoadYYNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Parallelism
- set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4]
- set time_params_path [spdAux::getRoute "Parallelization"]
- foreach {n v} $time_parameters {
- [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v
- }
- # Output
- set output_parameters [list DAMAGE_VARIABLE Yes]
- set output_params_path [spdAux::getRoute "ElementResults"]
- foreach {n v} $output_parameters {
- [$root selectNodes "$output_params_path/value\[@n = '$n'\]"] setAttribute v $v
- }
- spdAux::RequestRefresh
-}
-proc Solid::examples::TreeAssignationNotchedBeam2Da {args} {
- Kratos::ResetModel
-}
diff --git a/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.geo b/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.geo
deleted file mode 100644
index 4ee2b07dd..000000000
Binary files a/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.geo and /dev/null differ
diff --git a/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.prj b/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.prj
deleted file mode 100644
index 0da43773f..000000000
--- a/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.prj
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- 21 24 27 30
- 1x4
- 3 2 4 5
-
-
- 3:5
- 1x3
- 1x3
-
-
-
-
diff --git a/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.vv b/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.vv
deleted file mode 100644
index b1e32bd49..000000000
--- a/kratos.gid/apps/Solid/examples/NotchedBeam2D.gid/NotchedBeam2D.vv
+++ /dev/null
@@ -1,37 +0,0 @@
-BeginZE /home/josep_maria/Desktop/damage/NotchedBeam2D.gid/NotchedBeam2D.vv
- x -0.387526094913482666 1.22752606868743896
- y 0.564327478408813477 -0.364327490329742432
- z -1.39298248291015625 1.39298248291015625
- e 0.464327484369277954
- v -0 -0 -8.74227765734758577e-08
- r -1
- m 1 -1.74845553146951715e-07 0 0 1.74845553146951715e-07 1 0 0 0 0 1 0 0 0 0 1
- c 0.419999986886978149 0.118095241487026215 0
- pd 0
- pno 0
- pfo 0
- pf 4
- pv 0
- NowUse 0
- DrawingType 1
- LightVector 90 90 150 0
- OGLShadow(UseShadows) 0
- OGLShadow(RenderMode) RenderNice
- OGLShadow(ShadowBias) -0.002
- OGLShadow(AmbientShadows) 1
- OGLShadow(UseFBO) 0
- OGLShadow(FBOSize) 2048
- OGLShadow(DimmedLightFactor) 0.02
- OGLStereo(UseStereo) 0
- OGLStereo(RelativeEyeDistance) 1
- OGLStereo(FlipEyes) 0
- OGLStereo(StereoMode) AnaglyphColors
- OGLStereo(EyeDistance) 0.075
- OGLStereo(LeftEyeDistance) 1 0 0 1
- OGLStereo(RightEyeDistance) 0 1 1 1
-EndZE /home/josep_maria/Desktop/damage/NotchedBeam2D.gid/NotchedBeam2D.vv
-
-BeginMirror
- Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror
-EndMirror
-
diff --git a/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.geo b/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.geo
deleted file mode 100644
index 5f3a05b9f..000000000
Binary files a/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.geo and /dev/null differ
diff --git a/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.prj b/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.prj
deleted file mode 100644
index d92ec5512..000000000
--- a/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.prj
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1:6 18 27:32 100018
- 1x14
- 19 20 19 19 16 19 17 15x4 18 15 17
-
-
- 1:24 100001:100024 1000007:1000018 1000020:1000025
- 1x66
- 1x48 14x18
-
-
-
-
diff --git a/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.vv b/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.vv
deleted file mode 100644
index f545aaa7e..000000000
--- a/kratos.gid/apps/Solid/examples/StaticBeamLattice.gid/StaticBeamLattice.vv
+++ /dev/null
@@ -1,37 +0,0 @@
-BeginZE /home/jmaria/Desktop/StaticBeamLattice.gid/StaticBeamLattice.vv
- x -6.89991378784179688 6.89991378784179688
- y 15.3079414367675781 -4.42514467239379883
- z -20.6997413635253906 20.6997413635253906
- e 6.89991378784179688
- v 0.257072094239774285 -0.00642424184424369993 0.00395524515450007726
- r -0.966362780489641304
- m 0.999886155128479004 0.00434141699224710464 0.0144498627632856369 0 -0.0109473904594779015 0.867796599864959717 0.496798992156982422 0 -0.0103827305138111115 -0.496900618076324463 0.867745339870452881 0 0 0 0 1
- c 0 5.44139814376831055 0
- pd 0
- pno 0
- pfo 0
- pf 4
- pv 0
- NowUse 0
- DrawingType 0
- LightVector 90 90 150 0
- OGLShadow(UseShadows) 0
- OGLShadow(RenderMode) RenderNice
- OGLShadow(ShadowBias) -0.002
- OGLShadow(AmbientShadows) 1
- OGLShadow(UseFBO) 0
- OGLShadow(FBOSize) 2048
- OGLShadow(DimmedLightFactor) 0.02
- OGLStereo(UseStereo) 0
- OGLStereo(RelativeEyeDistance) 1
- OGLStereo(FlipEyes) 0
- OGLStereo(StereoMode) AnaglyphColors
- OGLStereo(EyeDistance) 0.075
- OGLStereo(LeftEyeDistance) 1 0 0 1
- OGLStereo(RightEyeDistance) 0 1 1 1
-EndZE /home/jmaria/Desktop/StaticBeamLattice.gid/StaticBeamLattice.vv
-
-BeginMirror
- Mirror 0 Angle 0.0 AngleFake -15.0 SizeFactor 2.0 HeightOffset 0.25 Color #d9e5f24d Backlight Off EdgeStyle No Type Scene DrawMode Mirror
-EndMirror
-
diff --git a/kratos.gid/apps/Solid/examples/StaticBeamLattice.tcl b/kratos.gid/apps/Solid/examples/StaticBeamLattice.tcl
deleted file mode 100644
index bffb42d84..000000000
--- a/kratos.gid/apps/Solid/examples/StaticBeamLattice.tcl
+++ /dev/null
@@ -1,204 +0,0 @@
-
-proc ::Solid::examples::StaticBeamLattice {args} {
- if {![Kratos::IsModelEmpty]} {
- set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
- set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
- if { $retval == "cancel" } { return }
- }
- DrawStaticBeamLatticeGeometry$::Model::SpatialDimension
- TreeAssignationStaticBeamLattice$::Model::SpatialDimension
-
- GiD_Process 'Redraw
- GidUtils::UpdateWindow GROUPS
- GidUtils::UpdateWindow LAYER
- GiD_Process 'Zoom Frame
-}
-
-
-# Draw Geometry
-proc Solid::examples::DrawStaticBeamLatticeGeometry3D {args} {
- Kratos::ResetModel
- set dir [apps::getMyDir "Solid"]
- set problemfile [file join $dir examples StaticBeamLattice.gid]
- GiD_Process Mescape Files InsertGeom $problemfile
-}
-proc Solid::examples::DrawStaticBeamLatticeGeometry2Da {args} {
- Kratos::ResetModel
-}
-proc Solid::examples::DrawStaticBeamLatticeGeometry2D {args} {
- Kratos::ResetModel
-}
-# Mesh sizes
-
-
-# Tree assign
-proc Solid::examples::TreeAssignationStaticBeamLattice3D {args} {
- set nd $::Model::SpatialDimension
- set root [customlib::GetBaseRoot]
-
- set condtype point
-
- # Static solution strategy set
- spdAux::SetValueOnTreeItem v "Quasi-static" SLSoluType
- spdAux::SetValueOnTreeItem v "StaticStep" SLScheme
-
- # Time parameters
- set time_parameters [list EndTime 1.6e2 DeltaTime 5.0]
- set time_params_path [spdAux::getRoute SLTimeParameters]
- foreach {name value} $time_parameters {
- set node [$root selectNodes "$time_params_path/value\[@n = '$name'\]"]
- if {$node ne ""} {
- $node setAttribute v $value
- } else {
- W "Couldn't find $name - Check example script"
- }
- }
-
- # Solid Parts
- set solidParts [spdAux::getRoute "SLParts"]
- set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Wires]
- $solidPartsNode setAttribute ov line
- set props [list Element LargeDisplacementBeamElement3D ConstitutiveLaw UserDefined3D DENSITY 2650 CROSS_SECTION_AREA 7.85e-4 YOUNG_MODULUS 83.0e15 INERTIA_X 4.9E-6 INERTIA_Y 4.9E-6]
- foreach {prop val} $props {
- set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- set solidPartsNode [customlib::AddConditionGroupOnXPath $solidParts Connectors]
- $solidPartsNode setAttribute ov line
- set props [list Element LargeDisplacementBeamElement3D ConstitutiveLaw UserDefined3D DENSITY 2650 CROSS_SECTION_AREA 7.85e-4 YOUNG_MODULUS 83.0e15 INERTIA_X 1.0E-6 INERTIA_Y 1.0E-6]
- foreach {prop val} $props {
- set propnode [$solidPartsNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- spdAux::RequestRefresh
- set solidConditions [spdAux::getRoute "SLNodalConditions"]
-
- # Solid Constraint
- GiD_Groups clone Displacement1 Total
- GiD_Groups edit parent Total Displacement1
- spdAux::AddIntervalGroup Displacement1 "Displacement1//Total"
- GiD_Groups edit state "Displacement1//Total" hidden
- set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Displacement1//Total"]
- $solidConstraintNode setAttribute ov point
- set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y ByValue value_component_Y 0.0 selector_component_Z ByValue value_component_Z 0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone Displacement2 Total
- GiD_Groups edit parent Total Displacement2
- spdAux::AddIntervalGroup Displacement2 "Displacement2//Total"
- GiD_Groups edit state "Displacement2//Total" hidden
- set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Displacement2//Total"]
- $solidConstraintNode setAttribute ov point
- set props [list selector_component_X Not selector_component_Y ByFunction function_component_Y "1.0e-2*t" selector_component_Z Not Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone Displacement3 Total
- GiD_Groups edit parent Total Displacement3
- spdAux::AddIntervalGroup Displacement3 "Displacement3//Total"
- GiD_Groups edit state "Displacement3//Total" hidden
- set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Displacement3//Total"]
- $solidConstraintNode setAttribute ov point
- set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y ByValue value_component_Y 0.0 selector_component_Z ByValue value_component_Z 0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone Displacement4 Total
- GiD_Groups edit parent Total Displacement4
- spdAux::AddIntervalGroup Displacement4 "Displacement4//Total"
- GiD_Groups edit state "Displacement4//Total" hidden
- set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Displacement4//Total"]
- $solidConstraintNode setAttribute ov point
- set props [list selector_component_X ByValue value_component_X 0.0 selector_component_Y ByFunction function_component_Y "1.0e-2*t" selector_component_Z ByValue value_component_Z 0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone Displacement5 Total
- GiD_Groups edit parent Total Displacement5
- spdAux::AddIntervalGroup Displacement5 "Displacement5//Total"
- GiD_Groups edit state "Displacement5//Total" hidden
- set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Displacement5//Total"]
- $solidConstraintNode setAttribute ov point
- set props [list selector_component_X Not value_component_X 0.0 selector_component_Y ByValue value_component_Y 0.0 selector_component_Z Not Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- GiD_Groups clone Displacement6 Total
- GiD_Groups edit parent Total Displacement6
- spdAux::AddIntervalGroup Displacement6 "Displacement6//Total"
- GiD_Groups edit state "Displacement6//Total" hidden
- set solidConstraint {container[@n='Solid']/container[@n='Boundary Conditions']/condition[@n='DISPLACEMENT']}
- set solidConstraintNode [customlib::AddConditionGroupOnXPath $solidConstraint "Displacement6//Total"]
- $solidConstraintNode setAttribute ov point
- set props [list selector_component_X Not selector_component_Y ByValue value_component_Y 0.0 selector_component_Z ByValue value_component_Z 0.0 Interval Total]
- foreach {prop val} $props {
- set propnode [$solidConstraintNode selectNodes "./value\[@n = '$prop'\]"]
- if {$propnode ne "" } {
- $propnode setAttribute v $val
- } else {
- W "Warning - Couldn't find property Solid $prop"
- }
- }
-
- # Parallelism
- set time_parameters [list ParallelSolutionType OpenMP OpenMPNumberOfThreads 4]
- set time_params_path [spdAux::getRoute "Parallelization"]
- foreach {n v} $time_parameters {
- [$root selectNodes "$time_params_path/value\[@n = '$n'\]"] setAttribute v $v
- }
-
-
- spdAux::RequestRefresh
-}
-proc Solid::examples::TreeAssignationStaticBeamLattice2Da {args} {
- Kratos::ResetModel
-}
-proc Solid::examples::TreeAssignationStaticBeamLattice2D {args} {
- Kratos::ResetModel
-}
diff --git a/kratos.gid/apps/Solid/examples/examples.tcl b/kratos.gid/apps/Solid/examples/examples.tcl
deleted file mode 100644
index 046f1c732..000000000
--- a/kratos.gid/apps/Solid/examples/examples.tcl
+++ /dev/null
@@ -1,41 +0,0 @@
-namespace eval Solid::examples {
-
-}
-
-proc Solid::examples::Init { } {
- uplevel #0 [list source [file join $::Solid::dir examples DynamicBeam.tcl]]
- uplevel #0 [list source [file join $::Solid::dir examples CircularTank.tcl]]
- uplevel #0 [list source [file join $::Solid::dir examples EccentricColumn.tcl]]
- uplevel #0 [list source [file join $::Solid::dir examples DynamicRod.tcl]]
- uplevel #0 [list source [file join $::Solid::dir examples NotchedBeam.tcl]]
- uplevel #0 [list source [file join $::Solid::dir examples StaticBeamLattice.tcl]]
-}
-
-proc Solid::examples::UpdateMenus3D { } {
- set menu_id 7
- GiDMenu::InsertOption "Kratos" [list "DynamicBeam" ] [incr menu_id] PRE [list ::Solid::examples::DynamicBeam] "" "" insertbefore =
- GiDMenu::InsertOption "Kratos" [list "CircularTank" ] [incr menu_id] PRE [list ::Solid::examples::CircularTank] "" "" insertbefore =
- GiDMenu::InsertOption "Kratos" [list "EccentricColumn" ] [incr menu_id] PRE [list ::Solid::examples::EccentricColumn] "" "" insertbefore =
- GiDMenu::InsertOption "Kratos" [list "DynamicRod" ] [incr menu_id] PRE [list ::Solid::examples::DynamicRod] "" "" insertbefore =
- GiDMenu::InsertOption "Kratos" [list "StaticBeamLattice" ] [incr menu_id] PRE [list ::Solid::examples::StaticBeamLattice] "" "" insertbefore =
- GiDMenu::InsertOption "Kratos" [list "---"] [incr menu_id] PRE "" "" "" insertbefore =
- GiDMenu::UpdateMenus
-}
-
-proc Solid::examples::UpdateMenus2D { } {
- set menu_id 7
- GiDMenu::InsertOption "Kratos" [list "NotchedBeam" ] [incr menu_id] PRE [list ::Solid::examples::NotchedBeam] "" "" insertbefore =
- GiDMenu::InsertOption "Kratos" [list "DynamicRod" ] [incr menu_id] PRE [list ::Solid::examples::DynamicRod] "" "" insertbefore =
- GiDMenu::InsertOption "Kratos" [list "---"] [incr menu_id] PRE "" "" "" insertbefore =
- GiDMenu::UpdateMenus
-}
-
-proc Solid::examples::UpdateMenus2Da { } {
- set menu_id 7
- GiDMenu::InsertOption "Kratos" [list "CircularTank" ] [incr menu_id] PRE [list ::Solid::examples::CircularTank] "" "" insertbefore =
- GiDMenu::InsertOption "Kratos" [list "---"] [incr menu_id] PRE "" "" "" insertbefore =
- GiDMenu::UpdateMenus
-}
-
-
-Solid::examples::Init
diff --git a/kratos.gid/apps/Solid/images/2D.png b/kratos.gid/apps/Solid/images/2D.png
deleted file mode 100644
index b7ea880e0..000000000
Binary files a/kratos.gid/apps/Solid/images/2D.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/2Da.png b/kratos.gid/apps/Solid/images/2Da.png
deleted file mode 100644
index 177ed86fc..000000000
Binary files a/kratos.gid/apps/Solid/images/2Da.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/3D.png b/kratos.gid/apps/Solid/images/3D.png
deleted file mode 100644
index 6b418ad8e..000000000
Binary files a/kratos.gid/apps/Solid/images/3D.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/analysis_type.png b/kratos.gid/apps/Solid/images/Black/analysis_type.png
deleted file mode 100644
index e9518e1c7..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/analysis_type.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/beam_example.png b/kratos.gid/apps/Solid/images/Black/beam_example.png
deleted file mode 100644
index a63274eab..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/beam_example.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/bodies.png b/kratos.gid/apps/Solid/images/Black/bodies.png
deleted file mode 100644
index d25725f10..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/bodies.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/boundaryConditions.png b/kratos.gid/apps/Solid/images/Black/boundaryConditions.png
deleted file mode 100644
index 7a53439e5..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/boundaryConditions.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/cancelProcess.png b/kratos.gid/apps/Solid/images/Black/cancelProcess.png
deleted file mode 100644
index 6f0580957..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/cancelProcess.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/column_example.png b/kratos.gid/apps/Solid/images/Black/column_example.png
deleted file mode 100644
index c79c11f1e..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/column_example.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/contactStrategy.png b/kratos.gid/apps/Solid/images/Black/contactStrategy.png
deleted file mode 100644
index e5fec1056..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/contactStrategy.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/data.png b/kratos.gid/apps/Solid/images/Black/data.png
deleted file mode 100644
index 0a9012afb..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/data.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/doRestart.png b/kratos.gid/apps/Solid/images/Black/doRestart.png
deleted file mode 100644
index 4f5a443ac..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/doRestart.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/folder.png b/kratos.gid/apps/Solid/images/Black/folder.png
deleted file mode 100644
index 9b967fc38..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/folder.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/groupCreated.png b/kratos.gid/apps/Solid/images/Black/groupCreated.png
deleted file mode 100644
index f174a291e..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/groupCreated.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/linear_solver.png b/kratos.gid/apps/Solid/images/Black/linear_solver.png
deleted file mode 100644
index 80f0f7307..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/linear_solver.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/meshingStrategies.png b/kratos.gid/apps/Solid/images/Black/meshingStrategies.png
deleted file mode 100644
index 194b27976..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/meshingStrategies.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/modelProperties.png b/kratos.gid/apps/Solid/images/Black/modelProperties.png
deleted file mode 100644
index 5bd3d0c2c..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/modelProperties.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/notched_example.png b/kratos.gid/apps/Solid/images/Black/notched_example.png
deleted file mode 100644
index f1237083b..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/notched_example.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/parallel_type.png b/kratos.gid/apps/Solid/images/Black/parallel_type.png
deleted file mode 100644
index 32ddaae50..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/parallel_type.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/rod_example.png b/kratos.gid/apps/Solid/images/Black/rod_example.png
deleted file mode 100644
index aba87579f..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/rod_example.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/runSimulation.png b/kratos.gid/apps/Solid/images/Black/runSimulation.png
deleted file mode 100644
index 37a16063a..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/runSimulation.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/seeResults.png b/kratos.gid/apps/Solid/images/Black/seeResults.png
deleted file mode 100644
index 0137561eb..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/seeResults.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/select.png b/kratos.gid/apps/Solid/images/Black/select.png
deleted file mode 100644
index 5e245deeb..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/select.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/setLoad.png b/kratos.gid/apps/Solid/images/Black/setLoad.png
deleted file mode 100644
index 066f81048..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/setLoad.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/setUnits.png b/kratos.gid/apps/Solid/images/Black/setUnits.png
deleted file mode 100644
index f9d191505..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/setUnits.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/sheets.png b/kratos.gid/apps/Solid/images/Black/sheets.png
deleted file mode 100644
index d1d70413c..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/sheets.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/solid.png b/kratos.gid/apps/Solid/images/Black/solid.png
deleted file mode 100644
index 29241370a..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/solid.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/solvers.png b/kratos.gid/apps/Solid/images/Black/solvers.png
deleted file mode 100644
index 72773b5db..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/solvers.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/tank_example.png b/kratos.gid/apps/Solid/images/Black/tank_example.png
deleted file mode 100644
index ae08e734a..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/tank_example.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/timeIntervals.png b/kratos.gid/apps/Solid/images/Black/timeIntervals.png
deleted file mode 100644
index 5555fa5d7..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/timeIntervals.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/timeParameters.png b/kratos.gid/apps/Solid/images/Black/timeParameters.png
deleted file mode 100644
index 2400bd6a5..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/timeParameters.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/tree.png b/kratos.gid/apps/Solid/images/Black/tree.png
deleted file mode 100644
index c3839cc21..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/tree.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/Black/view.png b/kratos.gid/apps/Solid/images/Black/view.png
deleted file mode 100644
index 84569e82d..000000000
Binary files a/kratos.gid/apps/Solid/images/Black/view.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/analysis_type.png b/kratos.gid/apps/Solid/images/analysis_type.png
deleted file mode 100644
index cdb4a00a4..000000000
Binary files a/kratos.gid/apps/Solid/images/analysis_type.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/beam_example.png b/kratos.gid/apps/Solid/images/beam_example.png
deleted file mode 100644
index ceaadf8df..000000000
Binary files a/kratos.gid/apps/Solid/images/beam_example.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/column_example.png b/kratos.gid/apps/Solid/images/column_example.png
deleted file mode 100644
index 7be554b56..000000000
Binary files a/kratos.gid/apps/Solid/images/column_example.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/conditions/arrow.msh b/kratos.gid/apps/Solid/images/conditions/arrow.msh
deleted file mode 100644
index 1b1accda0..000000000
--- a/kratos.gid/apps/Solid/images/conditions/arrow.msh
+++ /dev/null
@@ -1,53 +0,0 @@
-MESH dimension 3 ElemType Triangle Nnode 3
-Coordinates
- 1 1 0 0
- 2 0.625 -0.0999999958 3.47613295e-08
- 3 0.625 0.0999999958 3.47613296e-08
- 4 0.625 0.07071064 0.0707107146
- 5 0.625 -0.07071064 0.0707107146
- 6 0.625 -0.0707106906 -0.0707106655
- 7 0.625 0.0707106906 -0.0707106655
- 8 0.625 0 0.1
- 9 0.625 2.32452946e-16 -0.1
- 10 0.625 -0.2 2.34324128e-10
- 11 0.625 0.141421356 -0.141421356
- 12 0.625 0.141421357 0.141421356
- 13 0.625 -0.141421356 -0.141421356
- 14 0.625 -0.141421356 0.141421356
- 15 0.625 0 -0.2
- 16 0.625 0 0.2
- 17 0.625 0.2 -2.31773376e-10
- 18 0 0.0707106781 -0.0707106782
- 19 0 -0.0707106781 0.0707106782
- 20 0 -0.1 1.1713931e-10
- 21 0 -0.0707106781 -0.0707106782
- 22 0 4.38538095e-14 -0.1
- 23 0 0.0707106783 0.070710678
- 24 0 0.1 -1.15863951e-10
- 25 0 0 0.1
-End Coordinates
-
-Elements
-1 1 15 13
-2 1 13 10
-3 1 10 14
-4 1 14 16
-5 1 16 12
-6 1 12 17
-7 1 17 11
-8 1 11 15
-End Elements
-MESH dimension 3 ElemType Quadrilateral Nnode 4
-Coordinates
-End Coordinates
-
-Elements
-9 8 4 23 25
-10 4 3 24 23
-11 3 7 18 24
-12 7 9 22 18
-13 25 19 5 8
-14 19 20 2 5
-15 20 21 6 2
-16 21 22 9 6
-End Elements
diff --git a/kratos.gid/apps/Solid/images/conditions/displacement.png b/kratos.gid/apps/Solid/images/conditions/displacement.png
deleted file mode 100644
index 0760c9778..000000000
Binary files a/kratos.gid/apps/Solid/images/conditions/displacement.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/conditions/selfweight.msh b/kratos.gid/apps/Solid/images/conditions/selfweight.msh
deleted file mode 100644
index 7d29f3f3a..000000000
--- a/kratos.gid/apps/Solid/images/conditions/selfweight.msh
+++ /dev/null
@@ -1,38 +0,0 @@
-MESH dimension 3 ElemType Quadrilateral Nnode 4
-Coordinates
- 1 1 -1 0
- 2 0.7 -0.7 1.8
- 3 1 1 0
- 4 -1 -1 0
- 5 0.0866025404 -0.05 1.8
- 6 -0 -0.1 1.8
- 7 0.0866025404 0.05 1.8
- 8 -0.0866025404 -0.05 1.8
- 9 0 0.1 1.8
- 10 -0.0866025404 0.05 1.8
- 11 0.0866025404 -0.05 2
- 12 -0 -0.1 2
- 13 0.0866025404 0.05 2
- 14 -0.0866025404 -0.05 2
- 15 0 0.1 2
- 16 -0.7 -0.7 1.8
- 17 0.7 0.7 1.8
- 18 -0.0866025404 0.05 2
- 19 -1 1 0
- 20 -0.7 0.7 1.8
-End Coordinates
-
-Elements
-1 1 3 19 4
-2 2 17 20 16
-3 19 20 16 4
-4 3 17 20 19
-5 1 2 17 3
-6 4 16 2 1
-7 15 18 10 9
-8 18 14 8 10
-9 14 12 6 8
-10 12 11 5 6
-11 11 13 7 5
-12 13 15 9 7
-End Elements
diff --git a/kratos.gid/apps/Solid/images/conditions/spring.msh b/kratos.gid/apps/Solid/images/conditions/spring.msh
deleted file mode 100644
index c975aff16..000000000
--- a/kratos.gid/apps/Solid/images/conditions/spring.msh
+++ /dev/null
@@ -1,430 +0,0 @@
-MESH dimension 3 ElemType Quadrilateral Nnode 4
-Coordinates
- 1 -0.473042225 0.0999999574 -0.000170817993
- 2 -0.451464987 0.0600173227 0.0355144756
- 3 -0.494619463 0.0599264309 -0.0357540131
- 4 -0.446077782 5.68310897e-05 0.044487789
- 5 -0.500006668 -5.67536713e-05 -0.0445743572
- 6 -0.451464987 -0.0599263528 0.0356674452
- 7 -0.494619463 -0.0600172453 -0.0356010438
- 8 -0.473042225 -0.09999988 8.42504496e-05
- 9 -0.412394709 -0.00113413693 -0.213688722
- 10 -0.409445417 -0.0592214763 -0.188921007
- 11 -0.433604215 0.0418324251 -0.252658609
- 12 -0.417370829 -0.116691352 -0.181507101
- 13 -0.455434501 -1.26195103e-05 -0.286058594
- 14 -0.463340162 -0.0573199773 -0.278729349
- 15 -0.460063768 -0.116378948 -0.255930246
- 16 -0.439268564 -0.158903572 -0.214478378
- 17 -0.0215911123 0.059917595 -0.0356329607
- 18 -0.0269718282 -5.67573843e-05 -0.0444817637
- 19 -7.38465577e-06 0.0999999537 -7.82245153e-05
- 20 -0.0606358858 -0.000948653155 0.213547484
- 21 -0.0636006475 -0.0591854703 0.189004673
- 22 -0.0215773059 -0.0600122514 -0.0355658013
- 23 -0.37337435 -0.171656331 -0.403069876
- 24 -0.373149861 -0.225228592 -0.363051339
- 25 0.021562222 0.0600288617 0.0356385962
- 26 -0.0556585388 -0.116653213 0.181606496
- 27 -0.039444155 0.0420875477 0.252545177
- 28 -0.393620517 -0.121087381 -0.453968101
- 29 0.0269570586 5.68273767e-05 0.0445803825
- 30 -0.3842853 -0.272577396 -0.340851864
- 31 7.38465577e-06 -0.0999999537 7.82245153e-05
- 32 0.0215771528 -0.0599314731 0.0357027744
- 33 -0.0176140688 0.000343668135 0.286029257
- 34 -0.0337644928 -0.15886067 0.214681884
- 35 -0.415740216 -0.164604661 -0.483835788
- 36 -0.42643651 -0.213064782 -0.462972731
- 37 -0.406366932 -0.317525081 -0.370950942
- 38 -0.00970907278 -0.0570286489 0.278847491
- 39 -0.425367901 -0.270085052 -0.426806687
- 40 -0.0129562193 -0.116110437 0.255986295
- 41 0.0394310248 0.0418312677 -0.252568382
- 42 0.0176001717 -1.30127824e-05 -0.285965809
- 43 0.0096946778 -0.057319981 -0.278636756
- 44 0.0606386744 -0.00112840734 -0.21359164
- 45 0.0129747094 -0.116385161 -0.255876988
- 46 0.0635894223 -0.0592214756 -0.188828406
- 47 0.0570944384 -0.119110851 -0.18777369
- 48 0.0337814184 -0.158905961 -0.214486298
- 49 -0.0996725106 -0.171754298 0.402851357
- 50 -0.0998904615 -0.22542601 0.362957017
- 51 -0.0887478591 -0.272799308 0.340840483
- 52 -0.0794294675 -0.121067189 0.453710987
- 53 -0.0573211882 -0.164489981 0.483741677
- 54 -0.0666616739 -0.317669264 0.371015636
- 55 -0.0466153205 -0.212990249 0.462968146
- 56 -0.047681739 -0.270135826 0.426891665
- 57 -0.338488232 -0.457382298 -0.42603612
- 58 -0.334977314 -0.411203146 -0.481037789
- 59 -0.353427848 -0.487914552 -0.400412032
- 60 -0.352511307 -0.357214916 -0.559383112
- 61 0.0794150955 -0.121092142 -0.453878125
- 62 0.0996575196 -0.171638636 -0.402972733
- 63 0.0998849765 -0.22522858 -0.362958736
- 64 0.0465983302 -0.213064786 -0.462880138
- 65 0.0572948107 -0.164604909 -0.483743612
- 66 0.0476651991 -0.270064767 -0.42675719
- 67 0.0938215271 -0.281554921 -0.351420516
- 68 -0.374968338 -0.532141031 -0.433146924
- 69 0.0666831242 -0.317534634 -0.370954973
- 70 -0.138061265 -0.411292895 0.480774053
- 71 -0.374688258 -0.39880045 -0.589090912
- 72 -0.134541177 -0.457593352 0.425854272
- 73 -0.388592327 -0.432869969 -0.562490944
- 74 -0.390088361 -0.486209383 -0.513177315
- 75 -0.119595378 -0.488150825 0.400318117
- 76 -0.120542192 -0.357198975 0.559113819
- 77 -0.0980587022 -0.532299625 0.43316728
- 78 -0.0983814859 -0.398696685 0.589014167
- 79 -0.0844658746 -0.432802896 0.562494008
- 80 -0.0829618617 -0.486255616 0.513226926
- 81 -0.299887102 -0.650760846 -0.421597649
- 82 -0.308932953 -0.688635726 -0.35691224
- 83 -0.326572534 -0.709502552 -0.348795823
- 84 -0.31002423 -0.614104467 -0.537520165
- 85 -0.173174882 -0.651128332 0.421096386
- 86 0.412396525 -0.000949502319 0.213676024
- 87 0.409434193 -0.059185474 0.189097266
- 88 -0.164071947 -0.688820081 0.35665983
- 89 0.446063012 -5.67610974e-05 -0.0443891702
- 90 0.451441779 0.0599315362 -0.0355039438
- 91 0.134546605 -0.457382274 -0.425943527
- 92 0.138053521 -0.411171996 -0.480954632
- 93 0.417376267 -0.116652992 0.181699004
- 94 0.120524351 -0.357225216 -0.559286613
- 95 0.451457534 -0.0600122552 -0.0354732078
- 96 -0.146442431 -0.709764408 0.348643443
- 97 0.128630875 -0.498887238 -0.404784827
- 98 0.433575511 0.0420855371 0.252738563
- 99 -0.163030166 -0.614081539 0.537199725
- 100 0.473012668 0.10000001 0.000113108598
- 101 -0.344560295 -0.753486953 -0.397872419
- 102 0.0844425131 -0.432869973 -0.562398351
- 103 0.0980810985 -0.532156977 -0.433138183
- 104 0.0829462731 -0.486192169 -0.513126121
- 105 0.0983480298 -0.398802175 -0.588999427
- 106 -0.330985601 -0.653639058 -0.579177229
- 107 -0.348317953 -0.673801888 -0.561076895
- 108 0.473042225 -0.0999999574 0.000170817993
- 109 0.494596229 0.0600123027 0.0357646773
- 110 -0.352868828 -0.720611868 -0.5016491
- 111 0.439269952 -0.158862031 0.214776764
- 112 -0.274900805 -0.820446363 -0.248531483
- 113 0.373363863 -0.171734839 0.402989248
- 114 0.373144379 -0.225426014 0.36304961
- 115 0.455395836 0.000355312578 0.286191626
- 116 0.499991881 5.68139203e-05 0.0446730962
- 117 0.494611984 -0.0599314881 0.0357954135
- 118 0.463325751 -0.0570287037 0.278940183
- 119 0.459481525 -0.117946413 0.259850196
- 120 -0.19817499 -0.821240456 0.247007149
- 121 0.384286575 -0.272799195 0.340933614
- 122 -0.28870327 -0.865818588 -0.189273912
- 123 -0.128472371 -0.753644554 0.397883775
- 124 0.393589959 -0.121076401 0.453901555
- 125 -0.142097664 -0.653552425 0.579086719
- 126 -0.268756751 -0.81693285 -0.379841954
- 127 -0.124752422 -0.673742894 0.56108214
- 128 -0.120153443 -0.720430402 0.501746642
- 129 -0.184280607 -0.866033948 0.189059171
- 130 -0.204276682 -0.816838585 0.379430693
- 131 -0.241621748 -0.895542188 -0.132166509
- 132 -0.231335348 -0.89542053 0.131725534
- 133 -0.302836178 -0.899902838 -0.210551459
- 134 0.406372461 -0.317674347 0.371110275
- 135 -0.262206008 -0.920097307 -0.0263224918
- 136 0.415690374 -0.164499826 0.483877335
- 137 -0.210821413 -0.920697436 0.0250368073
- 138 0.426419504 -0.212990334 0.463060801
- 139 0.424443109 -0.275353464 0.429527343
- 140 -0.170196318 -0.900247296 0.210355413
- 141 0.334972742 -0.411280534 0.480912204
- 142 0.338493663 -0.457593356 0.425946866
- 143 0.164101884 -0.688635698 -0.356819666
- 144 0.17314504 -0.650727979 -0.42154059
- 145 -0.283417205 -0.8680931 -0.449027016
- 146 0.353438022 -0.488152288 0.400411104
- 147 0.138673136 -0.729419174 -0.357349791
- 148 -0.311192642 -0.946607623 -0.284209629
- 149 0.163010619 -0.614116175 -0.537409528
- 150 0.35247749 -0.357216518 0.559291629
- 151 -0.302840309 -0.889384979 -0.456454205
- 152 -0.189667257 -0.867892778 0.448916899
- 153 -0.266906185 -0.990705034 0.0208958101
- 154 -0.236140511 -0.964443951 0.222073821
- 155 -0.236924796 -0.964723405 -0.222342918
- 156 -0.31021076 -0.930036797 -0.396189325
- 157 0.128487815 -0.753503113 -0.397846833
- 158 -0.206131501 -0.991011297 -0.021034935
- 159 0.124716888 -0.673801891 -0.560984302
- 160 -0.161866047 -0.946765629 0.284229888
- 161 0.120167395 -0.72059883 -0.501590978
- 162 -0.170251488 -0.889310267 0.456419446
- 163 0.142052542 -0.653643493 -0.579082364
- 164 0.37497559 -0.532309247 0.433255289
- 165 -0.162722433 -0.92948335 0.396684989
- 166 0.374629196 -0.398730009 0.589125558
- 167 0.299856433 -0.651121872 0.421226097
- 168 -0.269557034 -1.04009122 -0.0177181561
- 169 0.388568951 -0.432802991 0.562586621
- 170 0.389355802 -0.492391604 0.509606991
- 171 0.198136704 -0.820421257 -0.248493613
- 172 0.308962894 -0.688820085 0.356752424
- 173 -0.25039504 -1.01710589 -0.257607059
- 174 -0.203426714 -1.04012434 0.0181121216
- 175 -0.222705459 -1.01690784 0.257489987
- 176 0.184331567 -0.865818563 -0.189181356
- 177 0.309990774 -0.614100004 0.537356532
- 178 0.326589871 -0.709767156 0.348732078
- 179 -0.257065464 -1.0609955 -0.207917643
- 180 0.204275823 -0.816938024 -0.379717709
- 181 -0.265516969 -1.07904774 -0.107450925
- 182 -0.215798893 -1.06064012 0.20881164
- 183 0.274855286 -0.821231407 0.247127018
- 184 -0.207593148 -1.07913758 0.10743992
- 185 0.167191199 -0.915681151 -0.221671401
- 186 0.231407908 -0.895542307 -0.132037047
- 187 0.210831929 -0.920062444 -0.0262869274
- 188 0.241692108 -0.895421096 0.131857788
- 189 0.268747136 -0.816847195 0.379569335
- 190 0.288754234 -0.866033951 0.189151765
- 191 0.330916882 -0.653572052 0.579166873
- 192 0.344562759 -0.753655117 0.397960279
- 193 0.189622237 -0.868095684 -0.448922696
- 194 0.161853775 -0.946618482 -0.284169106
- 195 0.262211399 -0.920681391 0.0251523726
- 196 0.348282404 -0.673742979 0.561174716
- 197 0.170194531 -0.889384982 -0.456361612
- 198 0.353466204 -0.722983512 0.490511355
- 199 0.16282617 -0.930025323 -0.396125314
- 200 0.302835637 -0.900246128 0.210435879
- 201 0.206128648 -0.990705017 0.020988352
- 202 0.236113216 -0.964714087 -0.222229423
- 203 0.236885241 -0.964411558 0.222105725
- 204 0.283349894 -0.867897879 0.44896634
- 205 0.266903339 -0.991011301 -0.0209423415
- 206 0.203083676 -1.04701111 -0.0298928952
- 207 0.302783337 -0.889310327 0.456511992
- 208 0.311170489 -0.946772698 0.284294692
- 209 0.2226398 -1.01710589 -0.257514466
- 210 0.314417853 -0.926780626 0.381055841
- 211 0.250329367 -1.01690785 0.257582518
- 212 0.269606095 -1.04012325 0.0181882818
- 213 0.207526808 -1.07905034 -0.107399913
- 214 0.215971109 -1.06098421 -0.207847507
- 215 0.271839979 -1.06232372 0.194937089
- 216 0.265446036 -1.07913868 0.107495949
-End Coordinates
-
-Elements
-1 6 12 16 8
-2 4 10 12 6
-3 12 30 37 16
-4 10 24 30 12
-5 30 59 68 37
-6 24 57 59 30
-7 59 83 101 68
-8 57 82 83 59
-9 83 133 148 101
-10 82 122 133 83
-11 133 168 181 148
-12 122 153 168 133
-13 168 182 184 181
-14 153 175 182 168
-15 182 165 160 184
-16 175 162 165 182
-17 165 128 123 160
-18 162 127 128 165
-19 128 80 77 123
-20 127 79 80 128
-21 80 56 54 77
-22 79 55 56 80
-23 56 40 34 54
-24 55 38 40 56
-25 40 32 31 34
-26 38 29 32 40
-27 2 9 10 4
-28 1 11 9 2
-29 9 23 24 10
-30 11 28 23 9
-31 23 58 57 24
-32 28 60 58 23
-33 58 81 82 57
-34 60 84 81 58
-35 81 112 122 82
-36 84 126 112 81
-37 112 135 153 122
-38 126 131 135 112
-39 135 154 175 153
-40 131 132 154 135
-41 154 152 162 175
-42 132 130 152 154
-43 152 125 127 162
-44 130 99 125 152
-45 125 78 79 127
-46 99 76 78 125
-47 78 53 55 79
-48 76 52 53 78
-49 53 33 38 55
-50 52 27 33 53
-51 33 25 29 38
-52 27 19 25 33
-53 7 15 14 5
-54 8 16 15 7
-55 15 39 36 14
-56 16 37 39 15
-57 39 74 73 36
-58 37 68 74 39
-59 74 110 107 73
-60 68 101 110 74
-61 110 156 151 107
-62 101 148 156 110
-63 156 179 173 151
-64 148 181 179 156
-65 179 174 158 173
-66 181 184 174 179
-67 174 140 129 158
-68 184 160 140 174
-69 140 96 88 129
-70 160 123 96 140
-71 96 75 72 88
-72 123 77 75 96
-73 75 51 50 72
-74 77 54 51 75
-75 51 26 21 50
-76 54 34 26 51
-77 26 22 18 21
-78 34 31 22 26
-79 3 13 11 1
-80 5 14 13 3
-81 13 35 28 11
-82 14 36 35 13
-83 35 71 60 28
-84 36 73 71 35
-85 71 106 84 60
-86 73 107 106 71
-87 106 145 126 84
-88 107 151 145 106
-89 145 155 131 126
-90 151 173 155 145
-91 155 137 132 131
-92 173 158 137 155
-93 137 120 130 132
-94 158 129 120 137
-95 120 85 99 130
-96 129 88 85 120
-97 85 70 76 99
-98 88 72 70 85
-99 70 49 52 76
-100 72 50 49 70
-101 49 20 27 52
-102 50 21 20 49
-103 20 17 19 27
-104 21 18 17 20
-105 32 47 48 31
-106 29 46 47 32
-107 47 67 69 48
-108 46 63 67 47
-109 67 97 103 69
-110 63 91 97 67
-111 97 147 157 103
-112 91 143 147 97
-113 147 185 194 157
-114 143 176 185 147
-115 185 206 213 194
-116 176 201 206 185
-117 206 215 216 213
-118 201 211 215 206
-119 215 210 208 216
-120 211 207 210 215
-121 210 198 192 208
-122 207 196 198 210
-123 198 170 164 192
-124 196 169 170 198
-125 170 139 134 164
-126 169 138 139 170
-127 139 119 111 134
-128 138 118 119 139
-129 119 117 108 111
-130 118 116 117 119
-131 25 44 46 29
-132 19 41 44 25
-133 44 62 63 46
-134 41 61 62 44
-135 62 92 91 63
-136 61 94 92 62
-137 92 144 143 91
-138 94 149 144 92
-139 144 171 176 143
-140 149 180 171 144
-141 171 187 201 176
-142 180 186 187 171
-143 187 203 211 201
-144 186 188 203 187
-145 203 204 207 211
-146 188 189 204 203
-147 204 191 196 207
-148 189 177 191 204
-149 191 166 169 196
-150 177 150 166 191
-151 166 136 138 169
-152 150 124 136 166
-153 136 115 118 138
-154 124 98 115 136
-155 115 109 116 118
-156 98 100 109 115
-157 22 45 43 18
-158 31 48 45 22
-159 45 66 64 43
-160 48 69 66 45
-161 66 104 102 64
-162 69 103 104 66
-163 104 161 159 102
-164 103 157 161 104
-165 161 199 197 159
-166 157 194 199 161
-167 199 214 209 197
-168 194 213 214 199
-169 214 212 205 209
-170 213 216 212 214
-171 212 200 190 205
-172 216 208 200 212
-173 200 178 172 190
-174 208 192 178 200
-175 178 146 142 172
-176 192 164 146 178
-177 146 121 114 142
-178 164 134 121 146
-179 121 93 87 114
-180 134 111 93 121
-181 93 95 89 87
-182 111 108 95 93
-183 17 42 41 19
-184 18 43 42 17
-185 42 65 61 41
-186 43 64 65 42
-187 65 105 94 61
-188 64 102 105 65
-189 105 163 149 94
-190 102 159 163 105
-191 163 193 180 149
-192 159 197 193 163
-193 193 202 186 180
-194 197 209 202 193
-195 202 195 188 186
-196 209 205 195 202
-197 195 183 189 188
-198 205 190 183 195
-199 183 167 177 189
-200 190 172 167 183
-201 167 141 150 177
-202 172 142 141 167
-203 141 113 124 150
-204 142 114 113 141
-205 113 86 98 124
-206 114 87 86 113
-207 86 90 100 98
-208 87 89 90 86
-End Elements
diff --git a/kratos.gid/apps/Solid/images/lattice_example.png b/kratos.gid/apps/Solid/images/lattice_example.png
deleted file mode 100644
index 3ef6589e8..000000000
Binary files a/kratos.gid/apps/Solid/images/lattice_example.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/logo.png b/kratos.gid/apps/Solid/images/logo.png
deleted file mode 100644
index 1f9a4c9fb..000000000
Binary files a/kratos.gid/apps/Solid/images/logo.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/logo_beam.png b/kratos.gid/apps/Solid/images/logo_beam.png
deleted file mode 100644
index c832c4af9..000000000
Binary files a/kratos.gid/apps/Solid/images/logo_beam.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/notched_example.png b/kratos.gid/apps/Solid/images/notched_example.png
deleted file mode 100644
index ac4cab58c..000000000
Binary files a/kratos.gid/apps/Solid/images/notched_example.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/parallel_type.png b/kratos.gid/apps/Solid/images/parallel_type.png
deleted file mode 100644
index 21cd04c90..000000000
Binary files a/kratos.gid/apps/Solid/images/parallel_type.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/rod_example.png b/kratos.gid/apps/Solid/images/rod_example.png
deleted file mode 100644
index 8288474ff..000000000
Binary files a/kratos.gid/apps/Solid/images/rod_example.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/solid.png b/kratos.gid/apps/Solid/images/solid.png
deleted file mode 100644
index 23573a2e1..000000000
Binary files a/kratos.gid/apps/Solid/images/solid.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/solvers.png b/kratos.gid/apps/Solid/images/solvers.png
deleted file mode 100644
index 9ae99faee..000000000
Binary files a/kratos.gid/apps/Solid/images/solvers.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/tank_example.png b/kratos.gid/apps/Solid/images/tank_example.png
deleted file mode 100644
index 5e6d01ae5..000000000
Binary files a/kratos.gid/apps/Solid/images/tank_example.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/timeIntervals.png b/kratos.gid/apps/Solid/images/timeIntervals.png
deleted file mode 100644
index 1f167f758..000000000
Binary files a/kratos.gid/apps/Solid/images/timeIntervals.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/images/tree.png b/kratos.gid/apps/Solid/images/tree.png
deleted file mode 100644
index 51156d9a0..000000000
Binary files a/kratos.gid/apps/Solid/images/tree.png and /dev/null differ
diff --git a/kratos.gid/apps/Solid/python/RunSolid.py b/kratos.gid/apps/Solid/python/RunSolid.py
deleted file mode 100644
index ebc2c9f39..000000000
--- a/kratos.gid/apps/Solid/python/RunSolid.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import KratosMultiphysics
-import KratosMultiphysics.ExternalSolversApplication
-import KratosMultiphysics.SolidMechanicsApplication
-import KratosMultiphysics.ConstitutiveModelsApplication
-import KratosMultiphysics.SolidMechanicsApplication.MainSolid as MainSolid
-
-MainSolid.Solution(KratosMultiphysics.Model()).Run()
-
diff --git a/kratos.gid/apps/Solid/start.tcl b/kratos.gid/apps/Solid/start.tcl
deleted file mode 100644
index 44f387284..000000000
--- a/kratos.gid/apps/Solid/start.tcl
+++ /dev/null
@@ -1,84 +0,0 @@
-namespace eval ::Solid {
- # Variable declaration
- variable dir
- variable attributes
- variable kratos_name
-}
-
-proc ::Solid::Init { } {
- # Variable initialization
- variable dir
- variable attributes
- variable kratos_name
- set kratos_name SolidMechanicsApplication
-
- set dir [apps::getMyDir "Solid"]
- set ::Model::ValidSpatialDimensions [list 2D 2Da 3D]
- set attributes [dict create]
-
- # Intervals
- dict set attributes UseIntervals 1
-
- # Restart available
- dict set attributes UseRestart 1
- # Allow to open the tree
- set ::spdAux::TreeVisibility 1
- LoadMyFiles
- #::spdAux::CreateDimensionWindow
-}
-
-proc ::Solid::LoadMyFiles { } {
- variable dir
- uplevel #0 [list source [file join $dir xml XmlController.tcl]]
- uplevel #0 [list source [file join $dir write write.tcl]]
- uplevel #0 [list source [file join $dir write validation.tcl]]
- uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]]
- uplevel #0 [list source [file join $dir symbols symbols.tcl]]
- uplevel #0 [list source [file join $dir examples examples.tcl]]
-}
-
-proc ::Solid::GetAttribute {name} {
- variable attributes
- set value ""
- if {[dict exists $attributes $name]} {set value [dict get $attributes $name]}
- return $value
-}
-
-proc ::Solid::CustomToolbarItems { } {
- variable dir
- # Reset the left toolbar
- 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]
- }
- Kratos::ToolbarAddItem "Model" [file join $img_dir "modelProperties.png"] [list -np- gid_groups_conds::open_conditions menu] [= "Define the model properties"]
- Kratos::ToolbarAddItem "Spacer" "" "" ""
- Kratos::ToolbarAddItem "Run" [file join $img_dir "runSimulation.png"] {Utilities Calculate} [= "Run the simulation"]
- Kratos::ToolbarAddItem "Output" [file join $img_dir "view.png"] [list -np- PWViewOutput] [= "View process info"]
- Kratos::ToolbarAddItem "Stop" [file join $img_dir "cancelProcess.png"] {Utilities CancelProcess} [= "Cancel process"]
- Kratos::ToolbarAddItem "Spacer" "" "" ""
- # Add examples
- if { $::Model::SpatialDimension eq "2Da" } {
- Kratos::ToolbarAddItem "Example" [file join $img_dir "tank_example.png"] [list -np- ::Solid::examples::CircularTank] [= "Example\nCircular water tank"]
- }
- if { $::Model::SpatialDimension eq "2D" } {
- Kratos::ToolbarAddItem "Example" [file join $img_dir "notched_example.png"] [list -np- ::Solid::examples::NotchedBeam] [= "Example\nNotched beam damage"]
- Kratos::ToolbarAddItem "Example" [file join $img_dir "rod_example.png"] [list -np- ::Solid::examples::DynamicRod] [= "Example\nDynamic rod pendulus"]
- }
- if { $::Model::SpatialDimension eq "3D" } {
- Kratos::ToolbarAddItem "Example" [file join $img_dir "beam_example.png"] [list -np- ::Solid::examples::DynamicBeam] [= "Example\nDynamic beam rotating"]
- Kratos::ToolbarAddItem "Example" [file join $img_dir "tank_example.png"] [list -np- ::Solid::examples::CircularTank] [= "Example\nCircular water tank"]
- Kratos::ToolbarAddItem "Example" [file join $img_dir "column_example.png"] [list -np- ::Solid::examples::EccentricColumn] [= "Example\nEccentric column"]
- Kratos::ToolbarAddItem "Example" [file join $img_dir "rod_example.png"] [list -np- ::Solid::examples::DynamicRod] [= "Example\nDynamic rod pendulus"]
- Kratos::ToolbarAddItem "Example" [file join $img_dir "lattice_example.png"] [list -np- ::Solid::examples::StaticBeamLattice] [= "Example\nStatic beam lattice"]
- }
- Kratos::ToolbarAddItem "Spacer" "" "" ""
-
-}
-
-proc ::Solid::CustomMenus { } {
- Solid::examples::UpdateMenus$::Model::SpatialDimension
-}
-
-::Solid::Init
diff --git a/kratos.gid/apps/Solid/symbols/symbols.tcl b/kratos.gid/apps/Solid/symbols/symbols.tcl
deleted file mode 100644
index 160590c70..000000000
--- a/kratos.gid/apps/Solid/symbols/symbols.tcl
+++ /dev/null
@@ -1,393 +0,0 @@
-package require gid_draw_opengl
-
-namespace eval Solid::symbols {
-}
-
-#to be used directly as symbol proc (to draw a condition as a 3D shape without take into account any direction to be oriented)
-#valuesList is unused, but necessary because it is automatically added when invokind the symbol proc
-#e.g
-proc Solid::symbols::draw_file_mesh { filename color_lines color_surfaces valuesList } {
- set full_filename [file join $Solid::dir $filename]
- if { [info procs gid_draw_opengl::create_opengl_list_from_file_mesh] != "" } {
- set list_id [gid_draw_opengl::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces ""]
- } else {
- set list_id [Solid::symbols::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces ""]
- }
- return $list_id
-}
-
-#valuesList will be like: {ByFunction No {}} {modulus 9.81 m/s^2} {direction 0.0,-1.0,0.0 {}} {compound_assignment direct {}} {Interval Total {}}
-proc Solid::symbols::draw_selfweight { valuesList } {
- set full_filename [file join $Solid::dir images conditions selfweight.msh]
- set color_lines black
- set color_surfaces blue
- foreach item $valuesList {
- lassign $item key value unit
- set data($key) $value
- #set unit($key) $unit
- }
- set modulus $data(modulus)
- if { $modulus == 0 } {
- #the value could be set by other function field, intead as modulus, consider like positive modulus
- set modulus 1.0
- }
- set direction [split $data(direction) ,]
- if { [llength $direction] == 2 } {
- lappend direction 0.0
- }
- set opposite_direction [math::linearalgebra::scale_vect -1.0 $direction]
- if { [info procs gid_draw_opengl::create_opengl_list_from_file_mesh_oriented_z_direction] != "" } {
- set list_id [gid_draw_opengl::create_opengl_list_from_file_mesh_oriented_z_direction $full_filename $color_lines $color_surfaces $opposite_direction]
- } else {
- #to allow use it before the proc is available in next GiD 14.1.1d
- set list_id [Solid::symbols::create_opengl_list_from_file_mesh_oriented_z_direction $full_filename $color_lines $color_surfaces $opposite_direction]
- }
- return $list_id
-}
-
-#valuesList will be like: {ByFunction No {}} {modulus 2.0 N} {direction 1.0,0.0,0.0 {}} {compound_assignment direct {}} {Interval Total {}}
-proc Solid::symbols::draw_load { valuesList } {
- foreach item $valuesList {
- lassign $item key value unit
- set data($key) $value
- #set unit($key) $unit
- }
- set modulus $data(modulus)
- if { $modulus == 0 } {
- #the value could be set by other function field, intead as modulus, consider like positive modulus
- set modulus 1.0
- }
- set direction [split $data(direction) ,]
- if { [llength $direction] == 2 } {
- lappend direction 0.0
- }
- set force [MathUtils::ScalarByVectorProd $modulus $direction]
- set x_axis [math::linearalgebra::unitLengthVector $force]
- lassign [MathUtils::CalculateLocalAxisFromXAxis $x_axis] y_axis z_axis
- set transform_matrix [concat $x_axis 0 $y_axis 0 $z_axis 0 0 0 0 1]
- if { [info procs gid_draw_opengl::create_opengl_list_drawing] != "" } {
- set list_id [gid_draw_opengl::create_opengl_list_drawing gid_draw_opengl::draw_point_load $transform_matrix]
- } else {
- #to allow use it before the proc is available in next GiD 14.1.1d
- set list_id [Solid::symbols::create_opengl_list_drawing Solid::symbols::draw_point_load $transform_matrix]
- }
- return $list_id
-}
-
-proc Solid::symbols::draw_arrow { valuesList } {
- set full_filename [file join $Solid::dir images conditions arrow.msh]
- set color_lines black
- set color_surfaces blue
- foreach item $valuesList {
- lassign $item key value unit
- set data($key) $value
- #set unit($key) $unit
- }
- set modulus $data(modulus)
- if { $modulus == 0 } {
- #the value could be set by other function field, intead as modulus, consider like positive modulus
- set modulus 1.0
- }
- set direction [split $data(direction) ,]
- if { [llength $direction] == 2 } {
- lappend direction 0.0
- }
- set force [math::linearalgebra::scale_vect $modulus $direction]
- set x_axis [math::linearalgebra::unitLengthVector $force]
- lassign [MathUtils::CalculateLocalAxisFromXAxis $x_axis] y_axis z_axis
- set transform_matrix [concat $x_axis 0 $y_axis 0 $z_axis 0 0 0 0 1]
- if { [info procs gid_draw_opengl::create_opengl_list_from_file_mesh] != "" } {
- set list_id [gid_draw_opengl::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces $transform_matrix]
- } else {
- #to allow use it before the proc is available in next GiD 14.1.1d
- set list_id [Solid::symbols::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces $transform_matrix]
- }
- return $list_id
-}
-
-#valuesList will be like: {{ByFunction No {}} {value 4 Pa} {compound_assignment direct {}} {Interval Total {}}}
-proc Solid::symbols::draw_surface_pressure { valuesList } {
- foreach item $valuesList {
- lassign $item key value unit
- set data($key) $value
- #set unit($key) $unit
- }
- set modulus $data(value)
- if { $modulus > 0 } {
- set load_local_direction [list 0 0 -1] ;#considered positive pointing oposite to local normal
- } elseif { $modulus < 0 } {
- set load_local_direction [list 0 0 1] ;#considered positive pointing oposite to local normal
- } else {
- #the value could be set by other function field, intead as modulus, consider like positive modulus
- set load_local_direction [list 0 0 -1]
- }
- set x_axis $load_local_direction
- lassign [MathUtils::CalculateLocalAxisFromXAxis $x_axis] y_axis z_axis
- set transform_matrix [concat $x_axis 0 $y_axis 0 $z_axis 0 0 0 0 1]
- if { [info procs gid_draw_opengl::create_opengl_list_drawing] != "" } {
- set list_id [gid_draw_opengl::create_opengl_list_drawing gid_draw_opengl::draw_point_load $transform_matrix]
- } else {
- #to allow use it before the proc is available in next GiD 14.1.1d
- set list_id [Solid::symbols::create_opengl_list_drawing Solid::symbols::draw_point_load $transform_matrix]
- }
- return $list_id
-}
-
-#draw_loads mean that is returning a dictionary but real draw is made native inside GiD based on this dict
-#in this case the XML declare orientation="loads", a special value to say GiD how to draw
-#valuesList will be like: {{ByFunction No {}} {value 4 Pa} {compound_assignment direct {}} {Interval Total {}}}
-#but to work well by now it is necessary to assign to surfaces the surface_Local_axes, else is drawn with wrong direction (eulerangles==NULL)
-proc Solid::symbols::draw_loads_surface_pressure { valuesList } {
- foreach item $valuesList {
- lassign $item key value unit
- set data($key) $value
- #set unit($key) $unit
- }
- set modulus $data(value)
- if { $modulus > 0 } {
- set load_local_direction [list 0 0 -1] ;#considered positive pointing oposite to local normal
- } elseif { $modulus < 0 } {
- set load_local_direction [list 0 0 1] ;#considered positive pointing oposite to local normal
- } else {
- #the value could be set by other function field, intead as modulus, consider like positive modulus
- set load_local_direction [list 0 0 -1]
- }
- set dictionary [dict create load_type local load_vector $load_local_direction]
- return $dictionary
-}
-
-proc Solid::symbols::draw_moment { valuesList } {
- foreach item $valuesList {
- lassign $item key value unit
- set data($key) $value
- #set unit($key) $unit
- }
- set modulus $data(modulus)
- if { $modulus == 0 } {
- #the value could be set by other function field, intead as modulus, consider like positive modulus
- set modulus 1.0
- }
- set direction [split $data(direction) ,]
- if { [llength $direction] == 2 } {
- lappend direction 0.0
- }
- set force [MathUtils::ScalarByVectorProd $modulus $direction]
- set x_axis [math::linearalgebra::unitLengthVector $force]
- lassign [MathUtils::CalculateLocalAxisFromXAxis $x_axis] y_axis z_axis
- set transform_matrix [concat $x_axis 0 $y_axis 0 $z_axis 0 0 0 0 1]
- if { [info procs gid_draw_opengl::create_opengl_list_drawing] != "" } {
- set list_id [gid_draw_opengl::create_opengl_list_drawing gid_draw_opengl::draw_point_momentum $transform_matrix]
- } else {
- #to allow use it before the proc is available in next GiD 14.1.1d
- set list_id [Solid::symbols::create_opengl_list_drawing Solid::symbols::draw_point_momentum $transform_matrix]
- }
- return $list_id
-}
-
-proc Solid::symbols::draw_spring { valuesList } {
- set full_filename [file join $Solid::dir images conditions spring.msh]
- set color_lines black
- set color_surfaces blue
- foreach item $valuesList {
- lassign $item key value unit
- set data($key) $value
- #set unit($key) $unit
- }
- set modulus $data(modulus)
- if { $modulus == 0 } {
- #the value could be set by other function field, intead as modulus, consider like positive modulus
- set modulus 1.0
- }
- set direction [split $data(direction) ,]
- if { [llength $direction] == 2 } {
- lappend direction 0.0
- }
- set momentum [math::linearalgebra::scale_vect $modulus $direction]
- set x_axis [math::linearalgebra::unitLengthVector $momentum]
- lassign [MathUtils::CalculateLocalAxisFromXAxis $x_axis] y_axis z_axis
- set transform_matrix [concat $x_axis 0 $y_axis 0 $z_axis 0 0 0 0 1]
- if { [info procs gid_draw_opengl::create_opengl_list_from_file_mesh] != "" } {
- set list_id [gid_draw_opengl::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces $transform_matrix]
- } else {
- #to allow use it before the proc is available in next GiD 14.1.1d
- set list_id [Solid::symbols::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces $transform_matrix]
- }
- return $list_id
-}
-
-proc Solid::symbols::draw_surface_ballast { valuesList } {
- set full_filename [file join $Solid::dir images conditions spring.msh]
- set color_lines black
- set color_surfaces blue
- foreach item $valuesList {
- lassign $item key value unit
- set data($key) $value
- #set unit($key) $unit
- }
- set modulus $data(value)
- if { $modulus > 0 } {
- set load_local_direction [list 0 0 1]
- } elseif { $modulus < 0 } {
- set load_local_direction [list 0 0 -1]
- } else {
- #the value could be set by other function field, intead as modulus, consider like positive modulus
- set load_local_direction [list 0 0 1]
- }
- set x_axis $load_local_direction
- lassign [MathUtils::CalculateLocalAxisFromXAxis $x_axis] y_axis z_axis
- set transform_matrix [concat $x_axis 0 $y_axis 0 $z_axis 0 0 0 0 1]
- if { [info procs gid_draw_opengl::create_opengl_list_from_file_mesh] != "" } {
- set list_id [gid_draw_opengl::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces $transform_matrix]
- } else {
- #to allow use it before the proc is available in next GiD 14.1.1d
- set list_id [Solid::symbols::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces $transform_matrix]
- }
- return $list_id
-}
-
-#cannot be used because now parts are for all types: shells, beams and solids,
-#and cannot set at design time orientation='shell_thickness', 'section' and the appropriated proc for each case
-#orientation='[some_proc]' cannot be used because the xml_node provided to some_proc is the one of
-#that does not contain the element type
-proc Solid::symbols::draw_parts_shell { valuesList } {
- foreach item $valuesList {
- lassign $item key value unit
- set data($key) $value
- #set unit($key) $unit
- }
- set thickness $data(THICKNESS)
- return [dict create thickness $thickness]
-}
-
-proc Solid::symbols::draw_thickness { thickness } {
- set z_max [expr $thickness*0.5]
- set z_min [expr -1.0*$z_max]
- GiD_OpenGL draw -color $::gid_draw_opengl::rgb(black)
- GiD_OpenGL draw -polygonmode frontandback line
- GiD_OpenGL draw -begin quads -vertex [list 0 -0.5 $z_min] -vertex [list 0 0.5 $z_min] -vertex [list 1 0.5 $z_min] -vertex [list 1 -0.5 $z_min] -end
- GiD_OpenGL draw -begin quads -vertex [list 0 -0.5 $z_max] -vertex [list 0 0.5 $z_max] -vertex [list 1 0.5 $z_max] -vertex [list 1 -0.5 $z_max] -end
- GiD_OpenGL draw -color $::gid_draw_opengl::rgb(green)
- GiD_OpenGL draw -polygonmode frontandback fill
- GiD_OpenGL draw -begin quads -vertex [list 0 -0.5 $z_min] -vertex [list 0 0.5 $z_min] -vertex [list 1 0.5 $z_min] -vertex [list 1 -0.5 $z_min] -end
- GiD_OpenGL draw -begin quads -vertex [list 0 -0.5 $z_max] -vertex [list 0 0.5 $z_max] -vertex [list 1 0.5 $z_max] -vertex [list 1 -0.5 $z_max] -end
-}
-
-proc Solid::symbols::draw_parts { valuesList } {
- set list_id ""
- foreach item $valuesList {
- lassign $item key value unit
- set data($key) $value
- #set unit($key) $unit
- }
- set beam_elements { LargeDisplacementBeamElement3D LargeDisplacementBeamEMCElement3D }
- set shell_elemenst { ShellThinElement ShellThickElement ShellThinCorotationalElement ShellThickCorotationalElement }
- if { [lsearch $shell_elemenst $data(Element)] != -1 } {
- set thickness $data(THICKNESS)
- set drawing_procedure [list Solid::symbols::draw_thickness $thickness]
- } elseif { [lsearch $beam_elements $data(Element)] != -1 } {
-
- #the kind of data depends on $data(ConstitutiveLaw) that is storing the kind of profile: UserDefined3D, RectangularSection3D, ...
- set profile $data(ConstitutiveLaw)
- set rotate_90 1
- if { $profile== "UserDefined3D" } {
- #set area $data(AREA)
- if { $data(INERTIA_Y) > $data(INERTIA_X) } {
- set rotate_90 0
- }
- } elseif { $profile== "RectangularSection3D" } {
- if { $data(SECTION_WIDTH) > $data(SECTION_HEIGHT) } {
- set rotate_90 0
- }
- } else {
- set rotate_90 1
- }
- #draw a double t profile
- set drawing_procedure [list gid_draw_opengl::draw_symbol_section_properties {0.0 0.0 0.0} {1.0 0.0 0.0} $rotate_90 1.0 1.0]
- } else {
- #assumed solid
- return ""
- }
- set transform_matrix ""
- if { [info procs gid_draw_opengl::create_opengl_list_drawing] != "" } {
- set list_id [gid_draw_opengl::create_opengl_list_drawing $drawing_procedure $transform_matrix]
- } else {
- #to allow use it before the proc is available in next GiD 14.1.1d
- set list_id [Solid::symbols::create_opengl_list_drawing $drawing_procedure $transform_matrix]
- }
- return $list_id
-}
-
-#only to show how is called, without drawing nothing
-proc Solid::symbols::draw_parts_free { valuesList geom_mesh ov num pnts points ent_type center scale } {
- W "valuesList=$valuesList geom_mesh=$geom_mesh ov=$ov num=$num pnts=$pnts points=$points ent_type=$ent_type center=$center scale=$scale"
- return ""
-}
-
-######## START procs temporary defined copied from gid_draw_opengl package
-#to allow use it before the proc is available in next GiD 14.1.1d
-#to be deleted when this problemtype require this version or higher (and off course this version is available)
-
-#transform_matrix could be "" for identity
-proc Solid::symbols::create_opengl_list_drawing { drawing_procedure transform_matrix } {
- set list_id [GiD_OpenGL draw -genlists 1]
- GiD_OpenGL draw -newlist $list_id compile
- if { [llength $transform_matrix] } {
- GiD_OpenGL draw -pushmatrix -multmatrix $transform_matrix
- }
- {*}$drawing_procedure
- if { [llength $transform_matrix] } {
- GiD_OpenGL draw -popmatrix
- }
- GiD_OpenGL draw -endlist
- return $list_id
-}
-
-#e.g. to draw a condition as a 3D shape defined in a GiD ASCII mesh file
-#transform_matrix could be "" for the identity or a list with 16 values (representing a 4x4 opengl_matrix)
-proc Solid::symbols::create_opengl_list_from_file_mesh { full_filename color_lines color_surfaces transform_matrix } {
- package require customLib
- set drawing_procedure [list gid_groups_conds::import_gid_mesh_as_openGL $full_filename $color_lines $color_surfaces]
- return [Solid::symbols::create_opengl_list_drawing $drawing_procedure $transform_matrix]
-}
-
-proc Solid::symbols::create_opengl_list_from_file_mesh_oriented_z_direction { full_filename color_lines color_surfaces z_direction } {
- package require customLib
- lassign [gid_groups_conds::calc_xy_shell $z_direction] x_axis y_axis z_axis
- set transform_matrix [concat $x_axis 0 $y_axis 0 $z_axis 0 0 0 0 1]
- return [Solid::symbols::create_opengl_list_from_file_mesh $full_filename $color_lines $color_surfaces $transform_matrix]
-}
-
-#arrow size 1 pointing to +x (arrow cone height 0.3, radius 0.05)
-proc Solid::symbols::draw_point_load { } {
- #GiD_OpenGL draw -linewidth 2.0
- GiD_OpenGL draw -begin lines -vertex [list 0 0 0] -vertex [list 1 0 0] -end
- GiD_OpenGL draw -begin trianglefan -vertex [list 1 0 0]
- foreach angle [GidUtils::GetRange 0.0 $MathUtils::2PI 9] {
- GiD_OpenGL draw -vertex [list 0.7 [expr {0.05*cos($angle)}] [expr {0.05*sin($angle)}]]
- }
- GiD_OpenGL draw -end
- #GiD_OpenGL draw -linewidth 1.0
-}
-
-#arc and double-arrow size 1 pointing to +x (arrow cone height 0.1, radius 0.05)
-proc Solid::symbols::draw_point_momentum { } {
- GiD_OpenGL draw -begin lines -vertex [list 0 0 0] -vertex [list 1 0 0] -end
- foreach x_cone_start {0.9 0.7} x_cone_end {1 0.8} {
- GiD_OpenGL draw -begin trianglefan -vertex [list $x_cone_end 0 0]
- foreach angle [GidUtils::GetRange 0.0 [expr {2.0*$MathUtils::Pi}] 9] {
- GiD_OpenGL draw -vertex [list $x_cone_start [expr {0.05*cos($angle)}] [expr {0.05*sin($angle)}]]
- }
- GiD_OpenGL draw -end
- }
- GiD_OpenGL draw -begin linestrip
- foreach angle [GidUtils::GetRange 0.0 [expr {1.5*$MathUtils::Pi}] 13] {
- GiD_OpenGL draw -vertex [list 0 [expr {0.5*cos($angle)}] [expr {0.5*sin($angle)}]]
- }
- GiD_OpenGL draw -end
- GiD_OpenGL draw -begin trianglefan -vertex [list 0 0 -0.5]
- foreach angle [GidUtils::GetRange 0.0 [expr {2.0*$MathUtils::Pi}] 9] {
- GiD_OpenGL draw -vertex [list [expr {0.05*sin($angle)}] -0.1 [expr {-0.5+0.05*cos($angle)}] ]
- }
- GiD_OpenGL draw -end
-}
-######## END procs temporary defined copied from gid_draw_opengl package
diff --git a/kratos.gid/apps/Solid/write/validation.tcl b/kratos.gid/apps/Solid/write/validation.tcl
deleted file mode 100644
index c2d1004b3..000000000
--- a/kratos.gid/apps/Solid/write/validation.tcl
+++ /dev/null
@@ -1,137 +0,0 @@
-
-# return 0 means ok; return [list 1 "Error message to be displayed"]
-proc Solid::write::writeValidateEvent { } {
- set problem_message [list ]
-
- # Entities assigned to parts validation
- lappend problem_message {*}[Solid::write::validatePartsMesh]
-
- # Entities assigned to parts validation
- lappend problem_message {*}[Solid::write::validateNodalConditionsMesh]
-
- # Entities assigned to parts validation
- #lappend problem_message {*}[Solid::write::validateLoadsMesh]
-
- # Add more tests here
-
- return [list [llength $problem_message] $problem_message]
-}
-
-proc Solid::write::validatePartsMesh {} {
- set problem_messages [list ]
- # Get the Parts node
- set parts_un "SLParts"
- set root [customlib::GetBaseRoot]
- set xp1 "[spdAux::getRoute $parts_un]/group"
- # Foreach group assigned
- foreach gNode [$root selectNodes $xp1] {
- # Get group name
- set group_name [$gNode @n]
- # Get the assigned element
- set element [write::getValueByNode [$gNode selectNodes "./value\[@n = 'Element'\]"]]
- # Get the element available topologies
- set topologies [Solid::write::GetTopologies [::Model::getElement $element]]
- # Validate if the group has any of the valid topologies assigned
- set has_any [Solid::write::ValidateGroupNotEmpty $group_name $topologies]
- if {$has_any == 0} {
- # Get the topologies to show the message
- set valid_topologies [list ]
- foreach topology $topologies {
- lappend valid_topologies [$topology getGeometry]
- }
- # Add the message to the list of problems
- lappend problem_messages "Parts > group: $group_name must have one of this elements assigned: $valid_topologies. Assign something in geometry and remesh"
- }
- }
- return $problem_messages
-}
-proc Solid::write::validateNodalConditionsMesh {} {
- set problem_messages [list ]
- # Get the Nodal conditions node
- set nodal_conditions_un "SLNodalConditions"
- set root [customlib::GetBaseRoot]
- set xp1 "[spdAux::getRoute $nodal_conditions_un]/condition/group"
- # Foreach group assigned
- foreach gNode [$root selectNodes $xp1] {
- # Get group name
- set group_name [write::GetWriteGroupName [$gNode @n]]
- # Get the assigned nodal condition
- set nodal_condition [[$gNode parent] @n]
- # Get the nodal condition available topologies
- set topologies [list [::Model::Topology new "Point" 1 ""]]
- # TODO: validate ov
- # Validate if the group has any of the valid topologies assigned
- set has_any [Solid::write::ValidateGroupNotEmpty $group_name $topologies]
- if {$has_any == 0} {
- # Get the topologies to show the message
- set valid_topologies [list ]
- foreach topology $topologies {
- lappend valid_topologies [$topology getGeometry]
- }
- # Add the message to the list of problems
- lappend problem_messages "Conditions > group: $group_name must have one of this elements assigned: $valid_topologies. Assign something in geometry and remesh"
- }
- }
- return $problem_messages
-}
-
-proc Solid::write::validateLoadsMesh {} {
- set problem_messages [list ]
- # Get the Conditions node
- set conditions_un "SLLoads"
- set root [customlib::GetBaseRoot]
- set xp1 "[spdAux::getRoute $conditions_un]/condition/group"
- # Foreach group assigned
- foreach gNode [$root selectNodes $xp1] {
- # Get group name
- set group_name [write::GetWriteGroupName [$gNode @n]]
- # Get the assigned nodal condition
- set condition [[$gNode parent] @n]
- # Get the entity selected condition
- if {[$gNode hasAttribute ov]} {set ov [$gNode getAttribute ov]} {set ov [[$gNode parent ] getAttribute ov]}
- # Get the nodal condition available topologies
- set topologies [Solid::write::GetTopologies [Model::getCondition $condition] ]
- if {$topologies eq ""} {set topologies [list [::Model::Topology new "Point" 1 ""]]; set ov ""}
- # Validate if the group has any of the valid topologies assigned
- set has_any [Solid::write::ValidateGroupNotEmpty $group_name $topologies $ov]
- if {$has_any == 0} {
- # Get the topologies to show the message
- set valid_topologies [list ]
- foreach topology $topologies {
- lappend valid_topologies [$topology getGeometry]
- }
- # Add the message to the list of problems
- lappend problem_messages "Loads > group: $group_name must have one of this elements assigned: $valid_topologies. Assign something in geometry and remesh"
- }
- }
- return $problem_messages
-}
-
-proc Solid::write::GetTopologies { entity } {
- if {$entity eq ""} {return [list ]}
- return [$entity getTopologyFeatures]
-}
-proc Solid::write::ValidateGroupNotEmpty { group_name topologies {ov ""} } {
- set any 0
- set isquadratic [write::isquadratic]
- # W "$group_name ov: $ov topo: [llength $topologies] $topologies"
- foreach topology $topologies {
- set geo [$topology getGeometry]
- if {$ov ne "" && [string tolower $geo] ne $ov} {continue}
- if {$geo == "Point"} {
- # W "Checking $group_name nodes: [GiD_EntitiesGroups get $group_name nodes -count]"
- if {[GiD_EntitiesGroups get $group_name nodes -count] > 0} {
- # TODO: check number of nodes if quadratic
- set any 1
- break
- }
- } else {
- if {[GiD_EntitiesGroups get $group_name elements -count -element_type $geo] > 0} {
- # TODO: check number of nodes if quadratic
- set any 1
- break
- }
- }
- }
- return $any
-}
\ No newline at end of file
diff --git a/kratos.gid/apps/Solid/write/write.tcl b/kratos.gid/apps/Solid/write/write.tcl
deleted file mode 100644
index fc2f7bbec..000000000
--- a/kratos.gid/apps/Solid/write/write.tcl
+++ /dev/null
@@ -1,377 +0,0 @@
-namespace eval Solid::write {
- variable mat_dict
- variable validApps
- variable ConditionsDictGroupIterators
- variable NodalConditionsGroup
- variable writeCoordinatesByGroups
-}
-
-proc Solid::write::Init { } {
- # Namespace variables inicialization
- variable mat_dict
- set mat_dict ""
- variable ConditionsDictGroupIterators
- variable NodalConditionsGroup
- set ConditionsDictGroupIterators [dict create]
- set NodalConditionsGroup [list ]
-
- variable validApps
- set validApps [list "Solid"]
-
- variable writeCoordinatesByGroups
- set writeCoordinatesByGroups 0
-}
-
-proc Solid::write::AddValidApps {appList} {
- variable validApps
-
- lappend validApps $appList
-}
-
-proc Solid::write::writeCustomFilesEvent { } {
- WriteMaterialsFile
-
- write::CopyFileIntoModel "python/RunSolid.py"
- set paralleltype [write::getValue ParallelType]
- set orig_name "RunSolid.py"
-
- write::RenameFileInModel $orig_name "MainKratos.py"
-}
-
-proc Solid::write::SetCoordinatesByGroups {value} {
- variable writeCoordinatesByGroups
- set writeCoordinatesByGroups $value
-}
-
-# MDPA Blocks
-
-proc Solid::write::writeModelPartEvent { } {
- variable writeCoordinatesByGroups
- variable validApps
- variable ConditionsDictGroupIterators
- write::initWriteData "SLParts" "SLMaterials"
-
- write::writeModelPartData
- write::WriteString "Begin Properties 0"
- write::WriteString "End Properties"
- write::writeMaterials $validApps
- #write::writeTables
- if {$writeCoordinatesByGroups} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates}
- write::writeElementConnectivities
- writeConditions
- set basicConds [write::writeBasicSubmodelParts [getLastConditionId]]
- set ConditionsDictGroupIterators [dict merge $ConditionsDictGroupIterators $basicConds]
- writeMeshes
- # W $ConditionsDictGroupIterators
- #writeCustomBlock
-}
-
-
-proc Solid::write::writeConditions { } {
- variable ConditionsDictGroupIterators
- set ConditionsDictGroupIterators [write::writeConditions "SLLoads"]
-}
-
-proc Solid::write::writeMeshes { } {
-
- write::writePartSubModelPart
-
- # Solo Malla , no en conditions
- write::writeNodalConditions "SLNodalConditions"
-
- # A Condition y a meshes-> salvo lo que no tenga topologia
- writeLoads
-}
-
-proc Solid::write::writeLoads { } {
- variable ConditionsDictGroupIterators
- set root [customlib::GetBaseRoot]
- set xp1 "[spdAux::getRoute "SLLoads"]/condition/group"
- foreach group [$root selectNodes $xp1] {
- set groupid [$group @n]
- set groupid [write::GetWriteGroupName $groupid]
- #W "Writing mesh of Load $groupid"
- if {$groupid in [dict keys $ConditionsDictGroupIterators]} {
- ::write::writeGroupSubModelPart [[$group parent] @n] $groupid "Conditions" [dict get $ConditionsDictGroupIterators $groupid]
- } else {
- ::write::writeGroupSubModelPart [[$group parent] @n] $groupid "nodal"
- }
- }
-}
-
-
-proc Solid::write::writeCustomBlock { } {
- write::WriteString "Begin Custom"
- write::WriteString "Custom write for Solid, any app can call me, so be careful!"
- write::WriteString "End Custom"
- write::WriteString ""
-}
-
-proc Solid::write::getLastConditionId { } {
- variable ConditionsDictGroupIterators
- set top 1
- if {$ConditionsDictGroupIterators ne ""} {
- foreach {group iters} $ConditionsDictGroupIterators {
- set top [expr max($top,[lindex $iters 1])]
- }
- }
- return $top
-}
-
-# Custom files
-proc Solid::write::WriteMaterialsFile { } {
- variable validApps
-
- set filename "Materials.json"
- set mats_json [Solid::write::getPropertiesList SLParts]
-
- write::OpenFile $filename
- write::WriteJSON $mats_json
- write::CloseFile
-}
-
-proc Solid::write::WriteMaterialsFileOld { } {
- variable validApps
-
- set filename "Materials.json"
- set mats_json [Solid::write::getPropertiesList SLParts]
-
- write::OpenFile $filename
- write::WriteJSON $mats_json
- write::CloseFile
-
- write::OpenFile "materials.py"
-
- set str "
-from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7
-# Importing the Kratos Library
-from KratosMultiphysics import *
-from KratosMultiphysics.SolidMechanicsApplication import *
-from beam_sections_python_utility import SetProperties
-from beam_sections_python_utility import SetMaterialProperties
-
-def AssignMaterial(Properties):
- # material for solid material"
- foreach {part mat} [write::getMatDict] {
- if {[dict get $mat APPID] in $validApps} {
- set law_name [dict get $mat ConstitutiveLaw]
- set law_type [[Model::getConstitutiveLaw $law_name] getAttribute "Type"]
- set public_name [[Model::getConstitutiveLaw $law_name] getAttribute "pn"]
- if {$law_type eq "1D_UR"} {
- append str "
- prop_id = [dict get $mat MID];
- prop = Properties\[prop_id\]
-"
- if {$public_name eq "Circular"} {
- append str "
- section_type = \"$public_name\"
- prop_list = \[\]
- prop_list.append([dict get $mat DIAMETER])
- prop = SetProperties(section_type,prop_list,prop)
-"
- } elseif {$public_name eq "Tubular"} {
- append str "
- section_type = \"$public_name\"
- prop_list = \[\]
- prop_list.append([dict get $mat DIAMETER])
- prop_list.append([dict get $mat THICKNESS])
- prop = SetProperties(section_type,prop_list,prop)
-"
- } elseif {$public_name eq "Rectangular"} {
- append str "
- section_type = \"$public_name\"
- prop_list = \[\]
- prop_list.append([dict get $mat HEIGHT])
- prop_list.append([dict get $mat WIDTH])
- prop = SetProperties(section_type,prop_list,prop)
-"
- } elseif {$public_name eq "UserDefined"} {
- append str "
- section_type = \"$public_name\"
- prop_list = \[\]
- prop_list.append([dict get $mat AREA])
- prop_list.append([dict get $mat INERTIA_X])
- prop_list.append([dict get $mat INERTIA_Y])
- prop = SetProperties(section_type,prop_list,prop)
-"
- } elseif {$public_name eq "UserParameters"} {
- append str "
- section_type = \"UserDefined\"
- prop_list = \[\]
- prop_list.append([dict get $mat YOUNGxAREA])
- prop_list.append([dict get $mat SHEARxREDUCED_AREA])
- prop_list.append([dict get $mat YOUNGxINERTIA_X])
- prop_list.append([dict get $mat YOUNGxINERTIA_Y])
- prop_list.append([dict get $mat SHEARxPOLAR_INERTIA])
- prop = SetMaterialProperties(section_type,prop_list,prop)
-"
- } else {
- append str "
- section_type = \"$public_name\"
- prop_list = \[\]
- prop_list.append([dict get $mat SIZE])
- prop = SetProperties(section_type,prop_list,prop)
-"
- }
- } {
- append str "
- prop_id = [dict get $mat MID];
- prop = Properties\[prop_id\]
- mat = [dict get $mat ConstitutiveLaw]()
- prop.SetValue(CONSTITUTIVE_LAW, mat.Clone())
-"
-
- }
- }
- }
-
-if 0 {
- foreach {part mat} [write::getMatDict] {
- if {[dict get $mat APPID] in $validApps} {
- append str "
- prop_id = [dict get $mat MID];
- prop = Properties\[prop_id\]
- mat = [dict get $mat ConstitutiveLaw]()
- prop.SetValue(CONSTITUTIVE_LAW, mat.Clone())
- "
- }
- }
-}
- write::WriteString $str
- write::CloseFile
-
-}
-
-
-proc Solid::write::ProcessVectorFunctionComponents { groupNode condition process} {
- set processDict [write::GetProcessHeader $groupNode $process $condition]
- set val [write::GetInputValue $groupNode [$process getInputPn component]]
- foreach i $val {
- if {$i == "null"} {
- lappend value null
- } {
- lappend value $i
- }
- }
-
- dict set processDict Parameters compound_assignment [write::GetInputValue $groupNode [$process getInputPn compound_assignment]]
- dict set processDict Parameters value $value
-
-
- return $processDict
-}
-
-proc Solid::write::getPropertiesList {parts_un} {
- set mat_dict [write::getMatDict]
- set props_dict [dict create]
- set props [list ]
- set sections [list ]
-
- set python_module "assign_materials_process"
- set process_name "AssignMaterialsProcess"
- set help "This process creates a material and assigns its properties"
-
- #set doc $gid_groups_conds::doc
- #set root [$doc documentElement]
- set root [customlib::GetBaseRoot]
-
- set xp1 "[spdAux::getRoute $parts_un]/group"
- foreach gNode [$root selectNodes $xp1] {
- set group [get_domnode_attribute $gNode n]
- set sub_model_part [write::getSubModelPartId Parts $group]
- if { [dict exists $mat_dict $group] } {
- set law_id [dict get $mat_dict $group MID]
- set law_name [dict get $mat_dict $group ConstitutiveLaw]
- set law_type [[Model::getConstitutiveLaw $law_name] getAttribute "Type"]
- set mat_name [dict get $mat_dict $group Material]
-
- if {$law_type eq "1D_UR"} {
- set python_module "assign_sections_process"
- set process_name "AssignSectionsProcess"
- set help "This process creates a section and assigns its properties"
- }
-
- set prop_dict [dict create]
- set kratos_module [[Model::getConstitutiveLaw $law_name] getAttribute "kratos_module"]
- dict set prop_dict "python_module" $python_module
- dict set prop_dict "kratos_module" $kratos_module
- dict set prop_dict "help" $help
- dict set prop_dict "process_name" $process_name
-
- set exclusionList [list "MID" "APPID" "ConstitutiveLaw" "Material" "Element"]
- set variables_dict [dict create]
- foreach prop [dict keys [dict get $mat_dict $group] ] {
- if {$prop ni $exclusionList} {
- dict set variables_list $prop [write::getFormattedValue [dict get $mat_dict $group $prop]]
- }
- }
-
- set material_dict [dict create]
- dict set material_dict "model_part_name" $sub_model_part
- dict set material_dict "properties_id" $law_id
- dict set material_dict "material_name" $mat_name
-
- if {$law_type eq "1D_UR"} {
- set public_name [[Model::getConstitutiveLaw $law_name] getAttribute "pn"]
- dict set material_dict "section_type" $public_name
- } else {
- set law_full_name [join [list "KratosMultiphysics" $kratos_module $law_name] "."]
- dict set material_dict constitutive_law [dict create name $law_full_name]
- }
- dict set material_dict variables $variables_list
- dict set material_dict tables dictnull
- dict set prop_dict Parameters $material_dict
-
- lappend props $prop_dict
- }
-
- }
-
- dict set props_dict material_models_list $props
-
- return $props_dict
-}
-
-proc Solid::write::GetUsedElements { {get "Objects"} } {
- set xp1 "[spdAux::getRoute SLParts]/group"
- set lista [list ]
- foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] {
- set elem_name [get_domnode_attribute [$gNode selectNodes ".//value\[@n='Element']"] v]
- set e [Model::getElement $elem_name]
- if {$get eq "Name"} { set e [$e getName] }
- lappend lista $e
- }
- return $lista
-}
-
-proc Solid::write::GetDefaultOutputDict { {appid ""} } {
- set outputDict [dict create]
- set resultDict [dict create]
-
- if {$appid eq ""} {set results_UN Results } {set results_UN [apps::getAppUniqueName $appid Results]}
- set GiDPostDict [dict create]
- dict set GiDPostDict GiDPostMode [write::getValue $results_UN GiDPostMode]
- dict set GiDPostDict WriteDeformedMeshFlag [write::getValue $results_UN GiDWriteMeshFlag]
- dict set GiDPostDict WriteConditionsFlag [write::getValue $results_UN GiDWriteConditionsFlag]
- dict set GiDPostDict MultiFileFlag [write::getValue $results_UN GiDMultiFileFlag]
- dict set resultDict gidpost_flags $GiDPostDict
-
- dict set resultDict file_label [write::getValue $results_UN FileLabel]
- set outputCT [write::getValue $results_UN OutputControlType]
- dict set resultDict output_control_type $outputCT
- if {$outputCT eq "time"} {set frequency [write::getValue $results_UN OutputDeltaTime]} {set frequency [write::getValue $results_UN OutputDeltaStep]}
- dict set resultDict output_frequency $frequency
-
- dict set resultDict node_output [write::getValue $results_UN NodeOutput]
-
- #dict set resultDict plane_output [write::GetCutPlanesList $results_UN]
-
- dict set resultDict nodal_results [write::GetResultsList $results_UN OnNodes]
- dict set resultDict gauss_point_results [write::GetResultsList $results_UN OnElement]
-
- dict set outputDict "result_file_configuration" $resultDict
- #dict set outputDict "point_data_configuration" [write::GetEmptyList]
- return $outputDict
-}
-
-Solid::write::Init
diff --git a/kratos.gid/apps/Solid/write/writeProjectParameters.tcl b/kratos.gid/apps/Solid/write/writeProjectParameters.tcl
deleted file mode 100644
index d1f6b228b..000000000
--- a/kratos.gid/apps/Solid/write/writeProjectParameters.tcl
+++ /dev/null
@@ -1,177 +0,0 @@
-# Project Parameters
-
-proc Solid::write::getParametersDict { } {
- set model_name "Solid_Domain"
- set projectParametersDict [dict create]
-
- # Problem data
- set problemDataDict [dict create]
-
- # Add items
- set model_name [Kratos::GetModelName]
- dict set problemDataDict problem_name $model_name
-
- # Parallelization
- set paralleltype [write::getValue ParallelType]
- #dict set problemDataDict "parallel_type" $paralleltype
- if {$paralleltype eq "OpenMP"} {
- #set nthreads [write::getValue Parallelization OpenMPNumberOfThreads]
- #dict set problemDataDict NumberofThreads $nthreads
- } else {
- #set nthreads [write::getValue Parallelization MPINumberOfProcessors]
- #dict set problemDataDict NumberofProcessors $nthreads
- }
-
- set echo_level [write::getValue Results EchoLevel]
- dict set problemDataDict echo_level $echo_level
-
- # Add ProblemData to Parameters
- dict set projectParametersDict problem_data $problemDataDict
-
- # Time settings
- set timeDataDict [dict create]
- dict set timeDataDict time_step [write::getValue SLTimeParameters DeltaTime]
- dict set timeDataDict start_time [write::getValue SLTimeParameters StartTime]
- dict set timeDataDict end_time [write::getValue SLTimeParameters EndTime]
-
- dict set projectParametersDict time_settings $timeDataDict
-
- # Model data
- # Create section
- set modelDataDict [dict create]
-
- # Add items
- dict set modelDataDict model_name $model_name
- set nDim [expr [string range [write::getValue nDim] 0 0] ]
- dict set modelDataDict dimension $nDim
-
- dict set modelDataDict domain_parts_list [write::getSubModelPartNames "SLParts"]
- dict set modelDataDict processes_parts_list [write::getSubModelPartNames "SLNodalConditions" "SLLoads"]
-
- # Add model import settings
- set importDataDict [dict create]
- #dict set importDataDict type "mdpa"
- dict set importDataDict name $model_name
- #dict set importDataDict label 0
- dict set modelDataDict input_file_settings $importDataDict
-
- # Add ModelData to Parameters
- dict set projectParametersDict model_settings $modelDataDict
-
- # Solver settings
- set solverDataDict [dict create]
-
- set currentStrategyId [write::getValue SLSolStrat]
- set strategy_write_name [[::Model::GetSolutionStrategy $currentStrategyId] getAttribute "python_module"]
- dict set solverDataDict solver_type $strategy_write_name
-
- # Solver parameters
- set solverParametersDict [dict create]
-
- # Time integration settings
- set integrationDataDict [dict create]
-
- dict set integrationDataDict solution_type [write::getValue SLSoluType]
-
- set solutiontype [write::getValue SLSoluType]
- if {$solutiontype ne "Dynamic"} {
- dict set integrationDataDict integration_method [write::getValue SLScheme]
- dict set integrationDataDict analysis_type [write::getValue SLAnalysisType]
- } else {
- dict set integrationDataDict time_integration [write::getValue SLSolStrat]
- dict set integrationDataDict integration_method [write::getValue SLScheme]
- }
-
- # Solving strategy settings
- set strategyDataDict [dict create]
-
- # Solution strategy parameters and Solvers
- set strategyDataDict [dict merge $strategyDataDict [write::getSolutionStrategyParametersDict] ]
-
- # Get integration order as term for the integration settings
- set exist_time_integration [dict exists $strategyDataDict time_integration_order]
- if {$exist_time_integration eq 1} {
- dict set integrationDataDict time_integration_order [dict get $strategyDataDict time_integration_order]
- dict unset strategyDataDict time_integration_order
- }
-
- dict set solverParametersDict time_integration_settings $integrationDataDict
-
- # Get convergence criterion settings
- set convergenceDataDict [dict create]
- set exist_convergence_criterion [dict exists $strategyDataDict convergence_criterion]
- if {$exist_convergence_criterion eq 1} {
- dict set convergenceDataDict convergence_criterion [dict get $strategyDataDict convergence_criterion]
- dict unset strategyDataDict convergence_criterion
- set exist_variable_tolerances [dict exists $strategyDataDict variable_relative_tolerance]
- if {$exist_variable_tolerances eq 1} {
- dict set convergenceDataDict variable_relative_tolerance [dict get $strategyDataDict variable_relative_tolerance]
- dict set convergenceDataDict variable_absolute_tolerance [dict get $strategyDataDict variable_absolute_tolerance]
- dict unset strategyDataDict variable_relative_tolerance
- dict unset strategyDataDict variable_absolute_tolerance
- }
- set exist_residual_tolerances [dict exists $strategyDataDict residual_relative_tolerance]
- if {$exist_residual_tolerances eq 1} {
- dict set convergenceDataDict residual_relative_tolerance [dict get $strategyDataDict residual_relative_tolerance]
- dict set convergenceDataDict residual_absolute_tolerance [dict get $strategyDataDict residual_absolute_tolerance]
- dict unset strategyDataDict residual_relative_tolerance
- dict unset strategyDataDict residual_absolute_tolerance
- }
- }
-
- dict set solverParametersDict convergence_criterion_settings $convergenceDataDict
-
- set strategy_data_size [dict size $strategyDataDict]
- if { $strategy_data_size ne 0 } {
- dict set solverParametersDict solving_strategy_settings $strategyDataDict
- }
-
- # Linear solver settings
- set solverParametersDict [dict merge $solverParametersDict [write::getSolversParametersDict Solid] ]
-
- # Add Dofs
- dict set solverParametersDict dofs [list {*}[DofsInElements] ]
-
- dict set solverDataDict Parameters $solverParametersDict
-
- dict set projectParametersDict solver_settings $solverDataDict
-
- # Lists of processes
- set nodal_conditions_dict [write::getConditionsParametersDict SLNodalConditions "Nodal"]
- dict set projectParametersDict constraints_process_list $nodal_conditions_dict
-
- dict set projectParametersDict loads_process_list [write::getConditionsParametersDict SLLoads]
-
- # GiD output configuration
- dict set projectParametersDict output_configuration [Solid::write::GetDefaultOutputDict]
-
- # restart options
- set restartDict [dict create ]
- dict set restartDict SaveRestart false
- dict set restartDict RestartFrequency 0
- dict set restartDict LoadRestart false
- dict set restartDict Restart_Step 0
- #dict set projectParametersDict restart_options $restartDict
-
- return $projectParametersDict
-}
-
-proc Solid::write::DofsInElements { } {
- set dofs [list ]
- set root [customlib::GetBaseRoot]
- set xp1 "[spdAux::getRoute SLParts]/group/value\[@n='Element'\]"
- set elements [$root selectNodes $xp1]
- foreach element_node $elements {
- set elemid [$element_node @v]
- set elem [Model::getElement $elemid]
- foreach dof [split [$elem getAttribute "Dofs"] ","] {
- if {$dof ni $dofs} {lappend dofs $dof}
- }
- }
- return {*}$dofs
-}
-
-proc Solid::write::writeParametersEvent { } {
- write::WriteJSON [getParametersDict]
- write::SetParallelismConfiguration
-}
diff --git a/kratos.gid/apps/Solid/xml/BoundaryConditions.spd b/kratos.gid/apps/Solid/xml/BoundaryConditions.spd
deleted file mode 100644
index fc68d449e..000000000
--- a/kratos.gid/apps/Solid/xml/BoundaryConditions.spd
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/Conditions.xml b/kratos.gid/apps/Solid/xml/Conditions.xml
deleted file mode 100644
index 43c9a5463..000000000
--- a/kratos.gid/apps/Solid/xml/Conditions.xml
+++ /dev/null
@@ -1,378 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/ConstitutiveLaws.xml b/kratos.gid/apps/Solid/xml/ConstitutiveLaws.xml
deleted file mode 100644
index ea6ea7cc6..000000000
--- a/kratos.gid/apps/Solid/xml/ConstitutiveLaws.xml
+++ /dev/null
@@ -1,694 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/DeprecatedProcesses.xml b/kratos.gid/apps/Solid/xml/DeprecatedProcesses.xml
deleted file mode 100644
index 5de58ec3f..000000000
--- a/kratos.gid/apps/Solid/xml/DeprecatedProcesses.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/Elements.xml b/kratos.gid/apps/Solid/xml/Elements.xml
deleted file mode 100644
index 21a6ec0f1..000000000
--- a/kratos.gid/apps/Solid/xml/Elements.xml
+++ /dev/null
@@ -1,958 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/Fields.spd b/kratos.gid/apps/Solid/xml/Fields.spd
deleted file mode 100644
index 4d781b83e..000000000
--- a/kratos.gid/apps/Solid/xml/Fields.spd
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/Functions.spd b/kratos.gid/apps/Solid/xml/Functions.spd
deleted file mode 100644
index e2a9567a6..000000000
--- a/kratos.gid/apps/Solid/xml/Functions.spd
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/kratos.gid/apps/Solid/xml/Loads.spd b/kratos.gid/apps/Solid/xml/Loads.spd
deleted file mode 100644
index f9fc3166e..000000000
--- a/kratos.gid/apps/Solid/xml/Loads.spd
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/Main.spd b/kratos.gid/apps/Solid/xml/Main.spd
deleted file mode 100644
index 14b4000ec..000000000
--- a/kratos.gid/apps/Solid/xml/Main.spd
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/Materials.spd b/kratos.gid/apps/Solid/xml/Materials.spd
deleted file mode 100644
index 51f040cd2..000000000
--- a/kratos.gid/apps/Solid/xml/Materials.spd
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/Materials.xml b/kratos.gid/apps/Solid/xml/Materials.xml
deleted file mode 100644
index 5c769b544..000000000
--- a/kratos.gid/apps/Solid/xml/Materials.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/NodalConditions.xml b/kratos.gid/apps/Solid/xml/NodalConditions.xml
deleted file mode 100644
index 1a409ff4e..000000000
--- a/kratos.gid/apps/Solid/xml/NodalConditions.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/Parts.spd b/kratos.gid/apps/Solid/xml/Parts.spd
deleted file mode 100644
index 2ba7cf0f1..000000000
--- a/kratos.gid/apps/Solid/xml/Parts.spd
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/Processes.xml b/kratos.gid/apps/Solid/xml/Processes.xml
deleted file mode 100644
index 386f279ef..000000000
--- a/kratos.gid/apps/Solid/xml/Processes.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/Procs.spd b/kratos.gid/apps/Solid/xml/Procs.spd
deleted file mode 100644
index 172497ac8..000000000
--- a/kratos.gid/apps/Solid/xml/Procs.spd
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/kratos.gid/apps/Solid/xml/Results.spd b/kratos.gid/apps/Solid/xml/Results.spd
deleted file mode 100644
index 9e10fab2a..000000000
--- a/kratos.gid/apps/Solid/xml/Results.spd
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/SolutionStrategy.spd b/kratos.gid/apps/Solid/xml/SolutionStrategy.spd
deleted file mode 100644
index 63761ecdb..000000000
--- a/kratos.gid/apps/Solid/xml/SolutionStrategy.spd
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/StageInfo.spd b/kratos.gid/apps/Solid/xml/StageInfo.spd
deleted file mode 100644
index cbb7c6d35..000000000
--- a/kratos.gid/apps/Solid/xml/StageInfo.spd
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/Strategies.xml b/kratos.gid/apps/Solid/xml/Strategies.xml
deleted file mode 100644
index 23b66efb9..000000000
--- a/kratos.gid/apps/Solid/xml/Strategies.xml
+++ /dev/null
@@ -1,261 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/kratos.gid/apps/Solid/xml/XmlController.tcl b/kratos.gid/apps/Solid/xml/XmlController.tcl
deleted file mode 100644
index b4c76bdc7..000000000
--- a/kratos.gid/apps/Solid/xml/XmlController.tcl
+++ /dev/null
@@ -1,152 +0,0 @@
-namespace eval Solid::xml {
- variable dir
-}
-
-proc Solid::xml::Init { } {
- variable dir
- Model::InitVariables dir $Solid::dir
-
- Model::getSolutionStrategies Strategies.xml
- Model::getElements Elements.xml
- Model::getMaterials Materials.xml
- Model::getNodalConditions NodalConditions.xml
- Model::getConstitutiveLaws ConstitutiveLaws.xml
- Model::getProcesses DeprecatedProcesses.xml
- Model::getProcesses Processes.xml
- Model::getConditions Conditions.xml
- Model::getSolvers "../../Common/xml/Solvers.xml"
-
- # Model::ForgetElement SmallDisplacementBbarElement2D
- # Model::ForgetElement SmallDisplacementBbarElement3D
-
- # This solver is not working in kratos June 01 2018
- Model::ForgetSolver GMRESSolver
-}
-
-proc Solid::xml::getUniqueName {name} {
- return SL$name
-}
-
-proc Solid::xml::CustomTree { args } {
-
- set root [customlib::GetBaseRoot]
-
- #set icon data as default
- foreach node [$root getElementsByTagName value ] { $node setAttribute icon data }
-
- #intervals
- spdAux::SetValueOnTreeItem icon timeIntervals Intervals
- foreach node [$root selectNodes "[spdAux::getRoute Intervals]/blockdata"] {
- $node setAttribute icon select
- }
-
- #conditions
- foreach node [$root selectNodes "[spdAux::getRoute SLNodalConditions]/condition" ] {
- $node setAttribute icon select
- $node setAttribute groups_icon groupCreated
- }
-
- #loads
- foreach node [$root selectNodes "[spdAux::getRoute SLLoads]/condition" ] {
- $node setAttribute icon select
- $node setAttribute groups_icon groupCreated
- }
-
- #materials
- foreach node [$root selectNodes "[spdAux::getRoute SLMaterials]/blockdata" ] {
- $node setAttribute icon select
- }
-
- #solver settings
- foreach node [$root selectNodes "[spdAux::getRoute SLStratSection]/container\[@n = 'linear_solver_settings'\]" ] {
- $node setAttribute icon solvers
- }
-
- #linear solver parameters
- spdAux::SetValueOnTreeItem v 2000 SLImplicitlinear_solver_settings max_iteration
- spdAux::SetValueOnTreeItem v 1e-6 SLImplicitlinear_solver_settings tolerance
- spdAux::SetValueOnTreeItem v cg SLImplicitlinear_solver_settings krylov_type
-
- #results
- foreach result [list SPRING_2D BALLAST_2D AXIAL_TURN_2D AXIAL_VELOCITY_TURN_2D AXIAL_ACCELERATION_TURN_2D SPRING_3D BALLAST_3D AXIAL_TURN_3D AXIAL_VELOCITY_TURN_3D AXIAL_ACCELERATION_TURN_3D] {
- set result_node [$root selectNodes "[spdAux::getRoute NodalResults]/value\[@n = '$result'\]"]
- if { $result_node ne "" } {$result_node delete}
- }
-
- #units
- [$root selectNodes "/Kratos_data/blockdata\[@n = 'units'\]"] setAttribute icon setUnits
-
- # Initial state for Strategy Parameters
- # set solutionType [get_domnode_attribute [$root selectNodes [spdAux::getRoute SLSoluType]] v]
- # if {$solutionType ne "Dynamic"} {
- # [$root selectNodes [spdAux::getRoute SLStratParams]] setAttribute state hidden
- # }
-}
-
-
-proc Solid::xml::ProcGetSolutionStrategiesSolid { domNode args } {
- set names [list ]
- set pnames [list ]
- set solutionType [get_domnode_attribute [$domNode selectNodes [spdAux::getRoute SLSoluType]] v]
- set Sols [::Model::GetSolutionStrategies [list "SolutionType" $solutionType] ]
- set ids [list ]
- foreach ss $Sols {
- lappend names [$ss getName]
- lappend pnames [$ss getName]
- lappend pnames [$ss getPublicName]
- }
- $domNode setAttribute values [join $names ","]
- set dv [lindex $names 0]
- if {[$domNode getAttribute v] eq ""} {$domNode setAttribute v $dv; spdAux::RequestRefresh}
- if {[$domNode getAttribute v] ni $names} {$domNode setAttribute v $dv; spdAux::RequestRefresh}
-
- return [join $pnames ","]
-}
-
-proc Solid::xml::ProcCheckNodalConditionStateSolid {domNode args} {
- # Overwritten the base function to add Solution Type restrictions
- set parts_un SLParts
- if {[spdAux::getRoute $parts_un] ne ""} {
- set conditionId [$domNode @n]
- set elems [$domNode selectNodes "[spdAux::getRoute $parts_un]/group/value\[@n='Element'\]"]
- set elemnames [list ]
- foreach elem $elems { lappend elemnames [$elem @v]}
- set elemnames [lsort -unique $elemnames]
-
- set solutionType [get_domnode_attribute [$domNode selectNodes [spdAux::getRoute SLSoluType]] v]
- set params [list analysis_type $solutionType]
- if {[::Model::CheckElementsNodalCondition $conditionId $elemnames $params]} {return "normal"} else {return "hidden"}
- } {return "normal"}
-}
-
-proc Solid::xml::ProcCheckGeometrySolid {domNode args} {
- set ret "surface"
- if {$::Model::SpatialDimension eq "3D"} {
- set ret "line,surface,volume"
- } elseif {$::Model::SpatialDimension eq "2D"} {
- set ret "line,surface"
- } elseif {$::Model::SpatialDimension eq "1D"} {
- set ret "line"
- }
- return $ret
-}
-
-proc Solid::xml::ProcCheckStratParamsState {domNode args} {
- set ret "normal"
-
- set solutionType [get_domnode_attribute [$domNode selectNodes [spdAux::getRoute SLSoluType]] v]
- set analysisType [get_domnode_attribute [$domNode selectNodes [spdAux::getRoute SLAnalysisType]] v]
-
- if {$solutionType ne "Dynamic"} {
- # If Static or Quasi-static
- if {$analysisType eq "Linear"} {
- # If linear -> hide
- set ret "hidden"
- }
- }
-
- return $ret
-}
-
-
-Solid::xml::Init
diff --git a/kratos.gid/apps/StenosisWizard/app.json b/kratos.gid/apps/StenosisWizard/app.json
new file mode 100644
index 000000000..fbf50f9cf
--- /dev/null
+++ b/kratos.gid/apps/StenosisWizard/app.json
@@ -0,0 +1,28 @@
+{
+ "id": "StenosisWizard",
+ "name": "Stenosis",
+ "prefix": "FL",
+ "themed": false,
+ "kratos_name": "FluidDynamicsApplication",
+ "dimensions": [
+ "3D"
+ ],
+ "script_files": [
+ "start.tcl",
+ "xml/XmlController.tcl",
+ "write/write.tcl",
+ "wizard/wizard_steps.tcl"
+ ],
+ "start_script":"::StenosisWizard::Init",
+ "requeriments":{
+ "apps":["Fluid"],
+ "minimum_gid_version":"15.1.3d"
+ },
+ "permissions": {
+ "open_tree": false,
+ "show_toolbar": true,
+ "intervals": true,
+ "wizard": true
+ },
+ "main_launch_file": "../../exec/MainKratos.py"
+}
diff --git a/kratos.gid/apps/StenosisWizard/start.tcl b/kratos.gid/apps/StenosisWizard/start.tcl
index 2ef261cd2..7542c013a 100644
--- a/kratos.gid/apps/StenosisWizard/start.tcl
+++ b/kratos.gid/apps/StenosisWizard/start.tcl
@@ -1,72 +1,47 @@
namespace eval ::StenosisWizard {
+ Kratos::AddNamespace [namespace current]
+
# Variable declaration
variable dir
- variable kratos_name
- variable attributes
+ variable _app
+
+ proc GetAttribute {name} {variable _app; return [$_app getProperty $name]}
+ proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]}
+ proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]}
}
-proc ::StenosisWizard::Init { } {
+proc ::StenosisWizard::Init { app } {
# Variable initialization
variable dir
- variable kratos_name
- variable attributes
+ variable _app $app
+
+ set must_open_wizard_window 1
# Init Working directory
set dir [apps::getMyDir "StenosisWizard"]
- # We'll work on 3D space
- spdAux::SetSpatialDimmension "3D"
- # Load Fluid App
- apps::LoadAppById "Fluid"
-
+
spdAux::processIncludes
- set kratos_name $::Fluid::kratos_name
- # Don't open the tree
- set ::spdAux::TreeVisibility 0
-
- dict set attributes UseIntervals 1
-
- # Enable the Wizard Module
- Kratos::LoadWizardFiles
- LoadMyFiles
-}
-
-proc ::StenosisWizard::LoadMyFiles { } {
- variable dir
- uplevel #0 [list source [file join $dir xml XmlController.tcl]]
- uplevel #0 [list source [file join $dir write write.tcl]]
smart_wizard::LoadWizardDoc [file join $dir wizard Wizard_default.wiz]
- uplevel #0 [list source [file join $dir wizard Wizard_Steps.tcl]]
smart_wizard::ImportWizardData
+
+ StenosisWizard::xml::Init
+ StenosisWizard::write::Init
# Init the Wizard Window
after 600 [::StenosisWizard::StartWizardWindow]
}
-
proc ::StenosisWizard::StartWizardWindow { } {
variable dir
gid_groups_conds::close_all_windows
smart_wizard::Init
- uplevel #0 [list source [file join $dir wizard Wizard_Steps.tcl]]
smart_wizard::SetWizardNamespace "::StenosisWizard::Wizard"
smart_wizard::SetWizardWindowName ".gid.activewizard"
smart_wizard::SetWizardImageDirectory [file join $dir images]
smart_wizard::LoadWizardDoc [file join $dir wizard Wizard_default.wiz]
smart_wizard::ImportWizardData
-
- smart_wizard::CreateWindow
+ smart_wizard::CreateWindow
}
-proc ::StenosisWizard::CustomToolbarItems { } {
- return "-1"
-}
-proc ::StenosisWizard::GetAttribute {name} {
- variable attributes
- set value ""
- if {[dict exists $attributes $name]} {set value [dict get $attributes $name]}
- return $value
-}
-
-::StenosisWizard::Init
diff --git a/kratos.gid/apps/StenosisWizard/wizard/Wizard_Steps.tcl b/kratos.gid/apps/StenosisWizard/wizard/Wizard_Steps.tcl
index bc9f93728..37b9e99fc 100644
--- a/kratos.gid/apps/StenosisWizard/wizard/Wizard_Steps.tcl
+++ b/kratos.gid/apps/StenosisWizard/wizard/Wizard_Steps.tcl
@@ -1,13 +1,21 @@
-namespace eval StenosisWizard::Wizard {
+namespace eval ::StenosisWizard::Wizard {
+ namespace path ::StenosisWizard
+ Kratos::AddNamespace [namespace current]
+
# Namespace variables declaration
variable curr_win
+ variable ogl_cuts
}
proc StenosisWizard::Wizard::Init { } {
#W "Carga los pasos"
variable curr_win
set curr_win ""
+ variable draw_cuts_name
+ set draw_cuts_name StenosisWizard_cuts
+ variable draw_render_name
+ set draw_render_name StenosisWizard_render
}
proc StenosisWizard::Wizard::Geometry { win } {
@@ -24,7 +32,7 @@ proc StenosisWizard::Wizard::GeometryTypeChange { } {
if {[GiDVersionCmp 14.1.3d] >= 0} {
switch $type {
"Circular" {
- smart_wizard::SetProperty Geometry Length,value 100
+ smart_wizard::SetProperty Geometry Length,value 200
smart_wizard::SetProperty Geometry Delta,value 3.18
smart_wizard::SetProperty Geometry Precision,state normal
smart_wizard::SetProperty Geometry SphRadius,state hidden
@@ -107,6 +115,7 @@ proc StenosisWizard::Wizard::DrawGeometry {} {
proc StenosisWizard::Wizard::DrawTriangular {length radius start end delta } {
GidUtils::DisableGraphics
+
set origin_x [expr double($length)/-2]
set end_x [expr double($length)/2]
@@ -148,9 +157,7 @@ proc StenosisWizard::Wizard::DrawSpherical {length radius start end delta sphrad
set origin_x [expr double($length)/-2]
set end_x [expr double($length)/2]
- # set m2 [expr double($end) / double ($delta)]
- # set m1 [expr double($delta) / double($end) *-1.0]
- # vGarate set ycenter [expr double($delta)/2-$m2*double($end)/2]
+
set hdelta [expr double($delta) - double($radius)]
set ycenter [expr double ($hdelta) - double($sphradius)]
@@ -193,7 +200,7 @@ proc StenosisWizard::Wizard::DrawPolygonal {length radius start end delta tpoly
GidUtils::DisableGraphics
set origin_x [expr double($length)/-2]
set end_x [expr double($length)/2]
-
+
set halfpoly [expr double($tpoly)/2]
set hdelta [expr $delta - $radius]
@@ -250,10 +257,12 @@ proc StenosisWizard::Wizard::DrawCircular {length radius start end delta precisi
set zona [expr $end - $start]
set delta_z [expr double($zona) / double($precision)]
-
+ set origin_x [expr double($length)/-2]
+ set end_x [expr double($length)/2]
+
# Initial point
- lappend points [list -$length $radius 0]
- GiD_Geometry create point 1 $layer -$length $radius 0
+ lappend points [list $origin_x $radius 0]
+ GiD_Geometry create point 1 $layer $origin_x $radius 0
# first cut
lappend points [list $start $radius 0]
@@ -269,8 +278,8 @@ proc StenosisWizard::Wizard::DrawCircular {length radius start end delta precisi
# last cut
lappend points [list $end $radius 0]
# Final point
- GiD_Geometry create point 2 $layer $length $radius 0
- lappend points [list $length $radius 0]
+ GiD_Geometry create point 2 $layer $end_x $radius 0
+ lappend points [list $end_x $radius 0]
set line [GiD_Geometry create line append nurbsline $layer 1 2 -interpolate [llength $points] {*}$points -tangents {1 0 0} {1 0 0}]
@@ -378,10 +387,12 @@ proc StenosisWizard::Wizard::NextFluid { } {
proc StenosisWizard::Wizard::Simulation { win } {
smart_wizard::AutoStep $win Simulation
- smart_wizard::SetWindowSize 450 500
+ smart_wizard::SetWindowSize 450 600
}
proc StenosisWizard::Wizard::Mesh { } {
+ LastStep
+ StenosisWizard::Wizard::UnregisterDrawCuts
if {[lindex [GiD_Info Mesh] 0]>0} {
#GiD_Process Mescape Meshing reset Yes
GiD_Process Mescape Meshing CancelMesh PreserveFrozen Yes
@@ -394,6 +405,7 @@ proc StenosisWizard::Wizard::Mesh { } {
MeshGenerationOKDo $mesh
}
proc StenosisWizard::Wizard::Save { } {
+ LastStep
GiD_Process Mescape Files Save
}
@@ -422,44 +434,241 @@ proc StenosisWizard::Wizard::LastStep { } {
gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='SolutionStrat']/container[@n='TimeParameters']/value[@n='EndTime']} "v $end"
gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='SolutionStrat']/container[@n='TimeParameters']/value[@n='DeltaTime']} "v $delta"
+
+ PlaceCutPlanes
+
+ #gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='SolutionStrat']/container[@n='velocity_linear_solver_settings']/value[@n='Solver']} {v Conjugate_gradient}
+ #gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='SolutionStrat']/container[@n='pressure_linear_solver_settings']/value[@n='Solver']} {v Conjugate_gradient}
+ spdAux::RequestRefresh
+
+}
+
+proc StenosisWizard::Wizard::PlaceCutPlanes { } {
set ncuts [smart_wizard::GetProperty Simulation Cuts,value]
set length [smart_wizard::GetProperty Geometry Length,value]
- set delta [expr 2.0*double($length)/(double($ncuts)+1.0)]
- #W "$length $delta"
+ set delta [expr double($length)/(double($ncuts)+1.0)]
+ set orig_x [ expr $length*-0.5]
+
+ set angle [smart_wizard::GetProperty Simulation Bending,value]
# Cut planes
- #gid_groups_conds::copyNode {container[@n='Fluid']/container[@n='Results']/container[@n='CutPlanes']/blockdata[@n='CutPlane'][1]} {container[@n='Fluid']/container[@n='Results']/container[@n='CutPlanes']}
-
- #gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='Results']/container[@n='CutPlanes']/blockdata[@n='CutPlane'][2]} {name Main}
- #gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='Results']/container[@n='CutPlanes']/blockdata[@n='CutPlane'][2]/value[@n='normal']} {v 0.0,1.0,0.0}
- spdAux::ClearCutPlanes
- set cutplane_xp "[spdAux::getRoute CutPlanes]/blockdata\[1\]"
-
- for {set i 1} {$i <= $ncuts} {incr i} {
- set x [expr -$length + ($i * $delta)]
- set x [expr double(round(100*$x))/100]
+ set cuts_enabled 1
+ if {$cuts_enabled} {
+ spdAux::ClearCutPlanes
+ set cutplane_xp "[spdAux::getRoute CutPlanes]/blockdata\[1\]"
+
+ for {set i 1} {$i <= $ncuts} {incr i} {
+ set x [expr $orig_x + ($i * $delta)]
+ set x [expr double(round(100*$x))/100]
+ gid_groups_conds::copyNode $cutplane_xp [spdAux::getRoute CutPlanes]
+ set cutplane "[spdAux::getRoute CutPlanes]/blockdata\[@n='CutPlane'\]\[[expr $i +1]\]"
+ gid_groups_conds::setAttributesF $cutplane "name CutPlane$i"
+
+ set coords [list [objarray new doublearray -values [list $x $x $x]] [objarray new doublearray -values {0.0 1.0 0.0}] [objarray new doublearray -values {0.0 0.0 1.0}]]
+ set new_nodes [StenosisWizard::Wizard::BendNodes $orig_x $length [expr $angle/2] $coords]
+ set o [list [objarray get [lindex $new_nodes 0] 0] [objarray get [lindex $new_nodes 1] 0] [objarray get [lindex $new_nodes 2] 0] ]
+ set p1 [list [objarray get [lindex $new_nodes 0] 1] [objarray get [lindex $new_nodes 1] 1] [objarray get [lindex $new_nodes 2] 1] ]
+ set p2 [list [objarray get [lindex $new_nodes 0] 2] [objarray get [lindex $new_nodes 1] 2] [objarray get [lindex $new_nodes 2] 2] ]
+ set v1 [math::linearalgebra::sub $p1 $o]
+ set v2 [math::linearalgebra::sub $p2 $o]
+ set v_norm [::math::linearalgebra::crossproduct $v1 $v2]
+ gid_groups_conds::setAttributesF "$cutplane/value\[@n='normal'\]" "v [join $v_norm {,}]"
+ gid_groups_conds::setAttributesF "$cutplane/value\[@n='point'\]" "v [join $o {,}]"
+ }
+
+ set x 0.0
+ set coords [list [objarray new doublearray -values [list $x [expr $x +1] $x]] [objarray new doublearray -values {0.0 0.0 0.0}] [objarray new doublearray -values {0.0 0.0 1.0}]]
+ set new_nodes [StenosisWizard::Wizard::BendNodes $orig_x $length [expr $angle/2] $coords]
+ set o [list [objarray get [lindex $new_nodes 0] 0] [objarray get [lindex $new_nodes 1] 0] [objarray get [lindex $new_nodes 2] 0] ]
+
+ set p1 [list [objarray get [lindex $new_nodes 0] 1] [objarray get [lindex $new_nodes 1] 1] [objarray get [lindex $new_nodes 2] 1] ]
+ set p2 [list [objarray get [lindex $new_nodes 0] 2] [objarray get [lindex $new_nodes 1] 2] [objarray get [lindex $new_nodes 2] 2] ]
+ set v1 [math::linearalgebra::sub $p1 $o]
+ set v2 [math::linearalgebra::sub $p2 $o]
+ set v_norm [::math::linearalgebra::crossproduct $v1 $v2]
gid_groups_conds::copyNode $cutplane_xp [spdAux::getRoute CutPlanes]
- set cutplane "[spdAux::getRoute CutPlanes]/blockdata\[@n='CutPlane'\]\[[expr $i +1]\]"
- gid_groups_conds::setAttributesF $cutplane "name CutPlane$i"
- gid_groups_conds::setAttributesF "$cutplane/value\[@n='normal'\]" "v 1.0,0.0,0.0"
- gid_groups_conds::setAttributesF "$cutplane/value\[@n='point'\]" "v $x,0.0,0.0"
+ set cutplane "[spdAux::getRoute CutPlanes]/blockdata\[@n='CutPlane'\]\[[expr $ncuts +2]\]"
+ gid_groups_conds::setAttributesF $cutplane "name CutPlane[expr $ncuts +1]"
+ gid_groups_conds::setAttributesF "$cutplane/value\[@n='normal'\]" "v [join $v_norm {,}]"
+ gid_groups_conds::setAttributesF "$cutplane/value\[@n='point'\]" "v [join $o {,}]"
}
- gid_groups_conds::copyNode $cutplane_xp [spdAux::getRoute CutPlanes]
- set cutplane "[spdAux::getRoute CutPlanes]/blockdata\[@n='CutPlane'\]\[[expr $ncuts +2]\]"
- gid_groups_conds::setAttributesF $cutplane "name CutPlane[expr $ncuts +1]"
- gid_groups_conds::setAttributesF "$cutplane/value\[@n='normal'\]" "v 0.0,1.0,0.0"
-
- #gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='SolutionStrat']/container[@n='velocity_linear_solver_settings']/value[@n='Solver']} {v Conjugate_gradient}
- #gid_groups_conds::setAttributesF {container[@n='Fluid']/container[@n='SolutionStrat']/container[@n='pressure_linear_solver_settings']/value[@n='Solver']} {v Conjugate_gradient}
- spdAux::RequestRefresh
-
}
proc StenosisWizard::AfterMeshGeneration { fail } {
+
GidUtils::CloseWindow MESHPROGRESS
GiD_Process Mescape Mescape Mescape
GiD_Process Mescape Files Save
+ StenosisWizard::Wizard::PostMeshBend
+ GiD_Process Mescape Files Save
+}
+
+
+proc StenosisWizard::Wizard::PostMeshBend { } {
+
+ set length [ smart_wizard::GetProperty Geometry Length,value]
+ set orig_x [ expr $length*-0.5]
+ set angle [ smart_wizard::GetProperty Simulation Bending,value]
+ set angle [expr $angle/2]
+ GidUtils::DisableGraphics
+ StenosisWizard::Wizard::Bend $orig_x $length $angle
+ GidUtils::EnableGraphics
+ GiD_Process Mescape Meshing MeshView escape
+ GiD_Process 'Redraw
+}
+
+proc StenosisWizard::Wizard::Bend { orig_x len angle} {
+
+ lassign [GiD_Info Mesh nodes -array] ids coords
+ set moved_nodes [StenosisWizard::Wizard::BendNodes $orig_x $len $angle $coords]
+ lassign $moved_nodes coord_x coord_y coord_z
+ set size [objarray length $coord_x]
+ for {set i 0} {$i < $size} {incr i} {
+ set res_x [objarray get $coord_x $i]
+ set res_y [objarray get $coord_y $i]
+ set res_z [objarray get $coord_z $i]
+ GiD_Mesh edit node [objarray get $ids $i] [list $res_x $res_y $res_z]
+ }
+}
+
+proc StenosisWizard::Wizard::BendNodes {orig_x len angle coords} {
+ lassign $coords coord_x coord_y coord_z
+ set size [objarray length $coord_x]
+ set result_x [objarray new doublearray $size 0.0]
+ set result_y [objarray new doublearray $size 0.0]
+ set result_z [objarray new doublearray $size 0.0]
+
+ for {set i 0} {$i < $size} {incr i} {
+ # primera parte
+ set old_val_x [objarray get $coord_x $i]
+ set old_val_y [objarray get $coord_y $i]
+ set old_val_z [objarray get $coord_z $i]
+ set dist_x [expr $old_val_x - $orig_x]
+ set ang [expr $angle*$dist_x/$len]
+ set ang [expr {double(round(10000*$ang))/10000}]
+ set res_x [expr $old_val_x + sin($ang) * $old_val_y]
+ set res_y [expr cos($ang) *$old_val_y]
+ set res_z $old_val_z
+
+ # segunda parte
+ set ang2 [expr $angle*($old_val_x - $orig_x)/$len]
+ set res_x_tmp $res_x
+ set x_rel [expr $res_x_tmp - $orig_x]
+
+ # Store the nodes final position
+ objarray set $result_x $i [expr $orig_x + cos($ang2)*($x_rel) + sin($ang2)*$res_y]
+ objarray set $result_y $i [expr -sin($ang2)*($x_rel) + cos($ang2)*$res_y]
+ objarray set $result_z $i $old_val_z
+ }
+ return [list $result_x $result_y $result_z]
+}
+
+proc StenosisWizard::Wizard::UnregisterDrawCuts { } {
+ variable draw_cuts_name
+ Drawer::Unregister $draw_cuts_name
+ GiD_Process 'Redraw
+ smart_wizard::SetProperty Simulation ViewCuts,name "Draw cuts"
+}
+
+proc StenosisWizard::Wizard::DrawCuts { } {
+ variable draw_cuts_name
+ variable curr_win
+ if {[Drawer::IsRegistered $draw_cuts_name]} {
+ StenosisWizard::Wizard::UnregisterDrawCuts
+ } else {
+ set planes [write::GetCutPlanesList]
+ set glob_cuts [list ]
+ foreach plane $planes {
+ set center [dict get $plane point]
+ set normal [dict get $plane normal]
+ lassign [MathUtils::CalculateLocalAxisFromXAxis $normal] v1 v2
+
+ # set v1 [list [expr -1.0*[lindex $normal 0]] [lindex $normal 1] [lindex $normal 2]]
+ # set v2 [list [lindex $normal 0] [lindex $normal 1] 1]
+ set c1 [MathUtils::VectorSum $center [MathUtils::ScalarByVectorProd 30 $v1]]
+ set c2 [MathUtils::VectorSum $center [MathUtils::ScalarByVectorProd 30 $v2]]
+ set c3 [MathUtils::VectorSum $center [MathUtils::ScalarByVectorProd -30 $v1]]
+ set c4 [MathUtils::VectorSum $center [MathUtils::ScalarByVectorProd -30 $v2]]
+
+ lappend glob_cuts [list $c1 $c2 $c3 $c4]
+ }
+ Drawer::Register $draw_cuts_name StenosisWizard::Wizard::RedrawCuts $glob_cuts
+ smart_wizard::SetProperty Simulation ViewCuts,name "End draw cuts"
+ }
+ GiD_Process 'Redraw
+ StenosisWizard::Wizard::Simulation $curr_win
+}
+
+proc StenosisWizard::Wizard::RedrawCuts { } {
+ variable draw_cuts_name
+ # blue
+ GiD_OpenGL draw -color "0.0 0.0 1.0"
+ foreach cuadrado [Drawer::GetVars $draw_cuts_name] {
+ lassign $cuadrado c1 c2 c3 c4
+ GiD_OpenGL draw -begin lineloop
+ GiD_OpenGL draw -vertex $c1
+ GiD_OpenGL draw -vertex $c2
+ GiD_OpenGL draw -vertex $c3
+ GiD_OpenGL draw -vertex $c4
+ GiD_OpenGL draw -end
+ }
+}
+
+proc StenosisWizard::Wizard::PreviewCurvature {} {
+ variable draw_render_name
+ variable curr_win
+ if {[Drawer::IsRegistered $draw_render_name]} {
+ StenosisWizard::Wizard::UnregisterDrawPrecurvature
+ } else {
+ set surfaces [GiD_Geometry -v2 list surface]
+
+ set x [list ]
+ set y [list ]
+ set z [list ]
+
+ foreach surface_id $surfaces {
+ lassign [GiD_Geometry get surface $surface_id -force render_mesh] elemtype elementnnodes nodes elements normals uvs
+ foreach {cx cy cz} $nodes {
+ lappend x $cx
+ lappend y $cy
+ lappend z $cz
+ }
+ }
+ set coords [list [objarray new doublearray -values $x] [objarray new doublearray -values $y] [objarray new doublearray -values $z]]
+
+ set length [ smart_wizard::GetProperty Geometry Length,value]
+ set orig_x [ expr $length*-0.5]
+ set angle [ smart_wizard::GetProperty Simulation Bending,value]
+ set angle [expr $angle/2]
+ set nodes [StenosisWizard::Wizard::BendNodes $orig_x $length $angle $coords]
+
+ Drawer::Register $draw_render_name StenosisWizard::Wizard::RedrawRenderBended $nodes
+
+ smart_wizard::SetProperty Simulation PreviewCurvature,name "End preview curvature"
+ }
+ GiD_Process 'Redraw
+ StenosisWizard::Wizard::Simulation $curr_win
+}
+
+
+proc StenosisWizard::Wizard::UnregisterDrawPrecurvature { } {
+ variable draw_render_name
+ Drawer::Unregister $draw_render_name
+ GiD_Process 'Redraw
+ smart_wizard::SetProperty Simulation PreviewCurvature,name "Preview curvature"
+}
+
+proc StenosisWizard::Wizard::RedrawRenderBended { } {
+ variable draw_render_name
+ # blue
+ GiD_OpenGL draw -color "0.0 0.0 1.0" -pointsize 3
+ lassign [Drawer::GetVars $draw_render_name] x y z
+ GiD_OpenGL draw -begin points
+ foreach cx $x cy $y cz $z {
+ GiD_OpenGL draw -vertex [list $cx $cy $cz]
+ }
+ GiD_OpenGL draw -end
}
StenosisWizard::Wizard::Init
diff --git a/kratos.gid/apps/StenosisWizard/wizard/Wizard_default.wiz b/kratos.gid/apps/StenosisWizard/wizard/Wizard_default.wiz
index b150d66b5..06344317c 100644
--- a/kratos.gid/apps/StenosisWizard/wizard/Wizard_default.wiz
+++ b/kratos.gid/apps/StenosisWizard/wizard/Wizard_default.wiz
@@ -8,13 +8,13 @@
-
+
-
+
@@ -49,15 +49,19 @@
+
+
+
+
-
+
diff --git a/kratos.gid/apps/StenosisWizard/write/write.tcl b/kratos.gid/apps/StenosisWizard/write/write.tcl
index 52b18f534..efdbac8f2 100644
--- a/kratos.gid/apps/StenosisWizard/write/write.tcl
+++ b/kratos.gid/apps/StenosisWizard/write/write.tcl
@@ -1,4 +1,6 @@
-namespace eval StenosisWizard::write {
+namespace eval ::StenosisWizard::write {
+ namespace path ::StenosisWizard
+ Kratos::AddNamespace [namespace current]
}
@@ -8,13 +10,11 @@ proc StenosisWizard::write::Init { } {
proc StenosisWizard::write::writeCustomFilesEvent { } {
- Fluid::write::WriteMaterialsFile
- write::CopyFileIntoModel "../Fluid/python/KratosFluid.py"
- write::RenameFileInModel "KratosFluid.py" "MainKratos.py"
+ ::Fluid::write::writeCustomFilesEvent
+ ::Fluid::write::SetAttribute main_launch_file [StenosisWizard::GetAttribute main_launch_file]
}
# MDPA Blocks
-
proc StenosisWizard::write::writeModelPartEvent { } {
Fluid::write::AddValidApps StenosisWizard
write::writeAppMDPA Fluid
@@ -25,5 +25,3 @@ proc StenosisWizard::write::writeParametersEvent { } {
set project_parameters_dict [::Fluid::write::getParametersDict]
write::WriteJSON $project_parameters_dict
}
-
-StenosisWizard::write::Init
diff --git a/kratos.gid/apps/StenosisWizard/xml/Procs.spd b/kratos.gid/apps/StenosisWizard/xml/Procs.spd
index 53779c99b..bb0205fb1 100644
--- a/kratos.gid/apps/StenosisWizard/xml/Procs.spd
+++ b/kratos.gid/apps/StenosisWizard/xml/Procs.spd
@@ -35,4 +35,9 @@
return $r
]]>
+
+
+
\ No newline at end of file
diff --git a/kratos.gid/apps/StenosisWizard/xml/XmlController.tcl b/kratos.gid/apps/StenosisWizard/xml/XmlController.tcl
index 581014677..9d047bed3 100644
--- a/kratos.gid/apps/StenosisWizard/xml/XmlController.tcl
+++ b/kratos.gid/apps/StenosisWizard/xml/XmlController.tcl
@@ -1,12 +1,12 @@
-namespace eval StenosisWizard::xml {
- variable dir
+namespace eval ::StenosisWizard::xml {
+ namespace path ::StenosisWizard
+ Kratos::AddNamespace [namespace current]
}
proc StenosisWizard::xml::Init { } {
- variable dir
- Model::InitVariables dir $StenosisWizard::dir
+ Model::InitVariables dir $::StenosisWizard::dir
- spdAux::processIncludes
+ spdAux::processIncludes
}
proc StenosisWizard::xml::CustomTree {args} {
@@ -16,14 +16,12 @@ proc StenosisWizard::xml::CustomTree {args} {
}
proc StenosisWizard::xml::getUniqueName {name} {
- return StenWiz$name
+ return [::StenosisWizard::GetAttribute prefix]$name
}
proc ::StenosisWizard::xml::MultiAppEvent {args} {
- if {$args eq "init"} {
- spdAux::parseRoutes
- spdAux::ConvertAllUniqueNames FL StenWiz
- }
+ if {$args eq "init"} {
+ spdAux::parseRoutes
+ spdAux::ConvertAllUniqueNames FL StenWiz
+ }
}
-
-StenosisWizard::xml::Init
diff --git a/kratos.gid/apps/Stent/app.json b/kratos.gid/apps/Stent/app.json
new file mode 100644
index 000000000..f2d076ebb
--- /dev/null
+++ b/kratos.gid/apps/Stent/app.json
@@ -0,0 +1,30 @@
+{
+ "id": "Stent",
+ "name": "Stent",
+ "prefix": "ST",
+ "themed": false,
+ "kratos_name": "StructuralMechanicsApplication",
+ "dimensions": [
+ "3D"
+ ],
+ "script_files": [
+ "start.tcl",
+ "xml/XmlController.tcl",
+ "write/write.tcl",
+ "wizard/StentGeometry.tcl"
+ ],
+ "start_script": "::Stent::Init",
+ "requeriments": {
+ "apps": [
+ "Structural"
+ ],
+ "minimum_gid_version": "15.1.3d"
+ },
+ "permissions": {
+ "open_tree": true,
+ "show_toolbar": true,
+ "intervals": true,
+ "wizard": true
+ },
+ "main_launch_file": "../../exec/MainKratos.py"
+}
\ No newline at end of file
diff --git a/kratos.gid/apps/Stent/python/KratosStructural.py b/kratos.gid/apps/Stent/python/KratosStructural.py
deleted file mode 100644
index ef6a15636..000000000
--- a/kratos.gid/apps/Stent/python/KratosStructural.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7
-
-import KratosMultiphysics
-from KratosMultiphysics.StructuralMechanicsApplication.structural_mechanics_analysis import StructuralMechanicsAnalysis
-
-"""
-For user-scripting it is intended that a new class is derived
-from StructuralMechanicsAnalysis to do modifications
-"""
-
-if __name__ == "__main__":
-
- with open("ProjectParameters.json",'r') as parameter_file:
- parameters = KratosMultiphysics.Parameters(parameter_file.read())
-
- model = KratosMultiphysics.Model()
- simulation = StructuralMechanicsAnalysis(model,parameters)
- simulation.Run()
diff --git a/kratos.gid/apps/Stent/start.tcl b/kratos.gid/apps/Stent/start.tcl
index 4f318790c..4f9b994bf 100644
--- a/kratos.gid/apps/Stent/start.tcl
+++ b/kratos.gid/apps/Stent/start.tcl
@@ -1,56 +1,31 @@
namespace eval ::Stent {
+ Kratos::AddNamespace [namespace current]
+
# Variable declaration
variable dir
variable app_id
+
+ proc GetAttribute {name} {variable _app; return [$_app getProperty $name]}
+ proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]}
+ proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]}
}
-proc ::Stent::Init { } {
+proc ::Stent::Init { app } {
# Variable initialization
variable dir
- variable attributes
- variable kratos_name
- variable app_id
+ variable _app
- if {[GiDVersionCmp 14.1.3d] < 0} {
- W "Minimum GiD version recommended 14.1.3d"
- W "Download it at https://www.gidhome.com/download/developer-versions/"
- }
-
- set app_id Stent
set dir [apps::getMyDir "Stent"]
-
- # We'll work on 3D space
- spdAux::SetSpatialDimmension "3D"
- # Load Fluid App
- apps::LoadAppById "Structural"
-
+ set _app $app
+
spdAux::processIncludes
- set attributes [dict create]
-
- # Allow to open the tree
- set ::spdAux::TreeVisibility 1
-
- # Intervals
- dict set attributes UseIntervals 1
- if {$::Kratos::kratos_private(DevMode) eq "dev"} {dict set attributes UseIntervals 1}
-
- set kratos_name StructuralMechanicsApplication
-
- # Enable the Wizard Module
- Kratos::LoadWizardFiles
- LoadMyFiles
-}
-
-proc ::Stent::LoadMyFiles { } {
- variable dir
-
- uplevel #0 [list source [file join $dir xml XmlController.tcl]]
- uplevel #0 [list source [file join $dir write write.tcl]]
-
smart_wizard::LoadWizardDoc [file join $dir wizard StentGeometry_default.wiz]
- uplevel #0 [list source [file join $dir wizard StentGeometry.tcl]]
smart_wizard::ImportWizardData
+
+ Stent::xml::Init
+ Stent::write::Init
+
}
proc ::Stent::StartWizardWindow { } {
@@ -71,13 +46,8 @@ proc ::Stent::CustomToolbarItems { } {
variable dir
Kratos::ToolbarAddItem "Generator" "example.png" [list -np- ::Stent::StartWizardWindow] [= "Geometry generator"]
-
-
}
proc ::Stent::BeforeMeshGeneration { size } {
::Structural::BeforeMeshGeneration $size
}
-
-
-::Stent::Init
diff --git a/kratos.gid/apps/Stent/wizard/StentGeometry.tcl b/kratos.gid/apps/Stent/wizard/StentGeometry.tcl
index c5fca9cf2..0bde434dd 100644
--- a/kratos.gid/apps/Stent/wizard/StentGeometry.tcl
+++ b/kratos.gid/apps/Stent/wizard/StentGeometry.tcl
@@ -1,4 +1,7 @@
-namespace eval Stent::Wizard {
+namespace eval ::Stent::Wizard {
+ namespace path ::Stent
+ Kratos::AddNamespace [namespace current]
+
# Namespace variables declaration
variable curr_win
diff --git a/kratos.gid/apps/Stent/write/write.tcl b/kratos.gid/apps/Stent/write/write.tcl
index f274715f2..7e5a9623a 100644
--- a/kratos.gid/apps/Stent/write/write.tcl
+++ b/kratos.gid/apps/Stent/write/write.tcl
@@ -1,26 +1,18 @@
-namespace eval Stent::write {
-}
+namespace eval ::Stent::write {
+ namespace path ::Stent
+ Kratos::AddNamespace [namespace current]
+ }
-proc Stent::write::Init { } {
- #Structural::write::Init
-}
+proc Stent::write::Init { } { }
# MDPA Blocks
-proc Stent::write::writeModelPartEvent { } {
- Structural::write::writeModelPartEvent
-}
+proc Stent::write::writeModelPartEvent { } {Structural::write::writeModelPartEvent}
-# Custom files
-proc Stent::write::WriteMaterialsFile { } {
- Structural::write::WriteMaterialsFile
-}
+# Materials
+proc Stent::write::WriteMaterialsFile { } {Structural::write::WriteMaterialsFile}
-proc Stent::write::writeCustomFilesEvent { } {
- Structural::write::writeCustomFilesEvent
-}
-proc Stent::write::writeParametersEvent { } {
- Structural::write::writeParametersEvent
-
-}
+# Custom files
+proc Stent::write::writeCustomFilesEvent { } {Structural::write::writeCustomFilesEvent}
-Stent::write::Init
+# Project parameters
+proc Stent::write::writeParametersEvent { } {Structural::write::writeParametersEvent}
diff --git a/kratos.gid/apps/Stent/xml/XmlController.tcl b/kratos.gid/apps/Stent/xml/XmlController.tcl
index 59e354e21..f4c4ff587 100644
--- a/kratos.gid/apps/Stent/xml/XmlController.tcl
+++ b/kratos.gid/apps/Stent/xml/XmlController.tcl
@@ -1,10 +1,10 @@
-namespace eval Stent::xml {
- variable dir
+namespace eval ::Stent::xml {
+ namespace path ::Stent
+ Kratos::AddNamespace [namespace current]
}
proc Stent::xml::Init { } {
- variable dir
- Model::InitVariables dir $Stent::dir
+ Model::InitVariables dir $::Stent::dir
# Import our elements
Model::ForgetElements
@@ -14,7 +14,7 @@ proc Stent::xml::Init { } {
}
proc Stent::xml::getUniqueName {name} {
- return ST$name
+ return [::Stent::GetAttribute prefix]$name
}
@@ -23,7 +23,6 @@ proc Stent::xml::CustomTree { args } {
Structural::xml::CustomTree {*}$args
}
-
proc Structural::xml::ProcCheckGeometryStructural {domNode args} {
set ret "line"
return $ret
@@ -33,4 +32,3 @@ proc Stent::xml::UpdateParts {domNode args} {
Structural::xml::UpdateParts $domNode {*}$args
}
-Stent::xml::Init
diff --git a/kratos.gid/apps/Structural/app.json b/kratos.gid/apps/Structural/app.json
new file mode 100644
index 000000000..257d91b55
--- /dev/null
+++ b/kratos.gid/apps/Structural/app.json
@@ -0,0 +1,57 @@
+{
+ "id": "Structural",
+ "name": "Structural",
+ "prefix": "ST",
+ "themed": false,
+ "kratos_name": "StructuralMechanicsApplication",
+ "python_packages": [
+ "KratosStructuralMechanicsApplication",
+ "KratosContactStructuralMechanicsApplication"
+ ],
+ "dimensions": [
+ "2D",
+ "2Da",
+ "3D"
+ ],
+ "script_files": [
+ "start.tcl",
+ "examples/examples.tcl",
+ "examples/TrussCantilever.tcl",
+ "examples/HighRiseBuilding.tcl",
+ "examples/IncompressibleCookMembrane.tcl",
+ "xml/XmlController.tcl",
+ "write/write.tcl",
+ "write/writeProjectParameters.tcl",
+ "postprocess/formfinding.tcl"
+ ],
+ "start_script": "::Structural::Init",
+ "requeriments": {
+ "apps": [],
+ "minimum_gid_version": "15.1.3d"
+ },
+ "permissions": {
+ "open_tree": true,
+ "show_toolbar": true,
+ "intervals": true,
+ "wizard": false,
+ "import_files": true
+ },
+ "unique_names": {
+ "parts": "STParts",
+ "initial_conditions": "STInitialConditions",
+ "nodal_conditions": "STNodalConditions",
+ "conditions": "STLoads",
+ "time_parameters": "STTimeParameters",
+ "results": "STResults",
+ "materials": "STMaterials"
+ },
+ "write": {
+ "coordinates": "all",
+ "materials_file": "StructuralMaterials.json",
+ "properties_location": "json",
+ "model_part_name": "Structure",
+ "output_model_part_name": ""
+ },
+ "main_launch_file": "../../exec/MainKratos.py",
+ "examples": "examples/examples.xml"
+}
\ No newline at end of file
diff --git a/kratos.gid/apps/Structural/examples/HighRiseBuilding.tcl b/kratos.gid/apps/Structural/examples/HighRiseBuilding.tcl
index 57228e416..dbc2f6d6b 100644
--- a/kratos.gid/apps/Structural/examples/HighRiseBuilding.tcl
+++ b/kratos.gid/apps/Structural/examples/HighRiseBuilding.tcl
@@ -1,5 +1,10 @@
+namespace eval ::Structural::examples::HighRiseBuilding {
+ namespace path ::Structural::examples
+ Kratos::AddNamespace [namespace current]
-proc ::Structural::examples::HighRiseBuilding {args} {
+}
+
+proc ::Structural::examples::HighRiseBuilding::Init {args} {
if {![Kratos::IsModelEmpty]} {
set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
@@ -7,10 +12,10 @@ proc ::Structural::examples::HighRiseBuilding {args} {
}
Kratos::ResetModel
- DrawHighRiseBuildingGeometry$::Model::SpatialDimension
- AssignGroupsHighRiseBuilding$::Model::SpatialDimension
- AssignHighRiseBuildingMeshSizes$::Model::SpatialDimension
- TreeAssignationHighRiseBuilding$::Model::SpatialDimension
+ DrawGeometry$::Model::SpatialDimension
+ AssignGroups$::Model::SpatialDimension
+ AssignMeshSizes$::Model::SpatialDimension
+ TreeAssignation$::Model::SpatialDimension
GiD_Process 'Redraw
GidUtils::UpdateWindow GROUPS
@@ -18,7 +23,7 @@ proc ::Structural::examples::HighRiseBuilding {args} {
GiD_Process 'Zoom Frame
}
-proc Structural::examples::DrawHighRiseBuildingGeometry2D {args} {
+proc ::Structural::examples::HighRiseBuilding::DrawGeometry2D {args} {
GiD_Layers create Structure
GiD_Layers edit to_use Structure
@@ -43,7 +48,7 @@ proc Structural::examples::DrawHighRiseBuildingGeometry2D {args} {
GiD_Process Mescape Geometry Create NurbsSurface {*}$structureLines escape escape
}
-proc Structural::examples::AssignGroupsHighRiseBuilding2D {args} {
+proc ::Structural::examples::HighRiseBuilding::AssignGroups2D {args} {
# Group creation
GiD_Groups create Structure
GiD_Groups create Ground
@@ -54,14 +59,14 @@ proc Structural::examples::AssignGroupsHighRiseBuilding2D {args} {
GiD_EntitiesGroups assign InterfaceStructure lines {1 2 3}
}
-proc Structural::examples::AssignHighRiseBuildingMeshSizes2D {args} {
+proc ::Structural::examples::HighRiseBuilding::AssignMeshSizes2D {args} {
set structure_mesh_size 5.0
GiD_Process Mescape Meshing ElemType Quadrilateral [GiD_EntitiesGroups get Structure surfaces] escape
GiD_Process Mescape Meshing Structured Surfaces Size {*}[GiD_EntitiesGroups get Structure surfaces] escape $structure_mesh_size {*}[GiD_EntitiesGroups get InterfaceStructure lines] escape escape escape escape
}
-proc Structural::examples::TreeAssignationHighRiseBuilding2D {args} {
+proc ::Structural::examples::HighRiseBuilding::TreeAssignation2D {args} {
set nd $::Model::SpatialDimension
set root [customlib::GetBaseRoot]
@@ -99,9 +104,8 @@ proc Structural::examples::TreeAssignationHighRiseBuilding2D {args} {
spdAux::SetValuesOnBaseNode $LoadNode $props
# Structure domain time parameters
- set parameters [list EndTime 25.0 DeltaTime 0.05]
- set xpath [spdAux::getRoute STTimeParameters]
- spdAux::SetValuesOnBasePath $xpath $parameters
-
+ [$root selectNodes "[spdAux::getRoute STTimeParameters]/value\[@n = 'EndTime'\]"] setAttribute v 25.0
+ [$root selectNodes "[spdAux::getRoute STTimeParameters]/container\[@n = 'TimeStep'\]/blockdata\[1\]/value\[@n = 'DeltaTime'\]"] setAttribute v 0.05
+
spdAux::RequestRefresh
}
diff --git a/kratos.gid/apps/Structural/examples/incompressible_cook_membrane.tcl b/kratos.gid/apps/Structural/examples/IncompressibleCookMembrane.tcl
similarity index 87%
rename from kratos.gid/apps/Structural/examples/incompressible_cook_membrane.tcl
rename to kratos.gid/apps/Structural/examples/IncompressibleCookMembrane.tcl
index 94b996b83..e1da6b08f 100644
--- a/kratos.gid/apps/Structural/examples/incompressible_cook_membrane.tcl
+++ b/kratos.gid/apps/Structural/examples/IncompressibleCookMembrane.tcl
@@ -1,5 +1,9 @@
+namespace eval ::Structural::examples::IncompressibleCookMembrane {
+ namespace path ::Structural::examples
+ Kratos::AddNamespace [namespace current]
-proc ::Structural::examples::IncompressibleCookMembrane {args} {
+}
+proc ::Structural::examples::IncompressibleCookMembrane::Init {args} {
if {![Kratos::IsModelEmpty]} {
set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
@@ -7,10 +11,10 @@ proc ::Structural::examples::IncompressibleCookMembrane {args} {
}
Kratos::ResetModel
- DrawIncompressibleCookMembraneGeometry$::Model::SpatialDimension
- AssignGroupsIncompressibleCookMembrane$::Model::SpatialDimension
- AssignIncompressibleCookMembraneMeshSizes$::Model::SpatialDimension
- TreeAssignationIncompressibleCookMembrane$::Model::SpatialDimension
+ DrawGeometry$::Model::SpatialDimension
+ AssignGroups$::Model::SpatialDimension
+ AssignMeshSizes$::Model::SpatialDimension
+ TreeAssignation$::Model::SpatialDimension
GiD_Process 'Redraw
GidUtils::UpdateWindow GROUPS
@@ -22,7 +26,7 @@ proc ::Structural::examples::IncompressibleCookMembrane {args} {
GiD_Process 'Zoom Frame
}
-proc Structural::examples::DrawIncompressibleCookMembraneGeometry2D {args} {
+proc ::Structural::examples::IncompressibleCookMembrane::DrawGeometry2D {args} {
GiD_Layers create Structure
GiD_Layers edit to_use Structure
@@ -47,15 +51,15 @@ proc Structural::examples::DrawIncompressibleCookMembraneGeometry2D {args} {
GiD_Process Mescape Geometry Create NurbsSurface {*}$structureLines escape escape
}
-proc Structural::examples::DrawIncompressibleCookMembraneGeometry3D {args} {
+proc ::Structural::examples::IncompressibleCookMembrane::DrawGeometry3D {args} {
# Create layers and draw in plane geometry
- DrawIncompressibleCookMembraneGeometry2D
+ DrawGeometry2D
# Extrude the xy-plane geometry
GiD_Process Mescape Utilities Copy Surfaces Duplicate DoExtrude Volumes MaintainLayers Translation FNoJoin 0.0,0.0,0.0 FNoJoin 0.0,0.0,1.0 1 escape Mescape
}
-proc Structural::examples::AssignGroupsIncompressibleCookMembrane2D {args} {
+proc ::Structural::examples::IncompressibleCookMembrane::AssignGroups2D {args} {
# Group creation
GiD_Groups create Structure
GiD_Groups create LeftEdge
@@ -66,7 +70,7 @@ proc Structural::examples::AssignGroupsIncompressibleCookMembrane2D {args} {
GiD_EntitiesGroups assign RightEdge lines 2
}
-proc Structural::examples::AssignGroupsIncompressibleCookMembrane3D {args} {
+proc ::Structural::examples::IncompressibleCookMembrane::AssignGroups3D {args} {
# Group creation
GiD_Groups create Structure
GiD_Groups create LeftSurface
@@ -79,18 +83,18 @@ proc Structural::examples::AssignGroupsIncompressibleCookMembrane3D {args} {
GiD_EntitiesGroups assign SideSurfaces surfaces {1 6}
}
-proc Structural::examples::AssignIncompressibleCookMembraneMeshSizes2D {args} {
+proc ::Structural::examples::IncompressibleCookMembrane::AssignMeshSizes2D {args} {
set edges_divisions 64
GiD_Process Mescape Meshing Structured Surfaces 1 escape $edges_divisions 1 2 3 4 escape escape escape Mescape Meshing ElemType Quadrilateral 1 escape
}
-proc Structural::examples::AssignIncompressibleCookMembraneMeshSizes3D {args} {
+proc ::Structural::examples::IncompressibleCookMembrane::AssignMeshSizes3D {args} {
set side_edges_divisions 64
set thickness_edges_divisions 1
GiD_Process Mescape Meshing ElemType Hexahedra 1 escape Mescape Meshing Structured Volumes 1 escape $side_edges_divisions 1 3 5 7 2 6 escape $thickness_edges_divisions 11 escape escape escape escape escape escape
}
-proc Structural::examples::TreeAssignationIncompressibleCookMembrane2D {args} {
+proc ::Structural::examples::IncompressibleCookMembrane::TreeAssignation2D {args} {
set nd $::Model::SpatialDimension
set root [customlib::GetBaseRoot]
@@ -131,7 +135,7 @@ proc Structural::examples::TreeAssignationIncompressibleCookMembrane2D {args} {
spdAux::RequestRefresh
}
-proc Structural::examples::TreeAssignationIncompressibleCookMembrane3D {args} {
+proc ::Structural::examples::IncompressibleCookMembrane::TreeAssignation3D {args} {
set nd $::Model::SpatialDimension
set root [customlib::GetBaseRoot]
diff --git a/kratos.gid/apps/Structural/examples/TrussCantilever.tcl b/kratos.gid/apps/Structural/examples/TrussCantilever.tcl
index f52ef761a..2451deaba 100644
--- a/kratos.gid/apps/Structural/examples/TrussCantilever.tcl
+++ b/kratos.gid/apps/Structural/examples/TrussCantilever.tcl
@@ -1,16 +1,20 @@
+namespace eval ::Structural::examples::TrussCantilever {
+ namespace path ::Structural::examples
+ Kratos::AddNamespace [namespace current]
-proc ::Structural::examples::TrussCantilever {args} {
+}
+proc ::Structural::examples::TrussCantilever::Init {args} {
if {![Kratos::IsModelEmpty]} {
set txt "We are going to draw the example geometry.\nDo you want to lose your previous work?"
set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
if { $retval == "cancel" } { return }
}
- DrawTrussCantileverGeometry
- AssignTrussCantileverMeshSizes
- TreeAssignationTrussCantilever
+ DrawGeometry
+ AssignMeshSizes
+ TreeAssignation
}
-proc Structural::examples::DrawTrussCantileverGeometry {args} {
+proc ::Structural::examples::TrussCantilever::DrawGeometry {args} {
Kratos::ResetModel
set structure_layer Structure
GiD_Process Mescape 'Layers ChangeName Layer0 $structure_layer escape
@@ -57,12 +61,11 @@ proc Structural::examples::DrawTrussCantileverGeometry {args} {
GidUtils::UpdateWindow GROUPS
}
-proc Structural::examples::AssignTrussCantileverMeshSizes {args} {
+proc ::Structural::examples::TrussCantilever::AssignMeshSizes {args} {
GiD_Process Mescape Meshing Structured Lines 1 {*}[GiD_EntitiesGroups get Structure lines] escape escape
}
-
-proc Structural::examples::TreeAssignationTrussCantilever {args} {
+proc ::Structural::examples::TrussCantilever::TreeAssignation {args} {
set nd $::Model::SpatialDimension
set root [customlib::GetBaseRoot]
@@ -125,9 +128,10 @@ proc Structural::examples::TreeAssignationTrussCantilever {args} {
spdAux::SetValuesOnBaseNode $LoadNode $props
# Structure domain time parameters
- set chanparameterse_list [list EndTime 25.0 DeltaTime 0.1]
+ #set change_list [list EndTime 25.0 DeltaTime 0.1]; # Commented delta time since the case is static
+ set change_list [list EndTime 25.0]
set xpath [spdAux::getRoute STTimeParameters]
- spdAux::SetValuesOnBasePath $xpath $parameters
+ spdAux::SetValuesOnBasePath $xpath $change_list
spdAux::RequestRefresh
}
diff --git a/kratos.gid/apps/Structural/examples/examples.tcl b/kratos.gid/apps/Structural/examples/examples.tcl
index f428c82ae..da1da84b0 100644
--- a/kratos.gid/apps/Structural/examples/examples.tcl
+++ b/kratos.gid/apps/Structural/examples/examples.tcl
@@ -1,22 +1,12 @@
-namespace eval Structural::examples {
+namespace eval ::Structural::examples {
+ namespace path ::Structural
+ Kratos::AddNamespace [namespace current]
}
-proc Structural::examples::Init { } {
- uplevel #0 [list source [file join $::Structural::dir examples TrussCantilever.tcl]]
- uplevel #0 [list source [file join $::Structural::dir examples HighRiseBuilding.tcl]]
- uplevel #0 [list source [file join $::Structural::dir examples incompressible_cook_membrane.tcl]]
-}
+proc ::Structural::examples::Init { } {
-proc Structural::examples::UpdateMenus { } {
- set menu_id 7
- GiDMenu::InsertOption "Kratos" [list "Truss cantilever" ] [incr menu_id] PRE [list ::Structural::examples::TrussCantilever] "" "" insertbefore =
- if {$::Model::SpatialDimension eq "2D"} {
- GiDMenu::InsertOption "Kratos" [list "High-rise building" ] [incr menu_id] PRE [list ::Structural::examples::HighRiseBuilding] "" "" insertbefore =
- }
- GiDMenu::InsertOption "Kratos" [list "Incompressible Cook membrane" ] [incr menu_id] PRE [list ::Structural::examples::IncompressibleCookMembrane] "" "" insertbefore =
- GiDMenu::InsertOption "Kratos" [list "---"] [incr menu_id] PRE "" "" "" insertbefore =
- GiDMenu::UpdateMenus
}
-Structural::examples::Init
\ No newline at end of file
+proc ::Structural::examples::UpdateMenus { } {
+}
diff --git a/kratos.gid/apps/Structural/examples/examples.xml b/kratos.gid/apps/Structural/examples/examples.xml
new file mode 100644
index 000000000..dc226be6f
--- /dev/null
+++ b/kratos.gid/apps/Structural/examples/examples.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/kratos.gid/apps/Structural/images/HighRiseBuilding2D.png b/kratos.gid/apps/Structural/images/HighRiseBuilding2D.png
new file mode 100644
index 000000000..abfb308f8
Binary files /dev/null and b/kratos.gid/apps/Structural/images/HighRiseBuilding2D.png differ
diff --git a/kratos.gid/apps/Structural/images/IncompressibleCookMembrane2D.png b/kratos.gid/apps/Structural/images/IncompressibleCookMembrane2D.png
new file mode 100644
index 000000000..56c783be8
Binary files /dev/null and b/kratos.gid/apps/Structural/images/IncompressibleCookMembrane2D.png differ
diff --git a/kratos.gid/apps/Structural/images/IncompressibleCookMembrane3D.png b/kratos.gid/apps/Structural/images/IncompressibleCookMembrane3D.png
new file mode 100644
index 000000000..ad0c256ad
Binary files /dev/null and b/kratos.gid/apps/Structural/images/IncompressibleCookMembrane3D.png differ
diff --git a/kratos.gid/apps/Examples/images/Structural/TrussCantilever2D.png b/kratos.gid/apps/Structural/images/TrussCantilever2D.png
similarity index 100%
rename from kratos.gid/apps/Examples/images/Structural/TrussCantilever2D.png
rename to kratos.gid/apps/Structural/images/TrussCantilever2D.png
diff --git a/kratos.gid/apps/Examples/images/Structural/TrussCantilever3D.png b/kratos.gid/apps/Structural/images/TrussCantilever3D.png
similarity index 100%
rename from kratos.gid/apps/Examples/images/Structural/TrussCantilever3D.png
rename to kratos.gid/apps/Structural/images/TrussCantilever3D.png
diff --git a/kratos.gid/apps/Structural/postprocess/formfinding.tcl b/kratos.gid/apps/Structural/postprocess/formfinding.tcl
index 18ce5f95b..57e09dda8 100644
--- a/kratos.gid/apps/Structural/postprocess/formfinding.tcl
+++ b/kratos.gid/apps/Structural/postprocess/formfinding.tcl
@@ -1,11 +1,12 @@
namespace eval ::Structural::Formfinding {
- # Variable declaration
+ namespace path ::Structural
+ Kratos::AddNamespace [namespace current]
}
# copy problem folder to restore the formfinding problem
-proc Structural::Formfinding::CopyFormfinding {} {
+proc ::Structural::Formfinding::CopyFormfinding {} {
#delete formfinding folder if it exists
# set script_file [file nativename [GiD_Info project modelname].gid]
set script_folder [GiD_Info project modelname].gid
@@ -28,7 +29,7 @@ proc Structural::Formfinding::CopyFormfinding {} {
}
# update nodal coordinates
-proc Structural::Formfinding::ModifyNodes {} {
+proc ::Structural::Formfinding::ModifyNodes {} {
set node_list [GiD_Result get {Displacement Kratos 1.1}]
set counter 0
foreach node $node_list {
@@ -55,7 +56,7 @@ proc Structural::Formfinding::ModifyNodes {} {
GidUtils::SetWarnLine "Preprocess mesh is now updated"
}
-proc Structural::Formfinding::UpdateGeometry { } {
+proc ::Structural::Formfinding::UpdateGeometry { } {
CopyFormfinding
ModifyNodes
}
diff --git a/kratos.gid/apps/Structural/python/KratosStructural.py b/kratos.gid/apps/Structural/python/KratosStructural.py
deleted file mode 100755
index ef6a15636..000000000
--- a/kratos.gid/apps/Structural/python/KratosStructural.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from __future__ import print_function, absolute_import, division #makes KratosMultiphysics backward compatible with python 2.6 and 2.7
-
-import KratosMultiphysics
-from KratosMultiphysics.StructuralMechanicsApplication.structural_mechanics_analysis import StructuralMechanicsAnalysis
-
-"""
-For user-scripting it is intended that a new class is derived
-from StructuralMechanicsAnalysis to do modifications
-"""
-
-if __name__ == "__main__":
-
- with open("ProjectParameters.json",'r') as parameter_file:
- parameters = KratosMultiphysics.Parameters(parameter_file.read())
-
- model = KratosMultiphysics.Model()
- simulation = StructuralMechanicsAnalysis(model,parameters)
- simulation.Run()
diff --git a/kratos.gid/apps/Structural/start.tcl b/kratos.gid/apps/Structural/start.tcl
index 456d82055..bd791418c 100644
--- a/kratos.gid/apps/Structural/start.tcl
+++ b/kratos.gid/apps/Structural/start.tcl
@@ -1,76 +1,45 @@
namespace eval ::Structural {
+ Kratos::AddNamespace [namespace current]
+
# Variable declaration
variable dir
- variable attributes
- variable kratos_name
- variable app_id
+ variable _app
+
+ proc GetAttribute {name} {variable _app; return [$_app getProperty $name]}
+ proc GetUniqueName {name} {variable _app; return [$_app getUniqueName $name]}
+ proc GetWriteProperty {name} {variable _app; return [$_app getWriteProperty $name]}
}
-proc ::Structural::Init { } {
+proc ::Structural::Init { app } {
# Variable initialization
variable dir
- variable attributes
- variable kratos_name
- variable app_id
-
- set app_id Structural
-
set dir [apps::getMyDir "Structural"]
- set attributes [dict create]
-
- # Allow to open the tree
- set ::spdAux::TreeVisibility 1
-
- # Intervals
- dict set attributes UseIntervals 1
- if {$::Kratos::kratos_private(DevMode) eq "dev"} {dict set attributes UseIntervals 1}
-
- set kratos_name StructuralMechanicsApplication
-
- LoadMyFiles
-}
-
-proc ::Structural::LoadMyFiles { } {
- variable dir
+ variable _app
+ set _app $app
- uplevel #0 [list source [file join $dir xml XmlController.tcl]]
- uplevel #0 [list source [file join $dir write write.tcl]]
- uplevel #0 [list source [file join $dir write writeProjectParameters.tcl]]
- uplevel #0 [list source [file join $dir postprocess formfinding.tcl]]
- uplevel #0 [list source [file join $dir examples examples.tcl]]
-}
-
-proc ::Structural::CustomToolbarItems { } {
- Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::Structural::examples::TrussCantilever] [= "Example\nTruss cantilever"]
- if {$::Model::SpatialDimension eq "2D"} {
- Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::Structural::examples::HighRiseBuilding] [= "Example\nHigh-rise building"]
- }
- Kratos::ToolbarAddItem "Example" "example.png" [list -np- ::Structural::examples::IncompressibleCookMembrane] [= "Example\nIncompressible Cook membrane"]
-}
-
-proc ::Structural::CustomMenus { } {
- Structural::examples::UpdateMenus
-
- GiDMenu::InsertOption "Kratos" [list "---"] 8 PRE "" "" "" insertafter =
- GiDMenu::InsertOption "Kratos" [list "Formfinding - Update geometry" ] end POST [list ::Structural::Formfinding::UpdateGeometry] "" "" insert =
- GiDMenu::UpdateMenus
-}
-
-proc ::Structural::GetAttribute {name} {
- variable attributes
- set value ""
- if {[dict exists $attributes $name]} {set value [dict get $attributes $name]}
- return $value
+ ::Structural::xml::Init
+ ::Structural::write::Init
}
+# Create the old-gid condition relation_line_geo_mesh to link geometry and mesh entities.
+# Topic: Local axes, beams
+# TODO: remove this when GiD creates this relation automatically
proc ::Structural::BeforeMeshGeneration { size } {
foreach group [GiD_Groups list] {
GiD_AssignData condition relation_line_geo_mesh Lines {0} [GiD_EntitiesGroups get $group lines]
}
}
+# Some conditions applied over small displacement parts must change the topology name... una chufa
proc ::Structural::ApplicationSpecificGetCondition {condition group etype nnodes} {
return [Structural::write::ApplicationSpecificGetCondition $condition $group $etype $nnodes]
}
-::Structural::Init
+# Add formfinding button in Kratos menu in postprocess
+proc ::Structural::CustomMenus { } {
+ Structural::examples::UpdateMenus
+
+ GiDMenu::InsertOption "Kratos" [list "---"] 8 POST "" "" "" insertafter =
+ GiDMenu::InsertOption "Kratos" [list "Formfinding - Update geometry" ] end POST [list ::Structural::Formfinding::UpdateGeometry] "" "" insert =
+ GiDMenu::UpdateMenus
+}
\ No newline at end of file
diff --git a/kratos.gid/apps/Structural/write/write.tcl b/kratos.gid/apps/Structural/write/write.tcl
index 4ffbdae0a..7af56fa63 100644
--- a/kratos.gid/apps/Structural/write/write.tcl
+++ b/kratos.gid/apps/Structural/write/write.tcl
@@ -1,11 +1,14 @@
-namespace eval Structural::write {
+namespace eval ::Structural::write {
+ namespace path ::Structural
+ Kratos::AddNamespace [namespace current]
+
variable ConditionsDictGroupIterators
variable NodalConditionsGroup
variable writeAttributes
variable ContactsDict
}
-proc Structural::write::Init { } {
+proc ::Structural::write::Init { } {
variable ConditionsDictGroupIterators
variable NodalConditionsGroup
set ConditionsDictGroupIterators [dict create]
@@ -16,25 +19,28 @@ proc Structural::write::Init { } {
variable writeAttributes
set writeAttributes [dict create]
+
SetAttribute validApps [list "Structural"]
- SetAttribute writeCoordinatesByGroups 0
- SetAttribute properties_location json
- SetAttribute parts_un STParts
- SetAttribute time_parameters_un STTimeParameters
- SetAttribute results_un STResults
- SetAttribute materials_un STMaterials
- SetAttribute initial_conditions_un STInitialConditions
- SetAttribute nodal_conditions_un STNodalConditions
- SetAttribute conditions_un STLoads
+ SetAttribute writeCoordinatesByGroups [::Structural::GetWriteProperty coordinates]
+ SetAttribute properties_location [::Structural::GetWriteProperty properties_location]
+
+ SetAttribute parts_un [::Structural::GetUniqueName parts]
+ SetAttribute time_parameters_un [::Structural::GetUniqueName time_parameters]
+ SetAttribute results_un [::Structural::GetUniqueName results]
+ SetAttribute materials_un [::Structural::GetUniqueName materials]
+ SetAttribute initial_conditions_un [::Structural::GetUniqueName initial_conditions]
+ SetAttribute nodal_conditions_un [::Structural::GetUniqueName nodal_conditions]
+ SetAttribute conditions_un [::Structural::GetUniqueName conditions]
+
SetAttribute nodal_conditions_no_submodelpart [list CONDENSED_DOF_LIST CONDENSED_DOF_LIST_2D CONTACT CONTACT_SLAVE]
- SetAttribute materials_file "StructuralMaterials.json"
- SetAttribute main_script_file "KratosStructural.py"
- SetAttribute model_part_name "Structure"
- SetAttribute output_model_part_name ""
+ SetAttribute materials_file [::Structural::GetWriteProperty materials_file]
+ SetAttribute main_launch_file [::Structural::GetAttribute main_launch_file]
+ SetAttribute model_part_name [::Structural::GetWriteProperty model_part_name]
+ SetAttribute output_model_part_name [::Structural::GetWriteProperty output_model_part_name]
}
# MDPA Blocks
-proc Structural::write::writeModelPartEvent { } {
+proc ::Structural::write::writeModelPartEvent { } {
variable ConditionsDictGroupIterators
initLocalWriteConfiguration
write::initWriteConfiguration [GetAttributes]
@@ -45,7 +51,7 @@ proc Structural::write::writeModelPartEvent { } {
write::WriteString "End Properties"
# Nodal coordinates (1: Print only Structural nodes | 0: the whole mesh )
- if {[GetAttribute writeCoordinatesByGroups]} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates}
+ if {[GetAttribute writeCoordinatesByGroups] ne "all"} {write::writeNodalCoordinatesOnParts} {write::writeNodalCoordinates}
# Element connectivities (Groups on STParts)
write::writeElementConnectivities
@@ -68,15 +74,15 @@ proc Structural::write::writeModelPartEvent { } {
}
-proc Structural::write::writeConditions { } {
+proc ::Structural::write::writeConditions { } {
variable ConditionsDictGroupIterators
- set ConditionsDictGroupIterators [write::writeConditions [GetAttribute conditions_un] ]
+ set ConditionsDictGroupIterators [::write::writeConditions [GetAttribute conditions_un] ]
set last_iter [Structural::write::getLastConditionId]
writeContactConditions $last_iter
}
-proc Structural::write::writeMeshes { } {
+proc ::Structural::write::writeMeshes { } {
# There are some Conditions and nodalConditions that dont generate a submodelpart
# Add them to this list
@@ -103,7 +109,7 @@ proc Structural::write::writeMeshes { } {
writeContacts
}
-proc Structural::write::writeContactConditions { last_iter } {
+proc ::Structural::write::writeContactConditions { last_iter } {
variable ConditionsDictGroupIterators
set root [customlib::GetBaseRoot]
set ov "line"
@@ -122,7 +128,7 @@ proc Structural::write::writeContactConditions { last_iter } {
}
}
-proc Structural::write::writeLoads { } {
+proc ::Structural::write::writeLoads { } {
variable ConditionsDictGroupIterators
set root [customlib::GetBaseRoot]
set xp1 "[spdAux::getRoute [GetAttribute conditions_un]]/condition/group"
@@ -138,7 +144,7 @@ proc Structural::write::writeLoads { } {
}
}
-proc Structural::write::writeContacts { } {
+proc ::Structural::write::writeContacts { } {
variable ConditionsDictGroupIterators
variable ContactsDict
@@ -151,7 +157,7 @@ proc Structural::write::writeContacts { } {
foreach slave_group [$root selectNodes $xp_slave] {
if {$slave_group ne ""} {
set slave_groupid_raw [$slave_group @n]
- set slave_group_pair_id [get_domnode_attribute [$slave_group selectNodes "./value\[@n='pair'\]"] v]
+ set slave_group_pair_id [write::getValueByNode [$slave_group selectNodes "./value\[@n='pair'\]"] ]
set slave_groupid [write::GetWriteGroupName $slave_groupid_raw]
set prev [list ]
if {[dict exists $ContactsDict Slaves $slave_group_pair_id]} {set prev [dict get $ContactsDict Slaves $slave_group_pair_id]}
@@ -165,7 +171,7 @@ proc Structural::write::writeContacts { } {
if {$master_group ne ""} {
set master_groupid_raw [$master_group @n]
set master_groupid [write::GetWriteGroupName $master_groupid_raw]
- set master_group_pair_id [get_domnode_attribute [$master_group selectNodes "./value\[@n='pair'\]"] v]
+ set master_group_pair_id [write::getValueByNode [$master_group selectNodes "./value\[@n='pair'\]"] ]
set prev [list ]
if {[dict exists $ContactsDict Masters $master_group_pair_id]} {
set prev [dict get $ContactsDict Masters $master_group_pair_id]
@@ -179,14 +185,14 @@ proc Structural::write::writeContacts { } {
}
}
-proc Structural::write::writeCustomBlock { } {
+proc ::Structural::write::writeCustomBlock { } {
write::WriteString "Begin Custom"
write::WriteString "Custom write for Structural, any app can call me, so be careful!"
write::WriteString "End Custom"
write::WriteString ""
}
-proc Structural::write::getLastConditionId { } {
+proc ::Structural::write::getLastConditionId { } {
variable ConditionsDictGroupIterators
set top 1
if {$ConditionsDictGroupIterators ne ""} {
@@ -198,21 +204,22 @@ proc Structural::write::getLastConditionId { } {
}
# Custom files
-proc Structural::write::WriteMaterialsFile { } {
+proc ::Structural::write::WriteMaterialsFile { } {
write::writePropertiesJsonFile [GetAttribute parts_un] [GetAttribute materials_file] True [GetAttribute model_part_name]
}
-proc Structural::write::GetUsedElements { {get "Objects"} } {
+proc ::Structural::write::GetUsedElements { {get "Objects"} } {
set lista [list ]
foreach gNode [Structural::write::GetPartsGroups] {
- set elem_name [get_domnode_attribute [$gNode selectNodes ".//value\[@n='Element']"] v]
+ set elem_name [write::getValueByNode [$gNode selectNodes ".//value\[@n='Element']"] ]
set e [Model::getElement $elem_name]
if {$get eq "Name"} { set e [$e getName] }
lappend lista $e
}
return $lista
}
-proc Structural::write::GetPartsGroups { {get "Objects"} } {
+
+proc ::Structural::write::GetPartsGroups { {get "Objects"} } {
set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/condition/group"
set lista [list ]
foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] {
@@ -223,10 +230,10 @@ proc Structural::write::GetPartsGroups { {get "Objects"} } {
return $lista
}
-proc Structural::write::writeLocalAxes { } {
+proc ::Structural::write::writeLocalAxes { } {
set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/condition/group"
foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] {
- set elem_name [get_domnode_attribute [$gNode selectNodes ".//value\[@n='Element']"] v]
+ set elem_name [write::getValueByNode [$gNode selectNodes ".//value\[@n='Element']"] ]
set e [Model::getElement $elem_name]
if {[write::isBooleanTrue [$e getAttribute "RequiresLocalAxes"]]} {
set group [$gNode @n]
@@ -236,7 +243,7 @@ proc Structural::write::writeLocalAxes { } {
}
# This is the kind of code I hate
-proc Structural::write::writeHinges { } {
+proc ::Structural::write::writeHinges { } {
# format for writing ids
set id_f [dict get $write::formats_dict ID]
@@ -266,25 +273,25 @@ proc Structural::write::writeHinges { } {
set first_list [list ]
set last_list [list ]
if {$::Model::SpatialDimension eq "3D"} {
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstDisplacementX']"] v]]} {lappend first_list 0}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstDisplacementY']"] v]]} {lappend first_list 1}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstDisplacementZ']"] v]]} {lappend first_list 2}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstMomentX']"] v]]} {lappend first_list 3}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstMomentY']"] v]]} {lappend first_list 4}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstMomentZ']"] v]]} {lappend first_list 5}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondDisplacementX']"] v]]} {lappend last_list 6}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondDisplacementY']"] v]]} {lappend last_list 7}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondDisplacementZ']"] v]]} {lappend last_list 8}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondMomentX']"] v]]} {lappend last_list 9}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondMomentY']"] v]]} {lappend last_list 10}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondMomentZ']"] v]]} {lappend last_list 11}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstDisplacementX']"] ]]} {lappend first_list 0}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstDisplacementY']"] ]]} {lappend first_list 1}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstDisplacementZ']"] ]]} {lappend first_list 2}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstMomentX']"] ]]} {lappend first_list 3}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstMomentY']"] ]]} {lappend first_list 4}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstMomentZ']"] ]]} {lappend first_list 5}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondDisplacementX']"] ]]} {lappend last_list 6}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondDisplacementY']"] ]]} {lappend last_list 7}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondDisplacementZ']"] ]]} {lappend last_list 8}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondMomentX']"] ]]} {lappend last_list 9}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondMomentY']"] ]]} {lappend last_list 10}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondMomentZ']"] ]]} {lappend last_list 11}
} else {
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstDisplacementX']"] v]]} {lappend first_list 0}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstDisplacementY']"] v]]} {lappend first_list 1}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='FirstMomentZ']"] v]]} {lappend first_list 2}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondDisplacementX']"] v]]} {lappend last_list 3}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondDisplacementY']"] v]]} {lappend last_list 4}
- if {[write::isBooleanTrue [get_domnode_attribute [$gNode selectNodes ".//value\[@n='SecondMomentZ']"] v]]} {lappend last_list 5}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstDisplacementX']"] ]]} {lappend first_list 0}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstDisplacementY']"] ]]} {lappend first_list 1}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='FirstMomentZ']"] ]]} {lappend first_list 2}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondDisplacementX']"] ]]} {lappend last_list 3}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondDisplacementY']"] ]]} {lappend last_list 4}
+ if {[write::isBooleanTrue [write::getValueByNode [$gNode selectNodes ".//value\[@n='SecondMomentZ']"] ]]} {lappend last_list 5}
}
# Write Left and Rigth end of each geometrical bar
@@ -308,10 +315,10 @@ proc Structural::write::writeHinges { } {
}
}
-proc Structural::write::initLocalWriteConfiguration { } {
+proc ::Structural::write::initLocalWriteConfiguration { } {
}
-proc Structural::write::usesContact { } {
+proc ::Structural::write::usesContact { } {
set result_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute STNodalConditions]/condition\[@n = 'CONTACT'\]/group"]
if {$result_node ne ""} {
@@ -322,7 +329,7 @@ proc Structural::write::usesContact { } {
}
# return 0 means ok; return [list 1 "Error message to be displayed"]
-proc Structural::write::writeValidateEvent { } {
+proc ::Structural::write::writeValidateEvent { } {
set problem 0
set problem_message [list ]
@@ -334,7 +341,7 @@ proc Structural::write::writeValidateEvent { } {
return [list $problem $problem_message]
}
-proc Structural::write::validateTrussMesh { } {
+proc ::Structural::write::validateTrussMesh { } {
# Elements to be checked
set truss_element_names [list "TrussLinearElement2D" "TrussElement2D" "TrussLinearElement3D" "TrussElement3D"]
set error 0
@@ -367,7 +374,7 @@ proc Structural::write::validateTrussMesh { } {
return [list $error $error_message]
}
-proc Structural::write::ApplicationSpecificGetCondition {condition group etype nnodes} {
+proc ::Structural::write::ApplicationSpecificGetCondition {condition group etype nnodes} {
# Prepare the return, if nothing to apply, return the same condition
set ret $condition
@@ -388,20 +395,22 @@ proc Structural::write::ApplicationSpecificGetCondition {condition group etype n
if {[Structural::write::GroupUsesSmallDisplacement $group $used_small_disp_elements]} {
set new_cond [Model::Clone $condition]
set topology [$new_cond getTopologyFeature $etype $nnodes]
- set new_kname [$topology getAttribute KratosNameSmallDisplacement]
- if {$new_kname ne ""} {$topology setKratosName $new_kname}
- set ret $new_cond
+ if {$topology ne "" && [$topology hasAttribute KratosNameSmallDisplacement]} {
+ set new_kname [$topology getAttribute KratosNameSmallDisplacement]
+ if {$new_kname ne ""} {$topology setKratosName $new_kname}
+ set ret $new_cond
+ }
}
}
return $ret
}
-proc Structural::write::GroupUsesSmallDisplacement {group used_small_disp_elements} {
+proc ::Structural::write::GroupUsesSmallDisplacement {group used_small_disp_elements} {
set ret 0
set group_nodes [GiD_EntitiesGroups get $group nodes]
foreach part_group_small_disp [Structural::write::GetPartsGroups] {
- set elem_name [get_domnode_attribute [$part_group_small_disp selectNodes ".//value\[@n='Element']"] v]
+ set elem_name [write::getValueByNode [$part_group_small_disp selectNodes ".//value\[@n='Element']"] ]
set elem [Model::getElement $elem_name]
if {$elem in $used_small_disp_elements} {
if {[objarray length [objarray intersection -sorted $group_nodes [GiD_EntitiesGroups get [$part_group_small_disp @n] nodes] ] ] > 0} {set ret 1; break}
@@ -410,53 +419,63 @@ proc Structural::write::GroupUsesSmallDisplacement {group used_small_disp_elemen
return $ret
}
+proc ::Structural::write::PrepareSubGroupsAssignChildEntitiesOnParents { } {
+ # list of groups sorted by lenght. so we always treat childs first and parents last
+ set groups_list [lsort -command {apply {{a b} {expr {[string length $a] - [string length $b]}}}} [GiD_Groups list]]
+ foreach group $groups_list {
+ set parent [GiD_Groups get parent $group]
+ if {$parent ne ""} {
+ foreach elem [GiD_Groups get allowed_types $parent] {
+ if {$elem ni [list "edges" "faces"]} {
+ GiD_EntitiesGroups assign $parent $elem [GiD_EntitiesGroups get $group $elem]
+ }
+ }
+ }
+ }
+}
-proc Structural::write::writeCustomFilesEvent { } {
+proc ::Structural::write::writeCustomFilesEvent { } {
WriteMaterialsFile
write::SetParallelismConfiguration
+ write::SetConfigurationAttribute main_launch_file [GetAttribute main_launch_file]
- set orig_name [GetAttribute main_script_file]
- write::CopyFileIntoModel [file join "python" $orig_name ]
- write::RenameFileInModel $orig_name "MainKratos.py"
}
-proc Structural::write::SetCoordinatesByGroups {value} {
+proc ::Structural::write::SetCoordinatesByGroups {value} {
SetAttribute writeCoordinatesByGroups $value
}
-proc Structural::write::GetAttribute {att} {
+proc ::Structural::write::GetAttribute {att} {
variable writeAttributes
return [dict get $writeAttributes $att]
}
-proc Structural::write::GetAttributes {} {
+proc ::Structural::write::GetAttributes {} {
variable writeAttributes
return $writeAttributes
}
-proc Structural::write::SetAttribute {att val} {
+proc ::Structural::write::SetAttribute {att val} {
variable writeAttributes
dict set writeAttributes $att $val
}
-proc Structural::write::AddAttribute {att val} {
+proc ::Structural::write::AddAttribute {att val} {
variable writeAttributes
dict append writeAttributes $att $val]
}
-proc Structural::write::AddAttributes {configuration} {
+proc ::Structural::write::AddAttributes {configuration} {
variable writeAttributes
set writeAttributes [dict merge $writeAttributes $configuration]
}
-proc Structural::write::AddValidApps {appList} {
+proc ::Structural::write::AddValidApps {appList} {
AddAttribute validApps $appList
}
-proc Structural::write::ApplyConfiguration { } {
+proc ::Structural::write::ApplyConfiguration { } {
variable writeAttributes
write::SetConfigurationAttributes $writeAttributes
}
-
-Structural::write::Init
diff --git a/kratos.gid/apps/Structural/write/writeProjectParameters.tcl b/kratos.gid/apps/Structural/write/writeProjectParameters.tcl
index aa3c87be8..9c66b0b7d 100644
--- a/kratos.gid/apps/Structural/write/writeProjectParameters.tcl
+++ b/kratos.gid/apps/Structural/write/writeProjectParameters.tcl
@@ -1,22 +1,32 @@
# Project Parameters
-proc Structural::write::getOldParametersDict { } {
+proc ::Structural::write::getOldParametersDict { } {
set model_part_name [GetAttribute model_part_name]
set projectParametersDict [dict create]
# Problem data
# Create section
- set problemDataDict [write::GetDefaultProblemDataDict $Structural::app_id]
+ set problemDataDict [write::GetDefaultProblemDataDict [::Structural::GetAttribute id]]
set solutiontype [write::getValue STSoluType]
+
# Time Parameters
+ set timeSteppingDict [dict create]
if {$solutiontype eq "Static" || $solutiontype eq "eigen_value"} {
set time_step "1.1"
dict set problemDataDict start_time "0.0"
dict set problemDataDict end_time "1.0"
+
+ # Time stepping settings for static
+ dict set timeSteppingDict "time_step" $time_step
+
} {
- set time_step [write::getValue STTimeParameters DeltaTime]
+ set time_step_table [write::GetTimeStepIntervals]
+
+ # Time stepping settings for dynamic
+ dict set timeSteppingDict "time_step_table" $time_step_table
}
+
# Add section to document
dict set projectParametersDict problem_data $problemDataDict
@@ -50,6 +60,8 @@ proc Structural::write::getOldParametersDict { } {
# TODO: Use default
# Solution strategy
set solverSettingsDict [dict create]
+ # Time stepping
+ dict set solverSettingsDict time_stepping $timeSteppingDict
set currentStrategyId [write::getValue STSolStrat]
# set strategy_write_name [[::Model::GetSolutionStrategy $currentStrategyId] getAttribute "n"]
set solver_type_name $solutiontype
@@ -76,11 +88,6 @@ proc Structural::write::getOldParametersDict { } {
dict set materialsDict materials_filename [GetAttribute materials_file]
dict set solverSettingsDict material_import_settings $materialsDict
- # Time stepping settings
- set timeSteppingDict [dict create]
- dict set timeSteppingDict "time_step" $time_step
- dict set solverSettingsDict time_stepping $timeSteppingDict
-
# Solution strategy parameters and Solvers
set solverSettingsDict [dict merge $solverSettingsDict [write::getSolutionStrategyParametersDict STSolStrat STScheme STStratParams] ]
set solverSettingsDict [dict merge $solverSettingsDict [write::getSolversParametersDict Structural] ]
@@ -145,7 +152,7 @@ proc Structural::write::getOldParametersDict { } {
dict set projectParametersDict processes $processesDict
# GiD output configuration
- dict set projectParametersDict output_processes [write::GetDefaultOutputProcessDict $Structural::app_id]
+ dict set projectParametersDict output_processes [write::GetDefaultOutputProcessDict [::Structural::GetAttribute id]]
set check_list [list "UpdatedLagrangianElementUP2D" "UpdatedLagrangianElementUPAxisym"]
foreach elem $check_list {
@@ -163,7 +170,7 @@ proc Structural::write::getOldParametersDict { } {
return $projectParametersDict
}
-proc Structural::write::GetContactConditionsDict { } {
+proc ::Structural::write::GetContactConditionsDict { } {
variable ContactsDict
set root [customlib::GetBaseRoot]
@@ -211,18 +218,19 @@ proc Structural::write::GetContactConditionsDict { } {
return $contacts
}
-
-proc Structural::write::writeParametersEvent { } {
+proc ::Structural::write::writeParametersEvent { } {
write::WriteJSON [getParametersDict]
}
-
# Project Parameters
-proc Structural::write::getParametersDict { } {
+proc ::Structural::write::getParametersDict { } {
# Get the base dictionary for the project parameters
set project_parameters_dict [getOldParametersDict]
+ # Analysis stage field
+ dict set project_parameters_dict analysis_stage "KratosMultiphysics.StructuralMechanicsApplication.structural_mechanics_analysis"
+
# If using any element with the attribute RotationDofs set to true
dict set project_parameters_dict solver_settings rotation_dofs [UsingSpecificDofElements RotationDofs]
dict set project_parameters_dict solver_settings volumetric_strain_dofs [UsingSpecificDofElements VolumetricStrainDofs]
@@ -234,11 +242,11 @@ proc Structural::write::getParametersDict { } {
return $project_parameters_dict
}
-proc Structural::write::writeParametersEvent { } {
+proc ::Structural::write::writeParametersEvent { } {
write::WriteJSON [::Structural::write::getParametersDict]
}
-proc Structural::write::UsingSpecificDofElements { SpecificDof } {
+proc ::Structural::write::UsingSpecificDofElements { SpecificDof } {
set root [customlib::GetBaseRoot]
set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/condition/group/value\[@n='Element'\]"
set elements [$root selectNodes $xp1]
@@ -252,7 +260,7 @@ proc Structural::write::UsingSpecificDofElements { SpecificDof } {
return $bool
}
-proc Structural::write::UsingFileInPrestressedMembrane { } {
+proc ::Structural::write::UsingFileInPrestressedMembrane { } {
set root [customlib::GetBaseRoot]
set xp1 "[spdAux::getRoute [GetAttribute parts_un]]/condition/group/value\[@n='Element'\]"
set elements [$root selectNodes $xp1]
diff --git a/kratos.gid/apps/Structural/xml/Elements.xml b/kratos.gid/apps/Structural/xml/Elements.xml
index b8c2f2abf..cde1ffbf5 100644
--- a/kratos.gid/apps/Structural/xml/Elements.xml
+++ b/kratos.gid/apps/Structural/xml/Elements.xml
@@ -458,8 +458,8 @@
-
-
+
+
@@ -478,10 +478,9 @@
-
-
+
-
+
diff --git a/kratos.gid/apps/Structural/xml/SolutionStrategy.spd b/kratos.gid/apps/Structural/xml/SolutionStrategy.spd
index e5409e525..a34a9f98a 100644
--- a/kratos.gid/apps/Structural/xml/SolutionStrategy.spd
+++ b/kratos.gid/apps/Structural/xml/SolutionStrategy.spd
@@ -1,11 +1,6 @@
-
-
-
-
-
-
+
diff --git a/kratos.gid/apps/Structural/xml/XmlController.tcl b/kratos.gid/apps/Structural/xml/XmlController.tcl
index 1a0c25749..6168ff5b4 100644
--- a/kratos.gid/apps/Structural/xml/XmlController.tcl
+++ b/kratos.gid/apps/Structural/xml/XmlController.tcl
@@ -1,10 +1,10 @@
-namespace eval Structural::xml {
- variable dir
+namespace eval ::Structural::xml {
+ namespace path ::Structural
+ Kratos::AddNamespace [namespace current]
}
-proc Structural::xml::Init { } {
- variable dir
- Model::InitVariables dir $Structural::dir
+proc ::Structural::xml::Init { } {
+ Model::InitVariables dir $::Structural::dir
Model::getSolutionStrategies Strategies.xml
Model::getElements Elements.xml
@@ -19,26 +19,24 @@ proc Structural::xml::Init { } {
Model::getSolvers Solvers.xml
}
-proc Structural::xml::getUniqueName {name} {
- return ST$name
+proc ::Structural::xml::getUniqueName {name} {
+ return [::Structural::GetAttribute prefix]$name
}
-proc ::Structural::xml::MultiAppEvent {args} {
-
-}
-
-proc Structural::xml::CustomTree { args } {
+proc ::Structural::xml::CustomTree { args } {
spdAux::SetValueOnTreeItem state hidden STResults CutPlanes
spdAux::SetValueOnTreeItem v SingleFile GiDOptions GiDMultiFileFlag
spdAux::SetValueOnTreeItem v 1 GiDOptions EchoLevel
- set result_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute NodalResults]/value\[@n = 'CONDENSED_DOF_LIST_2D'\]"]
+ set nodal_results_node [[customlib::GetBaseRoot] selectNodes [spdAux::getRoute NodalResults]]
+
+ set result_node [$nodal_results_node selectNodes "./value\[@n = 'CONDENSED_DOF_LIST_2D'\]"]
if {$result_node ne "" } {$result_node delete}
- set result_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute NodalResults]/value\[@n = 'CONDENSED_DOF_LIST'\]"]
+ set result_node [$nodal_results_node selectNodes "./value\[@n = 'CONDENSED_DOF_LIST'\]"]
if {$result_node ne "" } {$result_node delete}
- set result_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute NodalResults]/value\[@n = 'CONTACT'\]"]
+ set result_node [$nodal_results_node selectNodes "./value\[@n = 'CONTACT'\]"]
if {$result_node ne "" } {$result_node delete}
- set result_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute NodalResults]/value\[@n = 'CONTACT_SLAVE'\]"]
+ set result_node [$nodal_results_node selectNodes "./value\[@n = 'CONTACT_SLAVE'\]"]
if {$result_node ne "" } {$result_node delete}
set result_node [[customlib::GetBaseRoot] selectNodes "[spdAux::getRoute STNodalConditions]/condition\[@n = 'VOLUMETRIC_STRAIN'\]"]
if {$result_node ne "" } {$result_node delete}
@@ -52,7 +50,7 @@ proc Structural::xml::CustomTree { args } {
}
}
-proc Structural::xml::ProcCheckGeometryStructural {domNode args} {
+proc ::Structural::xml::ProcCheckGeometryStructural {domNode args} {
set ret "line,surface"
if {$::Model::SpatialDimension eq "3D"} {
set ret "line,surface,volume"
@@ -60,7 +58,7 @@ proc Structural::xml::ProcCheckGeometryStructural {domNode args} {
return $ret
}
-proc Structural::xml::ProcGetSolutionStrategiesStructural { domNode args } {
+proc ::Structural::xml::ProcGetSolutionStrategiesStructural { domNode args } {
set names ""
set pnames ""
set solutionType [get_domnode_attribute [$domNode selectNodes [spdAux::getRoute STSoluType]] v]
@@ -82,7 +80,7 @@ proc Structural::xml::ProcGetSolutionStrategiesStructural { domNode args } {
return $pnames
}
-proc Structural::xml::ProcCheckNodalConditionStateStructural {domNode args} {
+proc ::Structural::xml::ProcCheckNodalConditionStateStructural {domNode args} {
# Overwritten the base function to add Solution Type restrictions
set parts_un STParts
if {[spdAux::getRoute $parts_un] ne ""} {
@@ -103,7 +101,7 @@ proc Structural::xml::ProcCheckNodalConditionStateStructural {domNode args} {
} {return "normal"}
}
-proc Structural::xml::ProcCheckGeometryStructural {domNode args} {
+proc ::Structural::xml::ProcCheckGeometryStructural {domNode args} {
set ret "surface"
if {$::Model::SpatialDimension eq "3D"} {
set ret "surface,volume"
@@ -112,7 +110,7 @@ proc Structural::xml::ProcCheckGeometryStructural {domNode args} {
}
-proc Structural::xml::UpdateParts {domNode args} {
+proc ::Structural::xml::UpdateParts {domNode args} {
set current [lindex [$domNode selectNodes "./group"] end]
set element_name [get_domnode_attribute [$current selectNodes "./value\[@n = 'Element'\]"] v]
set element [Model::getElement $element_name]
@@ -122,7 +120,7 @@ proc Structural::xml::UpdateParts {domNode args} {
}
}
-proc Structural::xml::AddLocalAxesToBeamElement { current } {
+proc ::Structural::xml::AddLocalAxesToBeamElement { current } {
# set y_axis_deviation [get_domnode_attribute [$current selectNodes "./value\[@n = 'LOCAL_AXIS_ROTATION'\]"] v]
# W $y_axis_deviation
set group [get_domnode_attribute $current n]
@@ -136,7 +134,7 @@ proc Structural::xml::AddLocalAxesToBeamElement { current } {
############# procs #################
-proc Structural::xml::ProcGetElementsStructural { domNode args } {
+proc ::Structural::xml::ProcGetElementsStructural { domNode args } {
set nodeApp [spdAux::GetAppIdFromNode $domNode]
set sol_stratUN [apps::getAppUniqueName $nodeApp SolStrat]
set schemeUN [apps::getAppUniqueName $nodeApp Scheme]
@@ -194,6 +192,4 @@ proc Structural::xml::ProcGetElementsStructural { domNode args } {
}
#spdAux::RequestRefresh
return $diction
-}
-
-Structural::xml::Init
+}
\ No newline at end of file
diff --git a/kratos.gid/apps/ThermicLauncher/app.json b/kratos.gid/apps/ThermicLauncher/app.json
new file mode 100644
index 000000000..aac9d4568
--- /dev/null
+++ b/kratos.gid/apps/ThermicLauncher/app.json
@@ -0,0 +1,23 @@
+{
+ "id": "Thermic Launcher",
+ "name": "Thermic",
+ "script_files": [
+ "start.tcl"
+ ],
+ "start_script": "::ThermicLauncher::Init",
+ "requeriments": {
+ "apps_exist": [
+ "ConvectionDiffusion",
+ "Buoyancy",
+ "ConjugateHeatTransfer"
+ ],
+ "minimum_gid_version": "15.1.3d"
+ },
+ "permissions": {
+ "open_tree": false,
+ "show_toolbar": true,
+ "intervals": false,
+ "wizard": false
+ },
+ "description": "Thermal applications \n-Convection diffusion\n-Buoyancy\n-Conjugate heat transfer"
+}
\ No newline at end of file
diff --git a/kratos.gid/apps/ThermicLauncher/start.tcl b/kratos.gid/apps/ThermicLauncher/start.tcl
index 860325b96..f58e460a9 100644
--- a/kratos.gid/apps/ThermicLauncher/start.tcl
+++ b/kratos.gid/apps/ThermicLauncher/start.tcl
@@ -1,20 +1,20 @@
namespace eval ::ThermicLauncher {
+ Kratos::AddNamespace [namespace current]
+
variable available_apps
}
-proc ::ThermicLauncher::Init { } {
+proc ::ThermicLauncher::Init { app } {
variable available_apps
+ # TODO: Get apps from json
set available_apps [list ConvectionDiffusion Buoyancy ConjugateHeatTransfer]
- # Allow to open the tree
- set ::spdAux::TreeVisibility 0
::ThermicLauncher::AppSelectorWindow
}
proc ::ThermicLauncher::AppSelectorWindow { } {
variable available_apps
- set initwind $::spdAux::initwind
set root [customlib::GetBaseRoot]
set nd [ [$root selectNodes "value\[@n='nDim'\]"] getAttribute v]
@@ -25,10 +25,9 @@ proc ::ThermicLauncher::AppSelectorWindow { } {
} {
[$root selectNodes "value\[@n='nDim'\]"] setAttribute v wait
- set initwind .gid.win_example
- if { [ winfo exist $initwind]} {
- destroy $initwind
- }
+ set initwind $::spdAux::application_window_id
+ spdAux::DestroyWindows
+ spdAux::RegisterWindow $initwind
toplevel $initwind
wm withdraw $initwind
@@ -45,21 +44,30 @@ proc ::ThermicLauncher::AppSelectorWindow { } {
ttk::frame $w.top
ttk::label $w.top.title_text -text [_ "Select a Thermic application"]
- ttk::frame $w.information -relief ridge
+ ttk::frame $w.applications -relief ridge
set i 0
foreach app $available_apps {
set img [::apps::getImgFrom $app]
set app_publicname [[::apps::getAppById $app] getPublicName]
- set but [ttk::button $w.information.img$app -image $img -command [list ::ThermicLauncher::ChangeAppTo $app] ]
- ttk::label $w.information.text$app -text $app_publicname
- grid $w.information.img$app -column $i -row 0
- grid $w.information.text$app -column $i -row 1
+ set but [ttk::button $w.applications.img$app -image $img -command [list ::ThermicLauncher::ChangeAppTo $app] ]
+ bind $w.applications.img$app {::spdAux::PlaceInformationWindowByPath %W applications}
+ ttk::label $w.applications.text$app -text $app_publicname
+ grid $w.applications.img$app -column $i -row 0
+ grid $w.applications.text$app -column $i -row 1
incr i
}
grid $w.top
grid $w.top.title_text
- grid $w.information
+ grid $w.applications
+
+ # Information panel
+ 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
+ grid $w.info.text
+ grid $w.info -sticky we
+
}
}
@@ -68,5 +76,3 @@ proc ::ThermicLauncher::ChangeAppTo {appid} {
spdAux::SetSpatialDimmension undefined
apps::setActiveApp $appid
}
-
-::ThermicLauncher::Init
diff --git a/kratos.gid/exec/MainKratos.py b/kratos.gid/exec/MainKratos.py
new file mode 100644
index 000000000..fa3674d25
--- /dev/null
+++ b/kratos.gid/exec/MainKratos.py
@@ -0,0 +1,45 @@
+import sys
+import time
+import importlib
+
+import KratosMultiphysics
+
+def CreateAnalysisStageWithFlushInstance(cls, global_model, parameters):
+ class AnalysisStageWithFlush(cls):
+
+ def __init__(self, model,project_parameters, flush_frequency=10.0):
+ super().__init__(model,project_parameters)
+ self.flush_frequency = flush_frequency
+ self.last_flush = time.time()
+ sys.stdout.flush()
+
+ def Initialize(self):
+ super().Initialize()
+ sys.stdout.flush()
+
+ def FinalizeSolutionStep(self):
+ super().FinalizeSolutionStep()
+
+ if self.parallel_type == "OpenMP":
+ now = time.time()
+ if now - self.last_flush > self.flush_frequency:
+ sys.stdout.flush()
+ self.last_flush = now
+
+ return AnalysisStageWithFlush(global_model, parameters)
+
+if __name__ == "__main__":
+
+ with open("ProjectParameters.json", 'r') as parameter_file:
+ parameters = KratosMultiphysics.Parameters(parameter_file.read())
+
+ analysis_stage_module_name = parameters["analysis_stage"].GetString()
+ analysis_stage_class_name = analysis_stage_module_name.split('.')[-1]
+ analysis_stage_class_name = ''.join(x.title() for x in analysis_stage_class_name.split('_'))
+
+ analysis_stage_module = importlib.import_module(analysis_stage_module_name)
+ analysis_stage_class = getattr(analysis_stage_module, analysis_stage_class_name)
+
+ global_model = KratosMultiphysics.Model()
+ simulation = CreateAnalysisStageWithFlushInstance(analysis_stage_class, global_model, parameters)
+ simulation.Run()
diff --git a/kratos.gid/exec/compiled.unix.bat b/kratos.gid/exec/compiled.unix.bat
new file mode 100644
index 000000000..c2e89e6cc
--- /dev/null
+++ b/kratos.gid/exec/compiled.unix.bat
@@ -0,0 +1,45 @@
+#!/bin/bash
+# OutputFile: "$2/$1.info"
+# ErrorFile: "$2/$1.err"
+#delete previous result file
+rm -f "$2/$1*.post.bin"
+rm -f "$2/$1*.post.res"
+rm -f "$2/$1*.post.msh"
+rm -f "$2/$1.info"
+rm -f "$2/$1.err"
+rm -f "$2/$1.flavia.dat"
+
+# include .bashrc if it exists
+if [ -f "$HOME/.bashrc" ]; then
+ . "$HOME/.bashrc"
+fi
+
+# gid redefines LD_LIBRARY_PATH to its own libs directory
+# and maintains OLD_LD_LIBRARY_PATH with previous settings
+# therefore, we use the OLD_LD_LIBRARY_PATH and prepend the path to the kratos libs
+if [ "$OLD_LD_LIBRARY_PATH" != "" ]; then
+ export LD_LIBRARY_PATH="$3/exec/Kratos":"$3/exec/Kratos/libs":$OLD_LD_LIBRARY_PATH
+else
+ # do not add the ':'
+ export LD_LIBRARY_PATH="$3/exec/Kratos":"$3/exec/Kratos/libs"
+fi
+
+# Prevents the PYTHONHOME error from happening and isolate possible python repacks present
+# in the system and interfeering with runkratos
+export PYTHONPATH="$3/exec/Kratos":$PYTHONPATH
+
+
+# if mac
+KERNEL=`uname -s`
+if [ $KERNEL = "Darwin" ]; then
+ KERNEL_NAME="macosx"
+ export DYLD_LIBRARY_PATH="$3/exec/Kratos":"$3/exec/Kratos/libs":$DYLD_LIBRARY_PATH
+ export DYLD_FALLBACK_LIBRARY_PATH="$3/exec/Kratos":"$3/exec/Kratos/libs":$DYLD_FALLBACK_LIBRARY_PATH
+ export PYTHONPATH="$3/exec/Kratos/Lib":"$3/exec/Kratos/Lib/lib-dynload/":$PYTHONPATH
+ export PYTHONHOME="$3/exec/Kratos"
+else
+ KERNEL_NAME="linux"
+fi
+
+# Run Python using the script MainKratos.py
+"$3/exec/Kratos/runkratos" MainKratos.py > "$2/$1.info" 2> "$2/$1.err"
\ No newline at end of file
diff --git a/kratos.gid/exec/compiled.win.bat b/kratos.gid/exec/compiled.win.bat
new file mode 100644
index 000000000..6807e92e0
--- /dev/null
+++ b/kratos.gid/exec/compiled.win.bat
@@ -0,0 +1,16 @@
+REM @ECHO OFF
+REM Identification for arguments
+REM basename = %1
+REM Project directory = %2
+REM Problem directory = %3
+
+REM OutputFile: "%2\%1.info"
+REM ErrorFile: "%2\%1.err"
+
+DEL "%2\%1.info"
+DEL "%2\%1.err"
+
+set PATH=%3\\exec\\kratos;%3\\exec\\kratos\\libs;%PATH%
+
+REM Run Python using the script MainKratos.py
+"%3\\exec\\kratos\\runkratos" MainKratos.py > "%2\\%1.info" 2> "%2\\%1.err"
\ No newline at end of file
diff --git a/kratos.gid/exec/global_pip.win.bat b/kratos.gid/exec/global_pip.win.bat
new file mode 100644
index 000000000..6094cf4b1
--- /dev/null
+++ b/kratos.gid/exec/global_pip.win.bat
@@ -0,0 +1,22 @@
+REM @ECHO OFF
+REM Identification for arguments
+REM basename = %1
+REM Project directory = %2
+REM Problem directory = %3
+
+REM OutputFile: "%2\%1.info"
+REM ErrorFile: "%2\%1.err"
+
+REM Remove previous calculation files and results
+DEL "%2\%1.info"
+DEL "%2\%1.err"
+DEL "%2\%1*.post.bin"
+DEL "%2\%1*.post.res"
+DEL "%2\%1*.post.msh"
+
+REM Install dependencies if needed
+pip install numpy
+pip install KratosFluidDynamicsApplication
+
+@REM Calculate!
+python MainKratos.py > "%2\\%1.info" 2> "%2\\%1.err"
diff --git a/kratos.gid/exec/install_python.win.bat b/kratos.gid/exec/install_python.win.bat
new file mode 100644
index 000000000..073c54183
--- /dev/null
+++ b/kratos.gid/exec/install_python.win.bat
@@ -0,0 +1,14 @@
+@echo off
+
+@REM
+cd %1
+
+rem --Download python installer
+rem Curl is included in windows since 2018
+curl -ss "https://www.python.org/ftp/python/3.9.9/python-3.9.9-amd64.exe" -o python-installer.exe
+
+rem --Install python
+python-installer.exe /quiet InstallAllUsers=1 PrependPath=1
+del python-installer.exe
+
+pause
\ No newline at end of file
diff --git a/kratos.gid/exec/install_python_and_dependencies.unix.sh b/kratos.gid/exec/install_python_and_dependencies.unix.sh
new file mode 100755
index 000000000..809c3287c
--- /dev/null
+++ b/kratos.gid/exec/install_python_and_dependencies.unix.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+apt install -qq -y python3 python3-distutils python3-apt python3-pip 2>1 > /dev/null
diff --git a/kratos.gid/exec/install_python_and_dependencies.win.bat b/kratos.gid/exec/install_python_and_dependencies.win.bat
new file mode 100644
index 000000000..ea0c5ea38
--- /dev/null
+++ b/kratos.gid/exec/install_python_and_dependencies.win.bat
@@ -0,0 +1,13 @@
+@echo off
+cd %1
+echo "Installing python 3.9.9 from www.python.org"
+rem --Download python installer
+rem Curl is included in windows since 2018
+curl -ssL "https://www.python.org/ftp/python/3.9.9/python-3.9.9-amd64.exe" -o python-installer.exe
+
+rem --Install python
+python-installer.exe /quiet InstallAllUsers=1 PrependPath=1
+del python-installer.exe
+echo "Python 3.9.9 installed"
+
+pause
\ No newline at end of file
diff --git a/kratos.gid/exec/launch.json b/kratos.gid/exec/launch.json
new file mode 100644
index 000000000..a3b91337a
--- /dev/null
+++ b/kratos.gid/exec/launch.json
@@ -0,0 +1,26 @@
+{
+ "configurations": [
+ {
+ "name": "Launch via pip",
+ "script": "pip",
+ "pip_packages": "KratosMultiphysics-all",
+ "dependency_check": "Kratos::CheckDependenciesPipMode"
+ },
+ {
+ "name": "Launch via pip with local packages",
+ "script": "local_pip",
+ "pip_packages": "exec/packages/**.whl",
+ "dependency_check": "Kratos::CheckDependenciesLocalPipMode"
+ },
+ {
+ "name": "Launch local compiled version",
+ "script": "compiled",
+ "dependency_check": "Kratos::CheckDependenciesLocalMode"
+ },
+ {
+ "name": "Docker",
+ "script": "",
+ "dependency_check": "Kratos::CheckDependenciesDockerMode"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/kratos.gid/exec/pip.unix.bat b/kratos.gid/exec/pip.unix.bat
new file mode 100755
index 000000000..81bfccc67
--- /dev/null
+++ b/kratos.gid/exec/pip.unix.bat
@@ -0,0 +1,13 @@
+#!/bin/bash
+# OutputFile: "$2/$1.info"
+# ErrorFile: "$2/$1.err"
+#delete previous result file
+rm -f "$2/$1*.post.bin"
+rm -f "$2/$1*.post.res"
+rm -f "$2/$1*.post.msh"
+rm -f "$2/$1.info"
+rm -f "$2/$1.err"
+rm -f "$2/$1.flavia.dat"
+
+# Run Python using the script MainKratos.py
+python3 MainKratos.py > "$2/$1.info" 2> "$2/$1.err"
\ No newline at end of file
diff --git a/kratos.gid/exec/pip.win.bat b/kratos.gid/exec/pip.win.bat
new file mode 100644
index 000000000..8b0194437
--- /dev/null
+++ b/kratos.gid/exec/pip.win.bat
@@ -0,0 +1,18 @@
+REM @ECHO OFF
+REM Identification for arguments
+REM basename = %1
+REM Project directory = %2
+REM Problem directory = %3
+
+REM OutputFile: "%2\%1.info"
+REM ErrorFile: "%2\%1.err"
+
+REM Remove previous calculation files and results
+DEL "%2\%1.info"
+DEL "%2\%1.err"
+DEL "%2\%1*.post.bin"
+DEL "%2\%1*.post.res"
+DEL "%2\%1*.post.msh"
+
+@REM Calculate!
+python MainKratos.py > "%2\\%1.info" 2> "%2\\%1.err"
diff --git a/kratos.gid/images/files.png b/kratos.gid/images/files.png
new file mode 100644
index 000000000..cb5fd2b02
Binary files /dev/null and b/kratos.gid/images/files.png differ
diff --git a/kratos.gid/images/losta.png b/kratos.gid/images/losta.png
new file mode 100644
index 000000000..c10ff7e13
Binary files /dev/null and b/kratos.gid/images/losta.png differ
diff --git a/kratos.gid/images/settings.png b/kratos.gid/images/settings.png
new file mode 100644
index 000000000..92b312731
Binary files /dev/null and b/kratos.gid/images/settings.png differ
diff --git a/kratos.gid/images/time1.png b/kratos.gid/images/time1.png
new file mode 100644
index 000000000..26b6c4600
Binary files /dev/null and b/kratos.gid/images/time1.png differ
diff --git a/kratos.gid/kratos.tcl b/kratos.gid/kratos.tcl
index 6709fcfd5..78a1bfdeb 100644
--- a/kratos.gid/kratos.tcl
+++ b/kratos.gid/kratos.tcl
@@ -3,11 +3,14 @@
# Do not change anything here unless it's strictly necessary.
##################################################################################
-namespace eval Kratos {
+namespace eval ::Kratos {
variable kratos_private
-
+
variable must_write_calc_data
variable must_exist_calc_data
+
+ variable tmp_init_mesh_time
+ variable namespaces
}
# Hard minimum GiD Version is 14
@@ -16,25 +19,25 @@ if {[GidUtils::VersionCmp "14.0.1"] >=0 } {
# GiD Developer versions
proc GiD_Event_InitProblemtype { dir } {
Kratos::Event_InitProblemtype $dir
- }
+ }
} {
# GiD Official versions
proc InitGIDProject { dir } {
Kratos::Event_InitProblemtype $dir
- }
+ }
}
} {
- # GiD versions previous to 14 are no longer allowed
+ # GiD versions previous to 15 are no longer allowed
# As we dont register the event InitProblemtype, the rest of events are also unregistered
# So no chance to open anything in GiD 13.x or earlier
- WarnWin "The minimum GiD Version for Kratos is 14 or later \nUpdate at gidhome.com"
+ WarnWin "The minimum GiD Version for Kratos is 15 or later \nUpdate at gidhome.com"
}
proc Kratos::Events { } {
variable kratos_private
# Recommended GiD Version is the latest developer always
- if {[GidUtils::VersionCmp "14.1.4d"] <0 } {
+ if {[GidUtils::VersionCmp "15.0.0"] <0 } {
set dir [file dirname [info script]]
uplevel #0 [list source [file join $kratos_private(Path) scripts DeprecatedEvents.tcl]]
Kratos::ModifyPreferencesWindowOld
@@ -46,68 +49,76 @@ proc Kratos::Events { } {
proc Kratos::RegisterGiDEvents { } {
# Unregister previous events
GiD_UnRegisterEvents PROBLEMTYPE Kratos
-
+
# Init / Load
# After new gid project
#GiD_RegisterEvent GiD_Event_InitProblemtype Kratos::Event_InitProblemtype PROBLEMTYPE Kratos
GiD_RegisterEvent GiD_Event_LoadModelSPD Kratos::Event_LoadModelSPD PROBLEMTYPE Kratos
-
+
# Groups / Layers
GiD_RegisterEvent GiD_Event_AfterRenameGroup Kratos::Event_AfterRenameGroup PROBLEMTYPE Kratos
-
+
# Mesh
GiD_RegisterEvent GiD_Event_BeforeMeshGeneration Kratos::Event_BeforeMeshGeneration PROBLEMTYPE Kratos
+ GiD_RegisterEvent GiD_Event_MeshProgress Kratos::Event_MeshProgress PROBLEMTYPE Kratos
GiD_RegisterEvent GiD_Event_AfterMeshGeneration Kratos::Event_AfterMeshGeneration PROBLEMTYPE Kratos
-
+
# Write - Calculation
GiD_RegisterEvent GiD_Event_AfterWriteCalculationFile Kratos::Event_AfterWriteCalculationFile PROBLEMTYPE Kratos
GiD_RegisterEvent GiD_Event_BeforeRunCalculation Kratos::Event_BeforeRunCalculation PROBLEMTYPE Kratos
-
+ GiD_RegisterEvent GiD_Event_SelectGIDBatFile Kratos::Event_SelectGIDBatFile PROBLEMTYPE Kratos
+
# Postprocess
GiD_RegisterEvent GiD_Event_InitGIDPostProcess Kratos::Event_InitGIDPostProcess PROBLEMTYPE Kratos
GiD_RegisterEvent GiD_Event_EndGIDPostProcess Kratos::Event_EndGIDPostProcess PROBLEMTYPE Kratos
-
+
# Save
GiD_RegisterEvent GiD_Event_BeforeSaveGIDProject Kratos::Event_BeforeSaveGIDProject PROBLEMTYPE Kratos
GiD_RegisterEvent GiD_Event_SaveModelSPD Kratos::Event_SaveModelSPD PROBLEMTYPE Kratos
-
+
# Extra
GiD_RegisterEvent GiD_Event_ChangedLanguage Kratos::Event_ChangedLanguage PROBLEMTYPE Kratos
-
+
# End
GiD_RegisterEvent GiD_Event_EndProblemtype Kratos::Event_EndProblemtype PROBLEMTYPE Kratos
-
+
# Preferences window
- GiD_RegisterPluginPreferencesProc Kratos::Event_ModifyPreferencesWindow
+ GiD_RegisterPluginPreferencesProc Kratos::Event_ModifyPreferencesWindow
+ CreateWidgetsFromXml::ClearCachePreferences
}
proc Kratos::Event_InitProblemtype { dir } {
variable kratos_private
-
+
# Init Kratos problemtype global vars with default values
Kratos::InitGlobalVariables $dir
# Load all common tcl files (not the app ones)
Kratos::LoadCommonScripts
-
+
# GiD Versions earlier than recommended get a message
Kratos::WarnAboutMinimumRecommendedGiDVersion
# Register the rest of events
Kratos::Events
-
+
# Start the log and register the initial information
Kratos::LogInitialData
# Problemtype libraries as CustomLib
Kratos::LoadProblemtypeLibraries
+ # Load launch modes
+ Kratos::LoadLaunchModes
+
# Load the Kratos problemtype global and user environment (stored preferences)
Kratos::LoadEnvironment
+ Kratos::SetDefaultLaunchMode
+
# Customize GiD menus to add the Kratos entry
Kratos::UpdateMenus
-
+
# Start the spd as new project. Mandatory even if we are opening an old case, because this loads the default spd for the future transform
spdAux::StartAsNewProject
@@ -117,21 +128,23 @@ proc Kratos::Event_InitProblemtype { dir } {
#open a window to allow the user select the app
after 500 [list spdAux::CreateWindow]
}
+
+ Kratos::CheckDependencies
}
proc Kratos::InitGlobalVariables {dir} {
variable kratos_private
-
+
# clean and start private variables array
unset -nocomplain kratos_private
set kratos_private(Path) $dir
-
+
# This variables allows us to Write only and to run only
variable must_write_calc_data
set must_write_calc_data 1
variable must_exist_calc_data
set must_exist_calc_data 1
-
+
# User environment (stored for future sessions)
# DevMode in preferences window
set kratos_private(DevMode) "release" ; #can be dev or release
@@ -139,6 +152,19 @@ proc Kratos::InitGlobalVariables {dir} {
set kratos_private(echo_level) 0
# indent in mdpa files | 0 ASCII unindented | 1 ASCII indented pretty
set kratos_private(mdpa_format) 1
+ # kratos debug env for VSCode debug
+ set kratos_private(debug_folder) ""
+ # 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
+ # git hash of the problemtype
+ set Kratos::kratos_private(problemtype_git_hash) 0
+ # Place were the logs will be placed
+ set Kratos::kratos_private(model_log_folder) ""
+ # Check exec/launch.json
+ 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]
@@ -152,43 +178,62 @@ proc Kratos::InitGlobalVariables {dir} {
set kratos_private(UseWizard) 0
# Project New 1/0
set kratos_private(ProjectIsNew) 1
+ # Is using files modules
+ set kratos_private(UseFiles) 0
# Variables from the problemtype definition (kratos.xml)
array set kratos_private [ReadProblemtypeXml [file join $kratos_private(Path) kratos.xml] Infoproblemtype {Name Version CheckMinimumGiDVersion}]
+
+ variable namespaces
+ set namespaces [list ]
+
+ variable pip_packages_required
+ set pip_packages_required [list KratosMultiphysics KratosFluidDynamicsApplication KratosConvectionDiffusionApplication \
+ KratosDEMApplication numpy KratosDamApplication KratosSwimmingDEMApplication KratosStructuralMechanicsApplication KratosMeshMovingApplication \
+ KratosMappingApplication KratosParticleMechanicsApplication KratosLinearSolversApplication KratosContactStructuralMechanicsApplication \
+ KratosFSIApplication==9.0.3]
+ #set pip_packages_required KratosMultiphysics-all==9.0.2
}
proc Kratos::LoadCommonScripts { } {
variable kratos_private
-
+
# append to auto_path only folders that must include tcl packages (loaded on demand with package require mechanism)
if { [lsearch -exact $::auto_path [file join $kratos_private(Path) scripts]] == -1 } {
lappend ::auto_path [file join $kratos_private(Path) scripts]
}
-
+ if { [lsearch -exact $::auto_path [file join $kratos_private(Path) libs]] == -1 } {
+ lappend ::auto_path [file join $kratos_private(Path) libs]
+ }
+
# Writing common scripts
- foreach filename {Writing.tcl WriteHeadings.tcl WriteMaterials.tcl WriteNodes.tcl
- WriteElements.tcl WriteConditions.tcl WriteConditionsByGiDId.tcl WriteConditionsByUniqueId.tcl
- WriteProjectParameters.tcl WriteSubModelPart.tcl WriteProcess.tcl} {
- uplevel #0 [list source [file join $kratos_private(Path) scripts Writing $filename]]
+ foreach filename {Writing WriteHeadings WriteMaterials WriteNodes
+ WriteElements WriteConditions WriteConditionsByGiDId WriteConditionsByUniqueId
+ WriteProjectParameters WriteSubModelPart WriteProcess} {
+ uplevel #0 [list source [file join $kratos_private(Path) scripts Writing $filename.tcl]]
}
# Common scripts
- foreach filename {Utils.tcl Logs.tcl Applications.tcl spdAuxiliar.tcl Menus.tcl Deprecated.tcl} {
- uplevel #0 [list source [file join $kratos_private(Path) scripts $filename]]
+ foreach filename {Utils Launch Applications spdAuxiliar Menus Deprecated Logs} {
+ uplevel #0 [list source [file join $kratos_private(Path) scripts $filename.tcl]]
}
# Common controllers
- foreach filename {ApplicationMarketWindow.tcl CommonProcs.tcl PreferencesWindow.tcl TreeInjections.tcl MdpaImportMesh.tcl} {
- uplevel #0 [list source [file join $kratos_private(Path) scripts Controllers $filename]]
+ foreach filename {ApplicationMarketWindow ExamplesWindow CommonProcs PreferencesWindow TreeInjections MdpaImportMesh Drawer ImportFiles} {
+ uplevel #0 [list source [file join $kratos_private(Path) scripts Controllers $filename.tcl]]
}
# Model class
- foreach filename {Model.tcl Entity.tcl Parameter.tcl Topology.tcl Solver.tcl ConstitutiveLaw.tcl Condition.tcl Element.tcl Material.tcl SolutionStrategy.tcl Process.tcl} {
- uplevel #0 [list source [file join $kratos_private(Path) scripts Model $filename]]
+ foreach filename {Model Entity Parameter Topology Solver ConstitutiveLaw Condition Element Material SolutionStrategy Process} {
+ uplevel #0 [list source [file join $kratos_private(Path) scripts Model $filename.tcl]]
}
# Libs
- foreach filename {SimpleXMLViewer.tcl FileManager.tcl } {
- uplevel #0 [list source [file join $kratos_private(Path) libs $filename]]
+ foreach filename {SimpleXMLViewer} {
+ uplevel #0 [list source [file join $kratos_private(Path) libs $filename.tcl]]
}
}
proc Kratos::Event_LoadModelSPD { filespd } {
+ after 1 [list Kratos::LoadModelSPD $filespd]
+}
+
+proc Kratos::LoadModelSPD { filespd } {
variable kratos_private
# Event called if a model exists, so close all the windows while tree isn't loaded
@@ -200,10 +245,10 @@ proc Kratos::Event_LoadModelSPD { filespd } {
# Need this check for old gid compatibility. Sometimes this event was called by mistake.
Kratos::CheckProjectIsNew $filespd
-
+
# If the spd file does not exist, sorry
if { ![file exists $filespd] } { WarnWin "Could not find the spd file\n$filespd" ;return }
-
+
#### TRANSFORM SECTION ####
# Need transform? Define concepts: Model spd = old version || Problemtype spd = new version || Result of transform == Valid spd
# Get PT version
@@ -213,11 +258,13 @@ proc Kratos::Event_LoadModelSPD { filespd } {
set old_doc [gid_groups_conds::open_XML_file_gzip $filespd]
set old_root [$old_doc documentElement]
set old_versionData [$old_root @version]
-
+ set version_data [dict create model_version $old_versionData ]
+ Kratos::Log "Load model -> [write::tcl2json $version_data]"
+
# Compare the version number
if { [package vcompare $versionPT $old_versionData] != 0 } {
# If the spd versions are different, transform (no matter which is greater)
-
+
# Do the transform
after idle [list Kratos::TransformProblemtype $old_root ${filespd}]
@@ -229,7 +276,7 @@ proc Kratos::Event_LoadModelSPD { filespd } {
# Refresh the cache
customlib::UpdateDocument
-
+
# Load default files (if any) (file selection values store the filepaths in the spd)
spdAux::LoadModelFiles
@@ -239,17 +286,27 @@ proc Kratos::Event_LoadModelSPD { filespd } {
# Reactive the previous app
spdAux::reactiveApp
+ apps::ExecuteOnCurrentApp LoadModelEvent $filespd
+
# Open the tree
spdAux::OpenTree
+
+ after 500 {set ::Kratos::kratos_private(model_log_folder) [file join [GiD_Info Project ModelName].gid Logs]}
}
+
}
proc Kratos::Event_EndProblemtype { } {
+ Kratos::Log "End session"
# New event system need an unregister
if {[GidUtils::VersionCmp "14.1.4d"] >= 0 } {
GiD_UnRegisterEvents PROBLEMTYPE Kratos
+ GiD_UnRegisterPluginPreferencesProc Kratos::Event_ModifyPreferencesWindow
}
if {[array exists ::Kratos::kratos_private]} {
+ # Close the log and moves them to the folder
+ Kratos::FlushLog
+
# Restore GiD variables that were modified by kratos and must be restored (maybe mesher)
Kratos::RestoreVariables
@@ -270,16 +327,22 @@ proc Kratos::Event_EndProblemtype { } {
# Clear private global variable
unset -nocomplain ::Kratos::kratos_private
+
}
+ Drawer::UnregisterAll
+
+ # Clear namespaces
+ Kratos::DestroyNamespaces
}
proc Kratos::RestoreVariables { } {
variable kratos_private
-
+
# Restore GiD variables that kratos modified (maybe the mesher...)
if {[info exists kratos_private(RestoreVars)]} {
foreach {k v} $kratos_private(RestoreVars) {
+ # W "$k $v"
set $k $v
}
}
@@ -291,7 +354,7 @@ proc Kratos::AddRestoreVar {varName} {
# Add a variable (and value) to the list of variables that will be restored before exiting
if {[info exists $varName]} {
- set val [set $varName]
+ set val [set $varName]
lappend kratos_private(RestoreVars) $varName $val
}
}
@@ -303,11 +366,18 @@ proc Kratos::LoadWizardFiles { } {
package require gid_smart_wizard
Kratos::UpdateMenus
}
+proc Kratos::LoadImportFiles { } {
+ variable kratos_private
+ # Load the wizard package
+ set kratos_private(UseFiles) 1
+ package require gid_pt_file_manager
+ Kratos::UpdateMenus
+}
proc Kratos::TransformProblemtype {old_dom old_filespd} {
# Check if current problemtype allows transforms
if {[GiDVersionCmp 14.1.1d] < 0} { W "The minimum GiD version for a transform is '14.1.1d'\n Click Ok to try it anyway (You may lose data)" }
-
+
# set ::Kratos_AskToTransform to 0 to not not ask if transform and old model, and automatically act like ok was pressed (e.g. to automatize in batch)
if { ![info exists ::Kratos_AskToTransform] || $::Kratos_AskToTransform } {
# Ask the user if it's ready to tranform
@@ -323,7 +393,7 @@ proc Kratos::TransformProblemtype {old_dom old_filespd} {
set old_activeapp [get_domnode_attribute $old_activeapp_node v]
} else {
WarnWin "Unable to get the active application in your model"
- return ""
+ return ""
}
# Get the old dimmension
set old_nd [ [$old_dom selectNodes "value\[@n='nDim'\]"] getAttribute v]
@@ -333,7 +403,7 @@ proc Kratos::TransformProblemtype {old_dom old_filespd} {
# Load the previous files (file selection values store the filepaths in the spd)
spdAux::LoadModelFiles $old_dom
-
+
# Refresh the cache
customlib::UpdateDocument
@@ -342,7 +412,7 @@ proc Kratos::TransformProblemtype {old_dom old_filespd} {
# Prepare the new spd (and model) active application
apps::setActiveApp $old_activeapp
- apps::ExecuteOnCurrentXML CustomTree ""
+ apps::ExecuteOnCurrentXML CustomTree ""
# Call to customlib transform and pray
gid_groups_conds::transform_problemtype $old_filespd
@@ -356,13 +426,15 @@ proc Kratos::TransformProblemtype {old_dom old_filespd} {
proc Kratos::Event_BeforeMeshGeneration {elementsize} {
# Prepare things before meshing
-
-
+ variable tmp_init_mesh_time
+ set inittime [clock seconds]
+ set tmp_init_mesh_time $inittime
+ Kratos::Log "Mesh BeforeMeshGeneration start"
GiD_Process Mescape Meshing MeshCriteria NoMesh Lines 1:end escape escape escape
GiD_Process Mescape Meshing MeshCriteria NoMesh Surfaces 1:end escape escape escape
GiD_Process Mescape Meshing MeshCriteria NoMesh Volumes 1:end escape escape escape
- # We need to mesh every line and surface assigned to a group that appears in the tree
+ # We need to mesh every line and surface assigned to a group that appears in the tree
foreach group [spdAux::GetAppliedGroups] {
GiD_Process Mescape Meshing MeshCriteria Mesh Lines {*}[GiD_EntitiesGroups get $group lines] escape escape escape
GiD_Process Mescape Meshing MeshCriteria Mesh Surfaces {*}[GiD_EntitiesGroups get $group surfaces] escape escape escape
@@ -370,12 +442,26 @@ proc Kratos::Event_BeforeMeshGeneration {elementsize} {
}
# Maybe the current application needs to do some extra job
set ret [apps::ExecuteOnCurrentApp BeforeMeshGeneration $elementsize]
+ set endtime [clock seconds]
+ set ttime [expr {$endtime-$inittime}]
+ Kratos::Log "Mesh BeforeMeshGeneration end in [Duration $ttime]"
return $ret
}
+proc Kratos::Event_MeshProgress { total_percent partial_percents_0 partial_percents_1 partial_percents_2 partial_percents_3 n_nodes n_elems } {
+ # Maybe the current application needs to do some extra job
+ apps::ExecuteOnCurrentApp MeshProgress $total_percent $partial_percents_0 $partial_percents_1 $partial_percents_2 $partial_percents_3 $n_nodes n_elems
+}
+
proc Kratos::Event_AfterMeshGeneration {fail} {
+ variable tmp_init_mesh_time
# Maybe the current application needs to do some extra job
apps::ExecuteOnCurrentApp AfterMeshGeneration $fail
+ set endtime [clock seconds]
+ set ttime [expr {$endtime-$tmp_init_mesh_time}]
+ Kratos::Log "Mesh end process in [Duration $ttime]"
+ set mesh_data [Kratos::GetMeshBasicData]
+ Kratos::Log "Mesh data -> [write::tcl2json $mesh_data]"
}
proc Kratos::Event_AfterRenameGroup { oldname newname } {
@@ -405,7 +491,7 @@ proc Kratos::Event_EndGIDPostProcess {} {
proc Kratos::Event_BeforeRunCalculation { batfilename basename dir problemtypedir gidexe args } {
# Let's launch the Kratos rocket!
set run 1
-
+
catch {
# If the user selected MPI, stop it!
set paralleltype [write::getValue ParallelType]
@@ -415,6 +501,17 @@ proc Kratos::Event_BeforeRunCalculation { batfilename basename dir problemtypedi
if {!$run} {
return [list "-cancel-" [= "You have selected MPI parallelism system.\nInput files have been written.\nRun the MPILauncher.sh script" ]]
}
+ set app_run_brake [apps::ExecuteOnCurrentApp BreakRunCalculation]
+ if {[write::isBooleanTrue $app_run_brake]} {return "-cancel-"}
+
+}
+
+proc Kratos::Event_SelectGIDBatFile { dir basename } {
+ if {[info exists Kratos::kratos_private(launch_configuration)]} {
+ set launch_mode $Kratos::kratos_private(launch_configuration)
+ ::GidUtils::SetWarnLine "Launch mode: $launch_mode"
+ return [Kratos::ExecuteLaunchByMode $launch_mode]
+ }
}
proc Kratos::Event_AfterWriteCalculationFile { filename errorflag } {
@@ -422,10 +519,11 @@ proc Kratos::Event_AfterWriteCalculationFile { filename errorflag } {
if {$Kratos::must_write_calc_data} {
set errcode [Kratos::WriteCalculationFilesEvent $filename]
if {$errcode} {return "-cancel-"}
- }
+ }
}
proc Kratos::WriteCalculationFilesEvent { {filename ""} } {
+ # W "Kratos::WriteCalculationFilesEvent"
# Write the calculation files (mdpa, json...)
if {$filename eq ""} {
# Model must be saved
@@ -437,14 +535,14 @@ proc Kratos::WriteCalculationFilesEvent { {filename ""} } {
}
}
# The calculation process may need the files of the file selector entries inside the model folder
- FileSelector::CopyFilesIntoModel [file dirname $filename]
+ if {$Kratos::kratos_private(UseFiles) eq 1} {FileSelector::CopyFilesIntoModel [file dirname $filename]}
# Start the write configuration clean
write::Init
-
+
# Start the writing process
set errcode [::write::writeEvent $filename]
-
+
# Kindly inform the user
if {$errcode} {
::GidUtils::SetWarnLine "Error writing mdpa or json"
@@ -457,7 +555,7 @@ proc Kratos::WriteCalculationFilesEvent { {filename ""} } {
proc Kratos::Event_BeforeSaveGIDProject { modelname} {
# There are some restrictions in the filenames
set fail [::Kratos::CheckValidProjectName $modelname]
-
+
if {$fail} {
W [= "Wrong project name. Avoid boolean and numeric names."]
return "-cancel-"
@@ -472,9 +570,18 @@ proc Kratos::Event_SaveModelSPD { filespd } {
Kratos::RegisterEnvironment
# User files (in file selectors) copied into the model (if required)
- 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]
+ Kratos::Log "Save model [file tail $filespd ]"
+
}
+
proc Kratos::Event_ChangedLanguage { newlan } {
Kratos::UpdateMenus
}
@@ -488,10 +595,25 @@ proc Kratos::Quicktest {example_app example_dim example_cmd} {
# We can only test examples from the Examples app
apps::setActiveApp Examples
-
+
# So launch the example
::Examples::LaunchExample $example_app $example_dim $example_cmd
# And close the windows
Kratos::DestroyWindows
}
+
+proc Kratos::AddNamespace { namespace_name } {
+ variable namespaces
+ lappend namespaces $namespace_name
+
+}
+
+proc Kratos::DestroyNamespaces { } {
+ variable namespaces
+
+ foreach name $namespaces {
+ catch {namespace delete $name}
+ }
+ uplevel #0 [list namespace delete ::Kratos]
+}
\ No newline at end of file
diff --git a/kratos.gid/kratos.unix.bat b/kratos.gid/kratos.unix.bat
index a32e79334..3ea4ad5d3 100755
--- a/kratos.gid/kratos.unix.bat
+++ b/kratos.gid/kratos.unix.bat
@@ -45,4 +45,4 @@ else
fi
# Run Python using the script MainKratos.py
-"$3/exec/Kratos/runkratos" MainKratos.py > "$2/$1.info" 2> "$2/$1.err"
+python3 MainKratos.py > "$2/$1.info" 2> "$2/$1.err"
diff --git a/kratos.gid/kratos.unix_release.bat b/kratos.gid/kratos.unix_release.bat
index 4f8b7547b..b81b0283d 100755
--- a/kratos.gid/kratos.unix_release.bat
+++ b/kratos.gid/kratos.unix_release.bat
@@ -24,6 +24,10 @@ else
export LD_LIBRARY_PATH="$3/exec/Kratos":"$3/exec/Kratos/libs"
fi
+# Mpi
+export PWD=`pwd`
+export OPAL_PREFIX="$PWD/exec/Kratos/OpenMPI"
+
# Prevents the PYTHONHOME error from happening and isolate possible python repacks present
# in the system and interfeering with runkratos
export PYTHONHOME="$3/exec/Kratos"
diff --git a/kratos.gid/kratos.xml b/kratos.gid/kratos.xml
index 33d28da6c..81386b6ce 100644
--- a/kratos.gid/kratos.xml
+++ b/kratos.gid/kratos.xml
@@ -3,9 +3,9 @@
Kratos
- 7.1.6
+ 9.0.1
- 14.1.2d
+ 15.1.3d
0
1
images/ImageFileBrowser.gif
@@ -44,51 +44,6 @@ Kratos is OPEN SOURCE. The main code and program structure is available and aime
Kratos is FREE because is devoted mainly to developers, researchers and students and, therefore, is the most fruitful way to share knowledge and built a robust numerical methods laboratory adapted to their users' needs. Free because you have the freedom to modify and distribute the software. The one thing you're not able to do with free software is take away other people's freedom. Please, read the license for more detailed information.
-
- * What is new?
- * Solid:
- - New examples
- * Structural:
- - Hinges
- - Eigen analysis
-
-
- * What is new?
- * Bug fix
-
-
- * What is new?
- * Removed Dam Application due to Copyright issues
-
-
- * What is new?
- * FSI:
- - Bug correction in the update utilities
- - Removed deprecated Python FSI solvers
- * Fixed display version number
-
-
- * What is new?
- * Several bug fixes in core and applications:
- - Better MPI portability (Linux)
- - More consistence support of json configuration file
- * Structural Mechanic:
- - Linear and nonlinear beam element (for small and large displacement)
- - Linear and nonlinear truss element (for small and large displacement)
- - Initial support for beam orientation
- - Truss element now available
- - New Hyperelastic Law
- - Corrections in the Updated Lagrangian Element
- - Membrane and shells of both 3 and 4 nodes now available
- * Fluid Dynamics:
- - Several improvements under the hood for the Embedded CFD solver
- - New monolithic version of the embedded solver based on Ausas shape functions
- - New slip model for embedded CFD
- * FSI:
- - Improved precision of the solvers
- * Added Dam application
- * New GUI
-
diff --git a/kratos.gid/kratos_default.spd b/kratos.gid/kratos_default.spd
index 6ff0a2c53..639ab2ca2 100644
--- a/kratos.gid/kratos_default.spd
+++ b/kratos.gid/kratos_default.spd
@@ -1,6 +1,6 @@
-
+
@@ -9,7 +9,6 @@
-
@@ -18,19 +17,21 @@
-
+
-
-
-
+
+
+
-
+
+
+
@@ -170,12 +171,19 @@
@@ -309,7 +317,24 @@
+
+
+
+
+
+
+
diff --git a/kratos.gid/libs/FileManager.tcl b/kratos.gid/libs/FileManager.tcl
deleted file mode 100644
index ffa9db1f6..000000000
--- a/kratos.gid/libs/FileManager.tcl
+++ /dev/null
@@ -1,173 +0,0 @@
-# Usage:
-# source {E:\PROYECTOS\FileWizard\NativeFileManager\NativeFileOpener.tcl}
-# FileSelector::InitWindow W
-# FileSelector::InitWindow puts
-# W $::FileSelector::files_to_model
-# puts W $::FileSelector::files_to_model
-# FileSelector::CopyFilesIntoModel {E:\TEMP\aaaa}
-
-namespace eval FileSelector {
- variable selected_file
- variable save_to_model
- variable result_proc_name
- variable result_proc_args
- variable w
- variable files_to_model
- variable files_list
-}
-
-proc FileSelector::Start {} {
- variable selected_file
- set selected_file ""
-
- variable result_proc_name
- set result_proc_name ""
- variable result_proc_args
- set result_proc_args ""
-
- variable w
- set w .gid.fileSelector
-
- variable files_to_model
- set files_to_model [list ]
-
- variable files_list
- set files_list [list ]
-}
-FileSelector::Start
-
-# PUBLIC FUNCTIONS
-proc FileSelector::InitWindow {updateProcname args} {
- set ::FileSelector::selected_file ""
- set ::FileSelector::save_to_model 0
- variable result_proc_name
- variable result_proc_args
- set result_proc_name $updateProcname
- set result_proc_args $args
- FileSelector::_OpenFileSelector
-}
-proc FileSelector::FinishWindow {result} {
- variable result_proc_name
- variable result_proc_args
-
- if {$result} {
- variable save_to_model
- variable files_to_model
- variable selected_file
- variable files_list
-
- if {$save_to_model} {
- lappend files_to_model $selected_file
- set selected_file [file join . [file tail $selected_file] ]
- }
- lappend files_list $selected_file
- $result_proc_name $selected_file $result_proc_args
- } else {
- $result_proc_name "" $result_proc_args
- }
- catch {variable w; destroy $w}
-}
-
-proc FileSelector::CopyFilesIntoModel { dir } {
- variable files_to_model
- variable files_list
- foreach f $files_to_model {
- set files_list [lsearch -all -inline -not -exact $files_list $f]
- file copy -force $f $dir
- lappend files_list [file join $dir $f]
- }
- set files_to_model [list ]
-}
-
-proc FileSelector::GetAllFiles { } {
- variable files_list
- return $files_list
-}
-proc FileSelector::AddFile { fileid } {
- variable files_list
- if {$fileid ne "" && $fileid ni $files_list} {lappend files_list $fileid}
-}
-
-
-# PRIVATE FUNCTIONS
-proc FileSelector::_OpenFileSelector2 { } {
- variable w
- catch {destroy $w}
- toplevel $w
- wm title $w "Select a file"
- wm minsize $w 400 200
- wm resizable $w 0 0
- # Top frame
- set fr1 [ttk::frame $w.fr1 -borderwidth 10]
-
- # Label
- set lab1 [ttk::label $fr1.lab1 -text {Filename: } -justify left -anchor w ]
- grid $lab1 -row 0 -column 0 -sticky ew
-
- # Entry
- grid [ttk::entry $fr1.ent1 -width 40 -textvariable ::FileSelector::selected_file] -column 1 -row 0 -sticky we; # -state readonly
-
- # Button browse
- grid [ttk::button $fr1.browse -text "Browse" -command "set ::FileSelector::selected_file \[tk_getOpenFile\]" ] -column 2 -row 0 -sticky we
-
- # Checkbutton
- grid [ttk::checkbutton $fr1.check -text "Save file into model?" -variable ::FileSelector::save_to_model] -column 0 -row 1 -columnspan 3 -sticky we
- grid $fr1 -column 0 -row 0 -sticky nw
-
- # Bottom frame
- set fr2 [ttk::frame $w.fr2 -borderwidth 10]
-
- # Button browse
- grid [ttk::button $fr2.cancel -text "Cancel" -command [list FileSelector::FinishWindow 0 ]] -column 0 -row 0 -sticky w
- grid [ttk::button $fr2.ok -text "Ok" -command [list FileSelector::FinishWindow 1] ] -column 1 -row 0 -sticky e
-
- grid $fr2 -column 0 -row 1 -sticky swe
-}
-
-proc FileSelector::_OpenFileSelector { } {
- variable w
- ::InitWindow $w [_ "Select a file"] PreFileSelectorWindowGeom FileSelector
- if { ![winfo exists $w] } return ;# windows disabled || usemorewindows == 0
-
- # Top frame
- set fr1 [ttk::frame $w.fr1 -borderwidth 10]
-
- # Label
- set lab1 [ttk::label $fr1.lab1 -text {Filename: } -justify left -anchor w ]
- grid $lab1 -row 0 -column 0 -sticky ew
-
- # Entry
- grid [ttk::entry $fr1.ent1 -width 40 -textvariable ::FileSelector::selected_file] -column 1 -row 0 -sticky we; # -state readonly
-
- # Button browse
- grid [ttk::button $fr1.browse -text "Browse" -command "set ::FileSelector::selected_file \[tk_getOpenFile\]" ] -column 2 -row 0 -sticky we
-
- # Checkbutton
- grid [ttk::checkbutton $fr1.check -text "Save file into model?" -variable ::FileSelector::save_to_model] -column 0 -row 1 -columnspan 3 -sticky we
-
- grid $fr1 -column 0 -row 0 -sticky nw
-
- ttk::frame $w.but -style BottomFrame.TFrame
- ttk::button $w.but.accept -text [_ "Apply"] -command "[list FileSelector::FinishWindow 1 ]" -underline 0 -style BottomFrame.TButton
- ttk::button $w.but.close -text [_ "Close"] -command "[list FileSelector::FinishWindow 0 ]" -underline 0 -style BottomFrame.TButton
-
-
- grid columnconfigure $w.fr1 1 -weight 1
-
- grid $w.but.accept -row 1 -column 1 -padx 5 -pady 6
- grid $w.but.close -row 1 -column 3 -padx 5 -pady 6
- grid $w.but -row 4 -column 0 -sticky ews -columnspan 7
- if { $::tcl_version >= 8.5 } { grid anchor $w.but center }
-
- grid $w.but -row 3 -sticky ews -columnspan 7
-
- grid columnconfigure $w 0 -weight 1
- grid rowconfigure $w 3 -weight 1
- #
- ## Resize behavior management
- #wm minsize $w 180 200
-
- focus $w.but.accept
- bind $w "$w.but.close invoke"
- bind $w "$w.but.close invoke"
-}
\ No newline at end of file
diff --git a/kratos.gid/libs/gid-pt-file-manager/LICENSE b/kratos.gid/libs/gid-pt-file-manager/LICENSE
new file mode 100644
index 000000000..67afb7f1e
--- /dev/null
+++ b/kratos.gid/libs/gid-pt-file-manager/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021 GiD
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/kratos.gid/libs/gid-pt-file-manager/README.md b/kratos.gid/libs/gid-pt-file-manager/README.md
new file mode 100644
index 000000000..96ec9a5f6
--- /dev/null
+++ b/kratos.gid/libs/gid-pt-file-manager/README.md
@@ -0,0 +1 @@
+# gid-pt-file-manager
\ No newline at end of file
diff --git a/kratos.gid/libs/gid-pt-file-manager/gid_pt_file_manager.tcl b/kratos.gid/libs/gid-pt-file-manager/gid_pt_file_manager.tcl
new file mode 100644
index 000000000..db1752ae7
--- /dev/null
+++ b/kratos.gid/libs/gid-pt-file-manager/gid_pt_file_manager.tcl
@@ -0,0 +1,272 @@
+package provide gid_pt_file_manager 1.0
+
+# Usage:
+ # set FileSelector::callback_after_new_file "PFEM::xml::SaveModelFile"
+ # set FileSelector::callback_view_file "PFEM::xml::ViewFile"
+ # set FileSelector::callback_delete_file "PFEM::xml::DeleteFile"
+ # FileSelector::InitFileHandler
+
+namespace eval ::FileSelector {
+
+
+ variable selected_file
+ variable save_to_model
+ variable w
+ variable w_list
+ variable files_to_model
+ variable files_list
+
+ variable callback_after_new_file
+ variable callback_view_file
+ variable callback_delete_file
+}
+
+proc ::FileSelector::Start {} {
+ variable selected_file
+ set selected_file ""
+
+ variable w
+ set w .gid.fileSelector
+ variable w_list
+ set w_list .gid.fileList
+
+ variable files_to_model
+ set files_to_model [list ]
+
+ variable files_list
+ set files_list [list ]
+}
+FileSelector::Start
+
+# PUBLIC FUNCTIONS
+proc ::FileSelector::InitFileHandler { } {
+
+ variable w_list
+ catch {destroy $w_list}
+ toplevel $w_list
+ wm title $w_list "File handler"
+ wm minsize $w_list 400 200
+ wm resizable $w_list 0 0
+
+ ttk::frame $w_list.frame#2 -style groove.TFrame -borderwidth 3
+ ttk::frame $w_list.frame#6 -style BottomFrame.TFrame
+ ttk::frame $w_list.frame#1 -borderwidth 2 -style groove.TFrame
+ label $w_list.label#1 -text [_ "File name"]
+ listbox $w_list.listbox#1 \
+ -height 8 \
+ -width 40 \
+ -xscrollcommand "$w_list.scrollbar#1 set" \
+ -yscrollcommand "$w_list.scrollbar#2 set" -selectmode single
+
+ ttk::scrollbar $w_list.scrollbar#2 -command [list $w_list.listbox#1 yview] -orient vertical
+ ttk::scrollbar $w_list.scrollbar#1 -command [list $w_list.listbox#1 xview] -orient horizontal
+
+ menu $w_list.runprocmenu
+ bind $w_list.listbox#1 <1> "focus $w_list.listbox#1"
+ if { [esMac] } {
+ bind $w_list.listbox#1 <$::gid_central_button> "event generate $w_list.listbox#1 <1> -rootx %X -rooty %Y ; ShowRunprocMenu $w_list %X %Y"
+ } else {
+ bind $w_list.listbox#1 <$::gid_right_button> "event generate $w_list.listbox#1 <1> -rootx %X -rooty %Y ; ShowRunprocMenu $w_list %X %Y"
+ }
+
+ ttk::button $w_list.button#1 -text [_ "View file"] -command [list FileSelector::ViewFile] -style BottomFrame.TButton
+ ttk::button $w_list.button#2 -text [_ "Delete file"] -command [list FileSelector::DeleteFile] -style BottomFrame.TButton
+
+ ttk::button $w_list.button#4 -text [_ "Add file"] -command [list FileSelector::InitWindow] -style BottomFrame.TButton
+
+ focus $w_list.button#4
+ ttk::button $w_list.button#5 -text [_ "Close"] -command [list destroy $w_list] -style BottomFrame.TButton
+
+ # Geometry management
+ grid $w_list.frame#2 -in $w_list.frame#1 -row 4 -column 1 -sticky nw -padx 1 -pady 1
+ grid $w_list.frame#6 -in $w_list -row 3 -column 1 -sticky ew
+ grid anchor $w_list.frame#6 center
+ grid $w_list.frame#1 -in $w_list -row 1 -column 1 -sticky nesw -columnspan 2 -padx 3 -pady 3
+ grid $w_list.label#1 -in $w_list.frame#1 -row 1 -column 1 -sticky w -pady 3 -padx 3
+ grid $w_list.listbox#1 -in $w_list.frame#1 -row 2 -column 1 -sticky nesw
+ grid $w_list.scrollbar#2 -in $w_list.frame#1 -row 2 -column 2 -sticky ns
+ grid $w_list.scrollbar#1 -in $w_list.frame#1 -row 3 -column 1 -sticky ew
+ grid $w_list.button#4 -in $w_list.frame#2 -row 1 -column 1 -sticky w -padx 3
+ grid $w_list.button#1 -in $w_list.frame#2 -row 1 -column 2 -sticky w -padx 3
+ grid $w_list.button#2 -in $w_list.frame#2 -row 1 -column 3 -sticky w -padx 3
+
+ grid $w_list.button#5 -in $w_list.frame#6 -padx 3 -pady 3
+
+ grid columnconfigure $w_list.frame#2 "1 2" -weight 1
+
+ grid rowconfigure $w_list 1 -weight 1
+ grid columnconfigure $w_list 1 -weight 1
+
+ grid rowconfigure $w_list.frame#1 2 -weight 1
+ grid columnconfigure $w_list.frame#1 1 -weight 1
+
+ FileSelector::FillFileList
+}
+
+# what can be: current or window
+proc ::FileSelector::DeleteFile { } {
+ variable w_list
+ variable files_list
+
+ set wbase $w_list
+ set w $w_list.listbox#1
+ if { [$w size] == 1 } { $w sel set 0}
+ set sel [$w curselection]
+ if {$sel eq ""} {return ""}
+ set fil [$w get $sel]
+ set idx [lsearch $files_list $fil]
+ set files_list [lreplace $files_list $idx $idx]
+ FileSelector::FillFileList
+
+ variable callback_delete_file
+ $callback_delete_file $fil
+}
+
+proc ::FileSelector::ViewFile { } {
+ variable w_list
+
+ set wbase $w_list
+ set w $w_list.listbox#1
+ if { [$w size] == 1 } { $w sel set 0}
+ set sel [$w curselection]
+ if {$sel eq ""} {return ""}
+ set fil [$w get $sel]
+
+ variable callback_view_file
+ $callback_view_file $fil
+}
+
+proc ::FileSelector::FillFileList { } {
+ variable w_list
+ variable files_list
+ if { [GidUtils::AreWindowsDisabled] } {
+ return
+ }
+ if { ![winfo exists $w_list] } {
+ return
+ }
+
+ $w_list.listbox#1 delete 0 end
+ foreach name $files_list {
+ $w_list.listbox#1 insert end $name
+ }
+}
+
+proc ::FileSelector::InitWindow {} {
+ set ::FileSelector::selected_file ""
+ set ::FileSelector::save_to_model 0
+ FileSelector::_OpenFileSelector
+}
+
+proc ::FileSelector::FinishWindow {result} {
+ variable result_proc_name
+ variable result_proc_args
+
+ if {$result} {
+ variable save_to_model
+ variable files_to_model
+ variable selected_file
+ variable files_list
+
+ if {$save_to_model} {
+ lappend files_to_model $selected_file
+ set selected_file [file join . [file tail $selected_file] ]
+
+ }
+ variable callback_after_new_file
+ if {$callback_after_new_file ne ""} {$callback_after_new_file $selected_file}
+ }
+ catch {variable w; destroy $w}
+
+ variable w_list
+
+ if { ![winfo exists $w_list] } {
+ return
+ }
+ FileSelector::FillFileList
+
+ focus $w_list.button#4
+
+}
+
+proc ::FileSelector::CopyFilesIntoModel { dir } {
+ variable files_to_model
+ # variable files_list
+ foreach f $files_to_model {
+ # set files_list [lsearch -all -inline -not -exact $files_list $f]
+ file copy -force $f $dir
+ #lappend files_list [file join $dir $f]
+ }
+ set files_to_model [list ]
+}
+
+proc ::FileSelector::GetAllFiles { } {
+ variable files_list
+ return $files_list
+}
+proc ::FileSelector::AddFile { fileid } {
+ variable files_list
+
+ if {$fileid ne "" && $fileid ni $files_list} {
+ lappend files_list $fileid
+ }
+}
+
+proc ::FileSelector::ClearFileList { } {
+ variable files_list
+ set files_list [list ]
+}
+
+# PRIVATE FUNCTIONS
+proc ::FileSelector::_OpenFileSelector { } {
+ variable w
+ ::InitWindow $w [_ "Select a file"] PreFileSelectorWindowGeom FileSelector
+ if { ![winfo exists $w] } return ;# windows disabled || usemorewindows == 0
+
+ # Top frame
+ set fr1 [ttk::frame $w.fr1 -borderwidth 10]
+
+ # Label
+ set lab1 [ttk::label $fr1.lab1 -text {Filename: } -justify left -anchor w ]
+ grid $lab1 -row 0 -column 0 -sticky ew
+
+ # Entry
+ grid [ttk::entry $fr1.ent1 -width 40 -textvariable ::FileSelector::selected_file] -column 1 -row 0 -sticky we; # -state readonly
+
+ # Button browse
+ grid [ttk::button $fr1.browse -text "Browse" -command "set ::FileSelector::selected_file \[tk_getOpenFile\]" ] -column 2 -row 0 -sticky we
+
+ # Checkbutton
+ set ::FileSelector::save_to_model 1
+ grid [ttk::label $fr1.check -text "File will be copied into your model folder" ] -column 0 -row 1 -columnspan 3 -sticky we
+ #grid [ttk::checkbutton $fr1.check -text "Save file into model?" -variable ::FileSelector::save_to_model] -column 0 -row 1 -columnspan 3 -sticky we
+
+ grid $fr1 -column 0 -row 0 -sticky nw
+
+ ttk::frame $w.but -style BottomFrame.TFrame
+ ttk::button $w.but.accept -text [_ "Apply"] -command "[list FileSelector::FinishWindow 1 ]" -underline 0 -style BottomFrame.TButton
+ ttk::button $w.but.close -text [_ "Close"] -command "[list FileSelector::FinishWindow 0 ]" -underline 0 -style BottomFrame.TButton
+
+
+ grid columnconfigure $w.fr1 1 -weight 1
+
+ grid $w.but.accept -row 1 -column 1 -padx 5 -pady 6
+ grid $w.but.close -row 1 -column 3 -padx 5 -pady 6
+ grid $w.but -row 4 -column 0 -sticky ews -columnspan 7
+ if { $::tcl_version >= 8.5 } { grid anchor $w.but center }
+
+ grid $w.but -row 3 -sticky ews -columnspan 7
+
+ grid columnconfigure $w 0 -weight 1
+ grid rowconfigure $w 3 -weight 1
+ #
+ ## Resize behavior management
+ #wm minsize $w 180 200
+
+ focus $w.but.accept
+ bind $w "$w.but.close invoke"
+ bind $w "$w.but.close invoke"
+}
+set FileSelector::callback_after_new_file ""
+set FileSelector::callback_view_file ""
+set FileSelector::callback_delete_file ""
\ No newline at end of file
diff --git a/kratos.gid/libs/gid-pt-file-manager/pkgIndex.tcl b/kratos.gid/libs/gid-pt-file-manager/pkgIndex.tcl
new file mode 100644
index 000000000..cc7fc27de
--- /dev/null
+++ b/kratos.gid/libs/gid-pt-file-manager/pkgIndex.tcl
@@ -0,0 +1,2 @@
+
+package ifneeded gid_pt_file_manager 1.0 [list source [file join $dir gid_pt_file_manager.tcl]]
diff --git a/kratos.gid/scripts/Applications.tcl b/kratos.gid/scripts/Applications.tcl
index 67af6d9b6..1049e5b5d 100644
--- a/kratos.gid/scripts/Applications.tcl
+++ b/kratos.gid/scripts/Applications.tcl
@@ -3,7 +3,9 @@
# Do not change anything here unless it's strictly necessary.
##################################################################################
-namespace eval apps {
+namespace eval ::apps {
+ Kratos::AddNamespace [namespace current]
+
variable activeApp
variable appList
}
@@ -24,7 +26,7 @@ proc apps::ClearActiveApp {} {
proc apps::setActiveApp {appid} {
variable activeApp
variable appList
-
+
foreach app $appList {
if {[$app getName] eq $appid} {
set activeApp $app
@@ -80,21 +82,37 @@ proc apps::NewApp {appid publicname prefix} {
return $ap
}
-proc apps::getAllApplicationsName {} {
+# also_tools => 0 all apps no tools | 1 all apps and tools | 2 only tools
+proc apps::getAppsList {{also_tools 1}} {
variable appList
-
- set appnames [list ]
+ set list [list ]
foreach app $appList {
+ set is_tool [$app isTool]
+ set pass 0
+ switch $also_tools {
+ 0 { if {!$is_tool} {set pass 1} }
+ 1 { set pass 1 }
+ 2 { if {$is_tool} {set pass 1} }
+ }
+ if {$pass} {
+ lappend list $app
+ }
+ }
+ return $list
+}
+proc apps::getAllApplicationsName {{also_tools 1}} {
+
+ set appnames [list ]
+ foreach app [apps::getAppsList $also_tools] {
lappend appnames [$app getPublicName]
}
return $appnames
}
-proc apps::getAllApplicationsID {} {
- variable appList
-
+proc apps::getAllApplicationsID {{also_tools 1}} {
+
set appnames [list ]
- foreach app $appList {
+ foreach app [apps::getAppsList $also_tools] {
lappend appnames [$app getName]
}
return $appnames
@@ -105,7 +123,7 @@ proc apps::getImgFrom { appName {img "logo" } } {
}
proc apps::getImgPathFrom { appName {img "logo" } } {
variable appList
-
+
set imagespath ""
foreach app $appList {
if {[$app getName] eq $appName} {set imagespath [expr {$img == "logo" ? [$app getIcon] : [$app getImagePath $img] }]; break}
@@ -137,7 +155,7 @@ proc apps::ExecuteOnCurrentXML { func args} {
proc apps::ExecuteOnAppXML { appid func args} {
set response ""
set app [getAppById $appid]
- set response [$app executexml $func {*}$args]
+ set response [$app executexml $func {*}$args]
return $response
}
@@ -145,7 +163,7 @@ proc apps::ExecuteOnAppXML { appid func args} {
proc apps::ExecuteOnApp {appid func args} {
set response ""
set app [getAppById $appid]
- set response [$app execute $func {*}$args]
+ set response [$app execute $func {*}$args]
return $response
}
@@ -175,7 +193,7 @@ proc apps::isPublic {appId} {
proc apps::CheckElemState {elem inputid {arg ""} } {
variable activeApp
-
+
return [$activeApp executexml CheckElemState $elem $inputid $arg]
}
@@ -192,7 +210,10 @@ oo::class create App {
variable writeValidateEvent
variable prefix
variable release
-
+ variable is_tool
+
+ variable properties
+
constructor {n} {
variable name
variable publicname
@@ -203,7 +224,9 @@ oo::class create App {
variable writeValidateEvent
variable prefix
variable public
-
+ variable is_tool
+ variable properties
+
set name $n
set publicname $n
set imagepath [file nativename [file join $::Kratos::kratos_private(Path) apps $n images] ]
@@ -221,32 +244,33 @@ oo::class create App {
append writeValidateEvent "::writeValidateEvent"
set prefix ""
set public 0
+ set is_tool 0
+
+ set properties [dict create ]
+ apps::LoadAppProperties [self]
}
-
- method activate { } {
- variable name
- apps::ActivateApp_do $name
- }
-
+
+ method activate { } {apps::ActivateApp_do [self]}
+
method getPrefix { } {variable prefix; return $prefix}
method setPrefix { p } {variable prefix; set prefix $p}
-
+
method getPublicName { } {variable publicname; return $publicname}
method setPublicName { pn } {variable publicname; set publicname $pn}
-
+
method getName { } {variable name; return $name}
-
+
method getIcon { } {return [my getImagePath logo.png]}
method getImagePath { imgName } {variable imagepath; return [file nativename [file join $imagepath $imgName] ]}
-
+
method getWriteModelPartEvent { } {variable writeModelPartEvent; return $writeModelPartEvent}
-
+
method getWriteParametersEvent { } {variable writeParametersEvent; return $writeParametersEvent}
-
+
method getWriteCustomEvent { } {variable writeCustomEvent; return $writeCustomEvent}
method getValidateWriteEvent { } {variable writeValidateEvent; return $writeValidateEvent}
-
+
method executexml { func args } {
variable name
set f ::${name}::xml::${func}
@@ -257,33 +281,73 @@ oo::class create App {
set f ::${name}::${func}
if {[info procs $f] ne ""} {$f {*}$args}
}
-
- method setPublic {v} {
- variable public
- set public $v
+
+ method setPublic {v} {variable public; set public $v}
+ method isPublic { } {variable public; return $public}
+
+ method setIsTool {v} {variable is_tool; set is_tool $v}
+ method isTool { } {variable is_tool; return $is_tool}
+
+ method getKratosApplicationName { } {return [::${name}::GetAttribute kratos_name]}
+
+ method setProperties {props} {variable properties; set properties $props}
+ method getProperty {n} {variable properties; if {[dict exists $properties $n]} {return [dict get $properties $n]}}
+ method getProperties {} {variable properties; return $properties}
+ method getPermission {n} {variable properties; if {[dict exists $properties permissions $n]} {return [dict get $properties permissions $n]} }
+ method getPermissions {} {variable properties; return [dict get $properties permissions]}
+ method getUniqueName {n} {variable properties; if {[dict exists $properties unique_names $n]} {return [dict get $properties unique_names $n]} }
+ method getUniqueNames {} {variable properties; return [dict get $properties unique_names}
+ method getWriteProperty {n} {variable properties; if {[dict exists $properties write $n]} {return [dict get $properties write $n]} }
+ method getWriteProperties {} {variable properties; return [dict get $properties write}
+}
+
+proc apps::LoadAppProperties {app} {
+ set dir [file join $::Kratos::kratos_private(Path) apps [$app getName]]
+ set app_definition_file [file join $dir app.json]
+ if {[file exists $app_definition_file]} {
+ set props [Kratos::ReadJsonDict $app_definition_file]
+ $app setProperties $props
+ } else {
+ W "MISSING app.json file for app [$app getName]"
}
- method isPublic { } {
- variable public
- return $public
+}
+
+proc apps::ActivateApp_do {app} {
+ set dir [file join $::Kratos::kratos_private(Path) apps [$app getName]]
+ # Load app dependences
+ if {[dict exists [$app getProperty requeriments] apps]} {
+ foreach app_id [dict get [$app getProperty requeriments] apps] {
+ apps::LoadAppById $app_id
+ }
}
- method getKratosApplicationName { } {
- return [set ::${name}::kratos_name]
+
+ # Then load the app files, so we can overwrite functions loaded in dependences
+ if {[$app getProperty script_files] ne ""} {
+ foreach source_file [$app getProperty script_files] {
+ set fileName [file join $dir $source_file]
+ apps::loadAppFile $fileName
+ }
}
-}
-proc apps::ActivateApp_do {app_name} {
- # set ::Kratos::must_quit 0
- set dir [file join $::Kratos::kratos_private(Path) apps $app_name]
- set fileName [file join $dir start.tcl]
- apps::loadAppFile $fileName
+ set app_minimum_gid_version [dict get [$app getProperty requeriments] minimum_gid_version]
+ if {[GiDVersionCmp $app_minimum_gid_version] < 0} {W "Caution. Minimum GiD version is $app_minimum_gid_version"}
+ if {[write::isBooleanTrue [$app getPermission import_files]]} { Kratos::LoadImportFiles }
+ if {[write::isBooleanTrue [$app getPermission wizard]]} { Kratos::LoadWizardFiles }
+ if {[$app getProperty start_script] ne ""} {eval [$app getProperty start_script] $app}
+ apps::ApplyAppPreferences $app
+
+
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]]]
gid_groups_conds::add_images_dir [file join $dir images Black]
- }
+ }
gid_groups_conds::add_images_dir [file join $dir images]
}
-proc apps::loadAppFile {fileName} {
- uplevel 2 [list source $fileName]
+proc apps::ApplyAppPreferences {app} {
+ if {[write::isBooleanTrue [$app getPermission open_tree]]} {set spdAux::TreeVisibility 1} {set spdAux::TreeVisibility 0}
+ if {[$app getProperty dimensions] ne ""} { set ::Model::ValidSpatialDimensions [$app getProperty dimensions] }
}
+proc apps::loadAppFile {fileName} {uplevel #0 [list source $fileName]}
+
apps::Init
diff --git a/kratos.gid/scripts/Controllers/ApplicationMarketWindow.tcl b/kratos.gid/scripts/Controllers/ApplicationMarketWindow.tcl
index b7520e85b..04a4f4391 100644
--- a/kratos.gid/scripts/Controllers/ApplicationMarketWindow.tcl
+++ b/kratos.gid/scripts/Controllers/ApplicationMarketWindow.tcl
@@ -1,138 +1,135 @@
-proc spdAux::reactiveApp { } {
- #W "Reactive"
- variable initwind
- if { ![GidUtils::IsTkDisabled] } {
- if { [winfo exists $initwind] } {
- destroy $initwind
- }
- }
- set root [customlib::GetBaseRoot]
- set ::Model::SpatialDimension [[$root selectNodes "value\[@n='nDim'\]"] getAttribute v ]
- set appname [[$root selectNodes "hiddenfield\[@n='activeapp'\]"] @v ]
-
- apps::setActiveApp $appname
-}
-
-proc spdAux::deactiveApp { appid } {
-
- set root [customlib::GetBaseRoot]
- [$root selectNodes "hiddenfield\[@n='activeapp'\]"] setAttribute v ""
- foreach elem [$root getElementsByTagName "appLink"] {
- if {$appid eq [$elem getAttribute "appid"] && [$elem getAttribute "active"] eq "1"} {
- $elem setAttribute "active" 0
- break
- }
- }
-}
-proc spdAux::activeApp { appid } {
- #W "Active $appid"
- variable initwind
- catch {
- set root [customlib::GetBaseRoot]
- [$root selectNodes "hiddenfield\[@n='activeapp'\]"] setAttribute v $appid
- foreach elem [$root getElementsByTagName "appLink"] {
- if {$appid eq [$elem getAttribute "appid"] && [$elem getAttribute "active"] eq "0"} {
- $elem setAttribute "active" 1
- set must_open_init_window 0
- } else {
- $elem setAttribute "active" 0
- }
- }
- }
-
- set nd [$root selectNodes "value\[@n='nDim'\]"]
- if {[$nd getAttribute v] ne "wait"} {
- if {[$nd getAttribute v] ne "undefined"} {
- set ::Model::SpatialDimension [$nd getAttribute v]
- spdAux::SwitchDimAndCreateWindow $::Model::SpatialDimension
- spdAux::TryRefreshTree
- } {
- ::spdAux::CreateDimensionWindow
- }
- }
-}
-
-proc spdAux::SetActiveAppFromDOM { } {
- set activeapp_dom ""
- set root [customlib::GetBaseRoot]
- set activeapp_node [$root selectNodes "//hiddenfield\[@n='activeapp'\]"]
- if {$activeapp_node ne ""} {
- set activeapp_dom [get_domnode_attribute $activeapp_node v]
- if { $activeapp_dom != "" } {
- apps::setActiveApp $activeapp_dom
- }
- }
- return $activeapp_dom
+namespace eval ::spdAux {
+ variable info_main_window_text
+ variable application_window_id
+ set application_window_id .gid.win_app_selection
}
proc spdAux::CreateWindow {} {
variable initwind
variable must_open_init_window
+ variable application_window_id
+ # No graphics, no window
if { [GidUtils::IsTkDisabled] } {
return 0
}
+ # Sometimes we dont need the window (load event)
if {$must_open_init_window == 0} {return ""}
+ # If we have an active app, dont open this window
if {[apps::getActiveApp] ne ""} {return ""}
- gid_groups_conds::close_all_windows
+ # Window creation
+ set w $application_window_id
+ set initwind $w
+ # Close everything else
+ gid_groups_conds::close_all_windows
spdAux::DestroyInitWindow
- if {[winfo exist .gid.win_example]} {destroy .gid.win_example}
-
- set w .gid.win_example
+ if {[winfo exist $initwind]} {destroy $initwind}
toplevel $w
wm withdraw $w
-
set x [expr [winfo rootx .gid]+[winfo width .gid]/2-[winfo width $w]/2]
set y [expr [winfo rooty .gid]+[winfo height .gid]/2-[winfo height $w]/2]
-
wm geom $w +$x+$y
wm transient $w .gid
- InitWindow $w [_ "Kratos Multiphysics"] Kratos "" "" 1
- set initwind $w
+ InitWindow $w [_ "Kratos Multiphysics - Application market"] Kratos "" "" 1
+
ttk::frame $w.top
- ttk::label $w.top.title_text -text [_ " Application market"]
- ttk::frame $w.information -relief ridge
+ spdAux::RegisterWindow $initwind
- set appsid [::apps::getAllApplicationsID]
- set appspn [::apps::getAllApplicationsName]
+ # List of applications -> by family
+ ttk::labelframe $w.applications -text " Applications " -relief ridge
+
+ set appsid [::apps::getAllApplicationsID 0]
+ set appspn [::apps::getAllApplicationsName 0]
set col 0
set row 0
foreach appname $appspn appid $appsid {
if {[apps::isPublic $appid]} {
set img [::apps::getImgFrom $appid]
- ttk::button $w.information.img$appid -image $img -command [list apps::setActiveApp $appid]
- ttk::label $w.information.text$appid -text $appname
+ ttk::button $w.applications.img$appid -image $img -command [list apps::setActiveApp $appid]
+ ttk::label $w.applications.text$appid -text $appname
+
+ grid $w.applications.img$appid -column $col -row $row
+ grid $w.applications.text$appid -column $col -row [expr $row +1]
- grid $w.information.img$appid -column $col -row $row
- grid $w.information.text$appid -column $col -row [expr $row +1]
+ bind $w.applications.img$appid {::spdAux::PlaceInformationWindowByPath %W applications}
+
+ incr col
+ if {$col >= 5} {set col 0; incr row; incr row}
+ }
+ }
+
+ # List of tools
+ ttk::labelframe $w.tools -text " Tools " -relief ridge
+ set toolsid [::apps::getAllApplicationsID 2]
+ set toolspn [::apps::getAllApplicationsName 2]
+ set col 0
+ set row 0
+ foreach toolname $toolspn toolid $toolsid {
+ if {[apps::isPublic $toolid]} {
+ set img [::apps::getImgFrom $toolid]
+ set img_button $w.tools.img$toolid
+ ttk::button $img_button -image $img -command [list apps::setActiveApp $toolid]
+ ttk::label $w.tools.text$toolid -text $toolname
+ grid $img_button -column $col -row $row
+ grid $w.tools.text$toolid -column $col -row [expr $row +1]
+ bind $w.tools.img$toolid {::spdAux::PlaceInformationWindowByPath %W tools}
+
incr col
if {$col >= 5} {set col 0; incr row; incr row}
}
}
# More button
- if {$::Kratos::kratos_private(DevMode) eq "dev"} {
+ if {[Kratos::IsDeveloperMode]} {
set more_path [file nativename [file join $::Kratos::kratos_private(Path) images "more.png"] ]
set img [gid_themes::GetImage $more_path Kratos]
- ttk::button $w.information.img_more -image $img -command [list VisitWeb "https://github.com/KratosMultiphysics/GiDInterface"]
- ttk::label $w.information.text_more -text "More..."
-
- grid $w.information.img_more -column $col -row $row
- grid $w.information.text_more -column $col -row [expr $row +1]
+ ttk::button $w.tools.img_more -image $img -command [list VisitWeb "https://github.com/KratosMultiphysics/GiDInterface"]
+ ttk::label $w.tools.text_more -text "More..."
+
+ grid $w.tools.img_more -column $col -row $row
+ grid $w.tools.text_more -column $col -row [expr $row +1]
+ incr col
+ if {$col >= 5} {set col 0; incr row; incr row}
}
+
+ # Information panel
+ ttk::labelframe $w.info -text " Information " -relief ridge
+ ttk::label $w.info.text -textvariable spdAux::info_main_window_text
+ grid $w.info.text
+
+ # Settings
+ set settings_path [file nativename [file join $::Kratos::kratos_private(Path) images "settings.png"] ]
+ set img [gid_themes::GetImage $settings_path Kratos]
+ if {[GidUtils::VersionCmp "14.1.4d"] <0 } { set cmd [list ChangeVariables kratos_preferences] } {set cmd [list PreferencesWindow kratos_preferences]}
+ ttk::button $w.tools.img_preferences -image $img -command $cmd
+ ttk::label $w.tools.text_preferences -text "Preferences"
+ grid $w.tools.img_preferences -column $col -row $row
+ grid $w.tools.text_preferences -column $col -row [expr $row +1]
+ incr col
+ if {$col >= 5} {set col 0; incr row; incr row}
grid $w.top
- grid $w.top.title_text
+ # grid $w.top.title_text
- grid $w.information
+ grid $w.applications
+ grid $w.tools -columnspan 5 -sticky w
+ grid $w.info -columnspan 5 -sticky we
+}
+
+proc spdAux::PlaceInformationWindowByPath {win_path what} {
+ variable application_window_id
+ set app_id [string trimleft $win_path $application_window_id.$what.img]
+ set app [::apps::getAppById $app_id]
+ set description [$app getProperty description]
+ set ::spdAux::info_main_window_text $description
}
proc spdAux::DestroyInitWindow { } {
@@ -141,12 +138,11 @@ proc spdAux::DestroyInitWindow { } {
}
proc spdAux::CreateDimensionWindow { } {
- #package require anigif 1.3
- variable initwind
variable must_open_dim_window
if {$must_open_dim_window == 0} {return ""}
-
+
+ spdAux::DestroyWindows
set root [customlib::GetBaseRoot]
set nd [ [$root selectNodes "value\[@n='nDim'\]"] getAttribute v]
@@ -161,7 +157,7 @@ proc spdAux::CreateDimensionWindow { } {
}
set dir $::Kratos::kratos_private(Path)
- set initwind .gid.win_example
+ set initwind .gid.win_dimension
if { [ winfo exist $initwind]} {
destroy $initwind
}
@@ -178,6 +174,7 @@ proc spdAux::CreateDimensionWindow { } {
InitWindow $w [_ "Kratos Multiphysics"] Kratos "" "" 1
set initwind $w
+ spdAux::RegisterWindow $initwind
ttk::frame $w.top
ttk::label $w.top.title_text -text [_ " Dimension selection"]
@@ -212,9 +209,8 @@ proc spdAux::SetSpatialDimmension {ndim} {
proc spdAux::SwitchDimAndCreateWindow { ndim } {
variable TreeVisibility
-
SetSpatialDimmension $ndim
- spdAux::DestroyWindow
+ spdAux::DestroyWindows
processIncludes
parseRoutes
@@ -234,4 +230,71 @@ proc spdAux::SwitchDimAndCreateWindow { ndim } {
}
::Kratos::CreatePreprocessModelTBar
::Kratos::UpdateMenus
-}
\ No newline at end of file
+}
+
+proc spdAux::reactiveApp { } {
+ #W "Reactive"
+ variable initwind
+ if { ![GidUtils::IsTkDisabled] } {
+ if { [winfo exists $initwind] } {
+ destroy $initwind
+ }
+ }
+ set root [customlib::GetBaseRoot]
+ set ::Model::SpatialDimension [[$root selectNodes "value\[@n='nDim'\]"] getAttribute v ]
+ set appname [[$root selectNodes "hiddenfield\[@n='activeapp'\]"] @v ]
+
+ apps::setActiveApp $appname
+}
+
+proc spdAux::deactiveApp { appid } {
+
+ set root [customlib::GetBaseRoot]
+ [$root selectNodes "hiddenfield\[@n='activeapp'\]"] setAttribute v ""
+ foreach elem [$root getElementsByTagName "appLink"] {
+ if {$appid eq [$elem getAttribute "appid"] && [$elem getAttribute "active"] eq "1"} {
+ $elem setAttribute "active" 0
+ break
+ }
+ }
+}
+
+proc spdAux::activeApp { appid } {
+ #W "Active $appid"
+ catch {
+ set root [customlib::GetBaseRoot]
+ [$root selectNodes "hiddenfield\[@n='activeapp'\]"] setAttribute v $appid
+ foreach elem [$root getElementsByTagName "appLink"] {
+ if {$appid eq [$elem getAttribute "appid"] && [$elem getAttribute "active"] eq "0"} {
+ $elem setAttribute "active" 1
+ set must_open_init_window 0
+ } else {
+ $elem setAttribute "active" 0
+ }
+ }
+ }
+
+ set nd [$root selectNodes "value\[@n='nDim'\]"]
+ if {[$nd getAttribute v] ne "wait"} {
+ if {[$nd getAttribute v] ne "undefined"} {
+ set ::Model::SpatialDimension [$nd getAttribute v]
+ spdAux::SwitchDimAndCreateWindow $::Model::SpatialDimension
+ spdAux::TryRefreshTree
+ } {
+ ::spdAux::CreateDimensionWindow
+ }
+ }
+}
+
+proc spdAux::SetActiveAppFromDOM { } {
+ set activeapp_dom ""
+ set root [customlib::GetBaseRoot]
+ set activeapp_node [$root selectNodes "//hiddenfield\[@n='activeapp'\]"]
+ if {$activeapp_node ne ""} {
+ set activeapp_dom [get_domnode_attribute $activeapp_node v]
+ if { $activeapp_dom != "" } {
+ apps::setActiveApp $activeapp_dom
+ }
+ }
+ return $activeapp_dom
+}
diff --git a/kratos.gid/scripts/Controllers/CommonProcs.tcl b/kratos.gid/scripts/Controllers/CommonProcs.tcl
index 621d98fb0..8327ad9eb 100644
--- a/kratos.gid/scripts/Controllers/CommonProcs.tcl
+++ b/kratos.gid/scripts/Controllers/CommonProcs.tcl
@@ -79,10 +79,10 @@ proc spdAux::ProcGetElementsDict { domNode args } {
proc spdAux::ProcGetSolutionStrategies {domNode args} {
set names [list ]
set pnames [list ]
- #W $args
- set Sols [::Model::GetSolutionStrategies {*}$args]
- #W $Sols
- foreach ss $Sols {
+ # W $args
+ set sols [::Model::GetSolutionStrategies {*}$args]
+ # W $sols
+ foreach ss $sols {
lappend names [$ss getName]
lappend pnames [$ss getName]
lappend pnames [$ss getPublicName]
@@ -90,7 +90,7 @@ proc spdAux::ProcGetSolutionStrategies {domNode args} {
$domNode setAttribute values [join $names ","]
set dv [lindex $names 0]
- #W "dv $dv"
+ # W "dv $dv"
if {[$domNode getAttribute v] eq ""} {$domNode setAttribute v $dv; spdAux::RequestRefresh}
if {[$domNode getAttribute v] ni $names} {$domNode setAttribute v $dv; spdAux::RequestRefresh}
@@ -99,16 +99,11 @@ proc spdAux::ProcGetSolutionStrategies {domNode args} {
proc spdAux::ProcGetSchemes {domNode args} {
set nodeApp [GetAppIdFromNode $domNode]
- #W $nodeApp
+ # W $nodeApp
set sol_stratUN [apps::getAppUniqueName $nodeApp SolStrat]
- set sol_stat_path [spdAux::getRoute $sol_stratUN]
- #if {[get_domnode_attribute [$domNode selectNodes $sol_stat_path] v] eq ""} {
- #W "entra"
- get_domnode_attribute [$domNode selectNodes $sol_stat_path] dict
- get_domnode_attribute [$domNode selectNodes $sol_stat_path] values
- #}
- set solStratName [::write::getValue $sol_stratUN]
+ set solStratName [::write::getValue $sol_stratUN "" force]
+ if {$solStratName eq "" } {error "No solution strategy"}
#W "Unique name: $sol_stratUN - Nombre $solStratName"
set schemes [::Model::GetAvailableSchemes $solStratName {*}$args]
@@ -144,13 +139,16 @@ proc spdAux::SetNoneValue {domNode} {
proc spdAux::ProcGetConstitutiveLaws { domNode args } {
set Elementname [$domNode selectNodes {string(../value[@n='Element']/@v)}]
set Claws [::Model::GetAvailableConstitutiveLaws $Elementname]
- #W "Const Laws que han pasado la criba: $Claws"
+ #WV Elementname
+ #W "Const Laws que han pasado la criba: $Claws $args"
if {[llength $Claws] == 0} {
set names [list "None"]
} {
set names [list ]
foreach cl $Claws {
- lappend names [$cl getName]
+ if {[$cl cumple {*}$args]} {
+ lappend names [$cl getName]
+ }
}
}
set values [join $names ","]
@@ -399,9 +397,11 @@ proc spdAux::ProcPartParamState { domNode args } {
set resp [::Model::CheckElemParamState $domNode]
if {$resp eq "0"} {
set id [$domNode getAttribute n]
- set constLaw [get_domnode_attribute [[$domNode parent] selectNodes "./value\[@n='ConstitutiveLaw'\]"] v]
- if {$constLaw eq ""} {return hidden}
- set resp [Model::CheckConstLawParamState $constLaw $id]
+ set const_law ""
+ set const_law_node [[$domNode parent] selectNodes "./value\[@n='ConstitutiveLaw'\]"]
+ if {$const_law_node ne ""} {set const_law [get_domnode_attribute $const_law_node v]}
+ if {$const_law eq ""} {return hidden}
+ set resp [Model::CheckConstLawParamState $const_law $id]
}
#W "Calculando estado de [$domNode @pn] : $resp"
@@ -542,21 +542,13 @@ proc spdAux::ProcDirectorVectorNonZero { domNode args } {
proc spdAux::ProcShowInMode { domNode args } {
set kw [lindex $args 0]
if {$kw ni [list "Release" "Developer"]} {return "hidden"}
- if {$::Kratos::kratos_private(DevMode) eq "dev"} {
+ if {[Kratos::IsDeveloperMode]} {
if {$kw eq "Developer"} {return "normal"} {return "hidden"}
- }
- if {$::Kratos::kratos_private(DevMode) eq "release"} {
+ } else {
if {$kw eq "Developer"} {return "hidden"} {return "normal"}
}
}
-proc spdAux::ProcGetFilesValues { } {
- lappend listilla "- No file"
- lappend listilla {*}[FileSelector::GetAllFiles]
- lappend listilla "- Add new file"
- return [join $listilla ","]
-}
-
proc spdAux::ProcGetIntervals {domNode args} {
set lista [::spdAux::getIntervals]
if {$lista eq ""} {$domNode setAttribute state "hidden"; spdAux::RequestRefresh}
@@ -582,18 +574,84 @@ proc spdAux::PreChargeTree { } {
}
}
-proc spdAux::ProcGive_materials_list {domNode args} {
+
+proc spdAux::ProcEdit_database_list {domNode args} {
+ set root [customlib::GetBaseRoot]
+ set matname ""
+ set xnode "[$domNode @n]:"
+ # TODO: REMOVE THIS CHAPUZA
+ set baseframe ".gid.central.boundaryconds.gg.data.f0"
+ set things [winfo children $baseframe]
+ foreach thing $things {
+ if {[winfo class $thing] eq "TLabel"} {
+ set lab [$thing cget -text]
+ if {$lab eq $xnode} {
+ set id [string range [lindex [split $thing "."] end] 1 end]
+ set cbo ${baseframe}.e$id
+ set matname [$cbo get]
+ break
+ }
+ }
+ }
+ if {$matname ne ""} {
+ foreach thing $things {
+ set found 0
+ #set id ""
+ if {[winfo class $thing] eq "TPanedwindow"} {
+ #set id [string range [lindex [split $thing "."] end] 1 end]
+ set thing "${thing}.e"
+ }
+ if {[winfo class $thing] eq "TEntry"} {
+ #if {$id eq "" } {set id [string range [lindex [split $thing "."] end] 1 end]}
+ #set prop ${baseframe}.e$id
+ set varname [$thing cget -textvariable]
+ set propname [lindex [split [lindex [split [lindex [split $varname "::"] end] "("] end] ")"] 0]
+ #W $propname
+ set appid [spdAux::GetAppIdFromNode $domNode]
+ set mats_un [apps::getAppUniqueName $appid Materials]
+ set xp3 [spdAux::getRoute $mats_un]
+ append xp3 [format_xpath {/blockdata[@n="material" and @name=%s]/value} $matname]
+
+ foreach valueNode [$root selectNodes $xp3] {
+ if {$propname eq [$valueNode getAttribute n] } {
+ set val [$valueNode getAttribute v]
+ set $varname $val
+ #set found 1
+ break
+ }
+ }
+ #if {$found} {W "mat $matname value $val"}
+
+ }
+ }
+ }
+ return ""
+}
+
+proc spdAux::ProcCambioMat {domNode args} {
+ set matname [get_domnode_attribute $domNode v]
+ set exclusion [list "Element" "ConstitutiveLaw" "Material"]
+ set nodes [$domNode selectNodes "../value"]
+ foreach node $nodes {
+ if {[$node @n] ni $exclusion} {
+ #W "[$node @n] [CheckPartParamValue $node $matname]"
+ $node setAttribute v [spdAux::CheckPartParamValue $node $matname]
+ }
+ }
+ RequestRefresh
+}
+
+proc spdAux::ProcGetMaterialsList { domNode args } {
set optional {
{ -has_container container_name "" }
{ -icon icon_name material16 }
{ -types_icon types_icon_name ""}
{ -database database_name materials }
}
- #W $args
set compulsory ""
parse_args $optional $compulsory $args
set restList ""
-
+
proc database_append_list { parentNode database_name level container_name icon_name types_icon_name filters} {
set l ""
# We guess the keywords of the levels of the database
@@ -660,17 +718,22 @@ proc spdAux::ProcGive_materials_list {domNode args} {
}
return [list $primary_level $secondary_level]
}
- #W $database
+
set appid [spdAux::GetAppIdFromNode $domNode]
set mats_un [apps::getAppUniqueName $appid Materials]
set xp3 [spdAux::getRoute $mats_un]
+
+ # set xp3 [spdAux::getRoute $mats_un]
set parentNode [$domNode selectNodes $xp3]
- set const_law_name [get_domnode_attribute [$domNode selectNodes "../value\[@n = 'ConstitutiveLaw'\]"] v]
set filters [list ]
- if {$const_law_name != ""} {
- set const_law [Model::getConstitutiveLaw $const_law_name]
- if {$const_law != ""} {
- set filters [$const_law getMaterialFilters]
+ set const_law_node [$domNode selectNodes "../value\[@n = 'ConstitutiveLaw'\]"]
+ if {$const_law_node ne ""} {
+ set const_law_name [write::getValueByNode $const_law_node ]
+ if {$const_law_name != ""} {
+ set const_law [Model::getConstitutiveLaw $const_law_name]
+ if {$const_law != ""} {
+ set filters [$const_law getMaterialFilters]
+ }
}
}
#W [$parentNode asXML]
@@ -682,75 +745,68 @@ proc spdAux::ProcGive_materials_list {domNode args} {
set res_raw_list [list ]
foreach m $resList {lappend res_raw_list [lindex $m 1]}
- set v [get_domnode_attribute [$domNode selectNodes "../value\[@n = 'Material'\]"] v]
- if {$v ni $res_raw_list} {[$domNode selectNodes "../value\[@n = 'Material'\]"] setAttribute v $v}
- return [join $resList ","]
-}
-
-proc spdAux::ProcEdit_database_list {domNode args} {
- set root [customlib::GetBaseRoot]
- set matname ""
- set xnode "[$domNode @n]:"
- # TODO: REMOVE THIS CHAPUZA
- set baseframe ".gid.central.boundaryconds.gg.data.f0"
- set things [winfo children $baseframe]
- foreach thing $things {
- if {[winfo class $thing] eq "TLabel"} {
- set lab [$thing cget -text]
- if {$lab eq $xnode} {
- set id [string range [lindex [split $thing "."] end] 1 end]
- set cbo ${baseframe}.e$id
- set matname [$cbo get]
- break
- }
- }
- }
- if {$matname ne ""} {
- foreach thing $things {
- set found 0
- #set id ""
- if {[winfo class $thing] eq "TPanedwindow"} {
- #set id [string range [lindex [split $thing "."] end] 1 end]
- set thing "${thing}.e"
- }
- if {[winfo class $thing] eq "TEntry"} {
- #if {$id eq "" } {set id [string range [lindex [split $thing "."] end] 1 end]}
- #set prop ${baseframe}.e$id
- set varname [$thing cget -textvariable]
- set propname [lindex [split [lindex [split [lindex [split $varname "::"] end] "("] end] ")"] 0]
- #W $propname
- set appid [spdAux::GetAppIdFromNode $domNode]
- set mats_un [apps::getAppUniqueName $appid Materials]
- set xp3 [spdAux::getRoute $mats_un]
- append xp3 [format_xpath {/blockdata[@n="material" and @name=%s]/value} $matname]
-
- foreach valueNode [$root selectNodes $xp3] {
- if {$propname eq [$valueNode getAttribute n] } {
- set val [$valueNode getAttribute v]
- set $varname $val
- #set found 1
- break
- }
+ set v [get_domnode_attribute $domNode v]
+ if {$v ni $res_raw_list} {
+ $domNode setAttribute v [lindex $res_raw_list 0]
+ }
+ return [join $res_raw_list ","]
+
+}
+
+proc spdAux::ProcEditDatabaseList { domNode dict dict_units boundary_conds args } {
+ set part [$domNode parent]
+ set has_container ""
+ set database materials
+ set title [= "Material database"]
+ set list_name [$domNode @n]
+ set x_path {//container[@n="materials"]}
+ set dom_materials [$domNode selectNodes $x_path]
+ if { $dom_materials == "" } {
+ error [= "xpath '%s' not found in the spd file" $x_path]
+ }
+ set primary_level material
+ if { [dict exists $dict $list_name] } {
+ set xps $x_path
+ append xps [format_xpath {/blockdata[@n=%s and @name=%s]} $primary_level [dict get $dict $list_name]]
+ } else {
+ set xps ""
+ }
+ # Launches the window and gets the selected material in domNodes
+ set domNodes [gid_groups_conds::edit_tree_parts_window -accepted_n $primary_level -select_only_one 1 $boundary_conds $title $x_path $xps]
+
+ set ret_dict [dict create]
+ set ret_dict_units [dict create]
+ if {$domNodes ne ""} {
+ foreach k [dict keys $dict] {
+ set Selected_$k [dict get $dict $k]
+ set has_unit [dict exists $dict_units $k]
+ if {$has_unit} {set Selected_unit_$k [dict get $dict_units $k]}
+
+ if { [llength $domNodes] } {
+ set domNode [lindex $domNodes 0]
+ if { [$domNode @n] == $primary_level } {
+ dict set ret_dict $list_name [$domNode @name]
}
- #if {$found} {W "mat $matname value $val"}
-
+ set Selected_$k [$domNode selectNodes "value\[@n='$k'\]/@v"]
+ if {$has_unit} {set Selected_unit_$k [$domNode selectNodes "value\[@n='$k'\]/@units"]}
}
- }
- }
- return ""
-}
+
+ set name Selected_$k
+ if {$has_unit} {set name_unit Selected_unit_$k}
-proc spdAux::ProcCambioMat {domNode args} {
- set matname [get_domnode_attribute $domNode v]
- set exclusion [list "Element" "ConstitutiveLaw" "Material"]
- set nodes [$domNode selectNodes "../value"]
- foreach node $nodes {
- if {[$node @n] ni $exclusion} {
- #W "[$node @n] [CheckPartParamValue $node $matname]"
- $node setAttribute v [spdAux::CheckPartParamValue $node $matname]
+ set node [$part selectNodes "value\[@n='$k'\]"]
+ if {$node ne "" && [set $name] ne ""} {
+
+ #dict set ret_dict $k [set $name]
+ #if {$has_unit} {dict set ret_dict_units $k [set $name_unit]}
+ gid_groups_conds::setAttributes [gid_groups_conds::nice_xpath $node] {*}[set $name]
+ if {$has_unit} {gid_groups_conds::setAttributes [gid_groups_conds::nice_xpath $node] {*}[set $name_unit] }
+ dict set ret_dict $k [dict get [lindex [set $name] 0] v]
+ if {$has_unit} {dict set ret_dict_units $k [dict get [lindex [set $name_unit] 0] units]}
+ }
}
}
- RequestRefresh
+ return [list $ret_dict $ret_dict_units]
}
proc spdAux::ProcOkNewCondition {domNode args} {
@@ -816,7 +872,7 @@ proc spdAux::ProcConditionParameterState {domNode args} {
set parent_dependency_node [$domNode selectNodes "../value\[@n='$depN'\]"]
set current_parent_dep_state [$parent_dependency_node getAttribute cal_state ""]
if {$current_parent_dep_state eq ""} {
- set current_parent_dep_state [get_domnode_attribute $current_parent_dep_state state]
+ set current_parent_dep_state [get_domnode_attribute $parent_dependency_node state]
}
set realV [get_domnode_attribute $parent_dependency_node v]
if {$realV ni $depV || $current_parent_dep_state eq "hidden"} {set ret hidden}
diff --git a/kratos.gid/scripts/Controllers/Drawer.tcl b/kratos.gid/scripts/Controllers/Drawer.tcl
new file mode 100644
index 000000000..41165817a
--- /dev/null
+++ b/kratos.gid/scripts/Controllers/Drawer.tcl
@@ -0,0 +1,56 @@
+namespace eval ::Drawer {
+ Kratos::AddNamespace [namespace current]
+
+ variable registered_procs
+ variable vars
+}
+
+proc Drawer::Init { } {
+ variable registered_procs
+ set registered_procs [dict create]
+ variable vars
+ set vars [dict create ]
+ variable ids
+ set ids [dict create ]
+}
+
+proc Drawer::Register {name procedure varis} {
+ variable registered_procs
+ dict set registered_procs $name $procedure
+ variable vars
+ dict set vars $name $varis
+ variable ids
+ dict set ids $name [GiD_OpenGL register $procedure]
+}
+
+proc Drawer::Unregister {name} {
+ variable registered_procs
+ variable vars
+ variable ids
+ if {[dict exist $ids $name]} {
+ set id [dict get $ids $name]
+ GiD_OpenGL unregister $id
+ dict unset registered_procs $name
+ dict unset vars $name
+ dict unset ids $name
+ }
+}
+
+proc Drawer::UnregisterAll {} {
+ variable ids
+ foreach key [dict keys $ids] {
+ Unregister $key
+ }
+}
+
+proc Drawer::GetVars {name} {
+ variable vars
+ return [dict get $vars $name]
+}
+
+proc Drawer::IsRegistered {name} {
+ variable ids
+ return [dict exist $ids $name]
+}
+
+Drawer::Init
\ No newline at end of file
diff --git a/kratos.gid/scripts/Controllers/ExamplesWindow.tcl b/kratos.gid/scripts/Controllers/ExamplesWindow.tcl
new file mode 100644
index 000000000..dca8bd90c
--- /dev/null
+++ b/kratos.gid/scripts/Controllers/ExamplesWindow.tcl
@@ -0,0 +1,268 @@
+namespace eval ::Examples {
+ Kratos::AddNamespace [namespace current]
+
+ # Variable declaration
+ variable dir
+ variable doc
+ variable examples_window
+ variable filter_entry
+ variable groups_of_examples
+
+ variable _canvas_scroll
+ variable _canvas_scroll_w
+
+ variable info_main_window_text
+}
+
+proc Examples::Init { } {
+ # Variable initialization
+ variable dir
+ variable examples_window
+ set examples_window .gid.examples_window
+
+ set dir [apps::getMyDir "Examples"]
+
+ # Don't open the tree
+ set ::spdAux::TreeVisibility 0
+
+ LoadMyFiles
+
+ variable filter_entry
+ set filter_entry ""
+ variable groups_of_examples
+ set groups_of_examples [dict create]
+}
+
+proc Examples::LoadMyFiles { } {
+ variable dir
+ variable doc
+
+ # uplevel #0 [list source [file join $dir xml GetFromXML.tcl]]
+ set xmlfd [tDOM::xmlOpenFile [file join $dir xml examples.xml]]
+ set doc [dom parse -channel $xmlfd]
+ close $xmlfd
+ ResolveLinks
+}
+
+proc ::Examples::StartWindowEmpty {args} {
+ Examples::StartWindow
+}
+
+proc Examples::StartWindow { {filter ""} } {
+ variable examples_window
+ variable _canvas_scroll
+ variable _canvas_scroll_w
+
+ set ::spdAux::must_open_dim_window 0
+
+ if { [GidUtils::IsTkDisabled] } {
+ return 0
+ }
+
+ spdAux::DestroyInitWindow
+ Examples::DestroyExamplesWindow
+ toplevel $examples_window
+ wm withdraw $examples_window
+
+ set x [expr [winfo rootx .gid]+[winfo width .gid]/2-[winfo width $examples_window]/2]
+ set y [expr [winfo rooty .gid]+[winfo height .gid]/2-[winfo height $examples_window]/2]
+
+ wm geom $examples_window +$x+$y
+ wm transient $examples_window .gid
+
+ InitWindow $examples_window [_ "Kratos Multiphysics - Examples"] Kratos "" "" 1
+
+ spdAux::RegisterWindow $examples_window
+
+ set c_to_scroll [CreateScrolledCanvas $examples_window.center]
+ set fcenter [tk::frame $c_to_scroll.fcenter]
+ set _canvas_scroll $fcenter
+ set _canvas_scroll_w $examples_window.center
+ AddToScrolledCanvas $examples_window.center $fcenter
+ grid $examples_window.center -row 0 -column 0 -sticky nsew
+
+ 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]]
+ grid $filter_txt $filter_ent $filter_btn -sticky ew
+
+ # Information panel
+ ttk::labelframe $examples_window.info -text " Information " -relief ridge
+ ttk::label $examples_window.info.text -textvariable Examples::info_main_window_text
+ grid $examples_window.info.text
+ grid $examples_window.info -sticky ew
+
+ set groups [GetGroupsFromXML]
+
+ PrintGroups
+}
+
+proc Examples::getImgFrom {group_name example_logo} {
+ return [apps::getImgFrom $group_name $example_logo]
+}
+
+proc Examples::PrintGroups { } {
+ variable groups_of_examples
+ variable examples_window
+ variable _canvas_scroll
+ variable _canvas_scroll_w
+ variable filter_entry
+
+ set filter $filter_entry
+
+ foreach group_id [dict keys $groups_of_examples] {
+ set group [dict get $groups_of_examples $group_id]
+ set group_name [dict get $group name]
+
+ if {[winfo exists $_canvas_scroll.title_text$group_id]} {destroy $_canvas_scroll.title_text$group_id}
+ set parent [ttk::labelframe $_canvas_scroll.title_text$group_id -text $group_name]
+ set buttons_frame [ttk::frame $parent.buttonframe]
+ set col 0
+ set row 0
+ foreach example_id [dict keys [dict get $group examples]] {
+ set example [dict get $group examples $example_id]
+ if {[IsAproved $example $group_name $filter]} {
+ set inner_id "$group_id*$example_id"
+ set example_name [subst -nocommands -novariables [dict get $example name]]
+ set example_logo [dict get $example logo]
+ set example_dim [dict get $example dim]
+ set example_app [dict get $example app]
+ set example_cmd [dict get $example cmd]
+ set img [Examples::getImgFrom $example_app $example_logo]
+ ttk::button $buttons_frame.img~$inner_id -image $img -command [list Examples::LaunchExample $example_app $example_dim $example_cmd ]
+ ttk::label $buttons_frame.title$example_id -text $example_app -font {bold}
+ ttk::label $buttons_frame.text$example_id -text $example_name
+ grid $buttons_frame.img~$inner_id -column $col -row $row
+ grid $buttons_frame.title$example_id -column $col -row [expr $row +1]
+ grid $buttons_frame.text$example_id -column $col -row [expr $row +2]
+
+ bind $buttons_frame.img~$inner_id {::Examples::PlaceInformationWindowByPath %W}
+
+ incr col
+ if {$col >= 4} {set col 0; incr row; incr row; incr row}
+ }
+ }
+ if {$col > 0 || $row > 0 } {
+ grid $parent -sticky ew -columnspan 3
+ grid $buttons_frame
+ grid columnconfigure $parent 0 -weight 1
+ }
+ }
+
+ grid columnconfigure $examples_window 0 -weight 1
+ grid rowconfigure $examples_window 0 -weight 1
+ wm minsize $examples_window 700 500
+ update
+
+ ResizeScrolledCanvas $_canvas_scroll_w
+}
+
+proc Examples::PlaceInformationWindowByPath {win_path} {
+ variable examples_window
+ variable groups_of_examples
+ set inner_id [lindex [split $win_path "~"] end]
+ lassign [split $inner_id "*"] example_group example_id
+ set example [dict get $groups_of_examples $example_group examples $example_id]
+ if {$example ne ""} {
+ $examples_window.info configure -text "Information: [dict get $example name]"
+ set description [dict get $example description]
+ set ::Examples::info_main_window_text $description
+ }
+}
+
+proc Examples::getExampleById {example_id} {
+ variable groups_of_examples
+
+ foreach group_id [dict keys $groups_of_examples] {
+ set group [dict get $groups_of_examples $group_id]
+ foreach example [dict keys [dict get $group examples]] {
+ if {$example_id eq $example} {return [dict get $group examples $example]}
+ }
+ }
+}
+
+proc Examples::IsAproved {example group filter} {
+ # if empty, no filter, go
+ if {$filter eq ""} {return 1}
+ set filter [string tolower $filter]
+ # filter by app id
+ set app_name [string tolower [dict get $example app]]
+ if {[string first $filter $app_name] > -1} {return 2}
+ # filter by app name
+ set group [string tolower $group]
+ if {[string first $filter $group] > -1} {return 3}
+ # filter by example name
+ set example_name [string tolower [dict get $example name]]
+ if {[string first $filter $example_name] > -1} {return 4}
+
+ return 0
+}
+
+proc Examples::GetGroupsFromXML {} {
+ variable doc
+ variable groups_of_examples
+
+ set root [$doc documentElement]
+ set groups [$root getElementsByTagName "Group"]
+ foreach group $groups {
+ set group_id [$group @id]
+ if {[$group hasAttribute name]} {dict set groups_of_examples $group_id name [$group @name]}
+ set examples [$group getElementsByTagName "Example"]
+ foreach example $examples {
+ set example_id [$example @id]
+ dict set groups_of_examples $group_id examples $example_id name [subst -nocommands -novariables [$example @name]]
+ dict set groups_of_examples $group_id examples $example_id logo [$example @logo]
+ dict set groups_of_examples $group_id examples $example_id dim [$example @dim]
+ dict set groups_of_examples $group_id examples $example_id app [$example @app]
+ dict set groups_of_examples $group_id examples $example_id cmd [$example @cmd]
+ dict set groups_of_examples $group_id examples $example_id description [[$example getElementsByTagName "Description"] text]
+ }
+ }
+}
+
+proc Examples::LaunchExample {example_app example_dim example_cmd} {
+ if {![Kratos::IsModelEmpty]} {
+ set txt "We are going to draw the example geometry. You should save your work first.\nDo you want to lose your unsaved work?"
+ set retval [tk_messageBox -default ok -icon question -message $txt -type okcancel]
+ if { $retval == "cancel" } { return }
+ }
+ Examples::DestroyExamplesWindow
+ Kratos::ResetModel
+ Model::DestroyEverything
+ set ::problemtype_current(CustomLibAutomatic) 1
+ gid_common_problemtype_init_customlib_automatic $Kratos::kratos_private(Path)
+ set ::problemtype_current(CustomLibAutomatic) 0
+ spdAux::SetSpatialDimmension $example_dim
+ apps::setActiveApp $example_app
+ $example_cmd
+ spdAux::OpenTree
+}
+
+proc Examples::DestroyExamplesWindow {} {
+
+ variable examples_window
+ if { ![GidUtils::IsTkDisabled] } {
+ if {[winfo exists $examples_window]} {destroy $examples_window}
+ }
+}
+
+proc Examples::ResolveLinks { } {
+ variable doc
+
+ set examples_node [$doc selectNodes "/examples"]
+ foreach link [$examples_node getElementsByTagName link] {
+ catch {
+ set xmlfd [tDOM::xmlOpenFile [file join $::Kratos::kratos_private(Path) [$link @path]]]
+ set nodes [[dom parse -channel $xmlfd] getElementsByTagName Group]
+ close $xmlfd
+ foreach node $nodes {
+ $examples_node insertBefore $node $link
+ }
+ $link delete
+ }
+ }
+
+}
+
+Examples::Init
diff --git a/kratos.gid/scripts/Controllers/ImportFiles.tcl b/kratos.gid/scripts/Controllers/ImportFiles.tcl
new file mode 100644
index 000000000..cd97fbf59
--- /dev/null
+++ b/kratos.gid/scripts/Controllers/ImportFiles.tcl
@@ -0,0 +1,74 @@
+
+# Handle file input
+proc ::spdAux::LaunchFileWindow { } {
+ if {[GiD_Info Project Modelname] eq "UNNAMED"} {
+ MessageBoxOk [_ "Model error"] [_ "Save your model first"] error
+ return
+ }
+ set FileSelector::callback_after_new_file "::spdAux::SaveModelFile"
+ set FileSelector::callback_view_file "::spdAux::ViewFile"
+ set FileSelector::callback_delete_file "::spdAux::DeleteFile"
+ FileSelector::InitFileHandler
+}
+
+proc ::spdAux::ViewFile {file_id} {
+ exec {*}[auto_execok start] "" [file join [file nativename [GiD_Info Project ModelName].gid] $file_id]
+}
+
+proc ::spdAux::LoadModelFiles { {root "" }} {
+ if {$root eq ""} {
+ set root [customlib::GetBaseRoot]
+ customlib::UpdateDocument
+ }
+ set files [$root getElementsByTagName "file"]
+ if {[llength $files] > 0} {
+ Kratos::LoadImportFiles
+ foreach elem $files {
+ FileSelector::AddFile [$elem @n]
+ }
+ }
+}
+
+proc ::spdAux::SaveModelFile { fileid } {
+ customlib::UpdateDocument
+ FileSelector::AddFile $fileid
+ gid_groups_conds::addF {container[@n='files']} file [list n ${fileid}]
+ customlib::UpdateDocument
+ FileSelector::CopyFilesIntoModel [file nativename [GiD_Info Project ModelName] ].gid
+}
+
+proc ::spdAux::ProcGetFilesValues { domNode } {
+ Kratos::LoadImportFiles
+ customlib::UpdateDocument
+ spdAux::LoadModelFiles
+ lappend listilla $::spdAux::no_file_string
+ lappend listilla {*}[FileSelector::GetAllFiles]
+ if {[get_domnode_attribute $domNode v] ni $listilla} {$domNode setAttribute v [lindex $listilla 0]}
+ return [join $listilla ","]
+}
+
+proc ::spdAux::DeleteFile { fileid } {
+ customlib::UpdateDocument
+
+ set used_nodes [[customlib::GetBaseRoot] selectNodes "//value\[@type = 'file' and @v = '$fileid'\]"]
+ foreach used_node $used_nodes {
+ W "Warning: Deleted file $fileid was used in [[$used_node parent] @pn] > [$used_node @pn]"
+ }
+
+ set file_node [[customlib::GetBaseRoot] selectNodes "//file\[@n = '$fileid'\]"]
+ if {$file_node ne ""} {$file_node delete}
+ RequestRefresh
+}
+
+proc ::spdAux::UpdateFileField { fileid domNode} {
+ if {$fileid ne ""} {
+ $domNode setAttribute v $fileid
+ spdAux::SaveModelFile $fileid
+ RequestRefresh
+ }
+}
+
+namespace eval ::spdAux {
+ variable no_file_string
+ set no_file_string "- No file - (add files using File handler toolbar)"
+}
\ No newline at end of file
diff --git a/kratos.gid/scripts/Controllers/Preferences.xml b/kratos.gid/scripts/Controllers/Preferences.xml
index c269f223f..0a22c7cf0 100644
--- a/kratos.gid/scripts/Controllers/Preferences.xml
+++ b/kratos.gid/scripts/Controllers/Preferences.xml
@@ -8,11 +8,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/kratos.gid/scripts/Controllers/PreferencesWindow.tcl b/kratos.gid/scripts/Controllers/PreferencesWindow.tcl
index 5971f9f23..25a2436aa 100644
--- a/kratos.gid/scripts/Controllers/PreferencesWindow.tcl
+++ b/kratos.gid/scripts/Controllers/PreferencesWindow.tcl
@@ -11,6 +11,8 @@ proc Kratos::ManagePreferences { cmd name {value ""}} {
}
"SetValue" {
set ::Kratos::kratos_private($name) $value
+ if {$name eq "allow_logs"} {Kratos::InitLog}
+ if {$name eq "launch_configuration"} {Kratos::CheckDependencies}
}
"GetDefaultValue" {
# same as GetValue
@@ -21,13 +23,22 @@ proc Kratos::ManagePreferences { cmd name {value ""}} {
"echo_level" {
set ret 0
}
+ "allow_logs" {
+ set ret 1
+ }
"mdpa_format" {
set ret 1
}
+ "debug_folder" {
+ set ret ""
+ }
+ "launch_configuration" {
+ set ret "local"
+ }
}
}
}
-
+
Kratos::RegisterEnvironment
spdAux::RequestRefresh
return $ret
@@ -37,12 +48,11 @@ proc Kratos::ModifyPreferencesWindow { root } {
variable kratos_private
if {[info exists kratos_private(Path)]} {
- set findnode [$root find "name" "general"]
-
+ set findnode [$root find "name" "general"]
if { $findnode != "" } {
set xml_preferences_filename [file join $kratos_private(Path) scripts Controllers Preferences.xml]
- set xml_data [GidUtils::ReadFile $xml_preferences_filename]
- CreateWidgetsFromXml::AddAfterName $root "general" $xml_data
+ set xml_data [GidUtils::ReadFile $xml_preferences_filename]
+ CreateWidgetsFromXml::AddAfterName $root "general" $xml_data
CreateWidgetsFromXml::UpdatePreferencesWindow
}
}
@@ -50,15 +60,15 @@ proc Kratos::ModifyPreferencesWindow { root } {
}
proc Kratos::ModifyPreferencesWindowOld { } {
- set root [CreateWidgetsFromXml::GetPreferencesXml]
+ set root [CreateWidgetsFromXml::GetPreferencesXml]
variable kratos_private
if {[info exists kratos_private(Path)]} {
- set findnode [$root find "name" "general"]
+ set findnode [$root find "name" "general"]
if { $findnode != "" } {
set xml_preferences_filename [file join $kratos_private(Path) scripts Controllers Preferences.xml]
- set xml_data [GidUtils::ReadFile $xml_preferences_filename]
- CreateWidgetsFromXml::AddAfterName $root "general" $xml_data
+ set xml_data [GidUtils::ReadFile $xml_preferences_filename]
+ CreateWidgetsFromXml::AddAfterName $root "general" $xml_data
CreateWidgetsFromXml::UpdatePreferencesWindow
}
}
diff --git a/kratos.gid/scripts/Controllers/TreeInjections.tcl b/kratos.gid/scripts/Controllers/TreeInjections.tcl
index 0ac940bb2..3313a2085 100644
--- a/kratos.gid/scripts/Controllers/TreeInjections.tcl
+++ b/kratos.gid/scripts/Controllers/TreeInjections.tcl
@@ -22,7 +22,7 @@ proc spdAux::SetValueOnTreeItem { field value unique_name {it "" } } {
proc spdAux::SetValuesOnBasePath {base_path prop_value_pairs} {
return [spdAux::SetValuesOnBaseNode [[customlib::GetBaseRoot] selectNodes $base_path] $prop_value_pairs]
-}
+}
proc spdAux::SetValuesOnBaseNode {base_path prop_value_pairs} {
if {$base_path eq ""} {error "Empty $base_path"}
@@ -30,6 +30,7 @@ proc spdAux::SetValuesOnBaseNode {base_path prop_value_pairs} {
set propnode [$base_path selectNodes "./value\[@n = '$prop'\]"]
if {$propnode ne "" } {
$propnode setAttribute v $val
+ catch {get_domnode_attribute $propnode dict}
} else {
W "Warning - Couldn't find property $prop"
}
@@ -192,8 +193,8 @@ proc spdAux::injectConditions { basenode args} {
proc spdAux::_injectCondsToTree {basenode cond_list {cond_type "normal"} args } {
set conds [$basenode parent]
- set AppUsesIntervals [apps::ExecuteOnApp [GetAppIdFromNode $conds] GetAttribute UseIntervals]
- if {$AppUsesIntervals eq ""} {set AppUsesIntervals 0}
+ set app_uses_intervals [[apps::getAppById [GetAppIdFromNode $conds]] getPermission "intervals"]
+ if {$app_uses_intervals eq ""} {set app_uses_intervals 0}
set initial_conds_flag 0
if {$args ne "{}" && $args ne ""} {
if {[dict exists {*}$args can_be_initial]} {
@@ -233,7 +234,11 @@ proc spdAux::_injectCondsToTree {basenode cond_list {cond_type "normal"} args }
set state [$cnd getAttribute state]
if {$state eq ""} {set state "CheckNodalConditionState"}
}
- set node ""
+ set allow_group_creation ""
+ if {[$cnd getAttribute Groups] ne ""} {
+ set allow_group_creation "allow_group_creation='0' groups_list='\[[$cnd getAttribute Groups]\]'"
+ }
+ set node ""
set symbol_data [$cnd getSymbol]
if { [llength $symbol_data] } {
set txt " "
}
if { $vector_type eq "file" || $vector_type eq "tablefile" } {
- if {[set $v] eq ""} {set $v "- No file"}
+ if {[set $v] eq ""} {set $v $::spdAux::no_file_string}
append node ""
} else {
append node ""
@@ -373,9 +377,37 @@ proc spdAux::GetParameterValueString { param {forcedParams ""} {base ""}} {
}
}
+ }
+ "matrix" {
+ set rows [$param getAttribute "rows"]
+ set cols [$param getAttribute "cols"]
+ set components ""
+ for {set i 0} {$i < [expr max($rows,$cols)]} {incr i} {lappend components $i}; set components [join $components ","]
+ #append node ""
+ set value [split $v ","]
+ append node ""
+ append node " "
+ append node " "
+ for {set i 0} {$i < $rows} {incr i} {
+ for {set j 0} {$j < $cols} {incr j} {
+ set vi [lindex $value [expr ($i*$cols)+$j] ]
+ append node " "
+ }
+ }
+ append node " "
+ append node " "
+ append node ""
+
}
"combo" {
- append node [_GetComboParameterString $param $inName $pn $v $state $help $show_in_window $base]
+ if {[$param getAttribute "combotype"] eq "material"} {
+ append node ""
+ } elseif {[$param getAttribute "combotype"] eq "constitutive_law"} {
+ append node [_GetComboParameterString $param $inName $pn $v $state $help $show_in_window $base]
+ append node ""
+ } else {
+ append node [_GetComboParameterString $param $inName $pn $v $state $help $show_in_window $base]
+ }
}
"bool" {
append node [_GetBooleanParameterString $param $inName $pn $v $state $help $show_in_window $base]
@@ -433,7 +465,7 @@ proc spdAux::_GetBooleanParameterString {param inName pn v state help show_in_wi
append node " actualize_tree='1' "
}
append node " state='$state' show_in_window='$show_in_window'>"
- # if {$base ne ""} {append node [_insert_cond_param_dependencies $base $inName]}
+ if {$base ne ""} {append node [_insert_cond_param_dependencies $base $inName]}
append node ""
return $node
}
@@ -442,17 +474,21 @@ proc spdAux::_GetComboParameterString {param inName pn v state help show_in_wind
set node ""
set values [$param getValues]
- set pvalues [spdAux::_StringifyPValues $values [$param getPValues]]
+ if {[string range [$param getPValues] 0 1] ne "\{\["} {
+ set pvalues [spdAux::_StringifyPValues $values [$param getPValues]]
+ } {
+ set pvalues [lindex [$param getPValues] 0]
+ }
set values [join [$param getValues] ","]
append node ""
- # if {$base ne ""} { append node [_insert_cond_param_dependencies $base $inName] }
+ if {$base ne ""} { append node [_insert_cond_param_dependencies $base $inName] }
append node ""
return $node
}
@@ -475,6 +511,7 @@ proc spdAux::_insert_cond_param_dependencies {base param_name} {
}
}
set ret ""
+
foreach {name values} $dep_list {
set ins ""
set out ""
@@ -494,9 +531,10 @@ proc spdAux::_insert_cond_param_dependencies {base param_name} {
}
return $ret
}
+
proc spdAux::injectPartInputs { basenode {inputs ""} } {
set base [$basenode parent]
- set processeds [list ]
+ set processeds [spdAux::getFromXQueryValue [$base selectNodes "./value/@n"]]
spdAux::injectLocalAxesButton $basenode
foreach obj [concat [Model::GetElements] [Model::GetConstitutiveLaws]] {
set inputs [$obj getInputs]
@@ -517,6 +555,52 @@ proc spdAux::injectPartInputs { basenode {inputs ""} } {
}
$basenode delete
}
+proc spdAux::injectConstitutiveLawsInputs { basenode {inputs ""} } {
+ set base [$basenode parent]
+ set processeds [spdAux::getFromXQueryValue [$base selectNodes "./value/@n"]]
+ spdAux::injectLocalAxesButton $basenode
+ foreach obj [Model::GetConstitutiveLaws] {
+ set inputs [$obj getInputs]
+ foreach {inName in} $inputs {
+ if {$inName ni $processeds} {
+ lappend processeds $inName
+ set forcedParams [list state {[PartParamState]} ]
+ if {[$in getActualize]} { lappend forcedParams base $obj }
+ set node [GetParameterValueString $in $forcedParams $obj]
+
+ $base appendXML $node
+ set orig [$base lastChild]
+ set new [$orig cloneNode -deep]
+ $orig delete
+ $base insertBefore $new $basenode
+ }
+ }
+ }
+ $basenode delete
+}
+proc spdAux::injectPartElementInputs { basenode {inputs ""} } {
+ set base [$basenode parent]
+ set processeds [spdAux::getFromXQueryValue [$base selectNodes "./value/@n"]]
+ spdAux::injectLocalAxesButton $basenode
+ foreach obj [Model::GetElements] {
+ set inputs [$obj getInputs]
+ foreach {inName in} $inputs {
+ if {$inName ni $processeds} {
+ lappend processeds $inName
+ set forcedParams [list state {[PartParamState]} ]
+ if {[$in getActualize]} { lappend forcedParams base $obj }
+ set node [spdAux::GetParameterValueString $in $forcedParams $obj]
+
+ $base appendXML $node
+ set orig [$base lastChild]
+ set new [$orig cloneNode -deep]
+ $orig delete
+ $base insertBefore $new $basenode
+ }
+ }
+ }
+ $basenode delete
+}
proc spdAux::injectMaterials { basenode args } {
set base [$basenode parent]
@@ -524,8 +608,10 @@ proc spdAux::injectMaterials { basenode args } {
foreach mat $materials {
set matname [$mat getName]
set mathelp [$mat getAttribute help]
+ set icon [$mat getAttribute icon]
+ if {$icon eq ""} {set icon material16}
set inputs [$mat getInputs]
- set matnode ""
+ set matnode ""
foreach {inName in} $inputs {
set node [spdAux::GetParameterValueString $in [list base $mat state [$in getAttribute state]] $mat]
append matnode $node
@@ -536,6 +622,14 @@ proc spdAux::injectMaterials { basenode args } {
$basenode delete
}
+proc spdAux::getFromXQueryValue {obj} {
+ set ret [list ]
+ foreach pair $obj {
+ lappend ret [lindex $pair end]
+ }
+ return $ret
+}
+
proc spdAux::injectLocalAxesButton { basenode } {
# set base [$basenode parent]
# set node "
@@ -662,8 +756,9 @@ proc spdAux::CheckConstLawOutputState {outnode} {
set parts_un [apps::getAppUniqueName $nodeApp Parts]
set parts_path [getRoute $parts_un]
set xp1 "$parts_path/group/value\[@n='ConstitutiveLaw'\]"
+ set xp2 "$parts_path/condition/group/value\[@n='Element'\]"
set constlawactive [list ]
- foreach gNode [$root selectNodes $xp1] {
+ foreach gNode [concat [$root selectNodes $xp1] [$root selectNodes $xp2]] {
lappend constlawactive [get_domnode_attribute $gNode v]
}
@@ -682,7 +777,8 @@ proc spdAux::CheckElementOutputState {outnode {parts_uns ""}} {
foreach parts_un $parts_uns {
set parts_path [getRoute $parts_un]
set xp1 "$parts_path/group/value\[@n='Element'\]"
- foreach gNode [$root selectNodes $xp1] {
+ set xp2 "$parts_path/condition/group/value\[@n='Element'\]"
+ foreach gNode [concat [$root selectNodes $xp1] [$root selectNodes $xp2]] {
lappend elemsactive [get_domnode_attribute $gNode v]
}
}
@@ -699,7 +795,8 @@ proc spdAux::CheckAnyPartState {domNode {parts_uns ""}} {
foreach parts_un $parts_uns {
set parts_path [spdAux::getRoute $parts_un]
if {$parts_path ne ""} {
- lappend parts {*}[$domNode selectNodes "$parts_path/group"]
+ set parts_base [[customlib::GetBaseRoot] selectNodes $parts_path]
+ lappend parts {*}[$parts_base getElementsByTagName group]
}
}
if {[llength $parts] > 0} {return true} {return false}
@@ -842,7 +939,7 @@ proc spdAux::ClearCutPlanes { {cut_planes_un CutPlanes} } {
if {$first != true} {
$plane delete
} {set first false}
-
+
}
}
@@ -865,26 +962,25 @@ proc spdAux::injectPartsByElementType {domNode args} {
#if {[lsearch $ov point] != -1 && [lsearch $ov Point] != -1 } {set ovm "node,element"}
set condition_string "
-
+
-
+
-
-
-
+
+
"
+
$base appendXML $condition_string
set orig [$base lastChild]
set new [$orig cloneNode -deep]
$orig delete
$base insertBefore $new $domNode
}
-
+
$domNode delete
customlib::UpdateDocument
spdAux::processDynamicNodes $base
diff --git a/kratos.gid/scripts/Deprecated.tcl b/kratos.gid/scripts/Deprecated.tcl
index 802cb7bfe..30d1f5977 100644
--- a/kratos.gid/scripts/Deprecated.tcl
+++ b/kratos.gid/scripts/Deprecated.tcl
@@ -9,7 +9,7 @@
# Deprecation date: 9/03/2018
# Estimated deletion version: 5.3.0
proc write::getMeshId {cid group} {
- if {$::Kratos::kratos_private(DevMode) eq "dev"} {
+ if {[Kratos::IsDeveloperMode]} {
W "Deprecated method write::getMeshId\nUse write::getSubModelPartId\n"
}
write::getSubModelPartId $cid $group
@@ -18,7 +18,7 @@ proc write::getMeshId {cid group} {
# Deprecation date: 9/03/2018
# Estimated deletion version: 5.3.0
proc write::writeGroupMesh { cid group {what "Elements"} {iniend ""} {tableid_list ""} } {
- if {$::Kratos::kratos_private(DevMode) eq "dev"} {
+ if {[Kratos::IsDeveloperMode]} {
W "Deprecated method write::writeGroupMesh\nUse write::writeGroupSubModelPart\n"
}
write::writeGroupSubModelPart $cid $group $what $iniend $tableid_list
@@ -27,7 +27,7 @@ proc write::writeGroupMesh { cid group {what "Elements"} {iniend ""} {tableid_li
# Deprecation date: 9/03/2018
# Estimated deletion version: 5.3.0
proc write::writePartMeshes { } {
- if {$::Kratos::kratos_private(DevMode) eq "dev"} {
+ if {[Kratos::IsDeveloperMode]} {
W "Deprecated method write::writePartMeshes\nUse write::writePartSubModelPart\n"
}
write::writePartSubModelPart
@@ -36,7 +36,7 @@ proc write::writePartMeshes { } {
# Deprecation date: 9/03/2018
# Estimated deletion version: 5.3.0
proc write::GetMeshFromCondition { base_UN condition_id } {
- if {$::Kratos::kratos_private(DevMode) eq "dev"} {
+ if {[Kratos::IsDeveloperMode]} {
W "Deprecated method write::GetMeshFromCondition\nUse write::GetSubModelPartFromCondition\n"
}
write::GetSubModelPartFromCondition $base_UN $condition_id
@@ -45,7 +45,7 @@ proc write::GetMeshFromCondition { base_UN condition_id } {
# Deprecation date: 9/03/2018
# Estimated deletion version: 5.3.0
proc write::getPartsMeshId {} {
- if {$::Kratos::kratos_private(DevMode) eq "dev"} {
+ if {[Kratos::IsDeveloperMode]} {
W "Deprecated method write::getPartsMeshId\nUse write::getPartsSubModelPartId\n"
}
write::getPartsSubModelPartId
@@ -54,7 +54,7 @@ proc write::getPartsMeshId {} {
# Deprecation date: 13/03/2018
# Estimated deletion version: 5.3.0
proc spdAux::AddConditionGroupOnXPath {xpath groupid} {
- if {$::Kratos::kratos_private(DevMode) eq "dev"} {
+ if {[Kratos::IsDeveloperMode]} {
W "Deprecated method spdAux::AddConditionGroupOnXPath\nUse customlib::AddConditionGroupOnXPath\n"
}
return [customlib::AddConditionGroupOnXPath $xpath $groupid]
@@ -63,7 +63,7 @@ proc spdAux::AddConditionGroupOnXPath {xpath groupid} {
# Deprecation date: 13/03/2018
# Estimated deletion version: 5.3.0
proc spdAux::AddConditionGroupOnNode {basenode groupid} {
- if {$::Kratos::kratos_private(DevMode) eq "dev"} {
+ if {[Kratos::IsDeveloperMode]} {
W "Deprecated method spdAux::AddConditionGroupOnNode\nUse customlib::AddConditionGroupOnNode\n"
}
return [customlib::AddConditionGroupOnNode $basenode $groupid]
@@ -72,7 +72,7 @@ proc spdAux::AddConditionGroupOnNode {basenode groupid} {
# Deprecation date: 24/04/2018
# Estimated deletion version: 6.0.0
# proc spdAux::MergeGroups {basenode groupid} {
-# if {$::Kratos::kratos_private(DevMode) eq "dev"} {
+# if {[Kratos::IsDeveloperMode]} {
# #W "Deprecated method spdAux::MergeGroups\nUse GidUtils::MergeGroups\n"
# }
# return [GidUtils::MergeGroups $basenode $groupid]
@@ -102,4 +102,5 @@ if {[GidUtils::VersionCmp "14.1.4d"] <0} {
}
}
}
-}
\ No newline at end of file
+}
+
diff --git a/kratos.gid/scripts/Launch.tcl b/kratos.gid/scripts/Launch.tcl
new file mode 100644
index 000000000..e40fa33a1
--- /dev/null
+++ b/kratos.gid/scripts/Launch.tcl
@@ -0,0 +1,206 @@
+
+proc Kratos::InstallAllPythonDependencies { } {
+ package require gid_cross_platform
+
+ if { $::tcl_platform(platform) == "windows" } { set os win } {set os unix}
+ set dir [lindex [Kratos::GetLaunchConfigurationFile] 0]
+ if {$os eq "win"} {set py "python"} {set py "python3"}
+ # Check if python is installed. minimum 3.5, best 3.9
+ set python_version [pythonVersion $py]
+ if { $python_version <= 0 || [GidUtils::TwoVersionsCmp $python_version "3.9.0"] <0 } {
+ ::GidUtils::SetWarnLine "Installing python"
+ if {$os eq "win"} {
+ gid_cross_platform::run_as_administrator [file join $::Kratos::kratos_private(Path) exec install_python_and_dependencies.win.bat ] $dir
+ } {
+ gid_cross_platform::run_as_administrator [file join $::Kratos::kratos_private(Path) exec install_python_and_dependencies.unix.sh ]
+ }
+ }
+
+ if {$os ne "win"} {
+ ::GidUtils::SetWarnLine "Installing python dependencies"
+ gid_cross_platform::run_as_administrator [file join $::Kratos::kratos_private(Path) exec install_python_and_dependencies.unix.sh ]
+ }
+
+ if {$os eq "win"} {set pip "pyw"} {set pip "python3"}
+ set missing_packages [Kratos::GetMissingPipPackages]
+ ::GidUtils::SetWarnLine "Installing pip packages $missing_packages"
+ 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
+ ::GidUtils::SetWarnLine "Packages updated"
+}
+
+proc Kratos::InstallPip { } {
+ W ""
+}
+
+proc Kratos::pythonVersion {{pythonExecutable "python"}} {
+ # Tricky point: Python 2.7 writes version info to stderr!
+ set ver 0
+ catch {
+ set info [exec $pythonExecutable --version 2>@1]
+ if {[regexp {^Python ([\d.]+)$} $info --> version]} {
+ set ver $version
+ }
+ }
+ return $ver
+}
+
+proc Kratos::pipVersion { } {
+
+ if { $::tcl_platform(platform) == "windows" } { set os win } {set os unix}
+ if {$os eq "win"} {set pip "pyw"} {set pip "python3"}
+ set ver 0
+ catch {
+ set info [exec $pip -m pip --version 2>@1]
+ if {[regexp {^pip ([\d.]+)*} $info --> version]} {
+ set ver $version
+ }
+ }
+ return $ver
+}
+
+proc Kratos::GetMissingPipPackages { } {
+ variable pip_packages_required
+ set missing_packages [list ]
+
+
+ if { $::tcl_platform(platform) == "windows" } { set os win } {set os unix}
+ if {$os eq "win"} {set pip "pyw"} {set pip "python3"}
+ set pip_packages_installed [list ]
+ set pip_packages_installed_raw [exec $pip -m pip list --format=freeze --disable-pip-version-check 2>@1]
+ foreach package $pip_packages_installed_raw {
+ lappend pip_packages_installed [lindex [split $package "=="] 0]
+ }
+ foreach required_package $pip_packages_required {
+ set required_package_name [lindex [split $required_package "=="] 0]
+ if {$required_package_name ni $pip_packages_installed} {lappend missing_packages $required_package}
+ }
+ return $missing_packages
+}
+
+
+proc Kratos::CheckDependencies { } {
+ set curr_mode [Kratos::GetLaunchMode]
+ # W $curr_mode
+ if {[dict exists $curr_mode dependency_check]} {
+ set deps [dict get $curr_mode dependency_check]
+ $deps
+ }
+}
+
+proc Kratos::CheckDependenciesPipMode {} {
+ if { [GidUtils::IsTkDisabled] } {
+ return 0
+ }
+ if { $::tcl_platform(platform) == "windows" } { set os win } {set os unix}
+ if {$os eq "win"} {set py "python"} {set py "python3"}
+ set py_version [Kratos::pythonVersion $py]
+ if {$py_version <= 0} {
+ set msgBox_type yesno
+ # -do_not_ask_again 1 -do_not_ask_again_key "kratos_install_python"
+ set reply [tk_messageBox -icon warning -type $msgBox_type -parent .gid \
+ -message "Python 3 not installed on this system. Do you want Kratos to install it?" \
+ -title [_ "Missing python"]]
+ if {[string equal $reply "yes"]} {
+ Kratos::InstallAllPythonDependencies
+ }
+ if {[string equal $reply "cancel"]} {
+
+ }
+ }
+ set pip_version [Kratos::pipVersion]
+ if {$pip_version <= 0} {
+ WarnWin "pip is not installed on your system. Please install it."
+ } else {
+ set missing_packages [Kratos::GetMissingPipPackages]
+ if {[llength $missing_packages] > 0} {
+ set msgBox_type yesno
+ # -do_not_ask_again 1 -do_not_ask_again_key "kratos_install_python"
+ set reply [tk_messageBox -icon warning -type $msgBox_type -parent .gid \
+ -message "Python $py_version is installed, but there are some missing packages. Do you want Kratos to install them? \n\nPackages to be installed: \n$missing_packages" \
+ -title [_ "Missing python packages"]]
+ if {[string equal $reply "yes"]} {
+ Kratos::InstallAllPythonDependencies
+ }
+ if {[string equal $reply "cancel"]} {
+
+ }
+ }
+ }
+}
+proc Kratos::CheckDependenciesLocalPipMode {} {
+
+}
+proc Kratos::CheckDependenciesLocalMode {} {
+
+}
+proc Kratos::CheckDependenciesDockerMode {} {
+
+}
+
+proc Kratos::GetLaunchConfigurationFile { } {
+ set new_dir [file join $::env(HOME) .kratos_multiphysics]
+ set file [file join $new_dir launch_configuration.json]
+ return [list $new_dir $file]
+}
+
+proc Kratos::LoadLaunchModes { {force 0} } {
+ # Get location of launch config script
+ lassign [Kratos::GetLaunchConfigurationFile] new_dir file
+
+ # If it does not exist, copy it from exec
+ if {[file exists $new_dir] == 0} {file mkdir $new_dir}
+ if {[file exists $file] == 0 || $force} {
+ ::GidUtils::SetWarnLine "Loading launch mode"
+ set source [file join $::Kratos::kratos_private(Path) exec launch.json]
+ file copy -force $source $file
+ }
+
+ # Load configurations
+ Kratos::LoadConfigurationFile $file
+}
+
+proc Kratos::LoadConfigurationFile {config_file} {
+ if {[file exists $config_file] == 0} { error "Configuration file not found: $config_file" }
+
+ set dic [Kratos::ReadJsonDict $config_file]
+ set ::Kratos::kratos_private(configurations) [dict get $dic configurations]
+}
+
+proc Kratos::SetDefaultLaunchMode { } {
+ 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}
+}
+
+proc Kratos::ExecuteLaunchByMode {launch_mode} {
+ set bat_file ""
+ if { $::tcl_platform(platform) == "windows" } { set os win } {set os unix}
+ set mode [Kratos::GetLaunchMode $launch_mode]
+ if {$mode ne ""} {
+ set bat [dict get $mode script]
+ set bat_file [file join exec $bat.$os.bat]
+ }
+
+ return $bat_file
+}
+
+proc Kratos::GetLaunchMode { {launch_mode "current"} } {
+ set curr_mode ""
+ 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} {
+ set curr_mode $mode
+ }
+ }
+ return $curr_mode
+}
\ No newline at end of file
diff --git a/kratos.gid/scripts/Logs.tcl b/kratos.gid/scripts/Logs.tcl
index 0fb8be7e9..251d5d2bb 100644
--- a/kratos.gid/scripts/Logs.tcl
+++ b/kratos.gid/scripts/Logs.tcl
@@ -5,7 +5,8 @@
proc Kratos::GetLogFilePath { } {
variable kratos_private
- set dir_name [file dirname [GiveGidDefaultsFile]]
+ set gid_defaults [GiD_GetUserSettingsFilename -create_folders -ignore_alternative_configuration_file]
+ set dir_name [file dirname $gid_defaults]
set file_name $kratos_private(LogFilename)
if {$file_name eq ""} {}
if { $::tcl_platform(platform) == "windows" } {
@@ -17,31 +18,42 @@ proc Kratos::GetLogFilePath { } {
proc Kratos::InitLog { } {
variable kratos_private
- set kratos_private(LogFilename) [clock format [clock seconds] -format "%Y%m%d%H%M%S"].log
- set logpath [Kratos::GetLogFilePath]
- file mkdir [file dirname $logpath]
- set logfile [open $logpath "a+"];
- puts $logfile "Kratos Log Session"
- close $logfile
- set kratos_private(Log) [list ]
+
+ if {[info exists Kratos::kratos_private(allow_logs)] && $Kratos::kratos_private(allow_logs)>0} {
+
+ set kratos_private(LogFilename) [clock format [clock seconds] -format "%Y%m%d%H%M%S"].log
+ set logpath [Kratos::GetLogFilePath]
+ file mkdir [file dirname $logpath]
+ set logfile [open $logpath "a+"];
+ puts $logfile "Kratos Log Session"
+ close $logfile
+ set kratos_private(Log) [list ]
+
+ Kratos::AutoFlush
+ }
}
proc Kratos::Log {msg} {
variable kratos_private
+
+ if {[info exists kratos_private(Log)] && $Kratos::kratos_private(allow_logs) > 0} {
- if {[info exists kratos_private(Log)]} {
- lappend kratos_private(Log) "*~* [clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S}] | $msg"
+ if {[info exists kratos_private(Log)]} {
+ lappend kratos_private(Log) "*~* [clock format [clock seconds] -format {%Z %Y-%m-%d %H:%M:%S }] | $msg"
- # One of the triggers is to flush if we've stored more than 5
- if {[llength $kratos_private(Log)] > 5} {
- Kratos::FlushLog
+ # One of the triggers is to flush if we've stored more than 5
+ if {[llength $kratos_private(Log)] > 5} {
+ Kratos::FlushLog
+ }
}
}
}
proc Kratos::FlushLog { } {
variable kratos_private
- if {[info exists kratos_private(Log)]} {
+
+ if {[info exists kratos_private(Log)] && $Kratos::kratos_private(allow_logs) > 0} {
+ # only disturb the disk if we have something new to write
if {[llength $kratos_private(Log)] > 0} {
set logpath [Kratos::GetLogFilePath]
@@ -57,11 +69,38 @@ proc Kratos::FlushLog { } {
}
set kratos_private(Log) [list ]
+ # Move it to the model, so the user can see and store to get support
+ # Keep the original to keep centralized data to send to the servers
+ if {$Kratos::kratos_private(model_log_folder) ne ""} {
+ Kratos::MoveLogsToFolder $Kratos::kratos_private(model_log_folder) 0
+ }
}
}
- after 5000 {Kratos::FlushLog}
-
}
+proc Kratos::AutoFlush {} {
+ if {[info exists Kratos::kratos_private(allow_logs)] && $Kratos::kratos_private(allow_logs)>0} {
+ after 5000 {Kratos::AutoFlush}
+ }
+}
+
+proc Kratos::ViewLog {} {
+ package require gid_cross_platform
+ FlushLog
+ gid_cross_platform::open_by_extension [Kratos::GetLogFilePath]
+}
+
+#do not save preferences starting with flag gid.exe -c (that specify read only an alternative file)
+if { [GiD_Set SaveGidDefaults] } {
+ set Kratos::kratos_private(allow_logs) 0
+}
Kratos::InitLog
-Kratos::FlushLog
+
+proc Kratos::MoveLogsToFolder {folder {flush_log 1}} {
+
+ if {[info exists Kratos::kratos_private(allow_logs)] && $Kratos::kratos_private(allow_logs)>0} {
+ if {$flush_log} {FlushLog}
+ if {![file exists $folder]} {file mkdir $folder}
+ file copy -force [Kratos::GetLogFilePath] $folder
+ }
+}
\ No newline at end of file
diff --git a/kratos.gid/scripts/Menus.tcl b/kratos.gid/scripts/Menus.tcl
index 4edb2d9a7..227e9f055 100644
--- a/kratos.gid/scripts/Menus.tcl
+++ b/kratos.gid/scripts/Menus.tcl
@@ -41,8 +41,13 @@ proc Kratos::CreatePreprocessModelTBar { {type "DEFAULT INSIDELEFT"} } {
Kratos::ToolbarAddItem "Run" "run.png" {Utilities Calculate} [= "Run the simulation"]
Kratos::ToolbarAddItem "Output" "output.png" [list -np- PWViewOutput] [= "View process info"]
Kratos::ToolbarAddItem "Stop" "stop.png" {Utilities CancelProcess} [= "Cancel process"]
- Kratos::ToolbarAddItem "SpacerApp" "" "" ""
-
+ Kratos::ToolbarAddItem "SpacerApp1" "" "" ""
+ if {[info exists kratos_private(UseFiles)] && $kratos_private(UseFiles) == 1} {
+ Kratos::ToolbarAddItem "Files" "files.png" [list -np- spdAux::LaunchFileWindow] [= "File handler window"]
+ }
+ Kratos::ToolbarAddItem "Examples" "losta.png" [list -np- ::Examples::StartWindow [apps::getActiveAppId]] [= "Examples window"]
+ Kratos::ToolbarAddItem "SpacerApp2" "" "" ""
+
set app_items_toolbar [apps::ExecuteOnCurrentApp CustomToolbarItems]
if {$app_items_toolbar < 1} {
Kratos::ToolbarDeleteItem "SpacerApp"
@@ -55,38 +60,48 @@ proc Kratos::CreatePreprocessModelTBar { {type "DEFAULT INSIDELEFT"} } {
set helpslist [list ]
foreach item [dict keys $kratos_private(MenuItems)] {
set icon [dict get $kratos_private(MenuItems) $item icon]
- if {![file exists $icon] && $icon ne ""} {
- set good_dir $dir
- if {$theme eq "GiD_black"} {
- set good_dir [file join $dir Black]
- if {![file exists [file join $good_dir $icon]]} {set good_dir $dir}
+ set icon_path ""
+ if {[file exists $icon]} {
+ set icon_path $icon
+ } else {
+ set list_dirs [list ]
+ if {[apps::getActiveApp] ne ""} {lappend list_dirs [file dirname [apps::getImgPathFrom [[apps::getActiveApp] getName] ]]}
+ lappend list_dirs $dir
+ foreach path $list_dirs {
+ if {$icon ne ""} {
+ set good_dir $path
+ if {$theme eq "GiD_black"} {
+ set good_dir [file join $path Black]
+ if {![file exists [file join $good_dir $icon]]} {set good_dir $path}
+ }
+ set icon_path [file join $good_dir $icon]
+ if {[file exists $icon_path]} {break;}
+ }
}
- set icon [file join $good_dir $icon]
}
-
- lappend iconslist [expr {$icon ne "" ? $icon : "---"}]
+ lappend iconslist [expr {$icon ne "" ? $icon_path : "---"}]
lappend commslist [dict get $kratos_private(MenuItems) $item code]
lappend helpslist [dict get $kratos_private(MenuItems) $item tex]
}
-
+
set KBitmapsNames(0) $iconslist
set KBitmapsCommands(0) $commslist
set KBitmapsHelp(0) $helpslist
-
+
set prefix Pre
set name KPreprocessModelbar
set procname ::Kratos::CreatePreprocessModelTBar
set kratos_private(ToolBars,PreprocessModelTBar) [CreateOtherBitmaps ${name} [= "Kratos toolbar"] KBitmapsNames KBitmapsCommands KBitmapsHelp $dir $procname $type $prefix]
-
+
AddNewToolbar [= "Kratos toolbar"] ${prefix}${name}WindowGeom $procname
}
}
proc Kratos::EndCreatePreprocessTBar {} {
variable kratos_private
-
+
set name KPreprocessModelbar
-
+
ReleaseToolbar ${name}
if {[info exists kratos_private(ToolBars,PreprocessModelTBar)]} {
destroy $kratos_private(ToolBars,PreprocessModelTBar)
@@ -118,6 +133,7 @@ proc Kratos::ChangeMenus { } {
GiDMenu::InsertOption "Kratos" [list "Kratos data" ] [incr pos] PRE [list gid_groups_conds::open_conditions menu] "" "" replace =
GiDMenu::InsertOption "Kratos" [list "Local axes window" ] [incr pos] PRE [list gid_groups_conds::local_axes_window] "" "" replace =
GiDMenu::InsertOption "Kratos" [list "View spd file" ] [incr pos] PRE [list spdAux::ViewDoc] "" "" replace =
+ GiDMenu::InsertOption "Kratos" [list "Open case in VS Code" ] [incr pos] PRE [list Kratos::OpenCaseIn VSCode] "" "" replace =
GiDMenu::InsertOption "Kratos" [list "---"] [incr pos] PRE "" "" "" replace =
GiDMenu::InsertOption "Kratos" [list "Write calculation files - No run" ] [incr pos] PRE [list Kratos::WriteCalculationFilesEvent] "" "" replace =
GiDMenu::InsertOption "Kratos" [list "Run - No write" ] [incr pos] PRE [list Kratos::ForceRun] "" "" replace =
@@ -127,13 +143,17 @@ proc Kratos::ChangeMenus { } {
if {$::Kratos::kratos_private(UseWizard)} {
GiDMenu::InsertOption "Kratos" [list "---"] [incr pos] PRE "" "" "" replace =
- GiDMenu::InsertOption "Kratos" [list "Wizard window" ] [incr pos] PRE [list Wizard::CreateWindow] "" "" replace =
+ GiDMenu::InsertOption "Kratos" [list "Wizard window" ] [incr pos] PRE [list apps::ExecuteOnCurrentApp StartWizardWindow] "" "" replace =
}
GiDMenu::InsertOption "Kratos" [list "---"] [incr pos] PRE "" "" "" replace =
GiDMenu::InsertOption "Kratos" [list "Import MDPA"] [incr pos] PRE [list Kratos::ReadPreW] "" "" replace =
GiDMenu::InsertOption "Kratos" [list "---"] [incr pos] PRE "" "" "" replace =
- if {[GidUtils::VersionCmp "14.1.4d"] <0 } { set cmd [list ChangeVariables kratos_preferences] } {set cmd [list PreferencesWindow kratos_preferences]}
+ if {[GidUtils::VersionCmp "14.1.4d"] <0 } { set cmd [list ChangeVariables kratos_preferences] } {set cmd [list PreferencesWindow kratos_preferences]}
GiDMenu::InsertOption "Kratos" [list "Kratos preferences" ] [incr pos] PRE $cmd "" "" replace =
+ GiDMenu::InsertOption "Kratos" [list "View current log" ] [incr pos] PREPOST [list Kratos::ViewLog] "" "" replace =
+ GiDMenu::InsertOption "Kratos" [list "Install python and update dependencies" ] [incr pos] PREPOST [list Kratos::InstallAllPythonDependencies] "" "" replace =
+ GiDMenu::InsertOption "Kratos" [list "Refresh launch configurations" ] [incr pos] PREPOST [list Kratos::LoadLaunchModes 1] "" "" replace =
+ GiDMenu::InsertOption "Kratos" [list "---"] [incr pos] PRE "" "" "" replace =
GiDMenu::InsertOption "Kratos" [list "About Kratos" ] [incr pos] PREPOST [list Kratos::About] "" "" replace =
GidChangeDataLabel "Data units" ""
GidChangeDataLabel "Interval" ""
@@ -148,14 +168,14 @@ proc Kratos::ChangeMenus { } {
GiDMenu::InsertOption "Help" [list [_ "Visit %s web" Kratos]] end PREPOST [list VisitWeb "http://www.cimne.com/kratos"] "" "" insertafter
GiDMenu::InsertOption "Help" [list [_ "Do you want to develop Kratos?"]] end PREPOST [list VisitWeb "https://github.com/KratosMultiphysics"] "" "" insertafter
}
-
+
GiDMenu::UpdateMenus
}
proc Kratos::About {} {
Splash
}
-
+
proc Kratos::Splash { } {
variable kratos_private
@@ -173,6 +193,6 @@ proc Kratos::Splash { } {
.splash.lv configure -font $fnt -background white -foreground black -relief solid -borderwidth 1 -padx 12 -pady 3
update
-
+
GiD_Set SplashWindow $prev_splash_state
}
diff --git a/kratos.gid/scripts/Model/Condition.tcl b/kratos.gid/scripts/Model/Condition.tcl
index 9e0d26fe3..7a0b01b1a 100644
--- a/kratos.gid/scripts/Model/Condition.tcl
+++ b/kratos.gid/scripts/Model/Condition.tcl
@@ -3,7 +3,9 @@
# Do not change anything here unless it's strictly necessary.
##################################################################################
-namespace eval Model {
+namespace eval ::Model {
+ Kratos::AddNamespace [namespace current]
+
catch {Condition destroy}
oo::class create Condition {
superclass Entity
diff --git a/kratos.gid/scripts/Model/ConstitutiveLaw.tcl b/kratos.gid/scripts/Model/ConstitutiveLaw.tcl
index 0df2a5e8e..b2e7049c1 100644
--- a/kratos.gid/scripts/Model/ConstitutiveLaw.tcl
+++ b/kratos.gid/scripts/Model/ConstitutiveLaw.tcl
@@ -3,7 +3,7 @@
# Do not change anything here unless it's strictly necessary.
##################################################################################
-namespace eval Model {
+namespace eval ::Model {
# Clase CLaw
catch {CLaw destroy}
diff --git a/kratos.gid/scripts/Model/Element.tcl b/kratos.gid/scripts/Model/Element.tcl
index 604daf33a..63f1e460c 100644
--- a/kratos.gid/scripts/Model/Element.tcl
+++ b/kratos.gid/scripts/Model/Element.tcl
@@ -3,7 +3,7 @@
# Do not change anything here unless it's strictly necessary.
##################################################################################
-namespace eval Model {
+namespace eval ::Model {
catch {Element destroy}
oo::class create Element {
superclass Entity
diff --git a/kratos.gid/scripts/Model/Entity.tcl b/kratos.gid/scripts/Model/Entity.tcl
index 75e460697..9dd10910d 100644
--- a/kratos.gid/scripts/Model/Entity.tcl
+++ b/kratos.gid/scripts/Model/Entity.tcl
@@ -3,7 +3,7 @@
# Do not change anything here unless it's strictly necessary.
##################################################################################
-namespace eval Model {
+namespace eval ::Model {
catch {Entity destroy}
oo::class create Entity {
variable name
@@ -113,16 +113,17 @@ oo::class create Entity {
method cumple {args} {
#W "Cumplimos con los filtros: $args"
set c 1
- if {$::Kratos::kratos_private(DevMode) ne "release"} {
-
+ if {[Kratos::IsDeveloperMode]} {
+ # if our mode is debug, it's allowed
} elseif {[my getAttribute "ProductionReady"] ne "" && [my getAttribute "ProductionReady"] ne "ProductionReady"} {
+ # if our mode is release, only release entities
#W "[my getName] no paso - [my getAttribute "ProductionReady"] "
return 0
}
if {$args ne ""} {
foreach {k listfiltervalues} {*}$args {
set listfiltervalues [string map {, " "} $listfiltervalues]
- #W "k: $k vs : $listfiltervalues"
+ # W "k: $k vs : $listfiltervalues"
set listattributesvalues [string map {, " "} [my getAttribute $k]]
#W "My value $listattributesvalues"
set b1 0
diff --git a/kratos.gid/scripts/Model/Material.tcl b/kratos.gid/scripts/Model/Material.tcl
index fec823c26..dae1f6df6 100644
--- a/kratos.gid/scripts/Model/Material.tcl
+++ b/kratos.gid/scripts/Model/Material.tcl
@@ -3,7 +3,7 @@
# Do not change anything here unless it's strictly necessary.
##################################################################################
-namespace eval Model {
+namespace eval ::Model {
catch {Material destroy}
oo::class create Material {
superclass Entity
diff --git a/kratos.gid/scripts/Model/Model.tcl b/kratos.gid/scripts/Model/Model.tcl
index 9617218dc..f4a299f03 100644
--- a/kratos.gid/scripts/Model/Model.tcl
+++ b/kratos.gid/scripts/Model/Model.tcl
@@ -3,7 +3,7 @@
# Do not change anything here unless it's strictly necessary.
##################################################################################
-namespace eval Model {
+namespace eval ::Model {
variable SpatialDimension
variable ValidSpatialDimensions
variable SolutionStrategies
@@ -30,9 +30,7 @@ proc Model::Init { } {
variable ConstitutiveLaws
variable Solvers
variable Processes
-
- #set dir $::Kratos::kratos_private(Path)
-
+
set SolutionStrategies [list ]
set Elements [list ]
set Materials [list ]
@@ -53,70 +51,42 @@ proc Model::InitVariables {varName varValue} {
}
proc Model::getSolutionStrategies { SolutionStrategyFileName } {
- #variable SolutionStrategies
variable dir
-
- #set SolutionStrategies [list ]
dom parse [tDOM::xmlReadFile [file join $dir xml $SolutionStrategyFileName]] doc
-
ParseSolutionStrategies $doc
}
proc Model::getElements { ElementsFileName } {
- #variable Elements
variable dir
-
- #set Elements [list ]
dom parse [tDOM::xmlReadFile [file join $dir xml $ElementsFileName]] doc
-
ParseElements $doc
}
proc Model::getConditions { ConditionsFileName } {
- #variable Conditions
variable dir
-
- #set Conditions [list ]
dom parse [tDOM::xmlReadFile [file join $dir xml $ConditionsFileName]] doc
-
ParseConditions $doc
}
proc Model::getNodalConditions { NodalConditionsFileName } {
- #variable NodalConditions
variable dir
-
- #set Conditions [list ]
dom parse [tDOM::xmlReadFile [file join $dir xml $NodalConditionsFileName]] doc
- #W [$doc asXML]
ParseNodalConditions $doc
}
proc Model::getConstitutiveLaws { ConstitutiveLawsFileName } {
- #variable ConstitutiveLaws
variable dir
-
- #set ConstitutiveLaws [list ]
dom parse [tDOM::xmlReadFile [file join $dir xml $ConstitutiveLawsFileName]] doc
-
ParseConstitutiveLaws $doc
}
proc Model::getSolvers { SolversFileName } {
- #variable Solvers
variable dir
-
- #set Solvers [list ]
dom parse [tDOM::xmlReadFile [file join $dir xml $SolversFileName]] doc
-
ParseSolvers $doc
}
proc Model::getProcesses { ProcessesFileName } {
- #variable Processes
variable dir
-
- #set Processes [list ]
dom parse [tDOM::xmlReadFile [file join $dir xml $ProcessesFileName]] doc
-
ParseProcesses $doc
}
proc Model::getMaterials { MaterialsFileName } {
diff --git a/kratos.gid/scripts/Model/Parameter.tcl b/kratos.gid/scripts/Model/Parameter.tcl
index 96a9d7261..7283ea0e5 100644
--- a/kratos.gid/scripts/Model/Parameter.tcl
+++ b/kratos.gid/scripts/Model/Parameter.tcl
@@ -4,7 +4,7 @@
##################################################################################
# Clase Parameter
-namespace eval Model {
+namespace eval ::Model {
catch {Parameter destroy}
oo::class create Parameter {
superclass Entity
diff --git a/kratos.gid/scripts/Model/Process.tcl b/kratos.gid/scripts/Model/Process.tcl
index e9246a65b..e790b5e04 100644
--- a/kratos.gid/scripts/Model/Process.tcl
+++ b/kratos.gid/scripts/Model/Process.tcl
@@ -3,7 +3,7 @@
# Do not change anything here unless it's strictly necessary.
##################################################################################
-namespace eval Model {
+namespace eval ::Model {
# Clase Process
catch {Process destroy}
oo::class create Process {
diff --git a/kratos.gid/scripts/Model/SolutionStrategy.tcl b/kratos.gid/scripts/Model/SolutionStrategy.tcl
index 8cf3f22e0..b0a4ab0d5 100644
--- a/kratos.gid/scripts/Model/SolutionStrategy.tcl
+++ b/kratos.gid/scripts/Model/SolutionStrategy.tcl
@@ -3,7 +3,7 @@
# Do not change anything here unless it's strictly necessary.
##################################################################################
-namespace eval Model {
+namespace eval ::Model {
# Clase Solution Strategey
catch {Scheme destroy}
oo::class create Scheme {
@@ -124,9 +124,10 @@ oo::class create SolStrat {
}
method cumple {args} {
set c [next {*}$args]
-
+ # W "[my getName] $c"
if {$c && ![write::isBooleanFalse [my getAttribute "NeedElements"]]} {
set c 0
+ # W "[my getName] $c"
foreach sc [my getSchemes] {
if [llength [Model::GetAvailableElements [my getName] [$sc getName]]] {
set c 1; break
@@ -361,7 +362,6 @@ proc Model::GetSchemesParams {args} {
proc Model::GetAvailableElements {solutionStrategyId schemeId} {
variable Elements
- variable SolutionStrategies
#W "GetAvailableElements ss $solutionStrategyId sch $schemeId"
set cumplen [list ]
set solst [Model::GetSolutionStrategy $solutionStrategyId]
@@ -387,7 +387,6 @@ proc Model::GetAvailableElements {solutionStrategyId schemeId} {
proc Model::GetAvailableConditions {solutionStrategyId schemeId} {
variable Conditions
- variable SolutionStrategies
set cumplen [list ]
#W $solutionStrategyId
diff --git a/kratos.gid/scripts/Model/Solver.tcl b/kratos.gid/scripts/Model/Solver.tcl
index f66c5d944..421433a48 100644
--- a/kratos.gid/scripts/Model/Solver.tcl
+++ b/kratos.gid/scripts/Model/Solver.tcl
@@ -3,7 +3,7 @@
# Do not change anything here unless it's strictly necessary.
##################################################################################
-namespace eval Model {
+namespace eval ::Model {
# Clase Solution Strategey
catch {Solver destroy}
oo::class create Solver {
diff --git a/kratos.gid/scripts/Model/Topology.tcl b/kratos.gid/scripts/Model/Topology.tcl
index c83d3c1a1..aaf7bcc0c 100644
--- a/kratos.gid/scripts/Model/Topology.tcl
+++ b/kratos.gid/scripts/Model/Topology.tcl
@@ -3,7 +3,7 @@
# Do not change anything here unless it's strictly necessary.
##################################################################################
-namespace eval Model {
+namespace eval ::Model {
# Clase Topology features
catch {Topology destroy}
oo::class create Topology {
diff --git a/kratos.gid/scripts/Utils.tcl b/kratos.gid/scripts/Utils.tcl
index e763abe46..55f24f694 100644
--- a/kratos.gid/scripts/Utils.tcl
+++ b/kratos.gid/scripts/Utils.tcl
@@ -1,8 +1,8 @@
-proc Kratos::Quicktest {example_app example_dim example_cmd} {
- apps::setActiveApp Examples
- ::Examples::LaunchExample $example_app $example_dim $example_cmd
-}
+# proc Kratos::Quicktest {example_app example_dim example_cmd} {
+# apps::setActiveApp Examples
+# ::Examples::LaunchExample $example_app $example_dim $example_cmd
+# }
proc Kratos::ForceRun { } {
# validated by escolano@cimne.upc.edu
@@ -15,10 +15,12 @@ proc Kratos::ForceRun { } {
proc Kratos::DestroyWindows { } {
gid_groups_conds::close_all_windows
- spdAux::DestroyWindow
+ spdAux::DestroyWindows
if {[info exists ::Kratos::kratos_private(UseWizard)] && $::Kratos::kratos_private(UseWizard)} {
smart_wizard::DestroyWindow
+ catch {destroy $smart_wizard::wizwindow}
}
+ catch {destroy $smart_wizard::wizwindow}
::Kratos::EndCreatePreprocessTBar
}
@@ -52,7 +54,7 @@ proc Kratos::CheckValidProjectName {modelname} {
}
proc Kratos::PrintArray {a {pattern *}} {
- upvar 1 $a array
+ upvar 1 $a array
if {![array exists array]} {
error "\"$a\" isn't an array"
}
@@ -86,7 +88,7 @@ proc Kratos::WarnAboutMinimumRecommendedGiDVersion { } {
if { [GidUtils::VersionCmp $kratos_private(CheckMinimumGiDVersion)] < 0 } {
W "Warning: kratos interface requires GiD $kratos_private(CheckMinimumGiDVersion) or later."
if { [GidUtils::VersionCmp 14.0.0] < 0 } {
- W "If you are still using a GiD version 13.1.7d or later, you can still use most of the features, but think about upgrading to GiD 14."
+ W "If you are still using a GiD version 13.1.7d or later, you can still use most of the features, but think about upgrading to GiD 14."
} {
W "If you are using an official version of GiD 14, we recommend to use the latest developer version"
}
@@ -95,11 +97,11 @@ proc Kratos::WarnAboutMinimumRecommendedGiDVersion { } {
}
# Customlib libs and preferences
-proc Kratos::LoadProblemtypeLibraries {} {
+proc Kratos::LoadProblemtypeLibraries {} {
package require customlib_extras
package require customlib_native_groups
variable kratos_private
-
+
gid_groups_conds::SetProgramName $kratos_private(Name)
gid_groups_conds::SetLibDir [file join $kratos_private(Path) exec]
set spdfile [file join $kratos_private(Path) kratos_default.spd]
@@ -117,7 +119,8 @@ proc Kratos::LoadProblemtypeLibraries {} {
proc Kratos::GiveKratosDefaultsFile {} {
variable kratos_private
- set dir_name [file dirname [GiveGidDefaultsFile]]
+ set gid_defaults [GiD_GetUserSettingsFilename -create_folders]
+ set dir_name [file dirname $gid_defaults]
set file_name $kratos_private(Name)$kratos_private(Version).ini
if { $::tcl_platform(platform) == "windows" } {
return [file join $dir_name $file_name]
@@ -130,7 +133,7 @@ proc Kratos::GiveKratosDefaultsFile {} {
proc Kratos::GetPreferencesFilePath { } {
variable kratos_private
# Where we store the user preferences :)
-
+
# Get the GiD preferences dir
set dir_name [file dirname [GiveGidDefaultsFile]]
@@ -146,20 +149,40 @@ proc Kratos::GetPreferencesFilePath { } {
}
proc Kratos::RegisterEnvironment { } {
- variable kratos_private
- set vars_to_save [list DevMode echo_level mdpa_format]
- set preferences [dict create]
- foreach v $vars_to_save {
- if {[info exists kratos_private($v)]} {
- dict set preferences $v $kratos_private($v)
+ #do not save preferences starting with flag gid.exe -c (that specify read only an alternative file)
+ if { [GiD_Set SaveGidDefaults] } {
+ variable kratos_private
+ set vars_to_save [list DevMode echo_level mdpa_format debug_folder allow_logs launch_configuration]
+ set preferences [dict create]
+ foreach v $vars_to_save {
+ if {[info exists kratos_private($v)]} {
+ dict set preferences $v $kratos_private($v)
+ }
+ }
+
+ if {[llength [dict keys $preferences]] > 0} {
+ set fp [open [Kratos::GetPreferencesFilePath] w]
+ if {[catch {set data [puts $fp [write::tcl2json $preferences]]} ]} {W "Problems saving user prefecences"; W $preferences}
+ close $fp
}
}
-
- if {[llength [dict keys $preferences]] > 0} {
- set fp [open [Kratos::GetPreferencesFilePath] w]
- if {[catch {set data [puts $fp [write::tcl2json $preferences]]} ]} {W "Problems saving user prefecences"; W $data}
+}
+
+proc Kratos::ReadJsonDict {file_path} {
+ set data ""
+ catch {
+ # Try to open the preferences file
+ set fp [open $file_path r]
+ # Read the preferences
+ set data [read $fp]
+ # W $data
+ # Close the file
close $fp
}
+ if {$data ne ""} {
+ set data [write::json2dict $data]
+ }
+ return $data
}
proc Kratos::LoadEnvironment { } {
@@ -167,28 +190,135 @@ proc Kratos::LoadEnvironment { } {
# Init variables
set data ""
-
+
catch {
# Try to open the preferences file
set fp [open [Kratos::GetPreferencesFilePath] r]
# Read the preferences
set data [read $fp]
+ # W $data
# Close the file
close $fp
- }
- # Preferences are written in json format
- foreach {k v} [write::json2dict $data] {
- # Foreach pair key value, restore it
- set kratos_private($k) $v
+
+ # Preferences are written in json format
+ foreach {k v} [write::json2dict $data] {
+ # W "$k $v"
+ # Foreach pair key value, restore it
+ set kratos_private($k) $v
+ }
}
}
# LOGS
proc Kratos::LogInitialData { } {
+
+ # Get the exec version
+ #Kratos::GetExecVersion
+ Kratos::GetProblemtypeGitTag
+
set initial_data [dict create]
- dict set initial_data GiD_Version [GiD_Info gidversion]
- dict set initial_data Problemtype_Git_Hash "68418871cff2b897f7fb9176827871b339fe5f91"
-
+ dict set initial_data gid_version [GiD_Info gidversion]
+ dict set initial_data problemtype_git_hash $Kratos::kratos_private(problemtype_git_hash)
+ dict set initial_data problemtype_version $Kratos::kratos_private(Version)
+ # dict set initial_data executable_version $Kratos::kratos_private(exec_version)
+ dict set initial_data current_platform $::tcl_platform(platform)
+
Kratos::Log [write::tcl2json $initial_data]
-}
\ No newline at end of file
+}
+
+
+proc Kratos::Duration { int_time } {
+ if {$int_time == 0} {return "0 sec"}
+ set timeList [list]
+ foreach div {86400 3600 60 1} mod {0 24 60 60} name {day hr min sec} {
+ set n [expr {$int_time / $div}]
+ if {$mod > 0} {set n [expr {$n % $mod}]}
+ if {$n > 1} {
+ lappend timeList "$n ${name}s"
+ } elseif {$n == 1} {
+ lappend timeList "$n $name"
+ }
+ }
+ return [join $timeList]
+}
+
+
+proc Kratos::GetExecVersion {} {
+ catch {
+ variable kratos_private
+ set tmp_filename [GidUtils::GetTmpFilename]
+ if { $::tcl_platform(platform) == "unix"} {set command [file join $kratos_private(Path) exec Kratos runkratos]} {set command [file join $kratos_private(Path) exec Kratos runkratos.exe]}
+ set result [exec $command -c "import KratosMultiphysics as Kratos" >> $tmp_filename]
+ set fp [open $tmp_filename r]
+ set file_data [read $fp]
+ close $fp
+ file delete $tmp_filename
+ set data [split $file_data "\n"]
+ foreach line $data {
+ if {[string first "Multi-Physics" $line] > 0} {
+ set kratos_private(exec_version) [string range [string trim $line] 14 end]
+ break;
+ }
+ }
+ }
+}
+proc Kratos::GetProblemtypeGitTag {} {
+ catch {
+ variable kratos_private
+ set tmp_filename [GidUtils::GetTmpFilename]
+ set result [exec git -C $kratos_private(Path) log --format="%H" -n 1 >> $tmp_filename]
+ set fp [open $tmp_filename r]
+ set file_data [read $fp]
+ close $fp
+ file delete $tmp_filename
+ set data [split $file_data "\n"]
+ set kratos_private(problemtype_git_hash) [string trim [string trim [lindex $data 0]] "\""]
+ }
+}
+
+proc Kratos::GetMeshBasicData { } {
+ set result [dict create]
+ foreach element_type [GidUtils::GetElementTypes all] {
+ set ne [GiD_Info Mesh NumElements $element_type]
+ if { $ne } {
+ dict set result $element_type $ne
+ }
+ }
+
+ dict set result nodes [GiD_Info Mesh NumNodes]
+ dict set result is_quadratic [expr [GiD_Info Project Quadratic] && ![GiD_Cartesian get iscartesian] ]
+ return $result
+}
+
+proc ? {question true_val false_val} {
+ return [expr $question ? $true_val : $false_val]
+}
+
+proc Kratos::OpenCaseIn {program} {
+ switch $program {
+ "VSCode" {
+ if {[GiD_Info Project ModelName] eq "UNNAMED"} {W "Save your model first"} {
+ catch {exec code -n [GidUtils::GetDirectoryModel]} msg
+ if {$msg eq {couldn't execute "code": no such file or directory}} {
+ W "Install Visual Studio Code and add it to your PATH"
+ }
+ }
+ }
+ default {}
+ }
+}
+
+if { ![GidUtils::IsTkDisabled] } {
+ proc xmlprograms::OpenBrowserForDirectory { baseframe variable} {
+ set $variable [MessageBoxGetFilename directory write [_ "Select kratos debug compiled folder (kratos / bin / debug"]]
+ return variable
+ }
+}
+
+proc Kratos::IsDeveloperMode {} {
+ set is_dev 0
+ if {[info exists ::Kratos::kratos_private(DevMode)] && $::Kratos::kratos_private(DevMode) eq "dev"} {set is_dev 1}
+ return $is_dev
+}
+
diff --git a/kratos.gid/scripts/Writing/WriteConditions.tcl b/kratos.gid/scripts/Writing/WriteConditions.tcl
index 70b51faf7..a94252985 100644
--- a/kratos.gid/scripts/Writing/WriteConditions.tcl
+++ b/kratos.gid/scripts/Writing/WriteConditions.tcl
@@ -1,5 +1,5 @@
-proc write::writeConditions { baseUN {iter 0} {cond_id ""}} {
+proc ::write::writeConditions { baseUN {iter 0} {cond_id ""}} {
set dictGroupsIterators [dict create]
set root [customlib::GetBaseRoot]
@@ -24,7 +24,7 @@ proc write::writeConditions { baseUN {iter 0} {cond_id ""}} {
return $dictGroupsIterators
}
-proc write::writeGroupNodeCondition {dictGroupsIterators groupNode condid iter} {
+proc ::write::writeGroupNodeCondition {dictGroupsIterators groupNode condid iter} {
set groupid [get_domnode_attribute $groupNode n]
set groupid [GetWriteGroupName $groupid]
if {![dict exists $dictGroupsIterators $groupid]} {
@@ -37,8 +37,10 @@ proc write::writeGroupNodeCondition {dictGroupsIterators groupNode condid iter}
if {$aux_cond ne ""} {set cond $aux_cond}
set kname [$cond getTopologyKratosName $etype $nnodes]
if {$kname ne ""} {
- lassign [write::writeGroupCondition $groupid $kname $nnodes $iter] initial final
- dict set dictGroupsIterators $groupid [list $initial $final]
+ if {$nnodes >= 1} {
+ lassign [write::writeGroupCondition $groupid $kname $nnodes $iter] initial final
+ dict set dictGroupsIterators $groupid [list $initial $final]
+ }
} else {
# If kname eq "" => no topology feature match, condition written as nodal
if {[$cond hasTopologyFeatures]} {W "$groupid assigned to $condid - Selected invalid entity $ov with $nnodes nodes - Check Conditions.xml"}
@@ -50,7 +52,7 @@ proc write::writeGroupNodeCondition {dictGroupsIterators groupNode condid iter}
return $dictGroupsIterators
}
-proc write::writeGroupCondition {groupid kname nnodes iter} {
+proc ::write::writeGroupCondition {groupid kname nnodes iter} {
set obj [list ]
# Print header
@@ -65,6 +67,7 @@ proc write::writeGroupCondition {groupid kname nnodes iter} {
set obj [GiD_EntitiesGroups get $groupid nodes]
} else {
set formats [write::GetFormatDict $groupid 0 $nnodes]
+ #W "$groupid [GiD_Groups list $groupid]"
set elems [GiD_WriteCalculationFile connectivities -return $formats]
set obj [GetListsOfNodes $elems $nnodes 2]
}
@@ -87,7 +90,7 @@ proc write::writeGroupCondition {groupid kname nnodes iter} {
return [list $initial $final]
}
-proc write::writeNodalConditions { un } {
+proc ::write::writeNodalConditions { un } {
set root [customlib::GetBaseRoot]
set xp1 "[spdAux::getRoute $un]/condition/group"
@@ -106,7 +109,7 @@ proc write::writeNodalConditions { un } {
}
}
-proc write::writeConditionGroupedSubmodelParts {cid groups_dict} {
+proc ::write::writeConditionGroupedSubmodelParts {cid groups_dict} {
set s [mdpaIndent]
WriteString "${s}Begin SubModelPart $cid // Condition $cid"
diff --git a/kratos.gid/scripts/Writing/WriteConditionsByUniqueId.tcl b/kratos.gid/scripts/Writing/WriteConditionsByUniqueId.tcl
index 4ffbe9a7b..d698a9539 100644
--- a/kratos.gid/scripts/Writing/WriteConditionsByUniqueId.tcl
+++ b/kratos.gid/scripts/Writing/WriteConditionsByUniqueId.tcl
@@ -103,7 +103,7 @@ proc write::writeGroupConditionByUniqueId {groupid kname nnodes iter ConditionMa
set cndid 0
set new 0
if {$nnodes != 1} {
- set eid [lindex $elems $i]
+ set eid [objarray get $elems $i]
set cndid [objarray get $ConditionMap $eid]
}
if {$cndid == 0} {
diff --git a/kratos.gid/scripts/Writing/WriteElements.tcl b/kratos.gid/scripts/Writing/WriteElements.tcl
index d490a449a..3d6c8080c 100644
--- a/kratos.gid/scripts/Writing/WriteElements.tcl
+++ b/kratos.gid/scripts/Writing/WriteElements.tcl
@@ -20,8 +20,9 @@ proc write::writeGroupElementConnectivities { gNode kelemtype} {
set write_properties_in mdpa
if {[GetConfigurationAttribute properties_location] ne ""} {set write_properties_in [GetConfigurationAttribute properties_location]}
set group [get_domnode_attribute $gNode n]
- if { [dict exists $mat_dict $group] && $write_properties_in eq "mdpa"} {
- set mid [dict get $mat_dict $group MID]
+ set submodelpart [write::GetSubModelPartName Parts $group]
+ if { [dict exists $mat_dict $submodelpart] && $write_properties_in eq "mdpa"} {
+ set mid [dict get $mat_dict $submodelpart MID]
} else {
set mid 0
}
diff --git a/kratos.gid/scripts/Writing/WriteHeadings.tcl b/kratos.gid/scripts/Writing/WriteHeadings.tcl
index 32e78978d..ef493caec 100644
--- a/kratos.gid/scripts/Writing/WriteHeadings.tcl
+++ b/kratos.gid/scripts/Writing/WriteHeadings.tcl
@@ -13,6 +13,6 @@ proc write::writeTables { } {
set s [mdpaIndent]
WriteString "${s}Begin Table"
WriteString "${s}Table content"
- WriteString "${s}End Tablee"
+ WriteString "${s}End Table"
WriteString ""
}
diff --git a/kratos.gid/scripts/Writing/WriteMaterials.tcl b/kratos.gid/scripts/Writing/WriteMaterials.tcl
index 061166bbf..6b88a9af4 100644
--- a/kratos.gid/scripts/Writing/WriteMaterials.tcl
+++ b/kratos.gid/scripts/Writing/WriteMaterials.tcl
@@ -1,7 +1,11 @@
+# This function stores in mat dict all the processed materials, and returns the new ones
proc write::processMaterials { {alt_path ""} {last_assigned_id -1}} {
variable mat_dict
+ set new_mats [dict create ]
+
+ # Prepare paths
set parts [GetConfigurationAttribute parts_un]
set materials_un [GetConfigurationAttribute materials_un]
set root [customlib::GetBaseRoot]
@@ -14,18 +18,29 @@ proc write::processMaterials { {alt_path ""} {last_assigned_id -1}} {
}
set xp2 ".//value\[@n='Material']"
set material_number [expr {$last_assigned_id == -1 ? [llength [dict keys $mat_dict] ] : $last_assigned_id }]
+
+ # Foreach group applied to parts
foreach gNode [$root selectNodes $xp1] {
+ # Get the application. Important in Mixed apps (multiple inheritance).
set nodeApp [spdAux::GetAppIdFromNode $gNode]
- set group [$gNode getAttribute n]
+ # Get the write group name. Used as unique id due to intervals and child tricks.
+ set group_name [write::GetWriteGroupName [$gNode @n]]
+ # This group nodes are (always) child of condition (by definition), so get the condition is easy.
+ set cond_name [[$gNode parent] @n]
+ # Using the condition and the group name, we can get the submodelpart id. A submodelpart is always the joint of condition + group.
+ set submodelpart_id [write::GetSubModelPartName $cond_name $group_name]
- set material_name "material $material_number"
- if { ![dict exists $mat_dict $group] } {
+ #set material_name "material $material_number".
+ if { ![dict exists $mat_dict $submodelpart_id] } {
+ # increment the material number. In multi part apps, this material number is passed as variable, in order to keep the numeration.
incr material_number
set mid $material_number
- dict set mat_dict $group MID $material_number
- dict set mat_dict $group APPID $nodeApp
+ # Init the dictionary with initial data.
+ dict set mat_dict $submodelpart_id MID $material_number
+ dict set mat_dict $submodelpart_id APPID $nodeApp
+ # Get the elements name. Even if it's not used in this section, it's important to call it, so dependencies are applied.
catch {
set element_node [$gNode selectNodes ".//value\[@n = 'Element'\]"]
if {$element_node ne ""} {
@@ -34,37 +49,68 @@ proc write::processMaterials { {alt_path ""} {last_assigned_id -1}} {
set element_name [write::getValueByNode $element_node "force"]
}
+ # We have 2 ways to get the properties (output type):
+ # A) Defined by all the values available below parts
+ # B) (By default) Defined also by the material parameters
+
+ # Get the constitutive law output type
+ set output_type Materials
set claw_node [$gNode selectNodes ".//value\[@n = 'ConstitutiveLaw'\]"]
- set claw [write::getValueByNode $claw_node "force"]
- set const_law [Model::getConstitutiveLaw $claw]
- if {$const_law ne ""} {
- set output_type [$const_law getOutputMode]
- if {$output_type eq "Parameters"} {
- set s1 [$gNode selectNodes ".//value"]
+ if {$claw_node ne ""} {
+ set claw [write::getValueByNode $claw_node "force"]
+ if {$claw ne "None"} {
+ set const_law [Model::getConstitutiveLaw $claw]
+ set output_type [$const_law getOutputMode]
+ }
+ }
+ # Case A -> By parameters below parts
+ if {$output_type eq "Parameters"} {
+ set s1 [$gNode selectNodes ".//value"]
+ } else {
+ # Case B -> Include materials parameters
+ set s1 ""
+ set matvalueNode [$gNode selectNodes $xp2]
+ if {$matvalueNode ne ""} {
+ set real_material_name [write::getValueByNode $matvalueNode "force"]
+ set xp3 "[spdAux::getRoute $materials_un]/blockdata\[@n='material' and @name='$real_material_name']"
+ set matNode [$root selectNodes $xp3]
+ set s1 [join [list [$gNode selectNodes ".//value"] [$matNode selectNodes ".//value"]]]
} else {
- set s1 ""
- set matvalueNode [$gNode selectNodes $xp2]
- if {$matvalueNode ne ""} {
- set real_material_name [write::getValueByNode $matvalueNode "force"]
- set xp3 "[spdAux::getRoute $materials_un]/blockdata\[@n='material' and @name='$real_material_name']"
- set matNode [$root selectNodes $xp3]
- set s1 [join [list [$gNode selectNodes ".//value"] [$matNode selectNodes ".//value"]]]
- }
+ set s1 [$gNode selectNodes ".//value"]
}
+ }
- foreach valueNode $s1 {
- write::forceUpdateNode $valueNode
- set name [$valueNode getAttribute n]
- set state [get_domnode_attribute $valueNode state]
- if {$state ne "hidden" || $name eq "ConstitutiveLaw"} {
+ # Once we have all the 'value' nodes, lets get it's value and add them to the list
+ foreach valueNode $s1 {
+ # Force update, useful in combo with part dependencies
+ write::forceUpdateNode $valueNode
+ # name and state, useful for filtering
+ set name [$valueNode getAttribute n]
+ set state [get_domnode_attribute $valueNode state]
+ # hidden values and constitutive law are not included in properties
+ if {$state ne "hidden" || $name eq "ConstitutiveLaw"} {
+ if {[$valueNode hasAttribute type] && [$valueNode @type] eq "matrix"} {
+ set value [list ]
+ set M [gid_groups_conds::read_matrix_function $valueNode]
+ for {set i 0} {$i < [$valueNode @dimension_function_rows]} {incr i} {
+ set row [list ]
+ set cols [$valueNode @dimension_function_cols]
+ for {set j 0} {$j < $cols} {incr j} {
+ lappend row [expr [lindex $M [expr ($i*$cols)+$j]]]
+ }
+ lappend value $row
+ }
+ } else {
# All the introduced values are translated to 'm' and 'kg' with the help of this function
set value [gid_groups_conds::convert_value_to_default $valueNode]
- dict set mat_dict $group $name $value
- }
+ }
+ dict set mat_dict $submodelpart_id $name $value
}
}
+ dict set new_mats $submodelpart_id [dict get $mat_dict $submodelpart_id]
}
}
+ return $new_mats
}
proc write::writeMaterials { {appid ""} {const_law_write_name ""}} {
@@ -102,66 +148,87 @@ proc write::writeMaterials { {appid ""} {const_law_write_name ""}} {
}
}
-
-proc write::writePropertiesJsonFile {{parts_un ""} {fname "materials.json"} {write_claw_name "True"} {model_part_name ""}} {
+proc write::getPropertiesJson {{parts_un ""} {write_claw_name "True"} {model_part_name ""}} {
if {$parts_un eq ""} {set parts_un [GetConfigurationAttribute parts_un]}
set mats_json [getPropertiesList $parts_un $write_claw_name $model_part_name]
+ return $mats_json
+}
+
+proc write::writePropertiesJsonFile {{parts_un ""} {fname "materials.json"} {write_claw_name "True"} {model_part_name ""}} {
+ write::writePropertiesJsonFileDone $fname [write::getPropertiesJson $parts_un $write_claw_name $model_part_name]
+}
+proc write::writePropertiesJsonFileDone {fname json} {
write::OpenFile $fname
- write::WriteJSON $mats_json
+ write::WriteJSON $json
write::CloseFile
}
-proc write::getPropertiesList {parts_un {write_claw_name "True"} {model_part_name ""}} {
+proc write::getPropertiesListByConditionXPath {cnd_xpath {write_claw_name "True"} {model_part_name ""}} {
variable mat_dict
+ variable properties_exclusion_list
+ set exclusionList $properties_exclusion_list
set props_dict [dict create]
set props [list ]
set doc $gid_groups_conds::doc
set root [$doc documentElement]
- #set root [customlib::GetBaseRoot]
-
- set xp1 "[spdAux::getRoute $parts_un]/group"
- if {[llength [$root selectNodes $xp1]] < 1} {
- set xp1 "[spdAux::getRoute $parts_un]/condition/group"
- }
- foreach gNode [$root selectNodes $xp1] {
+
+ # iterate over the groups of the conditions
+ foreach gNode [$root selectNodes "$cnd_xpath/group"] {
+ # Group name
set group [get_domnode_attribute $gNode n]
+ # Condition name
set cond_id [get_domnode_attribute [$gNode parent] n]
- set sub_model_part [write::getSubModelPartId $cond_id $group]
- if {$model_part_name ne ""} {set sub_model_part $model_part_name.$sub_model_part}
- set sub_model_part [string trim $sub_model_part "."]
- if { [dict exists $mat_dict $group] } {
- set mid [dict get $mat_dict $group MID]
+ # We get the submodelpart name and the modelpart.submodelpart
+ set submodelpart_id [write::GetSubModelPartName $cond_id $group]
+ set submodelpart_fullname $submodelpart_id
+ if {$model_part_name ne ""} {set submodelpart_fullname $model_part_name.$submodelpart_id}
+ set submodelpart_id [string trim $submodelpart_id "."]
+ if { [dict exists $mat_dict $submodelpart_id] } {
+ set mid [dict get $mat_dict $submodelpart_id MID]
set prop_dict [dict create]
- dict set prop_dict "model_part_name" $sub_model_part
+ dict set prop_dict "model_part_name" $submodelpart_fullname
dict set prop_dict "properties_id" $mid
set constitutive_law_id ""
- if {[dict exists $mat_dict $group ConstitutiveLaw ]} {set constitutive_law_id [dict get $mat_dict $group ConstitutiveLaw]}
+ if {[dict exists $mat_dict $submodelpart_id ConstitutiveLaw ]} {
+ set constitutive_law_id [dict get $mat_dict $submodelpart_id ConstitutiveLaw]
+ }
set constitutive_law [Model::getConstitutiveLaw $constitutive_law_id]
- if {$constitutive_law ne ""} {
- set exclusionList [list "MID" "APPID" "ConstitutiveLaw" "Material" "Element"]
- set variables_dict [dict create]
- foreach prop [dict keys [dict get $mat_dict $group] ] {
- if {$prop ni $exclusionList} {
- dict set variables_list $prop [getFormattedValue [dict get $mat_dict $group $prop]]
- }
+
+ set variables_dict [dict create]
+ foreach prop [dict keys [dict get $mat_dict $submodelpart_id] ] {
+ if {$prop ni $exclusionList} {
+ dict set variables_dict $prop [getFormattedValue [dict get $mat_dict $submodelpart_id $prop]]
}
- set material_dict [dict create]
+ }
+ set material_dict [dict create]
- if {$write_claw_name eq "True"} {
- set constitutive_law_name [$constitutive_law getKratosName]
- dict set material_dict constitutive_law [dict create name $constitutive_law_name]
- }
- dict set material_dict Variables $variables_list
- dict set material_dict Tables dictnull
+ if {$constitutive_law ne "" && $write_claw_name eq "True"} {
+ set constitutive_law_name [$constitutive_law getKratosName]
+ dict set material_dict constitutive_law [dict create name $constitutive_law_name]
+ }
+ dict set material_dict Variables $variables_dict
+ dict set material_dict Tables dictnull
- dict set prop_dict Material $material_dict
+ dict set prop_dict Material $material_dict
- lappend props $prop_dict
- }
+ lappend props $prop_dict
+
}
}
dict set props_dict properties $props
return $props_dict
+}
+
+proc write::getPropertiesList {unique_name {write_claw_name "True"} {model_part_name ""}} {
+
+ set doc $gid_groups_conds::doc
+ set root [$doc documentElement]
+
+ set xp1 "[spdAux::getRoute $unique_name]"
+ if {[llength [$root selectNodes $xp1/group]] < 1} {
+ set xp1 "[spdAux::getRoute $unique_name]/condition"
+ }
+ return [write::getPropertiesListByConditionXPath $xp1 $write_claw_name $model_part_name]
}
\ No newline at end of file
diff --git a/kratos.gid/scripts/Writing/WriteNodes.tcl b/kratos.gid/scripts/Writing/WriteNodes.tcl
index 33e69b1bb..89c75b3e0 100644
--- a/kratos.gid/scripts/Writing/WriteNodes.tcl
+++ b/kratos.gid/scripts/Writing/WriteNodes.tcl
@@ -5,7 +5,12 @@ proc write::writeNodalCoordinatesOnGroups { groups } {
# Begin Nodes
# // id X Y Z
# End Nodes
+ # TODO: check gid version
+ set is_coordinates_scaling_fixed 0
if {[llength $groups] >0} {
+ set mesh_unit [gid_groups_conds::give_mesh_unit]
+ set mesh_factor [lindex [gid_groups_conds::give_unit_factor L $mesh_unit] 0]
+
variable formats_dict
set id_f [dict get $formats_dict ID]
set coord_f [dict get $formats_dict COORDINATE]
@@ -14,11 +19,25 @@ proc write::writeNodalCoordinatesOnGroups { groups } {
WriteString "${s}Begin Nodes"
incr ::write::current_mdpa_indent_level
- foreach group $groups {
- dict set formats $group "${s}$id_f $coord_f $coord_f $coord_f\n"
+ set s [mdpaIndent]
+ if {$is_coordinates_scaling_fixed} {
+ foreach group $groups {
+ dict set formats $group "${s}$id_f $coord_f $coord_f $coord_f\n"
+ }
+ # TODO: Add factor
+ GiD_WriteCalculationFile nodes $formats
+ } else {
+ foreach group $groups {
+ set nodes [GiD_EntitiesGroups get $group node]
+ foreach node $nodes {
+ lassign [GiD_Mesh get node $node coordinates] x y z
+ WriteString "${s}$node [expr $mesh_factor*$x] [expr $mesh_factor*$y] [expr $mesh_factor*$z]"
+ }
+ }
}
- GiD_WriteCalculationFile nodes $formats
+
incr ::write::current_mdpa_indent_level -1
+ set s [mdpaIndent]
WriteString "${s}End Nodes"
WriteString "\n"
}
diff --git a/kratos.gid/scripts/Writing/WriteProcess.tcl b/kratos.gid/scripts/Writing/WriteProcess.tcl
index 80c235b8e..8d8c5a905 100644
--- a/kratos.gid/scripts/Writing/WriteProcess.tcl
+++ b/kratos.gid/scripts/Writing/WriteProcess.tcl
@@ -24,7 +24,7 @@ proc write::GetRestartProcess { {un ""} {name "" } } {
dict set params "restart_file_label" $file_label
set output_control [getValue $un RestartControlType]
dict set params "output_control_type" $output_control
- if {$output_control eq "time"} {dict set params "output_frequency" [getValue $un RestartDeltaTime]} {dict set params "output_frequency" [getValue $un RestartDeltaStep]}
+ if {$output_control eq "time"} {dict set params "output_interval" [getValue $un RestartDeltaTime]} {dict set params "output_interval" [getValue $un RestartDeltaStep]}
set jsonoutput [write::getStringBinaryValue $un json_output]
dict set params "json_output" $jsonoutput
diff --git a/kratos.gid/scripts/Writing/WriteProjectParameters.tcl b/kratos.gid/scripts/Writing/WriteProjectParameters.tcl
index 35e3e6674..ef995179f 100644
--- a/kratos.gid/scripts/Writing/WriteProjectParameters.tcl
+++ b/kratos.gid/scripts/Writing/WriteProjectParameters.tcl
@@ -1,30 +1,7 @@
-
-# proc write::dict2json {dictVal} {
-# # XXX: Currently this API isn't symmetrical, as to create proper
-# # XXX: JSON text requires type knowledge of the input data
-# set json ""
-# dict for {key val} $dictVal {
-# # key must always be a string, val may be a number, string or
-# # bare word (true|false|null)
-# if {0 && ![string is double -strict $val] && ![regexp {^(?:true|false|null)$} $val]} {
-# set val "\"$val\""
-# }
-# if {[isDict $val]} {
-# set val [dict2json $val]
-# set val "\[${val}\]"
-# } else {
-# set val \"$val\"
-# }
-# append json "\"$key\": $val," \n
-# }
-# if {[string range $json end-1 end] eq ",\n"} {set json [string range $json 0 end-2]}
-# return "\{${json}\}"
-# }
-
-
package require json::write
+package require json
-proc write::json2dict {JSONtext} {
+proc write::json2dict_former {JSONtext} {
string range [
string trim [
string trimleft [
@@ -33,16 +10,20 @@ proc write::json2dict {JSONtext} {
]
] 1 end-1
}
+proc write::json2dict {JSONtext} {
+ return [::json::json2dict $JSONtext]
+}
proc write::tcl2json { value } {
# Guess the type of the value; deep *UNSUPPORTED* magic!
# display the representation of a Tcl_Obj for debugging purposes. Do not base the behavior of any command on the results of this one; it does not conform to Tcl's value semantics!
- regexp {^value is a (.*?) with a refcount} [::tcl::unsupported::representation $value] -> type
+ # regexp {^value is a (.*?) with a refcount} [::tcl::unsupported::representation $value] -> type
+ set type [GidUtils::GetInternalRepresentation $value]
if {$value eq ""} {return [json::write array {*}[lmap v $value {tcl2json $v}]]}
+ #if {$type ne "dict" && [llength $value]>1 && [string index $value 0] eq "\{"} { W "$value as list"; set type list}
+ #if {$type eq "exprcode"} {set type list; W "$type -> $value"}
switch $type {
string {
- if {$value eq "false"} {return [expr "false"]}
- if {$value eq "true"} {return [expr "true"]}
if {$value eq "null"} {return null}
if {$value eq "dictnull"} {return {{}}}
return [json::write string $value]
@@ -75,6 +56,51 @@ proc write::tcl2json { value } {
return [expr {$value}]
} elseif {[string is boolean -strict $value]} {
return [expr {$value ? "true" : "false"}]
+ } elseif {[string index $value 0] eq "\{"} {
+ return [json::write array {*}[lmap v $value {tcl2json $v}]]
+ }
+ return [json::write string $value]
+ }
+ }
+}
+
+proc write::tcl2jsonstrings { value } {
+ # Guess the type of the value; deep *UNSUPPORTED* magic!
+ # display the representation of a Tcl_Obj for debugging purposes. Do not base the behavior of any command on the results of this one; it does not conform to Tcl's value semantics!
+ regexp {^value is a (.*?) with a refcount} [::tcl::unsupported::representation $value] -> type
+ if {$value eq ""} {return [json::write array {*}[lmap v $value {tcl2jsonstrings $v}]]}
+ switch $type {
+ string {
+ if {$value eq "null"} {return null}
+ if {$value eq "dictnull"} {return {{}}}
+ return [json::write string $value]
+ }
+ dict {
+ return [json::write object {*}[
+ dict map {k v} $value {tcl2jsonstrings $v}]]
+ }
+ list {
+ return [json::write array {*}[lmap v $value {tcl2jsonstrings $v}]]
+ }
+ int - double {
+ return [json::write string $value]
+ }
+ booleanString {
+ return [json::write string $value]
+ #return [expr {$value ? "true" : "false"}]
+ }
+ default {
+ # Some other type; do some guessing...
+ if {$value eq "null"} {
+ # Tcl has *no* null value at all; empty strings are semantically
+ # different and absent variables aren't values. So cheat!
+ return $value
+ } elseif {[string is integer -strict $value]} {
+ return [json::write string $value]
+ } elseif {[string is double -strict $value]} {
+ return [json::write string $value]
+ } elseif {[string is boolean -strict $value]} {
+ return [json::write string $value]
}
return [json::write string $value]
}
@@ -84,6 +110,9 @@ proc write::tcl2json { value } {
proc write::WriteJSON {processDict} {
WriteString [write::tcl2json $processDict]
}
+proc write::WriteJSONAsStringFields {processDict} {
+ WriteString [write::tcl2jsonstrings $processDict]
+}
proc write::GetEmptyList { } {
# This is a gipsy code
@@ -144,8 +173,8 @@ proc write::getSolutionStrategyParametersDict { {solStratUN ""} {schemeUN ""} {S
set StratParamsUN [apps::getCurrentUniqueName StratParams]
}
- set solstratName [write::getValue $solStratUN]
- set schemeName [write::getValue $schemeUN]
+ set solstratName [write::getValue $solStratUN "" force]
+ set schemeName [write::getValue $schemeUN "" force]
set sol [::Model::GetSolutionStrategy $solstratName]
set sch [$sol getScheme $schemeName]
@@ -233,7 +262,7 @@ proc write::getConditionsParametersDict {un {condition_type "Condition"}} {
set process [::Model::GetProcess $processName]
set processDict [dict create]
set processWriteCommand [$process getAttribute write_command]
-
+
dict set processDict process_name $processName
if {$processWriteCommand eq ""} {
@@ -243,7 +272,7 @@ proc write::getConditionsParametersDict {un {condition_type "Condition"}} {
foreach {inputName in_obj} $process_parameters {
dict set processDict Parameters $inputName [write::GetInputValue $group $in_obj]
}
-
+
} else {
set processDict [$processWriteCommand $group $condition $process]
}
@@ -363,7 +392,7 @@ proc write::GetModelPartNameWithParent { child_name {forced_parent ""}} {
append parent $par "."
}
} else {
- append parent $forced_parent "."
+ append parent $forced_parent "."
}
append result $parent $child_name
return [string trim $result "."]
@@ -422,14 +451,16 @@ proc write::GetDefaultGiDOutput { {appid ""} } {
# Setup GiD-Output
set outputProcessParams [dict create]
dict set outputProcessParams model_part_name [write::GetModelPartNameWithParent [GetConfigurationAttribute output_model_part_name]]
- dict set outputProcessParams output_name $model_name
dict set outputProcessParams postprocess_parameters [write::GetDefaultOutputGiDDict $appid]
+ set folder_name [dict get $outputProcessParams postprocess_parameters folder_name]
+ dict unset outputProcessParams postprocess_parameters folder_name
+ dict set outputProcessParams output_name [file join $folder_name $model_name]
set outputConfigDict [dict create]
dict set outputConfigDict python_module gid_output_process
dict set outputConfigDict kratos_module KratosMultiphysics
dict set outputConfigDict process_name GiDOutputProcess
- dict set outputConfigDict help "This process writes postprocessing files for GiD"
+ # dict set outputConfigDict help "This process writes postprocessing files for GiD"
dict set outputConfigDict Parameters $outputProcessParams
return $outputConfigDict
@@ -451,8 +482,12 @@ proc write::GetDefaultOutputGiDDict { {appid ""} {gid_options_xpath ""} } {
dict set resultDict file_label [getValueByXPath $gid_options_xpath FileLabel]
set outputCT [getValueByXPath $gid_options_xpath OutputControlType]
dict set resultDict output_control_type $outputCT
- if {$outputCT eq "time"} {set frequency [getValueByXPath $gid_options_xpath OutputDeltaTime]} {set frequency [getValueByXPath $gid_options_xpath OutputDeltaStep]}
- dict set resultDict output_frequency $frequency
+ if {$outputCT eq "time"} {
+ set frequency [getValueByXPath $gid_options_xpath OutputDeltaTime]
+ } {
+ set frequency [getValueByXPath $gid_options_xpath OutputDeltaStep]
+ }
+ dict set resultDict output_interval $frequency
dict set resultDict body_output [getValueByXPath $gid_options_xpath BodyOutput]
dict set resultDict node_output [getValueByXPath $gid_options_xpath NodeOutput]
@@ -468,6 +503,8 @@ proc write::GetDefaultOutputGiDDict { {appid ""} {gid_options_xpath ""} } {
dict set outputDict "result_file_configuration" $resultDict
dict set outputDict "point_data_configuration" [GetEmptyList]
+
+ dict set outputDict folder_name [getValueByXPath $gid_options_xpath FolderName]
return $outputDict
}
@@ -481,7 +518,7 @@ proc write::GetDefaultVTKOutput { {appid ""} } {
dict set outputConfigDictVtk python_module vtk_output_process
dict set outputConfigDictVtk kratos_module KratosMultiphysics
dict set outputConfigDictVtk process_name VtkOutputProcess
- dict set outputConfigDictVtk help "This process writes postprocessing files for Paraview"
+ #dict set outputConfigDictVtk help "This process writes postprocessing files for Paraview"
dict set outputConfigDictVtk Parameters [write::GetDefaultParametersOutputVTKDict $appid]
return $outputConfigDictVtk
@@ -498,11 +535,11 @@ proc write::GetDefaultParametersOutputVTKDict { {appid ""} } {
set outputCT [getValueByXPath $vtk_options_xpath OutputControlType]
dict set resultDict output_control_type $outputCT
if {$outputCT eq "time"} {set frequency [getValueByXPath $vtk_options_xpath OutputDeltaTime]} {set frequency [getValueByXPath $vtk_options_xpath OutputDeltaStep]}
- dict set resultDict output_frequency $frequency
+ dict set resultDict output_interval $frequency
dict set resultDict file_format [getValueByXPath $vtk_options_xpath VtkFileFormat]
dict set resultDict output_precision 7
dict set resultDict output_sub_model_parts "false"
- dict set resultDict folder_name "vtk_output"
+ dict set resultDict output_path "vtk_output"
dict set resultDict save_output_files_in_folder "true"
dict set resultDict nodal_solution_step_data_variables [GetResultsList $results_UN OnNodes]
dict set resultDict nodal_data_value_variables [list ]
@@ -522,3 +559,27 @@ proc write::GetDefaultRestartDict { } {
dict set restartDict Restart_Step 0
return $restartDict
}
+
+proc write::GetTimeStepIntervals { {time_parameters_un ""} } {
+ if {$time_parameters_un eq ""} {set time_parameters_un [GetConfigurationAttribute time_parameters_un]}
+ set root [customlib::GetBaseRoot]
+
+ set xp "[spdAux::getRoute $time_parameters_un]/container\[@n = 'TimeStep'\]/blockdata"
+ set time_step_interval_nodes [$root selectNodes $xp]
+
+ # If the app is still working on fixed Delta time
+ if {[llength $time_step_interval_nodes] eq 0} {return [write::getValue $time_parameters_un DeltaTime]}
+
+ # If it works with interval delta time
+ set time_step_intervals_list [list ]
+ foreach time_step_interval_node $time_step_interval_nodes {
+ set time_step_interval_start_time [write::getValueByNode [$time_step_interval_node find n StartTime]]
+ set time_step_interval_delta_time [write::getValueByNode [$time_step_interval_node find n DeltaTime]]
+
+ set key_value [list $time_step_interval_start_time $time_step_interval_delta_time]
+ lappend time_step_intervals_list $key_value
+ }
+
+ set time_step_intervals_list [lsort -real -index 0 $time_step_intervals_list]
+ return $time_step_intervals_list
+}
\ No newline at end of file
diff --git a/kratos.gid/scripts/Writing/WriteSubModelPart.tcl b/kratos.gid/scripts/Writing/WriteSubModelPart.tcl
index 6c8c97263..3cc6c37ab 100644
--- a/kratos.gid/scripts/Writing/WriteSubModelPart.tcl
+++ b/kratos.gid/scripts/Writing/WriteSubModelPart.tcl
@@ -8,12 +8,9 @@ proc write::writeGroupSubModelPart { cid group {what "Elements"} {iniend ""} {ta
set mid ""
set what [split $what "&"]
set group [GetWriteGroupName $group]
- if {![dict exists $submodelparts [list $cid ${group}]]} {
+ if {[write::getSubModelPartId $cid $group] eq 0} {
# Add the submodelpart to the catalog
- set good_name [write::transformGroupName $group]
- set mid "${cid}_${good_name}"
- dict set submodelparts [list $cid ${group}] $mid
-
+ set mid [write::AddSubmodelpart $cid $group]
# Prepare the print formats
incr ::write::current_mdpa_indent_level
set s1 [mdpaIndent]
@@ -163,3 +160,30 @@ proc write::GetSubModelPartFromCondition { base_UN condition_id } {
}
return $submodelpart_list
}
+
+proc write::GetSubModelPartName {condid group} {
+ set group_name [write::GetWriteGroupName $group]
+ set good_name [write::transformGroupName $group_name]
+ return "${condid}_${good_name}"
+}
+
+proc write::AddSubmodelpart {condid group} {
+ variable submodelparts
+ set mid [write::GetSubModelPartName $condid $group]
+ set group_name [write::GetWriteGroupName $group]
+ set good_name [write::transformGroupName $group_name]
+ if {[write::getSubModelPartId $condid $group_name] eq 0} {
+ dict set submodelparts [list $condid ${group_name}] $mid
+ }
+ return $mid
+}
+
+proc write::getSubModelPartId {cid group} {
+ variable submodelparts
+ set find [list $cid ${group}]
+ if {[dict exists $submodelparts $find]} {
+ return [dict get $submodelparts [list $cid ${group}]]
+ } {
+ return 0
+ }
+}
\ No newline at end of file
diff --git a/kratos.gid/scripts/Writing/Writing.tcl b/kratos.gid/scripts/Writing/Writing.tcl
index 9966bb4e5..cc7e97d3a 100644
--- a/kratos.gid/scripts/Writing/Writing.tcl
+++ b/kratos.gid/scripts/Writing/Writing.tcl
@@ -1,656 +1,715 @@
-
-##################################################################################
-# This file is common for all Kratos Applications.
-# Do not change anything here unless it's strictly necessary.
-##################################################################################
-
-namespace eval write {
- variable mat_dict
- variable submodelparts
- variable MDPA_loop_control
- variable current_configuration
- variable current_mdpa_indent_level
- variable formats_dict
-}
-
-proc write::Init { } {
- variable mat_dict
- variable submodelparts
- variable current_configuration
- variable current_mdpa_indent_level
-
- set current_configuration [dict create]
-
- set mat_dict ""
- set submodelparts [dict create]
-
- SetConfigurationAttribute dir ""
- SetConfigurationAttribute parts_un ""
- SetConfigurationAttribute materials_un ""
- SetConfigurationAttribute time_monitor 0
- SetConfigurationAttribute model_name ""
-
- variable MDPA_loop_control
- set MDPA_loop_control 0
-
- set current_mdpa_indent_level 0
-
-
- variable formats_dict
- set formats_dict [dict create]
-}
-
-proc write::initWriteConfiguration {configuration} {
- SetConfigurationAttributes $configuration
- variable MDPA_loop_control
- set MDPA_loop_control 0
-
- processMaterials
-}
-
-proc write::initWriteData {parts mats} {
- set configutation [dict create]
- dict set configuration parts_un $parts
- dict set configuration materials_un $mats
-
- initWriteConfiguration $configuration
-}
-
-proc write::GetConfigurationAttribute {att} {
- variable current_configuration
- set ret ""
- if {[dict exists $current_configuration $att]} {
- set ret [dict get $current_configuration $att]
- }
- return $ret
-
-}
-
-proc write::SetConfigurationAttribute {att val} {
- variable current_configuration
- dict set current_configuration $att $val
-}
-
-proc write::SetConfigurationAttributes {configuration} {
- variable current_configuration
- set current_configuration [dict merge $current_configuration $configuration]
-}
-
-proc write::AddConfigurationAttribute {att val} {
- variable current_configuration
- dict append current_configuration $att $val]
-}
-
-# Write Events
-proc write::writeEvent { filename } {
- update ;#else appid is empty running in batch mode with window
- set time_monitor [GetConfigurationAttribute time_monitor]
- customlib::UpdateDocument
- SetConfigurationAttribute dir [file dirname $filename]
- SetConfigurationAttribute model_name [file rootname [file tail $filename]]
-
- set errcode 0
- set fail [::Kratos::CheckValidProjectName [file rootname $filename]]
-
- if {$fail} {
- W [= "Wrong project name. Avoid boolean and numeric names."]
- return 1
- }
- if {$time_monitor} {set inittime [clock seconds]}
-
- # Set write formats depending on the user's configuration
- InitWriteFormats
-
- # Current active app
- set activeapp [::apps::getActiveApp]
- set appid [::apps::getActiveAppId]
-
- #### Force values update ####
- spdAux::ForceTreePreload
-
- #### Validate ####
- set errcode [writeValidateInApp $appid]
-
- #### MDPA Write ####
- if {$errcode eq 0} {
- set errcode [writeAppMDPA $appid]
- }
- #### Project Parameters Write ####
- set wevent [$activeapp getWriteParametersEvent]
- set filename "ProjectParameters.json"
-
- if {$errcode eq 0} {
- set errcode [write::singleFileEvent $filename $wevent "Project Parameters"]
- }
-
- #### Custom files block ####
- set wevent [$activeapp getWriteCustomEvent]
- set filename ""
- if {$errcode eq 0} {
- set errcode [write::singleFileEvent $filename $wevent "Custom file" 0]
- }
- if {$time_monitor} {
- set endtime [clock seconds]
- set ttime [expr {$endtime-$inittime}]
- W "Total time: [Duration $ttime]"
- }
- return $errcode
-}
-
-proc write::writeValidateInApp {appid} {
- set activeapp [::apps::getAppById $appid]
- set wevent ::[$activeapp getValidateWriteEvent]
- set errcode 0
- if {[info procs $wevent] eq $wevent} {
- set err [eval $wevent]
- set errcode [lindex $err 0]
- set errmess [lindex $err 1]
- if {$errcode} {
- foreach line $errmess {
- W $line
- }
- }
- }
- return $errcode
-}
-
-proc write::singleFileEvent { filename wevent {errName ""} {needsOpen 1} } {
- set errcode 0
-
- CloseFile
- if {$needsOpen} {OpenFile $filename}
- if {$::Kratos::kratos_private(DevMode) eq "dev"} {
- if {[catch {eval $wevent} errmsg options] } {
- W $::errorInfo
- set errcode 1
- }
- } else {
- if {[catch {eval $wevent} fid] } {
- W "Problem Writing $errName block:\n$fid\nEvent $wevent \nEnd problems"
- set errcode 1
- }
- }
- CloseFile
-
- return $errcode
-}
-
-proc write::writeAppMDPA {appid} {
- variable MDPA_loop_control
- incr MDPA_loop_control
- if {$MDPA_loop_control > 10} {error [= "Infinite loop on MDPA - Check recursive or cyclic calls"]}
-
- set errcode 0
- set activeapp [::apps::getAppById $appid]
-
- #### MDPA Write ####
- set wevent [$activeapp getWriteModelPartEvent]
- set filename "[Kratos::GetModelName].mdpa"
-
- CloseFile
- OpenFile $filename
-
- if {$::Kratos::kratos_private(DevMode) eq "dev"} {
- eval $wevent
- } else {
- if { [catch {eval $wevent} fid] } {
- W "Problem Writing MDPA block:\n$fid\nEnd problems"
- set errcode 1
- }
- }
- CloseFile
- return $errcode
-}
-
-proc write::GetWriteGroupName { group_id } {
- # Interval trick
- # If a group is child, and has been created due to the Interval issue
- # it's entities are on the father, so we need to use it's fathers name
- foreach parent [dict keys $spdAux::GroupsEdited] {
- if {$group_id in [dict get $spdAux::GroupsEdited $parent]} {
- set group_id $parent
- break
- }
- }
- return $group_id
-}
-
-proc write::GetListsOfNodes {elems nnodes {ignore 0} } {
- set obj [list ]
- set imax [llength $elems]
- if {$nnodes eq 0} {return $obj}
- set i 0
- while {$i < $imax} {
- for {set j 0} {$j < $ignore} {incr j} {incr i; if {$i >= $imax} {return $obj}}
- set tmp [list ]
- for {set j 0} {$j < $nnodes} {incr j} {
- if {$i >= $imax} {break}
- lappend tmp [lindex $elems $i]
- incr i
- }
- lappend obj $tmp
- }
- return $obj
-}
-
-proc write::getSubModelPartId {cid group} {
- variable submodelparts
-
- set find [list $cid ${group}]
- if {[dict exists $submodelparts $find]} {
- return [dict get $submodelparts [list $cid ${group}]]
- } {
- return 0
- }
-}
-
-proc write::transformGroupName {groupid} {
- set new_parts [list ]
- foreach part [GidUtils::Split $groupid "//"] {
- foreach {bad good} {" " "_"} {
- lappend new_parts [string map [list $bad $good] $part]
- }
- }
- return [join $new_parts /]
-}
-
-# Warning! Indentation must be set before calling here!
-proc write::GetFormatDict { groupid mid num} {
- variable formats_dict
- set id_f [dict get $formats_dict ID]
- set mid_f [dict get $formats_dict MAT_ID]
-
- set s [mdpaIndent]
- set f "${s}$id_f [format $mid_f $mid] [string repeat "$id_f " $num]\n"
- return [dict create $groupid $f]
-}
-
-proc write::getEtype {ov group} {
- set isquadratic [isquadratic]
- set ret [list "" ""]
- set b 0
- if {$ov eq "point"} {
- if {$b} {error "Multiple element types in $group over $ov"}
- set ret [list "Point" 1]
- set b 1
- }
-
- if {$ov eq "line"} {
- if {$b} {error "Multiple element types in $group over $ov"}
- switch $isquadratic {
- 0 { set ret [list "Linear" 2] }
- default { set ret [list "Linear" 3] }
- }
- }
-
- if {$ov eq "surface"} {
- if {[GiD_EntitiesGroups get $group elements -count -element_type Triangle]} {
- if {$b} {error "Multiple element types in $group over $ov"}
- switch $isquadratic {
- 0 { set ret [list "Triangle" 3] }
- default { set ret [list "Triangle" 6] }
- }
- set b 1
- }
- if {[GiD_EntitiesGroups get $group elements -count -element_type Quadrilateral]} {
- if {$b} {error "Multiple element types in $group over $ov"}
- switch $isquadratic {
- 0 { set ret [list "Quadrilateral" 4] }
- 1 { set ret [list "Quadrilateral" 8] }
- 2 { set ret [list "Quadrilateral" 9] }
- }
- set b 1
- }
- if {[GiD_EntitiesGroups get $group elements -count -element_type Circle]} {
- if {$b} {error "Multiple element types in $group over $ov"}
- switch $isquadratic {
- 0 { set ret [list "Circle" 1] }
- }
- set b 1
- }
- }
-
- if {$ov eq "volume"} {
- if {[GiD_EntitiesGroups get $group elements -count -element_type Tetrahedra]} {
- if {$b} {error "Multiple element types in $group over $ov"}
- switch $isquadratic {
- 0 { set ret [list "Tetrahedra" 4] }
- 1 { set ret [list "Tetrahedra" 10] }
- 2 { set ret [list "Tetrahedra" 10] }
- }
- set b 1
- }
- if {[GiD_EntitiesGroups get $group elements -count -element_type Hexahedra]} {
- if {$b} {error "Multiple element types in $group over $ov"}
- switch $isquadratic {
- 0 { set ret [list "Hexahedra" 8] }
- 1 { set ret [list "Hexahedra" 20] }
- 2 { set ret [list "Hexahedra" 27] }
- }
- set b 1
- }
- if {[GiD_EntitiesGroups get $group elements -count -element_type Prism]} {
- if {$b} {error "Multiple element types in $group over $ov"}
- switch $isquadratic {
- 0 { set ret [list "Hexahedra" 6] }
- 1 { set ret [list "Hexahedra" 1] }
- 2 { set ret [list "Hexahedra" 27] }
- }
- set b 1
- }
- if {[GiD_EntitiesGroups get $group elements -count -element_type Sphere]} {
- if {$b} {error "Multiple element types in $group over $ov"}
- switch $isquadratic {
- 0 { set ret [list "Sphere" 1] }
- }
- set b 1
- }
- }
-
- return $ret
-}
-proc write::isquadratic {} {
- return [GiD_Set Model(QuadraticType)]
-}
-
-proc write::GetNodesFromElementFace {elem_id face_id} {
- set inf [GiD_Mesh get element $elem_id]
- set elem_type [lindex $inf 1]
- set nnodes [lindex $inf 2]
- set nodes [list ]
- switch $elem_type {
- Tetrahedra {
- set matrix {{1 2 3 5 6 7} {2 4 3 9 10 6} {3 4 1 10 8 7} {4 2 1 9 5 8}}
- }
- Triangle {
- set matrix {{1 2 4} {2 3 5} {3 1 6}}
- }
- }
- # Decrementamos porque la cara con id = i corresponde a la posicion i-1 de la matriz
- incr face_id -1
- set face_matrix [lindex $matrix $face_id]
- foreach node_index $face_matrix {
- set node [lindex $inf [expr $node_index +2]]
- if {$node ne ""} {lappend nodes $node}
- }
- #W "eid $elem_id fid $face_id nds $nodes"
- return $nodes
-}
-
-proc write::getPartsGroupsId {{what "name"} } {
- set root [customlib::GetBaseRoot]
-
- set listOfGroups [list ]
- set xp1 "[spdAux::getRoute [GetConfigurationAttribute parts_un]]/group"
- if {[llength [$root selectNodes $xp1]] < 1} {
- set xp1 "[spdAux::getRoute [GetConfigurationAttribute parts_un]]/condition/group"
- }
- set groups [$root selectNodes $xp1]
-
- foreach group $groups {
- if {$what eq "node"} {
- lappend listOfGroups $group
- } else {
- set groupName [get_domnode_attribute $group n]
- lappend listOfGroups $groupName
- }
- }
- return $listOfGroups
-}
-
-proc write::getPartsSubModelPartId {} {
- set root [customlib::GetBaseRoot]
-
- set listOfGroups [list ]
-
- foreach group [getPartsGroupsId node] {
- set cnd_id [get_domnode_attribute [$group parent] n]
- set group_name [get_domnode_attribute $group n]
- lappend listOfGroups [write::getSubModelPartId $cnd_id $group_name]
- }
- return $listOfGroups
-}
-
-proc write::writePartSubModelPart { } {
- foreach group [getPartsGroupsId node] {
- set part_name [get_domnode_attribute [$group parent] n]
- set group_name [get_domnode_attribute $group n]
- writeGroupSubModelPart $part_name $group_name "Elements"
- }
-}
-
-proc write::writeLinearLocalAxesGroup {group} {
- variable formats_dict
- set id_f [dict get $formats_dict ID]
- set coord_f [dict get $formats_dict COORDINATE]
- set elements [GiD_EntitiesGroups get $group elements -element_type linear]
- set num_elements [objarray length $elements]
- if {$num_elements} {
- write::WriteString "Begin ElementalData LOCAL_AXIS_2 // Groups: $group"
- for {set i 0} {$i < $num_elements} {incr i} {
- set line [objarray get $elements $i]
- set raw [lindex [lindex [GiD_Info conditions -localaxesmat line_Local_axes mesh $line] 0] 3]
- set y0 [lindex $raw 1]
- set y1 [lindex $raw 4]
- set y2 [lindex $raw 7]
- write::WriteString [format "$id_f \[3\]($coord_f, $coord_f, $coord_f)" $line $y0 $y1 $y2]
- }
- write::WriteString "End ElementalData"
- write::WriteString ""
- }
- return $num_elements
-}
-
-proc write::SetParallelismConfiguration {{un "Parallelization"} {n "OpenMPNumberOfThreads"}} {
- set nt 0
- set paralleltype [write::getValue ParallelType]
- if {$paralleltype eq "OpenMP"} {
- catch {set nt [write::getValue $un $n]}
- if {$nt} {write::SetEnvironmentVariable OMP_NUM_THREADS $nt} {return 0}
- } else {
- write::SetEnvironmentVariable OMP_NUM_THREADS 1
- WriteMPIbatFile $un
- }
-}
-
-proc write::SetEnvironmentVariable {name value} {
- set ::env($name) $value
-}
-
-proc write::WriteMPIbatFile {un} {
- # MPINumberOfProcessors
- set dir $::Kratos::kratos_private(Path)
- set model_dir [GetConfigurationAttribute dir]
- set model_name [GetConfigurationAttribute model_name]
- set num_nodes [write::getValue $un MPINumberOfProcessors]
-
- set fd [GiD_File fopen [file join $model_dir "MPILauncher.sh"]]
- GiD_File fprintf $fd %s "export LD_LIBRARY_PATH=\"$dir/exec/Kratos\":\"$dir/exec/Kratos/libs\""
- GiD_File fprintf $fd %s "export PYTHONPATH=\"$dir/exec/Kratos/python35.zip\":\"$dir/exec/Kratos\":\$PYTHONPATH"
- GiD_File fprintf $fd %s "export OMP_NUM_THREADS=1"
- GiD_File fprintf $fd %s "# Run Python using the script MainKratos.py"
- GiD_File fprintf $fd %s "mpirun --np $num_nodes \"$dir/exec/Kratos/runkratos\" MainKratos.py > \"$model_dir/$model_name.info\" 2> \"$model_dir/$model_name.err\""
- GiD_File fclose $fd
-}
-
-proc write::Duration { int_time } {
- set timeList [list]
- foreach div {86400 3600 60 1} mod {0 24 60 60} name {day hr min sec} {
- set n [expr {$int_time / $div}]
- if {$mod > 0} {set n [expr {$n % $mod}]}
- if {$n > 1} {
- lappend timeList "$n ${name}s"
- } elseif {$n == 1} {
- lappend timeList "$n $name"
- }
- }
- return [join $timeList]
-}
-
-proc write::forceUpdateNode {node} {
- catch {get_domnode_attribute $node dict}
- catch {get_domnode_attribute $node values}
- catch {get_domnode_attribute $node value}
- catch {get_domnode_attribute $node state}
-}
-proc write::getValueByNode { node {what noforce} } {
- if {[get_domnode_attribute $node v] eq "" || $what eq "force"} {
- write::forceUpdateNode $node
- }
- return [getFormattedValue [get_domnode_attribute $node v]]
-}
-proc write::getValueByXPath { xpath { it "" }} {
- set root [customlib::GetBaseRoot]
- set node [$root selectNodes $xpath]
- if {$node ne ""} {
- if {$it ne ""} {set node [$node find n $it]}
- return [write::getValueByNode $node]
- }
- return ""
-}
-proc write::getValue { name { it "" } {what noforce} } {
- set root [customlib::GetBaseRoot]
-
- set xp [spdAux::getRoute $name]
- set node [$root selectNodes $xp]
- if {$node ne ""} {
- if {$it ne ""} {set node [$node find n $it]}
- if {$what eq "force"} {write::forceUpdateNode $node}
- return [getValueByNode $node]
- } {
- return ""
- }
-}
-
-# anything containing the comma character is a list
-proc write::getFormattedValue {value} {
- set v ""
- if {[string first , $value] != -1} {
- set v [list ]
- foreach part [split $value ,] {
- lappend v [getFormattedValue $part]
- }
- } else {
- catch {set v [expr $value]}
- if {$v eq "" } {set v $value}
- }
- return $v
-}
-
-proc write::isBoolean {value} {
- set goodList [list "Yes" "1" "yes" "ok" "YES" "Ok" "OK" "True" "TRUE" "true" "No" "0" "no" "NO" "False" "FALSE" "false"]
- if {$value in $goodList} {return 1} {return 0}
-}
-proc write::isBooleanTrue {value} {
- set goodList [list "Yes" "1" "yes" "ok" "YES" "Ok" "OK" "True" "TRUE" "true"]
- if {$value in $goodList} {return 1} {return 0}
-}
-proc write::isBooleanFalse {value} {
- set goodList [list "No" "0" "no" "NO" "False" "FALSE" "false"]
- if {$value in $goodList} {return 1} {return 0}
-}
-
-proc write::getStringBinaryValue { name { it "" } } {
- set v [getValue $name $it]
- return [write::getStringBinaryFromValue $v]
-}
-proc write::getStringBinaryFromValue {v} {
- set goodList [list "Yes" "1" "yes" "ok" "YES" "Ok" "OK" "True" "TRUE" "true"]
- if {$v in $goodList} {return "true" } {return "false"}
-}
-
-proc write::OpenFile { fn } {
- set dir [GetConfigurationAttribute dir]
- set filename [file join $dir $fn]
- CloseFile
- customlib::InitWriteFile $filename
-}
-
-proc write::CloseFile { } {
- customlib::EndWriteFile
-}
-
-proc write::WriteString {str} {
- GiD_WriteCalculationFile puts [format "%s" $str]
-}
-
-proc write::getMatDict {} {
- variable mat_dict
- return $mat_dict
-}
-proc write::setMatDict {matdict} {
- variable mat_dict
- set mat_dict $matdict
-}
-
-proc write::isDict {value} {
- return [expr {[string is list $value] && ([llength $value]&1) == 0}]
-}
-
-proc write::getSpacing {number} {
- set r ""
- for {set i 0} {$i<$number} {incr i} {append r " "}
- return $r
-}
-proc write::mdpaIndent { {b 4} } {
- variable current_mdpa_indent_level
- if {[info exists Kratos::kratos_private(mdpa_format)]} {
- if {$Kratos::kratos_private(mdpa_format) == 0} {
- return ""
- }
- }
- string repeat [string repeat " " $b] $current_mdpa_indent_level
-}
-
-# Sets the precission for the diffetent entities written in the mdpa
-# To customize the formats and precissions for your mdpa.
-# You can edit in your write mdpa event script using write::SetWriteFormatFor
-proc write::InitWriteFormats { } {
- if {$::Kratos::kratos_private(mdpa_format) == 1} {
- # Readable
- write::SetWriteFormatFor ID "%5d"
- write::SetWriteFormatFor CONNECTIVITY "%10d"
- write::SetWriteFormatFor MAT_ID "%10d"
- write::SetWriteFormatFor COORDINATE "%14.10f"
- } else {
- # Optimized
- write::SetWriteFormatFor ID "%d"
- write::SetWriteFormatFor CONNECTIVITY "%d"
- write::SetWriteFormatFor MAT_ID "%d"
- write::SetWriteFormatFor COORDINATE "%.10f"
- }
-}
-
-proc write::SetWriteFormatFor { what format } {
- variable formats_dict
- dict set formats_dict $what $format
-}
-
-proc write::CopyFileIntoModel { filepath } {
- set dir [GetConfigurationAttribute dir]
- set activeapp [::apps::getActiveApp]
- set inidir [apps::getMyDir [$activeapp getName]]
- set totalpath [file join $inidir $filepath]
- file copy -force $totalpath $dir
-}
-proc write::RenameFileInModel { src target } {
- set dir [GetConfigurationAttribute dir]
- set srcfile [file join $dir $src]
- set tgtfile [file join $dir $target]
- file rename -force $srcfile $tgtfile
-}
-
-proc write::WriteAssignedValues {condNode} {
- set assignedVector [list 1 0 1]
- set valuesVector [list 0.0 null 0.0]
-
- for {set i 0} {$i<3} {incr i} {
- set assigned [lindex $assignedVector $i]
- if {!$assigned} {set assignedVector [lreplace $assignedVector $i $i null]}
- }
- set ret [dict create value $valuesVector]
- return $ret
-}
-
-
-write::Init
+
+##################################################################################
+# This file is common for all Kratos Applications.
+# Do not change anything here unless it's strictly necessary.
+##################################################################################
+
+namespace eval ::write {
+ Kratos::AddNamespace [namespace current]
+
+ variable mat_dict
+ variable submodelparts
+ variable MDPA_loop_control
+ variable current_configuration
+ variable current_mdpa_indent_level
+ variable formats_dict
+ variable properties_exclusion_list
+}
+
+proc write::Init { } {
+ variable mat_dict
+ variable submodelparts
+ variable current_configuration
+ variable current_mdpa_indent_level
+
+ set current_configuration [dict create]
+
+ set mat_dict ""
+ set submodelparts [dict create]
+
+ SetConfigurationAttribute dir ""
+ SetConfigurationAttribute parts_un ""
+ SetConfigurationAttribute materials_un ""
+ SetConfigurationAttribute time_monitor 0
+ SetConfigurationAttribute model_name ""
+
+ variable MDPA_loop_control
+ set MDPA_loop_control 0
+
+ set current_mdpa_indent_level 0
+
+
+ variable formats_dict
+ set formats_dict [dict create]
+ variable properties_exclusion_list
+ set properties_exclusion_list [list "MID" "APPID" "ConstitutiveLaw" "Material" "Element"]
+}
+
+proc write::initWriteConfiguration {configuration} {
+ SetConfigurationAttributes $configuration
+ variable MDPA_loop_control
+ set MDPA_loop_control 0
+
+ processMaterials
+}
+
+proc write::initWriteData {parts mats} {
+ set configutation [dict create]
+ dict set configuration parts_un $parts
+ dict set configuration materials_un $mats
+
+ initWriteConfiguration $configuration
+}
+
+proc write::GetConfigurationAttribute {att} {
+ variable current_configuration
+ set ret ""
+ if {[dict exists $current_configuration $att]} {
+ set ret [dict get $current_configuration $att]
+ }
+ return $ret
+
+}
+
+proc write::SetConfigurationAttribute {att val} {
+ variable current_configuration
+ dict set current_configuration $att $val
+}
+
+proc write::SetConfigurationAttributes {configuration} {
+ variable current_configuration
+ set current_configuration [dict merge $current_configuration $configuration]
+}
+
+proc write::AddConfigurationAttribute {att val} {
+ variable current_configuration
+ dict append current_configuration $att $val]
+}
+
+# Write Events
+proc write::writeEvent { filename } {
+ update ;#else appid is empty running in batch mode with window
+ set time_monitor [GetConfigurationAttribute time_monitor]
+ Kratos::Log "Write start $filename"
+ customlib::UpdateDocument
+ SetConfigurationAttribute dir [file dirname $filename]
+ SetConfigurationAttribute model_name [file rootname [file tail $filename]]
+
+ set errcode 0
+ set fail [::Kratos::CheckValidProjectName [file rootname $filename]]
+
+ if {$fail} {
+ W [= "Wrong project name. Avoid boolean and numeric names."]
+ return 1
+ }
+ set inittime [clock seconds]
+
+ # Set write formats depending on the user's configuration
+ InitWriteFormats
+
+ # Current active app
+ set activeapp [::apps::getActiveApp]
+ set appid [::apps::getActiveAppId]
+
+ #### Force values update ####
+ spdAux::ForceTreePreload
+
+ #### Validate ####
+ Kratos::Log "Write validation $appid"
+ set errcode [writeValidateInApp $appid]
+
+
+ set endtime [clock seconds]
+ set ttime [expr {$endtime-$inittime}]
+ if {$time_monitor} {
+ W "Validate time: [Kratos::Duration $ttime]"
+ }
+
+ #### MDPA Write ####
+ if {$errcode eq 0} {
+ Kratos::Log "Write MDPA $appid"
+ set errcode [writeAppMDPA $appid]
+ }
+
+
+ set endtime [clock seconds]
+ set ttime [expr {$endtime-$inittime}]
+ if {$time_monitor} {
+ W "MDPA time: [Kratos::Duration $ttime]"
+ }
+
+ #### Project Parameters Write ####
+ set wevent [$activeapp getWriteParametersEvent]
+ set filename "ProjectParameters.json"
+
+ if {$errcode eq 0} {
+ Kratos::Log "Write project parameters $appid"
+ set errcode [write::singleFileEvent $filename $wevent "Project Parameters"]
+ }
+
+ set endtime [clock seconds]
+ set ttime [expr {$endtime-$inittime}]
+ if {$time_monitor} {
+ W "Parameters time: [Kratos::Duration $ttime]"
+ }
+
+ #### Custom files block ####
+ set wevent [$activeapp getWriteCustomEvent]
+ set filename ""
+ if {$errcode eq 0} {
+ Kratos::Log "Write custom event $appid"
+ set errcode [write::singleFileEvent $filename $wevent "Custom file" 0]
+ }
+ set endtime [clock seconds]
+ set ttime [expr {$endtime-$inittime}]
+ if {$time_monitor} {
+ W "Total time: [Kratos::Duration $ttime]"
+ }
+
+ #### Copy main script file ####
+ if {$errcode eq 0} {
+ Kratos::Log "Write custom event $appid"
+ set errcode [CopyMainScriptFile]
+ }
+
+ #### Debug files for VSCode ####
+ write::writeLaunchJSONFile
+
+ Kratos::Log "Write end $appid in [Kratos::Duration $ttime]"
+ return $errcode
+}
+
+proc write::writeValidateInApp {appid} {
+ set activeapp [::apps::getAppById $appid]
+ set wevent ::[$activeapp getValidateWriteEvent]
+ set errcode 0
+ if {[info procs $wevent] eq $wevent} {
+ set err [eval $wevent]
+ set errcode [lindex $err 0]
+ set errmess [lindex $err 1]
+ if {$errcode} {
+ foreach line $errmess {
+ W $line
+ }
+ }
+ }
+ return $errcode
+}
+
+proc write::singleFileEvent { filename wevent {errName ""} {needsOpen 1} } {
+ set errcode 0
+
+ CloseFile
+ if {$needsOpen} {OpenFile $filename}
+ if {[Kratos::IsDeveloperMode]} {
+ if {[catch {eval $wevent} errmsg options] } {
+ W $::errorInfo
+ set errcode 1
+ }
+ } else {
+ if {[catch {eval $wevent} fid] } {
+ W "Problem Writing $errName block:\n$fid\nEvent $wevent \nEnd problems"
+ set errcode 1
+ }
+ }
+ CloseFile
+
+ return $errcode
+}
+
+proc write::writeAppMDPA {appid} {
+ variable MDPA_loop_control
+ incr MDPA_loop_control
+ if {$MDPA_loop_control > 10} {error [= "Infinite loop on MDPA - Check recursive or cyclic calls"]}
+
+ set errcode 0
+ set activeapp [::apps::getAppById $appid]
+
+ #### MDPA Write ####
+ set wevent [$activeapp getWriteModelPartEvent]
+ set filename "[Kratos::GetModelName].mdpa"
+
+ CloseFile
+ OpenFile $filename
+
+ if {[Kratos::IsDeveloperMode]} {
+ eval $wevent
+ } else {
+ if { [catch {eval $wevent} fid] } {
+ W "Problem Writing MDPA block:\n$fid\nEnd problems"
+ set errcode 1
+ }
+ }
+ CloseFile
+ return $errcode
+}
+
+proc write::GetWriteGroupName { group_id } {
+ # Interval trick
+ # If a group is child, and has been created due to the Interval issue
+ # it's entities are on the father, so we need to use it's fathers name
+ foreach parent [dict keys $spdAux::GroupsEdited] {
+ if {$group_id in [dict get $spdAux::GroupsEdited $parent]} {
+ set group_id $parent
+ break
+ }
+ }
+ return $group_id
+}
+
+proc write::GetListsOfNodes {elems nnodes {ignore 0} } {
+ set obj [list ]
+ set imax [llength $elems]
+ if {$nnodes eq 0} {return $obj}
+ set i 0
+ while {$i < $imax} {
+ for {set j 0} {$j < $ignore} {incr j} {incr i; if {$i >= $imax} {return $obj}}
+ set tmp [list ]
+ for {set j 0} {$j < $nnodes} {incr j} {
+ if {$i >= $imax} {break}
+ lappend tmp [lindex $elems $i]
+ incr i
+ }
+ lappend obj $tmp
+ }
+ return $obj
+}
+
+
+proc write::transformGroupName {groupid} {
+ set new_parts [list ]
+ foreach part [GidUtils::Split $groupid "//"] {
+ foreach {bad good} {" " "_"} {
+ lappend new_parts [string map [list $bad $good] $part]
+ }
+ }
+ return [join $new_parts -]
+}
+
+# Warning! Indentation must be set before calling here!
+proc write::GetFormatDict { groupid mid num} {
+ variable formats_dict
+ set id_f [dict get $formats_dict ID]
+ set mid_f [dict get $formats_dict MAT_ID]
+
+ set s [mdpaIndent]
+ set f "${s}$id_f [format $mid_f $mid] [string repeat "$id_f " $num]\n"
+ return [dict create $groupid $f]
+}
+
+proc write::getEtype {ov group} {
+ set isquadratic [isquadratic]
+ set ret [list "" ""]
+ set b 0
+ if {$ov eq "point"} {
+ if {$b} {error "Multiple element types in $group over $ov"}
+ set ret [list "Point" 1]
+ set b 1
+ }
+
+ if {$ov eq "line"} {
+ if {$b} {error "Multiple element types in $group over $ov"}
+ switch $isquadratic {
+ 0 { set ret [list "Linear" 2] }
+ default { set ret [list "Linear" 3] }
+ }
+ }
+
+ if {$ov eq "surface"} {
+ if {[GiD_EntitiesGroups get $group elements -count -element_type Triangle]} {
+ if {$b} {error "Multiple element types in $group over $ov"}
+ switch $isquadratic {
+ 0 { set ret [list "Triangle" 3] }
+ default { set ret [list "Triangle" 6] }
+ }
+ set b 1
+ }
+ if {[GiD_EntitiesGroups get $group elements -count -element_type Quadrilateral]} {
+ if {$b} {error "Multiple element types in $group over $ov"}
+ switch $isquadratic {
+ 0 { set ret [list "Quadrilateral" 4] }
+ 1 { set ret [list "Quadrilateral" 8] }
+ 2 { set ret [list "Quadrilateral" 9] }
+ }
+ set b 1
+ }
+ if {[GiD_EntitiesGroups get $group elements -count -element_type Circle]} {
+ if {$b} {error "Multiple element types in $group over $ov"}
+ switch $isquadratic {
+ 0 { set ret [list "Circle" 1] }
+ }
+ set b 1
+ }
+ }
+
+ if {$ov eq "volume"} {
+ if {[GiD_EntitiesGroups get $group elements -count -element_type Tetrahedra]} {
+ if {$b} {error "Multiple element types in $group over $ov"}
+ switch $isquadratic {
+ 0 { set ret [list "Tetrahedra" 4] }
+ 1 { set ret [list "Tetrahedra" 10] }
+ 2 { set ret [list "Tetrahedra" 10] }
+ }
+ set b 1
+ }
+ if {[GiD_EntitiesGroups get $group elements -count -element_type Hexahedra]} {
+ if {$b} {error "Multiple element types in $group over $ov"}
+ switch $isquadratic {
+ 0 { set ret [list "Hexahedra" 8] }
+ 1 { set ret [list "Hexahedra" 20] }
+ 2 { set ret [list "Hexahedra" 27] }
+ }
+ set b 1
+ }
+ if {[GiD_EntitiesGroups get $group elements -count -element_type Prism]} {
+ if {$b} {error "Multiple element types in $group over $ov"}
+ switch $isquadratic {
+ 0 { set ret [list "Hexahedra" 6] }
+ 1 { set ret [list "Hexahedra" 1] }
+ 2 { set ret [list "Hexahedra" 27] }
+ }
+ set b 1
+ }
+ if {[GiD_EntitiesGroups get $group elements -count -element_type Sphere]} {
+ if {$b} {error "Multiple element types in $group over $ov"}
+ switch $isquadratic {
+ 0 { set ret [list "Sphere" 1] }
+ }
+ set b 1
+ }
+ }
+
+ return $ret
+}
+proc write::isquadratic {} {
+ return [GiD_Set Model(QuadraticType)]
+}
+
+proc write::GetNodesFromElementFace {elem_id face_id} {
+ set inf [GiD_Mesh get element $elem_id]
+ set elem_type [lindex $inf 1]
+ set nnodes [lindex $inf 2]
+ set nodes [list ]
+ switch $elem_type {
+ Tetrahedra {
+ set matrix {{1 2 3 5 6 7} {2 4 3 9 10 6} {3 4 1 10 8 7} {4 2 1 9 5 8}}
+ }
+ Triangle {
+ set matrix {{1 2 4} {2 3 5} {3 1 6}}
+ }
+ }
+ # Decrementamos porque la cara con id = i corresponde a la posicion i-1 de la matriz
+ incr face_id -1
+ set face_matrix [lindex $matrix $face_id]
+ foreach node_index $face_matrix {
+ set node [lindex $inf [expr $node_index +2]]
+ if {$node ne ""} {lappend nodes $node}
+ }
+ #W "eid $elem_id fid $face_id nds $nodes"
+ return $nodes
+}
+
+proc write::getPartsGroupsId {{what "name"} } {
+ set root [customlib::GetBaseRoot]
+
+ set listOfGroups [list ]
+ set xp1 "[spdAux::getRoute [GetConfigurationAttribute parts_un]]/group"
+ if {[llength [$root selectNodes $xp1]] < 1} {
+ set xp1 "[spdAux::getRoute [GetConfigurationAttribute parts_un]]/condition/group"
+ }
+ set groups [$root selectNodes $xp1]
+
+ foreach group $groups {
+ if {$what eq "node"} {
+ lappend listOfGroups $group
+ } else {
+ set groupName [get_domnode_attribute $group n]
+ lappend listOfGroups $groupName
+ }
+ }
+ return $listOfGroups
+}
+
+proc write::getPartsSubModelPartId {} {
+ set root [customlib::GetBaseRoot]
+
+ set listOfGroups [list ]
+
+ foreach group [getPartsGroupsId node] {
+ set cnd_id [get_domnode_attribute [$group parent] n]
+ set group_name [get_domnode_attribute $group n]
+ lappend listOfGroups [write::getSubModelPartId $cnd_id $group_name]
+ }
+ return $listOfGroups
+}
+
+proc write::writePartSubModelPart { } {
+ foreach group [getPartsGroupsId node] {
+ set part_name [get_domnode_attribute [$group parent] n]
+ set group_name [get_domnode_attribute $group n]
+ writeGroupSubModelPart $part_name $group_name "Elements"
+ }
+}
+
+proc write::writeLinearLocalAxesGroup {group} {
+ variable formats_dict
+ set id_f [dict get $formats_dict ID]
+ set coord_f [dict get $formats_dict COORDINATE]
+ set elements [GiD_EntitiesGroups get $group elements -element_type linear]
+ set num_elements [objarray length $elements]
+ if {$num_elements} {
+ write::WriteString "Begin ElementalData LOCAL_AXIS_2 // Groups: $group"
+ for {set i 0} {$i < $num_elements} {incr i} {
+ set line [objarray get $elements $i]
+ set raw [lindex [lindex [GiD_Info conditions -localaxesmat line_Local_axes mesh $line] 0] 3]
+ set y0 [lindex $raw 1]
+ set y1 [lindex $raw 4]
+ set y2 [lindex $raw 7]
+ write::WriteString [format "$id_f \[3\]($coord_f, $coord_f, $coord_f)" $line $y0 $y1 $y2]
+ }
+ write::WriteString "End ElementalData"
+ write::WriteString ""
+ }
+ return $num_elements
+}
+
+proc write::SetParallelismConfiguration {{un "Parallelization"} {n "OpenMPNumberOfThreads"}} {
+ set nt 0
+ set paralleltype [write::getValue ParallelType]
+ if {$paralleltype eq "OpenMP"} {
+ catch {set nt [write::getValue $un $n]}
+ if {$nt} {write::SetEnvironmentVariable OMP_NUM_THREADS $nt} {return 0}
+ } else {
+ write::SetEnvironmentVariable OMP_NUM_THREADS 1
+ WriteMPIbatFile $un
+ }
+}
+
+proc write::SetEnvironmentVariable {name value} {
+ set ::env($name) $value
+}
+
+proc write::WriteMPIbatFile {un} {
+ # MPINumberOfProcessors
+ set dir $::Kratos::kratos_private(Path)
+ set model_dir [GetConfigurationAttribute dir]
+ set model_name [GetConfigurationAttribute model_name]
+ set num_nodes [write::getValue $un MPINumberOfProcessors]
+
+ set fd [GiD_File fopen [file join $model_dir "MPILauncher.sh"]]
+ GiD_File fprintf $fd %s "export LD_LIBRARY_PATH=\"$dir/exec/Kratos\":\"$dir/exec/Kratos/libs\""
+ GiD_File fprintf $fd %s "export PYTHONPATH=\"$dir/exec/Kratos/python35.zip\":\"$dir/exec/Kratos\":\$PYTHONPATH"
+ GiD_File fprintf $fd %s "export OMP_NUM_THREADS=1"
+ GiD_File fprintf $fd %s "# Run Python using the script MainKratos.py"
+ GiD_File fprintf $fd %s "mpirun --np $num_nodes \"$dir/exec/Kratos/runkratos\" MainKratos.py > \"$model_dir/$model_name.info\" 2> \"$model_dir/$model_name.err\""
+ GiD_File fclose $fd
+}
+
+proc write::forceUpdateNode {node} {
+ catch {get_domnode_attribute $node dict}
+ catch {get_domnode_attribute $node values}
+ catch {get_domnode_attribute $node value}
+ catch {get_domnode_attribute $node state}
+}
+proc write::getValueByNode { node {what noforce} } {
+ if {[get_domnode_attribute $node v] eq "" || $what eq "force"} {
+ write::forceUpdateNode $node
+ }
+ return [getFormattedValue [get_domnode_attribute $node v]]
+}
+proc write::getValueByNodeChild { parent_node child_name {what noforce} } {
+ set node [$parent_node find n $child_name]
+ return [write::getValueByNode $node $what]
+}
+proc write::getValueByXPath { xpath { it "" }} {
+ set root [customlib::GetBaseRoot]
+ set node [$root selectNodes $xpath]
+ if {$node ne ""} {
+ if {$it ne ""} {set node [$node find n $it]}
+ return [write::getValueByNode $node]
+ }
+ return ""
+}
+proc write::getValue { name { it "" } {what noforce} } {
+ set root [customlib::GetBaseRoot]
+
+ set xp [spdAux::getRoute $name]
+ set node [$root selectNodes $xp]
+ if {$node ne ""} {
+ if {$it ne ""} {set node [$node find n $it]}
+ if {$what eq "force"} {write::forceUpdateNode $node}
+ return [getValueByNode $node]
+ } {
+ return ""
+ }
+}
+
+# anything containing the comma character is a list
+proc write::getFormattedValue {value} {
+ set v ""
+ if {[string first , $value] != -1} {
+ set v [list ]
+ foreach part [split $value ,] {
+ lappend v [getFormattedValue $part]
+ }
+ } else {
+ catch {set v [expr $value]}
+ if {$v eq "" } {set v $value}
+ }
+ return $v
+}
+
+proc write::isBoolean {value} {
+ set goodList [list "Yes" "1" "yes" "ok" "YES" "Ok" "OK" "True" "TRUE" "true" "No" "0" "no" "NO" "False" "FALSE" "false"]
+ if {$value in $goodList} {return 1} {return 0}
+}
+proc write::isBooleanTrue {value} {
+ set goodList [list "Yes" "1" "yes" "ok" "YES" "Ok" "OK" "True" "TRUE" "true"]
+ if {$value in $goodList} {return 1} {return 0}
+}
+proc write::isBooleanFalse {value} {
+ set goodList [list "No" "0" "no" "NO" "False" "FALSE" "false"]
+ if {$value in $goodList} {return 1} {return 0}
+}
+
+proc write::getStringBinaryValue { name { it "" } } {
+ set v [getValue $name $it]
+ return [write::getStringBinaryFromValue $v]
+}
+proc write::getStringBinaryFromValue {v} {
+ set goodList [list "Yes" "1" "yes" "ok" "YES" "Ok" "OK" "True" "TRUE" "true"]
+ if {$v in $goodList} {return "true" } {return "false"}
+}
+
+proc write::OpenFile { fn } {
+ set dir [GetConfigurationAttribute dir]
+ set filename [file join $dir $fn]
+ CloseFile
+ customlib::InitWriteFile $filename
+}
+
+proc write::CloseFile { } {
+ customlib::EndWriteFile
+}
+
+proc write::WriteString {str} {
+ GiD_WriteCalculationFile puts [format "%s" $str]
+}
+
+proc write::getMatDict {} {
+ variable mat_dict
+ return $mat_dict
+}
+proc write::setMatDict {matdict} {
+ variable mat_dict
+ set mat_dict $matdict
+}
+
+proc write::isDict {value} {
+ return [expr {[string is list $value] && ([llength $value]&1) == 0}]
+}
+
+proc write::getSpacing {number} {
+ set r ""
+ for {set i 0} {$i<$number} {incr i} {append r " "}
+ return $r
+}
+proc write::mdpaIndent { {b 4} } {
+ variable current_mdpa_indent_level
+ if {[info exists Kratos::kratos_private(mdpa_format)]} {
+ if {$Kratos::kratos_private(mdpa_format) == 0} {
+ return ""
+ }
+ }
+ string repeat [string repeat " " $b] $current_mdpa_indent_level
+}
+
+# Sets the precission for the diffetent entities written in the mdpa
+# To customize the formats and precissions for your mdpa.
+# You can edit in your write mdpa event script using write::SetWriteFormatFor
+proc write::InitWriteFormats { } {
+ if {$::Kratos::kratos_private(mdpa_format) == 1} {
+ # Readable
+ write::SetWriteFormatFor ID "%5d"
+ write::SetWriteFormatFor CONNECTIVITY "%10d"
+ write::SetWriteFormatFor MAT_ID "%10d"
+ write::SetWriteFormatFor COORDINATE "%14.10f"
+ } else {
+ # Optimized
+ write::SetWriteFormatFor ID "%d"
+ write::SetWriteFormatFor CONNECTIVITY "%d"
+ write::SetWriteFormatFor MAT_ID "%d"
+ write::SetWriteFormatFor COORDINATE "%.10f"
+ }
+}
+
+proc write::SetWriteFormatFor { what format } {
+ variable formats_dict
+ dict set formats_dict $what $format
+}
+
+proc write::CopyFileIntoModel { filepath } {
+ set dir [GetConfigurationAttribute dir]
+ set activeapp [::apps::getActiveApp]
+ set inidir [apps::getMyDir [$activeapp getName]]
+ set totalpath [file join $inidir $filepath]
+ file copy -force $totalpath $dir
+}
+proc write::RenameFileInModel { src target } {
+ set dir [GetConfigurationAttribute dir]
+ set srcfile [file join $dir $src]
+ set tgtfile [file join $dir $target]
+ file rename -force $srcfile $tgtfile
+}
+
+proc write::WriteAssignedValues {condNode} {
+ set assignedVector [list 1 0 1]
+ set valuesVector [list 0.0 null 0.0]
+
+ for {set i 0} {$i<3} {incr i} {
+ set assigned [lindex $assignedVector $i]
+ if {!$assigned} {set assignedVector [lreplace $assignedVector $i $i null]}
+ }
+ set ret [dict create value $valuesVector]
+ return $ret
+}
+
+proc write::writeLaunchJSONFile { } {
+ # Check if developer
+ if {[Kratos::IsDeveloperMode]} {
+ set debug_folder $Kratos::kratos_private(debug_folder)
+
+ # Prepare JSON as dict
+ set json [dict create version "0.2.0"]
+ set n_omp "1"
+ set python_env [dict create OMP_NUM_THREADS $n_omp PYTHONPATH $debug_folder LD_LIBRARY_PATH [file join $debug_folder libs]]
+ set python_configuration [dict create name "python main" type python request launch program MainKratos.py console integratedTerminal env $python_env cwd [GetConfigurationAttribute dir]]
+ set cpp_configuration [dict create name "C++ Attach" type cppvsdbg request attach processId "\${command:pickProcess}"]
+ dict set json configurations [list $python_configuration $cpp_configuration]
+
+ # Print json
+ CloseFile
+ file mkdir [file join [GetConfigurationAttribute dir] .vscode]
+ OpenFile ".vscode/launch.json"
+ write::WriteJSONAsStringFields $json
+ CloseFile
+ }
+}
+
+proc write::CopyMainScriptFile { } {
+ set errcode 0
+ # Main python script
+ if {[catch {
+ set orig_name [write::GetConfigurationAttribute main_launch_file]
+ if {$orig_name ne ""} {
+ write::CopyFileIntoModel $orig_name
+ write::RenameFileInModel [file tail $orig_name] "MainKratos.py"
+ }
+ } fid] } {
+ W "Problem Writing $errName block:\n$fid\nEvent $wevent \nEnd problems"
+ return errcode 1
+ }
+ return $errcode
+}
+
+write::Init
diff --git a/kratos.gid/scripts/spdAuxiliar.tcl b/kratos.gid/scripts/spdAuxiliar.tcl
index ed10dc699..e9746070a 100644
--- a/kratos.gid/scripts/spdAuxiliar.tcl
+++ b/kratos.gid/scripts/spdAuxiliar.tcl
@@ -3,9 +3,10 @@
# Do not change anything here unless it's strictly necessary.
##################################################################################
-namespace eval spdAux {
+namespace eval ::spdAux {
+ Kratos::AddNamespace [namespace current]
+
# Namespace variables declaration
-
variable uniqueNames
variable initwind
@@ -17,6 +18,8 @@ namespace eval spdAux {
variable must_open_init_window
variable must_open_dim_window
+
+ variable list_of_windows
}
proc spdAux::Init { } {
@@ -29,16 +32,19 @@ proc spdAux::Init { } {
variable GroupsEdited
variable must_open_init_window
variable must_open_dim_window
+ variable list_of_windows
set uniqueNames ""
dict set uniqueNames "dummy" 0
set initwind ""
- set currentexternalfile ""
+ set currentexternalfile ""
set refreshTreeTurn 0
set TreeVisibility 0
set GroupsEdited [dict create]
set must_open_init_window 1
set must_open_dim_window 1
+
+ set list_of_windows [list ]
}
proc spdAux::StartAsNewProject { } {
@@ -71,7 +77,7 @@ proc spdAux::TryRefreshTree { } {
}
set ::spdAux::refreshTreeTurn 0
}
- after 750 {spdAux::TryRefreshTree}
+ after 750 {catch {spdAux::TryRefreshTree}}
}
proc spdAux::OpenTree { } {
@@ -86,7 +92,7 @@ proc spdAux::OpenTree { } {
proc spdAux::EndRefreshTree { } {
variable refreshTreeTurn
set refreshTreeTurn 0
- after cancel {spdAux::TryRefreshTree}
+ after cancel {catch {spdAux::TryRefreshTree}}
}
# Includes
@@ -116,6 +122,8 @@ proc spdAux::processAppIncludes { root } {
if {[$elem hasAttribute "public"]} {set public [$elem getAttribute "public"]}
set app [apps::NewApp $appid $pn $prefix]
$app setPublic $public
+ if {[$elem hasAttribute "is_tool"] } {$app setIsTool [$elem getAttribute "is_tool"]}
+
if {$active} {
set dir $::Kratos::kratos_private(Path)
set f [file join $dir apps $appid xml Main.spd]
@@ -127,10 +135,9 @@ proc spdAux::processAppIncludes { root } {
}
proc spdAux::CustomTreeCommon { } {
- set AppUsesIntervals [apps::ExecuteOnCurrentApp GetAttribute UseIntervals]
-
- if {$AppUsesIntervals eq ""} {set AppUsesIntervals 0}
- if {!$AppUsesIntervals} {
+ set app_uses_intervals [[apps::getActiveApp] getPermission "intervals"]
+ if {$app_uses_intervals eq ""} {set app_uses_intervals 0}
+ if {!$app_uses_intervals} {
if {[getRoute Intervals] ne ""} {
catch {spdAux::SetValueOnTreeItem state hidden Intervals}
}
@@ -167,14 +174,17 @@ proc spdAux::getImagePathDim { dim } {
set imagepath [file nativename [file join $::Model::dir images "$dim.png"] ]
return $imagepath
}
-proc spdAux::DestroyWindow {} {
+proc spdAux::DestroyWindows {} {
if { [GidUtils::IsTkDisabled] } {
return 0
}
- variable initwind
- if {[winfo exists $initwind]} {
- destroy $initwind
+ variable list_of_windows
+ foreach window $list_of_windows {
+ if {[winfo exists $window]} {
+ destroy $window
+ }
}
+ set list_of_windows [list ]
}
# Routes
@@ -252,6 +262,7 @@ proc spdAux::insertDependencies { baseNode originUN } {
set insertxpath [getRoute $originUN]
set insertonnode [$root selectNodes $insertxpath]
# a lo bestia, cambiar cuando sepamos inyectar la dependencia, abajo esta a medias
+ $insertonnode setAttribute "actualize" 1
$insertonnode setAttribute "actualize_tree" 1
## Aun no soy capaz de insertar y que funcione
@@ -353,6 +364,23 @@ proc spdAux::MergeGroups {result_group_name group_list} {
}
}
+
+proc spdAux::GetUsedElements {{alt_un ""}} {
+ set root [customlib::GetBaseRoot]
+
+ set un $alt_un
+ if {$un eq ""} {set un [apps::ExecuteOnCurrentApp write::GetAttribute parts_un]}
+
+ set xp1 "[spdAux::getRoute $un]/group"
+ set lista [list ]
+ foreach gNode [[customlib::GetBaseRoot] selectNodes $xp1] {
+ set name [write::getValueByNode [$gNode selectNodes ".//value\[@n='Element']"] ]
+ if {$name ni $lista} {lappend lista $name}
+ }
+
+ return $lista
+}
+
proc spdAux::LoadIntervalGroups { {root ""} } {
customlib::UpdateDocument
variable GroupsEdited
@@ -408,34 +436,9 @@ proc spdAux::GetAppliedGroups { {root ""} } {
}
return [lsort -unique $group_list]
}
-
-proc spdAux::LoadModelFiles { {root "" }} {
- if {$root eq ""} {
- set root [customlib::GetBaseRoot]
- customlib::UpdateDocument
- }
- foreach elem [$root getElementsByTagName "file"] {
- FileSelector::AddFile [$elem @n]
- }
-}
-
-proc spdAux::SaveModelFile { fileid } {
- customlib::UpdateDocument
- FileSelector::AddFile $fileid
- gid_groups_conds::addF {container[@n='files']} file [list n ${fileid}]
-}
-
-proc spdAux::AddFile { domNode } {
- FileSelector::InitWindow "spdAux::UpdateFileField" $domNode
+proc spdAux::RegisterWindow {window_name} {
+ variable list_of_windows
+ lappend list_of_windows $window_name
}
-proc spdAux::UpdateFileField { fileid domNode} {
- if {$fileid ne ""} {
- $domNode setAttribute v $fileid
- spdAux::SaveModelFile $fileid
- RequestRefresh
- }
-}
-
-
spdAux::Init