当前位置: 首页>>代码示例>>C++>>正文


C++ ModelException函数代码示例

本文整理汇总了C++中ModelException函数的典型用法代码示例。如果您正苦于以下问题:C++ ModelException函数的具体用法?C++ ModelException怎么用?C++ ModelException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ModelException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sk

void SUR_GA::SetValue(const char *key, float value)
{
    string sk(key);

    if (StringMatch(sk, "ThreadNum"))
    {
        omp_set_num_threads((int) value);
    }
    else if (StringMatch(sk, "TimeStep"))
    {
        m_TimeStep = value * 60; //hour -> mimute
    }
    else if (StringMatch(sk, "T_snow"))
    {
        m_Tsnow = value;
    }
    else if (StringMatch(sk, "t_soil"))
    {
        m_Tsoil = value;
    }
    else if (StringMatch(sk, "T0"))
    {
        m_T0 = value;
    }
    else if (StringMatch(sk, "s_frozen"))
    {
        this->m_Sfrozen = value;
    }
    else
        throw ModelException("SUR_GA", "SetValue", "Parameter " + sk
                                                   +
                                                   " does not exist in SUR_GA method. Please contact the module developer.");

}
开发者ID:Shenfang1993,项目名称:SEIMS,代码行数:34,代码来源:SUR_GA.cpp

示例2: ModelException

void Model::pushCommandOnUndoStack(UndoCommand* command)
{
	if ( !modificationInProgress )
		throw ModelException("Changing the application tree without calling Model.beginModification() first");
	if ( performedUndoRedo )
		throw ModelException("Trying to execute new commands after performing an Undo or a Redo operation.");

	if ( pushedNewCommandsOnTheStack == false )
	{
		pushedNewCommandsOnTheStack = true;
		commands.beginMacro(modificationText);
	}

	commands.push(command);
	if (command->target()) commands.push(new AddModifiedNode(modifiedTargets, command->target()));
}
开发者ID:JurajKubelka,项目名称:Envision,代码行数:16,代码来源:Model.cpp

示例3: ModelException

void Integer::load(PersistentStore &store)
{
	if (store.currentNodeType() != typeName())
		throw ModelException("Trying to load an Integer node from an incompatible node type " + store.currentNodeType());

	set(store.loadIntValue());
}
开发者ID:JurajKubelka,项目名称:Envision,代码行数:7,代码来源:Integer.cpp

示例4: ModelException

void SUR_GA::initalOutputs()
{
    if (m_cellSize <= 0)
        throw ModelException("SUR_GA", "CheckInputData", "The dimension of the input data can not be less than zero.");
    // allocate the output variables
    if (this->m_PE == NULL)
    {
        this->m_PE = new float[this->m_cellSize];
    }
    if (this->m_INFIL == NULL)
    {
        this->m_INFIL = new float[this->m_cellSize];
    }
    // initialization
    for (int i = 0; i < m_cellSize; i++)
    {
        m_PE[i] = 0.0f;
        m_INFIL[i] = 0.0f;
    }

    if (this->m_w1 == NULL) initalW1W2();
    if (this->m_wfmp == NULL) this->initialWFMP();
    if (this->m_INFRate == NULL)
    {
        this->m_INFRate = new float[this->m_cellSize];
        for (int iCell = 0; iCell < m_cellSize; iCell++)
            this->m_INFRate[iCell] = 0.0f;
    }
}
开发者ID:Shenfang1993,项目名称:SEIMS,代码行数:29,代码来源:SUR_GA.cpp

示例5: ModelException

void Float::load(PersistentStore &store)
{
	if (store.currentNodeType() != typeName())
		throw ModelException("Trying to load a Float node from an incompatible node type " + store.currentNodeType());

	set(store.loadDoubleValue());
}
开发者ID:Andresbu,项目名称:Envision,代码行数:7,代码来源:Float.cpp

示例6: Node

Character::Character(Node *parent, PersistentStore &store, bool) :
	Node(parent)
{
	QString t = store.loadStringValue();
	if (t.size() != 1) throw ModelException("Creating character node failed. Invalid persistent store data: " + t);

	value = t[0];
}
开发者ID:Andresbu,项目名称:Envision,代码行数:8,代码来源:Character.cpp

示例7: ModelException

bool UnsaturatedFlow::CheckInputSize(const char *key, int n) {
    if (n <= 0) {
        throw ModelException("UnsaturatedFlow", "CheckInputSize",
                             "Input data for " + string(key) + " is invalid. The size could not be less than zero.");
        return false;
    }
    if (this->m_cellSize != n) {
        if (this->m_cellSize <= 0) { this->m_cellSize = n; }
        else {
            throw ModelException("UnsaturatedFlow", "CheckInputSize", "Input data for " + string(key) +
                " is invalid. All the input data should have same size.");
            return false;
        }
    }

    return true;
}
开发者ID:crazyzlj,项目名称:SEIMS,代码行数:17,代码来源:UnsaturatedFlow.cpp

示例8: ModelException

void Boolean::load(PersistentStore &store)
{
	if (store.currentNodeType() != typeName())
		throw ModelException("Trying to load an Boolean node from an incompatible node type " + store.currentNodeType());

	bool val = store.loadIntValue();
	set(val);
}
开发者ID:fiirabig,项目名称:Envision,代码行数:8,代码来源:Boolean.cpp

示例9: ModelException

