Class InfoCube2f
In: infocube.rb
Parent: CubeCommon

Methods

cellcount   checknewstatus   create   new   refupdate   reset   update  

Attributes

flipdir  [RW] 
meshnum  [RW] 
twist  [RW] 

Public Class methods

[Source]

# File infocube.rb, line 758
      def initialize(reftype, csys, *args)
         print "\nInfoCube1f: "
         @changed = false
         $cubecount001 += 1
         @selected = false
         @visible = false
         @reftype = reftype
         @csys = csys
         @ref = args[0]
         @row = args[1]
         @twist = args[2]
         @flipdir = args[3]
         @meshnum = args[4]
         @info = [self, self, "c#{$cubecount001}"]
         @defaultprefix = "cube"
         @reforder = [ "twist", "flipdir", "meshnum" ]
         @reflist = { "twist" => @twist, "flipdir" => @flipdir, "meshnum" => @meshnum }
         @f0 = @ref[0]
         @f5 = @ref[1]
         # twist is 0 to 3 maybe 0 to 7
         if @twist.to_i == 0
            @f5first = @f5.firstline
            @f5second = @f5.secondline
            @f5third = @f5.thirdline
            @f5fourth = @f5.fourthline
         elsif @twist.to_i == 1
            @f5second = @f5.firstline
            @f5third = @f5.secondline
            @f5fourth = @f5.thirdline
            @f5first = @f5.fourthline
         elsif @twist.to_i == 2
            @f5third = @f5.firstline
            @f5fourth = @f5.secondline
            @f5first = @f5.thirdline
            @f5second = @f5.fourthline
         elsif @twist.to_i == 3
            @f5fourth = @f5.firstline
            @f5first = @f5.secondline
            @f5second = @f5.thirdline
            @f5third = @f5.fourthline
         else
            @f5first = @f5.firstline
            @f5second = @f5.secondline
            @f5third = @f5.thirdline
            @f5fourth = @f5.fourthline
         end
         @f1 = InfoFace.new("2l",@csys, [@f0.firstline, @f5first], self, "f5", @row, @meshnum ,@flipdir)
         @f1.uncount
         @f3 = InfoFace.new("2l",@csys, [@f0.thirdline, @f5third], self, "f3", @row, @meshnum ,@flipdir)
         @f3.uncount
         ref1 = [@f0.secondline, @f1.l3, @f3.l3, @f5second, @f5fourth, @f1.l1, @f3.l1 ]
         @f2 = InfoFace.new("4l",@csys, ref1, self, "f2", @row)
         @f2.uncount
         ref2 = [@f0.fourthline, @f1.l1, @f3.l1, @f5second, @f5fourth, @f1.l3, @f3.l3 ]
         @f4 = InfoFace.new("4l",@csys, ref2, self, "f4", @row)
         @f4.uncount
         @l4 = @f1.l3
         @l5 = @f1.l1
         @l6 = @f3.l3
         @l7 = @f3.l1
         @l4.info[0] = self
         @l5.info[0] = self
         @l6.info[0] = self
         @l7.info[0] = self
         @l4.info[2] = "l4"
         @l5.info[2] = "l5"
         @l6.info[2] = "l6"
         @l7.info[2] = "l7"
         print ":c0 "
         @firstcreate = true
         print "OK\n"
         @oldcsyspos = @csys.getpos
      end

Public Instance methods

[Source]

# File infocube.rb, line 927
      def cellcount
         return ( @f0.l0.meshnum-1 ) * ( @f0.l1.meshnum - 1 ) * @meshnum
      end

[Source]

# File infocube.rb, line 894
      def checknewstatus
??
         # check imesh on lines
         if @l4.imesh != @meshnum
            if @l4.imesh.class == Fixnum 
               @meshnum = @l4.imesh
            end
         end
         @newstatus = { "twist" => @twist, "flipdir" => @flipdir, "meshnum" => @meshnum }
      end

[Source]

# File infocube.rb, line 831
      def create
??
         # twist is 0 to 3
         if @twist.to_i == 0
            @f5first = @f5.firstline
            @f5second = @f5.secondline
            @f5third = @f5.thirdline
            @f5fourth = @f5.fourthline
         elsif @twist.to_i == 1
            @f5second = @f5.firstline
            @f5third = @f5.secondline
            @f5fourth = @f5.thirdline
            @f5first = @f5.fourthline
         elsif @twist.to_i == 2
            @f5third = @f5.firstline
            @f5fourth = @f5.secondline
            @f5first = @f5.thirdline
            @f5second = @f5.fourthline
         elsif @twist.to_i == 3
            @f5fourth = @f5.firstline
            @f5first = @f5.secondline
            @f5second = @f5.thirdline
            @f5third = @f5.fourthline
         else
            @f5first = @f5.firstline
            @f5second = @f5.secondline
            @f5third = @f5.thirdline
            @f5fourth = @f5.fourthline
         end
         @f1.l2 = @f5first 
         @f1.flipdir = @flipdir
         @f1.mapl2points
         @f1.meshnum = @meshnum
         @f3.l2 = @f5third 
         @f3.flipdir = @flipdir
         @f3.mapl2points
         @f3.meshnum = @meshnum
         @f1.create
         @f3.create 
         ref1 = [@f0.secondline, @f1.l3, @f3.l3, @f5second, @f5fourth, @f1.l1, @f3.l1 ]
         #l0tmp, l1tmp, l2tmp, l3tmp = findStructure4lalt(ref1)
         #@f2.l0, @f2.l1, @f2.l2, @f2.l3 = l0tmp, l1tmp, l2tmp, l3tmp
         @f2.ref = ref1
         @f2.find4l #if @firstcreate
         @f2.create 
         ref2 = [@f0.fourthline, @f1.l1, @f3.l1, @f5second, @f5fourth, @f1.l3, @f3.l3 ]
         l0tmp, l1tmp, l2tmp, l3tmp = findStructure4lalt(ref1)
         #@f4.l0, @f4.l1, @f4.l2, @f4.l3 = l0tmp, l1tmp, l2tmp, l3tmp
         @f4.ref = ref2
         @f4.find4l #if @firstcreate
         @f4.create 
         if @firstcreate 
            @c0 = InfoCube6f.new("6f",@csys, [@f0, @f1, @f2, @f3, @f4, @f5])
            @c0.uncount
            @if = findStructure6f([@f0, @f1, @f2, @f3, @f4, @f5])
            @firstcreate = false
         end
         @currentstatus = { "twist" => @twist, "flipdir" => @flipdir, "meshnum" => @meshnum }
      end

[Source]

# File infocube.rb, line 908
      def refupdate
         @reflist = { "twist" => @twist, "flipdir" => @flipdir, "meshnum" => @meshnum }
      end

[Source]

# File infocube.rb, line 924
      def reset
         $cubecount001 = -1
      end

[Source]

# File infocube.rb, line 911
      def update
         @reflist = { "twist" => @twist, "flipdir" => @flipdir, "meshnum" => @meshnum }
         checknewstatus
         if @newstatus != @currentstatus || @f0.info[0].changed || @f5.info[0].changed || @oldcsyspos != @csys.getpos
            hide
            create
            @changed = true
            show
         end
         if @csys.count != 0
            @oldcsyspos = @csys.getpos
         end
      end

[Validate]