26#include "ioss_export.h"
38[[noreturn]]
inline void IOSS_ERROR(
const std::ostringstream &errmsg)
40 throw std::runtime_error((errmsg).str());
38[[noreturn]]
inline void IOSS_ERROR(
const std::ostringstream &errmsg) {
…}
43[[noreturn]]
inline void IOSS_ERROR(
const std::string &errmsg) {
throw std::runtime_error(errmsg); }
46#define IOSS_ASSERT_USED(x) (void)x
48#define IOSS_ASSERT_USED(x)
76 return N == 0 ? nullptr : arr.data();
79template <
typename T,
size_t N>
IOSS_NODISCARD constexpr const T *
Data(
const std::array<T, N> &arr)
81 return N == 0 ? nullptr : arr.data();
79template <
typename T,
size_t N>
IOSS_NODISCARD constexpr const T *
Data(
const std::array<T, N> &arr) {
…}
121 static void set_output_stream(std::ostream &output_stream);
125 static void set_debug_stream(std::ostream &debug_stream);
129 static void set_warning_stream(std::ostream &warning_stream);
138 static void copyright(std::ostream &out,
const std::string &year_range);
140 IOSS_NODISCARD static bool check_valid_change_set_name(
const std::string &cs_name,
146 if (ptr ==
nullptr) {
147 std::ostringstream errmsg;
148 errmsg <<
"INTERNAL ERROR: Invalid dynamic cast returned nullptr\n";
160#ifdef __IOSS_WINDOWS__
161 return path[0] ==
'\\' && path[1] ==
':';
163 return path[0] ==
'/';
170 IOSS_NODISCARD static std::string get_type_from_file(
const std::string &filename);
172 template <
typename T>
static void uniquify(std::vector<T> &vec,
bool skip_first =
false)
174 auto it = vec.begin();
179 vec.resize(
unique(vec, skip_first));
172 template <
typename T>
static void uniquify(std::vector<T> &vec,
bool skip_first =
false) {
…}
186 for (
size_t i = 0; i < index.size() - 1; i++) {
194 template <
typename T>
203 static size_t prev = 1;
205 size_t nproc = index.size();
206 if (prev < nproc && index[prev - 1] <= node && index[prev] > node) {
210 for (
size_t p = 1; p < nproc; p++) {
211 if (index[p] > node) {
216 std::ostringstream errmsg;
217 errmsg <<
"FATAL ERROR: find_index_location. Searching for " << node <<
" in:\n";
218 for (
auto idx : index) {
219 errmsg << idx <<
", ";
224 return std::distance(index.begin(), std::upper_bound(index.begin(), index.end(), node)) - 1;
228 static void copy_string(
char *dest,
char const *source,
size_t elements);
230 static void copy_string(
char *dest,
const std::string &source,
size_t elements)
230 static void copy_string(
char *dest,
const std::string &source,
size_t elements) {
…}
235 template <
size_t size>
static void copy_string(
char (&output)[size],
const std::string &source)
235 template <
size_t size>
static void copy_string(
char (&output)[size],
const std::string &source) {
…}
240 template <
size_t size>
static void copy_string(
char (&output)[size],
const char *source)
240 template <
size_t size>
static void copy_string(
char (&output)[size],
const char *source) {
…}
246 template <
typename T>
static void clear(std::vector<T> &vec)
250 assert(vec.capacity() == 0);
246 template <
typename T>
static void clear(std::vector<T> &vec) {
…}
269 int width =
static_cast<int>(std::floor(std::log10(number))) + 1;
271 width += ((width - 1) / 3);
285 while (pow2 < count) {
291 template <
typename T>
296 typename std::vector<T *>::const_iterator I;
298 int64_t eb_offset = -1;
299 for (I = blocks.begin(); I != blocks.end(); ++I) {
300 int64_t this_off = (*I)->get_offset();
301 if (this_off < eb_offset) {
308 eb_offset = this_off;
328 static void time_and_date(
char *time_string,
char *date_string,
size_t length);
330 IOSS_NODISCARD static std::string decode_filename(
const std::string &filename,
int processor,
334 IOSS_NODISCARD static std::string encode_entity_name(
const std::string &entity_type,
341 IOSS_NODISCARD static std::string get_trailing_digits(
const std::string &name);
351 IOSS_NODISCARD static std::string format_id_list(
const std::vector<size_t> &ids,
352 const std::string &rng_sep =
" to ",
353 const std::string &seq_sep =
", ");
362 static void fixup_name(
char *name);
371 static void fixup_name(std::string &name);
386 const std::string &prop_name,
bool &prop_value);
408 IOSS_NODISCARD static std::string fixup_type(
const std::string &base,
int nodes_per_element,
432 static void check_non_null(
void *ptr,
const char *type,
const std::string &name,
433 const std::string &func);
441 IOSS_NODISCARD static bool str_equal(
const std::string &s1,
const std::string &s2);
449 IOSS_NODISCARD static bool substr_equal(
const std::string &prefix,
const std::string &str);
455 static bool check_int_to_real_overflow(
const Ioss::Field &field, int64_t *data,
478 IOSS_NODISCARD static std::string local_filename(
const std::string &relative_filename,
479 const std::string &type,
480 const std::string &working_directory);
482 static void get_fields(int64_t entity_count,
Ioss::NameList &names,
484 std::vector<Ioss::Field> &fields);
487 std::string_view inout);
489 static void calculate_sideblock_membership(
IntVector &face_is_member,
const SideBlock *sb,
490 size_t int_byte_size,
const void *element,
491 const void *sides, int64_t number_sides,
528 static void input_file(
const std::string &file_name,
Ioss::NameList *lines,
529 size_t max_line_length = 0);
533 return std::to_string(t);
554 IOSS_NODISCARD static std::string variable_name_kluge(
const std::string &name,
555 size_t component_count,
size_t copies,
571 static void generate_history_mesh(
Ioss::Region *region);
574 const std::string &header,
const std::string &suffix =
"\n\t",
575 bool detail =
false);
578 const std::string &header,
const std::string &suffix =
"\n\t",
579 bool print_empty =
false);
583 dest.insert(dest.end(), src.begin(), src.end());
584 std::sort(dest.begin(), dest.end(), std::less<>());
585 auto endIter = std::unique(dest.begin(), dest.end());
586 dest.resize(endIter - dest.begin());
591 template <
typename T>
static size_t unique(std::vector<T> &out,
bool skip_first)
604 for (; i < out.size(); ++i) {
607 pos += (newv != oldv);
591 template <
typename T>
static size_t unique(std::vector<T> &out,
bool skip_first) {
…}
618 inline std::ostream &
WarnOut(
bool output_prewarning =
true)
620 if (output_prewarning) {
618 inline std::ostream &
WarnOut(
bool output_prewarning =
true) {
…}
#define IOSS_MAYBE_UNUSED
Definition Ioss_CodeTypes.h:55
#define IOSS_NODISCARD
Definition Ioss_CodeTypes.h:56
IOSS_NODISCARD constexpr T * Data(std::vector< T > &vec)
Definition Ioss_Utils.h:58
void IOSS_ERROR(const std::ostringstream &errmsg)
Definition Ioss_Utils.h:38
An input or output Database.
Definition Ioss_DatabaseIO.h:63
Represents an element topology.
Definition Ioss_ElementTopology.h:68
Holds metadata for bulk data associated with a GroupingEntity.
Definition Ioss_Field.h:25
RoleType
Definition Ioss_Field.h:69
Base class for all 'grouping' entities. The following derived classes are typical:
Definition Ioss_GroupingEntity.h:67
A collection of Ioss::Property objects.
Definition Ioss_PropertyManager.h:36
Origin
Definition Ioss_Property.h:30
A grouping entity that contains other grouping entities.
Definition Ioss_Region.h:93
A collection of element sides having the same topology.
Definition Ioss_SideBlock.h:37
Definition Ioss_Utils.h:88
static IOSS_NODISCARD std::string to_string(const T &t)
Definition Ioss_Utils.h:531
static void insert_sort_and_unique(const Ioss::NameList &src, Ioss::NameList &dest)
Definition Ioss_Utils.h:581
static std::ostream * m_debugStream
debug output when requested. Default std::cerr
Definition Ioss_Utils.h:91
static std::ostream * m_outputStream
general informational output (very rare). Default std::cerr
Definition Ioss_Utils.h:90
static void clear(std::vector< T > &vec)
Definition Ioss_Utils.h:246
static void copy_string(char *dest, char const *source, size_t elements)
Definition Ioss_Utils.C:1293
static IOSS_NODISCARD constexpr int power_2(int count)
Definition Ioss_Utils.h:276
static void copy_string(char(&output)[size], const char *source)
Definition Ioss_Utils.h:240
static void check_dynamic_cast(const void *ptr)
Definition Ioss_Utils.h:144
static bool is_path_absolute(const std::string &path)
Definition Ioss_Utils.h:157
static IOSS_NODISCARD constexpr int number_width(const size_t number, bool use_commas=false)
Definition Ioss_Utils.h:264
static void uniquify(std::vector< T > &vec, bool skip_first=false)
Definition Ioss_Utils.h:172
static std::string m_preWarningText
Definition Ioss_Utils.h:93
static void generate_index(std::vector< T > &index)
Definition Ioss_Utils.h:183
static std::ostream * m_warningStream
IOSS warning output. Default std::cerr.
Definition Ioss_Utils.h:92
static IOSS_NODISCARD bool check_block_order(IOSS_MAYBE_UNUSED const std::vector< T * > &blocks)
Definition Ioss_Utils.h:292
static size_t unique(std::vector< T > &out, bool skip_first)
Definition Ioss_Utils.h:591
static void copy_string(char(&output)[size], const std::string &source)
Definition Ioss_Utils.h:235
static IOSS_NODISCARD T find_index_location(T node, const std::vector< T > &index)
Definition Ioss_Utils.h:195
static void copy_string(char *dest, const std::string &source, size_t elements)
Definition Ioss_Utils.h:230
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:135
static IOSS_NODISCARD std::string & get_warning_text()
Definition Ioss_Utils.h:117
static IOSS_NODISCARD std::ostream & get_warning_stream()
get the warning stream.
Definition Ioss_Utils.C:157
static IOSS_NODISCARD std::ostream & get_output_stream()
get the output stream.
Definition Ioss_Utils.C:155
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.C:142
static IOSS_NODISCARD std::ostream & get_debug_stream()
get the debug stream.
Definition Ioss_Utils.C:159
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40
std::ostream & WarnOut(bool output_prewarning=true)
Definition Ioss_Utils.h:618
std::ostream & OUTPUT()
Definition Ioss_Utils.h:614
void sort(Iter begin, Iter end, Comp compare)
Definition Ioss_Sort.h:17
ElementShape
Definition Ioss_ElementTopology.h:24
std::ostream & DebugOut()
Definition Ioss_Utils.h:616
std::vector< int > IntVector
Definition Ioss_CodeTypes.h:21
Ioss::NameList NameList
Definition Ioss_ChangeSetFactory.h:25
EntityType
The particular type of GroupingEntity.
Definition Ioss_EntityType.h:12