#!/bin/sh
#
# A simple script to compare the position update computed between a serial version
# of a algorithm for the numerical solution to the restricted range N body 
# problem with a parallel version (midpoint method) aimed at solving the same thing
# 
# Written by:
# -- 
# John L. Weatherwax                2006-10-01
# 
# email: wax@alum.mit.edu
# 
# Please send comments and especially bug reports to the
# above email address.
# 
#-----

TS=1

sort -n SimResults/update_pos_proc_?_ts_$TS.dat > /tmp/pUpdate_results.dat

sort -n Testing/move_bodies_ts_$TS.dat > /tmp/sUpdate_results.dat

if which ndiff ; then 
  echo "using ndiff..."
  ndiff -abserr 1d-6 /tmp/pUpdate_results.dat /tmp/sUpdate_results.dat
  #ndiff -relerr 1d-6 /tmp/pUpdate_results.dat /tmp/sUpdate_results.dat
else
  echo "no ndiff ... using diff..."
  if diff -b /tmp/pUpdate_results.dat /tmp/sUpdate_results.dat > /dev/null ; then 
    echo "no difference between the files"
  else
    emacs /tmp/pUpdate_results.dat /tmp/sUpdate_results.dat & 
  fi
fi

#echo "parallel V.S. serial..."
#diff -b /tmp/dum1.dat /tmp/dum2.dat | head 

