00001 #ifndef _Geom_vGeometry_txx
00002 #define _Geom_vGeometry_txx
00003 #include "Geom_vGeometry.h"
00004
00005 namespace mial
00006 {
00007
00008 template <class dType, int nDims,class MType,class VType>
00009 Geom_vGeometry<dType, nDims,MType,VType>::Geom_vGeometry()
00010 {
00011
00012 }
00013
00014
00015 template <class dType, int nDims,class MType, class VType>
00016 void Geom_vGeometry<dType, nDims,MType,VType>::getNodePosition(int index, dType* container)
00017 {
00018
00019 for(int i=0; i<nDims; i++)
00020 {
00021 container[i] = nodes(index,i);
00022 }
00023
00024 }
00025
00026
00027
00028 template <class dType, int nDims,class MType, class VType >
00029 bool Geom_vGeometry<dType, nDims,MType,VType>::setNodePosition(int index, dType* pos)
00030 {
00031
00032 for(int i=0; i<nDims; i++)
00033 {
00034 nodes(index,i) = pos[i];
00035 }
00036 return 1;
00037 }
00038
00039
00040
00041 template <class dType, int nDims,class MType, class VType>
00042 void Geom_vGeometry<dType, nDims,MType,VType>::writeNodesToFile(std::string fileName)
00043 {
00044 std::ofstream out(fileName.c_str());
00045 out << nodes.rows() << std::endl;
00046 for(int i =0; i<nodes.rows(); i++)
00047 {
00048 out << nodes.get_row(i) << std::endl;
00049 }
00050 }
00051
00052 template <class dType, int nDims,class MType,class VType >
00053 void Geom_vGeometry<dType, nDims,MType,VType>::readNodesFromFile(std::string fileName)
00054 {
00055 std::ifstream in(fileName.c_str());
00056 int count = 0;
00057 int size =0;
00058 in >> size;
00059 nodes.set_size(size,nDims);
00060 while(count < size)
00061 {
00062 for(int i=0; i<nDims; i++)
00063 {
00064 in >> nodes(count,i);
00065 }
00066 count++;
00067 }
00068 }
00069 }
00070 #endif