Commit 409a10c1 authored by ahern's avatar ahern
Browse files

Added the exp() function to the expression language.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@4300 18c085ea-50e0-402c-830e-de6fd14e8384
parent bf6672d7
......@@ -219,6 +219,9 @@
#
# Hank Childs, Mon May 19 10:54:22 PDT 2008
# Added avtCornerAngle.C
#
# Sean Ahern Tue May 27 15:17:08 EDT 2008
# Added avtExpFunction.C
#
##############################################################################
......@@ -364,6 +367,7 @@ Math_src= \
Math/avtDeterminantExpression.C \
Math/avtEigenvalueExpression.C \
Math/avtEigenvectorExpression.C \
Math/avtExpExpression.C \
Math/avtFloorExpression.C \
Math/avtIdentityExpression.C \
Math/avtModuloExpression.C \
......
......@@ -55,6 +55,7 @@
#include <avtRoundExpression.h>
#include <avtSinExpression.h>
#include <avtCosExpression.h>
#include <avtExpExpression.h>
#include <avtDistanceToBestFitLineExpression.h>
#include <avtRandomExpression.h>
#include <avtArctanExpression.h>
......@@ -500,6 +501,9 @@ avtVectorExpr::CreateFilters(ExprPipelineState *state)
// Hank Childs, Mon May 19 10:57:10 PDT 2008
// Added [min|max]_corner_angle.
//
// Sean Ahern, Tue May 27 15:22:47 EDT 2008
// Added "exp" function.
//
// ****************************************************************************
avtExpressionFilter *
......@@ -527,6 +531,8 @@ avtFunctionExpr::CreateFilters(string functionName)
return new avtAbsValExpression();
if (functionName == "ln")
return new avtNaturalLogExpression();
if (functionName == "exp")
return new avtExpExpression();
if ((functionName == "log") || (functionName == "log10"))
return new avtBase10LogExpression();
if (functionName == "sqrt")
......
/*****************************************************************************
*
* Copyright (c) 2000 - 2008, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400142
* 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.
*
*****************************************************************************/
// ************************************************************************* //
// avtExpExpression.C //
// ************************************************************************* //
#include <avtExpExpression.h>
#include <vtkDataArray.h>
#include <vtkDataSet.h>
// ****************************************************************************
// Method: avtExpExpression constructor
//
// Purpose:
// Defines the constructor. Note: this should not be inlined in the
// header because it causes problems for certain compilers.
//
// Programmer: Sean Ahern
// Creation: Tue May 27 15:14:49 EDT 2008
//
// ****************************************************************************
avtExpExpression::avtExpExpression()
{
;
}
// ****************************************************************************
// Method: avtExpExpression destructor
//
// Purpose:
// Defines the destructor. Note: this should not be inlined in the header
// because it causes problems for certain compilers.
//
// Programmer: Sean Ahern
// Creation: Tue May 27 15:14:58 EDT 2008
//
// ****************************************************************************
avtExpExpression::~avtExpExpression()
{
;
}
// ****************************************************************************
// Method: avtExpExpression::DoOperation
//
// Purpose:
// Performs the exp function to each component, tuple of a data array.
//
// Arguments:
// in The input data array.
// 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: Sean Ahern
// Creation: Tue May 27 15:15:11 EDT 2008
//
// Modifications:
//
// ****************************************************************************
void
avtExpExpression::DoOperation(vtkDataArray *in, vtkDataArray *out,
int ncomponents, int ntuples)
{
for (int i = 0 ; i < ntuples ; i++)
{
for (int j = 0 ; j < ncomponents ; j++)
{
float val = in->GetComponent(i, j);
out->SetComponent(i, j, exp(val));
}
}
}
/*****************************************************************************
*
* Copyright (c) 2000 - 2008, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400142
* 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.
*
*****************************************************************************/
// ************************************************************************* //
// avtExpExpression.h //
// ************************************************************************* //
#ifndef AVT_EXP_FILTER_H
#define AVT_EXP_FILTER_H
#include <avtUnaryMathExpression.h>
class vtkDataArray;
// ****************************************************************************
// Class: avtExpExpression
//
// Purpose:
// A filter that calculates the e^x expression.
//
// Programmer: Sean Ahern
// Creation: Tue May 27 15:13:05 EDT 2008
//
// Modifications:
//
// ****************************************************************************
class EXPRESSION_API avtExpExpression : public avtUnaryMathExpression
{
public:
avtExpExpression();
virtual ~avtExpExpression();
virtual const char *GetType(void) { return "avtExpExpression"; };
virtual const char *GetDescription(void)
{ return "Calculating exp function"; };
protected:
virtual void DoOperation(vtkDataArray *in, vtkDataArray *out,
int ncomponents, int ntuples);
};
#endif
......@@ -180,6 +180,7 @@ const char *expr_math[] = {
"abs",
"ceil",
"floor",
"exp",
"ln",
"log10",
"max",
......
../../avt/Expressions/Math/avtExpExpression.h
\ No newline at end of file
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