IOSS 2.0
Loading...
Searching...
No Matches
Ioad_Helper.h
Go to the documentation of this file.
1// Copyright(C) 1999-2020, 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 "ioad_export.h"
10
11#include <map>
12#include <set>
13#include <string>
14
15#include "Ioss_GroupingEntity.h" // for GroupingEntity
16#include "Ioss_SideSet.h" // for SideBlockContainer, SideSet
17
18namespace Ioad {
19
20 template <typename T>
22 typename std::enable_if<std::is_base_of<Ioss::GroupingEntity, T>::value, bool>::type;
23
24 template <typename T>
26 decltype(DerivedFromIossGroupingEntity<T>{}, T(nullptr, std::string{}, int64_t{}));
27
28 template <typename T>
31 T(nullptr, std::string{}, std::string{}, int64_t{}));
32
33 // Takes an extra unused parameter "entity_type" to match the API of the function
34 // "NewEntity" used for objects that are not EntitySets which require that parameter.
35 // Having matching APIs allows to call this function from generic templated functions
36 // that do not have to be specialized to call this function with a different number of
37 // parameters.
38 template <typename T>
39 auto NewEntity(Ioss::DatabaseIO *io_database, const std::string &my_name,
40 const std::string & /*entity_type*/,
41 size_t entity_count) -> IossHas3ParametersConstructor<T> *
42 {
43 return new T(io_database, my_name, entity_count);
44 }
45
46 template <typename T>
47 auto NewEntity(Ioss::DatabaseIO *io_database, const std::string &my_name,
48 const std::string &entity_type,
49 size_t entity_count) -> IossHas4ParametersConstructor<T> *
50 {
51 return new T(io_database, my_name, entity_type, entity_count);
52 }
53
54 IOAD_EXPORT int find_field_in_mapset(const std::string &entity_type,
55 const std::string &field_name,
56 const std::map<std::string, std::set<std::string>> &mapset);
57
58 IOAD_EXPORT std::string get_property_variable_name(const std::string &property_name);
59 IOAD_EXPORT std::vector<std::string>
60 properties_to_save(const Ioss::GroupingEntity *const entity_block);
61
62 IOAD_EXPORT std::string stringify_side_block_names(const Ioss::SideBlockContainer &sblocks);
63
64 IOAD_EXPORT std::string encode_field_name(std::vector<std::string> names);
65
66 IOAD_EXPORT std::string encode_sideblock_name(const std::string &type_string,
67 const std::string &name);
68
69 IOAD_EXPORT bool is_sideblock_name(const std::string &name);
70
71 IOAD_EXPORT bool use_transformed_storage(const Ioss::Field &field, const std::string &entity_type,
72 const std::string &field_name);
73
74} // namespace Ioad
An input or output Database.
Definition Ioss_DatabaseIO.h:63
Holds metadata for bulk data associated with a GroupingEntity.
Definition Ioss_Field.h:25
Base class for all 'grouping' entities. The following derived classes are typical:
Definition Ioss_GroupingEntity.h:67
A namespace for the adios database format.
Definition AdiosWrapper.C:11
bool use_transformed_storage(const Ioss::Field &field, const std::string &entity_type, const std::string &field_name)
Definition Ioad_Helper.C:82
typename std::enable_if< std::is_base_of< Ioss::GroupingEntity, T >::value, bool >::type DerivedFromIossGroupingEntity
Definition Ioad_Helper.h:21
std::vector< std::string > properties_to_save(const Ioss::GroupingEntity *const entity_block)
Definition Ioad_Helper.C:31
decltype(DerivedFromIossGroupingEntity< T >{}, T(nullptr, std::string{}, int64_t{})) IossHas3ParametersConstructor
Definition Ioad_Helper.h:25
std::string encode_field_name(std::vector< std::string > names)
Definition Ioad_Helper.C:58
int find_field_in_mapset(const std::string &entity_type, const std::string &field_name, const std::map< std::string, std::set< std::string > > &mapset)
Definition Ioad_Helper.C:12
std::string encode_sideblock_name(const std::string &type_string, const std::string &name)
Definition Ioad_Helper.C:71
decltype(DerivedFromIossGroupingEntity< T >{}, T(nullptr, std::string{}, std::string{}, int64_t{})) IossHas4ParametersConstructor
Definition Ioad_Helper.h:29
std::string stringify_side_block_names(const Ioss::SideBlockContainer &sblocks)
Definition Ioad_Helper.C:49
auto NewEntity(Ioss::DatabaseIO *io_database, const std::string &my_name, const std::string &, size_t entity_count) -> IossHas3ParametersConstructor< T > *
Definition Ioad_Helper.h:39
bool is_sideblock_name(const std::string &name)
Definition Ioad_Helper.C:76
std::string get_property_variable_name(const std::string &property_name)
Definition Ioad_Helper.C:26
std::vector< SideBlock * > SideBlockContainer
Definition Ioss_SideSet.h:24