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


C++ LIS_SETERR_MEM函数代码示例

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


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

示例1: lis_matrix_setDLU_dia

LIS_INT lis_matrix_setDLU_dia(LIS_INT lnnd, LIS_INT unnd, LIS_SCALAR *diag, LIS_INT *lindex, LIS_SCALAR *lvalue,
              LIS_INT *uindex, LIS_SCALAR *uvalue, LIS_MATRIX A)
{
  LIS_INT        err;
  LIS_MATRIX_DIAG  D;

  LIS_DEBUG_FUNC_IN;

#if 0
  err = lis_matrix_check(A,LIS_MATRIX_CHECK_SET);
  if( err ) return err;
#else
  if(lis_matrix_is_assembled(A))  return LIS_SUCCESS;
  else {
    err = lis_matrix_check(A,LIS_MATRIX_CHECK_SET);
    if( err ) return err;
  }
#endif

  A->L = (LIS_MATRIX_CORE)lis_calloc(sizeof(struct LIS_MATRIX_CORE_STRUCT),"lis_matrix_setDLU_dia::A->L");
  if( A->L==NULL )
  {
    LIS_SETERR_MEM(sizeof(struct LIS_MATRIX_CORE_STRUCT));
    return LIS_OUT_OF_MEMORY;
  }
  A->U = (LIS_MATRIX_CORE)lis_calloc(sizeof(struct LIS_MATRIX_CORE_STRUCT),"lis_matrix_setDLU_dia::A->U");
  if( A->U==NULL )
  {
    LIS_SETERR_MEM(sizeof(struct LIS_MATRIX_CORE_STRUCT));
    lis_matrix_DLU_destroy(A);
    return LIS_OUT_OF_MEMORY;
  }
  err = lis_matrix_diag_create(A->n,0,A->comm,&D);
  if( err )
  {
    lis_matrix_DLU_destroy(A);
    return err;
  }

  lis_free(D->value);
  D->value       = diag;
  A->D           = D;
  A->L->nnd      = lnnd;
  A->L->index    = lindex;
  A->L->value    = lvalue;
  A->U->nnd      = unnd;
  A->U->index    = uindex;
  A->U->value    = uvalue;
  A->is_copy     = LIS_FALSE;
  A->status      = -LIS_MATRIX_DIA;
  A->is_splited  = LIS_TRUE;

  LIS_DEBUG_FUNC_OUT;
  return LIS_SUCCESS;
}
开发者ID:OpenModelica,项目名称:OMCompiler-3rdParty,代码行数:55,代码来源:lis_matrix_dia.c

示例2: lis_matrix_ilu_create

LIS_INT lis_matrix_ilu_create(LIS_INT n, LIS_INT bs, LIS_MATRIX_ILU *A)
{
	LIS_INT i;
	LIS_INT *nnz;
	LIS_INT	**index;

	LIS_DEBUG_FUNC_IN;

	*A      = NULL;
	nnz     = NULL;
	index   = NULL;

	*A = (LIS_MATRIX_ILU)lis_malloc( sizeof(struct LIS_MATRIX_ILU_STRUCT),"lis_matrix_ilu_create::A" );
	if( NULL==*A )
	{
		LIS_SETERR_MEM(sizeof(struct LIS_MATRIX_ILU_STRUCT));
		return LIS_OUT_OF_MEMORY;
	}
	memset(*A,0,sizeof(struct LIS_MATRIX_ILU_STRUCT));

	nnz = (LIS_INT *)lis_malloc( n*sizeof(LIS_INT),"lis_matrix_ilu_create::nnz" );
	if( nnz==NULL )
	{
		LIS_SETERR_MEM(n*sizeof(LIS_INT));
		return LIS_OUT_OF_MEMORY;
	}
	index = (LIS_INT **)lis_malloc( n*sizeof(LIS_INT *),"lis_matrix_ilu_create::index" );
	if( index==NULL )
	{
		LIS_SETERR_MEM(n*sizeof(LIS_INT *));
		return LIS_OUT_OF_MEMORY;
	}

	#ifdef _OPENMP
	#pragma omp parallel for private(i)
	#endif
	for(i=0;i<n;i++)
	{
		nnz[i] = 0;
		index[i] = NULL;
	}

	(*A)->n      = n;
	(*A)->bs     = bs;
	(*A)->nnz    = nnz;
	(*A)->index  = index;
	(*A)->nnz_ma = NULL;
	(*A)->value  = NULL;
	(*A)->values = NULL;
	(*A)->bsz    = NULL;

	LIS_DEBUG_FUNC_OUT;
	return LIS_SUCCESS;
}
开发者ID:HaibingShao,项目名称:ComponentialMultiphase,代码行数:54,代码来源:lis_matrix_ilu.c

