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: 2002/06/10 23:09:20 $
00007   Version:   $Revision: 1.2 $
00008 
00009   Copyright (c) 2002 Insight 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     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 Fri May 21 01:14:45 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000