| Path: | tableio.rb |
| Last Update: | Wed Jun 11 18:43:46 +0200 2008 |
# File tableio.rb, line 280 def blockdialog2table(rownum, table, blockdialog) table.setItemText(rownum ,0,"b#{@rownum}") table.setItemText(rownum ,1,blockdialog.lengthField.text.to_s) table.setItemText(rownum ,2,blockdialog.angleField.to_s) table.setItemText(rownum ,3,blockdialog.r0Field.to_s) table.setItemText(rownum ,4,blockdialog.r1Field.to_s) table.setItemText(rownum ,5,blockdialog.r2Field.to_s) table.setItemText(rownum ,6,blockdialog.r3Field.to_s) end
# File tableio.rb, line 24 def csysint(text) case text when "normal" # puts "csys normal" return 0 when "cyl" # puts "csys cyl" return 1 when "spherical" # puts "csys sphe" return 2 end end
# File tableio.rb, line 37 def planeint(text) case text when "xy" return 0 when "xz" return 1 when "yz" return 2 end end
# File tableio.rb, line 289 def table2blockdialog(rownum, blockdialog, table) blockdialog.lengthField.text = table.getItem(rownum, 1).to_s blockdialog.angleField.text = table.getItem(rownum, 2).to_s blockdialog.r0Field.text = table.getItem(rownum, 3).to_s blockdialog.r1Field.text = table.getItem(rownum, 4).to_s blockdialog.r2Field.text = table.getItem(rownum, 5).to_s blockdialog.r3Field.text = table.getItem(rownum, 6).to_s end
# File tableio.rb, line 47 def table2csysdialog0p(rownum, table, dialog) #[1, 3, 5, 7, 9, 11, 13, 14].each do |col1| (1..$MAX_ATTRIB_SIZE*2+1).step(2) do |col1| col2 = col1 + 1 if table.getItem(rownum, col1).to_s == "xpos" dialog.xpos.text = table.getItem(rownum, col2).to_s elsif table.getItem(rownum, col1).to_s == "ypos" dialog.ypos.text = table.getItem(rownum, col2).to_s elsif table.getItem(rownum, col1).to_s == "zpos" dialog.zpos.text = table.getItem(rownum, col2).to_s elsif table.getItem(rownum, col1).to_s == "xrot" dialog.xrot.text = table.getItem(rownum, col2).to_s elsif table.getItem(rownum, col1).to_s == "yrot" dialog.yrot.text = table.getItem(rownum, col2).to_s elsif table.getItem(rownum, col1).to_s == "zrot" dialog.zrot.text = table.getItem(rownum, col2).to_s elsif table.getItem(rownum, col1).to_s == "type" #dialog.csystype = table.getItem(rownum, col2).to_s # puts csysint(table.getItem(rownum, col2).to_s) dialog.csystype.handle(self, MKUINT(FXDataTarget::ID_OPTION + csysint(table.getItem(rownum, col2).to_s), SEL_COMMAND), nil) elsif table.getItem(rownum, col1).to_s == "size" dialog.size.text = table.getItem(rownum, col2).to_s end # puts "csystype #{dialog.type}" # TODO set the right option in FXPopup case dialog.csystype when "normal" # puts "normal" when "cyl" # puts "cyl" when "spherical" # puts "spherical" end end end
# File tableio.rb, line 312 def table2modifybcinlet(row1, table, dialog) (1..$MAX_ATTRIB_SIZE*2+1).step(2) do |col1| col2 = col1 + 1 if table.getItem(row1, col1).to_s == "xvel" dialog.xvel.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "yvel" dialog.yvel.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "zvel" dialog.zvel.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "k" dialog.turbk.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "epsilon" dialog.turbepsilon.text = table.getItem(row1, col2).to_s end end end
# File tableio.rb, line 328 def table2modifybcoutlet(row1, table, dialog) (1..$MAX_ATTRIB_SIZE*2+1).step(2) do |col1| col2 = col1 + 1 if table.getItem(row1, col1).to_s == "p" dialog.xvel.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "yvel" dialog.yvel.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "zvel" dialog.zvel.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "k" dialog.turbk.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "epsilon" dialog.turbepsilon.text = table.getItem(row1, col2).to_s end end end
for boundary conditions when "INLET"
@reflist = { "bctype" => @bctype, "xvel" => @xvel, "yvel" => @yvel, "zvel" => @zvel, "k" => @k, "epsilon" => @epsilon }
when "OUTLET"
@reflist = { "bctype" => @bctype, "p" => @p }
# File tableio.rb, line 302 def table2modifybctest(row1, table ) @bcflag = $defaults['bcbctype'] (1..$MAX_ATTRIB_SIZE*2+1).step(2) do |col1| col2 = col1 + 1 if table.getItem(row1, col1).to_s == "bctype" @bcflag = table.getItem(row1, col2).to_s end end return @bcflag end
# File tableio.rb, line 265 def table2modifycube1f(row1, table ,dialog) table2modifyface1l(row1, table ,dialog) end
# File tableio.rb, line 228 def table2modifycube1p(row1, table ,dialog) # radius, xaxis, yaxis, zaxis, refattr, meshnum #[1, 3, 5].each do |col1| (1..$MAX_ATTRIB_SIZE*2+1).step(2) do |col1| col2 = col1 + 1 if table.getItem(row1, col1).to_s == "xlength" dialog.xlength.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "ylength" dialog.ylength.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "zlength" dialog.zlength.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "meshx" dialog.meshx.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "meshy" dialog.meshy.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "meshz" dialog.meshz.text = table.getItem(row1, col2).to_s end end end
# File tableio.rb, line 268 def table2modifycube2f(row1, table ,dialog) (1..$MAX_ATTRIB_SIZE*2+1).step(2) do |col1| col2 = col1 + 1 if table.getItem(row1, col1).to_s == "twist" dialog.twist.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "flipdir" dialog.flipdir.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "meshnum" dialog.meshnum.text = table.getItem(row1, col2).to_s end end end
# File tableio.rb, line 202 def table2modifyface1f(row1, table, dialog) (1..$MAX_ATTRIB_SIZE*2+1).step(2) do |col1| col2 = col1 + 1 if table.getItem(row1, col1).to_s == "xlength" dialog.xlength.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "ylength" dialog.ylength.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "xpos" dialog.xpos.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "ypos" dialog.ypos.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "refattr" dialog.refattr.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "adjust" puts "tableitem #{table.getItem(row1, col2).to_s.class}" if table.getItem(row1, col2).to_s == "0" puts "got 0" dialog.adjustTarget.value = false else puts "got 1" dialog.adjustTarget.value = false end end end dialog.updateCheck end
# File tableio.rb, line 248 def table2modifyface1l(row1, table ,dialog) # :xlength, :ylength, :xrot, :yrot, :zrot # :meshx, :meshy #[1, 3, 5].each do |col1| (1..$MAX_ATTRIB_SIZE*2+1).step(2) do |col1| col2 = col1 + 1 if table.getItem(row1, col1).to_s == "xvec" dialog.xvec.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "yvec" dialog.yvec.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "zvec" dialog.zvec.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "meshnum" dialog.meshnum.text = table.getItem(row1, col2).to_s end end end
# File tableio.rb, line 175 def table2modifyface1p(row1, table ,dialog) # :xlength, :ylength, :xrot, :yrot, :zrot # :meshx, :meshy #[1, 3, 5].each do |col1| (1..$MAX_ATTRIB_SIZE*2+1).step(2) do |col1| col2 = col1 + 1 if table.getItem(row1, col1).to_s == "xlength" dialog.xlength.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "ylength" dialog.ylength.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "xrot" dialog.xrot.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "yrot" dialog.yrot.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "zrot" dialog.zrot.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "meshx" dialog.meshx.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "meshy" dialog.meshy.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "plane" #dialog.csystype = table.getItem(rownum, col2).to_s # puts csysint(table.getItem(rownum, col2).to_s) dialog.planesel.handle(self, MKUINT(FXDataTarget::ID_OPTION + planeint(table.getItem(row1, col2).to_s), SEL_COMMAND), nil) end end end
# File tableio.rb, line 136 def table2modifyface2l(row1, table ,dialog) # radius, xaxis, yaxis, zaxis, refattr, meshnum #[1, 3, 5].each do |col1| (1..$MAX_ATTRIB_SIZE*2+1).step(2) do |col1| col2 = col1 + 1 if table.getItem(row1, col1).to_s == "meshnum" dialog.meshnum.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "flipdir" tmp = table.getItem(row1, col2).to_s dialog.flipdir = tmp.to_i dialog.checkstate end end end
# File tableio.rb, line 150 def table2modifyfutureline(row1, table, dialog) axistmp = $defaults['lineaxis'] (1..$MAX_ATTRIB_SIZE*2+1).step(2) do |col1| col2 = col1 + 1 if table.getItem(row1, col1).to_s == "radius" dialog.radius.text = table.getItem(row1, col2).to_s end if table.getItem(row1, col1).to_s == "refattr" dialog.refattr.text = table.getItem(row1, col2).to_s end if table.getItem(row1, col1).to_s == "axis" axistmp = table.getItem(row1, col2).to_s end end # todo axis #obj = whichobj(row1) case axistmp when "x" dialog.axisswitch.handle(self, MKUINT(FXDataTarget::ID_OPTION+0, SEL_COMMAND), nil) when "y" dialog.axisswitch.handle(self, MKUINT(FXDataTarget::ID_OPTION+1, SEL_COMMAND), nil) when "z" dialog.axisswitch.handle(self, MKUINT(FXDataTarget::ID_OPTION+2, SEL_COMMAND), nil) end end
# File tableio.rb, line 95 def table2modifyline1p(row1, table, dialog) #[1, 3, 5].each do |col1| (1..$MAX_ATTRIB_SIZE*2+1).step(2) do |col1| col2 = col1 + 1 if table.getItem(row1, col1).to_s == "xvec" dialog.xvec.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "yvec" dialog.yvec.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "zvec" dialog.zvec.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "refattr" dialog.refattr.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "meshnum" dialog.meshnum.text = table.getItem(row1, col2).to_s end end end
# File tableio.rb, line 112 def table2modifyline2p(row1, table ,dialog) # radius, xaxis, yaxis, zaxis, refattr, meshnum #[1, 3, 5].each do |col1| (1..$MAX_ATTRIB_SIZE*2+1).step(2) do |col1| col2 = col1 + 1 if table.getItem(row1, col1).to_s == "radius" dialog.radius.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "xaxis" dialog.xaxis.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "yaxis" dialog.yaxis.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "zaxis" dialog.zaxis.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "refattr" dialog.refattr.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "meshnum" dialog.meshnum.text = table.getItem(row1, col2).to_s elsif table.getItem(row1, col1).to_s == "flipdir" tmp = table.getItem(row1, col2).to_s dialog.flipdir = tmp.to_i dialog.checkstate end end end
# File tableio.rb, line 82 def table2pointdialog(rownum,table,dialog) #[1, 3, 5].each do |col1| (1..$MAX_ATTRIB_SIZE*2+1).step(2) do |col1| col2 = col1 + 1 if table.getItem(rownum, col1).to_s == "xpos" dialog.xpos.text = table.getItem(rownum, col2).to_s elsif table.getItem(rownum, col1).to_s == "ypos" dialog.ypos.text = table.getItem(rownum, col2).to_s elsif table.getItem(rownum, col1).to_s == "zpos" dialog.zpos.text = table.getItem(rownum, col2).to_s end end end
# File tableio.rb, line 345 def write2table(table,row,obj) obj.row = row attr_index = 1 table.setItemText(row ,0,obj.info[2]) # this method looks awkward, maybe it could be done in another way prefix = obj.defaultprefix #puts "obj.reflist #{obj.reflist}, obj #{obj}, obj.defaultprefix #{obj.defaultprefix}" obj.reforder.each do |name| # puts name # puts obj.reflist.class value = obj.reflist[name] # puts "prefix #{prefix} name #{name}" if value != $defaults[prefix+name] && value != nil table.setItemText(row ,attr_index,name) attr_index += 1 table.setItemText(row ,attr_index,value.to_s) attr_index += 1 end end # clear the contents in the rest of the row # remove any old info on the row (attr_index..($MAX_ATTRIB_SIZE*2)).each do |col| table.setItemText(row ,col,"") end end