Commit 6b53a74e authored by hrchilds's avatar hrchilds
Browse files

Add new option for streamline algorithm that allows VisIt to choose the best streamline algorithm.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@12648 18c085ea-50e0-402c-830e-de6fd14e8384
parent eee83353
......@@ -821,6 +821,47 @@ avtPICSFilter::Execute(void)
}
}
// ****************************************************************************
// Function: AlgorithmToString
//
// Purpose:
// Gets the name of an algorithm
//
// Programmer: Hank Childs
// Creation: September 29, 2010
//
// ****************************************************************************
const char *
AlgorithmToString(int algo)
{
if (algo == STREAMLINE_PARALLEL_STATIC_DOMAINS)
{
static const char *s = "Parallel Static Domains";
return s;
}
if (algo == STREAMLINE_MASTER_SLAVE)
{
static const char *s = "Master Slave";
return s;
}
if (algo == STREAMLINE_LOAD_ONDEMAND)
{
static const char *s = "Load On-Demand";
return s;
}
if (algo == STREAMLINE_VISIT_SELECTS)
{
static const char *s = "VisIt Selects Best Algo";
return s;
}
static const char *s = "Unknown Algorithm";
return s;
}
// ****************************************************************************
// Method: avtPICSFilter::Initialize
//
......@@ -882,6 +923,9 @@ avtPICSFilter::Execute(void)
// Hank Childs, Sun Sep 19 11:04:32 PDT 2010
// Parallel support for case where domain IDs are not unique.
//
// Hank Childs, Wed Sep 29 19:25:06 PDT 2010
// Add support for the "VisIt Selects" algorithm.
//
// ****************************************************************************
void
......@@ -1022,12 +1066,32 @@ avtPICSFilter::Initialize()
#ifdef PARALLEL
// If not operating on demand, the method *has* to be parallel static domains.
int actualMethod = method;
if (actualMethod == STREAMLINE_VISIT_SELECTS)
actualMethod = STREAMLINE_MASTER_SLAVE;
if ( ! OperatingOnDemand() )
method = STREAMLINE_PARALLEL_STATIC_DOMAINS;
{
debug1 << "Can only use parallel static domains because we can't operate on demand" << endl;
actualMethod = STREAMLINE_PARALLEL_STATIC_DOMAINS;
}
// Parallel and one domains, use the serial algorithm.
if (numDomains == 1)
{
debug1 << "Forcing load-on-demand since there is only one domain." << endl;
method = STREAMLINE_LOAD_ONDEMAND;
}
if ((method != STREAMLINE_VISIT_SELECTS) && (method != actualMethod))
{
char str[1024];
SNPRINTF(str, 1024, "Warning: you selected the algorithm \"%s\", but VisIt decided "
"it could not use that algorithm and instead used \"%s\".\n",
AlgorithmToString(method), AlgorithmToString(actualMethod));
avtCallback::IssueWarning(str);
}
method = actualMethod;
#else
// for serial, it's all load on demand.
method = STREAMLINE_LOAD_ONDEMAND;
......
......@@ -72,6 +72,8 @@ class avtICAlgorithm;
#define STREAMLINE_LOAD_ONDEMAND 0
#define STREAMLINE_PARALLEL_STATIC_DOMAINS 1
#define STREAMLINE_MASTER_SLAVE 2
#define STREAMLINE_VISIT_SELECTS 3
// ****************************************************************************
// Class: avtPICSFilter
......
......@@ -421,7 +421,7 @@ PyStreamlineAttributes_ToString(const StreamlineAttributes *atts, const char *pr
break;
}
const char *streamlineAlgorithmType_names = "LoadOnDemand, ParallelStaticDomains, MasterSlave";
const char *streamlineAlgorithmType_names = "LoadOnDemand, ParallelStaticDomains, MasterSlave, VisItSelects";
switch (atts->GetStreamlineAlgorithmType())
{
case StreamlineAttributes::LoadOnDemand:
......@@ -436,6 +436,10 @@ PyStreamlineAttributes_ToString(const StreamlineAttributes *atts, const char *pr
SNPRINTF(tmpStr, 1000, "%sstreamlineAlgorithmType = %sMasterSlave # %s\n", prefix, prefix, streamlineAlgorithmType_names);
str += tmpStr;
break;
case StreamlineAttributes::VisItSelects:
SNPRINTF(tmpStr, 1000, "%sstreamlineAlgorithmType = %sVisItSelects # %s\n", prefix, prefix, streamlineAlgorithmType_names);
str += tmpStr;
break;
default:
break;
}
......@@ -1795,14 +1799,14 @@ StreamlineAttributes_SetStreamlineAlgorithmType(PyObject *self, PyObject *args)
return NULL;
// Set the streamlineAlgorithmType in the object.
if(ival >= 0 && ival < 3)
if(ival >= 0 && ival < 4)
obj->data->SetStreamlineAlgorithmType(StreamlineAttributes::StreamlineAlgorithmType(ival));
else
{
fprintf(stderr, "An invalid streamlineAlgorithmType value was given. "
"Valid values are in the range of [0,2]. "
"Valid values are in the range of [0,3]. "
"You can also use the following names: "
"LoadOnDemand, ParallelStaticDomains, MasterSlave.");
"LoadOnDemand, ParallelStaticDomains, MasterSlave, VisItSelects.");
return NULL;
}
......@@ -2961,6 +2965,8 @@ PyStreamlineAttributes_getattr(PyObject *self, char *name)
return PyInt_FromLong(long(StreamlineAttributes::ParallelStaticDomains));
if(strcmp(name, "MasterSlave") == 0)
return PyInt_FromLong(long(StreamlineAttributes::MasterSlave));
if(strcmp(name, "VisItSelects") == 0)
return PyInt_FromLong(long(StreamlineAttributes::VisItSelects));
if(strcmp(name, "maxStreamlineProcessCount") == 0)
return StreamlineAttributes_GetMaxStreamlineProcessCount(self, NULL);
......
......@@ -935,6 +935,9 @@ QvisStreamlinePlotWindow::CreateAppearanceTab(QWidget *pageAppearance)
//
// Modifications:
//
// Hank Childs, Wed Sep 29 19:25:06 PDT 2010
// Add option for having VisIt select the best algorithm.
//
// ****************************************************************************
void
......@@ -959,6 +962,7 @@ QvisStreamlinePlotWindow::CreateAdvancedTab(QWidget *pageAdvanced)
slAlgo->addItem(tr("Streamlines"));
slAlgo->addItem(tr("Domains"));
slAlgo->addItem(tr("Streamlines and Domains"));
slAlgo->addItem(tr("Have VisIt select the best algorithm"));
connect(slAlgo, SIGNAL(activated(int)),
this, SLOT(streamlineAlgorithmChanged(int)));
algoGLayout->addWidget( slAlgoLabel, 1,0);
......
......@@ -62,6 +62,7 @@
LoadOnDemand
ParallelStaticDomains
MasterSlave
VisItSelects
</Enum>
<Enum name="IntegrationType">
DormandPrince
......@@ -214,7 +215,7 @@
DormandPrince
</Field>
<Field name="streamlineAlgorithmType" label="Streamline algorithm type" type="enum" subtype="StreamlineAlgorithmType">
ParallelStaticDomains
VisItSelects
</Field>
<Field name="maxStreamlineProcessCount" label="maxStreamlineProcessCount" type="int">
10
......
......@@ -243,21 +243,21 @@ StreamlineAttributes::TerminationType_FromString(const std::string &s, Streamlin
//
static const char *StreamlineAlgorithmType_strings[] = {
"LoadOnDemand", "ParallelStaticDomains", "MasterSlave"
};
"LoadOnDemand", "ParallelStaticDomains", "MasterSlave",
"VisItSelects"};
std::string
StreamlineAttributes::StreamlineAlgorithmType_ToString(StreamlineAttributes::StreamlineAlgorithmType t)
{
int index = int(t);
if(index < 0 || index >= 3) index = 0;
if(index < 0 || index >= 4) index = 0;
return StreamlineAlgorithmType_strings[index];
}
std::string
StreamlineAttributes::StreamlineAlgorithmType_ToString(int t)
{
int index = (t < 0 || t >= 3) ? 0 : t;
int index = (t < 0 || t >= 4) ? 0 : t;
return StreamlineAlgorithmType_strings[index];
}
......@@ -265,7 +265,7 @@ bool
StreamlineAttributes::StreamlineAlgorithmType_FromString(const std::string &s, StreamlineAttributes::StreamlineAlgorithmType &val)
{
val = StreamlineAttributes::LoadOnDemand;
for(int i = 0; i < 3; ++i)
for(int i = 0; i < 4; ++i)
{
if(s == StreamlineAlgorithmType_strings[i])
{
......@@ -502,7 +502,7 @@ void StreamlineAttributes::Init()
absTol = 1e-05;
terminationType = Distance;
integrationType = DormandPrince;
streamlineAlgorithmType = ParallelStaticDomains;
streamlineAlgorithmType = VisItSelects;
maxStreamlineProcessCount = 10;
maxDomainCacheSize = 3;
workGroupSize = 32;
......@@ -1873,7 +1873,7 @@ StreamlineAttributes::SetFromNode(DataNode *parentNode)
if(node->GetNodeType() == INT_NODE)
{
int ival = node->AsInt();
if(ival >= 0 && ival < 3)
if(ival >= 0 && ival < 4)
SetStreamlineAlgorithmType(StreamlineAlgorithmType(ival));
}
else if(node->GetNodeType() == STRING_NODE)
......
......@@ -103,7 +103,8 @@ public:
{
LoadOnDemand,
ParallelStaticDomains,
MasterSlave
MasterSlave,
VisItSelects
};
enum IntegrationType
{
......
......@@ -96,6 +96,7 @@ public class StreamlineAttributes extends AttributeSubject implements Plugin
public final static int STREAMLINEALGORITHMTYPE_LOADONDEMAND = 0;
public final static int STREAMLINEALGORITHMTYPE_PARALLELSTATICDOMAINS = 1;
public final static int STREAMLINEALGORITHMTYPE_MASTERSLAVE = 2;
public final static int STREAMLINEALGORITHMTYPE_VISITSELECTS = 3;
public final static int INTEGRATIONTYPE_DORMANDPRINCE = 0;
public final static int INTEGRATIONTYPE_ADAMSBASHFORTH = 1;
......@@ -188,7 +189,7 @@ public class StreamlineAttributes extends AttributeSubject implements Plugin
absTol = 1e-05;
terminationType = TERMINATIONTYPE_DISTANCE;
integrationType = INTEGRATIONTYPE_DORMANDPRINCE;
streamlineAlgorithmType = STREAMLINEALGORITHMTYPE_PARALLELSTATICDOMAINS;
streamlineAlgorithmType = STREAMLINEALGORITHMTYPE_VISITSELECTS;
maxStreamlineProcessCount = 10;
maxDomainCacheSize = 3;
workGroupSize = 32;
......@@ -298,7 +299,7 @@ public class StreamlineAttributes extends AttributeSubject implements Plugin
absTol = 1e-05;
terminationType = TERMINATIONTYPE_DISTANCE;
integrationType = INTEGRATIONTYPE_DORMANDPRINCE;
streamlineAlgorithmType = STREAMLINEALGORITHMTYPE_PARALLELSTATICDOMAINS;
streamlineAlgorithmType = STREAMLINEALGORITHMTYPE_VISITSELECTS;
maxStreamlineProcessCount = 10;
maxDomainCacheSize = 3;
workGroupSize = 32;
......@@ -1591,6 +1592,8 @@ public class StreamlineAttributes extends AttributeSubject implements Plugin
str = str + "STREAMLINEALGORITHMTYPE_PARALLELSTATICDOMAINS";
if(streamlineAlgorithmType == STREAMLINEALGORITHMTYPE_MASTERSLAVE)
str = str + "STREAMLINEALGORITHMTYPE_MASTERSLAVE";
if(streamlineAlgorithmType == STREAMLINEALGORITHMTYPE_VISITSELECTS)
str = str + "STREAMLINEALGORITHMTYPE_VISITSELECTS";
str = str + "\n";
str = str + intToString("maxStreamlineProcessCount", maxStreamlineProcessCount, indent) + "\n";
str = str + intToString("maxDomainCacheSize", maxDomainCacheSize, indent) + "\n";
......
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