36 #include "VesselSegment.hpp" 37 #include "ChastePoint.hpp" 38 #include "GeometryTools.hpp" 39 #include "LacunarityCalculator.hpp" 41 template<
unsigned DIM>
48 template<
unsigned DIM>
55 template<
unsigned DIM>
61 template<
unsigned DIM>
67 template<
unsigned DIM>
72 std::vector<boost::shared_ptr<VesselSegment<DIM> > > segments;
73 segments = this->
mpNetwork->GetVesselSegments();
76 std::vector<unsigned> width_factors;
77 width_factors.push_back(1);
78 width_factors.push_back(2);
79 width_factors.push_back(4);
80 width_factors.push_back(8);
81 width_factors.push_back(16);
83 std::ofstream output_file((this->
mpOutputFileHandler->GetOutputDirectoryFullPath() +
"output.dat").c_str());
84 if (output_file.is_open())
86 output_file <<
"Lacunarity, Box\n";
89 units::quantity<unit::length> length_scale = this->
mpRegularGrid->GetReferenceLengthScale();
90 for (
unsigned width_index = 0; width_index < width_factors.size(); width_index++)
92 double box_size = (double(extents_x - 1) / double(width_factors[width_index]));
93 units::quantity<unit::length> q1 = 0.0* unit::metres;
94 units::quantity<unit::area> q2 = 0.0* unit::metres*unit::metres;
96 unsigned z_extent = width_factors[width_index];
99 for (
unsigned kdx = 0; kdx < z_extent; kdx++)
101 for (
unsigned jdx = 0; jdx < width_factors[width_index]; jdx++)
103 for (
unsigned idx = 0; idx < width_factors[width_index]; idx++)
105 c_vector<double, DIM> box_location;
106 box_location[0] = double(idx) * box_size + box_size / 2.0;
107 box_location[1] = double(jdx) * box_size + box_size / 2.0;
108 box_location[2] = double(kdx) * box_size + box_size / 2.0;
110 units::quantity<unit::length> vessel_length = 0.0 * unit::metres;
111 for (
unsigned seg_index = 0; seg_index < segments.size(); seg_index++)
113 vessel_length += LengthOfLineInBox<DIM>(segments[seg_index]->GetNode(0)->rGetLocation(),
114 segments[seg_index]->GetNode(1)->rGetLocation(),
118 q2 += vessel_length * vessel_length;
123 unsigned num_boxes = width_factors[width_index] * width_factors[width_index] * z_extent;
124 double lacunarity = double(num_boxes) * q2 / (q1 * q1);
126 if (output_file.is_open())
128 output_file << lacunarity <<
", " << box_size <<
" \n";
boost::shared_ptr< RegularGrid< DIM > > mpRegularGrid
boost::shared_ptr< OutputFileHandler > mpOutputFileHandler
boost::shared_ptr< VesselNetwork< DIM > > mpNetwork