Commit af4717da authored by cyrush's avatar cyrush

Added ghost zone neighbors enhancement to parallel connected components

Added an algorithm selection option to the gradient expression
Added a new gradient algorithm "nzqh"
Updated macro expressions that use the gradient expression to all for algorithm selection
Fixed case where duplicate points where created in the rectilinear case of VisIt's clipper. 
Fixed var and mesh naming issue with Silo export




git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@1887 18c085ea-50e0-402c-830e-de6fd14e8384
parent c584a0ed
......@@ -64,6 +64,9 @@ class avtIntervalTree;
// Cyrus Harrison, Fri Mar 16 15:52:47 PDT 2007
// Added variables to track progress.
//
// Cyrus Harrison, Sat Aug 11 14:41:01 PDT 2007
// Added LabelGhostNeighbors and PerformRestriction
//
// ****************************************************************************
class EXPRESSION_API avtConnComponentsExpression : public avtExpressionFilter
......@@ -203,7 +206,12 @@ class EXPRESSION_API avtConnComponentsExpression : public avtExpressionFilter
int totalSteps;
virtual void Execute(void);
virtual avtPipelineSpecification_p
PerformRestriction(avtPipelineSpecification_p);
virtual void LabelGhostNeighbors(vtkDataSet *);
virtual vtkIntArray *SingleSetLabel(vtkDataSet *, int &);
virtual int MultiSetResolve(int,
......
......@@ -41,8 +41,7 @@
#include <avtCurlFilter.h>
#include <stdio.h>
#include <snprintf.h>
#include <ExpressionException.h>
......@@ -95,6 +94,9 @@ avtCurlFilter::~avtCurlFilter()
// If we are creating a scalar, then make sure the expression type is a
// scalar as well.
//
// Cyrus Harrison, Sat Aug 11 18:15:50 PDT 2007
// Add second argument for gradient algorithm selection
//
// ****************************************************************************
void
......@@ -111,20 +113,66 @@ avtCurlFilter::GetMacro(std::vector<std::string> &args, std::string &ne,
}
}
char new_expr[1024];
int nargs = args.size();
char new_expr[2048];
if (do3D)
{
sprintf(new_expr, "{gradient(%s[2])[1]-gradient(%s[1])[2],"
"gradient(%s[0])[2]-gradient(%s[2])[0],"
"gradient(%s[1])[0]-gradient(%s[0])[1]}",
args[0].c_str(), args[0].c_str(), args[0].c_str(),
args[0].c_str(), args[0].c_str(), args[0].c_str());
if(nargs == 1)
{
SNPRINTF(new_expr,2048,
"{gradient(%s[2])[1]-gradient(%s[1])[2],"
"gradient(%s[0])[2]-gradient(%s[2])[0],"
"gradient(%s[1])[0]-gradient(%s[0])[1]}",
args[0].c_str(), args[0].c_str(), args[0].c_str(),
args[0].c_str(), args[0].c_str(), args[0].c_str());
}
else if(nargs > 1)
{
SNPRINTF(new_expr,2048,
"{gradient(%s[2],%s)[1]-gradient(%s[1],%s)[2],"
"gradient(%s[0],%s)[2]-gradient(%s[2],%s)[0],"
"gradient(%s[1],%s)[0]-gradient(%s[0],%s)[1]}",
args[0].c_str(), args[1].c_str(),
args[0].c_str(), args[1].c_str(),
args[0].c_str(), args[1].c_str(),
args[0].c_str(), args[1].c_str(),
args[0].c_str(), args[1].c_str(),
args[0].c_str(), args[1].c_str());
}
else
{
EXCEPTION1(ExpressionException, " invalid curl syntax. "
"Expected arguments: "
"vector_var, gradient_algorithm\n"
"[gradient_algorithm is optional]");
}
type = Expression::VectorMeshVar;
}
else
{
sprintf(new_expr, "gradient(%s[1])[0]-gradient(%s[0])[1]",
args[0].c_str(), args[0].c_str());
if(nargs == 1)
{
SNPRINTF(new_expr,2048,
"gradient(%s[1])[0]-gradient(%s[0])[1]",
args[0].c_str(), args[0].c_str());
}
else if(nargs > 1)
{
SNPRINTF(new_expr,2048,
"gradient(%s[1],%s)[0]-gradient(%s[0],%s)[1]",
args[0].c_str(), args[1].c_str(),
args[0].c_str(), args[1].c_str());
}
else
{
EXCEPTION1(ExpressionException, " invalid curl syntax. "
"Expected arguments: "
"vector_var, gradient_algorithm\n"
"[gradient_algorithm is optional]");
}
type = Expression::ScalarMeshVar;
}
ne = new_expr;
......
......@@ -41,8 +41,8 @@
#include <avtDivergenceFilter.h>
#include <stdio.h>
#include <snprintf.h>
#include <ExpressionException.h>
// ****************************************************************************
// Method: avtDivergenceFilter constructor
......@@ -87,6 +87,9 @@ avtDivergenceFilter::~avtDivergenceFilter()
// Hank Childs, Mon Jun 6 11:21:23 PDT 2005
// Add support for 2D.
//
// Cyrus Harrison, Sat Aug 11 18:34:41 PDT 2007
// Add second argument for gradient algorithm selection
//
// ****************************************************************************
void
......@@ -101,14 +104,59 @@ avtDivergenceFilter::GetMacro(std::vector<std::string> &args, std::string &ne,
do3D = (atts.GetTopologicalDimension() == 3);
}
char new_expr[1024];
int nargs = args.size();
char new_expr[2048];
if (do3D)
sprintf(new_expr, "gradient(%s[0])[0]+gradient(%s[1])[1]+"
"gradient(%s[2])[2]",
args[0].c_str(), args[0].c_str(), args[0].c_str());
{
if(nargs == 1)
{
SNPRINTF(new_expr, 2048,
"gradient(%s[0])[0]+gradient(%s[1])[1]+"
"gradient(%s[2])[2]",
args[0].c_str(), args[0].c_str(), args[0].c_str());
}
else if(nargs > 1)
{
SNPRINTF(new_expr, 2048,
"gradient(%s[0],%s)[0]+gradient(%s[1],%s)[1]+"
"gradient(%s[2],%s)[2]",
args[0].c_str(), args[1].c_str(),
args[0].c_str(), args[1].c_str(),
args[0].c_str(), args[1].c_str());
}
else
{
EXCEPTION1(ExpressionException, " invalid divergence syntax. "
"Expected arguments: "
" vector_var, gradient_algorithm\n"
" gradient_algorithm is optional");
}
}
else
sprintf(new_expr, "gradient(%s[0])[0]+gradient(%s[1])[1]",
args[0].c_str(), args[0].c_str());
{
if(nargs == 1)
{
SNPRINTF(new_expr, 2048,
"gradient(%s[0])[0]+gradient(%s[1])[1]",
args[0].c_str(), args[0].c_str());
}
else if(nargs > 1)
{
SNPRINTF(new_expr, 2048,
"gradient(%s[0],%s)[0]+gradient(%s[1],%s)[1]",
args[0].c_str(), args[1].c_str(),
args[0].c_str(), args[1].c_str());
}
else
{
EXCEPTION1(ExpressionException, " invalid divergence syntax. "
"Expected arguments: "
" vector_var, gradient_algorithm\n"
" gradient_algorithm is optional");
}
}
ne = new_expr;
type = Expression::ScalarMeshVar;
}
......
......@@ -76,37 +76,61 @@ class vtkStructuredGrid;
// Add support for logical gradients. Also add perform restriction, so we
// can request ghost zones.
//
// Cyrus Harrison, Wed Aug 8 11:17:51 PDT 2007
// Add support for multiple gradient algorithms.
//
// ****************************************************************************
typedef enum
{
SAMPLE = 0,
LOGICAL , /* 1 */
NODAL_TO_ZONAL_QUAD_HEX /* 2 */
} GradientAlgorithmType;
class EXPRESSION_API avtGradientFilter : public avtSingleInputExpressionFilter
{
public:
avtGradientFilter();
virtual ~avtGradientFilter();
void SetDoLogicalGradient(bool b)
{ doLogicalGradients = b; };
void SetAlgorithm(int algo)
{gradientAlgo = algo;}
virtual const char *GetType(void) { return "avtGradientFilter"; };
virtual const char *GetDescription(void)
{ return "Calculating Gradient"; };
virtual void PreExecute(void);
virtual void ProcessArguments(ArgsExpr*, ExprPipelineState *);
protected:
bool doLogicalGradients;
bool haveIssuedWarning;
int gradientAlgo;
virtual vtkDataArray *DeriveVariable(vtkDataSet *);
virtual int GetVariableDimension() { return 3; }
float EvaluateComponent(float, float, float, float,
float, float, float,
float, float, float,
vtkDataSet *, vtkDataArray *,
vtkIdList *);
vtkIdList *);
float EvaluateValue(float, float, float, vtkDataSet *,
vtkDataArray *,vtkIdList *,bool &);
vtkDataArray *RectilinearGradient(vtkRectilinearGrid *);
vtkDataArray *LogicalGradient(vtkStructuredGrid *);
vtkDataArray *NodalToZonalQuadHexGrad(vtkStructuredGrid *);
void CalculateNodalToZonalQuadGrad(vtkDataSet *,
vtkDataArray *,
int ,
double *);
void CalculateNodalToZonalHexGrad(vtkDataSet *,
vtkDataArray *,
int ,
double *);
virtual avtPipelineSpecification_p
PerformRestriction(avtPipelineSpecification_p);
};
......
......@@ -41,8 +41,8 @@
#include <avtLaplacianFilter.h>
#include <stdio.h>
#include <snprintf.h>
#include <ExpressionException.h>
// ****************************************************************************
// Method: avtLaplacianFilter constructor
......@@ -82,14 +82,38 @@ avtLaplacianFilter::~avtLaplacianFilter()
// Programmer: Hank Childs
// Creation: December 28, 2004
//
// Modifications:
//
// Cyrus Harrison, Sat Aug 11 18:45:53 PDT 2007
// Add second argument for gradient algorithm selection
//
// ****************************************************************************
void
avtLaplacianFilter::GetMacro(std::vector<std::string> &args, std::string &ne,
Expression::ExprType &type)
{
char new_expr[1024];
sprintf(new_expr, "divergence(gradient(%s))", args[0].c_str());
char new_expr[2048];
int nargs = args.size();
if(nargs == 1)
{
SNPRINTF(new_expr, 2048,
"divergence(gradient(%s))",
args[0].c_str());
}
else if(nargs ==2)
{
SNPRINTF(new_expr, 2048,
"divergence(gradient(%s,%s))",
args[0].c_str(),args[1].c_str());
}
else
{
EXCEPTION1(ExpressionException, " invalid laplacian syntax. "
"Expected arguments: "
"var, gradient_algorithm\n"
"[gradient_algorithm is optional]");
}
ne = new_expr;
type = Expression::ScalarMeshVar;
}
......
......@@ -454,6 +454,9 @@ avtVectorExpr::CreateFilters(ExprPipelineState *state)
// Cyrus Harrison, Fri Jun 1 14:43:59 PDT 2007
// Added contraction and viscous_stress
//
// Cyrus Harrison, Wed Aug 8 14:15:06 PDT 2007
// Modified to support new unified gradient expression
//
// ****************************************************************************
avtExpressionFilter *
......@@ -580,11 +583,15 @@ avtFunctionExpr::CreateFilters(string functionName)
if (functionName == "ijk_gradient" || functionName == "ij_gradient")
{
avtGradientFilter *g = new avtGradientFilter();
g->SetDoLogicalGradient(true);
g->SetAlgorithm(LOGICAL);
return g;
}
if (functionName == "agrad")
{
avtGradientFilter *g = new avtGradientFilter();
g->SetAlgorithm(NODAL_TO_ZONAL_QUAD_HEX);
return g;
}
if (functionName == "conn_components")
return new avtConnComponentsExpression();
if (functionName == "gradient")
return new avtGradientFilter();
if (functionName == "curl")
......@@ -593,6 +600,8 @@ avtFunctionExpr::CreateFilters(string functionName)
return new avtDivergenceFilter();
if (functionName == "laplacian" || functionName == "Laplacian")
return new avtLaplacianFilter();
if (functionName == "conn_components")
return new avtConnComponentsExpression();
if (functionName == "resrad")
return new avtResradFilter();
if (functionName == "magnitude")
......
......@@ -81,11 +81,16 @@ avtConnComponentsQuery::avtConnComponentsQuery()
// Programmer: Cyrus Harrison
// Creation: February 5, 2007
//
// Modifications:
//
// Cyrus Harrison, Tue Aug 7 16:18:18 PDT 2007
// Fixed memory leak - added delete of cclFilter
//
// ****************************************************************************
avtConnComponentsQuery::~avtConnComponentsQuery()
{
;
delete cclFilter;
}
......@@ -124,7 +129,7 @@ avtConnComponentsQuery::PreExecute(void)
void
avtConnComponentsQuery::PostExecute(void)
{
// simply return the number of connected components
// simply return the number of connected components
std::string msg = "";
char buff[2048];
......
......@@ -709,6 +709,11 @@ vtkVisItClipper::StructuredGridExecute(void)
// Mark C. Miller, Sun Dec 3 12:20:11 PST 2006
// Added code to adjust percent to new percent consistent with zero
// crossing of implicit func.
//
// Cyrus Harrison, Tue Aug 21 08:34:29 PDT 2007
// Fixed case where new points were created but not required resulting
// in duplicate points and bad connectivity.
//
// ****************************************************************************
void vtkVisItClipper::RectilinearGridExecute(void)
......@@ -909,7 +914,12 @@ void vtkVisItClipper::RectilinearGridExecute(void)
clipFunction, &percent);
}
shape[p] = vfv.AddPoint(ptId1, ptId2, percent);
if( percent == 1.0)
shape[p] = ptId1;
else if( percent == 0.0)
shape[p] = ptId2;
else
shape[p] = vfv.AddPoint(ptId1, ptId2, percent);
}
else if (pt >= N0 && pt <= N3)
{
......
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