Class InternalFace
In: internal.rb
Parent: Object

Methods

getfacedef   getpointno   imax   jmax   new  

Attributes

context  [RW] 
i  [RW] 
if1type  [RW] 
imod  [RW]  temporary accessors
j  [RW] 
jmod  [RW]  temporary accessors
parent  [RW] 
type  [RW] 

Public Class methods

type is 0 to 7, context is internal face no 0 to 5, parent is parent face

[Source]

# File internal.rb, line 30
   def initialize(type, context, parent,if1type)
      @type = type
      @context = context
      @parent = parent
      @if1type = if1type
      #puts "type #{type}, context #{context}, parent #{parent.info[2]}"
      # find which position for getpointno calculation
      # n m is imod jmod
      # ifunc = i*iflag[n][0] + j*iflag[n][1] + (imax-i)*iflag[n][2] + (jmax-i)*iflag[n][3]
      # jfunc = j*jflag[m][0] + i*jflag[m][1] + (imax-j)*jflag[m][2] + (jmax-j)*jflag[m][3]
      #
      @iflag = [ [1,0,0,0,0,0], [0,1,0,0,0,0], [0,0,1,0,0,0], [0,0,0,1,0,0], [0,0,0,0,1,0], [0,0,0,0,0,1] ]
      @jflag = @iflag
      # put this stuff in an Array
      # ijmods1 is for context == 1
      ijmods = Array.new
      ijmods[0] = [ [0,1], [0,1], [0,1], [0,1], [0,1], [0,1], [0,1], [0,1] ]
      #ijmods[1] = [ [0,1], [3,1], [2,5], [0,5], [2,1], [2,5], [0,5], [0,1] ]
      #ijmods[2] = [ [0,1], [3,1], [2,5], [0,5], [2,1], [2,5], [0,5], [0,1] ]
      ijmods[1] = [ [0,1], [5,0], [2,5], [1,2], [2,1], [5,2], [0,5], [1,0] ]
      ijmods[2] = [ [0,1], [5,0], [2,5], [1,2], [2,1], [5,2], [0,5], [1,0] ]
      #ijmods[3] = [ [2,1], [2,5], [0,5], [0,1], [0,1], [2,1], [2,5], [0,5] ]
      #ijmods[4] = [ [2,1], [2,5], [0,5], [0,1], [0,1], [2,1], [2,5], [0,5] ]
      ijmods[3] = [ [2,1], [5,2], [0,5], [1,0], [0,1], [5,0], [2,5], [1,2] ]
      ### ijmods[3] = [ [2,1], [5,3], [0,5], [1,0], [0,1], [5,0], [2,5], [1,2] ]
      # 2-1 3-5 0-5 0-1 0-1 2-1 2-5 0-5
      # strange ijmods[4] = [ [2,1], [3,5], [0,5], [0,1], [0,1], [2,1], [2,5], [0,5] ]
      ijmods[4] = [ [2,1], [5,2], [0,5], [1,0], [0,1], [5,0], [2,5], [1,2] ]
      #ijmods[4] = [ [2,1], [5,3], [0,5], [1,0], [0,1], [5,0], [2,5], [1,2] ]
      #ijmods[5] = [ [2,1], [2,5], [0,5], [0,1], [0,1], [2,1], [2,5], [0,5] ]
      #0-1 3-1 2-5 0-5 2-1 2-5 0-5 0-1
      #2-1 3-5 0-5 0-1 0-1 2-1 2-5 0-5
      #0-2 5-1 2-0 1-5 2-0 1-5 0-2 5-1
      # 0-2 1-5 : 2-0 5-1 2-0 5-1 : 0-2 1-5
      # 2-1 5-3 0-5 1-0 0-1 5-0 2-5 1-2
      # 0-1 5-0 2-5 1-2 2-1 5-2 0-5 1-0
      # depends on if1 type
      if @context == 5 && @if1type > 3
         #ijmods[5] = [ [0,1], [3,1], [2,5], [0,5], [2,1], [2,5], [0,5], [0,1] ]
         ijmods[5] = [ [0,1], [5,0], [2,5], [1,2], [2,1], [5,2], [0,5], [1,0] ]
      else
         #ijmods[5] = [ [2,1], [3,5], [0,5], [0,1], [0,1], [2,1], [2,5], [0,5] ]
         # here I got some trouble
         #ijmods[5] = [ [2,1], [3,5], [0,5], [0,1], [0,1], [2,1], [2,5], [1,2] ]
         ijmods[5] = [ [2,1], [5,2], [0,5], [1,0], [0,1], [5,0], [2,5], [1,2] ]
      end
      #ijmods[5] = [ [0,1], [3,5], [0,5], [0,1], [0,1], [2,1], [2,5], [0,5] ]
