/*========================================================================= Program: ShapeWorks: Particle-based Shape Correspondence & Visualization Module: $RCSfile: itkParticleContainerArrayAttribute.h,v $ Date: $Date: 2011/03/24 01:17:33 $ Version: $Revision: 1.2 $ Author: $Author: wmartin $ Copyright (c) 2009 Scientific Computing and Imaging Institute. See ShapeWorksLicense.txt for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information.=========================================================================*/#ifndef __itkParticleContainerArrayAttribute_h#define __itkParticleContainerArrayAttribute_h#include"itkDataObject.h"#include"itkWeakPointer.h"#include"itkParticleAttribute.h"#include"itkParticleContainer.h"#include<vector>namespaceitk{template<classT,unsignedintVDimension>classITK_EXPORTParticleContainerArrayAttribute:publicstd::vector<typenameParticleContainer<T>::Pointer>,publicParticleAttribute<VDimension>{public:typedefTDataType;typedefParticleContainerArrayAttributeSelf;typedefParticleAttribute<VDimension>Superclass;typedefSmartPointer<Self>Pointer;typedefSmartPointer<constSelf>ConstPointer;typedefWeakPointer<constSelf>ConstWeakPointer;itkNewMacro(Self);itkTypeMacro(ParticleContainer,ParticleAttribute);virtualvoidDomainAddEventCallback(Object*,constEventObject&){this->resize(this->size()+1);this->operator[](this->size()-1)=ParticleContainer<T>::New();}virtualvoidPositionAddEventCallback(Object*o,constEventObject&e){constitk::ParticlePositionAddEvent&event=dynamic_cast<constitk::ParticlePositionAddEvent&>(e);this->operator[](event.GetDomainIndex())->operator[](event.GetPositionIndex())=0.0;}virtualvoidPositionRemoveEventCallback(Object*,constEventObject&){// NEED TO IMPLEMENT THIS}voidZeroAllValues(){for(unsignedd=0;d<this->size();d++){for(unsignedinti=0;i<this->operator[](d)->GetSize();i++){this->operator[](d)->operator[](i)=0.0;}}}protected:ParticleContainerArrayAttribute(){this->m_DefinedCallbacks.DomainAddEvent=true;this->m_DefinedCallbacks.PositionAddEvent=true;this->m_DefinedCallbacks.PositionRemoveEvent=true;}virtual~ParticleContainerArrayAttribute(){};voidPrintSelf(std::ostream&os,Indentindent)const{Superclass::PrintSelf(os,indent);}private:ParticleContainerArrayAttribute(constSelf&);//purposely not implementedvoidoperator=(constSelf&);//purposely not implemented};}// end namespace#endif