| 1 |
// Copyright(C) 1999-2022 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 "iofaodel_export.h" |
| 10 |
|
| 11 |
#include "Ioss_GroupingEntity.h" |
| 12 |
#include "Ioss_Property.h" |
| 13 |
#include "Ioss_Region.h" |
| 14 |
|
| 15 |
#include <kelpie/Key.hh> |
| 16 |
#include <lunasa/DataObject.hh> |
| 17 |
|
| 18 |
#include <set> |
| 19 |
|
| 20 |
namespace Iofaodel { |
| 21 |
|
| 22 |
// Keys and LDOs go together, the pair below makes publishing easy |
| 23 |
using DataPair = std::pair<kelpie::Key, lunasa::DataObject>; |
| 24 |
|
| 25 |
struct IOFAODEL_EXPORT value_entry_t |
| 26 |
{ |
| 27 |
size_t offset, size; |
| 28 |
}; |
| 29 |
|
| 30 |
struct IOFAODEL_EXPORT meta_entry_t |
| 31 |
{ |
| 32 |
enum class IossType { |
| 33 |
IossProperty, |
| 34 |
IossField, |
| 35 |
IofaodelStates, |
| 36 |
IofaodelSideBlock, |
| 37 |
IofaodelStructuredBlock |
| 38 |
}; |
| 39 |
IossType ioss_type; |
| 40 |
value_entry_t value; // offset from LDO::GetDataPtr and size |
| 41 |
// NOTE an added char data[0] would point to the next meta_entry_T |
| 42 |
}; |
| 43 |
|
| 44 |
struct IOFAODEL_EXPORT state_entry_t |
| 45 |
{ |
| 46 |
using basic_type = double; |
| 47 |
size_t count; |
| 48 |
value_entry_t value; |
| 49 |
char data[0]; |
| 50 |
|
| 51 |
explicit state_entry_t(const Ioss::Region &r); |
| 52 |
}; |
| 53 |
|
| 54 |
struct IOFAODEL_EXPORT sideblock_entry_t |
| 55 |
{ |
| 56 |
size_t entity_count; |
| 57 |
|
| 58 |
explicit sideblock_entry_t(const Ioss::SideBlock &sb); |
| 59 |
}; |
| 60 |
|
| 61 |
IOFAODEL_EXPORT lunasa::DataObject pack_states(const Ioss::Region &r); |
| 62 |
|
| 63 |
IOFAODEL_EXPORT lunasa::DataObject pack_sideblock(const Ioss::SideBlock &sb); |
| 64 |
IOFAODEL_EXPORT int64_t unpack_sideblocks(lunasa::DataObject ldo); |
| 65 |
|
| 66 |
IOFAODEL_EXPORT lunasa::DataObject pack_structuredblock(const Ioss::StructuredBlock &sb); |
| 67 |
IOFAODEL_EXPORT void unpack_structuredblock(lunasa::DataObject &ldo, Ioss::StructuredBlock &sb); |
| 68 |
|
| 69 |
IOFAODEL_EXPORT kelpie::Key make_states_search_key(int parallel_rank, const Ioss::Region ®ion); |
| 70 |
|
| 71 |
IOFAODEL_EXPORT kelpie::Key make_states_key(int parallel_rank, const Ioss::Region ®ion); |
| 72 |
|
| 73 |
IOFAODEL_EXPORT kelpie::Key sideblocks_search_key(int rank, const Ioss::Region ®ion, |
| 74 |
const Ioss::SideSet &sideset); |
| 75 |
|
| 76 |
IOFAODEL_EXPORT kelpie::Key make_sideblock_key(int rank, const Ioss::Region ®ion, |
| 77 |
const Ioss::SideSet &sideset, |
| 78 |
const Ioss::SideBlock &sideblock); |
| 79 |
|
| 80 |
IOFAODEL_EXPORT kelpie::Key |
| 81 |
structuredblock_search_key(int parallel_rank, const Ioss::Region ®ion, |
| 82 |
const Ioss::StructuredBlock &structuredblock); |
| 83 |
|
| 84 |
IOFAODEL_EXPORT kelpie::Key |
| 85 |
make_structuredblock_key(int parallel_rank, const Ioss::Region ®ion, |
| 86 |
const Ioss::StructuredBlock &structuredblock); |
| 87 |
|
| 88 |
IOFAODEL_EXPORT kelpie::Key make_key(int parallel_rank, const Ioss::Region ®ion, |
| 89 |
const Ioss::GroupingEntity &grouping_entity, |
| 90 |
const Ioss::Field &field); |
| 91 |
|
| 92 |
IOFAODEL_EXPORT kelpie::Key make_key(int parallel_rank, const Ioss::Region ®ion, |
| 93 |
const Ioss::GroupingEntity &grouping_entity, |
| 94 |
const Ioss::Property &property); |
| 95 |
|
| 96 |
IOFAODEL_EXPORT kelpie::Key make_key(int parallel_rank, const Ioss::Region ®ion, |
| 97 |
const Ioss::GroupingEntity &grouping_entity); |
| 98 |
|
| 99 |
IOFAODEL_EXPORT kelpie::Key entity_search_key(int rank, const Ioss::Region ®ion, |
| 100 |
const std::string &entity_name); |
| 101 |
|
| 102 |
IOFAODEL_EXPORT kelpie::Key entity_search_key(int rank, const Ioss::Region ®ion, |
| 103 |
const Ioss::GroupingEntity &entity); |
| 104 |
|
| 105 |
IOFAODEL_EXPORT kelpie::Key property_search_key(int parallel_rank, const Ioss::Region ®ion, |
| 106 |
const Ioss::GroupingEntity &grouping_entity); |
| 107 |
|
| 108 |
IOFAODEL_EXPORT kelpie::Key make_property_key(int rank, const Ioss::Region ®ion, |
| 109 |
const std::string &entity_type, |
| 110 |
const std::string &entity_name, |
| 111 |
const std::string &property_type, |
| 112 |
const std::string &property_name); |
| 113 |
|
| 114 |
IOFAODEL_EXPORT kelpie::Key field_search_key(int parallel_rank, const Ioss::Region ®ion, |
| 115 |
const Ioss::GroupingEntity &grouping_entity); |
| 116 |
|
| 117 |
IOFAODEL_EXPORT kelpie::Key field_search_key(int parallel_rank, int state, |
| 118 |
const Ioss::Region ®ion, |
| 119 |
const Ioss::GroupingEntity &grouping_entity); |
| 120 |
|
| 121 |
IOFAODEL_EXPORT std::string to_string(const Ioss::Property::BasicType &t); |
| 122 |
IOFAODEL_EXPORT std::string to_string(const Ioss::Field::BasicType &t); |
| 123 |
IOFAODEL_EXPORT std::string to_string(const Ioss::Field::RoleType &t); |
| 124 |
IOFAODEL_EXPORT std::string to_string(const Ioss::EntityType &t); |
| 125 |
|
| 126 |
IOFAODEL_EXPORT std::string get_entity_name(const kelpie::Key &k, const std::string &target); |
| 127 |
IOFAODEL_EXPORT std::set<std::string> get_entity_names(const std::vector<kelpie::Key> &keys, |
| 128 |
const std::string &target); |
| 129 |
|
| 130 |
} // namespace Iofaodel |