Commit 08c6b69e authored by js9's avatar js9
Browse files

Adding saved knowledge of which plugin was used to open a given file.

This will force visit to re-use the same plugin when re-opening the file.
This is sometimes cleared, e.g. when the file is closed.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@9716 18c085ea-50e0-402c-830e-de6fd14e8384
parent 53681a5e
......@@ -253,6 +253,10 @@ ViewerFileServer::~ViewerFileServer()
//
// Mark C. Miller, Wed Jun 17 14:27:08 PDT 2009
// Replaced CATCHALL(...) with CATCHALL.
//
// Jeremy Meredith, Fri Jan 29 10:27:29 EST 2010
// Added knowledge of what plugin was used to open a file. Clear it here.
//
// ****************************************************************************
void
......@@ -292,6 +296,7 @@ ViewerFileServer::CloseServers()
delete fpos->second;
}
fileMetaData.clear();
filePlugins.clear();
FileSILMap::iterator fpos2;
for (fpos2 = fileSIL.begin() ; fpos2 != fileSIL.end() ; fpos2++)
{
......@@ -632,12 +637,17 @@ ViewerFileServer::GetMetaDataForState(const std::string &host,
//
// Mark C. Miller, Mon Jun 22 15:16:05 PDT 2009
// Replaced typo of '%`' with '%1' in in an arg to QObject::tr().
//
// Jeremy Meredith, Fri Jan 29 10:27:29 EST 2010
// Added knowledge of what plugin was used to open a file. Use it to
// set a forced file type if one is not already set.
//
// ****************************************************************************
const avtDatabaseMetaData *
ViewerFileServer::GetMetaDataHelper(const std::string &host,
const std::string &db, int timeState, bool forceReadAllCyclesAndTimes,
const std::string &forcedFileType)
const std::string &forcedFileType_)
{
// Try and start a server if one does not exist.
NoFaultStartServer(host);
......@@ -662,6 +672,12 @@ ViewerFileServer::GetMetaDataHelper(const std::string &host,
TRY
{
std::string key(ComposeDatabaseName(host, db));
std::string forcedFileType(forcedFileType_);
if (forcedFileType == "" && filePlugins.count(key) > 0)
forcedFileType = filePlugins[key];
int t0 = visitTimer->StartTimer();
const avtDatabaseMetaData *md =
servers[host]->proxy->GetMetaData(db, timeState,
......@@ -675,7 +691,9 @@ ViewerFileServer::GetMetaDataHelper(const std::string &host,
if(md != NULL)
{
avtDatabaseMetaData *mdCopy = new avtDatabaseMetaData(*md);
// Cache the format we used for this file.
// (Don't add time state information to its name yet.)
filePlugins[key] = md->GetFileFormat();
//
// If the meta-data changes for each state, then cache
......@@ -683,10 +701,9 @@ ViewerFileServer::GetMetaDataHelper(const std::string &host,
// encoding the state into the name. Don't encode the state
// into the name though if we got it using ANY_STATEs
//
std::string key(ComposeDatabaseName(host, db));
if ((mdCopy->GetMustRepopulateOnStateChange() ||
GetTreatAllDBsAsTimeVarying()) &&
timeState != ANY_STATE)
if ((md->GetMustRepopulateOnStateChange() ||
GetTreatAllDBsAsTimeVarying()) &&
timeState != ANY_STATE)
{
char timeStateString[20];
SNPRINTF(timeStateString, 20, ":%d", timeState);
......@@ -696,6 +713,7 @@ ViewerFileServer::GetMetaDataHelper(const std::string &host,
//
// Add the metadata copy to the cache.
//
avtDatabaseMetaData *mdCopy = new avtDatabaseMetaData(*md);
fileMetaData[key] = mdCopy;
retval = mdCopy;
......@@ -2031,10 +2049,14 @@ ViewerFileServer::UpdateDBPluginInfo(const std::string &host)
// time-varying metadata. I also added code to delete the default database
// correlation for the database, if one exists.
//
// Jeremy Meredith, Fri Jan 29 10:25:16 EST 2010
// Added extra flag to tell ClearFile whether or not we want to
// forget which plugin was used to open it.
//
// ****************************************************************************
void
ViewerFileServer::ClearFile(const std::string &fullName)
ViewerFileServer::ClearFile(const std::string &fullName, bool forgetPlugin)
{
debug4 << "ViewerFileServer::Clearfile" << endl;
......@@ -2058,6 +2080,12 @@ ViewerFileServer::ClearFile(const std::string &fullName)
++mpos;
}
// Clear the plugin used for this file, if needed
if (forgetPlugin)
{
filePlugins.erase(fullName);
}
// Clear the SIL.
for(FileSILMap::iterator spos = fileSIL.begin(); spos != fileSIL.end();)
{
......@@ -2851,6 +2879,9 @@ ViewerFileServer::CreateNode(DataNode *parentNode,
// Brad Whitlock, Fri Oct 23 16:11:33 PDT 2009
// I added code to remove all metadata, SILs, and database correlations.
//
// Jeremy Meredith, Fri Jan 29 10:27:29 EST 2010
// Added knowledge of what plugin was used to open a file. Clear it here.
//
// ****************************************************************************
void
......@@ -2867,6 +2898,7 @@ ViewerFileServer::SetFromNode(DataNode *parentNode,
delete fpos->second;
}
fileMetaData.clear();
filePlugins.clear();
FileSILMap::iterator fpos2;
for (fpos2 = fileSIL.begin() ; fpos2 != fileSIL.end() ; fpos2++)
{
......
......@@ -184,6 +184,11 @@ class SILAttributes;
// Kathleen Bonnell, Thu Aug 14 16:13:41 PDT 2008
// Added SendFileOpenOptions.
//
// Jeremy Meredith, Fri Jan 29 10:25:16 EST 2010
// Added saved knowledge of what plugin was used to open a file.
// Added extra flag to tell ClearFile whether or not we want to
// forget which plugin was used to open it. In this case, we do not.
//
// ****************************************************************************
class ViewerFileServer : public ViewerServerManager
......@@ -286,7 +291,8 @@ public:
const stringVector &args);
void SendKeepAlives();
void ClearFile(const std::string &fullName);
void ClearFile(const std::string &fullName,
bool forgetPlugin);
void CloseFile(const std::string &host);
void CloseFile(const std::string &host,
const std::string &database);
......@@ -357,6 +363,7 @@ private:
ServerMap servers;
FileMetaDataMap fileMetaData;
std::map<std::string,std::string> filePlugins;
FileSILMap fileSIL;
DatabaseCorrelationList *databaseCorrelationList;
DBPluginInfoAttributes *dbPluginInfoAtts;
......
......@@ -4435,9 +4435,13 @@ ViewerSubject::CheckForNewStates()
// Made it use the generic integer argument for forceClose so as to not be
// misleading.
//
// Cyrus Harrison, Tue Apr 14 13:35:54 PDT 2009
// Changed the interface to ReplaceDatabase to support option for only
// replacing active plots.
// Cyrus Harrison, Tue Apr 14 13:35:54 PDT 2009
// Changed the interface to ReplaceDatabase to support option for only
// replacing active plots.
//
// Jeremy Meredith, Fri Jan 29 10:25:16 EST 2010
// Added extra flag to tell ClearFile whether or not we want to
// forget which plugin was used to open it. In this case, we do not.
//
// ****************************************************************************
......@@ -4532,7 +4536,7 @@ ViewerSubject::ReOpenDatabase()
// we open the database again, regardless of if we clear the cached one.
//
if (!isSim)
fileServer->ClearFile(hostDatabase);
fileServer->ClearFile(hostDatabase, false);
//
// Tell the compute engine to clear any cached information about the
......@@ -4826,6 +4830,11 @@ ViewerSubject::CloseDatabase()
//
// Mark C. Miller, Wed Apr 22 13:48:13 PDT 2009
// Changed interface to DebugStream to obtain current debug level.
//
// Jeremy Meredith, Fri Jan 29 10:25:16 EST 2010
// Added extra flag to tell ClearFile whether or not we want to
// forget which plugin was used to open it. In this case, we do not.
//
// ****************************************************************************
void
......@@ -4860,7 +4869,8 @@ ViewerSubject::HandleRequestMetaData()
// time-invariant and we don't know which it will be so we
// need to clear the metadata for the database so we will read
// it again at the right time state.
fs->ClearFile(hdb);
// Don't forget which plugin you used, though.
fs->ClearFile(hdb, false);
debug4 << mName << "Calling fs->GetMetaDataForState(" << host
<< ", " << db << ", " << ts << ", \"\")" << endl;
......
......@@ -6654,6 +6654,10 @@ ViewerWindowManager::GetDatabasesForWindows(const intVector &windowIds,
// Brad Whitlock, Wed Apr 30 10:10:43 PDT 2008
// Support for internationalization.
//
// Jeremy Meredith, Fri Jan 29 10:25:16 EST 2010
// Added extra flag to tell ClearFile whether or not we want to
// forget which plugin was used to open it. In this case, we DO.
//
// ****************************************************************************
void
......@@ -6685,7 +6689,8 @@ ViewerWindowManager::CloseDatabase(const std::string &dbName)
// the database that we're closing. This also deletes the database
// correlation.
//
fs->ClearFile(expandedDB);
// We want to forget which plugin was used here.
fs->ClearFile(expandedDB, true);
//
// Tell the mdserver to close its database so the next time we ask
......@@ -6815,6 +6820,10 @@ ViewerWindowManager::ReplaceDatabase(const EngineKey &key,
// Fixed call to CloseFile so it passes the name of the database to close
// on the mdserver so the database gets re-read.
//
// Jeremy Meredith, Fri Jan 29 10:25:16 EST 2010
// Added extra flag to tell ClearFile whether or not we want to
// forget which plugin was used to open it. In this case, we do not.
//
// ****************************************************************************
void
......@@ -6887,7 +6896,8 @@ ViewerWindowManager::CheckForNewStates(const std::string &hostDatabase)
// Clear all knowledge of the file from the cache
fs->CloseFile(host, db);
fs->ClearFile(hDB);
// Don't forget which plugin you used, though.
fs->ClearFile(hDB, false);
// Get the file's metadata again.
debug4 << mName << "Reopening " << hDB.c_str()
......
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