当前位置: 首页>>代码示例>>C++>>正文


C++ ARG_IS_D函数代码示例

本文整理汇总了C++中ARG_IS_D函数的典型用法代码示例。如果您正苦于以下问题:C++ ARG_IS_D函数的具体用法?C++ ARG_IS_D怎么用?C++ ARG_IS_D使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ARG_IS_D函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tclcommand_inter_parse_harmonic_dumbbell

int tclcommand_inter_parse_harmonic_dumbbell(Tcl_Interp *interp, int bond_type, int argc, char **argv)
{
  double k1, k2, r, r_cut;

  if (argc < 4) {
    Tcl_AppendResult(interp, "harmonic dumbbell needs at least 3 parameters: "
		     "<k1> <k2> <r> [<r_cut>]", (char *) NULL);
    return TCL_ERROR;
  }

  if ((! ARG_IS_D(1, k1)) || (! ARG_IS_D(2, k2)) || (! ARG_IS_D(3, r))) {
    Tcl_AppendResult(interp, "harmonic dumbbell needs at least 3 DOUBLE parameters: "
		     "<k1> <k2> <r> [<r_cut>]", (char *) NULL);
    return TCL_ERROR;
  }

  if (argc < 5) {
    r_cut = -1.0;
  } else if (! ARG_IS_D(4, r_cut))  {
    Tcl_AppendResult(interp, "<r_cut> should be DOUBLE", (char *) NULL);
    return TCL_ERROR;
  }

  CHECK_VALUE(harmonic_dumbbell_set_params(bond_type, k1, k2, r, r_cut), "bond type must be nonnegative");
}
开发者ID:Clemson-MSE,项目名称:espresso,代码行数:25,代码来源:harmonic_dumbbell_tcl.cpp

示例2: tclcommand_inter_parse_cos2

int tclcommand_inter_parse_cos2(Tcl_Interp * interp,
		       int part_type_a, int part_type_b,
		       int argc, char ** argv)
{
  /* parameters needed for cos2 */
  double eps, offset, w;
  int change;

  /* get cos2 interaction type */
  if (argc < 4) {
    Tcl_AppendResult(interp, "cos2 needs 3 parameters: "
		     "<cos2_eps> <cos2_offset> <cos2_w>",
		     (char *) NULL);
    return 0;
  }

  /* copy cos2 parameters */
  if ((! ARG_IS_D(1, eps))    ||
      (! ARG_IS_D(2, offset)) ||
      (! ARG_IS_D(3, w))) {
    Tcl_AppendResult(interp, "cos2 needs 3 DOUBLE parameters: "
		     "<cos2_eps> <cos2_offset> <cos2_w>",
		     (char *) NULL);
    return 0;
  }
  change = 4;

  if (cos2_set_params(part_type_a, part_type_b,
			       eps, offset, w
			       ) == ES_ERROR) {
    Tcl_AppendResult(interp, "particle types must be non-negative", (char *) NULL);
    return 0;
  }
  return change;
}
开发者ID:Haider-BA,项目名称:espresso,代码行数:35,代码来源:cos2_tcl.cpp

示例3: tclcommand_inter_parse_hat

int tclcommand_inter_parse_hat(Tcl_Interp * interp,
				int part_type_a, int part_type_b,
				int argc, char ** argv)
{
  /* parameters needed for hat */
  double Fmax, r;
  int change;

  /* get hat interaction type */
  if (argc < 3) {
    Tcl_AppendResult(interp, "hat potential needs 2 parameters: "
		     "<hat_Fmax> <hat_r>",
		     (char *) NULL);
    return 0;
  }

  /* copy soft-sphere parameters */
  if ((! ARG_IS_D(1, Fmax))     ||
      (! ARG_IS_D(2, r))  ) {
    Tcl_AppendResult(interp, "hat potential needs 2 parameters: "
		     "<hat_Fmax> <hat_r>",
		     (char *) NULL);
    return 0;
  }
  change = 3;
	
  
  Tcl_ResetResult(interp);
  if (hat_set_params(part_type_a, part_type_b, Fmax, r) == ES_ERROR) {
    Tcl_AppendResult(interp, "particle types must be non-negative", (char *) NULL);
    return 0;
  }
  return change;
}
开发者ID:Ammar-85,项目名称:espresso,代码行数:34,代码来源:hat_tcl.cpp

示例4: tclcommand_inter_parse_gaussian

int tclcommand_inter_parse_gaussian(Tcl_Interp * interp,
                                    int part_type_a, int part_type_b,
                                    int argc, char ** argv)
{
    /* parameters needed for Gaussian */
    double eps, sig, cut;

    /* copy parameters */
    if ((argc < 4) ||
            (! ARG_IS_D(1, eps)) ||
            (! ARG_IS_D(2, sig)) ||
            (! ARG_IS_D(3, cut))) {
        Tcl_AppendResult(interp, "Gaussian potential needs 3 parameters: "
                         "<epsilon> <sigma> <cut>", (char *) NULL);
        return 0;
    }

    Tcl_ResetResult(interp);
    if (gaussian_set_params(part_type_a, part_type_b,
                            eps, sig, cut) == ES_ERROR) {
        Tcl_AppendResult(interp, "particle types must be non-negative", (char *) NULL);
        return 0;
    }
    /* return number of used parameters */
    return 4;
}
开发者ID:kessel,项目名称:espresso,代码行数:26,代码来源:gaussian_tcl.cpp

示例5: tclcommand_thermostat_parse_npt_isotropic

int tclcommand_thermostat_parse_npt_isotropic(Tcl_Interp *interp, int argc, char **argv) 
{
  double temp, gamma0, gammav;
  /* check number of arguments */
  if (argc < 5) {
    Tcl_AppendResult(interp, "wrong # args:  should be \n\"",
		     argv[0]," set ",argv[1]," <temp> <gamma0> <gammav>\"", (char *)NULL);
    return (TCL_ERROR);
  }
  /* check argument types */
  if ( !ARG_IS_D(2, temp) || !ARG_IS_D(3, gamma0) || !ARG_IS_D(4, gammav) ) {
    Tcl_AppendResult(interp, argv[0]," ",argv[1]," needs four DOUBLES", (char *)NULL);
    return (TCL_ERROR);
  }
  /* broadcast parameters */
  temperature = temp;
  nptiso_gamma0 = gamma0;
  nptiso_gammav = gammav;

  thermo_switch = ( thermo_switch | THERMO_NPT_ISO );
  mpi_bcast_parameter(FIELD_THERMO_SWITCH);
  mpi_bcast_parameter(FIELD_TEMPERATURE);
  mpi_bcast_parameter(FIELD_NPTISO_G0);
  mpi_bcast_parameter(FIELD_NPTISO_GV);
  return (TCL_OK);
}
开发者ID:gitter-badger,项目名称:espresso,代码行数:26,代码来源:thermostat_tcl.cpp

示例6: tclcommand_inter_parse_angle

/// parse parameters for the angle potential
int tclcommand_inter_parse_angle(Tcl_Interp *interp, int bond_type, int argc, char **argv)
{
  double bend, phi0;

  /* the optional parameter phi0 is due to backwards compatibility and is set to PI if not given */
  if (argc != 2 && argc != 3) {
    Tcl_AppendResult(interp, "angle needs 1 or 2 parameters: "
		     "<bend> [<phi0>]", (char *) NULL);
    return (TCL_ERROR);
  }

  if (! ARG_IS_D(1, bend)) {
    Tcl_AppendResult(interp, "angle needs a DOUBLE parameter: "
		     "<bend> ", (char *) NULL);
    return TCL_ERROR;
  }

  /* special treatment of the optional parameter phi0 */
  if (argc == 3) {
    if (! ARG_IS_D(2, phi0)) {
      Tcl_AppendResult(interp, "angle needs a DOUBLE parameter: "
		       "<phi0> ", (char *) NULL);
      return TCL_ERROR;
    }
  } else {
    phi0 = PI;
  }
  CHECK_VALUE(angle_set_params(bond_type, bend, phi0), "bond type must be nonnegative");
}
开发者ID:Ammar-85,项目名称:espresso,代码行数:30,代码来源:angle_tcl.cpp

