Пример #1
0
static void  TRAN_Change_axis_Grid(
   int n1, int n2, int n3,
   double  *grid)
   /* order n2, n3, n1 */
#define v_ref(i,j,k)  v[  (i)*n3*n1+(j)*n1+k ]
#define grid_ref(i,j,k)  grid[ (i)*n2*n3+(j)*n3+k ]
{

  int i,j,k;
  double *v;

  v = (double*)malloc(sizeof(double)*n1*n2*n3);

  for (i=0;i<n1*n2*n3;i++) v[i]=grid[i];

  for (i=0;i<n1;i++) {
   for (j=0;j<n2;j++) {
     for (k=0;k<n3;k++) {
       grid_ref(i,j,k) = v_ref(j,k,i);
     }
    }
  }
 
  free(v); 

}
Пример #2
0
_MEMBER_FUNCTION_IMPL(GUIMultiColumnList, getItem)
{
	CEGUI::MultiColumnList * pWindow = sq_getinstance<CEGUI::MultiColumnList *>(pVM);
	if(!pWindow)
	{
		sq_pushbool(pVM, false);
		return 1;
	}

	SQInteger sqiRow;
	SQInteger sqiColumn;

	sq_getinteger(pVM, -2, &sqiRow);
	sq_getinteger(pVM, -1, &sqiColumn);

	try
	{
		CEGUI::MCLGridRef grid_ref(sqiRow, sqiColumn);
		CEGUI::ListboxItem* pItem = pWindow->getItemAtGridReference(grid_ref);
		sq_pushstring(pVM, pItem->getText().c_str(), -1);
	}
	catch(...)
	{
		sq_pushbool(pVM, false);
	}
	return 1;
}