Commit e5f3e10e authored by allens's avatar allens
Browse files

fixed bug for the index and did some other clean up

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@12661 18c085ea-50e0-402c-830e-de6fd14e8384
parent 89779be4
......@@ -90,7 +90,6 @@ avtExecuteThenTimeLoopFilter::avtExecuteThenTimeLoopFilter()
avtExecuteThenTimeLoopFilter::~avtExecuteThenTimeLoopFilter()
{
;
}
......@@ -108,7 +107,8 @@ avtExecuteThenTimeLoopFilter::~avtExecuteThenTimeLoopFilter()
void
avtExecuteThenTimeLoopFilter::FinalizeTimeLoop()
{
int numStates = GetInput()->GetInfo().GetAttributes().GetNumStates();
int numStates = GetInput()->GetInfo().GetAttributes().GetNumStates();
if (startTime < 0)
{
startTime = 0;
......@@ -121,6 +121,7 @@ avtExecuteThenTimeLoopFilter::FinalizeTimeLoop()
{
stride = 1;
}
if (startTime > endTime)
{
std::string msg("Start time must be smaller than or equal to the end time for " );
......@@ -129,15 +130,19 @@ avtExecuteThenTimeLoopFilter::FinalizeTimeLoop()
EXCEPTION1(ImproperUseException, msg);
}
nFrames = (int) ceil((((float)endTime -startTime))/(float)stride) + 1;
nFrames = (int) ceil((((float)endTime-startTime))/(float)stride) + 1;
if (nFrames < 1)
{
std::string msg(GetType());
msg = msg + " requires at least 1 frame, please correct start " +
"and end times and try again.";
EXCEPTION1(ImproperUseException, msg);
}
// ARS - This check will always pass because of the additional
// frame added to nFrames above and startTime must be greater than
// or equal to endTime. Thus it is commented out.
// if (nFrames < 1)
// {
// std::string msg(GetType());
// msg = msg + " requires at least 1 frame, please correct start " +
// "and end times and try again.";
// EXCEPTION1(ImproperUseException, msg);
// }
if (endTime >= numStates)
{
......@@ -150,7 +155,7 @@ avtExecuteThenTimeLoopFilter::FinalizeTimeLoop()
// Ensure that the specified endTime is included,
// regardless of the stride.
//
actualEnd = startTime + nFrames *stride;
actualEnd = startTime + nFrames * stride;
if (actualEnd < endTime)
actualEnd = endTime + stride;
}
......@@ -206,13 +211,15 @@ avtExecuteThenTimeLoopFilter::Execute(void)
avtContract_p contract = new avtContract(origContract);
int currentTime = (i < endTime ? i : endTime);
debug5 << "Execute-then-time-loop-filter updating with time slice #"
<< currentTime << endl;
contract->GetDataRequest()->SetTimestep(currentTime);
eef.Update(contract);
// Friend status plus reference points leads to some extra contortions here.
// Friend status plus reference points leads to some extra
// contortions here.
avtDataset *ds = *(eef.GetTypedOutput());
avtDataTree_p tree = ds->GetDataTree();
Iterate(currentTime, tree);
......@@ -244,5 +251,3 @@ avtExecuteThenTimeLoopFilter::Execute(void)
Finalize();
}
......@@ -8,18 +8,18 @@
<Field name="startIndex" label="Index of first time slice" type="int">
0
</Field>
<Field name="startPathType" label="Absolute" type="int">
0
</Field>
<Field name="stopIndex" label="Index of last time slice" type="int">
1
</Field>
<Field name="stopPathType" label="Absolute" type="int">
0
</Field>
<Field name="stride" label="Skip rate between time slices" type="int">
1
</Field>
<Field name="startPathType" label="Type of Path" type="enum" subtype="PathTypeEnum">
Absolute
</Field>
<Field name="stopPathType" label="Type of Path" type="enum" subtype="PathTypeEnum">
Absolute
</Field>
<Field name="traceVariableX" label="X-Coordinate" type="variablename" vartypes="01000000000">
</Field>
<Field name="traceVariableY" label="Y-Coordinate" type="variablename" vartypes="01000000000">
......
......@@ -94,10 +94,10 @@ PersistentParticlesAttributes::PathTypeEnum_FromString(const std::string &s, Per
void PersistentParticlesAttributes::Init()
{
startIndex = 0;
startPathType = 0;
stopIndex = 1;
stopPathType = 0;
stride = 1;
startPathType = Absolute;
stopPathType = Absolute;
connectParticles = false;
PersistentParticlesAttributes::SelectAll();
......@@ -121,10 +121,10 @@ void PersistentParticlesAttributes::Init()
void PersistentParticlesAttributes::Copy(const PersistentParticlesAttributes &obj)
{
startIndex = obj.startIndex;
startPathType = obj.startPathType;
stopIndex = obj.stopIndex;
stopPathType = obj.stopPathType;
stride = obj.stride;
startPathType = obj.startPathType;
stopPathType = obj.stopPathType;
traceVariableX = obj.traceVariableX;
traceVariableY = obj.traceVariableY;
traceVariableZ = obj.traceVariableZ;
......@@ -292,10 +292,10 @@ PersistentParticlesAttributes::operator == (const PersistentParticlesAttributes
{
// Create the return value
return ((startIndex == obj.startIndex) &&
(startPathType == obj.startPathType) &&
(stopIndex == obj.stopIndex) &&
(stopPathType == obj.stopPathType) &&
(stride == obj.stride) &&
(startPathType == obj.startPathType) &&
(stopPathType == obj.stopPathType) &&
(traceVariableX == obj.traceVariableX) &&
(traceVariableY == obj.traceVariableY) &&
(traceVariableZ == obj.traceVariableZ) &&
......@@ -445,10 +445,10 @@ void
PersistentParticlesAttributes::SelectAll()
{
Select(ID_startIndex, (void *)&startIndex);
Select(ID_startPathType, (void *)&startPathType);
Select(ID_stopIndex, (void *)&stopIndex);
Select(ID_stopPathType, (void *)&stopPathType);
Select(ID_stride, (void *)&stride);
Select(ID_startPathType, (void *)&startPathType);
Select(ID_stopPathType, (void *)&stopPathType);
Select(ID_traceVariableX, (void *)&traceVariableX);
Select(ID_traceVariableY, (void *)&traceVariableY);
Select(ID_traceVariableZ, (void *)&traceVariableZ);
......@@ -492,28 +492,28 @@ PersistentParticlesAttributes::CreateNode(DataNode *parentNode, bool completeSav
node->AddNode(new DataNode("startIndex", startIndex));
}
if(completeSave || !FieldsEqual(ID_startPathType, &defaultObject))
if(completeSave || !FieldsEqual(ID_stopIndex, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("startPathType", startPathType));
node->AddNode(new DataNode("stopIndex", stopIndex));
}
if(completeSave || !FieldsEqual(ID_stopIndex, &defaultObject))
if(completeSave || !FieldsEqual(ID_stride, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("stopIndex", stopIndex));
node->AddNode(new DataNode("stride", stride));
}
if(completeSave || !FieldsEqual(ID_stopPathType, &defaultObject))
if(completeSave || !FieldsEqual(ID_startPathType, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("stopPathType", stopPathType));
node->AddNode(new DataNode("startPathType", PathTypeEnum_ToString(startPathType)));
}
if(completeSave || !FieldsEqual(ID_stride, &defaultObject))
if(completeSave || !FieldsEqual(ID_stopPathType, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("stride", stride));
node->AddNode(new DataNode("stopPathType", PathTypeEnum_ToString(stopPathType)));
}
if(completeSave || !FieldsEqual(ID_traceVariableX, &defaultObject))
......@@ -584,14 +584,42 @@ PersistentParticlesAttributes::SetFromNode(DataNode *parentNode)
DataNode *node;
if((node = searchNode->GetNode("startIndex")) != 0)
SetStartIndex(node->AsInt());
if((node = searchNode->GetNode("startPathType")) != 0)
SetStartPathType(node->AsInt());
if((node = searchNode->GetNode("stopIndex")) != 0)
SetStopIndex(node->AsInt());
if((node = searchNode->GetNode("stopPathType")) != 0)
SetStopPathType(node->AsInt());
if((node = searchNode->GetNode("stride")) != 0)
SetStride(node->AsInt());
if((node = searchNode->GetNode("startPathType")) != 0)
{
// Allow enums to be int or string in the config file
if(node->GetNodeType() == INT_NODE)
{
int ival = node->AsInt();
if(ival >= 0 && ival < 2)
SetStartPathType(PathTypeEnum(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
PathTypeEnum value;
if(PathTypeEnum_FromString(node->AsString(), value))
SetStartPathType(value);
}
}
if((node = searchNode->GetNode("stopPathType")) != 0)
{
// Allow enums to be int or string in the config file
if(node->GetNodeType() == INT_NODE)
{
int ival = node->AsInt();
if(ival >= 0 && ival < 2)
SetStopPathType(PathTypeEnum(ival));
}
else if(node->GetNodeType() == STRING_NODE)
{
PathTypeEnum value;
if(PathTypeEnum_FromString(node->AsString(), value))
SetStopPathType(value);
}
}
if((node = searchNode->GetNode("traceVariableX")) != 0)
SetTraceVariableX(node->AsString());
if((node = searchNode->GetNode("traceVariableY")) != 0)
......@@ -616,31 +644,31 @@ PersistentParticlesAttributes::SetStartIndex(int startIndex_)
}
void
PersistentParticlesAttributes::SetStartPathType(int startPathType_)
PersistentParticlesAttributes::SetStopIndex(int stopIndex_)
{
startPathType = startPathType_;
Select(ID_startPathType, (void *)&startPathType);
stopIndex = stopIndex_;
Select(ID_stopIndex, (void *)&stopIndex);
}
void
PersistentParticlesAttributes::SetStopIndex(int stopIndex_)
PersistentParticlesAttributes::SetStride(int stride_)
{
stopIndex = stopIndex_;
Select(ID_stopIndex, (void *)&stopIndex);
stride = stride_;
Select(ID_stride, (void *)&stride);
}
void
PersistentParticlesAttributes::SetStopPathType(int stopPathType_)
PersistentParticlesAttributes::SetStartPathType(PersistentParticlesAttributes::PathTypeEnum startPathType_)
{
stopPathType = stopPathType_;
Select(ID_stopPathType, (void *)&stopPathType);
startPathType = startPathType_;
Select(ID_startPathType, (void *)&startPathType);
}
void
PersistentParticlesAttributes::SetStride(int stride_)
PersistentParticlesAttributes::SetStopPathType(PersistentParticlesAttributes::PathTypeEnum stopPathType_)
{
stride = stride_;
Select(ID_stride, (void *)&stride);
stopPathType = stopPathType_;
Select(ID_stopPathType, (void *)&stopPathType);
}
void
......@@ -689,27 +717,27 @@ PersistentParticlesAttributes::GetStartIndex() const
}
int
PersistentParticlesAttributes::GetStartPathType() const
PersistentParticlesAttributes::GetStopIndex() const
{
return startPathType;
return stopIndex;
}
int
PersistentParticlesAttributes::GetStopIndex() const
PersistentParticlesAttributes::GetStride() const
{
return stopIndex;
return stride;
}
int
PersistentParticlesAttributes::GetStopPathType() const
PersistentParticlesAttributes::PathTypeEnum
PersistentParticlesAttributes::GetStartPathType() const
{
return stopPathType;
return PathTypeEnum(startPathType);
}
int
PersistentParticlesAttributes::GetStride() const
PersistentParticlesAttributes::PathTypeEnum
PersistentParticlesAttributes::GetStopPathType() const
{
return stride;
return PathTypeEnum(stopPathType);
}
const std::string &
......@@ -819,10 +847,10 @@ PersistentParticlesAttributes::GetFieldName(int index) const
switch (index)
{
case ID_startIndex: return "startIndex";
case ID_startPathType: return "startPathType";
case ID_stopIndex: return "stopIndex";
case ID_stopPathType: return "stopPathType";
case ID_stride: return "stride";
case ID_startPathType: return "startPathType";
case ID_stopPathType: return "stopPathType";
case ID_traceVariableX: return "traceVariableX";
case ID_traceVariableY: return "traceVariableY";
case ID_traceVariableZ: return "traceVariableZ";
......@@ -853,10 +881,10 @@ PersistentParticlesAttributes::GetFieldType(int index) const
switch (index)
{
case ID_startIndex: return FieldType_int;
case ID_startPathType: return FieldType_int;
case ID_stopIndex: return FieldType_int;
case ID_stopPathType: return FieldType_int;
case ID_stride: return FieldType_int;
case ID_startPathType: return FieldType_enum;
case ID_stopPathType: return FieldType_enum;
case ID_traceVariableX: return FieldType_variablename;
case ID_traceVariableY: return FieldType_variablename;
case ID_traceVariableZ: return FieldType_variablename;
......@@ -887,10 +915,10 @@ PersistentParticlesAttributes::GetFieldTypeName(int index) const
switch (index)
{
case ID_startIndex: return "int";
case ID_startPathType: return "int";
case ID_stopIndex: return "int";
case ID_stopPathType: return "int";
case ID_stride: return "int";
case ID_startPathType: return "enum";
case ID_stopPathType: return "enum";
case ID_traceVariableX: return "variablename";
case ID_traceVariableY: return "variablename";
case ID_traceVariableZ: return "variablename";
......@@ -927,24 +955,24 @@ PersistentParticlesAttributes::FieldsEqual(int index_, const AttributeGroup *rhs
retval = (startIndex == obj.startIndex);
}
break;
case ID_startPathType:
case ID_stopIndex:
{ // new scope
retval = (startPathType == obj.startPathType);
retval = (stopIndex == obj.stopIndex);
}
break;
case ID_stopIndex:
case ID_stride:
{ // new scope
retval = (stopIndex == obj.stopIndex);
retval = (stride == obj.stride);
}
break;
case ID_stopPathType:
case ID_startPathType:
{ // new scope
retval = (stopPathType == obj.stopPathType);
retval = (startPathType == obj.startPathType);
}
break;
case ID_stride:
case ID_stopPathType:
{ // new scope
retval = (stride == obj.stride);
retval = (stopPathType == obj.stopPathType);
}
break;
case ID_traceVariableX:
......
......@@ -98,10 +98,10 @@ public:
// Property setting methods
void SetStartIndex(int startIndex_);
void SetStartPathType(int startPathType_);
void SetStopIndex(int stopIndex_);
void SetStopPathType(int stopPathType_);
void SetStride(int stride_);
void SetStartPathType(PathTypeEnum startPathType_);
void SetStopPathType(PathTypeEnum stopPathType_);
void SetTraceVariableX(const std::string &traceVariableX_);
void SetTraceVariableY(const std::string &traceVariableY_);
void SetTraceVariableZ(const std::string &traceVariableZ_);
......@@ -110,10 +110,10 @@ public:
// Property getting methods
int GetStartIndex() const;
int GetStartPathType() const;
int GetStopIndex() const;
int GetStopPathType() const;
int GetStride() const;
PathTypeEnum GetStartPathType() const;
PathTypeEnum GetStopPathType() const;
const std::string &GetTraceVariableX() const;
std::string &GetTraceVariableX();
const std::string &GetTraceVariableY() const;
......@@ -145,10 +145,10 @@ public:
// IDs that can be used to identify fields in case statements
enum {
ID_startIndex = 0,
ID_startPathType,
ID_stopIndex,
ID_stopPathType,
ID_stride,
ID_startPathType,
ID_stopPathType,
ID_traceVariableX,
ID_traceVariableY,
ID_traceVariableZ,
......@@ -159,10 +159,10 @@ public:
private:
int startIndex;
int startPathType;
int stopIndex;
int stopPathType;
int stride;
int startPathType;
int stopPathType;
std::string traceVariableX;
std::string traceVariableY;
std::string traceVariableZ;
......
......@@ -59,7 +59,7 @@ import llnl.visit.Plugin;
public class PersistentParticlesAttributes extends AttributeSubject implements Plugin
{
private static int numAdditionalAttributes = 10;
private static int PersistentParticlesAttributes_numAdditionalAtts = 10;
// Enum values
public final static int PATHTYPEENUM_ABSOLUTE = 0;
......@@ -68,13 +68,13 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
public PersistentParticlesAttributes()
{
super(numAdditionalAttributes);
super(PersistentParticlesAttributes_numAdditionalAtts);
startIndex = 0;
startPathType = 0;
stopIndex = 1;
stopPathType = 0;
stride = 1;
startPathType = PATHTYPEENUM_ABSOLUTE;
stopPathType = PATHTYPEENUM_ABSOLUTE;
traceVariableX = new String("");
traceVariableY = new String("");
traceVariableZ = new String("");
......@@ -84,13 +84,13 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
public PersistentParticlesAttributes(int nMoreFields)
{
super(numAdditionalAttributes + nMoreFields);
super(PersistentParticlesAttributes_numAdditionalAtts + nMoreFields);
startIndex = 0;
startPathType = 0;
stopIndex = 1;
stopPathType = 0;
stride = 1;
startPathType = PATHTYPEENUM_ABSOLUTE;
stopPathType = PATHTYPEENUM_ABSOLUTE;
traceVariableX = new String("");
traceVariableY = new String("");
traceVariableZ = new String("");
......@@ -100,13 +100,13 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
public PersistentParticlesAttributes(PersistentParticlesAttributes obj)
{
super(numAdditionalAttributes);
super(PersistentParticlesAttributes_numAdditionalAtts);
startIndex = obj.startIndex;
startPathType = obj.startPathType;
stopIndex = obj.stopIndex;
stopPathType = obj.stopPathType;
stride = obj.stride;
startPathType = obj.startPathType;
stopPathType = obj.stopPathType;
traceVariableX = new String(obj.traceVariableX);
traceVariableY = new String(obj.traceVariableY);
traceVariableZ = new String(obj.traceVariableZ);
......@@ -123,17 +123,17 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
public int GetNumAdditionalAttributes()
{
return numAdditionalAttributes;
return PersistentParticlesAttributes_numAdditionalAtts;
}
public boolean equals(PersistentParticlesAttributes obj)
{
// Create the return value
return ((startIndex == obj.startIndex) &&
(startPathType == obj.startPathType) &&
(stopIndex == obj.stopIndex) &&
(stopPathType == obj.stopPathType) &&
(stride == obj.stride) &&
(startPathType == obj.startPathType) &&
(stopPathType == obj.stopPathType) &&
(traceVariableX.equals(obj.traceVariableX)) &&
(traceVariableY.equals(obj.traceVariableY)) &&
(traceVariableZ.equals(obj.traceVariableZ)) &&
......@@ -151,27 +151,27 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
Select(0);
}
public void SetStartPathType(int startPathType_)
public void SetStopIndex(int stopIndex_)
{
startPathType = startPathType_;
stopIndex = stopIndex_;
Select(1);
}
public void SetStopIndex(int stopIndex_)
public void SetStride(int stride_)
{
stopIndex = stopIndex_;
stride = stride_;
Select(2);
}
public void SetStopPathType(int stopPathType_)
public void SetStartPathType(int startPathType_)
{
stopPathType = stopPathType_;
startPathType = startPathType_;
Select(3);
}
public void SetStride(int stride_)
public void SetStopPathType(int stopPathType_)
{
stride = stride_;
stopPathType = stopPathType_;
Select(4);
}
......@@ -207,10 +207,10 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
// Property getting methods
public int GetStartIndex() { return startIndex; }
public int GetStartPathType() { return startPathType; }
public int GetStopIndex() { return stopIndex; }
public int GetStopPathType() { return stopPathType; }
public int GetStride() { return stride; }
public int GetStartPathType() { return startPathType; }
public int GetStopPathType() { return stopPathType; }
public String GetTraceVariableX() { return traceVariableX; }
public String GetTraceVariableY() { return traceVariableY; }
public String GetTraceVariableZ() { return traceVariableZ; }
......@@ -223,13 +223,13 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
if(WriteSelect(0, buf))
buf.WriteInt(startIndex);
if(WriteSelect(1, buf))
buf.WriteInt(startPathType);
if(WriteSelect(2, buf))
buf.WriteInt(stopIndex);
if(WriteSelect(2, buf))
buf.WriteInt(stride);
if(WriteSelect(3, buf))
buf.WriteInt(stopPathType);
buf.WriteInt(startPathType);
if(WriteSelect(4, buf))
buf.WriteInt(stride);
buf.WriteInt(stopPathType);