7#include "iotm_export.h"
21#include <unordered_map>
36 using ErrorHandler = std::function<void(
const std::ostringstream &)>;
43 case AssemblyType::ASSEMBLY:
return out <<
"ASSEMBLY";
break;
44 case AssemblyType::BLOCK:
return out <<
"ELEMENT_BLOCK";
break;
45 case AssemblyType::SIDESET:
return out <<
"SIDESET";
break;
46 case AssemblyType::NODESET:
return out <<
"NODESET";
break;
47 default:
return out <<
"INVALID";
break;
49 return out <<
"INVALID[" << (unsigned)t <<
"]";
113 if (
nullptr != assemblyData) {
119 for (
const std::string &member : assemblyData->
data) {
129 bool isCyclic =
false;
131 if (
nullptr != assemblyData) {
139 for (
const std::string &member : assemblyData->
data) {
167 ErrorHandler errorHandler = [](
const std::ostringstream &errmsg) {
184 void parse(
const std::string &parseData)
188 for (
const auto &option : options) {
196 std::ostringstream errmsg;
197 errmsg <<
"Error! Assembly with name: " <<
m_name <<
" does not have a defined type.";
203 void parse_option(std::string optionName,
const std::string &optionValue)
207 if (optionName ==
"name") {
210 else if (optionName ==
"type") {
213 else if (optionName ==
"member") {
217 std::ostringstream errmsg;
218 errmsg <<
"Unrecognized assembly option: " << optionName;
225 if (!option.empty()) {
228 if (optionTokens.size() != 2) {
229 std::ostringstream errmsg;
230 errmsg <<
"Unrecognized assembly option: " << option;
244 if (type ==
"assembly") {
247 else if (type ==
"block") {
250 else if (type ==
"sideset") {
253 else if (type ==
"nodeset") {
257 std::ostringstream errmsg;
258 errmsg <<
"Unrecognized assembly type: " << type;
265 std::vector<std::string> assemblyData =
get_tokens(data,
",");
266 for (std::string &member : assemblyData) {
std::vector< std::string > && get_forward_traversal_list(const std::string &assembly) const
Definition Iotm_TextMeshAssembly.h:91
std::vector< std::string > m_traversalList
Definition Iotm_TextMeshAssembly.h:159
void fill_traversal(const std::string &assembly) const
Definition Iotm_TextMeshAssembly.h:110
bool is_cyclic(const std::string &assembly) const
Definition Iotm_TextMeshAssembly.h:75
std::vector< std::string > && get_reverse_traversal_list(const std::string &assembly) const
Definition Iotm_TextMeshAssembly.h:99
std::unordered_map< std::string, bool > m_visitedNodes
Definition Iotm_TextMeshAssembly.h:158
bool check_for_cycle(const std::string &assembly) const
Definition Iotm_TextMeshAssembly.h:127
Assemblies()
Definition Iotm_TextMeshAssembly.h:70
void initialize_graph() const
Definition Iotm_TextMeshAssembly.h:148
bool is_cyclic() const
Definition Iotm_TextMeshAssembly.h:81
EntityGroup< AssemblyData > BaseClass
Definition Iotm_TextMeshAssembly.h:68
void parse_assembly_members(const std::string &data)
Definition Iotm_TextMeshAssembly.h:263
void parse(const std::string &parseData)
Definition Iotm_TextMeshAssembly.h:184
void parse_assembly_type(std::string type)
Definition Iotm_TextMeshAssembly.h:240
void parse_option_group(const std::string &option)
Definition Iotm_TextMeshAssembly.h:223
AssemblyType get_assembly_type() const
Definition Iotm_TextMeshAssembly.h:177
const std::vector< std::string > & get_assembly_data()
Definition Iotm_TextMeshAssembly.h:179
std::string get_name()
Definition Iotm_TextMeshAssembly.h:175
void verify_parse() const
Definition Iotm_TextMeshAssembly.h:193
AssemblyType m_assemblyType
Definition Iotm_TextMeshAssembly.h:275
void set_error_handler(ErrorHandler errorHandler)
Definition Iotm_TextMeshAssembly.h:173
ErrorHandler m_errorHandler
Definition Iotm_TextMeshAssembly.h:276
void parse_name(const std::string &data)
Definition Iotm_TextMeshAssembly.h:238
std::vector< std::string > m_members
Definition Iotm_TextMeshAssembly.h:273
AssemblyParser()
Definition Iotm_TextMeshAssembly.h:165
void parse_option(std::string optionName, const std::string &optionValue)
Definition Iotm_TextMeshAssembly.h:203
std::string m_name
Definition Iotm_TextMeshAssembly.h:274
const std::vector< std::string > & get_part_names() const
Definition Iotm_TextMeshEntityGroup.h:111
const std::vector< AssemblyData > & get_group_data() const
Definition Iotm_TextMeshEntityGroup.h:109
size_t size() const
Definition Iotm_TextMeshEntityGroup.h:107
EntityGroup(const std::string &type, const std::string &namePrefix, const std::vector< std::string > &invalidNamePrefixes)
Definition Iotm_TextMeshEntityGroup.h:64
Definition Iotm_TextMeshAdjacencyGraph.h:39
void convert_to_uppercase(std::string &str)
Definition Iotm_TextMeshFuncs.h:96
std::function< void(const std::ostringstream &)> ErrorHandler
Definition Iotm_TextMeshAdjacencyGraph.h:41
void convert_to_lowercase(std::string &str)
Definition Iotm_TextMeshFuncs.h:101
std::string AssemblyDataType
Definition Iotm_TextMeshAssembly.h:52
AssemblyType
Definition Iotm_TextMeshAssembly.h:38
@ INVALID_ASSEMBLY
Definition Iotm_TextMeshAssembly.h:38
@ NODESET
Definition Iotm_TextMeshAssembly.h:38
@ ASSEMBLY
Definition Iotm_TextMeshAssembly.h:38
@ SIDESET
Definition Iotm_TextMeshAssembly.h:38
@ BLOCK
Definition Iotm_TextMeshAssembly.h:38
std::ostream & operator<<(std::ostream &out, const AssemblyType &t)
Definition Iotm_TextMeshAssembly.h:40
std::vector< std::string > get_tokens(const std::string &str, const std::string &separators)
Definition Iotm_TextMeshFuncs.h:76
void default_error_handler(const std::ostringstream &message)
Definition Iotm_TextMeshFuncs.h:40
A namespace for the textmesh database format.
Definition Iotm_DatabaseIO.C:95
Definition Iotm_TextMeshAssembly.h:55
AssemblyType assemblyType
Definition Iotm_TextMeshAssembly.h:62
AssemblyDataType DataType
Definition Iotm_TextMeshAssembly.h:56
AssemblyType get_assembly_type() const
Definition Iotm_TextMeshAssembly.h:59
void set_assembly_type(AssemblyType type_)
Definition Iotm_TextMeshAssembly.h:58
Definition Iotm_TextMeshEntityGroup.h:43
std::vector< DataType > data
Definition Iotm_TextMeshEntityGroup.h:51