16#include "ioss_export.h"
19#if defined MAP_USE_STD
20#include <unordered_map>
21#elif defined MAP_USE_HOPSCOTCH
23#elif defined MAP_USE_ROBIN
30#if defined MAP_USE_SORTED_VECTOR
31 using IdPair = std::pair<int64_t, int64_t>;
33#elif defined MAP_USE_STD
35#elif defined MAP_USE_HOPSCOTCH
40#elif defined MAP_USE_ROBIN
49 Map(std::string entity_type, std::string file_name,
int processor)
50 : m_entityType(std::move(entity_type)), m_filename(std::move(file_name)),
51 m_myProcessor(processor)
57 void set_rank(
int processor) { m_myProcessor = processor; }
59 void set_size(
size_t entity_count);
67 IOSS_NODISCARD int64_t global_to_local(int64_t global,
bool must_exist =
true)
const;
69 template <
typename INT>
70 bool set_map(INT *ids,
size_t count,
size_t offset,
bool in_define_mode =
true);
72 void set_default(
size_t count,
size_t offset = 0);
74 void build_reverse_map();
75 void build_reverse_map_no_lock();
76 void build_reverse_map(int64_t num_to_get, int64_t offset);
78 void release_memory();
80 void reverse_map_data(
void *data,
const Ioss::Field &field,
size_t count)
const;
81 void map_data(
void *data,
const Ioss::Field &field,
size_t count)
const;
83 void map_implicit_data(
void *data,
const Ioss::Field &field,
size_t count,
size_t offset)
const;
86 size_t map_field_to_db_scalar_order(T *variables, std::vector<double> &db_var,
87 size_t begin_offset,
size_t count,
size_t stride,
99 template <
typename INT>
void reverse_map_data(INT *data,
size_t count)
const;
100 template <
typename INT>
void map_data(INT *data,
size_t count)
const;
101 template <
typename INT>
void map_implicit_data(INT *data,
size_t count,
size_t offset)
const;
103 int64_t global_to_local_nl(int64_t global,
bool must_exist =
true)
const;
104 void build_reorder_map_nl(int64_t start, int64_t count);
105 void build_reverse_map_nl(int64_t num_to_get, int64_t offset);
106#if defined MAP_USE_SORTED_VECTOR
107 void verify_no_duplicate_ids(std::vector<Ioss::IdPair> &reverse_map);
109#if defined(IOSS_THREADSAFE)
110 mutable std::mutex m_;
115 std::string m_entityType{
"unknown"};
116 std::string m_filename{
"undefined"};
117 mutable int64_t m_offset{-1};
118 int m_myProcessor{0};
119 bool m_defined{
false};
#define IOSS_NODISCARD
Definition Ioss_CodeTypes.h:55
Holds metadata for bulk data associated with a GroupingEntity.
Definition Ioss_Field.h:25
BasicType
The basic data type held in the field.
Definition Ioss_Field.h:29
IOSS_NODISCARD size_t size() const
Definition Ioss_Map.h:60
void set_defined(bool yes_no)
Definition Ioss_Map.h:94
Map(std::string entity_type, std::string file_name, int processor)
Definition Ioss_Map.h:49
IOSS_NODISCARD MapContainer & map()
Definition Ioss_Map.h:91
void set_is_sequential(bool yesno)
Definition Ioss_Map.h:62
Map & operator=(const Map &from)=delete
IOSS_NODISCARD const MapContainer & map() const
Definition Ioss_Map.h:90
IOSS_NODISCARD bool defined() const
Definition Ioss_Map.h:93
Map(const Map &from)=delete
IOSS_NODISCARD bool reorders() const
Definition Ioss_Map.h:96
void set_rank(int processor)
Definition Ioss_Map.h:57
Definition bhopscotch_map.h:61
Definition robin_map.h:90
The main namespace for the Ioss library.
Definition Ioad_DatabaseIO.C:40
std::unordered_map< int64_t, int64_t > ReverseMapContainer
Definition Ioss_Map.h:34
std::vector< int64_t > MapContainer
Definition Ioss_Map.h:29