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

📄 ne_plbpc.c

📁 一个用来实现偏微分方程中网格的计算库
💻 C
📖 第 1 页 / 共 2 页
字号:
      return (EX_FATAL);    }    if ((status = nc_def_var(neid, VAR_NODE_MAP_INT, NC_INT, 1, &dimid[0], &varid)) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to define variable \"%s\" in file ID %d",              VAR_NODE_MAP_INT, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }    /* and the index variable */    if ((status = nc_def_var(neid, VAR_NODE_MAP_INT_IDX, NC_INT, 1,			     &dimid_npf, &varid_idx[2])) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to define variable \"%s\" in file ID %d",              VAR_NODE_MAP_INT_IDX, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }  } /* End "if (num_int_node > 0)" */  if (num_bor_node > 0) {    /* Define variable for vector of border FEM node IDs */    ltempsv = num_bor_node;    if ((status = nc_def_dim(neid, DIM_NUM_BOR_NODES, ltempsv, &dimid[1])) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to dimension \"%s\" in file id %d",              DIM_NUM_BOR_NODES, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }    if ((status = nc_def_var(neid, VAR_NODE_MAP_BOR, NC_INT, 1, &dimid[1], &varid)) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to define variable \"%s\" in file ID %d",              VAR_NODE_MAP_BOR, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }    /* and the index variable */    if ((status = nc_def_var(neid, VAR_NODE_MAP_BOR_IDX, NC_INT, 1,			     &dimid_npf, &varid_idx[3])) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to define variable \"%s\" in file ID %d",              VAR_NODE_MAP_BOR_IDX, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }  } /* End "if (num_bor_node > 0)" */  if (num_ext_node > 0) {    /* Define dimension for vector of external FEM node IDs */    ltempsv = num_ext_node;    if ((status = nc_def_dim(neid, DIM_NUM_EXT_NODES, ltempsv, &dimid[2])) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to dimension \"%s\" in file id %d",              DIM_NUM_EXT_NODES, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }    if ((status = nc_def_var(neid, VAR_NODE_MAP_EXT, NC_INT, 1, &dimid[2], &varid)) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to define variable \"%s\" in file ID %d",              VAR_NODE_MAP_EXT, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }    /* and the index variable */    if ((status = nc_def_var(neid, VAR_NODE_MAP_EXT_IDX, NC_INT, 1,			     &dimid_npf, &varid_idx[4])) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to define variable \"%s\" in file ID %d",              VAR_NODE_MAP_EXT_IDX, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }  } /* End "if (num_ext_node > 0)" */  /* Output the communication map dimensions */  if (num_n_cmaps > 0) {    ltempsv = num_n_cmaps;    if ((status = nc_def_dim(neid, DIM_NUM_N_CMAPS, ltempsv, &dimid[0])) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to add dimension \"%s\" in file ID %d",              DIM_NUM_N_CMAPS, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }    /* Add variables for communication maps */    if ((status = nc_def_var(neid, VAR_N_COMM_IDS, NC_INT, 1, dimid, &varid)) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to define variable \"%s\" in file ID %d",              VAR_N_COMM_IDS, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }    if ((status = nc_def_var(neid, VAR_N_COMM_STAT, NC_INT, 1, dimid, &varid)) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to define variable \"%s\" in file ID %d",              VAR_N_COMM_STAT, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }    /* and the index variable */    if ((status = nc_def_var(neid, VAR_N_COMM_INFO_IDX, NC_INT, 1,			     &dimid_npf, &varid_idx[5])) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to define variable \"%s\" in file ID %d",              VAR_N_COMM_INFO_IDX, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }  } /* End "if (num_n_cmaps > 0)" */  if (num_e_cmaps > 0) {    ltempsv = num_e_cmaps;    if ((status = nc_def_dim(neid, DIM_NUM_E_CMAPS, ltempsv, &dimid[0])) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to add dimension \"%s\" in file ID %d",              DIM_NUM_E_CMAPS, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }    /* Add variables for elemental communication maps */    if ((status = nc_def_var(neid, VAR_E_COMM_IDS, NC_INT, 1, dimid, &varid)) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to define variable \"%s\" in file ID %d",              VAR_E_COMM_IDS, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }    if ((status = nc_def_var(neid, VAR_E_COMM_STAT, NC_INT, 1, dimid, &varid)) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to define variable \"%s\" in file ID %d",              VAR_E_COMM_STAT, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }    /* and the index variable */    if ((status = nc_def_var(neid, VAR_E_COMM_INFO_IDX, NC_INT, 1,			     &dimid_npf, &varid_idx[6])) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to define variable \"%s\" in file ID %d",              VAR_E_COMM_INFO_IDX, neid);      ex_err(func_name, errmsg, exerrval);      /* Leave define mode before returning */      ne_leavedef(neid, func_name);      return (EX_FATAL);    }  } /* End "if (num_e_cmaps > 0)" */  /* Leave define mode */  if (ne_leavedef(neid, func_name) != EX_NOERR)    return (EX_FATAL);  /* need to reset these counters */  num_int_elem = 0;  num_int_node = 0;  num_bor_elem = 0;  num_bor_node = 0;  num_ext_node = 0;  num_n_cmaps = 0;  num_e_cmaps = 0;  /* Update the status vectors */  for(iproc=0; iproc < num_proc_in_f; iproc++) {    start[0] = iproc;    if (num_int_nodes[iproc] > 0)      nmstat = 1;    else      nmstat = 0;    if ((status = nc_put_var1_int(neid, varid_nm[0], start, &nmstat)) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to output status int node map in file ID %d",              neid);      ex_err(func_name, errmsg, exerrval);      return (EX_FATAL);    }    if (num_bor_nodes[iproc] > 0)      nmstat = 1;    else      nmstat = 0;    if ((status = nc_put_var1_int(neid, varid_nm[1], start, &nmstat)) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to output status bor node map in file ID %d",              neid);      ex_err(func_name, errmsg, exerrval);      return (EX_FATAL);    }    if (num_ext_nodes[iproc] > 0)      nmstat = 1;    else      nmstat = 0;    if ((status = nc_put_var1_int(neid, varid_nm[2], start, &nmstat)) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to output status ext node map in file ID %d",              neid);      ex_err(func_name, errmsg, exerrval);      return (EX_FATAL);    }    if (num_int_elems[iproc] > 0)      nmstat = 1;    else      nmstat = 0;    if ((status = nc_put_var1_int(neid, varid_em[0], start, &nmstat)) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to output status int elem map in file ID %d",              neid);      ex_err(func_name, errmsg, exerrval);      return (EX_FATAL);    }    if (num_bor_elems[iproc] > 0)      nmstat = 1;    else      nmstat = 0;    if ((status = nc_put_var1_int(neid, varid_em[1], start, &nmstat)) != NC_NOERR) {      exerrval = status;      sprintf(errmsg,              "Error: failed to output status bor elem map in file ID %d",              neid);      ex_err(func_name, errmsg, exerrval);      return (EX_FATAL);    }    /* now fill the index variables */    if (varid_idx[0] > 0) {      /* increment to the next starting position */      num_int_elem += num_int_elems[iproc];      if ((status = nc_put_var1_int(neid, varid_idx[0], start, &num_int_elem)) != NC_NOERR) {        exerrval = status;        sprintf(errmsg,                "Error: failed to output int elem map index in file ID %d",                neid);        ex_err(func_name, errmsg, exerrval);        return (EX_FATAL);      }    }    if (varid_idx[1] > 0) {      /* increment to the next starting position */      num_bor_elem += num_bor_elems[iproc];      if ((status = nc_put_var1_int(neid, varid_idx[1], start, &num_bor_elem)) != NC_NOERR) {        exerrval = status;        sprintf(errmsg,                "Error: failed to output bor elem map index in file ID %d",                neid);        ex_err(func_name, errmsg, exerrval);        return (EX_FATAL);      }    }    if (varid_idx[2] > 0) {      /* increment to the next starting position */      num_int_node += num_int_nodes[iproc];      if ((status = nc_put_var1_int(neid, varid_idx[2], start, &num_int_node)) != NC_NOERR) {        exerrval = status;        sprintf(errmsg,                "Error: failed to output int node map index in file ID %d",                neid);        ex_err(func_name, errmsg, exerrval);        return (EX_FATAL);      }    }    if (varid_idx[3] > 0) {      /* increment to the next starting position */      num_bor_node += num_bor_nodes[iproc];      if ((status = nc_put_var1_int(neid, varid_idx[3], start, &num_bor_node)) != NC_NOERR) {        exerrval = status;        sprintf(errmsg,                "Error: failed to output bor node map index in file ID %d",                neid);        ex_err(func_name, errmsg, exerrval);        return (EX_FATAL);      }    }    if (varid_idx[4] > 0) {      /* increment to the next starting position */      num_ext_node += num_ext_nodes[iproc];      if ((status = nc_put_var1_int(neid, varid_idx[4], start, &num_ext_node)) != NC_NOERR) {        exerrval = status;        sprintf(errmsg,                "Error: failed to output ext node map index in file ID %d",                neid);        ex_err(func_name, errmsg, exerrval);        return (EX_FATAL);      }    }    if (varid_idx[5] > 0) {      /* increment to the next starting position */      num_n_cmaps += num_node_cmaps[iproc];      if ((status = nc_put_var1_int(neid, varid_idx[5], start, &num_n_cmaps)) != NC_NOERR) {        exerrval = status;        sprintf(errmsg,                "Error: failed to output node comm map index in file ID %d",                neid);        ex_err(func_name, errmsg, exerrval);        return (EX_FATAL);      }    }    if (varid_idx[6] > 0) {      /* increment to the next starting position */      num_e_cmaps += num_elem_cmaps[iproc];      if ((status = nc_put_var1_int(neid, varid_idx[6], start, &num_e_cmaps)) != NC_NOERR) {        exerrval = status;        sprintf(errmsg,                "Error: failed to output elem cmap index in file ID %d",                neid);        ex_err(func_name, errmsg, exerrval);        return (EX_FATAL);      }    }  } /* End "for(iproc=0; iproc < num_proc_in_f; iproc++)" */  return (EX_NOERR);}

⌨️ 快捷键说明

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