示例3: lis_vector_reuse

LIS_INT lis_vector_reuse(LIS_VECTOR *vec)
{
	LIS_INT	err,np,precision;

	LIS_DEBUG_FUNC_IN;

	err = lis_vector_check(*vec,LIS_VECTOR_CHECK_NULL);
	if( err ) return err;

	np = (*vec)->np;
	if( (*vec)->status==LIS_VECTOR_NULL )
	{
		precision = ((LIS_VECTOR)*vec)->precision;
		if( !precision )
		{
			(*vec)->value = (LIS_SCALAR *)lis_malloc( np*sizeof(LIS_SCALAR),"lis_vector_reuse::vec->value" );
			if( NULL==(*vec)->value )
			{
				LIS_SETERR_MEM(np*sizeof(LIS_SCALAR));
				return LIS_OUT_OF_MEMORY;
			}
			(*vec)->is_copy = LIS_TRUE;
		}
		else
		{
			(*vec)->value = (LIS_SCALAR *)lis_malloc( (2*np+np%2)*sizeof(LIS_SCALAR),"lis_vector_reuse::vec->value" );
			if( NULL==(*vec)->value )
			{
				LIS_SETERR_MEM((2*np+np%2)*sizeof(LIS_SCALAR));
				return LIS_OUT_OF_MEMORY;
			}
			(*vec)->is_copy = LIS_TRUE;
			(*vec)->value_lo = (*vec)->value + np + np%2;
			(*vec)->work = (LIS_SCALAR *)lis_malloc( 32*sizeof(LIS_SCALAR),"lis_vector_reuse::vec->work" );
			if( NULL==(*vec)->work )
			{
				LIS_SETERR_MEM(32*sizeof(LIS_SCALAR));
				lis_vector_destroy(*vec);
				*vec = NULL;
				return LIS_OUT_OF_MEMORY;
			}
		}
	}

	(*vec)->status = LIS_VECTOR_ASSEMBLED;

	LIS_DEBUG_FUNC_OUT;
	return LIS_SUCCESS;
}
开发者ID:florianl,项目名称:lis,代码行数:49,代码来源:lis_vector.c

示例4: lis_set_argv_f

void lis_set_argv_f(LIS_INT *no, char *argv, LIS_INT *ierr, LIS_INT len)
{
  LIS_INT   i;
  char  *p;

  LIS_DEBUG_FUNC_IN;

  i = *no;
  f_argv_tmp[i] = (char *)lis_malloc((len+1)*sizeof(char),"lis_set_argv_f::f_argv_tmp");
  if( f_argv_tmp[i]==NULL )
  {
    LIS_SETERR_MEM((len+1)*sizeof(char));
    *ierr = LIS_OUT_OF_MEMORY;
    return;
  }
  memset(f_argv_tmp[i],0x20,(len+1)*sizeof(char));
  strncpy(f_argv_tmp[i],argv,len);
  p = &f_argv_tmp[i][len];
  if( len>0 )
  {
    while( *p==' ' ) p--;
    p++;
  }
  *p = '\0';
  *ierr = LIS_SUCCESS;

  LIS_DEBUG_FUNC_OUT;
  return;
}
开发者ID:OpenModelica,项目名称:OMCompiler-3rdParty,代码行数:29,代码来源:lisf_system.c

示例5: lis_matrix_ilu_premalloc

