const double& PipeBundle::ConjugateDeadCache(void)
{
for(this->FirstChild(); this->UntilFinalChild(); this->NextChild())
area_dead_cache += (*child)->ConjugateDeadCache();
area_alive -= area_dead_cache; // この一行追加しただけ (2002.05.23)
return area_dead_cache;
}
const double PipeBundle::EstimateVolumeChange(const double& recycle_rate)
{
if (status == DYING)
return 0.0;
double volume_change(0.0);
for(this->FirstChild(); this->UntilFinalChild(); this->NextChild())
volume_change += (*child)->EstimateVolumeChange(recycle_rate);
// with setting area_alive_new
// ------------------------------------------------------------------
area_alive_new = 0.0;
if (foliage != NULL)
area_alive_new += foliage->AreaAsPipe();
if (pipe_terminal != NULL)
area_alive_new += pipe_terminal->AreaNew();
for(this->FirstChild(); this->UntilFinalChild(); this->NextChild())
area_alive_new += (*child)->area_alive_new;
// ------------------------------------------------------------------
const double recycled_area(recycle_rate * area_dead_cache);
area_dead_change = area_dead_cache - recycled_area;
// ------------------------------------------------------------------
const double area_alive_change(area_alive_new - area_alive);
if (area_alive_change < recycled_area)
area_dead_change += recycled_area - area_alive_change;
else
volume_change += length * (area_alive_change - recycled_area);
// ------------------------------------------------------------------
return volume_change; //including children's growth
}
void PipeBundle::ChangeSize(void)
{
for(this->FirstChild(); this->UntilFinalChild(); this->NextChild())
(*child)->ChangeSize();
area_alive = area_alive_new;
area_dead += area_dead_change;
area_dead_cache = area_dead_change = 0.0;
volume_alive = length * area_alive;
volume_total = volume_alive + length * area_dead;
if (area_alive > 0.0)
tube_maker->Generate(tube, this);
else
this->SetAllDying();
}