本文整理汇总了C++中Error::all方法的典型用法代码示例。如果您正苦于以下问题:C++ Error::all方法的具体用法?C++ Error::all怎么用?C++ Error::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Error
的用法示例。
在下文中一共展示了Error::all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void ImbalanceVar::init()
{
Error *error = _lmp->error;
Variable *variable = _lmp->input->variable;
if (_name) {
_id = variable->find(_name);
if (_id < 0) {
error->all(FLERR,"Variable name for balance weight does not exist");
} else {
if (variable->atomstyle(_id) == 0)
error->all(FLERR,"Variable for balance weight has invalid style");
}
}
}
示例2: options
int ImbalanceVar::options(int narg, char **arg)
{
Error *error = _lmp->error;
if (narg < 1) error->all(FLERR,"Illegal balance weight command");
int len = strlen(arg[0])+1;
_name = new char[len];
memcpy(_name,arg[0],len);
this->init();
return 1;
}
示例3: options
int ImbalanceGroup::options(int narg, char **arg)
{
Error *error = _lmp->error;
Force *force = _lmp->force;
Group *group = _lmp->group;
if (narg < 3) error->all(FLERR,"Illegal balance weight command");
_num = force->inumeric(FLERR,arg[0]);
if (_num < 1) error->all(FLERR,"Illegal balance weight command");
if (2*_num+1 > narg) error->all(FLERR,"Illegal balance weight command");
_id = new int[_num];
_factor = new double[_num];
for (int i = 0; i < _num; ++i) {
_id[i] = group->find(arg[2*i+1]);
if (_id[i] < 0)
error->all(FLERR,"Unknown group in balance weight command");
_factor[i] = force->numeric(FLERR,arg[2*i+2]);
}
return 2*_num+1;
}
示例4: main
int main(int narg, char **arg)
{
int n;
char str[128];
// setup MPI
MPI_Init(&narg,&arg);
MPI_Comm comm = MPI_COMM_WORLD;
int me,nprocs;
MPI_Comm_rank(comm,&me);
MPI_Comm_size(comm,&nprocs);
Memory *memory = new Memory(comm);
Error *error = new Error(comm);
// command-line args
if (narg != 4) error->all("Syntax: lmpqst Niter in.lammps in.quest");
int niter = atoi(arg[1]);
n = strlen(arg[2]) + 1;
char *lammps_input = new char[n];
strcpy(lammps_input,arg[2]);
n = strlen(arg[3]) + 1;
char *quest_input = new char[n];
strcpy(quest_input,arg[3]);
// instantiate LAMMPS
LAMMPS *lmp = new LAMMPS(0,NULL,MPI_COMM_WORLD);
// create simulation in LAMMPS from in.lammps
lmp->input->file(lammps_input);
// make info avaiable to callback function
Info info;
info.me = me;
info.memory = memory;
info.lmp = lmp;
info.quest_input = quest_input;
// set callback to Quest inside fix external
int ifix = lmp->modify->find_fix("2");
FixExternal *fix = (FixExternal *) lmp->modify->fix[ifix];
fix->set_callback(quest_callback,&info);
// run LAMMPS for Niter
// each time it needs forces, it will invoke quest_callback
sprintf(str,"run %d",niter);
lmp->input->one(str);
// clean up
delete lmp;
delete memory;
delete error;
delete [] lammps_input;
delete [] quest_input;
MPI_Finalize();
}