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");
00062 
00063     std::cout<<"Load object's data:"<<l0->data<<"\n";
00064   }
00065 private:
00066   static const bool registered;
00067 };
00068 
00069 // When the templated load implementation function is instantiated,
00070 // it will automatically be registered with the VisitorDispatcher so 
00071 // that it is called as required.
00072 // Instantiating the implementation function will also instantiate the
00073 // corresponding Load class.
00074 template<class TLoadClass>
00075 const bool LoadImplementationTest<TLoadClass>::registered=
00076   VisitorDispatcher<Element2DC0LinearLineStress,Element::LoadType,Element2DC0LinearLineStress::LoadImplementationFunctionPointer>
00077   ::RegisterVisitor((TLoadClass*)0, &LoadImplementationTest<TLoadClass>::impl);
00078 
00079 
00080 
00081 
00082 }} // end namespace itk::fem
00083 
00084 #endif // #ifndef __itkFEMLoadImplementationTest_h
00085 

Generated at Mon Mar 12 00:17:32 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000