| 1 |
// Copyright(C) 1999-2024 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 |
#pragma once |
| 8 |
|
| 9 |
#include "Ioss_BoundingBox.h" |
| 10 |
#include "Ioss_CodeTypes.h" |
| 11 |
#include "Ioss_DBUsage.h" // for DatabaseUsage, etc |
| 12 |
#include "Ioss_DataSize.h" // for DataSize |
| 13 |
#include "Ioss_EntityType.h" // for EntityType |
| 14 |
#include "Ioss_Map.h" |
| 15 |
#include "Ioss_ParallelUtils.h" // for ParallelUtils |
| 16 |
#include "Ioss_PropertyManager.h" // for PropertyManager |
| 17 |
#include "Ioss_State.h" // for State, State::STATE_INVALID |
| 18 |
#include "Ioss_SurfaceSplit.h" // for SurfaceSplitType |
| 19 |
#include <chrono> |
| 20 |
#include <cstddef> // for size_t, nullptr |
| 21 |
#include <cstdint> // for int64_t |
| 22 |
#include <map> // for map |
| 23 |
#include <string> // for string |
| 24 |
#include <utility> // for pair |
| 25 |
#include <vector> // for vector |
| 26 |
|
| 27 |
#include "Ioss_Field.h" |
| 28 |
#include "ioss_export.h" |
| 29 |
|
| 30 |
namespace Ioss { |
| 31 |
class Assembly; |
| 32 |
class Blob; |
| 33 |
class CommSet; |
| 34 |
class EdgeBlock; |
| 35 |
class EdgeSet; |
| 36 |
class ElementBlock; |
| 37 |
class ElementSet; |
| 38 |
class ElementTopology; |
| 39 |
class FaceBlock; |
| 40 |
class FaceSet; |
| 41 |
class Field; |
| 42 |
class GroupingEntity; |
| 43 |
class NodeBlock; |
| 44 |
class NodeSet; |
| 45 |
class Region; |
| 46 |
class SideBlock; |
| 47 |
class SideSet; |
| 48 |
class StructuredBlock; |
| 49 |
} // namespace Ioss |
| 50 |
|
| 51 |
namespace Ioss { |
| 52 |
class EntityBlock; |
| 53 |
|
| 54 |
enum class DuplicateFieldBehavior { UNSET_, IGNORE_, WARNING_, ERROR_ }; |
| 55 |
|
| 56 |
// Contains (parent_element, side) topology pairs |
| 57 |
using TopoContainer = std::vector<std::pair<const ElementTopology *, const ElementTopology *>>; |
| 58 |
|
| 59 |
/** \brief An input or output Database. |
| 60 |
* |
| 61 |
*/ |
| 62 |
class IOSS_EXPORT DatabaseIO |
| 63 |
{ |
| 64 |
public: |
| 65 |
friend class SerializeIO; |
| 66 |
|
| 67 |
DatabaseIO() = delete; |
| 68 |
DatabaseIO(const DatabaseIO &) = delete; |
| 69 |
DatabaseIO(DatabaseIO &&) = delete; |
| 70 |
DatabaseIO &operator=(const DatabaseIO &) = delete; |
| 71 |
DatabaseIO &operator=(DatabaseIO &&) = delete; |
| 72 |
virtual ~DatabaseIO(); |
| 73 |
|
| 74 |
/** \brief Check to see if database state is OK. |
| 75 |
* |
| 76 |
* \param[in] write_message If true, then output a warning message indicating the problem. |
| 77 |
* \param[in,out] error_message If non-null on input, then a warning message on output. |
| 78 |
* \param[in,out] bad_count If non-null on input, then count of the number of processors |
| 79 |
* where the file does not exist on output. If ok returns false, but |
| 80 |
* *bad_count==0, |
| 81 |
* then the routine does not support this argument. |
| 82 |
* \returns True if database state is OK. False if not. |
| 83 |
*/ |
| 84 |
IOSS_NODISCARD bool ok(bool write_message = false, std::string *error_message = nullptr, |
| 85 |
int *bad_count = nullptr) const |
| 86 |
{ |
| 87 |
IOSS_FUNC_ENTER(m_); |
| 88 |
return ok_nl(write_message, error_message, bad_count); |
| 89 |
} |
| 90 |
|
| 91 |
// Check capabilities of input/output database... Returns an |
| 92 |
// unsigned int with the supported Ioss::EntityTypes or'ed |
| 93 |
// together. If "return_value & Ioss::EntityType" is set, then the |
| 94 |
// database supports that type (e.g. return_value & Ioss::FACESET) |
| 95 |
IOSS_NODISCARD virtual unsigned entity_field_support() const = 0; |
| 96 |
|
| 97 |
IOSS_NODISCARD bool using_parallel_io() const { return usingParallelIO; } |
| 98 |
|
| 99 |
/** \brief Get the local (process-specific) node number corresponding to a global node number. |
| 100 |
* |
| 101 |
* \param[in] global The global node number |
| 102 |
* \param[in] must_exist If true, error will occur if the global node number is not |
| 103 |
* mapped to any local node number on the current process. |
| 104 |
* \returns The local node number |
| 105 |
*/ |
| 106 |
IOSS_NODISCARD int64_t node_global_to_local(int64_t global, bool must_exist) const |
| 107 |
{ |
| 108 |
IOSS_FUNC_ENTER(m_); |
| 109 |
return node_global_to_local_nl(global, must_exist); |
| 110 |
} |
| 111 |
|
| 112 |
IOSS_NODISCARD int64_t element_global_to_local(int64_t global) const |
| 113 |
{ |
| 114 |
IOSS_FUNC_ENTER(m_); |
| 115 |
return element_global_to_local_nl(global); |
| 116 |
} |
| 117 |
|
| 118 |
/** If there is a single block of nodes in the model, then it is |
| 119 |
* considered a node_major() database. If instead the nodes are |
| 120 |
* local to each element block or structured block, then it is |
| 121 |
* not a node_major database. Exodus is node major, CGNS is not. |
| 122 |
*/ |
| 123 |
IOSS_NODISCARD virtual bool node_major() const { return true; } |
| 124 |
|
| 125 |
// Eliminate as much memory as possible, but still retain meta data information |
| 126 |
// Typically, eliminate the maps... |
| 127 |
void release_memory() |
| 128 |
{ |
| 129 |
IOSS_FUNC_ENTER(m_); |
| 130 |
release_memory_nl(); |
| 131 |
} |
| 132 |
|
| 133 |
// Do anything that might be needed to the database prior to it |
| 134 |
// being closed and destructed. |
| 135 |
virtual void finalize_database() const {} |
| 136 |
|
| 137 |
// Let's save the name on disk after Filename gets modified, e.g: decoded_filename |
| 138 |
void set_pfs_name(const std::string &name) const { pfsName = name; } |
| 139 |
|
| 140 |
IOSS_NODISCARD std::string get_pfs_name() const { return pfsName; } |
| 141 |
|
| 142 |
/** \brief this will be the name in BB namespace |
| 143 |
*/ |
| 144 |
void set_dw_name(const std::string &name) const { bbName = name; } |
| 145 |
|
| 146 |
IOSS_NODISCARD std::string get_dw_name() const |
| 147 |
{ |
| 148 |
if (!bbName.empty() && !is_input() && using_dw()) { |
| 149 |
return bbName; |
| 150 |
} |
| 151 |
return get_filename(); |
| 152 |
} |
| 153 |
|
| 154 |
/** \brief We call this ONLY after we assure that using_dw() is TRUE |
| 155 |
* \returns mount point of Datawarp namespace, e.g: `/opt/cray/....<jobid>` |
| 156 |
*/ |
| 157 |
IOSS_NODISCARD std::string get_dw_path() const { return dwPath; } |
| 158 |
|
| 159 |
/** Determine whether Cray Datawarp module is loaded and we have BB capacity allocated for this |
| 160 |
* job ( i.e: DW_JOB_STRIPED is set) && IOSS property to use DATAWARP is set to Y/YES (i.e |
| 161 |
* environmental variable ENABLE_DATAWARP) . If we are using DW then set some pathnames for |
| 162 |
* writing directly to BB instead of PFS(i.e Lustre) |
| 163 |
*/ |
| 164 |
void check_set_dw() const; |
| 165 |
|
| 166 |
/** Set if Cray Datawarp exists and allocated space is found , i.e PATH to DW name space |
| 167 |
*/ |
| 168 |
IOSS_NODISCARD bool using_dw() const { return usingDataWarp; } |
| 169 |
|
| 170 |
/** \brief Get the file name associated with the database. |
| 171 |
* |
| 172 |
* \returns The database file name. |
| 173 |
*/ |
| 174 |
IOSS_NODISCARD std::string get_filename() const { return DBFilename; } |
| 175 |
|
| 176 |
/** For the database types that support it, return an integer `handle` |
| 177 |
* through which a client can directly access the underlying file. |
| 178 |
* Please use sparingly and with discretion. Basically, a kluge |
| 179 |
*/ |
| 180 |
IOSS_NODISCARD virtual int get_file_pointer() const { return 0; } |
| 181 |
|
| 182 |
/** \brief Get a file-per-processor filename associated with the database. |
| 183 |
* |
| 184 |
* \returns The file-per-processor name for a file on this processor. |
| 185 |
*/ |
| 186 |
IOSS_NODISCARD const std::string &decoded_filename() const; |
| 187 |
|
| 188 |
/** Return a string specifying underlying format of database (exodus, cgns, ...) */ |
| 189 |
IOSS_NODISCARD virtual std::string get_format() const = 0; |
| 190 |
|
| 191 |
/** \brief Determine whether the database is an input database. |
| 192 |
* |
| 193 |
* \returns True if the database is an input database. False otherwise. |
| 194 |
*/ |
| 195 |
IOSS_NODISCARD bool is_input() const { return isInput; } |
| 196 |
|
| 197 |
/** \brief Get the Ioss::DatabaseUsage type of the database. |
| 198 |
* |
| 199 |
* \returns The Ioss::DatabaseUsage type of the database. |
| 200 |
*/ |
| 201 |
IOSS_NODISCARD Ioss::DatabaseUsage usage() const { return dbUsage; } |
| 202 |
|
| 203 |
/** \brief Determine whether the database needs information about process ownership of nodes. |
| 204 |
* |
| 205 |
* \returns True if database needs information about process ownership of nodes. |
| 206 |
*/ |
| 207 |
IOSS_NODISCARD virtual bool needs_shared_node_information() const { return false; } |
| 208 |
|
| 209 |
IOSS_NODISCARD Ioss::IfDatabaseExistsBehavior open_create_behavior() const; |
| 210 |
|
| 211 |
void set_region(Region *region) { region_ = region; } |
| 212 |
|
| 213 |
/** \brief If we are planning to use BB(aka Burst Buffer) service, we will call |
| 214 |
* simple C API provided by Cray DataWarp module. |
| 215 |
* |
| 216 |
* Note: We would only like to use BB during write to avoid cache coherency issues during |
| 217 |
* read. `dwPath` is the DW namespace which gets set during runtime from environment variable |
| 218 |
* DW_JOB_STRIPED. Afterword, `using_dw()` function is used extensively for filename redirection |
| 219 |
* for all related subsequent functions(e.g: get_filename, get_file_ptr etc) once burst buffer |
| 220 |
* is found and set to be used. |
| 221 |
*/ |
| 222 |
void open_dw(const std::string &filename) const; |
| 223 |
|
| 224 |
/** \brief Function which invokes stageout from BB to Disk, prior to completion of final close |
| 225 |
*/ |
| 226 |
void close_dw() const; |
| 227 |
|
| 228 |
void openDatabase() const |
| 229 |
{ |
| 230 |
IOSS_FUNC_ENTER(m_); |
| 231 |
progress(__func__); |
| 232 |
openDatabase_nl(); |
| 233 |
} |
| 234 |
|
| 235 |
void closeDatabase() const |
| 236 |
{ |
| 237 |
IOSS_FUNC_ENTER(m_); |
| 238 |
progress(__func__); |
| 239 |
closeDatabase_nl(); |
| 240 |
} |
| 241 |
|
| 242 |
void flush_database() const |
| 243 |
{ |
| 244 |
IOSS_FUNC_ENTER(m_); |
| 245 |
progress(__func__); |
| 246 |
flush_database_nl(); |
| 247 |
} |
| 248 |
|
| 249 |
void reset_database() |
| 250 |
{ |
| 251 |
IOSS_FUNC_ENTER(m_); |
| 252 |
progress(__func__); |
| 253 |
reset_database_nl(); |
| 254 |
} |
| 255 |
|
| 256 |
/** \brief If a database type supports internal change sets and if the database |
| 257 |
* contains internal change sets, open the specified set. |
| 258 |
* |
| 259 |
* \param[in] set_name The name of the set to open. |
| 260 |
* \returns True if successful. |
| 261 |
*/ |
| 262 |
bool open_internal_change_set(const std::string &set_name) |
| 263 |
{ |
| 264 |
IOSS_FUNC_ENTER(m_); |
| 265 |
return open_internal_change_set_nl(set_name); |
| 266 |
} |
| 267 |
|
| 268 |
/** \brief If a database type supports internal change sets, create the |
| 269 |
* specified set. |
| 270 |
* |
| 271 |
* \param[in] set_name The name of the set to create. |
| 272 |
* \returns True if successful. |
| 273 |
*/ |
| 274 |
bool create_internal_change_set(const std::string &set_name) |
| 275 |
{ |
| 276 |
IOSS_FUNC_ENTER(m_); |
| 277 |
return create_internal_change_set_nl(set_name); |
| 278 |
} |
| 279 |
|
| 280 |
/** \brief If a database type supports internal change sets, and if the database |
| 281 |
* contains internal change sets, return the number of change sets. |
| 282 |
*/ |
| 283 |
int num_internal_change_set() |
| 284 |
{ |
| 285 |
IOSS_FUNC_ENTER(m_); |
| 286 |
return num_internal_change_set_nl(); |
| 287 |
} |
| 288 |
|
| 289 |
/** \brief If a database type supports internal change sets, open the change set |
| 290 |
* specified [zero-based] index |
| 291 |
* |
| 292 |
* \param[in] child_index The [zero-based] index of the internal change set to open. |
| 293 |
* \returns True if successful. |
| 294 |
*/ |
| 295 |
bool open_internal_change_set(int set_index) |
| 296 |
{ |
| 297 |
IOSS_FUNC_ENTER(m_); |
| 298 |
return open_internal_change_set_nl(set_index); |
| 299 |
} |
| 300 |
|
| 301 |
/** \brief If a database type supports internal change sets, return a list of set names |
| 302 |
* |
| 303 |
* \param[in] return_full_names Flag to control return of relative |
| 304 |
* or full set name paths. |
| 305 |
* \returns True if successful. |
| 306 |
*/ |
| 307 |
Ioss::NameList internal_change_set_describe(bool return_full_names = false) |
| 308 |
{ |
| 309 |
IOSS_FUNC_ENTER(m_); |
| 310 |
return internal_change_set_describe_nl(return_full_names); |
| 311 |
} |
| 312 |
|
| 313 |
/** \brief Checks if a database type supports internal change sets |
| 314 |
* |
| 315 |
* \returns True if successful. |
| 316 |
*/ |
| 317 |
bool supports_internal_change_set() |
| 318 |
{ |
| 319 |
IOSS_FUNC_ENTER(m_); |
| 320 |
return supports_internal_change_set_nl(); |
| 321 |
} |
| 322 |
|
| 323 |
IOSS_NODISCARD virtual std::string get_internal_change_set_name() const { return ""; } |
| 324 |
|
| 325 |
/** \brief Set the database to the given State. |
| 326 |
* |
| 327 |
* All transitions must begin from the 'STATE_CLOSED' state or be to |
| 328 |
* the 'STATE_CLOSED' state (There are no nested begin/end pairs at |
| 329 |
* this time.) |
| 330 |
* |
| 331 |
* The database state is automatically set when Region::begin_mode is called |
| 332 |
* for its associated region, so it may not be necessary to call this method |
| 333 |
* directly. |
| 334 |
* |
| 335 |
* \param[in] state The new State to which the database should be set. |
| 336 |
* \returns True if successful. |
| 337 |
* |
| 338 |
*/ |
| 339 |
bool begin(Ioss::State state) |
| 340 |
{ |
| 341 |
IOSS_FUNC_ENTER(m_); |
| 342 |
progress(__func__); |
| 343 |
return begin_nl(state); |
| 344 |
} |
| 345 |
|
| 346 |
/** \brief Return the database to STATE_CLOSED. |
| 347 |
* |
| 348 |
* The database is automatically set to STATE_CLOSED when Region::end_mode |
| 349 |
* is called for its associated region, so it may not be necessary to call this |
| 350 |
* method directly. |
| 351 |
* |
| 352 |
* \param[in] state The State to end, i.e. the current state. |
| 353 |
* \returns True if successful. |
| 354 |
* |
| 355 |
*/ |
| 356 |
bool end(Ioss::State state) |
| 357 |
{ |
| 358 |
IOSS_FUNC_ENTER(m_); |
| 359 |
progress(__func__); |
| 360 |
return end_nl(state); |
| 361 |
} |
| 362 |
|
| 363 |
bool begin_state(int state, double time); |
| 364 |
bool end_state(int state, double time); |
| 365 |
|
| 366 |
// Metadata-related functions. |
| 367 |
void read_meta_data() |
| 368 |
{ |
| 369 |
IOSS_FUNC_ENTER(m_); |
| 370 |
progress("Begin read_meta_data()"); |
| 371 |
read_meta_data_nl(); |
| 372 |
progress("End read_meta_data()"); |
| 373 |
} |
| 374 |
|
| 375 |
void get_step_times() |
| 376 |
{ |
| 377 |
IOSS_FUNC_ENTER(m_); |
| 378 |
get_step_times_nl(); |
| 379 |
} |
| 380 |
|
| 381 |
/** \brief Return the list of timesteps in the database contingent on certain |
| 382 |
* controlling properties. |
| 383 |
* |
| 384 |
* This is different from get_step_times() in that it does not set timestep |
| 385 |
* data on the region. If the database supports change sets, it will return the |
| 386 |
* timestep data for the current change set |
| 387 |
* |
| 388 |
* \returns timesteps. |
| 389 |
* |
| 390 |
*/ |
| 391 |
std::vector<double> get_db_step_times() |
| 392 |
{ |
| 393 |
IOSS_FUNC_ENTER(m_); |
| 394 |
return get_db_step_times_nl(); |
| 395 |
} |
| 396 |
|
| 397 |
IOSS_NODISCARD virtual bool internal_edges_available() const { return false; } |
| 398 |
IOSS_NODISCARD virtual bool internal_faces_available() const { return false; } |
| 399 |
|
| 400 |
// Information Records: |
| 401 |
|
| 402 |
/** \brief Get all information records (informative strings) for the database. |
| 403 |
* |
| 404 |
* \returns The informative strings. |
| 405 |
*/ |
| 406 |
IOSS_NODISCARD const Ioss::NameList &get_information_records() const |
| 407 |
{ |
| 408 |
return informationRecords; |
| 409 |
} |
| 410 |
void add_information_records(const Ioss::NameList &info); |
| 411 |
void add_information_record(const std::string &info); |
| 412 |
|
| 413 |
// QA Records: |
| 414 |
|
| 415 |
/** \brief Get all QA records, each of which consists of 4 strings, from the database |
| 416 |
* |
| 417 |
* The 4 strings that make up a database QA record are: |
| 418 |
* |
| 419 |
* 1. A descriptive code name, such as the application that modified the database. |
| 420 |
* |
| 421 |
* 2. A descriptive string, such as the version of the application that modified the database. |
| 422 |
* |
| 423 |
* 3. A relevant date, such as the date the database was modified. |
| 424 |
* |
| 425 |
* 4. A relevant time, such as the time the database was modified. |
| 426 |
* |
| 427 |
* \returns All QA records in a single vector. Every 4 consecutive elements of the |
| 428 |
* vector make up a single QA record. |
| 429 |
*/ |
| 430 |
IOSS_NODISCARD const Ioss::NameList &get_qa_records() const { return qaRecords; } |
| 431 |
void add_qa_record(const std::string &code, const std::string &code_qa, const std::string &date, |
| 432 |
const std::string &time); |
| 433 |
|
| 434 |
IOSS_NODISCARD bool get_logging() const { return doLogging && !singleProcOnly; } |
| 435 |
void set_logging(bool on_off) { doLogging = on_off; } |
| 436 |
IOSS_NODISCARD bool get_nan_detection() const { return doNanDetection; } |
| 437 |
void set_nan_detection(bool on_off) { doNanDetection = on_off; } |
| 438 |
|
| 439 |
// The get_field and put_field functions are just a wrapper around the |
| 440 |
// pure virtual get_field_internal and put_field_internal functions, |
| 441 |
// but this lets me add some debug/checking/common code to the |
| 442 |
// functions without having to do it in the calling code or in the |
| 443 |
// derived classes code. This also fulfills the heuristic that a |
| 444 |
// public interface should not contain pure virtual functions. |
| 445 |
template <typename T> |
| 446 |
int64_t get_field(const T *reg, const Field &field, void *data, size_t data_size) const |
| 447 |
{ |
| 448 |
IOSS_FUNC_ENTER(m_); |
| 449 |
verify_and_log(reg, field, 1); |
| 450 |
int64_t retval = get_field_internal(reg, field, data, data_size); |
| 451 |
if (get_nan_detection()) { |
| 452 |
verify_field_data(reg, field, Ioss::Field::InOut::INPUT, data); |
| 453 |
} |
| 454 |
verify_and_log(nullptr, field, 1); |
| 455 |
return retval; |
| 456 |
} |
| 457 |
|
| 458 |
template <typename T> |
| 459 |
int64_t put_field(const T *reg, const Field &field, void *data, size_t data_size) const |
| 460 |
{ |
| 461 |
IOSS_FUNC_ENTER(m_); |
| 462 |
verify_and_log(reg, field, 0); |
| 463 |
if (get_nan_detection()) { |
| 464 |
verify_field_data(reg, field, Ioss::Field::InOut::OUTPUT, data); |
| 465 |
} |
| 466 |
int64_t retval = put_field_internal(reg, field, data, data_size); |
| 467 |
verify_and_log(nullptr, field, 0); |
| 468 |
return retval; |
| 469 |
} |
| 470 |
|
| 471 |
template <typename T> |
| 472 |
int64_t get_zc_field(const T *reg, const Field &field, void **data, size_t *data_size) const |
| 473 |
{ |
| 474 |
IOSS_FUNC_ENTER(m_); |
| 475 |
verify_and_log(reg, field, 1); |
| 476 |
int64_t retval = get_zc_field_internal(reg, field, data, data_size); |
| 477 |
if (get_nan_detection()) { |
| 478 |
verify_field_data(reg, field, Ioss::Field::InOut::INPUT, data); |
| 479 |
} |
| 480 |
verify_and_log(nullptr, field, 1); |
| 481 |
return retval; |
| 482 |
} |
| 483 |
|
| 484 |
/** Determine whether application will make field data get/put calls parallel consistently. |
| 485 |
* |
| 486 |
* True is default and required for parallel-io databases. |
| 487 |
* Even if false, metadata operations must be called by all processors. |
| 488 |
* |
| 489 |
* \returns True if application will make field data get/put calls parallel consistently. |
| 490 |
* |
| 491 |
*/ |
| 492 |
IOSS_NODISCARD bool is_parallel_consistent() const { return isParallelConsistent; } |
| 493 |
void set_parallel_consistency(bool on_off) { isParallelConsistent = on_off; } |
| 494 |
|
| 495 |
IOSS_NODISCARD bool get_use_generic_canonical_name() const { return useGenericCanonicalName; } |
| 496 |
void set_use_generic_canonical_name(bool yes_no) { useGenericCanonicalName = yes_no; } |
| 497 |
|
| 498 |
IOSS_NODISCARD bool ignore_database_names() const { return ignoreDatabaseNames; } |
| 499 |
void ignore_database_names(bool yes_no) { ignoreDatabaseNames = yes_no; } |
| 500 |
|
| 501 |
IOSS_NODISCARD bool get_ignore_realn_fields() const { return m_ignoreRealnFields; } |
| 502 |
void set_ignore_realn_fields(bool yes_no) { m_ignoreRealnFields = yes_no; } |
| 503 |
|
| 504 |
/** \brief Get the length of the longest name in the database file. |
| 505 |
* |
| 506 |
* \returns The length, or 0 for unlimited. |
| 507 |
*/ |
| 508 |
IOSS_NODISCARD virtual int maximum_symbol_length() const |
| 509 |
{ |
| 510 |
return 0; |
| 511 |
} // Default is unlimited... |
| 512 |
virtual void set_maximum_symbol_length(int /* requested_symbol_size */) { |
| 513 |
} // Default does nothing... |
| 514 |
|
| 515 |
IOSS_NODISCARD std::string get_component_name(const Ioss::Field &field, |
| 516 |
Ioss::Field::InOut in_out, int component) const; |
| 517 |
IOSS_NODISCARD char get_field_separator() const { return fieldSeparator; } |
| 518 |
IOSS_NODISCARD bool get_field_recognition() const { return enableFieldRecognition; } |
| 519 |
IOSS_NODISCARD bool get_field_strip_trailing_() const { return fieldStripTrailing_; } |
| 520 |
void set_field_separator(char separator); |
| 521 |
void set_field_recognition(bool yes_no) { enableFieldRecognition = yes_no; } |
| 522 |
void set_field_strip_trailing_(bool yes_no) { fieldStripTrailing_ = yes_no; } |
| 523 |
|
| 524 |
IOSS_NODISCARD DuplicateFieldBehavior get_duplicate_field_behavior() const |
| 525 |
{ |
| 526 |
return duplicateFieldBehavior; |
| 527 |
} |
| 528 |
|
| 529 |
void set_lower_case_variable_names(bool true_false) const |
| 530 |
{ |
| 531 |
lowerCaseVariableNames = true_false; |
| 532 |
} |
| 533 |
|
| 534 |
/* \brief Set the method used to split sidesets into homogeneous blocks. |
| 535 |
* |
| 536 |
* \param[in] split_type The desired method. |
| 537 |
* |
| 538 |
*/ |
| 539 |
void set_surface_split_type(Ioss::SurfaceSplitType split_type) { splitType = split_type; } |
| 540 |
IOSS_NODISCARD Ioss::SurfaceSplitType get_surface_split_type() const { return splitType; } |
| 541 |
|
| 542 |
void set_block_omissions(const Ioss::NameList &omissions, |
| 543 |
const Ioss::NameList &inclusions = {}); |
| 544 |
|
| 545 |
void set_assembly_omissions(const Ioss::NameList &omissions, |
| 546 |
const Ioss::NameList &inclusions = {}); |
| 547 |
|
| 548 |
void get_block_adjacencies(const Ioss::ElementBlock *eb, Ioss::NameList &block_adjacency) const |
| 549 |
{ |
| 550 |
return get_block_adjacencies_nl(eb, block_adjacency); |
| 551 |
} |
| 552 |
void compute_block_membership(Ioss::SideBlock *efblock, Ioss::NameList &block_membership) const |
| 553 |
{ |
| 554 |
return compute_block_membership_nl(efblock, block_membership); |
| 555 |
} |
| 556 |
|
| 557 |
IOSS_NODISCARD AxisAlignedBoundingBox get_bounding_box(const Ioss::NodeBlock *nb) const; |
| 558 |
IOSS_NODISCARD AxisAlignedBoundingBox get_bounding_box(const Ioss::ElementBlock *eb) const; |
| 559 |
IOSS_NODISCARD AxisAlignedBoundingBox get_bounding_box(const Ioss::StructuredBlock *sb) const; |
| 560 |
|
| 561 |
IOSS_NODISCARD virtual int int_byte_size_db() const = 0; //! Returns 4 or 8 |
| 562 |
IOSS_NODISCARD int int_byte_size_api() const; //! Returns 4 or 8 |
| 563 |
virtual void set_int_byte_size_api(Ioss::DataSize size) const; |
| 564 |
IOSS_NODISCARD Ioss::DataSize int_byte_size_data_size() const; |
| 565 |
|
| 566 |
/*! |
| 567 |
* The owning region of this database. |
| 568 |
*/ |
| 569 |
IOSS_NODISCARD Region *get_region() const { return region_; } |
| 570 |
|
| 571 |
/*! |
| 572 |
* The overlay_count specifies the number of restart outputs |
| 573 |
* which will be overlaid on top of the currently written |
| 574 |
* step before advancing to the next step on the restart |
| 575 |
* database. |
| 576 |
* |
| 577 |
* For example, if restarts are being output every 0.1 |
| 578 |
* seconds and the overlay count is specified as 2, then |
| 579 |
* restart will write time 0.1 to step 1 of the database. |
| 580 |
* It will then write 0.2 and 0.3 also to step 1. It will |
| 581 |
* then increment the database step and write 0.4 to step 2; |
| 582 |
* overlay 0.5 and 0.6 on step 2... At the end of the |
| 583 |
* analysis, assuming it runs to completion, the database |
| 584 |
* would have times 0.3, 0.6, 0.9, ... However, if there |
| 585 |
* were a problem during the analysis, the last step on the |
| 586 |
* database would contain an intermediate step. |
| 587 |
* |
| 588 |
* The cycle_count specifies the number of restart steps |
| 589 |
* which will be written to the restart database before |
| 590 |
* previously written steps are overwritten. |
| 591 |
* |
| 592 |
* For example, if the cycle count is 5 and restart is written every 0.1 |
| 593 |
* seconds, the restart system will write data at times 0.1, 0.2, 0.3, |
| 594 |
* 0.4, 0.5 to the database. |
| 595 |
* |
| 596 |
* It will then overwrite the first step with data from time 0.6, the |
| 597 |
* second with time 0.7. At time 0.8, the database would contain data at |
| 598 |
* times 0.6, 0.7, 0.8, 0.4, 0.5. Note that time will not necessarily be |
| 599 |
* monotonically increasing on a database that specifies the cycle |
| 600 |
* count. |
| 601 |
* |
| 602 |
* The cycle count and overlay count can both be used at the same time |
| 603 |
* also. The basic formula is: |
| 604 |
* |
| 605 |
* db_step = (((output_step - 1) / overlay) % cycle) + 1 |
| 606 |
* |
| 607 |
* where "output_step" is the step that this would have been on the |
| 608 |
* database in a normal write (1,2,3,....) and "db_step" is the step |
| 609 |
* number that this will be written to. |
| 610 |
* |
| 611 |
* If you only want the last step available on the database, |
| 612 |
* use set_cycle_count(1) |
| 613 |
*/ |
| 614 |
void set_cycle_count(int count) const { cycleCount = count; } |
| 615 |
IOSS_NODISCARD int get_cycle_count() const { return cycleCount; } |
| 616 |
void set_overlay_count(int count) const { overlayCount = count; } |
| 617 |
IOSS_NODISCARD int get_overlay_count() const { return overlayCount; } |
| 618 |
void set_file_per_state(bool yes_no) const { filePerState = yes_no; } |
| 619 |
IOSS_NODISCARD bool get_file_per_state() const { return filePerState; } |
| 620 |
|
| 621 |
void set_time_scale_factor(double factor) { timeScaleFactor = factor; } |
| 622 |
|
| 623 |
IOSS_NODISCARD const Ioss::ParallelUtils &util() const { return util_; } |
| 624 |
IOSS_NODISCARD const Ioss::PropertyManager &get_property_manager() const { return properties; } |
| 625 |
/** \brief Get the processor that this mesh database is on. |
| 626 |
* |
| 627 |
* \returns The processor that this mesh database is on. |
| 628 |
*/ |
| 629 |
IOSS_NODISCARD int parallel_rank() const { return myProcessor; } |
| 630 |
IOSS_NODISCARD int parallel_size() const { return util().parallel_size(); } |
| 631 |
IOSS_NODISCARD bool is_parallel() const { return isParallel; } |
| 632 |
|
| 633 |
void progress(const std::string &output) const |
| 634 |
{ |
| 635 |
if (m_enableTracing) { |
| 636 |
util().progress(output); |
| 637 |
} |
| 638 |
} |
| 639 |
|
| 640 |
virtual std::vector<size_t> |
| 641 |
get_entity_field_data(const std::string &field_name, |
| 642 |
const std::vector<Ioss::ElementBlock *> &elem_blocks, void *data, |
| 643 |
size_t data_size) const; |
| 644 |
|
| 645 |
protected: |
| 646 |
DatabaseIO(Region *region, std::string filename, Ioss::DatabaseUsage db_usage, |
| 647 |
Ioss_MPI_Comm communicator, const Ioss::PropertyManager &props); |
| 648 |
|
| 649 |
/*! |
| 650 |
* The properties member data contains properties that can be |
| 651 |
* used to set database-specific options. Examples include |
| 652 |
* compression, name lengths, integer sizes, floating point |
| 653 |
* sizes. By convention, the property name is all |
| 654 |
* uppercase. Some existing properties recognized by the Exodus |
| 655 |
* DatabaseIO class are: |
| 656 |
* |
| 657 |
* | Property | Value |
| 658 |
* |-----------------------|------------------- |
| 659 |
* | COMPRESSION_LEVEL | In the range [0..9]. A value of 0 indicates no compression |
| 660 |
* | COMPRESSION_SHUFFLE | (true/false) to enable/disable hdf5's shuffle compression |
| 661 |
* algorithm. |
| 662 |
* | FILE_TYPE | netcdf4 |
| 663 |
* | MAXIMUM_NAME_LENGTH | Maximum length of names that will be returned/passed via api call. |
| 664 |
* | INTEGER_SIZE_DB | 4 or 8 indicating byte size of integers stored on the database. |
| 665 |
* | INTEGER_SIZE_API | 4 or 8 indicating byte size of integers used in api functions. |
| 666 |
* | LOGGING | (true/false) to enable/disable logging of field input/output |
| 667 |
*/ |
| 668 |
|
| 669 |
Ioss::PropertyManager properties; |
| 670 |
|
| 671 |
/*! |
| 672 |
* Utility function that may be used by derived classes. |
| 673 |
* Determines whether all elements in the model have the same side |
| 674 |
* topology. This can be used to speed-up certain algorithms since |
| 675 |
* they don't have to check each side (or group of sides) |
| 676 |
* individually. |
| 677 |
*/ |
| 678 |
void set_common_side_topology() const; |
| 679 |
ElementTopology *commonSideTopology{nullptr}; |
| 680 |
|
| 681 |
template <typename T> |
| 682 |
void create_groups(const std::string &property_name, EntityType type, |
| 683 |
const std::string &type_name, const T *set_type); |
| 684 |
template <typename T> |
| 685 |
void create_group(EntityType type, const std::string &type_name, |
| 686 |
const Ioss::NameList &group_spec, const T *set_type); |
| 687 |
|
| 688 |
// Create new sets as groups of existing exodus sets... |
| 689 |
void handle_groups(); |
| 690 |
|
| 691 |
/*! |
| 692 |
* Filename that this Database is connected with. Derived |
| 693 |
* DatabaseIO classes may need to change this if the passed in |
| 694 |
* filename is not the same as the filename actually used E.g., |
| 695 |
* the Ioex_DatabaseIO (exodusII) changes if this is a parallel |
| 696 |
* run since the passed in filename is just the basename, not the |
| 697 |
* processor-specific filename. |
| 698 |
*/ |
| 699 |
std::string originalDBFilename{}; |
| 700 |
std::string DBFilename{}; |
| 701 |
mutable std::string decodedFilename{}; |
| 702 |
|
| 703 |
/*! |
| 704 |
* `bbName` is a temporary swizzled name which resides inside Burst Buffer namespace. |
| 705 |
* This is a private trivial mapped name vs original `DBFilename` (which resides in |
| 706 |
* permanent storage backed by parallel filesystem. |
| 707 |
* `dwPath` is global BB mountpoint for current job with requested capacity via SLURM \c \#DW |
| 708 |
* directive. `usingDataWarp` -- a boolean, for convenience of use so that we don't have to do |
| 709 |
* getenv() calls to see if BB present. |
| 710 |
*/ |
| 711 |
mutable std::string bbName{}; |
| 712 |
mutable std::string pfsName{}; |
| 713 |
mutable std::string dwPath{}; |
| 714 |
|
| 715 |
mutable Ioss::State dbState{STATE_INVALID}; |
| 716 |
|
| 717 |
int myProcessor{0}; //!< number of processor this database is for |
| 718 |
|
| 719 |
int64_t nodeCount{0}; |
| 720 |
int64_t elementCount{0}; |
| 721 |
|
| 722 |
/*! |
| 723 |
* Check the topology of all face/element pairs in the model and |
| 724 |
* fill the "TopoContainer faceTopology" variable with the |
| 725 |
* unique pairs. This information is used for the |
| 726 |
* faceblock/facesets and edgeblock/edgesets. If the |
| 727 |
* 'topo_dimension' is 2, then face/element pairs are generated; if |
| 728 |
* 'topo_dimension' is 1, then edge/element pairs are generated. |
| 729 |
*/ |
| 730 |
void check_side_topology() const; |
| 731 |
|
| 732 |
/// Used to speed up faceblock/edgeblock calculations. |
| 733 |
TopoContainer sideTopology{}; |
| 734 |
|
| 735 |
/*! Typically used for restart output, but can be used for all output... |
| 736 |
* Maximum number of states on the output file. Overwrite the existing |
| 737 |
* steps in a cyclic manner once exceed this count. Note that this breaks |
| 738 |
* the convention that times be monotonically increasing on an exodusII file. |
| 739 |
* Used by derived classes if they support this capability... |
| 740 |
*/ |
| 741 |
mutable int cycleCount{0}; |
| 742 |
|
| 743 |
mutable int overlayCount{0}; |
| 744 |
|
| 745 |
/*! Scale the time read/written from/to the file by the specified |
| 746 |
scaleFactor. If the database times are 0.1, 0.2, 0.3 and the |
| 747 |
scaleFactor is 20, then the application will think that the |
| 748 |
times read are 2.0, 4.0, 6.0. |
| 749 |
|
| 750 |
If specified for an output database, then the analysis time |
| 751 |
is divided by the scaleFactor time prior to output. |
| 752 |
*/ |
| 753 |
double timeScaleFactor{1.0}; |
| 754 |
|
| 755 |
Ioss::SurfaceSplitType splitType{SPLIT_BY_TOPOLOGIES}; |
| 756 |
Ioss::DatabaseUsage dbUsage{}; |
| 757 |
|
| 758 |
mutable Ioss::DataSize dbIntSizeAPI{USE_INT32_API}; |
| 759 |
|
| 760 |
/*! EXPERIMENTAL If this is true, then each state (timestep) |
| 761 |
* output will be directed to a separate file. Currently this is |
| 762 |
* only implemented for the exodus (parallel or serial, single |
| 763 |
* file or fpp) database type. |
| 764 |
*/ |
| 765 |
mutable bool filePerState{false}; |
| 766 |
mutable bool usingDataWarp{false}; |
| 767 |
bool isParallel{false}; //!< true if running in parallel |
| 768 |
|
| 769 |
mutable bool lowerCaseVariableNames{true}; |
| 770 |
bool usingParallelIO{false}; |
| 771 |
|
| 772 |
// List of element blocks that should be omitted or included from |
| 773 |
// this model. Surfaces will take this into account while |
| 774 |
// splitting; however, node and nodesets will not be filtered |
| 775 |
// (perhaps this will be done at a later time...) NOTE: All local |
| 776 |
// element ids and offsets are still calculated assuming that the |
| 777 |
// blocks exist in the model... |
| 778 |
// Only one of these can have values and the other must be empty. |
| 779 |
Ioss::NameList blockOmissions{}; |
| 780 |
Ioss::NameList blockInclusions{}; |
| 781 |
Ioss::NameList assemblyOmissions{}; |
| 782 |
Ioss::NameList assemblyInclusions{}; |
| 783 |
|
| 784 |
Ioss::NameList informationRecords{}; |
| 785 |
Ioss::NameList qaRecords{}; |
| 786 |
|
| 787 |
//---Node Map -- Maps internal (1..NUMNP) ids to global ids used on the |
| 788 |
// application side. global = nodeMap[local] |
| 789 |
mutable Ioss::Map nodeMap{"node", DBFilename, myProcessor}; |
| 790 |
mutable Ioss::Map edgeMap{"edge", DBFilename, myProcessor}; |
| 791 |
mutable Ioss::Map faceMap{"face", DBFilename, myProcessor}; |
| 792 |
mutable Ioss::Map elemMap{"element", DBFilename, myProcessor}; |
| 793 |
|
| 794 |
mutable std::vector<std::vector<bool>> blockAdjacency; |
| 795 |
|
| 796 |
virtual void openDatabase_nl() const; |
| 797 |
virtual void closeDatabase_nl() const; |
| 798 |
virtual void flush_database_nl() const {} |
| 799 |
|
| 800 |
virtual void release_memory_nl(); |
| 801 |
|
| 802 |
virtual void reset_database_nl(); |
| 803 |
|
| 804 |
private: |
| 805 |
virtual bool ok_nl(bool /* write_message */, std::string * /* error_message */, |
| 806 |
int *bad_count) const |
| 807 |
{ |
| 808 |
if (bad_count != nullptr) { |
| 809 |
*bad_count = 0; |
| 810 |
} |
| 811 |
return dbState != Ioss::STATE_INVALID; |
| 812 |
} |
| 813 |
|
| 814 |
virtual int64_t node_global_to_local_nl(int64_t global, bool must_exist) const |
| 815 |
{ |
| 816 |
return nodeMap.global_to_local(global, must_exist); |
| 817 |
} |
| 818 |
|
| 819 |
virtual int64_t element_global_to_local_nl(int64_t global) const |
| 820 |
{ |
| 821 |
return elemMap.global_to_local(global); |
| 822 |
} |
| 823 |
|
| 824 |
virtual bool supports_internal_change_set_nl() { return false; } |
| 825 |
virtual bool open_internal_change_set_nl(const std::string & /* set_name */) { return false; } |
| 826 |
virtual bool open_internal_change_set_nl(int /* index */) { return false; } |
| 827 |
virtual bool create_internal_change_set_nl(const std::string & /* set_name */) { return false; } |
| 828 |
virtual int num_internal_change_set_nl() { return 0; } |
| 829 |
virtual Ioss::NameList internal_change_set_describe_nl(bool /* return_full_names */) |
| 830 |
{ |
| 831 |
return Ioss::NameList(); |
| 832 |
} |
| 833 |
|
| 834 |
virtual bool begin_nl(Ioss::State state) = 0; |
| 835 |
virtual bool end_nl(Ioss::State state) = 0; |
| 836 |
|
| 837 |
virtual void read_meta_data_nl() = 0; |
| 838 |
virtual void get_step_times_nl() {} |
| 839 |
virtual std::vector<double> get_db_step_times_nl() { return std::vector<double>(); } |
| 840 |
|
| 841 |
virtual bool begin_state_nl(int state, double time); |
| 842 |
virtual bool end_state_nl(int state, double time); |
| 843 |
|
| 844 |
void get_block_adjacencies_nl(const Ioss::ElementBlock *eb, |
| 845 |
Ioss::NameList &block_adjacency) const; |
| 846 |
|
| 847 |
virtual void compute_block_membership_nl(Ioss::SideBlock * /* efblock */, |
| 848 |
Ioss::NameList & /* block_membership */) const |
| 849 |
{ |
| 850 |
} |
| 851 |
|
| 852 |
void compute_block_adjacencies() const; |
| 853 |
|
| 854 |
bool verify_field_data(const GroupingEntity *ge, const Field &field, Ioss::Field::InOut in_out, |
| 855 |
void *data) const; |
| 856 |
void verify_and_log(const GroupingEntity *ge, const Field &field, int in_out) const; |
| 857 |
|
| 858 |
virtual int64_t get_field_internal(const Region *reg, const Field &field, void *data, |
| 859 |
size_t data_size) const = 0; |
| 860 |
virtual int64_t get_field_internal(const NodeBlock *nb, const Field &field, void *data, |
| 861 |
size_t data_size) const = 0; |
| 862 |
virtual int64_t get_field_internal(const EdgeBlock *nb, const Field &field, void *data, |
| 863 |
size_t data_size) const = 0; |
| 864 |
virtual int64_t get_field_internal(const FaceBlock *nb, const Field &field, void *data, |
| 865 |
size_t data_size) const = 0; |
| 866 |
virtual int64_t get_field_internal(const ElementBlock *eb, const Field &field, void *data, |
| 867 |
size_t data_size) const = 0; |
| 868 |
virtual int64_t get_field_internal(const SideBlock *fb, const Field &field, void *data, |
| 869 |
size_t data_size) const = 0; |
| 870 |
virtual int64_t get_field_internal(const NodeSet *ns, const Field &field, void *data, |
| 871 |
size_t data_size) const = 0; |
| 872 |
virtual int64_t get_field_internal(const EdgeSet *ns, const Field &field, void *data, |
| 873 |
size_t data_size) const = 0; |
| 874 |
virtual int64_t get_field_internal(const FaceSet *ns, const Field &field, void *data, |
| 875 |
size_t data_size) const = 0; |
| 876 |
virtual int64_t get_field_internal(const ElementSet *ns, const Field &field, void *data, |
| 877 |
size_t data_size) const = 0; |
| 878 |
virtual int64_t get_field_internal(const SideSet *fs, const Field &field, void *data, |
| 879 |
size_t data_size) const = 0; |
| 880 |
virtual int64_t get_field_internal(const CommSet *cs, const Field &field, void *data, |
| 881 |
size_t data_size) const = 0; |
| 882 |
virtual int64_t get_field_internal(const Assembly *as, const Field &field, void *data, |
| 883 |
size_t data_size) const = 0; |
| 884 |
virtual int64_t get_field_internal(const Blob *bl, const Field &field, void *data, |
| 885 |
size_t data_size) const = 0; |
| 886 |
virtual int64_t get_field_internal(const StructuredBlock *sb, const Field &field, void *data, |
| 887 |
size_t data_size) const = 0; |
| 888 |
|
| 889 |
virtual int64_t put_field_internal(const Region *reg, const Field &field, void *data, |
| 890 |
size_t data_size) const = 0; |
| 891 |
virtual int64_t put_field_internal(const NodeBlock *nb, const Field &field, void *data, |
| 892 |
size_t data_size) const = 0; |
| 893 |
virtual int64_t put_field_internal(const EdgeBlock *nb, const Field &field, void *data, |
| 894 |
size_t data_size) const = 0; |
| 895 |
virtual int64_t put_field_internal(const FaceBlock *nb, const Field &field, void *data, |
| 896 |
size_t data_size) const = 0; |
| 897 |
virtual int64_t put_field_internal(const ElementBlock *eb, const Field &field, void *data, |
| 898 |
size_t data_size) const = 0; |
| 899 |
virtual int64_t put_field_internal(const SideBlock *fb, const Field &field, void *data, |
| 900 |
size_t data_size) const = 0; |
| 901 |
virtual int64_t put_field_internal(const NodeSet *ns, const Field &field, void *data, |
| 902 |
size_t data_size) const = 0; |
| 903 |
virtual int64_t put_field_internal(const EdgeSet *ns, const Field &field, void *data, |
| 904 |
size_t data_size) const = 0; |
| 905 |
virtual int64_t put_field_internal(const FaceSet *ns, const Field &field, void *data, |
| 906 |
size_t data_size) const = 0; |
| 907 |
virtual int64_t put_field_internal(const ElementSet *ns, const Field &field, void *data, |
| 908 |
size_t data_size) const = 0; |
| 909 |
virtual int64_t put_field_internal(const SideSet *fs, const Field &field, void *data, |
| 910 |
size_t data_size) const = 0; |
| 911 |
virtual int64_t put_field_internal(const CommSet *cs, const Field &field, void *data, |
| 912 |
size_t data_size) const = 0; |
| 913 |
virtual int64_t put_field_internal(const Assembly *as, const Field &field, void *data, |
| 914 |
size_t data_size) const = 0; |
| 915 |
virtual int64_t put_field_internal(const Blob *bl, const Field &field, void *data, |
| 916 |
size_t data_size) const = 0; |
| 917 |
virtual int64_t put_field_internal(const StructuredBlock *sb, const Field &field, void *data, |
| 918 |
size_t data_size) const = 0; |
| 919 |
|
| 920 |
virtual int64_t get_zc_field_internal(const Region *reg, const Field &field, void **data, |
| 921 |
size_t *data_size) const; |
| 922 |
virtual int64_t get_zc_field_internal(const NodeBlock *nb, const Field &field, void **data, |
| 923 |
size_t *data_size) const; |
| 924 |
virtual int64_t get_zc_field_internal(const EdgeBlock *nb, const Field &field, void **data, |
| 925 |
size_t *data_size) const; |
| 926 |
virtual int64_t get_zc_field_internal(const FaceBlock *nb, const Field &field, void **data, |
| 927 |
size_t *data_size) const; |
| 928 |
virtual int64_t get_zc_field_internal(const ElementBlock *eb, const Field &field, void **data, |
| 929 |
size_t *data_size) const; |
| 930 |
virtual int64_t get_zc_field_internal(const SideBlock *fb, const Field &field, void **data, |
| 931 |
size_t *data_size) const; |
| 932 |
virtual int64_t get_zc_field_internal(const NodeSet *ns, const Field &field, void **data, |
| 933 |
size_t *data_size) const; |
| 934 |
virtual int64_t get_zc_field_internal(const EdgeSet *ns, const Field &field, void **data, |
| 935 |
size_t *data_size) const; |
| 936 |
virtual int64_t get_zc_field_internal(const FaceSet *ns, const Field &field, void **data, |
| 937 |
size_t *data_size) const; |
| 938 |
virtual int64_t get_zc_field_internal(const ElementSet *ns, const Field &field, void **data, |
| 939 |
size_t *data_size) const; |
| 940 |
virtual int64_t get_zc_field_internal(const SideSet *fs, const Field &field, void **data, |
| 941 |
size_t *data_size) const; |
| 942 |
virtual int64_t get_zc_field_internal(const CommSet *cs, const Field &field, void **data, |
| 943 |
size_t *data_size) const; |
| 944 |
virtual int64_t get_zc_field_internal(const Assembly *as, const Field &field, void **data, |
| 945 |
size_t *data_size) const; |
| 946 |
virtual int64_t get_zc_field_internal(const Blob *bl, const Field &field, void **data, |
| 947 |
size_t *data_size) const; |
| 948 |
virtual int64_t get_zc_field_internal(const StructuredBlock *sb, const Field &field, |
| 949 |
void **data, size_t *data_size) const; |
| 950 |
|
| 951 |
template <typename T> |
| 952 |
std::vector<size_t> get_entity_field_data_internal(const std::string &field_name, |
| 953 |
const std::vector<T *> &entity_container, |
| 954 |
void *data, size_t data_size) const; |
| 955 |
|
| 956 |
mutable std::map<std::string, AxisAlignedBoundingBox> elementBlockBoundingBoxes; |
| 957 |
|
| 958 |
Ioss::ParallelUtils util_; // Encapsulate parallel and other utility functions. |
| 959 |
#if defined(IOSS_THREADSAFE) |
| 960 |
protected: |
| 961 |
mutable std::mutex m_; |
| 962 |
|
| 963 |
private: |
| 964 |
#endif |
| 965 |
Region *region_{nullptr}; |
| 966 |
char fieldSeparator{'_'}; |
| 967 |
DuplicateFieldBehavior duplicateFieldBehavior{DuplicateFieldBehavior::UNSET_}; |
| 968 |
|
| 969 |
bool fieldSeparatorSpecified{false}; |
| 970 |
bool enableFieldRecognition{true}; |
| 971 |
bool fieldStripTrailing_{false}; |
| 972 |
bool isInput{true}; // No good default... |
| 973 |
bool isParallelConsistent{ |
| 974 |
true}; // True if application will make field data get/put calls parallel |
| 975 |
// consistently. |
| 976 |
// True is default and required for parallel-io databases. |
| 977 |
// Even if false, metadata operations must be called by all processors |
| 978 |
|
| 979 |
bool singleProcOnly{false}; // True if history or heartbeat which is only written from proc 0... |
| 980 |
bool doLogging{false}; // True if logging field input/output |
| 981 |
bool doNanDetection{false}; // True if checking all floating point field data for NaNs |
| 982 |
bool useGenericCanonicalName{ |
| 983 |
false}; // True if "block_id" is used as canonical name instead of the name |
| 984 |
// given on the mesh file e.g. "fireset". Both names are still aliases. |
| 985 |
bool ignoreDatabaseNames{false}; // True if "block_{id}" used as canonical name; ignore any |
| 986 |
// names on database. |
| 987 |
mutable bool blockAdjacenciesCalculated{false}; // True if the lazy creation of |
| 988 |
// block adjacencies has been calculated. |
| 989 |
|
| 990 |
bool m_timeStateInOut{false}; |
| 991 |
bool m_enableTracing{false}; |
| 992 |
bool m_ignoreRealnFields{false}; // Do not recognize var_1, var_2, ..., var_n as an n-component |
| 993 |
// field. Keep as n scalar fields. |
| 994 |
std::chrono::time_point<std::chrono::steady_clock> |
| 995 |
m_stateStart; // Used for optional output step timing. |
| 996 |
}; |
| 997 |
} // namespace Ioss |