/usr/include/GNUstep/Base/AdBaseFunctions.h is in adun.app 0.81-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #ifndef _ADBASEFUNCTIONS_
#define _ADBASEFUNCTIONS_
#include <Base/AdMatrix.h>
#ifdef __GNUC__
/**
Calculates the kinetic energy of a set of particles.
\param velocities A DoubleMatrix with one row for each particle. Each row has three elements
which are the particles velocity.
\param masses An array of doubles. The length is assumed to be the same as the number of rows in \e velocities.
Each element of \e masses must be the mass of the particle in the corresponding row in velcocities.
*/
extern inline double AdCalculateKineticEnergy(DoubleMatrix* velocities, double* masses)
{
register int i, j;
double *vhold;
double **matrix;
double en, enhold;
matrix = velocities->matrix;
for(en =0, i=0; i<velocities->no_rows; i++)
{
vhold = matrix[i];
for(enhold = 0,j=0; j< 3; j++)
enhold += *(vhold + j)* *(vhold + j);
en += enhold*masses[i];
}
en = en*0.5;
return en;
}
#else
double AdCalculateKineticEnergy(DoubleMatrix* velocities, double* masses);
#endif
#endif
|