??
      @imod, @jmod = ijmods[@context][@type]
   end

Public Instance methods

[Source]

# File internal.rb, line 144
   def getfacedef(offset)
   end

[Source]

# File internal.rb, line 126
   def getpointno(i,j)
      #puts "context is #{@context}, type is #{@type}"
      imod1 = i*@iflag[@imod][0] + j*@iflag[@imod][1] + (imax-i)*@iflag[@imod][2] + (jmax-i)*@iflag[@imod][3] + (imax-j)*@iflag[@imod][4] + (jmax-j)*@iflag[@imod][5]
      jmod1 = i*@jflag[@jmod][0] + j*@jflag[@jmod][1] + (imax-i)*@jflag[@jmod][2] + (jmax-i)*@jflag[@jmod][3] + (imax-j)*@jflag[@jmod][4] + (jmax-j)*@jflag[@jmod][5]

      # jmod1 = j*@jflag[@jmod][0] + i*@jflag[@jmod][1] + (imax-j)*@jflag[@jmod][2] + (jmax-j)*@jflag[@jmod][3] + (imax-i)*@jflag[@jmod][4] + (jmax-i)*@jflag[@jmod][5]
      if @type == 1 || @type == 3 || @type == 5 || @type == 7
         if ( jmod1*(jmax + 1) + imod1 ) < 0
            puts "xxx context is #{@context}, type is #{@type}"
         end
         return jmod1*(jmax + 1) + imod1
      else
         if ( jmod1*(imax + 1) + imod1 ) < 0 
            puts "xxx context is #{@context}, type is #{@type}"
         end
         return jmod1*(imax + 1) + imod1
      end
   end

[Source]

# File internal.rb, line 87
   def imax
      # depending on type and context return imax or jmax of parent
      if @context == 0
            return @parent.imax
      #elsif @context == 3 && @type == 1
      #   return @parent.imax
      elsif @context == 1 || @context == 3 || @context == 5
         if @type == 0 || @type == 2 || @type == 4 || @type == 6
            return @parent.imax
         elsif @type == 1 || @type == 3 || @type == 5 || @type == 7
            return @parent.jmax
         end
      elsif @context == 2 || @context == 4
         if @type == 0 || @type == 2 || @type == 4 || @type == 6
            return @parent.imax
         elsif @type == 1 || @type == 3 || @type == 5 || @type == 7
            return @parent.jmax
         end
      end
   end

[Source]

# File internal.rb, line 107
   def jmax
      if @context == 0
            return @parent.jmax
      #elsif @context == 3 && @type == 1
      #   return @parent.jmax
      elsif @context == 1 || @context == 3 || @context == 5
         if @type == 0 || @type == 2 || @type == 4 || @type == 6
            return @parent.jmax
         elsif @type == 1 || @type == 3 || @type == 5 || @type == 7
            return @parent.imax
         end
      elsif @context == 2 || @context == 4
         if @type == 0 || @type == 2 || @type == 4 || @type == 6
            return @parent.jmax
         elsif @type == 1 || @type == 3 || @type == 5 || @type == 7
            return @parent.imax
         end
      end
   end

[Validate]