⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 putget.c

📁 一个用来实现偏微分方程中网格的计算库
💻 C
📖 第 1 页 / 共 5 页
字号:
	switch(varp->type){	case NC_CHAR:		return NC_ECHAR;	case NC_BYTE:		return putNCvx_schar_float(ncp, varp, start, nelems,			value);	case NC_SHORT:		return putNCvx_short_float(ncp, varp, start, nelems,			value);	case NC_INT:		return putNCvx_int_float(ncp, varp, start, nelems,			value);	case NC_FLOAT:		return putNCvx_float_float(ncp, varp, start, nelems,			value);	case NC_DOUBLE: 		return putNCvx_double_float(ncp, varp, start, nelems,			value);	}	return NC_EBADTYPE;}static intputNCv_double(NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, const double *value){	switch(varp->type){	case NC_CHAR:		return NC_ECHAR;	case NC_BYTE:		return putNCvx_schar_double(ncp, varp, start, nelems,			value);	case NC_SHORT:		return putNCvx_short_double(ncp, varp, start, nelems,			value);	case NC_INT:		return putNCvx_int_double(ncp, varp, start, nelems,			value);	case NC_FLOAT:		return putNCvx_float_double(ncp, varp, start, nelems,			value);	case NC_DOUBLE: 		return putNCvx_double_double(ncp, varp, start, nelems,			value);	}	return NC_EBADTYPE;}static intgetNCvx_char_char(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, char *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t nget = ncx_howmany(varp->type, extent);		int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,				 0, (void **)&xp);	/* cast away const */		if(lstatus != NC_NOERR)			return lstatus;				lstatus = ncx_getn_char_char(&xp, nget, value);		if(lstatus != NC_NOERR && status == NC_NOERR)			status = lstatus;		(void) ncp->nciop->rel(ncp->nciop, offset, 0);			remaining -= extent;		if(remaining == 0)			break; /* normal loop exit */		offset += extent;		value += nget;	}	return status;}static intgetNCvx_schar_schar(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, schar *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t nget = ncx_howmany(varp->type, extent);		int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,				 0, (void **)&xp);	/* cast away const */		if(lstatus != NC_NOERR)			return lstatus;				lstatus = ncx_getn_schar_schar(&xp, nget, value);		if(lstatus != NC_NOERR && status == NC_NOERR)			status = lstatus;		(void) ncp->nciop->rel(ncp->nciop, offset, 0);			remaining -= extent;		if(remaining == 0)			break; /* normal loop exit */		offset += extent;		value += nget;	}	return status;}static intgetNCvx_schar_uchar(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, uchar *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t nget = ncx_howmany(varp->type, extent);		int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,				 0, (void **)&xp);	/* cast away const */		if(lstatus != NC_NOERR)			return lstatus;				lstatus = ncx_getn_schar_uchar(&xp, nget, value);		if(lstatus != NC_NOERR && status == NC_NOERR)			status = lstatus;		(void) ncp->nciop->rel(ncp->nciop, offset, 0);			remaining -= extent;		if(remaining == 0)			break; /* normal loop exit */		offset += extent;		value += nget;	}	return status;}static intgetNCvx_schar_short(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, short *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t nget = ncx_howmany(varp->type, extent);		int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,				 0, (void **)&xp);	/* cast away const */		if(lstatus != NC_NOERR)			return lstatus;				lstatus = ncx_getn_schar_short(&xp, nget, value);		if(lstatus != NC_NOERR && status == NC_NOERR)			status = lstatus;		(void) ncp->nciop->rel(ncp->nciop, offset, 0);			remaining -= extent;		if(remaining == 0)			break; /* normal loop exit */		offset += extent;		value += nget;	}	return status;}static intgetNCvx_schar_int(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, int *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t nget = ncx_howmany(varp->type, extent);		int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,				 0, (void **)&xp);	/* cast away const */		if(lstatus != NC_NOERR)			return lstatus;				lstatus = ncx_getn_schar_int(&xp, nget, value);		if(lstatus != NC_NOERR && status == NC_NOERR)			status = lstatus;		(void) ncp->nciop->rel(ncp->nciop, offset, 0);			remaining -= extent;		if(remaining == 0)			break; /* normal loop exit */		offset += extent;		value += nget;	}	return status;}static intgetNCvx_schar_long(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, long *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t nget = ncx_howmany(varp->type, extent);		int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,				 0, (void **)&xp);	/* cast away const */		if(lstatus != NC_NOERR)			return lstatus;				lstatus = ncx_getn_schar_long(&xp, nget, value);		if(lstatus != NC_NOERR && status == NC_NOERR)			status = lstatus;		(void) ncp->nciop->rel(ncp->nciop, offset, 0);			remaining -= extent;		if(remaining == 0)			break; /* normal loop exit */		offset += extent;		value += nget;	}	return status;}static intgetNCvx_schar_float(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, float *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t nget = ncx_howmany(varp->type, extent);		int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,				 0, (void **)&xp);	/* cast away const */		if(lstatus != NC_NOERR)			return lstatus;				lstatus = ncx_getn_schar_float(&xp, nget, value);		if(lstatus != NC_NOERR && status == NC_NOERR)			status = lstatus;		(void) ncp->nciop->rel(ncp->nciop, offset, 0);			remaining -= extent;		if(remaining == 0)			break; /* normal loop exit */		offset += extent;		value += nget;	}	return status;}static intgetNCvx_schar_double(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, double *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t nget = ncx_howmany(varp->type, extent);		int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,				 0, (void **)&xp);	/* cast away const */		if(lstatus != NC_NOERR)			return lstatus;				lstatus = ncx_getn_schar_double(&xp, nget, value);		if(lstatus != NC_NOERR && status == NC_NOERR)			status = lstatus;		(void) ncp->nciop->rel(ncp->nciop, offset, 0);			remaining -= extent;		if(remaining == 0)			break; /* normal loop exit */		offset += extent;		value += nget;	}	return status;}static intgetNCvx_short_schar(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, schar *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t nget = ncx_howmany(varp->type, extent);		int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,				 0, (void **)&xp);	/* cast away const */		if(lstatus != NC_NOERR)			return lstatus;				lstatus = ncx_getn_short_schar(&xp, nget, value);		if(lstatus != NC_NOERR && status == NC_NOERR)			status = lstatus;		(void) ncp->nciop->rel(ncp->nciop, offset, 0);			remaining -= extent;		if(remaining == 0)			break; /* normal loop exit */		offset += extent;		value += nget;	}	return status;}static intgetNCvx_short_uchar(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, uchar *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t nget = ncx_howmany(varp->type, extent);		int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,				 0, (void **)&xp);	/* cast away const */		if(lstatus != NC_NOERR)			return lstatus;				lstatus = ncx_getn_short_uchar(&xp, nget, value);		if(lstatus != NC_NOERR && status == NC_NOERR)			status = lstatus;		(void) ncp->nciop->rel(ncp->nciop, offset, 0);			remaining -= extent;		if(remaining == 0)			break; /* normal loop exit */		offset += extent;		value += nget;	}	return status;}static intgetNCvx_short_short(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, short *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t nget = ncx_howmany(varp->type, extent);		int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,				 0, (void **)&xp);	/* cast away const */		if(lstatus != NC_NOERR)			return lstatus;				lstatus = ncx_getn_short_short(&xp, nget, value);		if(lstatus != NC_NOERR && status == NC_NOERR)			status = lstatus;		(void) ncp->nciop->rel(ncp->nciop, offset, 0);			remaining -= extent;		if(remaining == 0)			break; /* normal loop exit */		offset += extent;		value += nget;	}	return status;}static intgetNCvx_short_int(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, int *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t nget = ncx_howmany(varp->type, extent);		int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,				 0, (void **)&xp);	/* cast away const */		if(lstatus != NC_NOERR)			return lstatus;				lstatus = ncx_getn_short_int(&xp, nget, value);		if(lstatus != NC_NOERR && status == NC_NOERR)			status = lstatus;		(void) ncp->nciop->rel(ncp->nciop, offset, 0);			remaining -= extent;		if(remaining == 0)			break; /* normal loop exit */		offset += extent;		value += nget;	}	return status;}static intgetNCvx_short_long(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, long *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t nget = ncx_howmany(varp->type, extent);		int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,				 0, (void **)&xp);	/* cast away const */		if(lstatus != NC_NOERR)			return lstatus;				lstatus = ncx_getn_short_long(&xp, nget, value);		if(lstatus != NC_NOERR && status == NC_NOERR)			status = lstatus;		(void) ncp->nciop->rel(ncp->nciop, offset, 0);			remaining -= extent;		if(remaining == 0)			break; /* normal loop exit */		offset += extent;		value += nget;	}	return status;}static intgetNCvx_short_float(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, float *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t nget = ncx_howmany(varp->type, extent);		int lstatus = ncp->nciop->get(ncp->nciop, offset, extent,				 0, (void **)&xp);	/* cast away const */		if(lstatus != NC_NOERR)			return lstatus;				lstatus = ncx_getn_short_float(&xp, nget, value);		if(lstatus != NC_NOERR && status == NC_NOERR)			status = lstatus;		(void) ncp->nciop->rel(ncp->nciop, offset, 0);			remaining -= extent;		if(remaining == 0)			break; /* normal loop exit */		offset += extent;		value += nget;	}	return status;}static intgetNCvx_short_double(const NC *ncp, const NC_var *varp,		 const size_t *start, size_t nelems, double *value){	off_t offset = NC_varoffset(ncp, varp, start);	size_t remaining = varp->xsz * nelems;	int status = NC_NOERR;	const void *xp;	if(nelems == 0)		return NC_NOERR;	assert(value != NULL);	for(;;)	{		size_t extent = MIN(remaining, ncp->chunk);		size_t 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -