82 {
84 SegmentSplitter splitter;
85 const SegmentList& segments = splitter.split(zone, ray);
86
87
88
89
90 double volumeTotal = 0;
91
92 std::vector<ServiceVolume* > tmpServiceVec;
93 tmpServiceVec.reserve(segments.size());
94 for (
unsigned int i = 0;
i < segments.size(); ++
i) {
95 const Segment& seg = segments.getSegment(i);
96 ServiceVolume* paramNew = new ServiceVolume(param);
97
98 if (segments.horizontal()) {
99 if (param.splittableInZ()) {
100 paramNew->setZmin(seg.zmin());
101 paramNew->setZmax(seg.zmax());
102
104 } else if (i == 1) {
105 std::cout << "Volume " << param.fullLabel() << " cannot be split in Z" << std::endl;
106 }
107 } else {
108
109 if (param.splittableInR()) {
110 paramNew->setRmin(seg.rmin());
111 paramNew->setRmax(seg.rmax());
112 } else if (i == 1) {
113 std::cout << "Volume " << param.fullLabel() << " cannot be split in R" << std::endl;
114 }
115 }
116
117 if (seg.rotated()) {
118
119
120
121
122 double zminTmp = paramNew->zmin();
123 paramNew->setZmin(-paramNew->zmax());
124 paramNew->setZmax(-zminTmp);
125 paramNew->setNeedsRotation(false);
126
127 }
128
129 if (param.splittableInZ()) {
131 }
132
133 paramNew->setRegion(seg.label());
134 tmpServiceVec.push_back(paramNew);
135
136 paramNew->getShape();
137 volumeTotal += paramNew->volume();
138
139 }
140
141 for (
unsigned int i = 0;
i < segments.size(); ++
i) {
142 ServiceVolume* paramNew = tmpServiceVec[
i];
143 if (segments.size() > 1) {
144 std::ostringstream ostr;
145 ostr <<
"_" <<
i + 1;
146 paramNew->addLabel(ostr.str());
147 }
148 paramNew->setOrigVolume(volumeTotal);
150 }
151 }
void adjustR(const ServiceVolume ¶m, ServiceVolume *paramNew)
Ray makeRay(const ServiceVolume &origVolume)