//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CHL2WarsGameMovement::PlayerMove() { // Other movetype than strategic? use base class if( player->GetMoveType() != MOVETYPE_STRATEGIC ) { CGameMovement::PlayerMove(); return; } VPROF( "CHL2WarsGameMovement::PlayerMove" ); CheckParameters(); // clear output applied velocity mv->m_outWishVel.Init(); mv->m_outJumpVel.Init(); MoveHelper( )->ResetTouchList(); // Assume we don't touch anything ReduceTimers(); AngleVectors (mv->m_vecViewAngles, &m_vecForward, &m_vecRight, &m_vecUp ); // Determine movement angles SetGroundEntity( NULL ); // Store off the starting water level m_nOldWaterLevel = player->GetWaterLevel(); m_nOnLadder = 0; StrategicPlayerMove(); }
/*virtual*/ void PCLDepthToMeters::_Initialize (const Arguments& parameters) { CheckParameters (parameters, _parameters); _parameters = _runtime.CopyArguments (parameters); _input_args.push_back (ShortMatrix (GetRuntime()).SetName ("DepthMatrix").SetDescription ("Depth matrix")); _output_args.push_back (DoubleMatrix (GetRuntime()).SetName ("MetersMatrix").SetDescription ("Real world coordinates matrix in meters")); }
static void retro_load_game(int argc, char *argv[]) { CheckParameters(argc, argv); CheckForEpisodes(); InitGame(); }
/*virtual*/ void PCLDepthToRealWorld::_Initialize (const Arguments& parameters) { CheckParameters (parameters, _parameters); _parameters = _runtime.CopyArguments (parameters); _input_args.push_back (ShortMatrix (GetRuntime()).SetName ("DepthMatrix").SetDescription ("Depth matrix")); _output_args.push_back (XYZArray (GetRuntime()).SetName ("XYZMeters").SetDescription ("(x,y,z)-array in real world coordinates in meters")); }
void CallbackParameters::AddFloat( const char *_name, float _param ) { CheckParameters(); mVariables[ mNumParameters ].SetFloat( _param ); #if(DEBUG_PARAMS) mDebugNames[.mNumParameters] = _name; #endif mNumParameters++; }
void CallbackParameters::AddTable( const char *_name, gmTableObject *_param ) { CheckParameters(); mVariables[ mNumParameters ].SetTable( _param ); #if(DEBUG_PARAMS) mDebugNames[.mNumParameters] = _name; #endif mNumParameters++; }
void CallbackParameters::AddString( const char *_name, const char *_param ) { CheckParameters(); mVariables[ mNumParameters ].SetString( mMachine->AllocStringObject( _param ? _param : "<unknown>" ) ); #if(DEBUG_PARAMS) mDebugNames[.mNumParameters] = _name; #endif mNumParameters++; }
void CallbackParameters::AddVector( const char *_name, float _x, float _y, float _z ) { CheckParameters(); mVariables[ mNumParameters ].SetVector( _x, _y, _z ); #if(DEBUG_PARAMS) mDebugNames[.mNumParameters] = _name; #endif mNumParameters++; }
void CallbackParameters::AddNull( const char *_name ) { CheckParameters(); mVariables[ mNumParameters ].Nullify(); #if(DEBUG_PARAMS) mDebugNames[.mNumParameters] = _name; #endif mNumParameters++; }
//--------------------------------------------------------------------------- void __fastcall TfrmEditFTP::btnOkClick(TObject *Sender) { if(!CheckParameters()) return; AnsiString Mode; if(cbxMode->ItemIndex == 0) Mode = "PASV"; else Mode = "NORMAL"; AnsiString UserName; if(chkNoUserName->Checked) UserName = "******"; else UserName = txtUserName->Text; if(ForEdit) { if(OldFTPName != txtServerName->Text) { if(FTPConfig->IsFTPNameExists(txtServerName->Text)) { MessageBox(Handle,"输入的服务器名称在配置文件中已经存在!","提示",MB_OK | MB_ICONWARNING); txtServerName->SetFocus(); txtServerName->SelectAll(); return; } } FTPConfig->SetFTPAttributeValue(OldFTPName,"ServerName",txtServerName->Text); FTPConfig->SetFTPAttributeValue(OldFTPName,"Server",txtServer->Text); FTPConfig->SetFTPAttributeValue(OldFTPName,"Port",txtPort->Text); FTPConfig->SetFTPAttributeValue(OldFTPName,"UserName",UserName); FTPConfig->SetFTPAttributeValue(OldFTPName,"Password",txtPassword->Text,true); FTPConfig->SetFTPAttributeValue(OldFTPName,"Mode",Mode); //FTPConfig->SetFTPAttributeValue(OldFTPName,"TimeOut",txtTimeOut->Text); } else { if(FTPConfig->IsFTPNameExists(txtServerName->Text)) { MessageBox(Handle,"输入的服务器名称在配置文件中已经存在!","提示",MB_OK | MB_ICONWARNING); txtServerName->SetFocus(); txtServerName->SelectAll(); return; } FTPConfig->AddNewFTPServer( txtServerName->Text, txtServer->Text, StrToInt(txtPort->Text), UserName, txtPassword->Text, Mode);//,StrToInt(txtTimeOut->Text)); } ModalResult = mrOk; }
bool CCommonParm::Init(int argc, char *argv[]) { if (!AnalizeParameters(argc, argv)) return false; if (!CheckParameters()) return false; if (!InitParameters()) return false; return true; }
void CallbackParameters::AddEntity( const char *_name, GameEntity _param ) { if ( !_param.IsValid() ) { AddNull( _name ); return; } CheckParameters(); mVariables[ mNumParameters ].SetEntity( _param.AsInt() ); #if(DEBUG_PARAMS) mDebugNames[.mNumParameters] = _name; #endif mNumParameters++; }
void TimeScaleDialog::OnText_RatePercentChangeEnd(wxCommandEvent & WXUNUSED(event)) { if (m_bLoopDetect) return; if (m_pTextCtrl_RatePercentChangeEnd) { wxString str = m_pTextCtrl_RatePercentChangeEnd->GetValue(); double newValue = 0; str.ToDouble(&newValue); m_RatePercentChangeEnd = newValue; m_bLoopDetect = true; this->Update_Slider_RatePercentChangeEnd(); m_bLoopDetect = false; FindWindow(wxID_OK)->Enable(CheckParameters()); } }
void TimeScaleDialog::OnText_PitchHalfStepsEnd(wxCommandEvent & event) { if (m_bLoopDetect) return; if (m_pTextCtrl_PitchHalfStepsEnd) { wxString str = m_pTextCtrl_PitchHalfStepsEnd->GetValue(); double newValue = 0; str.ToDouble(&newValue); m_PitchHalfStepsEnd = newValue; m_PitchPercentChangeEnd = HalfStepsToPercentChange(newValue); m_bLoopDetect = true; this->Update_Text_PitchPercentChangeEnd(); m_bLoopDetect = false; FindWindow(wxID_OK)->Enable(CheckParameters()); } }
int __cdecl main(int argc, const char *argv[]) { if ( ParseCmdLine (argc, argv) == false ) { usage(); return 0; } if ( CheckParameters () == false ) { return 0; } // init DebugPlot library DebugPlotInit(); InitializeTimestampInfo ( &tsinfo, true ); // begin receive or transmit packets if (!SoraUInitUserExtension("\\\\.\\HWTest")) { printf ( "Error: fail to find the hwtest driver!\n" ); getchar(); return -1; } if ( bWarning ) { printf ( "Warnings - press enter to continue...\n" ); getchar(); } // clear screen system( "cls" ); // Start the main procedure Dot11_main (); // clear screen // system( "cls" ); SoraUCleanUserExtension(); DebugPlotDeinit(); return 0; }
void TimeScaleDialog::OnText_PitchPercentChangeStart(wxCommandEvent & WXUNUSED(event)) { if (m_bLoopDetect) return; if (m_pTextCtrl_PitchPercentChangeStart) { wxString str = m_pTextCtrl_PitchPercentChangeStart->GetValue(); double newValue = 0; str.ToDouble(&newValue); m_PitchPercentChangeStart = newValue; m_PitchHalfStepsStart = PercentChangeToHalfSteps(newValue); m_bLoopDetect = true; this->Update_Text_PitchHalfStepsStart(); m_bLoopDetect = false; FindWindow(wxID_OK)->Enable(CheckParameters()); } }
void HyperElasticUP3DLaw::CalculateMaterialResponsePK2 (Parameters& rValues) { //-----------------------------// //a.-Check if the constitutive parameters are passed correctly to the law calculation CheckParameters(rValues); //b.- Get Values to compute the constitutive law: Flags &Options=rValues.GetOptions(); const Properties& MaterialProperties = rValues.GetMaterialProperties(); const Matrix& DeformationGradientF = rValues.GetDeformationGradientF(); const double& DeterminantF = rValues.GetDeterminantF(); const GeometryType& DomainGeometry = rValues.GetElementGeometry (); const Vector& ShapeFunctions = rValues.GetShapeFunctionsValues (); Vector& StrainVector = rValues.GetStrainVector(); Vector& StressVector = rValues.GetStressVector(); Matrix& ConstitutiveMatrix = rValues.GetConstitutiveMatrix(); //-----------------------------// //0.- Initialize parameters MaterialResponseVariables ElasticVariables; ElasticVariables.Identity = identity_matrix<double> ( 3 ); ElasticVariables.SetElementGeometry(DomainGeometry); ElasticVariables.SetShapeFunctionsValues(ShapeFunctions); // Initialize Splited Parts: Isochoric and Volumetric stresses and constitutive tensors double voigtsize = StressVector.size(); VectorSplit SplitStressVector; MatrixSplit SplitConstitutiveMatrix; //1.- Lame constants const double& YoungModulus = MaterialProperties[YOUNG_MODULUS]; const double& PoissonCoefficient = MaterialProperties[POISSON_RATIO]; ElasticVariables.LameLambda = (YoungModulus*PoissonCoefficient)/((1+PoissonCoefficient)*(1-2*PoissonCoefficient)); ElasticVariables.LameMu = YoungModulus/(2*(1+PoissonCoefficient)); //2.- Thermal constants if( MaterialProperties.Has(THERMAL_EXPANSION_COEFFICIENT) ) ElasticVariables.ThermalExpansionCoefficient = MaterialProperties[THERMAL_EXPANSION_COEFFICIENT]; else ElasticVariables.ThermalExpansionCoefficient = 0; if( MaterialProperties.Has(REFERENCE_TEMPERATURE) ) ElasticVariables.ReferenceTemperature = MaterialProperties[REFERENCE_TEMPERATURE]; else ElasticVariables.ReferenceTemperature = 0; //3.-DeformationGradient Tensor 3D ElasticVariables.DeformationGradientF = DeformationGradientF; ElasticVariables.DeformationGradientF = Transform2DTo3D( ElasticVariables.DeformationGradientF ); //4.-Determinant of the Total Deformation Gradient ElasticVariables.DeterminantF = DeterminantF; //5.-Right Cauchy Green tensor C Matrix RightCauchyGreen = prod(trans(ElasticVariables.DeformationGradientF),ElasticVariables.DeformationGradientF); //6.-Inverse of the Right Cauchy-Green tensor C: (stored in the CauchyGreenMatrix) ElasticVariables.traceCG = 0; ElasticVariables.CauchyGreenMatrix( 3, 3 ); MathUtils<double>::InvertMatrix( RightCauchyGreen, ElasticVariables.CauchyGreenMatrix, ElasticVariables.traceCG); //8.-Green-Lagrange Strain: if(Options.Is( ConstitutiveLaw::COMPUTE_STRAIN )) { this->CalculateGreenLagrangeStrain(RightCauchyGreen, StrainVector); } //9.-Calculate Total PK2 stress SplitStressVector.Isochoric = ZeroVector(voigtsize); if( Options.Is(ConstitutiveLaw::COMPUTE_STRESS ) || Options.Is(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR ) ) this->CalculateIsochoricStress( ElasticVariables, StressMeasure_PK2, SplitStressVector.Isochoric ); Vector IsochoricStressVector = SplitStressVector.Isochoric; if( Options.Is( ConstitutiveLaw::COMPUTE_STRESS ) ) { SplitStressVector.Volumetric = ZeroVector(voigtsize); this->CalculateVolumetricStress ( ElasticVariables, SplitStressVector.Volumetric ); //PK2 Stress: StressVector = SplitStressVector.Isochoric + SplitStressVector.Volumetric; if( Options.Is(ConstitutiveLaw::ISOCHORIC_TENSOR_ONLY ) ) { StressVector = SplitStressVector.Isochoric; } else if( Options.Is(ConstitutiveLaw::VOLUMETRIC_TENSOR_ONLY ) ) { StressVector = SplitStressVector.Volumetric; } } //10.-Calculate Constitutive Matrix related to Total PK2 stress if( Options.Is( ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR ) ) { //initialize constitutive tensors ConstitutiveMatrix.clear(); SplitConstitutiveMatrix.Isochoric = ConstitutiveMatrix; SplitConstitutiveMatrix.Volumetric = ConstitutiveMatrix; Matrix IsoStressMatrix = MathUtils<double>::StressVectorToTensor( IsochoricStressVector ); this->CalculateIsochoricConstitutiveMatrix ( ElasticVariables, IsoStressMatrix, SplitConstitutiveMatrix.Isochoric ); this->CalculateVolumetricConstitutiveMatrix ( ElasticVariables, SplitConstitutiveMatrix.Volumetric ); //if( Options.Is(ConstitutiveLaw::TOTAL_TENSOR ) ) ConstitutiveMatrix = SplitConstitutiveMatrix.Isochoric + SplitConstitutiveMatrix.Volumetric; if( Options.Is(ConstitutiveLaw::ISOCHORIC_TENSOR_ONLY ) ) { ConstitutiveMatrix = SplitConstitutiveMatrix.Isochoric; } else if( Options.Is(ConstitutiveLaw::VOLUMETRIC_TENSOR_ONLY ) ) { ConstitutiveMatrix = SplitConstitutiveMatrix.Volumetric; } } // std::cout<<" Constitutive "<<ConstitutiveMatrix<<std::endl; // std::cout<<" Stress "<<StressVector<<std::endl; //-----------------------------// }
// --------------------------------------------------------- // CPosLmPartialReadParameters::SetRequestedAttributes // // (other items were commented in a header). // --------------------------------------------------------- // EXPORT_C void CPosLmPartialReadParameters::SetRequestedAttributes( CPosLandmark::TAttributes aAttributes) { CheckParameters(aAttributes); iAttributes = aAttributes; }
int GptSanityCheck(GptData *gpt) { int retval; GptHeader *header1 = (GptHeader *)(gpt->primary_header); GptHeader *header2 = (GptHeader *)(gpt->secondary_header); GptEntry *entries1 = (GptEntry *)(gpt->primary_entries); GptEntry *entries2 = (GptEntry *)(gpt->secondary_entries); GptHeader *goodhdr = NULL; gpt->valid_headers = 0; gpt->valid_entries = 0; retval = CheckParameters(gpt); if (retval != GPT_SUCCESS) return retval; /* Check both headers; we need at least one valid header. */ if (0 == CheckHeader(header1, 0, gpt->streaming_drive_sectors, gpt->gpt_drive_sectors, gpt->flags)) { gpt->valid_headers |= MASK_PRIMARY; goodhdr = header1; } if (0 == CheckHeader(header2, 1, gpt->streaming_drive_sectors, gpt->gpt_drive_sectors, gpt->flags)) { gpt->valid_headers |= MASK_SECONDARY; if (!goodhdr) goodhdr = header2; } if (!gpt->valid_headers) return GPT_ERROR_INVALID_HEADERS; /* * Check if entries are valid. * * Note that we use the same header in both checks. This way we'll * catch the case where (header1,entries1) and (header2,entries2) are * both valid, but (entries1 != entries2). */ if (0 == CheckEntries(entries1, goodhdr)) gpt->valid_entries |= MASK_PRIMARY; if (0 == CheckEntries(entries2, goodhdr)) gpt->valid_entries |= MASK_SECONDARY; /* * If both headers are good but neither entries were good, check the * entries with the secondary header. */ if (MASK_BOTH == gpt->valid_headers && !gpt->valid_entries) { if (0 == CheckEntries(entries1, header2)) gpt->valid_entries |= MASK_PRIMARY; if (0 == CheckEntries(entries2, header2)) gpt->valid_entries |= MASK_SECONDARY; if (gpt->valid_entries) { /* * Sure enough, header2 had a good CRC for one of the * entries. Mark header1 invalid, so we'll update its * entries CRC. */ gpt->valid_headers &= ~MASK_PRIMARY; goodhdr = header2; } } if (!gpt->valid_entries) return GPT_ERROR_INVALID_ENTRIES; /* * Now that we've determined which header contains a good CRC for * the entries, make sure the headers are otherwise identical. */ if (MASK_BOTH == gpt->valid_headers && 0 != HeaderFieldsSame(header1, header2)) gpt->valid_headers &= ~MASK_SECONDARY; return GPT_SUCCESS; }
/*virtual*/ void pInTemplate::_Initialize (const Arguments& parameters) { CheckParameters (parameters, _parameters); // TODO create I/O signature here... }
/*virtual*/ void RampToGray::_Initialize (const Arguments& parameters) { CheckParameters (parameters, _parameters); _act_params = _runtime.CopyArguments (parameters); InitColourModel (static_cast<ColourModel> (StringSelection(parameters[0]).GetIndex())); }
//============================================================================= int Amesos_Mumps::SymbolicFactorization() { // erase data if present. if (IsSymbolicFactorizationOK_ && MDS.job != -777) Destroy(); IsSymbolicFactorizationOK_ = false; IsNumericFactorizationOK_ = false; CreateTimer(Comm()); CheckParameters(); AMESOS_CHK_ERR(ConvertToTriplet(false)); #if defined(HAVE_MPI) && defined(HAVE_AMESOS_MPI_C2F) if (MaxProcs_ != Comm().NumProc()) { if(MUMPSComm_) MPI_Comm_free(&MUMPSComm_); std::vector<int> ProcsInGroup(MaxProcs_); for (int i = 0 ; i < MaxProcs_ ; ++i) ProcsInGroup[i] = i; MPI_Group OrigGroup, MumpsGroup; MPI_Comm_group(MPI_COMM_WORLD, &OrigGroup); MPI_Group_incl(OrigGroup, MaxProcs_, &ProcsInGroup[0], &MumpsGroup); MPI_Comm_create(MPI_COMM_WORLD, MumpsGroup, &MUMPSComm_); #ifdef MUMPS_4_9 MDS.comm_fortran = (MUMPS_INT) MPI_Comm_c2f( MUMPSComm_); #else #ifndef HAVE_AMESOS_OLD_MUMPS MDS.comm_fortran = (DMUMPS_INT) MPI_Comm_c2f( MUMPSComm_); #else MDS.comm_fortran = (F_INT) MPI_Comm_c2f( MUMPSComm_); #endif #endif } else { const Epetra_MpiComm* MpiComm = dynamic_cast<const Epetra_MpiComm*>(&Comm()); assert (MpiComm != 0); #ifdef MUMPS_4_9 MDS.comm_fortran = (MUMPS_INT) MPI_Comm_c2f(MpiComm->GetMpiComm()); #else #ifndef HAVE_AMESOS_OLD_MUMPS MDS.comm_fortran = (DMUMPS_INT) MPI_Comm_c2f(MpiComm->GetMpiComm()); #else MDS.comm_fortran = (F_INT) MPI_Comm_c2f(MpiComm->GetMpiComm()); #endif #endif } #else // This next three lines of code were required to make Amesos_Mumps work // with Ifpack_SubdomainFilter. They is usefull in all cases // when using MUMPS on a subdomain. const Epetra_MpiComm* MpiComm = dynamic_cast<const Epetra_MpiComm*>(&Comm()); assert (MpiComm != 0); MDS.comm_fortran = (MUMPS_INT) MPI_Comm_c2f(MpiComm->GetMpiComm()); // only thing I can do, use MPI_COMM_WORLD. This will work in serial as well // Previously, the next line was uncommented, but we don't want MUMPS to work // on the global MPI comm, but on the comm associated with the matrix // MDS.comm_fortran = -987654; #endif MDS.job = -1 ; // Initialization MDS.par = 1 ; // Host IS involved in computations // MDS.sym = MatrixProperty_; MDS.sym = 0; // MatrixProperty_ is unititalized. Furthermore MUMPS // expects only half of the matrix to be provided for // symmetric matrices. Hence setting MDS.sym to be non-zero // indicating that the matrix is symmetric will only work // if we change ConvertToTriplet to pass only half of the // matrix. Bug #2331 and Bug #2332 - low priority RedistrMatrix(true); if (Comm().MyPID() < MaxProcs_) { dmumps_c(&(MDS)); // Initialize MUMPS static_cast<void>( CheckError( ) ); } MDS.n = Matrix().NumGlobalRows(); // fix pointers for nonzero pattern of A. Numerical values // will be entered in PerformNumericalFactorization() if (Comm().NumProc() != 1) { MDS.nz_loc = RedistrMatrix().NumMyNonzeros(); if (Comm().MyPID() < MaxProcs_) { MDS.irn_loc = &Row[0]; MDS.jcn_loc = &Col[0]; } } else { if (Comm().MyPID() == 0) { MDS.nz = Matrix().NumMyNonzeros(); MDS.irn = &Row[0]; MDS.jcn = &Col[0]; } } // scaling if provided by the user if (RowSca_ != 0) { MDS.rowsca = RowSca_; MDS.colsca = ColSca_; } // given ordering if provided by the user if (PermIn_ != 0) { MDS.perm_in = PermIn_; } MDS.job = 1; // Request symbolic factorization SetICNTLandCNTL(); // Perform symbolic factorization ResetTimer(); if (Comm().MyPID() < MaxProcs_) dmumps_c(&(MDS)); SymFactTime_ = AddTime("Total symbolic factorization time", SymFactTime_); int IntWrong = CheckError()?1:0 ; int AnyWrong; Comm().SumAll( &IntWrong, &AnyWrong, 1 ) ; bool Wrong = AnyWrong > 0 ; if ( Wrong ) { AMESOS_CHK_ERR( StructurallySingularMatrixError ) ; } IsSymbolicFactorizationOK_ = true ; NumSymbolicFact_++; return 0; }