LIS_INT lis_matrix_ilu_premalloc(LIS_INT nnzrow, LIS_MATRIX_ILU A)
{
	LIS_INT i,n;
	LIS_INT *nnz_ma;

	LIS_DEBUG_FUNC_IN;

	n = A->n;

	nnz_ma = (LIS_INT *)lis_malloc( n*sizeof(LIS_INT),"lis_matrix_ilu_premalloc::nnz_ma" );
	if( nnz_ma==NULL )
	{
		LIS_SETERR_MEM(n*sizeof(LIS_INT));
		return LIS_OUT_OF_MEMORY;
	}

	#ifdef _OPENMP
	#pragma omp parallel for private(i)
	#endif
	for(i=0;i<n;i++)
	{
		nnz_ma[i] = nnzrow;
		A->index[i] = (LIS_INT *)malloc( nnzrow*sizeof(LIS_INT) );
		A->value[i] = (LIS_SCALAR *)malloc( nnzrow*sizeof(LIS_SCALAR) );
	}
	for(i=0;i<n;i++)
	{
		if( A->index[i]==NULL )
		{
			LIS_SETERR_MEM(nnzrow*sizeof(LIS_INT));
			return LIS_OUT_OF_MEMORY;
		}
		if( A->value[i]==NULL )
		{
			LIS_SETERR_MEM(nnzrow*sizeof(LIS_SCALAR));
			return LIS_OUT_OF_MEMORY;
		}
	}

	A->nnz_ma   = nnz_ma;

	LIS_DEBUG_FUNC_OUT;
	return LIS_SUCCESS;
}
开发者ID:HaibingShao,项目名称:ComponentialMultiphase,代码行数:44,代码来源:lis_matrix_ilu.c

示例6: lis_precon_create_adds

LIS_INT lis_precon_create_adds(LIS_SOLVER solver, LIS_PRECON precon)
{
	LIS_INT	i,j;
	LIS_INT	precon_type,worklen;
	LIS_INT	err;
	LIS_VECTOR *work;

	LIS_DEBUG_FUNC_IN;

	precon_type = solver->options[LIS_OPTIONS_PRECON];
	worklen     = 2;
	work        = (LIS_VECTOR *)lis_malloc( worklen*sizeof(LIS_VECTOR),"lis_precon_create_adds::work" );
	if( work==NULL )
	{
		LIS_SETERR_MEM(worklen*sizeof(LIS_VECTOR));
		return LIS_OUT_OF_MEMORY;
	}
	if( solver->precision==LIS_PRECISION_DEFAULT )
	{
		for(i=0;i<worklen;i++)
		{
			err = lis_vector_duplicate(solver->A,&work[i]);
			if( err ) break;
		}
	}
	else
	{
		for(i=0;i<worklen;i++)
		{
			err = lis_vector_duplicateex(LIS_PRECISION_QUAD,solver->A,&work[i]);
			if( err ) break;
		}
	}
	if( i<worklen )
	{
		for(j=0;j<i;j++) lis_vector_destroy(work[j]);
		lis_free(work);
		return err;
	}
	precon->worklen = worklen;
	precon->work    = work;

	err = lis_precon_create_xxx[precon_type](solver,precon);
	if( err )
	{
		lis_precon_destroy(precon);
		return err;
	}

    precon->A       = solver->A;
    precon->is_copy = LIS_FALSE;

	LIS_DEBUG_FUNC_OUT;
	return err;
}
开发者ID:florianl,项目名称:lis,代码行数:55,代码来源:lis_precon_ads.c

示例7: lis_gmres_malloc_work

