Commit 1db3645a authored by hrchilds's avatar hrchilds

Update from July 27, 2005

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@510 18c085ea-50e0-402c-830e-de6fd14e8384
parent 22021f63
This diff is collapsed.
#ifndef VIEW2DATTRIBUTES_H
#define VIEW2DATTRIBUTES_H
#include <state_exports.h>
#include <string>
#include <AttributeSubject.h>
// ****************************************************************************
......@@ -12,7 +13,7 @@
// Notes: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 18 11:24:35 PDT 2003
// Creation: Mon Jul 25 16:10:32 PST 2005
//
// Modifications:
//
......@@ -21,11 +22,19 @@
class STATE_API View2DAttributes : public AttributeSubject
{
public:
enum TriStateMode
{
On,
Off,
Auto
};
static const double DEFAULT_FULL_FRAME_AUTO_THRESHOLD;
View2DAttributes();
View2DAttributes(const View2DAttributes &obj);
virtual ~View2DAttributes();
virtual void operator = (const View2DAttributes &obj);
virtual View2DAttributes& operator = (const View2DAttributes &obj);
virtual bool operator == (const View2DAttributes &obj) const;
virtual bool operator != (const View2DAttributes &obj) const;
......@@ -42,19 +51,27 @@ public:
// Property setting methods
void SetWindowCoords(const double *windowCoords_);
void SetViewportCoords(const double *viewportCoords_);
void SetFullFrame(bool fullFrame_);
void SetFullFrameActivationMode(TriStateMode fullFrameActivationMode_);
void SetFullFrameAutoThreshold(double fullFrameAutoThreshold_);
// Property getting methods
const double *GetWindowCoords() const;
double *GetWindowCoords();
const double *GetViewportCoords() const;
double *GetViewportCoords();
bool GetFullFrame() const;
TriStateMode GetFullFrameActivationMode() const;
double GetFullFrameAutoThreshold() const;
// Persistence methods
virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
virtual void SetFromNode(DataNode *node);
// Enum conversion functions
static std::string TriStateMode_ToString(TriStateMode);
static bool TriStateMode_FromString(const std::string &, TriStateMode &);
protected:
static std::string TriStateMode_ToString(int);
public:
// Keyframing methods
virtual std::string GetFieldName(int index) const;
......@@ -62,10 +79,14 @@ public:
virtual std::string GetFieldTypeName(int index) const;
virtual bool FieldsEqual(int index, const AttributeGroup *rhs) const;
// User-defined methods
bool GetUseFullFrame(const double *limits=0) const;
void View2DAttributes::SetUseFullFrame(bool ff);
private:
double windowCoords[4];
double viewportCoords[4];
bool fullFrame;
int fullFrameActivationMode;
double fullFrameAutoThreshold;
};
#endif
<?xml version="1.0"?>
<Attribute name="View2DAttributes" purpose="This class contains the 2d view attributes." exportAPI="STATE_API" exportInclude="state_exports.h">
<Field name="windowCoords" type="doubleArray" length="4">0. 0. 1. 1.</Field>
<Field name="viewportCoords" type="doubleArray" length="4">0.1 0.1 0.9 0.9</Field>
<Field name="fullFrame" type="bool">false</Field>
<Attribute name="View2DAttributes" purpose="This class contains the 2d view attributes." persistent="true" exportAPI="STATE_API" exportInclude="state_exports.h" codefile="View2DAttributes.code">
<Enum name="TriStateMode">
On
Off
Auto
</Enum>
<Field name="windowCoords" label="windowCoords" type="doubleArray" length="4">
0.000000
0.000000
1.000000
1.000000
</Field>
<Field name="viewportCoords" label="viewportCoords" type="doubleArray" length="4">
0.100000
0.100000
0.900000
0.900000
</Field>
<Field name="fullFrameActivationMode" label="fullFrameActivationMode" type="enum" subtype="TriStateMode">
Off
</Field>
<Field name="fullFrameAutoThreshold" label="fullFrameAutoThreshold" type="double">
100.000000
</Field>
<Function name="GetUseFullFrame" user="true" member="true">
</Function>
<Function name="SetUseFullFrame" user="true" member="true">
</Function>
<Constant name="DEFAULT_FULL_FRAME_AUTO_THRESHOLD" member="false">
</Constant>
</Attribute>
This diff is collapsed.
......@@ -13,7 +13,7 @@
// Notes: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Tue Jun 21 12:01:53 PDT 2005
// Creation: Thu Jul 21 11:12:47 PDT 2005
//
// Modifications:
//
......@@ -50,7 +50,7 @@ public:
void SetTimeSliders(const stringVector &timeSliders_);
void SetTimeSliderCurrentStates(const intVector &timeSliderCurrentStates_);
void SetAnimationMode(int animationMode_);
void SetWindowMode(int windowMode_);
void SetInteractionMode(int interactionMode_);
void SetBoundingBoxNavigate(bool boundingBoxNavigate_);
void SetSpin(bool spin_);
void SetFullFrame(bool fullFrame_);
......@@ -69,6 +69,7 @@ public:
void SetNumPrimitives(int numPrimitives_);
void SetExtents(const double *extents_);
void SetWindowSize(const int *windowSize_);
void SetWinMode(int winMode_);
// Property getting methods
const std::string &GetActiveSource() const;
......@@ -79,7 +80,7 @@ public:
const intVector &GetTimeSliderCurrentStates() const;
intVector &GetTimeSliderCurrentStates();
int GetAnimationMode() const;
int GetWindowMode() const;
int GetInteractionMode() const;
bool GetBoundingBoxNavigate() const;
bool GetSpin() const;
bool GetFullFrame() const;
......@@ -101,6 +102,7 @@ public:
double *GetExtents();
const int *GetWindowSize() const;
int *GetWindowSize();
int GetWinMode() const;
// Persistence methods
virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
......@@ -119,7 +121,7 @@ private:
stringVector timeSliders;
intVector timeSliderCurrentStates;
int animationMode;
int windowMode;
int interactionMode;
bool boundingBoxNavigate;
bool spin;
bool fullFrame;
......@@ -138,6 +140,7 @@ private:
int numPrimitives;
double extents[6];
int windowSize[2];
int winMode;
};
#endif
......@@ -12,7 +12,7 @@
<Field name="animationMode" label="Animation mode" type="int">
2
</Field>
<Field name="windowMode" label="windowMode" type="int">
<Field name="interactionMode" label="interactionMode" type="int">
0
</Field>
<Field name="boundingBoxNavigate" label="boundingBoxNavigate" type="bool">
......@@ -74,6 +74,9 @@
0
0
</Field>
<Field name="winMode" label="winMode" type="int">
0
</Field>
<Function name="SetFromNode" user="false" member="true">
</Function>
<Function name="CreateNode" user="false" member="true">
......
......@@ -76,8 +76,9 @@ LIBS=
##
## Files...
##
SRC=BJHash.C NamingConvention.C Utility.C void_ref_ptr.C
HDR=BJHash.h NamingConvention.h Utility.h ref_ptr.h array_ref_ptr.h void_ref_ptr.h
SRC=BJHash.C NamingConvention.C StringHelpers.C Utility.C void_ref_ptr.C
HDR=BJHash.h NamingConvention.h StringHelpers.h Utility.h ref_ptr.h \
array_ref_ptr.h void_ref_ptr.h
OBJ=$(SRC:.C=.o)
LIB=libutility
NOT_DISTRIB=
......
......@@ -40,6 +40,10 @@ static int CompareRelevantStrings(const void *arg1, const void *arg2)
return strcmp(str1.c_str(),str2.c_str());
}
//
// Groups a list of strings by finding identical leading substrings
// of length numLeadingVals.
//
void
StringHelpers::GroupStrings(vector<string> stringList,
vector<vector<string> > &stringGroups,
......@@ -99,10 +103,11 @@ StringHelpers::GroupStrings(vector<string> stringList,
}
}
//
// now, scan the sorted list of strings for value transitions
// in first N (default 3) chars. Each such transition indicates the end of
// one group and the beginning of the next. The 'first 3' criterion
// is arbitrary but seems to work well.
// one group and the beginning of the next.
//
groupNames.push_back(RelevantString(stringPtrs[0]));
vector<string> curGroup;
curGroup.push_back(stringPtrs[0]);
......@@ -146,6 +151,10 @@ StringHelpers::GroupStrings(vector<string> stringList,
delete [] stringPtrs;
}
//
// Groups a list of strings that look like file paths into groups
// that have same dirname
//
void
StringHelpers::GroupStringsAsPaths(vector<string> stringList,
vector<vector<string> > &stringGroups,
......@@ -199,6 +208,53 @@ StringHelpers::GroupStringsAsPaths(vector<string> stringList,
delete [] stringPtrs;
}
//
// Groups a list of strings into a fixed number of groups
// by alphabetizing and then dividing the alphabetized list into pieces
//
void
StringHelpers::GroupStringsFixedAlpha(vector<string> stringList,
int numGroups,
vector<vector<string> > &stringGroups)
{
int i;
int nStrings = stringList.size();
if (nStrings == 0)
return;
// prime the input to the compare functions
IGNORE_CHARS = "";
// first, we need to sort the strings. Well, we don't really sort the
// strings. Instead we sort an array of pointers to the strings. We
// build that array here.
const char **stringPtrs = new const char*[nStrings];
for (i = 0; i < nStrings; i++)
stringPtrs[i] = stringList[i].c_str();
// now, call qsort for this array of string pointers
qsort(stringPtrs, nStrings, sizeof(char *), CompareRelevantStrings);
int groupSize = nStrings / numGroups;
if (nStrings % numGroups)
groupSize++;
for (i = 0; i < nStrings; i++)
{
int groupNum = i / groupSize;
int groupIdx = i % groupSize;
if (groupIdx == 0)
{
vector<string> newGroup;
stringGroups.push_back(newGroup);
}
stringGroups[groupNum].push_back(stringPtrs[i]);
}
}
int
StringHelpers::FindRE(const char *strToSearch, const char *re)
{
......
......@@ -4,6 +4,7 @@
#ifndef STRINGHELPERS_H
#define STRINGHELPERS_H
#include <utility_exports.h>
#include <string>
#include <vector>
......@@ -11,25 +12,27 @@
using std::string;
using std::vector;
namespace StringHelpers
{
const string NON_RELEVANT_CHARS = "`~!@#$%^&*()-_=+{[}]|\\:;\"'<,>.?/0123456789";
enum FindResult {FindNone = -1, FindError = -2};
void GroupStrings(vector<string> stringList,
void UTILITY_API GroupStrings(vector<string> stringList,
vector<vector<string> > &stringGroups,
vector<string> &groupNames,
int numLeadingVals = 3,
string nonRelevantChars = NON_RELEVANT_CHARS);
void GroupStringsAsPaths(vector<string> stringList,
void UTILITY_API GroupStringsAsPaths(vector<string> stringList,
vector<vector<string> > &stringGroups,
vector<string> &groupNames);
int FindRE(const char *stringToSearch, const char *re);
void UTILITY_API GroupStringsFixedAlpha(vector<string> stringList,
int numGroups,
vector<vector<string> > &stringGroups);
int UTILITY_API FindRE(const char *stringToSearch, const char *re);
const char * Basename(const char *path);
const char * Dirname(const char *path);
const char UTILITY_API *Basename(const char *path);
const char UTILITY_API *Dirname(const char *path);
}
#endif
......@@ -395,7 +395,7 @@ avtView2D::SetFromView2DAttributes(const View2DAttributes *view2DAtts)
viewport[i] = view2DAtts->GetViewportCoords()[i];
window[i] = view2DAtts->GetWindowCoords()[i];
}
fullFrame = view2DAtts->GetFullFrame();
fullFrame = view2DAtts->GetUseFullFrame();
}
// ****************************************************************************
......@@ -424,7 +424,7 @@ avtView2D::SetToView2DAttributes(View2DAttributes *view2DAtts) const
{
view2DAtts->SetWindowCoords(window);
view2DAtts->SetViewportCoords(viewport);
view2DAtts->SetFullFrame(fullFrame);
view2DAtts->SetUseFullFrame(fullFrame);
}
// ****************************************************************************
......
......@@ -779,16 +779,18 @@ VisWinAxes::AdjustRange(float min_x, float max_x, float min_y, float max_y)
// Akira Haddox, Wed Jul 16 16:48:20 PDT 2003
// Added special case for when range is zero.
//
// Mark C. Miller, Wed Jul 27 08:39:38 PDT 2005
// Moved test for non-positive range to *before* call to log10
//
// ****************************************************************************
int
Digits(float min, float max)
{
float range = max - min;
float pow10 = log10(range);
if (range <= 0)
pow10 = -5;
float pow10 = -5.0;
if (range > 0)
pow10 = log10(range);
int ipow10 = (int)floor(pow10);
......
......@@ -144,7 +144,9 @@ avtANSYSFileFormat::ActivateTimestep()
// Creation: Wed Jul 6 16:00:08 PST 2005
//
// Modifications:
//
// Brad Whitlock, Wed Jul 27 10:55:58 PDT 2005
// Fixed for win32.
//
// ****************************************************************************
bool
......@@ -212,7 +214,11 @@ avtANSYSFileFormat::ReadFile(const char *name, int nLines)
// Get the line
ifile.getline(line, 1024);
#if defined(_WIN32)
int linelen = strlen(line);
#else
int linelen = strlen(line)-1; // account for the end of line char.
#endif
// Determine what the line is for.
bool rightLength = (linelen == expectedLineLength);
......
This diff is collapsed.
......@@ -26,6 +26,9 @@ using std::map;
// Modifications:
// Mark C. Miller, Thu Jun 17 23:07:34 PDT 2004
// Added matNameMap data member, GetCurve
//
// Mark C. Miller, Thu Jul 21 12:52:42 PDT 2005
// Added xdim/ydim data members to var info
// ****************************************************************************
class LEOSFileReader : public PDBReader
......@@ -45,6 +48,8 @@ protected:
// struct to organize eos variable information
typedef struct _eosVarInfo {
int ndims;
int xdim; // size in x (obtained directly from PDB variable)
int ydim; // size in y (obtained directly from PDB variable)
string vName; // name of PDB symbol containing variable data
string vUnits; // units of variable data
......
......@@ -784,10 +784,14 @@ PDBFileObject::SymbolExists(const char *name, TypeEnum *t,
syment *ep = 0;
// Indicate that there is no type initially.
*t = NO_TYPE;
*nTotalElements = 0;
*dimensions = 0;
*nDims = 0;
if (t)
*t = NO_TYPE;
if (nTotalElements)
*nTotalElements = 0;
if (dimensions)
*dimensions = 0;
if (nDims)
*nDims = 0;
if(AutoOpen())
{
......@@ -835,32 +839,39 @@ PDBFileObject::SymbolExists(const char *name, TypeEnum *t,
debug4 << "}" << endl;
// Set some of the return values.
*dimensions = dims;
*nDims = nd;
*nTotalElements = length;
if (dimensions)
*dimensions = dims;
if (nDims)
*nDims = nd;
if (nTotalElements)
*nTotalElements = length;
//
// Take the storage type along with the length to determine the real
// type that we want to report. Also allocate memory for the
// variable.
//
retval = true;
if(strcmp(PD_entry_type(ep), "char") == 0 ||
strcmp(PD_entry_type(ep), "string") == 0)
*t = (length > 1) ? CHARARRAY_TYPE : CHAR_TYPE;
else if(strcmp(PD_entry_type(ep), "int") == 0 ||
strcmp(PD_entry_type(ep), "integer") == 0)
*t = (length > 1) ? INTEGERARRAY_TYPE : INTEGER_TYPE;
else if(strcmp(PD_entry_type(ep), "float") == 0)
*t = (length > 1) ? FLOATARRAY_TYPE : FLOAT_TYPE;
else if(strcmp(PD_entry_type(ep), "double") == 0)
*t = (length > 1) ? DOUBLEARRAY_TYPE : DOUBLE_TYPE;
else if(strcmp(PD_entry_type(ep), "long") == 0)
*t = (length > 1) ? LONGARRAY_TYPE : LONG_TYPE;
else
if (t)
{
*t = OBJECT_TYPE;
if(strcmp(PD_entry_type(ep), "char") == 0 ||
strcmp(PD_entry_type(ep), "string") == 0)
*t = (length > 1) ? CHARARRAY_TYPE : CHAR_TYPE;
else if(strcmp(PD_entry_type(ep), "int") == 0 ||
strcmp(PD_entry_type(ep), "integer") == 0)
*t = (length > 1) ? INTEGERARRAY_TYPE : INTEGER_TYPE;
else if(strcmp(PD_entry_type(ep), "float") == 0)
*t = (length > 1) ? FLOATARRAY_TYPE : FLOAT_TYPE;
else if(strcmp(PD_entry_type(ep), "double") == 0)
*t = (length > 1) ? DOUBLEARRAY_TYPE : DOUBLE_TYPE;
else if(strcmp(PD_entry_type(ep), "long") == 0)
*t = (length > 1) ? LONGARRAY_TYPE : LONG_TYPE;
else
{
*t = OBJECT_TYPE;
}
}
retval = true;
}
}
......
......@@ -19,7 +19,8 @@
#include <InvalidVariableException.h>
#include <InvalidFilesException.h>
#include <visitstream.h>
#include <Expression.h>
#include <DebugStream.h>
using std::string;
using std::vector;
......@@ -27,6 +28,7 @@ using std::vector;
#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
// ****************************************************************************
// Method: avtTecplotFileFormat::PushBackToken
//
......@@ -602,11 +604,14 @@ avtTecplotFileFormat::ParsePOINT(int numI, int numJ, int numK)
// Creation: December 10, 2004
//
// Modifications:
//
// Hank Childs, Sat Mar 5 14:28:52 PST 2005
// Add call to 'clear' so that the file can be re-used on subsequent calls.
//
// Brad Whitlock, Tue Jul 26 14:09:45 PST 2005
// I made it understand DATASETAUXDATA.
//
// ****************************************************************************
void
avtTecplotFileFormat::ReadFile()
{
......@@ -616,6 +621,15 @@ avtTecplotFileFormat::ReadFile()
int numVars = 0;
bool got_next_token_already = false;
bool first_token = true;
#define READING_UNTIL_END_OF_LINE !next_char_eof &&\
tok != "TITLE" &&\
tok != "VARIABLES" &&\
tok != "ZONE" &&\
tok != "GEOMETRY" &&\
tok != "TEXT" &&\
tok != "DATASETAUXDATA"
while (!next_char_eof)
{
got_next_token_already = false;
......@@ -632,12 +646,7 @@ avtTecplotFileFormat::ReadFile()
{
// unsupported
tok = GetNextToken();
while (!next_char_eof &&
tok != "TITLE" &&
tok != "VARIABLES" &&
tok != "ZONE" &&
tok != "GEOMETRY" &&
tok != "TEXT")
while (READING_UNTIL_END_OF_LINE)
{
// Skipping token
tok = GetNextToken();
......@@ -648,12 +657,7 @@ avtTecplotFileFormat::ReadFile()
{
// unsupported
tok = GetNextToken();
while (!next_char_eof &&
tok != "TITLE" &&
tok != "VARIABLES" &&
tok != "ZONE" &&
tok != "GEOMETRY" &&
tok != "TEXT")
while (READING_UNTIL_END_OF_LINE)
{
// Skipping token
tok = GetNextToken();
......@@ -677,11 +681,11 @@ avtTecplotFileFormat::ReadFile()
tok[i] = '_';
}
if (tok == "X" || tok == "x")
if (tok == "X" || tok == "x" || tok == "I")
{
Xindex = numTotalVars;
}
else if (tok == "Y" || tok == "y")
else if (tok == "Y" || tok == "y" || tok == "J")
{
Yindex = numTotalVars;
spatialDimension = (spatialDimension < 2) ? 2 : spatialDimension;
......@@ -712,11 +716,11 @@ avtTecplotFileFormat::ReadFile()
while (true)
{
if (tok == "X" || tok == "x")
if (tok == "X" || tok == "x" || tok == "I")
{
Xindex = numTotalVars;
}
else if (tok == "Y" || tok == "y")
else if (tok == "Y" || tok == "y" || tok == "J")
{
Yindex = numTotalVars;
spatialDimension = (spatialDimension < 2) ? 2 : spatialDimension;
......@@ -852,6 +856,64 @@ avtTecplotFileFormat::ReadFile()
EXCEPTION2(InvalidFilesException, filename, msg);
}
}
else if(tok == "DATASETAUXDATA")
{
int tokIndex = 0;
bool haveVectorExpr = false;
tok = GetNextToken();
while (READING_UNTIL_END_OF_LINE)
{
if(tokIndex == 0)
{
haveVectorExpr = (tok == "VECTOR");
}
else if(tokIndex == 1)
{
if(haveVectorExpr)
{
// Remove spaces
std::string::size_type pos = tok.find(" ");
while(pos != std::string::npos)
{
tok.replace(pos, 1, "");
pos = tok.find(" ");
}
// Look for '('
pos = tok.find("(");
if(pos != std::string::npos)
{
std::string exprName(tok.substr(0, pos));
std::string exprDef(tok.substr(pos, tok.size()-pos));
exprDef.replace(0, 1, "{");
// Replace ')' with '}'
pos = exprDef.find(")");
if(pos != std::string::npos)
{
exprDef.replace(pos, 1, "}");
debug4 << "Expr name=" << exprName.c_str()
<< ", Expr def=" << exprDef.c_str()
<< endl;
Expression newE;
newE.SetName(exprName);
newE.SetDefinition(exprDef);
newE.SetType(Expression::VectorMeshVar);
expressions.AddExpression(newE);
}
}
}
}
// Skipping token
tok = GetNextToken();
++tokIndex;
}
got_next_token_already = true;
}
else if (first_token && token_was_string)
{
// Robust: assume it's a title
......@@ -894,10 +956,14 @@ avtTecplotFileFormat::ReadFile()
// Programmer: Jeremy Meredith
// Creation: November 7, 2004
//
// Modifications:
// Brad Whitlock, Tue Jul 26 14:59:48 PST 2005
// Initialized expressions.
//
// ****************************************************************************
avtTecplotFileFormat::avtTecplotFileFormat(const char *fname)
: avtSTMDFileFormat(&fname, 1)
: avtSTMDFileFormat(&fname, 1), expressions()
{
file_read = false;
filename = fname;
......@@ -942,11 +1008,13 @@ avtTecplotFileFormat::~avtTecplotFileFormat()
// Creation: Fri Nov 5 15:44:16 PST 2004
//
// Modifications:
//
// Hank Childs, Sat Mar 5 10:03:47 PST 2005
// Do not blow away file name, because we will need that to re-read the file
// if asked.
//
// Brad Whitlock, Tue Jul 26 14:59:03 PST 2005
// Clear the expression list.
//
// ****************************************************************************