您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GET_INDEX函数代码示例

51自学网 2021-06-01 20:51:20
  C++
这篇教程C++ GET_INDEX函数代码示例写得很实用,希望能帮到您。

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

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

示例1: matrix_set_many_on_column

void matrix_set_many_on_column(matrix_type * matrix , int row_offset , int elements , const double * data , int column) {  if ((row_offset + elements) <= matrix->rows) {    if (matrix->row_stride == 1)  /* Memory is continous ... */      memcpy( &matrix->data[ GET_INDEX( matrix , row_offset , column) ] , data , elements * sizeof * data);    else {      int i;      for (i = 0; i < elements; i++)        matrix->data[ row_offset + GET_INDEX( matrix , i , column) ] = data[i];    }  } else    util_abort("%s: range violation /n" , __func__);}
开发者ID:danielfmva,项目名称:ert,代码行数:12,


示例2: matrix_det2

double matrix_det2( const matrix_type * A) {  if ((A->rows == 2) && (A->columns == 2)) {    double a00 = A->data[GET_INDEX(A,0,0)];    double a01 = A->data[GET_INDEX(A,0,1)];    double a10 = A->data[GET_INDEX(A,1,0)];    double a11 = A->data[GET_INDEX(A,1,1)];    return a00 * a11 - a10 * a01;  } else {    util_abort("%s: hardcoded for 2x2 matrices A is: %d x %d /n",__func__, A->rows , A->columns);    return 0;  }}
开发者ID:YingfangZhou,项目名称:ert,代码行数:13,


示例3: matrix_row_column_dot_product

double matrix_row_column_dot_product(const matrix_type * m1 , int row1 , const matrix_type * m2 , int col2) {  if (m1->columns != m2->rows)    util_abort("%s: size mismatch: m1:[%d,%d]   m2:[%d,%d] /n",__func__ , matrix_get_rows( m1 ) , matrix_get_columns( m1 ) , matrix_get_rows( m2 ) , matrix_get_columns( m2 ));  {    int k;    double sum = 0;    for( k = 0; k < m1->columns; k++)      sum += m1->data[ GET_INDEX(m1 , row1 , k) ] * m2->data[ GET_INDEX(m2, k , col2) ];    return sum;  }}
开发者ID:YingfangZhou,项目名称:ert,代码行数:13,


示例4: matrix_columns_equal

bool matrix_columns_equal( const matrix_type * m1 , int col1 , const matrix_type * m2 , int col2) {  if (m1->rows != m2->rows)    return false;  {    int row;    for (row=0; row < m1->rows; row++) {      if (memcmp( &m1->data[ GET_INDEX(m1 , row , col1)]  , &m2->data[ GET_INDEX(m2 , row , col2)] , sizeof * m1->data) != 0)        return false;    }  }  return true;}
开发者ID:YingfangZhou,项目名称:ert,代码行数:14,


示例5: matrix_transpose

void matrix_transpose(const matrix_type * A , matrix_type * T) {  if ((A->columns == T->rows) && (A->rows == T->columns)) {    int i,j;    for (i=0; i < A->rows; i++) {      for (j=0; j < A->columns; j++) {        size_t src_index    = GET_INDEX(A , i , j );        size_t target_index = GET_INDEX(T , j , i );        T->data[ target_index ] = A->data[ src_index ];      }    }  } else    util_abort("%s: size mismatch/n",__func__);}
开发者ID:YingfangZhou,项目名称:ert,代码行数:14,


示例6: reset_pnodes

int reset_pnodes(int curr, int pnode){	struct msm_bus_inode_info *info;	struct msm_bus_fabric_device *fabdev;	int index, next_pnode;	fabdev = msm_bus_get_fabric_device(GET_FABID(curr));	index = GET_INDEX(pnode);	info = fabdev->algo->find_node(fabdev, curr);	if (!info) {		MSM_BUS_ERR("Cannot find node info!/n");		return -ENXIO;	}	MSM_BUS_DBG("Starting the loop--remove/n");	do {		struct msm_bus_inode_info *hop;		fabdev = msm_bus_get_fabric_device(GET_FABID(curr));		if (!fabdev) {			MSM_BUS_ERR("Fabric not found/n");				return -ENXIO;		}		next_pnode = info->pnode[index].next;		info->pnode[index].next = -2;		curr = GET_NODE(next_pnode);		index = GET_INDEX(next_pnode);		if (IS_NODE(curr))			hop = fabdev->algo->find_node(fabdev, curr);		else			hop = fabdev->algo->find_gw_node(fabdev, curr);		if (!hop) {			MSM_BUS_ERR("Null Info found for hop/n");			return -ENXIO;		}		MSM_BUS_DBG("%d[%d] = %d/n", info->node_info->priv_id, index,			info->pnode[index].next);		MSM_BUS_DBG("num_pnodes: %d: %d/n", info->node_info->priv_id,			info->num_pnodes);		info = hop;	} while (GET_NODE(info->pnode[index].next) != info->node_info->priv_id);	info->pnode[index].next = -2;	MSM_BUS_DBG("%d[%d] = %d/n", info->node_info->priv_id, index,		info->pnode[index].next);	MSM_BUS_DBG("num_pnodes: %d: %d/n", info->node_info->priv_id,		info->num_pnodes);	return 0;}
开发者ID:cooldudezach,项目名称:android_kernel_zte_warplte,代码行数:49,


