Esempio n. 1
0
        public HpcVertexReader(HpcLinqVertexEnv denv, HpcLinqFactory <T> readerFactory, UInt32 startPort, UInt32 endPort)
        {
            this.m_dvertexEnv     = denv;
            this.m_nativeHandle   = denv.NativeHandle;
            this.m_readerFactory  = readerFactory;
            this.m_startPort      = startPort;
            this.m_numberOfInputs = endPort - startPort;
            this.m_portPermArray  = new UInt32[this.NumberOfInputs];
            for (UInt32 i = 0; i < this.NumberOfInputs; i++)
            {
                this.m_portPermArray[i] = i;
            }
            if (!denv.KeepInputPortOrder)
            {
                Random rdm = new Random(System.Diagnostics.Process.GetCurrentProcess().Id);
                Int32  max = (Int32)this.NumberOfInputs;
                for (UInt32 i = 1; i < this.NumberOfInputs; i++)
                {
                    int    idx = rdm.Next(max);
                    UInt32 n   = this.m_portPermArray[max - 1];
                    this.m_portPermArray[max - 1] = this.m_portPermArray[idx];
                    this.m_portPermArray[idx]     = n;
                    max--;
                }
            }

            this.m_readers = new HpcRecordReader <T> [this.NumberOfInputs];
            for (UInt32 i = 0; i < this.NumberOfInputs; i++)
            {
                this.m_readers[i] = this.m_readerFactory.MakeReader(this.m_nativeHandle, startPort + i);
            }
            this.m_isUsed = false;
        }
Esempio n. 2
0
        public HpcVertexWriter(HpcLinqVertexEnv denv, HpcLinqFactory <T> writerFactory, UInt32 portNum)
        {
            this.m_dvertexEnv      = denv;
            this.m_nativeHandle    = denv.NativeHandle;
            this.m_startPort       = portNum;
            this.m_numberOfOutputs = 1;
            this.m_writerFactory   = writerFactory;
            Int32 buffSize             = this.m_dvertexEnv.GetWriteBuffSize();
            HpcRecordWriter <T> writer = writerFactory.MakeWriter(this.m_nativeHandle, portNum, buffSize);

            this.m_writers = new HpcRecordWriter <T>[] { writer };
        }
Esempio n. 3
0
        public HpcVertexReader(HpcLinqVertexEnv denv, HpcLinqFactory <T> readerFactory, UInt32 portNum)
        {
            this.m_dvertexEnv     = denv;
            this.m_nativeHandle   = denv.NativeHandle;
            this.m_readerFactory  = readerFactory;
            this.m_startPort      = portNum;
            this.m_numberOfInputs = 1;
            this.m_portPermArray  = new UInt32[] { 0 };
            HpcRecordReader <T> reader = readerFactory.MakeReader(this.m_nativeHandle, portNum);

            this.m_readers = new HpcRecordReader <T>[] { reader };
            this.m_isUsed  = false;
        }
Esempio n. 4
0
 public HpcVertexWriter <T> MakeWriter <T>(HpcLinqFactory <T> writerFactory)
 {
     if (this.m_nextOutputPort + 1 < this.m_vertexParams.OutputArity)
     {
         UInt32 portNum = (UInt32)this.m_nextOutputPort++;
         return(new HpcVertexWriter <T>(this, writerFactory, portNum));
     }
     else
     {
         UInt32 startPort = (UInt32)this.m_nextOutputPort;
         UInt32 endPort   = this.NumberOfOutputs;
         return(new HpcVertexWriter <T>(this, writerFactory, startPort, endPort));
     }
 }
Esempio n. 5
0
 public HpcVertexReader <T> MakeReader <T>(HpcLinqFactory <T> readerFactory)
 {
     if (this.m_nextInputPort + 1 < this.m_vertexParams.InputArity)
     {
         UInt32 portNum = (UInt32)this.m_nextInputPort++;
         return(new HpcVertexReader <T>(this, readerFactory, portNum));
     }
     else
     {
         UInt32 startPort = (UInt32)this.m_nextInputPort;
         UInt32 endPort   = this.NumberOfInputs;
         return(new HpcVertexReader <T>(this, readerFactory, startPort, endPort));
     }
 }
Esempio n. 6
0
        public HpcVertexWriter(HpcLinqVertexEnv denv, HpcLinqFactory <T> writerFactory, UInt32 startPort, UInt32 endPort)
        {
            this.m_dvertexEnv      = denv;
            this.m_nativeHandle    = denv.NativeHandle;
            this.m_startPort       = startPort;
            this.m_numberOfOutputs = endPort - startPort;
            this.m_writerFactory   = writerFactory;
            this.m_writers         = new HpcRecordWriter <T> [this.m_numberOfOutputs];
            Int32 buffSize = this.m_dvertexEnv.GetWriteBuffSize();

            for (UInt32 i = 0; i < this.m_numberOfOutputs; i++)
            {
                this.m_writers[i] = writerFactory.MakeWriter(this.m_nativeHandle, i + startPort, buffSize);
            }
        }