Commit c9946b78 authored by hrchilds's avatar hrchilds

Update from September 23, 2005

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@545 18c085ea-50e0-402c-830e-de6fd14e8384
parent 80dfb33d
......@@ -774,6 +774,9 @@ avtDatabase::GetNewMetaData(int timeState, bool forceReadAllCyclesTimes)
// Hank Childs, Thu May 26 15:45:48 PDT 2005
// Mark mesh quality expressions as auto-expressions.
//
// Hank Childs, Thu Sep 22 15:49:34 PDT 2005
// Change side_volume to min_side_volume. Add edge length as well.
//
// ****************************************************************************
void
......@@ -802,7 +805,7 @@ avtDatabase::AddMeshQualityExpressions(avtDatabaseMetaData *md)
if (topoDim == 0 || topoDim == 1)
continue;
const int nPairs = 21;
const int nPairs = 24;
MQExprTopoPair exprs[nPairs];
exprs[0] = MQExprTopoPair("area", 2);
exprs[1] = MQExprTopoPair("aspect_gamma", 3);
......@@ -823,8 +826,11 @@ avtDatabase::AddMeshQualityExpressions(avtDatabaseMetaData *md)
exprs[16] = MQExprTopoPair("stretch", -1);
exprs[17] = MQExprTopoPair("taper", -1);
exprs[18] = MQExprTopoPair("volume", 3);
exprs[19] = MQExprTopoPair("side_volume", 3);
exprs[20] = MQExprTopoPair("warpage", 2);
exprs[19] = MQExprTopoPair("min_side_volume", 3);
exprs[20] = MQExprTopoPair("max_side_volume", 3);
exprs[21] = MQExprTopoPair("warpage", 2);
exprs[22] = MQExprTopoPair("min_edge_length", -1);
exprs[23] = MQExprTopoPair("max_edge_length", -1);
string name = mmd->name;
for (int i = 0 ; i < nPairs ; i++)
......
......@@ -138,6 +138,11 @@ avtSourceFromDatabase::~avtSourceFromDatabase()
// Made call to GetMetaData set flag to force it to read the current
// timeState's cycle/time information.
//
// Hank Childs, Fri Sep 23 10:23:01 PDT 2005
// No longer use the DBVariable to make a new data specification. The EEF
// will guarantee that the variable list coming to the database will
// contain only variables that the database is familiar with.
//
// ****************************************************************************
bool
......@@ -146,9 +151,7 @@ avtSourceFromDatabase::FetchDataset(avtDataSpecification_p spec,
{
TRY
{
avtDataSpecification_p tmp_spec = new avtDataSpecification(spec,
spec->GetDBVariable());
tree = database->GetOutput(tmp_spec, this);
tree = database->GetOutput(spec, this);
}
CATCH2(VisItException, e)
{
......@@ -417,6 +420,10 @@ avtSourceFromDatabase::FetchSpeciesAuxiliaryData(const char *type, void *args,
// Hank Childs, Sun Mar 6 11:15:11 PST 2005
// Add special support for NeedBoundarySurfaces in lieu of fix for '5723.
//
// Hank Childs, Fri Sep 23 10:23:01 PDT 2005
// Return a data specification with the original variable. This is the
// variable that the pipeline is plotting.
//
// ****************************************************************************
avtDataSpecification_p
......@@ -424,7 +431,7 @@ avtSourceFromDatabase::GetFullDataSpecification(void)
{
const char *acting_var = variable;
if (*lastSpec != NULL)
acting_var = lastSpec->GetVariable();
acting_var = lastSpec->GetOriginalVariable();
avtSIL *sil = database->GetSIL(timestep);
avtSILRestriction_p silr = new avtSILRestriction(sil);
......
// ************************************************************************* //
// avtExternalNodeExpression.C //
// ************************************************************************* //
#include <avtExternalNodeExpression.h>
#include <vtkCellData.h>
#include <vtkDataSet.h>
#include <vtkFloatArray.h>
#include <vtkIntArray.h>
#include <vtkPointData.h>
#include <avtCallback.h>
#include <avtCondenseDatasetFilter.h>
#include <avtDatasetExaminer.h>
#include <avtGhostZoneAndFacelistFilter.h>
#include <avtSourceFromAVTDataset.h>
#include <avtTypes.h>
#include <ExpressionException.h>
// ****************************************************************************
// Method: avtExternalNodeExpression 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: September 21, 2005
//
// ****************************************************************************
avtExternalNodeExpression::avtExternalNodeExpression()
{
}
// ****************************************************************************
// Method: avtExternalNodeExpression 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: September 21, 2005
//
// ****************************************************************************
avtExternalNodeExpression::~avtExternalNodeExpression()
{
;
}
// ****************************************************************************
// Method: avtExternalNodeExpression::DeriveVariable
//
// Purpose:
// Assigns the zone ID to each variable.
//
// Arguments:
// inDS The input dataset.
//
// Returns: The derived variable. The calling class must free this
// memory.
//
// Programmer: Hank Childs
// Creation: September 21, 2005
//
// ****************************************************************************
vtkDataArray *
avtExternalNodeExpression::DeriveVariable(vtkDataSet *in_ds)
{
int i;
vtkDataSet *new_ds = in_ds->NewInstance();
new_ds->ShallowCopy(in_ds);
int npts = new_ds->GetNumberOfPoints();
vtkIntArray *arr = vtkIntArray::New();
arr->SetNumberOfTuples(npts);
for (i = 0 ; i < npts ; i++)
arr->SetValue(i, i);
const char *varname = "_avt_node_id";
arr->SetName(varname);
new_ds->GetPointData()->AddArray(arr);
arr->Delete();
//
// A whole bunch of rigamorale to get the AVT pipeline to update using
// only this VTK dataset.
//
avtDataset_p ds = new avtDataset(new_ds, *(GetTypedInput()));
avtSourceFromAVTDataset termsrc(ds);
avtGhostZoneAndFacelistFilter gzff;
gzff.SetInput(termsrc.GetOutput());
gzff.SetUseFaceFilter(true);
gzff.SetCreateEdgeListFor2DDatasets(true);
avtCondenseDatasetFilter cdf;
cdf.KeepAVTandVTK(true);
cdf.BypassHeuristic(true);
cdf.SetInput(gzff.GetOutput());
cdf.Update(GetGeneralPipelineSpecification());
avtDataset_p ds2;
avtDataObject_p output = cdf.GetOutput();
CopyTo(ds2, output);
avtCentering node_cent = AVT_NODECENT;
vtkDataArray *arr2 =
avtDatasetExaminer::GetArray(ds2, varname, 0, node_cent);
if (arr2 == NULL || arr2->GetDataType() != VTK_INT)
EXCEPTION1(ExpressionException, "An internal error occurred when "
"calculating the external nodes.");
vtkIntArray *arr3 = (vtkIntArray *) arr2;
bool *haveNode = new bool[npts];
for (i = 0 ; i < npts ; i++)
haveNode[i] = false;
int nArr = arr3->GetNumberOfTuples();
for (i = 0 ; i < nArr ; i++)
haveNode[arr3->GetValue(i)] = true;
vtkFloatArray *rv = vtkFloatArray::New();
rv->SetNumberOfTuples(npts);
for (i = 0 ; i < npts ; i++)
rv->SetTuple1(i, (haveNode[i] ? 1. : 0.));
delete haveNode;
new_ds->Delete();
return rv;
}
// ************************************************************************* //
// avtExternalNodeExpression.h //
// ************************************************************************* //
#ifndef AVT_EXTERNAL_NODE_EXPRESSION_H
#define AVT_EXTERNAL_NODE_EXPRESSION_H
#include <avtSingleInputExpressionFilter.h>
class vtkDataArray;
// ****************************************************************************
// Class: avtExternalNodeExpression
//
// Purpose:
// An expression that determines which nodes are external.
//
// Programmer: Hank Childs
// Creation: September 22, 2005
//
// ****************************************************************************
class EXPRESSION_API avtExternalNodeExpression
: public avtSingleInputExpressionFilter
{
public:
avtExternalNodeExpression();
virtual ~avtExternalNodeExpression();
virtual const char *GetType(void)
{ return "avtExternalNodeExpression"; };
virtual const char *GetDescription(void)
{return "Determining external nodes"; };
protected:
virtual vtkDataArray *DeriveVariable(vtkDataSet *);
virtual bool IsPointVariable(void) { return true; };
};
#endif
// ************************************************************************* //
// avtSurfaceNormalExpression.C //
// ************************************************************************* //
#include <avtSurfaceNormalExpression.h>
#include <vtkCellData.h>
#include <vtkDataSet.h>
#include <vtkPointData.h>
#include <vtkPolyData.h>
#include <vtkVisItPolyDataNormals.h>
#include <ExpressionException.h>
// ****************************************************************************
// Method: avtSurfaceNormalExpression 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: September 22, 2005
//
// ****************************************************************************
avtSurfaceNormalExpression::avtSurfaceNormalExpression()
{
isPoint = true;
}
// ****************************************************************************
// Method: avtSurfaceNormalExpression 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: September 22, 2005
//
// ****************************************************************************
avtSurfaceNormalExpression::~avtSurfaceNormalExpression()
{
;
}
// ****************************************************************************
// Method: avtSurfaceNormalExpression::DeriveVariable
//
// Purpose:
// Assigns the zone ID to each variable.
//
// Arguments:
// inDS The input dataset.
//
// Returns: The derived variable. The calling class must free this
// memory.
//
// Programmer: Hank Childs
// Creation: September 22, 2005
//
// ****************************************************************************
vtkDataArray *
avtSurfaceNormalExpression::DeriveVariable(vtkDataSet *in_ds)
{
if (in_ds->GetDataObjectType() != VTK_POLY_DATA)
{
EXCEPTION1(ExpressionException, "The Surface normal expression "
"can only be calculated on surfaces. Use the External"
"Surface operator to generate the external surface of "
"this object. You must also use the DeferExpression "
"operator to defer the evaluation of this expression until "
"after the external surface operator. The external surface"
" and defer expression operators are available through "
"the plugin manager located under the Options menu");
}
vtkPolyData *pd = (vtkPolyData *) in_ds;
vtkVisItPolyDataNormals *n = vtkVisItPolyDataNormals::New();
n->SetSplitting(false);
if (isPoint)
n->SetNormalTypeToPoint();
else
n->SetNormalTypeToCell();
n->SetInput(pd);
vtkPolyData *out = n->GetOutput();
out->Update();
vtkDataArray *arr = NULL;
if (isPoint)
arr = out->GetPointData()->GetNormals();
else
arr = out->GetCellData()->GetNormals();
if (arr == NULL)
{
EXCEPTION1(ExpressionException, "An internal error occurred where "
"the surface normals could not be calculated. Please "
"contact a VisIt developer.");
}
arr->Register(NULL);
n->Delete();
return arr;
}
// ************************************************************************* //
// avtSurfaceNormalExpression.h //
// ************************************************************************* //
#ifndef AVT_SURFACE_NORMAL_EXPRESSION_H
#define AVT_SURFACE_NORMAL_EXPRESSION_H
#include <avtSingleInputExpressionFilter.h>
class vtkDataArray;
// ****************************************************************************
// Class: avtSurfaceNormalExpression
//
// Purpose:
// An expression that determines which nodes are external.
//
// Programmer: Hank Childs
// Creation: September 22, 2005
//
// ****************************************************************************
class EXPRESSION_API avtSurfaceNormalExpression
: public avtSingleInputExpressionFilter
{
public:
avtSurfaceNormalExpression();
virtual ~avtSurfaceNormalExpression();
virtual const char *GetType(void)
{ return "avtSurfaceNormalExpression"; };
virtual const char *GetDescription(void)
{return "Calculating surface normal"; };
void DoPointNormals(bool val) { isPoint = val; };
protected:
bool isPoint;
virtual vtkDataArray *DeriveVariable(vtkDataSet *);
virtual bool IsPointVariable(void) { return isPoint; };
virtual int GetVariableDimension(void) { return 3; };
};
#endif
......@@ -111,6 +111,9 @@
# Hank Childs, Fri Aug 26 07:32:58 PDT 2005
# Added CMFE directory.
#
# Hank Childs, Wed Sep 21 17:16:30 PDT 2005
# Added avtExternalNodeExpression, avtSurfaceNormalExpression, avtEdgeLength.
#
##############################################################################
@SET_MAKE@
......@@ -162,6 +165,7 @@ General_src= \
General/avtDegreeFilter.C \
General/avtDivergenceFilter.C \
General/avtExpressionComponentMacro.C \
General/avtExternalNodeExpression.C \
General/avtGradientFilter.C \
General/avtLaplacianFilter.C \
General/avtMIRvfFilter.C \
......@@ -177,6 +181,7 @@ General_src= \
General/avtRandomFilter.C \
General/avtRecenterFilter.C \
General/avtSpecMFFilter.C \
General/avtSurfaceNormalExpression.C \
General/avtVariableSkewFilter.C \
General/avtVectorComposeFilter.C \
General/avtVectorDecomposeFilter.C
......@@ -228,6 +233,7 @@ Math_src= \
Math/avtVectorCrossProductFilter.C
MeshQuality_src= \
MeshQuality/avtEdgeLength.C \
MeshQuality/avtNeighborFilter.C \
MeshQuality/avtNodeDegreeFilter.C \
MeshQuality/avtRevolvedSurfaceArea.C \
......
......@@ -43,6 +43,7 @@
#include <avtRadianToDegreeFilter.h>
#include <avtRevolvedVolume.h>
#include <avtSideVolume.h>
#include <avtEdgeLength.h>
#include <avtRevolvedSurfaceArea.h>
#include <avtSpecMFFilter.h>
#include <avtTanFilter.h>
......@@ -83,6 +84,8 @@
#include <avtMeanFilterExpression.h>
#include <avtMedianFilterExpression.h>
#include <avtConnCMFEExpression.h>
#include <avtExternalNodeExpression.h>
#include <avtSurfaceNormalExpression.h>
#include <stdio.h>
#include <ExpressionException.h>
......@@ -406,6 +409,10 @@ avtVectorExpr::CreateFilters(ExprPipelineState *state)
// Hank Childs, Fri Aug 26 13:51:39 PDT 2005
// Added conn_cmfe.
//
// Hank Childs, Wed Sep 21 17:30:53 PDT 2005
// Added external_node, surface normals, min_side_volume, max_side_volume,
// min_edge_length, and max_edge_length.
//
// ****************************************************************************
void
avtFunctionExpr::CreateFilters(ExprPipelineState *state)
......@@ -538,6 +545,8 @@ avtFunctionExpr::CreateFilters(ExprPipelineState *state)
f = new avtTestNotEqualToFilter();
else if (functionName == "neighbor")
f = new avtNeighborFilter();
else if (functionName == "external_node")
f = new avtExternalNodeExpression();
else if (functionName == "node_degree")
f = new avtNodeDegreeFilter();
// Begin Verdict Metrics
......@@ -551,8 +560,30 @@ avtFunctionExpr::CreateFilters(ExprPipelineState *state)
f = new avtVMetricTaper();
else if (functionName == "volume")
f = new avtVMetricVolume();
else if (functionName == "side_volume")
f = new avtSideVolume();
else if (functionName == "min_edge_length")
{
avtEdgeLength *el = new avtEdgeLength();
el->SetTakeMin(true);
f = el;
}
else if (functionName == "max_edge_length")
{
avtEdgeLength *el = new avtEdgeLength();
el->SetTakeMin(false);
f = el;
}
else if (functionName == "min_side_volume")
{
avtSideVolume *sv = new avtSideVolume();
sv->SetTakeMin(true);
f = sv;
}
else if (functionName == "max_side_volume")
{
avtSideVolume *sv = new avtSideVolume();
sv->SetTakeMin(false);
f = sv;
}
else if (functionName == "stretch")
f = new avtVMetricStretch();
else if (functionName == "diagonal")
......@@ -595,6 +626,19 @@ avtFunctionExpr::CreateFilters(ExprPipelineState *state)
f = new avtMedianFilterExpression;
else if (functionName == "conn_cmfe")
f = new avtConnCMFEExpression;
else if (functionName == "surface_normal" ||
functionName == "point_surface_normal")
{
avtSurfaceNormalExpression *ff = new avtSurfaceNormalExpression;
ff->DoPointNormals(true);
f = ff;
}
else if (functionName == "cell_surface_normal")
{
avtSurfaceNormalExpression *ff = new avtSurfaceNormalExpression;
ff->DoPointNormals(false);
f = ff;
}
else if (functionName == "zoneid")
{
avtDataIdFilter *ff = new avtDataIdFilter;
......
......@@ -104,6 +104,10 @@ avtExpressionEvaluatorFilter::~avtExpressionEvaluatorFilter()
// Hank Childs, Tue Aug 16 16:53:20 PDT 2005
// Added called to VerifyVariableTypes ['6485]
//
// Hank Childs, Fri Sep 23 09:50:49 PDT 2005
// Directly use 'lastUsedSpec's data specification, since it has the
// best description of the data we want.
//
// ****************************************************************************
void
......@@ -133,15 +137,10 @@ avtExpressionEvaluatorFilter::Execute(void)
// Make sure that the DataSpec being used has the timestep needed.
//
avtPipelineSpecification_p pspec = GetGeneralPipelineSpecification();
avtDataSpecification_p new_dspec = pspec->GetDataSpecification();
avtDataSpecification_p old_dspec =lastUsedSpec->GetDataSpecification();
new_dspec->AddSecondaryVariable(old_dspec->GetVariable());
const vector<CharStrRef> &vars2nd=old_dspec->GetSecondaryVariables();
for (int i = 0 ; i < vars2nd.size() ; i++)
{
new_dspec->AddSecondaryVariable(*(vars2nd[i]));
}
pspec->GetDataSpecification()->SetTimestep(currentTimeState);
avtDataSpecification_p new_dspec =
new avtDataSpecification(lastUsedSpec->GetDataSpecification());
new_dspec->SetTimestep(currentTimeState);
pspec = new avtPipelineSpecification(pspec, new_dspec);
bottom->Update(pspec);
GetOutput()->Copy(*(bottom->GetOutput()));
} else {
......@@ -487,17 +486,32 @@ avtExpressionEvaluatorFilter::PerformRestriction(
haveActiveVariable = true;
}
// Set up the data spec.
// Set up the data spec. Note: This data spec is used in two places.
// The first is to tell the expressions what secondary variables are
// needed, what the pipeline variable is, etc, as well as let them
// modify the pipeline specification. The second use is to send
// the resulting pipeline spec up to the database.