C:/cmcintos/defOrgs/source/physical/abc/Physics.h

00001 #if defined (_MSC_VER) && (_MSC_VER >= 1000)
00002 #pragma once
00003 #endif
00004 #ifndef _INC_PHYSICS
00005 #define _INC_PHYSICS
00006 
00007 #include "Geometric.h"
00008 #include "Deformation.h"
00009 #include "stdafx.h"
00010 #include "itkSmartPointer.h"
00011 #include <itkLightObject.h> 
00012 #include <vector>//Not to be confused with VNL vectors
00013  
00014 
00015 
00016 namespace mial
00017 {
00018 
00020 
00039         template<class Type, int nDims, class MType = vnl_matrix<Type>, class VType = vnl_vector<Type> > class Physics:public itk::LightObject
00040 {
00041 
00042 public:
00043 
00044         //Smartpointers
00045         typedef Physics Self;
00046         typedef itk::SmartPointer<Self>  Pointer;
00047         typedef itk::SmartPointer<const Self>  ConstPointer;
00048         typedef itk::WeakPointer<const Self>  ConstWeakPointer;
00049         //itkNewMacro(Self);
00050 
00051     //******************************************
00052     //Define the types
00053     //******************************************
00054 
00055         
00057     typedef Deformation<Type,nDims,MType,VType> DeformationType;
00058 
00060 
00065     struct Error{
00066         std::string msg;
00067         int deformationNumber;
00068         typename DeformationType::Error * deformationError;
00069     };
00070 
00071     typedef MType                                           MatrixType;
00072     typedef VType                                           VectorType;
00073 
00075     typedef Geometric<Type, nDims,MatrixType,VectorType>  GeometryType;
00076 
00077 
00078     //***************************************
00079     //Define the methods
00080     //***************************************  
00081 
00083     ~Physics();
00084 
00086 
00090         virtual bool runDeformation(const std::string defName,typename DeformationType::deformationIn* const i,std::stringstream * const s = NULL)=0;
00091         
00093         virtual bool addDeformation(Deformation<Type,nDims> * def);
00094 
00096     virtual bool simulate() =0;
00097 
00099 
00103     virtual void setExternalForces(void * img)=0;
00104 
00106         void setGeometry(GeometryType* a){ if(a !=NULL){geom = a;}else{Error e; e.msg="Cannot add null geometric layer"; throw & e;}};
00107 
00108         double getTime(){return time;};
00109 
00110 protected:
00111 
00113     Physics();
00114 
00116     int numDeformations;
00117 
00119         typename GeometryType::Pointer geom;
00120 
00122         //use stl vectors
00123         std::vector<typename Deformation<Type,nDims>::Pointer> deformationsList;
00124 
00126         double time;
00127 };
00128 } // end namespace mial
00129 #include "Physics.cxx"
00130 #endif /* _INC_PHYSICS*/
00131 

Generated on Wed Jul 19 13:05:18 2006 for IDO by  doxygen 1.4.7