Commit 5285175c authored by pugmire's avatar pugmire

merge from 2.7RC

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@23401 18c085ea-50e0-402c-830e-de6fd14e8384
parent 60fd84de
......@@ -143,7 +143,8 @@ DDTManager::getSessionNC()
// Creation: Sun Dec 18, 2011
//
// Modifications:
//
// Jonathan Byrd, Fri Feb 1, 2013
// Update default location of DDT's socket (for DDT >= 4.0)
// ****************************************************************************
DDTSession*
......@@ -160,7 +161,21 @@ DDTManager::makeConnection()
QString filename = QFile::decodeName(getenv("DDT_SOCKET"));
if(filename.isEmpty())
filename = QDir::homePath() + "/.ddt/ddt.socket.tmp";
{
const char *userName = NULL;
userName = getenv("USER"); // Linux/Mac
if (userName == NULL)
userName = getenv("LOGNAME");
if (userName == NULL)
userName = getenv("USERNAME"); // Windows
if (userName == NULL)
return NULL; // Unable to get username
filename = QString("%0/allinea-%1/ddt.socket.tmp").arg(QDir::tempPath(),QString::fromLocal8Bit(userName));
}
if (!QFile::exists(filename))
return NULL; // Named socket does not exist, cannot connect to it
mSession = new DDTSession(filename);
if (mSession->connected())
......
......@@ -243,11 +243,12 @@ void
DDTSession::setFocusOnDomain(const int domain)
{
if (domain == -1)
{
Error(tr("No domain information, may not be a parallel simulation. DDT's focus will not be changed."));
if (mSocket->state() == QLocalSocket::ConnectedState)
}
else if (mSocket->state() == QLocalSocket::ConnectedState)
{
QString str = QString("[VisIt] focus domain %0\n").arg(domain);
const QString str = QString("[VisIt] focus domain %0\n").arg(QString::number(domain));
mSocket->write(str.toLatin1().constData());
mSocket->flush();
}
......@@ -257,6 +258,49 @@ DDTSession::setFocusOnDomain(const int domain)
}
}
// ****************************************************************************
// Method: DDTSession::setFocusOnElement
//
// Purpose:
// Sends a command over the socket instructing DDT to focus on a
// specific element within a domain
//
// Programmer: Jonathan Byrd
// Creation: Fri Feb 1, 2013
//
// Modifications:
//
// ****************************************************************************
void
DDTSession::setFocusOnElement(const int domain, const std::string& variable,
const int elementNumber, const std::string& value)
{
int safeDomain;
if (domain < 0) // No domain information. May be a 1-proc simulation
safeDomain = 0; // DDT assumes domain == MPI rank. Negative domain nonsensical.
else
safeDomain = domain;
if (elementNumber < 0)
Error(tr("Invalid element number (%0). DDT's focus will not be changed."));
else if (mSocket->state() == QLocalSocket::ConnectedState)
{
QString str = QString("[VisIt];;command=focus;;domain=%0;;variable=%1;;element=%2;;value=%3\n").arg(
QString::number(safeDomain),
QString::fromLatin1(variable.c_str()),
QString::number(elementNumber),
QString::fromLatin1(value.c_str()));
mSocket->write(str.toLatin1().constData());
mSocket->flush();
}
else
{
Error(tr("Cannot focus DDT on element %0 domain %1 as VisIt is not currently connected to DDT.").arg(
elementNumber, domain));
}
}
// ****************************************************************************
// Method: DDTSession::errorHandler
//
......@@ -349,6 +393,10 @@ DDTSession::readDataFromDDT()
}
}
}
else if (message=="exit")
{
GetViewerMethods()->Close();
}
else
Error(QString("Unrecognised message from DDT: %0").arg(message));
......
......@@ -55,7 +55,8 @@
// Creation: Sun Dec 18, 2011
//
// Modifications:
//
// Jonathan Byrd Fri Feb 1, 2013
// Add setFocusOnElement
// ****************************************************************************
class VIEWER_API DDTSession : public ViewerBase
......@@ -71,6 +72,8 @@ public:
QString statusString();
void setFocusOnDomain(const int domain);
void setFocusOnElement(const int domain, const std::string& variable,
const int elementNumber, const std::string& value);
signals:
void statusChanged();
......
......@@ -610,6 +610,7 @@ ViewerActionManager::ViewerActionManager(ViewerWindow *win) :
AddAction(new SetToolUpdateModeAction(win), ViewerRPC::SetToolUpdateModeRPC);
#ifdef HAVE_DDT
AddAction(new ReleaseToDDTAction(win), ViewerRPC::ReleaseToDDTRPC);
AddAction(new PlotDDTVispointVariablesAction(win), ViewerRPC::PlotDDTVispointVariablesRPC);
#endif
AddAction(new ToggleSpinModeAction(win), ViewerRPC::ToggleSpinModeRPC);
......
......@@ -2762,6 +2762,8 @@ ViewerQueryManager::ComputePick(PICK_POINT_INFO *ppi, const int dom,
// Check whether reusePickLetter flag in PickAttributes is set and
// do not advance pick designtor if it is.
//
// Jonathan Byrd, Fri Feb 1 2013
// Add DDT pick support for domain & element
// ****************************************************************************
void
......@@ -2798,13 +2800,37 @@ ViewerQueryManager::Pick(PICK_POINT_INFO *ppi, const int dom, const int el)
// instead of picking it directly
if (win->GetInteractionMode() == DDT_PICK)
{
const int targetDomain = pickAtts->GetDomain();
const int targetDomain = pickAtts->GetDomain();
const int targetElement = pickAtts->GetElementNumber();
const std::string targetVariable = pickAtts->GetActiveVariable();
char buff[256];
buff[0] = '\0';
for (int i=0; i<pickAtts->GetNumVarInfos(); ++i)
{
const PickVarInfo &info = pickAtts->GetVarInfo(i);
const doubleVector &values = info.GetValues();
// For the active variable only
if (info.GetVariableName() == targetVariable)
{
if (info.GetVariableType() == "scalar" && values.size()==1)
{
SNPRINTF(buff, 256, info.GetFloatFormat().c_str(), values[0]);
}
}
}
std::string targetValue(buff);
DDTSession* ddt = DDTManager::getInstance()->getSession();
if (ddt!=NULL)
ddt->setFocusOnDomain(targetDomain);
ddt->setFocusOnElement(targetDomain, targetVariable, targetElement, targetValue);
else
Error(tr("Cannot focus on domain %0, unable to connect to DDT").arg(targetDomain));
Error(tr("Cannot focus on domain %0, element %1 of %2: unable to connect to DDT").arg(
QString::number(targetDomain),
QString::number(targetElement),
QString::fromLatin1(targetVariable.c_str())));
}
else
{
......
......@@ -166,6 +166,7 @@
#include <avtColorTables.h>
#include <avtDatabaseMetaData.h>
#include <avtSimulationInformation.h>
#include <avtSimulationCommandSpecification.h>
#include <SharedDaemon.h>
#include <DDTManager.h>
......@@ -10129,6 +10130,21 @@ ViewerSubject::HandleMetaDataUpdated(const string &host,
{
wM->UpdateWindowInformation(WINDOWINFO_ANIMATION, -1);
wM->UpdateActions();
const EngineKey &key = plotList->GetEngineKey();
const avtDatabaseMetaData *md = ViewerEngineManager::Instance()->GetSimulationMetaData(key);
// If supported, send a command to the DDTSim simulation to (optionally)
// generate python commands to set up suitable plots for the current
// vispoint
if (md && key.IsSimulation())
{
for (int i=0; i<md->GetSimInfo().GetNumGenericCommands(); ++i)
if (md->GetSimInfo().GetGenericCommands(i).GetName()=="plot")
{
ViewerEngineManager::Instance()->SendSimulationCommand(
key, "plot", "");
}
}
}
}
CATCHALL
......@@ -11938,20 +11954,30 @@ void ViewerSubject::DDTConnect()
// Method: DDTFocus
//
// Purpose:
// Instructs DDT to focus on a specific domain
// Instructs DDT to focus on a specific domain & element
//
// Programmer: Jonathan Byrd
// Creation: December 18, 2011
//
// Modifications:
// Jonathan Byrd, Mon Feb 4, 2013
// Focus on variable & element within a domain, not just a domain
//
// ****************************************************************************
void ViewerSubject::DDTFocus()
{
const int domain = GetViewerState()->GetViewerRPC()->GetIntArg1();
const int domain = GetViewerState()->GetViewerRPC()->GetIntArg1();
const int element = GetViewerState()->GetViewerRPC()->GetIntArg2();
const std::string variable = GetViewerState()->GetViewerRPC()->GetStringArg1();
const std::string value = GetViewerState()->GetViewerRPC()->GetStringArg2();
DDTSession* ddt = DDTManager::getInstance()->getSession();
if (ddt!=NULL)
ddt->setFocusOnDomain(domain);
ddt->setFocusOnElement(domain, variable, element, value);
else
Error(tr("Cannot focus DDT on domain %0: failed to connect to DDT").arg(domain));
Error(tr("Cannot focus DDT on domain %0, element %1 of %2:: failed to connect to DDT").arg(
QString::number(domain),
QString::number(element),
QString::fromLatin1(variable.c_str())));
}
......@@ -7750,11 +7750,14 @@ ViewerWindowManager::UpdateWindowInformation(int flags, int windowIndex)
if (DDTManager::isDDTSim(win))
{
const EngineKey &key = win->GetPlotList()->GetEngineKey();
const avtDatabaseMetaData *md = ViewerEngineManager::Instance()->GetSimulationMetaData(key);
if (md->GetSimInfo().GetMode()==avtSimulationInformation::Running)
windowInfo->SetAnimationMode(3);
else
windowInfo->SetAnimationMode(2);
if (key.IsSimulation())
{
const avtDatabaseMetaData *md = ViewerEngineManager::Instance()->GetSimulationMetaData(key);
if (md->GetSimInfo().GetMode()==avtSimulationInformation::Running)
windowInfo->SetAnimationMode(3);
else
windowInfo->SetAnimationMode(2);
}
}
else
{
......
......@@ -46,6 +46,8 @@
#include <OperatorPluginManager.h>
#include <ViewerEngineManager.h>
#include <DDTManager.h>
#include <avtDatabaseMetaData.h>
#include <avtSimulationCommandSpecification.h>
#include <QIcon>
#include <QPixmap>
......@@ -957,7 +959,7 @@ SetWindowModeAction::SetWindowModeAction(ViewerWindow *win) :
AddChoice(tr("Zone Pick"), tr("Zone Pick mode"), QPixmap(zonepickmode_xpm));
AddChoice(tr("Node Pick"), tr("Node Pick mode"), QPixmap(nodepickmode_xpm));
AddChoice(tr("Spreadsheet Pick"), tr("Spreadsheet Pick mode"), QPixmap(spreadsheetpickmode_xpm));
AddChoice(tr("DDT Pick"), tr("DDT Pick mode"), QPixmap(ddtpickmode_xpm));
AddChoice(tr("Add DDT Pick"), tr("DDT Pick mode"), QPixmap(ddtpickmode_xpm));
AddChoice(tr("Lineout"), tr("Lineout mode"), QPixmap(lineoutmode_xpm));
}
else
......@@ -967,7 +969,7 @@ SetWindowModeAction::SetWindowModeAction(ViewerWindow *win) :
AddChoice(tr("Zone Pick"));
AddChoice(tr("Node Pick"));
AddChoice(tr("Spreadsheet Pick"));
AddChoice(tr("DDT Pick"));
AddChoice(tr("Add DDT Pick"));
AddChoice(tr("Lineout"));
}
......@@ -1553,3 +1555,84 @@ ReleaseToDDTAction::Enabled() const
return (window->GetPlotList()->GetEngineKey().IsSimulation()
&& DDTManager::isDatabaseDDTSim(window->GetPlotList()->GetDatabaseName()));
}
// ****************************************************************************
// Method: PlotDDTVispointVariablesAction::PlotDDTVispointVariablesAction
//
// Purpose:
// Constructor for the 'plot vispoint variables' Action
//
// Arguments:
// win : The ViewerWindow this action applies to
//
// Programmer: Jonathan Byrd (Allinea Software)
// Creation: July 15, 2013
//
// ****************************************************************************
PlotDDTVispointVariablesAction::PlotDDTVispointVariablesAction(ViewerWindow *win) :
ViewerAction(win)
{
SetAllText(tr("Plot DDT vispoint variables"));
}
// ****************************************************************************
// Method: PlotDDTVispointVariablesAction::Execute
//
// Purpose:
// Performs the 'plot vispoint variables' Action
//
// Programmer: Jonathan Byrd (Allinea Software)
// Creation: July 15, 2013
//
// ****************************************************************************
void
PlotDDTVispointVariablesAction::Execute()
{
if (DDTManager::isDatabaseDDTSim(GetWindow()->GetPlotList()->GetDatabaseName()))
{
const EngineKey &key = GetWindow()->GetPlotList()->GetEngineKey();
if (key.IsSimulation())
ViewerEngineManager::Instance()->SendSimulationCommand(
key, "plot", "force");
}
}
// ****************************************************************************
// Method: PlotDDTVispointVariablesAction::Enabled
//
// Purpose:
// Determines the enabled status for the 'plot vispoint variables' Action
//
// Returns:
// true if this Action should appear enabled
//
// Programmer: Jonathan Byrd (Allinea Software)
// Creation: July 15, 2013
//
// ****************************************************************************
bool
PlotDDTVispointVariablesAction::Enabled() const
{
const EngineKey &key = GetWindow()->GetPlotList()->GetEngineKey();
if (key.IsSimulation())
{
const avtDatabaseMetaData *md = ViewerEngineManager::Instance()->GetSimulationMetaData(
key);
// This action should only be enabled if the window to which the action belongs
// is displaying a ddtsim-sourced simulation
if (md && DDTManager::isDatabaseDDTSim(window->GetPlotList()->GetDatabaseName()))
{
// The ddtsim library in use must also support the "plot" command
const int numCommands = md->GetSimInfo().GetNumGenericCommands();
const std::string plotCmd = "plot";
for (int i=0; i<numCommands; ++i)
if (md->GetSimInfo().GetGenericCommands(i).GetName()==plotCmd)
return true;
}
}
return false;
}
......@@ -446,3 +446,28 @@ public:
virtual void Execute();
virtual bool Enabled() const;
};
// ****************************************************************************
// Class: PlotDDTVispointVariablesAction
//
// Purpose:
// Action to automatically plot variables at the current DDT vispoint.
//
// Notes:
//
// Programmer: Jonathan Byrd (Allinea Software)
// Creation: July 15, 2013
//
// Modifications:
//
// ****************************************************************************
class VIEWER_API PlotDDTVispointVariablesAction : public ViewerAction
{
public:
PlotDDTVispointVariablesAction(ViewerWindow *win);
virtual ~PlotDDTVispointVariablesAction(){}
virtual void Execute();
virtual bool Enabled() const;
};
......@@ -5443,13 +5443,21 @@ ViewerMethods::DDTConnect(bool connect)
// Programmer: Jonathan Byrd
// Creation: December 18, 2011
//
// Modifications:
// Jonathan Byrd, Mon Feb 4, 2013
// Focus on domain, variable and element, not just domain
//
// ****************************************************************************
void
ViewerMethods::DDTFocus(int domain)
ViewerMethods::DDTFocus(int domain, const std::string& variable, int element,
const std::string& value)
{
state->GetViewerRPC()->SetRPCType(ViewerRPC::DDTFocusRPC);
state->GetViewerRPC()->SetIntArg1(domain);
state->GetViewerRPC()->SetIntArg2(element);
state->GetViewerRPC()->SetStringArg1(variable);
state->GetViewerRPC()->SetStringArg2(value);
state->GetViewerRPC()->Notify();
}
......
......@@ -440,7 +440,7 @@ public:
const stringVector &args);
void DDTConnect(bool connect);
void DDTFocus(int domain);
void DDTFocus(int domain, const std::string &variable, int element, const std::string &value);
void ExportWindows(const intVector &windowIds, const std::string& format);
void ExportHostProfile(const std::string& profile, const std::string &filename, const bool& saveInUserDir = false);
......
......@@ -111,7 +111,7 @@ static const char *ViewerRPCType_strings[] = {
"SetPlotDescriptionRPC", "MovePlotOrderTowardFirstRPC", "MovePlotOrderTowardLastRPC",
"SetPlotOrderToFirstRPC", "SetPlotOrderToLastRPC", "RenamePickLabelRPC",
"GetQueryParametersRPC", "DDTConnectRPC", "DDTFocusRPC",
"ReleaseToDDTRPC", "ExportRPC", "MaxRPC"
"ReleaseToDDTRPC", "PlotDDTVispointVariablesRPC", "ExportRPC", "MaxRPC"
};
std::string
......
......@@ -262,6 +262,7 @@ public:
DDTConnectRPC,
DDTFocusRPC,
ReleaseToDDTRPC,
PlotDDTVispointVariablesRPC,
ExportRPC,
MaxRPC
};
......
......@@ -200,6 +200,7 @@
DDTConnectRPC
DDTFocusRPC
ReleaseToDDTRPC
PlotDDTVispointVariablesRPC
ExportRPC
MaxRPC
</Enum>
......
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