ElectronPhononExchangeHertel::ElectronPhononExchangeHertel(fstream &fileId,
                                                           map<string,double> & parameters,
                                                           Material * material) 
  : ElectronPhononExchange(),
    exchangeCoef_(0),
    debeyeTemperature_(1),
    massEnhancement_(0),
    material_(material)
{
  if (!fileId.is_open()) throw ATC_Error("cannot open material file");
  vector<string> line;
  while(fileId.good()) {
    command_line(fileId, line);
    if (line.size() == 0) continue;
    if (line[0] == "end") break;
    else if (line[0] == "debeye_temperature") {
      debeyeTemperature_ = str2dbl(line[1]);
      parameters["debeye_temperature"] = debeyeTemperature_;
    }
    else if (line[0] == "mass_enhancement") {
      massEnhancement_ = str2dbl(line[1]);
      parameters["mass_enhancement"] = massEnhancement_;
    }
    else {
      throw ATC_Error( "unrecognized material function "+line[0]);
    }
  }
  // coupling coefficient, eqn. 15 of Hertel 2002
  double kb = LammpsInterface::instance()->kBoltzmann();
  double hbar = LammpsInterface::instance()->hbar();
  double PI = 3.141592653589793238; 
  exchangeCoef_ = 144.*1.0369*kb/(PI*hbar);
  exchangeCoef_ *= massEnhancement_/pow(debeyeTemperature_,2);
}
示例#2
0
//---------------------------------------------------------------------------
void __fastcall TMapAreaDialog::UpdateMap(void)
{
	Plot->MapScaleX=str2dbl(ScaleX->Text);
	Plot->MapScaleY=str2dbl(ScaleY->Text);
	Plot->MapLat=str2dbl(Lat->Text);
	Plot->MapLon=str2dbl(Lon->Text);
	Plot->MapScaleEq=ScaleEq->Checked;
	Plot->UpdatePlot();
}
示例#3
0
//---------------------------------------------------------------------------
void __fastcall TInputStrDialog::BtnPosClick(TObject *Sender)
{
	AnsiString s;
	RefDialog->RovPos[0]=str2dbl(NmeaPos1->Text);
	RefDialog->RovPos[1]=str2dbl(NmeaPos2->Text);
	RefDialog->StaPosFile=MainForm->StaPosFileF;
	if (RefDialog->ShowModal()!=mrOk) return;
	NmeaPos1->Text=s.sprintf("%.9f",RefDialog->Pos[0]);
	NmeaPos2->Text=s.sprintf("%.9f",RefDialog->Pos[1]);
}
示例#4
0
文件: strdist.c 项目: LFHao/Projects
int main(int argc, char *argv[]) {
    char *str1 = argv[1];
    char *str2 = argv[2];

    double val1 = str2dbl(str1);
    double val2 = str2dbl(str2);

    printf("%lf %lf\n",val1,val2);
    printf("%lf\n",strdist(str1,str2));
}
示例#5
0
//---------------------------------------------------------------------------
void __fastcall TPntDialog::BtnOkClick(TObject *Sender)
{
	double pos[3]={0};
	int n=0;
	for (int i=0;i<PntList->RowCount;i++) {
		if (PntList->Cells[3][i]=="") continue;
		pos[0]=str2dbl(PntList->Cells[0][i])*D2R;
		pos[1]=str2dbl(PntList->Cells[1][i])*D2R;
		pos[2]=str2dbl(PntList->Cells[2][i]);
		pos2ecef(pos,Plot->PntPos[n]);
		Plot->PntName[n++]=PntList->Cells[3][i];
	}
	Plot->NWayPnt=n;
}
示例#6
0
//---------------------------------------------------------------------------
void __fastcall TConvDialog::BtnConvertClick(TObject *Sender)
{
	AnsiString TimeY1_Text=TimeY1->Text,TimeH1_Text=TimeH1->Text;
	AnsiString TimeY2_Text=TimeY2->Text,TimeH2_Text=TimeH2->Text;
	AnsiString InputFile_Text=InputFile->Text,OutputFile_Text=OutputFile->Text;
	int stat;
	char cmd[1024],file[1024],kmlfile[1024],*p;
	double offset[3]={0},es[6]={1970,1,1},ee[6]={2038,1,1},tint=0.0;
	gtime_t ts={0},te={0};
	ShowMsg("");
	if (InputFile->Text==""||OutputFile->Text=="") return;
	ShowMsg("converting ...");
	if (TimeSpan->Checked) {
		sscanf(TimeY1_Text.c_str(),"%lf/%lf/%lf",es  ,es+1,es+2);
		sscanf(TimeH1_Text.c_str(),"%lf:%lf:%lf",es+3,es+4,es+5);
		sscanf(TimeY2_Text.c_str(),"%lf/%lf/%lf",ee  ,ee+1,ee+2);
		sscanf(TimeH2_Text.c_str(),"%lf:%lf:%lf",ee+3,ee+4,ee+5);
		ts=epoch2time(es);
		te=epoch2time(ee);
	}
	if (AddOffset->Checked) {
		offset[0]=str2dbl(Offset1->Text);
		offset[1]=str2dbl(Offset2->Text);
		offset[2]=str2dbl(Offset3->Text);
	}
	if (TimeIntF->Checked) tint=str2dbl(TimeInt->Text);
	strcpy(file,InputFile_Text.c_str());
	strcpy(kmlfile,file);
	if (!(p=strrchr(kmlfile,'.'))) p=kmlfile+strlen(kmlfile);
	strcpy(p,".kml");
	if((stat=convkml(file,Compress->Checked?kmlfile:OutputFile_Text.c_str(),
	                 ts,te,tint,QFlags->ItemIndex,offset,
	                 TrackColor->ItemIndex,PointColor->ItemIndex,
	                 OutputAlt->ItemIndex,OutputTime->ItemIndex))<0) {
		if      (stat==-1) ShowMsg("error : read input file");
		else if (stat==-2) ShowMsg("error : input file format");
		else if (stat==-3) ShowMsg("error : no data in input file");
		else               ShowMsg("error : write kml file");
		return;
	}
	if (Compress->Checked) {
		sprintf(cmd,"zip.exe -j -m %s %s",OutputFile->Text.c_str(),kmlfile);
		if (!ExecCmd(cmd)) {
			ShowMsg("error : zip execution");
			return;
		}
	}
	ShowMsg("done");
}
示例#7
0
//---------------------------------------------------------------------------
void __fastcall TOptDialog::GetPos(int type, TEdit **edit, double *pos)
{
	AnsiString edit0_Text=edit[0]->Text;
	AnsiString edit1_Text=edit[1]->Text;
	double p[3]={0},dms1[3]={0},dms2[3]={0};
	
	if (type==1) { /* lat/lon/height dms/m */
		sscanf(edit0_Text.c_str(),"%lf %lf %lf",dms1,dms1+1,dms1+2);
		sscanf(edit1_Text.c_str(),"%lf %lf %lf",dms2,dms2+1,dms2+2);
		p[0]=(dms1[0]<0?-1:1)*(fabs(dms1[0])+dms1[1]/60+dms1[2]/3600)*D2R;
		p[1]=(dms2[0]<0?-1:1)*(fabs(dms2[0])+dms2[1]/60+dms2[2]/3600)*D2R;
		p[2]=str2dbl(edit[2]->Text);
		pos2ecef(p,pos);
	}
	else if (type==2) { /* x/y/z-ecef */
		pos[0]=str2dbl(edit[0]->Text);
		pos[1]=str2dbl(edit[1]->Text);
		pos[2]=str2dbl(edit[2]->Text);
	}
	else {
		p[0]=str2dbl(edit[0]->Text)*D2R;
		p[1]=str2dbl(edit[1]->Text)*D2R;
		p[2]=str2dbl(edit[2]->Text);
		pos2ecef(p,pos);
	}
}
示例#8
0
//---------------------------------------------------------------------------
void __fastcall TMapAreaDialog::ScaleYUpDownChangingEx(TObject *Sender,
      bool &AllowChange, short NewValue, TUpDownDirection Direction)
{
	AnsiString s;
	double scale=str2dbl(ScaleY->Text);
	if (Direction==updUp) scale+=0.0005; else scale-=0.0005;
	ScaleY->Text=s.sprintf("%.5f",scale);
	UpdateMap();
}
示例#9
0
//---------------------------------------------------------------------------
void __fastcall TMapAreaDialog::LonUpDownChangingEx(TObject *Sender,
      bool &AllowChange, short NewValue, TUpDownDirection Direction)
{
	AnsiString s;
	double lon=str2dbl(Lon->Text);
	if (Direction==updUp) lon+=0.000005; else lon-=0.000005;
	Lon->Text=s.sprintf("%.7f",lon);
	UpdateMap();
}
示例#10
0
文件: skydlg.cpp 项目: Chaos99/RTKLIB
//---------------------------------------------------------------------------
void __fastcall TSkyImgDialog::SkyCent2UpDownChangingEx(TObject *Sender, bool &AllowChange,
        short NewValue, TUpDownDirection Direction)
{
    AnsiString s;
    double cent=str2dbl(SkyCent2->Text);
    cent=floor(cent+0.5);
    if (Direction==updUp) cent+=1.0;
    else cent-=1.0;
    SkyCent2->Text=s.sprintf("%.2f",cent);
    UpdateSky();
}
示例#11
0
//---------------------------------------------------------------------------
void __fastcall TInputStrDialog::BtnOkClick(TObject *Sender)
{
	StreamC[0] =StreamC1  ->Checked;
	StreamC[1] =StreamC2  ->Checked;
	StreamC[2] =StreamC3  ->Checked;
	Stream[0]  =Stream1   ->ItemIndex;
	Stream[1]  =Stream2   ->ItemIndex;
	Stream[2]  =Stream3   ->ItemIndex;
	Format[0]  =Format1   ->ItemIndex;
	Format[1]  =Format2->ItemIndex<NRcv?Format2->ItemIndex:STRFMT_SP3+Format2->ItemIndex-NRcv;
	Format[2]  =Format3->ItemIndex<NRcv?Format3->ItemIndex:STRFMT_SP3+Format3->ItemIndex-NRcv;
	Paths[0][2]=SetFilePath(FilePath1->Text);
	Paths[1][2]=SetFilePath(FilePath2->Text);
	Paths[2][2]=SetFilePath(FilePath3->Text);
	NmeaReq    =NmeaReqL  ->ItemIndex;
	TimeTag    =TimeTagC  ->Checked;
	TimeSpeed  =TimeSpeedL->Text;
	TimeStart  =TimeStartE->Text;
	NmeaPos[0] =str2dbl(NmeaPos1->Text);
	NmeaPos[1] =str2dbl(NmeaPos2->Text);
}
示例#12
0
文件: skydlg.cpp 项目: Chaos99/RTKLIB
//---------------------------------------------------------------------------
void __fastcall TSkyImgDialog::SkyScaleUpDownChangingEx(TObject *Sender, bool &AllowChange,
        short NewValue, TUpDownDirection Direction)
{
    AnsiString s;
    double scale=str2dbl(SkyScale->Text);
    scale=floor(scale+0.5);
    if (Direction==updUp) scale+=1.0;
    else scale-=1.0;
    if (scale<1.0) scale=1.0;
    SkyScale->Text=s.sprintf("%.2f",scale);
    UpdateSky();
}
示例#13
0
文件: extopt.cpp 项目: Chaos99/RTKLIB
//---------------------------------------------------------------------------
void __fastcall TExtOptDialog::SetExtErrOpt(void)
{
    TEdit *editc[][6]= {
        {CodeErr00,CodeErr01,CodeErr02,CodeErr03,CodeErr04,CodeErr05},
        {CodeErr10,CodeErr11,CodeErr12,CodeErr13,CodeErr14,CodeErr15},
        {CodeErr20,CodeErr21,CodeErr22,CodeErr23,CodeErr24,CodeErr25}
    };
    TEdit *editp[][6]= {
        {PhaseErr00,PhaseErr01,PhaseErr02,PhaseErr03,PhaseErr04,PhaseErr05},
        {PhaseErr10,PhaseErr11,PhaseErr12,PhaseErr13,PhaseErr14,PhaseErr15},
        {PhaseErr20,PhaseErr21,PhaseErr22,PhaseErr23,PhaseErr24,PhaseErr25}
    };
    OptDialog->ExtErr.ena[0]=ExtEna0->Checked;
    OptDialog->ExtErr.ena[1]=ExtEna1->Checked;
    OptDialog->ExtErr.ena[2]=ExtEna2->Checked;
    OptDialog->ExtErr.ena[3]=ExtEna3->Checked;

    for (int i=0; i<3; i++) for (int j=0; j<6; j++) {
            OptDialog->ExtErr.cerr[i][j]=str2dbl(editc[i][j]->Text);
            OptDialog->ExtErr.perr[i][j]=str2dbl(editp[i][j]->Text);
        }
    OptDialog->ExtErr.gloicb[0]=str2dbl(GloICB0->Text);
    OptDialog->ExtErr.gloicb[1]=str2dbl(GloICB1->Text);
    OptDialog->ExtErr.gpsglob[0]=str2dbl(GpsGloB0->Text);
    OptDialog->ExtErr.gpsglob[1]=str2dbl(GpsGloB1->Text);
}
示例#14
0
文件: skydlg.cpp 项目: Chaos99/RTKLIB
//---------------------------------------------------------------------------
void __fastcall TSkyImgDialog::SkyFov3UpDownChangingEx(TObject *Sender, bool &AllowChange,
        short NewValue, TUpDownDirection Direction)
{
    AnsiString s;
    double fov=str2dbl(SkyFov3->Text);
    fov=floor(fov+0.5);
    if (Direction==updUp) fov+=1.0;
    else fov-=1.0;
    if (fov<=-180.0) fov+=360.0;
    else if (fov>180.0) fov-=360.0;
    SkyFov3->Text=s.sprintf("%.2f",fov);
    UpdateSky();
}
示例#15
0
//---------------------------------------------------------------------------
void __fastcall TSpanDialog::BtnOkClick(TObject *Sender)
{
	double eps[]={2000,1,1,0,0,0},epe[]={2000,1,1,0,0,0};
	
	TimeEna[0]=TimeStartF->Checked;
	TimeEna[1]=TimeEndF  ->Checked;
	TimeEna[2]=TimeIntF  ->Checked;
	sscanf(TimeY1->Text.c_str(),"%lf/%lf/%lf",eps,eps+1,eps+2);
	sscanf(TimeH1->Text.c_str(),"%lf:%lf:%lf",eps+3,eps+4,eps+5);
	sscanf(TimeY2->Text.c_str(),"%lf/%lf/%lf",epe,epe+1,epe+2);
	sscanf(TimeH2->Text.c_str(),"%lf:%lf:%lf",epe+3,epe+4,epe+5);
	TimeStart=epoch2time(eps);
	TimeEnd=epoch2time(epe);
	TimeInt=str2dbl(EditTimeInt->Text);
}
示例#16
0
//---------------------------------------------------------------------------
void __fastcall TConvOptDialog::BtnOkClick(TObject *Sender)
{
	MainWindow->RnxVer=RnxVer->ItemIndex;
	MainWindow->RnxFile=RnxFile->Checked;
	MainWindow->RnxCode=RnxCode->Text;
	MainWindow->RunBy=RunBy->Text;
	MainWindow->Marker=Marker->Text;
	MainWindow->MarkerNo=MarkerNo->Text;
	MainWindow->MarkerType=MarkerType->Text;
	MainWindow->Name[0]=Name0->Text;
	MainWindow->Name[1]=Name1->Text;
	MainWindow->Rec[0]=Rec0->Text;
	MainWindow->Rec[1]=Rec1->Text;
	MainWindow->Rec[2]=Rec2->Text;
	MainWindow->Ant[0]=Ant0->Text;
	MainWindow->Ant[1]=Ant1->Text;
	MainWindow->Ant[2]=Ant2->Text;
	MainWindow->AppPos[0]=str2dbl(AppPos0->Text);
	MainWindow->AppPos[1]=str2dbl(AppPos1->Text);
	MainWindow->AppPos[2]=str2dbl(AppPos2->Text);
	MainWindow->AntDel[0]=str2dbl(AntDel0->Text);
	MainWindow->AntDel[1]=str2dbl(AntDel1->Text);
	MainWindow->AntDel[2]=str2dbl(AntDel2->Text);
	MainWindow->Comment[0]=Comment0->Text;
	MainWindow->Comment[1]=Comment1->Text;
	MainWindow->RcvOption=RcvOption->Text;
	for (int i=0;i<6;i++) MainWindow->CodeMask[i]=CodeMask[i];
	MainWindow->AutoPos=AutoPos->Checked;
	MainWindow->ScanObs=ScanObs->Checked;
	MainWindow->OutIono=OutIono->Checked;
	MainWindow->OutTime=OutTime->Checked;
	MainWindow->OutLeaps=OutLeaps->Checked;
	
	int navsys=0,obstype=0,freqtype=0;
	if (Nav1->Checked) navsys|=SYS_GPS;
	if (Nav2->Checked) navsys|=SYS_GLO;
	if (Nav3->Checked) navsys|=SYS_GAL;
	if (Nav4->Checked) navsys|=SYS_QZS;
	if (Nav5->Checked) navsys|=SYS_SBS;
	if (Nav6->Checked) navsys|=SYS_CMP;
	if (Obs1->Checked) obstype|=OBSTYPE_PR;
	if (Obs2->Checked) obstype|=OBSTYPE_CP;
	if (Obs3->Checked) obstype|=OBSTYPE_DOP;
	if (Obs4->Checked) obstype|=OBSTYPE_SNR;
	if (Freq1->Checked) freqtype|=FREQTYPE_L1;
	if (Freq2->Checked) freqtype|=FREQTYPE_L2;
	if (Freq3->Checked) freqtype|=FREQTYPE_L5;
	if (Freq4->Checked) freqtype|=FREQTYPE_L6;
	if (Freq5->Checked) freqtype|=FREQTYPE_L7;
	if (Freq6->Checked) freqtype|=FREQTYPE_L8;
	MainWindow->NavSys=navsys;
	MainWindow->ObsType=obstype;
	MainWindow->FreqType=freqtype;
	MainWindow->ExSats=ExSats->Text;
	MainWindow->TraceLevel=TraceLevel->ItemIndex;
}
示例#17
0
enum MqErrorE
pBufferGetA8 (
  struct MqBufferS * const buf,
  union MqBufferAtomU * const ato,
  enum MqTypeE const type 
)
{
  buf->cur.B = buf->data;
  if (type == buf->type) {
#if defined(HAVE_ALIGNED_ACCESS_REQUIRED)
    memcpy(ato,buf->cur.B,8);
#else
    (*ato).W = (*buf->cur.A).W;
#endif
  } else if ( buf->type == MQ_STRT ) {
    MQ_STR end;
    errno = 0;
    if (type == MQ_WIDT) {
      // MQ_WIDT
      (*ato).W = str2wid (buf->cur.C, &end, 0);
      if (unlikely (errno == ERANGE)) {
	if (unlikely ((*ato).W == MQ_WID_MIN)) {
	  return RANGE_E (underflow, WID);
	} else if (unlikely ((*ato).W == MQ_WID_MAX)) {
	  return RANGE_E (overflow, WID);
	}
      } else if (unlikely ((end - buf->cur.C) != buf->cursize)) {
	return RANGE_E (size, WID);
      }
    } else {
      // MQ_DBLT
      (*ato).D = str2dbl (buf->cur.C, &end);
      if (unlikely (errno == ERANGE)) {
	if (unlikely ((*ato).D == 0.0L)) {
	  return RANGE_E (underflow, DBL);
	} else if (unlikely ((*ato).D == +MQ_HUGE_VAL || (*ato).D == -MQ_HUGE_VAL)) {
	  return RANGE_E (overflow, DBL);
	}
      } else if (unlikely ((end - buf->cur.C) != buf->cursize)) {
	return RANGE_E (size, DBL);
      }
    }
  } else {
    return TYPE_E(type, buf->type);
  }
  return MQ_OK;
}
ElectronPhononExchangeLinear::ElectronPhononExchangeLinear(
  fstream &fileId, map<string,double> & parameters) 
  : ElectronPhononExchange(),
  exchangeCoef_(0)
{
  if (!fileId.is_open()) throw ATC_Error("cannot open material file");
  vector<string> line;
  while(fileId.good()) {
    command_line(fileId, line);
    if (line.size() == 0) continue;
    if (line[0] == "end") return;
    else if (line[0] == "coefficient") {
      exchangeCoef_ = str2dbl(line[1]);
      parameters["electron_phonon_exchange_coefficient"] = exchangeCoef_;
    }
    else {
      throw ATC_Error( "unrecognized material function "+line[0]);
    }
  }
}
示例#19
0
//---------------------------------------------------------------------------
void __fastcall TOptDialog::SaveOpt(AnsiString file)
{
	AnsiString ProxyAddrE_Text=ProxyAddrE->Text;
	AnsiString ExSatsE_Text=ExSatsE->Text;
	AnsiString FieldSep_Text=FieldSep->Text;
	AnsiString RovAnt_Text=RovAnt->Text,RefAnt_Text=RefAnt->Text;
	AnsiString SatPcvFile_Text=SatPcvFile->Text;
	AnsiString AntPcvFile_Text=AntPcvFile->Text;
	AnsiString StaPosFile_Text=StaPosFile->Text;
	AnsiString GeoidDataFile_Text=GeoidDataFile->Text;
	AnsiString DCBFile_Text=DCBFile->Text;
	AnsiString LocalDir_Text=LocalDir->Text;
    int itype[]={STR_SERIAL,STR_TCPCLI,STR_TCPSVR,STR_NTRIPCLI,STR_FILE,STR_FTP,STR_HTTP};
    int otype[]={STR_SERIAL,STR_TCPCLI,STR_TCPSVR,STR_NTRIPSVR,STR_FILE};
	TEdit *editu[]={RovPos1,RovPos2,RovPos3};
	TEdit *editr[]={RefPos1,RefPos2,RefPos3};
	char buff[1024],*p,id[32],comment[256],s[64];
	int sat,ex;
	prcopt_t prcopt=prcopt_default;
	solopt_t solopt=solopt_default;
	filopt_t filopt={""};
	
	for (int i=0;i<8;i++) {
		strtype[i]=i<3?itype[MainForm->Stream[i]]:otype[MainForm->Stream[i]];
		strfmt[i]=MainForm->Format[i];
		
		if (!MainForm->StreamC[i]) {
			strtype[i]=STR_NONE;
			strcpy(strpath[i],"");
		}
		else if (strtype[i]==STR_SERIAL) {
			strcpy(strpath[i],MainForm->Paths[i][0].c_str());
		}
		else if (strtype[i]==STR_FILE) {
			strcpy(strpath[i],MainForm->Paths[i][2].c_str());
		}
		else if (strtype[i]<=STR_NTRIPCLI) {
			strcpy(strpath[i],MainForm->Paths[i][1].c_str());
		}
		else if (strtype[i]<=STR_HTTP) {
			strcpy(strpath[i],MainForm->Paths[i][3].c_str());
		}
	}
	nmeareq   =MainForm->NmeaReq;
	nmeapos[0]=MainForm->NmeaPos[0];
	nmeapos[1]=MainForm->NmeaPos[1];

	svrcycle    =SvrCycleE   ->Text.ToInt();
	timeout     =TimeoutTimeE->Text.ToInt();
	reconnect   =ReconTimeE  ->Text.ToInt();
	nmeacycle   =NmeaCycleE  ->Text.ToInt();
	buffsize    =SvrBuffSizeE->Text.ToInt();
	navmsgsel   =NavSelectS  ->ItemIndex;
	strcpy(proxyaddr,ProxyAddrE_Text.c_str());
	fswapmargin =FileSwapMarginE->Text.ToInt();
	prcopt.sbassatsel=SbasSatE->Text.ToInt();

	prcopt.mode		=PosMode	 ->ItemIndex;
	prcopt.nf		=Freq		 ->ItemIndex+1;
	prcopt.soltype	=Solution	 ->ItemIndex;
	prcopt.elmin	=str2dbl(ElMask	->Text)*D2R;
	prcopt.dynamics	=DynamicModel->ItemIndex;
	prcopt.tidecorr	=TideCorr	 ->ItemIndex;
	prcopt.ionoopt	=IonoOpt	 ->ItemIndex;
	prcopt.tropopt	=TropOpt	 ->ItemIndex;
	prcopt.sateph	=SatEphem	 ->ItemIndex;
	if (ExSatsE->Text!="") {
		strcpy(buff,ExSatsE_Text.c_str());
		for (p=strtok(buff," ");p;p=strtok(NULL," ")) {
			if (*p=='+') {ex=2; p++;} else ex=1;
			if (!(sat=satid2no(p))) continue;
			prcopt.exsats[sat-1]=ex;
		}
	}
	prcopt.navsys	= (NavSys1->Checked?SYS_GPS:0)|
					  (NavSys2->Checked?SYS_GLO:0)|
					  (NavSys3->Checked?SYS_GAL:0)|
					  (NavSys4->Checked?SYS_QZS:0)|
					  (NavSys5->Checked?SYS_SBS:0)|
					  (NavSys6->Checked?SYS_CMP:0);
	prcopt.posopt[0]=PosOpt1->Checked;
	prcopt.posopt[1]=PosOpt2->Checked;
	prcopt.posopt[2]=PosOpt3->Checked;
	prcopt.posopt[3]=PosOpt4->Checked;
	prcopt.posopt[4]=PosOpt5->Checked;
	
	prcopt.modear	=AmbRes		->ItemIndex;
	prcopt.glomodear=GloAmbRes	->ItemIndex;
	prcopt.thresar[0]=str2dbl(ValidThresAR->Text);
	prcopt.maxout	=str2dbl(OutCntResetAmb->Text);
	prcopt.minfix	=str2dbl(FixCntHoldAmb->Text);
	prcopt.minlock	=str2dbl(LockCntFixAmb->Text);
	prcopt.elmaskar	=str2dbl(ElMaskAR	->Text)*D2R;
	prcopt.elmaskhold=str2dbl(ElMaskHold->Text)*D2R;
	prcopt.maxtdiff	=str2dbl(MaxAgeDiff	->Text);
	prcopt.maxgdop	=str2dbl(RejectGdop ->Text);
	prcopt.maxinno	=str2dbl(RejectThres->Text);
	prcopt.thresslip=str2dbl(SlipThres	->Text);
	prcopt.niter	=str2dbl(NumIter	->Text);
	prcopt.syncsol	=SyncSol->ItemIndex;
	if (prcopt.mode==PMODE_MOVEB&&BaselineConst->Checked) {
		prcopt.baseline[0]=str2dbl(BaselineLen->Text);
		prcopt.baseline[1]=str2dbl(BaselineSig->Text);
	}
	solopt.posf		=SolFormat	->ItemIndex;
	solopt.timef	=TimeFormat	->ItemIndex==0?0:1;
	solopt.times	=TimeFormat	->ItemIndex==0?0:TimeFormat->ItemIndex-1;
	solopt.timeu	=str2dbl(TimeDecimal ->Text);
	solopt.degf		=LatLonFormat->ItemIndex;
	strcpy(solopt.sep,FieldSep_Text.c_str());
	solopt.outhead	=OutputHead	 ->ItemIndex;
	solopt.outopt	=OutputOpt	 ->ItemIndex;
	solopt.datum	=OutputDatum ->ItemIndex;
	solopt.height	=OutputHeight->ItemIndex;
	solopt.geoid	=OutputGeoid ->ItemIndex;
	solopt.nmeaintv[0]=str2dbl(NmeaIntv1->Text);
	solopt.nmeaintv[1]=str2dbl(NmeaIntv2->Text);
	solopt.trace	=DebugTrace	 ->ItemIndex;
	solopt.sstat	=DebugStatus ->ItemIndex;
	
	prcopt.eratio[0]=str2dbl(MeasErrR1->Text);
	prcopt.eratio[1]=str2dbl(MeasErrR2->Text);
	prcopt.err[1]	=str2dbl(MeasErr2->Text);
	prcopt.err[2]	=str2dbl(MeasErr3->Text);
	prcopt.err[3]	=str2dbl(MeasErr4->Text);
	prcopt.err[4]	=str2dbl(MeasErr5->Text);
	prcopt.sclkstab	=str2dbl(SatClkStab->Text);
	prcopt.prn[0]	=str2dbl(PrNoise1->Text);
	prcopt.prn[1]	=str2dbl(PrNoise2->Text);
	prcopt.prn[2]	=str2dbl(PrNoise3->Text);
	prcopt.prn[3]	=str2dbl(PrNoise4->Text);
	prcopt.prn[4]	=str2dbl(PrNoise5->Text);
	
	if (RovAntPcv->Checked) strcpy(prcopt.anttype[0],RovAnt_Text.c_str());
	if (RefAntPcv->Checked) strcpy(prcopt.anttype[1],RefAnt_Text.c_str());
	prcopt.antdel[0][0]=str2dbl(RovAntE->Text);
	prcopt.antdel[0][1]=str2dbl(RovAntN->Text);
	prcopt.antdel[0][2]=str2dbl(RovAntU->Text);
	prcopt.antdel[1][0]=str2dbl(RefAntE->Text);
	prcopt.antdel[1][1]=str2dbl(RefAntN->Text);
	prcopt.antdel[1][2]=str2dbl(RefAntU->Text);
	
	prcopt.rovpos=RovPosTypeP->ItemIndex<3?0:4;
	prcopt.refpos=RefPosTypeP->ItemIndex<3?0:4;
	
	if (prcopt.rovpos==0) GetPos(RovPosTypeP->ItemIndex,editu,prcopt.ru);
	if (prcopt.refpos==0) GetPos(RefPosTypeP->ItemIndex,editr,prcopt.rb);
	
	strcpy(filopt.satantp,SatPcvFile_Text.c_str());
	strcpy(filopt.rcvantp,AntPcvFile_Text.c_str());
	strcpy(filopt.stapos, StaPosFile_Text.c_str());
	strcpy(filopt.geoid,  GeoidDataFile_Text.c_str());
	strcpy(filopt.dcb,    DCBFile_Text.c_str());
	strcpy(filopt.tempdir,LocalDir_Text.c_str());
	
	time2str(utc2gpst(timeget()),s,0);
	sprintf(comment,"RTKNAVI options (%s, v.%s)",s,VER_RTKLIB);
	setsysopts(&prcopt,&solopt,&filopt);
	if (!saveopts(file.c_str(),"w",comment,sysopts)||
		!saveopts(file.c_str(),"a","",rcvopts)) return;
}
示例#20
0
//---------------------------------------------------------------------------
void __fastcall TOptDialog::SetOpt(void)
{
	AnsiString FieldSep_Text=FieldSep->Text;
	TEdit *editu[]={RovPos1,RovPos2,RovPos3};
	TEdit *editr[]={RefPos1,RefPos2,RefPos3};
	
	PrcOpt.mode      =PosMode     ->ItemIndex;
	PrcOpt.nf        =Freq        ->ItemIndex+1;
	PrcOpt.elmin     =str2dbl(ElMask ->Text)*D2R;
	PrcOpt.dynamics  =DynamicModel->ItemIndex;
	PrcOpt.tidecorr  =TideCorr    ->ItemIndex;
	PrcOpt.ionoopt   =IonoOpt     ->ItemIndex;
	PrcOpt.tropopt   =TropOpt     ->ItemIndex;
	PrcOpt.sateph    =SatEphem    ->ItemIndex;
	PrcOpt.modear    =AmbRes      ->ItemIndex;
	PrcOpt.glomodear =GloAmbRes   ->ItemIndex;
	PrcOpt.thresar[0]=str2dbl(ValidThresAR->Text);
	PrcOpt.maxout    =OutCntResetAmb->Text.ToInt();
	PrcOpt.minlock   =LockCntFixAmb->Text.ToInt();
	PrcOpt.minfix    =FixCntHoldAmb->Text.ToInt();
	PrcOpt.elmaskar  =str2dbl(ElMaskAR   ->Text)*D2R;
	PrcOpt.elmaskhold=str2dbl(ElMaskHold ->Text)*D2R;
	PrcOpt.maxtdiff  =str2dbl(MaxAgeDiff ->Text);
	PrcOpt.maxgdop   =str2dbl(RejectGdop ->Text);
	PrcOpt.maxinno   =str2dbl(RejectThres->Text);
	PrcOpt.thresslip =str2dbl(SlipThres  ->Text);
	PrcOpt.niter     =NumIter     ->Text.ToInt();
	PrcOpt.syncsol   =SyncSol     ->ItemIndex;
	ExSats			 =ExSatsE	  ->Text;
	PrcOpt.navsys    =0;
	if (NavSys1->Checked) PrcOpt.navsys|=SYS_GPS;
	if (NavSys2->Checked) PrcOpt.navsys|=SYS_GLO;
	if (NavSys3->Checked) PrcOpt.navsys|=SYS_GAL;
	if (NavSys4->Checked) PrcOpt.navsys|=SYS_QZS;
	if (NavSys5->Checked) PrcOpt.navsys|=SYS_SBS;
	if (NavSys6->Checked) PrcOpt.navsys|=SYS_CMP;
	PrcOpt.posopt[0] =PosOpt1   ->Checked;
	PrcOpt.posopt[1] =PosOpt2   ->Checked;
	PrcOpt.posopt[2] =PosOpt3   ->Checked;
	PrcOpt.posopt[3] =PosOpt4   ->Checked;
	PrcOpt.posopt[4] =PosOpt5   ->Checked;
	
	SolOpt.posf      =SolFormat   ->ItemIndex;
	SolOpt.timef     =TimeFormat->ItemIndex==0?0:1;
	SolOpt.times     =TimeFormat->ItemIndex==0?0:TimeFormat->ItemIndex-1;
	SolOpt.timeu     =(int)str2dbl(TimeDecimal->Text);
	SolOpt.degf      =LatLonFormat->ItemIndex;
	strcpy(SolOpt.sep,FieldSep_Text.c_str());
	SolOpt.outhead   =OutputHead  ->ItemIndex;
	SolOpt.outopt    =OutputOpt   ->ItemIndex;
	SolOpt.datum     =OutputDatum ->ItemIndex;
	SolOpt.height    =OutputHeight->ItemIndex;
	SolOpt.geoid     =OutputGeoid ->ItemIndex;
	SolOpt.nmeaintv[0]=str2dbl(NmeaIntv1->Text);
	SolOpt.nmeaintv[1]=str2dbl(NmeaIntv2->Text);
	DebugStatusF     =DebugStatus ->ItemIndex;
	DebugTraceF      =DebugTrace  ->ItemIndex;
	
	BaselineC        =BaselineConst->Checked;
	Baseline[0]      =str2dbl(BaselineLen->Text);
	Baseline[1]      =str2dbl(BaselineSig->Text);
	
	PrcOpt.eratio[0] =str2dbl(MeasErrR1 ->Text);
	PrcOpt.eratio[1] =str2dbl(MeasErrR2 ->Text);
	PrcOpt.err[1]    =str2dbl(MeasErr2  ->Text);
	PrcOpt.err[2]    =str2dbl(MeasErr3  ->Text);
	PrcOpt.err[3]    =str2dbl(MeasErr4  ->Text);
	PrcOpt.err[4]    =str2dbl(MeasErr5  ->Text);
	PrcOpt.prn[0]    =str2dbl(PrNoise1  ->Text);
	PrcOpt.prn[1]    =str2dbl(PrNoise2  ->Text);
	PrcOpt.prn[2]    =str2dbl(PrNoise3  ->Text);
	PrcOpt.prn[3]    =str2dbl(PrNoise4  ->Text);
	PrcOpt.prn[4]    =str2dbl(PrNoise5  ->Text);
	PrcOpt.sclkstab  =str2dbl(SatClkStab->Text);
	
	RovPosTypeF      =RovPosTypeP ->ItemIndex;
	RefPosTypeF      =RefPosTypeP ->ItemIndex;
	RovAntPcvF       =RovAntPcv   ->Checked;
	RefAntPcvF       =RefAntPcv   ->Checked;
	RovAntF          =RovAnt      ->Text;
	RefAntF          =RefAnt      ->Text;
	RovAntDel[0]     =str2dbl(RovAntE   ->Text);
	RovAntDel[1]     =str2dbl(RovAntN   ->Text);
	RovAntDel[2]     =str2dbl(RovAntU   ->Text);
	RefAntDel[0]     =str2dbl(RefAntE   ->Text);
	RefAntDel[1]     =str2dbl(RefAntN   ->Text);
	RefAntDel[2]     =str2dbl(RefAntU   ->Text);
	GetPos(RovPosTypeP->ItemIndex,editu,RovPos);
	GetPos(RefPosTypeP->ItemIndex,editr,RefPos);
	
	SatPcvFileF      =SatPcvFile  ->Text;
	AntPcvFileF      =AntPcvFile  ->Text;
	StaPosFileF      =StaPosFile  ->Text;
	GeoidDataFileF   =GeoidDataFile->Text;
	DCBFileF         =DCBFile     ->Text;
	EOPFileF         =EOPFile     ->Text;
	TLEFileF         =TLEFile     ->Text;
	TLESatFileF      =TLESatFile  ->Text;
	LocalDirectory   =LocalDir    ->Text;
	
	SvrCycle	     =SvrCycleE   ->Text.ToInt();
	TimeoutTime      =TimeoutTimeE->Text.ToInt();
	ReconTime        =ReconTimeE  ->Text.ToInt();
	NmeaCycle	     =NmeaCycleE  ->Text.ToInt();
	FileSwapMargin   =FileSwapMarginE->Text.ToInt();
	SvrBuffSize      =SvrBuffSizeE->Text.ToInt();
	SolBuffSize      =SolBuffSizeE->Text.ToInt();
	SavedSol         =SavedSolE   ->Text.ToInt();
	NavSelect        =NavSelectS  ->ItemIndex;
	PrcOpt.sbassatsel=SbasSatE    ->Text.ToInt();
	ProxyAddr        =ProxyAddrE  ->Text;
	MoniPort         =MoniPortE   ->Text.ToInt();
	PanelStack       =PanelStackE ->ItemIndex;
	PosFont->Assign(FontLabel->Font);
	UpdateEnable();
}
示例#21
0
文件: skydlg.cpp 项目: Chaos99/RTKLIB
//---------------------------------------------------------------------------
void __fastcall TSkyImgDialog::UpdateSky(void)
{
    Plot->SkyCent[0]=str2dbl(SkyCent1->Text);
    Plot->SkyCent[1]=str2dbl(SkyCent2->Text);
    Plot->SkyScale=str2dbl(SkyScale->Text);
    Plot->SkyFov[0]=str2dbl(SkyFov1->Text);
    Plot->SkyFov[1]=str2dbl(SkyFov2->Text);
    Plot->SkyFov[2]=str2dbl(SkyFov3->Text);
    Plot->SkyDest[1]=str2dbl(SkyDest1->Text);
    Plot->SkyDest[2]=str2dbl(SkyDest2->Text);
    Plot->SkyDest[3]=str2dbl(SkyDest3->Text);
    Plot->SkyDest[4]=str2dbl(SkyDest4->Text);
    Plot->SkyDest[5]=str2dbl(SkyDest5->Text);
    Plot->SkyDest[6]=str2dbl(SkyDest6->Text);
    Plot->SkyDest[7]=str2dbl(SkyDest7->Text);
    Plot->SkyDest[8]=str2dbl(SkyDest8->Text);
    Plot->SkyDest[9]=str2dbl(SkyDest9->Text);
    Plot->SkyElMask=SkyElMask->Checked;
    Plot->SkyDestCorr=SkyDestCorr->Checked;
    Plot->SkyRes=SkyRes->ItemIndex;
    Plot->SkyFlip=SkyFlip->Checked;
    Plot->UpdateSky();
}
示例#22
0
enum MqErrorE
pBufferGetA4 (
  struct MqBufferS * const buf,
  union MqBufferAtomU * const ato,
  enum MqTypeE const type 
)
{
  buf->cur.B = buf->data;
  if (type == buf->type) {
#if defined(HAVE_ALIGNED_ACCESS_REQUIRED)
    memcpy(ato,buf->cur.B,4);
#else
    (*ato).I = (*buf->cur.A).I;
#endif
  } else if ( buf->type == MQ_STRT ) {
    MQ_STR end;
    errno = 0;
    if (type == MQ_INTT) {
      // MQ_INTT
      long ret = str2int (buf->cur.C, &end, 0);
      (*ato).I = (MQ_INT) ret;
      // on 32bit: long=int
      if (unlikely (errno == ERANGE)) {
        if (unlikely (ret == LONG_MIN)) {
          return RANGE_E (underflow, INT);
        } else if (unlikely (ret == LONG_MAX)) {
          return RANGE_E (overflow, INT);
        }
      } else {
        if (unlikely (ret < (long) MQ_INT_MIN)) {
          return RANGE_E (underflow, INT);
        } else if (unlikely (ret > (long) MQ_INT_MAX)) {
          return RANGE_E (overflow, INT);
        } else if (unlikely ((end - buf->cur.C) != buf->cursize)) {
          return RANGE_E (size, INT);
        }
      }
    } else {
#if defined(HAVE_STRTOF)
      // MQ_FLTT
      (*ato).F = str2flt (buf->cur.C, &end);
      if (unlikely (errno == ERANGE)) {
        if (unlikely ((*ato).F == 0.0)) {
          return RANGE_E (underflow, FLT);
        } else if (unlikely ((*ato).F == +MQ_HUGE_VALF || (*ato).F == -MQ_HUGE_VALF)) {
          return RANGE_E (overflow, FLT);
        }
      } else if (unlikely ((end - buf->cur.C) != buf->cursize)) {
        return RANGE_E (size, FLT);
      }
#else /* ! HAVE_STRTOF */
      // MQ_DBLT
      double d = str2dbl (buf->cur.C, &end);
      if (unlikely (errno == ERANGE)) {
        if (unlikely (d == 0.0L)) {
          return RANGE_E (underflow, FLT);
        } else if (unlikely (d == +MQ_HUGE_VAL || d == -MQ_HUGE_VAL)) {
          return RANGE_E (overflow, FLT);
        }
      } else if (unlikely ((end - buf->cur.C) != buf->cursize)) {
        return RANGE_E (size, FLT);
      }
      (*ato).F = (float) d;
#endif /* !HAVE_STRTOF */
    }
  } else {
    return TYPE_E(type, buf->type);
  }
  return MQ_OK;
}
    // Reads a LAMMPS dump output file, in atom format.
    void LAMMPS_Data::read_dump(string path) {
        fstream fid(path);
        if (!fid) cout << "Error opening output file " << path << "!\n";
        else      cout << "Opened dump " << path << ".\n";

        SnapshotDump *step=NULL;
        while (fid) {
            auto line = trim(read_line(fid));
            if (line.empty()) continue;
            else if (line=="ITEM: TIMESTEP") {
                _dump.push_back(SnapshotDump());
                step = &_dump.back(); 
                step->timestep = str2u32(trim(read_line(fid)));
            }
            else if (line=="ITEM: NUMBER OF ATOMS") {
                if (!step) { 
                    cout << "Error: NUMBER OF ATOMS specified before TIMESTEP\n";
                    exit(1);
                }
                unsigned n = str2u32(trim(read_line(fid)));
                step->scaled_coordinates.assign(n, Coord());
            }
            else if (line.find("ITEM: BOX BOUNDS")==0) {
                if (!step) { 
                    cout << "Error: BOX BOUNDS specified before TIMESTEP\n";
                    exit(1);
                }
                auto xb  = split(read_line(fid));
                auto yb  = split(read_line(fid));
                auto zb  = split(read_line(fid));
                step->dx = fabs(str2dbl(xb.at(1))-str2dbl(xb.at(0)));
                step->dy = fabs(str2dbl(yb.at(1))-str2dbl(yb.at(0)));                                
                step->dz = fabs(str2dbl(zb.at(1))-str2dbl(zb.at(0)));
            }
            // The only thing left should be the ATOMS data.
            else {
                auto pieces = split(line);
                if (pieces.size() < 4) continue;
                if (pieces[0]=="ITEM:" && pieces[1]=="ATOMS") {
                    vector<string> var(pieces.begin()+2, pieces.end());
                    // Search for coordinate and tag columns.
                    step->xc = step->yc = step->zc = step->zc = -1;
                    step->xs = step->ys = step->zs = 0;
                    for (size_t i=0; i<var.size(); ++i) {
                        if (var[i]=="x")  {step->xc=i;}
                        if (var[i]=="xs") {step->xc=i; step->xs=1; }
                        if (var[i]=="y")  {step->yc=i;}
                        if (var[i]=="ys") {step->yc=i; step->ys=1; }
                        if (var[i]=="z")  {step->zc=i;}
                        if (var[i]=="zs") {step->zc=i; step->zs=1; }
                        if (var[i]=="id")  step->tc=i;
                    }
                    if (step->xc<0 || step->yc<0 || step->zc<0) {
                        cout << "Error: coordinate column not found\n";
                        exit(1);
                    }
                    if (step->tc<0) {
                        cout << "Error: atom tag column not found.\n";
                        exit(1);
                    }
                   continue;
                }
                if (!step) { 
                    cout << "Error: data encountered before TIMESTEP\n";
                    exit(1);
                }
                auto maxc=max(step->tc,max(step->xc,max(step->yc,step->zc)));
                auto minc=min(step->tc,min(step->xc,min(step->yc,step->zc)));
                if (maxc >= (int)pieces.size()) {
                    cout << "Not enough columns in dump data.\n";
                    exit(1);
                }
                if (minc < 0) {
                    cout << "Missing data column in dump data.\n";
                    exit(1);
                }
                unsigned id = str2u32(pieces[step->tc])-1;
                if (step->scaled_coordinates.size() <= id) {
                    cout << "Error: invalid atom id found " << id << "\n";
                    exit(1);
                }
                Coord &r = step->scaled_coordinates[id];
                r.x = str2dbl(pieces[step->xc]);
                r.y = str2dbl(pieces[step->yc]);
                r.z = str2dbl(pieces[step->zc]);

                // Store coordinates scaled no matter what the input is.
                if (!step->xs) r.x = to_scaled(r.x, step->dx);
                if (!step->ys) r.y = to_scaled(r.y, step->dy);
                if (!step->zs) r.z = to_scaled(r.z, step->dz);
            }
        }
    }
示例#24
0
文件: strdist.c 项目: LFHao/Projects
double strdist(char *str1, char *str2) {
    return str2dbl(str1)-str2dbl(str2);
}