36 #include "Exception.hpp" 37 #include "CsvVesselNetworkReader.hpp" 38 #include <boost/tokenizer.hpp> 39 #include <boost/lexical_cast.hpp> 42 template<
unsigned DIM>
49 template<
unsigned DIM>
54 template <
unsigned DIM>
61 template<
unsigned DIM>
66 EXCEPTION(
"File name not set in vessel network reader");
69 std::ifstream in(mFileName.c_str());
72 EXCEPTION(
"Problem during input file opening in vessel network reader.");
78 typedef boost::tokenizer< boost::escaped_list_separator<char> > Tokenizer;
79 std::vector<std::string> vec;
83 while (std::getline(in, line))
92 vec.assign(tok.begin(),tok.end());
96 EXCEPTION(
"CSV File not in expected format");
99 double pos_x_1 = boost::lexical_cast<
double>(vec[3]);
100 double pos_y_1 = boost::lexical_cast<
double>(vec[4]);
101 double pos_z_1 = boost::lexical_cast<
double>(vec[5]);
102 double pos_x_2 = boost::lexical_cast<
double>(vec[6]);
103 double pos_y_2 = boost::lexical_cast<
double>(vec[7]);
104 double pos_z_2 = boost::lexical_cast<
double>(vec[8]);
115 double y_max = extents.second.GetLocation(length_scale)[1];
117 for(
unsigned idx=0; idx<p_network->GetNumberOfNodes();idx++)
119 c_vector<double, DIM> current_location = p_network->GetNode(idx)->rGetLocation().GetLocation(length_scale);
120 c_vector<double, DIM> new_location;
121 new_location[0] = current_location[0];
122 new_location[1] = y_max - current_location[1];
125 new_location[2] = current_location[2];
132 template<
unsigned DIM>
135 mFileName = rFileName;
~CsvVesselNetworkReader()
units::quantity< unit::length > GetReferenceLengthScale() const
static boost::shared_ptr< VesselNetwork< DIM > > Create()
static boost::shared_ptr< CsvVesselNetworkReader< DIM > > Create()