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