IOSS 2.0
|
#include <Ioss_Utils.h>
Static Public Member Functions | |
static void | set_all_streams (std::ostream &out_stream) |
set the stream for all streams (output, debug, and warning) to the specified out_stream | |
static IOSS_NODISCARD std::ostream & | get_debug_stream () |
get the debug stream. | |
static IOSS_NODISCARD std::ostream & | get_warning_stream () |
get the warning stream. | |
static IOSS_NODISCARD std::ostream & | get_output_stream () |
get the output stream. | |
static IOSS_NODISCARD std::string & | get_warning_text () |
static void | set_output_stream (std::ostream &output_stream) |
set the output stream to the specified output_stream | |
static void | set_debug_stream (std::ostream &debug_stream) |
set the debug stream to the specified debug_stream | |
static void | set_warning_stream (std::ostream &warning_stream) |
set the warning stream to the specified warning_stream | |
static void | set_pre_warning_text (const std::string &text) |
set the pre-warning text Sets the text output prior to a warning to the specified text. Pass an empty string to disable this. Default is "\nIOSS WARNING: " | |
static void | copyright (std::ostream &out, const std::string &year_range) |
static void | check_dynamic_cast (const void *ptr) |
static bool | is_path_absolute (const std::string &path) |
static IOSS_NODISCARD std::string | get_type_from_file (const std::string &filename) |
guess file type from extension | |
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 IOSS_NODISCARD 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 IOSS_NODISCARD int | number_width (const size_t number, bool use_commas=false) |
static IOSS_NODISCARD int | power_2 (int count) |
template<typename T > | |
static IOSS_NODISCARD bool | check_block_order (IOSS_MAYBE_UNUSED const std::vector< T * > &blocks) |
static IOSS_NODISCARD int | term_width () |
static IOSS_NODISCARD int | log_power_2 (uint64_t value) |
static void | time_and_date (char *time_string, char *date_string, size_t length) |
Get formatted time and date strings. | |
static IOSS_NODISCARD std::string | decode_filename (const std::string &filename, int processor, int num_processors) |
static IOSS_NODISCARD int | get_number (const std::string &suffix) |
static IOSS_NODISCARD int | extract_id (const std::string &name_id) |
static IOSS_NODISCARD std::string | encode_entity_name (const std::string &entity_type, int64_t id) |
static IOSS_NODISCARD std::string | get_trailing_digits (const std::string &name) |
static IOSS_NODISCARD 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. | |
static void | fixup_name (char *name) |
Convert a string to lower case, and convert spaces to _ . | |
static void | fixup_name (std::string &name) |
Convert a string to lower case, and convert spaces to _ . | |
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 | |
static IOSS_NODISCARD bool | block_is_omitted (Ioss::GroupingEntity *block) |
Determine whether an entity has the property omitted . | |
static IOSS_NODISCARD 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. | |
static IOSS_NODISCARD std::string | capitalize (std::string name) |
Uppercase the first letter of the string. | |
static IOSS_NODISCARD std::string | uppercase (std::string name) |
Convert a string to upper case. | |
static IOSS_NODISCARD std::string | lowercase (std::string name) |
Convert a string to lower case. | |
static void | check_non_null (void *ptr, const char *type, const std::string &name, const std::string &func) |
static IOSS_NODISCARD bool | str_equal (const std::string &s1, const std::string &s2) |
Case-insensitive string comparison. | |
static IOSS_NODISCARD bool | substr_equal (const std::string &prefix, const std::string &str) |
Case-insensitive substring comparison. | |
static bool | check_int_to_real_overflow (const Ioss::Field &field, int64_t *data, size_t num_entity) |
static IOSS_NODISCARD std::string | platform_information () |
Get a string containing uname output. | |
static IOSS_NODISCARD 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. | |
static void | get_fields (int64_t entity_count, Ioss::NameList &names, Ioss::Field::RoleType fld_role, const DatabaseIO *db, 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 *sb, size_t int_byte_size, const void *element, const void *sides, int64_t number_sides, const Region *region) |
static IOSS_NODISCARD int64_t | get_side_offset (const Ioss::ElementTopology *parent_topo, const Ioss::ElementTopology *side_topo) |
Get the appropriate index offset for the sides of elements in a SideBlock. | |
static IOSS_NODISCARD int64_t | get_side_offset (const Ioss::SideBlock *sb) |
static IOSS_NODISCARD unsigned int | hash (const std::string &name) |
static IOSS_NODISCARD double | timer () |
static void | input_file (const std::string &file_name, Ioss::NameList *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. | |
template<class T > | |
static IOSS_NODISCARD std::string | to_string (const T &t) |
static IOSS_NODISCARD 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 _ | |
static IOSS_NODISCARD std::string | shape_to_string (const Ioss::ElementShape &shape) |
static IOSS_NODISCARD std::string | entity_type_to_string (const Ioss::EntityType &type) |
static void | generate_history_mesh (Ioss::Region *region) |
Create a nominal mesh for use in history databases. | |
static void | info_fields (const Ioss::GroupingEntity *ige, Ioss::Field::RoleType role, const std::string &header, const std::string &suffix="\n\t", bool detail=false) |
static void | info_property (const Ioss::GroupingEntity *ige, Ioss::Property::Origin origin, const std::string &header, const std::string &suffix="\n\t", bool print_empty=false) |
static void | insert_sort_and_unique (const Ioss::NameList &src, Ioss::NameList &dest) |
Static Private Member Functions | |
template<typename T > | |
static size_t | unique (std::vector< T > &out, bool skip_first) |
Static Private Attributes | |
static std::ostream * | m_outputStream = &std::cerr |
general informational output (very rare). Default std::cerr | |
static std::ostream * | m_debugStream = &std::cerr |
debug output when requested. Default std::cerr | |
static std::ostream * | m_warningStream = &std::cerr |
IOSS warning output. Default std::cerr. | |
static std::string | m_preWarningText = "\nIOSS WARNING: " |
|
static |
Determine whether an entity has the property omitted
.
[in] | block | The entity. |
omitted
.
|
static |
|
static |
Uppercase the first letter of the string.
[in] | name | The string to convert. |
|
inlinestatic |
|
inlinestatic |
|
static |
Check all values in data
to make sure that if they are converted to a double and back again, there will be no data loss. This requires that the value be less than 2^53. This is done in the exodus database since it stores all transient data as doubles...
|
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 |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
|
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 |
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 |
Return the trailing digits (if any) from name
hex20
would return the string 20
tetra
would return an empty string.
|
static |
guess file type from extension
|
static |
|
static |
|
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. |
|
inlinestatic |
|
inlinestatic |
|
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 |
|
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 | The prefix that should start the string |
[in] | str | The string which should begin with prefix |
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 |
|
inlinestaticprivate |
|
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 _
|
staticprivate |
debug output when requested. Default std::cerr
|
staticprivate |
general informational output (very rare). Default std::cerr
|
staticprivate |
is a string that prepends all warning message output. Default is "\nIOSS WARNING: "
|
staticprivate |
IOSS warning output. Default std::cerr.