artisynth.core.util
Class CompareStateFiles

java.lang.Object
  extended by artisynth.core.util.CompareStateFiles

public class CompareStateFiles
extends java.lang.Object

This program is used to two compare files describing the state (i.e., velocity and position) trajectory of a sequence of ArtiSynth simulations:

 java artisynth.core.util.CompareStateFiles file1 file2
 
The reason for doing this is mainly regression testing: We record the state trajectories for a series of simulations, save this in a file (usually named something like XXXTestData.orig), and then after we have made changes to the system, record the state trajectories again, save these in another file (usually XXXTestData.out), and then compare with the original. Because of numeric round-off error, we can't expect the numbers to always be exactly the same - without introducing error, refactorization may change the order of arithmetic operations, leading to small differences in output. Hence we can't simply 'diff' the files, and so we use this program instead. Each file consists of a series of sections, arranged like this:
 # comment line describing the section
 t=0.00:
 v: xxx xxx xxx xxx
 x: xxx xxx xxx xxx xxx
 t=0.01:
 v: xxx xxx xxx xxx
 x: xxx xxx xxx xxx xxx
 ...
 
where t, v, x denote time, velocity, and position. Note that velocity and position do not necessarily have the same number of state variables. Between the two files, each section must have the same comment line and the same number of time entries. This program then compares the maximum error between the velocity and position trajectories for each section, and outputs the maximum overall. With the -a option, the errors for each section are also output.


Constructor Summary
CompareStateFiles()
           
 
Method Summary
 void compareFiles(ReaderTokenizer rtok1, ReaderTokenizer rtok2, int showLevel)
           
 boolean compareSections(ReaderTokenizer rtok1, ReaderTokenizer rtok2, int showLevel)
           
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompareStateFiles

public CompareStateFiles()
Method Detail

compareSections

public boolean compareSections(ReaderTokenizer rtok1,
                               ReaderTokenizer rtok2,
                               int showLevel)
                        throws java.io.IOException
Throws:
java.io.IOException

compareFiles

public void compareFiles(ReaderTokenizer rtok1,
                         ReaderTokenizer rtok2,
                         int showLevel)
                  throws java.io.IOException
Throws:
java.io.IOException

main

public static void main(java.lang.String[] args)