LIS_INT lis_gmres_malloc_work(LIS_SOLVER solver)
{
	LIS_VECTOR *work;
	LIS_INT	i,j,restart,worklen,err;

	LIS_DEBUG_FUNC_IN;

	restart = solver->options[LIS_OPTIONS_RESTART];
	worklen = NWORK + (restart+1);
	work    = (LIS_VECTOR *)lis_malloc( worklen*sizeof(LIS_VECTOR),"lis_gmres_malloc_work::work" );
	if( work==NULL )
	{
		LIS_SETERR_MEM(worklen*sizeof(LIS_VECTOR));
		return LIS_ERR_OUT_OF_MEMORY;
	}
	if( solver->precision==LIS_PRECISION_DEFAULT )
	{
		for(i=1;i<worklen;i++)
		{
			err = lis_vector_duplicate(solver->A,&work[i]);
			if( err ) break;
		}
	}
	else
	{
		for(i=1;i<worklen;i++)
		{
			err = lis_vector_duplicateex(LIS_PRECISION_QUAD,solver->A,&work[i]);
			if( err ) break;
			memset(work[i]->value_lo,0,solver->A->np*sizeof(LIS_SCALAR));
		}
	}
	if( i<worklen )
	{
		for(j=1;j<i;j++) lis_vector_destroy(work[j]);
		lis_free(work);
		return err;
	}
	if( solver->precision==LIS_PRECISION_DEFAULT )
	{
		lis_vector_create(solver->A->comm,&work[0]);
	}
	else
	{
		lis_vector_createex(LIS_PRECISION_QUAD,solver->A->comm,&work[0]);
	}
	lis_vector_set_size(work[0],restart+1,0);
	solver->worklen = worklen;
	solver->work    = work;


	LIS_DEBUG_FUNC_OUT;
	return LIS_SUCCESS;
}
开发者ID:rwl,项目名称:lis,代码行数:54,代码来源:lis_solver_gmres.c

示例8: lis_idrs_malloc_work

LIS_INT lis_idrs_malloc_work(LIS_SOLVER solver)
{
	LIS_VECTOR	*work;
	LIS_INT			i,j,s,worklen,err;

	LIS_DEBUG_FUNC_IN;

	/*
	err = lis_matrix_convert(solver->A,&solver->At,LIS_MATRIX_CCS);
	if( err ) return err;
	*/

	s       = solver->options[LIS_OPTIONS_IDRS_RESTART];
	worklen = NWORK + 3*s;
	work    = (LIS_VECTOR *)lis_malloc(
worklen*sizeof(LIS_VECTOR),"lis_idrs_malloc_work::work" );
	if( work==NULL )
	{
		LIS_SETERR_MEM(worklen*sizeof(LIS_VECTOR));
		return LIS_ERR_OUT_OF_MEMORY;
	}
	if( solver->precision==LIS_PRECISION_DEFAULT )
	{
		for(i=0;i<worklen;i++)
		{
			err = lis_vector_duplicate(solver->A,&work[i]);
			if( err ) break;
		}
	}
	else
	{
		for(i=0;i<worklen;i++)
		{
			err =
lis_vector_duplicateex(LIS_PRECISION_QUAD,solver->A,&work[i]);
			if( err ) break;

memset(work[i]->value_lo,0,solver->A->np*sizeof(LIS_SCALAR));
		}
	}
	if( i<worklen )
	{
		for(j=0;j<i;j++) lis_vector_destroy(work[j]);
		lis_free(work);
		return err;
	}
	solver->worklen = worklen;
	solver->work    = work;

	LIS_DEBUG_FUNC_OUT;
	return LIS_SUCCESS;
}
开发者ID:HaibingShao,项目名称:ComponentialMultiphase,代码行数:52,代码来源:lis_solver_idrs.c

示例9: lis_matrix_ilu_realloc

LIS_INT lis_matrix_ilu_realloc(LIS_INT row, LIS_INT nnz, LIS_MATRIX_ILU A)
{

	LIS_DEBUG_FUNC_IN;


	A->index[row] = (LIS_INT *)realloc(A->index[row],nnz*sizeof(LIS_INT));
	if( A->index[row]==NULL )
	{
		LIS_SETERR_MEM(nnz*sizeof(LIS_INT));
		return LIS_OUT_OF_MEMORY;
	}
	A->value[row] = (LIS_SCALAR *)realloc(A->value[row],nnz*sizeof(LIS_SCALAR));
	if( A->value[row]==NULL )
	{
		LIS_SETERR_MEM(nnz*sizeof(LIS_SCALAR));
		return LIS_OUT_OF_MEMORY;
	}

	LIS_DEBUG_FUNC_OUT;
	return LIS_SUCCESS;
}
开发者ID:HaibingShao,项目名称:ComponentialMultiphase,代码行数:22,代码来源:lis_matrix_ilu.c

