本文整理汇总了C++中ActorList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ ActorList::begin方法的具体用法?C++ ActorList::begin怎么用?C++ ActorList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActorList
的用法示例。
在下文中一共展示了ActorList::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newActors
void Physics::newActors(ActorList const & newActors)
{
for(ActorList::const_iterator itr = newActors.begin(); itr != newActors.end(); ++itr)
{
btVector3 vel = (*itr)->initialVel;
Physics::MotionState * actorMotion = new Physics::MotionState( btTransform( btQuaternion(0,0,0,1), (*itr)->pos ), *itr);
motionStates.push_back( actorMotion );
PhysObject const & physObject = (*itr)->physObject; //grabs physical info about the actor
if(physObject.mass != 0)
physObject.shape->calculateLocalInertia(physObject.mass, *(physObject.fallInertia) ); //dynamic object so calculate local inertia
btRigidBody::btRigidBodyConstructionInfo bodyCI(physObject.mass, actorMotion, physObject.shape, *(physObject.fallInertia) ); //TODO this can be shared so stop recreating
btRigidBody * body = new btRigidBody(bodyCI);
dynamicsWorld.addRigidBody(body);
body->setLinearVelocity(btVector3(vel.getX(),vel.getY(), vel.getZ()));
rigidBodies.push_back(body);
}
}
示例2: force_calc
void force_calc()
{
// Communication step: distribute ghost positions
cells_update_ghosts();
// VIRTUAL_SITES pos (and vel for DPD) update for security reason !!!
#ifdef VIRTUAL_SITES
update_mol_vel_pos();
ghost_communicator(&cell_structure.update_ghost_pos_comm);
#endif
#if defined(VIRTUAL_SITES_RELATIVE) && defined(LB)
// This is on a workaround stage:
// When using virtual sites relative and LB at the same time, it is necessary
// to reassemble the cell lists after all position updates, also of virtual
// particles.
if ((lattice_switch & LATTICE_LB) && cell_structure.type == CELL_STRUCTURE_DOMDEC && (!dd.use_vList) )
cells_update_ghosts();
#endif
espressoSystemInterface.update();
#ifdef COLLISION_DETECTION
prepare_collision_queue();
#endif
#ifdef LB_GPU
#ifdef SHANCHEN
if (lattice_switch & LATTICE_LB_GPU && this_node == 0) lattice_boltzmann_calc_shanchen_gpu();
#endif // SHANCHEN
// transfer_momentum_gpu check makes sure the LB fluid doesn't get updated on integrate 0
// this_node==0 makes sure it is the master node where the gpu exists
if (lattice_switch & LATTICE_LB_GPU && transfer_momentum_gpu && (this_node == 0) ) lb_calc_particle_lattice_ia_gpu();
#endif // LB_GPU
#ifdef ELECTROSTATICS
if (iccp3m_initialized && iccp3m_cfg.set_flag)
iccp3m_iteration();
#endif
init_forces();
for (ActorList::iterator actor = forceActors.begin();
actor != forceActors.end(); ++actor)
{
(*actor)->computeForces(espressoSystemInterface);
#ifdef ROTATION
(*actor)->computeTorques(espressoSystemInterface);
#endif
}
calc_long_range_forces();
switch (cell_structure.type) {
case CELL_STRUCTURE_LAYERED:
layered_calculate_ia();
break;
case CELL_STRUCTURE_DOMDEC:
if(dd.use_vList) {
if (rebuild_verletlist)
build_verlet_lists_and_calc_verlet_ia();
else
calculate_verlet_ia();
}
else
calc_link_cell();
break;
case CELL_STRUCTURE_NSQUARE:
nsq_calculate_ia();
}
#ifdef OIF_GLOBAL_FORCES
double area_volume[2]; //There are two global quantities that need to be evaluated: object's surface and object's volume. One can add another quantity.
area_volume[0] = 0.0;
area_volume[1] = 0.0;
for (int i=0;i< MAX_OBJECTS_IN_FLUID;i++){
calc_oif_global(area_volume,i);
if (fabs(area_volume[0])<1e-100 && fabs(area_volume[1])<1e-100) break;
add_oif_global_forces(area_volume,i);
}
#endif
#ifdef IMMERSED_BOUNDARY
// Must be done here. Forces need to be ghost-communicated
IBM_VolumeConservation();
#endif
#ifdef LB
if (lattice_switch & LATTICE_LB) calc_particle_lattice_ia() ;
#endif
#ifdef COMFORCE
calc_comforce();
#endif
#ifdef METADYNAMICS
/* Metadynamics main function */
meta_perform();
#endif
//.........这里部分代码省略.........
示例3: energy_calc
void energy_calc(double *result)
{
if (!interactions_sanity_checks())
return;
init_energies(&energy);
#ifdef CUDA
clear_energy_on_GPU();
#endif
espressoSystemInterface.update();
// Compute the energies from the energyActors
for (ActorList::iterator actor= energyActors.begin();
actor != energyActors.end(); ++actor)
(*actor)->computeEnergy(espressoSystemInterface);
on_observable_calc();
switch (cell_structure.type) {
case CELL_STRUCTURE_LAYERED:
layered_calculate_energies();
break;
case CELL_STRUCTURE_DOMDEC:
if(dd.use_vList) {
if (rebuild_verletlist)
build_verlet_lists();
calculate_verlet_energies();
}
else
calculate_link_cell_energies();
break;
case CELL_STRUCTURE_NSQUARE:
nsq_calculate_energies();
}
/* rescale kinetic energy */
energy.data.e[0] /= (2.0*time_step*time_step);
calc_long_range_energies();
#ifdef CUDA
copy_energy_from_GPU();
#endif
/* gather data */
MPI_Reduce(energy.data.e, result, energy.data.n, MPI_DOUBLE, MPI_SUM, 0, comm_cart);
if (n_external_potentials > 0) {
double* energies = (double*) malloc(n_external_potentials*sizeof(double));
for (int i=0; i<n_external_potentials; i++) {
energies[i]=external_potentials[i].energy;
}
double* energies_sum = (double*) malloc(n_external_potentials*sizeof(double));
MPI_Reduce(energies, energies_sum, n_external_potentials, MPI_DOUBLE, MPI_SUM, 0, comm_cart);
for (int i=0; i<n_external_potentials; i++) {
external_potentials[i].energy=energies_sum[i];
}
free(energies);
free(energies_sum);
}
}
示例4: actor_at
ActorList::iterator actor_at( Vec pos )
{
return std::find_if (
actors.begin(), actors.end(), [=](const Actor& n) { return n.pos == pos; }
);
}