bool ReservoirMethod::CheckInputSize(const char* key, int n)
{
	if(n<=0)
		throw ModelException("GWA_RE","CheckInputSize","Input data for "+string(key) +" is invalid. The size could not be less than zero.");

	if(m_nCells != n)
	{
		if(m_nCells <= 0) 
			m_nCells = n;
		else
		{
			throw ModelException("GWA_RE","CheckInputSize","Input data for "+string(key) +" is invalid. All the input data should have same size.");
		}
	}

	return true;
}
开发者ID:SmileEric,项目名称:SEIMS,代码行数:17,代码来源:ReservoirMethod.cpp

示例10: sk

void DepressionFSDaily::SetValue(const char *key, float data)
{
    string sk(key);
    if (StringMatch(sk, VAR_DEPREIN)) m_depCo = data;
    else if (StringMatch(sk, VAR_OMP_THREADNUM))omp_set_num_threads((int) data); 
    else
        throw ModelException(MID_DEP_LINSLEY, "SetValue", "Parameter " + sk + " does not exist.");
}
开发者ID:Shenfang1993,项目名称:SEIMS,代码行数:8,代码来源:DepressionFSDaily.cpp

示例11: s

void SOL_WB::Set1DData(const char* key, int nRows, float* data)
{
	string s(key);
	if(StringMatch(s, Tag_SubbasinSelected))
	{
		m_subbasinSelected = data;
		m_subbasinSelectedCount = nRows;
		return;
	}

	if(StringMatch(s, VAR_T_RG))
	{
		m_RG = data;
		m_subbasinTotalCount = nRows;		

		return;
	}

	CheckInputSize(key,nRows);

	if(StringMatch(s, VAR_INLO))				
		m_Interception = data;
	else if(StringMatch(s, VAR_PRECI))			
		m_Precipitation = data;
	else if(StringMatch(s, VAR_INET))		
		m_EI = data;
	else if(StringMatch(s, VAR_DPST))		
		m_Depression = data;
	else if(StringMatch(s, VAR_DEET))		
		m_ED = data;	
	else if(StringMatch(s, VAR_INFIL))
		m_Infil = data;
	else if(StringMatch(s, VAR_SOET))	
		m_ES = data;
	else if(StringMatch(s, VAR_REVAP))		
		m_Revap = data;	
	else if(StringMatch(s, VAR_SURU))		
		m_RS = data;
	else if(StringMatch(s, VAR_T_RG))			
		m_RG = data;
	else if(StringMatch(s, VAR_SNSB))		
		m_SE = data;
	else if(StringMatch(s, VAR_TMIN))		
		m_tMin = data;	
	else if(StringMatch(s, VAR_TMAX))		
		m_tMax = data;	
	else if(StringMatch(s, VAR_SOTE))		
		m_SoilT = data;
	else if(StringMatch(s, VAR_SUBBSN))		
		m_subbasin = data;
	else if(StringMatch(s, VAR_SOILDEPTH))		
		m_Rootdepth = data;	
	else if(StringMatch(s, VAR_NEPR))	
		m_pNet = data;
	else
		throw ModelException("SOL_WB", "Set1DData", "Parameter " + s + " does not exist in the SOL_WB module.");

}
开发者ID:fannq,项目名称:SEIMS,代码行数:58,代码来源:SOL_WB.cpp

示例12: ModelException

bool PER_PI::CheckInputSize(const char* key, int n)
{
	if(n<=0)
	{
		throw ModelException(MID_PER_PI,"CheckInputSize","Input data for "+string(key) +" is invalid. The size could not be less than zero.");
		return false;
	}
	if(this->m_nCells != n)
	{
		if(this->m_nCells <=0) this->m_nCells = n;
		else
		{
			throw ModelException(MID_PER_PI,"CheckInputSize","Input data for "+string(key) +" is invalid. All the input data should have same size.");
			return false;
		}
	}
	return true;
}
开发者ID:fannq,项目名称:SEIMS,代码行数:18,代码来源:PER_PI.cpp

示例13: CheckInputSize

void IUH_OL::Set1DData(const char* key, const int n, float* data) {
    CheckInputSize(key, n);
    string sk(key);
    if (StringMatch(sk, VAR_SUBBSN)) m_subbsnID = data;
    else if (StringMatch(sk, VAR_SURU)) m_surfRf = data;
    else {
        throw ModelException(MID_IUH_OL, "Set1DData", "Parameter " + sk + " does not exist.");
    }
}
开发者ID:crazyzlj,项目名称:SEIMS,代码行数:9,代码来源:IUH_OL.cpp

示例14: s

void PER_PI::SetValue(const char* key, float data)
{
	string s(key);
	if(StringMatch(s, Tag_TimeStep))		m_dt = int(data);	
	else if(StringMatch(s, VAR_T_SOIL))		m_frozenT = data;
	else if (StringMatch(s, VAR_OMP_THREADNUM))omp_set_num_threads((int)data);
	else									
		throw ModelException(MID_PER_PI,"SetValue",
		    "Parameter " + s + " does not exist in current module. Please contact the module developer.");
}
开发者ID:fannq,项目名称:SEIMS,代码行数:10,代码来源:PER_PI.cpp

示例15: InitialOutputs

void SNO_SP::Get1DData(const char* key, int* n, float** data) {
    InitialOutputs();
    string s(key);
    if (StringMatch(s, VAR_SNME)) *data = m_snowMelt;
    else if (StringMatch(s, VAR_SNAC)) *data = m_snowAccum;
    else {
        throw ModelException(MID_SNO_SP, "Get1DData", "Result " + s + " does not exist.");
    }
    *n = m_nCells;
}
开发者ID:crazyzlj,项目名称:SEIMS,代码行数:10,代码来源:SNO_SP.cpp


注:本文中的ModelException函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。