Commit 5bf60d01 authored by hrchilds's avatar hrchilds

Update from June 5, 2006

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@678 18c085ea-50e0-402c-830e-de6fd14e8384
parent 27f3f3f9
......@@ -52,9 +52,14 @@
#include <InvalidFilesException.h>
#include <InvalidVariableException.h>
#include <Utility.h>
#include <DebugStream.h>
const char *avtPoint3DFileFormat::MESHNAME = "points";
#define COORDINATE_ORDER_DEFAULT 0
#define COORDINATE_ORDER_XYZV 0
#define COORDINATE_ORDER_XYVZ 1
using std::string;
using std::vector;
......@@ -256,11 +261,16 @@ avtPoint3DFileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
// Removed another bogus line, this time it was at the beginning, with
// the variable declaration.
//
// Brad Whitlock, Mon Jun 5 10:58:49 PDT 2006
// Added support for a config file as well as setting coordflag in the
// file itself.
//
// ****************************************************************************
void
avtPoint3DFileFormat::ReadData(void)
{
const char *mName = "avtPoint3DFileFormat::ReadData: ";
int i;
ifstream ifile(filename);
......@@ -269,6 +279,11 @@ avtPoint3DFileFormat::ReadData(void)
EXCEPTION1(InvalidFilesException, filename);
}
// Read the coordinate ordering out of the file.
int coordFlag = COORDINATE_ORDER_XYZV;
ReadConfigFile(coordFlag);
// Read the variable names.
for (i = 0 ; i < 4 ; i++)
{
char buf[1024];
......@@ -291,12 +306,35 @@ avtPoint3DFileFormat::ReadData(void)
{
line[0] = '\0';
ifile.getline(line, 1024);
float a, b, c, d;
sscanf(line, "%f %f %f %f", &a, &b, &c, &d);
var1.push_back(a);
var2.push_back(b);
var3.push_back(c);
var4.push_back(d);
// Allow the user to specify "coordflag" in the file.
if(line[0] == '#')
{
if(strncmp(line+1, "coordflag", 9) == 0)
{
debug4 << mName << "Reading coordflag value from file: ";
if(strncmp(line+9+2, "xyzv", 4) == 0)
{
coordFlag = COORDINATE_ORDER_XYZV;
debug4 << "xyzv";
}
else if(strncmp(line+9+2, "xyvz", 4) == 0)
{
coordFlag = COORDINATE_ORDER_XYVZ;
debug4 << "xyvz";
}
debug4 << endl;
}
}
else
{
float a, b, c, d;
sscanf(line, "%f %f %f %f", &a, &b, &c, &d);
var1.push_back(a);
var2.push_back(b);
var3.push_back(c);
var4.push_back(d);
}
}
int npts = var1.size();
......@@ -333,9 +371,15 @@ avtPoint3DFileFormat::ReadData(void)
vtkPoints *p = vtkPoints::New();
p->SetNumberOfPoints(npts);
for (i = 0 ; i < npts ; i++)
if(coordFlag == COORDINATE_ORDER_XYZV)
{
for (i = 0 ; i < npts ; i++)
p->SetPoint(i, var1[i], var2[i], var3[i]);
}
else // COORDINATE_ORDER_XYVZ
{
p->SetPoint(i, var1[i], var2[i], var4[i]); // Not a typo.
for (i = 0 ; i < npts ; i++)
p->SetPoint(i, var1[i], var2[i], var4[i]);
}
points = vtkUnstructuredGrid::New();
......@@ -353,4 +397,77 @@ avtPoint3DFileFormat::ReadData(void)
haveReadData = true;
}
// ****************************************************************************
// Method: avtPoint3DFileFormat::ReadConfigFile
//
// Purpose:
// Reads a config file out of the home VisIt directory that allows the user
// to configure the Point3D file format.
//
// Arguments:
// coordFlag : The order of the coordinates.
//
// Returns:
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Mon Jun 5 10:51:59 PDT 2006
//
// Modifications:
//
// ****************************************************************************
bool
avtPoint3DFileFormat::ReadConfigFile(int &coordFlag)
{
const char *mName = "avtPoint3DFileFormat::ReadConfigFile: ";
bool retval = false;
std::string configFile(GetUserVisItDirectory());
configFile += "Point3D.ini";
coordFlag = COORDINATE_ORDER_DEFAULT;
// Open the file.
ifstream ifile(configFile.c_str());
if (ifile.fail())
{
debug4 << mName << "Could not open config file: "
<< configFile.c_str() << endl;
}
else
{
debug4 << mName << "Opened config file: "
<< configFile.c_str() << endl;
char line[1024];
for(int lineIndex = 0; !ifile.eof(); ++lineIndex)
{
// Get the line
ifile.getline(line, 1024);
if(strncmp(line, "coordflag", 9) == 0)
{
debug4 << mName << "Reading coordflag value from file: ";
if(strncmp(line+9+1, "xyzv", 4) == 0)
{
coordFlag = COORDINATE_ORDER_XYZV;
debug4 << "xyzv";
}
else if(strncmp(line+9+1, "xyvz", 4) == 0)
{
coordFlag = COORDINATE_ORDER_XYVZ;
debug4 << "xyvz";
}
debug4 << endl;
}
}
retval = true;
}
debug4 << mName << "coordFlag=" << coordFlag << endl;
return retval;
}
......@@ -62,6 +62,10 @@ class vtkUnstructuredGrid;
// Programmer: Hank Childs
// Creation: May 28, 2002
//
// Modifications:
// Brad Whitlock, Mon Jun 5 10:43:55 PDT 2006
// Added config file support.
//
// ****************************************************************************
class avtPoint3DFileFormat : public avtSTSDFileFormat
......@@ -91,6 +95,7 @@ class avtPoint3DFileFormat : public avtSTSDFileFormat
static const char *MESHNAME;
void ReadData(void);
bool ReadConfigFile(int &);
};
......
......@@ -898,6 +898,10 @@ avtProteinDataBankFileFormat::ReadAtomsForModel(int model)
// Programmer: Jeremy Meredith
// Creation: March 23, 2006
//
// Modifications:
// Brad Whitlock, Fri Jun 2 13:15:47 PST 2006
// Added Jeremy's fix for yet another style of ATOM line.
//
// ****************************************************************************
Atom::Atom(const char *line)
{
......@@ -944,6 +948,11 @@ Atom::Atom(const char *line)
element[0] = line[13];
element[1] = '\0';
}
else if (line[13] >= '0' && line[13] <= '9')
{
element[0] = line[12];
element[1] = '\0';
}
else
{
element[0] = line[12];
......
......@@ -34,6 +34,7 @@ enhancements and bug-fixes that were added to this release.</p>
<li>VisIt's Enzo database reader plug-in now supports tracer particles.</li>
<li>The <i>NodePick</i> query now has a <i>PointQuery</i> alias in the Query window.</li>
<li>The Python Interface Manual has been updated to fix a flaw in the documentation for the <i>CreateAnnotationObject</i> function.</li>
<li>VisIt's Point3D database reader plugin has been changed so the first three columns of data are once again the X,Y,Z coordinates of the point while the fourth column is reserved for data. For users having data files in the X,Y,V,Z representation where the Z coordinate was provided by the fourth column, there is a compatability mode that you can use by adding <i>#coordflag xyvz</i> as the second line in your Point3D data file. You can also create a "Point3D.ini" file in your <i>.visit</i> directory, containing the line: <i>coordflag xyvz</i>, if you want to apply the compatibility mode to all Point3D files without changing the files themselves.</li>
<li>VisIt's download pages now include a DNS lookup disclaimer that can indicate to certain users the reasons why they cannot download VisIt.</li>
</ul>
<p><b><font size="4">Bugs fixed in version 1.5.3</font></b></p>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment