ErrorCode ReadDamsel::parse_options(const FileOptions &opts, bool ¶llel) { // Handle parallel options std::string junk; bool use_mpio = (MB_SUCCESS == opts.get_null_option("USE_MPIO")); ErrorCode rval = opts.match_option("PARALLEL", "READ_PART"); parallel = (rval != MB_ENTITY_NOT_FOUND); nativeParallel = (rval == MB_SUCCESS); if (use_mpio && !parallel) { readMeshIface->report_error( "'USE_MPIO' option specified w/out 'PARALLEL' option" ); return MB_NOT_IMPLEMENTED; } return MB_SUCCESS; }
ErrorCode ReadNC::parse_options(const FileOptions& opts, std::vector<std::string>& var_names, std::vector<int>& tstep_nums, std::vector<double>& tstep_vals) { int tmpval; if (MB_SUCCESS == opts.get_int_option("DEBUG_IO", 1, tmpval)) { dbgOut.set_verbosity(tmpval); dbgOut.set_prefix("NC "); } ErrorCode rval = opts.get_strs_option("VARIABLE", var_names); if (MB_TYPE_OUT_OF_RANGE == rval) noVars = true; else noVars = false; opts.get_ints_option("TIMESTEP", tstep_nums); opts.get_reals_option("TIMEVAL", tstep_vals); rval = opts.get_null_option("NOMESH"); if (MB_SUCCESS == rval) noMesh = true; rval = opts.get_null_option("SPECTRAL_MESH"); if (MB_SUCCESS == rval) spectralMesh = true; rval = opts.get_null_option("NO_MIXED_ELEMENTS"); if (MB_SUCCESS == rval) noMixedElements = true; rval = opts.get_null_option("NO_EDGES"); if (MB_SUCCESS == rval) noEdges = true; if (2 <= dbgOut.get_verbosity()) { if (!var_names.empty()) { std::cerr << "Variables requested: "; for (unsigned int i = 0; i < var_names.size(); i++) std::cerr << var_names[i]; std::cerr << std::endl; } if (!tstep_nums.empty()) { std::cerr << "Timesteps requested: "; for (unsigned int i = 0; i < tstep_nums.size(); i++) std::cerr << tstep_nums[i]; std::cerr << std::endl; } if (!tstep_vals.empty()) { std::cerr << "Time vals requested: "; for (unsigned int i = 0; i < tstep_vals.size(); i++) std::cerr << tstep_vals[i]; std::cerr << std::endl; } } rval = opts.get_int_option("GATHER_SET", 0, gatherSetRank); if (MB_TYPE_OUT_OF_RANGE == rval) { MB_SET_ERR(rval, "Invalid value for GATHER_SET option"); } rval = opts.get_int_option("TIMESTEPBASE", 0, tStepBase); if (MB_TYPE_OUT_OF_RANGE == rval) { MB_SET_ERR(rval, "Invalid value for TIMESTEPBASE option"); } rval = opts.get_int_option("TRIVIAL_PARTITION_SHIFT", 1, trivialPartitionShift); if (MB_TYPE_OUT_OF_RANGE == rval) { MB_SET_ERR(rval, "Invalid value for TRIVIAL_PARTITION_SHIFT option"); } #ifdef MOAB_HAVE_MPI isParallel = (opts.match_option("PARALLEL", "READ_PART") != MB_ENTITY_NOT_FOUND); if (!isParallel) // Return success here, since rval still has _NOT_FOUND from not finding option // in this case, myPcomm will be NULL, so it can never be used; always check for isParallel // before any use for myPcomm return MB_SUCCESS; int pcomm_no = 0; rval = opts.get_int_option("PARALLEL_COMM", pcomm_no); if (MB_TYPE_OUT_OF_RANGE == rval) { MB_SET_ERR(rval, "Invalid value for PARALLEL_COMM option"); } myPcomm = ParallelComm::get_pcomm(mbImpl, pcomm_no); if (0 == myPcomm) { myPcomm = new ParallelComm(mbImpl, MPI_COMM_WORLD); } const int rank = myPcomm->proc_config().proc_rank(); dbgOut.set_rank(rank); int dum; rval = opts.match_option("PARTITION_METHOD", ScdParData::PartitionMethodNames, dum); if (MB_FAILURE == rval) { MB_SET_ERR(rval, "Unknown partition method specified"); } else if (MB_ENTITY_NOT_FOUND == rval) partMethod = ScdParData::ALLJORKORI; else partMethod = dum; #endif return MB_SUCCESS; }