Class InfoCube1p
In: infocube.rb
Parent: CubeCommon

Methods

cellcount   checknewstatus   create   new   refupdate   reset   update  

Attributes

meshx  [RW] 
meshy  [RW] 
meshz  [RW] 
xlength  [RW] 
ylength  [RW] 
zlength  [RW] 

Public Class methods

[Source]

# File infocube.rb, line 261
      def initialize(reftype, csys, *args)
         print "\nInfoCube1p: "
         @changed = false
         $cubecount001 += 1
         @selected = false
         @visible = false
         @reftype = reftype
         @csys = csys
         @ref = args[0]
         @row = args[1]
         @xlength = args[2].to_f
         @ylength = args[3].to_f
         @zlength = args[4].to_f
         @meshx = args[5].to_i
         @meshy = args[6].to_i
         @meshz = args[7].to_i
         @info = [self, self, "c#{$cubecount001}"]
         @defaultprefix = "cube"
         @reforder = [ "xlength", "ylength", "zlength", "meshx", "meshy", "meshz" ]
         @reflist = { "xlength" => @xlength, "ylength" => @ylength, "zlength" => @zlength, "meshx" => @meshx, "meshy" => @meshy, "meshz" => @meshz }
         # f0
         @f0 = InfoFace.new("1p", @csys, @ref, self, "f0", @row,
                                    @xlength.to_f,
                                    @ylength.to_f,
                                    "xy",
                                    @meshx.to_i,
                                    @meshy.to_i)
         @f0.uncount
         @p0 = @f0.p0
         @p1 = @f0.p1
         @p2 = @f0.p2
         @p3 = @f0.p3
         @l0 = @f0.l0
         @l1 = @f0.l1
         @l2 = @f0.l2
         @l3 = @f0.l3
         print ":f0 "
         # p4
         xpos1, ypos1, zpos1 = @p0.pos[@csys.count]
         zpos1 += @zlength
         @p4 = InfoPoint.new(@csys, xpos1, ypos1, zpos1, self,"p4")
         # f0
         @f5 = InfoFace.new("1p", @csys, @p4, self, "f5", @row,
                                    @xlength.to_f,
                                    @ylength.to_f,
                                    "xy",
                                    @meshx.to_i,
                                    @meshy.to_i)
         @f5.uncount
         @p4 = @f5.p0
         @p5 = @f5.p1
         @p6 = @f5.p2
         @p7 = @f5.p3
         @l8 = @f5.l0
         @l9 = @f5.l1
         @l10 = @f5.l2
         @l11 = @f5.l3
         print ":f5 "
         # f1
         @f1 = InfoFace.new("2l",@csys, [@l0, @l8], self, "f1", @row, @meshz.to_i)
         @f1.uncount
         @l4 = @f1.l3
         @l5 = @f1.l1
         print ":f1 "
         # f3
         @f3 = InfoFace.new("2l",@csys, [@l2, @l10], self, "f3", @row, @meshz.to_i)
         @f3.uncount
         @l6 = @f3.l3
         @l7 = @f3.l1
         # f2
         @f2 = InfoFace.new("4l",@csys, [@l1, @l5, @l6, @l9], self, "f2", @row)
         @f2.uncount
         print ":f2 "
         # f4
         @f4 = InfoFace.new("4l",@csys, [@l3, @l4, @l7, @l11], self, "f4", @row)
         @f4.uncount
         print ":f4 "


############################################################
         if false
         # f1
         @f1 = InfoFace.new("1l",@csys, @f0.firstline, self, "f1", @row, 
                                          0.0,
                                          0.0,
                                          @zlength.to_f,
                                          @meshz.to_i)
         @f1.uncount
         @p4 = @f1.p3
         @p5 = @f1.p2
         @l4 = @f1.l3
         @l5 = @f1.l1
         @l8 = @f1.l2
         print ":f1 "
         # f3
         @f3 = InfoFace.new("1l",@csys, @f0.thirdline, self, "f3", @row, 
                                          0.0,
                                          0.0,
                                          @zlength.to_f,
                                          @meshz.to_i)
         @f3.uncount
         @p6 = @f3.p3
         @p7 = @f3.p2
         @l6 = @f3.l3
         @l7 = @f3.l1
         @l10 = @f3.l2
         print ":f3 "
         # f5
         @f5 = InfoFace.new("2l",@csys, [@f1.l2, @f3.l2], self, "f5", @row, @meshy.to_i)
         @f5.uncount
         @l9 = @f5.l3
         @l11 = @f5.l1
         print ":f5 "
         # f2
         @f2 = InfoFace.new("4l",@csys, [@f0.l1, @f1.l1, @f5.l3, @f3.l3], self, "f2", @row)
         @f2.uncount
         print ":f2 "
         # f4
         @f4 = InfoFace.new("4l",@csys, [@f0.l3, @f1.l3, @f5.l1, @f3.l1], self, "f4", @row)
         @f4.uncount
         print ":f4 "
         end # temporary disable
         # all
         #@p0.info[0] = self
         @p1.info[0] = self
         @p2.info[0] = self
         @p3.info[0] = self
         @p4.info[0] = self
         @p5.info[0] = self
         @p6.info[0] = self
         @p7.info[0] = self
         @l0.info[0] = self
         @l1.info[0] = self
         @l2.info[0] = self
         @l3.info[0] = self
         @l4.info[0] = self
         @l5.info[0] = self
         @l6.info[0] = self
         @l7.info[0] = self
         @l8.info[0] = self
         @l9.info[0] = self
         @l10.info[0] = self
         @l11.info[0] = self
         # set the right face names for cube. Points and lines have to be done later on.
         #@p0.info[2] = "p0"
         @p1.info[2] = "p1"
         @p2.info[2] = "p2"
         @p3.info[2] = "p3"
         @p4.info[2] = "p4"
         @p5.info[2] = "p5"
         @p6.info[2] = "p6"
         @p7.info[2] = "p7"
         @l0.info[2] = "l0"
         @l1.info[2] = "l1"
         @l2.info[2] = "l2"
         @l3.info[2] = "l3"
         @l4.info[2] = "l4"
         @l5.info[2] = "l5"
         @l6.info[2] = "l6"
         @l7.info[2] = "l7"
         @l8.info[2] = "l8"
         @l9.info[2] = "l9"
         @l10.info[2] = "l10"
         @l11.info[2] = "l11"
         #@c0 = InfoCube6f.new("6f",@csys, [@f0, @f1, @f2, @f3, @f4, @f5])
         #@c0.uncount
         #print ":c0 "
         # after findStructure6f is done maybe points and lines could be given unique names
         #@if = findStructure6f([@f0, @f1, @f2, @f3, @f4, @f5])
         #show
         print "OK\n"
         @firstcreate = true
         @oldcsyspos = @csys.getpos
      end

