Example #1
0
        /// <summary>
        /// Add a single option to the collection.
        /// </summary>
        /// <param name="opt">Option to add</param>
        public void Add(CudaJitOption opt)
        {
            if (_count >= MAX_ELEM - 2)
            {
                throw new Exception("Maximum number of options elements reached!");
            }

            _cudaOptions.Add(opt);

            if (opt is CudaJOErrorLogBuffer) //add two elements
            {
                CUJITOption[] o = opt.Options;
                IntPtr[]      v = opt.Values;

                opt.Index        = _count;
                _options[_count] = o[0];
                _values[_count]  = v[0];
                _count++;
                _options[_count] = o[1];
                _values[_count]  = v[1];
            }
            else if (opt is CudaJOInfoLogBuffer) //add two elements
            {
                CUJITOption[] o = opt.Options;
                IntPtr[]      v = opt.Values;

                opt.Index        = _count;
                _options[_count] = o[0];
                _values[_count]  = v[0];
                _count++;
                _options[_count] = o[1];
                _values[_count]  = v[1];
            }
            else //add one elements
            {
                CUJITOption[] o = opt.Options;
                IntPtr[]      v = opt.Values;

                opt.Index        = _count;
                _options[_count] = o[0];
                _values[_count]  = v[0];
            }
            _count++;
        }
Example #2
0
		/// <summary>
		/// Add a single option to the collection.
		/// </summary>
		/// <param name="opt">Option to add</param>
		public void Add(CudaJitOption opt)
		{
			if (_count >= MAX_ELEM - 2)
				throw new Exception("Maximum number of options elements reached!");

			_cudaOptions.Add(opt);

			if (opt is CudaJOErrorLogBuffer) //add two elements
			{
				CUJITOption[] o = opt.Options;
				IntPtr[] v = opt.Values;

				opt.Index = _count;
				_options[_count] = o[0];
				_values[_count] = v[0];
				_count++;
				_options[_count] = o[1];
				_values[_count] = v[1];
			}
			else if (opt is CudaJOInfoLogBuffer) //add two elements
			{
				CUJITOption[] o = opt.Options;
				IntPtr[] v = opt.Values;

				opt.Index = _count;
				_options[_count] = o[0];
				_values[_count] = v[0];
				_count++;
				_options[_count] = o[1];
				_values[_count] = v[1];
			}
			else //add one elements
			{
				CUJITOption[] o = opt.Options;
				IntPtr[] v = opt.Values;

				opt.Index = _count;
				_options[_count] = o[0];
				_values[_count] = v[0];
			}
			_count++;
		}