Commit 82308ff5 authored by hrchilds's avatar hrchilds
Browse files

Update from February 4, 2004

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@169 18c085ea-50e0-402c-830e-de6fd14e8384
parent 58e95c1e
......@@ -91,3 +91,22 @@ avtMultipleInputExpressionFilter::IsPointVariable(void)
}
// ****************************************************************************
// Method: avtMultipleInputExpressionFilter::ClearInputVariableNames
//
// Purpose:
// Clears the input variable names. This allows a filter to be used
// repeatedly.
//
// Programmer: Hank Childs
// Creation: February 4, 2004
//
// ****************************************************************************
void
avtMultipleInputExpressionFilter::ClearInputVariableNames(void)
{
varnames.clear();
}
......@@ -33,6 +33,7 @@ class EXPRESSION_API avtMultipleInputExpressionFilter
virtual ~avtMultipleInputExpressionFilter();
virtual void AddInputVariableName(const char *var);
void ClearInputVariableNames(void);
virtual const char *GetType(void)
{ return "avtMultipleInputExpressionFilter"; }
......
......@@ -125,6 +125,24 @@ avtImage::ReleaseData(void)
image.ReleaseData();
}
// ****************************************************************************
// Method: avtImage::Instance
//
// Purpose:
// Creates an instance of an avtImage.
//
// Programmer: Mark C. Miller
// Creation: February 4, 2004
//
// ****************************************************************************
avtDataObject *
avtImage::Instance(void)
{
avtDataObjectSource *src = NULL;
avtImage *img = new avtImage(src);
return img;
}
// ****************************************************************************
// Method: avtImage::DerivedCopy
......
......@@ -29,6 +29,9 @@
// Hank Childs, Wed Nov 21 12:08:42 PST 2001
// Re-define DerivedCopy.
//
// Mark C. Miller, Wed Feb 4 19:47:30 PST 2004
// Added Instance, needed by avtDataObject->Clone
//
// ****************************************************************************
class PIPELINE_API avtImage : public avtDataObject
......@@ -47,6 +50,7 @@ class PIPELINE_API avtImage : public avtDataObject
virtual const char *GetType(void) { return "avtImage"; };
virtual int GetNumberOfCells(bool polysOnly = false) const;
virtual avtDataObject *Instance(void);
virtual avtDataObjectWriter
*InstantiateWriter(void);
virtual void ReleaseData(void);
......
......@@ -5,6 +5,26 @@
#include <avtNullData.h>
#include <avtNullDataWriter.h>
// ****************************************************************************
// Method: avtNullData::Instance
//
// Purpose:
// Creates an instance of an avtNullData taking care to copy the incomming
// null data object's type string.
//
// Programmer: Mark C. Miller
// Creation: February 4, 2004
//
// ****************************************************************************
avtDataObject *
avtNullData::Instance(void)
{
avtDataObjectSource *src = NULL;
avtNullData *nd = new avtNullData(src,GetType());
return nd;
}
// ****************************************************************************
// Method: avtNullData::InstantiateWriter
//
......
......@@ -25,6 +25,11 @@ const char * const AVT_NULL_DATASET_MSG = "avtDataset withheld; over scalable th
// Programmer: Mark C. Miller
// Creation: January 7, 2003
//
// Modifications:
//
// Mark C. Miller, Wed Feb 4 19:47:30 PST 2004
// Added Instance & DerivedCopy, needed by avtDataObject->Clone
//
// ****************************************************************************
class PIPELINE_API avtNullData : public avtDataObject
......@@ -38,9 +43,11 @@ class PIPELINE_API avtNullData : public avtDataObject
virtual const char *GetType(void) { return typeStr.c_str(); };
virtual int GetNumberOfCells(bool polysOnly = false) const { return 0;};
virtual void SetType(char *_typeStr ) { typeStr = _typeStr; };
avtDataObject *Instance(void);
avtDataObjectWriter *InstantiateWriter(void);
protected:
virtual void DerivedCopy(avtDataObject *) {;};
virtual void DerivedMerge(avtDataObject *dob) {;};
private:
......
......@@ -56,6 +56,9 @@
# Kathleen Bonnell, Tue Dec 2 17:44:34 PST 2003
# Added avtCurvePickQuery.
#
# Hank Childs, Tue Feb 3 16:58:36 PST 2004
# Added variable summation, weighted variable summation.
#
##############################################################################
@SET_MAKE@
......@@ -90,7 +93,9 @@ Queries_src= \
Queries/avtTotalRevolvedVolumeQuery.C \
Queries/avtTotalSurfaceAreaQuery.C \
Queries/avtTotalVolumeQuery.C \
Queries/avtVariableQuery.C
Queries/avtVariableQuery.C \
Queries/avtVariableSummationQuery.C \
Queries/avtWeightedVariableSummationQuery.C
CPPFLAGS=@COMPONENT_CPPFLAGS@ @CPPFLAGS@
......
// ************************************************************************* //
// avtVariableSummationQuery.C //
// ************************************************************************* //
#include <avtVariableSummationQuery.h>
#include <avtTerminatingSource.h>
using std::string;
// ****************************************************************************
// Method: avtVariableSummationQuery constructor
//
// Programmer: Hank Childs
// Creation: February 3, 2004
//
// ****************************************************************************
avtVariableSummationQuery::avtVariableSummationQuery() : avtSummationQuery()
{
}
// ****************************************************************************
// Method: avtVariableSummationQuery destructor
//
// Programmer: Hank Childs
// Creation: February 3, 2004
//
// ****************************************************************************
avtVariableSummationQuery::~avtVariableSummationQuery()
{
}
// ****************************************************************************
// Method: avtVariableSummationQuery::VerifyInput
//
// Purpose:
// Now that we have an input, we can determine what the variable name is
// and tell the base class about it.
//
// Programmer: Hank Childs
// Creation: February 3, 2004
//
// ****************************************************************************
void
avtVariableSummationQuery::VerifyInput(void)
{
//
// We want to do this in addition to what the base class does, so call the
// base class' version of this method as well.
//
avtSummationQuery::VerifyInput();
avtDataSpecification_p dspec = GetInput()->GetTerminatingSource()
->GetFullDataSpecification();
string varname = dspec->GetVariable();
SetVariableName(varname);
SumGhostValues(false);
SetSumType(varname);
}
// ************************************************************************* //
// avtVariableSummationQuery.h //
// ************************************************************************* //
#ifndef AVT_VARIABLE_SUMMATION_QUERY_H
#define AVT_VARIABLE_SUMMATION_QUERY_H
#include <query_exports.h>
#include <avtSummationQuery.h>
// ****************************************************************************
// Class: avtVariableSummationQuery
//
// Purpose:
// A query that will sum all of one variables values.
//
// Programmer: Hank Childs
// Creation: February 3, 2004
//
// ****************************************************************************
class QUERY_API avtVariableSummationQuery : public avtSummationQuery
{
public:
avtVariableSummationQuery();
virtual ~avtVariableSummationQuery();
virtual const char *GetType(void)
{ return "avtVariableSummationQuery"; };
protected:
virtual void VerifyInput(void);
};
#endif
// ************************************************************************* //
// avtWeightedVariableSummationQuery.C //
// ************************************************************************* //
#include <avtWeightedVariableSummationQuery.h>
#include <avtBinaryMultiplyFilter.h>
#include <avtSourceFromAVTDataset.h>
#include <avtTerminatingSource.h>
#include <avtVMetricArea.h>
#include <avtVMetricVolume.h>
using std::string;
// ****************************************************************************
// Method: avtWeightedVariableSummationQuery constructor
//
// Programmer: Hank Childs
// Creation: February 3, 2004
//
// ****************************************************************************
avtWeightedVariableSummationQuery::avtWeightedVariableSummationQuery()
: avtSummationQuery()
{
area = new avtVMetricArea;
area->SetOutputVariableName("avt_weights");
multiply = new avtBinaryMultiplyFilter;
multiply->SetOutputVariableName("avt_sum");
volume = new avtVMetricVolume;
volume->SetOutputVariableName("avt_weights");
string vname = "avt_sum";
SetVariableName(vname);
SumGhostValues(false);
SumOnlyPositiveValues(true);
}
// ****************************************************************************
// Method: avtWeightedVariableSummationQuery destructor
//
// Programmer: Hank Childs
// Creation: February 3, 2004
//
// ****************************************************************************
avtWeightedVariableSummationQuery::~avtWeightedVariableSummationQuery()
{
delete area;
delete multiply;
delete volume;
}
// ****************************************************************************
// Method: avtWeightedVariableSummationQuery::ApplyFilters
//
// Purpose:
// Applies the filters to the input.
//
// Programmer: Hank Childs
// Creation: February 3, 2004
//
// ****************************************************************************
avtDataObject_p
avtWeightedVariableSummationQuery::ApplyFilters(avtDataObject_p inData)
{
//
// Create an artificial pipeline.
//
avtDataset_p ds;
CopyTo(ds, inData);
avtSourceFromAVTDataset termsrc(ds);
avtDataObject_p dob = termsrc.GetOutput();
//
// Set up our base class so it is ready to sum.
//
avtDataSpecification_p dspec = GetInput()->GetTerminatingSource()
->GetFullDataSpecification();
string varname = dspec->GetVariable();
SetSumType(varname);
int topo = GetInput()->GetInfo().GetAttributes().GetTopologicalDimension();
if (topo == 2)
{
area->SetInput(dob);
dob = area->GetOutput();
}
else
{
volume->SetInput(dob);
dob = volume->GetOutput();
}
multiply->SetInput(dob);
multiply->ClearInputVariableNames();
multiply->AddInputVariableName("avt_weights");
multiply->AddInputVariableName(varname.c_str());
//
// Cause our artificial pipeline to execute.
//
avtPipelineSpecification_p pspec = inData->GetTerminatingSource()
->GetGeneralPipelineSpecification();
multiply->GetOutput()->Update(pspec);
return multiply->GetOutput();
}
// ************************************************************************* //
// avtWeightedVariableSummationQuery.h //
// ************************************************************************* //
#ifndef AVT_WEIGHTED_VARIABLE_SUMMATION_QUERY_H
#define AVT_WEIGHTED_VARIABLE_SUMMATION_QUERY_H
#include <query_exports.h>
#include <avtSummationQuery.h>
class avtBinaryMultiplyFilter;
class avtVMetricArea;
class avtVMetricVolume;
// ****************************************************************************
// Class: avtWeightedVariableSummationQuery
//
// Purpose:
// A query that will sum all of one variables values.
//
// Programmer: Hank Childs
// Creation: February 3, 2004
//
// ****************************************************************************
class QUERY_API avtWeightedVariableSummationQuery : public avtSummationQuery
{
public:
avtWeightedVariableSummationQuery();
virtual ~avtWeightedVariableSummationQuery();
virtual const char *GetType(void)
{ return "avtWeightedVariableSummationQuery"; };
protected:
avtVMetricArea *area;
avtVMetricVolume *volume;
avtBinaryMultiplyFilter *multiply;
virtual avtDataObject_p ApplyFilters(avtDataObject_p);
virtual int GetNFilters(void) { return 2; };
};
#endif
......@@ -790,6 +790,9 @@ Engine::AlarmHandler(int signal)
// Jeremy Meredith, Thu Jul 10 11:37:48 PDT 2003
// Made the engine an object.
//
// Mark C. Miller, Wed Feb 4 19:45:35 PST 2004
// Made the ui_dob a 'clone' of the writer's input
//
// ****************************************************************************
void
Engine::WriteData(NonBlockingRPC *rpc, avtDataObjectWriter_p &writer)
......@@ -808,12 +811,12 @@ Engine::WriteData(NonBlockingRPC *rpc, avtDataObjectWriter_p &writer)
avtDataObject_p ui_dob = writer->GetInput();
// Create a writer to write across the network.
avtDataObjectWriter_p networkwriter = ui_dob->InstantiateWriter();
networkwriter->SetDestinationFormat(destinationFormat);
if (writer->MustMergeParallelStreams())
{
// we clone here to preserve this processor's orig network output
// while we merge other proc's output into the cloned dob
ui_dob = ui_dob->Clone();
for (int i=1; i<PAR_Size(); i++)
{
MPI_Status stat;
......@@ -850,6 +853,11 @@ Engine::WriteData(NonBlockingRPC *rpc, avtDataObjectWriter_p &writer)
}
visitTimer->StopTimer(collectData, "Collecting data");
// Create a writer to write across the network.
avtDataObjectWriter_p networkwriter = ui_dob->InstantiateWriter();
networkwriter->SetDestinationFormat(destinationFormat);
// indicate that cumulative extents in data object now as good as true extents
ui_dob->GetInfo().GetAttributes().SetCanUseCummulativeAsTrueOrCurrent(true);
......
......@@ -37,6 +37,8 @@
#include <avtTotalRevolvedVolumeQuery.h>
#include <avtTotalRevolvedSurfaceAreaQuery.h>
#include <avtVariableQuery.h>
#include <avtVariableSummationQuery.h>
#include <avtWeightedVariableSummationQuery.h>
#include <avtWholeImageCompositer.h>
#include <avtPlot.h>
#include <VisWindow.h>
......@@ -1752,6 +1754,9 @@ NetworkManager::Pick(const int id, PickAttributes *pa)
// Hank Childs, Mon Jan 5 16:39:06 PST 2004
// Make sure the network hasn't already been cleared.
//
// Hank Childs, Tue Feb 3 17:07:25 PST 2004
// Added variable summation query.
//
// ****************************************************************************
void
NetworkManager::Query(const std::vector<int> &ids, QueryAttributes *qa)
......@@ -1854,6 +1859,14 @@ NetworkManager::Query(const std::vector<int> &ids, QueryAttributes *qa)
q->SetNthInput(queryInputs[1], 1);
query = q;
}
else if (strcmp(queryName.c_str(), "Variable Sum") == 0)
{
query = new avtVariableSummationQuery();
}
else if (strcmp(queryName.c_str(), "Weighted Variable Sum") == 0)
{
query = new avtWeightedVariableSummationQuery();
}
else if (strcmp(queryName.c_str(), "Variable by Zone") == 0)
{
query = new avtVariableQuery();
......
package llnl.visit.operators;
import llnl.visit.AttributeSubject;
import llnl.visit.CommunicationBuffer;
import llnl.visit.Plugin;
// ****************************************************************************
// Class: IsovolumeAttributes
//
// Purpose:
// This class contains attributes for the isovolume operator.
//
// Notes: Autogenerated by xml2java.
//
// Programmer: xml2java
// Creation: Fri Jan 30 14:50:27 PST 2004
//
// Modifications:
//
// ****************************************************************************
public class IsovolumeAttributes extends AttributeSubject implements Plugin
{
public IsovolumeAttributes()
{
super(3);
lbound = -1e+37;
ubound = 1e+37;
variable = new String("default");
}
public IsovolumeAttributes(IsovolumeAttributes obj)
{
super(3);
lbound = obj.lbound;
ubound = obj.ubound;
variable = new String(obj.variable);
SelectAll();
}
public boolean equals(IsovolumeAttributes obj)
{
// Create the return value
return ((lbound == obj.lbound) &&
(ubound == obj.ubound) &&
(variable == obj.variable));
}
public String GetName() { return "Isovolume"; }
public String GetVersion() { return "1.0"; }
// Property setting methods
public void SetLbound(double lbound_)
{
lbound = lbound_;
Select(0);
}
public void SetUbound(double ubound_)
{
ubound = ubound_;
Select(1);
}
public void SetVariable(String variable_)
{
variable = variable_;
Select(2);
}
// Property getting methods
public double GetLbound() { return lbound; }
public double GetUbound() { return ubound; }
public String GetVariable() { return variable; }
// Write and read methods.
public void WriteAtts(CommunicationBuffer buf)
{
if(WriteSelect(0, buf))
buf.WriteDouble(lbound);
if(WriteSelect(1, buf))
buf.WriteDouble(ubound);
if(WriteSelect(2, buf))
buf.WriteString(variable);
}
public void ReadAtts(int n, CommunicationBuffer buf)
{
for(int i = 0; i < n; ++i)
{
int index = (int)buf.ReadByte();
switch(index)
{
case 0:
SetLbound(buf.ReadDouble());
break;
case 1:
SetUbound(buf.ReadDouble());
break;
case 2:
SetVariable(buf.ReadString());
break;
}
}
}
// Attributes
private double lbound;