示例7: matrix_inplace_diag_sqrt

// Commentvoid matrix_inplace_diag_sqrt(matrix_type *Cd){  int nrows = Cd->rows;  if (Cd->rows != Cd->columns) {    util_abort("%s: size mismatch /n",__func__);  }  else{    int i;    for ( i=0; i<nrows; i++)      {        Cd->data[GET_INDEX(Cd , i , i)] = sqrt(Cd->data[GET_INDEX(Cd , i , i)]);      }  }}
开发者ID:YingfangZhou,项目名称:ert,代码行数:16,


示例8: matrix_column_column_dot_product

double matrix_column_column_dot_product(const matrix_type * m1 , int col1 , const matrix_type * m2 , int col2) {  if (m1->rows != m2->rows)    util_abort("%s: size mismatch /n",__func__);  if (col1 >= m1->columns || col2 >= m2->columns)    util_abort("%s: size mismatch /n",__func__);  {    int row;    double sum = 0;    for( row = 0; row < m1->rows; row++)      sum += m1->data[ GET_INDEX(m1 , row , col1) ] * m2->data[ GET_INDEX(m2, row , col2) ];    return sum;  }}
开发者ID:YingfangZhou,项目名称:ert,代码行数:15,


示例9: matrix_inplace_sub

/* Updates matrix A by subtracting matrix B - elementwise. */void matrix_inplace_sub(matrix_type * A , const matrix_type * B) {  if ((A->rows == B->rows) && (A->columns == B->columns)) {    int i,j;    for (j = 0; j < A->columns; j++)      for (i=0; i < A->rows; i++)        A->data[ GET_INDEX(A,i,j) ] -= B->data[ GET_INDEX(B,i,j) ];  } else    util_abort("%s: size mismatch  A:[%d,%d]   B:[%d,%d]/n",__func__ ,               matrix_get_rows(A),               matrix_get_columns(A),               matrix_get_rows(B),               matrix_get_columns(B));}
开发者ID:YingfangZhou,项目名称:ert,代码行数:16,


示例10: file_geo_nappe

/***************************************** * Read nappe characterization in a file * *****************************************/GEO *file_geo_nappe (BYTE Type, FILE *File){  GEO_NAPPE  *Geo;  PNT        *Pnt, *PntA, *PntB, *PntC, *PntD;  FCT        *Fct;  VECTOR     U, V;  REAL       Real;  INDEX      Index;  INIT_MEM (Geo, 1, GEO_NAPPE);  Geo->Type = Type;  GET_INDEX (Geo->NbrPnt);  INIT_MEM (Geo->TabPnt, Geo->NbrPnt, PNT);  GET_INDEX (Geo->NbrFct);  INIT_MEM (Geo->TabFct, Geo->NbrFct, FCT);  Geo->Min.x = Geo->Min.y = Geo->Min.z =  INFINITY;  Geo->Max.x = Geo->Max.y = Geo->Max.z = -INFINITY;  for (Index = 0, Pnt = Geo->TabPnt; Index < Geo->NbrPnt; Index++, Pnt++) {    GET_VECTOR (Pnt->Point);    VEC_MIN (Geo->Min, Pnt->Point);    VEC_MAX (Geo->Max, Pnt->Point);  }  for (Index = 0, Fct = Geo->TabFct; Index < Geo->NbrFct; Index++, Fct++) {    if (fscanf (File, " ( %d %d %d %d )", &Fct->i, &Fct->j, &Fct->k, &Fct->l) < 4)      return (FALSE);    Fct->NumFct = Index;    PntA = Geo->TabPnt + Fct->i;     PntB = Geo->TabPnt + Fct->j;    PntC = Geo->TabPnt + Fct->k;    PntD = Geo->TabPnt + Fct->l;    VEC_SUB (U, PntC->Point, PntA->Point);    VEC_SUB (V, PntD->Point, PntB->Point);    VEC_CROSS (Fct->Normal, U, V);    VEC_UNIT (Fct->Normal, Real);    VEC_INC (PntA->Normal, Fct->Normal);    VEC_INC (PntB->Normal, Fct->Normal);    VEC_INC (PntC->Normal, Fct->Normal);    VEC_INC (PntD->Normal, Fct->Normal);  }  for (Index = 0, Pnt = Geo->TabPnt; Index < Geo->NbrPnt; Index++, Pnt++)    VEC_UNIT (Pnt->Normal, Real);  return ((GEO *) Geo);}
开发者ID:Moeryn,项目名称:PRCD-TP5,代码行数:51,


