IOSS 2.0
Loading...
Searching...
No Matches
Iofaodel_PropertySerialization.h
Go to the documentation of this file.
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 "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
21namespace 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 lamba 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 &region, 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 &region,
41 const Ioss::GroupingEntity &grouping_entity,
43
44 IOFAODEL_EXPORT lunasa::DataObject pack_property(const Ioss::Region &region,
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 {
52
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
Base class for all 'grouping' entities. The following derived classes are typical:
Definition Ioss_GroupingEntity.h:67
A named value that has a known type.
Definition Ioss_Property.h:27
BasicType
Definition Ioss_Property.h:29
A grouping entity that contains other grouping entities.
Definition Ioss_Region.h:90
A namespace for the pamgen database format.
Definition Iofaodel_DatabaseIO.C:46
std::string property_get_string(lunasa::DataObject ldo)
Definition Iofaodel_PropertySerialization.C:168
size_t data_size(const Ioss::Field &f)
Definition Iofaodel_FieldSerialization.C:17
std::function< void(const Ioss::Region &, const Ioss::GroupingEntity &, const Ioss::Property &)> PropertyFunction
Definition Iofaodel_PropertySerialization.h:31
void map_properties(const Ioss::Region &region, const Ioss::GroupingEntity &entity, PropertyFunction op)
Definition Iofaodel_PropertySerialization.C:54
int64_t property_get_int(lunasa::DataObject ldo)
Definition Iofaodel_PropertySerialization.C:161
lunasa::DataObject pack_property(const Ioss::Region &region, const Ioss::GroupingEntity &entity, const Ioss::Property &property)
Definition Iofaodel_PropertySerialization.C:117
Definition Iofaodel_PropertySerialization.h:50
value_entry_t value
Definition Iofaodel_PropertySerialization.h:57
Ioss::Property::BasicType basic_type
Definition Iofaodel_PropertySerialization.h:51
bool is_valid
Definition Iofaodel_PropertySerialization.h:54
size_t data_size
Definition Iofaodel_PropertySerialization.h:59
bool is_implicit
Definition Iofaodel_PropertySerialization.h:53
value_entry_t name
Definition Iofaodel_PropertySerialization.h:56
Definition Iofaodel_Utils.h:26