def objects_dct(job_path): """ Get the sections for the run block """ run_str = ptt.read_inp_str(job_path, RUN_INP) obj_str = object_block(run_str) # Read one of a set of objects to run calcs on (only one supported) pes_block_str = apf.first_capture(ptt.paren_section('pes'), obj_str) pspc_block_str = apf.first_capture(ptt.paren_section('pspc'), obj_str) spc_block_str = apf.first_capture(ptt.paren_section('spc'), obj_str) # ts_block_str = apf.first_capture(paren_section('ts'), section_str) # wells_block_str = apf.first_capture(paren_section('wells'), section_str) # Build the run dictionary run_dct = {} if pes_block_str is not None: run_dct['pes'] = get_pes_idxs(ptt.remove_empty_lines(pes_block_str)) else: run_dct['pes'] = [] if pspc_block_str is not None: run_dct['pspc'] = get_pspc_idxs(ptt.remove_empty_lines(pspc_block_str)) else: run_dct['pspc'] = [] if spc_block_str is not None: run_dct['spc'] = get_spc_idxs(ptt.remove_empty_lines(spc_block_str)) else: run_dct['spc'] = [] # elif ts_block_str is not None: # obj_str = ts_block_str # elif ts_block_str is not None: # obj_str = ts_block_str # elif wells_block_str is not None: # obj_str = wells_block_str # else: # raise ValueError return run_dct
def object_block(inp_str): """ Read the string that has the global model information """ return ptt.remove_empty_lines( apf.first_capture(ptt.end_section('obj'), inp_str))