コード例 #1
0
ファイル: Antenna.cpp プロジェクト: rumkex/GPSTk
/* Add antenna phase center RMS eccentricities, in METERS.
 *
 * @param[in] freq        Frequency.
 * @param[in] northRMS    North eccentricity RMS component, in METERS.
 * @param[in] eastRMS     East eccentricity RMS component, in METERS.
 * @param[in] upRMS       Up eccentricity RMS component, in METERS.
 */
Antenna Antenna::addAntennaRMSEcc( frequencyType freq,
                                   double northRMS,
                                   double eastRMS,
                                   double upRMS )
{

    // Build a Triple with eccentricities RMS
    Triple ecc(northRMS, eastRMS, upRMS);

    // Get Triple into eccentricities map
    antennaRMSEccMap[freq] = ecc;

    // Return this object
    return (*this);

}  // End of method 'Antenna::addAntennaRMSEcc()'
コード例 #2
0
ファイル: Antenna.cpp プロジェクト: rumkex/GPSTk
/* Add antenna phase center eccentricities, in METERS.
 *
 * @param[in] freq        Frequency.
 * @param[in] northEcc    North eccentricity component, in METERS.
 * @param[in] eastEcc     East eccentricity component, in METERS.
 * @param[in] upEcc       Up eccentricity component, in METERS.
 */
