Commit cae680f6 authored by hrchilds's avatar hrchilds
Browse files

Add -safe mode.

Also fix sscanf bug with Silo.
Also add Hank's relnotes for 2.2.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@13386 18c085ea-50e0-402c-830e-de6fd14e8384
parent e4a7aa03
......@@ -65,6 +65,7 @@ LightList avtCallback::lightList;
bool avtCallback::nowinMode = false;
bool avtCallback::swRendering = false;
bool avtCallback::safeMode = false;
UpdatePlotAttributesCallback avtCallback::updatePlotAttributesCallback = NULL;
void *avtCallback::updatePlotAttributesCallbackArgs
......
......@@ -101,6 +101,9 @@ typedef void (*ResetTimeoutCallback)(void *, int);
// Hank Childs, Tue Sep 5 10:51:08 PDT 2006
// Added ResetTimeout callback.
//
// Hank Childs, Fri Dec 31 11:45:48 PST 2010
// Add a GetSafeMode callback.
//
// ****************************************************************************
class PIPELINE_API avtCallback
......@@ -153,6 +156,9 @@ class PIPELINE_API avtCallback
ResetTimeoutCallback, void *);
static void ResetTimeout(int);
static void EnableSafeMode(void) { safeMode = true; };
static bool GetSafeMode(void) { return safeMode; };
protected:
static WarningCallback warningCallback;
static void *warningCallbackArgs;
......@@ -165,6 +171,7 @@ class PIPELINE_API avtCallback
static bool nowinMode;
static bool swRendering;
static bool safeMode;
static UpdatePlotAttributesCallback
updatePlotAttributesCallback;
......
......@@ -1252,35 +1252,6 @@ GetDataRange(vtkDataSet *ds, double *de, const char *vname,
}
// ****************************************************************************
// Function: visitIsFinite
//
// Purpose:
// Determines if a given number is finite.
//
// Programmer: Hank Childs
// Creation: September 19, 2010
//
// Modifications:
// Kathleen Bonnell, Mon Sep 20 10:40:15 MST 2010
// Use _finite on Windows.
//
// ****************************************************************************
template <class T>
inline bool visitIsFinite(T t)
{
#ifndef _WIN32
#ifdef HAVE_ISFINITE
return isfinite(t);
#endif
#else
return _finite(t);
#endif
return true;
}
// ****************************************************************************
// Function: GetDataScalarRange
//
......
......@@ -51,6 +51,8 @@
#include <vector>
#include <string>
#include <visit-config.h>
class vtkDataArray;
......@@ -128,6 +130,9 @@ class vtkDataArray;
// Hank Childs, Fri May 21 11:22:21 CDT 2010
// Added CCalculateHistogram.
//
// Hank Childs, Sat Jan 1 17:35:23 PST 2011
// Moved visitIsFinite to header, so other classes can use it.
//
// ****************************************************************************
//
......@@ -247,6 +252,35 @@ typedef struct
} CalculateHistogramArgs;
// ****************************************************************************
// Function: visitIsFinite
//
// Purpose:
// Determines if a given number is finite.
//
// Programmer: Hank Childs
// Creation: September 19, 2010
//
// Modifications:
// Kathleen Bonnell, Mon Sep 20 10:40:15 MST 2010
// Use _finite on Windows.
//
// ****************************************************************************
template <class T>
inline bool visitIsFinite(T t)
{
#ifndef _WIN32
#ifdef HAVE_ISFINITE
return isfinite(t);
#endif
#else
return _finite(t);
#endif
return true;
}
#endif
......@@ -42,15 +42,21 @@
#include <avtDatasetVerifier.h>
#include <vtkCellArray.h>
#include <vtkCellData.h>
#include <vtkDataSet.h>
#include <vtkFloatArray.h>
#include <vtkPointData.h>
#include <vtkPoints.h>
#include <vtkPointSet.h>
#include <vtkPolyData.h>
#include <vtkRectilinearGrid.h>
#include <vtkStructuredGrid.h>
#include <vtkUnstructuredGrid.h>
#include <vtkUnsignedCharArray.h>
#include <avtCallback.h>
#include <avtCommonDataFunctions.h>
#include <DebugStream.h>
......@@ -167,6 +173,9 @@ avtDatasetVerifier::VerifyDatasets(int nlist, vtkDataSet **list,
// No longer worry about type conversion. That is the transform managers
// job now.
//
// Hank Childs, Fri Dec 31 12:07:05 PST 2010
// Add support for safe mode.
//
// ****************************************************************************
void
......@@ -227,6 +236,218 @@ avtDatasetVerifier::VerifyDataset(vtkDataSet *ds, int dom)
cell_var->GetName());
}
}
int dims[3];
bool didDims = false;
if (ds->GetDataObjectType() == VTK_RECTILINEAR_GRID)
{
vtkRectilinearGrid *rg = (vtkRectilinearGrid *) ds;
rg->GetDimensions(dims);
didDims = true;
}
if (ds->GetDataObjectType() == VTK_STRUCTURED_GRID)
{
vtkStructuredGrid *sg = (vtkStructuredGrid *) ds;
sg->GetDimensions(dims);
didDims = true;
}
if (didDims)
{
int dimsnpts = (dims[0]*dims[1]*dims[2]);
int dimsncells = 1;
if (dims[0] > 1)
dimsncells *= dims[0]-1;
if (dims[1] > 1)
dimsncells *= dims[1]-1;
if (dims[2] > 1)
dimsncells *= dims[2]-1;
if (dimsnpts != nPts)
{
if (! issuedWarningForVarMismatch)
{
char msg[1024];
sprintf(msg, "Your dimensions were declared to be %d x %d x %d, "
"which should mean %d points. But your point "
"variables have %d points. This is an unrecoverable "
"error.", dims[0], dims[1], dims[2], dimsnpts, nPts);
avtCallback::IssueWarning(msg);
issuedWarningForVarMismatch = true;
}
}
if (dimsncells != nCells)
{
if (! issuedWarningForVarMismatch)
{
char msg[1024];
sprintf(msg, "Your dimensions were declared to be %d x %d x %d, "
"which should mean %d cells. But your cell "
"variables have %d cells. This is an unrecoverable "
"error.", dims[0], dims[1], dims[2], dimsncells, nCells);
avtCallback::IssueWarning(msg);
issuedWarningForVarMismatch = true;
}
}
}
if (avtCallback::GetSafeMode())
{
issuedSafeModeWarning = false;
if (ds->GetDataObjectType() == VTK_RECTILINEAR_GRID)
{
vtkRectilinearGrid *rg = (vtkRectilinearGrid *) ds;
CheckArray(dom, rg->GetXCoordinates(), "X-coordinates");
CheckArray(dom, rg->GetYCoordinates(), "Y-coordinates");
CheckArray(dom, rg->GetZCoordinates(), "Z-coordinates");
}
else if (ds->GetDataObjectType() == VTK_STRUCTURED_GRID)
{
vtkStructuredGrid *sg = (vtkStructuredGrid *) ds;
CheckArray(dom, sg->GetPoints()->GetData(), "Coordinates");
}
else if (ds->GetDataObjectType() == VTK_UNSTRUCTURED_GRID)
{
vtkUnstructuredGrid *ug = (vtkUnstructuredGrid *) ds;
CheckArray(dom, ug->GetPoints()->GetData(), "Coordinates");
CheckConnectivity(dom, ug->GetNumberOfPoints(), ug->GetCells(),
"Cells");
}
else if (ds->GetDataObjectType() == VTK_POLY_DATA)
{
vtkPolyData *pd = (vtkPolyData *) ds;
CheckArray(dom, pd->GetPoints()->GetData(), "Coordinates");
CheckConnectivity(dom, pd->GetNumberOfPoints(), pd->GetVerts(),
"Vertex Cells");
CheckConnectivity(dom, pd->GetNumberOfPoints(), pd->GetLines(),
"Line Cells");
CheckConnectivity(dom, pd->GetNumberOfPoints(), pd->GetPolys(),
"Polygon Cells");
CheckConnectivity(dom, pd->GetNumberOfPoints(), pd->GetStrips(),
"Triangle Strip Cells");
}
for (int i = 0 ; i < 2 ; i++)
{
vtkDataSetAttributes *atts = NULL;
if (i == 0)
atts = ds->GetCellData();
else
atts = ds->GetPointData();
int narr = atts->GetNumberOfArrays();
for (int j = 0 ; j < narr ; j++)
{
vtkDataArray *arr = atts->GetArray(j);
const char *name = arr->GetName();
if (name == NULL)
{
if (i == 0)
name = "Unnamed Cell Var";
else
name = "Unnamed Point Var";
}
CheckArray(dom, arr, name);
}
}
}
}
// ****************************************************************************
// Method: avtDatasetVerifier::CheckArray
//
// Purpose:
// Checks to see if an array contains any NaNs or infs.
//
// Programmer: Hank Childs
// Creation: January 1, 2011
//
// ****************************************************************************
void
avtDatasetVerifier::CheckArray(int dom, vtkDataArray *arr, const char *name)
{
int ncomps = arr->GetNumberOfComponents();
int ntups = arr->GetNumberOfTuples();
for (int i = 0 ; i < ntups ; i++)
{
double *vals = arr->GetTuple(i);
for (int j = 0 ; j < ncomps ; j++)
{
if (!visitIsFinite(vals[j]))
{
if (!issuedSafeModeWarning)
{
char msg[1024];
if (ncomps > 1)
sprintf(msg, "In domain %d, array \"%s\" at location (%d, %d), "
"you have a non-finite value (%f). Note that "
"only the first error encountered is reported.",
dom, name, i, j, vals[j]);
else
sprintf(msg, "In domain %d, array \"%s\" at location %d, "
"you have a non-finite value (%f). Note that "
"only the first error encountered is reported.",
dom, name, i, vals[j]);
avtCallback::IssueWarning(msg);
issuedSafeModeWarning = true;
}
vals[j] = 0.;
}
}
}
}
// ****************************************************************************
// Method: avtDatasetVerifier::CheckConnectivity
//
// Purpose:
// Checks to see if a connectivity array is invalid.
//
// Programmer: Hank Childs
// Creation: January 1, 2011
//
// ****************************************************************************
void
avtDatasetVerifier::CheckConnectivity(int dom, int nTotalPts, vtkCellArray *arr,
const char *name)
{
int numEntries = arr->GetNumberOfConnectivityEntries();
vtkIdType *start_ptr = arr->GetPointer();
vtkIdType *ptr = start_ptr;
int ncells = arr->GetNumberOfCells();
for (int i = 0 ; i < ncells ; i++)
{
int npts = *ptr;
if ((ptr+npts-start_ptr) > numEntries)
{
char msg[1024];
sprintf(msg, "In domain %d, connectivity values go beyond declared "
"allocation. Unrecoverable error.", dom);
avtCallback::IssueWarning(msg);
return;
}
ptr++;
for (int j = 0 ; j < npts ; j++)
{
if (*ptr < 0 || *ptr >= nTotalPts)
{
if (!issuedSafeModeWarning)
{
char msg[1024];
sprintf(msg, "In domain %d, your connectivity array (%s) "
"has a bad value. Cell %d references point %d "
"and the maximum value is %d. Note that "
"only the first error encountered is reported.",
dom, name, i, *ptr, nTotalPts);
avtCallback::IssueWarning(msg);
issuedSafeModeWarning = true;
}
*ptr = 0;
}
ptr++;
}
}
}
......
......@@ -47,6 +47,7 @@
#include <avtDataTree.h>
class vtkCellArray;
class vtkDataArray;
class vtkDataSet;
class vtkDataSetAttributes;
......@@ -81,6 +82,9 @@ class vtkDataSetAttributes;
// Hank Childs, Tue Jul 5 16:22:56 PDT 2005
// Add variable name to IssueWarning call.
//
// Hank Childs, Sat Jan 1 12:42:28 PST 2011
// Add methods for -safe mode.
//
// ****************************************************************************
class PIPELINE_API avtDatasetVerifier
......@@ -93,8 +97,11 @@ class PIPELINE_API avtDatasetVerifier
protected:
bool issuedWarningForVarMismatch;
bool issuedSafeModeWarning;
void VerifyDataset(vtkDataSet *, int);
void CheckArray(int, vtkDataArray *, const char *);
void CheckConnectivity(int, int, vtkCellArray *, const char *);
void CorrectVarMismatch(vtkDataArray *, vtkDataSetAttributes*, int);
void IssueVarMismatchWarning(int, int, bool, int, const char *);
......
......@@ -2437,10 +2437,19 @@ avtSiloFileFormat::ReadCSGmeshes(DBfile *dbfile,
}
 
