Commit 7eeac0cd authored by hrchilds's avatar hrchilds

Update from February 3, 2005

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@406 18c085ea-50e0-402c-830e-de6fd14e8384
parent 2e3a693c
......@@ -234,6 +234,9 @@
# Jeremy Meredith, Tue Nov 2 11:37:34 PST 2004
# Added SimulationCommand.
#
# Hank Childs, Tue Feb 1 08:49:27 PST 2005
# Added SurfaceFilterAttributes.
#
##############################################################################
##
......@@ -316,6 +319,7 @@ SRC= AnimationAttributes.C \
SphereAttributes.C \
StatusAttributes.C \
Subject.C \
SurfaceFilterAttributes.C \
SyncAttributes.C \
TimeFormat.C \
View2DAttributes.C \
......
This diff is collapsed.
#ifndef RESAMPLEATTRIBUTES_H
#define RESAMPLEATTRIBUTES_H
#include <state_exports.h>
#include <string>
#include <AttributeSubject.h>
// ****************************************************************************
......@@ -12,7 +13,7 @@
// Notes: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Thu Dec 18 11:24:28 PDT 2003
// Creation: Sat Jan 29 10:54:44 PDT 2005
//
// Modifications:
//
......@@ -25,7 +26,7 @@ public:
ResampleAttributes(const ResampleAttributes &obj);
virtual ~ResampleAttributes();
virtual void operator = (const ResampleAttributes &obj);
virtual ResampleAttributes& operator = (const ResampleAttributes &obj);
virtual bool operator == (const ResampleAttributes &obj) const;
virtual bool operator != (const ResampleAttributes &obj) const;
......@@ -36,6 +37,7 @@ public:
// Property selection methods
virtual void SelectAll();
void SelectArbitratorVarName();
// Property setting methods
void SetUseTargetVal(bool useTargetVal_);
......@@ -45,15 +47,36 @@ public:
void SetDepth(int depth_);
void SetPrefersPowersOfTwo(bool prefersPowersOfTwo_);
void SetDefaultVal(float defaultVal_);
void SetUseBounds(bool useBounds_);
void SetMinX(double minX_);
void SetMinY(double minY_);
void SetMinZ(double minZ_);
void SetMaxX(double maxX_);
void SetMaxY(double maxY_);
void SetMaxZ(double maxZ_);
void SetUseArbitrator(bool useArbitrator_);
void SetArbitratorLessThan(bool arbitratorLessThan_);
void SetArbitratorVarName(const std::string &arbitratorVarName_);
// Property getting methods
bool GetUseTargetVal() const;
int GetTargetVal() const;
int GetWidth() const;
int GetHeight() const;
int GetDepth() const;
bool GetPrefersPowersOfTwo() const;
float GetDefaultVal() const;
bool GetUseTargetVal() const;
int GetTargetVal() const;
int GetWidth() const;
int GetHeight() const;
int GetDepth() const;
bool GetPrefersPowersOfTwo() const;
float GetDefaultVal() const;
bool GetUseBounds() const;
double GetMinX() const;
double GetMinY() const;
double GetMinZ() const;
double GetMaxX() const;
double GetMaxY() const;
double GetMaxZ() const;
bool GetUseArbitrator() const;
bool GetArbitratorLessThan() const;
const std::string &GetArbitratorVarName() const;
std::string &GetArbitratorVarName();
// Persistence methods
virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
......@@ -67,13 +90,23 @@ public:
virtual bool FieldsEqual(int index, const AttributeGroup *rhs) const;
private:
bool useTargetVal;
int targetVal;
int width;
int height;
int depth;
bool prefersPowersOfTwo;
float defaultVal;
bool useTargetVal;
int targetVal;
int width;
int height;
int depth;
bool prefersPowersOfTwo;
float defaultVal;
bool useBounds;
double minX;
double minY;
double minZ;
double maxX;
double maxY;
double maxZ;
bool useArbitrator;
bool arbitratorLessThan;
std::string arbitratorVarName;
};
#endif
<?xml version="1.0"?>
<Attribute name="ResampleAttributes" purpose="This class contains attributes for the resample operator." exportAPI="STATE_API" exportInclude="state_exports.h">
<Field name="useTargetVal" type="bool">false</Field>
<Field name="targetVal" type="int">100000</Field>
<Field name="width" type="int">30</Field>
<Field name="height" type="int">30</Field>
<Field name="depth" type="int">30</Field>
<Field name="prefersPowersOfTwo" type="bool">false</Field>
<Field name="defaultVal" type="float">-1e38</Field>
<Attribute name="ResampleAttributes" purpose="This class contains attributes for the resample operator." persistent="true" exportAPI="STATE_API" exportInclude="state_exports.h">
<Field name="useTargetVal" label="useTargetVal" type="bool">
false
</Field>
<Field name="targetVal" label="targetVal" type="int">
100000
</Field>
<Field name="width" label="width" type="int">
30
</Field>
<Field name="height" label="height" type="int">
30
</Field>
<Field name="depth" label="depth" type="int">
30
</Field>
<Field name="prefersPowersOfTwo" label="prefersPowersOfTwo" type="bool">
false
</Field>
<Field name="defaultVal" label="defaultVal" type="float">
-99999996802856924650656260769173209088.000000
</Field>
<Field name="useBounds" label="useBounds" type="bool">
false
</Field>
<Field name="minX" label="minX" type="double">
0.000000
</Field>
<Field name="minY" label="minY" type="double">
0.000000
</Field>
<Field name="minZ" label="minZ" type="double">
0.000000
</Field>
<Field name="maxX" label="maxX" type="double">
1.000000
</Field>
<Field name="maxY" label="maxY" type="double">
1.000000
</Field>
<Field name="maxZ" label="maxZ" type="double">
1.000000
</Field>
<Field name="useArbitrator" label="useArbitrator" type="bool">
false
</Field>
<Field name="arbitratorLessThan" label="arbitratorLessThan" type="bool">
false
</Field>
<Field name="arbitratorVarName" label="arbitratorVarName" type="string">
default
</Field>
</Attribute>
This diff is collapsed.
#ifndef SURFACEFILTERATTRIBUTES_H
#define SURFACEFILTERATTRIBUTES_H
#include <string>
#include <AttributeSubject.h>
// ****************************************************************************
// Class: SurfaceFilterAttributes
//
// Purpose:
// Attributes for the surface filter
//
// Notes: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Tue Feb 1 11:14:58 PDT 2005
//
// Modifications:
//
// ****************************************************************************
class SurfaceFilterAttributes : public AttributeSubject
{
public:
enum Scaling
{
Linear,
Log,
Skew
};
enum LimitsMode
{
OriginalData,
CurrentPlot
};
SurfaceFilterAttributes();
SurfaceFilterAttributes(const SurfaceFilterAttributes &obj);
virtual ~SurfaceFilterAttributes();
virtual SurfaceFilterAttributes& operator = (const SurfaceFilterAttributes &obj);
virtual bool operator == (const SurfaceFilterAttributes &obj) const;
virtual bool operator != (const SurfaceFilterAttributes &obj) const;
virtual const std::string TypeName() const;
virtual bool CopyAttributes(const AttributeGroup *);
virtual AttributeSubject *CreateCompatible(const std::string &) const;
virtual AttributeSubject *NewInstance(bool) const;
// Property selection methods
virtual void SelectAll();
void SelectVariable();
// Property setting methods
void SetLimitsMode(LimitsMode limitsMode_);
void SetMinFlag(bool minFlag_);
void SetMaxFlag(bool maxFlag_);
void SetScaling(Scaling scaling_);
void SetSkewFactor(double skewFactor_);
void SetMin(double min_);
void SetMax(double max_);
void SetVariable(const std::string &variable_);
void SetUseXYLimits(bool useXYLimits_);
void SetGenerateNodalOutput(bool generateNodalOutput_);
// Property getting methods
LimitsMode GetLimitsMode() const;
bool GetMinFlag() const;
bool GetMaxFlag() const;
Scaling GetScaling() const;
double GetSkewFactor() const;
double GetMin() const;
double GetMax() const;
const std::string &GetVariable() const;
std::string &GetVariable();
bool GetUseXYLimits() const;
bool GetGenerateNodalOutput() const;
// Persistence methods
virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
virtual void SetFromNode(DataNode *node);
// Enum conversion functions
static std::string Scaling_ToString(Scaling);
static bool Scaling_FromString(const std::string &, Scaling &);
protected:
static std::string Scaling_ToString(int);
public:
static std::string LimitsMode_ToString(LimitsMode);
static bool LimitsMode_FromString(const std::string &, LimitsMode &);
protected:
static std::string LimitsMode_ToString(int);
public:
// Keyframing methods
virtual std::string GetFieldName(int index) const;
virtual AttributeGroup::FieldType GetFieldType(int index) const;
virtual std::string GetFieldTypeName(int index) const;
virtual bool FieldsEqual(int index, const AttributeGroup *rhs) const;
private:
int limitsMode;
bool minFlag;
bool maxFlag;
int scaling;
double skewFactor;
double min;
double max;
std::string variable;
bool useXYLimits;
bool generateNodalOutput;
};
#endif
<?xml version="1.0"?>
<Attribute name="SurfaceFilterAttributes" purpose="Attributes for the surface filter" persistent="true">
<Enum name="Scaling">
Linear
Log
Skew
</Enum>
<Enum name="LimitsMode">
OriginalData
CurrentPlot
</Enum>
<Field name="limitsMode" label="LimitsMode" type="enum" subtype="LimitsMode">
OriginalData
</Field>
<Field name="minFlag" label="Use min" type="bool">
false
</Field>
<Field name="maxFlag" label="Use max" type="bool">
false
</Field>
<Field name="scaling" label="Scale" type="enum" subtype="Scaling">
Linear
</Field>
<Field name="skewFactor" label="Skew factor" type="double" enabler="scaling:Skew">
1.000001
</Field>
<Field name="min" label="Min" type="double" enabler="minFlag:true">
0.000000
</Field>
<Field name="max" label="Max" type="double" enabler="maxFlag:true">
1.000000
</Field>
<Field name="variable" label="Elevate by Variable" type="variablename" vartypes="010000000">
default
</Field>
<Field name="useXYLimits" label="Use XY Limits" type="bool">
true
</Field>
<Field name="generateNodalOutput" label="Generate Nodal Output" type="bool">
true
</Field>
</Attribute>
......@@ -50,6 +50,9 @@
# Brad Whitlock, Tue Jan 4 18:14:57 PST 2005
# Added -lexpr so we can link on MacOS X.
#
# Hank Childs, Tue Feb 1 08:47:07 PST 2005
# Added avtSurfaceFilter.
#
##############################################################################
##
......@@ -87,6 +90,7 @@ SRC=\
avtSimilarityTransformFilter.C \
avtSmoothPolyDataFilter.C \
avtSummationFilter.C \
avtSurfaceFilter.C \
avtTiledImageCompositor.C \
avtTransform.C \
avtVertexNormalsFilter.C \
......
......@@ -153,6 +153,10 @@ avtGhostZoneAndFacelistFilter::SetForceFaceConsolidation(bool val)
// Mark C. Miller, Thu Oct 16 05:46:06 PDT 2003
// Added condition that if ghost were CREATED, apply facelist filter first
//
// Hank Childs, Wed Feb 2 08:56:00 PST 2005
// Make sure we are using the right variable in the spec, since that will
// affect what the active variable is.
//
// ****************************************************************************
void
......@@ -173,18 +177,25 @@ avtGhostZoneAndFacelistFilter::Execute(void)
avtSourceFromAVTDataset termsrc(ds);
avtDataObject_p data = termsrc.GetOutput();
avtPipelineSpecification_p specForDB = GetGeneralPipelineSpecification();
avtDataSpecification_p wrongVar = specForDB->GetDataSpecification();
avtDataSpecification_p correctVar = new avtDataSpecification(wrongVar,
pipelineVariable);
avtPipelineSpecification_p goodSpec = new avtPipelineSpecification(
specForDB, correctVar);
if (useFaceFilter && !useGhostFilter)
{
debug5 << "Using facelist filter only." << endl;
faceFilter->SetInput(data);
faceFilter->Update(GetGeneralPipelineSpecification());
faceFilter->Update(goodSpec);
GetOutput()->Copy(*(faceFilter->GetOutput()));
}
else if (useGhostFilter && !useFaceFilter)
{
debug5 << "Using ghostzone filter only." << endl;
ghostFilter->SetInput(data);
ghostFilter->Update(GetGeneralPipelineSpecification());
ghostFilter->Update(goodSpec);
GetOutput()->Copy(*(ghostFilter->GetOutput()));
}
else if (!useGhostFilter && !useFaceFilter)
......@@ -203,7 +214,7 @@ avtGhostZoneAndFacelistFilter::Execute(void)
debug5 << "Using facelist filter before ghostzone filter." << endl;
faceFilter->SetInput(data);
ghostFilter->SetInput(faceFilter->GetOutput());
ghostFilter->Update(GetGeneralPipelineSpecification());
ghostFilter->Update(goodSpec);
GetOutput()->Copy(*(ghostFilter->GetOutput()));
}
else
......@@ -211,7 +222,7 @@ avtGhostZoneAndFacelistFilter::Execute(void)
debug5 << "Using ghostzone filter before facelist filter." << endl;
ghostFilter->SetInput(data);
faceFilter->SetInput(ghostFilter->GetOutput());
faceFilter->Update(GetGeneralPipelineSpecification());
faceFilter->Update(goodSpec);
GetOutput()->Copy(*(faceFilter->GetOutput()));
}
}
......
// ************************************************************************* //
// ************************************************************************* //
// avtResampleFilter.C //
// ************************************************************************* //
......@@ -13,6 +13,8 @@
#include <avtDatasetExaminer.h>
#include <avtExtents.h>
#include <avtParallel.h>
#include <avtRay.h>
#include <avtRelativeValueSamplePointArbitrator.h>
#include <avtSamplePointExtractor.h>
#include <avtSourceFromAVTDataset.h>
#include <avtWorldSpaceToImageSpaceTransform.h>
......@@ -337,6 +339,10 @@ avtResampleFilter::BypassResample(void)
// Hank Childs, Fri Aug 8 15:34:27 PDT 2003
// Make sure that we can get good variable names on the root processor.
//
// Hank Childs, Sat Jan 29 10:56:58 PST 2005
// Added support for using bounds from attributes. Also set up arbitrator
// if necessary.
//
// ****************************************************************************
void
......@@ -344,17 +350,37 @@ avtResampleFilter::ResampleInput(void)
{
int i, j;
avtRelativeValueSamplePointArbitrator *arb = NULL;
bool is3D = true;
avtDataset_p output = GetTypedOutput();
double bounds[6];
avtDataAttributes &datts = GetInput()->GetInfo().GetAttributes();
avtExtents *exts = datts.GetEffectiveSpatialExtents();
if (exts->HasExtents())
if (atts.GetUseBounds())
{
exts->CopyTo(bounds);
bounds[0] = atts.GetMinX();
bounds[1] = atts.GetMaxX();
bounds[2] = atts.GetMinY();
bounds[3] = atts.GetMaxY();
bounds[4] = atts.GetMinZ();
bounds[5] = atts.GetMaxZ();
if (bounds[4] == bounds[5])
{
is3D = false;
bounds[5] += 0.1;
}
}
else
{
GetSpatialExtents(bounds);
avtDataAttributes &datts = GetInput()->GetInfo().GetAttributes();
avtExtents *exts = datts.GetEffectiveSpatialExtents();
if (exts->HasExtents())
{
exts->CopyTo(bounds);
}
else
{
GetSpatialExtents(bounds);
}
}
debug4 << "Resampling over space: " << bounds[0] << ", " << bounds[1]
......@@ -367,8 +393,11 @@ avtResampleFilter::ResampleInput(void)
// pass it along (since resampling does not change it in theory).
//
double range[2];
GetDataExtents(range);
output->GetInfo().GetAttributes().GetEffectiveDataExtents()->Set(range);
if (GetInput()->GetInfo().GetAttributes().ValidActiveVariable())
{
GetDataExtents(range);
output->GetInfo().GetAttributes().GetEffectiveDataExtents()->Set(range);
}
avtViewInfo view;
double scale[3];
......@@ -408,8 +437,49 @@ avtResampleFilter::ResampleInput(void)
GetDimensions(width, height, depth, bounds);
avtSamplePointExtractor extractor(width, height, depth);
extractor.Set3DMode(is3D);
extractor.SetInput(trans.GetOutput());
//
// This is hack-ish. The sample point extractor throws out variables
// that have "avt" or "vtk" in them. The returned sample points don't
// have variable names, so we need to match up the variables from the
// input dataset.
//
VarList vl;
vl.nvars = -1;
avtDatasetExaminer::GetVariableList(ds, vl);
int myVars = 0;
for (i = 0 ; i < vl.nvars ; i++)
if ((strstr(vl.varnames[i].c_str(), "vtk") == NULL) &&
(strstr(vl.varnames[i].c_str(), "avt") == NULL))
myVars++;
if (atts.GetUseArbitrator())
{
int tmpCnt = 0;
int match = -1;
for (i = 0 ; i < vl.nvars ; i++)
if ((strstr(vl.varnames[i].c_str(), "vtk") == NULL) &&
(strstr(vl.varnames[i].c_str(), "avt") == NULL))
{
if (vl.varnames[i] == atts.GetArbitratorVarName())
match = tmpCnt;
if (atts.GetArbitratorVarName() == "default" &&
vl.varnames[i] == primaryVariable)
match = tmpCnt;
tmpCnt++;
}
if (match != -1)
{
arb = new avtRelativeValueSamplePointArbitrator(
atts.GetArbitratorLessThan(), match);
avtRay::SetArbitrator(arb);
}
}
else
avtRay::SetArbitrator(NULL);
//
// Since this is Execute, forcing an update is okay...
//
......@@ -428,21 +498,6 @@ avtResampleFilter::ResampleInput(void)
// original bounds.
//
vtkRectilinearGrid *rg = CreateGrid(bounds, width, height, depth);
VarList vl;
vl.nvars = -1;
avtDatasetExaminer::GetVariableList(ds, vl);
//
// This is hack-ish. The sample point extractor throws out variables
// that have "avt" or "vtk" in them. The returned sample points don't
// have variable names, so we need to match up the variables from the
// input dataset.
//
int myVars = 0;
for (i = 0 ; i < vl.nvars ; i++)
if ((strstr(vl.varnames[i].c_str(), "vtk") == NULL) &&
(strstr(vl.varnames[i].c_str(), "avt") == NULL))
myVars++;
//
// If we have more processors than domains, we have to handle that
......@@ -531,6 +586,11 @@ avtResampleFilter::ResampleInput(void)
vars[i]->Delete();
}
delete [] vars;
if (arb != NULL)
{
delete arb;
avtRay::SetArbitrator(NULL);
}
}
......@@ -855,12 +915,21 @@ GetCoordinates(float start, float length, int numEls)
// Hank Childs, Fri Nov 16 08:51:59 PST 2001
// Capture what the primary variable is.
//
// Hank Childs, Sat Jan 29 11:01:59 PST 2005
// If we are going to use an arbitrator, make sure to request the variable.
//
// ****************************************************************************
avtPipelineSpecification_p
avtResampleFilter::PerformRestriction(avtPipelineSpecification_p spec)
{
spec->NoDynamicLoadBalancing();
if (atts.GetUseArbitrator())
{
if (atts.GetArbitratorVarName() != "default")
spec->GetDataSpecification()->
AddSecondaryVariable(atts.GetArbitratorVarName().c_str());
}
if (primaryVariable != NULL)
{
delete [] primaryVariable;
......
......@@ -13,8 +13,11 @@
#include <avtViewInfo.h>
class vtkHexahedron;
class vtkPixel;
class vtkPyramid;
class vtkQuad;
class vtkTetra;
class vtkTriangle;
class vtkVoxel;
class vtkWedge;
......@@ -55,6 +58,9 @@ class avtRayFunction;
// Hank Childs, Fri Nov 19 13:41:56 PST 2004
// Added view conversion option.
//
// Hank Childs, Sat Jan 29 13:32:54 PST 2005
// Added 2D extractors.
//
// ****************************************************************************
class AVTFILTERS_API avtSamplePointExtractor
......@@ -77,6 +83,8 @@ class AVTFILTERS_API avtSamplePointExtractor
void RestrictToTile(int, int, int, int);
void StopTiling(void) { shouldDoTiling = false; };
void Set3DMode(bool m) { modeIs3D = m; };
protected:
int width, height, depth;
int currentNode, totalNodes;
......@@ -84,6 +92,7 @@ class AVTFILTERS_API avtSamplePointExtractor
bool shouldDoTiling;
int width_min, width_max;
int height_min, height_max;
bool modeIs3D;
avtHexahedronExtractor *hexExtractor;
avtMassVoxelExtractor *massVoxelExtractor;
......@@ -107,6 +116,9 @@ class AVTFILTERS_API avtSamplePointExtractor
inline void ExtractTet(vtkTetra *, vtkDataSet *, int);
inline void ExtractPyramid(vtkPyramid *, vtkDataSet *, int);
inline void ExtractWedge(vtkWedge *, vtkDataSet *, int);
inline void ExtractTriangle(vtkTriangle *, vtkDataSet *,int);
inline void ExtractQuad(vtkQuad *, vtkDataSet *, int);
inline void ExtractPixel(vtkPixel *, vtkDataSet *, int);
};
......
......@@ -10,7 +10,6 @@
#include <vtkCellData.h>
#include <vtkCellDataToPointData.h>
#include <vtkDataSet.h>
#include <vtkDataSetWriter.h>
#include <vtkFloatArray.h>
#include <vtkPointData.h>
#include <vtkPoints.h>
......@@ -21,6 +20,7 @@
#include <vtkSurfaceFilter.h>
#include <vtkUnstructuredGrid.h>
#include <avtCallback.h>
#include <avtDataAttributes.h>
#include <avtDatasetExaminer.h>
#include <avtExtents.h>
......@@ -54,11 +54,14 @@
// Kathleen Bonnell, Mon May 24 14:13:55 PDT 2004
// Moved geoFilter, appendFilter and edgesFilter to avtWireframeFilter.
//
// Hank Childs, Sun Jan 30 13:55:21 PST 2005
// Change attribute type.
//
// ****************************************************************************
avtSurfaceFilter::avtSurfaceFilter(const AttributeGroup *a)
{
atts = *(SurfaceAttributes*)a;
atts = *(SurfaceFilterAttributes*)a;
filter = vtkSurfaceFilter::New();
cd2pd = vtkCellDataToPointData::New();
stillNeedExtents = true;
......@@ -132,12 +135,15 @@ avtSurfaceFilter::Create(const AttributeGroup *atts)
//
// Modifications:
//
// Hank Childs, Sun Jan 30 13:55:21 PST 2005
// Change attribute type we are casting to.
//