| Class | InfoFace |
| In: |
infoface.rb
|
| Parent: | Object |
Face object
| adjust | [RW] | facefaces, futurerefs |
| celldef | [RW] | for all reference types |
| changed | [RW] | interaction attributes |
| csys | [RW] | |
| defaultprefix | [RW] | for the write2table method |
| diag | [RW] | attribute for connected 2l references |
| externref | [RW] | refs is replaced with ref |
| f | [RW] | faces |
| ff | [RW] | facefaces, futurerefs |
| ffcells | [RW] | facefaces, futurerefs |
| ffl0 | [RW] | facefaces, futurerefs |
| ffl1 | [RW] | facefaces, futurerefs |
| ffl2 | [RW] | facefaces, futurerefs |
| ffl3 | [RW] | facefaces, futurerefs |
| ffref | [RW] | facefaces, futurerefs |
| firstline | [RW] | info on first, second, third and fourth line belonging to a face |
| flipdir | [RW] | flip dir when cylindrical and spherical coordinate system is used |
| fourthline | [RW] | info on first, second, third and fourth line belonging to a face |
| futurerefs | [RW] | refs is replaced with ref |
| imax | [RW] | for cube creation, imax is meshx or l0.size-1, jmax is meshy or meshnum |
| info | [RW] | interaction attributes |
| jmax | [RW] | for cube creation, imax is meshx or l0.size-1, jmax is meshy or meshnum |
| l0 | [RW] | lines |
| l1 | [RW] | lines |
| l2 | [RW] | lines |
| l2twist | [RW] | info on first, second, third and fourth line belonging to a face |
| l3 | [RW] | lines |
| meshnum | [RW] | mesh attributes |
| meshx | [RW] | mesh attributes |
| meshy | [RW] | mesh attributes |
| normal | [RW] | interaction attributes |
| p0 | [RW] | points |
| p0tmp | [RW] | points |
| p1 | [RW] | points |
| p1tmp | [RW] | points |
| p2 | [RW] | points |
| p2tmp | [RW] | points |
| p3 | [RW] | points |
| p3tmp | [RW] | points |
| plane | [RW] | 1p attributes |
| point0 | [RW] | |
| point1 | [RW] | |
| point2 | [RW] | |
| point3 | [RW] | |
| ref | [RW] | refs is replaced with ref |
| refattr | [RW] | refs is replaced with ref |
| reflist | [RW] | for the write2table method |
| reforder | [RW] | for the write2table method |
| reftype | [RW] | refs is replaced with ref |
| row | [RW] | interaction attributes |
| secondline | [RW] | info on first, second, third and fourth line belonging to a face |
| selected | [RW] | interaction attributes |
| thirdline | [RW] | info on first, second, third and fourth line belonging to a face |
| visible | [RW] | |
| x | [RW] | lines |
| xlength | [RW] | 1p attributes |
| xrot | [RW] | 1p attributes |
| xvec | [RW] | 1l attributes |
| y | [RW] | lines |
| ylength | [RW] | 1p attributes |
| yrot | [RW] | 1p attributes |
| yvec | [RW] | 1l attributes |
| z | [RW] | lines |
| zlength | [RW] | 1p attributes |
| zrot | [RW] | 1p attributes |
| zvec | [RW] | 1l attributes |
returns an InfoFace with all attributes no objects are created they are created with the create method also initialize with parent face (face in context) for 1l, 2l and 4l
# File infoface.rb, line 69 def initialize(reftype, csys, ref, parent, info, rownum, *args) @changed = false @selected = false @visible = false @l2twist = false @flipdir = 0 @x = Array.new @y = Array.new @z = Array.new @ff = Array.new @ffref = Array.new @adjust = Array.new @defaultprefix = "face" @futurerefed = false @futureref = nil @reftype = reftype @csys = csys @ref = ref @parent = parent @parent == nil ? @parent = self:nil info == nil ? @info = [ @parent, self, "f#{@@count}"]:@info = [ @parent, self, info ] @f = DefFace.new(@info[0], @info[1], "f#{@@count}") @row = rownum if rownum != nil case @reftype when "1p" @xlength, @ylength, @plane, @meshx, @meshy = args @reflist = { "xlength" => @xlength, "ylength" => @ylength, "plane" => @plane, "meshx" => @meshx, "meshy" => @meshy } @reforder = ["xlength", "ylength", "plane", "meshx", "meshy" ] @p0 = @ref @p1 = InfoPoint.new(@csys, 0.0, 0.0, 0.0, self,"p1") @p2 = InfoPoint.new(@csys, 0.0, 0.0, 0.0, self,"p2") @p3 = InfoPoint.new(@csys, 0.0, 0.0, 0.0, self,"p3") # # # @p0.pos[@csys.count] = invPositionInCsys(@csys, @p0.pos[0]) case @plane when "xy" # puts "xy plane" @p1.pos[@csys.count] = [ @p0.pos[@csys.count][0]+@xlength, @p0.pos[@csys.count][1], @p0.pos[@csys.count][2] ] @p2.pos[@csys.count] = [ @p0.pos[@csys.count][0]+@xlength, @p0.pos[@csys.count][1]+@ylength, @p0.pos[@csys.count][2] ] @p3.pos[@csys.count] = [ @p0.pos[@csys.count][0], @p0.pos[@csys.count][1]+@ylength, @p0.pos[@csys.count][2] ] when "xz" # puts "xz plane" @p1.pos[@csys.count] = [ @p0.pos[@csys.count][0]+@xlength, @p0.pos[@csys.count][1], @p0.pos[@csys.count][2] ] @p2.pos[@csys.count] = [ @p0.pos[@csys.count][0]+@xlength, @p0.pos[@csys.count][1], @p0.pos[@csys.count][2]+@ylength ] @p3.pos[@csys.count] = [ @p0.pos[@csys.count][0], @p0.pos[@csys.count][1], @p0.pos[@csys.count][2]+@ylength ] when "yz" # puts "yz plane" @p1.pos[@csys.count] = [ @p0.pos[@csys.count][0], @p0.pos[@csys.count][1]+@xlength, @p0.pos[@csys.count][2] ] @p2.pos[@csys.count] = [ @p0.pos[@csys.count][0], @p0.pos[@csys.count][1]+@xlength, @p0.pos[@csys.count][2]+@ylength ] @p3.pos[@csys.count] = [ @p0.pos[@csys.count][0], @p0.pos[@csys.count][1], @p0.pos[@csys.count][2]+@ylength ] end @p1.pos[0] = positionInCsys(@csys, @p1.pos[@csys.count]) @p2.pos[0] = positionInCsys(@csys, @p2.pos[@csys.count]) @p3.pos[0] = positionInCsys(@csys, @p3.pos[@csys.count]) # # # @l0 = DefLine.new(self, "l0") @l1 = DefLine.new(self, "l1") @l2 = DefLine.new(self, "l2") @l3 = DefLine.new(self, "l3") @firstline = @l0 @secondline = @l1 @thirdline = @l2 @fourthline = @l3 @l0.firstpoint = @p0 @l0.lastpoint = @p1 @l1.firstpoint = @p1 @l1.lastpoint = @p2 @l2.firstpoint = @p2 @l2.lastpoint = @p3 @l3.firstpoint = @p3 @l3.lastpoint = @p0 @point0, @point1, @point2, @point3 = @p0, @p1, @p2, @p3 when "1l" @ref.child.push(self) @xvec, @yvec, @zvec, @meshnum = args @reflist = { "xvec" => @xvec, "yvec" => @yvec, "zvec" => @zvec, "meshnum" => @meshnum } @reforder = [ "xvec", "yvec", "zvec", "meshnum" ] @l0 = @ref @p0 = @ref.firstpoint @p1 = @ref.lastpoint @p2 = InfoPoint.new($defaultcsys, 0.0, 0.0, 0.0, self,"p2") @p3 = InfoPoint.new($defaultcsys, 1.0, 0.0, 0.0, self,"p3") @l1 = DefLine.new(self, "l1") @l2 = DefLine.new(self, "l2") @l3 = DefLine.new(self, "l3") @firstline = @l0 @secondline = @l1 @thirdline = @l2 @fourthline = @l3 @l1.firstpoint = @p1 @l1.lastpoint = @p2 @l2.firstpoint = @p2 @l2.lastpoint = @p3 @l3.firstpoint = @p3 @l3.lastpoint = @p0 @point0, @point1, @point2, @point3 = @p0, @p1, @p2, @p3 when "2l" @ref[0].child.push(self) @ref[1].child.push(self) @meshnum, @flipdir = args @reflist = { "meshnum" => @meshnum, "flipdir" => @flipdir } @reforder = [ "meshnum", "flipdir" ] @l0 = @ref[0] @l2 = @ref[1] @l1 = DefLine.new(self, "l1") @l3 = DefLine.new(self, "l3") @firstline = @l0 @secondline = @l1 @thirdline = @l2 @fourthline = @l3 @p0 = @l0.firstpoint @p1 = @l0.lastpoint mapl2points @point0, @point1, @point2, @point3 = @p0, @p1, @p2, @p3 when "2lconn" when "3l" @ref[0].child.push(self) @ref[1].child.push(self) @ref[2].child.push(self) @reforder = [] # create missing line @l0, @l1, @l2, @p0, @p1, @p2, @p3 = findUnconnectedPoints(@ref) @l3 = InfoLine.new("2p", @csys, [p3, p0], self, "l3", @l2.x[0].size, 0) @l3.create #puts "l0 #{@l0}, l1 #{@l1}, l2 #{@l2}, l3 #{@l3}" @firstline = @l0 @secondline = @l1 @thirdline = @l2 @fourthline = @l3 @point0, @point1, @point2, @point3 = @p0, @p1, @p2, @p3 when "4l" @ref[0].child.push(self) @ref[1].child.push(self) @ref[2].child.push(self) @ref[3].child.push(self) @reforder = [] # now we have to find p0..3 and l0..3 then the mesh creation will be easy # first we collect all the end points # maybe create a function like connectionmatrix = findStructure4l(@ref) # maybe we should have a new concept with internal lines and points for faces # il0..3, ip0..3 then the 4l face mesh could always be used, I have already begun to do this # with the first/second/third-line concept @l0, @l1, @l2, @l3, @p0, @p1, @p2, @p3 = findStructure4lalt(@ref) @firstline = @l0 @secondline = @l1 @thirdline = @l2 @fourthline = @l3 @point0, @point1, @point2, @point3 = @p0, @p1, @p2, @p3 end @l0.child.push(self) @l1.child.push(self) @l2.child.push(self) @l3.child.push(self) @firstinit = true #create @oldcsyspos = @csys.getpos @facefacecurrentstatus = { "ref" => @ffref, "geom" => @ff, "adjust" => @adjust } @@count += 1 end
# File infoface.rb, line 867 def checkchild puts "for #{@info[2]}" if @ref.class == Array @ref.each do |tmp| print "parent/ref #{tmp.info[0].info[2]}.#{tmp.info[2]} has " tmp.child.each do |child| print "child #{child.info[2]} " end print "\n" end elsif @ref.class == InfoLine || @ref.class == DefLine print "ref/parent #{@ref.info[0].info[2]}.#{@ref.info[2]} has " @ref.child.each do |child| print "child #{child.info[2]} " end print "\n" end end
# File infoface.rb, line 761 def checknewstatus case @reftype when "1p" ?? # set meshx imeshtmp = nil [@l0, @l2].each do |line| if line.imesh != nil imeshtmp = line.imesh end end @meshx = imeshtmp if imeshtmp != nil # set meshy imeshtmp = nil [@l1, @l3].each do |line| if line.imesh != nil imeshtmp = line.imesh end end @meshy = imeshtmp if imeshtmp != nil if @meshx < 2 @meshx = 2 end if @meshy < 2 @meshy = 2 end @newstatus = { "xlength" => @xlength, "ylength" => @ylength, "plane" => @plane, "meshx" => @meshx, "meshy" => @meshy, "externref" => @externref } when "1l" ?? # set meshnum imeshtmp = nil [@l1, @l3].each do |line| if line.imesh != nil imeshtmp = line.imesh end end @meshnum = imeshtmp if imeshtmp != nil if @meshnum < 2 @meshnum = 2 end @newstatus = { "xvec" => @xvec, "yvec" => @yvec, "zvec" => @zvec, "meshnum" => @meshnum, "externref" => @externref } when "2l" ?? # set meshnum imeshtmp = nil [@l1, @l3].each do |line| if line.imesh != nil imeshtmp = line.imesh end end @meshnum = imeshtmp if imeshtmp != nil if @meshnum < 2 @meshnum = 2 end @newstatus = { "meshnum" => @meshnum, "flipdir" => @flipdir, "externref" => @externref } end @facefacenewstatus = { "ref" => @ffref, "geom" => @ff, "adjust" => @adjust } end
# File infoface.rb, line 281 def create case @reftype when "1p" # set meshx ?? if @meshx < 2 @meshx = 2 end if @meshy < 2 @meshy = 2 end @imax = @meshx - 1 @jmax = @meshy - 1 # do the 1p referenced face # which will be upgraded a lot. Want to align it with a coordinate system instead of # input the rotations direct in the face method. #@p0 = @refs[0] # if rotation is needed a csys might be added by this class? # in fact it will be created in the x-y (or r-fi) direction of the coordinate # system that the point is referenced to @p0.pos[@csys.count] = invPositionInCsys(@csys, @p0.pos[0]) # puts "xlength #{@xlength}, ylength #{@ylength}" #@p0xz = [ @p0.pos[@csys.count][0] , @p0.pos[@csys.count][2], @p0.pos[@csys.count][1] ] #@p1xz = [ @p0xz[0] + @xlength, @p0xz[1], @p0xz[2] ] #@p2xz = [ @p0xz[0] + @xlength, @p0xz[1] + @ylength, @p0xz[2] ] #@p3xz = [ @p0xz[0] , @p0xz[1] + @ylength, @p0xz[2] ] #@p0yz = [ @p0.pos[@csys.count][1] , @p0.pos[@csys.count][2], @p0.pos[@csys.count][0] ] #@p1yz = [ @p0yz[0] + @xlength, @p0yz[1], @p0yz[2] ] #@p2yz = [ @p0yz[0] + @xlength, @p0yz[1] + @ylength, @p0yz[2] ] #@p3yz = [ @p0yz[0] , @p0yz[1] + @ylength, @p0yz[2] ] #@p1xy = [ @p0.pos[@csys.count][0]+@xlength, @p0.pos[@csys.count][1], @p0.pos[@csys.count][2] ] #@p2xy = [ @p0.pos[@csys.count][0]+@xlength, @p0.pos[@csys.count][1]+@ylength, @p0.pos[@csys.count][2] ] #@p3xy = [ @p0.pos[@csys.count][0], @p0.pos[@csys.count][1]+@ylength, @p0.pos[@csys.count][2] ] #@p1xy = invPositionInCsys(@csys, p1xytmp) #@p2xy = invPositionInCsys(@csys, p2xytmp) #@p3xy = invPositionInCsys(@csys, p3xytmp) case @plane when "xy" # puts "xy plane" @p1.pos[@csys.count] = [ @p0.pos[@csys.count][0]+@xlength, @p0.pos[@csys.count][1], @p0.pos[@csys.count][2] ] @p2.pos[@csys.count] = [ @p0.pos[@csys.count][0]+@xlength, @p0.pos[@csys.count][1]+@ylength, @p0.pos[@csys.count][2] ] @p3.pos[@csys.count] = [ @p0.pos[@csys.count][0], @p0.pos[@csys.count][1]+@ylength, @p0.pos[@csys.count][2] ] when "xz" # puts "xz plane" @p1.pos[@csys.count] = [ @p0.pos[@csys.count][0]+@xlength, @p0.pos[@csys.count][1], @p0.pos[@csys.count][2] ] @p2.pos[@csys.count] = [ @p0.pos[@csys.count][0]+@xlength, @p0.pos[@csys.count][1], @p0.pos[@csys.count][2]+@ylength ] @p3.pos[@csys.count] = [ @p0.pos[@csys.count][0], @p0.pos[@csys.count][1], @p0.pos[@csys.count][2]+@ylength ] when "yz" # puts "yz plane" @p1.pos[@csys.count] = [ @p0.pos[@csys.count][0], @p0.pos[@csys.count][1]+@xlength, @p0.pos[@csys.count][2] ] @p2.pos[@csys.count] = [ @p0.pos[@csys.count][0], @p0.pos[@csys.count][1]+@xlength, @p0.pos[@csys.count][2]+@ylength ] @p3.pos[@csys.count] = [ @p0.pos[@csys.count][0], @p0.pos[@csys.count][1], @p0.pos[@csys.count][2]+@ylength ] end @p1.pos[0] = positionInCsys(@csys, @p1.pos[@csys.count]) @p2.pos[0] = positionInCsys(@csys, @p2.pos[@csys.count]) @p3.pos[0] = positionInCsys(@csys, @p3.pos[@csys.count]) # have to be able to replace the lines with 2p ref lines referenced to InfoFace.lX InfoFace.lX # the lineonline dialog will have attributes: xaxis and radius. Point refs are already given # maybe these attributes should be attr accessor of the infoface class # like: l0xaxis, l0radius .. if they are set they add future refs to the table # FutureRef:s will not hold an object it's just additional attributes to an already # defined piece of an object. It's @info will be set so it will be "*" selected i table #l0 = InfoLine.new(@p0,@p1,self,"l0") 4 arg reftype 2p # use the method: # def meshline(p0,p1,radius,meshnum,xaxis,yaxis,zaxis,refattr,csys,parent,self1) # or InfoLine.new # these InfoLines is not created when it becomes a face with a faceface # attached # if @externref == true this is not going to happend @x[@csys.count], @y[@csys.count], @z[@csys.count] , @celldef, @l0def, @l1def, @l2def, @l3def = createfrom4points( @p0.pos[@csys.count], @p1.pos[@csys.count], @p2.pos[@csys.count], @p3.pos[@csys.count], @meshx, @meshy ) @x[0], @y[0], @z[0] = spaceinreal(@csys, @x[@csys.count], @y[@csys.count], @z[@csys.count]) if @externref createexternref end @f.create(@celldef, @x[0], @y[0], @z[0]) @l0.create(@l0def, @x[0], @y[0], @z[0]) @l0.meshnum = @meshx @l1.create(@l1def, @x[0], @y[0], @z[0]) @l1.meshnum = @meshy @l2.create(@l2def, @x[0], @y[0], @z[0]) @l2.meshnum = @meshx @l3.create(@l3def, @x[0], @y[0], @z[0]) @l3.meshnum = @meshy # create a new mesh method that take l0 to l3 as input argument (InfoLines) # these lines could be curved (with a radius) and the meshpoints should be # adjusted in a clever way. Also there could be faces applied on the face # afterward and they should fit straigth in to the mesh faces. # So this mesh function has to treat this face-on-faces as hard points(/lines). # Also it would be nice to output the worst cell skewness and aspect ratio. @currentstatus = { "xlength" => @xlength, "ylength" => @ylength, "plane" => @plane, "meshx" => @meshx, "meshy" => @meshy, "externref" => @externref } when "1l" ?? if @meshnum < 2 @meshnum = 2 end @imax = @l0.x[0].size - 1 @jmax = @meshnum - 1 # always do this before I have way telling if a coordinate system is changed ccount = @csys.count @l0.x[ccount], @l0.y[ccount], @l0.z[ccount] = spaceincsys(@csys, @l0.x[0], @l0.y[0], @l0.z[0]) #test1 = Benchmark.realtime { @x[@csys.count], @y[@csys.count], @z[@csys.count] , @celldef, @l1def, @l2def, @l3def = extrudeincsys( @l0.x[@csys.count], @l0.y[@csys.count], @l0.z[@csys.count], @xvec, @yvec, @zvec, @meshnum) #} # create a l0def for creation of facefaces, could be moved to extrudeincsys function # maybe I should throw away the original line and recreate it from l0def # then lines has be connected to the DefLine instead @l0def = Array.new (0..@l2def.size-1).each do |tmp| @l0def.push(tmp) end #test2 = Benchmark.realtime { @x[0], @y[0], @z[0] = spaceinreal(@csys, @x[@csys.count], @y[@csys.count], @z[@csys.count]) #} if @externref createexternref end #test3 = Benchmark.realtime { @f.create(@celldef, @x[0], @y[0], @z[0]) #} # the lines are made from the line definition and stored in the DefLine objects (l1..3) # I also want to have DefFace? #test4 = Benchmark.realtime { @l1.create(@l1def, @x[0], @y[0], @z[0]) @l1.meshnum = @meshnum @l2.create(@l2def, @x[0], @y[0], @z[0]) @l2.meshnum = @l0.meshnum @l3.create(@l3def, @x[0], @y[0], @z[0]) @l3.meshnum = @meshnum #} p2num = @meshnum*@l0.meshnum-1 p3num = (@meshnum-1)*@l0.meshnum @p2.xpos = @x[0][p2num] @p2.ypos = @y[0][p2num] @p2.zpos = @z[0][p2num] @p3.xpos = @x[0][p3num] @p3.ypos = @y[0][p3num] @p3.zpos = @z[0][p3num] @p2.update @p3.update # @vertex,@celldef,@f, @l0extra, @l1, @l2, @l3 = extrude(@ref,@csys,[@xvec, @yvec, @zvec], @meshnum, self) #puts "extrudeincsys #{test1}, spaceinreal #{test2}, f.create #{test3}, lX.create #{test4}" @currentstatus = { "xvec" => @xvec, "yvec" => @yvec, "zvec" => @zvec, "meshnum" => @meshnum, "externref" => @externref } when "2l" ?? if @meshnum < 2 @meshnum = 2 end @imax = @l0.x[0].size - 1 @jmax = @meshnum - 1 # do the 2l referenced face # if meshnum doesn't match, abort. Later on meshnum will be altered on one of the lines # I' going to do a function like x,y,z,celldef = realcsys2l(@l0.x[0], @l0.y[0], @l0.z[0], # @l2.x[0], @l2.y[1], @l2.z[0]) # if meshNoFromRow is set that line is choosen ccount = @csys.count # procedure to take flip dir into account if @flipdir == 1 && ( @csys.csystype == 1 || @csys.csystype == 2 ) @l0.x[ccount], @l0.y[ccount], @l0.z[ccount] = spaceincsys(@csys, @l0.x[0], @l0.y[0], @l0.z[0]) @l2.x[ccount], @l2.y[ccount], @l2.z[ccount] = spaceincsys(@csys, @l2.x[0], @l2.y[0], @l2.z[0]) # l0ytmp = Array.new l2ytmp = Array.new if @l0.y[ccount][0].abs > @l2.y[ccount][0].abs (0..(@l0.y[ccount].size-1) ).each do |idx| l0ytmp[idx] = @l0.y[ccount][idx] - 360.0 end l2ytmp = @l2.y[ccount] else (0..(@l2.y[ccount].size-1) ).each do |idx| l2ytmp[idx] = @l2.y[ccount][idx] - 360.0 end l0ytmp = @l0.y[ccount] end # use l2twist instead of calculate if it is twisted in realcsys2l @x[ccount],@y[ccount],@z[ccount],@celldef, @l1def, @l3def = realcsys2lmod(@l0.x[ccount], l0ytmp, @l0.z[ccount], @l2.x[ccount], l2ytmp, @l2.z[ccount], @meshnum, @l2twist) @x[0], @y[0], @z[0] = spaceinreal(@csys, @x[ccount], @y[ccount], @z[ccount]) else # cartesian coordinate system or no flip dir. @l0.x[ccount], @l0.y[ccount], @l0.z[ccount] = spaceincsys(@csys, @l0.x[0], @l0.y[0], @l0.z[0]) @l2.x[ccount], @l2.y[ccount], @l2.z[ccount] = spaceincsys(@csys, @l2.x[0], @l2.y[0], @l2.z[0]) @x[ccount],@y[ccount],@z[ccount],@celldef, @l1def, @l3def = realcsys2lmod(@l0.x[ccount], @l0.y[ccount], @l0.z[ccount], @l2.x[ccount], @l2.y[ccount], @l2.z[ccount], @meshnum, @l2twist) @x[0], @y[0], @z[0] = spaceinreal(@csys, @x[ccount], @y[ccount], @z[ccount]) end @l0def, @l1def, @l2def, @l3def = findAllLdef(@celldef) if @externref createexternref end @f.create(@celldef, @x[0], @y[0], @z[0]) @l1.create(@l1def, @x[0], @y[0], @z[0]) @l1.meshnum = @meshnum @l3.create(@l3def, @x[0], @y[0], @z[0]) @l3.meshnum = @meshnum # just map points when initialize #mapl2points @currentstatus = { "meshnum" => @meshnum, "flipdir" => @flipdir, "externref" => @externref } @point0, @point1, @point2, @point3 = @p0, @p1, @p2, @p3 when "2lconn" # do the 2lconn referenced face when "3l" # do the 3l referenced face #puts "l0 #{@l0}, l1 #{@l1}, l2 #{@l2}, l3 #{@l3}" #puts @l1.reftype @imax = @l0.x[0].size - 1 @jmax = @l1.x[0].size - 1 @x[0],@y[0],@z[0],@celldef = realcsys4l(@l0.x[0], @l0.y[0], @l0.z[0], @l1.x[0], @l1.y[0], @l1.z[0], @l2.x[0], @l2.y[0], @l2.z[0], @l3.x[0], @l3.y[0], @l3.z[0] ) if @externref createexternref end @f.create(@celldef, @x[0], @y[0], @z[0]) when "4l" # do the 4l referenced face #@meshnum = [@l1.x[0].size, @l3.x[0].size].max #@meshnum = @ref[1].x[0].size #@l1 = @ref[1] #@l3 = @ref[3] # the externref is made in csys, and 4l is made in realcsys... #@x[0],@y[0],@z[0],@celldef, @l1def, @l3def = realcsys2l(@l0.x[0], @l0.y[0], @l0.z[0], @l2.x[0], @l2.y[0], @l2.z[0], @meshnum) @imax = @l0.x[0].size - 1 @jmax = @l1.x[0].size - 1 ccount = @csys.count @l0.x[ccount], @l0.y[ccount], @l0.z[ccount] = spaceincsys(@csys, @l0.x[0], @l0.y[0], @l0.z[0]) @l1.x[ccount], @l1.y[ccount], @l1.z[ccount] = spaceincsys(@csys, @l1.x[0], @l1.y[0], @l1.z[0]) @l2.x[ccount], @l2.y[ccount], @l2.z[ccount] = spaceincsys(@csys, @l2.x[0], @l2.y[0], @l2.z[0]) @l3.x[ccount], @l3.y[ccount], @l3.z[ccount] = spaceincsys(@csys, @l3.x[0], @l3.y[0], @l3.z[0]) #@x[ccount],@y[ccount],@z[ccount],@celldef, @l1def, @l3def = realcsys2l(@l0.x[ccount], @l0.y[ccount], @l0.z[ccount], @l2.x[ccount], @l2.y[ccount], @l2.z[ccount], @meshnum) @x[ccount],@y[ccount],@z[ccount],@celldef = realcsys4l(@l0.x[ccount], @l0.y[ccount], @l0.z[ccount], @l1.x[ccount], @l1.y[ccount], @l1.z[ccount], @l2.x[ccount], @l2.y[ccount], @l2.z[ccount], @l3.x[ccount], @l3.y[ccount], @l3.z[ccount] ) @x[0], @y[0], @z[0] = spaceinreal(@csys, @x[ccount], @y[ccount], @z[ccount]) #@l0def, @l1def, @l2def, @l3def = findAllLdef(@celldef) if @externref createexternref end @f.create(@celldef, @x[0], @y[0], @z[0]) end # create the face: face.new(@p0, @p1, @p2, @p3) # set imax and jmax case @reftype when "1p" @imax = @meshx - 1 @jmax = @meshy - 1 when "1l" @imax = @l0.x[0].size - 1 @jmax = @meshnum - 1 when "2l" @imax = @l0.x[0].size - 1 @jmax = @meshnum - 1 when "3l" @imax = @l0.x[0].size - 1 @jmax = @l1.x[0].size - 1 when "4l" @imax = @l0.x[0].size - 1 @jmax = @l1.x[0].size - 1 end @point0, @point1, @point2, @point3 = @p0, @p1, @p2, @p3 end
faceface is created
# File infoface.rb, line 251 def createexternref @celldef, @facefacecelldef, @facefaceldef = createfacefacemesh3(@ff, @x[@csys.count], @y[@csys.count], @z[@csys.count], @celldef, @l0def, @l1def, @l2def, @l3def, @adjust) @x[0], @y[0], @z[0] = spaceinreal(@csys, @x[@csys.count], @y[@csys.count], @z[@csys.count]) # update mesh count @ffcells = Array.new (0..@facefacecelldef.size-1).each do |idx| # DefFace.new(parent, viewerobj, text) #@ffcells[idx] = DefFace.new(self, self, "ff#{idx}") @ffcells[idx] = DefFace.new(self, @ffref[idx], "ff#{idx}") @ffcells[idx].create(@facefacecelldef[idx], @x[0], @y[0], @z[0]) end @ffl0 = Array.new @ffl1 = Array.new @ffl2 = Array.new @ffl3 = Array.new (0..@facefaceldef.size-1).each do |idx| if @facefacecelldef[idx].size > 0 @ffl0[idx] = DefLine.new(@ffref[idx], "ff#{idx}l0" ) @ffl0[idx].create(@facefaceldef[idx][0], @x[0], @y[0], @z[0] ) @ffl1[idx] = DefLine.new(self, "ff#{idx}l1" ) @ffl1[idx].create(@facefaceldef[idx][1], @x[0], @y[0], @z[0] ) @ffl2[idx] = DefLine.new(self, "ff#{idx}l2" ) @ffl2[idx].create(@facefaceldef[idx][2], @x[0], @y[0], @z[0] ) @ffl3[idx] = DefLine.new(self, "ff#{idx}l3" ) @ffl3[idx].create(@facefaceldef[idx][3], @x[0], @y[0], @z[0] ) end end end
The create method position the points according to the initialized attributes. Then the lines and the face mesh are created tmp.createfaceface(xlength,ylength,refattr,xpos,ypos)
# File infoface.rb, line 238 def createfaceface(futureref, xmin, xmax, ymin, ymax, adjust) # @ff has to be able to store more info. Maybe it has to be treated as a buffer? Also the future ref # has to keep track on face cells belonging to facefaces. @ffref.push(futureref) @ff.push([xmin,xmax,ymin,ymax]) @adjust.push(adjust) @externref = true # maybe the InfoFace class has to keep track on FutureRefs? Of course it has. Only how? @facefacecurrentstatus = { "ref" => @ffref, "geom" => @ff, "adjust" => @adjust } return @ff.size - 1 end
deselect all the individual parts of the InfoFace
# File infoface.rb, line 713 def deselect @selected = false case @reftype when "1l" @l0.refdeselect @l1.deselect @l2.deselect @l3.deselect when "2l" @l0.refdeselect @l1.deselect @l2.refdeselect @l3.deselect when "1p" [@l0,@l1,@l2,@l3].each do |ltmp| if ltmp.class != Array ltmp.deselect else ltmp.each do |lseg| lseg.deselect end end end when "3l" @l0.refdeselect @l1.refdeselect @l2.refdeselect @l3.refdeselect when "4l" @l0.refdeselect @l1.refdeselect @l2.refdeselect @l3.refdeselect end if @f.class == Array @f.each do |tmp| tmp.deselect end else @f.deselect end end
# File infoface.rb, line 967 def find4l @l0, @l1, @l2, @l3, @p0, @p1, @p2, @p3 = findStructure4lalt(@ref) @firstline = @l0 @secondline = @l1 @thirdline = @l2 @fourthline = @l3 end
# File infoface.rb, line 853 def getlinename(input) if input == @l0 return "l0" end if input == @l1 return "l1" end if input == @l2 return "l2" end if input == @l3 return "l3" end end
# File infoface.rb, line 836 def getopposingline(input) #puts "getopposing input #{input.info[0].info[2]}.#{ input.info[2]}" if input == @l0 return @l2 end if input == @l1 return @l3 end if input == @l2 return @l0 end if input == @l3 return @l1 end end
hide the InfoFace in the specified $globalscene
# File infoface.rb, line 622 def hide @visible = false @f.hide case @reftype when "1p" @p0.hide @p1.hide @p2.hide @p3.hide @l0.hide @l1.hide @l2.hide @l3.hide when "1l" @p2.hide @p3.hide @l1.hide @l2.hide @l3.hide when "2l" @l1.hide @l3.hide when "3l" @l3.hide end if @ffcells != nil @ffcells.each do |tmp| tmp.hide end end if @ffl0 != nil @ffl0.each do |tmp| tmp.hide end @ffl1.each do |tmp| tmp.hide end @ffl2.each do |tmp| tmp.hide end @ffl3.each do |tmp| tmp.hide end end end
# File infoface.rb, line 939 def mapl2points if @l2.class == DefLine || @l2.class == InfoLine pfirst = @l2.firstpoint.pos[0] psecond = @l2.lastpoint.pos[0] pthird = @p0.pos[0] pfourth = @p1.pos[0] v1 = [ psecond[0] - pfirst[0], psecond[1] - pfirst[1], psecond[2] - pfirst[2] ] v2 = [ pfourth[0] - pthird[0], pfourth[1] - pthird[1], pfourth[2] - pthird[2] ] begin angle = angleBetween(v1, v2) rescue @angle = 0.0 end if angle < 90.0 @p3 = @l2.firstpoint @p2 = @l2.lastpoint @l2twist = true else @p3 = @l2.lastpoint @p2 = @l2.firstpoint @l2twist = false end end @l1.firstpoint = @p1 @l1.lastpoint = @p2 @l3.firstpoint = @p3 @l3.lastpoint = @p0 end
# File infoface.rb, line 675 def select @selected = true case @reftype when "1l" @l0.refselect @l1.select @l2.select @l3.select when "2l" @l0.refselect @l1.select @l2.refselect @l3.select when "1p" [@l0,@l1,@l2,@l3].each do |ltmp| if ltmp.class != Array ltmp.select else ltmp.each do |lseg| lseg.select end end end when "3l" @l0.refselect @l1.refselect @l2.refselect @l3.select when "4l" @l0.refselect @l1.refselect @l2.refselect @l3.refselect end @f.select end
show the InfoFace in $globalscene
# File infoface.rb, line 566 def show @visible = true if $pointvisibility @p0.show @p1.show @p2.show @p3.show else @p0.hide @p1.hide @p2.hide @p3.hide end if $linevisibility case @reftype when "1p" @l0.show @l1.show @l2.show @l3.show when "1l" @l1.show @l2.show @l3.show when "2l" @l1.show @l3.show when "3l" @l3.show end if @ffl0.class != NilClass @ffl0.each do |tmp| tmp.show end @ffl1.each do |tmp| tmp.show end @ffl2.each do |tmp| tmp.show end @ffl3.each do |tmp| tmp.show end end end if $facevisibility @f.show if @ffcells != nil @ffcells.each do |tmp| tmp.show end end end end
# File infoface.rb, line 930 def uncount uncountno = 1 if @@count >= uncountno @@count -= uncountno end end
# File infoface.rb, line 885 def update #checkchild # also used for 2l case @reftype when "1p" @reflist = { "xlength" => @xlength, "ylength" => @ylength, "plane" => @plane, "meshx" => @meshx, "meshy" => @meshy } checknewstatus if @newstatus != @currentstatus || @p0.changed || @oldcsyspos != @csys.getpos || @facefacenewstatus != @facefacecurrentstatus hide create show @changed = true end when "1l" @reflist = { "xvec" => @xvec, "yvec" => @yvec, "zvec" => @zvec, "meshnum" => @meshnum } checknewstatus if @newstatus != @currentstatus || @l0.info[0].changed || @oldcsyspos != @csys.getpos || @facefacenewstatus != @facefacecurrentstatus hide create show @changed = true end when "2l" @reflist = { "meshnum" => @meshnum, "flipdir" => @flipdir } checknewstatus if @newstatus != @currentstatus || (@l0.info[0].changed || @l2.info[0].changed) || @oldcsyspos != @csys.getpos || @facefacenewstatus != @facefacecurrentstatus hide create show @changed = true end when "4l" if @l0.info[0].changed || @l1.info[0].changed || @l2.info[0].changed || @l3.info[0].changed || @oldcsyspos != @csys.getpos || @facefacenewstatus != @facefacecurrentstatus || true hide create show @changed = true end end #unless ( @oldreflist == @reflist && ( @csys.count == 0 || @oldcsyspos == @csys.getpos ) && @oldimax == @imax && @oldjmax == @jmax ) && test4l && !@externref if @csys.count != 0 @oldcsyspos = @csys.getpos end #end end