示例7: lbnode_parse_set

static int lbnode_parse_set(Tcl_Interp *interp, int argc, char **argv, int *ind) {
  double f[3];
  
  while (argc > 0) {
    if(ARG0_IS_S("force")){
      if (argc < 4 ||
 	  !ARG_IS_D(1, f[0]) ||
 	  !ARG_IS_D(2, f[1]) ||
 	  !ARG_IS_D(3, f[2])
	  ) {
	Tcl_AppendResult(interp, "force expects three doubles as argument", (char *)NULL);
	return TCL_ERROR;
      }
      argc -= 4;
      argv += 4;
      if (argc > 0) {
	Tcl_ResetResult(interp);
	Tcl_AppendResult(interp, "Error in lbnode_extforce force. You can only change one field at the same time.", (char *)NULL);
	return ES_ERROR;
      }
    }
    else {
      Tcl_AppendResult(interp, "unknown parameter \"", argv[0], "\" to set", (char *)NULL);
      return TCL_ERROR;
    }
  }

  if (lb_lbnode_set_extforce_GPU(ind, f) == ES_ERROR) {
    Tcl_AppendResult(interp, "position is not in the LB lattice", (char *)NULL);
    return TCL_ERROR;
  }

  return ES_OK;
}
开发者ID:andmi,项目名称:espresso,代码行数:34,代码来源:lb_tcl.c

示例8: tclcommand_rotate_system

/* ############### */
int tclcommand_rotate_system(ClientData data, Tcl_Interp * interp, int argc, char ** argv) {
    double alpha,theta,phi;
    if (argc != 4) {
        fprintf(stderr,"needs 3 angles\n");
        return ES_ERROR;
    }
    if (! (ARG_IS_D(1,phi)))
    {
        fprintf(stderr,"Expects 3 floats\n");
        return ES_ERROR;
    }

    if (!(ARG_IS_D(2,theta)))
    {
        fprintf(stderr,"Expects 3 floats\n");
        return ES_ERROR;
    }
    if (! (ARG_IS_D(3,alpha)))
    {
        fprintf(stderr,"Expects 3 floats\n");
        return ES_ERROR;
    }


    rotate_system(phi,theta,alpha);

    return ES_OK;
}
开发者ID:hirschsn,项目名称:espresso,代码行数:29,代码来源:rotate_system_tcl.cpp

示例9: tclcommand_minimize_energy

int tclcommand_minimize_energy(ClientData data, Tcl_Interp *interp, int argc, char **argv) 
{
  int  max_steps;
  double f_max, gamma, max_displacement;
  
  if (argc != 5) {
    Tcl_AppendResult(interp, "wrong # args: \n\"", (char *) NULL);
    return usage(interp);
  }
  else {
    if(!ARG_IS_D(1,f_max)) {
      return usage(interp);      
    }
    if(!ARG_IS_I(2,max_steps)) {
      return usage(interp);      
    }
    if(!ARG_IS_D(3,gamma)) {
      return usage(interp);      
    }
    if(!ARG_IS_D(4,max_displacement)) {
      return usage(interp);      
    }
  }

  minimize_energy_init(f_max, gamma, max_steps, max_displacement);
  mpi_minimize_energy();

  return TCL_OK;
}
开发者ID:Clemson-MSE,项目名称:espresso,代码行数:29,代码来源:minimize_energy_tcl.cpp