示例10: lis_matrix_malloc_dia

LIS_INT lis_matrix_malloc_dia(LIS_INT n, LIS_INT nnd, LIS_INT **index, LIS_SCALAR **value)
{
  LIS_DEBUG_FUNC_IN;

  *index   = NULL;
  *value   = NULL;

  *index = (LIS_INT *)lis_malloc( n*nnd*sizeof(LIS_INT),"lis_matrix_malloc_dia::index" );
  if( *index==NULL )
  {
    LIS_SETERR_MEM(n*nnd*sizeof(LIS_INT));
    lis_free2(2,*index,*value);
    return LIS_OUT_OF_MEMORY;
  }
  *value = (LIS_SCALAR *)lis_malloc( n*nnd*sizeof(LIS_SCALAR),"lis_matrix_malloc_dia::value" );
  if( *value==NULL )
  {
    LIS_SETERR_MEM(n*nnd*sizeof(LIS_SCALAR));
    lis_free2(2,*index,*value);
    return LIS_OUT_OF_MEMORY;
  }
  LIS_DEBUG_FUNC_OUT;
  return LIS_SUCCESS;
}
开发者ID:OpenModelica,项目名称:OMCompiler-3rdParty,代码行数:24,代码来源:lis_matrix_dia.c

示例11: lis_vector_set_value

int lis_vector_set_value(int flag, int i, LIS_SCALAR value, LIS_VECTOR v)
{
	int n,np,gn,is,ie;

	LIS_DEBUG_FUNC_IN;

	np  = v->np;
	n   = v->n;
	gn  = v->gn;
	is  = v->is;
	ie  = v->ie;
	if( v->origin ) i--;
	if( i<is || i>=ie )
	{
		if( v->origin )
		{
			is++;
			ie++;
			i++;
		}
		LIS_SETERR3(LIS_ERR_ILL_ARG, "i(=%d) is less than %d or larger than %d\n",i,is,ie);
		return LIS_ERR_ILL_ARG;
	}

	if(v->status==LIS_VECTOR_NULL)
	{
		v->value = (LIS_SCALAR *)lis_malloc( np*sizeof(LIS_SCALAR),"lis_vector_set_value::v->value" );
		if( NULL==v->value )
		{

			LIS_SETERR_MEM(np*sizeof(LIS_SCALAR));
			return LIS_OUT_OF_MEMORY;
		}
		v->is_copy = LIS_TRUE;
		v->status  = LIS_VECTOR_ASSEMBLING;
	}
	if(flag==LIS_INS_VALUE)
	{
		v->value[i-is] = value;
	}
	else
	{
		v->value[i-is] += value;
	}
	LIS_DEBUG_FUNC_OUT;
	return LIS_SUCCESS;
}
开发者ID:lukasa1993,项目名称:HomCalculation,代码行数:47,代码来源:lis_vector.c

示例12: lis_solver_create

LIS_INT lis_solver_create(LIS_SOLVER *solver)
{
	LIS_DEBUG_FUNC_IN;

	*solver = NULL;

	*solver = (LIS_SOLVER)lis_malloc( sizeof(struct LIS_SOLVER_STRUCT),"lis_solver_create::solver" );
	if( NULL==*solver )
	{
		LIS_SETERR_MEM(sizeof(struct LIS_SOLVER_STRUCT));
		return LIS_OUT_OF_MEMORY;
	}
	lis_solver_init(*solver);

	LIS_DEBUG_FUNC_OUT;
	return LIS_SUCCESS;
}
开发者ID:HaibingShao,项目名称:ComponentialMultiphase,代码行数:17,代码来源:lis_solver.c

示例13: lis_set_argv_begin_f

