Demo entry 6350235

advance-velocity-omp

   

Submitted by anonymous on Mar 08, 2017 at 23:51
Language: C. Code size: 534 Bytes.

void advanceVelocity(SimFlat* s, int nBoxes, real_t dt)
{
   int maxTotalAtoms = MAXATOMS * s->boxes->nTotalBoxes;
   int* s_boxes_nAtoms = s->boxes->nAtoms;
   real3* restrict s_atoms_p = s->atoms->p;
   real3* restrict s_atoms_f = s->atoms->f;

   #pragma omp parallel for
   for (int iBox=0; iBox<nBoxes; iBox++)
   {
      for (int ii=0; ii < s_boxes_nAtoms[iBox]; ii++)
      {
      	int iOff=MAXATOMS*iBox + ii;

      	for(int j=0;j<3;j++) 
		s_atoms_p[iOff][j] += dt*s_atoms_f[iOff][j];

      }
   }

}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).