Commit 0161bc5f authored by hrchilds's avatar hrchilds
Browse files

Update from May 7, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@237 18c085ea-50e0-402c-830e-de6fd14e8384
parent 1bf53ede
......@@ -115,6 +115,9 @@ avtVectorDecomposeFilter::GetVariableDimension(void)
// Hank Childs, Fri Sep 19 15:00:11 PDT 2003
// Account for tensor data as well.
//
// Hank Childs, Fri May 7 07:38:31 PDT 2004
// Fix bug with decomposing point tensors.
//
// ****************************************************************************
vtkDataArray *
......@@ -133,7 +136,7 @@ avtVectorDecomposeFilter::DeriveVariable(vtkDataSet *in_ds)
//
// Get the array of interest.
//
if (in_ds->GetPointData()->GetVectors() != NULL)
if (in_ds->GetPointData()->GetArray(varname) != NULL)
{
arr = in_ds->GetPointData()->GetArray(varname);
}
......@@ -143,7 +146,8 @@ avtVectorDecomposeFilter::DeriveVariable(vtkDataSet *in_ds)
}
if (arr == NULL)
{
EXCEPTION1(ExpressionException, "Cannot locate variable");
EXCEPTION1(ExpressionException, "When creating an expression, VisIt "
"was not able to locate a necessary variable.");
}
//
......
......@@ -268,6 +268,11 @@ avtTensorGlyphMapper::InsertFilters(vtkDataSet *ds, int dom)
// Programmer: Hank Childs
// Creation: September 23, 2003
//
// Modifications:
//
// Hank Childs, Fri May 7 07:38:31 PDT 2004
// Reset the default range so the colors update properly.
//
// ****************************************************************************
void
......@@ -284,6 +289,8 @@ avtTensorGlyphMapper::SetScale(float s)
}
}
}
SetDefaultRange();
}
......
......@@ -228,6 +228,13 @@ avtCosmosPPFileFormat::~avtCosmosPPFileFormat()
// Programmer: Hank Childs
// Creation: December 31, 2003
//
// Modifications:
//
// Hank Childs, Fri May 7 15:31:07 PDT 2004
// The VTK point locator is numerically sensitive if you give it lots of
// points along a plane. So we are going to code around it and dummy up
// z-values as x-values.
//
// ****************************************************************************
void
......@@ -347,9 +354,10 @@ avtCosmosPPFileFormat::ReadDataset(int ts, int dom)
}
else
{
float z_diff = bounds[5] - bounds[4];
bounds[4] -= z_diff*0.1;
bounds[5] += z_diff*0.1;
// HACK! The VTK point locator doesn't work very well with 2D objects,
// so make this appear to be 3D by using the X-coordinate.
bounds[4] = bounds[0];
bounds[5] = bounds[1];
}
pl->InitPointInsertion(pts, bounds, npts);
......@@ -363,7 +371,9 @@ avtCosmosPPFileFormat::ReadDataset(int ts, int dom)
float pt[3];
pt[0] = current_tmp[0];
pt[1] = current_tmp[1];
pt[2] = (rank < 3 ? 0. : current_tmp[2]);
// HACK -- if we are in 2D and all the points are along the plane
// z=0, then we will crash. So dummy up some good z-values.
pt[2] = (rank < 3 ? pt[0] : current_tmp[2]);
int ptIndex = pl->IsInsertedPoint(pt);
if (ptIndex >= 0)
{
......@@ -379,6 +389,15 @@ avtCosmosPPFileFormat::ReadDataset(int ts, int dom)
}
current_tmp += rank;
}
if (rank < 3)
{
// HACK -- to avoid VTK's numerical sensitivity, we had to dummy up
// some Z-values. Undo this now.
int new_npts = pts->GetNumberOfPoints();
float *ptr = (float *) pts->GetVoidPointer(0);
for (i = 0 ; i < new_npts ; i++)
ptr[3*i+2] = 0.;
}
dataset[ts][dom]->SetPoints(pts);
pts->Delete();
pl->Delete();
......
#if 0
#ifndef WIN32
#include <unistd.h>
#endif
#include <stdio.h>
#include <Python.h>
#endif
#include <Interpreter.h>
// *******************************************************************
// Method: Interpreter::Interpreter
//
// Purpose:
// Constructor for the Interpreter class. It initializes the Python
// interpreter and writes program usage information to the log file.
//
// Arguments:
// filename : The name of the log file to which the commands will
// be written.
// argc : The number of command line arguments for the program.
// argv : A list of strings containing the command line args.
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 17:17:48 PST 2000
//
// Modifications:
//
// *******************************************************************
Interpreter::Interpreter(const char *filename, int argc, char *argv[])
#if 0
: macroList(), macroName(), macroString()
#endif
{
#if 0
recordingMacro = false;
// Open the log file.
logFile = fopen(filename, "wb");
// Write the usage information to the log file.
if(logFile && argv)
{
std::string str;
#ifndef WIN32
char buf[200];
std::string host;
// Get the host name.
host = (gethostname(buf, 200) == -1) ? "unknown" : buf;
str = "# " + std::string(argv[0]) + " run on " + host + "\n";
WriteLog(str.c_str());
#endif
// Write the command line arguments to the log
str = "# Command line: ";
for(int i = 0; i < argc; ++i)
{
str += argv[i];
str += " ";
}
str += "\n";
WriteLog(str.c_str());
}
// Initialize the Python interpreter.
Py_SetProgramName(argv[0]);
Py_Initialize();
// Set up true, false until I know whether or not Python has boolean.
ExecuteString("true=1");
ExecuteString("false=0");
#endif
}
// *******************************************************************
// Method: Interpreter::~Interpreter
//
// Purpose:
// Destructor for the Interpreter class. It closes the log file if
// it is still open.
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 17:17:01 PST 2000
//
// Modifications:
//
// *******************************************************************
Interpreter::~Interpreter()
{
#if 0
// Close the log file if it is open.
if(logFile != NULL)
fclose(logFile);
Py_Finalize();
#endif
}
// *******************************************************************
// Method: Interpreter::WriteLog
//
// Purpose:
// Writes a string to the log file.
//
// Arguments:
// str : The string that we want to write to the log.
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 17:15:36 PST 2000
//
// Modifications:
//
// *******************************************************************
void
Interpreter::WriteLog(const char *str)
{
#if 0
std::string command = std::string(str);
// Add a newline character to the command if it does not have one.
if(command[command.length() - 1] != '\n')
command += "\n";
fprintf(logFile, "%s", command.c_str());
#endif
}
// *******************************************************************
// Method: Interpreter::ExecuteString
//
// Purpose:
// Sends a command string to the interpreter, logfile, and macro
// string.
//
// Arguments:
// str : The command that we're going to execute.
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 17:14:30 PST 2000
//
// Modifications:
//
// *******************************************************************
void
Interpreter::ExecuteString(const char *str)
{
#if 0
// If a log file is open, write the string to the log.
if(logFile)
WriteLog(str);
// Add a newline character to the command if it does not have one.
std::string command = std::string(str);
if(command[command.length() - 1] != '\n')
command += "\n";
// If we're recording a macro, add the string to the macro.
if(recordingMacro)
{
macroString += command;
}
// Send the string to the Python interpreter.
PyRun_SimpleString((char *)command.c_str());
#endif
}
// *******************************************************************
// Method: Interpreter::ExecuteFile
//
// Purpose:
// Calls the interpreter for all lines in the file. This should be
// finished later... It's contents should be added to the log.
//
// Arguments:
// filename : The name of the file to execute.
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 17:11:24 PST 2000
//
// Modifications:
//
// *******************************************************************
void
Interpreter::ExecuteFile(const char *filename)
{
#if 0
FILE *fp = fopen(filename, "rb");
if(fp != NULL)
{
PyRun_SimpleFile(fp, (char *)filename);
fclose(fp);
}
#endif
}
// *******************************************************************
// Method: Interpreter::ExecuteMacro
//
// Purpose:
// Executes the named macro if it exists.
//
// Arguments:
// macro : The name of the macro to execute.
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 17:10:36 PST 2000
//
// Modifications:
//
// *******************************************************************
void
Interpreter::ExecuteMacro(const char *macro)
{
#if 0
std::map<std::string, std::string>::iterator pos;
std::string name(macro);
//
// If the macro name is in the list, execute the macro body.
//
if((pos = macroList.find(name)) != macroList.end())
{
ExecuteString(pos->second.c_str());
}
#endif
}
// *******************************************************************
// Method: Interpreter::BeginMacro
//
// Purpose:
// Starts recording a macro for the macro list.
//
// Arguments:
// macro : The name of the new macro.
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 17:09:04 PST 2000
//
// Modifications:
//
// *******************************************************************
void
Interpreter::BeginMacro(const char *macro)
{
#if 0
recordingMacro = true;
macroName = std::string(macro);
macroString.erase();
#endif
}
// *******************************************************************
// Method: Interpreter::EndMacro
//
// Purpose:
// Stops recording the macro and puts the macro in the macro list.
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 17:08:24 PST 2000
//
// Modifications:
//
// *******************************************************************
void
Interpreter::EndMacro()
{
#if 0
recordingMacro = false;
//
// If the macroString is not empty, then add the macro to
// the macro list.
//
if(macroString.length() > 0)
{
macroList[macroName] = macroString;
macroString.erase();
}
#endif
}
// *******************************************************************
// Method: Interpreter::RedefineMacro
//
// Purpose:
// Redefines the macro body for the specified macro.
//
// Arguments:
// macro : The name of the macro to redefine.
// body : The new commands that make up the macro.
//
// Returns:
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 17:07:19 PST 2000
//
// Modifications:
//
// *******************************************************************
void
Interpreter::RedefineMacro(const char *macro, const char *body)
{
#if 0
macroList[std::string(macro)] = std::string(body);
#endif
}
// *******************************************************************
// Method: Interpreter::RemoveMacro
//
// Purpose:
// Removes a macro from the macro list.
//
// Arguments:
// macro : The name of the macro to remove.
// Returns:
//
// Note:
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 17:06:39 PST 2000
//
// Modifications:
//
// *******************************************************************
void
Interpreter::RemoveMacro(const char *macro)
{
#if 0
std::map<std::string, std::string>::iterator pos;
//
// If the macro specified by name is in the macro list, then
// remove it.
//
if((pos = macroList.find(std::string(macro))) != macroList.end())
{
macroList.erase(pos);
}
#endif
}
#ifndef INTERPRETER_H
#define INTERPRETER_H
#include <gui_exports.h>
#if 0
#include <stdio.h>
#include <string>
#include <map>
#endif
// *******************************************************************
// Class: Interpreter
//
// Purpose:
// This is a veneer over the Python interpreter. It encapsulates
// writing the command string to a file and recording macros.
//
// Notes:
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 15:32:50 PST 2000
//
// Modifications:
//
// *******************************************************************
class GUI_API Interpreter
{
public:
Interpreter(const char *filename, int argc, char *argv[]);
~Interpreter();
void ExecuteString(const char *str);
void ExecuteFile(const char *filename);
void ExecuteMacro(const char *macro);
void BeginMacro(const char *macro);
void EndMacro();
void RedefineMacro(const char *macro, const char *body);
void RemoveMacro(const char *macro);
void WriteLog(const char *str);
private:
#if 0
FILE *logFile;
bool recordingMacro;
std::string macroName, macroString;
std::map<std::string, std::string> macroList;
#endif
};
#endif
......@@ -273,6 +273,10 @@
# I added support for MacOS X frameworks so the gui can be prebound on
# MacOS X.
#
# Brad Whitlock, Wed May 5 16:20:09 PST 2004
# I removed the command line window and interpreter classes since they
# have not been valid since before the intitial visit prototype.
#
##############################################################################
##
......@@ -318,7 +322,6 @@ HDRMOC = \
QvisColorSelectionWidget.h \
QvisColorTableButton.h \
QvisColorTableWindow.h \
QvisCommandLineWindow.h \
QvisDatabaseCorrelationListWindow.h \
QvisDatabaseCorrelationWindow.h \
QvisDelayedWindow.h \
......@@ -378,7 +381,6 @@ HDR = ${HDRMOC} \
ColorTableObserver.h \
FileServerList.h \
GUIBase.h \
Interpreter.h \
KFBase.h \
KFListViewItem.h \
NameSimplifier.h \
......@@ -396,7 +398,6 @@ SRC = \
ColorTableObserver.C \
FileServerList.C \
GUIBase.C \
Interpreter.C \
KFBase.C \
KFListViewItem.C \
NameSimplifier.C \
......@@ -474,9 +475,6 @@ ${SRCMOC}:
main.o: main.C QvisMainWindow.h
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c main.C
Interpreter.o:
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c Interpreter.C
##
## Automatic dependency stuff
##
......
#include <QvisCommandLineWindow.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qhbox.h>
#include <qlayout.h>
#include <qvbox.h>
// ****************************************************************************
// Method: QvisCommandLineWindow::QvisCommandLineWindow
//
// Purpose:
// Constructor for the QvisCommandLineWindow class.
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 18:34:47 PST 2000
//
// Modifications:
//
// ****************************************************************************
QvisCommandLineWindow::QvisCommandLineWindow(const char *captionString,
const char *shortName, QvisNotepadArea *notepad) :
QvisPostableWindow(captionString, shortName, notepad)
{
}
// ****************************************************************************
// Method: QvisCommandLineWindow::~QvisCommandLineWindow
//
// Purpose:
// Destructor for the QvisCommandLineWindow class.
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 18:34:47 PST 2000
//
// Modifications:
//
// ****************************************************************************
QvisCommandLineWindow::~QvisCommandLineWindow()
{
}
// ****************************************************************************
// Method: QvisCommandLineWindow::CreateWindowContents
//
// Purpose:
// Creates the widgets used in the window. This method is provided
// as a means of delaying the creation of the window widgets until
// the window needs to be shown.
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 18:35:29 PST 2000
//
// Modifications:
//
// ****************************************************************************
void
QvisCommandLineWindow::CreateWindowContents()
{
// Create the line edit and add it to the top layout.
commandLineEdit = new QLineEdit(central);
topLayout->addWidget(commandLineEdit);
// When text is entered, process it.
connect(commandLineEdit, SIGNAL(returnPressed()), this, SLOT(processText()));
}
// ****************************************************************************
// Method: QvisCommandLineWindow::processText
//
// Purpose:
// This is a Qt slot function that reads the text entered into the
// window's line edit widget and sends it to the interpreter.
//
// Programmer: Brad Whitlock
// Creation: Tue Jul 25 18:36:33 PST 2000
//
// Modifications:
// Brad Whitlock, Wed May 2 11:18:28 PDT 2001
// Got rid of interpreter until we can decide what to do.
//
// ****************************************************************************
void
QvisCommandLineWindow::processText()
{
// If the line edit is not empty, send it to the interpreter