|
IOSS
2.0
|
#include <Ioss_Utils.h>
Public Member Functions | |
| Utils ()=default | |
| ~Utils ()=default | |
Static Public Member Functions | |
| static void | check_dynamic_cast (const void *ptr) |
| template<typename T > | |
| static void | uniquify (std::vector< T > &vec, bool skip_first=false) |
| template<typename T > | |
| static void | generate_index (std::vector< T > &index) |
| template<typename T > | |
| static T | find_index_location (T node, const std::vector< T > &index) |
| static void | copy_string (char *dest, char const *source, size_t elements) |
| static void | copy_string (char *dest, const std::string &source, size_t elements) |
| template<size_t size> | |
| static void | copy_string (char(&output)[size], const std::string &source) |
| template<size_t size> | |
| static void | copy_string (char(&output)[size], const char *source) |
| template<typename T > | |
| static void | clear (std::vector< T > &vec) |
| static int | number_width (const size_t number, bool use_commas=false) |
| static int | power_2 (int count) |
| template<typename T > | |
| static bool | check_block_order (const std::vector< T * > &blocks) |
| static int | term_width () |
| static int | log_power_2 (uint64_t value) |
| static char ** | get_name_array (size_t count, int size) |
| static void | delete_name_array (char **names, int count) |
| static void | time_and_date (char *time_string, char *date_string, size_t length) |
| Get formatted time and date strings. More... | |
| static std::string | decode_filename (const std::string &filename, int processor, int num_processors) |
| static size_t | get_number (const std::string &suffix) |
| static int64_t | extract_id (const std::string &name_id) |
| static std::string | encode_entity_name (const std::string &entity_type, int64_t id) |
| static std::string | format_id_list (const std::vector< size_t > &ids, const std::string &rng_sep=" to ", const std::string &seq_sep=", ") |
create a string that describes the list of input ids collapsing ranges if possible. More... | |
| static void | fixup_name (char *name) |
Convert a string to lower case, and convert spaces to _. More... | |
| static void | fixup_name (std::string &name) |
Convert a string to lower case, and convert spaces to _. More... | |
| static bool | check_set_bool_property (const Ioss::PropertyManager &properties, const std::string &prop_name, bool &prop_value) |
Check whether property prop_name exists and if so, set prop_value More... | |
| static bool | block_is_omitted (Ioss::GroupingEntity *block) |
Determine whether an entity has the property omitted. More... | |
| static std::string | fixup_type (const std::string &base, int nodes_per_element, int spatial) |
Process the base element type base which has nodes_per_element nodes and a spatial dimension of spatial into a form that the IO system can (hopefully) recognize. More... | |
| static std::string | uppercase (std::string name) |
| Convert a string to upper case. More... | |
| static std::string | lowercase (std::string name) |
| Convert a string to lower case. More... | |
| static void | check_non_null (void *ptr, const char *type, const std::string &name, const std::string &func) |
| static bool | str_equal (const std::string &s1, const std::string &s2) |
| Case-insensitive string comparison. More... | |
| static bool | substr_equal (const std::string &prefix, const std::string &str) |
| Case-insensitive substring comparison. More... | |
| static std::string | platform_information () |
Get a string containing uname output. More... | |
| static size_t | get_memory_info () |
| Return amount of memory being used on this processor. More... | |
| static size_t | get_hwm_memory_info () |
| static std::string | local_filename (const std::string &relative_filename, const std::string &type, const std::string &working_directory) |
| Get a filename relative to the specified working directory (if any) of the current execution. More... | |
| static void | get_fields (int64_t entity_count, char **names, size_t num_names, Ioss::Field::RoleType fld_role, bool enable_field_recognition, char suffix_separator, int *local_truth, std::vector< Ioss::Field > &fields) |
| static int | field_warning (const Ioss::GroupingEntity *ge, const Ioss::Field &field, const std::string &inout) |
| static void | calculate_sideblock_membership (IntVector &face_is_member, const SideBlock *ef_blk, size_t int_byte_size, const void *element, const void *sides, int64_t number_sides, const Region *region) |
| static int64_t | get_side_offset (const Ioss::SideBlock *sb) |
| Get the appropriate index offset for the sides of elements in a SideBlock. More... | |
| static unsigned int | hash (const std::string &name) |
| static double | timer () |
| static void | input_file (const std::string &file_name, std::vector< std::string > *lines, size_t max_line_length=0) |
| Convert an input file to a vector of strings containing one string for each line of the file. More... | |
| template<class T > | |
| static std::string | to_string (const T &t) |
| static std::string | variable_name_kluge (const std::string &name, size_t component_count, size_t copies, size_t max_var_len) |
Tries to shorten long variable names to an acceptable length, and converts to lowercase and spaces to _ More... | |
| static void | generate_history_mesh (Ioss::Region *region) |
| Create a nominal mesh for use in history databases. More... | |
| static void | copy_database (Ioss::Region ®ion, Ioss::Region &output_region, Ioss::MeshCopyOptions &options) |
|
default |
|
default |
|
static |
Determine whether an entity has the property omitted.
| [in] | block | The entity. |
omitted.
|
static |
|
inlinestatic |
|
inlinestatic |
|
static |
|
static |
Check whether property prop_name exists and if so, set prop_value
based on the property value. Either "TRUE", "YES", "ON", or nonzero for true; or "FALSE", "NO", "OFF", or 0 for false.
| [in] | properties | the Ioss::PropertyManager containing the properties to be checked. |
| [in] | prop_name | the name of the property to check whether it exists and if so, set its value. |
| [out] | prop_value | if prop_name exists and has a valid value, set prop_value accordingly. Does not modify if prop_name does not exist. |
|
inlinestatic |
|
static |
Copy the mesh in region to output_region. Behavior can be controlled via options in options
|
static |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
|
static |
|
static |
|
static |
|
static |
|
inlinestatic |
|
static |
Convert a string to lower case, and convert spaces to _.
The conversion is performed in place.
| [in,out] | name | On input, the string to convert. On output, the converted string. |
|
static |
Convert a string to lower case, and convert spaces to _.
The conversion is performed in place.
| [in,out] | name | On input, the string to convert. On output, the converted string. |
|
static |
Process the base element type base which has nodes_per_element nodes and a spatial dimension of spatial into a form that the IO system can (hopefully) recognize.
Lowercases the name; converts spaces to _, adds nodes_per_element at end of name (if not already there), and does some other transformations to remove some exodusII ambiguity.
| [in] | base | The element base name. |
| [in] | nodes_per_element | The number of nodes per element. |
| [in] | spatial | The spatial dimension of the element. |
|
static |
create a string that describes the list of input ids collapsing ranges if possible.
Traverse the sorted input vector ids and return a string that has all sequential ranges collapsed and separated by rng_sep and all individual ids or ranges separated by seq_sep. Will throw an exception if ids is not sorted. An empty list returns an empty string. The sequence of ids 1, 2, 3, 5, 6, 7 with rng_sep=".." will return the default string 1..3, 5..8
|
static |
Create a nominal mesh for use in history databases.
The model for a history file is a single sphere element (1 node, 1 element). This is needed for some applications that read this file that require a "mesh" even though a history file is just a collection of global variables with no real mesh. This routine will add the mesh portion to a history file.
| [in,out] | region | The region on which the nominal mesh is to be defined. |
|
inlinestatic |
|
static |
|
static |
|
static |
Return amount of memory being used on this processor.
|
static |
|
static |
|
static |
Get the appropriate index offset for the sides of elements in a SideBlock.
And yet another idiosyncrasy of sidesets... The side of an element (especially shells) can be either a face or an edge in the same sideset. The ordinal of an edge is (local_edge_number+numfaces) on the database, but needs to be (local_edge_number) for Sierra...
If the sideblock has a "parent_element_topology" and a "topology", then we can determine whether to offset the side ordinals...
| [in] | sb | Compute the offset for element sides in this SideBlock |
|
static |
|
static |
Convert an input file to a vector of strings containing one string for each line of the file.
Should only be called by a single processor or each processor will be accessing the file at the same time...
| [in] | file_name | The name of the file. |
| [out] | lines | The vector of strings containing the lines of the file |
| [in] | max_line_length | The maximum number of characters in any line of the file. |
|
static |
Get a filename relative to the specified working directory (if any) of the current execution.
Working_directory must end with / or be empty.
| [in] | relative_filename | The file path to be appended to the working directory path. |
| [in] | type | The file type. "generated" file types are treated differently. |
| [in] | working_directory | the path to which the relative_filename path is appended. |
|
static |
|
static |
Convert a string to lower case.
| [in] | name | The string to convert. |
|
inlinestatic |
Returns the number of digits required to print the number. If use_commas is specified, then the width will be adjusted to account for the comma used every 3 digits. (1,234,567,890 would return 13) Typically used with the fmt::print() functions as:
|
static |
Get a string containing uname output.
This output contains information about the current computing platform. This is used as information data in the created results file to help in tracking when/where/... the file was created.
|
inlinestatic |
|
static |
Case-insensitive string comparison.
| [in] | s1 | First string |
| [in] | s2 | Second string |
true if strings are equal
|
static |
Case-insensitive substring comparison.
| [in] | prefix | |
| [in] | str |
true if str begins with prefix or prefix is empty
|
static |
|
static |
Get formatted time and date strings.
Fill time_string and date_string with current time and date formatted as "HH:MM:SS" for time and "yy/mm/dd" or "yyyy/mm/dd" for date.
| [out] | time_string | The formatted time string. |
| [out] | date_string | The formatted date string. |
| [in] | length | Use 8 for short-year date format, or 10 for long-year date format. |
|
static |
|
inlinestatic |
|
inlinestatic |
|
static |
Convert a string to upper case.
| [in] | name | The string to convert. |
|
static |
Tries to shorten long variable names to an acceptable length, and converts to lowercase and spaces to _
Many databases have a maximum length for variable names which can cause a problem with variable name length. This routine tries to shorten long variable names to an acceptable length (max_var_len characters max). If the name is already less than this length, it is returned unchanged...
Since there is a (good) chance that two shortened names will match, a 2-letter hash code is appended to the end of the variable name.
So, we shorten the name to a maximum of max_var_len-3 characters and append a 2 character hash+separator.
It also converts name to lowercase and converts spaces to _