Commit 47aef661 authored by hrchilds's avatar hrchilds

Update from February 28, 2006

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@626 18c085ea-50e0-402c-830e-de6fd14e8384
parent a8da1037
This diff is collapsed.
......@@ -12,7 +12,7 @@
// Notes: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Mon Feb 20 10:41:51 PDT 2006
// Creation: Sat Feb 25 13:51:43 PST 2006
//
// Modifications:
//
......@@ -36,7 +36,6 @@ public:
Percentile,
Median,
InterquartileRange,
Mode,
Sum
};
......@@ -71,6 +70,10 @@ public:
void SetUndefinedValue(double undefinedValue_);
void SetBinningScheme(BinningScheme binningScheme_);
void SetNumSamples(const intVector &numSamples_);
void SetOverTime(bool overTime_);
void SetTimeStart(int timeStart_);
void SetTimeEnd(int timeEnd_);
void SetTimeStride(int timeStride_);
// Property getting methods
const std::string &GetDdfName() const;
......@@ -87,6 +90,10 @@ public:
BinningScheme GetBinningScheme() const;
const intVector &GetNumSamples() const;
intVector &GetNumSamples();
bool GetOverTime() const;
int GetTimeStart() const;
int GetTimeEnd() const;
int GetTimeStride() const;
// Persistence methods
virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
......@@ -120,6 +127,10 @@ private:
double undefinedValue;
int binningScheme;
intVector numSamples;
bool overTime;
int timeStart;
int timeEnd;
int timeStride;
};
#endif
......@@ -13,7 +13,6 @@
Percentile
Median
InterquartileRange
Mode
Sum
</Enum>
<Field name="ddfName" label="ddfName" type="string">
......@@ -38,4 +37,16 @@
</Field>
<Field name="numSamples" label="numSamples" type="intVector">
</Field>
<Field name="overTime" label="OverTime" type="bool">
false
</Field>
<Field name="timeStart" label="TimeStart" type="int">
0
</Field>
<Field name="timeEnd" label="TimeEnd" type="int">
1
</Field>
<Field name="timeStride" label="TimeStride" type="int">
1
</Field>
</Attribute>
......@@ -34,6 +34,9 @@
# Hank Childs, Sun Feb 12 14:14:09 PST 2006
# Created.
#
# Hank Childs, Sat Feb 25 14:05:47 PST 2006
# Added avtR2Fsum, avtR2Fstddev, avtR2Fvariance.
#
##############################################################################
##
......@@ -47,7 +50,7 @@
##
SRC=avtBinningScheme.C avtDDF.C avtDDFConstructor.C avtDDFFunctionInfo.C \
avtR2Faverage.C avtR2Fmaximum.C avtR2Fminimum.C avtR2Foperator.C \
avtUniformBinningScheme.C
avtR2Fstddev.C avtR2Fsum.C avtR2Fvariance.C avtUniformBinningScheme.C
CPPFLAGS=-I../../include/visit @COMPONENT_CPPFLAGS@ @CPPFLAGS@
......
This diff is collapsed.
......@@ -13,9 +13,14 @@
// Programmer: Hank Childs
// Creation: February 12, 2006
//
// Modifications:
//
// Hank Childs, Sat Feb 25 15:22:19 PST 2006
// Add undefinedVal.
//
// ****************************************************************************
avtR2Faverage::avtR2Faverage(int nb) : avtR2Foperator(nb)
avtR2Faverage::avtR2Faverage(int nb, double uv) : avtR2Foperator(nb, uv)
{
running_total = new double[nb];
count = new int[nb];
......@@ -76,6 +81,11 @@ avtR2Faverage::AddData(int b, float v)
// Programmer: Hank Childs
// Creation: February 12, 2006
//
// Modifications:
//
// Hank Childs, Sat Feb 25 15:22:19 PST 2006
// Use the "undefinedVal".
//
// ****************************************************************************
float *
......@@ -91,7 +101,7 @@ avtR2Faverage::FinalizePass(int pass)
if (cnt2[i] > 0)
rv[i] = rt2[i] / cnt2[i];
else
rv[i] = 0.;
rv[i] = undefinedVal;
}
delete [] rt2;
delete [] cnt2;
......
......@@ -23,12 +23,17 @@
// Programmer: Hank Childs
// Creation: February 12, 2006
//
// Modifications:
//
// Hank Childs, Sat Feb 25 15:24:49 PST 2006
// Add undefined value in constructor.
//
// ****************************************************************************
class AVTDDF_API avtR2Faverage : public avtR2Foperator
{
public:
avtR2Faverage(int);
avtR2Faverage(int, double);
virtual ~avtR2Faverage();
virtual float *FinalizePass(int);
......
......@@ -15,9 +15,14 @@
// Programmer: Hank Childs
// Creation: February 12, 2006
//
// Modifications:
//
// Hank Childs, Sat Feb 25 15:22:19 PST 2006
// Add undefinedVal.
//
// ****************************************************************************
avtR2Fmaximum::avtR2Fmaximum(int nb) : avtR2Foperator(nb)
avtR2Fmaximum::avtR2Fmaximum(int nb, double uv) : avtR2Foperator(nb, uv)
{
max = new float[nb];
for (int i = 0 ; i < nb ; i++)
......@@ -73,6 +78,11 @@ avtR2Fmaximum::AddData(int b, float v)
// Programmer: Hank Childs
// Creation: February 12, 2006
//
// Modifications:
//
// Hank Childs, Sat Feb 25 15:28:11 PST 2006
// Use the undefined val.
//
// ****************************************************************************
float *
......@@ -80,6 +90,8 @@ avtR2Fmaximum::FinalizePass(int pass)
{
float *rv = new float[nBins];
UnifyMaximumFloatArrayAcrossAllProcessors(max, rv, nBins);
for (int i = 0 ; i < nBins ; i++)
rv[i] = (rv[i] == -FLT_MAX ? undefinedVal : rv[i]);
return rv;
}
......
......@@ -23,12 +23,17 @@
// Programmer: Hank Childs
// Creation: February 12, 2006
//
// Modifications:
//
// Hank Childs, Sat Feb 25 15:24:49 PST 2006
// Add undefined value in constructor.
//
// ****************************************************************************
class AVTDDF_API avtR2Fmaximum : public avtR2Foperator
{
public:
avtR2Fmaximum(int);
avtR2Fmaximum(int, double);
virtual ~avtR2Fmaximum();
virtual float *FinalizePass(int);
......
......@@ -15,9 +15,14 @@
// Programmer: Hank Childs
// Creation: February 12, 2006
//
// Modifications:
//
// Hank Childs, Sat Feb 25 15:22:19 PST 2006
// Add undefinedVal.
//
// ****************************************************************************
avtR2Fminimum::avtR2Fminimum(int nb) : avtR2Foperator(nb)
avtR2Fminimum::avtR2Fminimum(int nb, double uv) : avtR2Foperator(nb, uv)
{
min = new float[nb];
for (int i = 0 ; i < nb ; i++)
......@@ -73,6 +78,11 @@ avtR2Fminimum::AddData(int b, float v)
// Programmer: Hank Childs
// Creation: February 12, 2006
//
// Modifications:
//
// Hank Childs, Sat Feb 25 15:28:11 PST 2006
// Use the undefined val.
//
// ****************************************************************************
float *
......@@ -80,6 +90,8 @@ avtR2Fminimum::FinalizePass(int pass)
{
float *rv = new float[nBins];
UnifyMinimumFloatArrayAcrossAllProcessors(min, rv, nBins);
for (int i = 0 ; i < nBins ; i++)
rv[i] = (rv[i] == FLT_MAX ? undefinedVal : rv[i]);
return rv;
}
......
......@@ -23,12 +23,17 @@
// Programmer: Hank Childs
// Creation: February 12, 2006
//
// Modifications:
//
// Hank Childs, Sat Feb 25 15:24:49 PST 2006
// Add undefined value in constructor.
//
// ****************************************************************************
class AVTDDF_API avtR2Fminimum : public avtR2Foperator
{
public:
avtR2Fminimum(int);
avtR2Fminimum(int, double);
virtual ~avtR2Fminimum();
virtual float *FinalizePass(int);
......
......@@ -11,11 +11,17 @@
// Programmer: Hank Childs
// Creation: February 12, 2006
//
// Modifications:
//
// Hank Childs, Sat Feb 25 15:24:49 PST 2006
// Added undefined value.
//
// ****************************************************************************
avtR2Foperator::avtR2Foperator(int nb)
avtR2Foperator::avtR2Foperator(int nb, double uv)
{
nBins = nb;
undefinedVal = uv;
}
......
......@@ -22,12 +22,17 @@
// Programmer: Hank Childs
// Creation: February 12, 2006
//
// Modifications:
//
// Hank Childs, Sat Feb 25 15:24:49 PST 2006
// Added undefinedVal.
//
// ****************************************************************************
class AVTDDF_API avtR2Foperator
{
public:
avtR2Foperator(int);
avtR2Foperator(int, double);
virtual ~avtR2Foperator();
virtual int GetNumberOfPasses(void) { return 1; };
......@@ -36,6 +41,7 @@ class AVTDDF_API avtR2Foperator
protected:
int nBins;
double undefinedVal;
};
......
// ************************************************************************* //
// avtR2Fstddev.C //
// ************************************************************************* //
#include <avtR2Fstddev.h>
#include <math.h>
#include <avtParallel.h>
// ****************************************************************************
// Method: avtR2Fstddev constructor
//
// Programmer: Hank Childs
// Creation: February 25, 2006
//
// ****************************************************************************
avtR2Fstddev::avtR2Fstddev(int nb, double uv) : avtR2Foperator(nb, uv)
{
running_total_ave = new double[nb];
running_total_stddev = new double[nb];
count = new int[nb];
for (int i = 0 ; i < nb ; i++)
{
running_total_ave[i] = 0.;
running_total_stddev[i] = 0.;
count[i] = 0;
}
pass = 0;
}
// ****************************************************************************
// Method: avtR2Fstddev destructor
//
// Purpose:
// Defines the destructor. Note: this should not be inlined in the header
// because it causes problems for certain compilers.
//
// Programmer: Hank Childs
// Creation: February 25, 2006
//
// ****************************************************************************
avtR2Fstddev::~avtR2Fstddev()
{
delete [] running_total_ave;
delete [] running_total_stddev;
delete [] count;
}
// ****************************************************************************
// Method: avtR2Fstddev::AddData
//
// Purpose:
// Adds a single data point to the operator.
//
// Programmer: Hank Childs
// Creation: February 25, 2006
//
// ****************************************************************************
void
avtR2Fstddev::AddData(int b, float v)
{
if (pass == 0)
{
running_total_ave[b] += v;
count[b]++;
}
else
{
float diff = (v-running_total_ave[b]);
running_total_stddev[b] += diff*diff;
}
}
// ****************************************************************************
// Method: avtR2Fstddev::FinalizePass
//
// Purpose:
// Finalizes the current pass. In the first pass, calculate the average.
// In the second pass, calculate the standard deviation.
//
// Programmer: Hank Childs
// Creation: February 25, 2006
//
// ****************************************************************************
float *
avtR2Fstddev::FinalizePass(int pass)
{
float *rv = NULL;
if (pass == 0)
{
double *rt2 = new double[nBins];
int *cnt2 = new int[nBins];
SumIntArrayAcrossAllProcessors(count, cnt2, nBins);
SumDoubleArrayAcrossAllProcessors(running_total_ave, rt2, nBins);
for (int i = 0 ; i < nBins ; i++)
{
if (cnt2[i] > 0)
running_total_ave[i] = rt2[i] / cnt2[i];
else
running_total_ave[i] = undefinedVal;
}
delete [] rt2;
delete [] cnt2;
}
else
{
rv = new float[nBins];
double *rt2 = new double[nBins];
int *cnt2 = new int[nBins];
SumIntArrayAcrossAllProcessors(count, cnt2, nBins);
SumDoubleArrayAcrossAllProcessors(running_total_stddev, rt2, nBins);
for (int i = 0 ; i < nBins ; i++)
{
if (cnt2[i] > 0)
rv[i] = sqrt(rt2[i] / cnt2[i]);
else
rv[i] = undefinedVal;
}
delete [] rt2;
delete [] cnt2;
}
this->pass++;
return rv;
}
// ************************************************************************* //
// avtR2Fstddev.h //
// ************************************************************************* //
#ifndef AVT_R2F_STDDEV_H
#define AVT_R2F_STDDEV_H
#include <ddf_exports.h>
#include <avtR2Foperator.h>
#include <vector>
#include <string>
// ****************************************************************************
// Class: avtR2Fstddev
//
// Purpose:
// Turns a derived data relation into a derived data function using the
// statistical operator "standard deviation".
//
// Programmer: Hank Childs
// Creation: February 25, 2006
//
// ****************************************************************************
class AVTDDF_API avtR2Fstddev : public avtR2Foperator
{
public:
avtR2Fstddev(int, double);
virtual ~avtR2Fstddev();
virtual float *FinalizePass(int);
virtual void AddData(int, float);
virtual int GetNumberOfPasses(void) { return 2; };
protected:
double *running_total_ave;
double *running_total_stddev;
int *count;
int pass;
};
#endif
// ************************************************************************* //
// avtR2Fsum.C //
// ************************************************************************* //
#include <avtR2Fsum.h>
#include <float.h>
#include <avtParallel.h>
// ****************************************************************************
// Method: avtR2Fsum constructor
//
// Programmer: Hank Childs
// Creation: February 25, 2006
//
// ****************************************************************************
avtR2Fsum::avtR2Fsum(int nb) : avtR2Foperator(nb, 0.)
{
sum = new float[nb];
for (int i = 0 ; i < nb ; i++)
sum[i] = 0.;
}
// ****************************************************************************
// Method: avtR2Fsum destructor
//
// Purpose:
// Defines the destructor. Note: this should not be inlined in the header
// because it causes problems for certain compilers.
//
// Programmer: Hank Childs
// Creation: February 25, 2006
//
// ****************************************************************************
avtR2Fsum::~avtR2Fsum()
{
delete [] sum;
}
// ****************************************************************************
// Method: avtR2Fsum::AddData
//
// Purpose:
// Adds a single data point to the operator.
//
// Programmer: Hank Childs
// Creation: February 25, 2006
//
// ****************************************************************************
void
avtR2Fsum::AddData(int b, float v)
{
sum[b] += v;
}
// ****************************************************************************
// Method: avtR2Fsum::FinalizePass
//
// Purpose:
// Finalizes the current pass. In the case of "sum", there is only
// one pass. So calculate the final sums and return them. The caller
// is responsible for freeing the memory.
//
// Programmer: Hank Childs
// Creation: February 25, 2006
//
// ****************************************************************************
float *
avtR2Fsum::FinalizePass(int pass)
{
float *rv = new float[nBins];
SumFloatArrayAcrossAllProcessors(sum, rv, nBins);
return rv;
}
// ************************************************************************* //
// avtR2Fsum.h //
// ************************************************************************* //
#ifndef AVT_R2F_SUM_H
#define AVT_R2F_SUM_H
#include <ddf_exports.h>
#include <avtR2Foperator.h>
#include <vector>
#include <string>
// ****************************************************************************
// Class: avtR2Fsum
//
// Purpose:
// Turns a derived data relation into a derived data function by
// consistently taking the sum.
//
// Programmer: Hank Childs
// Creation: February 25, 2006
//
// ****************************************************************************
class AVTDDF_API avtR2Fsum : public avtR2Foperator
{
public:
avtR2Fsum(int);
virtual ~avtR2Fsum();
virtual float *FinalizePass(int);
virtual void AddData(int, float);
protected:
float *sum;
};
#endif
// ************************************************************************* //
// avtR2Fvariance.C //
// ************************************************************************* //
#include <avtR2Fvariance.h>
#include <avtParallel.h>
// ****************************************************************************
// Method: avtR2Fvariance constructor
//
// Programmer: Hank Childs
// Creation: February 25, 2006
//
// ****************************************************************************
avtR2Fvariance::avtR2Fvariance(int nb, double uv) : avtR2Foperator(nb, uv)
{
running_total_ave = new double[nb];
running_total_variance = new double[nb];
count = new int[nb];
for (int i = 0 ; i < nb ; i++)
{
running_total_ave[i] = 0.;
running_total_variance[i] = 0.;
count[i] = 0;
}
pass = 0;
}
// ****************************************************************************
// Method: avtR2Fvariance destructor
//
// Purpose:
// Defines the destructor. Note: this should not be inlined in the header
// because it causes problems for certain compilers.
//
// Programmer: Hank Childs
// Creation: February 25, 2006
//
// ****************************************************************************
avtR2Fvariance::~avtR2Fvariance()
{
delete [] running_total_ave;
delete [] running_total_variance;
delete [] count;
}
// ****************************************************************************
// Method: avtR2Fvariance::AddData
//
// Purpose:
// Adds a single data point to the operator.
//
// Programmer: Hank Childs
// Creation: February 25, 2006
//
// ****************************************************************************
void
avtR2Fvariance::AddData(int b, float v)
{
if (pass == 0)
{
running_total_ave[b] += v;
count[b]++;
}
else
{
float diff = (v-running_total_ave[b]);
running_total_variance[b] += diff*diff;
}
}
// ****************************************************************************
// Method: avtR2Fvariance::FinalizePass
//
// Purpose:
// Finalizes the current pass. In the first pass, calculate the average.
// In the second pass, calculate the standard deviation.
//
// Programmer: Hank Childs
// Creation: February 25, 2006
//
// ****************************************************************************
float *
avtR2Fvariance::FinalizePass(int pass)
{
float *rv = NULL;
if (pass == 0)
{
double *rt2 = new double[nBins];
int *cnt2 = new int[nBins];
SumIntArrayAcrossAllProcessors(count, cnt2, nBins);
SumDoubleArrayAcrossAllProcessors(running_total_ave, rt2, nBins);
for (int i = 0 ; i < nBins ; i++)
{
if (cnt2[i] > 0)