Commit 721d7294 authored by hrchilds's avatar hrchilds

Better handling of ray-casting + log + mininum set, which was previously

doing a bunch of unneeded expressions.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@11451 18c085ea-50e0-402c-830e-de6fd14e8384
parent ccd113c6
......@@ -42,6 +42,9 @@
# Use proper python include path ${PYTHON_INCLUDE_PATH}, instead of
# ${PYTHON_INCLUDE_DIRS}
#
# Hank Childs, Thu May 20 21:26:47 PDT 2010
# Add Base10LogWithMin.
#
#****************************************************************************/
SET(ABSTRACT_SOURCES
......@@ -188,6 +191,7 @@ Math/avtArcsinExpression.C
Math/avtArctanExpression.C
Math/avtArctan2Expression.C
Math/avtBase10LogExpression.C
Math/avtBase10LogWithMinExpression.C
Math/avtBinaryAddExpression.C
Math/avtBinaryAndExpression.C
Math/avtBinaryDivideExpression.C
......
......@@ -43,6 +43,7 @@
#include <avtArctan2Expression.h>
#include <avtArctanExpression.h>
#include <avtBase10LogExpression.h>
#include <avtBase10LogWithMinExpression.h>
#include <avtCeilingExpression.h>
#include <avtCosExpression.h>
#include <avtCoshExpression.h>
......@@ -80,6 +81,10 @@
//
// Modifications:
//
// Hank Childs, Thu May 20 21:26:47 PDT 2010
// Add log10withmin. This is possible with if, gt, and log, but more
// efficiently implemented in a single filter.
//
// ****************************************************************************
avtExpressionFilter *
......@@ -119,6 +124,8 @@ avtFunctionExpr::CreateMathFilters(const string &functionName) const
f = new avtExpExpression();
else if ((functionName == "log") || (functionName == "log10"))
f = new avtBase10LogExpression();
else if (functionName == "log10withmin")
f = new avtBase10LogWithMinExpression();
else if (functionName == "sqrt")
f = new avtSquareRootExpression();
else if ((functionName == "sq") || (functionName == "sqr"))
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2010, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400124
* 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.
*
*****************************************************************************/
// ************************************************************************* //
// avtBase10LogWithMinExpression.C //
// ************************************************************************* //
#include <avtBase10LogWithMinExpression.h>
#include <vtkDataArray.h>
#include <vtkDataSet.h>
#include <avtExprNode.h>
#include <ExprToken.h>
#include <DebugStream.h>
#include <ExpressionException.h>
// ****************************************************************************
// Method: avtBase10LogWithMinExpression constructor
//
// Purpose:
// Defines the constructor. Note: this should not be inlined in the
// header because it causes problems for certain compilers.
//
// Programmer: Hank Childs
// Creation: February 5, 2004
//
// ****************************************************************************
avtBase10LogWithMinExpression::avtBase10LogWithMinExpression()
{
}
// ****************************************************************************
// Method: avtBase10LogWithMinExpression destructor
//
// Purpose:
// Defines the destructor. Note: this should not be inlined in the header
// because it causes problems for certain compilers.
//
// Programmer: Hank Childs
// Creation: February 5, 2004
//
// ****************************************************************************
avtBase10LogWithMinExpression::~avtBase10LogWithMinExpression()
{
;
}
// ****************************************************************************
// Method: avtBase10LogWithMinExpression::DoOperation
//
// Purpose:
// Performs the base-10 logarithm to each component,tuple of a data array.
// Also checks against a minimum value.
//
// Arguments:
// in1 Input data array #1.
// in2 Input data array #2.
// out The output data array.
// ncomponents The number of components ('1' for scalar, '2' or '3' for
// vectors, etc.)
// ntuples The number of tuples (ie 'npoints' or 'ncells')
//
// Programmer: Hank Childs
// Creation: May 20, 2010
//
// ****************************************************************************
void
avtBase10LogWithMinExpression::DoOperation(vtkDataArray *in1,vtkDataArray *in2,
vtkDataArray *out,
int ncomponents, int ntuples)
{
if (in2->GetNumberOfComponents() != 1)
{
EXCEPTION2(ExpressionException, outputVariableName,
"The minimum value must be a scalar");
}
bool var1IsSingleton = (in1->GetNumberOfTuples() == 1);
bool var2IsSingleton = (in2->GetNumberOfTuples() == 1);
int in1ncomps = in1->GetNumberOfComponents();
for (int i = 0 ; i < ntuples ; i++)
{
int tup2 = (var2IsSingleton ? 0 : i);
float f2 = in2->GetTuple1(tup2);
for (int j = 0 ; j < in1ncomps ; j++)
{
int tup1 = (var1IsSingleton ? 0 : i);
float f1 = in1->GetComponent(tup1, j);
float f = (f2 < f1 ? f2 : f1);
out->SetComponent(i, j, log10(f));
}
}
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2010, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400124
* 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.
*
*****************************************************************************/
// ************************************************************************* //
// avtBase10LogWithMinExpression.h //
// ************************************************************************* //
#ifndef AVT_BASE10LOG_WITH_MIN_FILTER_H
#define AVT_BASE10LOG_WITH_MIN_FILTER_H
#include <avtBinaryMathExpression.h>
class vtkDataArray;
class ArgsExpr;
class ExprPipelineState;
// ****************************************************************************
// Class: avtBase10LogWithMinExpression
//
// Purpose:
// A filter that calculates the base 10 logarithm of its input and also
// take a minimum value. This expression can be done with other
// expressions, but is more efficiently implemented.
//
// Programmer: Hank Childs
// Creation: May 20, 2010
//
// ****************************************************************************
class EXPRESSION_API avtBase10LogWithMinExpression
: public avtBinaryMathExpression
{
public:
avtBase10LogWithMinExpression();
virtual ~avtBase10LogWithMinExpression();
virtual const char *GetType(void) { return "avtBase10LogWithMinExpression"; };
virtual const char *GetDescription(void)
{ return "Calculating base 10 logarithm"; };
protected:
virtual void DoOperation(vtkDataArray *in1, vtkDataArray *in2,
vtkDataArray *out, int ncomps,int ntups);
};
#endif
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>VisIt 2.1 Release Notes</title>
</head>
<body>
<center><b><font size="6">VisIt 2.1 Release Notes</font></b></center>
<p>Welcome to VisIt's release notes page. This page describes the important
enhancements and bug-fixes that were added to this release.</p>
<p><b>Sections</b></p>
<ul>
<li><a href="#General_Features">Features for all users</a></li>
<li><a href="#Advanced_Features">Features for advanced users</a></li>
<li><a href="#File_format">Changes to file format readers</a></li>
<li><a href="#Plot_changes">Changes to plots</a></li>
<li><a href="#Operator_changes">Changes to operators</a></li>
<li><a href="#Expression_changes">Changes to expressions</a></li>
<li><a href="#Query_changes">Changes to picks and queries</a></li>
<li><a href="#Bugs_fixed">Other bug fixes</a></li>
<li><a href="#Config_changes">Changes to machine configuration files</a></li>
<li><a href="#Dev_changes">Changes for VisIt developers</a></li>
</ul>
<a name="General_Features"></a>
<p><b><font size="4">General features added in version 2.1</font></b></p>
<ul>
</ul>
<a name="Advanced_Features"></a>
<p><b><font size="4">Advanced features added in version 2.1</font></b></p>
<ul>
</ul>
<a name="File_format"></a>
<p><b><font size="4">File format reader changes in version 2.1</font></b></p>
<ul>
<li>Files formats that support time natively now can correctly report their time when concatenated inside a <i>.visit</i> file.</li>
<li><i>BOV</i> files now properly support the <i>TIME</i> keyword. They also support a new keyword, <i>CYCLE</i>.</li>
</ul>
<a name="Plot_changes"></a>
<p><b><font size="4">Changes to VisIt's plots in version 2.1</font></b></p>
<ul>
<li>The <i>Volume</i> plot is now more efficient in memory and execution time
when doing a ray casting with logarithmic scale with a minimum set.</li>
</ul>
<a name="Operator_changes"></a>
<p><b><font size="4">Changes to VisIt's operators in version 2.1</font></b></p>
<ul>
</ul>
<a name="Expression_changes"></a>
<p><b><font size="4">Changes to VisIt's expression language in version 2.1</font></b></p>
<ul>
</ul>
<a name="Query_changes"></a>
<p><b><font size="4">Changes to VisIt's picks and queries in version 2.1</font></b></p>
<ul>
<li>The <i>Integrate</i> query now works on one dimensional cross sections.</li>
</ul>
<a name="Bugs_fixed"></a>
<p><b><font size="4">Other bugs fixed in version 2.1</font></b></p>
<ul>
</ul>
<a name="Config_changes"></a>
<p><b><font size="4">Changes to configuration files in version 2.1</font></b></p>
<ul>
</ul>
<a name="Dev_changes"></a>
<p><b><font size="4">Changes for VisIt developers in version 2.1</font></b></p>
<ul>
</ul>
<p>Click the following link to view the release notes for the previous version
of VisIt: <a href="relnotes2.0.0.html">VisIt 2.0 Release Notes</a>.</p>
</body>
</html>
......@@ -60,7 +60,6 @@
#include <avtRay.h>
#include <avtPhong.h>
#include <avtRayTracer.h>
#include <avtResampleFilter.h>
#include <avtSourceFromAVTDataset.h>
#include <avtView3D.h>
#include <avtViewInfo.h>
......@@ -747,6 +746,9 @@ CreateViewInfoFromViewAttributes(avtViewInfo &vi, const View3DAttributes &view)
// Lighting queues should be taken from the gradient of the opacity var,
// not the color var.
//
// Hank Childs, Thu May 20 21:32:04 PDT 2010
// Use a more efficient version of Log10-with-minimum.
//
// ****************************************************************************
avtContract_p
......@@ -776,8 +778,7 @@ avtVolumeFilter::ModifyContract(avtContract_p contract)
{
char m[16];
SNPRINTF(m, 16, "%f", atts.GetColorVarMin());
SNPRINTF(exprDef, 128, "log10(if(gt(%s, 0), %s, %s))",
var, var, m);
SNPRINTF(exprDef, 128, "log10withmin(%s, %s)", var, m);
}
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