Commit c653d2e8 authored by bonnell's avatar bonnell

Add xml results to some queries

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@22838 18c085ea-50e0-402c-830e-de6fd14e8384
parent 2318f5b7
......@@ -130,11 +130,18 @@ avtAreaBetweenCurvesQuery::CompareCurves(int n1, const float *x1, const float *y
// Cyrus Harrison, Tue Sep 18 13:45:35 PDT 2007
// Added support for user settable floating point format string
//
// Kathleen Biagas, Thu Feb 13 15:04:58 PST 2014
// Add Xml results.
//
// ****************************************************************************
std::string
avtAreaBetweenCurvesQuery::CreateMessage(double area)
{
MapNode result_node;
result_node["area_between_curves"] = area;
queryAtts.SetXmlResult(result_node.ToXML());
char msg[1024];
std::string format = "The area between the curves is "
+ queryAtts.GetFloatFormat() +".";
......
......@@ -328,6 +328,9 @@ avtCompactnessQuery::MidExecute(void)
// Hank Childs, Fri Oct 6 09:39:54 PDT 2006
// Made the compactness query return an array for Python.
//
// Kathleen Biagas, Thu Feb 13 15:04:58 PST 2014
// Add Xml results.
//
// ****************************************************************************
void
......@@ -398,6 +401,14 @@ avtCompactnessQuery::PostExecute(void)
values.push_back(distBound_dv_vol);
values.push_back(distOrigin_da);
MapNode result_node;
result_node["XSA"] = totalXSectArea;
result_node["VOL"] = totalRotVolume;
result_node["dist_bound_da_xsa"] = distBound_da_xsa;
result_node["dist_bound_da_vol"] = distBound_da_vol;
result_node["dist_bound_dv_xsa"] = distBound_dv_xsa;
result_node["dist_bound_dv_vol"] = distBound_dv_vol;
result_node["dist_origin_da"] = distOrigin_da;
// If we have a density variable available
if (!densityValid)
......@@ -438,9 +449,15 @@ avtCompactnessQuery::PostExecute(void)
values.push_back(centMassY);
values.push_back(distBound_dv_den_vol);
values.push_back(distCMass_dv_den_vol);
result_node["MASS"] = totalRotMass;
result_node["center_mass_x"] = centMassX;
result_node["center_mass_y"] = centMassY;
result_node["distBound_dv_den_vol"] = distBound_dv_den_vol;
result_node["distCMass_dv_den_vol"] = distCMass_dv_den_vol;
}
SetResultValues(values);
SetXmlResult(result_node.ToXML());
}
// ****************************************************************************
......
......@@ -319,6 +319,10 @@ avtEulerianQuery::Execute(vtkDataSet *in_ds, const int dom)
//
// Mark C. Miller, Mon Jan 22 22:09:01 PST 2007
// Changed MPI_COMM_WORLD to VISIT_MPI_COMM
//
// Kathleen Biagas, Thu Feb 13 15:04:58 PST 2014
// Add Xml results.
//
// ****************************************************************************
void
......@@ -380,9 +384,11 @@ avtEulerianQuery::PostExecute(void)
char msgBuff[500];
DomainToEulerMap::iterator iter;
int blockOrigin = GetInput()->GetInfo().GetAttributes().GetBlockOrigin();
MapNode de;
for (iter = domToEulerMap.begin(); iter != domToEulerMap.end(); iter++)
{
string domainName;
std::stringstream dns;
GetInput()->GetQueryableSource()->GetDomainName(
queryAtts.GetVariables()[0], queryAtts.GetTimeStep(),
(*iter).first, domainName);
......@@ -390,17 +396,26 @@ avtEulerianQuery::PostExecute(void)
{
SNPRINTF(msgBuff, 500, "Eulerian for %s is %d\n",
domainName.c_str(), (*iter).second);
dns << domainName;
}
else
{
SNPRINTF(msgBuff, 500, "Eulerian for domain %d is %d\n",
(*iter).first + blockOrigin, (*iter).second);
dns << "domain " << (*iter).first+blockOrigin;
}
de[dns.str()] = (*iter).second;
msg += msgBuff;
}
if (msg.size() == 0)
msg = "Eulerian could not compute.\n" ;
SetResultMessage(msg);
if (de.GetNumEntries() > 0)
{
MapNode result_node;
result_node["eulerian"] = de;
SetXmlResult(result_node.ToXML());
}
}
......
......@@ -134,11 +134,18 @@ avtIntegrateQuery::CurveQuery(int n1, const float *x1, const float *y1)
// Cyrus Harrison, Tue Sep 18 13:45:35 PDT 2007
// Added support for user settable floating point format string
//
// Kathleen Biagas, Thu Feb 13 15:04:58 PST 2014
// Add Xml results.
//
// ****************************************************************************
std::string
avtIntegrateQuery::CreateMessage(double integral)
{
MapNode result_node;
result_node["area_under_curve"] = integral;
SetXmlResult(result_node.ToXML());
char msg[1024];
std::string format = "The area under the curve is "
+ queryAtts.GetFloatFormat() + ".";
......
......@@ -168,11 +168,18 @@ avtL2NormBetweenCurvesQuery::CompareCurves(int n1, const float *x1,
// Cyrus Harrison, Tue Sep 18 13:45:35 PDT 2007
// Added support for user settable floating point format string
//
// Kathleen Biagas, Thu Feb 13 15:04:58 PST 2014
// Add Xml results.
//
// ****************************************************************************
std::string
avtL2NormBetweenCurvesQuery::CreateMessage(double l2norm)
{
MapNode result_node;
result_node["L2Norm_between_curves"] = l2norm;
queryAtts.SetXmlResult(result_node.ToXML());
char msg[1024];
std::string format = "The L2Norm between the two curves is "
+ queryAtts.GetFloatFormat() +".";
......
This diff is collapsed.
......@@ -112,6 +112,9 @@ avtNumNodesQuery::GetDefaultInputParams(MapNode &params)
// Hank Childs, Sat Nov 21 13:25:42 PST 2009
// Add long long support.
//
// Kathleen Biagas, Wed Feb 12 08:17:21 PST 2014
// Add xml results.
//
// ****************************************************************************
void
......@@ -151,6 +154,8 @@ avtNumNodesQuery::PerformQuery(QueryAttributes *qA)
SumLongLongArrayAcrossAllProcessors(totalNodes, tn, 2);
MapNode result_node;
result_node["num_nodes"] = (int)tn[0];
if (OriginalData())
SNPRINTF(msg, 200, "The original number of nodes is %ld.", tn[0]);
else
......@@ -169,8 +174,9 @@ avtNumNodesQuery::PerformQuery(QueryAttributes *qA)
double results[2] = {(double) tn[0], (double) tn[1]};
qA->SetResultsValues(results, 2);
qA->SetResultsMessage(msg2);
result_node["num_ghost_nodes"] = (int)tn[1];
}
qA->SetXmlResult(result_node.ToXML());
UpdateProgress(1, 0);
}
......@@ -122,6 +122,9 @@ avtNumZonesQuery::GetDefaultInputParams(MapNode &params)
// Hank Childs, Sat Nov 21 13:10:43 PST 2009
// Change counter to long long.
//
// Kathleen Biagas, Wed Feb 12 09:07:34 PST 2014
// Add xml results.
//
// ****************************************************************************
void
......@@ -158,6 +161,9 @@ avtNumZonesQuery::PerformQuery(QueryAttributes *qA)
VISIT_LONG_LONG tz[2] = {0, 0};
SumLongLongArrayAcrossAllProcessors(totalZones, tz, 2);
MapNode result_node;
result_node["num_zones"] = (int)tz[0];
if (OriginalData())
SNPRINTF(msg, 200, "The original number of zones is %ld.", tz[0]);
else
......@@ -175,7 +181,10 @@ avtNumZonesQuery::PerformQuery(QueryAttributes *qA)
double results[2] = {(double) tz[0], (double) tz[1]};
qA->SetResultsValues(results, 2);
qA->SetResultsMessage(msg2);
result_node["num_ghost_zones"] = (int)tz[1];
}
qA->SetXmlResult(result_node.ToXML());
UpdateProgress(1, 0);
}
......@@ -130,6 +130,9 @@ avtOriginalDataSpatialExtentsQuery::ApplyFilters(avtDataObject_p inData)
// Cyrus Harrison, Tue Sep 18 13:45:35 PDT 2007
// Added support for user settable floating point format string
//
// Kathleen Biagas, Thu Feb 13 15:04:58 PST 2014
// Add Xml results.
//
// ****************************************************************************
void
......@@ -186,6 +189,10 @@ avtOriginalDataSpatialExtentsQuery::PerformQuery(QueryAttributes *qA)
qA->SetResultsMessage(msg);
qA->SetResultsValue(d);
MapNode result_node;
result_node["extents"] = d;
qA->SetXmlResult(result_node.ToXML());
UpdateProgress(1, 0);
}
......@@ -315,6 +315,9 @@ avtSummationQuery::PreExecute(void)
// Fix the case where sums.size can return zero, causing a crash when we
// index the first element in the empty vector.
//
// Kathleen Biagas, Thu Feb 13 15:04:58 PST 2014
// Add Xml results.
//
// ****************************************************************************
void
......@@ -366,6 +369,11 @@ avtSummationQuery::PostExecute(void)
// get floating point format string
string floatFormat = queryAtts.GetFloatFormat();
MapNode result_node;
if (sums.size() == 1)
result_node[variableName] = sums[0];
else
result_node[variableName] = sums;
char buf[1024];
string str;
if (CalculateAverage())
......@@ -387,6 +395,7 @@ avtSummationQuery::PostExecute(void)
{
SNPRINTF(buf, 1024, " %s%s", units.c_str(), unitsAppend.c_str());
str += buf;
result_node["units"] = units+unitsAppend;
}
if (!qualifier.empty())
{
......@@ -401,6 +410,7 @@ avtSummationQuery::PostExecute(void)
//
SetResultMessage(str);
SetResultValues(sums);
SetXmlResult(result_node.ToXML());
}
......
......@@ -178,6 +178,9 @@ avtZoneCenterQuery::GetDefaultInputParams(MapNode &params)
// Kathleen Biagas, Tue Jun 21 10:14:51 PDT 2011
// Domain, Element, useGlobalId retrieved in SetInputParams.
//
// Kathleen Biagas, Thu Feb 13 15:04:58 PST 2014
// Add Xml results.
//
// ****************************************************************************
void
......@@ -227,17 +230,35 @@ avtZoneCenterQuery::PerformQuery(QueryAttributes *qA)
if (success)
{
int dim = GetInput()->GetInfo().GetAttributes().GetSpatialDimension();
doubleVector c;
c.push_back(coord[0]);
c.push_back(coord[1]);
if (dim == 3)
c.push_back(coord[2]);
qA->SetResultsValue(c);
MapNode result_node;
result_node["center"] = c;
if (singleDomain)
{
string global;
if (useGlobalId)
{
global = "global";
result_node["global_zone"] = element;
}
else
{
result_node["zone"] = element;
}
if (dim == 2)
{
format = "The center of %s zone %d is (" + floatFormat + ", "
+ floatFormat + ").";
SNPRINTF(msg, 120, format.c_str(),
global.c_str(), element, coord[0], coord[1]);
global.c_str(), element, c[0], c[1]);
}
else
{
......@@ -246,7 +267,7 @@ avtZoneCenterQuery::PerformQuery(QueryAttributes *qA)
+ floatFormat + ").";
SNPRINTF(msg, 120, format.c_str(),
global.c_str(), element,
coord[0], coord[1], coord[2]);
c[0], c[1], c[2]);
}
}
else
......@@ -258,13 +279,15 @@ avtZoneCenterQuery::PerformQuery(QueryAttributes *qA)
int ts = queryAtts.GetTimeStep();
string var = queryAtts.GetVariables()[0];
src->GetDomainName(var, ts, dom, domainName);
result_node["zone"] = element;
result_node["domain"] = domainName;
if (dim == 2)
{
format = "The center of zone %d (%s) is (" + floatFormat + ", "
+ floatFormat + ").";
SNPRINTF(msg, 120, format.c_str(),
element, domainName.c_str(),
coord[0], coord[1]);
c[0], c[1]);
}
else
{
......@@ -273,15 +296,10 @@ avtZoneCenterQuery::PerformQuery(QueryAttributes *qA)
+ floatFormat + ").";
SNPRINTF(msg, 120, format.c_str(),
element, domainName.c_str(),
coord[0], coord[1], coord[2]);
c[0], c[1], c[2]);
}
}
doubleVector c;
c.push_back((double)coord[0]);
c.push_back((double)coord[1]);
c.push_back((double)coord[2]);
qA->SetResultsValue(c);
qA->SetXmlResult(result_node.ToXML());
}
else
{
......
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