Unverified Commit 873a638c authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

fix issues in AtomVec refactoring detected by compiler warnings

parent b799e44e
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -604,9 +604,12 @@ void Atom::add_peratom(const char *name, void *address,
void Atom::add_peratom_change_columns(const char *name, int cols)
{
  int i;
  for (int i = 0; i < nperatom; i++)
    if (strcmp(name,peratom[i].name) == 0) peratom[i].cols = cols;
  if (i == nperatom)
  for (i = 0; i < nperatom; i++) {
    if (strcmp(name,peratom[i].name) == 0) {
            peratom[i].cols = cols;
            return;
    }
  }
  error->all(FLERR,"Could not find name of peratom array for column change");
}

+8 −8
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ int AtomVec::grow_nmax_bonus(int nmax_bonus)
void AtomVec::grow(int n)
{
  int datatype,cols,maxcols;
  void *pdata,*plength;
  void *pdata;

  if (n == 0) grow_nmax();
  else nmax = n;
@@ -1775,7 +1775,7 @@ void AtomVec::pack_data(double **buf)

  int nlocal = atom->nlocal;

  for (int i = 0; i < nlocal; i++) {
  for (i = 0; i < nlocal; i++) {

    // if needed, change values before packing

@@ -1847,29 +1847,29 @@ void AtomVec::write_data(FILE *fp, int n, double **buf)
      if (datatype == DOUBLE) {
        if (cols == 0) {
          double *vec = *((double **) pdata);
          fprintf(fp," %-1.16e",buf[i][j++]);
          fprintf(fp," %-1.16e",vec[i][j++]);
        } else {
          double **array = *((double ***) pdata);
          for (m = 0; m < cols; m++)
            fprintf(fp," %-1.16e",buf[i][j++]);
            fprintf(fp," %-1.16e",array[i][j++]);
        }
      } else if (datatype == INT) {
        if (cols == 0) {
          int *vec = *((int **) pdata);
          fprintf(fp," %d",(int) ubuf(buf[i][j++]).i);
          fprintf(fp," %d",(int) ubuf(vec[i][j++]).i);
        } else {
          int **array = *((int ***) pdata);
          for (m = 0; m < cols; m++)
            fprintf(fp," %d",(int) ubuf(buf[i][j++]).i);
            fprintf(fp," %d",(int) ubuf(array[i][j++]).i);
        }
      } else if (datatype == BIGINT) {
        if (cols == 0) {
          bigint *vec = *((bigint **) pdata);
          fprintf(fp," " BIGINT_FORMAT,(bigint) ubuf(buf[i][j++]).i);
          fprintf(fp," " BIGINT_FORMAT,(bigint) ubuf(vec[i][j++]).i);
        } else {
          bigint **array = *((bigint ***) pdata);
          for (m = 0; m < cols; m++)
            fprintf(fp," " BIGINT_FORMAT,(bigint) ubuf(buf[i][j++]).i);
            fprintf(fp," " BIGINT_FORMAT,(bigint) ubuf(array[i][j++]).i);
        }
      }
    }
+0 −1
Original line number Diff line number Diff line
@@ -192,7 +192,6 @@ void AtomVecEllipsoid::unpack_comm_bonus(int n, int first, double *buf)
int AtomVecEllipsoid::pack_border_bonus(int n, int *list, double *buf)
{
  int i,j,m;
  double dx,dy,dz;
  double *shape,*quat;

  m = 0;