- Adding first working version of the McStas SICS connection to cvs
SKIPPED: psi/polterwrite.c
This commit is contained in:
66
mcstas/dmc/mcsupport.tcl
Normal file
66
mcstas/dmc/mcsupport.tcl
Normal file
@ -0,0 +1,66 @@
|
||||
#-------------------------------------------------------------------
|
||||
# These are a couple of Tcl function which help with the interface
|
||||
# between SICS and McStas
|
||||
#
|
||||
# Mark Koennecke, June 2005
|
||||
#--------------------------------------------------------------------
|
||||
# washsimfile fixes the evil NXsimulation name ="./dmc.xml" thing in
|
||||
# the XML file. Path separators in name attributes throw off
|
||||
# NXopenpath
|
||||
#--------------------------------------------------------------------
|
||||
proc washsimfile {name} {
|
||||
set oriname $name
|
||||
set in [open $name "r"]
|
||||
set name [file tail $name]
|
||||
set out [open /tmp/$name "w"]
|
||||
while { [gets $in line] >= 0} {
|
||||
if { [string first "NXsimulation name=" $line] > 0} {
|
||||
puts $out "<NXsimulation name=\"$name\">"
|
||||
} else {
|
||||
puts $out $line
|
||||
}
|
||||
}
|
||||
close $in
|
||||
close $out
|
||||
file copy -force /tmp/$name $oriname
|
||||
file delete /tmp/$name
|
||||
}
|
||||
#---------------------------------------------------------------------
|
||||
# When McStas dumps or is killed we need to give McStas some time to
|
||||
# dump its data. Otherwise we observe that data reading fails.
|
||||
# mcwaittime is used for this. Increase if you see problems
|
||||
#--------------------------------------------------------------------
|
||||
set mcwaittime 7
|
||||
#----------------------------------------------------------------------
|
||||
proc mcstasdump {pid} {
|
||||
global mcwaittime
|
||||
catch {eval exec /usr/bin/kill -USR2 $pid}
|
||||
wait $mcwaittime
|
||||
}
|
||||
#-----------------------------------------------------------------------
|
||||
proc mcstasisrunning {pid} {
|
||||
set ret [catch {eval exec /bin/ps --pid $pid} msg]
|
||||
if {$ret == 0} {
|
||||
return 1
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#-----------------------------------------------------------------------
|
||||
proc mcstaskill {pid} {
|
||||
global mcwaittime
|
||||
catch {eval exec /usr/bin/kill -TERM $pid}
|
||||
wait $mcwaittime
|
||||
}
|
||||
#-----------------------------------------------------------------------
|
||||
proc mcinstall {} {
|
||||
allowexec /usr/bin/kill
|
||||
allowexec /bin/ps
|
||||
Publish mcstasdump User
|
||||
Publish mcstasisrunning User
|
||||
Publish mcstaskill User
|
||||
mccontrol configure mcdump mcstasdump
|
||||
mccontrol configure mckill mcstaskill
|
||||
mccontrol configure mcisrunning mcstasisrunning
|
||||
mccontrol configure update 300
|
||||
}
|
Reference in New Issue
Block a user