示例10: tclcommand_inter_coulomb_parse_maggs

/** parse TCL command.
    number of parameters is checked and maggs_set_parameters function is called.
    @return zero if successful
    @param interp  TCL interpreter handle
    @param argc    number of arguments given
    @param argv    array of arguments given
*/
int tclcommand_inter_coulomb_parse_maggs(Tcl_Interp * interp, int argc, char ** argv)
{
    int mesh;
    double f_mass;
    double epsilon = 1.0;
    int finite_epsilon_flag = 1;
	
    /* if the command is localeps, call function */
    if ( (argc > 0) && (ARG_IS_S(0, "localeps")) )
        return tclcommand_localeps(interp, argc, argv);
    
    if(argc < 2) {
        Tcl_AppendResult(interp, "Not enough parameters: inter coulomb <bjerrum> memd <f_mass> <mesh>", (char *) NULL);
        return TCL_ERROR;
    }
	
    if(! ARG_IS_D(0, f_mass))
        return TCL_ERROR;
	
    if(! ARG_IS_I(1, mesh)) {
        Tcl_AppendResult(interp, "integer expected", (char *) NULL);
        return TCL_ERROR;
    }
	
    if(argc > 4) {
        Tcl_AppendResult(interp, "Too many parameters: inter coulomb memd <f_mass> <mesh> [epsilon <eps>]", (char *) NULL);
        return TCL_ERROR;
    }
    if(argc == 3) {
        Tcl_AppendResult(interp, "Usage: inter coulomb memd <f_mass> <mesh> [epsilon <eps>]", (char *) NULL);
        return TCL_ERROR;
    }
    if(argc == 4) {
        if (ARG_IS_S(2, "epsilon")) {
            if(! (ARG_IS_D(3, epsilon) && epsilon > 0.0)) {
                Tcl_AppendResult(interp, "epsilon expects a positive double",
                             (char *) NULL);
                return TCL_ERROR;
            }
        }
    } else finite_epsilon_flag=1;

  coulomb.method = COULOMB_MAGGS;
	
  int res = maggs_set_parameters(coulomb.bjerrum, f_mass, mesh,
                                 finite_epsilon_flag, epsilon);
  switch (res) {
  case -1:
    Tcl_AppendResult(interp, "mass of the field is negative", (char *)NULL);
    return TCL_ERROR;
  case -2:
    Tcl_AppendResult(interp, "mesh must be positive", (char *) NULL);
    return TCL_ERROR;
  case ES_OK:
    return TCL_OK;
  }
  Tcl_AppendResult(interp, "unknown error", (char *) NULL);
  return TCL_ERROR;
}
开发者ID:Petr-Melenev,项目名称:espresso-dev,代码行数:66,代码来源:maggs_tcl.cpp

示例11: tclcommand_inter_coulomb_parse_elc_params

