Commit 68862012 authored by hrchilds's avatar hrchilds

Add PersistentParticles operator, which is part of 1.12RC merge from

previous commit.  (SVN weirdness)


git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@6368 18c085ea-50e0-402c-830e-de6fd14e8384
parent a96c7087
<?xml version="1.0"?>
<Plugin name="PersistentParticles" type="operator" label="PersistentParticles" version="1.0" enabled="true" mdspecificcode="false" engspecificcode="false" onlyengine="false" noengine="false">
<Attribute name="PersistentParticlesAttributes" purpose="This class contains attributes for the PersistentParticles operator." persistent="true" keyframe="true" exportAPI="" exportInclude="">
<Field name="startIndex" label="Index of first time slice" type="int">
0
</Field>
<Field name="stopIndex" label="Index of last time slice" type="int">
1
</Field>
<Field name="stride" label="Skip rate between time slices" type="int">
1
</Field>
</Attribute>
</Plugin>
/*****************************************************************************
*
* Copyright (c) 2000 - 2008, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400142
* 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.
*
*****************************************************************************/
#include <PersistentParticlesAttributes.h>
#include <DataNode.h>
// Type map format string
const char *PersistentParticlesAttributes::TypeMapFormatString = "iii";
// ****************************************************************************
// Method: PersistentParticlesAttributes::PersistentParticlesAttributes
//
// Purpose:
// Constructor for the PersistentParticlesAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
PersistentParticlesAttributes::PersistentParticlesAttributes() :
AttributeSubject(PersistentParticlesAttributes::TypeMapFormatString)
{
startIndex = 0;
stopIndex = 1;
stride = 1;
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::PersistentParticlesAttributes
//
// Purpose:
// Copy constructor for the PersistentParticlesAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
PersistentParticlesAttributes::PersistentParticlesAttributes(const PersistentParticlesAttributes &obj) :
AttributeSubject(PersistentParticlesAttributes::TypeMapFormatString)
{
startIndex = obj.startIndex;
stopIndex = obj.stopIndex;
stride = obj.stride;
SelectAll();
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::~PersistentParticlesAttributes
//
// Purpose:
// Destructor for the PersistentParticlesAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
PersistentParticlesAttributes::~PersistentParticlesAttributes()
{
// nothing here
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::operator =
//
// Purpose:
// Assignment operator for the PersistentParticlesAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
PersistentParticlesAttributes&
PersistentParticlesAttributes::operator = (const PersistentParticlesAttributes &obj)
{
if (this == &obj) return *this;
startIndex = obj.startIndex;
stopIndex = obj.stopIndex;
stride = obj.stride;
SelectAll();
return *this;
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::operator ==
//
// Purpose:
// Comparison operator == for the PersistentParticlesAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
bool
PersistentParticlesAttributes::operator == (const PersistentParticlesAttributes &obj) const
{
// Create the return value
return ((startIndex == obj.startIndex) &&
(stopIndex == obj.stopIndex) &&
(stride == obj.stride));
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::operator !=
//
// Purpose:
// Comparison operator != for the PersistentParticlesAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
bool
PersistentParticlesAttributes::operator != (const PersistentParticlesAttributes &obj) const
{
return !(this->operator == (obj));
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::TypeName
//
// Purpose:
// Type name method for the PersistentParticlesAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
const std::string
PersistentParticlesAttributes::TypeName() const
{
return "PersistentParticlesAttributes";
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::CopyAttributes
//
// Purpose:
// CopyAttributes method for the PersistentParticlesAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
bool
PersistentParticlesAttributes::CopyAttributes(const AttributeGroup *atts)
{
if(TypeName() != atts->TypeName())
return false;
// Call assignment operator.
const PersistentParticlesAttributes *tmp = (const PersistentParticlesAttributes *)atts;
*this = *tmp;
return true;
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::CreateCompatible
//
// Purpose:
// CreateCompatible method for the PersistentParticlesAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
AttributeSubject *
PersistentParticlesAttributes::CreateCompatible(const std::string &tname) const
{
AttributeSubject *retval = 0;
if(TypeName() == tname)
retval = new PersistentParticlesAttributes(*this);
// Other cases could go here too.
return retval;
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::NewInstance
//
// Purpose:
// NewInstance method for the PersistentParticlesAttributes class.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
AttributeSubject *
PersistentParticlesAttributes::NewInstance(bool copy) const
{
AttributeSubject *retval = 0;
if(copy)
retval = new PersistentParticlesAttributes(*this);
else
retval = new PersistentParticlesAttributes;
return retval;
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::SelectAll
//
// Purpose:
// Selects all attributes.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
void
PersistentParticlesAttributes::SelectAll()
{
Select(ID_startIndex, (void *)&startIndex);
Select(ID_stopIndex, (void *)&stopIndex);
Select(ID_stride, (void *)&stride);
}
///////////////////////////////////////////////////////////////////////////////
// Persistence methods
///////////////////////////////////////////////////////////////////////////////
// ****************************************************************************
// Method: PersistentParticlesAttributes::CreateNode
//
// Purpose:
// This method creates a DataNode representation of the object so it can be saved to a config file.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
bool
PersistentParticlesAttributes::CreateNode(DataNode *parentNode, bool completeSave, bool forceAdd)
{
if(parentNode == 0)
return false;
PersistentParticlesAttributes defaultObject;
bool addToParent = false;
// Create a node for PersistentParticlesAttributes.
DataNode *node = new DataNode("PersistentParticlesAttributes");
if(completeSave || !FieldsEqual(ID_startIndex, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("startIndex", startIndex));
}
if(completeSave || !FieldsEqual(ID_stopIndex, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("stopIndex", stopIndex));
}
if(completeSave || !FieldsEqual(ID_stride, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("stride", stride));
}
// Add the node to the parent node.
if(addToParent || forceAdd)
parentNode->AddNode(node);
else
delete node;
return (addToParent || forceAdd);
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::SetFromNode
//
// Purpose:
// This method sets attributes in this object from values in a DataNode representation of the object.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
void
PersistentParticlesAttributes::SetFromNode(DataNode *parentNode)
{
int i;
if(parentNode == 0)
return;
DataNode *searchNode = parentNode->GetNode("PersistentParticlesAttributes");
if(searchNode == 0)
return;
DataNode *node;
if((node = searchNode->GetNode("startIndex")) != 0)
SetStartIndex(node->AsInt());
if((node = searchNode->GetNode("stopIndex")) != 0)
SetStopIndex(node->AsInt());
if((node = searchNode->GetNode("stride")) != 0)
SetStride(node->AsInt());
}
///////////////////////////////////////////////////////////////////////////////
// Set property methods
///////////////////////////////////////////////////////////////////////////////
void
PersistentParticlesAttributes::SetStartIndex(int startIndex_)
{
startIndex = startIndex_;
Select(ID_startIndex, (void *)&startIndex);
}
void
PersistentParticlesAttributes::SetStopIndex(int stopIndex_)
{
stopIndex = stopIndex_;
Select(ID_stopIndex, (void *)&stopIndex);
}
void
PersistentParticlesAttributes::SetStride(int stride_)
{
stride = stride_;
Select(ID_stride, (void *)&stride);
}
///////////////////////////////////////////////////////////////////////////////
// Get property methods
///////////////////////////////////////////////////////////////////////////////
int
PersistentParticlesAttributes::GetStartIndex() const
{
return startIndex;
}
int
PersistentParticlesAttributes::GetStopIndex() const
{
return stopIndex;
}
int
PersistentParticlesAttributes::GetStride() const
{
return stride;
}
///////////////////////////////////////////////////////////////////////////////
// Keyframing methods
///////////////////////////////////////////////////////////////////////////////
// ****************************************************************************
// Method: PersistentParticlesAttributes::GetFieldName
//
// Purpose:
// This method returns the name of a field given its index.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
std::string
PersistentParticlesAttributes::GetFieldName(int index) const
{
switch (index)
{
case ID_startIndex: return "startIndex";
case ID_stopIndex: return "stopIndex";
case ID_stride: return "stride";
default: return "invalid index";
}
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::GetFieldType
//
// Purpose:
// This method returns the type of a field given its index.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
AttributeGroup::FieldType
PersistentParticlesAttributes::GetFieldType(int index) const
{
switch (index)
{
case ID_startIndex: return FieldType_int;
case ID_stopIndex: return FieldType_int;
case ID_stride: return FieldType_int;
default: return FieldType_unknown;
}
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::GetFieldTypeName
//
// Purpose:
// This method returns the name of a field type given its index.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
std::string
PersistentParticlesAttributes::GetFieldTypeName(int index) const
{
switch (index)
{
case ID_startIndex: return "int";
case ID_stopIndex: return "int";
case ID_stride: return "int";
default: return "invalid index";
}
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::FieldsEqual
//
// Purpose:
// This method compares two fields and return true if they are equal.
//
// Note: Autogenerated by xml2atts.
//
// Programmer: xml2atts
// Creation: Fri Jan 25 11:27:40 PDT 2008
//
// Modifications:
//
// ****************************************************************************
bool
PersistentParticlesAttributes::FieldsEqual(int index_, const AttributeGroup *rhs) const
{
const PersistentParticlesAttributes &obj = *((const PersistentParticlesAttributes*)rhs);
bool retval = false;
switch (index_)
{
case ID_startIndex:
{ // new scope
retval = (startIndex == obj.startIndex);
}
break;
case ID_stopIndex:
{ // new scope
retval = (stopIndex == obj.stopIndex);
}
break;
case ID_stride:
{ // new scope
retval = (stride == obj.stride);
}
break;
default: retval = false;
}
return retval;
}
///////////////////////////////////////////////////////////////////////////////
// User-defined methods.
///////////////////////////////////////////////////////////////////////////////
/*****************************************************************************
*
* Copyright (c) 2000 - 2008, Lawrence Livermore National Security, LLC
* Produced at the Lawrence Livermore National Laboratory
* LLNL-CODE-400142
* 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