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