Commit c21f24ef authored by hrchilds's avatar hrchilds

Merge RC to trunk, picking up changes for non-compliant files

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@11446 18c085ea-50e0-402c-830e-de6fd14e8384
parent cb7a6cbd
......@@ -68,6 +68,7 @@
#include <ImproperUseException.h>
#include <InvalidFilesException.h>
#include <InvalidDBTypeException.h>
#include <NonCompliantFileException.h>
#include <TimingsManager.h>
#if !defined(_WIN32)
......@@ -259,6 +260,12 @@ avtDatabaseFactory::SetDefaultFileOpenOptions(const FileOpenOptions &opts)
// Brad Whitlock, Wed Mar 10 10:50:00 PST 2010
// Rethrow a caught ImproperUseException so its message won't be changed.
//
// Hank Childs, Thu May 20 14:32:06 PDT 2010
// Add support for NonCompliantFileExceptions, a new type which should
// immediately issue their warnings to the user. You use these when
// you know that you have a file of a certain type, but that type is
// a non-compliant file.
//
// ****************************************************************************
avtDatabase *
......@@ -352,6 +359,11 @@ avtDatabaseFactory::FileList(DatabasePluginManager *dbmgr,
nBlocks, forceReadAllCyclesAndTimes,
treatAllDBsAsTimeVarying, false);
}
CATCH(NonCompliantFileException)
{
rv = NULL;
RETHROW;
}
CATCH(ImproperUseException)
{
rv = NULL;
......@@ -434,6 +446,11 @@ avtDatabaseFactory::FileList(DatabasePluginManager *dbmgr,
delete dbtmp;
}
}
CATCH(NonCompliantFileException)
{
rv = NULL;
RETHROW;
}
CATCHALL
{
}
......@@ -538,13 +555,17 @@ avtDatabaseFactory::FileList(DatabasePluginManager *dbmgr,
nBlocks, forceReadAllCyclesAndTimes,
treatAllDBsAsTimeVarying, true);
}
CATCH(NonCompliantFileException)
{
rv = NULL;
RETHROW;
}
CATCHALL
{
rv = NULL;
}
ENDTRY
}
return rv;
}
......
......@@ -67,6 +67,7 @@ Exceptions/Database/InvalidSourceException.C
Exceptions/Database/InvalidTimeStepException.C
Exceptions/Database/InvalidVariableException.C
Exceptions/Database/InvalidZoneTypeException.C
Exceptions/Database/NonCompliantFileException.C
Exceptions/Database/PointerNotInCacheException.C
Exceptions/Database/SiloException.C
Exceptions/Pipeline/AbortException.C
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2010, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400124
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
// ************************************************************************* //
// NonCompliantFileException.C //
// ************************************************************************* //
#include <stdio.h> // for sprintf
#include <NonCompliantFileException.h>
// ****************************************************************************
// Method: NonCompliantFileException constructor
//
// Arguments:
// dbtype The type of file.
// err A specific message regarding why the file is noncompliant.
//
// Programmer: Hank Childs
// Creation: May 20, 2010
//
// ****************************************************************************
NonCompliantFileException::NonCompliantFileException(const char *dbtype,
std::string err)
{
char t_str[1024];
sprintf(t_str, "VisIt believes this is a \"%s\" file. Further, the reader"
" for this format believes this is a non-compliant file of "
"this type. Its description of non-compliance is: \"%s\"."
" If you believe this file is of a different type, try to "
"open this file with that type with the \"Open file as "
"type\" option under File->Open.", dbtype, err.c_str());
msg = t_str;
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2010, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400124
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
// ************************************************************************* //
// NonCompliantFileException.h //
// ************************************************************************* //
#ifndef NON_COMPLIANT_FILE_EXCEPTION_H
#define NON_COMPLIANT_FILE_EXCEPTION_H
#include <avtexception_exports.h>
#include <DatabaseException.h>
// ****************************************************************************
// Class: NonCompliantFileException
//
// Purpose:
// The exception thrown when the database type is correct, but the file
// is not compliant with that type.
//
// Programmer: Hank Childs
// Creation: May 20, 2010
//
// ****************************************************************************
class AVTEXCEPTION_API NonCompliantFileException : public DatabaseException
{
public:
NonCompliantFileException(const char *, std::string);
virtual ~NonCompliantFileException() VISIT_THROW_NOTHING {;};
};
#endif
......@@ -78,6 +78,7 @@
#include <InvalidFilesException.h>
#include <InvalidVariableException.h>
#include <InvalidDBTypeException.h>
#include <NonCompliantFileException.h>
#include <TimingsManager.h>
#ifdef PARALLEL
......@@ -307,7 +308,7 @@ avtNek5000FileFormat::avtNek5000FileFormat(const char *filename)
// ****************************************************************************
// Method: avtNek5000FileFormat::ParseNekFileHeader
// Method: avtNek5000FileFormat::ParseMetaDataFile
//
// Purpose:
// This method is called as part of initialization. It parses the text
......@@ -419,8 +420,8 @@ avtNek5000FileFormat::ParseMetaDataFile(const char *filename)
}
else
{
EXCEPTION1(InvalidDBTypeException,
"Value following type: \"ascii\" or \"binary\" or \"binary6\"" );
EXCEPTION2(NonCompliantFileException, "Nek",
"Value following \"type\" must be \"ascii\" or \"binary\" or \"binary6\"" );
}
}
else if (STREQUAL("numoutputdirs:", tag.c_str())==0)
......@@ -447,14 +448,14 @@ avtNek5000FileFormat::ParseMetaDataFile(const char *filename)
else
{
SNPRINTF(buf, 2048, "Error parsing file. Unknown tag %s", tag.c_str());
EXCEPTION1(InvalidDBTypeException, buf);
EXCEPTION2(NonCompliantFileException, "Nek", buf);
}
}
//Do a little consistency checking before moving on
if (fileTemplate == "")
{
EXCEPTION1(InvalidDBTypeException,
EXCEPTION2(NonCompliantFileException, "Nek",
"A tag called filetemplate: must be specified" );
}
f.close();
......@@ -550,8 +551,8 @@ avtNek5000FileFormat::ParseNekFileHeader()
if (!f.is_open())
{
char msg[1024];
SNPRINTF(msg, 1024, "Could not open file %s.", filename);
EXCEPTION1(InvalidFilesException, msg);
SNPRINTF(msg, 1024, "Could not open file %s, which should exist according to header file %s.", blockfilename, filename);
EXCEPTION2(NonCompliantFileException, "Nek", msg);
}
// Determine the type (ascii or binary)
......@@ -731,11 +732,15 @@ avtNek5000FileFormat::ParseNekFileHeader()
// Add support for legacy passive scalars where trailing white spaces
// followed by numbers can get confused for numbers of passive scalars.
//
// Hank Childs, Thu May 20 13:59:07 PDT 2010
// Issue a warning when there are no coordinates.
//
// ****************************************************************************
void avtNek5000FileFormat::ParseFieldTags(ifstream &f)
{
int numSpacesInARow = 0;
bool foundCoordinates = false;
while (f.tellg() < iHeaderSize)
{
char c = f.get();
......@@ -748,7 +753,10 @@ void avtNek5000FileFormat::ParseFieldTags(ifstream &f)
}
numSpacesInARow = 0;
if (c == 'X' || c == 'Y' || c == 'Z')
{
foundCoordinates = true;
continue;
}
else if (c == 'U')
bHasVelocity = true;
else if (c == 'P')
......@@ -780,6 +788,12 @@ void avtNek5000FileFormat::ParseFieldTags(ifstream &f)
else
break;
}
if (!foundCoordinates)
{
EXCEPTION2(NonCompliantFileException, "Nek",
"The first time step in a Nek file must contain a mesh");
}
}
......@@ -904,7 +918,7 @@ avtNek5000FileFormat::ReadBlockLocations()
char msg[1024];
SNPRINTF(msg, 1024, "Could not open file \"%s\" to read block "
"locations.", blockfilename);
EXCEPTION1(InvalidDBTypeException, msg);
EXCEPTION2(NonCompliantFileException, "Nek", msg);
}
delete[] blockfilename;
......@@ -927,7 +941,7 @@ avtNek5000FileFormat::ReadBlockLocations()
if (sum != iNumBlocks)
{
EXCEPTION1(InvalidDBTypeException,
EXCEPTION2(NonCompliantFileException, "Nek",
"Sum of blocks per file does not equal total number of blocks");
}
......@@ -2073,12 +2087,12 @@ avtNek5000FileFormat::GetFileName(int rawTimestep, int pardir, char *outFileName
if (!bParFormat && nPrintfTokens != 1)
{
EXCEPTION1(ImproperUseException,
EXCEPTION2(NonCompliantFileException, "Nek",
"The filetemplate tag must receive only one printf token for serial Nek files.");
}
else if (bParFormat && (nPrintfTokens < 2 || nPrintfTokens > 3))
{
EXCEPTION1(ImproperUseException,
EXCEPTION2(NonCompliantFileException, "Nek",
"The filetemplate tag must receive either 2 or 3 printf tokens for parallel Nek files.");
}
int len;
......
......@@ -15,6 +15,7 @@
<p><b><font size="4">Bugs fixed in version 2.0.1</font></b></p>
<ul>
<li>A bug was fixed where number of passive scalars in legacy Nek files was being misinterpreted.</li>
<li>If a non-compliant Nek file is encountered, VisIt is better at reporting to the user why the file is non-compliant.</li>
<li>It no longer crashes the GUI when you delete the last variable in the Threshold operator's attributes window.</li>
</ul>
<p><b><font size="4">Enhancements in version 2.0.1</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