Example #1
0
// Create a stringified list of (symbol: value)-pairs
// for output in the error-message.
CString CValidator::Symbols_And_Values(const CString symbols_possibly_affected)
{
	CString Result = "";
	int Token_Pos = 0;
	while (Token_Pos < symbols_possibly_affected.GetLength())
	{
		// Tokenize the string, using space or commas as delimiters.
		CString Symbol = symbols_possibly_affected.Tokenize(" ,", Token_Pos);
		double Symbol_Value = gws(Symbol);
		CString Symbol_Value_String;
		// Convert symbol value to string, 7 digits total, 2 digits precision
		Symbol_Value_String.Format("%7.2f", Symbol_Value);
		Result += "\n    ("
			+ Symbol
			+ ": "
			+ Symbol_Value_String
			+ ")";
	}
	return Result;
}
void enqueue2DRangeKernel(SEXP sQueue, SEXP sKernel, SEXP sGlobalWorkSize, SEXP sLocalWorkSize){
    Rcpp::XPtr<cl_command_queue> queue(sQueue);
    Rcpp::XPtr<cl_kernel> kernel(sKernel);
     
    Rcpp::NumericVector gws(sGlobalWorkSize);
    Rcpp::NumericVector lws(sLocalWorkSize);
    size_t *globalWorkSizePtr = (size_t *) ::operator new(sizeof(size_t)*2);
    size_t *localWorkSizePtr  = (size_t *) ::operator new(sizeof(size_t)*2);
     
    globalWorkSizePtr[0] = gws[0]; // TODO: check bounds on gws
    globalWorkSizePtr[1] = gws[1];
     
    if (lws[0] == 0 && lws[1] == 0) { // TODO: check bounds on lws
        localWorkSizePtr = NULL;
    } else {
        localWorkSizePtr[0] = lws[0];
        localWorkSizePtr[1] = lws[1];
    }
     
    cl_int ciErr1 = clEnqueueNDRangeKernel(*queue, *kernel, 2, NULL, globalWorkSizePtr, localWorkSizePtr, 0, NULL, NULL);
    printOnError(ciErr1,"ROpenCL::enqueueNDRangeKernel()");
}
Example #3
0
void CGlobalVars::init_userchair()
{
	//USERCHAIR FIRST
	userchair = static_cast<int>(gws("userchair"));
	assert (userchair >= 0 && userchair < k_max_chairs);
}
Example #4
0
   void Rinex3NavData::getPRNEpoch(Rinex3NavStream& strm)
      throw(StringException, FFStreamError)
   {
      try {
         int i;
         short yr,mo,day,hr,min;
         double dsec;

         string line;
         while(line.empty())        // ignore blank lines in place of epoch lines
            strm.formattedGetLine(line, true);

         if(strm.header.version >= 3) {
            // check for spaces in the right spots...
            if(line[3] != ' ')
               throw(FFStreamError("Badly formatted epoch line"));
            for(i = 8; i <= 20; i += 3)
               if(line[i] != ' ')
                  throw(FFStreamError("Badly formatted epoch line"));

            satSys = line.substr(0,1);
            PRNID = asInt(line.substr(1,2));
            sat.fromString(line.substr(0,3));

            yr  = asInt(line.substr( 4,4));
            mo  = asInt(line.substr( 9,2));
            day = asInt(line.substr(12,2));
            hr  = asInt(line.substr(15,2));
            min = asInt(line.substr(18,2));
            dsec = asDouble(line.substr(21,2));
         }
         else {                  // RINEX 2
            for(i=2; i <= 17; i+=3)
               if(line[i] != ' ') {
                  throw(FFStreamError("Badly formatted epoch line"));
               }

            satSys = string(1,strm.header.fileSys[0]);
            PRNID = asInt(line.substr(0,2));
            sat.fromString(satSys + line.substr(0,2));

            yr  = asInt(line.substr( 2,3));
            if(yr < 80) yr += 100;     // rollover is at 1980
            yr += 1900;
            mo  = asInt(line.substr( 5,3));
            day = asInt(line.substr( 8,3));
            hr  = asInt(line.substr(11,3));
            min = asInt(line.substr(14,3));
            dsec = asDouble(line.substr(17,5));
         }

         // Fix RINEX epochs of the form 'yy mm dd hr 59 60.0'
         short ds = 0;
         if(dsec >= 60.) { ds = dsec; dsec = 0; }
         time = CivilTime(yr,mo,day,hr,min,dsec).convertToCommonTime();
         if(ds != 0) time += ds;

         // specify the time system based on satellite system
         time.setTimeSystem(TimeSystem::Any);
         if(satSys == "G") time.setTimeSystem(TimeSystem::GPS);
         if(satSys == "R") time.setTimeSystem(TimeSystem::GLO);
         if(satSys == "E") time.setTimeSystem(TimeSystem::GAL);
         if(satSys == "C") time.setTimeSystem(TimeSystem::BDT);
         if(satSys == "J") time.setTimeSystem(TimeSystem::QZS);
         if(satSys == "S") time.setTimeSystem(TimeSystem::GPS);

         // TOC is the clock time
         GPSWeekSecond gws(time);         // sow is system-independent
         Toc = gws.sow;

         if(strm.header.version < 3) {    // Rinex 2.*
            if(satSys == "G") {
               af0 = StringUtils::for2doub(line.substr(22,19));
               af1 = StringUtils::for2doub(line.substr(41,19));
               af2 = StringUtils::for2doub(line.substr(60,19));
            }
            else if(satSys == "R" || satSys == "S") {
               TauN   =      StringUtils::for2doub(line.substr(22,19));
               GammaN =      StringUtils::for2doub(line.substr(41,19));
               MFtime =(long)StringUtils::for2doub(line.substr(60,19));
               if(satSys == "R") {     // make MFtime consistent with R3.02
                  MFtime += int(Toc/86400) * 86400;
               }
            }
         }
         else if(satSys == "G" || satSys == "E" || satSys == "C" || satSys == "J") {
            af0 = StringUtils::for2doub(line.substr(23,19));
            af1 = StringUtils::for2doub(line.substr(42,19));
            af2 = StringUtils::for2doub(line.substr(61,19));
         }
         else if(satSys == "R" || satSys == "S") {
            TauN   =      StringUtils::for2doub(line.substr(23,19));
            GammaN =      StringUtils::for2doub(line.substr(42,19));
            MFtime =(long)StringUtils::for2doub(line.substr(61,19));
         }
      }
      catch (std::exception &e)
      {
         FFStreamError err("std::exception: " + string(e.what()));
         GPSTK_THROW(err);
      }
   }