int tclcommand_inter_coulomb_parse_elc_params(Tcl_Interp * interp, int argc, char ** argv)
{
  double pwerror;
  double gap_size;
  double far_cut = -1;
  double top = 1, mid = 1, bot = 1;
  int neutralize = 1;

  if (argc < 2) {
    Tcl_AppendResult(interp, "either nothing or elc <pwerror> <minimal layer distance> {<cutoff>}  {dielectric <di_top> <di_mid> <di_bottom>} {noneutralization} expected, not \"",
		     argv[0], "\"", (char *)NULL);
    return TCL_ERROR;
  }
  if (!ARG0_IS_D(pwerror))
    return TCL_ERROR;
  if (!ARG1_IS_D(gap_size))
    return TCL_ERROR;

  argc -= 2; argv += 2;

  if (argc > 0) {
    // if there, parse away manual cutoff
    if(ARG0_IS_D(far_cut)) {
      argc--; argv++;
    }
    else
      Tcl_ResetResult(interp);

    while (argc > 0) {
      if (ARG0_IS_S("noneutralization") || ARG0_IS_S("-noneutralization")) {
	neutralize = 0;
	argc--; argv++;
      }
      else if (argc >= 4 && ARG0_IS_S("dielectric")) {
	// just a dummy, not used, as it is only printed for information
	// purposes. We need to calculate it
	double space_layer_dummy;

	if (!ARG_IS_D(1,top) || !ARG_IS_D(2,mid) || !ARG_IS_D(3,bot))
	  return TCL_ERROR;
	argc -= 4; argv += 4;

	if (argc > 0 && ARG_IS_D(4, space_layer_dummy)) {
	  argc--; argv++;
	}
      }
      else {
	Tcl_AppendResult(interp, "either nothing or elc <pwerror> <minimal layer distance> {<cutoff>}  {dielectric <di_top> <di_mid> <di_bottom>} {noneutralization} expected, not \"",
			 argv[0], "\"", (char *)NULL);
	return TCL_ERROR;
      }
    }
  }
  CHECK_VALUE(ELC_set_params(pwerror, gap_size, far_cut, neutralize, top, mid, bot),
	      "choose a 3d electrostatics method prior to ELC");
}
开发者ID:rafaelbordin,项目名称:espresso,代码行数:56,代码来源:elc_tcl.c

示例12: tclcommand_inter_coulomb_parse_mmm2d

int tclcommand_inter_coulomb_parse_mmm2d(Tcl_Interp * interp, int argc, char ** argv)
{
  int err;
  double maxPWerror;
  double far_cut = -1;
  double top = 1, mid = 1, bot = 1;
  double delta_top = 0, delta_bot = 0;

  if (argc < 1) {
    Tcl_AppendResult(interp, "wrong # arguments: inter coulomb mmm2d <maximal pairwise error> "
		     "{<fixed far cutoff>} {dielectric <e1> <e2> <e3>} | {dielectric-contrasts <d1> <d2>}", (char *) NULL);
    return TCL_ERROR;
  }
  
  if (! ARG0_IS_D(maxPWerror))
    return TCL_ERROR;
  --argc; ++argv;
  
  if (argc >= 1) {
    if (ARG0_IS_D(far_cut)){
      --argc; ++argv;
    } else {
      Tcl_ResetResult(interp);
    }
  }
  
  if (argc != 0) {
    if (argc == 4 && ARG0_IS_S("dielectric")) {
      if (!ARG_IS_D(1,top) || !ARG_IS_D(2,mid) || !ARG_IS_D(3,bot))
	return TCL_ERROR;

      delta_top = (mid - top)/(mid + top);
      delta_bot = (mid - bot)/(mid + bot);
    }
    else if (argc == 3 && ARG0_IS_S("dielectric-contrasts")) {
      if (!ARG_IS_D(1,delta_top) || !ARG_IS_D(2,delta_bot))
	return TCL_ERROR;
    } else {
      Tcl_AppendResult(interp, "wrong # arguments: inter coulomb mmm2d <maximal pairwise error> "
		       "{<fixed far cutoff>} {dielectric <e1> <e2> <e3>} | {dielectric-contrasts <d1> <d2>}", (char *) NULL);
      return TCL_ERROR;
    }
  }

  if (cell_structure.type != CELL_STRUCTURE_NSQUARE &&
      cell_structure.type != CELL_STRUCTURE_LAYERED) {
    Tcl_AppendResult(interp, "MMM2D requires layered of nsquare cell structure", (char *)NULL);
    return TCL_ERROR;
  }

  if ((err = MMM2D_set_params(maxPWerror, far_cut, delta_top, delta_bot)) > 0) {
    Tcl_AppendResult(interp, mmm2d_errors[err], (char *)NULL);
    return TCL_ERROR;
  }
  return TCL_OK;
}
开发者ID:andmi,项目名称:espresso,代码行数:56,代码来源:mmm2d_tcl.c

示例13: tclcommand_thermostat_parse_inter_dpd

