7#include "iotm_export.h"
21#include <unordered_map>
37 using ErrorHandler = std::function<void(
const std::ostringstream &)>;
44 case AssemblyType::ASSEMBLY:
return out <<
"ASSEMBLY";
break;
45 case AssemblyType::BLOCK:
return out <<
"ELEMENT_BLOCK";
break;
46 case AssemblyType::SIDESET:
return out <<
"SIDESET";
break;
47 case AssemblyType::NODESET:
return out <<
"NODESET";
break;
48 default:
return out <<
"INVALID";
break;
50 return out <<
"INVALID[" << (unsigned)t <<
"]";
114 if (
nullptr != assemblyData) {
120 for (
const std::string &member : assemblyData->
data) {
130 bool isCyclic =
false;
132 if (
nullptr != assemblyData) {
140 for (
const std::string &member : assemblyData->
data) {
168 ErrorHandler errorHandler = [](
const std::ostringstream &errmsg) {
185 void parse(
const std::string &parseData)
189 for (
const auto &option : options) {
197 std::ostringstream errmsg;
198 errmsg <<
"Error! Assembly with name: " <<
m_name <<
" does not have a defined type.";
204 void parse_option(std::string optionName,
const std::string &optionValue)
208 if (optionName ==
"name") {
211 else if (optionName ==
"type") {
214 else if (optionName ==
"member") {
218 std::ostringstream errmsg;
219 errmsg <<
"Unrecognized assembly option: " << optionName;
226 if (!option.empty()) {
229 if (optionTokens.size() != 2) {
230 std::ostringstream errmsg;
231 errmsg <<
"Unrecognized assembly option: " << option;
245 if (type ==
"assembly") {
248 else if (type ==
"block") {
251 else if (type ==
"sideset") {
254 else if (type ==
"nodeset") {
258 std::ostringstream errmsg;
259 errmsg <<
"Unrecognized assembly type: " << type;
266 std::vector<std::string> assemblyData =
get_tokens(data,
",");
267 for (std::string &member : assemblyData) {
std::vector< std::string > && get_forward_traversal_list(const std::string &assembly) const
Definition Iotm_TextMeshAssembly.h:92
std::vector< std::string > m_traversalList
Definition Iotm_TextMeshAssembly.h:160
void fill_traversal(const std::string &assembly) const
Definition Iotm_TextMeshAssembly.h:111
bool is_cyclic(const std::string &assembly) const
Definition Iotm_TextMeshAssembly.h:76
std::vector< std::string > && get_reverse_traversal_list(const std::string &assembly) const
Definition Iotm_TextMeshAssembly.h:100
std::unordered_map< std::string, bool > m_visitedNodes
Definition Iotm_TextMeshAssembly.h:159
bool check_for_cycle(const std::string &assembly) const
Definition Iotm_TextMeshAssembly.h:128
Assemblies()
Definition Iotm_TextMeshAssembly.h:71
void initialize_graph() const
Definition Iotm_TextMeshAssembly.h:149
bool is_cyclic() const
Definition Iotm_TextMeshAssembly.h:82
EntityGroup< AssemblyData > BaseClass
Definition Iotm_TextMeshAssembly.h:69
void parse_assembly_members(const std::string &data)
Definition Iotm_TextMeshAssembly.h:264
void parse(const std::string &parseData)
Definition Iotm_TextMeshAssembly.h:185
void parse_assembly_type(std::string type)
Definition Iotm_TextMeshAssembly.h:241
void parse_option_group(const std::string &option)
Definition Iotm_TextMeshAssembly.h:224
AssemblyType get_assembly_type() const
Definition Iotm_TextMeshAssembly.h:178
const std::vector< std::string > & get_assembly_data()
Definition Iotm_TextMeshAssembly.h:180
std::string get_name()
Definition Iotm_TextMeshAssembly.h:176
void verify_parse() const
Definition Iotm_TextMeshAssembly.h:194
AssemblyType m_assemblyType
Definition Iotm_TextMeshAssembly.h:276
void set_error_handler(ErrorHandler errorHandler)
Definition Iotm_TextMeshAssembly.h:174
ErrorHandler m_errorHandler
Definition Iotm_TextMeshAssembly.h:277
void parse_name(const std::string &data)
Definition Iotm_TextMeshAssembly.h:239
std::vector< std::string > m_members
Definition Iotm_TextMeshAssembly.h:274
AssemblyParser()
Definition Iotm_TextMeshAssembly.h:166
void parse_option(std::string optionName, const std::string &optionValue)
Definition Iotm_TextMeshAssembly.h:204
std::string m_name
Definition Iotm_TextMeshAssembly.h:275
const std::vector< std::string > & get_part_names() const
Definition Iotm_TextMeshEntityGroup.h:105
const std::vector< AssemblyData > & get_group_data() const
Definition Iotm_TextMeshEntityGroup.h:103
size_t size() const
Definition Iotm_TextMeshEntityGroup.h:101
EntityGroup(const std::string &type, const std::string &namePrefix, const std::vector< std::string > &invalidNamePrefixes)
Definition Iotm_TextMeshEntityGroup.h:58
Definition Iotm_TextMeshAdjacencyGraph.h:33
void convert_to_upper_case(std::string &str)
Definition Iotm_TextMeshFuncs.h:88
std::function< void(const std::ostringstream &)> ErrorHandler
Definition Iotm_TextMeshAdjacencyGraph.h:35
std::string AssemblyDataType
Definition Iotm_TextMeshAssembly.h:53
AssemblyType
Definition Iotm_TextMeshAssembly.h:39
@ INVALID_ASSEMBLY
Definition Iotm_TextMeshAssembly.h:39
@ NODESET
Definition Iotm_TextMeshAssembly.h:39
@ ASSEMBLY
Definition Iotm_TextMeshAssembly.h:39
@ SIDESET
Definition Iotm_TextMeshAssembly.h:39
@ BLOCK
Definition Iotm_TextMeshAssembly.h:39
std::ostream & operator<<(std::ostream &out, const AssemblyType &t)
Definition Iotm_TextMeshAssembly.h:41
std::vector< std::string > get_tokens(const std::string &str, const std::string &separators)
Definition Iotm_TextMeshFuncs.h:68
void default_error_handler(const std::ostringstream &message)
Definition Iotm_TextMeshFuncs.h:32
void convert_to_lower_case(std::string &str)
Definition Iotm_TextMeshFuncs.h:93
A namespace for the textmesh database format.
Definition Iotm_DatabaseIO.C:95
Definition Iotm_TextMeshAssembly.h:56
AssemblyType assemblyType
Definition Iotm_TextMeshAssembly.h:63
AssemblyDataType DataType
Definition Iotm_TextMeshAssembly.h:57
AssemblyType get_assembly_type() const
Definition Iotm_TextMeshAssembly.h:60
void set_assembly_type(AssemblyType type_)
Definition Iotm_TextMeshAssembly.h:59
Definition Iotm_TextMeshEntityGroup.h:37
std::vector< DataType > data
Definition Iotm_TextMeshEntityGroup.h:45