Skip to content
Snippets Groups Projects
AbstractParam.cpp 595 B
Newer Older
  • Learn to ignore specific revisions
  • Radim Vavřík's avatar
    Radim Vavřík committed
    #include "AbstractParam.h"
    
    namespace math1d_cl
    {
    	AbstractParam::AbstractParam(std::shared_ptr<AbstractRandom> random, UncertainityOptions options, std::shared_ptr<MatData> matData) : m_options(options), m_random(random)
    	{
    		m_currentIterationNumber = 0;
    	}
    
    	double AbstractParam::keepLimits(double value, Limit limit)
    	{
    		// If within limits, do nothin'
    		if(value >= limit.lower && value <= limit.upper)
    		{
    			return value;
    		} 
    		else
    		{
    			if(value < limit.lower)
    			{
    				return limit.lower;
    			}
    			if( value > limit.upper) 
    			{
    				return limit.upper;
    			}
    		}
    		return value;
    	}
    }