pyjac.utils module¶
Module containing utility functions.
-
pyjac.utils.comment= {'c': '//', 'cuda': '//', 'fortran': '!', 'matlab': '%'}¶ dict – comment characters for each language
-
pyjac.utils.file_ext= {'c': '.c', 'cuda': '.cu', 'fortran': '.f90', 'matlab': '.m'}¶ dict – source code file extensions based on language
-
pyjac.utils.restrict= {'c': '__restrict__', 'cuda': '__restrict__'}¶ dict – language-dependent keyword for restrict
-
pyjac.utils.header_ext= {'c': '.h', 'cuda': '.cuh'}¶ dict – header extensions based on language
-
pyjac.utils.line_end= {'c': ';\n', 'cuda': ';\n', 'fortran': '\n', 'matlab': ';\n'}¶ dict – line endings dependent on language
-
pyjac.utils.exp_10_fun= {'c': 'pow(10.0, ', 'cuda': 'exp10(', 'fortran': 'exp(log(10) * ', 'matlab': 'exp(log(10.0) * '}¶ dict – exp10 functions for various languages
-
pyjac.utils.array_chars= {'c': '[{}]', 'cuda': '[INDEX({})]', 'fortran': '({})', 'matlab': '({})'}¶ dict – the characters to format an index into an array per language
-
pyjac.utils.get_species_mappings(num_specs, last_species)[source]¶ Maps species indices around species moved to last position.
Parameters: Returns:
-
pyjac.utils.get_nu(isp, rxn)[source]¶ Returns the net nu of species isp for the reaction rxn
Parameters: Returns: nu – Overall stoichiometric coefficient of species
ispin reactionrxnReturn type:
-
pyjac.utils.read_str_num(string, sep=None)[source]¶ Returns a list of floats pulled from a string.
Delimiter is optional; if not specified, uses whitespace.
Parameters: Returns: Floats separated by
sepinstring.Return type: list of
float
-
pyjac.utils.split_str(seq, length)[source]¶ Separate a string seq into length-sized pieces.
Parameters: Returns: List of strings of length
lengthfromseq.Return type: list of
str
-
pyjac.utils.create_dir(path)[source]¶ Creates a new directory based on input path.
No error if path already exists, but other error is reported.
Parameters: path (str) – Path of directory to be created Returns: Return type: None
-
pyjac.utils.get_array(lang, name, index, twod=None)[source]¶ Given a language and an index, returns the proper string index formatted into the appropriate array characters (e.g., [] or ()).
Parameters: Returns: name – String with indexed array.
Return type:
-
pyjac.utils.get_index(lang, index)[source]¶ Given an integer index this function will return the proper string version of the index based on the language and other considerations
Parameters: Returns: The string corresponding to the correct index to be formatted into the code
Return type:
-
pyjac.utils.reassign_species_lists(reacs, specs)[source]¶ Given a list of
ReacInfo, andSpecInfo, this method will update theReacInforeactants / products / third body list to integers representing the species’ index in the list.Parameters: Returns: Return type: None
-
pyjac.utils.is_integer(val)[source]¶ Returns
Trueif argument is an integer or whole number.Parameters: val (int, float) – Value to be checked. Returns: Trueifvalisintor whole number (iffloat).Return type: bool
-
pyjac.utils.get_parser()[source]¶ Parameters: None – Returns: args – Command line arguments for running pyJac. Return type: argparse.Namespace