static void write_peaks(struct image *image, FILE *ofh) { int i; fprintf(ofh, PEAK_LIST_START_MARKER"\n"); fprintf(ofh, " fs/px ss/px (1/d)/nm^-1 Intensity\n"); for ( i=0; i<image_feature_count(image->features); i++ ) { struct imagefeature *f; struct rvec r; double q; f = image_get_feature(image->features, i); if ( f == NULL ) continue; r = get_q(image, f->fs, f->ss, NULL, 1.0/image->lambda); q = modulus(r.u, r.v, r.w); fprintf(ofh, "%7.2f %7.2f %10.2f %10.2f\n", f->fs, f->ss, q/1.0e9, f->intensity); } fprintf(ofh, PEAK_LIST_END_MARKER"\n"); }
BeamEmitter::BeamEmitter(MaxwellianFlux *max, Scalar current, oopicList <LineSegment> *segments, Scalar np2c, Scalar _thetaDot) : Emitter(segments, max->get_speciesPtr(), np2c) { maxwellian = max; // emissionRate = fabs(current/get_q()*max->get_speciesPtr()->get_supercycleIndex()/max->get_speciesPtr()->get_subcycleIndex()); emissionRate = fabs(current/get_q()); extra = 0.5; if(alongx2()) normal = Boundary::normal*Vector3(1,0,0); else normal = Boundary::normal*Vector3(0,1,0); thetaDot = Vector3(0, 0, _thetaDot); init = TRUE; Farray_compute = FALSE; BoundaryType = BEAMEMITTER; deltaVertical = Vector2(MAX(j1,j2)*1e-6 + 1e-20, 0)*Boundary::get_normal(); deltaHorizontal = Vector2(0, MAX(k1,k2)*1e-6 + 1e-20)*Boundary::get_normal(); if (alongx2()) delta = deltaVertical; else delta = deltaHorizontal; nIntervals = 0; t = 0; xArray = NULL; FArray = NULL; }
void TranslationalJoint::_updateTransform() { // T mT = mT_ParentBodyToJoint * Eigen::Translation3d(get_q()) * mT_ChildBodyToJoint.inverse(); }
void FreeJoint::updateTransform() { // TODO(JS): This is workaround for Issue #122. mT_Joint = math::expMap(get_q()); mT = mT_ParentBodyToJoint * mT_Joint * mT_ChildBodyToJoint.inverse(); assert(math::verifyTransform(mT)); }
void orthoit(double* a, int lda, int n, double* x, int k, double eps){ double *q_hat, *y, *lambda, *test; double norm; q_hat = (double*) malloc(n*k*sizeof(double)); y = (double*) malloc(n*k*sizeof(double)); lambda = (double*) malloc(k*k*sizeof(double)); test = (double*) malloc(n*k*sizeof(double)); /* Matrix der Abbruchbedingung */ /* QR=X und Q extrahieren */ qr_decomp(x, n, k, n); get_q(x, n, n, k, q_hat, k); /* Y=AQ rechnen */ m_mult(a, n, n, 0, q_hat, n, k, 0, y); /* Lambda=Q*Y rechnen */ m_mult(q_hat, n, k, 1, y, n, k, 0, lambda); while (1) { // Abbruchbedingung berechnen und checken m_mult(q_hat, n, k, 0, lambda, k, k, 0, test); m_sub(test, test, y, n, n, k); norm = norm_frob(test, n, n, k); if (norm < eps) break; // QR=Y und Q extrahieren qr_decomp(y, n, k, n); get_q(y, n, n, k, q_hat, k); m_mult(a, n, n, 0, q_hat, n, k, 0, y); m_mult(q_hat, n, k, 1, y, n, k, 0, lambda); } memcpy(x, q_hat, n*k*sizeof(double)); free(q_hat); free(y); free(lambda); free(test); }
/* アイテムの量を求める (p の中の q の量)*/ float get_q(int p, int q) { int i; /* ループカウンタ */ float r = 0.0; /* 返す量 */ if (p == q) /* 計算したいアイテムかどうか? */ r = 1.0; else if (buhin[p].n_spart != 0 ) /* さらに子アイテムがあるか? */ for (i = 0; i < buhin[p].n_spart; i++) r += get_q(buhin[p].spart[i], q) * buhin[p].q_spart[i]; /* 子アイテムがあれば再帰呼び出し */ return r; /* 求めた量を返す */ }
float get_q(int p, int q) { int i; float r = 0.0; if (p == q) r = 1.0; else if (buhin[p].n_spart != 0) for (i = 0; i < buhin[p].n_spart; i++) r += get_q(buhin[p].spart[i], q) * buhin[p].q_spart[i]; return r; }
static int write_peaks(struct image *image, FILE *ofh) { int i; fprintf(ofh, PEAK_LIST_START_MARKER"\n"); fprintf(ofh, " fs/px ss/px (1/d)/nm^-1 Intensity\n"); for ( i=0; i<image_feature_count(image->features); i++ ) { struct imagefeature *f; struct rvec r; double q; f = image_get_feature(image->features, i); if ( f == NULL ) continue; r = get_q(image, f->fs, f->ss, NULL, 1.0/image->lambda); q = modulus(r.u, r.v, r.w); if ( image->det != NULL ) { struct panel *p; double write_fs, write_ss; p = find_orig_panel(image->det, f->fs, f->ss); if ( p == NULL ) { ERROR("Panel not found\n"); return 1; } /* Convert coordinates to match arrangement of panels in * HDF5 file */ write_fs = f->fs - p->min_fs + p->orig_min_fs; write_ss = f->ss - p->min_ss + p->orig_min_ss; fprintf(ofh, "%7.2f %7.2f %10.2f %10.2f\n", write_fs, write_ss, q/1.0e9, f->intensity); } else { fprintf(ofh, "%7.2f %7.2f %10.2f %10.2f\n", f->fs, f->ss, q/1.0e9, f->intensity); } } fprintf(ofh, PEAK_LIST_END_MARKER"\n"); return 0; }
int main() { float t_quant; /* 求める所蔵量 */ int p0; /* 計算の基準のアイテム番号 */ int q0; /* 調べたいアイテム番号 */ init_buhin(); /* データを初期化 */ p0 = 0; /* 計算の基準のアイテム番号 */ q0 = 11; /* 調べたいアイテム番号 */ t_quant = get_q(p0, q0); /* 必要量を求める */ printf("Total quantity of %s is %f in %s.\n", buhin[q0].part_name, t_quant, buhin[p0].part_name); /* 結果表示 */ return 0; }
int main() { float t_quant; int p0; int q0; init_buhin(); p0 = 0; q0 = 11; t_quant = get_q(p0, q0); printf("Total quantity of %s is %f in %s. \n", buhin[q0].part_name, t_quant, buhin[p0].part_name); return 0; }
int main(int argc, char *argv[]) { int c; program_name = argv[0]; /* Parse command line options */ while ((c = getopt(argc, argv, "m:h?")) != EOF) { switch (c) { case 'm': msgqid = atoi(optarg); break; case 'h': case '?': usage(); return 1; } } if(msgqid == -1) { if(argc - optind != 1){ usage(); return 1; } } // test outfile = fopen("/tmp/spu", "w"); if(msgqid != -1) { wait_for_msg(CMD_FILE_OPEN); wait_for_msg(CMD_DECODE_STREAM_BUFFER); } else { fprintf(stderr, "what?\n"); } while(1) { get_q(); } return 0; }
int main() { float t_quant; int p0; int q0; int i; init_buhin(); p0 = 0; for (i = 0; i < 14; i++){ if (buhin[i].n_spart == 0){ t_quant = get_q(p0, i); printf("Total quantity of %s is %f in %s. \n", buhin[i].part_name, t_quant, buhin[p0].part_name); } } return 0; }
void TranslationalJoint::updateTransform() { mT = mT_ParentBodyToJoint * Eigen::Translation3d(get_q()) * mT_ChildBodyToJoint.inverse(); assert(math::verifyTransform(mT)); }
void DogStateCart3::ReportAfterStep() const { // map onto deprecated global method ::ConSoln(get_aux(),get_q(),get_time()); }
void AppStateCart2::ReportAfterStep()const { const dTensorBC4& aux = get_aux(); const dTensorBC4& q = get_q(); const double t = get_time(); assert(dogParams.get_mcapa()<1); // without capacity function void WriteConservation(const dTensorBC4& q, double t); WriteConservation(q, t); double OutputMagneticFluxes( int n_B1, int n_B2, const dTensorBC4& q, double t); const double bottom_to_rght_flux = OutputMagneticFluxes(_B1, _B2, q, t); void Output_center_E3(const dTensorBC4& q, double t, int _E3); Output_center_E3(q, t, _E3); void Output_center_gas_states( const dTensorBC4& q, double t, const char* outputfile, int species_offset, bool fiveMoment); const char* get_outputdir(); string outputfile_i = string(get_outputdir())+"/xpoint_gas_i.dat"; string outputfile_e = string(get_outputdir())+"/xpoint_gas_e.dat"; Output_center_gas_states(q, t, outputfile_i.c_str(), _rho_i-1,false); Output_center_gas_states(q, t, outputfile_e.c_str(), _rho_e-1,true); void Output_center_cell_state(const dTensorBC4& q, double t); Output_center_cell_state(q, t); // output the rate of production of entropy at the center // const int maux = aux.getsize(3); if(maux>0) { assert_eq(maux,2); void output_component_at_center( const dTensorBC4& q, double t, const char* outputfile, int idx); outputfile_i = string(get_outputdir())+"/xpoint_ent_prod_i.dat"; outputfile_e = string(get_outputdir())+"/xpoint_ent_prod_e.dat"; output_component_at_center(aux, t, outputfile_i.c_str(),1); output_component_at_center(aux, t, outputfile_e.c_str(),2); } void output_local_divergence_error( int method_order, double dx, double dy, int n_B1, int n_B2, const dTensorBC4& q, double t); const double dx = dogParamsCart2.get_dx(); const double dy = dogParamsCart2.get_dy(); output_local_divergence_error( dogParams.get_space_order(), dx, dy, _B1, _B2, q, t); static bool unit_flux_triggered = bottom_to_rght_flux >=1; if(!unit_flux_triggered && bottom_to_rght_flux >= 1.) { unit_flux_triggered = true; dprintf("writing restart file q8000.dat at time %f;" "\n\tbottom_to_rght_flux = %f", t, bottom_to_rght_flux); get_solver().write_restart(8000); } }
Eigen::VectorXd Skeleton::getPose() const { return get_q(); }