Commit ba63734b authored by whitlocb's avatar whitlocb
Browse files

Move selections closer to the front of the pipeline so they happen before operators and plots.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@15891 18c085ea-50e0-402c-830e-de6fd14e8384
parent 30d39a0e
...@@ -71,6 +71,9 @@ using std::deque; ...@@ -71,6 +71,9 @@ using std::deque;
// Hank Childs, Fri Jan 16 14:38:42 PST 2009 // Hank Childs, Fri Jan 16 14:38:42 PST 2009
// Initialize time and var. // Initialize time and var.
// //
// Brad Whitlock, Mon Aug 22 10:37:05 PDT 2011
// Initialize selectionName.
//
// **************************************************************************** // ****************************************************************************
DataNetwork::DataNetwork(void) DataNetwork::DataNetwork(void)
...@@ -85,6 +88,7 @@ DataNetwork::DataNetwork(void) ...@@ -85,6 +88,7 @@ DataNetwork::DataNetwork(void)
plotName = ""; plotName = "";
time = -1; time = -1;
var = ""; var = "";
selectionName = std::string();
} }
// **************************************************************************** // ****************************************************************************
......
...@@ -112,7 +112,11 @@ ...@@ -112,7 +112,11 @@
// Hank Childs, Fri Jan 16 14:37:33 PST 2009 // Hank Childs, Fri Jan 16 14:37:33 PST 2009
// Add a variable field. // Add a variable field.
// //
// Brad Whitlock, Mon Aug 22 10:36:08 PDT 2011
// I added a selectionName field.
//
// **************************************************************************** // ****************************************************************************
class ENGINE_MAIN_API DataNetwork class ENGINE_MAIN_API DataNetwork
{ {
public: public:
...@@ -132,6 +136,7 @@ public: ...@@ -132,6 +136,7 @@ public:
void SetDataSpec(avtDataRequest_p s) {dataRequest = s;}; void SetDataSpec(avtDataRequest_p s) {dataRequest = s;};
void SetTime(int time_) {time = time_;}; void SetTime(int time_) {time = time_;};
void SetVariable(const std::string &v) {var = v;}; void SetVariable(const std::string &v) {var = v;};
void SetSelectionName(const std::string &s) { selectionName = s; }
virtual void ReleaseData(void); virtual void ReleaseData(void);
...@@ -153,6 +158,7 @@ public: ...@@ -153,6 +158,7 @@ public:
std::string &GetPlottype(void) { return plottype; }; std::string &GetPlottype(void) { return plottype; };
std::string &GetPlotName(void) { return plotName; }; std::string &GetPlotName(void) { return plotName; };
std::vector<Netnode*> &GetNodeList(void) { return nodeList; }; std::vector<Netnode*> &GetNodeList(void) { return nodeList; };
const std::string &GetSelectionName() const { return selectionName; }
protected: protected:
int nid; int nid;
...@@ -162,8 +168,6 @@ protected: ...@@ -162,8 +168,6 @@ protected:
avtDataRequest_p dataRequest; avtDataRequest_p dataRequest;
avtDataObjectWriter_p writer; avtDataObjectWriter_p writer;
avtActor_p plotActor; avtActor_p plotActor;
double bgColor[3];
double fgColor[3];
avtContract_p contract; avtContract_p contract;
NetnodeDB* netdb; NetnodeDB* netdb;
avtPlot_p plot; avtPlot_p plot;
...@@ -172,6 +176,7 @@ protected: ...@@ -172,6 +176,7 @@ protected:
std::string var; std::string var;
int time; int time;
bool clone; bool clone;
std::string selectionName;
}; };
#endif #endif
...@@ -209,6 +209,9 @@ RPCExecutor<KeepAliveRPC>::Execute(KeepAliveRPC *rpc) ...@@ -209,6 +209,9 @@ RPCExecutor<KeepAliveRPC>::Execute(KeepAliveRPC *rpc)
// Brad Whitlock, Tue Jun 24 15:57:34 PDT 2008 // Brad Whitlock, Tue Jun 24 15:57:34 PDT 2008
// Changed how the database plugin manager is accessed. // Changed how the database plugin manager is accessed.
// //
// Brad Whitlock, Mon Aug 22 10:22:18 PDT 2011
// Pass the selection name to StartNetwork.
//
// **************************************************************************** // ****************************************************************************
template<> template<>
...@@ -231,7 +234,8 @@ RPCExecutor<ReadRPC>::Execute(ReadRPC *rpc) ...@@ -231,7 +234,8 @@ RPCExecutor<ReadRPC>::Execute(ReadRPC *rpc)
rpc->GetMaterialAttributes(), rpc->GetMaterialAttributes(),
rpc->GetMeshManagementAttributes(), rpc->GetMeshManagementAttributes(),
rpc->GetTreatAllDBsAsTimeVarying(), rpc->GetTreatAllDBsAsTimeVarying(),
rpc->GetIgnoreExtents()); rpc->GetIgnoreExtents(),
rpc->GetSelectionName());
rpc->SendReply(); rpc->SendReply();
} }
CATCH2(VisItException, e) CATCH2(VisItException, e)
...@@ -1562,6 +1566,9 @@ RPCExecutor<SimulationCommandRPC>::Execute(SimulationCommandRPC *rpc) ...@@ -1562,6 +1566,9 @@ RPCExecutor<SimulationCommandRPC>::Execute(SimulationCommandRPC *rpc)
// Pass selection properties to CreateNamedSelection. I also added status // Pass selection properties to CreateNamedSelection. I also added status
// updates since the RPC is now non-blocking. // updates since the RPC is now non-blocking.
// //
// Brad Whitlock, Mon Aug 22 10:21:17 PDT 2011
// I changed how named selections get applied.
//
// **************************************************************************** // ****************************************************************************
template<> template<>
void void
...@@ -1588,9 +1595,6 @@ RPCExecutor<NamedSelectionRPC>::Execute(NamedSelectionRPC *rpc) ...@@ -1588,9 +1595,6 @@ RPCExecutor<NamedSelectionRPC>::Execute(NamedSelectionRPC *rpc)
switch (rpc->GetNamedSelectionOperation()) switch (rpc->GetNamedSelectionOperation())
{ {
case NamedSelectionRPC::NS_APPLY:
netmgr->ApplyNamedSelection(rpc->GetPlotNames(), rpc->GetSelectionName());
break;
case NamedSelectionRPC::NS_CREATE: case NamedSelectionRPC::NS_CREATE:
summary = netmgr->CreateNamedSelection( summary = netmgr->CreateNamedSelection(
rpc->GetPlotID(), rpc->GetSelectionProperties()); rpc->GetPlotID(), rpc->GetSelectionProperties());
......
...@@ -852,6 +852,9 @@ NetworkManager::GetDBFromCache(const std::string &filename, int time, ...@@ -852,6 +852,9 @@ NetworkManager::GetDBFromCache(const std::string &filename, int time,
// Jeremy Meredith, Fri Feb 13 11:22:39 EST 2009 // Jeremy Meredith, Fri Feb 13 11:22:39 EST 2009
// Added MIR iteration capability. // Added MIR iteration capability.
// //
// Brad Whitlock, Mon Aug 22 13:34:36 PDT 2011
// I added named selection creation here instead of at the end of the pipeline.
//
// **************************************************************************** // ****************************************************************************
void void
...@@ -863,7 +866,8 @@ NetworkManager::StartNetwork(const std::string &format, ...@@ -863,7 +866,8 @@ NetworkManager::StartNetwork(const std::string &format,
const MaterialAttributes &matopts, const MaterialAttributes &matopts,
const MeshManagementAttributes &meshopts, const MeshManagementAttributes &meshopts,
bool treatAllDBsAsTimeVarying, bool treatAllDBsAsTimeVarying,
bool ignoreExtents) bool ignoreExtents,
const std::string &selName)
{ {
// If the variable is an expression, we need to find a "real" variable // If the variable is an expression, we need to find a "real" variable
// name to work with. // name to work with.
...@@ -884,15 +888,28 @@ NetworkManager::StartNetwork(const std::string &format, ...@@ -884,15 +888,28 @@ NetworkManager::StartNetwork(const std::string &format,
workingNet->SetNetDB(netDB); workingNet->SetNetDB(netDB);
workingNet->SetVariable(leaf); workingNet->SetVariable(leaf);
netDB->SetDBInfo(filename, leaf, time); netDB->SetDBInfo(filename, leaf, time);
Netnode *input = netDB;
// Put an ExpressionEvaluatorFilter right after the netDB to handle // Add ExpressionEvaluatorFilter to handle expressions that come up the pipe.
// expressions that come up the pipe.
avtExpressionEvaluatorFilter *f = new avtExpressionEvaluatorFilter(); avtExpressionEvaluatorFilter *f = new avtExpressionEvaluatorFilter();
NetnodeFilter *filt = new NetnodeFilter(f, "ExpressionEvaluator"); NetnodeFilter *filt = new NetnodeFilter(f, "ExpressionEvaluator");
filt->GetInputNodes().push_back(netDB); filt->GetInputNodes().push_back(input);
f->GetOutput()->SetTransientStatus(false); f->GetOutput()->SetTransientStatus(false);
// Push the ExpressionEvaluator onto the working list. input = filt;
if(!selName.empty())
{
// Add the EEF to the network.
workingNet->AddNode(filt);
avtNamedSelectionFilter *f = new avtNamedSelectionFilter();
f->SetSelectionName(selName);
filt = new NetnodeFilter(f, "NamedSelection");
filt->GetInputNodes().push_back(input);
workingNet->SetSelectionName(selName);
}
// Push the last filter onto the working list.
workingNetnodeList.push_back(filt); workingNetnodeList.push_back(filt);
workingNet->AddNode(filt); workingNet->AddNode(filt);
...@@ -1337,45 +1354,37 @@ NetworkManager::MakePlot(const std::string &plotName, const std::string &pluginI ...@@ -1337,45 +1354,37 @@ NetworkManager::MakePlot(const std::string &plotName, const std::string &pluginI
// Brad Whitlock, Tue Aug 10 16:11:25 PDT 2010 // Brad Whitlock, Tue Aug 10 16:11:25 PDT 2010
// Use find() method. // Use find() method.
// //
// Brad Whitlock, Mon Aug 22 10:39:12 PDT 2011
// Changed how named selections are finally set up.
//
// **************************************************************************** // ****************************************************************************
int int
NetworkManager::EndNetwork(int windowID) NetworkManager::EndNetwork(int windowID)
{ {
std::map<std::string, std::string>::iterator it; // Checking to see if the network has been built successfully.
it = namedSelectionsToApply.find(workingNet->GetPlotName()); if (workingNetnodeList.size() != 1)
if (it != namedSelectionsToApply.end())
{ {
avtNamedSelectionFilter *f = new avtNamedSelectionFilter(); debug1 << "Network building still in progress. Filter required to "
f->SetSelectionName(it->second); << "absorb " << workingNetnodeList.size() << " nodes." << endl;
NetnodeFilter *filt = new NetnodeFilter(f, "NamedSelection");
Netnode *n = workingNetnodeList.back();
workingNetnodeList.pop_back();
filt->GetInputNodes().push_back(n);
// Push the NamedSelection filter onto the working list.
workingNetnodeList.push_back(filt);
workingNet->AddNode(filt); EXCEPTION0(ImproperUseException);
}
// If a named selection has been applied, make sure all of the filters
// know about it.
if (!workingNet->GetSelectionName().empty())
{
const std::string &selName = workingNet->GetSelectionName();
std::vector<Netnode *> netnodes = workingNet->GetNodeList(); std::vector<Netnode *> netnodes = workingNet->GetNodeList();
for (int i = 0 ; i < netnodes.size() ; i++) for (int i = 0 ; i < netnodes.size() ; i++)
{ {
avtFilter *filt = netnodes[i]->GetFilter(); avtFilter *filt = netnodes[i]->GetFilter();
if (filt == NULL) if (filt == NULL)
continue; continue;
filt->RegisterNamedSelection(it->second); filt->RegisterNamedSelection(selName);
} }
workingNet->GetPlot()->RegisterNamedSelection(it->second); workingNet->GetPlot()->RegisterNamedSelection(selName);
}
// Checking to see if the network has been built successfully.
if (workingNetnodeList.size() != 1)
{
debug1 << "Network building still in progress. Filter required to "
<< "absorb " << workingNetnodeList.size() << " nodes." << endl;
EXCEPTION0(ImproperUseException);
} }
// set the pipeline specification // set the pipeline specification
...@@ -3929,44 +3938,6 @@ NetworkManager::CreateNamedSelection(int id, const SelectionProperties &props) ...@@ -3929,44 +3938,6 @@ NetworkManager::CreateNamedSelection(int id, const SelectionProperties &props)
} }
// ****************************************************************************
// Method: NetworkManager::ApplyNamedSelection
//
// Purpose:
// Applies a named selection to a plot.
//
// Arguments:
// ids The names of the plots to which the selection will apply.
// selName The name of the selection.
//
// Programmer: Hank Childs
// Creation: January 30, 2009
//
// Modifications:
// Brad Whitlock, Tue Aug 10 16:13:27 PDT 2010
// Remove a named selection from a plot if the selName is empty.
//
// ****************************************************************************
void
NetworkManager::ApplyNamedSelection(const std::vector<std::string> &ids,
const std::string &selName)
{
for (int i = 0 ; i < ids.size() ; i++)
{
if(selName.size() > 0)
namedSelectionsToApply[ids[i]] = selName;
else
{
std::map<std::string,std::string>::iterator it;
it = namedSelectionsToApply.find(ids[i]);
if(it != namedSelectionsToApply.end())
namedSelectionsToApply.erase(it);
}
}
}
// **************************************************************************** // ****************************************************************************
// Method: NetworkManager::DeleteNamedSelection // Method: NetworkManager::DeleteNamedSelection
// //
......
...@@ -421,6 +421,9 @@ typedef void (*ProgressCallback)(void *, const char *, const char *,int,int); ...@@ -421,6 +421,9 @@ typedef void (*ProgressCallback)(void *, const char *, const char *,int,int);
// Tom Fogal, Wed May 18 12:17:18 MDT 2011 // Tom Fogal, Wed May 18 12:17:18 MDT 2011
// Need some debug code in IceT; promoting it to class methods. // Need some debug code in IceT; promoting it to class methods.
// //
// Brad Whitlock, Mon Aug 22 10:23:00 PDT 2011
// I added a selName argument to StartNetwork.
//
// **************************************************************************** // ****************************************************************************
class ENGINE_MAIN_API NetworkManager class ENGINE_MAIN_API NetworkManager
...@@ -463,7 +466,8 @@ class ENGINE_MAIN_API NetworkManager ...@@ -463,7 +466,8 @@ class ENGINE_MAIN_API NetworkManager
const CompactSILRestrictionAttributes &, const CompactSILRestrictionAttributes &,
const MaterialAttributes &, const MaterialAttributes &,
const MeshManagementAttributes &, const MeshManagementAttributes &,
bool, bool); bool, bool,
const std::string &selName);
void DefineDB(const std::string &, const std::string &, void DefineDB(const std::string &, const std::string &,
const stringVector &, int, const std::string &); const stringVector &, int, const std::string &);
void AddFilter(const std::string&, void AddFilter(const std::string&,
...@@ -527,8 +531,7 @@ class ENGINE_MAIN_API NetworkManager ...@@ -527,8 +531,7 @@ class ENGINE_MAIN_API NetworkManager
void ExportDatabase(const int, ExportDBAttributes *); void ExportDatabase(const int, ExportDBAttributes *);
void ConstructDataBinning(const int, ConstructDataBinningAttributes *); void ConstructDataBinning(const int, ConstructDataBinningAttributes *);
avtDataBinning *GetDataBinning(const char *); avtDataBinning *GetDataBinning(const char *);
void ApplyNamedSelection(const std::vector<std::string> &,
const std::string &);
SelectionSummary CreateNamedSelection(int, const SelectionProperties &); SelectionSummary CreateNamedSelection(int, const SelectionProperties &);
void DeleteNamedSelection(const std::string &); void DeleteNamedSelection(const std::string &);
void LoadNamedSelection(const std::string &); void LoadNamedSelection(const std::string &);
...@@ -617,8 +620,6 @@ class ENGINE_MAIN_API NetworkManager ...@@ -617,8 +620,6 @@ class ENGINE_MAIN_API NetworkManager
std::vector<Netnode*> workingNetnodeList; std::vector<Netnode*> workingNetnodeList;
std::vector<std::string> nameStack; std::vector<std::string> nameStack;
std::map<std::string, std::string> namedSelectionsToApply;
int uniqueNetworkId; int uniqueNetworkId;
bool requireOriginalCells; bool requireOriginalCells;
bool requireOriginalNodes; bool requireOriginalNodes;
......
...@@ -463,6 +463,11 @@ EngineProxy::SendKeepAlive() ...@@ -463,6 +463,11 @@ EngineProxy::SendKeepAlive()
// var the variable to read // var the variable to read
// time the time step to read // time the time step to read
// silr the sil restriction to use. // silr the sil restriction to use.
// matopts
// meshopts
// treatAllDBsAsTimeVarying
// ignoreExtents
// selName the selection to apply to the data.
// //
// Returns: // Returns:
// //
...@@ -504,17 +509,22 @@ EngineProxy::SendKeepAlive() ...@@ -504,17 +509,22 @@ EngineProxy::SendKeepAlive()
// //
// Mark C. Miller, Tue Jun 10 15:57:15 PDT 2008 // Mark C. Miller, Tue Jun 10 15:57:15 PDT 2008
// Added support for ignoring extents // Added support for ignoring extents
//
// Brad Whitlock, Mon Aug 22 10:10:04 PDT 2011
// I added a selName argument.
//
// **************************************************************************** // ****************************************************************************
void void
EngineProxy::ReadDataObject(const string &format, const string &file, EngineProxy::ReadDataObject(const std::string &format, const std::string &file,
const string &var, const int time, const std::string &var, const int time,
avtSILRestriction_p silr, avtSILRestriction_p silr,
const MaterialAttributes &matopts, const MaterialAttributes &matopts,
const ExpressionList &expressions, const ExpressionList &expressions,
const MeshManagementAttributes &meshopts, const MeshManagementAttributes &meshopts,
bool treatAllDBsAsTimeVarying, bool treatAllDBsAsTimeVarying,
bool ignoreExtents) bool ignoreExtents,
const std::string &selName)
{ {
// Make sure the engine knows about our current expression list. // Make sure the engine knows about our current expression list.
if (exprList != expressions) if (exprList != expressions)
...@@ -525,7 +535,7 @@ EngineProxy::ReadDataObject(const string &format, const string &file, ...@@ -525,7 +535,7 @@ EngineProxy::ReadDataObject(const string &format, const string &file,
CompactSILRestrictionAttributes *atts = silr->MakeCompactAttributes(); CompactSILRestrictionAttributes *atts = silr->MakeCompactAttributes();
readRPC(format, file, var, time, *atts, matopts, meshopts, readRPC(format, file, var, time, *atts, matopts, meshopts,
treatAllDBsAsTimeVarying, ignoreExtents); treatAllDBsAsTimeVarying, ignoreExtents, selName);
if (readRPC.GetStatus() == VisItRPC::error) if (readRPC.GetStatus() == VisItRPC::error)
{ {
RECONSTITUTE_EXCEPTION(readRPC.GetExceptionType(), RECONSTITUTE_EXCEPTION(readRPC.GetExceptionType(),
...@@ -1573,37 +1583,6 @@ EngineProxy::BlockForNamedSelectionOperation() ...@@ -1573,37 +1583,6 @@ EngineProxy::BlockForNamedSelectionOperation()
} }
} }
// ****************************************************************************
// Method: EngineProxy::ApplyNamedSelection
//
// Purpose:
// Apply a named selection to a list of plots.
//
// Arguments:
// ids the id of the network to have the selection applied to.
// selName the name of the named selection.
//
// Programmer: Hank Childs
// Creation: January 29, 2009
//
// Modifications:
// Kathleen Bonnell, Wed Mar 25 15:35:32 MST 2009
// Renamed NamedSelectionRPC enum names to compile on windows.
//
// Brad Whitlock, Tue Dec 14 11:58:33 PST 2010
// I changed the invocation method.
//
// ****************************************************************************
void
EngineProxy::ApplyNamedSelection(const vector<string> &ids,
const string selName)
{
namedSelectionRPC.ApplyNamedSelection(ids, selName);
BlockForNamedSelectionOperation();
}
// **************************************************************************** // ****************************************************************************
// Method: EngineProxy::CreateNamedSelection // Method: EngineProxy::CreateNamedSelection
// //
......
...@@ -316,6 +316,10 @@ class ParentProcess; ...@@ -316,6 +316,10 @@ class ParentProcess;
// Hank Childs, Sat Aug 21 14:35:47 PDT 2010 // Hank Childs, Sat Aug 21 14:35:47 PDT 2010
// Rename DDF to DataBinning. // Rename DDF to DataBinning.
// //
// Brad Whitlock, Mon Aug 22 10:07:44 PDT 2011
// I added a selection argument to ReadDataObject. I also removed
// ApplyNamedSelection.
//
// **************************************************************************** // ****************************************************************************
class ENGINE_PROXY_API EngineProxy : public RemoteProxyBase class ENGINE_PROXY_API EngineProxy : public RemoteProxyBase
...@@ -359,14 +363,16 @@ public: ...@@ -359,14 +363,16 @@ public:
const stringVector &, const stringVector &,
int = 0, bool=true, int = 0, bool=true,
bool=true); bool=true);
void ReadDataObject(const std::string&, void ReadDataObject(const std::string &format,
const std::string&, const std::string &filename,
const std::string&, const int, const std::string &var, const int ts,
avtSILRestriction_p, avtSILRestriction_p,
const MaterialAttributes&, const MaterialAttributes&,
const ExpressionList &, const ExpressionList &,
const MeshManagementAttributes &, const MeshManagementAttributes &,
bool, bool); bool treatAllDbsAsTimeVarying,
bool ignoreExtents,
const std::string &selName);
void ApplyOperator(const std::string&, void ApplyOperator(const std::string&,
const AttributeSubject*); const AttributeSubject*);
void ApplyNamedFunction(const std::string &name, void ApplyNamedFunction(const std::string &name,
...@@ -413,8 +419,6 @@ public: ...@@ -413,8 +419,6 @@ public:
void ExportDatabase(int, const ExportDBAttributes *); void ExportDatabase(int, const ExportDBAttributes *);
void ConstructDataBinning(int, const ConstructDataBinningAttributes *); void ConstructDataBinning(int, const ConstructDataBinningAttributes *);
void ApplyNamedSelection(const std::vector<std::string> &ids,
const std::string selName);
const SelectionSummary &CreateNamedSelection(int id, const SelectionProperties &props); const SelectionSummary &CreateNamedSelection(int id, const SelectionProperties &props);
void DeleteNamedSelection(const std::string selName); void DeleteNamedSelection(const std::string selName);
void LoadNamedSelection(const std::string selName); void LoadNamedSelection(const std::string selName);
......
...@@ -55,9 +55,14 @@ ...@@ -55,9 +55,14 @@
// Brad Whitlock, Tue Dec 14 12:05:51 PST 2010 // Brad Whitlock, Tue Dec 14 12:05:51 PST 2010
// I added selection properties and summary return value. // I added selection properties and summary return value.
// //
// Brad Whitlock, Mon Aug 22 10:15:03 PDT 2011
// I removed items from the type string and added intializers.
//
// **************************************************************************** // ****************************************************************************
NamedSelectionRPC::NamedSelectionRPC() : NonBlockingRPC("is*sia", &summary) NamedSelectionRPC::NamedSelectionRPC() : NonBlockingRPC("iisa", &summary),
selOperation(NamedSelectionRPC::NS_CREATE), plotId(-1), selName(),
properties(), summary()
{ {
} }
...@@ -79,32 +84,7 @@ NamedSelectionRPC::~NamedSelectionRPC() ...@@ -79,32 +84,7 @@ NamedSelectionRPC::~NamedSelectionRPC()
} }
// **************************************************************************** // ****************************************************************************
// Method: ApplyNamedSelection // Method: CreateNamedSelection
//
// Purpose:
// Invocation method for apply.
//
// Arguments:
// ids : The plot names of the plots to which we're applying a selection.
// selName : The nameof the selection to apply.
//
// Programmer: Brad Whitlock
// Creation: Tue Dec 14 12:09:51 PST 2010