📄 ne_gcmp.c
字号:
VAR_N_COMM_DATA_IDX, neid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (cmap_data_idx[1] == -1) { /* * Find the dimension ID of the variable containing the * node count */ if ((status = nc_inq_dimid(neid, DIM_NCNT_CMAP, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_NCNT_CMAP, neid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Find the value of the number of nodes in this nodal comm map */ if ((status = nc_inq_dimlen(neid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NCNT_CMAP, neid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } cmap_data_idx[1] = count[0]; } node_cmap_node_cnts[cnt] = cmap_data_idx[1] - cmap_data_idx[0]; } else node_cmap_node_cnts[cnt] = 0; } /* "for(cnt=0; cnt < num_n_comm_maps; cnt++)" */ } /* "if (node_cmap_node_cnts != NULL)" */ } /* "if (node_cmap_ids != NULL)" */ } /* "if (num_n_comm_maps > 0)" */ } /* End "if ((dimid = nc_inq_dimid(neid, DIM_NUM_N_CMAPS)) != -1)" */ /*****************************************************************************/ /*****************************************************************************/ /* Elemental communication map(s) */ /*****************************************************************************/ /*****************************************************************************/ /* get the cmap information variables index */ if (ne_get_idx(neid, VAR_E_COMM_INFO_IDX, cmap_info_idx, processor) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_E_COMM_INFO_IDX, neid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the number of elemental communications maps in the file */ if ((status = nc_inq_dimid(neid, DIM_NUM_E_CMAPS, &dimid)) == NC_NOERR) { /* check if I need to get the dimension of the nodal comm map */ if (cmap_info_idx[1] == -1) { if ((status = nc_inq_dimlen(neid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_NUM_E_CMAPS, neid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* set the end value for the node map */ cmap_info_idx[1] = count[0]; } /* End "if (cmap_info_idx[1] == -1) */ num_e_comm_maps = cmap_info_idx[1] - cmap_info_idx[0]; if (num_e_comm_maps > 0) { count[0] = num_e_comm_maps; /* Get the variable ID for the vector of nodal comm map IDs */ if ((status = nc_inq_varid(neid, VAR_E_COMM_IDS, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable ID for \"%s\" in file ID %d", VAR_E_COMM_IDS, neid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Get the vector of elemental communication map IDs */ if (elem_cmap_ids != NULL) { start[0] = cmap_info_idx[0]; status = nc_get_vara_int(neid, varid, start, count, elem_cmap_ids); if (status != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get variable \"%s\" from file ID %d", VAR_E_COMM_IDS, neid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if ((status = nc_inq_varid(neid, VAR_E_COMM_STAT, &varid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find variable ID for \"%s\" from file ID %d", VAR_E_COMM_STAT, neid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (elem_cmap_elem_cnts != NULL) { /* * Get the element counts in each of the elemental * communication maps */ for(cnt=0; cnt < num_e_comm_maps; cnt++) { if ((map_idx=ne_id_lkup(neid, VAR_E_COMM_IDS, cmap_info_idx, elem_cmap_ids[cnt])) < 0) { exerrval = EX_MSG; sprintf(errmsg, "Error: failed to find elemental comm map with ID %d in file ID %d", elem_cmap_ids[cnt], neid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* Check the status of the requested elemental map */ start[0] = map_idx; if ((status = nc_get_var1_int(neid, varid, start, &nmstat)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to get status for \"%s\" from file ID %d", VAR_E_COMM_STAT, neid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (nmstat == 1) { /* get the cmap information variables index */ if (ne_get_idx(neid, VAR_E_COMM_DATA_IDX, cmap_data_idx, map_idx) == -1) { exerrval = status; sprintf(errmsg, "Error: failed to find index variable, \"%s\", in file ID %d", VAR_E_COMM_DATA_IDX, neid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } if (cmap_data_idx[1] == -1) { /* * Find the dimension ID of the variable containing the * element count */ if ((status = nc_inq_dimid(neid, DIM_ECNT_CMAP, &dimid)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find dimension ID for \"%s\" in file ID %d", DIM_ECNT_CMAP, neid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } /* * Find the value of the number of elements in this elemental * comm map */ if ((status = nc_inq_dimlen(neid, dimid, count)) != NC_NOERR) { exerrval = status; sprintf(errmsg, "Error: failed to find length of dimension \"%s\" in file ID %d", DIM_ECNT_CMAP, neid); ex_err(func_name, errmsg, exerrval); return (EX_FATAL); } cmap_data_idx[1] = count[0]; } elem_cmap_elem_cnts[cnt] = cmap_data_idx[1] - cmap_data_idx[0]; } else elem_cmap_elem_cnts[cnt] = 0; } /* "for(cnt=0; cnt < num_e_comm_maps; cnt++)" */ } /* "if (elem_cmap_elem_cnts != NULL)" */ } /* "if (elem_cmap_ids != NULL)" */ } /* "if (num_e_comm_maps > 0)" */ } /* End "if ((dimid = nc_inq_dimid(neid, DIM_NUM_E_CMAPS(processor))) != -1)" */ return (EX_NOERR);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -