Commit 6dbd4ee7 authored by hrchilds's avatar hrchilds
Browse files

Fix misc bugs for V1.11.


(1) The Threshold operator now issues a warning when applied to the Vector or Truecolor plots (or any other plots that don't take scalars), basically saying that it won't work.  This resolves '8559
(2) I added a check in the avtUnaryMathExpression to guard against de-referencing NULL pointers.  This had a small amount of trickle down to derived types.  This resolves '8621.
(3) I changed the text for the pos_cmfe expression when it gets inserted in the Expressions window.  It now gives the "fill" variable a more meaningful description.  This resolves '8127.
(4) I made the Slice operator label the axes differently when doing an arbitrary slice.  As background, if you do an orthogonal slice by Y=0, it relabels the axes to be "X" and "Z", giving the impression that we are maintaining the axes labels correctly.  And for orthogonal slices, we were.  But for arbitrary slices, we always had "X" and "Y", which created confusion for a user who assumed we were "doing the right thing" based on our track record with orthogonal slices.  I changed the labels to be (Up[0], Up[1], Up[2])-Axis for Y and (Cross[0],Cross[1], Cross[2])-Axis for X (with numbers, not "Up" or "Cross").  The Cross is the cross product of the Up and the Normal.  This resolves '8751.
(5) The same user wanted to use the "theta-phi" slice selection and pointed out that he could not change the up axis.  I enabled this widget.  This resolves '8761.
(6) We were always assuming that 2D Boxlib files were ZR.  I enhanced the reader to read the coordinate system information out of the "Header" file and correctly report the coordinate system.  This resolves '8755.
(7) My machine was renamed, and I changed the config-site files.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@5288 18c085ea-50e0-402c-830e-de6fd14e8384
parent a5e800c1
......@@ -37,7 +37,7 @@
*****************************************************************************/
// ************************************************************************* //
// avtUnaryMathExpression.C //
// avtUnaryMathExpression.C //
// ************************************************************************* //
#include <avtUnaryMathExpression.h>
......@@ -49,6 +49,7 @@
#include <vtkPointData.h>
#include <ImproperUseException.h>
#include <ExpressionException.h>
// ****************************************************************************
......@@ -283,6 +284,18 @@ avtUnaryMathExpression::DeriveVariable(vtkDataSet *in_ds)
dv = CreateArray(data);
}
if (data == NULL)
{
if (! NullInputIsExpected())
{
// One way to get here is to have vtkPolyData Curve plots.
EXCEPTION2(ExpressionException, outputVariableName,
"An internal error occurred when "
"trying to calculate your expression. Please contact a "
"VisIt developer.");
}
}
int noutcomps = GetNumberOfComponentsInOutput(ncomps);
dv->SetNumberOfComponents(noutcomps);
dv->SetNumberOfTuples(nvals);
......
......@@ -37,13 +37,14 @@
*****************************************************************************/
// ************************************************************************* //
// avtUnaryMathExpression.h //
// avtUnaryMathExpression.h //
// ************************************************************************* //
#ifndef AVT_UNARY_MATH_FILTER_H
#define AVT_UNARY_MATH_FILTER_H
#include <expression_exports.h>
#include <avtSingleInputExpressionFilter.h>
class vtkDataArray;
......@@ -78,6 +79,9 @@ class vtkDataArray;
// Hank Childs, Sun Jan 13 20:07:56 PST 2008
// Add support for constants creating a singleton.
//
// Hank Childs, Thu Oct 9 09:44:37 PDT 2008
// Define method "NullInputIsExpected".
//
// ****************************************************************************
class EXPRESSION_API avtUnaryMathExpression : public avtSingleInputExpressionFilter
......@@ -89,6 +93,8 @@ class EXPRESSION_API avtUnaryMathExpression : public avtSingleInputExpressionFil
virtual const char *GetType(void) { return "avtUnaryMathExpression";};
virtual const char *GetDescription(void) = 0;
virtual bool NullInputIsExpected(void) { return false; };
protected:
virtual vtkDataArray *DeriveVariable(vtkDataSet *);
virtual void DoOperation(vtkDataArray *in, vtkDataArray *out,
......
......@@ -37,7 +37,7 @@
*****************************************************************************/
// ************************************************************************* //
// avtConstantCreatorExpression.h //
// avtConstantCreatorExpression.h //
// ************************************************************************* //
#ifndef AVT_CONSTANT_CREATOR_FILTER_H
......@@ -45,6 +45,7 @@
#include <avtUnaryMathExpression.h>
// ****************************************************************************
// Class: avtConstantCreatorExpression
//
......@@ -69,9 +70,13 @@
// Hank Childs, Sun Jan 13 20:07:56 PST 2008
// Allow constants to be created as singletons.
//
// Hank Childs, Thu Oct 9 09:44:37 PDT 2008
// Define method "NullInputIsExpected".
//
// ****************************************************************************
class EXPRESSION_API avtConstantCreatorExpression : public avtUnaryMathExpression
class EXPRESSION_API avtConstantCreatorExpression
: public avtUnaryMathExpression
{
public:
avtConstantCreatorExpression();
......@@ -83,6 +88,8 @@ class EXPRESSION_API avtConstantCreatorExpression : public avtUnaryMathExpressio
virtual const char * GetDescription(void)
{ return "Generating constant"; }
virtual bool NullInputIsExpected(void) { return true; };
protected:
virtual void DoOperation(vtkDataArray *in, vtkDataArray *out,
int ncomponents, int ntuples);
......
......@@ -60,6 +60,9 @@
// Hank Childs, Mon Jan 14 20:47:27 PST 2008
// Allow constants to be created as singletons.
//
// Hank Childs, Thu Oct 9 09:44:37 PDT 2008
// Define method "NullInputIsExpected".
//
// ****************************************************************************
class EXPRESSION_API avtTimeExpression : public avtUnaryMathExpression
......@@ -73,6 +76,8 @@ class EXPRESSION_API avtTimeExpression : public avtUnaryMathExpression
virtual const char * GetDescription(void)
{ return "Generating constant (time)"; };
virtual bool NullInputIsExpected(void) { return true; };
protected:
virtual void DoOperation(vtkDataArray *in, vtkDataArray *out,
int ncomponents, int ntuples);
......
......@@ -691,6 +691,9 @@ avtBoxlibFileFormat::GetMesh(int patch, const char *mesh_name)
// Hank Childs, Thu Feb 21 16:17:07 PST 2008
// Initialize variables in case parsing fails (Klocwork).
//
// Hank Childs, Wed Oct 8 16:57:17 PDT 2008
// Initialize coordSys.
//
// ****************************************************************************
void
......@@ -872,7 +875,10 @@ avtBoxlibFileFormat::ReadHeader(void)
// Read in coord system;
if (iDoReading)
in >> integer;
{
in >> coordSys;
BroadcastInt(coordSys);
}
// Read in width of boundary regions (ghost zones)
if (iDoReading)
{
......@@ -1545,7 +1551,20 @@ avtBoxlibFileFormat::PopulateDatabaseMetaData(avtDatabaseMetaData *md)
}
mesh->blockNames = blockPieceNames;
#if BL_SPACEDIM==2
mesh->meshCoordType = AVT_ZR;
// coordSys == 0 <- XYZ
// coordSys == 1 <- ZR
// coordSys == 2 <- r-theta
if (coordSys == 1)
{
mesh->meshCoordType = AVT_ZR;
mesh->xLabel = "R-Axis";
mesh->yLabel = "Z-Axis";
}
else if (coordSys == 2)
{
avtCallback::IssueWarning("The boxlib reader does not support "
"r-theta meshes");
}
#endif
md->Add(mesh);
md->AddGroupInformation(nLevels, totalPatches, groupIds);
......
......@@ -79,6 +79,9 @@ class VisMF;
// Removed GetType, as it is redefined in derived classes
// avtBoxlib2DFileFormat and avtBoxlib3DFileFormat.
//
// Hank Childs, Wed Oct 8 16:56:47 PDT 2008
// Add data member for coordinate system.
//
// ****************************************************************************
class avtBoxlibFileFormat : public avtSTMDFileFormat
......@@ -120,6 +123,7 @@ class avtBoxlibFileFormat : public avtSTMDFileFormat
std::string rootPath;
int nLevels;
int coordSys;
std::vector<int> patchesPerLevel;
// These entries are per patch.
std::vector<double> xMin;
......
......@@ -1123,6 +1123,10 @@ QvisExpressionsWindow::displayAllVarsChanged()
//
// Sean Ahern, Wed Sep 10 12:44:22 EDT 2008
// Added support for recenter with optional argument.
//
// Hank Childs, Wed Oct 8 16:31:05 PDT 2008
// Make pos_cmfe fillin be more comprehensible.
//
// ****************************************************************************
void
......@@ -1151,7 +1155,7 @@ QvisExpressionsWindow::insertFunction(int id)
}
else if (str == "pos_cmfe")
{
definitionEdit->insert("(<filename:var>, <meshname>, <default-var>)");
definitionEdit->insert("(<filename:var>, <meshname>, <fill-var-for-uncovered-regions>)");
doParens = false;
}
else if (str == "symm_point")
......
......@@ -433,6 +433,9 @@ QvisSliceWindow::CreateWindowContents()
// Dave Pugmire, Thu Oct 18 08:25:42 EDT 2007
// Added theta-phi method of editing the plane normal.
//
// Hank Childs, Thu Oct 9 11:13:19 PDT 2008
// Update test for what is "orthogonal" (theta-phi is not!).
//
// ****************************************************************************
void
......@@ -449,7 +452,9 @@ QvisSliceWindow::UpdateWindow(bool doAll)
if (doAll)
UpdateMeshNames();
bool orthogonal = sliceAtts->GetAxisType() != SliceAttributes::Arbitrary;
bool orthogonal = sliceAtts->GetAxisType() != SliceAttributes::Arbitrary &&
sliceAtts->GetAxisType() != SliceAttributes::ThetaPhi;
// Loop through all the attributes and do something for
// each of them that changed. This function is only responsible
......
......@@ -71,6 +71,8 @@
#include <DebugStream.h>
#include <TimingsManager.h>
#include <snprintf.h>
using std::vector;
......@@ -1852,6 +1854,9 @@ avtSliceFilter::ReleaseData(void)
// Kathleen Bonnell, Thu Mar 2 14:26:06 PST 2006
// Set ZonesSplit.
//
// Hank Childs, Thu Oct 9 11:01:14 PDT 2008
// Change the axis names for arbitrary slices.
//
// ****************************************************************************
void
......@@ -1899,7 +1904,7 @@ avtSliceFilter::UpdateDataObjectInfo(void)
outAtts.SetZUnits(inAtts.GetXUnits());
}
}
if ((normal[0] == 0.) && (normal[1] != 0.) && (normal[2] == 0.))
else if ((normal[0] == 0.) && (normal[1] != 0.) && (normal[2] == 0.))
{
if ((up[0] != 0.) && (up[1] == 0.) && (up[2] == 0.))
{
......@@ -1920,7 +1925,7 @@ avtSliceFilter::UpdateDataObjectInfo(void)
outAtts.SetZUnits(inAtts.GetYUnits());
}
}
if ((normal[0] == 0.) && (normal[1] == 0.) && (normal[2] != 0.))
else if ((normal[0] == 0.) && (normal[1] == 0.) && (normal[2] != 0.))
{
if ((up[0] != 0.) && (up[1] == 0.) && (up[2] == 0.))
{
......@@ -1935,6 +1940,46 @@ avtSliceFilter::UpdateDataObjectInfo(void)
// Pretty much a no-op
}
}
else
{
double normal_mag = sqrt(normal[0]*normal[0] +
normal[1]*normal[1] + normal[2]*normal[2]);
double nn[3];
if (normal_mag > 0.)
{
nn[0] = normal[0] / normal_mag;
nn[1] = normal[1] / normal_mag;
nn[2] = normal[2] / normal_mag;
}
double up_mag = sqrt(up[0]*up[0] + up[1]*up[1] + up[2]*up[2]);
double un[3];
if (up_mag > 0.)
{
un[0] = up[0] / up_mag;
un[1] = up[1] / up_mag;
un[2] = up[2] / up_mag;
}
char ylabel[2048];
SNPRINTF(ylabel, 2048, "(%.2f,%.2f,%.2f)-Axis", un[0],un[1],un[2]);
outAtts.SetYLabel(ylabel);
double cross[3];
cross[0] = un[1]*nn[2] - un[2]*nn[1];
cross[1] = un[2]*nn[0] - un[0]*nn[2];
cross[2] = un[0]*nn[1] - un[1]*nn[0];
double cross_mag = sqrt(cross[0]*cross[0] + cross[1]*cross[1] +
cross[2]*cross[2]);
if (cross_mag > 0.)
{
cross[0] /= cross_mag;
cross[1] /= cross_mag;
cross[2] /= cross_mag;
}
char xlabel[2048];
SNPRINTF(xlabel, 2048, "(%.2f,%.2f,%.2f)-Axis", cross[0], cross[1],
cross[2]);
outAtts.SetXLabel(xlabel);
}
}
}
......
......@@ -157,8 +157,7 @@ class avtSliceFilter : public avtPluginDataTreeIterator
vtkMatrix4x4 *invTrans;
vtkMatrix4x4 *origTrans;
virtual avtContract_p
ModifyContract(avtContract_p);
virtual avtContract_p ModifyContract(avtContract_p);
virtual vtkDataSet *ExecuteData(vtkDataSet *, int, std::string);
virtual void PreExecute(void);
virtual void PostExecute(void);
......
......@@ -54,6 +54,7 @@
#include <vtkThreshold.h>
#include <vtkUnstructuredGrid.h>
#include <avtCallback.h>
#include <avtDataAttributes.h>
#include <avtIntervalTree.h>
#include <avtMetaData.h>
......@@ -787,6 +788,9 @@ avtThresholdFilter::UpdateDataObjectInfo(void)
// Removes any variable from the threshold list that's not a scalar or not in
// the input. Also determines whether or not default variable is a scalar.
//
// Hank Childs, Thu Oct 9 09:24:26 PDT 2008
// Issue a better error message for non-scalars.
//
// *****************************************************************************
void
......@@ -817,7 +821,21 @@ avtThresholdFilter::PreExecute(void)
}
if (inputVarNum >= inputVarCount)
{
atts.SetDefaultVarIsScalar(false);
static bool issuedWarning = false;
if (!issuedWarning)
{
avtCallback::IssueWarning("The threshold operator was asked to "
"threshold by a non-scalar. Only scalars are supported "
"for thresholding. You can overcome this by using "
"expressions. For example, if you would like to threshold "
"using a vector, then you can define an expression for "
"vector magnitude and threshold by that. This warning "
"will only be issued once per VisIt session.");
issuedWarning = true;
}
}
stringVector curListedVarNames = atts.GetListedVarNames();
intVector curZonePortions = atts.GetZonePortions();
......
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