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: 2004/12/19 16:47:22 $
00007   Version:   $Revision: 1.4 $
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 
00027 
00028 
00029 
00050 template<class TLoadClass>
00051 class LoadImplementationTest
00052 {
00053 public:
00054   static void impl(Element2DC0LinearLineStress::ConstPointer element, Element::LoadPointer load, Element::VectorType& Fe)
00055   {
00056     // We must dynamically cast the given load pointer to the
00057     // correct templated load class, which is given as
00058     // template parameter.
00059     typename TLoadClass::Pointer l0=dynamic_cast<TLoadClass*>(&*load);
00060     if ( !l0 ) throw FEMException(__FILE__, __LINE__, "FEM error");
00061 
00062     std::cout<<"Load object's data:"<<l0->data<<"\n";
00063   }
00064 private:
00065   static const bool registered;
00066 };
00067 
00068 // When the templated load implementation function is instantiated,
00069 // it will automatically be registered with the VisitorDispatcher so 
00070 // that it is called as required.
00071 // Instantiating the implementation function will also instantiate the
00072 // corresponding Load class.
00073 template<class TLoadClass>
00074 const bool LoadImplementationTest<TLoadClass>::registered=
00075   VisitorDispatcher<Element2DC0LinearLineStress,Element::LoadType,Element2DC0LinearLineStress::LoadImplementationFunctionPointer>
00076   ::RegisterVisitor((TLoadClass*)0, &LoadImplementationTest<TLoadClass>::impl);
00077 
00078 
00079 
00080 
00081 }} // end namespace itk::fem
00082 
00083 #endif // #ifndef __itkFEMLoadImplementationTest_h

Generated at Wed May 24 23:07:50 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000