19#include <unordered_map>
38 using ErrorHandler = std::function<void(
const std::ostringstream &)>;
42 template <
typename EntityId,
typename Topology>
102 template <
typename EntityId,
typename Topology>
115 sidesetData.set_error_handler(errorHandler);
124 sidesetData.skin_blocks(data);
125 sidesetData.split(data.elementDataVec);
135 ErrorHandler errorHandler = [](
const std::ostringstream &errmsg) {
155 void parse(
const std::string &parseData)
159 for (
const auto &option : options) {
167 std::ostringstream errmsg;
168 errmsg <<
"Error! Sideset with name: " <<
m_name
169 <<
" is attempting to set element/side pair data *AND* use skinning.";
175 void parse_option(std::string optionName,
const std::string &optionValue)
179 if (optionName ==
"name") {
182 else if (optionName ==
"data") {
185 else if (optionName ==
"split") {
188 else if (optionName ==
"skin") {
192 std::ostringstream errmsg;
193 errmsg <<
"Unrecognized sideset option: " << optionName;
200 if (!option.empty()) {
203 if (optionTokens.size() != 2) {
204 std::ostringstream errmsg;
205 errmsg <<
"Unrecognized sideset option: " << option;
221 if (sidesetData.size() % 2 != 0) {
222 std::ostringstream errmsg;
223 errmsg <<
"Unmatched element/ordinal pairs in sideset data: " << data;
227 for (
unsigned i = 0; i < sidesetData.size(); i += 2) {
228 EntityId elem = std::stoull(sidesetData[i]);
229 int side = std::stoi(sidesetData[i + 1]);
232 std::ostringstream errmsg;
233 errmsg <<
"Invalid element/ordinal pair {" << sidesetData[i] <<
","
234 << sidesetData[i + 1] <<
"}";
246 if (splitName ==
"none") {
249 else if (splitName ==
"block") {
252 else if (splitName ==
"topology") {
256 std::ostringstream errmsg;
257 errmsg <<
"Unrecognized sideset split type: " << splitName;
Definition Iotm_TextMeshEntityGroup.h:53
std::vector< SidesetData< EntityId, Topology > > m_groupDataVec
Definition Iotm_TextMeshEntityGroup.h:252
void finalize_parse()
Definition Iotm_TextMeshEntityGroup.h:87
virtual void set_error_handler(ErrorHandler errorHandler)
Definition Iotm_TextMeshEntityGroup.h:68
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
std::vector< std::pair< EntityId, int > > m_elemSidePairs
Definition Iotm_TextMeshSideset.h:262
void parse(const std::string &parseData)
Definition Iotm_TextMeshSideset.h:155
std::string m_name
Definition Iotm_TextMeshSideset.h:263
ErrorHandler m_errorHandler
Definition Iotm_TextMeshSideset.h:266
void parse_skin_blocks(const std::string &data)
Definition Iotm_TextMeshSideset.h:215
void parse_option(std::string optionName, const std::string &optionValue)
Definition Iotm_TextMeshSideset.h:175
void set_error_handler(ErrorHandler errorHandler)
Definition Iotm_TextMeshSideset.h:141
void parse_split_type(std::string splitName)
Definition Iotm_TextMeshSideset.h:242
SplitType m_splitType
Definition Iotm_TextMeshSideset.h:265
void parse_option_group(const std::string &option)
Definition Iotm_TextMeshSideset.h:198
void parse_element_side_pairs(const std::string &data)
Definition Iotm_TextMeshSideset.h:217
SidesetParser()
Definition Iotm_TextMeshSideset.h:133
std::string get_name()
Definition Iotm_TextMeshSideset.h:143
void parse_name(const std::string &data)
Definition Iotm_TextMeshSideset.h:213
const std::vector< std::pair< EntityId, int > > & get_sideset_data()
Definition Iotm_TextMeshSideset.h:145
SplitType get_split_type()
Definition Iotm_TextMeshSideset.h:147
std::vector< std::string > m_skinnedBlocks
Definition Iotm_TextMeshSideset.h:264
Definition Iotm_TextMeshSidesetSkinner.h:41
Definition Iotm_TextMeshSidesetSplitter.h:67
Definition Iotm_TextMeshSideset.h:104
void set_error_handler(ErrorHandler errorHandler) override
Definition Iotm_TextMeshSideset.h:110
void finalize_parse(const TextMeshData< EntityId, Topology > &data)
Definition Iotm_TextMeshSideset.h:119
Sidesets()
Definition Iotm_TextMeshSideset.h:108
std::function< void(const std::ostringstream &)> ErrorHandler
Definition Iotm_TextMeshAdjacencyGraph.h:35
std::pair< EntityId, int > SidesetDataType
Definition Iotm_TextMeshSideset.h:40
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::pair< unsigned, bool > get_id_from_part_name(const std::string &name, const std::string &prefix)
Definition Iotm_TextMeshFuncs.h:118
SplitType
Definition Iotm_TextMeshSidesetSplitter.h:49
@ TOPOLOGY
Definition Iotm_TextMeshSidesetSplitter.h:49
@ NO_SPLIT
Definition Iotm_TextMeshSidesetSplitter.h:49
@ ELEMENT_BLOCK
Definition Iotm_TextMeshSidesetSplitter.h:49
A namespace for the textmesh database format.
Definition Iotm_DatabaseIO.C:95
int64_t EntityId
Definition Iotm_TextMesh.h:33
Definition Iotm_TextMeshDataTypes.h:277
Definition Iotm_TextMeshEntityGroup.h:37
std::string name
Definition Iotm_TextMeshEntityGroup.h:43
std::vector< DataType > data
Definition Iotm_TextMeshEntityGroup.h:45
bool has_name() const
Definition Iotm_TextMeshEntityGroup.h:48
Definition Iotm_TextMeshSidesetSplitter.h:39
std::vector< size_t > sideIndex
Definition Iotm_TextMeshSidesetSplitter.h:45
Definition Iotm_TextMeshSidesetSplitter.h:64
std::vector< size_t > get_sideblock_indices_local_to_proc(const SideBlockInfo &info, int proc) const
Definition Iotm_TextMeshSideset.h:72
SideBlockInfo get_side_block_info(const std::string &sideBlockName) const
Definition Iotm_TextMeshSideset.h:78
void split(const std::vector< ElementData< EntityId, Topology > > &elementData)
Definition Iotm_TextMeshSideset.h:62
SidesetSplitter< EntityId, Topology > m_sidesetSplitter
Definition Iotm_TextMeshSideset.h:99
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
SidesetDataType< EntityId > DataType
Definition Iotm_TextMeshSideset.h:45
SplitType get_split_type() const
Definition Iotm_TextMeshSideset.h:49
void set_error_handler(ErrorHandler errorHandler)
Definition Iotm_TextMeshSideset.h:56
std::vector< SideBlockInfo > get_side_block_info() const
Definition Iotm_TextMeshSideset.h:83
bool has_default_exodus_name() const
Definition Iotm_TextMeshSideset.h:88
void skin_blocks(const TextMeshData< EntityId, Topology > &textMeshData)
Definition Iotm_TextMeshSideset.h:67
SidesetSkinner< EntityId, Topology > m_sidesetSkinner
Definition Iotm_TextMeshSideset.h:98
Definition Iotm_TextMeshDataTypes.h:315