示例11: ubidi_getVisualRun

U_CAPI UBiDiDirection U_EXPORT2ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,                   int32_t *pLogicalStart, int32_t *pLength){    int32_t start;    UErrorCode errorCode = U_ZERO_ERROR;    RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, errorCode, UBIDI_LTR);    ubidi_getRuns(pBiDi, &errorCode);    if(U_FAILURE(errorCode)) {        return UBIDI_LTR;    }    RETURN_IF_BAD_RANGE(runIndex, 0, pBiDi->runCount, errorCode, UBIDI_LTR);    start=pBiDi->runs[runIndex].logicalStart;    if(pLogicalStart!=NULL) {        *pLogicalStart=GET_INDEX(start);    }    if(pLength!=NULL) {        if(runIndex>0) {            *pLength=pBiDi->runs[runIndex].visualLimit-                     pBiDi->runs[runIndex-1].visualLimit;        } else {            *pLength=pBiDi->runs[0].visualLimit;        }    }    return (UBiDiDirection)GET_ODD_BIT(start);}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:27,


示例12: output_line

static void output_line(FILE *out_file, DATA *data, DPOINT *where, 		double *est, int n_outfl) {	int i;	assert(out_file != NULL);	assert(out_file != stdout);	if (data->mode & X_BIT_SET) {		fprintf(out_file, " ");		fprintf(out_file, gl_format, where->x);	}	if (data->mode & Y_BIT_SET) {		fprintf(out_file, " ");		fprintf(out_file, gl_format, where->y);	}	if (data->mode & Z_BIT_SET) {		fprintf(out_file, " ");		fprintf(out_file, gl_format, where->z);	}	if (data->mode & S_BIT_SET)		fprintf(out_file, " %d", where->u.stratum + strata_min);	if (data->colnvalue > 0) {		fprintf(out_file, " ");		fprintf(out_file, gl_format, where->attr);	}	for (i = 0; i < n_outfl; i++)		fprintf(out_file, " %s", my_dtoa(gl_format, &(est[i])));    if (data->point_ids)        fprintf(out_file, " %s",data->point_ids[GET_INDEX(where)]);    	fprintf(out_file, "/n");	return;}
开发者ID:Andlon,项目名称:cs267FinalProject,代码行数:34,


示例13: matrix_get_column_abssum

double matrix_get_column_abssum(const matrix_type * matrix , int column) {  double sum = 0;  int i;  for (i=0; i < matrix->rows; i++)    sum += fabs( matrix->data[ GET_INDEX( matrix , i , column ) ] );  return sum;}
开发者ID:YingfangZhou,项目名称:ert,代码行数:7,


示例14: matrix_get_row_sum

double matrix_get_row_sum(const matrix_type * matrix , int row) {  double sum = 0;  int j;  for (j=0; j < matrix->columns; j++)    sum += matrix->data[ GET_INDEX( matrix , row , j ) ];  return sum;}
开发者ID:YingfangZhou,项目名称:ert,代码行数:7,


示例15: run_experiment_ji

double run_experiment_ji ( mtype_t * matrix , mtype_t scalar , int buffer_size ) {    int i, j, iter;    hptimer_t start , end;    double final_time ;        start = get_time ();    for ( iter = 0; iter < MAX_ITERS ; ++ iter ) {        for (j = 0; j < buffer_size ; ++j ) {            for (i = 0; i < buffer_size ; ++i ) {                matrix [ GET_INDEX (i, j, buffer_size ) ] = scalar * matrix [ GET_INDEX (i, j, buffer_size ) ];            }        }    }    end = get_time ();    return final_time = diff_timers (start , end) / MAX_ITERS ;}
开发者ID:drinkintiger,项目名称:CS441_Project_3.1,代码行数:16,


