本文整理汇总了C++中Species::name方法的典型用法代码示例。如果您正苦于以下问题:C++ Species::name方法的具体用法?C++ Species::name怎么用?C++ Species::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Species
的用法示例。
在下文中一共展示了Species::name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupSimulation
// Setup all simulation data, checking it as we go
bool DUQ::setupSimulation()
{
/* Check each defined Species */
Messenger::print("*** Checking Species definitions...\n");
for (Species* sp = species_.first(); sp != NULL; sp = sp->next)
{
Messenger::print("--- Species '%s'...\n", sp->name());
if (!sp->checkSetup(atomTypes_)) return false;
}
Messenger::print("\n");
Messenger::print("*** Setting up Configurations...\n");
int index = 0;
for (Configuration* cfg = configurations_.first(); cfg != NULL; cfg = cfg->next, ++index)
{
Messenger::print("*** Configuration %2i: '%s'\n", index, cfg->name());
if (!cfg->setup(worldPool_, atomTypes_, pairPotentialRange_, boxNormalisationPoints_)) return false;
}
/* Pair Potentials */
/* We expect a PairPotential to have been defined for every combination of AtomType used in the system */
Messenger::print("\n");
Messenger::print("*** Checking PairPotential definitions....\n");
int nMissingPots = 0;
for (AtomType* at1 = atomTypes_.first(); at1 != NULL; at1 = at1->next)
{
for (AtomType* at2 = at1; at2 != NULL; at2 = at2->next)
{
PairPotential* pot = hasPairPotential(at1, at2);
if (pot == NULL)
{
Messenger::error("A PairPotential between AtomTypes '%s' and '%s' is required, but has not been defined.\n", at1->name(), at2->name());
++nMissingPots;
}
}
}
if (nMissingPots > 0) return false;
/* Finalise AtomTypes */
// Assign indices to atom types
Messenger::print("--> Assigning indices to master AtomTypes...\n");
int id = 0;
for (AtomType* at = atomTypes_.first(); at != NULL; at = at->next) at->setIndex(id++);
// Set global AtomType indices in all Configurations
Messenger::print("--> Setting global AtomType indices in Configurations...\n");
for (Configuration* cfg = configurations_.first(); cfg != NULL; cfg = cfg->next) cfg->setGlobalAtomTypeIndices(atomTypes_);
// Create PairPotential matrix
Messenger::print("--> Creating PairPotential matrix (%ix%i)...\n", atomTypes_.nItems(), atomTypes_.nItems());
if (!potentialMap_.initialise(atomTypes_, pairPotentials_, pairPotentialRange_)) return false;
/* Construct Pre/Post-Process Lists */
Messenger::print("--> Creating Pre/Post-Processing task list...\n");
// Loop over configurations
for (Configuration* cfg = configurations_.first(); cfg != NULL; cfg = cfg->next)
{
// Loop over Modules, checking for those that have pre- or post-processing steps
RefListIterator<Module,bool> moduleIterator(cfg->modules());
while (Module* module = moduleIterator.iterate())
{
// Pre-Processing
if (module->hasPreProcessing())
{
// If the Module's instance type is UniqueInstance, check that it is not already in the list
if (module->instanceType() == Module::UniqueInstance)
{
Module* oldModule = findPreProcessingTask(module->name());
if (!oldModule) preProcessingTasks_.add(module);
}
else preProcessingTasks_.add(module);
}
// Post-Processing
if (module->hasPostProcessing())
{
// If the Module's instance type is UniqueInstance, check that it is not already in the list
if (module->instanceType() == Module::UniqueInstance)
{
Module* oldModule = findPostProcessingTask(module->name());
if (!oldModule) postProcessingTasks_.add(module);
}
else postProcessingTasks_.add(module);
}
}
}
if (preProcessingTasks_.nItems() == 0) Messenger::print("--> No pre-processing tasks found.\n");
else Messenger::print("--> %i pre-processing %s found.\n", preProcessingTasks_.nItems(), preProcessingTasks_.nItems() == 1 ? "task" : "tasks");
RefListIterator<Module,bool> preProcessingIterator(preProcessingTasks_);
while (Module* module = preProcessingIterator.iterate())
{
Messenger::print(" %s:\n", module->name());
if (module->nConfigurationTargets() == 0) Messenger::print(" No Configuration targets.\n");
else
{
//.........这里部分代码省略.........
示例2: findSpecies
// Search for Species by name
Species* DUQ::findSpecies(const char* name) const
{
for (Species* sp = species_.first(); sp != NULL; sp = sp->next) if (strcmp(name,sp->name()) == 0) return sp;
return NULL;
}