Unverified Commit 6f1d913e authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

simplify library interface code to extract peratom or local data from computes

parent 943540b0
Loading
Loading
Loading
Loading
+9 −25
Original line number Diff line number Diff line
@@ -537,35 +537,19 @@ void *lammps_extract_compute(void *ptr, char *id, int style, int type)

    if (style == 1) {
      if (!compute->peratom_flag) return NULL;
      if (type == 1) {
        if (compute->invoked_peratom != lmp->update->ntimestep)
          compute->compute_peratom();
        return (void *) compute->vector_atom;
      }
      if (type == 2) {
      if (compute->invoked_peratom != lmp->update->ntimestep)
        compute->compute_peratom();
        return (void *) compute->array_atom;
      }
      if (type == 1) return (void *) compute->vector_atom;
      if (type == 2) return (void *) compute->array_atom;
    }

    if (style == 2) {
      if (!compute->local_flag) return NULL;
      if (type == 0) {
        if (compute->invoked_local != lmp->update->ntimestep)
          compute->compute_local();
        return (void *) &compute->size_local_rows;
      }
      if (type == 1) {
        if (compute->invoked_local != lmp->update->ntimestep)
          compute->compute_local();
        return (void *) compute->vector_local;
      }
      if (type == 2) {
      if (compute->invoked_local != lmp->update->ntimestep)
        compute->compute_local();
        return (void *) compute->array_local;
      }
      if (type == 0) return (void *) &compute->size_local_rows;
      if (type == 1) return (void *) compute->vector_local;
      if (type == 2) return (void *) compute->array_local;
    }
  }
  END_CAPTURE