Files
DEC/environment/Region.cpp
2024-10-03 18:43:04 +07:00

39 lines
1.3 KiB
C++

#include "AbstractRegion.h"
#include <iostream>
//template<class T>
//////////////////////////////////////
Region::Region(Position3D<double> pos, long capac):
position3D(pos), capacity(capac)
{}
Region::Region(Position3D<double> pos, long capac,
const std::vector<long int> & curS, const std::vector<long int> & restS,
const std::vector<long int> & maxS, const std::vector<double> & regS):
position3D(pos), capacity(capac),
currentSubstrates(curS), restorationSubstrates(restS),
maxSubstrates(maxS), regulators(regS)
{
if(currentSubstrates.size() != restorationSubstrates.size()){
std::cerr<<"Warning! currentSubstrates size != restorationSubstrates size\n";
}
if(currentSubstrates.size() != maxSubstrates.size()){
std::cerr<<"Warning! currentSubstrates size != maximumSubstrates size\n";
}
if(restorationSubstrates.size() != maxSubstrates.size()){
std::cerr<<"Warning! restorationSubstrates size != maximumSubstrates size\n";
}
}
/**
* Âîññòàíîâëåíèå ñóáñòðàòîâ çà ïåðèîä
**/
void Region::restoreSubstrate(){
for(unsigned int i = 0; i < this->currentSubstrates.size(); i++){
this->currentSubstrates.at(i) = std::max(
this->currentSubstrates.at(i) + this->restorationSubstrates.at(i),
this->maxSubstrates.at(i));
}
}