Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Diff of /trunk/gadget/grower.cc
[mareframe] / trunk / gadget / grower.cc Repository:
ViewVC logotype

Diff of /trunk/gadget/grower.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1, Mon Feb 10 17:09:07 2014 UTC revision 4, Thu Apr 30 17:32:47 2015 UTC
# Line 22  Line 22 
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);
# Line 104  Line 105 
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    
111    for (i = 0; i < noareas; i++) {    for (i = 0; i < noareas; i++) {
112      lgrowth.resize(new DoubleMatrix(maxlengthgroupgrowth + 1, otherlen, 0.0));            lgrowth[i] = *new Matrix(maxlengthgroupgrowth + 1, otherlen, 0.0);
113      wgrowth.resize(new DoubleMatrix(maxlengthgroupgrowth + 1, otherlen, 0.0));            wgrowth[i] = *new Matrix(maxlengthgroupgrowth + 1, otherlen, 0.0);
114    }    }
115  }  }
116    
117  Grower::~Grower() {  Grower::~Grower() {
118    int i;    int i;
119    for (i = 0; i < lgrowth.Size(); i++) {    int size = sizeof(lgrowth)/sizeof(lgrowth[0]);
120      delete lgrowth[i];    for (i = 0; i < size; i++) {
121      delete wgrowth[i];      delete &lgrowth[i];
122        delete &wgrowth[i];
123    }    }
124    delete CI;    delete CI;
125    delete LgrpDiv;    delete LgrpDiv;
# Line 128  Line 133 
133    LgrpDiv->Print(outfile);    LgrpDiv->Print(outfile);
134    for (area = 0; area < areas.Size(); area++) {    for (area = 0; area < areas.Size(); area++) {
135      outfile << "\tLength increase on internal area " << areas[area] << ":\n\t";      outfile << "\tLength increase on internal area " << areas[area] << ":\n\t";
136      for (i = 0; i < calcLengthGrowth.Ncol(area); i++)      for (i = 0; i < calcLengthGrowth.Ncol(); i++)
137        outfile << sep << calcLengthGrowth[area][i];        outfile << sep << calcLengthGrowth[area][i];
138      outfile << "\n\tWeight increase on internal area " << areas[area] << ":\n\t";      outfile << "\n\tWeight increase on internal area " << areas[area] << ":\n\t";
139      for (i = 0; i < calcWeightGrowth.Ncol(area); i++)      for (i = 0; i < calcWeightGrowth.Ncol(); i++)
140        outfile << sep << calcWeightGrowth[area][i];        outfile << sep << calcWeightGrowth[area][i];
141      outfile << "\n\tDistributed length increase on internal area " << areas[area] << ":\n";      outfile << "\n\tDistributed length increase on internal area " << areas[area] << ":\n";
142      for (i = 0; i < lgrowth[area]->Nrow(); i++) {      for (i = 0; i < lgrowth[area].Nrow(); i++) {
143        outfile << TAB;        outfile << TAB;
144        for (j = 0; j < lgrowth[area]->Ncol(i); j++)        for (j = 0; j < lgrowth[area].Ncol(); j++)
145          outfile << sep << (*lgrowth[area])[i][j];          outfile << sep << lgrowth[area][i][j];
146        outfile << endl;        outfile << endl;
147      }      }
148      outfile << "\tDistributed weight increase on internal area " << areas[area] << ":\n";      outfile << "\tDistributed weight increase on internal area " << areas[area] << ":\n";
149      for (i = 0; i < wgrowth[area]->Nrow(); i++) {      for (i = 0; i < wgrowth[area].Nrow(); i++) {
150        outfile << TAB;        outfile << TAB;
151        for (j = 0; j < wgrowth[area]->Ncol(i); j++)        for (j = 0; j < wgrowth[area].Ncol(); j++)
152          outfile << sep << (*wgrowth[area])[i][j];          outfile << sep << wgrowth[area][i][j];
153        outfile << endl;        outfile << endl;
154      }      }
155    }    }
# Line 156  Line 161 
161    
162  void Grower::calcGrowth(int area,  void Grower::calcGrowth(int area,
163    const AreaClass* const Area, const TimeClass* const TimeInfo) {    const AreaClass* const Area, const TimeClass* const TimeInfo) {
   
164    this->calcGrowth(area, Area, TimeInfo, dummyfphi, dummyfphi);    this->calcGrowth(area, Area, TimeInfo, dummyfphi, dummyfphi);
165  }  }
166    
# Line 165  Line 169 
169    const DoubleVector& FPhi, const DoubleVector& MaxCon) {    const DoubleVector& FPhi, const DoubleVector& MaxCon) {
170    
171    int inarea = this->areaNum(area);    int inarea = this->areaNum(area);
172    
173    growthcalc->calcGrowth(area, calcLengthGrowth[inarea], calcWeightGrowth[inarea],    growthcalc->calcGrowth(area, calcLengthGrowth[inarea], calcWeightGrowth[inarea],
174      numGrow[inarea], Area, TimeInfo, FPhi, MaxCon, LgrpDiv);        numGrow[inarea], Area, TimeInfo, FPhi, MaxCon, LgrpDiv, calcLengthGrowth.Ncol());
175    
176    CI->interpolateLengths(interpLengthGrowth[inarea], calcLengthGrowth[inarea]);    CI->interpolateLengths(interpLengthGrowth[inarea], calcLengthGrowth[inarea], calcLengthGrowth.Ncol());
177    switch (functionnumber) {    switch (functionnumber) {
178      case 1:      case 1:
179      case 2:      case 2:
# Line 178  Line 183 
183      case 6:      case 6:
184      case 7:      case 7:
185      case 9:      case 9:
186        CI->interpolateLengths(interpWeightGrowth[inarea], calcWeightGrowth[inarea]);          CI->interpolateLengths(interpWeightGrowth[inarea], calcWeightGrowth[inarea], calcWeightGrowth.Ncol());
187        break;        break;
188      case 8:      case 8:
189      case 10:      case 10:
# Line 198  Line 203 
203    calcWeightGrowth.setToZero();    calcWeightGrowth.setToZero();
204    interpLengthGrowth.setToZero();    interpLengthGrowth.setToZero();
205    for (area = 0; area < areas.Size(); area++) {    for (area = 0; area < areas.Size(); area++) {
206      (*lgrowth[area]).setToZero();      (lgrowth[area]).setToZero();
207      for (i = 0; i < LgrpDiv->numLengthGroups(); i++)      for (i = 0; i < LgrpDiv->numLengthGroups(); i++)
208        numGrow[area][i].setToZero();        numGrow[area][i].setToZero();
209    }    }
# Line 214  Line 219 
219      case 9:      case 9:
220        interpWeightGrowth.setToZero();        interpWeightGrowth.setToZero();
221        for (area = 0; area < areas.Size(); area++)        for (area = 0; area < areas.Size(); area++)
222          (*wgrowth[area]).setToZero();          (wgrowth[area]).setToZero();
223        break;        break;
224      case 8:      case 8:
225      case 10:      case 10:

Legend:
Removed from v.1  
changed lines
  Added in v.4

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge