| 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 |
#include "Ioss_Field.h" |
| 13 |
#include "Ioss_GroupingEntity.h" |
| 14 |
#include "Ioss_Property.h" |
| 15 |
|
| 16 |
#include <string> |
| 17 |
#include <vector> |
| 18 |
|
| 19 |
#include <lunasa/DataObject.hh> |
| 20 |
|
| 21 |
namespace Iofaodel { |
| 22 |
|
| 23 |
IOFAODEL_EXPORT size_t data_size(const Ioss::Property &p); |
| 24 |
|
| 25 |
// Caller should write their own version of this |
| 26 |
// PropertyFunction should return a function or a lambda that matches the |
| 27 |
// signature below. The function it returns may or may not capture variables |
| 28 |
// that are given to the user-defined function. |
| 29 |
// Some examples are given in this file and are also useful |
| 30 |
// |
| 31 |
using PropertyFunction = std::function<void(const Ioss::Region &, const Ioss::GroupingEntity &, |
| 32 |
const Ioss::Property &)>; |
| 33 |
|
| 34 |
// Applies PropertyFunction 'op' to all properties encountered in the |
| 35 |
// Ioss::Region and it's various Ioss::GroupingEntities |
| 36 |
IOFAODEL_EXPORT void map_properties(const Ioss::Region ®ion, PropertyFunction op); |
| 37 |
|
| 38 |
// Applies PropertyFunction 'op' to all properties encountered in the |
| 39 |
// Ioss::GroupingEntity |
| 40 |
IOFAODEL_EXPORT void map_properties(const Ioss::Region ®ion, |
| 41 |
const Ioss::GroupingEntity &grouping_entity, |
| 42 |
PropertyFunction op); |
| 43 |
|
| 44 |
IOFAODEL_EXPORT lunasa::DataObject pack_property(const Ioss::Region ®ion, |
| 45 |
const Ioss::GroupingEntity &entity, |
| 46 |
const Ioss::Property &property); |
| 47 |
|
| 48 |
// Put this in the meta data section of the LDO |
| 49 |
struct IOFAODEL_EXPORT property_entry_t |
| 50 |
{ |
| 51 |
Ioss::Property::BasicType basic_type; |
| 52 |
|
| 53 |
bool is_implicit; |
| 54 |
bool is_valid; |
| 55 |
|
| 56 |
value_entry_t name; // offsets from data[0] |
| 57 |
value_entry_t value; // offsets from data[0] |
| 58 |
|
| 59 |
size_t data_size; // Total size of data stored in data[0] ptr |
| 60 |
char data[0]; |
| 61 |
|
| 62 |
explicit property_entry_t(const Ioss::Property &property, const size_t start = 0); |
| 63 |
}; |
| 64 |
|
| 65 |
IOFAODEL_EXPORT int64_t property_get_int(lunasa::DataObject ldo); |
| 66 |
std::string property_get_string(lunasa::DataObject ldo); |
| 67 |
|
| 68 |
} // namespace Iofaodel |