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;
// Hank Childs, Fri Jan 16 14:38:42 PST 2009
// Initialize time and var.
//
// Brad Whitlock, Mon Aug 22 10:37:05 PDT 2011
// Initialize selectionName.
//
// ****************************************************************************
DataNetwork::DataNetwork(void)
......@@ -85,6 +88,7 @@ DataNetwork::DataNetwork(void)
plotName = "";
time = -1;
var = "";
selectionName = std::string();
}
// ****************************************************************************
......
......@@ -112,7 +112,11 @@
// Hank Childs, Fri Jan 16 14:37:33 PST 2009
// Add a variable field.
//
// Brad Whitlock, Mon Aug 22 10:36:08 PDT 2011
// I added a selectionName field.
//
// ****************************************************************************
class ENGINE_MAIN_API DataNetwork
{
public:
......@@ -132,6 +136,7 @@ public:
void SetDataSpec(avtDataRequest_p s) {dataRequest = s;};
void SetTime(int time_) {time = time_;};
void SetVariable(const std::string &v) {var = v;};
void SetSelectionName(const std::string &s) { selectionName = s; }
virtual void ReleaseData(void);
......@@ -153,6 +158,7 @@ public:
std::string &GetPlottype(void) { return plottype; };
std::string &GetPlotName(void) { return plotName; };
std::vector<Netnode*> &GetNodeList(void) { return nodeList; };
const std::string &GetSelectionName() const { return selectionName; }
protected:
int nid;
......@@ -162,8 +168,6 @@ protected:
avtDataRequest_p dataRequest;
avtDataObjectWriter_p writer;
avtActor_p plotActor;
double bgColor[3];
double fgColor[3];
avtContract_p contract;
NetnodeDB* netdb;
avtPlot_p plot;
......@@ -172,6 +176,7 @@ protected:
std::string var;
int time;
bool clone;
std::string selectionName;
};
#endif
......@@ -209,6 +209,9 @@ RPCExecutor<KeepAliveRPC>::Execute(KeepAliveRPC *rpc)
// Brad Whitlock, Tue Jun 24 15:57:34 PDT 2008
// 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<>
......@@ -231,7 +234,8 @@ RPCExecutor<ReadRPC>::Execute(ReadRPC *rpc)
rpc->GetMaterialAttributes(),
rpc->GetMeshManagementAttributes(),
rpc->GetTreatAllDBsAsTimeVarying(),
rpc->GetIgnoreExtents());
rpc->GetIgnoreExtents(),
rpc->GetSelectionName());
rpc->SendReply();
}
CATCH2(VisItException, e)
......@@ -1562,6 +1566,9 @@ RPCExecutor<SimulationCommandRPC>::Execute(SimulationCommandRPC *rpc)
// Pass selection properties to CreateNamedSelection. I also added status
// 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<>
void
......@@ -1588,9 +1595,6 @@ RPCExecutor<NamedSelectionRPC>::Execute(NamedSelectionRPC *rpc)
switch (rpc->GetNamedSelectionOperation())
{
case NamedSelectionRPC::NS_APPLY:
netmgr->ApplyNamedSelection(rpc->GetPlotNames(), rpc->GetSelectionName());
break;
case NamedSelectionRPC::NS_CREATE:
summary = netmgr->CreateNamedSelection(
rpc->GetPlotID(), rpc->GetSelectionProperties());
......
......@@ -852,6 +852,9 @@ NetworkManager::GetDBFromCache(const std::string &filename, int time,
// Jeremy Meredith, Fri Feb 13 11:22:39 EST 2009
// 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
......@@ -863,7 +866,8 @@ NetworkManager::StartNetwork(const std::string &format,
const MaterialAttributes &matopts,
const MeshManagementAttributes &meshopts,
bool treatAllDBsAsTimeVarying,
bool ignoreExtents)
bool ignoreExtents,
const std::string &selName)
{
// If the variable is an expression, we need to find a "real" variable
// name to work with.
......@@ -884,15 +888,28 @@ NetworkManager::StartNetwork(const std::string &format,
workingNet->SetNetDB(netDB);
workingNet->SetVariable(leaf);
netDB->SetDBInfo(filename, leaf, time);
Netnode *input = netDB;
// Put an ExpressionEvaluatorFilter right after the netDB to handle
// expressions that come up the pipe.
// Add ExpressionEvaluatorFilter to handle expressions that come up the pipe.
avtExpressionEvaluatorFilter *f = new avtExpressionEvaluatorFilter();
NetnodeFilter *filt = new NetnodeFilter(f, "ExpressionEvaluator");
filt->GetInputNodes().push_back(netDB);
filt->GetInputNodes().push_back(input);
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);
workingNet->AddNode(filt);
......@@ -1337,45 +1354,37 @@ NetworkManager::MakePlot(const std::string &plotName, const std::string &pluginI
// Brad Whitlock, Tue Aug 10 16:11:25 PDT 2010
// Use find() method.
//
// Brad Whitlock, Mon Aug 22 10:39:12 PDT 2011
// Changed how named selections are finally set up.
//
// ****************************************************************************
int
NetworkManager::EndNetwork(int windowID)
{
std::map<std::string, std::string>::iterator it;
it = namedSelectionsToApply.find(workingNet->GetPlotName());
if (it != namedSelectionsToApply.end())
// Checking to see if the network has been built successfully.
if (workingNetnodeList.size() != 1)
{
avtNamedSelectionFilter *f = new avtNamedSelectionFilter();
f->SetSelectionName(it->second);
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);
debug1 << "Network building still in progress. Filter required to "
<< "absorb " << workingNetnodeList.size() << " nodes." << endl;
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();
for (int i = 0 ; i < netnodes.size() ; i++)
{
avtFilter *filt = netnodes[i]->GetFilter();
if (filt == NULL)
continue;
filt->RegisterNamedSelection(it->second);
filt->RegisterNamedSelection(selName);
}
workingNet->GetPlot()->RegisterNamedSelection(it->second);
}
// 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);
workingNet->GetPlot()->RegisterNamedSelection(selName);
}
// set the pipeline specification
......@@ -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
//
......
......@@ -421,6 +421,9 @@ typedef void (*ProgressCallback)(void *, const char *, const char *,int,int);
// Tom Fogal, Wed May 18 12:17:18 MDT 2011
// 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
......@@ -463,7 +466,8 @@ class ENGINE_MAIN_API NetworkManager
const CompactSILRestrictionAttributes &,
const MaterialAttributes &,
const MeshManagementAttributes &,
bool, bool);
bool, bool,
const std::string &selName);
void DefineDB(const std::string &, const std::string &,
const stringVector &, int, const std::string &);
void AddFilter(const std::string&,
......@@ -527,8 +531,7 @@ class ENGINE_MAIN_API NetworkManager
void ExportDatabase(const int, ExportDBAttributes *);
void ConstructDataBinning(const int, ConstructDataBinningAttributes *);
avtDataBinning *GetDataBinning(const char *);
void ApplyNamedSelection(const std::vector<std::string> &,
const std::string &);
SelectionSummary CreateNamedSelection(int, const SelectionProperties &);
void DeleteNamedSelection(const std::string &);
void LoadNamedSelection(const std::string &);
......@@ -617,8 +620,6 @@ class ENGINE_MAIN_API NetworkManager
std::vector<Netnode*> workingNetnodeList;
std::vector<std::string> nameStack;
std::map<std::string, std::string> namedSelectionsToApply;
int uniqueNetworkId;
bool requireOriginalCells;
bool requireOriginalNodes;
......
......@@ -463,6 +463,11 @@ EngineProxy::SendKeepAlive()
// var the variable to read
// time the time step to read
// silr the sil restriction to use.
// matopts
// meshopts
// treatAllDBsAsTimeVarying
// ignoreExtents
// selName the selection to apply to the data.
//
// Returns:
//
......@@ -504,17 +509,22 @@ EngineProxy::SendKeepAlive()
//
// Mark C. Miller, Tue Jun 10 15:57:15 PDT 2008
// Added support for ignoring extents
//
// Brad Whitlock, Mon Aug 22 10:10:04 PDT 2011
// I added a selName argument.
//
// ****************************************************************************
void
EngineProxy::ReadDataObject(const string &format, const string &file,
const string &var, const int time,
EngineProxy::ReadDataObject(const std::string &format, const std::string &file,
const std::string &var, const int time,
avtSILRestriction_p silr,
const MaterialAttributes &matopts,
const ExpressionList &expressions,
const MeshManagementAttributes &meshopts,
bool treatAllDBsAsTimeVarying,
bool ignoreExtents)
bool ignoreExtents,
const std::string &selName)
{
// Make sure the engine knows about our current expression list.
if (exprList != expressions)
......@@ -525,7 +535,7 @@ EngineProxy::ReadDataObject(const string &format, const string &file,
CompactSILRestrictionAttributes *atts = silr->MakeCompactAttributes();
readRPC(format, file, var, time, *atts, matopts, meshopts,
treatAllDBsAsTimeVarying, ignoreExtents);
treatAllDBsAsTimeVarying, ignoreExtents, selName);
if (readRPC.GetStatus() == VisItRPC::error)
{
RECONSTITUTE_EXCEPTION(readRPC.GetExceptionType(),
......@@ -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
//
......
......@@ -316,6 +316,10 @@ class ParentProcess;
// Hank Childs, Sat Aug 21 14:35:47 PDT 2010
// 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
......@@ -359,14 +363,16 @@ public:
const stringVector &,
int = 0, bool=true,
bool=true);
void ReadDataObject(const std::string&,
const std::string&,
const std::string&, const int,
void ReadDataObject(const std::string &format,
const std::string &filename,
const std::string &var, const int ts,
avtSILRestriction_p,
const MaterialAttributes&,
const ExpressionList &,
const MeshManagementAttributes &,
bool, bool);
bool treatAllDbsAsTimeVarying,
bool ignoreExtents,
const std::string &selName);
void ApplyOperator(const std::string&,
const AttributeSubject*);
void ApplyNamedFunction(const std::string &name,
......@@ -413,8 +419,6 @@ public:
void ExportDatabase(int, const ExportDBAttributes *);
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);
void DeleteNamedSelection(const std::string selName);
void LoadNamedSelection(const std::string selName);
......
......@@ -55,9 +55,14 @@
// Brad Whitlock, Tue Dec 14 12:05:51 PST 2010
// 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()
}
// ****************************************************************************
// Method: ApplyNamedSelection
//
// 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
//
// ****************************************************************************
void
NamedSelectionRPC::ApplyNamedSelection(const std::vector<std::string> &ids, const std::string &selName)
{
SetPlotNames(ids);
SetSelectionName(selName);
SetNamedSelectionOperation(NS_APPLY);
Execute();
}
// ****************************************************************************
// Method: ApplyNamedSelection
// Method: CreateNamedSelection
//
// Purpose:
// Invocation method for apply.
......@@ -221,24 +201,25 @@ NamedSelectionRPC::SaveNamedSelection(const std::string &selName)
// Brad Whitlock, Tue Dec 14 12:05:07 PST 2010
// I added selection properties.
//
// Brad Whitlock, Mon Aug 22 10:18:58 PDT 2011
// I removed plotIDs.
//
// ****************************************************************************
void
NamedSelectionRPC::SelectAll()
{
Select(0, (void*)&plotId);
Select(1, (void*)&plotNames);
Select(0, (void*)&selOperation);
Select(1, (void*)&plotId);
Select(2, (void*)&selName);
Select(3, (void*)&selOperation);
Select(4, (void*)&properties);
Select(3, (void*)&properties);
}
// ****************************************************************************
// Method: NamedSelectionRPC::SetPlotID
// Method: NamedSelectionRPC::SetNamedSelectionOperation
//
// Purpose:
// This sets the plot (network) ID.
// This sets the selection type.
//
// Programmer: Hank Childs
// Creation: January 29, 2009
......@@ -246,32 +227,30 @@ NamedSelectionRPC::SelectAll()
// ****************************************************************************
void
NamedSelectionRPC::SetPlotID(int id)
NamedSelectionRPC::SetNamedSelectionOperation(NamedSelectionOperation t)
{
plotId = id;
Select(0, (void*)&plotId);
selOperation = t;
Select(0, (void*)&selOperation);
}
// ****************************************************************************
// Method: NamedSelectionRPC::SetPlotNames
// Method: NamedSelectionRPC::SetPlotID
//
// Purpose:
// This sets the plot names.
// This sets the plot (network) ID.
//
// Programmer: Hank Childs
// Creation: February 2, 2009
// Creation: January 29, 2009
//
// ****************************************************************************
void
NamedSelectionRPC::SetPlotNames(const std::vector<std::string> &ids)
NamedSelectionRPC::SetPlotID(int id)
{
plotNames = ids;
Select(1, (void*)&plotNames);
plotId = id;
Select(1, (void*)&plotId);
}
// ****************************************************************************
// Method: NamedSelectionRPC::SetSelectionName
//
......@@ -290,26 +269,6 @@ NamedSelectionRPC::SetSelectionName(const std::string &n)
Select(2, (void*)&selName);
}
// ****************************************************************************
// Method: NamedSelectionRPC::SetNamedSelectionOperation
//
// Purpose:
// This sets the selection type.
//
// Programmer: Hank Childs
// Creation: January 29, 2009
//
// ****************************************************************************
void
NamedSelectionRPC::SetNamedSelectionOperation(NamedSelectionOperation t)
{
selOperation = t;
Select(3, (void*)&selOperation);
}
// ****************************************************************************
// Method: NamedSelectionRPC::SetSelectionProperties
//
......@@ -327,5 +286,5 @@ void
NamedSelectionRPC::SetSelectionProperties(const SelectionProperties &p)
{
properties = p;
Select(4, (void*)&properties);
Select(3, (void*)&properties);
}
......@@ -72,8 +72,7 @@ class ENGINE_RPC_API NamedSelectionRPC : public NonBlockingRPC
public:
typedef enum
{
NS_APPLY = 0,
NS_CREATE, /* 1 */
NS_CREATE = 0,
NS_DELETE, /* 2 */
NS_LOAD, /* 3 */
NS_SAVE /* 4 */
......@@ -85,7 +84,6 @@ public:
virtual const std::string TypeName() const { return "NamedSelectionRPC"; }
// Invocation method
void ApplyNamedSelection(const std::vector<std::string> &ids, const std::string &selName);
const SelectionSummary &CreateNamedSelection(int id, const SelectionProperties &);
void DeleteNamedSelection(const std::string &selName);
void LoadNamedSelection(const std::string &selName);
......@@ -95,23 +93,20 @@ public:
virtual void SelectAll();
// Property setting methods
void SetPlotNames(const std::vector<std::string> &ids);
void SetPlotID(int);
void SetSelectionName(const std::string &s);
void SetNamedSelectionOperation(NamedSelectionOperation t);
void SetSelectionProperties(const SelectionProperties &p);
// Property getting methods
const std::vector<std::string> &GetPlotNames(void) const { return plotNames; }
int GetPlotID(void) const { return plotId; }
const std::string &GetSelectionName(void) const { return selName; }
NamedSelectionOperation GetNamedSelectionOperation(void) const { return selOperation; }
const SelectionProperties &GetSelectionProperties() const { return properties; }
private:
std::vector<std::string> plotNames;
NamedSelectionOperation selOperation;
int plotId;
std::string selName;
NamedSelectionOperation selOperation;
SelectionProperties properties;