Commit aa3996c0 authored by hrchilds's avatar hrchilds

New expressions to get the min/max x/y/z position of a cell.


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@11776 18c085ea-50e0-402c-830e-de6fd14e8384
parent c3d11225
......@@ -45,6 +45,9 @@
# Hank Childs, Thu May 20 21:26:47 PDT 2010
# Add Base10LogWithMin.
#
# Hank Childs, Mon Jun 28 06:43:20 PDT 2010
# Add CoordinateExtrema.
#
#****************************************************************************/
SET(ABSTRACT_SOURCES
......@@ -111,6 +114,7 @@ General/avtArrayDecomposeExpression.C
General/avtColorComposeExpression.C
General/avtConnComponentsExpression.C
General/avtConstantFunctionExpression.C
General/avtCoordinateExtremaExpression.C
General/avtCurlExpression.C
General/avtCurveDomainExpression.C
General/avtCurveExpression.C
......
/*****************************************************************************
*
* 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.
*
*****************************************************************************/
// ************************************************************************* //
// avtCoordinateExtremaExpression.C //
// ************************************************************************* //
#include <avtCoordinateExtremaExpression.h>
#include <vtkDataSet.h>
#include <vtkFloatArray.h>
#include <vtkRectilinearGrid.h>
// ****************************************************************************
// Method: avtCoordinateExtremaExpression 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: June 28, 2010
//
// ****************************************************************************
avtCoordinateExtremaExpression::avtCoordinateExtremaExpression()
{
getMinimum = true;
dim = 0;
}
// ****************************************************************************
// Method: avtCoordinateExtremaExpression 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: June 28, 2010
//
// ****************************************************************************
avtCoordinateExtremaExpression::~avtCoordinateExtremaExpression()
{
;
}
// ****************************************************************************
// Method: avtCoordinateExtremaExpression::DeriveVariable
//
// Purpose:
// Calculates the extrema of a coordinate.
//
// Arguments:
// inDS The input dataset.
//
// Returns: The derived variable. The calling class must free this
// memory.
//
// Programmer: Hank Childs
// Creation: June 28, 2010
//
// ****************************************************************************
vtkDataArray *
avtCoordinateExtremaExpression::DeriveVariable(vtkDataSet *in_ds)
{
int ncells = in_ds->GetNumberOfCells();
vtkFloatArray *rv = vtkFloatArray::New();
rv->SetNumberOfComponents(1);
rv->SetNumberOfTuples(ncells);
for (int i = 0 ; i < ncells ; i++)
{
double bbox[6];
in_ds->GetCellBounds(i, bbox);
int idx = 2*dim + (getMinimum ? 0 : 1);
rv->SetTuple1(i, bbox[idx]);
}
return rv;
}
/*****************************************************************************
*
* 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.
*
*****************************************************************************/
// ************************************************************************* //
// avtCoordinateExtremaExpression.h //
// ************************************************************************* //
#ifndef AVT_COORDINATE_EXTREMA_FILTER_H
#define AVT_COORDINATE_EXTREMA_FILTER_H
#include <avtSingleInputExpressionFilter.h>
// ****************************************************************************
// Class: avtCoordinateExtremaExpression
//
// Purpose:
// Finds the extrema of a coordinate for a cell (example: minimum X
// coordinate)
//
// Programmer: Hank Childs
// Creation: June 28, 2010
//
// ****************************************************************************
class EXPRESSION_API avtCoordinateExtremaExpression
: public avtSingleInputExpressionFilter
{
public:
avtCoordinateExtremaExpression();
virtual ~avtCoordinateExtremaExpression();
virtual const char *GetType(void)
{ return "avtCoordinateExtremaExpression"; };
virtual const char *GetDescription(void)
{ return "Calculating coordinate extrema"; };
void SetGetMinimum(bool gm) { getMinimum = gm; };
void SetDimension(int d) { dim = d; };
protected:
bool getMinimum;
int dim;
virtual vtkDataArray *DeriveVariable(vtkDataSet *);
virtual int GetVariableDimension() { return 1; }
virtual bool IsPointVariable() { return false; }
};
#endif
......@@ -37,6 +37,7 @@
*****************************************************************************/
#include <avtExprNode.h>
#include <avtCoordinateExtremaExpression.h>
#include <avtCylindricalRadiusExpression.h>
#include <avtDataIdExpression.h>
#include <avtExpressionComponentMacro.h>
......@@ -62,6 +63,9 @@
//
// Modifications:
//
// Hank Childs, Mon Jun 28 06:43:20 PDT 2010
// Add avtCoordinateExtrema.
//
// ****************************************************************************
avtExpressionFilter *
......@@ -155,7 +159,51 @@ avtFunctionExpr::CreateMeshFilters(const string &functionName) const
return ecm;
}
else if (functionName == "zonetype")
{
return new avtZoneTypeExpression();
}
else if (functionName == "minx_coord")
{
avtCoordinateExtremaExpression *ce = new avtCoordinateExtremaExpression;
ce->SetGetMinimum(true);
ce->SetDimension(0);
return ce;
}
else if (functionName == "maxx_coord")
{
avtCoordinateExtremaExpression *ce = new avtCoordinateExtremaExpression;
ce->SetGetMinimum(false);
ce->SetDimension(0);
return ce;
}
else if (functionName == "miny_coord")
{
avtCoordinateExtremaExpression *ce = new avtCoordinateExtremaExpression;
ce->SetGetMinimum(true);
ce->SetDimension(1);
return ce;
}
else if (functionName == "maxy_coord")
{
avtCoordinateExtremaExpression *ce = new avtCoordinateExtremaExpression;
ce->SetGetMinimum(false);
ce->SetDimension(1);
return ce;
}
else if (functionName == "minz_coord")
{
avtCoordinateExtremaExpression *ce = new avtCoordinateExtremaExpression;
ce->SetGetMinimum(true);
ce->SetDimension(2);
return ce;
}
else if (functionName == "maxz_coord")
{
avtCoordinateExtremaExpression *ce = new avtCoordinateExtremaExpression;
ce->SetGetMinimum(false);
ce->SetDimension(1);
return ce;
}
return 0;
}
......@@ -156,6 +156,9 @@
// Kathleen Bonnell, Mon Apr 27 17:35:25 PDT 2009
// Added sinh, cosh, tanh to expr_trig.
//
// Hank Childs, Mon Jun 28 06:49:16 PDT 2010
// Add [min|max][x|y|z]_coord.
//
// ****************************************************************************
struct ExprNameList
......@@ -311,6 +314,12 @@ const char *expr_mesh[] = {
"external_node",
"global_nodeid",
"global_zoneid",
"maxx_coord",
"maxy_coord",
"maxz_coord",
"minx_coord",
"miny_coord",
"minz_coord",
"nodeid",
"polar",
"polar_radius",
......
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