public class CompareStateFiles
extends java.lang.Object
java artisynth.core.util.CompareStateFiles file1 file2The 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:
TEST "string describing the section" comps: [ P P F ] t=0.00: v: xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx x: xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx t=0.01: v: xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx x: xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx ...The section begins with the keyword
TEST, followed by a quoted
 string describing the section.
 The next line, beginning with comps:, lists a sequence of letter
 codes, delimited by square brackets, describing the dynamic components that
 make up the state. The following letter codes are defined: 'P' denotes a
 particle, 'F' denotes a frame, and 'RXX' denotes a reduced model where 'XX'
 is an integer giving the number of coordinates.
 
The following lines give the simulation time (after t=), velocity
 state (after v:, and position state (after x:), and these
 lines repeat until the end of the section.
 
Between the two files, each section must have the description string and
 the same number of time entries. This program then compares the maximum
 error between the velocity and position trajectories for each section (in a
 manner appropriate to the components), and outputs the maximum 
 overall. With the -a option, the errors for each section are
 also output.
| Constructor and Description | 
|---|
CompareStateFiles()  | 
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
compareFiles(ReaderTokenizer rtok1,
            ReaderTokenizer rtok2,
            int showLevel)  | 
boolean | 
compareFiles(java.lang.String fileName1,
            java.lang.String fileName2,
            int showLevel)  | 
boolean | 
compareSections(ReaderTokenizer rtok1,
               ReaderTokenizer rtok2,
               int showLevel)  | 
double | 
getMaxPosErr()  | 
double | 
getMaxPosErrTime()  | 
double | 
getMaxVelErr()  | 
double | 
getMaxVelErrTime()  | 
static void | 
main(java.lang.String[] args)  | 
void | 
printMaxErrors()  | 
void | 
printMaxErrors(java.io.PrintWriter pw)  | 
public boolean compareSections(ReaderTokenizer rtok1, ReaderTokenizer rtok2, int showLevel) throws java.io.IOException
java.io.IOExceptionpublic double getMaxVelErr()
public double getMaxPosErr()
public double getMaxVelErrTime()
public double getMaxPosErrTime()
public boolean compareFiles(java.lang.String fileName1,
                            java.lang.String fileName2,
                            int showLevel)
                     throws java.io.IOException
java.io.IOExceptionpublic boolean compareFiles(ReaderTokenizer rtok1, ReaderTokenizer rtok2, int showLevel) throws java.io.IOException
java.io.IOExceptionpublic void printMaxErrors()
public void printMaxErrors(java.io.PrintWriter pw)
public static void main(java.lang.String[] args)