IOSS 2.0
Loading...
Searching...
No Matches
Iotm_TextMeshUtils.h
Go to the documentation of this file.
1// Copyright(C) 1999-2020, 2022, 2023 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#pragma once
6
7#include "iotm_export.h"
8
9// ####################### Start Clang Header Tool Managed Headers ########################
10// clang-format off
11#include <cctype> // for toupper, isspace, isdigit
12#include <stddef.h> // for size_t
13#include <algorithm> // for remove, etc
14#include <iterator> // for insert_iterator
15#include <map>
16#include <set> // for set
17#include <sstream> // for operator<<, etc
18#include <string> // for basic_string, etc
19#include <utility> // for pair
20#include <vector> // for vector
21#include <unordered_map>
22#include <sstream> // for ostringstream
23#include <iostream>
24#include <functional>
25#include <stdexcept>
26#include <numeric>
27#include <strings.h>
28
29#include "Iotm_TextMeshFuncs.h"
35
36// clang-format on
37// ####################### End Clang Header Tool Managed Headers ########################
38namespace Iotm {
39 namespace text_mesh {
40 using ErrorHandler = std::function<void(const std::ostringstream &)>;
41
42 class IOTM_EXPORT TextMeshLexer
43 {
44 public:
45 TextMeshLexer() : m_currentIndex(0), m_token(""), m_isNumber(false) {}
46
47 void set_input_string(const std::string &input)
48 {
49 m_input = input;
50 m_currentIndex = 0;
51 read_next_token();
52 }
53
54 int get_int()
55 {
56 read_next_token();
57 return std::stoi(m_oldToken);
58 }
59
60 unsigned get_unsigned()
61 {
62 read_next_token();
63 return std::stoul(m_oldToken);
64 }
65
66 std::string get_string()
67 {
68 read_next_token();
69 return make_upper_case(m_oldToken);
70 }
71
72 void get_newline() { read_next_token(); }
73
74 bool has_token() const { return !m_token.empty(); }
75 bool has_newline() const { return m_token == "\n"; }
76 bool has_number() const { return has_token() && m_isNumber; }
77 bool has_string() const { return has_token() && !has_number() && !has_newline(); }
78
79 private:
81 {
82 m_oldToken = m_token;
83
84 if (char_is_newline()) {
85 m_isNumber = false;
86 m_token = "\n";
87 m_currentIndex++;
88 return;
89 }
90
91 m_token = "";
92 m_isNumber = true;
93
94 while (has_more_input()) {
95 if (char_is_whitespace()) {
96 m_currentIndex++;
97 continue;
98 }
99
100 if (char_is_comma()) {
101 m_currentIndex++;
102 break;
103 }
104
105 if (char_is_newline()) {
106 break;
107 }
108
109 m_isNumber &= char_is_digit();
110 m_token += current_char();
111 m_currentIndex++;
112 }
113 }
114
115 bool has_more_input() { return m_currentIndex < m_input.size(); }
116
117 bool char_is_whitespace() { return current_char() == ' '; }
118 bool char_is_comma() { return current_char() == ','; }
119 bool char_is_newline() { return current_char() == '\n'; }
120 bool char_is_digit() { return std::isdigit(static_cast<unsigned char>(current_char())); }
121
122 char current_char() { return m_input[m_currentIndex]; }
123
124 std::string make_upper_case(std::string str)
125 {
126 std::transform(str.begin(), str.end(), str.begin(), ::toupper);
127 return str;
128 }
129
130 std::string m_input{};
131 unsigned m_currentIndex{0};
132
133 std::string m_oldToken{};
134 std::string m_token{};
135
136 bool m_isNumber{false};
137 };
138
139 template <typename EntityId, typename Topology> class TextMeshOptionParser
140 {
141 private:
142 static constexpr int INVALID_DIMENSION = -1;
143 static constexpr int DEFAULT_DIMENSION = 3;
144
153
154 public:
160
166
167 void set_error_handler(ErrorHandler errorHandler) { m_errorHandler = errorHandler; }
168
170 {
172 }
173
174 void initialize_parse(const std::string &parameters)
175 {
176 if (!parameters.empty()) {
177 std::vector<std::string> optionGroups = get_tokens(parameters, "|");
178 parse_options(optionGroups);
179
180 m_meshConnectivityDescription = optionGroups[0];
181 }
182
185 }
186
188 {
190 m_data.partIds.finalize_parse();
191 m_data.sidesets.finalize_parse(m_data);
192 m_data.nodesets.finalize_parse();
193 m_data.assemblies.finalize_parse();
197 }
198
199 private:
201
206
208 {
211 std::ostringstream errmsg;
212 errmsg << "Error! An enforced dimension of " << m_constructorEnforcedDimension
213 << " was provided but does not match the parsed value of " << m_parsedDimension
214 << ".";
215 m_errorHandler(errmsg);
216 }
217 }
218 }
219
221 {
224 }
225 else if (parsed_dimension_provided()) {
226 m_data.spatialDim = m_parsedDimension;
227 }
228 else {
229 m_data.spatialDim = DEFAULT_DIMENSION;
230 }
231 }
232
233 void parse_dimension_option(const std::vector<std::string> &option)
234 {
236 std::ostringstream errmsg;
237 errmsg << "Spatial dimension has already been parsed! Check syntax.";
238 m_errorHandler(errmsg);
239 }
240
241 if (option.size() == 2) {
242 m_parsedDimension = std::stoull(option[1]);
243 if (m_parsedDimension != 2 && m_parsedDimension != 3) {
244 std::ostringstream errmsg;
245 errmsg << "Error! Parsed spatial dimension (" << m_parsedDimension
246 << " not defined to be 2 or 3.";
247 m_errorHandler(errmsg);
248 }
249
251 }
252 else {
253 std::ostringstream errmsg;
254 errmsg << "Error! Invalid spatial dimension syntax.";
255 m_errorHandler(errmsg);
256 }
257 }
258
260 {
261 std::vector<double> swapVectorForDeallocation;
262 m_rawCoordinates.swap(swapVectorForDeallocation);
263 }
264
266 {
268 m_data.coords.set_coordinate_data(m_data.spatialDim, m_data.nodeIds, m_rawCoordinates);
270 }
271 }
272
274
275 void parse_coordinates_option(const std::vector<std::string> &coordinatesOptionGroup)
276 {
278 std::ostringstream errmsg;
279 errmsg << "Coordinates have already been parsed! Check syntax.";
280 m_errorHandler(errmsg);
281 }
282
283 if (coordinatesOptionGroup.size() > 1) {
284 const std::vector<std::string> &coordinateTokens =
285 get_tokens(coordinatesOptionGroup[1], ",");
286 m_rawCoordinates.reserve(coordinateTokens.size());
287 for (const auto &token : coordinateTokens) {
288 double coord = std::stod(token);
289 m_rawCoordinates.push_back(coord);
290 }
291
293 }
294 }
295
296 template <typename DataType>
298 const std::string &entityType,
299 const std::set<std::string> &entitySetNames)
300 {
301 std::string groupName = groupData.name;
302 convert_to_upper_case(groupName);
303
304 if (entitySetNames.count(groupName) > 0) {
305 std::ostringstream errmsg;
306 errmsg << "Error! " << groupData.type << " with id: " << groupData.id
307 << " and name: " << groupData.name << " is referencing " << entityType
308 << " with same name.";
309 m_errorHandler(errmsg);
310 }
311 }
312
313 template <typename SrcDataGroup, typename DestDataGroup>
314 void check_name_collision_with_group(const SrcDataGroup &srcGroup,
315 const DestDataGroup &destGroup)
316 {
317 std::set<std::string> groupNames = transform_to_set(destGroup.get_part_names());
318
319 for (const auto &srcGroupData : srcGroup.get_group_data()) {
320 check_name_collision_with_entity_sets(srcGroupData, destGroup.get_group_type(),
321 groupNames);
322 }
323 }
324
326 {
327 for (const SidesetData<EntityId, Topology> &sidesetData :
328 m_data.sidesets.get_group_data()) {
329 for (const std::pair<EntityId, int> &elemSidePair : sidesetData.data) {
330 EntityId id = elemSidePair.first;
331 if (!std::binary_search(m_data.elementDataVec.begin(), m_data.elementDataVec.end(),
332 id)) {
333 std::ostringstream errmsg;
334 errmsg << "Error! Sideset with id: " << sidesetData.id
335 << " and name: " << sidesetData.name << " has reference to invalid element '"
336 << id << "'.";
337 m_errorHandler(errmsg);
338 }
339 }
340 }
341 }
342
349
355
357 {
358 for (const NodesetData<EntityId> &nodesetData : m_data.nodesets.get_group_data()) {
359 for (const EntityId nodeId : nodesetData.data) {
360 if (m_data.nodeIds.count(nodeId) == 0) {
361 std::ostringstream errmsg;
362 errmsg << "Error! Nodeset with id: " << nodesetData.id
363 << " and name: " << nodesetData.name << " has reference to invalid node '"
364 << nodeId << "'.";
365 m_errorHandler(errmsg);
366 }
367 }
368 }
369 }
370
377
383
384 template <typename T>
386 const T &group)
387 {
388 for (const std::string &entry : assemblyData.data) {
389 if (!group.is_registered(entry)) {
390 std::ostringstream errmsg;
391 errmsg << "Error! Assembly with id: " << assemblyData.id
392 << " and name: " << assemblyData.name << " has reference to invalid "
393 << group.get_group_type() << " '" << entry << "'.";
394 m_errorHandler(errmsg);
395 }
396 }
397 }
398
400 {
401 for (const AssemblyData &assemblyData : m_data.assemblies.get_group_data()) {
402 const AssemblyType assemblyType = assemblyData.get_assembly_type();
403
404 switch (assemblyType) {
405 case AssemblyType::BLOCK:
407 break;
408 case AssemblyType::SIDESET:
409 check_assembly_member_reference_in_group(assemblyData, m_data.sidesets);
410 break;
411 case AssemblyType::NODESET:
412 check_assembly_member_reference_in_group(assemblyData, m_data.nodesets);
413 break;
414 case AssemblyType::ASSEMBLY:
415 check_assembly_member_reference_in_group(assemblyData, m_data.assemblies);
416 break;
417 default:
418 std::ostringstream errmsg;
419 errmsg << "Error! Assembly with id: " << assemblyData.id
420 << " and name: " << assemblyData.name << " does not have a valid assembly type '"
421 << assemblyType << "'.";
422 m_errorHandler(errmsg);
423 }
424 }
425 }
426
428 {
429 check_name_collision_with_group(m_data.assemblies, m_data.partIds);
430 check_name_collision_with_group(m_data.assemblies, m_data.sidesets);
431 check_name_collision_with_group(m_data.assemblies, m_data.nodesets);
432 }
433
435 {
436 for (const std::string &assembly : m_data.assemblies.get_part_names()) {
437 if (m_data.assemblies.is_cyclic(assembly)) {
438 std::ostringstream errmsg;
439 errmsg << "Error! Assembly with name: '" << assembly << "' has a cyclic dependency.";
440 m_errorHandler(errmsg);
441 }
442 }
443 }
444
451
452 void parse_sideset_option(const std::vector<std::string> &sidesetOptionGroup)
453 {
454 if (sidesetOptionGroup.size() > 1) {
457 parser.parse(sidesetOptionGroup[1]);
458 parser.verify_parse();
459
461 m_data.sidesets.add_group_data(parser.get_name(), parser.get_sideset_data());
462 sideset->set_split_type(parser.get_split_type());
463 sideset->set_skin_blocks(parser.get_skin_blocks());
465 }
466 }
467
468 void parse_nodeset_option(const std::vector<std::string> &nodesetOptionGroup)
469 {
470 if (nodesetOptionGroup.size() > 1) {
473 parser.parse(nodesetOptionGroup[1]);
474
475 m_data.nodesets.add_group_data(parser.get_name(), parser.get_nodeset_data());
477 }
478 }
479
480 void parse_assembly_option(const std::vector<std::string> &assemblyOptionGroup)
481 {
482 if (assemblyOptionGroup.size() > 1) {
483 AssemblyParser parser;
485 parser.parse(assemblyOptionGroup[1]);
486 parser.verify_parse();
487
488 AssemblyData *assembly =
489 m_data.assemblies.add_group_data(parser.get_name(), parser.get_assembly_data());
490 assembly->set_assembly_type(parser.get_assembly_type());
492 }
493 }
494
495 void print_help_message(std::ostream &out = std::cout)
496 {
497 out << "\nValid Options for TextMesh parameter string:\n"
498 "\tPROC_ID,ELEM_ID,TOPOLOGY,{NODE CONNECTIVITY LIST}[,PART_NAME[,PART_ID]] "
499 "(specifies "
500 "element list .. first "
501 "argument)\n"
502 "\t|coordinates:x_1,y_1[,z_1], x_2,y_2[,z_2], ...., x_n,y_n[,z_n] (specifies "
503 "coordinate data)\n"
504 "\t|sideset:[name=<name>;] data=elem_1,side_1,elem_2,side_2,....,elem_n,side_n; "
505 "[split=<block|topology|none>;] [skin=<block list|all>;]"
506 "(specifies sideset data)\n"
507 "\t|nodeset:[name=<name>;] data=node_1,node_2,....,node_n (specifies nodeset data)\n"
508 "\t|assembly:[name=<name>;] type=<assembly|block|sideset|nodeset>; "
509 "member=member_1,...,member_n (specifies assembly hierarchy)\n"
510 "\t|dimension:spatialDimension (specifies spatial dimension .. default is 3)\n"
511 "\t|help -- show this list\n\n";
512 }
513
514 void handle_unrecognized_option(const std::string &optionType)
515 {
516 std::ostringstream errmsg;
517 errmsg << "ERROR: Unrecognized option '" << optionType << "'. It will be ignored.\n";
518 m_errorHandler(errmsg);
519 }
520
521 void parse_options(const std::vector<std::string> &optionGroups)
522 {
523 for (size_t i = 1; i < optionGroups.size(); i++) {
524 std::vector<std::string> optionGroup = get_tokens(optionGroups[i], ":");
525 std::string optionType = optionGroup[0];
526 convert_to_lower_case(optionType);
527
528 if (optionType == "coordinates") {
529 parse_coordinates_option(optionGroup);
530 }
531 else if (optionType == "dimension") {
532 parse_dimension_option(optionGroup);
533 }
534 else if (optionType == "sideset") {
535 parse_sideset_option(optionGroup);
536 }
537 else if (optionType == "nodeset") {
538 parse_nodeset_option(optionGroup);
539 }
540 else if (optionType == "assembly") {
541 parse_assembly_option(optionGroup);
542 }
543 else if (optionType == "help") {
545 }
546 else {
547 handle_unrecognized_option(optionType);
548 }
549 }
550 }
551
553
556
558
559 std::vector<double> m_rawCoordinates{};
561
563 };
564
565 template <typename EntityId, typename TopologyMapping> class TextMeshParser
566 {
567 private:
569
570 public:
571 explicit TextMeshParser(unsigned enforcedDimension)
572 : m_optionParser(m_data, enforcedDimension)
573 {
575 }
576
578
579 TextMeshData<EntityId, Topology> parse(const std::string &meshDescription)
580 {
581 initialize_parse(meshDescription);
584 return m_data;
585 }
586
588 {
589 m_errorHandler = errorHandler;
590 m_data.partIds.set_error_handler(errorHandler);
591 m_data.coords.set_error_handler(errorHandler);
592 m_data.sidesets.set_error_handler(errorHandler);
593 m_data.nodesets.set_error_handler(errorHandler);
594 m_data.assemblies.set_error_handler(errorHandler);
595 m_optionParser.set_error_handler(errorHandler);
596 }
597
598 private:
600 {
601 ErrorHandler errorHandler = [](const std::ostringstream &errmsg) {
602 default_error_handler(errmsg);
603 };
604 set_error_handler(errorHandler);
606 }
607
608 void initialize_connectivity_parse(const std::string &meshDescription)
609 {
610 m_lexer.set_input_string(meshDescription);
611 m_lineNumber = 1;
613 }
614
615 void initialize_parse(const std::string &meshDescription)
616 {
617 m_optionParser.initialize_parse(meshDescription);
618 initialize_connectivity_parse(m_optionParser.get_mesh_connectivity_description());
619 }
620
621 void finalize_parse() { m_optionParser.finalize_parse(); }
622
624 {
625 while (m_lexer.has_token()) {
627 m_data.add_element(elemData);
628
631 }
632
633 std::sort(m_data.elementDataVec.begin(), m_data.elementDataVec.end(),
635 }
636
638 {
640 elem.proc = parse_proc_id();
641 elem.identifier = parse_elem_id();
642 elem.topology = parse_topology();
643 elem.nodeIds = parse_node_ids(elem.topology);
644 elem.partName = parse_part(elem.topology);
645 return elem;
646 }
647
649 {
651 return parse_int();
652 }
653
659
661 {
663 std::string topologyName = parse_string();
664
665 Topology topology = m_topologyMapping.topology(topologyName);
666 validate_topology(topology, topologyName);
667
668 return topology;
669 }
670
671 std::vector<EntityId> parse_node_ids(const Topology &topology)
672 {
673 std::vector<EntityId> nodeIds;
674 while (m_lexer.has_number()) {
675 nodeIds.push_back(parse_unsigned());
676 }
677 validate_node_count(topology, nodeIds.size());
678 return nodeIds;
679 }
680
681 std::string parse_part(const Topology &topology)
682 {
683 std::string partName;
684
685 if (m_lexer.has_string()) {
686 partName = parse_string();
687 }
688 else {
689 partName = "block_" + topology.name();
690 }
691
692 if (m_lexer.has_number()) {
693 unsigned partId = parse_unsigned();
694 m_data.partIds.register_part_name_with_id(partName, partId);
695 }
696 else {
697 m_data.partIds.register_part_name(partName);
698 }
699
700 return partName;
701 }
702
703 int parse_int() { return m_lexer.get_int(); }
704 unsigned parse_unsigned() { return m_lexer.get_unsigned(); }
705 std::string parse_string() { return m_lexer.get_string(); }
706
708 {
710 m_lineNumber++;
711 }
712
713 void validate_required_field(bool hasNextRequiredField)
714 {
715 if (!hasNextRequiredField) {
716 std::ostringstream errmsg;
717 errmsg
718 << "Error! Each line must contain the following fields (with at least one node): "
719 "Processor, GlobalId, Element Topology, NodeIds. Error on line "
720 << m_lineNumber << ".";
721 m_errorHandler(errmsg);
722 }
723 }
724
726 {
727 bool requiredCondition = !m_lexer.has_token() || m_lexer.has_newline();
728 if (!requiredCondition) {
729 std::ostringstream errmsg;
730 errmsg << "Error! Each line should not contain more than the following fields (with at "
731 "least one node): "
732 "Processor, GlobalId, Element Topology, NodeIds, Part Name, PartId. "
733 "Error on line "
734 << m_lineNumber << ".";
735 m_errorHandler(errmsg);
736 }
737 }
738
739 void validate_topology(const Topology &topology, const std::string &providedName)
740 {
741 if (topology == m_topologyMapping.invalid_topology()) {
742 std::ostringstream errmsg;
743 errmsg << "Error! Topology = >>" << providedName << "<< is invalid from line "
744 << m_lineNumber << ".";
745 m_errorHandler(errmsg);
746 }
747
748 if (!topology.defined_on_spatial_dimension(m_data.spatialDim)) {
749 std::ostringstream errmsg;
750 errmsg << "Error on input line " << m_lineNumber << ". Topology = " << topology
751 << " is not defined on spatial dimension = " << m_data.spatialDim
752 << " set in parser.";
753 m_errorHandler(errmsg);
754 }
755 }
756
757 void validate_node_count(const Topology &topology, size_t numNodes)
758 {
759 size_t numTopologyNodes = topology.num_nodes();
760 if (numNodes != numTopologyNodes) {
761 std::ostringstream errmsg;
762 errmsg << "Error! The input line appears to contain " << numNodes
763 << " nodes, but the topology " << topology << " needs " << numTopologyNodes
764 << " nodes on line " << m_lineNumber << ".";
765 m_errorHandler(errmsg);
766 }
767 }
768
769 unsigned m_lineNumber{0};
773
775
777 };
778
779 } // namespace text_mesh
780} // namespace Iotm
Definition Iotm_TextMeshAssembly.h:164
void parse(const std::string &parseData)
Definition Iotm_TextMeshAssembly.h:185
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
void set_error_handler(ErrorHandler errorHandler)
Definition Iotm_TextMeshAssembly.h:174
Definition Iotm_TextMeshNodeset.h:56
const std::vector< EntityId > & get_nodeset_data()
Definition Iotm_TextMeshNodeset.h:70
std::string get_name()
Definition Iotm_TextMeshNodeset.h:68
void set_error_handler(ErrorHandler errorHandler)
Definition Iotm_TextMeshNodeset.h:66
void parse(const std::string &parseData)
Definition Iotm_TextMeshNodeset.h:75
Definition Iotm_TextMeshSideset.h:131
void verify_parse() const
Definition Iotm_TextMeshSideset.h:164
const std::vector< std::string > & get_skin_blocks() const
Definition Iotm_TextMeshSideset.h:149
void parse(const std::string &parseData)
Definition Iotm_TextMeshSideset.h:155
void set_error_handler(ErrorHandler errorHandler)
Definition Iotm_TextMeshSideset.h:141
std::string get_name()
Definition Iotm_TextMeshSideset.h:143
const std::vector< std::pair< EntityId, int > > & get_sideset_data()
Definition Iotm_TextMeshSideset.h:145
SplitType get_split_type()
Definition Iotm_TextMeshSideset.h:147
Definition Iotm_TextMeshUtils.h:43
std::string get_string()
Definition Iotm_TextMeshUtils.h:66
int get_int()
Definition Iotm_TextMeshUtils.h:54
bool has_string() const
Definition Iotm_TextMeshUtils.h:77
unsigned get_unsigned()
Definition Iotm_TextMeshUtils.h:60
void set_input_string(const std::string &input)
Definition Iotm_TextMeshUtils.h:47
bool has_token() const
Definition Iotm_TextMeshUtils.h:74
bool has_newline() const
Definition Iotm_TextMeshUtils.h:75
bool char_is_comma()
Definition Iotm_TextMeshUtils.h:118
std::string make_upper_case(std::string str)
Definition Iotm_TextMeshUtils.h:124
TextMeshLexer()
Definition Iotm_TextMeshUtils.h:45
bool char_is_whitespace()
Definition Iotm_TextMeshUtils.h:117
bool has_more_input()
Definition Iotm_TextMeshUtils.h:115
void read_next_token()
Definition Iotm_TextMeshUtils.h:80
char current_char()
Definition Iotm_TextMeshUtils.h:122
bool has_number() const
Definition Iotm_TextMeshUtils.h:76
bool char_is_digit()
Definition Iotm_TextMeshUtils.h:120
void get_newline()
Definition Iotm_TextMeshUtils.h:72
bool char_is_newline()
Definition Iotm_TextMeshUtils.h:119
Definition Iotm_TextMeshUtils.h:140
void validate_dimension()
Definition Iotm_TextMeshUtils.h:207
int m_constructorEnforcedDimension
Definition Iotm_TextMeshUtils.h:555
std::vector< double > m_rawCoordinates
Definition Iotm_TextMeshUtils.h:559
void initialize_parse(const std::string &parameters)
Definition Iotm_TextMeshUtils.h:174
void check_assembly_member_reference()
Definition Iotm_TextMeshUtils.h:399
bool enforced_dimension_provided()
Definition Iotm_TextMeshUtils.h:202
void finalize_parse()
Definition Iotm_TextMeshUtils.h:187
TextMeshOptionParser(TextMeshData< EntityId, Topology > &data)
Definition Iotm_TextMeshUtils.h:161
ErrorHandler m_errorHandler
Definition Iotm_TextMeshUtils.h:560
unsigned long m_parsedOptionMask
Definition Iotm_TextMeshUtils.h:552
TextMeshData< EntityId, Topology > & m_data
Definition Iotm_TextMeshUtils.h:562
void check_sideset_name_collision()
Definition Iotm_TextMeshUtils.h:343
void parse_coordinates_option(const std::vector< std::string > &coordinatesOptionGroup)
Definition Iotm_TextMeshUtils.h:275
void set_dimension()
Definition Iotm_TextMeshUtils.h:220
void validate_assemblies()
Definition Iotm_TextMeshUtils.h:445
void parse_sideset_option(const std::vector< std::string > &sidesetOptionGroup)
Definition Iotm_TextMeshUtils.h:452
void set_coordinates()
Definition Iotm_TextMeshUtils.h:265
int m_parsedDimension
Definition Iotm_TextMeshUtils.h:554
void check_assembly_name_collision()
Definition Iotm_TextMeshUtils.h:427
void check_assembly_cyclic_dependency()
Definition Iotm_TextMeshUtils.h:434
void validate_sidesets()
Definition Iotm_TextMeshUtils.h:350
bool parsed_dimension_provided()
Definition Iotm_TextMeshUtils.h:200
void check_nodeset_node_reference()
Definition Iotm_TextMeshUtils.h:356
TextMeshOptionParser(TextMeshData< EntityId, Topology > &data, unsigned enforcedDimension)
Definition Iotm_TextMeshUtils.h:155
void parse_nodeset_option(const std::vector< std::string > &nodesetOptionGroup)
Definition Iotm_TextMeshUtils.h:468
void parse_dimension_option(const std::vector< std::string > &option)
Definition Iotm_TextMeshUtils.h:233
void parse_assembly_option(const std::vector< std::string > &assemblyOptionGroup)
Definition Iotm_TextMeshUtils.h:480
std::string get_mesh_connectivity_description() const
Definition Iotm_TextMeshUtils.h:169
void check_sideset_element_reference()
Definition Iotm_TextMeshUtils.h:325
static constexpr int DEFAULT_DIMENSION
Definition Iotm_TextMeshUtils.h:143
void validate_nodesets()
Definition Iotm_TextMeshUtils.h:378
void parse_options(const std::vector< std::string > &optionGroups)
Definition Iotm_TextMeshUtils.h:521
void set_error_handler(ErrorHandler errorHandler)
Definition Iotm_TextMeshUtils.h:167
void check_nodeset_name_collision()
Definition Iotm_TextMeshUtils.h:371
void deallocate_raw_coordinates()
Definition Iotm_TextMeshUtils.h:259
void check_name_collision_with_entity_sets(const EntityGroupData< DataType > &groupData, const std::string &entityType, const std::set< std::string > &entitySetNames)
Definition Iotm_TextMeshUtils.h:297
static constexpr int INVALID_DIMENSION
Definition Iotm_TextMeshUtils.h:142
void handle_unrecognized_option(const std::string &optionType)
Definition Iotm_TextMeshUtils.h:514
ParsedOptions
Definition Iotm_TextMeshUtils.h:145
@ PARSED_COORDINATES
Definition Iotm_TextMeshUtils.h:148
@ PARSED_NONE
Definition Iotm_TextMeshUtils.h:146
@ PARSED_ASSEMBLY
Definition Iotm_TextMeshUtils.h:151
@ PARSED_NODESET
Definition Iotm_TextMeshUtils.h:150
@ PARSED_DIMENSION
Definition Iotm_TextMeshUtils.h:147
@ PARSED_SIDESET
Definition Iotm_TextMeshUtils.h:149
bool parsed_coordinates_provided()
Definition Iotm_TextMeshUtils.h:273
void check_name_collision_with_group(const SrcDataGroup &srcGroup, const DestDataGroup &destGroup)
Definition Iotm_TextMeshUtils.h:314
std::string m_meshConnectivityDescription
Definition Iotm_TextMeshUtils.h:557
void check_assembly_member_reference_in_group(const AssemblyData &assemblyData, const T &group)
Definition Iotm_TextMeshUtils.h:385
void print_help_message(std::ostream &out=std::cout)
Definition Iotm_TextMeshUtils.h:495
Definition Iotm_TextMeshUtils.h:566
typename TopologyMapping::Topology Topology
Definition Iotm_TextMeshUtils.h:568
void initialize_parse(const std::string &meshDescription)
Definition Iotm_TextMeshUtils.h:615
std::string parse_string()
Definition Iotm_TextMeshUtils.h:705
EntityId parse_elem_id()
Definition Iotm_TextMeshUtils.h:654
TextMeshLexer m_lexer
Definition Iotm_TextMeshUtils.h:771
TextMeshData< EntityId, Topology > parse(const std::string &meshDescription)
Definition Iotm_TextMeshUtils.h:579
TopologyMapping m_topologyMapping
Definition Iotm_TextMeshUtils.h:772
void initialize_constructor()
Definition Iotm_TextMeshUtils.h:599
Topology parse_topology()
Definition Iotm_TextMeshUtils.h:660
TextMeshData< EntityId, Topology > m_data
Definition Iotm_TextMeshUtils.h:770
void validate_no_extra_fields()
Definition Iotm_TextMeshUtils.h:725
ErrorHandler m_errorHandler
Definition Iotm_TextMeshUtils.h:774
std::string parse_part(const Topology &topology)
Definition Iotm_TextMeshUtils.h:681
void parse_newline()
Definition Iotm_TextMeshUtils.h:707
ElementData< EntityId, Topology > parse_element()
Definition Iotm_TextMeshUtils.h:637
unsigned m_lineNumber
Definition Iotm_TextMeshUtils.h:769
int parse_proc_id()
Definition Iotm_TextMeshUtils.h:648
void initialize_connectivity_parse(const std::string &meshDescription)
Definition Iotm_TextMeshUtils.h:608
void validate_required_field(bool hasNextRequiredField)
Definition Iotm_TextMeshUtils.h:713
void validate_topology(const Topology &topology, const std::string &providedName)
Definition Iotm_TextMeshUtils.h:739
void validate_node_count(const Topology &topology, size_t numNodes)
Definition Iotm_TextMeshUtils.h:757
TextMeshOptionParser< EntityId, Topology > m_optionParser
Definition Iotm_TextMeshUtils.h:776
void finalize_parse()
Definition Iotm_TextMeshUtils.h:621
void parse_description()
Definition Iotm_TextMeshUtils.h:623
unsigned parse_unsigned()
Definition Iotm_TextMeshUtils.h:704
void set_error_handler(ErrorHandler errorHandler)
Definition Iotm_TextMeshUtils.h:587
int parse_int()
Definition Iotm_TextMeshUtils.h:703
TextMeshParser()
Definition Iotm_TextMeshUtils.h:577
std::vector< EntityId > parse_node_ids(const Topology &topology)
Definition Iotm_TextMeshUtils.h:671
TextMeshParser(unsigned enforcedDimension)
Definition Iotm_TextMeshUtils.h:571
Definition Iotm_TextMeshDataTypes.h:39
TopologyMapEntry Topology
Definition Iotm_TextMeshDataTypes.h:41
virtual void initialize_topology_map()=0
virtual Topology invalid_topology() const =0
Topology topology(const std::string &textMeshName) const
Definition Iotm_TextMeshDataTypes.h:45
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
AssemblyType
Definition Iotm_TextMeshAssembly.h:39
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
std::set< T > transform_to_set(const std::vector< T > &dataAsVector)
Definition Iotm_TextMeshFuncs.h:107
A namespace for the textmesh database format.
Definition Iotm_DatabaseIO.C:95
int64_t EntityId
Definition Iotm_TextMesh.h:33
Definition Iotm_TextMeshAssembly.h:56
void set_assembly_type(AssemblyType type_)
Definition Iotm_TextMeshAssembly.h:59
Definition Iotm_TextMeshDataTypes.h:288
Definition Iotm_TextMeshDataTypes.h:277
Topology topology
Definition Iotm_TextMeshDataTypes.h:280
std::string partName
Definition Iotm_TextMeshDataTypes.h:282
int proc
Definition Iotm_TextMeshDataTypes.h:278
EntityId identifier
Definition Iotm_TextMeshDataTypes.h:279
std::vector< EntityId > nodeIds
Definition Iotm_TextMeshDataTypes.h:281
Definition Iotm_TextMeshEntityGroup.h:37
std::string name
Definition Iotm_TextMeshEntityGroup.h:43
std::string type
Definition Iotm_TextMeshEntityGroup.h:44
unsigned id
Definition Iotm_TextMeshEntityGroup.h:42
std::vector< DataType > data
Definition Iotm_TextMeshEntityGroup.h:45
Definition Iotm_TextMeshNodeset.h:41
Definition Iotm_TextMeshSidesetSplitter.h:64
void set_split_type(SplitType splitType)
Definition Iotm_TextMeshSideset.h:48
void set_skin_blocks(const std::vector< std::string > &skinBlocks)
Definition Iotm_TextMeshSideset.h:51
Definition Iotm_TextMeshDataTypes.h:315