int tclcommand_thermostat_parse_inter_dpd(Tcl_Interp *interp, int argc, char ** argv)
{
  double temp;

  if (argc < 2) {
    Tcl_AppendResult(interp, "thermostat needs 1 parameter: "
		     "<temperature>",
		     (char *) NULL);
    return TCL_ERROR;
  }

  if (argc>2 && ARG_IS_S(2, "ignore_fixed_particles")) {
    if (argc == 3)
      dpd_ignore_fixed_particles=1;
    else if (argc!= 4 || (!ARG_IS_I(3, dpd_ignore_fixed_particles))) 
      return TCL_ERROR;
    mpi_bcast_parameter(FIELD_DPD_IGNORE_FIXED_PARTICLES);
    return TCL_OK;
  }

  /* copy lattice-boltzmann parameters */
  if (! ARG_IS_D(2, temp)) { return TCL_ERROR; }

  if ( temp < 0.0 ) {
    Tcl_AppendResult(interp, "temperature must be non-negative", (char *) NULL);
    return TCL_ERROR;
  }
  temperature = temp;
  thermo_switch = ( thermo_switch | THERMO_INTER_DPD );
  mpi_bcast_parameter(FIELD_THERMO_SWITCH);
  mpi_bcast_parameter(FIELD_TEMPERATURE);
  return (TCL_OK);
}
开发者ID:Ammar-85,项目名称:espresso,代码行数:33,代码来源:dpd_tcl.cpp

示例14: tclcommand_thermostat_parse_lb

int tclcommand_thermostat_parse_lb(Tcl_Interp *interp, int argc, char ** argv)
{

#if defined(LB) || defined(LB_GPU)
  double temp;

  /* get lb interaction type */
  if (argc < 2) {
    Tcl_AppendResult(interp, "lb needs 1 parameter: "
		     "<temperature>",
		     (char *) NULL);
    return TCL_ERROR;
  }

  /* copy lattice-boltzmann parameters */
  if (! ARG_IS_D(1, temp)) { return TCL_ERROR; }

  if ( temp < 0.0 ) {
    Tcl_AppendResult(interp, "temperature must be non-negative", (char *) NULL);
    return TCL_ERROR;
  }
  temperature = temp;
  thermo_switch = ( thermo_switch | THERMO_LB );
  mpi_bcast_parameter(FIELD_THERMO_SWITCH);
  mpi_bcast_parameter(FIELD_TEMPERATURE);
  
#endif
  return TCL_OK;
}
开发者ID:gitter-badger,项目名称:espresso,代码行数:29,代码来源:thermostat_tcl.cpp

示例15: tclcommand_thermostat_parse_bd

int tclcommand_thermostat_parse_bd(Tcl_Interp *interp, int argc, char **argv) 
{
  double temp;

  /* check number of arguments */
  if (argc < 3) {
    Tcl_AppendResult(interp, "wrong # args:  should be \n\"",
		     argv[0]," ",argv[1]," <temp>\"", (char *)NULL);
    return (TCL_ERROR);
  }

  /* check argument types */
  if ( !ARG_IS_D(2, temp) ) {
    Tcl_AppendResult(interp, argv[0]," ",argv[1]," needs a  DOUBLE", (char *)NULL);
    return (TCL_ERROR);
  }

  if (temp < 0) {
    Tcl_AppendResult(interp, "temperature must be positive", (char *)NULL);
    return (TCL_ERROR);
  }

  /* broadcast parameters */
  temperature = temp;
  thermo_switch = ( thermo_switch | THERMO_BD );
  mpi_bcast_parameter(FIELD_THERMO_SWITCH);
  mpi_bcast_parameter(FIELD_TEMPERATURE);
  return (TCL_OK);
}
开发者ID:gitter-badger,项目名称:espresso,代码行数:29,代码来源:thermostat_tcl.cpp


注:本文中的ARG_IS_D函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。