Commit 3d3621a1 authored by js9's avatar js9
Browse files

Splitting "constant" function into cell and point versions.

Adding to expression gui.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@3269 18c085ea-50e0-402c-830e-de6fd14e8384
parent 31848971
......@@ -59,10 +59,15 @@
// Programmer: Jeremy Meredith
// Creation: February 19, 2008
//
// Modifications:
// Jeremy Meredith, Wed Feb 20 10:00:31 EST 2008
// Support either nodal or zonal values.
//
// ****************************************************************************
avtConstantFunctionExpression::avtConstantFunctionExpression()
avtConstantFunctionExpression::avtConstantFunctionExpression(bool n)
{
nodal = n;
value = 0;
}
......@@ -99,16 +104,20 @@ avtConstantFunctionExpression::~avtConstantFunctionExpression()
// Programmer: Jeremy Meredith
// Creation: February 19, 2008
//
// Modifications:
// Jeremy Meredith, Wed Feb 20 10:00:31 EST 2008
// Support either nodal or zonal values.
//
// ****************************************************************************
vtkDataArray *
avtConstantFunctionExpression::DeriveVariable(vtkDataSet *in_ds)
{
int npts = in_ds->GetNumberOfPoints();
int nvals = nodal ? in_ds->GetNumberOfPoints() : in_ds->GetNumberOfCells();
vtkFloatArray *rv = vtkFloatArray::New();
rv->SetNumberOfTuples(npts);
for (int i = 0 ; i < npts ; i++)
rv->SetNumberOfTuples(nvals);
for (int i = 0 ; i < nvals ; i++)
{
rv->SetTuple1(i, value);
}
......
......@@ -64,13 +64,16 @@ class vtkDataArray;
// possible to clobber other constant creations. I upped it to 2 and
// had the second arg push a textual representation on the state.
//
// Jeremy Meredith, Wed Feb 20 10:00:31 EST 2008
// Support either nodal or zonal values.
//
// ****************************************************************************
class EXPRESSION_API avtConstantFunctionExpression
: public avtMultipleInputExpressionFilter
{
public:
avtConstantFunctionExpression();
avtConstantFunctionExpression(bool nodal);
virtual ~avtConstantFunctionExpression();
virtual const char *GetType() { return "avtConstantFunctionExpression"; }
......@@ -78,10 +81,11 @@ class EXPRESSION_API avtConstantFunctionExpression
virtual void ProcessArguments(ArgsExpr*, ExprPipelineState *);
protected:
virtual vtkDataArray *DeriveVariable(vtkDataSet *);
virtual bool IsPointVariable() { return true; }
virtual bool IsPointVariable() { return nodal; }
virtual int GetVariableDimension() { return 1; }
virtual int NumVariableArguments(void) { return 2; }
private:
bool nodal;
float value;
};
......
......@@ -478,6 +478,9 @@ avtVectorExpr::CreateFilters(ExprPipelineState *state)
// Jeremy Meredith, Tue Feb 19 14:19:18 EST 2008
// Added "constant".
//
// Jeremy Meredith, Wed Feb 20 10:01:27 EST 2008
// Split "constant" into point_constant and cell_constant.
//
// ****************************************************************************
avtExpressionFilter *
......@@ -883,8 +886,10 @@ avtFunctionExpr::CreateFilters(string functionName)
return new avtHSVColorComposeExpression;
if (functionName == "colorlookup")
return new avtPerformColorTableLookupExpression;
if (functionName == "constant")
return new avtConstantFunctionExpression;
if (functionName == "cell_constant")
return new avtConstantFunctionExpression(false);
if (functionName == "point_constant")
return new avtConstantFunctionExpression(true);
return NULL;
}
......
......@@ -290,6 +290,7 @@ const char *expr_mesh[] = {
};
const char *expr_misc[] = {
"cell_constant",
"conn_components",
"curl",
"divergence",
......@@ -300,6 +301,7 @@ const char *expr_misc[] = {
"ijk_gradient",
"Laplacian",
"mean_curvature",
"point_constant",
"recenter",
"resrad",
"surface_normal",
......@@ -1062,6 +1064,9 @@ QvisExpressionsWindow::displayAllVarsChanged()
// Jeremy Meredith, Wed Feb 13 12:27:50 EST 2008
// Added enumerate
//
// Jeremy Meredith, Wed Feb 20 10:01:59 EST 2008
// Added cell_constant and point_constant.
//
// ****************************************************************************
void
......@@ -1157,6 +1162,11 @@ QvisExpressionsWindow::insertFunction(int id)
definitionEdit->insert("(<var>, [<val-if-0>, <val-if-1>, ...])");
doParens = false;
}
else if (str == "cell_constant" || str == "point_constant")
{
definitionEdit->insert("(<meshvar>, <constantvalue>)");
doParens = false;
}
if (doParens)
{
......
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