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

itkFEMLoadImplementationTest.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkFEMLoadImplementationTest.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-01-30 21:10:18 $
00007   Version:   $Revision: 1.5 $
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 __itkFEMLoadImplementationTest_h
00019 #define __itkFEMLoadImplementationTest_h
00020 
00021 #include "itkFEMElement2DC0LinearLineStress.h"
00022 #include "itkFEMLoadTest.h"
00023 
00024 namespace itk {
00025 namespace fem {
00026 
00047 template<class TLoadClass>
00048 class LoadImplementationTest
00049 {
00050 public:
00051   static void impl(Element2DC0LinearLineStress::ConstPointer element, Element::LoadPointer load, Element::VectorType& Fe)
00052   {
00053     // We must dynamically cast the given load pointer to the
00054     // correct templated load class, which is given as
00055     // template parameter.
00056     typename TLoadClass::Pointer l0=dynamic_cast<TLoadClass*>(&*load);
00057     if ( !l0 ) throw FEMException(__FILE__, __LINE__, "FEM error");
00059 
00060     std::cout<<"Load object's data:"<<l0->data<<"\n";
00061   }
00062 private:
00063   static const bool m_Registered;
00064 };
00065 
00066 // When the templated load implementation function is instantiated,
00067 // it will automatically be registered with the VisitorDispatcher so 
00068 // that it is called as required.
00069 // Instantiating the implementation function will also instantiate the
00070 // corresponding Load class.
00071 template<class TLoadClass>
00072 const bool LoadImplementationTest<TLoadClass>::m_Registered=
00073   VisitorDispatcher<Element2DC0LinearLineStress,Element::LoadType,Element2DC0LinearLineStress::LoadImplementationFunctionPointer>
00074   ::RegisterVisitor((TLoadClass*)0, &LoadImplementationTest<TLoadClass>::impl);
00075 
00076 }} // end namespace itk::fem
00077 
00078 #endif // #ifndef __itkFEMLoadImplementationTest_h
00079 

Generated at Sat Feb 28 12:24:46 2009 for ITK by doxygen 1.5.6 written by Dimitri van Heesch, © 1997-2000