Commit 892d233c authored by bonnell's avatar bonnell
Browse files

Added ability for CracksClipper operator to create a variable. Updated...

Added ability for CracksClipper operator to create a variable. Updated xml2info such that the operator common info method 'GetCreatedExpressions' could be overridden, and updated a few plugins accordingly, so that when regenerated they would still be correct.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@12642 18c085ea-50e0-402c-830e-de6fd14e8384
parent f8e5835e
Target: xml2info
Function: ConnectedComponentsCommonPluginInfo::GetCreatedExpressions
Declaration: virtual ExpressionList *GetCreatedExpressions(const char *);
Definition:
ExpressionList *
ConnectedComponentsCommonPluginInfo::GetCreatedExpressions(const char *mesh)
{
char name[1024];
char defn[1024];
ExpressionList *el = new ExpressionList;
Expression e2;
sprintf(name, "operators/ConnectedComponents/%s", mesh);
e2.SetName(name);
e2.SetType(Expression::ScalarMeshVar);
e2.SetFromOperator(true);
e2.SetOperatorName("ConnectedComponents");
sprintf(defn, "cell_constant(%s, 0.)", mesh);
e2.SetDefinition(defn);
el->AddExpressions(e2);
return el;
}
<?xml version="1.0"?>
<Plugin name="ConnectedComponents" type="operator" label="ConnectedComponents" version="1.0" enabled="true" mdspecificcode="false" engspecificcode="false" onlyengine="false" noengine="false" category="Analysis">
<Attribute name="ConnectedComponentsAttributes" purpose="Attributes for Connected Components operator" persistent="false" keyframe="true" exportAPI="" exportInclude="">
<Attribute name="ConnectedComponentsAttributes" purpose="Attributes for Connected Components operator" persistent="false" keyframe="true" exportAPI="" exportInclude="" codefile="ConnectedComponents.code">
<Function name="ConnectedComponentsCommonPluginInfo::GetCreatedExpressions" user="false" member="true">
</Function>
</Attribute>
</Plugin>
......@@ -44,7 +44,7 @@
#include <ConnectedComponentsAttributes.h>
#include <Expression.h>
#include <ExpressionList.h>
// ****************************************************************************
// Method: ConnectedComponentsCommonPluginInfo::AllocAttributes
......@@ -87,7 +87,6 @@ ConnectedComponentsCommonPluginInfo::CopyAttributes(AttributeSubject *to,
*((ConnectedComponentsAttributes *) to) = *((ConnectedComponentsAttributes *) from);
}
ExpressionList *
ConnectedComponentsCommonPluginInfo::GetCreatedExpressions(const char *mesh)
{
......@@ -108,4 +107,3 @@ ConnectedComponentsCommonPluginInfo::GetCreatedExpressions(const char *mesh)
return el;
}
......@@ -42,9 +42,6 @@
#ifndef CONNECTEDCOMPONENTS_PLUGIN_INFO_H
#define CONNECTEDCOMPONENTS_PLUGIN_INFO_H
#include <ExpressionList.h>
#include <OperatorPluginInfo.h>
#include <operator_plugin_exports.h>
......
......@@ -11,3 +11,39 @@ CracksClipperAttributes::ChangesRequireRecalculation(const CracksClipperAttribut
return true;
}
Target: xml2info
Function: CracksClipperCommonPluginInfo::GetCreatedExpressions
Declaration: virtual ExpressionList *GetCreatedExpressions(const char *);
Definition:
// ***************************************************************************
// Method: CracksClipperCommonPluginInfo::GetCreatedExpressions
//
// Purpose: Adds expressions to the pipeline that will be evaluated after
// this operator is executed.
//
// Programmer: Kathleen Bonnell
// Creation: September 27, 2010
//
// Modifications:
//
// ***************************************************************************
ExpressionList *
CracksClipperCommonPluginInfo::GetCreatedExpressions(const char *mesh)
{
char name[1024];
char defn[1024];
ExpressionList *el = new ExpressionList;
Expression e2;
sprintf(name, "operators/CracksClipper/%s/den", mesh);
e2.SetName(name);
e2.SetType(Expression::ScalarMeshVar);
e2.SetFromOperator(true);
sprintf(defn, "cell_constant(%s, 0.)", mesh);
e2.SetDefinition(defn);
el->AddExpressions(e2);
return el;
}
......@@ -36,16 +36,12 @@
<Field name="showCrack3" label="Show Crack 3" type="bool">
true
</Field>
<Field name="calculateDensity" label="Calculate Density" type="bool">
true
</Field>
<Field name="inMassVar" label="Input Mass Variable" type="string">
ems
</Field>
<Field name="outDenVar" label="Output Density Variable" type="string">
ems
</Field>
<Function name="ChangesRequireRecalculation" user="true" member="true">
</Function>
<Function name="CracksClipperCommonPluginInfo::GetCreatedExpressions" user="false" member="true">
</Function>
</Attribute>
</Plugin>
......@@ -39,14 +39,11 @@
#include <CracksClipperAttributes.h>
#include <DataNode.h>
// Type map format string
const char *CracksClipperAttributes::TypeMapFormatString = "ssssbbbbss";
// ****************************************************************************
// Method: CracksClipperAttributes::CracksClipperAttributes
//
// Purpose:
// Constructor for the CracksClipperAttributes class.
// Init utility for the CracksClipperAttributes class.
//
// Note: Autogenerated by xml2atts.
//
......@@ -57,8 +54,7 @@ const char *CracksClipperAttributes::TypeMapFormatString = "ssssbbbbss";
//
// ****************************************************************************
CracksClipperAttributes::CracksClipperAttributes() :
AttributeSubject(CracksClipperAttributes::TypeMapFormatString)
void CracksClipperAttributes::Init()
{
crack1Var = "crack1_dir";
crack2Var = "crack2_dir";
......@@ -67,16 +63,16 @@ CracksClipperAttributes::CracksClipperAttributes() :
showCrack1 = true;
showCrack2 = true;
showCrack3 = true;
calculateDensity = true;
inMassVar = "ems";
outDenVar = "ems";
CracksClipperAttributes::SelectAll();
}
// ****************************************************************************
// Method: CracksClipperAttributes::CracksClipperAttributes
//
// Purpose:
// Copy constructor for the CracksClipperAttributes class.
// Copy utility for the CracksClipperAttributes class.
//
// Note: Autogenerated by xml2atts.
//
......@@ -87,8 +83,7 @@ CracksClipperAttributes::CracksClipperAttributes() :
//
// ****************************************************************************
CracksClipperAttributes::CracksClipperAttributes(const CracksClipperAttributes &obj) :
AttributeSubject(CracksClipperAttributes::TypeMapFormatString)
void CracksClipperAttributes::Copy(const CracksClipperAttributes &obj)
{
crack1Var = obj.crack1Var;
crack2Var = obj.crack2Var;
......@@ -97,11 +92,98 @@ CracksClipperAttributes::CracksClipperAttributes(const CracksClipperAttributes &
showCrack1 = obj.showCrack1;
showCrack2 = obj.showCrack2;
showCrack3 = obj.showCrack3;
calculateDensity = obj.calculateDensity;
inMassVar = obj.inMassVar;
outDenVar = obj.outDenVar;
SelectAll();
CracksClipperAttributes::SelectAll();
}
// Type map format string
const char *CracksClipperAttributes::TypeMapFormatString = CRACKSCLIPPERATTRIBUTES_TMFS;
const AttributeGroup::private_tmfs_t CracksClipperAttributes::TmfsStruct = {CRACKSCLIPPERATTRIBUTES_TMFS};
// ****************************************************************************
// Method: CracksClipperAttributes::CracksClipperAttributes
//
// Purpose:
// Default constructor for the CracksClipperAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
CracksClipperAttributes::CracksClipperAttributes() :
AttributeSubject(CracksClipperAttributes::TypeMapFormatString)
{
CracksClipperAttributes::Init();
}
// ****************************************************************************
// Method: CracksClipperAttributes::CracksClipperAttributes
//
// Purpose:
// Constructor for the derived classes of CracksClipperAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
CracksClipperAttributes::CracksClipperAttributes(private_tmfs_t tmfs) :
AttributeSubject(tmfs.tmfs)
{
CracksClipperAttributes::Init();
}
// ****************************************************************************
// Method: CracksClipperAttributes::CracksClipperAttributes
//
// Purpose:
// Copy constructor for the CracksClipperAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
CracksClipperAttributes::CracksClipperAttributes(const CracksClipperAttributes &obj) :
AttributeSubject(CracksClipperAttributes::TypeMapFormatString)
{
CracksClipperAttributes::Copy(obj);
}
// ****************************************************************************
// Method: CracksClipperAttributes::CracksClipperAttributes
//
// Purpose:
// Copy constructor for derived classes of the CracksClipperAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: omitted
//
// Modifications:
//
// ****************************************************************************
CracksClipperAttributes::CracksClipperAttributes(const CracksClipperAttributes &obj, private_tmfs_t tmfs) :
AttributeSubject(tmfs.tmfs)
{
CracksClipperAttributes::Copy(obj);
}
// ****************************************************************************
......@@ -143,18 +225,9 @@ CracksClipperAttributes&
CracksClipperAttributes::operator = (const CracksClipperAttributes &obj)
{
if (this == &obj) return *this;
crack1Var = obj.crack1Var;
crack2Var = obj.crack2Var;
crack3Var = obj.crack3Var;
strainVar = obj.strainVar;
showCrack1 = obj.showCrack1;
showCrack2 = obj.showCrack2;
showCrack3 = obj.showCrack3;
calculateDensity = obj.calculateDensity;
inMassVar = obj.inMassVar;
outDenVar = obj.outDenVar;
SelectAll();
CracksClipperAttributes::Copy(obj);
return *this;
}
......@@ -184,9 +257,7 @@ CracksClipperAttributes::operator == (const CracksClipperAttributes &obj) const
(showCrack1 == obj.showCrack1) &&
(showCrack2 == obj.showCrack2) &&
(showCrack3 == obj.showCrack3) &&
(calculateDensity == obj.calculateDensity) &&
(inMassVar == obj.inMassVar) &&
(outDenVar == obj.outDenVar));
(inMassVar == obj.inMassVar));
}
// ****************************************************************************
......@@ -330,16 +401,14 @@ CracksClipperAttributes::NewInstance(bool copy) const
void
CracksClipperAttributes::SelectAll()
{
Select(ID_crack1Var, (void *)&crack1Var);
Select(ID_crack2Var, (void *)&crack2Var);
Select(ID_crack3Var, (void *)&crack3Var);
Select(ID_strainVar, (void *)&strainVar);
Select(ID_showCrack1, (void *)&showCrack1);
Select(ID_showCrack2, (void *)&showCrack2);
Select(ID_showCrack3, (void *)&showCrack3);
Select(ID_calculateDensity, (void *)&calculateDensity);
Select(ID_inMassVar, (void *)&inMassVar);
Select(ID_outDenVar, (void *)&outDenVar);
Select(ID_crack1Var, (void *)&crack1Var);
Select(ID_crack2Var, (void *)&crack2Var);
Select(ID_crack3Var, (void *)&crack3Var);
Select(ID_strainVar, (void *)&strainVar);
Select(ID_showCrack1, (void *)&showCrack1);
Select(ID_showCrack2, (void *)&showCrack2);
Select(ID_showCrack3, (void *)&showCrack3);
Select(ID_inMassVar, (void *)&inMassVar);
}
///////////////////////////////////////////////////////////////////////////////
......@@ -414,24 +483,12 @@ CracksClipperAttributes::CreateNode(DataNode *parentNode, bool completeSave, boo
node->AddNode(new DataNode("showCrack3", showCrack3));
}
if(completeSave || !FieldsEqual(ID_calculateDensity, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("calculateDensity", calculateDensity));
}
if(completeSave || !FieldsEqual(ID_inMassVar, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("inMassVar", inMassVar));
}
if(completeSave || !FieldsEqual(ID_outDenVar, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("outDenVar", outDenVar));
}
// Add the node to the parent node.
if(addToParent || forceAdd)
......@@ -482,12 +539,8 @@ CracksClipperAttributes::SetFromNode(DataNode *parentNode)
SetShowCrack2(node->AsBool());
if((node = searchNode->GetNode("showCrack3")) != 0)
SetShowCrack3(node->AsBool());
if((node = searchNode->GetNode("calculateDensity")) != 0)
SetCalculateDensity(node->AsBool());
if((node = searchNode->GetNode("inMassVar")) != 0)
SetInMassVar(node->AsString());
if((node = searchNode->GetNode("outDenVar")) != 0)
SetOutDenVar(node->AsString());
}
///////////////////////////////////////////////////////////////////////////////
......@@ -543,13 +596,6 @@ CracksClipperAttributes::SetShowCrack3(bool showCrack3_)
Select(ID_showCrack3, (void *)&showCrack3);
}
void
CracksClipperAttributes::SetCalculateDensity(bool calculateDensity_)
{
calculateDensity = calculateDensity_;
Select(ID_calculateDensity, (void *)&calculateDensity);
}
void
CracksClipperAttributes::SetInMassVar(const std::string &inMassVar_)
{
......@@ -557,13 +603,6 @@ CracksClipperAttributes::SetInMassVar(const std::string &inMassVar_)
Select(ID_inMassVar, (void *)&inMassVar);
}
void
CracksClipperAttributes::SetOutDenVar(const std::string &outDenVar_)
{
outDenVar = outDenVar_;
Select(ID_outDenVar, (void *)&outDenVar);
}
///////////////////////////////////////////////////////////////////////////////
// Get property methods
///////////////////////////////////////////////////////////////////////////////
......@@ -634,12 +673,6 @@ CracksClipperAttributes::GetShowCrack3() const
return showCrack3;
}
bool
CracksClipperAttributes::GetCalculateDensity() const
{
return calculateDensity;
}
const std::string &
CracksClipperAttributes::GetInMassVar() const
{
......@@ -652,18 +685,6 @@ CracksClipperAttributes::GetInMassVar()
return inMassVar;
}
const std::string &
CracksClipperAttributes::GetOutDenVar() const
{
return outDenVar;
}
std::string &
CracksClipperAttributes::GetOutDenVar()
{
return outDenVar;
}
///////////////////////////////////////////////////////////////////////////////
// Select property methods
///////////////////////////////////////////////////////////////////////////////
......@@ -698,12 +719,6 @@ CracksClipperAttributes::SelectInMassVar()
Select(ID_inMassVar, (void *)&inMassVar);
}
void
CracksClipperAttributes::SelectOutDenVar()
{
Select(ID_outDenVar, (void *)&outDenVar);
}
///////////////////////////////////////////////////////////////////////////////
// Keyframing methods
///////////////////////////////////////////////////////////////////////////////
......@@ -728,16 +743,14 @@ CracksClipperAttributes::GetFieldName(int index) const
{
switch (index)
{
case ID_crack1Var: return "crack1Var";
case ID_crack2Var: return "crack2Var";
case ID_crack3Var: return "crack3Var";
case ID_strainVar: return "strainVar";
case ID_showCrack1: return "showCrack1";
case ID_showCrack2: return "showCrack2";
case ID_showCrack3: return "showCrack3";
case ID_calculateDensity: return "calculateDensity";
case ID_inMassVar: return "inMassVar";
case ID_outDenVar: return "outDenVar";
case ID_crack1Var: return "crack1Var";
case ID_crack2Var: return "crack2Var";
case ID_crack3Var: return "crack3Var";
case ID_strainVar: return "strainVar";
case ID_showCrack1: return "showCrack1";
case ID_showCrack2: return "showCrack2";
case ID_showCrack3: return "showCrack3";
case ID_inMassVar: return "inMassVar";
default: return "invalid index";
}
}
......@@ -762,16 +775,14 @@ CracksClipperAttributes::GetFieldType(int index) const
{
switch (index)
{
case ID_crack1Var: return FieldType_string;
case ID_crack2Var: return FieldType_string;
case ID_crack3Var: return FieldType_string;
case ID_strainVar: return FieldType_string;
case ID_showCrack1: return FieldType_bool;
case ID_showCrack2: return FieldType_bool;
case ID_showCrack3: return FieldType_bool;
case ID_calculateDensity: return FieldType_bool;
case ID_inMassVar: return FieldType_string;
case ID_outDenVar: return FieldType_string;
case ID_crack1Var: return FieldType_string;
case ID_crack2Var: return FieldType_string;
case ID_crack3Var: return FieldType_string;
case ID_strainVar: return FieldType_string;
case ID_showCrack1: return FieldType_bool;
case ID_showCrack2: return FieldType_bool;
case ID_showCrack3: return FieldType_bool;
case ID_inMassVar: return FieldType_string;
default: return FieldType_unknown;
}
}
......@@ -796,16 +807,14 @@ CracksClipperAttributes::GetFieldTypeName(int index) const
{
switch (index)
{
case ID_crack1Var: return "string";
case ID_crack2Var: return "string";
case ID_crack3Var: return "string";
case ID_strainVar: return "string";
case ID_showCrack1: return "bool";
case ID_showCrack2: return "bool";
case ID_showCrack3: return "bool";
case ID_calculateDensity: return "bool";
case ID_inMassVar: return "string";
case ID_outDenVar: return "string";
case ID_crack1Var: return "string";
case ID_crack2Var: return "string";
case ID_crack3Var: return "string";
case ID_strainVar: return "string";
case ID_showCrack1: return "bool";
case ID_showCrack2: return "bool";
case ID_showCrack3: return "bool";
case ID_inMassVar: return "string";
default: return "invalid index";
}
}
......@@ -867,21 +876,11 @@ CracksClipperAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) cons
retval = (showCrack3 == obj.showCrack3);
}
break;
case ID_calculateDensity:
{ // new scope
retval = (calculateDensity == obj.calculateDensity);
}
break;
case ID_inMassVar:
{ // new scope
retval = (inMassVar == obj.inMassVar);
}
break;
case ID_outDenVar:
{ // new scope
retval = (outDenVar == obj.outDenVar);
}
break;
default: retval = false;
}
......
......@@ -41,6 +41,7 @@
#include <string>
#include <AttributeSubject.h>
// ****************************************************************************
// Class: CracksClipperAttributes
//
......@@ -59,13 +60,23 @@
class CracksClipperAttributes : public AttributeSubject
{
public:
// These constructors are for objects of this class
CracksClipperAttributes();
CracksClipperAttributes(const CracksClipperAttributes &obj);
protected:
// These constructors are for objects derived from this class
CracksClipperAttributes(private_tmfs_t tmfs);
CracksClipperAttributes(const CracksClipperAttributes &obj, private_tmfs_t tmfs);
public:
virtual ~CracksClipperAttributes();
virtual CracksClipperAttributes& operator = (const CracksClipperAttributes &obj);
virtual bool operator == (const CracksClipperAttributes &obj) const;
virtual bool operator != (const CracksClipperAttributes &obj) const;
private:
void Init();
void Copy(const CracksClipperAttributes &obj);
public:
virtual const std::string TypeName() const;
virtual bool CopyAttributes(const AttributeGroup *);
......@@ -79,7 +90,6 @@ public:
void SelectCrack3Var();
void SelectStrainVar();
void SelectInMassVar();
void SelectOutDenVar();
// Property setting methods
void SetCrack1Var(const std::string &crack1Var_);
......@@ -89,9 +99,7 @@ public:
void SetShowCrack1(bool showCrack1_);
void SetShowCrack2(bool showCrack2_);
void SetShowCrack3(bool showCrack3_);
void SetCalculateDensity(bool calculateDensity_);
void SetInMassVar(const std::string &inMassVar_);
void SetOutDenVar(const std::string &outDenVar_);
// Property getting methods
const std::string &GetCrack1Var() const;
......@@ -105,11 +113,8 @@ public:
bool GetShowCrack1() const;
bool GetShowCrack2() const;
bool GetShowCrack3() const;
bool GetCalculateDensity() const;
const std::string &GetInMassVar() const;
std::string &GetInMassVar();
const std::string &GetOutDenVar() const;
std::string &GetOutDenVar();
// Persistence methods
virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
......@@ -134,9 +139,8 @@ public:
ID_showCrack1,
ID_showCrack2,
ID_showCrack3,