void lis_set_argv_begin_f(LIS_INT *argc, LIS_INT *ierr)
{
  LIS_DEBUG_FUNC_IN;

  f_argc_tmp = *argc+1;
  f_argv_tmp = (char **)lis_malloc(f_argc_tmp*sizeof(char *),"lis_set_argv_begin_f::f_argv_tmp");
  if( f_argv_tmp==NULL )
  {
    LIS_SETERR_MEM(f_argc_tmp*sizeof(char *));
    *ierr = LIS_OUT_OF_MEMORY;
    return;
  }
  *ierr = LIS_SUCCESS;

  LIS_DEBUG_FUNC_OUT;
  return;
}
开发者ID:OpenModelica,项目名称:OMCompiler-3rdParty,代码行数:17,代码来源:lisf_system.c

示例14: lis_input_hb

LIS_INT lis_input_hb(LIS_MATRIX A, LIS_VECTOR b, LIS_VECTOR x, FILE *file)
{
  LIS_INT      err;
  LIS_INT      matrix_type;
  LIS_MATRIX  B;

  LIS_DEBUG_FUNC_IN;

  matrix_type = A->matrix_type;

  err = lis_input_hb_csr(A,b,x,file);
  if( err ) return err;

  if( matrix_type!=LIS_MATRIX_CSR && matrix_type!=LIS_MATRIX_CSC )
  {
    err = lis_matrix_duplicate(A,&B);
    if( err ) return err;
    lis_matrix_set_type(B,matrix_type);
    err = lis_matrix_convert(A,B);
    if( err ) return err;
    lis_matrix_storage_destroy(A);
    lis_matrix_DLU_destroy(A);
    lis_matrix_diag_destroy(A->WD);
    if( A->l2g_map ) lis_free( A->l2g_map );
    if( A->commtable ) lis_commtable_destroy( A->commtable );
    if( A->ranges ) lis_free( A->ranges );
    err = lis_matrix_copy_struct(B,A);
    if( err ) return err;
    lis_free(B);
    if( A->matrix_type==LIS_MATRIX_JAD )
    {
      A->work = (LIS_SCALAR *)lis_malloc(A->n*sizeof(LIS_SCALAR),"lis_input_hb::A->work");
      if( A->work==NULL )
      {
        LIS_SETERR_MEM(A->n*sizeof(LIS_SCALAR));
        return LIS_OUT_OF_MEMORY;
      }
    }
  }


  LIS_DEBUG_FUNC_OUT;
  return LIS_SUCCESS;
}
开发者ID:OpenModelica,项目名称:OMCompiler-3rdParty,代码行数:44,代码来源:lis_input_hb.c

示例15: lis_esi_malloc_work

LIS_INT lis_esi_malloc_work(LIS_ESOLVER esolver)
{
	LIS_VECTOR	*work;
	LIS_INT			i,j,worklen,err,ss;

	LIS_DEBUG_FUNC_IN;

	ss = esolver->options[LIS_EOPTIONS_SUBSPACE];

	worklen = NWORK + ss;
	work    = (LIS_VECTOR *)lis_malloc( worklen*sizeof(LIS_VECTOR),"lis_esi_malloc_work::work" );
	if( work==NULL )
	{
		LIS_SETERR_MEM(worklen*sizeof(LIS_VECTOR));
		return LIS_ERR_OUT_OF_MEMORY;
	}
	if( esolver->eprecision==LIS_PRECISION_DEFAULT )
	{
		for(i=0;i<worklen;i++)
		{
			err = lis_vector_duplicate(esolver->A,&work[i]);
			if( err ) break;
		}
	}
	else
	{
		for(i=0;i<worklen;i++)
		{
			err = lis_vector_duplicateex(LIS_PRECISION_QUAD,esolver->A,&work[i]);
			if( err ) break;
		}
	}
	if( i<worklen )
	{
		for(j=0;j<i;j++) lis_vector_destroy(work[j]);
		lis_free(work);
		return err;
	}
	esolver->worklen = worklen;
	esolver->work    = work;

	LIS_DEBUG_FUNC_OUT;
	return LIS_SUCCESS;
}
开发者ID:HaibingShao,项目名称:ComponentialMultiphase,代码行数:44,代码来源:lis_esolver_si.c


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