Public Instance methods

[Source]

# File infocube.rb, line 576
      def cellcount
         return @meshx * @meshy * @meshz
      end

[Source]

# File infocube.rb, line 520
      def checknewstatus
         # set meshx
??
         # check imesh on lines 0 1 3 x y z
         if @l0.imesh != @meshx
            if @l0.imesh.class == Fixnum 
               @meshx = @l0.imesh
            end
         end
         if @l1.imesh != @meshy
            if @l1.imesh.class == Fixnum 
               @meshy = @l1.imesh
            end
         end
         if @l4.imesh != @meshz
            if @l4.imesh.class == Fixnum 
               @meshz = @l4.imesh
            end
         end
         @newstatus = { "xlength" => @xlength, "ylength" => @ylength, "zlength" => @zlength, "meshx" => @meshx, "meshy" => @meshy, "meshz" => @meshz }
      end

[Source]

# File infocube.rb, line 435
      def create
         # set meshx
??
         # f0
         @f0.meshx = @meshx
         @f0.meshy = @meshy
         @f0.xlength = @xlength
         @f0.ylength = @ylength
         # f5
         @f5.meshx = @meshx
         @f5.meshy = @meshy
         @f5.xlength = @xlength
         @f5.ylength = @ylength
         # f1
         @f1.meshnum = @meshz
         @f1.zvec = @zlength
         # f3
         @f3.meshnum = @meshz
         @f3.zvec = @zlength
         # f0
         @f0.create
         xpos1, ypos1, zpos1 = @p0.pos[@csys.count]
         zpos1 += @zlength
         @p4.xpos, @p4.ypos, @p4.zpos = xpos1, ypos1, zpos1 
         @p4.update
         # f5
         @f5.create
         # f1
         @f1.mapl2points if @firstcreate
         @f1.create 
         # f3
         @f3.mapl2points if @firstcreate
         @f3.create 
         # f2
         @f2.find4l if @firstcreate
         @f2.create 
         # f4
         @f4.find4l if @firstcreate
         @f4.create 
         
         if false
         # f5
         @f5.meshnum = @meshy
         # f1
         @f1.meshnum = @meshz
         @f1.zvec = @zlength
         # f3
         @f3.meshnum = @meshz
         @f3.zvec = @zlength
         # f0
         @f0.create
         # f1
         @f1.create
         # f3
         @f3.create 
         # f5
         @f5.mapl2points if @firstcreate
         @f5.create 
         # f2
         @f2.find4l if @firstcreate
         @f2.create 
         # f4
         @f4.find4l if @firstcreate
         @f4.create 
         end # temporary disable
         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 = { "xlength" => @xlength, "ylength" => @ylength, "zlength" => @zlength, "meshx" => @meshx, "meshy" => @meshy, "meshz" => @meshz }
      end

[Source]

# File infocube.rb, line 557
      def refupdate
         @reflist = { "xlength" => @xlength, "ylength" => @ylength, "zlength" => @zlength, "meshx" => @meshx, "meshy" => @meshy, "meshz" => @meshz }
      end

[Source]

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

[Source]

# File infocube.rb, line 560
      def update
         @reflist = { "xlength" => @xlength, "ylength" => @ylength, "zlength" => @zlength, "meshx" => @meshx, "meshy" => @meshy, "meshz" => @meshz }
         checknewstatus
         if @newstatus != @currentstatus || @p0.changed || @oldcsyspos != @csys.getpos
            hide
            create
            @changed = true
            show
         end
         if @csys.count != 0
            @oldcsyspos = @csys.getpos
         end
      end

[Validate]