示例16: choice

staticintchoice( void ){    int i, n;    rb->yield();    for( n = i = 0 ; i < 81 ; ++i )        if( IS_EMPTY( i ) )        {            possible[ n ] = SET_INDEX( i ) | SET_DIGIT( numset( board[ i ] ) );            /* Inconsistency if square unknown, but nothing possible */            if( 9 == GET_DIGIT( possible[ n ] ) )                return -2;            ++n;        }    if( 0 == n )        return -1;      /* All squares known */    rb->qsort( possible, n, sizeof( possible[ 0 ] ), cmp );    return GET_INDEX( possible[ 0 ] );}
开发者ID:BurntBrunch,项目名称:rockbox-fft,代码行数:25,


示例17: project

/*************************************************************** * Ensures the velocity field is non divergent i.e. incompressible: * Solves a poisson equation to compute a gradient field and then * subtracts this from the current velocity field to obtain an * incompressible field. When solving for pressure it sets the * cells pressure field. ***************************************************************/void FGS_Fluid_Solver2DS :: project (FLUID_DATA ux, FLUID_DATA uy, FLUID_DATA pressure, FLUID_DATA divergence){    double h           = 1.0 / N * -0.5;    double half_width  = width   * 0.5;    double half_height = height  * 0.5;    int    cell;    double north, south, east, west;        for (int i=1 ; i <= width; i++ )        for (int j=1 ; j <= height; j++ ){            cell  = GET_INDEX(i,j);            north = grid[GET_INDEX(i,j-1)].data[uy];            south = grid[GET_INDEX(i,j+1)].data[uy];            east  = grid[GET_INDEX(i+1,j)].data[ux];            west  = grid[GET_INDEX(i-1,j)].data[ux];                        grid[cell].data[divergence] = h * (east-west+south-north);            grid[cell].data[pressure]   = 0;        }        set_boundary (SET_FOR_NON_VELOCITY_COMPONENT, divergence);    set_boundary (SET_FOR_NON_VELOCITY_COMPONENT, pressure);        computing_pressure = true;    linear_solve (SET_FOR_NON_VELOCITY_COMPONENT, pressure, divergence, 1, 0.25);    computing_pressure = false;        for (int i = 1; i <= width; i++)        for (int j = 1; j <= height; j++){                        cell  = GET_INDEX(i,j);            north = grid[GET_INDEX(i,j-1)].data[pressure];            south = grid[GET_INDEX(i,j+1)].data[pressure];            east  = grid[GET_INDEX(i+1,j)].data[pressure];            west  = grid[GET_INDEX(i-1,j)].data[pressure];                        double u_in_cell = grid[cell].data[ux],                   v_in_cell = grid[cell].data[uy];                        grid[cell].data[ux] = u_in_cell - (half_width  * (east  - west));            grid[cell].data[uy] = v_in_cell - (half_height * (south - north));                    }    set_boundary(SET_FOR_HORIZONTAL_COMPONENT, ux);    set_boundary(SET_FOR_VERTICAL_COMPONENT,   uy);}
开发者ID:schanq,项目名称:FLUIDITI,代码行数:54,


示例18: linear_solve

/*************************************************************** * Computes a Gauss seidel relaxation to solve AX=B for the * unknowns X using forward substitution (the higher the number * of iterations the closer the resultant vector X will be * to convergence).  ***************************************************************/void FGS_Fluid_Solver2DS :: linear_solve (BOUNDARY_CONDITION  b, FLUID_DATA to, FLUID_DATA from, double a, double coef){    for (int k = 0 ; k < iterations; k++){        for (int i = 1 ; i <= width; i++){            for (int j = 1 ; j <= height; j++){                int    cell_ij_index = GET_INDEX(i, j);                double w             = grid[GET_INDEX(i-1, j)].data[to], e = grid[GET_INDEX(i+1, j)].data[to],                       n             = grid[GET_INDEX(i, j-1)].data[to], s = grid[GET_INDEX(i, j+1)].data[to],                       c0            = grid[cell_ij_index].data[from];                                grid[cell_ij_index].data[to] = coef * (c0 + a * (w+e+s+n));                                if (computing_pressure) grid[cell_ij_index].data[PRESSURE] = grid[cell_ij_index].data[to];            }        }        set_boundary(b, to);    }}
开发者ID:schanq,项目名称:FLUIDITI,代码行数:23,


