org.jcae.mesh.amibe.validation
Class QualityFloat

java.lang.Object
  extended by org.jcae.mesh.amibe.validation.QualityFloat

public class QualityFloat
extends java.lang.Object

Manage statistics for quality values. This class allows easy computation of mesh quality. A criterion factor can be selected, then quality is computed and results are printed on screen or in files. Quality values are stored in a list of floats. Example:

    QualityFloat data = new QualityFloat();
    data.setQualityProcedure(new DihedralAngle());
    for (Iterator itf = mesh.getTriangles().iterator(); itf.hasNext(); )
    {
        Triangle f = (Triangle) itf.next();
        data.compute(f);
    }
    //  Print all results in the BB mesh format.
    data.printMeshBB("foo.bb");
    //  Gather results into 10 blocks...
    data.split(10);
    //  ... and display them on screen.
    data.printLayers();
 


Constructor Summary
QualityFloat()
           
QualityFloat(int n)
          Create a new QualityFloat instance
 
Method Summary
 void add(float x)
          Add a value to the list.
 void compute(java.lang.Object x)
          Compute the quality of an object and add it to the list.
 void finish()
          Call the QualityProcedure.finish() procedure.
 float getMeanValue()
          Return mean value
 float getStandardDeviation()
          Return standard deviation
 float getValueByPercent(double p)
          Return value by its distribution index.
 void printLayers()
          Display histogram about quality values.
 void printMeshBB(java.lang.String file)
          Write quality values into a file.
 void printStatistics()
          Display statistics about quality values.
 void setQualityProcedure(QualityProcedure q)
          Define the procedure which will compute quality values.
 void setTarget(float factor)
          Normalize quality target.
 int size()
          Return the number of quality values.
 void split(float... v)
           
 void split(float v1, float v2, int nr)
          Split quality values into buckets.
 void split(int nr)
          Split quality values into buckets.
 void writeRawData(java.lang.String file)
          Write quality values into a raw file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QualityFloat

public QualityFloat()

QualityFloat

public QualityFloat(int n)
Create a new QualityFloat instance

Parameters:
n - initial capacity of the list.
Method Detail

setQualityProcedure

public void setQualityProcedure(QualityProcedure q)
Define the procedure which will compute quality values.

Parameters:
q - the procedure which will compute quality values.

compute

public void compute(java.lang.Object x)
Compute the quality of an object and add it to the list.

Parameters:
x - the object on which quality is computed.

add

public void add(float x)
Add a value to the list.

Parameters:
x - the value to add to the list.

finish

public void finish()
Call the QualityProcedure.finish() procedure.


getValueByPercent

public float getValueByPercent(double p)
Return value by its distribution index. Returned value is such that there are p*N values below it, where N is the total number of values. For instance, getValueByPercent(0.0) (resp. 1 and 0.5) returns minimum value (resp. maximum value and median value).

Parameters:
p - number between 0 and 1
Returns:
value associated to this distribution index

getMeanValue

public float getMeanValue()
Return mean value


getStandardDeviation

public float getStandardDeviation()
Return standard deviation


size

public int size()
Return the number of quality values.

Returns:
the number of quality values.

setTarget

public void setTarget(float factor)
Normalize quality target. This method divides all values by the given factor. This is useful to scale quality factors so that they are in the range [0..1].

Parameters:
factor - the scale factor.

split

public void split(int nr)
Split quality values into buckets. The minimal and maximal quality values are computed, this range is divided into n subsegments of equal length, and the number of quality values for each subsegment is computed. These numbers can then be displayed by printLayers().

Parameters:
nr - the desired number of subsegments.

split

public void split(float v1,
                  float v2,
                  int nr)
Split quality values into buckets. The range between minimal and maximal quality values is divided into nr subsegments of equal length, and the number of quality values for each subsegment is computed. These numbers can then be displayed by printLayers().

Parameters:
v1 - minimal value to consider.
v2 - maximal value to consider.
nr - the desired number of subsegments.

split

public void split(float... v)

printLayers

public void printLayers()
Display histogram about quality values.


printStatistics

public void printStatistics()
Display statistics about quality values.


printMeshBB

public void printMeshBB(java.lang.String file)
Write quality values into a file. They are stored in the BB medit format, in the same order as they have been computed. This means that a mesh file had been written with the same order.

Parameters:
file - name of the output file

writeRawData

public void writeRawData(java.lang.String file)
Write quality values into a raw file. They are stored in machine format, in the same order as they have been computed.

Parameters:
file - name of the output file