#include "ActualData.h"
namespace math1d_cl
{
	ActualData::ActualData(std::shared_ptr<math1d_cl::MatData> matData, std::shared_ptr<math1d_cl::Channel> amChannel, int amChannelIdx, std::shared_ptr<math1d_cl::Station> amStation, int amStationIdx, std::vector<int> upstreamChannels, double stepCn, double stepN, double p, Limit cnLimit, Limit nLimit)
	{
		this->m_amChannel = amChannel;
		this->m_amChannelIdx = amChannelIdx;
		this->m_amStation = amStation;
		this->m_amStationIdx = amStationIdx;
		this->m_stepCn = stepCn;
		this->m_stepN = stepN;
		this->m_p = p;
		this->m_cnLimit = cnLimit;
		this->m_nLimit = nLimit;

		// Get active channels
		for (size_t i = 0; i < upstreamChannels.size(); i++)
		{
			std::shared_ptr<math1d_cl::Channel> currentChannel = matData->getChannels()[upstreamChannels[i]];
			m_cnChannels.push_back(currentChannel);
			m_cnChannelsIdx.push_back(upstreamChannels[i]);
			if(currentChannel->getN() > 0)
			{
				m_nChannels.push_back(currentChannel);
				m_nChannelsIdx.push_back(upstreamChannels[i]);
			}
		}
	}

	std::shared_ptr<math1d_cl::Channel> ActualData::getamChannel()
	{
		return this->m_amChannel;
	}

	std::shared_ptr<math1d_cl::Station> ActualData::getamStation()
	{
		return this->m_amStation;		
	}
		
	std::vector<std::shared_ptr<math1d_cl::Channel>>  ActualData::getNChannels()
	{
		return this->m_nChannels;
	}

	std::vector<std::shared_ptr<math1d_cl::Channel>> ActualData::getCnChannels()
	{
		return this->m_cnChannels;
	}

	double ActualData::getStepCn()
	{
		return m_stepCn;
	}

	double ActualData::getStepN()
	{
		return m_stepN;
	}

	double ActualData::getP()
	{
		return m_p;
	}

	std::vector<int> ActualData::getNChannelsIdx()
	{
		return m_nChannelsIdx;
	}

	std::vector<int> ActualData::getCnChannelsIdx()
	{
		return m_cnChannelsIdx;
	}

	int ActualData::getAmChannelIdx()
	{
		return m_amChannelIdx;
	}

	int ActualData::getAmStationIdx()
	{
		return m_amStationIdx;
	}

	void ActualData::setCnDerivation(std::shared_ptr<std::vector<double>> cnDerivation)
	{
		m_cnDerivation = cnDerivation;
	}
	
	std::shared_ptr<std::vector<double>> ActualData::getCnDerivation()
	{		
		return m_cnDerivation;
	}
	
	void ActualData::setnDerivation(std::shared_ptr<std::vector<double>> nDerivation)
	{
		m_nDerivation = nDerivation;
	}
	
	std::shared_ptr<std::vector<double>> ActualData::getnDerivation()
	{
		return m_nDerivation;
	}
	void ActualData::setCnLimit(Limit cnLimit)
	{
		m_cnLimit = cnLimit;
	}
	Limit ActualData::getCnLimit()
	{
		return m_cnLimit;
	}
	void ActualData::setnLimit(Limit nLimit)
	{
		m_nLimit = nLimit;
	}
	Limit ActualData::getNLimit()
	{
		return m_nLimit;
	}


}