22 |
fixedweights = 0; |
fixedweights = 0; |
23 |
functionnumber = 0; |
functionnumber = 0; |
24 |
LgrpDiv = new LengthGroupDivision(*GivenLgrpDiv); |
LgrpDiv = new LengthGroupDivision(*GivenLgrpDiv); |
25 |
|
vector_OK = 0; |
26 |
if (LgrpDiv->Error()) |
if (LgrpDiv->Error()) |
27 |
handle.logMessage(LOGFAIL, "Error in grower - failed to create length group"); |
handle.logMessage(LOGFAIL, "Error in grower - failed to create length group"); |
28 |
CI = new ConversionIndex(OtherLgrpDiv, LgrpDiv, 1); |
CI = new ConversionIndex(OtherLgrpDiv, LgrpDiv, 1); |
105 |
interpLengthGrowth.AddRows(noareas, otherlen, 0.0); |
interpLengthGrowth.AddRows(noareas, otherlen, 0.0); |
106 |
interpWeightGrowth.AddRows(noareas, otherlen, 0.0); |
interpWeightGrowth.AddRows(noareas, otherlen, 0.0); |
107 |
dummyfphi.resize(len, 0.0); |
dummyfphi.resize(len, 0.0); |
108 |
|
lgrowth = new Matrix[noareas]; |
109 |
|
wgrowth = new Matrix[noareas]; |
110 |
for (i = 0; i < noareas; i++) { |
for (i = 0; i < noareas; i++) { |
111 |
lgrowth.resize(new DoubleMatrix(maxlengthgroupgrowth + 1, otherlen, 0.0)); |
lgrowth[i].Initialize(maxlengthgroupgrowth + 1, otherlen, 0.0); |
112 |
wgrowth.resize(new DoubleMatrix(maxlengthgroupgrowth + 1, otherlen, 0.0)); |
wgrowth[i].Initialize(maxlengthgroupgrowth + 1, otherlen, 0.0); |
113 |
|
// lgrowth[i] = new Matrix(maxlengthgroupgrowth + 1, otherlen, 0.0); |
114 |
|
// wgrowth[i] = new Matrix(maxlengthgroupgrowth + 1, otherlen, 0.0); |
115 |
} |
} |
116 |
} |
} |
117 |
|
|
118 |
Grower::~Grower() { |
Grower::~Grower() { |
119 |
int i; |
int i; |
120 |
for (i = 0; i < lgrowth.Size(); i++) { |
//int size = sizeof(lgrowth)/sizeof(lgrowth[0]); |
121 |
delete lgrowth[i]; |
int size = areas.Size(); |
122 |
delete wgrowth[i]; |
// for (i = 0; i < size; i++) { |
123 |
} |
// delete (*lgrowth)[i]; |
124 |
|
// delete (*wgrowth)[i]; |
125 |
|
// } |
126 |
|
delete[] lgrowth; |
127 |
|
delete[] wgrowth; |
128 |
delete CI; |
delete CI; |
129 |
delete LgrpDiv; |
delete LgrpDiv; |
130 |
delete growthcalc; |
delete growthcalc; |
131 |
|
if (vector_OK != 0) |
132 |
|
delete[] meanlength_vectorPow; |
133 |
} |
} |
134 |
|
|
135 |
void Grower::Print(ofstream& outfile) const { |
void Grower::Print(ofstream& outfile) const { |
139 |
LgrpDiv->Print(outfile); |
LgrpDiv->Print(outfile); |
140 |
for (area = 0; area < areas.Size(); area++) { |
for (area = 0; area < areas.Size(); area++) { |
141 |
outfile << "\tLength increase on internal area " << areas[area] << ":\n\t"; |
outfile << "\tLength increase on internal area " << areas[area] << ":\n\t"; |
142 |
for (i = 0; i < calcLengthGrowth.Ncol(area); i++) |
for (i = 0; i < calcLengthGrowth.Ncol(); i++) |
143 |
outfile << sep << calcLengthGrowth[area][i]; |
outfile << sep << calcLengthGrowth[area][i]; |
144 |
outfile << "\n\tWeight increase on internal area " << areas[area] << ":\n\t"; |
outfile << "\n\tWeight increase on internal area " << areas[area] << ":\n\t"; |
145 |
for (i = 0; i < calcWeightGrowth.Ncol(area); i++) |
for (i = 0; i < calcWeightGrowth.Ncol(); i++) |
146 |
outfile << sep << calcWeightGrowth[area][i]; |
outfile << sep << calcWeightGrowth[area][i]; |
147 |
outfile << "\n\tDistributed length increase on internal area " << areas[area] << ":\n"; |
outfile << "\n\tDistributed length increase on internal area " << areas[area] << ":\n"; |
148 |
for (i = 0; i < lgrowth[area]->Nrow(); i++) { |
for (i = 0; i < lgrowth[area].Nrow(); i++) { |
149 |
outfile << TAB; |
outfile << TAB; |
150 |
for (j = 0; j < lgrowth[area]->Ncol(i); j++) |
for (j = 0; j < lgrowth[area].Ncol(); j++) |
151 |
outfile << sep << (*lgrowth[area])[i][j]; |
outfile << sep << lgrowth[area][i][j]; |
152 |
outfile << endl; |
outfile << endl; |
153 |
} |
} |
154 |
outfile << "\tDistributed weight increase on internal area " << areas[area] << ":\n"; |
outfile << "\tDistributed weight increase on internal area " << areas[area] << ":\n"; |
155 |
for (i = 0; i < wgrowth[area]->Nrow(); i++) { |
for (i = 0; i < wgrowth[area].Nrow(); i++) { |
156 |
outfile << TAB; |
outfile << TAB; |
157 |
for (j = 0; j < wgrowth[area]->Ncol(i); j++) |
for (j = 0; j < wgrowth[area].Ncol(); j++) |
158 |
outfile << sep << (*wgrowth[area])[i][j]; |
outfile << sep << wgrowth[area][i][j]; |
159 |
outfile << endl; |
outfile << endl; |
160 |
} |
} |
161 |
} |
} |
167 |
|
|
168 |
void Grower::calcGrowth(int area, |
void Grower::calcGrowth(int area, |
169 |
const AreaClass* const Area, const TimeClass* const TimeInfo) { |
const AreaClass* const Area, const TimeClass* const TimeInfo) { |
|
|
|
170 |
this->calcGrowth(area, Area, TimeInfo, dummyfphi, dummyfphi); |
this->calcGrowth(area, Area, TimeInfo, dummyfphi, dummyfphi); |
171 |
} |
} |
172 |
|
|
175 |
const DoubleVector& FPhi, const DoubleVector& MaxCon) { |
const DoubleVector& FPhi, const DoubleVector& MaxCon) { |
176 |
|
|
177 |
int inarea = this->areaNum(area); |
int inarea = this->areaNum(area); |
178 |
|
|
179 |
growthcalc->calcGrowth(area, calcLengthGrowth[inarea], calcWeightGrowth[inarea], |
growthcalc->calcGrowth(area, calcLengthGrowth[inarea], calcWeightGrowth[inarea], |
180 |
numGrow[inarea], Area, TimeInfo, FPhi, MaxCon, LgrpDiv); |
numGrow[inarea], Area, TimeInfo, FPhi, MaxCon, LgrpDiv, calcLengthGrowth.Ncol()); |
181 |
|
|
182 |
CI->interpolateLengths(interpLengthGrowth[inarea], calcLengthGrowth[inarea]); |
CI->interpolateLengths(interpLengthGrowth[inarea], calcLengthGrowth[inarea], calcLengthGrowth.Ncol()); |
183 |
switch (functionnumber) { |
switch (functionnumber) { |
184 |
case 1: |
case 1: |
185 |
case 2: |
case 2: |
189 |
case 6: |
case 6: |
190 |
case 7: |
case 7: |
191 |
case 9: |
case 9: |
192 |
CI->interpolateLengths(interpWeightGrowth[inarea], calcWeightGrowth[inarea]); |
CI->interpolateLengths(interpWeightGrowth[inarea], calcWeightGrowth[inarea], calcWeightGrowth.Ncol()); |
193 |
break; |
break; |
194 |
case 8: |
case 8: |
195 |
case 10: |
case 10: |
209 |
calcWeightGrowth.setToZero(); |
calcWeightGrowth.setToZero(); |
210 |
interpLengthGrowth.setToZero(); |
interpLengthGrowth.setToZero(); |
211 |
for (area = 0; area < areas.Size(); area++) { |
for (area = 0; area < areas.Size(); area++) { |
212 |
(*lgrowth[area]).setToZero(); |
(lgrowth[area]).setToZero(); |
213 |
for (i = 0; i < LgrpDiv->numLengthGroups(); i++) |
for (i = 0; i < LgrpDiv->numLengthGroups(); i++) |
214 |
numGrow[area][i].setToZero(); |
numGrow[area][i].setToZero(); |
215 |
} |
} |
216 |
|
if (vector_OK != 0) |
217 |
|
{ |
218 |
|
delete[] meanlength_vectorPow; |
219 |
|
vector_OK = 0; |
220 |
|
} |
221 |
|
|
222 |
switch (functionnumber) { |
switch (functionnumber) { |
223 |
case 1: |
case 1: |
230 |
case 9: |
case 9: |
231 |
interpWeightGrowth.setToZero(); |
interpWeightGrowth.setToZero(); |
232 |
for (area = 0; area < areas.Size(); area++) |
for (area = 0; area < areas.Size(); area++) |
233 |
(*wgrowth[area]).setToZero(); |
(wgrowth[area]).setToZero(); |
234 |
break; |
break; |
235 |
case 8: |
case 8: |
236 |
case 10: |
case 10: |