示例#1
0
文件: P571.cpp 项目: LasseD/uva
void add(int a, int b, int op, INFO *from, set<PI> &seen, queue<INFO*> &q) {
  if(seen.find(PI(a, b)) != seen.end())
    return; // Already seen.
  seen.insert(PI(a, b));
  INFO *g = &infos[infoI++];
  g->a = a; g->b = b; g->op = op; g->from = from; q.push(g);
}
logical DBReaction :: Connect (Dictionary *dictptr )
{
  CAU_Action             *caction;
  DBResource             *resource;
  DBStructDef            *strdef;
  DBFieldDef             *flddef;
  PI(CAU_RCT_PathComp)   *path_pi;
  int32                    count;
  int32                    indx0 = 0;
  logical                 term = NO;
BEGINSEQ
  if ( react_id == AUTO )                            LEAVESEQ

  DBObjectHandle   temp_object(dictptr);
  PI(CAU_Reaction)     react_pi(temp_object,"CAU_Reaction",PI_Read);
                                                     SDBCERR
  if ( !react_pi((char *)&react_id) || 
       !(caction = react_pi->get_db_action()(0L)) )  ERROR
       
  type   = react_pi->get_rct_type();
  delay  = react_pi->get_delay();
  active = react_pi->get_rct_path().get_active() ? AUTO : 0;

  if ( !(strdef = (DBStructDef *)dictptr->ProvideStructDef(caction->get_structure())) )
                                                     SDBERR(99)
  if ( *caction->get_property() > ' ' )
  {
    if ( !(flddef = strdef->GetEntry(caction->get_property())) )
                                                     SDBERR(99)
    if ( !(strdef = flddef->GetDBStruct(dictptr)) )  SDBERR(99)
    prop_action = YES;
    resource = flddef->get_resource();
  }
  else
示例#3
0
static void pr_rot(FILE *fp,int indent,t_rot *rot)
{
  int g;

  PI("rot_nstrout",rot->nstrout);
  PI("rot_nstsout",rot->nstsout);
  PI("rot_ngrp",rot->ngrp);
  for(g=0; g<rot->ngrp; g++)
    pr_rotgrp(fp,indent,g,&rot->grp[g]);
}
示例#4
0
bool fitsInPie(const QPointF &p, const QPointF &centre, qreal radius, qreal dirAngle, qreal spanAngle)
{
    dirAngle = fmod(dirAngle, PI() * 2);

    qreal st = dirAngle - spanAngle / 2;
    qreal fn = dirAngle + spanAngle / 2;

    st = fmod(st, PI() * 2);
    if (st < 0)
        st += 2 * PI();
    fn = fmod(fn, PI() * 2);
    if (fn < 0)
        fn += 2 * PI();
    if (st > fn)
        fn += 2 * PI();
    qreal angle = degr2rad(QLineF(centre, p).angle());

    if (angle < 0)
        angle += 2 * PI();
    if (angle < st)
        angle += 2 * PI();
#ifdef DEBUG
//    qDebug() << "Start angle " << rad2degr(st) << " Finish angle " << rad2degr(fn) << " Anlge " << rad2degr(angle) << endl;
#endif

    return (distance(p, centre) < radius && st <= angle && angle <= fn);
}
示例#5
0
static void pr_pull(FILE *fp,int indent,t_pull *pull)
{
  int g;

  PS("pull-geometry",EPULLGEOM(pull->eGeom));
  pr_ivec(fp,indent,"pull-dim",pull->dim,DIM,TRUE);
  PR("pull-r1",pull->cyl_r1);
  PR("pull-r0",pull->cyl_r0);
  PR("pull-constr-tol",pull->constr_tol);
  PI("pull-nstxout",pull->nstxout);
  PI("pull-nstfout",pull->nstfout);
  PI("pull-ngrp",pull->ngrp);
  for(g=0; g<pull->ngrp+1; g++)
    pr_pullgrp(fp,indent,g,&pull->grp[g]);
}
logical SDB_BaseStruct :: Fill (DatabaseHandle &dbhandle, char *propnames, char *proptypes, char *inverse )
{
  SDB_Structure  *dbsptr = NULL;
  logical         term   = NO;
BEGINSEQ
//SDB_Reference::Fill(dbhandle,propnames,proptypes,1);
  SDB_Relationship::Fill(dbhandle,propnames,proptypes,1,inverse,NO);

  memset(ddegent,' ',sizeof(ddegent));
  clustered       = NO;
  ddesecr         = NO;
  ddeprv          = ODC_public;

  if ( inverse )
  {
    gvtxstb(ddeinv,inverse,ID_SIZE);    
    
    TypeKey            type_key(ddetype,0);
    PI(SDB_Structure)  dbs_pi(dbhandle,"SDB_Structure",PI_Read);
                                                     SDBCERR
    if ( (dbsptr = dbs_pi(type_key.GetKey())) && 
         *dbsptr->get_smceiksm() > ' '            )
    {
      if ( SDB_Extend::ProvideStrRoot(dbhandle,ddetype) )
                                                     ERROR
      memcpy(ddeext,ddetype,ID_SIZE);     
      owning          = NO;
    }
  }
RECOVER
  term = YES;
ENDSEQ
  return(term);
}
logical SDB_Reference :: Fill (DatabaseHandle &dbhandle, char *propnames, char *proptypes, uint16 dim )
{
  logical                 term = NO;
BEGINSEQ
//  Initialize();
  SDB_Property::Fill(dbhandle,propnames,proptypes);
  if ( memcmp(proptypes,"MEMO ",5) )
    ddedim[0] = (uint32) dim;

  memcpy(ddegent,"PI",2);
  ddetrans        = NO;
  owning          = YES;
  create          = YES;
  clustered       = YES;
  mb_number       = 0;
  week_typed      = NO;
  update          = NO;
  multikey        = NO;
  ddeatyp         = AT_ODABA;
    
  if ( !*proptypes )
  {
    PI(SDB_Structure)  str_pi(dbhandle,"SDB_Structure",PI_Read);  
                                                     SDBCERR
    if ( str_pi(sys_ident) )
      memcpy(ddetype,sys_ident,sizeof(ddetype));
  }
示例#8
0
static BOOL bign_keyunwrap(byte *X, byte *d, byte *untoken){
	Point q;
	REV_PI(X, q);
	BigInteger Q = bign_curve256v1::getQ();
	byte s0[32];
	memcpy(s0, d, sizeof s0);
	for (size_t jj = 0; jj < 32; jj += 4) change_endian(s0 + jj);
	BigInteger S0(s0, 32);
	S0 <<= 128;
	S0 %= Q;
	byte h_belt[32];
	memcpy(h_belt, H, 32);
	for (size_t jj = 0; jj <32; jj += 4) change_endian(h_belt + jj);
	BigInteger temp2(h_belt, 32);
	temp2 %= Q;
	byte _qq[32];
	memcpy(_qq, d + 32, sizeof _qq);
	for (size_t jj = 0; jj < 32; jj += 4) change_endian(_qq + jj);
	BigInteger S1(_qq, 32);
	if (S1 >= Q) return false;

	BigInteger rr = (temp2 + S1) % Q;
	BigInteger zero = BigInteger(0);
	Point G(zero, bign_curve256v1::getY());
	Point R = shamir(G, rr, q, S0);
	if (R.x == zero && R.y == zero) return false;
	byte toHash[108];
	byte bR[64];
	PI(bR, R);
	belt_hash(toHash, sizeof toHash, h_belt);
	for (size_t jj = 0; jj < 32; ++jj) if (h_belt[jj] != bR[jj]) return false;
	return true;
}
示例#9
0
文件: P10842.cpp 项目: LasseD/uva
int main() {
  int parents[101], ranks[101];
  WPI edges[10001];
  int N, M, s, t, w;
  FORCAS {
    cin >> N >> M;
    FORI(N) {
      ranks[i] = 0;
      parents[i] = i;
    }
    FORI(M) {
      cin >> s >> t >> w;
      edges[i] = WPI(-w, PI(s,t));
    }
    sort(edges, edges+M);
    
    int min = 1000000;
    FORI(M) {
      w = edges[i].first;
      PI p = edges[i].second;
      if(_union(p.P1, p.P2, parents, ranks)) {
	min = MIN(min, -w);
      }
    }
    cout << "Case #" << cas+1 << ": " << min << endl;
  }
}
示例#10
0
static  BOOL bign_verify(byte *H, byte *_q, byte *S, uint32 size){
	Point q;
	REV_PI(_q, q);
	BigInteger Q = bign_curve256v1::getQ();
	byte s0[32];
	memcpy(s0, S, sizeof s0);
	for (size_t jj = 0; jj < 32; jj += 4) change_endian(s0 + jj);
	BigInteger S0(s0, 32);
	S0 <<= 128;
	S0 %= Q;
	byte _qq[32];
	memcpy(_qq, S + 32, sizeof _qq);
	for (size_t jj = 0; jj < 32; jj += 4) change_endian(_qq + jj);
	BigInteger S1(_qq, 32);
	if (S1 >= Q) return false;
	byte h_belt[32];
	memcpy(h_belt, H, 32);
	for (size_t jj = 0; jj <32; jj += 4) change_endian(h_belt + jj);
	BigInteger temp2(h_belt, 32);
	temp2 %= Q;
	BigInteger rr = (temp2 + S1) % Q;
	BigInteger zero = BigInteger(0);
	Point G(zero, bign_curve256v1::getY());
	Point R = shamir(G, rr, q, S0);
	if (R.x == zero && R.y == zero) return false;
	byte toHash[108];
	byte bR[64];
	PI(bR, R);
	memcpy(toHash, OID, sizeof OID);
	memcpy(toHash + sizeof OID, bR, sizeof bR);
	memcpy(toHash + sizeof OID + sizeof bR, H, 32);
	belt_hash(toHash, sizeof toHash, h_belt);
	for (size_t jj = 0; jj < 32; ++jj) if (h_belt[jj] != S[jj]) return false;
	return true;
}
示例#11
0
文件: cond1.C 项目: 0day-ci/gcc
int main(int argc, char *argv[])
{
    (argc+1 ? has_destructor() : throw 0);
    CI((argc+1 ? throw 0 : has_destructor()));
    CI((0 ? has_destructor() : throw 0));
    CI((1 ? throw 0 : has_destructor()));
    (0 ? throw 0 : has_destructor());
    (1 ? has_destructor() : throw 0);

    (argc+1 ? no_destructor() : throw 0);
    CI((argc+1 ? throw 0 : no_destructor()));
    CI((0 ? no_destructor() : throw 0));
    CI((1 ? throw 0 : no_destructor()));
    (0 ? throw 0 : no_destructor());
    (1 ? no_destructor() : throw 0);

    int i = 1;
    CI(throw PI(i));
    if (i != 2) abort();

    (1 ? 0 : throw PI(i));
    if (i != 2) abort();

    CI(0 ? 0 : throw PI(i));
    if (i != 3) abort();

    CI(0 ? has_destructor() : throw PI(i));
    if (i != 4) abort();
    (argc+1 ? has_destructor() : throw PI(i));
    if (i != 4) abort();

    i = 1;
    CI(throw i++);
    if (i != 2) abort();

    (1 ? 0 : throw i++);
    if (i != 2) abort();

    CI(0 ? 0 : throw i++);
    if (i != 3) abort();

    CI(0 ? has_destructor() : throw i++);
    if (i != 4) abort();
    (argc+1 ? has_destructor() : throw i++);
    if (i != 4) abort();
}
示例#12
0
inline float_32_bit  compute_volume_of_capsule(
        float_32_bit const  half_distance_between_end_points,
        float_32_bit const  thickness_from_central_line
        )
{
    return compute_volume_of_sphere(thickness_from_central_line) +
           PI() * thickness_from_central_line * thickness_from_central_line * (2.0f * half_distance_between_end_points);
}
Foam::
IH_Waves_InletVelocityFvPatchVectorField::
IH_Waves_InletVelocityFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF,
    const dictionary& dict
)
:
    fixedValueFvPatchField<vector>(p, iF, dict),
    wavePeriod_(dict.lookupOrDefault<scalar>("wavePeriod", -1)),
    wavePeriods_( dict.lookupOrDefault("wavePeriods", List<scalar> (1, -1.0)) ),
    waveHeight_(dict.lookupOrDefault<scalar>("waveHeight", -1)),
    waveHeights_( dict.lookupOrDefault("waveHeights", List<scalar> (1, -1.0)) ),
    waveLength_(dict.lookupOrDefault<scalar>("waveLength", -1)),
    waveLengths_( dict.lookupOrDefault("waveLengths", List<scalar> (1, -1.0)) ),
    waterDepth_(dict.lookupOrDefault<scalar>("waterDepth", -1 )),
    wavePhase_(dict.lookupOrDefault<scalar>("wavePhase", 3.0*PI()/2.0 )),
    wavePhases_( dict.lookupOrDefault("wavePhases", List<scalar> (1, -1.0)) ),
    timeLag_(dict.lookupOrDefault<scalar>("timeLag", 0)),
    timeLags_( dict.lookupOrDefault("timeLags", List<scalar> (1, 0.0)) ),
    lambdaStokesV_(dict.lookupOrDefault<scalar>("lambdaStokesV", -1 )),
    mCnoidal_(dict.lookupOrDefault<scalar>("mCnoidal", -1 )),
    uMean_(dict.lookupOrDefault<scalar>("uMean", -1)),
    Bjs_( dict.lookupOrDefault("Bjs", List<scalar> (1, -1.0)) ),
    Ejs_( dict.lookupOrDefault("Ejs", List<scalar> (1, -1.0)) ),
    uCurrent_(dict.lookupOrDefault("uCurrent", vector(0., 0., 0.))),
    genAbs_(dict.lookupOrDefault<bool>("genAbs", false )),
    secondOrder_(dict.lookupOrDefault<bool>("secondOrder", false )),
    nPaddles_(dict.lookupOrDefault<label>("nPaddles", 1)),
    tSmooth_(dict.lookupOrDefault<scalar>("tSmooth", -1)),
    tuningFactor_(dict.lookupOrDefault<scalar>("tuningFactor", 1)),
    nComp_(dict.lookupOrDefault<label>("nComp", 1)),
    waveDictName_(dict.lookupOrDefault<word>("waveDict", "IHWavesDict")),
    waveType_(dict.lookupOrDefault<word>("waveType", "aaa")),
    waveTheory_(dict.lookupOrDefault<word>("waveTheory", "aaa")),
    waveTheoryOrig_(dict.lookupOrDefault<word>("waveTheoryOrig", "aaa")),
    allCheck_(dict.lookupOrDefault<bool>("allCheck", false )),
    absDir_(dict.lookupOrDefault<scalar>("absDir", 400.0)),
    waveDir_(dict.lookupOrDefault<scalar>("waveDir", 0)),
    waveDirs_( dict.lookupOrDefault("waveDirs", List<scalar> (1, -1.0)) ),
    timeSeries_( dict.lookupOrDefault("timeSeries", List<scalar> (1, -1.0)) ),
    paddlePosition_( 
        dict.lookupOrDefault("paddlePosition", List<scalar> (1, -1.0)) ),
    paddleVelocity_( 
        dict.lookupOrDefault("paddleVelocity", List<scalar> (1, -1.0)) ),
    paddleEta_( dict.lookupOrDefault("paddleEta", List<scalar> (1, -1.0)) )
{
    word dictName = dict.lookupOrDefault<word>("waveDict", "empty");
    if(dictName!="empty")
    {
        Warning << 
        "Keyword waveDict defined in boundary condition.\n" << 
        "The new expected keyword is: waveDictName\n" << 
        "Using waveDictName = IHWavesDict by default.\n" << endl;
    }
}
示例#14
0
float torpedoDamage(float diameter, float length, bool torpex, float tds_beam){
	float c1 = 0.012;
	float density = 0.00165;
	
	float derMod = 1.0;
	if(torpex) derMod = 1.5;
	
	return (PI() * pow(diameter/2.0, 2.0) * length * density * c1) * 4.0 * pow(0.5, tds_beam/3.0) * dermod;
}
示例#15
0
void hardw_senc_init(int fs, int fc)
{
	// LAUNCH
	int reset = 0;															// reset counter
	*(FPGA_addr + ((FPGA_BDN) << 12) + 0xA04) = 0x00000000;					// set clear register
	for (reset = 0; reset < 8; reset++)										// iterate over registers
	{
		*(FPGA_addr + ((FPGA_BDN) << 12) + 0xA00) = 0xC0000008;				// clear enc registers
	}		
	*(FPGA_addr + ((FPGA_BDN) << 12) + 0xA00) = 0xC0000F00;					// read bit for init
	
	// PAR
	fs_s = (float)fs;
	alpha = expsp(-PI(2)*(float)fc / fs_s);

	// READ 1e
	*(FPGA_addr + ((FPGA_BDN) << 12) + 0xA00) = 0xC0000F00;
	theta_nano_temp = (*(FPGA_addr + ((FPGA_BDN) << 12) + 0x804) & 0xFFFFF);
	theta_db_temp = (double)(theta_nano_temp) / ENC_RES * PI(2);
}
batch  create_wireframe_sphere(
        float_32_bit const  radius,
        natural_8_bit const  num_lines_per_quarter_of_circle,
        vector4 const&  colour,
        FOG_TYPE const  fog_type_,
        std::string const&  id
        )
{
    TMPROF_BLOCK();

    ASSUMPTION(radius > 1e-4f);
    ASSUMPTION(num_lines_per_quarter_of_circle != 0U);

    std::vector< std::array<float_32_bit,3> >  vertices;
    vertices.reserve(2U * 3U * 4U * static_cast<natural_16_bit>(num_lines_per_quarter_of_circle));

    float_32_bit const  delta_phi = (PI() / 2.0f) / static_cast<float_32_bit>(num_lines_per_quarter_of_circle);
    vertices.push_back({ radius, 0.0f, 0.0f });
    for (natural_16_bit  i = 1U; i != num_lines_per_quarter_of_circle; ++i)
    {
        float_32_bit const  phi = static_cast<float_32_bit>(i) * delta_phi;
        vertices.push_back({ radius * std::cosf(phi), radius * std::sinf(phi), 0.0f });
        vertices.push_back(vertices.back());
    }
    vertices.push_back({ 0.0f, radius, 0.0f });

    for (std::size_t  i = 0U, n = vertices.size(); i != n; ++i)
    {
        std::array<float_32_bit,3> const&  v = vertices.at(i);
        vertices.push_back({ -v[0], v[1], 0.0f });
    }
    for (std::size_t  i = 0U, n = vertices.size(); i != n; ++i)
    {
        std::array<float_32_bit,3> const&  v =  vertices.at(i);
        vertices.push_back({ v[0], -v[1], 0.0f });
    }

    std::size_t const  num_vertices_per_ring = vertices.size();
    INVARIANT(num_vertices_per_ring == 2UL * 4UL * num_lines_per_quarter_of_circle);

    for (std::size_t  i = 0U; i != num_vertices_per_ring; ++i)
    {
        std::array<float_32_bit,3> const&  v =  vertices.at(i);
        vertices.push_back({ v[0], 0.0f, v[1] });
    }

    for (std::size_t  i = 0U; i != num_vertices_per_ring; ++i)
    {
        std::array<float_32_bit,3> const&  v =  vertices.at(i);
        vertices.push_back({ 0.0f, v[0], v[1] });
    }

    return create_lines3d(vertices, colour, fog_type_, id);
}
示例#17
0
static  void bign_dh(byte *k, uint32 kSize, byte *P, byte* to){
	byte *_k = new byte[((kSize - 1 / 4) + 1) * 4];
	memset(_k, 0x00, sizeof _k);
	memcpy(_k, k, kSize);
	for (size_t jj = 0; jj < sizeof _k; jj += 4) change_endian(_k + jj);
	BigInteger K(_k, sizeof _k);
	K %= bign_curve256v1::getQ();
	Point PP;
	REV_PI(P, PP);
	Point ret = doit(PP, K);
	PI(to, ret);
}
void RotationControl::run(){
	IMU_DATA_RAW raw;
	int cnt = 0;

	while(1){
		if(!isActive()) suspendCallerUntil(END_OF_TIME);

		imuData.get(raw);
		controlOut = PI(desSpeed, raw.ANGULAR_RAW_Z);

//
//		err = desSpeed - (raw.ANGULAR_RAW_Z);
		period = SECONDS_NOW() - lastTime;
//
//		if(!(cnt % 100)) PRINTF("dps error: %f, des: %f, current: %f\n",err,desSpeed,raw.ANGULAR_RAW_Z);
//
//		if((err > 0.1) || (err < -0.1)){
//			i += (err * period);
//		}
//
//		dt = (err - lastError) / period;
//
//		pPart = err * pGain;
//		iPart = i * iGain;
//		dPart = dt * dGain;
//
//
//		controlOut = pPart + iPart + dPart;
//
//		// control output deckeln
//		//		if(controlOut > 1000) controlOut = 1000;
//		//Saturation filter
//		if (controlOut > MAX) {
//			controlOut = MAX;
//		}
//		else if (controlOut < MIN) {
//			controlOut = MIN;
//		}
//
//		if(!(cnt % 100)) PRINTF("control output: %f, pPart %f, iPart %f, dPart %f\n",controlOut,pPart,iPart,dPart);
//		if(!(cnt%100)) PRINTF("p: %f, i: %f, d: %f\n",pGain,iGain,dGain);
//		cnt++;


		motor.setspeed(controlOut);

		lastTime = SECONDS_NOW();
//		lastError = err;
		suspendCallerUntil(NOW()+IMU_SAMPLERATE*MILLISECONDS);

	}
}
示例#19
0
static void bign_keywrap(byte* X, uint32 len, byte *Q, byte *token){
	uint32 I[4];
	memset(I, 0x00, sizeof I);
	byte rand[32];
	gen_rnd_data(rand, 32);
	BigInteger k(rand, 32);
	BigInteger q = bign_curve256v1::getQ();
	k %= q;
	byte dd[32];
	Point _Q;
	REV_PI(Q, _Q);
	Point G(BigInteger(0), bign_curve256v1::getY());
	Point R = doit(G, k);
	Point _2 = doit(_Q, k);
	byte sigma[1<<6];
	PI(sigma, _2);
	PI(token, R);
	byte *hlp = new byte[len];
	belt_keywrap(X, len, sigma, hlp);
	memcpy(token+32, hlp, len);
	delete hlp;
}
示例#20
0
static void pr_pullgrp(FILE *fp,int indent,int g,t_pullgrp *pg)
{
  pr_indent(fp,indent);
  fprintf(fp,"pull-group %d:\n",g);
  indent += 2;
  pr_ivec_block(fp,indent,"atom",pg->ind,pg->nat,TRUE);
  pr_rvec(fp,indent,"weight",pg->weight,pg->nweight,TRUE);
  PI("pbcatom",pg->pbcatom);
  pr_rvec(fp,indent,"vec",pg->vec,DIM,TRUE);
  pr_rvec(fp,indent,"init",pg->init,DIM,TRUE);
  PR("rate",pg->rate);
  PR("k",pg->k);
  PR("kB",pg->kB);
}
示例#21
0
void hardw_senc_read(int *theta_s_nano, float *theta_s, int *omega_s_nano, float *omega_s)
{
	int i = 0, diff;
	double theta_db;
	float omega_temp;

	// NANO
	*(FPGA_addr + ((FPGA_BDN) << 12) + 0xA00) = 0xC0000F00;
	*theta_s_nano = (*(FPGA_addr + ((FPGA_BDN) << 12) + 0x804) & 0xFFFFF);
	diff = *theta_s_nano - theta_nano_temp;
	if (diff >  ENC_RES/2.0) { nrofr--; i--; }
	if (diff < -ENC_RES/2.0) { nrofr++; i++; }
	theta_nano_temp = *theta_s_nano;

	// MECH
	omega_temp = *omega_s;
	theta_db = (double)(*theta_s_nano) / ENC_RES * PI(2);
	*theta_s_nano = *theta_s_nano + nrofr * ENC_RES;
	*theta_s = (float)theta_db + nrofr * PI(2) - theta_home;
	*omega_s_nano = (diff + i*ENC_RES) * fs_s;
	*omega_s = (float)((theta_db - theta_db_temp + i*PI(2)) * fs_s);
	*omega_s = *omega_s * (1.0 - alpha) + omega_temp * alpha;				// resursive iir maf
	theta_db_temp = theta_db;
}
示例#22
0
void motion_ctrl_ref(int reftype_e, float Aref, float Fref, float *x_ref)
{
	switch (reftype_e)
	{
	case 0:	*x_ref = 0.0;							break;
	case 1:	*x_ref = Aref;							break;
	case 2:	*x_ref = Aref*sin(Fref*PI(2)*t);
		t += (TS*1.0e-6);							break;
	case 3: *x_ref = Aref*freqref[ref];
		if (ref < (FREQ - 1))	{ ref++; }
		else					{ ref = 0; }		break;
	case 4:	*x_ref = Aref*timeref[ref];
		if (ref < (TIME - 1))	{ ref++; }
		else					{ ref = 0; }		break;
	case 5:											break;
	}
}
Foam::
IH_Waves_InletVelocityFvPatchVectorField::
IH_Waves_InletVelocityFvPatchVectorField
(
    const fvPatch& p,
    const DimensionedField<vector, volMesh>& iF
)
:
    fixedValueFvPatchField<vector>(p, iF),
    wavePeriod_(-1),
    wavePeriods_( List<scalar> (1, -1.0) ),
    waveHeight_(-1),
    waveHeights_( List<scalar> (1, -1.0) ),
    waveLength_(-1),
    waveLengths_( List<scalar> (1, -1.0) ),
    waterDepth_(-1),
    wavePhase_(3.0*PI()/2.0),
    wavePhases_( List<scalar> (1, -1.0) ),
    timeLag_(0),
    timeLags_( List<scalar> (1, 0.0) ),
    lambdaStokesV_(-1),
    mCnoidal_(-1),
    uMean_(-1),
    Bjs_( List<scalar> (1, -1.0) ),
    Ejs_( List<scalar> (1, -1.0) ),
    uCurrent_( vector(0., 0., 0.) ),
    genAbs_(false),
    secondOrder_(false),
    nPaddles_(1),
    tSmooth_(-1),
    tuningFactor_(1),
    nComp_(1),
    waveDictName_("IHWavesDict"),
    waveType_("aaa"),
    waveTheory_("aaa"),
    waveTheoryOrig_("aaa"),
    allCheck_(false),
    absDir_(400.0),
    waveDir_(0),
    waveDirs_( List<scalar> (1, -1.0) ),
    timeSeries_( List<scalar> (1, -1.0) ),
    paddlePosition_( List<scalar> (1, -1.0) ),
    paddleVelocity_( List<scalar> (1, -1.0) ),
    paddleEta_( List<scalar> (1, -1.0) )
{}
示例#24
0
static void pr_rotgrp(FILE *fp,int indent,int g,t_rotgrp *rotg)
{
  pr_indent(fp,indent);
  fprintf(fp,"rotation_group %d:\n",g);
  indent += 2;
  PS("type",EROTGEOM(rotg->eType));
  PS("massw",BOOL(rotg->bMassW));
  pr_ivec_block(fp,indent,"atom",rotg->ind,rotg->nat,TRUE);
  pr_rvecs(fp,indent,"x_ref",rotg->x_ref,rotg->nat);
  pr_rvec(fp,indent,"vec",rotg->vec,DIM,TRUE);
  pr_rvec(fp,indent,"pivot",rotg->pivot,DIM,TRUE);
  PR("rate",rotg->rate);
  PR("k",rotg->k);
  PR("slab_dist",rotg->slab_dist);
  PR("min_gaussian",rotg->min_gaussian);
  PR("epsilon",rotg->eps);
  PS("fit_method",EROTFIT(rotg->eFittype));
  PI("potfitangle_nstep",rotg->PotAngle_nstep);
  PR("potfitangle_step",rotg->PotAngle_step);
}
示例#25
0
static void bign_sign(byte *H, byte *d, byte* to) {
	byte rand[32];
	gen_rnd_data(rand, 32);
	BigInteger k(rand, 32);
	BigInteger P = bign_curve256v1::getP();
	k %= P;
	byte dd[32];
	memcpy(dd, d, 32);
	for (size_t jj = 0; jj < 32; jj += 4) change_endian(dd + jj);
	BigInteger D(dd, 32);
	BigInteger Q = bign_curve256v1::getQ();
	Point G(BigInteger(0), bign_curve256v1::getY());
	Point R = doit(G, k);
	byte toHash[108];
	byte bR[64];
	PI(bR, R);
	memcpy(toHash, OID, sizeof OID);
	memcpy(toHash + sizeof OID, bR, sizeof bR);
	memcpy(toHash + sizeof OID + sizeof bR, H, 32);
	byte h_belt[32];
	belt_hash(toHash, sizeof toHash, h_belt);
	memcpy(to, h_belt, sizeof h_belt);
	for (size_t jj = 0; jj <32; jj += 4) change_endian(h_belt + jj);
	BigInteger temp1(h_belt, 32);
	temp1 <<= 128;
	temp1 %= Q;
	temp1 *= D %= Q;
	memcpy(h_belt, H, 32);
	for (size_t jj = 0; jj <32; jj += 4) change_endian(h_belt + jj);
	BigInteger temp2(h_belt, 32);
	temp2 %= Q;
	BigInteger temp3 = (k + Q - temp1 + Q - temp2) % Q;
	memcpy(h_belt, temp3.data, 32);
	for (size_t jj = 0; jj < 32; jj += 4) change_endian(h_belt + jj);
	memcpy(to + 32, h_belt, 32);
}
logical SDB_Relationship :: Fill (DatabaseHandle &dbhandle, char *propnames, char *proptypes, uint16 dim, char *inverse, logical secrefr )
{
  SDB_Structure  *dbsptr = NULL;
  logical         term   = NO;
BEGINSEQ
  SDB_Reference::Fill(dbhandle,propnames,proptypes,dim);

  clustered = NO;  
  ddesecr   = secrefr;

  TypeKey            type_key(ddetype,0);
  PI(SDB_Structure)  dbs_pi(dbhandle,"SDB_Structure",PI_Read);
                                                     SDBCERR
  if ( (dbsptr = dbs_pi(type_key.GetKey())) && *dbsptr->get_smceiksm() > ' ' )
  {
    if ( SDB_Extend::ProvideStrRoot(dbhandle,ddetype) ) ERROR
    gvtxbts(ddeext,ddetype,ID_SIZE);     
    owning          = NO;
    
    ddeindx.Add(dbsptr->get_smceiksm());             SDBCERR
    ddeindx->Initialize(dbsptr->get_smceiksm(),SET_SMAL,YES,YES);
    ddeindx.Modify();
    ddeindx.Save();
  }

  if ( inverse )
  {
    gvtxstb(ddeinv,inverse,ID_SIZE);
    update          = YES;
  }

RECOVER
  term = YES;
ENDSEQ
  return(term);
}
示例#27
0
文件: P10895.cpp 项目: LasseD/uva
int main() {
  set<PI> rows[10001];
  int pos[10001];

  int width, height;
  while(cin >> height >> width) {
    FORI(width)
      rows[i].clear();
    FORI(height) {
      GI(N);
      FORJ(N) {
	cin >> pos[j];
	--pos[j];
      }
      FORJ(N) {
	GI(x);
	rows[pos[j]].insert(PI(i, x));
      }
    }
    cout << width << " " << height << endl;
    FORI(width) {
      cout << rows[i].size();
      FORIT(set<PI>, rows[i]) {
	cout << " " << it->first+1;
      }
      cout << endl;
      bool first = true;
      FORIT(set<PI>, rows[i]) {
	if(!first)
	  cout << " ";
	first = false;
	cout << it->second;
      }
      cout << endl;	
    } // FORI
  } // while(cin)
示例#28
0
int main(int argc, char **argv)
{
    // OSG init
    osgInit(argc,argv);

    {
        // Set up Window
        WindowEventProducerRecPtr TutorialWindow = createNativeWindow();
        TutorialWindow->initWindow();

        // Create the SimpleSceneManager helper
        SimpleSceneManager sceneManager;
        TutorialWindow->setDisplayCallback(boost::bind(display, &sceneManager));
        TutorialWindow->setReshapeCallback(boost::bind(reshape, _1, &sceneManager));

        // Tell the Manager what to manage
        sceneManager.setWindow(TutorialWindow);

        TutorialWindow->connectKeyTyped(boost::bind(keyPressed, _1));

        // Make Torus Node (creates Torus in background of scene)
        NodeRecPtr TorusGeometryNode = makeTorus(.5, 2, 16, 16);

        // Make Main Scene Node and add the Torus
        NodeRecPtr scene = Node::create();
        scene->setCore(Group::create());
        scene->addChild(TorusGeometryNode);

        // Create the Graphics
        GraphicsRecPtr TutorialGraphics = Graphics2D::create();

        // Initialize the LookAndFeelManager to enable default settings
        LookAndFeelManager::the()->getLookAndFeel()->init();

        /******************************************************

          Create a RotatedComponent.
          -setAngle(Angle, in radians): Determine
          the angle the Component initially
          is rotated.
          -setInternalComponent(Component): 
          Determine what Component will
          be rotated.
          -setResizePolicy(RotatedComponent::ENUM):
          Takes NO_RESIZING, RESIZE_TO_MIN, or
          RESIZE_TO_MAX arguments.

         ******************************************************/    

        RotatedComponentRecPtr TheRotatedComponent = RotatedComponent::create();
        // Define PI
        Real32 PI(3.14159);
        TheRotatedComponent->setAngle(PI/4);
        ComponentRecPtr InnerPanel = createPanel();
        TheRotatedComponent->setInternalComponent(InnerPanel);
        TheRotatedComponent->setResizePolicy(RotatedComponent::RESIZE_TO_MIN);

        /******************************************************

          Create a ToggleButton which can 
          be used to start and stop the 
          Button from rotating.

            Note: due to the way FlowLayout works
            you will notice that this ToggleButton
            will move as well.  In cases where
            a Rotating Component is used, an 
            alternate Layout may be preferred
            to prevent other Components from 
            moving as well.  This is 
            intentionally left this way to 
            illustrate why this might be the case.
            A SplitPanel with fixed divider for 
            example would prevent the ToggleButton
            from moving, while still allowing the 
            Panel to move freely.

         ******************************************************/    
        ToggleButtonRecPtr RotateControlButton = ToggleButton::create();
        RotateControlButton->setText("Start Rotating");
        RotateControlButton->setPreferredSize(Vec2f(100.0f, 29.0f));

        RotateControlButton->connectButtonSelected(boost::bind(handleButtonSelected, _1,
                                                               TutorialWindow.get(),
                                                               TheRotatedComponent.get()));
        RotateControlButton->connectButtonDeselected(boost::bind(handleButtonDeselected, _1,
                                                                 TutorialWindow.get(),
                                                                 TheRotatedComponent.get()));

        // Create The Main InternalWindow
        // Create Background to be used with the Main InternalWindow
        ColorLayerRecPtr MainInternalWindowBackground = ColorLayer::create();
        MainInternalWindowBackground->setColor(Color4f(1.0,1.0,1.0,0.5));

        LayoutRecPtr MainInternalWindowLayout = FlowLayout::create();

        InternalWindowRecPtr MainInternalWindow = InternalWindow::create();
        MainInternalWindow->pushToChildren(TheRotatedComponent);
        MainInternalWindow->pushToChildren(RotateControlButton);
        MainInternalWindow->setLayout(MainInternalWindowLayout);
        MainInternalWindow->setBackgrounds(MainInternalWindowBackground);
        MainInternalWindow->setAlignmentInDrawingSurface(Vec2f(0.5f,0.5f));
        MainInternalWindow->setScalingInDrawingSurface(Vec2f(0.8f,0.8f));
        MainInternalWindow->setDrawTitlebar(false);
        MainInternalWindow->setResizable(false);

        // Create the Drawing Surface
        UIDrawingSurfaceRecPtr TutorialDrawingSurface = UIDrawingSurface::create();
        TutorialDrawingSurface->setGraphics(TutorialGraphics);
        TutorialDrawingSurface->setEventProducer(TutorialWindow);

        TutorialDrawingSurface->openWindow(MainInternalWindow);

        // Create the UI Foreground Object
        UIForegroundRecPtr TutorialUIForeground = UIForeground::create();

        TutorialUIForeground->setDrawingSurface(TutorialDrawingSurface);


        // Tell the Manager what to manage
        sceneManager.setRoot(scene);

        // Add the UI Foreground Object to the Scene
        ViewportRecPtr TutorialViewport = sceneManager.getWindow()->getPort(0);
        TutorialViewport->addForeground(TutorialUIForeground);

        //Create the Documentation Foreground and add it to the viewport
        SimpleScreenDoc TheSimpleScreenDoc(&sceneManager, TutorialWindow);

        // Show the whole Scene
        sceneManager.showAll();

        //Open Window
        Vec2f WinSize(TutorialWindow->getDesktopSize() * 0.85f);
        Pnt2f WinPos((TutorialWindow->getDesktopSize() - WinSize) *0.5);
        TutorialWindow->openWindow(WinPos,
                                   WinSize,
                                   "30RotatedComponent");

        //Enter main Loop
        TutorialWindow->mainLoop();
    }

    osgExit();

    return 0;
}
示例#29
0
static void SetValue(ST_PACKHEAD *head, ST_PACK *pack,int ids,const char *data,int len = -1)
{
	long lv;
	double dv;
#define PC(a)	do{ \
	if(len == -1 || len < sizeof(pack->a)) len = sizeof(pack->a);\
	SetParmBit(head,ids);\
	strncpy((char *)pack->a,data,len);\
	pack->a[sizeof(pack->a)-1]=0;\
	}while(0)

#define PI(a)	do{ SetParmBit(head,ids);lv=atol(data);memcpy(&pack->a,&lv,sizeof(pack->a));}while(0)//INT
#define PD(a)	do{ SetParmBit(head,ids);dv=atof(data);memcpy(&pack->a,&dv,sizeof(pack->a));}while(0)//LONG

	switch(ids)
	{                                
	case F_SCUST_NO:                     
		PC(scust_no);                
		break;                       
	case F_SCUST_NO2:                    
		PC(scust_no2);               
		break;                       
	case F_SHOLDER_AC_NO:                
		PC(sholder_ac_no);           
		break;                       
	case F_SHOLDER_AC_NO2:               
		PC(sholder_ac_no2);          
		break;                       
	case F_SHOLDER_TYPE:                 
		PC(sholder_type);            
		break;                       
	case F_SHOLDER_TYPE2:                
		PC(sholder_type2);           
		break;                       
	case F_SNAME:                        
		PC(sname);                   
		break;                       
	case F_SNAME2:                       
		PC(sname2);                  
		break;                       
	case F_SALL_NAME:                    
		PC(sall_name);               
		break;                       
	case F_SMARKET_CODE:                 
		PC(smarket_code);            
		break;                       
	case F_SMARKET_CODE2:                
		PC(smarket_code2);           
		break;                       
	case F_SDATE0:                       
		PC(sdate0);                  
		break;                       
	case F_SDATE1:                       
		PC(sdate1);                  
		break;                       
	case F_SDATE2:                       
		PC(sdate2);                  
		break;                       
	case F_SDATE3:                       
		PC(sdate3);                  
		break;                       
	case F_STIME0:                       
		PC(stime0);                  
		break;                       
	case F_STIME1:                       
		PC(stime1);                  
		break;                       
	case F_STIME2:                       
		PC(stime2);                  
		break;                       
	case F_STIME3:                       
		PC(stime3);                  
		break;                       
	case F_LVOL0:                        
		PI(lvol0);                   
		break;                       
	case F_LVOL1:                        
		PI(lvol1);                   
		break;                       
	case F_LVOL2:                        
		PI(lvol2);                   
		break;                       
	case F_LVOL3:                        
		PI(lvol3);                   
		break;                       
	case F_LVOL4:                        
		PI(lvol4);                   
		break;                       
	case F_LVOL5:                        
		PI(lvol5);                   
		break;                       
	case F_LVOL6:                        
		PI(lvol6);                   
		break;                       
	case F_LVOL7:                        
		PI(lvol7);                   
		break;                       
	case F_LVOL8:                        
		PI(lvol8);                   
		break;                       
	case F_LVOL9:                        
		PI(lvol9);                   
		break;                       
	case F_LVOL10:                       
		PI(lvol10);                  
		break;                       
	case F_LVOL11:                       
		PI(lvol11);                  
		break;                       
	case F_LVOL12:                       
		PI(lvol12);                  
		break;                       
	case F_DAMT0:                        
		PD(damt0);                   
		break;                       
	case F_DAMT1:                        
		PD(damt1);                   
		break;                       
	case F_DAMT2:                        
		PD(damt2);                   
		break;                       
	case F_DAMT3:                        
		PD(damt3);                   
		break;                       
	case F_DAMT4:                        
		PD(damt4);                   
		break;                       
	case F_DAMT5:                        
		PD(damt5);                   
		break;                       
	case F_DAMT6:                        
		PD(damt6);                   
		break;                       
	case F_DAMT7:                        
		PD(damt7);                   
		break;                       
	case F_DAMT8:                        
		PD(damt8);                   
		break;                       
	case F_DAMT9:                        
		PD(damt9);                   
		break;                       
	case F_DAMT10:                       
		PD(damt10);                  
		break;                       
	case F_DAMT11:                       
		PD(damt11);                  
		break;                       
	case F_DAMT12:                       
		PD(damt12);                  
		break;                       
	case F_DAMT13:                       
		PD(damt13);                  
		break;                       
	case F_DAMT14:                       
		PD(damt14);                  
		break;                       
	case F_DAMT15:                       
		PD(damt15);                  
		break;                       
	case F_DAMT16:                       
		PD(damt16);                  
		break;                       
	case F_DAMT17:                       
		PD(damt17);                  
		break;                       
	case F_DAMT18:                       
		PD(damt18);                  
		break;                       
	case F_DAMT19:                       
		PD(damt19);                  
		break;                       
	case F_DAMT20:                       
		PD(damt20);                  
		break;                       
	case F_DAMT21:                       
		PD(damt21);                  
		break;                       
	case F_DAMT22:                       
		PD(damt22);                  
		break;                       
	case F_DAMT23:                       
		PD(damt23);                  
		break;                       
	case F_DAMT24:                       
		PD(damt24);                  
		break;                       
	case F_DAMT25:                       
		PD(damt25);                  
		break;                       
	case F_DAMT26:                       
		PD(damt26);                  
		break;                       
	case F_DAMT27:                       
		PD(damt27);                  
		break;                       
	case F_DAMT28:                       
		PD(damt28);                  
		break;                       
	case F_DAMT29:                       
		PD(damt29);                  
		break;                       
	case F_DAMT30:                       
		PD(damt30);                  
		break;                       
	case F_DAMT31:                       
		PD(damt31);                  
		break;                       
	case F_DAMT32:                       
		PD(damt32);                  
		break;                       
	case F_DAMT33:                       
		PD(damt33);                  
		break;                       
	case F_SSTOCK_CODE:                  
		PC(sstock_code);             
		break;                       
	case F_SSTOCK_CODE2:                 
		PC(sstock_code2);            
		break;                       
	case F_SCUST_TYPE:                   
		PC(scust_type);              
		break;                       
	case F_SCUST_TYPE2:                  
		PC(scust_type2);             
		break;                       
	case F_SSTAT_TYPE:                   
		PC(sstat_type);              
		break;                       
	case F_SSTAT_TYPE2:                  
		PC(sstat_type2);             
		break;                       
	case F_SROOM_NO:                     
		PC(sroom_no);                
		break;                       
	case F_SROOM_NO2:                    
		PC(sroom_no2);               
		break;                       
	case F_SOPEN_EMP:                    
		PC(sopen_emp);               
		break;                       
	case F_SCLOSE_EMP:                   
		PC(sclose_emp);              
		break;                       
	case F_SCHANGE_EMP:                  
		PC(schange_emp);             
		break;                       
	case F_SCHECK_EMP:                   
		PC(scheck_emp);              
		break;                       
	case F_SEMP:                         
		PC(semp);                    
		break;                       
	case F_SNATION_CODE:                 
		PC(snation_code);            
		break;                       
	case F_LCERT_CODE:                   
		PI(lcert_code);              
		break;                       
	case F_STX_PWD:                      
		PC(stx_pwd);                 
		break;                       
	case F_STX_PWD2:                     
		PC(stx_pwd2);                
		break;                       
	case F_SWITHDRAW_PWD:                
		PC(swithdraw_pwd);           
		break;                       
	case F_SWITHDRAW_PWD2:               
		PC(swithdraw_pwd2);          
		break;                       
	case F_SEMP_PWD:                     
		PC(semp_pwd);                
		break;                       
	case F_SEMP_PWD2:                    
		PC(semp_pwd2);               
		break;                       
	case F_SBANK_PWD:                    
		PC(sbank_pwd);               
		break;                       
	case F_SBANK_PWD2:                   
		PC(sbank_pwd2);              
		break;                       
	case F_SCUST_AUTH:                   
		PC(scust_auth);              
		break;                       
	case F_SCUST_AUTH2:                  
		PC(scust_auth2);             
		break;                       
	case F_SCUST_LIMIT:                  
		PC(scust_limit);             
		break;                       
	case F_SCUST_LIMIT2:                 
		PC(scust_limit2);            
		break;                       
	case F_LSAFE_LEVEL:                  
		PI(lsafe_level);             
		break;                       
	case F_LSAFE_LEVEL2:                 
		PI(lsafe_level2);            
		break;                       
	case F_SPOST_CODE:                   
		PC(spost_code);              
		break;                       
	case F_SPOST_CODE2:                  
		PC(spost_code2);             
		break;                       
	case F_SPHONE:                       
		PC(sphone);                  
		break;                       
	case F_SPHONE2:                      
		PC(sphone2);                 
		break;                       
	case F_SPHONE3:                      
		PC(sphone3);                 
		break;                       
	case F_SPAGER:                       
		PC(spager);                  
		break;                       
	case F_SEMAIL:                       
		PC(semail);                  
		break;                       
	case F_SEMAIL2:                      
		PC(semail2);                 
		break;                       
	case F_SNOTE:                        
		PC(snote);                   
		break;                       
	case F_SNOTE2:                       
		PC(snote2);                  
		break;                       
	case F_SCERT_NO:                     
		PC(scert_no);                
		break;                       
	case F_SCERT_NO2:                    
		PC(scert_no2);               
		break;                       
	case F_SCERT_ADDR:                   
		PC(scert_addr);              
		break;                       
	case F_SSTATUS0:                     
		PC(sstatus0);                
		break;                       
	case F_SSTATUS1:                     
		PC(sstatus1);                
		break;                       
	case F_SSTATUS2:                     
		PC(sstatus2);                
		break;                       
	case F_SSTATUS3:                     
		PC(sstatus3);                
		break;                       
	case F_SSTATUS4:                     
		PC(sstatus4);                
		break;                       
	case F_LWITHDRAW_FLAG:               
		PI(lwithdraw_flag);          
		break;                       
	case F_SADDR:                        
		PC(saddr);                   
		break;                       
	case F_SADDR2:                       
		PC(saddr2);                  
		break;                       
	case F_SSERIAL0:                     
		PC(sserial0);                
		break;                       
	case F_SSERIAL1:                     
		PC(sserial1);                
		break;                       
	case F_SSERIAL2:                     
		PC(sserial2);                
		break;                       
	case F_SSERIAL3:                     
		PC(sserial3);                
		break;                       
	case F_SSERIAL4:                     
		PC(sserial4);                
		break;                       
	case F_SCURRENCY_TYPE:               
		PC(scurrency_type);          
		break;                       
	case F_SCURRENCY_TYPE2:              
		PC(scurrency_type2);         
		break;                       
	case F_SBRANCH_CODE0:                
		PC(sbranch_code0);           
		break;                       
	case F_SBRANCH_CODE1:                
		PC(sbranch_code1);           
		break;                       
	case F_SBRANCH_CODE2:                
		PC(sbranch_code2);           
		break;                       
	case F_USSET0:                       
		PC(usset0);                  
		break;                       
	case F_USSET1:                       
		PC(usset1);                  
		break;                       
	case F_USSET2:                       
		PC(usset2);                  
		break;                       
	case F_USSET3:                       
		PC(usset3);                  
		break;                       
	case F_USSET4:                       
		PC(usset4);                  
		break;                       
	case F_USSET5:                       
		PC(usset5);                  
		break;                       
	case F_USSET6:                       
		PC(usset6);                  
		break;                       
	case F_SSTATION0:                    
		PC(sstation0);               
		break;                       
	case F_SSTATION1:                    
		PC(sstation1);               
		break;                       
	case F_SBANK_ACC:                    
		PC(sbank_acc);               
		break;                       
	case F_SBANK_ACC2:                   
		PC(sbank_acc2);              
		break;                       
	case F_LBANK_ACC_TYPE:               
		PI(lbank_acc_type);          
		break;                       
	case F_LBANK_ACC_TYPE2:              
		PI(lbank_acc_type2);         
		break;                       
	case F_SMAIN_FLAG:                   
		PC(smain_flag);              
		break;                       
	case F_SMAIN_FLAG2:                  
		PC(smain_flag2);             
		break;                       
	case F_SBANK_CODE:                   
		PC(sbank_code);              
		break;                       
	case F_SBANK_CODE2:                  
		PC(sbank_code2);             
		break;                       
	case F_SEMP_NO:                      
		PC(semp_no);                 
		break;                       
	case F_SEMP_NO2:                     
		PC(semp_no2);                
		break;                       
	case F_DRATE0:                       
		PD(drate0);                  
		break;                       
	case F_DRATE1:                       
		PD(drate1);                  
		break;                       
	case F_LSERIAL0:                     
		PI(lserial0);                
		break;                       
	case F_LSERIAL1:                     
		PI(lserial1);                
		break;                       
	case F_SBANKNAME:                    
		PC(sbankname);               
		break;                       
	case F_SBANKNAME2:                   
		PC(sbankname2);              
		break;                       
	case F_SCARD0:                       
		PC(scard0);                  
		break;                       
	case F_SCARD1:                       
		PC(scard1);                  
		break;                       
	case F_SORDER0:                      
		PC(sorder0);                 
		break;                       
	case F_SORDER1:                      
		PC(sorder1);                 
		break;                       
	case F_SORDER2:                      
		PC(sorder2);                 
		break;                       
	case F_VSMESS:                       
		PC(vsmess);                  
		break;       
	case F_SCUSTTYPES:
		PC(scusttypes);
		break;
	case F_SSECTYPES:
		PC(ssectypes);
		break;
	case F_VSVARSTR0:                    
		PC(vsvarstr0);               
		break;                       
	case F_VSVARSTR1:                    
		PC(vsvarstr1);               
		break;                       
	case F_VSVARSTR2:                    
		PC(vsvarstr2);               
		break;                       
	case F_VSVARSTR3:                    
		PC(vsvarstr3);               
		break;                       
	default:
		printf("not existed parameter=%d....\n",ids);

	}                                
}  
示例#30
0
void pr_inputrec(FILE *fp,int indent,const char *title,t_inputrec *ir,
                 gmx_bool bMDPformat)
{
  const char *infbuf="inf";
  int  i;
  
  if (available(fp,ir,indent,title)) {
    if (!bMDPformat)
      indent=pr_title(fp,indent,title);
    PS("integrator",EI(ir->eI));
    PSTEP("nsteps",ir->nsteps);
    PSTEP("init-step",ir->init_step);
    PS("ns-type",ENS(ir->ns_type));
    PI("nstlist",ir->nstlist);
    PI("ndelta",ir->ndelta);
    PI("nstcomm",ir->nstcomm);
    PS("comm-mode",ECOM(ir->comm_mode));
    PI("nstlog",ir->nstlog);
    PI("nstxout",ir->nstxout);
    PI("nstvout",ir->nstvout);
    PI("nstfout",ir->nstfout);
    PI("nstcalcenergy",ir->nstcalcenergy);
    PI("nstenergy",ir->nstenergy);
    PI("nstxtcout",ir->nstxtcout);
    PR("init-t",ir->init_t);
    PR("delta-t",ir->delta_t);
    
    PR("xtcprec",ir->xtcprec);
    PI("nkx",ir->nkx);
    PI("nky",ir->nky);
    PI("nkz",ir->nkz);
    PI("pme-order",ir->pme_order);
    PR("ewald-rtol",ir->ewald_rtol);
    PR("ewald-geometry",ir->ewald_geometry);
    PR("epsilon-surface",ir->epsilon_surface);
    PS("optimize-fft",BOOL(ir->bOptFFT));
    PS("ePBC",EPBC(ir->ePBC));
    PS("bPeriodicMols",BOOL(ir->bPeriodicMols));
    PS("bContinuation",BOOL(ir->bContinuation));
    PS("bShakeSOR",BOOL(ir->bShakeSOR));
    PS("etc",ETCOUPLTYPE(ir->etc));
    PI("nsttcouple",ir->nsttcouple);
    PS("epc",EPCOUPLTYPE(ir->epc));
    PS("epctype",EPCOUPLTYPETYPE(ir->epct));
    PI("nstpcouple",ir->nstpcouple);
    PR("tau-p",ir->tau_p);
    pr_matrix(fp,indent,"ref-p",ir->ref_p,bMDPformat);
    pr_matrix(fp,indent,"compress",ir->compress,bMDPformat);
    PS("refcoord-scaling",EREFSCALINGTYPE(ir->refcoord_scaling));
    if (bMDPformat)
      fprintf(fp,"posres-com  = %g %g %g\n",ir->posres_com[XX],
	      ir->posres_com[YY],ir->posres_com[ZZ]);
    else
      pr_rvec(fp,indent,"posres-com",ir->posres_com,DIM,TRUE);
    if (bMDPformat)
      fprintf(fp,"posres-comB = %g %g %g\n",ir->posres_comB[XX],
	      ir->posres_comB[YY],ir->posres_comB[ZZ]);
    else
      pr_rvec(fp,indent,"posres-comB",ir->posres_comB,DIM,TRUE);
    PI("andersen-seed",ir->andersen_seed);
    PR("rlist",ir->rlist);
    PR("rlistlong",ir->rlistlong);
    PR("rtpi",ir->rtpi);
    PS("coulombtype",EELTYPE(ir->coulombtype));
    PR("rcoulomb-switch",ir->rcoulomb_switch);
    PR("rcoulomb",ir->rcoulomb);
    PS("vdwtype",EVDWTYPE(ir->vdwtype));
    PR("rvdw-switch",ir->rvdw_switch);
    PR("rvdw",ir->rvdw);
    if (ir->epsilon_r != 0)
      PR("epsilon-r",ir->epsilon_r);
    else
      PS("epsilon-r",infbuf);
    if (ir->epsilon_rf != 0)
      PR("epsilon-rf",ir->epsilon_rf);
    else
      PS("epsilon-rf",infbuf);
    PR("tabext",ir->tabext);
    PS("implicit-solvent",EIMPLICITSOL(ir->implicit_solvent));
    PS("gb-algorithm",EGBALGORITHM(ir->gb_algorithm));
    PR("gb-epsilon-solvent",ir->gb_epsilon_solvent);
    PI("nstgbradii",ir->nstgbradii);
    PR("rgbradii",ir->rgbradii);
    PR("gb-saltconc",ir->gb_saltconc);
    PR("gb-obc-alpha",ir->gb_obc_alpha);
    PR("gb-obc-beta",ir->gb_obc_beta);
    PR("gb-obc-gamma",ir->gb_obc_gamma);
    PR("gb-dielectric-offset",ir->gb_dielectric_offset);
    PS("sa-algorithm",ESAALGORITHM(ir->gb_algorithm));
    PR("sa-surface-tension",ir->sa_surface_tension);
	  
    PS("DispCorr",EDISPCORR(ir->eDispCorr));
    PS("free-energy",EFEPTYPE(ir->efep));
    PR("init-lambda",ir->init_lambda);
    PR("delta-lambda",ir->delta_lambda);
    if (!bMDPformat)
    {
        PI("n-foreign-lambda",ir->n_flambda);
    }
    if (ir->n_flambda > 0)
    {
        pr_indent(fp,indent);
        fprintf(fp,"foreign-lambda%s",bMDPformat ? " = " : ":");
        for(i=0; i<ir->n_flambda; i++)
        {
            fprintf(fp,"  %10g",ir->flambda[i]);
        }
        fprintf(fp,"\n");
    }
    PR("sc-alpha",ir->sc_alpha);
    PI("sc-power",ir->sc_power);
    PR("sc-sigma",ir->sc_sigma);
    PR("sc-sigma-min",ir->sc_sigma_min);
    PI("nstdhdl", ir->nstdhdl);
    PS("separate-dhdl-file", SEPDHDLFILETYPE(ir->separate_dhdl_file));
    PS("dhdl-derivatives", DHDLDERIVATIVESTYPE(ir->dhdl_derivatives));
    PI("dh-hist-size", ir->dh_hist_size);
    PD("dh-hist-spacing", ir->dh_hist_spacing);

    PI("nwall",ir->nwall);
    PS("wall-type",EWALLTYPE(ir->wall_type));
    PI("wall-atomtype[0]",ir->wall_atomtype[0]);
    PI("wall-atomtype[1]",ir->wall_atomtype[1]);
    PR("wall-density[0]",ir->wall_density[0]);
    PR("wall-density[1]",ir->wall_density[1]);
    PR("wall-ewald-zfac",ir->wall_ewald_zfac);

    PS("pull",EPULLTYPE(ir->ePull));
    if (ir->ePull != epullNO)
      pr_pull(fp,indent,ir->pull);
    
    PS("rotation",BOOL(ir->bRot));
    if (ir->bRot)
      pr_rot(fp,indent,ir->rot);

    PS("disre",EDISRETYPE(ir->eDisre));
    PS("disre-weighting",EDISREWEIGHTING(ir->eDisreWeighting));
    PS("disre-mixed",BOOL(ir->bDisreMixed));
    PR("dr-fc",ir->dr_fc);
    PR("dr-tau",ir->dr_tau);
    PR("nstdisreout",ir->nstdisreout);
    PR("orires-fc",ir->orires_fc);
    PR("orires-tau",ir->orires_tau);
    PR("nstorireout",ir->nstorireout);

    PR("dihre-fc",ir->dihre_fc);
    
    PR("em-stepsize",ir->em_stepsize);
    PR("em-tol",ir->em_tol);
    PI("niter",ir->niter);
    PR("fc-stepsize",ir->fc_stepsize);
    PI("nstcgsteep",ir->nstcgsteep);
    PI("nbfgscorr",ir->nbfgscorr);

    PS("ConstAlg",ECONSTRTYPE(ir->eConstrAlg));
    PR("shake-tol",ir->shake_tol);
    PI("lincs-order",ir->nProjOrder);
    PR("lincs-warnangle",ir->LincsWarnAngle);
    PI("lincs-iter",ir->nLincsIter);
    PR("bd-fric",ir->bd_fric);
    PI("ld-seed",ir->ld_seed);
    PR("cos-accel",ir->cos_accel);
    pr_matrix(fp,indent,"deform",ir->deform,bMDPformat);

    PS("adress",BOOL(ir->bAdress));
    if (ir->bAdress){
        PS("adress_type",EADRESSTYPE(ir->adress->type));
        PR("adress_const_wf",ir->adress->const_wf);
        PR("adress_ex_width",ir->adress->ex_width);
        PR("adress_hy_width",ir->adress->hy_width);
        PS("adress_interface_correction",EADRESSICTYPE(ir->adress->icor));
        PS("adress_site",EADRESSSITETYPE(ir->adress->site));
        PR("adress_ex_force_cap",ir->adress->ex_forcecap);
        PS("adress_do_hybridpairs", BOOL(ir->adress->do_hybridpairs));

        pr_rvec(fp,indent,"adress_reference_coords",ir->adress->refs,DIM,TRUE);
    }
    PI("userint1",ir->userint1);
    PI("userint2",ir->userint2);
    PI("userint3",ir->userint3);
    PI("userint4",ir->userint4);
    PR("userreal1",ir->userreal1);
    PR("userreal2",ir->userreal2);
    PR("userreal3",ir->userreal3);
    PR("userreal4",ir->userreal4);
    pr_grp_opts(fp,indent,"grpopts",&(ir->opts),bMDPformat);
    pr_cosine(fp,indent,"efield-x",&(ir->ex[XX]),bMDPformat);
    pr_cosine(fp,indent,"efield-xt",&(ir->et[XX]),bMDPformat);
    pr_cosine(fp,indent,"efield-y",&(ir->ex[YY]),bMDPformat);
    pr_cosine(fp,indent,"efield-yt",&(ir->et[YY]),bMDPformat);
    pr_cosine(fp,indent,"efield-z",&(ir->ex[ZZ]),bMDPformat);
    pr_cosine(fp,indent,"efield-zt",&(ir->et[ZZ]),bMDPformat);
    PS("bQMMM",BOOL(ir->bQMMM));
    PI("QMconstraints",ir->QMconstraints);
    PI("QMMMscheme",ir->QMMMscheme);
    PR("scalefactor",ir->scalefactor);
    pr_qm_opts(fp,indent,"qm-opts",&(ir->opts));
  }
}