Antenna Antenna::addAntennaEcc( frequencyType freq,
                                double northEcc,
                                double eastEcc,
                                double upEcc )
{

    // Build a Triple with the eccentricities
    Triple ecc(northEcc, eastEcc, upEcc);

    // Get Triple into eccentricities map
    antennaEccMap[freq] = ecc;

    // Return this object
    return (*this);

}  // End of method 'Antenna::addAntennaEcc()'
コード例 #3
0
bool SendMsg(string strId , string strText , string strService , string strPort , string &errorMsg)
{
	bool bRet = false;
	CChineseCode cCode;
	char strInputData[1024] = {0};
	sprintf(strInputData , "Input Data is:%s--%s" , strId.c_str() , strText.c_str());
//	WriteToHTML(strInputData);

	char strTemp[1024] = {0};
	string strUTF8_ID;
	string strUTF8_Text;

	sprintf(strTemp , "%s" , strId.c_str());
	cCode.GB2312ToUTF_8(strUTF8_ID , strTemp , 1024);

	sprintf(strTemp , "%s" , strText.c_str());
	cCode.GB2312ToUTF_8(strUTF8_Text , strTemp , 1024);

//	WriteToHTML(strUTF8_ID.c_str());
//	WriteToHTML(strUTF8_Text.c_str());
//	return true;
	string strMonitorId;
	string strRecord;

	strMonitorId = URLEncode(strUTF8_ID);
	strRecord = URLEncode(strUTF8_Text);

	SvdbApiImplSoapBinding ecc(strService.c_str() , atoi(strPort.c_str()));
	_ns1__appendRecord ar;
	_ns1__appendRecordResponse arRes;	
	try
	{
		ar.id = strMonitorId;
		ar.text = strRecord;
		if(ecc.__ns1__appendRecord(&ar , &arRes) == S_OK)
		{
			bRet = true;
		}
		else
		{
			errorMsg += "向WebService发送soap数据包失败,请检查网络!\n";
			bRet = false;
		}
	}
	catch(...)
	{
		DWORD dwError = ::GetLastError();
		LPSTR lpBuffer = NULL;
		::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
			NULL,
			dwError,
			0,
			(LPTSTR)&lpBuffer,
			0,
			NULL
			);
		cout<<lpBuffer<<endl;
		errorMsg += lpBuffer;
		::LocalFree(lpBuffer);
		bRet = false;
	}

	return bRet;
}
コード例 #4
0
void master(fp timeinst,
					fp* initvalu,
					fp* parameter,
					fp* finavalu,
					int mode){

	//=====================================================================
	//	VARIABLES
	//=====================================================================

	// counters
	int i;

	// intermediate output on host
	fp JCaDyad;
	fp JCaSL;
	fp JCaCyt;

	// offset pointers
	int initvalu_offset_batch;															//
	int initvalu_offset_ecc;																// 46 points
	int parameter_offset_ecc;
	int initvalu_offset_Dyad;															// 15 points
	int parameter_offset_Dyad;
	int initvalu_offset_SL;																// 15 points
	int parameter_offset_SL;
	int initvalu_offset_Cyt;																// 15 poitns
	int parameter_offset_Cyt;

	// module parameters
	fp CaDyad;																					// from ECC model, *** Converting from [mM] to [uM] ***
	fp CaSL;																						// from ECC model, *** Converting from [mM] to [uM] ***
	fp CaCyt;																					// from ECC model, *** Converting from [mM] to [uM] ***

		// thread counters
		int th_id, nthreads;
		int th_count[4];
		int temp;

	//=====================================================================
	//	KERNELS FOR 1 WORKLOAD - PARALLEL
	//=====================================================================

	nthreads = omp_get_max_threads();

	if(mode == 0){

		// partition workload between threads
		temp = 0;
		for(i=0; i<4; i++){													// do for all 4 pieces of work
			if(temp>=nthreads){											// limit according to number of threads
				temp = 0;
			}
			th_count[i] = temp;												// assign thread to piece of work
			temp = temp +1;
		}

		// run pieces of work in parallel
		#pragma omp parallel private(th_id)
		{

			if (th_id == th_count[1]) {

				// ecc function
				initvalu_offset_ecc = 0;												// 46 points
				parameter_offset_ecc = 0;
				ecc(						timeinst,
											initvalu,
											initvalu_offset_ecc,
											parameter,
											parameter_offset_ecc,
											finavalu);

			}

			if (th_id == th_count[2]) {

				// cam function for Dyad
				initvalu_offset_Dyad = 46;											// 15 points
				parameter_offset_Dyad = 1;
				CaDyad = initvalu[35]*1e3;											// from ECC model, *** Converting from [mM] to [uM] ***
				JCaDyad = cam(timeinst,
											initvalu,
											initvalu_offset_Dyad,
											parameter,
											parameter_offset_Dyad,
											finavalu,
											CaDyad);

			}

			if (th_id == th_count[3]) {

				// cam function for SL
				initvalu_offset_SL = 61;											// 15 points
				parameter_offset_SL = 6;
				CaSL = initvalu[36]*1e3;											// from ECC model, *** Converting from [mM] to [uM] ***
				JCaSL = cam(		timeinst,
											initvalu,
											initvalu_offset_SL,
											parameter,
											parameter_offset_SL,
											finavalu,
											CaSL);

			}

			if (th_id == th_count[4]) {

				// cam function for Cyt
				initvalu_offset_Cyt = 76;												// 15 poitns
				parameter_offset_Cyt = 11;
				CaCyt = initvalu[37]*1e3;											// from ECC model, *** Converting from [mM] to [uM] ***
				JCaCyt = cam(	timeinst,
											initvalu,
											initvalu_offset_Cyt,
											parameter,
											parameter_offset_Cyt,
											finavalu,
											CaCyt);

			}

		}

	}

	//=====================================================================
	//	KERNELS FOR MANY WORKLOAD - SERIAL
	//=====================================================================

	else{

		// ecc function
		initvalu_offset_ecc = 0;												// 46 points
		parameter_offset_ecc = 0;
		ecc(						timeinst,
									initvalu,
									initvalu_offset_ecc,
									parameter,
									parameter_offset_ecc,
									finavalu);

		// cam function for Dyad
		initvalu_offset_Dyad = 46;											// 15 points
		parameter_offset_Dyad = 1;
		CaDyad = initvalu[35]*1e3;											// from ECC model, *** Converting from [mM] to [uM] ***
		JCaDyad = cam(timeinst,
									initvalu,
									initvalu_offset_Dyad,
									parameter,
									parameter_offset_Dyad,
									finavalu,
									CaDyad);

		// cam function for SL
		initvalu_offset_SL = 61;											// 15 points
		parameter_offset_SL = 6;
		CaSL = initvalu[36]*1e3;											// from ECC model, *** Converting from [mM] to [uM] ***
		JCaSL = cam(		timeinst,
									initvalu,
									initvalu_offset_SL,
									parameter,
									parameter_offset_SL,
									finavalu,
									CaSL);

		// cam function for Cyt
		initvalu_offset_Cyt = 76;												// 15 poitns
		parameter_offset_Cyt = 11;
		CaCyt = initvalu[37]*1e3;											// from ECC model, *** Converting from [mM] to [uM] ***
		JCaCyt = cam(	timeinst,
									initvalu,
									initvalu_offset_Cyt,
									parameter,
									parameter_offset_Cyt,
									finavalu,
									CaCyt);

	}

	//=====================================================================
	//	FINAL KERNEL
	//=====================================================================

	// final adjustments
	fin(						initvalu,
								initvalu_offset_ecc,
								initvalu_offset_Dyad,
								initvalu_offset_SL,
								initvalu_offset_Cyt,
								parameter,
								finavalu,
								JCaDyad,
								JCaSL,
								JCaCyt);

	//=====================================================================
	//	COMPENSATION FOR NANs and INFs
	//=====================================================================

	// make sure function does not return NANs and INFs
	for(i=0; i<EQUATIONS; i++){
		if (isnan(finavalu[i]) == 1){ 
			finavalu[i] = 0.0001;												// for NAN set rate of change to 0.0001
		}
		else if (isinf(finavalu[i]) == 1){ 
			finavalu[i] = 0.0001;												// for INF set rate of change to 0.0001
		}
	}

}
コード例 #5
0
	/*
	 * DataMatrix data encoding, implements Barcode2dBase::encode()
	 */
	bool BarcodeDataMatrix::encode( const std::string& cookedData, Matrix<bool>& encodedData )
	{
		std::vector<uint8_t> codewords;

		/*
		 * Encode data into codewords
		 */
		int nRawCw = ecc200Encode( cookedData, codewords );

		/*
		 * Determine parameters for "best size"
		 */
		const DMParameterEntry * p = ecc200BestSizeParams( nRawCw );
		if ( p == nullptr )
		{
			return false;
		}
		encodedData.resize( p->nXtotal, p->nYtotal );
			

		/*
		 * Fill any extra data codewords
		 */
		ecc200Fill( codewords, nRawCw, p->nDataTotal );


		/*
		 * Calculate Reed-Solomon correction codewords
		 */
		int nTotalBlocks = p->nBlocks1 + p->nBlocks2;

		std::vector<uint8_t> ecc( p->nEccBlock*nTotalBlocks, 0 );

		for ( int iBlock = 0; iBlock < p->nBlocks1; iBlock++ )
		{
			ecc200EccBlock( codewords, ecc, p->nDataBlock1, p->nEccBlock, p->aSelect, iBlock, nTotalBlocks );
		}

		for ( int iBlock = p->nBlocks1; iBlock < nTotalBlocks; iBlock++ )
		{
			ecc200EccBlock( codewords, ecc, p->nDataBlock2, p->nEccBlock, p->aSelect, iBlock, nTotalBlocks );
		}

		codewords.insert( codewords.end(), ecc.begin(), ecc.end() ); /* Append to data */


		/*
		 * Create raw data matrix
		 */
		Matrix<bool> matrix( p->nXregions * p->nXregion, p->nYregions * p->nYregion );
		ecc200FillMatrix( matrix, codewords );


		/*
		 * Construct by separating out regions and inserting finder patterns
		 */
		int xstride = p->nXregion + 2;
		int ystride = p->nYregion + 2;

		for ( int iXregion = 0; iXregion < p->nXregions; iXregion++ )
		{
			for ( int iYregion = 0; iYregion < p->nYregions; iYregion++ )
			{
				Matrix<bool> region = matrix.subMatrix( iXregion*p->nXregion, iYregion*p->nYregion,
									p->nXregion, p->nYregion );

				encodedData.setSubMatrix( iXregion*xstride + 1, iYregion*ystride + 1, region );
				finderPattern( encodedData, iXregion*xstride, iYregion*ystride, xstride, ystride );
			}
		}


		return true;
	}