class OMX::OMXData

Class to read the data from the OMX file

Public Class Methods

new(file, table, zones) click to toggle source
# File lib/OpenMatriX.rb, line 320
def initialize(file, table, zones)
  @id = file.id
  @gId = OMXTables::gOpen(@id,"data",0)
  @zones = zones
  b = basic_open(@gId,table)
  filespace = h5dspace(b)
  rank = h5sN(filespace)
  dims = FFI::MemoryPointer.new(H5Types.hsize_t)
  maxdims = FFI::MemoryPointer.new(H5Types.hsize_t)
  status_n = h5sD(filespace,dims,maxdims)
  cparms = h5dpl(b)
  if h5pLayout(cparms)
    chunk_dims = FFI::MemoryPointer.new(H5Types.hsize_t)
    rank_chunk = h5pGetChunk(cparms, maxdims.read_int(), chunk_dims)
  end
  memspace = h5sCreate(2, dims, nil)
  type = h5dtype(b)
  buffer = FFI::MemoryPointer.new(type,2)
  c = h5dRead(b, type, memspace, filespace, 0, buffer)
  ask_zones = zones * zones
  @outAry = buffer.get_array_of_double(0,ask_zones)
end

Public Instance Methods

getI(zone) click to toggle source
# File lib/OpenMatriX.rb, line 343
def getI(zone)
  return(@outAry[(zone-1)*@zones,@zones])
end
getIJ(i,j) click to toggle source
# File lib/OpenMatriX.rb, line 347
def getIJ(i,j)
  a = @outAry[(i-1)*@zones,@zones]
  return(a[j-1])
end
getJ(j) click to toggle source
# File lib/OpenMatriX.rb, line 352
def getJ(j)
  out ||= []
  for i in 0..@zones-1
    x = @outAry[i*@zones,j]
    out << x[j-1]
  end
  return(out)
end