| 1 |
// Copyright(C) 1999-2022, 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 "iofaodel_export.h" |
| 10 |
|
| 11 |
#include "Iofaodel_Utils.h" |
| 12 |
|
| 13 |
#include "Ioss_CommSet.h" |
| 14 |
#include "Ioss_DatabaseIO.h" |
| 15 |
#include "Ioss_DatabaseIO.h" // for DatabaseIO |
| 16 |
#include "Ioss_EdgeBlock.h" |
| 17 |
#include "Ioss_EdgeSet.h" |
| 18 |
#include "Ioss_ElementBlock.h" |
| 19 |
#include "Ioss_ElementSet.h" |
| 20 |
#include "Ioss_FaceBlock.h" |
| 21 |
#include "Ioss_FaceSet.h" |
| 22 |
#include "Ioss_Field.h" // for Region |
| 23 |
#include "Ioss_GroupingEntity.h" |
| 24 |
#include "Ioss_IOFactory.h" |
| 25 |
#include "Ioss_NodeBlock.h" |
| 26 |
#include "Ioss_NodeSet.h" |
| 27 |
#include "Ioss_Property.h" // for Region |
| 28 |
#include "Ioss_Region.h" |
| 29 |
#include "Ioss_Region.h" // for Region |
| 30 |
#include "Ioss_SideBlock.h" |
| 31 |
#include "Ioss_SideSet.h" |
| 32 |
#include "Ioss_State.h" // for State |
| 33 |
#include "Ioss_StructuredBlock.h" |
| 34 |
|
| 35 |
#include <string> |
| 36 |
#include <vector> |
| 37 |
|
| 38 |
namespace Iofaodel { |
| 39 |
|
| 40 |
IOFAODEL_EXPORT size_t data_size(const Ioss::Field &f); |
| 41 |
|
| 42 |
// Caller should write their own version of this |
| 43 |
// FieldFunction should return a function or a lambda that matches the |
| 44 |
// signature below. The function it returns may or may not capture variables |
| 45 |
// that are given to the user-defined function. |
| 46 |
// Some examples are given in this file and are also useful |
| 47 |
// |
| 48 |
using FieldFunction = |
| 49 |
std::function<void(const Ioss::Region &, const Ioss::GroupingEntity &, const Ioss::Field &)>; |
| 50 |
|
| 51 |
// Applies FieldFunction 'op' to all fields encountered in the |
| 52 |
// Ioss::Region and it's various Ioss::GroupingEntities |
| 53 |
IOFAODEL_EXPORT void map_fields(const Ioss::Region ®ion, FieldFunction op); |
| 54 |
|
| 55 |
// Applies FieldFunction 'op' to all fields encountered in the |
| 56 |
// Ioss::GroupingEntity |
| 57 |
IOFAODEL_EXPORT void map_fields(const Ioss::Region ®ion, |
| 58 |
const Ioss::GroupingEntity &grouping_entity, FieldFunction op); |
| 59 |
|
| 60 |
IOFAODEL_EXPORT lunasa::DataObject pack_field(const Ioss::Region ®ion, |
| 61 |
const Ioss::GroupingEntity &entity, |
| 62 |
const Ioss::Field &field); |
| 63 |
|
| 64 |
IOFAODEL_EXPORT lunasa::DataObject pack_field(const Ioss::Region &r, |
| 65 |
const Ioss::GroupingEntity &e, const Ioss::Field &f, |
| 66 |
void *data, size_t data_size); |
| 67 |
|
| 68 |
// Put this in the meta data section of the LDO |
| 69 |
struct IOFAODEL_EXPORT field_entry_t |
| 70 |
{ |
| 71 |
Ioss::Field::BasicType basic_type; |
| 72 |
Ioss::Field::RoleType role_type; |
| 73 |
bool is_implicit; |
| 74 |
bool is_valid; |
| 75 |
size_t raw_count; |
| 76 |
|
| 77 |
// value_entry_t storage; |
| 78 |
value_entry_t name; |
| 79 |
value_entry_t value; |
| 80 |
value_entry_t storage; |
| 81 |
size_t data_size; // Total size of data stored in LDO data section |
| 82 |
|
| 83 |
char data[0]; |
| 84 |
|
| 85 |
explicit field_entry_t(const Ioss::Field &field, const size_t start = 0); |
| 86 |
}; |
| 87 |
|
| 88 |
} // namespace Iofaodel |