// ****************************************************************************
// Function: Get the material indices (not the same as matnos) to which a
// subsetting variable is restricted.
// Function: GetRestrictedMaterialIndices
//
// Created: Mark C. Miller, Mon Aug 30 01:32:15 PDT 2010
// Purpose:
// Get the material indices (not the same as matnos) to which a
// subsetting variable is restricted.
//
// Programmer: Mark C. Miller
// Creation: August 30, 2010
//
// Modifications:
//
// Hank Childs, Sat Jan 1 15:11:10 PST 2011
// Fix sscanf problem from compiler warning.
//
// ****************************************************************************
 
......@@ -2502,7 +2511,7 @@ GetRestrictedMaterialIndices(const avtDatabaseMetaData *md, const char *const va
{
int matno;
char matname[256];
int nmatches = sscanf(mmd->materialNames[j].c_str(), "%d %s", &matno, &matname);
int nmatches = sscanf(mmd->materialNames[j].c_str(), "%d %s", &matno, matname);
debug3 << " matno=" << matno << ", matname=\"" << matname << "\"";
if (nmatches == 1) // have matno only
{
......
......@@ -1788,6 +1788,10 @@ Engine::ProcessInput()
//
// Mark C. Miller, Tue Oct 19 21:59:16 PDT 2010
// Predicated some cerr warnings about timeout on !PAR_Rank()
//
// Hank Childs, Sat Jan 1 14:17:58 PST 2011
// Add "-safe" flag.
//
// ****************************************************************************
void
......@@ -1975,6 +1979,10 @@ Engine::ProcessCommandLine(int argc, char **argv)
avtVariableCache::SetVTKDebugMode(true);
vtkDebugStream::FrequentEventsFilter(true);
}
else if (strcmp(argv[i], "-safe") == 0)
{
avtCallback::EnableSafeMode();
}
else if (strcmp(argv[i], "-lb-block") == 0)
{
LoadBalancer::SetScheme(LOAD_BALANCE_CONTIGUOUS_BLOCKS_TOGETHER);
......
......@@ -35,12 +35,14 @@ enhancements and bug-fixes that were added to this release.</p>
<li>The Selection window was enhanced so users can load selections from a file and save selections to a file. This lets users use precomputed selections for analyses without having to recreate selections from a plot.</li>
<li>The Movie wizard was enhanced so you can provide a stride, enabling every Nth frame to be saved.</li>
<li>VisIt's filters can now cache intermediate results for later use. Contours and streamlines should be faster after the first execution.</li>
<li>Lineouts can now be directly calculated (i.e. without having to make a Pseudocolor plot to extract a Lineout from). You can access this feature by making a Curve plot of a scalar listed under operators/Lineout.</li>
<li>VisIt now has a "-safe" mode. This mode will tell you if your data has NaNs, infs, or bad connectivity. Access this mode by adding "-safe" to VisIt's invocation. (This mode is not the default because it incurs a performance penalty.)</li>
</ul>
<a name="Advanced_Features"></a>
<p><b><font size="4">Advanced features added in version 2.2</font></b></p>
<ul>
<li></li>
<li>The Y-axis title is now vertically oriented for 2D plots.</li>
<li></li>
<li></li>
<li></li>
......@@ -70,7 +72,7 @@ enhancements and bug-fixes that were added to this release.</p>
<li>The Streamline plot now reports progress as it executes.</li>
<li>The Streamline plot now has a pathline option that allows the velocity field to vary over time.</li>
<li>The Spreadsheet plot can now display curves.</li>
<li></li>
<li>The ParallelCoordinates plot now correctly display the extents of the data in the case where cells are removed by operators.</li>
<li></li>
<li></li>
<li></li>
......@@ -80,7 +82,7 @@ enhancements and bug-fixes that were added to this release.</p>
<p><b><font size="4">Changes to VisIt's operators in version 2.2</font></b></p>
<ul>
<li>IndexSelect now works with BOV files.</li>
<li></li>
<li>The InverseGhostZone operator now provides individual controls over which types of ghost zones to display (duplicated zones at the boundary, coarse zones from an AMR simulation, etc).</li>
<li></li>
<li></li>
<li></li>
......@@ -146,9 +148,8 @@ enhancements and bug-fixes that were added to this release.</p>
<a name="Dev_changes"></a>
<p><b><font size="4">Changes for VisIt developers in version 2.2</font></b></p>
<ul>
<li></li>
<li></li>
<li></li>
<li>xmledit, xml2info and xml2avt all now support expression-creating-operators.</li>
<li>The avtGradientExpression module was re-factored so that other modules can access these gradients without creating a mini-pipeline.</li>
<li></li>
<li></li>
<li></li>
......
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