Commit 2ed93124 authored by whitlocb's avatar whitlocb

Exporting enhancements

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@23130 18c085ea-50e0-402c-830e-de6fd14e8384
parent 4ec4b264
/*****************************************************************************
*
* Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC
* Copyright (c) 2000 - 2014, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
......@@ -193,9 +193,14 @@ static float random_11()
// Dave Pugmire, Mon Feb 21 08:22:30 EST 2011
// Color by correlation distance.
//
// Brad Whitlock, Thu Feb 27 14:25:05 PST 2014
// Initialize options for extracting time.
// Work partially supported by DOE Grant SC0007548.
//
// ****************************************************************************
avtStreamlineFilter::avtStreamlineFilter() : seedVelocity(0,0,0)
avtStreamlineFilter::avtStreamlineFilter() : avtPICSFilter(),
seedVelocity(0,0,0)
{
coloringMethod = PICS_COLOR_SPEED;
displayMethod = PICS_DISPLAY_LINES;
......@@ -222,6 +227,9 @@ avtStreamlineFilter::avtStreamlineFilter() : seedVelocity(0,0,0)
correlationDistanceAngTol = 0.0;
correlationDistanceMinDist = 0.0;
correlationDistanceDoBBox = false;
extractTime = false;
timeArrayName = "";
}
......@@ -273,12 +281,46 @@ avtStreamlineFilter::GetCommunicationPattern()
return avtPICSFilter::RestoreSequenceAssembleUniformly;
}
// ****************************************************************************
// Method: avtStreamlineFilter::SetExtractTime
//
// Purpose:
// Sets whether we want the filter to extract the streamline time as an
// extra scalar.
//
// Arguments:
// doIt : True if we want the time as a scalar.
// name : The name of the array in which to store the time.
//
// Returns:
//
// Note: Work partially supported by DOE Grant SC0007548.
//
// Programmer: Brad Whitlock
// Creation: Thu Feb 27 14:25:51 PST 2014
//
// Modifications:
//
// ****************************************************************************
void
avtStreamlineFilter::SetExtractTime(bool doIt, const std::string &name)
{
timeArrayName = name;
extractTime = doIt;
}
// ****************************************************************************
// Method: avtStreamlineFilter::GenerateAttributeFields() const
//
// Programmer: Dave Pugmire
// Creation: November 5, 2010
//
// Modifications:
// Brad Whitlock, Thu Feb 27 15:42:06 PST 2014
// Extract time explicitly.
// Work partially supported by DOE Grant SC0007548.
//
// ****************************************************************************
unsigned char
......@@ -330,6 +372,9 @@ avtStreamlineFilter::GenerateAttributeFields() const
if (!scaleTubeRadiusVariable.empty())
attr |= avtStateRecorderIntegralCurve::SAMPLE_SCALAR2;
if (extractTime)
attr |= avtStateRecorderIntegralCurve::SAMPLE_TIME;
return attr;
}
......@@ -974,6 +1019,11 @@ avtStreamlineFilter::PostExecute(void)
// Hank Childs, Sat Jun 5 16:06:26 PDT 2010
// Call the new base class' (avtPICSFilter) method.
//
// Brad Whitlock, Fri Feb 28 12:00:51 PST 2014
// Add some hints about what coloring method was used and what colorVar
// might actually be.
// Work partially supported by DOE Grant SC0007548.
//
// ****************************************************************************
void
......@@ -996,6 +1046,31 @@ avtStreamlineFilter::UpdateDataObjectInfo(void)
atts.SetVariableDimension(1);
atts.SetCentering(AVT_NODECENT);
}
switch(coloringMethod)
{
case PICS_COLOR_SOLID:
atts.AddFilterMetaData("Streamline", "coloringMethod=PICS_COLOR_SOLID");
break;
case PICS_COLOR_SPEED:
atts.AddFilterMetaData("Streamline", "coloringMethod=PICS_COLOR_SPEED");
break;
case PICS_COLOR_VORTICITY:
atts.AddFilterMetaData("Streamline", "coloringMethod=PICS_COLOR_VORTICITY");
break;
case PICS_COLOR_ARCLENGTH:
atts.AddFilterMetaData("Streamline", "coloringMethod=PICS_COLOR_ARCLENGTH");
break;
case PICS_COLOR_TIME:
atts.AddFilterMetaData("Streamline", "coloringMethod=PICS_COLOR_TIME");
break;
case PICS_COLOR_ID:
atts.AddFilterMetaData("Streamline", "coloringMethod=PICS_COLOR_ID");
break;
case PICS_COLOR_VARIABLE:
atts.AddFilterMetaData("Streamline", "coloringMethod=PICS_COLOR_VARIABLE, colorVar=" + coloringVariable);
break;
}
}
typedef struct
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC
* Copyright (c) 2000 - 2014, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
......@@ -225,6 +225,10 @@ class vtkAppendPolyData;
// Dave Pugmire, Fri Jan 14 11:10:44 EST 2011
// Set default communication pattern to RestoreSequenceAssembleUniformly.
//
// Brad Whitlock, Thu Feb 27 14:22:38 PST 2014
// Add options to extract time, id.
// Work partially supported by DOE Grant SC0007548.
//
// ****************************************************************************
class IVP_API avtStreamlineFilter : virtual public avtPICSFilter
......@@ -283,6 +287,8 @@ class IVP_API avtStreamlineFilter : virtual public avtPICSFilter
correlationDistanceDoBBox = doBBox;
}
void SetExtractTime(bool doIt, const std::string &name=std::string());
void SetVelocitiesForLighting(bool v) { storeVelocitiesForLighting = v; };
void SetOpacityVariable(const std::string &var);
void SetScaleTubeRadiusVariable(const std::string &var);
......@@ -337,6 +343,9 @@ class IVP_API avtStreamlineFilter : virtual public avtPICSFilter
bool issueWarningForCriticalPoints;
double criticalPointThreshold;
bool extractTime;
std::string timeArrayName;
avtVector seedVelocity;
std::string SeedInfoString() const;
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC
* Copyright (c) 2000 - 2014, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
......@@ -75,12 +75,51 @@ std::string avtStreamlinePolyDataFilter::scaleRadiusArrayName = "scaleRadius";
// Programmer: Dave Pugmire
// Creation: June 16, 2008
//
// Modifications:
// Brad Whitlock, Fri Feb 28 15:55:19 PST 2014
// Added extractID, idArrayName.
// Work partially supported by DOE Grant SC0007548.
//
// ****************************************************************************
avtStreamlinePolyDataFilter::avtStreamlinePolyDataFilter():
coordinateSystem(0), phiScalingFlag( false ), phiScaling( 1.0 )
avtStreamlinePolyDataFilter::avtStreamlinePolyDataFilter() : avtStreamlineFilter(),
coordinateSystem(0), phiScalingFlag( false ), phiScaling( 1.0 ),
extractID(false), idArrayName()
{
}
avtStreamlinePolyDataFilter::~avtStreamlinePolyDataFilter()
{
}
// ****************************************************************************
// Method: avtStreamlinePolyDataFilter::SetExtractID
//
// Purpose:
// Sets whether we want the filter to extract the streamline id as an
// extra scalar.
//
// Arguments:
// doIt : True if we want the time as a scalar.
// name : The name of the array in which to store the time.
//
// Returns:
//
// Note: Work partially supported by DOE Grant SC0007548.
//
// Programmer: Brad Whitlock
// Creation: Thu Feb 27 14:25:51 PST 2014
//
// Modifications:
//
// ****************************************************************************
void
avtStreamlinePolyDataFilter::SetExtractID(bool doIt, const std::string &name)
{
idArrayName = name;
extractID = doIt;
}
// ****************************************************************************
// Method: avtStreamlineFilter::CreateIntegralCurveOutput
......@@ -142,6 +181,10 @@ avtStreamlinePolyDataFilter::avtStreamlinePolyDataFilter():
// Dave Pugmire, Mon Feb 21 08:22:30 EST 2011
// Color by correlation distance.
//
// Brad Whitlock, Thu Feb 27 14:25:05 PST 2014
// Extract time and ids as separate arrays if we want to.
// Work partially supported by DOE Grant SC0007548.
//
// ****************************************************************************
void
......@@ -239,6 +282,8 @@ avtStreamlinePolyDataFilter::CreateIntegralCurveOutput(std::vector<avtIntegralCu
vtkFloatArray *scaleTubeRad = NULL;
vtkFloatArray *thetas = NULL;
vtkFloatArray *opacity = NULL;
vtkFloatArray *times = NULL;
vtkFloatArray *ids = NULL;
lines->Allocate(numICs);
points->Allocate(numPts);
......@@ -280,6 +325,20 @@ avtStreamlinePolyDataFilter::CreateIntegralCurveOutput(std::vector<avtIntegralCu
scaleTubeRad->SetName(scaleRadiusArrayName.c_str());
pd->GetPointData()->AddArray(scaleTubeRad);
}
if(extractTime)
{
times = vtkFloatArray::New();
times->Allocate(numPts);
times->SetName(timeArrayName.c_str());
pd->GetPointData()->AddArray(times);
}
if(extractID)
{
ids = vtkFloatArray::New();
ids->Allocate(numPts);
ids->SetName(idArrayName.c_str());
pd->GetPointData()->AddArray(ids);
}
double correlationDistMinDistToUse = correlationDistanceMinDist;
double correlationDistAngTolToUse = 0.0;
......@@ -401,14 +460,22 @@ avtStreamlinePolyDataFilter::CreateIntegralCurveOutput(std::vector<avtIntegralCu
}
if (scaleTubeRad)
scaleTubeRad->InsertTuple1(pIdx, s.scalar2);
// Extract time
if(times != NULL)
times->InsertTuple1(pIdx, s.time);
// Extract ids
if(ids != NULL)
ids->InsertTuple1(pIdx, ic->id);
pIdx++;
}
lines->InsertNextCell(line);
line->Delete();
}
points->Delete();
lines->Delete();
scalars->Delete();
......@@ -418,6 +485,10 @@ avtStreamlinePolyDataFilter::CreateIntegralCurveOutput(std::vector<avtIntegralCu
thetas->Delete();
if (opacity)
opacity->Delete();
if(times != NULL)
times->Delete();
if(ids != NULL)
ids->Delete();
vtkCleanPolyData *clean = vtkCleanPolyData::New();
clean->ConvertLinesToPointsOff();
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC
* Copyright (c) 2000 - 2014, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
......@@ -95,7 +95,7 @@ class IVP_API avtStreamlinePolyDataFilter : public avtStreamlineFilter
{
public:
avtStreamlinePolyDataFilter();
virtual ~avtStreamlinePolyDataFilter() {}
virtual ~avtStreamlinePolyDataFilter();
static std::string colorvarArrayName;
static std::string paramArrayName;
static std::string opacityArrayName;
......@@ -107,6 +107,8 @@ class IVP_API avtStreamlinePolyDataFilter : public avtStreamlineFilter
void SetPhiScaling(bool flag, double pf) {
phiScalingFlag = flag; phiScaling = pf;}
void SetExtractID(bool doIt, const std::string &name=std::string());
protected:
void CreateIntegralCurveOutput(std::vector<avtIntegralCurve *> &streamlines);
float ComputeCorrelationDistance(int idx, avtStateRecorderIntegralCurve *ic,
......@@ -117,5 +119,7 @@ class IVP_API avtStreamlinePolyDataFilter : public avtStreamlineFilter
int coordinateSystem;
bool phiScalingFlag;
double phiScaling;
bool extractID;
std::string idArrayName;
};
#endif
#*****************************************************************************
#
# Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC
# Copyright (c) 2000 - 2014, Lawrence Livermore National Security, LLC
# Produced at the Lawrence Livermore National Laboratory
# LLNL-CODE-442911
# All rights reserved.
......@@ -42,6 +42,7 @@ SET(AVTMATH_SOURCES
avtFactorial.C
avtHermitePolynomial.C
avtMatrix.C
avtPlane.C
avtPolynomial.C
avtQuaternion.C
avtTrackball.C
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2014, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
#include <avtPlane.h>
// ****************************************************************************
// Function: PlaneIntersectsCube
//
// Purpose:
// Determines if a plane intersects a cube.
//
// Arguments:
// plane The equation of a plane as (A,B,C,D).
// bounds The bounds of a cube as (minx,maxx,miny,maxy,minz,maxz).
//
// Returns: True if the plane intersects the cube, false otherwise.
//
// Programmer: Hank Childs
// Creation: August 5, 2002
//
// ****************************************************************************
bool
PlaneIntersectsCube(double plane[4], double bounds[6])
{
bool has_low_point = false;
bool has_high_point = false;
for (int i = 0 ; i < 8 ; i++)
{
double x = (i&1 ? bounds[1] : bounds[0]);
double y = (i&2 ? bounds[3] : bounds[2]);
double z = (i&4 ? bounds[5] : bounds[4]);
double val = plane[3] - plane[0]*x - plane[1]*y - plane[2]*z;
if (val == 0.) // If we are on the plane, intersect
return true;
if (val < 0)
has_low_point = true;
else
has_high_point = true;
if (has_low_point && has_high_point)
return true;
}
return false;
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2014, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
*
* This file is part of VisIt. For details, see https://visit.llnl.gov/. The
* full copyright notice is contained in the file COPYRIGHT located at the root
* of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the disclaimer (as noted below) in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of the LLNS/LLNL nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
* LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*****************************************************************************/
#ifndef AVT_PLANE_H
#define AVT_PLANE_H
#include <math_exports.h>
bool MATH_API PlaneIntersectsCube(double plane[4], double bounds[6]);
#endif
/*****************************************************************************
*
* Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC
* Copyright (c) 2000 - 2014, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-442911
* All rights reserved.
......@@ -115,6 +115,49 @@ avtCompactTreeFilter::avtCompactTreeFilter()
// Creation: September 18, 2001
//
// Modifications:
// Brad Whitlock, Wed Mar 5 09:52:31 PST 2014
// I moved the guts of the Execute method to a static helper method.
// Work partially supported by DOE Grant SC0007548.
//
// ****************************************************************************
void
avtCompactTreeFilter::Execute(void)
{
avtDataTree_p output = Execute(GetInput(),
executionDependsOnDLB,
parallelMerge,
false, // skipCompact
createCleanPolyData,
tolerance,
compactDomainMode,
compactDomainThreshold);
SetOutputDataTree(output);
}
// ****************************************************************************
// Method: avtCompactTreeFilter::Execute
//
// Purpose:
// Compacts the data tree based on number and type of labels in info:
//
// If there are no labels, compacts all domains into one vtkDataSet.
// If labels are present, will group all like-labeled leaves into
// the same child tree.
//
// Arguments:
// input : The input data object.
// executionDependsOnDLB : Whether the execution depends on dynamic load balancing.
// parallelMerge : Whether data should be merged onto rank 0.
// createCleanPolyData : Whether polydata should be cleaned up.
// tolerance : tolerance for combining nodes that are close.
// compactDomainNode : Mode that determines how domains are combined.
// compactDomainThreshold : The threshold used to determine how domains are combined.
//
// Programmer: Kathleen Bonnell
// Creation: September 18, 2001
//
// Modifications:
// Kathleen Bonnell, Fri Oct 12 11:38:41 PDT 2001
// Removed domain-pruning as it is not really necessary.
// Execute this filter when dynamically load-balanced, only if requested
......@@ -165,23 +208,37 @@ avtCompactTreeFilter::avtCompactTreeFilter()
// Dave Pugmire, Tue Aug 24 11:32:12 EDT 2010
// Add compact domain options.
//
// Brad Whitlock, Wed Mar 5 09:52:31 PST 2014
// I turned the method static and made the arguments get passed in. This
// lets me compact datasets without a filter execution.
// Work partially supported by DOE Grant SC0007548.
//
// ****************************************************************************
void
avtCompactTreeFilter::Execute(void)
avtDataTree_p
avtCompactTreeFilter::Execute(avtDataObject_p input,
bool executionDependsOnDLB,
bool parallelMerge,
bool skipCompact,
bool createCleanPolyData,
double tolerance,
CompactDomainsMode compactDomainMode,
int compactDomainThreshold)
{
avtDataset_p inputDS;
CopyTo(inputDS, input);
if (executionDependsOnDLB &&
GetInput()->GetInfo().GetValidity().AreWeStreaming())
input->GetInfo().GetValidity().AreWeStreaming())
{
//
// We execute this filter during cleanup when streaming,
// so no need to execute it at the the end of the avtPlot pipeline.
//
SetOutputDataTree(GetInputDataTree());
return;
return inputDS->GetDataTree();
}
avtDataTree_p inTree = GetInputDataTree();
avtDataTree_p inTree = inputDS->GetDataTree();
if (parallelMerge)
{
......@@ -190,7 +247,7 @@ avtCompactTreeFilter::Execute(void)
int mpiSendObjSizeTag = GetUniqueMessageTag();
#endif
avtDataObject_p bigDS = GetTypedInput()->Clone();
avtDataObject_p bigDS = input->Clone(); //GetTypedInput()->Clone();
if (PAR_UIProcess())
{
#ifdef PARALLEL
......@@ -219,8 +276,8 @@ avtCompactTreeFilter::Execute(void)
else
{
#ifdef PARALLEL
avtDataObjectWriter_p writer = GetInput()->InstantiateWriter();
writer->SetInput(GetInput());
avtDataObjectWriter_p writer = input->InstantiateWriter();
writer->SetInput(input);
avtDataObjectString str;
writer->Write(str);
int len = 0;
......@@ -234,15 +291,14 @@ avtCompactTreeFilter::Execute(void)
}
}
if (inTree->IsEmpty())
if (inTree->IsEmpty() || skipCompact)
{
//
// No need to compact an empty tree!
// No need to compact this tree!
// This is not an exception, because contour plots will return
// an empty tree for constant-valued variables.
//
SetOutputDataTree(inTree);
return;
return inTree;
}
avtDataTree_p outTree;
......@@ -250,7 +306,7 @@ avtCompactTreeFilter::Execute(void)
vector<string> labels;
GetInput()->GetInfo().GetAttributes().GetLabels(labels);
input->GetInfo().GetAttributes().GetLabels(labels);
struct map
{
......@@ -269,9 +325,8 @@ avtCompactTreeFilter::Execute(void)
//
// No need for compacting a single-leaved tree!
//
SetOutputDataTree(inTree);
delete pmap;
return;
return inTree;
}
pmap->filter = vtkAppendFilter::New();
pmap->polyFilter = vtkAppendPolyData::New();
......@@ -365,9 +420,8 @@ avtCompactTreeFilter::Execute(void)
debug1 << " avtDataAttribute labels that had no corresponding match" << endl;
debug1 << " in the tree. This can happen if avtDataAttribute labels" << endl;
debug1 << " were set incorrectly by a filter. Tree can not be compacted.\n" << endl;
SetOutputDataTree(inTree);
delete pmap;
return;
return inTree;
}
int nc = prunedTree->GetNChildren();
......@@ -426,12 +480,12 @@ avtCompactTreeFilter::Execute(void)
delete [] temp;
}