00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkFEMElementStd.h,v $ 00005 Language: C++ 00006 Date: $Date: 2009-01-29 21:28:16 $ 00007 Version: $Revision: 1.17 $ 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 __itkFEMElementStd_h 00019 #define __itkFEMElementStd_h 00020 00021 #include "itkFEMElementBase.h" 00022 00023 namespace itk { 00024 namespace fem { 00025 00052 template<unsigned int VNumberOfNodes, unsigned int VNumberOfSpatialDimensions, class TBaseClass=Element> 00053 class ElementStd : public TBaseClass 00054 { 00055 FEM_ABSTRACT_CLASS(ElementStd,TBaseClass) 00056 public: 00057 00058 // FIXME: Add concept cheking for TBaseClass, and TPointClass 00059 00060 // Repeat typedefs and enums from parent class 00061 typedef typename Superclass::Float Float; 00062 typedef typename Superclass::MatrixType MatrixType; 00063 typedef typename Superclass::VectorType VectorType; 00064 typedef typename Superclass::LoadType LoadType; 00065 typedef typename Superclass::LoadPointer LoadPointer; 00066 typedef typename Superclass::NodeIDType NodeIDType; 00067 typedef typename Superclass::DegreeOfFreedomIDType DegreeOfFreedomIDType; 00068 typedef typename Superclass::Node Node; 00069 enum{ InvalidDegreeOfFreedomID = Superclass::InvalidDegreeOfFreedomID }; 00070 00074 enum { NumberOfNodes=VNumberOfNodes }; 00075 00079 enum { NumberOfSpatialDimensions=VNumberOfSpatialDimensions }; 00080 00084 ElementStd(); 00085 00087 00090 virtual unsigned int GetNumberOfNodes( void ) const 00091 { return NumberOfNodes; } 00092 00093 virtual NodeIDType GetNode(unsigned int n) const 00094 { 00095 if(n>=NumberOfNodes) 00096 { 00097 return 0; 00098 } 00099 return this->m_node[n]; 00100 } 00101 00102 virtual void SetNode(unsigned int n, NodeIDType node) 00103 { 00104 if(n>=NumberOfNodes) 00105 { 00106 return; 00107 } 00108 this->m_node[n]=node; 00109 } 00110 00111 virtual const VectorType& GetNodeCoordinates( unsigned int n ) const 00112 { 00113 return m_node[n]->GetCoordinates(); 00114 } 00115 00116 virtual unsigned int GetNumberOfSpatialDimensions() const 00117 { 00118 return NumberOfSpatialDimensions; 00119 } 00120 00122 00129 virtual void Read( std::istream&, void* info ); 00130 00134 virtual void Write( std::ostream& f ) const; 00135 00136 protected: 00137 00141 NodeIDType m_node[NumberOfNodes]; 00142 00143 }; 00144 00145 #ifdef _MSC_VER 00146 // Declare a static dummy function to prevent a MSVC 6.0 SP5 from crashing. 00147 // I have no idea why things don't work when this is not declared, but it 00148 // looks like this declaration makes compiler forget about some of the 00149 // troubles it has with templates. 00150 static void Dummy( void ); 00151 #endif // #ifdef _MSC_VER 00152 00153 }} // end namespace itk::fem 00154 00155 #ifndef ITK_MANUAL_INSTANTIATION 00156 #include "itkFEMElementStd.txx" 00157 #endif 00158 00159 #endif // #ifndef __itkFEMElementStd_h 00160