def run_damocles(exe_path, parame_file, log_file=''): """ Running the damocles executable @param exe_path Path the damocles executable @param parame_file Path to the input aprameters file @param log_file Redirecting ouput to that file if present """ if not path.exists(exe_path): raise TelemacException("You need to compile damocles to use it...") # Run Fortran program mes = Messages(size=10) try: if log_file == '': print("%s < %s " % (exe_path, parame_file)) _, code = mes.run_cmd("%s < %s" % (exe_path, parame_file), False) else: print("%s < %s > %s" % (exe_path, parame_file, log_file)) _, code = mes.run_cmd( "%s < %s > %s" % (exe_path, parame_file, log_file), False) except OSError as exc: raise TelemacException(exc.strerror) if code != 0: raise TelemacException([\ {'name':'damocles', 'msg':'Could not execute damocles'\ +'\n\nHere is the log:\n' +'\n'.join(get_file_content(log_file)) }])
def get_xyn(file_name): # TODO: Read the whole header, for the time being head is copied # over # TODO: Read multiple variables depending on type and on a list # ~~ Get all ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ core = get_file_content(file_name) # ~~ Parse head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ icore = 0 file_type = None while re.match(KEN_HEADER, core[icore]): # ~~> instruction FileType proc = re.match(ASC_FILE_TYPE, core[icore]) if proc: file_type = proc.group('type').lower() # ... more instruction coming ... icore += 1 head = core[0:icore] if file_type is None: proc = re.match(VAR_3DBL, core[icore]+' ') if not proc: proc = re.match(VAR_2DBL, core[icore]+' ') if not proc: raise TelemacException( '\nCould not parse the first record: ' '{}'.format(core[icore])) else: file_type = 'xy' else: file_type = 'xyz' # /!\ icore starts the body # ~~ Parse body ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # This is also fairly fast, so you might not need a progress bar xyz = [] # ; pbar = ProgressBar(maxval=len(core)).start() while icore < len(core): if file_type == 'xy': proc = re.match(VAR_2DBL, core[icore]+' ') if not proc: raise TelemacException( '\nCould not parse the following xyz record: ' '{}'.format(core[icore])) xyz.append([float(proc.group('number1')), float(proc.group('number2'))]) elif file_type == 'xyz': proc = re.match(VAR_3DBL, core[icore]+' ') if not proc: raise TelemacException( '\nCould not parse the following xyz record: ' '{}'.format(core[icore])) xyz.append([float(proc.group('number1')), float(proc.group('number2')), float(proc.group('number3'))]) icore += 1 # pbar.finish() return head, file_type, xyz
def generate_ref_from_dict(exe_path, dictionary, latex_file, lng, cleanup, verbose): """ @brief Generate the Latex file for the reference manual from the dictionary @param exe_path (string) Path to homere_damocles executable @param dictionary (string) Path to the dictionary to read @param latex_file (string) Name of the outpu latex file that will contain the reference manual @param lng (int) Language for the reference manual 1: French 2: English @param cleanup (boolean) If True removing genrated files @param verbose (boolean) If True display command """ # Building input parameter file latex_dir = path.dirname(latex_file) if not path.exists(latex_dir): mkdir(latex_dir) param_file = path.join(latex_dir, 'gen_ref.par') log_file = path.join(latex_dir, 'gen_ref.log') # Cleanup if cleanup: if path.exists(param_file): remove(param_file) if path.exists(log_file): remove(log_file) if path.exists(latex_file): remove(latex_file) else: # Creating parameter file for damocles with open(param_file, 'w') as f: f.write('LATEX' + '\n') f.write(dictionary + '\n') f.write(latex_file + '\n') f.write(lng + '\n') # Removing LaTeX file if already there if path.exists(latex_file): remove(latex_file) # Run Fortran program mes = Messages(size=10) if verbose: cmd = "{} < {}".format(exe_path, param_file) else: cmd = "{} < {} >{} 2>&1".format(exe_path, param_file, log_file) if verbose: print(cmd) _, code = mes.run_cmd(cmd, False) if code != 0: if verbose: log = '' else: log = '\n\nHere is the log:\n'\ + '\n'.join(get_file_content(log_file)) raise TelemacException(\ 'Could not generated data from dictionary ' + '{}'.format(log))
def _get_file_content(self, file_name): """ @brief Get the content of the file if file does not exist then system exit """ if not path.exists(file_name): raise TelemacException( '... could not find your .sortie file: ' '{}'.format(file_name)) self.output = get_file_content(file_name)
def run_partel(partel, par_file, file_format, conlim, ncsize, bypass, section_name, zone_name, weir_name, geom, fmtgeom, i_part, concat): """ @brief Runs PARTEL @param partel (string): the path of partel @param par_file (string): the name of the PARTEL file @param file_format (string): the format of the filee to partition @param conlim (string): the name of the *.cli file @param ncsize (int): the number of processors @param bypass (boolean): continue execution after exception was raised if True, kill the execution otherwise @param section_name (string): path to the section ascii input file. This file has to be split by partel at the same time as the geometry file. To do so, partel needs to know its name, which is why it is returned by process_lit. @param zone_name (string): path to the zone ascii input file. This file has the same treatment as the one above. @param weir_name (string): path to the weir ascii input file. This file has the same treatment as the one above. @param fmtgeom (string): format of the geometry file (serafin, serafind, med) @param i_part (int): type of partitionner, 1:metis; 2: scotch @param concat (boolean): If output is concatenate @return void """ partel_input = 'partel_' + par_file + '.par' partel_log = 'partel_' + par_file + '.log' put_file_content(partel_input, [ par_file, file_format, conlim, str(ncsize), str(i_part), section_name, zone_name, weir_name, geom, fmtgeom, concat, '' ]) par_cmd = partel.replace('<partel.log>', partel_log)\ .replace('<partel.par>', partel_input).split(';') mes = Messages(size=10) for par in par_cmd: print(' +> ' + par) tail, code = mes.run_cmd(par, bypass) if code != 0: if path.exists(partel_log): log = "Here is the log:\n"+ \ '\n'.join(get_file_content(partel_log)) else: log = "No log available check command:\n" + par_cmd raise TelemacException(\ 'Could not split your file '+par_file\ +' with the error as follows:'\ +'\n '+tail\ +'\n\n'+log)
def get_lqd(file_name): # ~~ Get all ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ core = get_file_content(file_name) # ~~ Parse head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ icore = 0 while re.match(LQD_HEADER, core[icore]): icore += 1 head = core[0:icore] # /!\ icore starts the body # ~~ Parse variables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ jcore = icore + 1 while icore < len(core) and jcore < len(core): if re.match(LQD_HEADER, core[icore]): icore += 1 jcore += 1 continue if re.match(LQD_HEADER, core[jcore]): jcore += 1 continue core[icore].replace(',', ' ') core[jcore].replace(',', ' ') # ~~> Variable header if core[icore].split()[0].upper() != 'T': raise TelemacException(\ '\nThought I would find T for this LQD file on ' 'this line: {}'.format(core[icore])) if len(core[icore].split()) != len(core[jcore].split()): raise TelemacException(\ '\nThought I to corresponding units for this LQD file on ' 'this line: {}'.format(core[jcore])) vrs = zip(core[icore].upper().split(), core[jcore].upper().split()) # ~~ Size valid values ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ icore = jcore + 1 while icore < len(core): if not re.match(LQD_HEADER, core[jcore]): icore += 1 # ~~ Parse body ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # This is also fairly fast, so you might not need a progress bar time = np.zeros(jcore - icore) z = np.zeros(len(vrs) - 1, jcore - icore) itime = 0 for icore in core[jcore + 1:]: if re.match(LQD_HEADER, icore): continue values = icore.replace(',', ' ').split() time[itime] = float(values[0]) for ivar in range(len(values[1:])): z[itime][ivar] = float(values[ivar]) return head, vrs[1:], time, z
def run_gretel(gretel, gre_file, file_format, geom, geo_format, bnd, ncsize, nplan, method=1, bypass=False): """ @brief Runs GRETEL, the functions that merges results @param gretel (string): the path of gredel @param gre_file (string): the name of the GRETEL file @param file_format (string): format of the GRETEL file @param geom (string): name of the geometry file @param geo_format (string): format of the geometry file @param bnd (string): name of the boundary file @param ncsize (int): number of processors @param nplan (int): number of vertical layers @param method (int): method for data merging @param bypass (boolean): continue execution after exception was raised if True, kill the execution otherwise @return None """ # ~~ Run GRETEL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gretel_par = 'gretel_' + gre_file + '.par' gretel_log = 'gretel_' + gre_file + '.log' put_file_content(gretel_par, [ geom, geo_format, bnd, gre_file, file_format, str(ncsize), str(nplan), str(method) ]) mes = Messages(size=10) cmd = '{} < {} >> {}'.format(gretel, gretel_par, gretel_log) print(' +> ' + cmd) tail, code = mes.run_cmd(cmd, bypass) if code != 0: if path.exists(gretel_log): log = "Here is the log:\n" + \ '\n'.join(get_file_content(gretel_log)) else: log = "No log available check command:\n" + cmd raise TelemacException('Could not split your file ' + gre_file + ' (runcode=' + str(code) + ') with the error as follows:' + '\n ' + tail + '\n\n' + log)
def run_hpc_exe(self, options, job_id=''): """ Run only the execution of telemac-mascaret executable in job scheduler @return job_id (integer) Id of the job that was launched """ # /!\ This is being done in parallel when multiple cas_files # if not hpcpass: chdir(self.working_dir) # ~~> HPC Command line launching runcode hpccmd = get_hpc_cmd(self.cfg['HPC']).replace('<root>', self.cfg['root']) hpccmd = hpccmd.replace('<wdir>', self.working_dir) if 'id_log' in options: hpccmd = hpccmd.replace('<id_log>', options.id_log) else: hpccmd = hpccmd.replace('<id_log>', 'id.log') # ~~> HPC dependency between jobs hpcjob = get_hpc_depend(self.cfg['HPC']) if hpcjob != '' and job_id != '': hpccmd = hpccmd + ' ' + hpcjob.replace('<jobid>', job_id) # ~~> HPC queueing script stdin_file = self.cfg['HPC']['STDIN'][0] # only one key for now stdin = self.cfg['HPC']['STDIN'][1] stdin, sortie = self.fill_hpc_stdin(stdin, options) # working from working dir stdin = stdin.replace('<wdir>', self.working_dir) # ~~> Recreate the <mpi_exec> (option --hpc) stdin = stdin.replace('<exename>', self.run_cmd) # /!\ serial mode stdin = stdin.replace('<mpi_cmdexec>', self.run_cmd) # ~~> Write to HPC_STDIN chdir(self.working_dir) put_file_content(stdin_file, stdin.split('\n')) # ~~> here you go run run_code(hpccmd, sortie) job_id = get_file_content(sortie)[0].strip() print('... Your simulation (' + self.steering_file + ') has been launched through the queue.\n') print(' +> You need to wait for completion before re-collecting' 'files using the option --merge\n') return job_id
def __init__(self, file_name): # ~~> Read the steering file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if not path.exists(file_name): raise TelemacException( '... Could not file your DELWAQ file: ' '{}'.format(file_name)) self.dwq_list = self.parse_dwq(get_file_content(file_name)) # ~~> Read the geometry file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fle = self.dwq_list['grid-indices-file'] if not path.exists(fle): raise TelemacException( '...Could not find the GEO file: ' '{}'.format(fle)) self.geo = Selafin(fle) self.npoin3 = int(self.dwq_list['grid-cells-first-direction']) if self.npoin3 != self.geo.npoin3: raise TelemacException( '...In consistency in numbers with GEO file: ' '{} {}'.format(str(self.npoin3), str(self.geo.npoin3))) self.nseg3 = int(self.dwq_list['grid-cells-second-direction']) # ~~> Read the Conlim file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fle = self.dwq_list['grid-coordinates-file'] if not path.exists(fle): raise TelemacException( '...Could not find the Conlim file: ' '{}'.format(fle)) self.conlim = Conlim(fle) # ~~> Time records ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ self.hydro0t = int(self.dwq_list['hydrodynamic-start-time']) self.hydroat = int(self.dwq_list['hydrodynamic-stop-time']) self.hydrodt = int(self.dwq_list['hydrodynamic-timestep']) self.hydroit = 1 + (self.hydroat-self.hydro0t) / self.hydrodt self.hydro00 = 0 self.tfrom = self.hydro0t self.tstop = self.hydroat self.minvol = None
def compile_doxygen(doxy_file, verbose): """ Compile a doxygen documentation @param doxy_file name of the doxygen file to use @param verbose If True display doxygen listing """ doxy_dir = path.dirname(doxy_file) chdir(doxy_dir) if verbose: cmd = "doxygen {}".format(doxy_file) else: cmd = "doxygen {} >Doxygen_run.log 2>&1 ".format(doxy_file) print(" ~> Generating doxygen documentation for " + doxy_file) # Running convertion mes = Messages(size=10) tail, code = mes.run_cmd(cmd, bypass=False) if code != 0: if verbose: log = '' else: log = '\noutput:\n{}'.format(\ '\n'.join(get_file_content('Doxygen_run.log')[-20:])) raise TelemacException(\ 'Doxygen failed\n{}\n{}'\ .format(tail, log)) html_file = path.join(doxy_dir, 'html', 'index.html') print(" To see documentation run (replace firefox by your "\ "internet browser):\n firefox {}".format(html_file)) doxy_warning_log = path.join(doxy_dir, 'Doxygen_warning.log') if stat(doxy_warning_log).st_size != 0: print('There seems to be some doxygen warnings see:\n{}'\ .format(doxy_warning_log))
def __init__(self, file_name): """ @brief Initializes the Conlim object @param file_name (string): name of the boundary conditions file @return None """ self.file_name = file_name # ~~> Columns of integers and floats dtype = np.dtype = [('lih', '<i4'), ('liu', '<i4'), ('liv', '<i4'), ('h', '<f4'), ('u', '<f4'), ('v', '<f4'), ('au', '<f4'), ('lit', '<i4'), ('t', '<f4'), ('at', '<f4'), ('bt', '<f4'), ('n', '<i4'), ('line', '<i4')] if file_name != '': # ~~> Number of boundary points ( tuple() necessary for dtype # parsing ) core = [ tuple(line.strip().split()[0:13]) for line in get_file_content(file_name) ] self.nptfr = len(core) self.bor = np.array(core, dtype) # ~~> Dictionary of kfrgl self.kfrgl = dict(zip(self.bor['n'] - 1, range(self.nptfr))) # ~~> Filtering indices self.index = np.array(range(self.nptfr), dtype=np.int) else: self.nptfr = 0 self.bor = None self.kfrgl = None self.index = None self.nptir = 0 self.ifapar = None self.por = None self.nfrliq = 0
def main(): """ Main function of doxygenTELEMAC """ bypass = False # /!\ Temporary bypass for subroutine within programs # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Reads config file ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('\n\nLoading Options and Configurations\n'+'~'*72+'\n') parser = ArgumentParser(\ formatter_class=RawDescriptionHelpFormatter, description=('''\n Generate the DOXYGEN documentation of the whole TELEMAC system. '''), usage=' (--help for help)\n---------\n => '\ '%(prog)s [options] \n---------') parser = add_config_argument(parser) parser.add_argument(\ "-d", "--doxydir", dest="doxyDir", default='', help="specify the root, default is taken from config file") parser.add_argument(\ "-m", "--modules", dest="modules", default='', help="specify the list modules, default is taken from config file") options = parser.parse_args() # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Environment ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ update_config(options) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ banners ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ svn_banner(CFGS.get_root()) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Works for one configuration only ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Works for only one configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cfg = CFGS.configs[CFGS.cfgname] # still in lower case if options.modules != '': cfg['modules'] = options.modules.replace(',', ' ')\ .replace(';', ' ')\ .replace('.', ' ') if options.doxyDir == '': cfg.update({'doxydocs':path.join(cfg['root'], 'documentation', CFGS.cfgname)}) else: cfg.update({'doxydocs':options.doxyDir}) if not path.isdir(cfg['doxydocs']): create_directories(cfg['doxydocs']) # parsing for proper naming CFGS.compute_doxy_info() print('\n\nScanning the source code for:\n'+'~'*72+'\n') CFGS.light_dump() # ~~ Scans all source files to build a relation database ~~ fic, _, _, _, _, _, _, racine = scan_sources(CFGS.cfgname, cfg, bypass) # ~~ Scann all source files to update Doxygen ~~~~~~~~~~~~~~~~ for mod in fic: print('\nCreating the DOXYGEN headers for ' + mod + '\n'+'~'*72+'\n') for ifile in fic[mod]: # ~~ Read the content of the source file ~~~~~~~~~~~~ ilines = get_file_content(ifile) # ~~ Update its Doxygen content ~~~~~~~~~~~~~~~~~~~~~ olines = create_doxygen(ifile, ilines, mod, racine) # ~~ Make sure the distination exists ~~~~~~~~~~~~~~~ ofile = ifile.replace(cfg['root'], cfg['doxydocs']) create_directories(path.dirname(ofile)) # ~~ Write the content of the source file ~~~~~~~~~~~ put_file_content(ofile, olines) # ~~ Run Doxygen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('\nNow running DOXYGEN within ' + cfg['doxydocs'] + '\n'+'~'*72+'\n') chdir(cfg['doxydocs']) if not path.exists(cfg['cmd_doxygen']): raise Exception('Do not know where to find {}\n ' '... you can correct this through the key ' 'cmd_doxygen in your configuration file' ''.format(cfg['cmd_doxygen'])) if sp.call([cfg['cmd_doxygen']]): raise Exception # ~~ Scan all HTML files and replace template in phases replace_doxygen(path.join(cfg['doxydocs'], 'html')) # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< # ~~~~ Jenkins' success message ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ print('\n\nMy work is done\n\n') sys.exit(0)
def replace_doxygen(doxydocs): """ Replace all the information required for the Documentation of TELEMAC (in htlm) preparing for Doxygen @param doxydocs(string) path to search the command of DOXYGENE """ i_txt_lst = [('<!DOCTYPE HTML PUBLIC', '<BODY BGCOLOR="#FFFFFF">'), ('<DIV class="div-page">', '<hr>'), ('<div class="header">', '<div class="summary">'), ('<hr>\n<div class="div-footer">', '</html>'), ('<dl class="user"><dt><', '>'), \ ('</b></dt><d', 'd><br/>')] o_txt_lst = [r"""<!DOCTYPE install PUBLIC "-//Joomla! 2.5//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/1.6/template-install.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="keywords" content="open, telemac, mascaret, hydraulique, surface libre, houle, vague, hydraulic, free surface, wave, sediment" /> <meta name="robots" content="index, follow" /> <meta name="date" content="2013-07-24T16:49:04+0100"/> <meta name="description" content="The open TELEMAC-MASCARET system is a set of software for free surface numerical modelling of:\n* 2D, 3D Hydrodynamics,\n* Sediment (sand and muds),\n* Waves." /> <title>The open TELEMAC-MASCARET system: 2D, 3D hydrodynamics sediment waves simulation system</title> <link rel="shortcut icon" href="./images/favicon.ico" type="image/vnd.microsoft.icon" /> <script src="./images/jquery-1.4.2.min.js" type="text/javascript"></script> <link rel="stylesheet" href="./images/system.css" type="text/css" /> <link rel="stylesheet" href="./images/position.css" type="text/css" media="screen,projection" /> <link rel="stylesheet" href="./images/layout.css" type="text/css" media="screen,projection" /> <link rel="stylesheet" href="./images/general.css" type="text/css" /> <link rel="stylesheet" href="./images/principal.css" type="text/css" /> <style type="text/css"> #ahgalleryOTconsortium { margin-left: auto; margin-right: auto; margin-top: 0px !important; margin-bottom: 0px !important; width: 1000px; } #ahgalleryOTconsortium ul.hover_block0, #ahgalleryOTconsortium ul.hover_block1, #ahgalleryOTconsortium ul.hover_block2 { display: block; overflow: hidden; padding-top: 20px; padding-left: 2px; background: transparent; margin-left: 2px; margin-top: 0 !important; margin-bottom: 0 !important; } #ahgalleryOTconsortium ul.bottom_block { padding-bottom: 20px ; } #ahgalleryOTconsortium ul.hover_block0 li.item, #ahgalleryOTconsortium ul.hover_block1 li.item, #ahgalleryOTconsortium ul.hover_block2 li.item { margin-left: 0; padding-left: 0; list-style:none; list-style-position: inside; float:left; background: transparent; width: 150px; position: relative; } #ahgalleryOTconsortium ul.hover_block0 li a.teaser, #ahgalleryOTconsortium ul.hover_block1 li a.teaser , #ahgalleryOTconsortium ul.hover_block2 li a.teaser{ display: block; position: relative; overflow: hidden; height: 60px; width: 130px; padding: 1px; } #ahgalleryOTconsortium ul.hover_block0 li div.teaser, #ahgalleryOTconsortium ul.hover_block1 li div.teaser , #ahgalleryOTconsortium ul.hover_block2 li div.teaser { display: block; position: relative; overflow: hidden; height: 60px; width: 140px; padding: 1px; } #ahgalleryOTconsortium ul.hover_block0 li img.overlay, #ahgalleryOTconsortium ul.hover_block1 li img.overlay, #ahgalleryOTconsortium ul.hover_block2 li img.overlay { margin: 0; position: absolute; top: 5px; left: 0; border: 0; } </style> <script type="text/javascript" src="./images/hide.js"></script> <script type="text/javascript"> window.addEvent(\'load\', function() { new JCaption(\'img.caption\'); }); window.addEvent(\'domready\', function() { $$(\'.hasTip\').each(function(el) { var title = el.get(\'title\'); if (title) { var parts = title.split(\'::\', 2); el.store(\'tip:title\', parts[0]); el.store(\'tip:text\', parts[1]); }}); var JTooltips = new Tips($$(\'.hasTip\'), \ { maxTitleChars: 50, fixed: false}); }); </script> <link href="./images/tabsVTK.css" rel="stylesheet" type="text/css"/> <link href="./images/searchVTK.css" rel="stylesheet" type="text/css"/> <script type="text/javaScript" src="./images/searchVTK.js"></script> <link href="./images/doxygenVTK.css" rel="stylesheet" type="text/css"/> </HEAD> <BODY BGCOLOR="#FFFFFF">""",\ """<div id="all"> <div id="header"> <div class="logoheader"> <h1 id="logo">open TELEMAC-MASCARET <span class="header1">The mathematically superior suite of solvers</span></h1> </div> <div class="bar-top" > <ul class="menu"> <li><a href="http://www.opentelemac.org/" ><img src="./images/OTM_Home-icon_15pix_212-118-0.png" alt="Home" /><span class="image-title">Home</span> </a></li> <li><a href="http://www.opentelemac.org/index.php/contact2"><img src="./images/OTM_Mail-icon_15pix_212-118-0.png" alt="Contact"/><span class="image-title">CONTACT</span> </a></li> <li><span class="separator"><img src="./images/OTM_transparent_15x080pix.png" /><img src="./images/OTM_transparent_15x080pix.png" /></span></li> <li><a href="http://www.opentelemac.org/index.php/community"><span class="image-title">COMMUNITY</span> </a></li> <li><a href="http://www.opentelemac.org/index.php/user-conference"><span class="image-title">CONFERENCE</span> </a></li> <li><a href="http://www.opentelemac.org/index.php/download"><span class="image-title">DOWNLOAD</span> </a></li> <li><a href="http://docs.opentelemac.org/" style="color:#333;background:#ffd1a3;padding:10px;"><span class="image-title">DOXY DOCS</span> </a></li> <li><a href="http://www.opentelemac.org/index.php/kunena"><span class="image-title">FORUM</span> </a></li> <li><a href="http://wiki.opentelemac.org/doku.php"><span class="image-title">WIKI</span> </a></li> </ul> </div> </div> <!-- Generated by Doxygen 1.7.0 --> <script type="text/javascript"> function hasClass(ele,cls) { return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)')); } function addClass(ele,cls) { if (!this.hasClass(ele,cls)) ele.className += " "+cls; } function removeClass(ele,cls) { if (hasClass(ele,cls)) { var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)'); ele.className=ele.className.replace(reg,' '); } } function toggleVisibility(linkObj) { var base = linkObj.getAttribute('id'); var summary = document.getElementById(base + '-summary'); var content = document.getElementById(base + '-content'); var trigger = document.getElementById(base + '-trigger'); if ( hasClass(linkObj,'closed') ) { summary.style.display = 'none'; content.style.display = 'block'; trigger.src = 'open.png'; removeClass(linkObj,'closed'); addClass(linkObj,'opened'); } else if ( hasClass(linkObj,'opened') ) { summary.style.display = 'block'; content.style.display = 'none'; trigger.src = 'closed.png'; removeClass(linkObj,'opened'); addClass(linkObj,'closed'); } return false; } </script> <br>""",\ """<div id="main" > <div class="header" > <div class="summary" >""",\ """<br> </div></div> <h2 class="unseen">Generated on Fri Aug 31 2013 18:12:58 by S.E.Bourban (HRW) using <A href="http://www.doxygen.org/index.html"><img class="footer" width=70px src="doxygen.png" alt="doxygen"/></A> 1.7.0</h2> <div id="footer-outer" ><div id="footer-inner"><div id="bottom"><div class="box box1"><div class="moduletable"> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function($) { $('#ahgalleryOTconsortium ul.hover_block0 li.item').hover(function(){ $(this).find('img.overlay').animate({top:'60px'},{queue:false,duration:500}); }, function(){ $(this).find('img.overlay').animate({top:'5px'},{queue:false,duration:500}); }); }); </script> <div id="ahgalleryOTconsortium"> <ul class="hover_block0 bottom_block"> <li class="item"><a class="teaser" style="background-color:transparent !important; font-weight: normal; text-decoration: none;" href="http://www.arteliagroup.com/" target="_blank"><img class="overlay" src="./images/Sogreah-Artelia.jpg" alt="" /> <span style="color:grey; font-size: 14px; font-weight: bold; line-height: 18px; font-family: arial; margin-bottom: 0.5em; margin-top: 0.5em; display: block; text-align: center;">Artelia</span> <span style="color:white; display: block; font-size: 12px; font-weight: normal; font-family: arial; margin-bottom: 0.5em; margin-top: 0.5em;"></span></a></li> <li class="item"><a class="teaser" style="background-color:transparent !important; font-weight: normal; text-decoration: none;" href="http://www.baw.de/de/index.php.html" target="_blank"><img class="overlay" src="./images/logo_baw.png" alt="" /> <span style="color:grey; font-size: 14px; font-weight: bold; line-height: 18px; font-family: arial; margin-bottom: 0.5em; margin-top: 0.5em; display: block; text-align: center;">BundesAnstalt fur Wasserbau</span> <span style="color:white; display: block; font-size: 12px; font-weight: normal; font-family: arial; margin-bottom: 0.5em; margin-top: 0.5em;"></span></a></li> <li class="item"><a class="teaser" style="background-color:transparent !important; font-weight: normal; text-decoration: none;" href="http://www.cetmef.equipement.gouv.fr/" target="_blank"><img class="overlay" src="./images/logo_cetmef_v2.png" alt="" /> <span style="color:grey; font-size: 14px; font-weight: bold; line-height: 18px; font-family: arial; margin-bottom: 0.5em; margin-top: 0.5em; display: block; text-align: center;">CETMEF</span> <span style="color:white; display: block; font-size: 12px; font-weight: normal; font-family: arial; margin-bottom: 0.5em; margin-top: 0.5em;"></span></a></li> <li class="item"><a class="teaser" style="background-color:transparent !important; font-weight: normal; text-decoration: none;" href="http://www.stfc.ac.uk/About%20STFC/45.aspx" target="_blank"><img class="overlay" src="./images/logo_Daresbury_v3.gif" alt="" /> <span style="color:grey; font-size: 14px; font-weight: bold; line-height: 18px; font-family: arial; margin-bottom: 0.5em; margin-top: 0.5em; display: block; text-align: center;">Daresbury Laboratory</span> <span style="color:white; display: block; font-size: 12px; font-weight: normal; font-family: arial; margin-bottom: 0.5em; margin-top: 0.5em;"></span></a></li> <li class="item"><a class="teaser" style="background-color:transparent !important; font-weight: normal; text-decoration: none;" href="http://research.edf.com/research-and-innovation-44204.html&tab=44205" target="_blank"><img class="overlay" src="./images/logo_edfR&D.jpg" alt="" /> <span style="color:grey; font-size: 14px; font-weight: bold; line-height: 18px; font-family: arial; margin-bottom: 0.5em; margin-top: 0.5em; display: block; text-align: center;">EDF R&D</span> <span style="color:white; display: block; font-size: 12px; font-weight: normal; font-family: arial; margin-bottom: 0.5em; margin-top: 0.5em;"></span></a></li> <li class="item"><a class="teaser" style="background-color:transparent !important; font-weight: normal; text-decoration: none;" href="http://www.hrwallingford.com" target="_blank"><img class="overlay" src="./images/logo_HRW.png" alt="" /> <span style="color:grey; font-size: 14px; font-weight: bold; line-height: 18px; font-family: arial; margin-bottom: 0.5em; margin-top: 0.5em; display: block; text-align: center;">HR Wallingford</span> <span style="color:white; display: block; font-size: 12px; font-weight: normal; font-family: arial; margin-bottom: 0.5em; margin-top: 0.5em;"></span></a></li> </ul></div> <div class="clr"></div> </div></div> </div></div> <div id="footer-sub"><div id="footer"> <ul class="menu"> <li class="item-187"><a href="http://www.opentelemac.org/index.php/forum-rules" >Forum rules</a></li> <li class="item-111"><a href="http://www.opentelemac.org/index.php/licence" >Licence</a></li> <li class="item-112"><a href="http://www.opentelemac.org/index.php/privacy" >Privacy</a></li> <li class="item-112"><a href="http://www.opentelemac.org/index.php/terms-and-conditions" >Terms & Conditions</a></li> </ul> </div> </div></div> </body></html>""",\ '<dl class="user"><dt><h3><b>',\ '</b></h3></dt><dd><br/>'] text = r'(?P<before>[\s\S]*?)(?P<text>%s)(?P<after>[\s\S]*)' if path.exists(doxydocs): dirpath, _, filenames = next(walk(doxydocs)) for fle in filenames: _, tail = path.splitext(fle) if tail == '.html': print(' +> '+fle) lines = ''.join(get_file_content(path.join(dirpath, fle))) proc = True while proc: proc = False for itext, otext in zip(i_txt_lst, o_txt_lst): proc0 = re.match(re.compile(text%(itext[0]), re.I), \ lines) if proc0: bfr = proc0.group('before') proc1 = re.match(re.compile(text%(itext[1]), re.I), proc0.group('after')) if proc1: proc = True aftr = proc1.group('after') lines = bfr + otext + aftr #print('replacing: ', # proc0.group('text')+ \ # proc1.group('before')) put_file_content(path.join(dirpath, fle), [lines]) return
def run_hpc_full(self, options, job_id=''): """ Rerun whole script in jpbscheduler @return job_id (integer) Id of the job that was launched """ chdir(self.working_dir) # ~~> HPC Command line launching runcode hpccmd = get_hpc_cmd(self.cfg['HPC']).replace('<root>', self.cfg['root']) hpccmd = hpccmd.replace('<wdir>', self.working_dir) # ~~> HPC dependency between jobs hpcjob = get_hpc_depend(self.cfg['HPC']) if hpcjob != '' and job_id != '': hpccmd = hpccmd + ' ' + hpcjob.replace('<jobid>', job_id) # ~~> HPC queueing script stdin_file = self.cfg['HPC']['STDIN'][0] # only one key for now stdin = self.cfg['HPC']['STDIN'][1] stdin = stdin.replace('<exename>', self.steering_file) # Replacing tags by options values stdin, sortie = self.fill_hpc_stdin(stdin, options) # Building runcode.py command runcmd = 'runcode.py ' + self.code_name + ' --mpi ' if options.config_name != '': runcmd = runcmd + ' -c ' + options.cfgname if options.config_file != '': runcmd = runcmd + ' -f ' + options.config_file if options.root_dir != '': runcmd = runcmd + ' -r ' + options.root_dir runcmd = runcmd + ' -s ' if options.tmpdirectory: runcmd = runcmd + ' -t ' runcmd = runcmd + ' -w ' + self.working_dir runcmd = runcmd + ' --nctile ' + str(self.nctile) runcmd = runcmd + ' --ncnode ' + str(self.ncnode) runcmd = runcmd + ' --ncsize ' + str(self.ncsize) if options.split: runcmd = runcmd + ' --split ' if options.compileonly: runcmd = runcmd + ' -x ' if options.merge: runcmd = runcmd + ' --merge ' if options.run: runcmd = runcmd + ' --run ' runcmd = runcmd + ' ' + self.steering_file stdin = stdin.replace('<py_runcode>', runcmd) # ~~> Write to HPC_STDIN chdir(self.working_dir) put_file_content(stdin_file, stdin.split('\n')) # ~~> here you go run run_code(hpccmd, sortie) job_id = get_file_content(sortie)[0].strip() print('... Your simulation ('+self.steering_file+\ ') has been launched through the queue.\n') print(' +> You need to wait for completion '\ 'before checking on results.\n') return job_id
def process_executable(working_dir, pbin, plib, pobj, system, trace, code_name): """ @brief Process the excecutable including: - checking the presence and the validity of the current executable - if necessary, copying the FORTRAN files in the temporary directory - if necessary, compiling the FORTRAN into the executable The background of this function sits where the CAS file is @param cas (string): Everything that touches the CAS file. @param pbin (string): Location of the default executables @param plib (string): location of the associated libs (and cmdx files) @param pobj (string): location of the associated objs (and cmdo files) @param trace: @param code_name (string): Name of the module @return exe_fort: name of the executable whether copied or compiled and a @note even in case of coupling, the principal executable remains @note possible fortran files may or may not be associated with the principal code and may be files or directories @note If the executable exist, and that the user fortran files have not changed and that the system has not been recompiled, then the executable remains valid @note The name of the executable is taken to be based on the name defined by the user, i.e. the name of the PRINCI whether it is a file or a directory. @note - exe_file: The name of the default executable as well as the system preference for that file extension - ori_file: The user define name of the executable, based on the name of the FORTRAN FILE whether a file or a directory. - use_name,obj_name,f90_name,obj_cmd,exe_cmd """ # ~~ exception error, if any mes = Messages(size=10) # ~~ saving current location curdir = getcwd() # ~~ default executable (no user defined fortran file(s) exe_file = path.join(pbin, code_name + system['sfx_exe']) if not path.exists(exe_file): raise TelemacException(\ '\nNot able to find your default executable: ' + \ exe_file + '\n' + \ '\n ... you have to compile this module at least: '+\ code_name) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~> All user fortran have been copied in user_fortran # ori_fort = [] tmp_fortran_dir = path.join(working_dir, "user_fortran") if path.exists(tmp_fortran_dir): # Sort them to force order of compilation for f in sorted(listdir(tmp_fortran_dir)): # If we found a compiled file removing it if f.endswith(system['sfx_obj']): remove(path.join(tmp_fortran_dir, f)) else: ori_fort.append(path.join(tmp_fortran_dir, f)) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~> Getting name of executable in working dir # # ~~ case of user fortran if ori_fort != []: # wir_fort working sub-directory, locally contain all user fortran files use_file = 'out_user_fortran' + system['sfx_exe'] # # ~~ without user fortran else: # ~~ default executable use_file = 'out_' + code_name + system['sfx_exe'] exe_fort = path.join(working_dir, use_file) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # copy the default executable if ori_fort == []: shutil.copy2(exe_file, exe_fort) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ else: # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~> Compiling fortran file(s) # ~~ default command line for compilation of obects cmdo_file = path.join(pobj, code_name + '.cmdo') if not path.exists(cmdo_file): raise TelemacException(\ '\nNot able to find your OBJECT command line: ' + \ cmdo_file + '\n' + \ '\n ... you have to compile this module at least: '+\ code_name) obj_cmd = get_file_content(cmdo_file)[0] # ~~ make the keys portable (no full path) for k in trace: obj_cmd = obj_cmd.replace('[' + k + ']', path.normpath(trace[k])) # ~~ into local compilation chdir(tmp_fortran_dir) print(' > compiling objs') # ~~ compilation one file at a time objs = [] # Reordonning user fortran to compile module first # Are considered modules files beginning the letter m user_files = [] tmp = [] for f90 in ori_fort: # /!\ TODO avoid using hard-coded explicit assumptions # use get_principal_wrap_names(f90)[0], or better, # scan the local user tree if f90.lower()[0] == "m": user_files.append(f90) else: tmp.append(f90) user_files.extend(tmp) # Looping on ordered fortran files for f90 in user_files: print(' compiling: ' + path.basename(f90), end='') tail, code = mes.run_cmd(obj_cmd.replace('<f95name>', f90), False) if code != 0: raise TelemacException(\ 'Could not compile your FORTRAN (runcode='+\ str(code)+').\n '+tail) print(' ... completed') objs.append(path.splitext(f90)[0] + system['sfx_obj']) # ~~ default command line for linkage into an executable cmdx_file = path.join(plib, code_name + '.cmdx') if not path.exists(cmdx_file): raise TelemacException(\ '\nNot able to find your EXECUTE command line: '\ + cmdx_file + '\n'\ + '\n ... you have to compile this module '\ 'at least: ' + code_name) exe_cmd = get_file_content(cmdx_file)[0] # ~~ make the keys portable (no full path) for k in trace: exe_cmd = exe_cmd.replace('[' + k + ']', path.normpath(trace[k])) exe_cmd = exe_cmd.replace('<objs>', ' '.join(objs))\ .replace('<exename>', '"'+exe_fort+'"') tail, code = mes.run_cmd(exe_cmd, False) if code != 0: raise TelemacException(\ 'Could not link your executable (runcode='+\ str(code)+').\n '+tail) print(' created: ' + path.basename(exe_fort)) # ~~ out of local compilation chdir(curdir) return exe_fort
def compiletex(texfile, version, verbose): """ @brief Full procedure for compiling a LaTeX file .i.e pdflatex,bibtex,pdflatex,pdflatex @param texfile Name of the main LaTex file @param version Version of the code/documentation @param verbose If yes display pdflatex listing """ if verbose: tex_cmd = "pdflatex --jobname={tex}_{version} {tex}.tex"\ .format(tex=texfile, version=version) bib_cmd = "bibtex {}_{}.aux".format(texfile, version) else: tex_cmd = \ "pdflatex --jobname={tex}_{version} {tex}.tex >latex_run.log 2>&1"\ .format(tex=texfile, version=version) bib_cmd = "bibtex {}_{}.aux >bib_run.log 2>&1".format(texfile, version) # First compilation mes = Messages(size=10) tail, code = mes.run_cmd(tex_cmd, False) if code != 0: if verbose: log = '' else: log = '\noutput:\n{}'.format(\ '\n'.join(get_file_content('latex_run.log')[-20:])) raise TelemacException(\ 'Latex compilation failed\n{}\n{}'\ .format(tail, log)) # Bibtex compilation tail, code = mes.run_cmd(bib_cmd, False) # Forcing bibtex to pass code = 0 if code != 0: if verbose: log = '' else: log = '\noutput:\n{}'.format(\ '\n'.join(get_file_content('latex_run.log')[-20:])) raise TelemacException(\ 'Latex compilation failed\n{}\n{}'\ .format(tail, log)) # Second compilation tail, code = mes.run_cmd(tex_cmd, False) if code != 0: if verbose: log = '' else: log = '\noutput:\n{}'.format(\ '\n'.join(get_file_content('bib_run.log')[-20:])) raise TelemacException(\ 'Latex compilation failed\n{}\n{}'\ .format(tail, log)) # Third compilation tail, code = mes.run_cmd(tex_cmd, False) if code != 0: if verbose: log = '' else: log = '\noutput:\n{}'.format(\ '\n'.join(get_file_content('latex_run.log')[-20:])) raise TelemacException(\ 'Latex compilation failed\n{}\n{}'\ .format(tail, log))
def get_insel(file_name): # ~~ Get all ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ core = get_file_content(file_name) if not re.match(DAT_FOOTER, core[len(core) - 1]): raise TelemacException('\nCould not parse the following ' 'end line of the file: {}'.format( core[len(core) - 1])) # ~~ First scan at INSEL and DAMM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # This is also fairly fast, so you might not need a progress bar core.pop(len(core) - 1) poly = [] vals = [] typ = [] npoin = 0 iline = 0 xyi = [] val = [] file_type = True while iline < len(core): proco = re.match(DAT_OPENH, core[iline]) if proco: time = 0 procc = re.match(DAT_CLOSH, core[iline]) if procc: time = 1 if proco or procc: iline += 1 if xyi != []: poly.append(xyi) npoin += len(xyi) typ.append(time) vals.append(val) xyi = [] val = [] else: proc = re.match(VAR_3DBL, core[iline].strip()) if proc: xyi.append((proc.group('number1'), proc.group('number2'))) val.append(proc.group('number3')) else: file_type = False proc = re.match(VAR_2DBL, core[iline].strip()) if proc: xyi.append((proc.group('number1'), proc.group('number2'))) val.append('') else: raise TelemacException('\nCould not parse the following ' 'polyline record: {}'.format( core[iline])) iline += 1 poly.append(xyi) npoin += len(xyi) typ.append(time) vals.append(val) # ~~ Second scan at INSEL and DAMM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # This is also fairly fast, so you might not need a progress bar if file_type: for pline in range(len(poly)): for iline in range(len(poly[pline])): x, y, val = poly[pline][iline] poly[pline][iline] = [float(x), float(y)] vals[pline][iline] = [float(val)] poly[pline] = np.asarray(poly[pline]) else: for pline in range(len(poly)): for iline in range(len(poly[pline])): x, y = poly[pline][iline] poly[pline][iline] = [float(x), float(y)] poly[pline] = np.asarray(poly[pline]) vals = [] return file_type, npoin, poly, vals, typ
def parser_content(self, file_name): # TODO: Read the whole header # ~~ Get all ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ core = get_file_content(file_name) # ~~ Parse head ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ icore = 0 self.atrbut = {} self.natrbut = 0 self.oatrbut = [] while re.match(KEN_HEADER, core[icore].strip()): # ~~> instruction FileType proc = re.match(ASC_FILE_TYPE, core[icore].strip()) if proc: self.file_type = proc.group('type').lower() # ~~> instruction AttributeName proc = re.match(ASC_ATTRIBUTE_NAME, core[icore].strip()) if proc: self.natrbut += 1 if self.natrbut == int(proc.group('number')): self.oatrbut.append(proc.group('after').strip()) self.atrbut.update({self.oatrbut[-1]: []}) else: raise TelemacException( '... Could not read the order of your Attributes: ' '{}'.format(core[icore])) # ... more instruction coming ... icore += 1 self.head = core[0:icore] # /!\ icore starts the body # ~~ Parse body ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # This is also fairly fast, so you might not need a progress bar self.poly = [] self.vals = [] self.type = [] self.npoin = 0 while icore < len(core): if core[icore].strip() == '': icore += 1 continue # ~~> polygon head proc = re.match(VAR_1INT, core[icore].strip()) if not proc: raise TelemacException( '\nCould not parse the following polyline header: ' '{}'.format(core[icore].strip())) nrec = int(proc.group('number')) after = proc.group('after').strip().split() if len(after) != self.natrbut: if self.natrbut != 0: raise TelemacException( '... Could not find the correct number of attribute:' '{}, {} expected'.format(core[icore].strip(), self.natrbut)) else: self.natrbut = len(after) self.oatrbut = range(1, len(after)+1) self.atrbut = \ dict([(i+1, [after[i]]) for i in range(len(after))]) else: for i in range(len(self.oatrbut)): self.atrbut[self.oatrbut[i]].append(after[i]) xyi = [] val = [] icore += 1 for irec in range(nrec): nbres = core[icore+irec].strip().split() proc = re.match(VAR_1DBL, nbres[0]) if not proc: proc = re.match(VAR_1INT, nbres[0]) if not proc: raise TelemacException( '\nCould not parse the following polyline record: ' '{}'.format(core[icore+irec].strip())) nbres[0] = float(proc.group('number')) procd = re.match(VAR_1DBL, nbres[1]) proci = re.match(VAR_1INT, nbres[1]) if procd: nbres[1] = float(procd.group('number')) elif proci: nbres[1] = float(procd.group('number')) xyi.append(nbres[:2]) val.append(nbres[2:]) if xyi != []: cls = 0 if is_close(xyi[0], xyi[len(xyi)-1], size=10): xyi.pop(len(xyi)-1) val.pop(len(val)-1) cls = 1 self.poly.append(np.asarray(xyi, dtype=np.float)) self.vals.append(np.asarray(val, dtype=np.float)) self.type.append(cls) self.npoin += len(xyi) icore += nrec self.npoly = len(self.poly)