示例19: matrix_copy_row

void matrix_copy_row(matrix_type * target_matrix, const matrix_type * src_matrix , int target_row, int src_row) {  matrix_assert_equal_columns( target_matrix , src_matrix );  {    int col;    for(col = 0; col < target_matrix->columns; col++)      target_matrix->data[ GET_INDEX( target_matrix , target_row , col)] = src_matrix->data[ GET_INDEX( src_matrix, src_row, col)];  }}
开发者ID:YingfangZhou,项目名称:ert,代码行数:8,


示例20: matrix_copy_column

void matrix_copy_column(matrix_type * target_matrix, const matrix_type * src_matrix , int target_column, int src_column) {  matrix_assert_equal_rows( target_matrix , src_matrix );  {    int row;    for(row = 0; row < target_matrix->rows; row++)      target_matrix->data[ GET_INDEX( target_matrix, row , target_column)] = src_matrix->data[ GET_INDEX( src_matrix, row, src_column)];  }}
开发者ID:YingfangZhou,项目名称:ert,代码行数:8,


示例21: add_path_node

/** * add_path_node: Adds the path information to the current node * @info: Internal node info structure * @next: Combination of the id and index of the next node * Function returns: Number of pnodes (path_nodes) on success, * error on failure. * * Every node maintains the list of path nodes. A path node is * reached by finding the node-id and index stored at the current * node. This makes updating the paths with requested bw and clock * values efficient, as it avoids lookup for each update-path request. */static int add_path_node(struct msm_bus_inode_info *info, int next){	struct path_node *pnode;	int i;	if (ZERO_OR_NULL_PTR(info)) {		MSM_BUS_ERR("Cannot find node info!: id :%d/n",				info->node_info->priv_id);		return -ENXIO;	}	for (i = 0; i <= info->num_pnodes; i++) {		if (info->pnode[i].next == -2) {			MSM_BUS_DBG("Reusing pnode for info: %d at index: %d/n",				info->node_info->priv_id, i);			info->pnode[i].clk[DUAL_CTX] = 0;			info->pnode[i].clk[ACTIVE_CTX] = 0;			info->pnode[i].bw[DUAL_CTX] = 0;			info->pnode[i].bw[ACTIVE_CTX] = 0;			info->pnode[i].next = next;			MSM_BUS_DBG("%d[%d] : (%d, %d)/n",				info->node_info->priv_id, i, GET_NODE(next),				GET_INDEX(next));			return i;		}	}	info->num_pnodes++;	pnode = krealloc(info->pnode,		((info->num_pnodes + 1) * sizeof(struct path_node))		, GFP_KERNEL);	if (ZERO_OR_NULL_PTR(pnode)) {		MSM_BUS_ERR("Error creating path node!/n");		info->num_pnodes--;		return -ENOMEM;	}	info->pnode = pnode;	info->pnode[info->num_pnodes].clk[DUAL_CTX] = 0;	info->pnode[info->num_pnodes].clk[ACTIVE_CTX] = 0;	info->pnode[info->num_pnodes].bw[DUAL_CTX] = 0;	info->pnode[info->num_pnodes].bw[ACTIVE_CTX] = 0;	info->pnode[info->num_pnodes].next = next;	MSM_BUS_DBG("%d[%d] : (%d, %d)/n", info->node_info->priv_id,		info->num_pnodes, GET_NODE(next), GET_INDEX(next));	return info->num_pnodes;}
开发者ID:cooldudezach,项目名称:android_kernel_zte_warplte,代码行数:57,


示例22: matrix_get_row_abssum

double matrix_get_row_abssum(const matrix_type * matrix , int row) {  double sum_abs = 0;  int j;  for ( j=0; j < matrix->columns; j++) {    double m = matrix->data[ GET_INDEX( matrix , row , j ) ];    sum_abs += fabs( m );  }  return sum_abs;}
开发者ID:YingfangZhou,项目名称:ert,代码行数:9,


示例23: matrix_get_row_sum2

double matrix_get_row_sum2(const matrix_type * matrix , int row) {  double sum2 = 0;  int j;  for ( j=0; j < matrix->columns; j++) {    double m = matrix->data[ GET_INDEX( matrix , row , j ) ];    sum2 += m*m;  }  return sum2;}
开发者ID:YingfangZhou,项目名称:ert,代码行数:9,


示例24: matrix_diag_set_scalar

