Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkFEMPArray.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkFEMPArray.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:43 $ 00007 Version: $Revision: 1.14 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef __itkFEMPArray_h 00019 #define __itkFEMPArray_h 00020 00021 #include "itkFEMP.h" 00022 #include "itkFEMException.h" 00023 #include <vector> 00024 00025 namespace itk { 00026 namespace fem { 00027 00028 00029 00030 00039 template<class T> 00040 class FEMPArray : public std::vector<FEMP<T> > 00041 { 00042 public: 00046 typedef FEMPArray Self; 00047 00051 typedef std::vector<FEMP<T> > Superclass; 00052 00056 typedef Self* Pointer; 00057 typedef const Self* ConstPointer; 00058 00062 typedef T ClassType; 00063 typedef typename ClassType::Pointer ClassTypePointer; 00064 typedef typename ClassType::ConstPointer ClassTypeConstPointer; 00065 00069 ClassTypePointer Find(int gn); 00070 ClassTypeConstPointer Find(int gn) const; 00071 00075 ClassTypePointer operator() (int i) 00076 { 00077 return &(*operator[](i)); 00078 } 00079 00084 ClassTypeConstPointer operator() (int i) const 00085 { 00086 return &(*operator[](i)); 00087 } 00088 00089 00095 int Renumber(); 00096 00097 }; 00098 00099 00100 00104 template<class T> 00105 typename FEMPArray<T>::ClassTypePointer 00106 FEMPArray<T>::Find(int gn) 00107 { 00108 00109 typedef typename Superclass::iterator Iterator; 00110 00111 Iterator it = this->begin(); 00112 Iterator iend = this->end(); 00113 while( it != iend ) 00114 { 00115 if( (*it)->GN == gn ) 00116 { 00117 break; 00118 } 00119 it++; 00120 } 00121 00122 if( it == this->end() ) 00123 { 00127 throw FEMExceptionObjectNotFound(__FILE__,__LINE__,"FEMPArray::Find() const",typeid(T).name(),gn); 00128 } 00129 00133 return &(*(*it)); 00134 00135 } 00136 00137 00138 00139 00143 template<class T> 00144 typename FEMPArray<T>::ClassTypeConstPointer 00145 FEMPArray<T>::Find( int gn ) const 00146 { 00147 00148 typedef typename Superclass::const_iterator ConstIterator; 00149 00150 ConstIterator it = this->begin(); 00151 ConstIterator iend = this->end(); 00152 while( it != iend ) 00153 { 00154 if( (*it)->GN == gn ) 00155 { 00156 break; 00157 } 00158 it++; 00159 } 00160 00161 if( it == this->end() ) 00162 { 00166 throw FEMExceptionObjectNotFound(__FILE__,__LINE__,"FEMPArray::Find() const",typeid(T).name(),gn); 00167 } 00168 00172 return &(*(*it)); 00173 00174 } 00175 00176 00177 00178 00179 template<class T> 00180 int FEMPArray<T>::Renumber() 00181 { 00182 00183 typename Superclass::iterator i; 00184 int j=0; 00185 00186 for(i=begin(); i!=end(); i++) 00187 { 00188 (*i)->GN=j; 00189 j++; 00190 } 00191 00192 return j; 00193 00194 } 00195 00196 00197 00198 00199 }} // end namespace itk::fem 00200 00201 #endif // #ifndef __itkFEMPArray_h

Generated at Sat Mar 31 02:18:31 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000