IOSS  2.0
Ioss_Utils.h
Go to the documentation of this file.
1 // Copyright(C) 1999-2020 National Technology & Engineering Solutions
2 // of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3 // NTESS, the U.S. Government retains certain rights in this software.
4 //
5 // See packages/seacas/LICENSE for details
6 
7 #ifndef IOSS_Ioss_Utils_h
8 #define IOSS_Ioss_Utils_h
9 
10 #include <Ioss_CodeTypes.h>
11 #include <Ioss_Field.h>
12 #include <Ioss_Property.h>
13 #include <algorithm> // for sort, lower_bound, copy, etc
14 #include <cassert>
15 #include <cmath>
16 #include <cstddef> // for size_t
17 #include <cstdint> // for int64_t
18 #include <cstdlib> // for nullptrr
19 #include <iostream> // for ostringstream, etcstream, etc
20 #include <stdexcept> // for runtime_error
21 #include <string> // for string
22 #include <vector> // for vector
23 namespace Ioss {
24  class Field;
25  class GroupingEntity;
26  class Region;
27  class SideBlock;
28  class PropertyManager;
29  struct MeshCopyOptions;
30 } // namespace Ioss
31 
32 #define IOSS_ERROR(errmsg) throw std::runtime_error((errmsg).str())
33 
34 namespace {
35  // SEE: http://lemire.me/blog/2017/04/10/removing-duplicates-from-lists-quickly
36  template <typename T> size_t unique(std::vector<T> &out, bool skip_first)
37  {
38  if (out.empty())
39  return 0;
40  size_t i = 1;
41  size_t pos = 1;
42  T oldv = out[0];
43  if (skip_first) {
44  i = 2;
45  pos = 2;
46  oldv = out[1];
47  }
48  for (; i < out.size(); ++i) {
49  T newv = out[i];
50  out[pos] = newv;
51  pos += (newv != oldv);
52  oldv = newv;
53  }
54  return pos;
55  }
56 } // namespace
57 
58 namespace Ioss {
59  /* \brief Utility methods.
60  */
61  class Utils
62  {
63  public:
64  Utils() = default;
65  ~Utils() = default;
66 
67  /**
68  * \defgroup IossStreams Streams used for IOSS output
69  *@{
70  */
71  static std::ostream
72  *m_outputStream; ///< general informational output (very rare). Default std::cerr
73  static std::ostream *m_debugStream; ///< debug output when requested. Default std::cerr
74  static std::ostream *m_warningStream; ///< IOSS warning output. Default std::cerr
75  static std::string m_preWarningText; ///< is a string that prepends all warning message output.
76  ///< Default is "\nIOSS WARNING: "
77 
78  /** \brief set the stream for all streams (output, debug, and warning) to the specified
79  * `out_stream`
80  */
81  static void set_all_streams(std::ostream &out_stream)
82  {
83  m_outputStream = &out_stream;
84  m_debugStream = &out_stream;
85  m_warningStream = &out_stream;
86  }
87 
88  /** \brief set the output stream to the specified `output_stream`
89  */
90  static void set_output_stream(std::ostream &output_stream) { m_outputStream = &output_stream; }
91 
92  /** \brief set the debug stream to the specified `debug_stream`
93  */
94  static void set_debug_stream(std::ostream &debug_stream) { m_debugStream = &debug_stream; }
95 
96  /** \brief set the warning stream to the specified `warning_stream`
97  */
98  static void set_warning_stream(std::ostream &warning_stream)
99  {
100  m_warningStream = &warning_stream;
101  }
102 
103  /** \brief set the pre-warning text
104  * Sets the text output prior to a warning to the specified text.
105  * Pass an empty string to disable this. Default is `"\nIOSS WARNING: "`
106  */
107  static void set_pre_warning_text(const std::string &text) { m_preWarningText = text; }
108  /** @}*/
109 
110  static void check_dynamic_cast(const void *ptr)
111  {
112  if (ptr == nullptr) {
113  std::ostringstream errmsg;
114  errmsg << "INTERNAL ERROR: Invalid dynamic cast returned nullptr\n";
115  IOSS_ERROR(errmsg);
116  }
117  }
118 
119  template <typename T> static void uniquify(std::vector<T> &vec, bool skip_first = false)
120  {
121  auto it = vec.begin();
122  if (skip_first) {
123  it++;
124  }
125  std::sort(it, vec.end());
126  vec.resize(unique(vec, skip_first));
127  vec.shrink_to_fit();
128  }
129 
130  template <typename T> static void generate_index(std::vector<T> &index)
131  {
132  T sum = 0;
133  for (size_t i = 0; i < index.size() - 1; i++) {
134  T cnt = index[i];
135  index[i] = sum;
136  sum += cnt;
137  }
138  index.back() = sum;
139  }
140 
141  template <typename T> static T find_index_location(T node, const std::vector<T> &index)
142  {
143  // 0-based node numbering
144  // index[p] = first node (0-based) on processor p
145 
146 #if 1
147  // Assume data coherence. I.e., a new search will be close to the
148  // previous search.
149  static size_t prev = 1;
150 
151  size_t nproc = index.size();
152  if (prev < nproc && index[prev - 1] <= node && index[prev] > node) {
153  return prev - 1;
154  }
155 
156  for (size_t p = 1; p < nproc; p++) {
157  if (index[p] > node) {
158  prev = p;
159  return p - 1;
160  }
161  }
162  std::ostringstream errmsg;
163  errmsg << "FATAL ERROR: find_index_location. Searching for " << node << " in:\n";
164  for (auto idx : index) {
165  errmsg << idx << ", ";
166  }
167  errmsg << "\n";
168  IOSS_ERROR(errmsg);
169 #else
170  return std::distance(index.begin(), std::upper_bound(index.begin(), index.end(), node)) - 1;
171 #endif
172  }
173 
174  static void copy_string(char *dest, char const *source, size_t elements);
175 
176  static void copy_string(char *dest, const std::string &source, size_t elements)
177  {
178  copy_string(dest, source.c_str(), elements);
179  }
180 
181  template <size_t size> static void copy_string(char (&output)[size], const std::string &source)
182  {
183  copy_string(output, source.c_str(), size);
184  }
185 
186  template <size_t size> static void copy_string(char (&output)[size], const char *source)
187  {
188  // Copy the string — don’t copy too many bytes.
189  copy_string(output, source, size);
190  }
191 
192  template <typename T> static void clear(std::vector<T> &vec)
193  {
194  vec.clear();
195  vec.shrink_to_fit();
196  assert(vec.capacity() == 0);
197  }
198 
199  /**
200  * Returns the number of digits required to print the number.
201  * If `use_commas` is specified, then the width will be adjusted
202  * to account for the comma used every 3 digits.
203  * (1,234,567,890 would return 13)
204  * Typically used with the `fmt::print()` functions as:
205  * ```
206  * fmt::print("{:{}n}", number, number_width(number,true))
207  * fmt::print("{:{}d}", number, number_width(number,false))
208  * ```
209  */
210  inline static int number_width(const size_t number, bool use_commas = false)
211  {
212  if (number == 0) {
213  return 1;
214  }
215  int width = int(std::floor(std::log10(number))) + 1;
216  if (use_commas) {
217  width += ((width - 1) / 3);
218  }
219  return width;
220  }
221 
222  inline static int power_2(int count)
223  {
224  // Return the power of two which is equal to or greater than `count`
225  // count = 15 -> returns 16
226  // count = 16 -> returns 16
227  // count = 17 -> returns 32
228 
229  // Use brute force...
230  int pow2 = 1;
231  while (pow2 < count) {
232  pow2 *= 2;
233  }
234  return pow2;
235  }
236 
237  template <typename T> static bool check_block_order(const std::vector<T *> &blocks)
238  {
239 #ifndef NDEBUG
240  // Verify that element blocks are defined in sorted offset order...
241  typename std::vector<T *>::const_iterator I;
242 
243  int64_t eb_offset = -1;
244  for (I = blocks.begin(); I != blocks.end(); ++I) {
245  int64_t this_off = (*I)->get_offset();
246  if (this_off < eb_offset) {
247  {
248  {
249  return false;
250  }
251  }
252  }
253  eb_offset = this_off;
254  }
255 #endif
256  return true;
257  }
258 
259  static int term_width();
260 
261  static int log_power_2(uint64_t value);
262 
263  static char **get_name_array(size_t count, int size);
264  static void delete_name_array(char **names, int count);
265 
266  /** \brief Get formatted time and date strings.
267  *
268  * Fill time_string and date_string with current time and date
269  * formatted as "HH:MM:SS" for time and "yy/mm/dd" or "yyyy/mm/dd"
270  * for date.
271  *
272  * \param[out] time_string The formatted time string.
273  * \param[out] date_string The formatted date string.
274  * \param[in] length Use 8 for short-year date format, or 10 for long-year date format.
275  */
276  static void time_and_date(char *time_string, char *date_string, size_t length);
277 
278  static std::string decode_filename(const std::string &filename, int processor,
279  int num_processors);
280  static size_t get_number(const std::string &suffix);
281  static int64_t extract_id(const std::string &name_id);
282  static std::string encode_entity_name(const std::string &entity_type, int64_t id);
283 
284  /** \brief create a string that describes the list of input `ids` collapsing ranges if possible.
285  *
286  * Traverse the sorted input vector `ids` and return a string that has all sequential ranges
287  * collapsed and separated by `rng_sep` and all individual ids or ranges separated by `seq_sep`.
288  * Will throw an exception if `ids` is not sorted. An empty list returns an empty string.
289  * The sequence of ids `1, 2, 3, 5, 6, 7` with `rng_sep=".."` will return the default
290  * string `1..3, 5..8`
291  */
292  static std::string format_id_list(const std::vector<size_t> &ids,
293  const std::string & rng_sep = " to ",
294  const std::string & seq_sep = ", ");
295 
296  /** \brief Convert a string to lower case, and convert spaces to `_`.
297  *
298  * The conversion is performed in place.
299  *
300  * \param[in,out] name On input, the string to convert. On output, the converted string.
301  *
302  */
303  static void fixup_name(char *name);
304 
305  /** \brief Convert a string to lower case, and convert spaces to `_`.
306  *
307  * The conversion is performed in place.
308  *
309  * \param[in,out] name On input, the string to convert. On output, the converted string.
310  *
311  */
312  static void fixup_name(std::string &name);
313 
314  /** \brief Check whether property `prop_name` exists and if so, set `prop_value`
315  *
316  * based on the property value. Either "TRUE", "YES", "ON", or nonzero for true;
317  * or "FALSE", "NO", "OFF", or 0 for false.
318  * \param[in] properties the Ioss::PropertyManager containing the properties to be checked.
319  * \param[in] prop_name the name of the property to check whether it exists and if so, set its
320  * value.
321  * \param[out] prop_value if `prop_name` exists and has a valid value, set prop_value
322  * accordingly. Does not modify if `prop_name` does not exist. \returns true/false depending on
323  * whether property found and value set.
324  */
325 
326  static bool check_set_bool_property(const Ioss::PropertyManager &properties,
327  const std::string &prop_name, bool &prop_value);
328 
329  /** \brief Determine whether an entity has the property `omitted`.
330  *
331  * \param[in] block The entity.
332  * \returns True if the entity has the property `omitted`.
333  */
334  static bool block_is_omitted(Ioss::GroupingEntity *block);
335 
336  /** \brief Process the base element type `base` which has
337  * `nodes_per_element` nodes and a spatial dimension of `spatial`
338  * into a form that the IO system can (hopefully) recognize.
339  *
340  * Lowercases the name; converts spaces to `_`, adds
341  * nodes_per_element at end of name (if not already there), and
342  * does some other transformations to remove some exodusII ambiguity.
343  *
344  * \param[in] base The element base name.
345  * \param[in] nodes_per_element The number of nodes per element.
346  * \param[in] spatial The spatial dimension of the element.
347  * \returns The Ioss-formatted element name.
348  */
349  static std::string fixup_type(const std::string &base, int nodes_per_element, int spatial);
350 
351  /** \brief Convert a string to upper case.
352  *
353  * \param[in] name The string to convert.
354  * \returns The converted string.
355  */
356  static std::string uppercase(std::string name);
357 
358  /** \brief Convert a string to lower case.
359  *
360  * \param[in] name The string to convert.
361  * \returns The converted string.
362  */
363  static std::string lowercase(std::string name);
364 
365  static void check_non_null(void *ptr, const char *type, const std::string &name,
366  const std::string &func);
367 
368  /** \brief Case-insensitive string comparison.
369  *
370  * \param[in] s1 First string
371  * \param[in] s2 Second string
372  * \returns `true` if strings are equal
373  */
374  static bool str_equal(const std::string &s1, const std::string &s2);
375 
376  /** \brief Case-insensitive substring comparison.
377  *
378  * \param[in] prefix
379  * \param[in] str
380  * \returns `true` if `str` begins with `prefix` or `prefix` is empty
381  */
382  static bool substr_equal(const std::string &prefix, const std::string &str);
383 
384  /** \brief Get a string containing `uname` output.
385  *
386  * This output contains information about the current computing platform.
387  * This is used as information data in the created results file to help
388  * in tracking when/where/... the file was created.
389  *
390  * \returns The platform information string.
391  */
392  static std::string platform_information();
393 
394  /** \brief Return amount of memory being used on this processor */
395  static size_t get_memory_info();
396  static size_t get_hwm_memory_info();
397 
398  /** \brief Get a filename relative to the specified working directory (if any)
399  * of the current execution.
400  *
401  * Working_directory must end with `/` or be empty.
402  *
403  * \param[in] relative_filename The file path to be appended to the working directory path.
404  * \param[in] type The file type. "generated" file types are treated differently.
405  * \param[in] working_directory the path to which the relative_filename path is appended.
406  * \returns The full path (working_directory + relative_filename)
407  */
408  static std::string local_filename(const std::string &relative_filename, const std::string &type,
409  const std::string &working_directory);
410 
411  static void get_fields(int64_t entity_count, char **names, size_t num_names,
412  Ioss::Field::RoleType fld_role, bool enable_field_recognition,
413  char suffix_separator, int *local_truth,
414  std::vector<Ioss::Field> &fields);
415 
416  static int field_warning(const Ioss::GroupingEntity *ge, const Ioss::Field &field,
417  const std::string &inout);
418 
419  static void calculate_sideblock_membership(IntVector &face_is_member, const SideBlock *ef_blk,
420  size_t int_byte_size, const void *element,
421  const void *sides, int64_t number_sides,
422  const Region *region);
423 
424  /** \brief Get the appropriate index offset for the sides of elements in a SideBlock.
425  *
426  * And yet another idiosyncrasy of sidesets...
427  * The side of an element (especially shells) can be
428  * either a face or an edge in the same sideset. The
429  * ordinal of an edge is (local_edge_number+numfaces) on the
430  * database, but needs to be (local_edge_number) for Sierra...
431  *
432  * If the sideblock has a "parent_element_topology" and a
433  * "topology", then we can determine whether to offset the
434  * side ordinals...
435  *
436  * \param[in] sb Compute the offset for element sides in this SideBlock
437  * \returns The offset.
438  */
439  static int64_t get_side_offset(const Ioss::SideBlock *sb);
440 
441  static unsigned int hash(const std::string &name);
442 
443  static double timer();
444 
445  /** \brief Convert an input file to a vector of strings containing one string for each line of
446  * the file.
447  *
448  * Should only be called by a single processor or each processor will be accessing the file
449  * at the same time...
450  *
451  * \param[in] file_name The name of the file.
452  * \param[out] lines The vector of strings containing the lines of the file
453  * \param[in] max_line_length The maximum number of characters in any line of the file.
454  */
455  static void input_file(const std::string &file_name, std::vector<std::string> *lines,
456  size_t max_line_length = 0);
457 
458  template <class T> static std::string to_string(const T &t) { return std::to_string(t); }
459 
460  //! \brief Tries to shorten long variable names to an acceptable
461  //! length, and converts to lowercase and spaces to `_`
462  //!
463  //! Many databases have a maximum length for variable names which can
464  //! cause a problem with variable name length.
465  //!
466 
467  //! This routine tries to shorten long variable names to an
468  //! acceptable length (`max_var_len` characters max). If the name
469  //! is already less than this length, it is returned unchanged...
470  //!
471  //! Since there is a (good) chance that two shortened names will match,
472  //! a 2-letter `hash` code is appended to the end of the variable name.
473  //!
474  //! So, we shorten the name to a maximum of `max_var_len`-3
475  //! characters and append a 2 character hash+separator.
476  //!
477  //! It also converts name to lowercase and converts spaces to `_`
478  static std::string variable_name_kluge(const std::string &name, size_t component_count,
479  size_t copies, size_t max_var_len);
480 
481  /** \brief Create a nominal mesh for use in history databases.
482  *
483  * The model for a history file is a single sphere element (1 node, 1 element).
484  * This is needed for some applications that read this file that require a
485  * "mesh" even though a history file is just a collection of global variables
486  * with no real mesh. This routine will add the mesh portion to a history file.
487  *
488  * \param[in,out] region The region on which the nominal mesh is to be defined.
489  */
490  static void generate_history_mesh(Ioss::Region *region);
491 
492  //! Copy the mesh in `region` to `output_region`. Behavior can be controlled
493  //! via options in `options`
494  static void copy_database(Ioss::Region &region, Ioss::Region &output_region,
495  Ioss::MeshCopyOptions &options);
496 
497  static void info_fields(const Ioss::GroupingEntity *ige, Ioss::Field::RoleType role,
498  const std::string &header, const std::string &suffix = "\n\t");
499 
500  static void info_property(const Ioss::GroupingEntity *ige, Ioss::Property::Origin origin,
501  const std::string &header, const std::string &suffix = "\n\t",
502  bool print_empty = false);
503  };
504 
505  inline std::ostream &OUTPUT() { return *Utils::m_outputStream; }
506 
507  inline std::ostream &DEBUG() { return *Utils::m_debugStream; }
508 
509  inline std::ostream &WARNING()
510  {
512  return *Utils::m_warningStream;
513  }
514 
515 } // namespace Ioss
516 #endif
Ioss::Utils::copy_string
static void copy_string(char(&output)[size], const std::string &source)
Definition: Ioss_Utils.h:181
Ioss::Utils::info_property
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)
Definition: Ioss_Utils.C:1446
Ioss::Field
Holds metadata for bulk data associated with a GroupingEntity.
Definition: Ioss_Field.h:22
Ioss_Property.h
Ioss::Utils::m_debugStream
static std::ostream * m_debugStream
debug output when requested. Default std::cerr
Definition: Ioss_Utils.h:73
Ioss::Utils::field_warning
static int field_warning(const Ioss::GroupingEntity *ge, const Ioss::Field &field, const std::string &inout)
Definition: Ioss_Utils.C:459
Ioss::Utils::hash
static unsigned int hash(const std::string &name)
Definition: Ioss_Utils.C:1096
Ioss::Utils::str_equal
static bool str_equal(const std::string &s1, const std::string &s2)
Case-insensitive string comparison.
Definition: Ioss_Utils.C:1155
Ioss::Utils::uniquify
static void uniquify(std::vector< T > &vec, bool skip_first=false)
Definition: Ioss_Utils.h:119
Ioss::Utils::fixup_type
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 spati...
Definition: Ioss_Utils.C:375
Ioss::Utils::copy_string
static void copy_string(char *dest, char const *source, size_t elements)
Definition: Ioss_Utils.C:1356
Ioss::Utils::find_index_location
static T find_index_location(T node, const std::vector< T > &index)
Definition: Ioss_Utils.h:141
Ioss::Utils::get_number
static size_t get_number(const std::string &suffix)
Definition: Ioss_Utils.C:289
Ioss::IntVector
std::vector< int > IntVector
Definition: Ioss_CodeTypes.h:25
Ioss::Utils::term_width
static int term_width()
Definition: Ioss_Utils.C:1385
Ioss::Utils::~Utils
~Utils()=default
Ioss::Utils::platform_information
static std::string platform_information()
Get a string containing uname output.
Definition: Ioss_Utils.C:863
Ioss::Utils::get_hwm_memory_info
static size_t get_hwm_memory_info()
Definition: Ioss_Utils.C:943
Ioss::MeshCopyOptions
Definition: Ioss_MeshCopyOptions.h:10
Ioss
The main namespace for the Ioss library.
Definition: Ioad_DatabaseIO.C:40
Ioss::Utils::to_string
static std::string to_string(const T &t)
Definition: Ioss_Utils.h:458
Ioss::Utils::clear
static void clear(std::vector< T > &vec)
Definition: Ioss_Utils.h:192
Ioss::Utils::extract_id
static int64_t extract_id(const std::string &name_id)
Definition: Ioss_Utils.C:299
anonymous_namespace{Iovs_DatabaseIO.C}::entity_type
entity_type
Definition: Iovs_DatabaseIO.C:55
Ioss::Utils::number_width
static int number_width(const size_t number, bool use_commas=false)
Definition: Ioss_Utils.h:210
Ioss::Utils::encode_entity_name
static std::string encode_entity_name(const std::string &entity_type, int64_t id)
Definition: Ioss_Utils.C:348
Ioss::DEBUG
std::ostream & DEBUG()
Definition: Ioss_Utils.h:507
Ioss::Region
A grouping entity that contains other grouping entities.
Definition: Ioss_Region.h:78
Ioss::Utils::m_preWarningText
static std::string m_preWarningText
Definition: Ioss_Utils.h:75
anonymous_namespace{Ioss_Utils.h}::unique
size_t unique(std::vector< T > &out, bool skip_first)
Definition: Ioss_Utils.h:36
Ioss::Utils::get_fields
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)
Definition: Ioss_Utils.C:745
Ioss::PropertyManager
A collection of Ioss::Property objects.
Definition: Ioss_PropertyManager.h:24
Ioss::Utils::get_name_array
static char ** get_name_array(size_t count, int size)
Definition: Ioss_Utils.C:357
Ioss::Utils::get_memory_info
static size_t get_memory_info()
Return amount of memory being used on this processor.
Definition: Ioss_Utils.C:879
Ioss::Utils::calculate_sideblock_membership
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)
Definition: Ioss_Utils.C:989
Ioss::Utils::info_fields
static void info_fields(const Ioss::GroupingEntity *ige, Ioss::Field::RoleType role, const std::string &header, const std::string &suffix="\n\t")
Definition: Ioss_Utils.C:1402
Ioss::Utils::local_filename
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.
Definition: Ioss_Utils.C:447
Ioss::Utils::uppercase
static std::string uppercase(std::string name)
Convert a string to upper case.
Definition: Ioss_Utils.C:1167
Ioss::Utils::check_set_bool_property
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
Definition: Ioss_Utils.C:1179
Ioss::Utils::copy_string
static void copy_string(char *dest, const std::string &source, size_t elements)
Definition: Ioss_Utils.h:176
Ioss::Utils::set_debug_stream
static void set_debug_stream(std::ostream &debug_stream)
set the debug stream to the specified debug_stream
Definition: Ioss_Utils.h:94
Ioss::OUTPUT
std::ostream & OUTPUT()
Definition: Ioss_Utils.h:505
Ioss::Utils::set_warning_stream
static void set_warning_stream(std::ostream &warning_stream)
set the warning stream to the specified warning_stream
Definition: Ioss_Utils.h:98
Ioss::Utils::fixup_name
static void fixup_name(char *name)
Convert a string to lower case, and convert spaces to _.
Definition: Ioss_Utils.C:1209
IOSS_ERROR
#define IOSS_ERROR(errmsg)
Definition: Ioss_Utils.h:32
Ioss::Utils::timer
static double timer()
Definition: Ioss_Utils.C:1115
Ioss::SideBlock
A collection of element sides having the same topology.
Definition: Ioss_SideBlock.h:34
Ioss::Utils::set_all_streams
static void set_all_streams(std::ostream &out_stream)
set the stream for all streams (output, debug, and warning) to the specified out_stream
Definition: Ioss_Utils.h:81
Ioss_Field.h
Ioss::Utils::power_2
static int power_2(int count)
Definition: Ioss_Utils.h:222
Ioss::Utils::block_is_omitted
static bool block_is_omitted(Ioss::GroupingEntity *block)
Determine whether an entity has the property omitted.
Definition: Ioss_Utils.C:980
Ioss::Utils::m_outputStream
static std::ostream * m_outputStream
general informational output (very rare). Default std::cerr
Definition: Ioss_Utils.h:72
Ioss::Utils::set_output_stream
static void set_output_stream(std::ostream &output_stream)
set the output stream to the specified output_stream
Definition: Ioss_Utils.h:90
Ioss::Utils::check_dynamic_cast
static void check_dynamic_cast(const void *ptr)
Definition: Ioss_Utils.h:110
Ioss::Utils::copy_database
static void copy_database(Ioss::Region &region, Ioss::Region &output_region, Ioss::MeshCopyOptions &options)
Definition: Ioss_Utils.C:1491
Ioss::Utils::m_warningStream
static std::ostream * m_warningStream
IOSS warning output. Default std::cerr.
Definition: Ioss_Utils.h:74
anonymous_namespace{Ioex_BaseDatabaseIO.C}::max_line_length
const size_t max_line_length
Definition: Ioex_BaseDatabaseIO.C:82
Ioss::Utils::variable_name_kluge
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...
Definition: Ioss_Utils.C:1259
Ioss::Utils::decode_filename
static std::string decode_filename(const std::string &filename, int processor, int num_processors)
Definition: Ioss_Utils.C:272
Ioss::Utils::generate_index
static void generate_index(std::vector< T > &index)
Definition: Ioss_Utils.h:130
Ioss::Utils::copy_string
static void copy_string(char(&output)[size], const char *source)
Definition: Ioss_Utils.h:186
Ioss::Utils::log_power_2
static int log_power_2(uint64_t value)
Definition: Ioss_Utils.C:1372
Ioss::Utils::Utils
Utils()=default
Ioss::Utils::check_non_null
static void check_non_null(void *ptr, const char *type, const std::string &name, const std::string &func)
Definition: Ioss_Utils.C:260
Ioss::Utils::delete_name_array
static void delete_name_array(char **names, int count)
Definition: Ioss_Utils.C:367
Ioss::Utils::input_file
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.
Definition: Ioss_Utils.C:1121
Ioss::Property::Origin
Origin
Definition: Ioss_Property.h:27
Ioss::Utils::format_id_list
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.
Definition: Ioss_Utils.C:312
Ioss::Field::RoleType
RoleType
Definition: Ioss_Field.h:49
anonymous_namespace{io_info.C}::name
std::string name(const Ioss::GroupingEntity *entity)
Definition: io_info.C:65
Ioss::WARNING
std::ostream & WARNING()
Definition: Ioss_Utils.h:509
Ioss::Utils::generate_history_mesh
static void generate_history_mesh(Ioss::Region *region)
Create a nominal mesh for use in history databases.
Definition: Ioss_Utils.C:1324
Ioss::Utils::substr_equal
static bool substr_equal(const std::string &prefix, const std::string &str)
Case-insensitive substring comparison.
Definition: Ioss_Utils.C:1162
Ioss::Utils::get_side_offset
static int64_t get_side_offset(const Ioss::SideBlock *sb)
Get the appropriate index offset for the sides of elements in a SideBlock.
Definition: Ioss_Utils.C:1078
Ioss::GroupingEntity
Base class for all 'grouping' entities. The following derived classes are typical:
Definition: Ioss_GroupingEntity.h:68
Ioss_CodeTypes.h
Ioss::Utils
Definition: Ioss_Utils.h:62
Ioss::Utils::set_pre_warning_text
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....
Definition: Ioss_Utils.h:107
Ioss::Utils::time_and_date
static void time_and_date(char *time_string, char *date_string, size_t length)
Get formatted time and date strings.
Definition: Ioss_Utils.C:245
Ioss::Utils::check_block_order
static bool check_block_order(const std::vector< T * > &blocks)
Definition: Ioss_Utils.h:237
Ioss::Utils::lowercase
static std::string lowercase(std::string name)
Convert a string to lower case.
Definition: Ioss_Utils.C:1173