Commit b662d50a authored by hrchilds's avatar hrchilds
Browse files

Update from July 20, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@283 18c085ea-50e0-402c-830e-de6fd14e8384
parent 3c984002
......@@ -149,11 +149,25 @@ VisitHotPointInteractor::~VisitHotPointInteractor()
//
// Modifications:
//
// Hank Childs, Tue Jul 20 10:54:45 PDT 2004
// If the current interactor has buttons depressed, allow it to finish
// gracefully.
//
// ****************************************************************************
void
VisitHotPointInteractor::SetInteractor(VisitInteractor *newInteractor)
{
if (currentInteractor != NULL)
{
if (currentInteractor->LeftButtonIsDown())
currentInteractor->EndLeftButtonAction();
if (currentInteractor->RightButtonIsDown())
currentInteractor->EndRightButtonAction();
if (currentInteractor->MiddleButtonIsDown())
currentInteractor->EndMiddleButtonAction();
}
newInteractor->SetInteractor(Interactor);
currentInteractor = newInteractor;
hotPointMode = false;
......@@ -611,7 +625,9 @@ VisitHotPointInteractor::EndLeftButtonAction()
hotPointMode = false;
}
else
{
currentInteractor->OnLeftButtonUp();
}
// Tell the other colleagues that motion is ending.
MotionEnd();
......
......@@ -62,6 +62,9 @@ typedef void (*ViewCallback)(VisWindow *);
// OnMouseMove, and PrepTrackball. Added members that were part of old
// parent class, but are not in the new: OldX/Y, Center, MotionFactor.
//
// Hank Childs, Tue Jul 20 10:54:45 PDT 2004
// Add methods to check on whether buttons are depressed.
//
// ****************************************************************************
class VISWINDOW_API VisitInteractor : public vtkInteractorStyleTrackballCamera
......@@ -96,6 +99,13 @@ class VISWINDOW_API VisitInteractor : public vtkInteractorStyleTrackballCamera
virtual void SetInteractor(vtkRenderWindowInteractor *);
virtual bool LeftButtonIsDown(void)
{ return leftButtonDown; };
virtual bool MiddleButtonIsDown(void)
{ return middleButtonDown; };
virtual bool RightButtonIsDown(void)
{ return rightButtonDown; };
protected:
VisWindowInteractorProxy &proxy;
......
......@@ -17,6 +17,7 @@
#include <vtkUnsignedCharArray.h>
#include <vtkUnstructuredGrid.h>
#include <avtCallback.h>
#include <avtDatabaseMetaData.h>
#include <BadIndexException.h>
......@@ -42,11 +43,17 @@ static string GetDirName(const char *path);
// Programmer: Hank Childs
// Creation: November 24, 2003
//
// Modifications:
//
// Hank Childs, Mon Jul 19 16:57:59 PDT 2004
// Initialize haveIssuedWarning.
//
// ****************************************************************************
avtCosmosPPFileFormat::avtCosmosPPFileFormat(const char *fname)
: avtMTMDFileFormat(fname)
{
haveIssuedWarning = false;
dirname = GetDirName(fname);
ifstream ifile(fname);
......@@ -436,6 +443,22 @@ avtCosmosPPFileFormat::ReadDataset(int ts, int dom)
vtkUnsignedCharArray *ghosts = vtkUnsignedCharArray::New();
ghosts->SetName("vtkGhostLevels");
ghosts->SetNumberOfTuples(nzones);
if (numInternalZones > nzones)
{
if (!haveIssuedWarning)
{
char msg[1024];
sprintf(msg, "The file %s claims to have more internal zones (%d)"
" than there are actual zones (%d). This warning "
"will only be issued one time per session, even if "
"additional problems are found.", filename.c_str(),
numInternalZones, nzones);
avtCallback::IssueWarning(msg);
haveIssuedWarning = true;
}
numInternalZones = nzones;
}
for (i = 0 ; i < numInternalZones ; i++)
ghosts->SetTuple1(i, 0);
for (i = numInternalZones ; i < nzones ; i++)
......
......@@ -23,6 +23,11 @@ class vtkUnstructuredGrid;
// Programmer: Hank Childs
// Creation: November 24, 2003
//
// Modifications:
//
// Hank Childs, Mon Jul 19 16:57:59 PDT 2004
// Added haveIssuedWarning.
//
// ****************************************************************************
class avtCosmosPPFileFormat : public avtMTMDFileFormat
......@@ -53,6 +58,7 @@ class avtCosmosPPFileFormat : public avtMTMDFileFormat
int ntimesteps;
int nscalars;
int nvectors;
bool haveIssuedWarning;
std::vector<std::string> scalarVarNames;
std::vector<std::string> vectorVarNames;
......
......@@ -58,6 +58,9 @@ using std::ifstream;
// Akira Haddox, Mon Aug 18 14:33:15 PDT 2003
// Added partition file support.
//
// Hank Childs, Tue Jul 20 15:53:30 PDT 2004
// Add support for more data types (float, double, char, int, etc).
//
// ****************************************************************************
avtMiliFileFormat::avtMiliFileFormat(const char *fname)
......@@ -126,8 +129,12 @@ avtMiliFileFormat::avtMiliFileFormat(const char *fname)
}
vars_valid.resize(ndomains);
var_size.resize(ndomains);
for (dom = 0; dom < ndomains; ++dom)
{
vars_valid[dom].resize(vars.size());
var_size[dom].resize(vars.size());
}
if (in.fail())
EXCEPTION1(InvalidFilesException, fname);
......@@ -245,6 +252,90 @@ avtMiliFileFormat::~avtMiliFileFormat()
}
// ****************************************************************************
// Function: read_results
//
// Purpose:
// A wrapper around mc_read_results that handles multiple types (floats,
// doubles, etc.).
//
// Programmer: Hank Childs
// Creation: July 20, 2004
//
// ****************************************************************************
static void
read_results(Famid &dbid, int ts, int sr, int rank,
char **name, int vtype, int amount, float *buff)
{
int i;
void *buff_to_read_into = NULL;
switch (vtype)
{
case M_STRING:
buff_to_read_into = new char[amount];
break;
case M_FLOAT:
case M_FLOAT4:
buff_to_read_into = buff;
break;
case M_FLOAT8:
buff_to_read_into = new double[amount];
break;
case M_INT:
case M_INT4:
buff_to_read_into = new int[amount];
break;
case M_INT8:
buff_to_read_into = new long[amount];
break;
}
int rval = mc_read_results(dbid, ts, sr, rank, name, buff_to_read_into);
if (rval != OK)
{
EXCEPTION1(InvalidVariableException, name[0]);
}
char *c_tmp = NULL;
double *d_tmp = NULL;
int *i_tmp = NULL;
long *l_tmp = NULL;
switch (vtype)
{
case M_STRING:
c_tmp = (char *) buff_to_read_into;
for (i = 0 ; i < amount ; i++)
buff[i] = (float)(c_tmp[i]);
delete [] c_tmp;
break;
case M_FLOAT:
case M_FLOAT4:
break;
case M_FLOAT8:
d_tmp = (double *) buff_to_read_into;
for (i = 0 ; i < amount ; i++)
buff[i] = (float)(d_tmp[i]);
delete [] d_tmp;
break;
case M_INT:
case M_INT4:
i_tmp = (int *) buff_to_read_into;
for (i = 0 ; i < amount ; i++)
buff[i] = (float)(i_tmp[i]);
delete [] i_tmp;
break;
case M_INT8:
l_tmp = (long *) buff_to_read_into;
for (i = 0 ; i < amount ; i++)
buff[i] = (float)(l_tmp[i]);
delete [] l_tmp;
break;
}
}
// ****************************************************************************
// Method: avtMiliFileFormat::GetMesh
//
......@@ -272,6 +363,9 @@ avtMiliFileFormat::~avtMiliFileFormat()
// Hank Childs, Sat Jun 26 11:24:47 PDT 2004
// Check for bad files where number of timesteps is incorrectly reported.
//
// Hank Childs, Tue Jul 20 15:53:30 PDT 2004
// Add support for more data types (float, double, char, int, etc).
//
// ****************************************************************************
vtkDataSet *
......@@ -322,11 +416,13 @@ avtMiliFileFormat::GetMesh(int ts, int dom, const char *mesh)
int nodpos = GetVariableIndex(nodpos_str, mesh_id);
int subrec = -1;
int vsize = M_FLOAT;
for (int i = 0 ; i < vars_valid[dom][nodpos].size() ; i++)
{
if (vars_valid[dom][nodpos][i])
{
subrec = sub_record_ids[dom][i];
vsize = var_size[dom][nodpos][i];
break;
}
}
......@@ -335,12 +431,9 @@ avtMiliFileFormat::GetMesh(int ts, int dom, const char *mesh)
EXCEPTION0(ImproperUseException);
}
float *fpts = new float[dims*nnodes[dom][mesh_id]];
int rval = mc_read_results(dbid[dom], ts+1, subrec, 1, &nodpos_str, fpts);
if (rval != OK)
{
EXCEPTION1(InvalidFilesException, filename);
}
int amt = dims*nnodes[dom][mesh_id];
float *fpts = new float[amt];
read_results(dbid[dom], ts+1, subrec, 1, &nodpos_str, vsize, amt, fpts);
vtkPoints *pts = vtkPoints::New();
pts->SetNumberOfPoints(nnodes[dom][mesh_id]);
......@@ -960,7 +1053,10 @@ avtMiliFileFormat::ValidateVariables(int dom)
// list.
//
for (int vv = 0 ; vv < vars.size() ; vv++)
vars_valid[dom][vv].push_back(false);
{
vars_valid[dom][vv].push_back(false);
var_size[dom][vv].push_back(M_FLOAT);
}
int index = sub_records[dom].size() - 1;
for (int k = 0 ; k < sr.qty_svars ; k++)
......@@ -986,6 +1082,7 @@ avtMiliFileFormat::ValidateVariables(int dom)
}
vars_valid[dom][sameAsVar][index] = true;
var_size[dom][sameAsVar][index] = sv.num_type;
}
}
}
......@@ -1077,6 +1174,9 @@ avtMiliFileFormat::ConstructMaterials(vector< vector<int *> > &mat_list,
// Akira Haddox, Thu Jul 24 13:36:38 PDT 2003
// Properly dealt with cell variable blocks.
//
// Hank Childs, Tue Jul 20 15:53:30 PDT 2004
// Add support for more data types (float, double, char, int, etc).
//
// ****************************************************************************
vtkDataArray *
......@@ -1115,16 +1215,14 @@ avtMiliFileFormat::GetVar(int ts, int dom, const char *name)
{
EXCEPTION1(InvalidVariableException, name);
}
int vsize = var_size[dom][v_index][sr_valid];
rv->SetNumberOfTuples(nnodes[dom][mesh_id]);
int amt = nnodes[dom][mesh_id];
rv->SetNumberOfTuples(amt);
float *p = (float *) rv->GetVoidPointer(0);
char *tmp = (char *) name; // Bypass const
int rval = mc_read_results(dbid[dom], ts+1,
sub_record_ids[dom][sr_valid], 1, &tmp, p);
if (rval != OK)
{
EXCEPTION1(InvalidVariableException, name);
}
read_results(dbid[dom], ts+1, sub_record_ids[dom][sr_valid], 1,
&tmp, vsize, amt, p);
}
else
{
......@@ -1137,6 +1235,7 @@ avtMiliFileFormat::GetVar(int ts, int dom, const char *name)
{
if (vars_valid[dom][v_index][i])
{
int vsize = var_size[dom][v_index][i];
int start = 0;
int csize = 0;
GetSizeInfoForGroup(sub_records[dom][i].class_name, start,
......@@ -1150,13 +1249,8 @@ avtMiliFileFormat::GetVar(int ts, int dom, const char *name)
// Adjust start
start += (sub_records[dom][i].mo_blocks[0] - 1);
int rval = mc_read_results(dbid[dom], ts+1,
sub_record_ids[dom][i],
1, &tmp, p + start);
if (rval != OK)
{
EXCEPTION1(InvalidVariableException, name);
}
read_results(dbid[dom], ts+1, sub_record_ids[dom][i],
1, &tmp, vsize, csize, p + start);
}
else
{
......@@ -1170,16 +1264,8 @@ avtMiliFileFormat::GetVar(int ts, int dom, const char *name)
float *arr = new float[pSize];
int rval = mc_read_results(dbid[dom], ts + 1,
sub_record_ids[dom][i],
1, &tmp, arr);
if (rval != OK)
{
delete [] arr;
EXCEPTION1(InvalidVariableException, name);
}
read_results(dbid[dom], ts + 1, sub_record_ids[dom][i],
1, &tmp, vsize, pSize, arr);
float *ptr = arr;
// Fill up the blocks into the array.
......@@ -1224,6 +1310,9 @@ avtMiliFileFormat::GetVar(int ts, int dom, const char *name)
// Hank Childs, Mon Sep 22 07:36:48 PDT 2003
// Add support for reading in tensors.
//
// Hank Childs, Tue Jul 20 15:53:30 PDT 2004
// Add support for more data types (float, double, char, int, etc).
//
// ****************************************************************************
vtkDataArray *
......@@ -1270,15 +1359,13 @@ avtMiliFileFormat::GetVectorVar(int ts, int dom, const char *name)
EXCEPTION1(InvalidVariableException, name);
}
rv->SetNumberOfTuples(nnodes[dom][mesh_id]);
int vsize = var_size[dom][v_index][sr_valid];
int amt = nnodes[dom][mesh_id];
rv->SetNumberOfTuples(amt);
float *ptr = (float *) rv->GetVoidPointer(0);
char *tmp = (char *) name; // Bypass const
int rval = mc_read_results(dbid[dom], ts+1,
sub_record_ids[dom][sr_valid], 1, &tmp,ptr);
if (rval != OK)
{
EXCEPTION1(InvalidVariableException, name);
}
read_results(dbid[dom], ts+1, sub_record_ids[dom][sr_valid], 1,
&tmp, vsize, amt, ptr);
}
else
{
......@@ -1292,6 +1379,7 @@ avtMiliFileFormat::GetVectorVar(int ts, int dom, const char *name)
{
if (vars_valid[dom][v_index][i])
{
int vsize = var_size[dom][v_index][i];
int start = 0;
int csize = 0;
GetSizeInfoForGroup(sub_records[dom][i].class_name, start,
......@@ -1305,13 +1393,8 @@ avtMiliFileFormat::GetVectorVar(int ts, int dom, const char *name)
// Adjust start
start += (sub_records[dom][i].mo_blocks[0] - 1);
int rval = mc_read_results(dbid[dom], ts+1,
sub_record_ids[dom][i],
1, &tmp, p + vdim * start);
if (rval != OK)
{
EXCEPTION1(InvalidVariableException, name);
}
read_results(dbid[dom], ts+1, sub_record_ids[dom][i],
1, &tmp, vsize, csize*vdim, p + vdim * start);
}
else
{
......@@ -1325,16 +1408,8 @@ avtMiliFileFormat::GetVectorVar(int ts, int dom, const char *name)
float *arr = new float[pSize * vdim];
int rval = mc_read_results(dbid[dom], ts + 1,
sub_record_ids[dom][i],
1, &tmp, arr);
if (rval != OK)
{
delete [] arr;
EXCEPTION1(InvalidVariableException, name);
}
read_results(dbid[dom], ts + 1, sub_record_ids[dom][i],
1, &tmp, vsize, pSize*vdim, arr);
float *ptr = arr;
// Fill up the blocks into the array.
......
......@@ -52,6 +52,9 @@ using std::vector;
// Hank Childs, Mon Oct 20 10:07:00 PDT 2003
// Added GetTimes and times data member.
//
// Hank Childs, Tue Jul 20 14:47:31 PDT 2004
// Added an array for the variable type.
//
// ****************************************************************************
class avtMiliFileFormat : public avtMTMDFileFormat
......@@ -107,6 +110,7 @@ class avtMiliFileFormat : public avtMTMDFileFormat
vector< std::string > vars;
vector< avtCentering > centering;
vector< vector< vector<bool> > > vars_valid;
vector< vector< vector<int> > > var_size;
vector< avtVarType > vartype;
vector< int > var_dimension;
vector< int > var_mesh_associations;
......
......@@ -436,6 +436,10 @@ avtSliceFilter::PreExecute(void)
// Kathleen Bonnell, Wed Jun 2 09:11:01 PDT 2004
// Added origTrans.
//
// Hank Childs, Tue Jul 20 14:21:06 PDT 2004
// Make sure that basis vectors are unit vectors -- crossing two
// non-orthogonal vectors does not yield a unit vector.
//
// ****************************************************************************
void
......@@ -492,9 +496,12 @@ avtSliceFilter::SetUpProjection(void)
//
float third[3];
vtkMath::Cross(upaxis, normal, third); // right-handed
vtkMath::Normalize(third); // if normal is not "orthogonal" to "third".
// Make sure the up axis is orthogonal to third and normal
vtkMath::Cross(normal, third, upaxis); // right-handed
vtkMath::Normalize(upaxis); // probably not necessary since "normal" and
// "third" are orthogonal
//
// Because it is easier to find the Frame-to-Cartesian-Frame conversion
......
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