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

itkFEMLoadImplementationGenericBodyLoad.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkFEMLoadImplementationGenericBodyLoad.h,v $
00005   Language:  C++
00006   Date:      $Date: 2009-01-30 21:10:18 $
00007   Version:   $Revision: 1.7 $
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 __itkFEMLoadImplementationGenericBodyLoad_h
00019 #define __itkFEMLoadImplementationGenericBodyLoad_h
00020 
00021 #include "itkFEMElementBase.h"
00022 #include "itkFEMLoadGrav.h"
00023 
00024 namespace itk {
00025 namespace fem {
00026 
00045 class LoadImplementationGenericBodyLoad
00046 {
00047 public:
00048 
00056   template<class TElementClassConstPointer>
00057   static void HandleLoad(TElementClassConstPointer e, Element::LoadPointer l, Element::VectorType& Fe)
00058     {
00059     // Check if we really got a LoadGrav object
00060     LoadGrav::Pointer l0=dynamic_cast<LoadGrav*>(&*l);
00061     if ( !l0 )
00062       {
00063       // Passed load object was not of class LoadGrav!
00064       throw FEMException(__FILE__, __LINE__, "FEM error");
00065       }
00067 
00068     // Statically cast the passed pointer to the element base class and
00069     // call the real load implementation with the correct pointer types.
00070     // If cast fails, the passed pointer was of incompatible class.
00071     Implementation(static_cast<Element::ConstPointer>(e),l0,Fe);
00072     }
00073 
00074 private:
00083   static void Implementation(Element::ConstPointer element, LoadGrav::Pointer load, Element::VectorType& Fe);
00084 
00088   LoadImplementationGenericBodyLoad();
00089 };
00090 
00091 #ifdef _MSC_VER 
00092 // Declare a static dummy function to prevent a MSVC 6.0 SP5 from crashing.
00093 // I have no idea why things don't work when this is not declared, but it
00094 // looks like this declaration makes compiler forget about some of the
00095 // troubles it has with templates.
00096 static void Dummy( void );
00097 #endif // #ifdef _MSC_VER
00098 
00099 }} // end namespace itk::fem
00100 
00101 #endif // #ifndef __itkFEMLoadImplementationGenericBodyLoad_h
00102 

Generated at Thu May 28 09:56:07 2009 for ITK by doxygen 1.5.5 written by Dimitri van Heesch, © 1997-2000