void matrix_diag_set_scalar(matrix_type * matrix , double value) {  if (matrix->rows == matrix->columns) {    int i;        matrix_set(matrix , 0);    for ( i=0; i < matrix->rows; i++)      matrix->data[ GET_INDEX(matrix , i , i) ] = value;  } else    util_abort("%s: size mismatch /n",__func__);}
开发者ID:YingfangZhou,项目名称:ert,代码行数:9,


示例25: rs_resource_get

/************************************************************************************************* * Inlines */INLINE struct rs_resource* rs_resource_get(reshandle_t hdl) {    uint idx = GET_INDEX(hdl);    ASSERT(idx < (uint)g_rs.ress.item_cnt);    struct rs_resource* r = &((struct rs_resource*)g_rs.ress.buffer)[idx];    ASSERT(r->hdl != INVALID_HANDLE);    ASSERT(GET_ID(r->hdl) == GET_ID(hdl));    return r;}
开发者ID:septag,项目名称:darkhammer,代码行数:12,


示例26: matrix_get_column_sum2

/**   Return the sum of the squares on column.*/double matrix_get_column_sum2(const matrix_type * matrix , int column) {  double sum2 = 0;  int i;  for ( i=0; i < matrix->rows; i++) {    double m = matrix->data[ GET_INDEX( matrix , i , column ) ];    sum2 += m*m;  }  return sum2;}
开发者ID:YingfangZhou,项目名称:ert,代码行数:12,


示例27: matrix_diag_set

void matrix_diag_set(matrix_type * matrix , const double * diag) {  if (matrix->rows == matrix->columns) {    int i;        matrix_set(matrix , 0);    for ( i=0; i < matrix->rows; i++)      matrix->data[ GET_INDEX(matrix , i , i) ] = diag[i];  } else    util_abort("%s: size mismatch /n",__func__);}
开发者ID:YingfangZhou,项目名称:ert,代码行数:9,


示例28: mem_blocks_pool_get_block_index

extern intmem_blocks_pool_get_block_index(const MEMORY_BLOCKS_POOL *pool, int id) {    int real_id = GET_ID(id);    int index = GET_INDEX(id);    if (pool->ids[index] == real_id)        return index;    return -1;}
开发者ID:m1nuz,项目名称:argon-base,代码行数:10,


示例29: advect

/*************************************************************** * Computes for each cell a backwards particle trace: Linearly * interpolates a virtual particle from the center of each cell * backwards in time (dt) using the velocity in the cell (Uxy) * and copies the value (density or velocity) from this * 'previous' position into the cell. Also computes the average * density if called from the density step. ***************************************************************/void FGS_Fluid_Solver2DS :: advect (BOUNDARY_CONDITION  b,  FLUID_DATA to, FLUID_DATA from, FLUID_DATA ux, FLUID_DATA uy){        int      i0, j0, i1, j1;        double   x,  y,  s0, t0,             s1, t1, deltaT0,             nw, ne, se, sw;        deltaT0 = deltaT*N;        for (int i = 1; i <= width; i++) {        for (int j = 1; j <= height; j++) {                        int cell_ij_index = GET_INDEX(i,j);                        x = i-deltaT0 * grid[cell_ij_index].data[ux];            y = j-deltaT0 * grid[cell_ij_index].data[uy];                        if      (x < 0.5         )   x = 0.5;            else if (x > width + 0.5 )   x = width+0.5;            if      (y < 0.5         )   y = 0.5;            else if (y > height + 0.5)   y = height+0.5;                        i0 = ((int) x); j0 = ((int) y);            i1 = i0 + 1;    j1 = j0 + 1;                        s1 = x-i0;      s0 = 1-s1;            t1 = y-j0;      t0 = 1-t1;                        nw = grid[GET_INDEX(i0, j0)].data[from];            ne = grid[GET_INDEX(i1, j0)].data[from];            se = grid[GET_INDEX(i1, j1)].data[from];            sw = grid[GET_INDEX(i0, j1)].data[from];                        grid[cell_ij_index].data[to] = s0 * (t0 * nw + t1 * sw) + s1 * (t0 * ne + t1 * se);            if(computing_density)                d_av += grid[cell_ij_index].data[to];        }    }    if(computing_density)        d_av *= inv_dims;    set_boundary (b, to);}
开发者ID:schanq,项目名称:FLUIDITI,代码行数:51,



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


C++ GET_INT函数代码示例
C++ GET_HTTP_CONTEXT函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。