IOSS 2.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
UnitTestIotmTextMeshFixture.h
Go to the documentation of this file.
1// Copyright(C) 1999-2020, 2022, 2023, 2024 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#pragma once
8
9#include "Ioss_CodeTypes.h"
10
11#include "Ionit_Initializer.h"
12#include "Ioss_Assembly.h"
13#include "Ioss_CommSet.h"
14#include "Ioss_DBUsage.h"
15#include "Ioss_DatabaseIO.h" // for DatabaseIO
16#include "Ioss_ElementBlock.h"
18#include "Ioss_EntityType.h" // for EntityType, etc
19#include "Ioss_Field.h" // for Field, etc
20#include "Ioss_GroupingEntity.h" // for GroupingEntity
21#include "Ioss_IOFactory.h" // for IOFactory
22#include "Ioss_MeshType.h" // for MeshType, etc
23#include "Ioss_NodeBlock.h"
24#include "Ioss_NodeSet.h"
25#include "Ioss_ParallelUtils.h"
27#include "Ioss_Region.h"
28#include "Ioss_SideBlock.h"
29#include "Ioss_SideSet.h"
31
32#include <gtest/gtest.h>
33#ifdef SEACAS_HAVE_MPI
34#include <mpi.h>
35#endif
36#include <string>
37#include <unordered_map>
38
39#include <memory>
40#include <string>
41#if defined(_WIN32) && !defined(__MINGW32__)
42#include <string.h>
43#define strcasecmp _stricmp
44#define strncasecmp _strnicmp
45#else
46#include <strings.h>
47#endif
48#include <vector>
49
54
55#define ThrowRequireWithMsg(expr, message) \
56 do { \
57 if (!(expr)) { \
58 std::ostringstream internal_throw_require_oss; \
59 internal_throw_require_oss << message; \
60 throw std::logic_error(internal_throw_require_oss.str()); \
61 } \
62 } while (false)
63
66using EntityId = int64_t;
67using EntityIdVector = std::vector<EntityId>;
68using EntityIdSet = std::set<EntityId>;
77using SideEntry = std::pair<EntityId, int>;
78using SideVector = std::vector<SideEntry>;
80
82{
83 using NeighborVector = std::vector<std::pair<int, SideAdjacencyGraph::IndexType>>;
84 using SimpleNeighborVector = std::vector<SideAdjacencyGraph::IndexType>;
85
86 size_t elemIndex;
88
89 Adjacency(size_t elemIndex_, const NeighborVector &neighborIndices_)
90 : elemIndex(elemIndex_), neighborIndices(neighborIndices_)
91 {
92 }
93
94 Adjacency(size_t elemIndex_, const SimpleNeighborVector &neighborIndices_)
95 : elemIndex(elemIndex_), neighborIndices(get_full_neighbor_vector(neighborIndices_))
96 {
97 }
98
100 {
101 NeighborVector fullNeighborVector;
102 fullNeighborVector.reserve(simpleNeighborVector.size());
103
104 for (unsigned i = 0; i < simpleNeighborVector.size(); i++) {
105 fullNeighborVector.push_back(std::make_pair(static_cast<int>(i), simpleNeighborVector[i]));
106 }
107 return fullNeighborVector;
108 }
109};
110
112{
113 inline bool operator()(const SideEntry &lhs, const SideEntry &rhs) const
114 {
115 if (lhs.first < rhs.first)
116 return true;
117 else if (lhs.first == rhs.first && lhs.second < rhs.second)
118 return true;
119
120 return false;
121 }
122};
123
124namespace Iotm {
125 namespace unit_test {
126
128 {
129 public:
132
134
135 public:
136 std::vector<std::string> get_unique_leaf_members(const std::string &name)
137 {
138 m_leafMembers.clear();
139 m_visitedAssemblies.clear();
140
141 for (Ioss::Assembly *assembly : m_region->get_assemblies()) {
142 m_visitedAssemblies[assembly] = false;
143 }
144
145 traverse_tree(m_region->get_assembly(name));
146
147 std::sort(m_leafMembers.begin(), m_leafMembers.end(), std::less<std::string>());
148 auto endIter = std::unique(m_leafMembers.begin(), m_leafMembers.end());
149 m_leafMembers.resize(endIter - m_leafMembers.begin());
150
151 return m_leafMembers;
152 }
153
154 private:
155 void traverse_tree(const Ioss::Assembly *assembly)
156 {
157 // Walk the tree without cyclic dependency
158 if (assembly != nullptr) {
159 if (m_visitedAssemblies[assembly] == false) {
160 m_visitedAssemblies[assembly] = true;
161
162 const Ioss::EntityType assemblyType = assembly->get_member_type();
163 if (Ioss::ASSEMBLY != assemblyType) {
164 for (const Ioss::GroupingEntity *ge : assembly->get_members()) {
165 m_leafMembers.push_back(ge->name());
166 }
167 }
168 else {
169 for (const Ioss::GroupingEntity *ge : assembly->get_members()) {
170 const Ioss::Assembly *assemblyMember = dynamic_cast<const Ioss::Assembly *>(ge);
171 ThrowRequireWithMsg(nullptr != assemblyMember,
172 "Non-assembly member: " << ge->name()
173 << " in ASSEMBLY rank assembly: "
174 << assembly->name());
175 traverse_tree(assemblyMember);
176 }
177 }
178 }
179 }
180 }
181
183 mutable std::unordered_map<const Ioss::Assembly *, bool> m_visitedAssemblies;
184 mutable std::vector<std::string> m_leafMembers;
185 };
186
187 class TextMeshFixture : public ::testing::Test
188 {
189 protected:
190 using PartNameId = std::pair<std::string, unsigned>;
191
193 {
196
197 ElementInfo() : topology(nullptr) {}
198 ElementInfo(const Ioss::ElementTopology *topology_, const EntityIdVector &connectivity_)
199 : topology(topology_), connectivity(connectivity_)
200 {
201 }
202 };
203
204 struct PartInfo
205 {
206 std::string blockName;
208 };
209
210 TextMeshFixture(unsigned spatialDimension) : m_spatialDimension(spatialDimension)
211 {
213 m_topologyMapping.initialize_topology_map();
214 }
215
217
219
221
222 void fill_mesh(const std::string &meshDesc)
223 {
224 std::pair<std::string, std::string> result = get_database_type_and_filename(meshDesc);
225
226 std::string type = result.first;
227 std::string filename = result.second;
228
229 EXPECT_EQ("textmesh", type);
230
231 create_database(filename, type);
233 }
234
236
237 std::string get_mesh_desc(const std::string &textMeshDesc)
238 {
239 std::string header = "textmesh:";
240 std::string meshDesc = header + textMeshDesc;
241 return meshDesc;
242 }
243
244 std::string get_mesh_desc(const std::string &textMeshDesc, unsigned dimension)
245 {
246 std::stringstream dim;
247 dim << "|dimension:" << dimension;
248
249 std::string meshDesc = get_mesh_desc(textMeshDesc) + dim.str();
250 return meshDesc;
251 }
252
253 void verify_shared_nodes(const EntityIdVector &nodeIds, int sharingProc)
254 {
255 EXPECT_EQ(nodeIds.size(), get_node_sharing_count(sharingProc));
256
257 for (EntityId nodeId : nodeIds) {
258 EXPECT_TRUE(node_is_shared_with_proc(nodeId, sharingProc));
259 }
260 }
261
262 void verify_num_elements(size_t goldCount)
263 {
264 size_t count = get_element_count();
265 EXPECT_EQ(goldCount, count);
266 }
267
268 void verify_single_element(EntityId elemId, const std::string &textMeshTopologyName,
269 const EntityIdVector &nodeIds)
270 {
271 Topology topology = m_topologyMapping.topology(textMeshTopologyName);
272 ElementInfo info = get_element_info(elemId);
273 EXPECT_TRUE(is_valid_element(info));
274 EXPECT_EQ(topology, info.topology);
275 verify_nodes_on_element(info, nodeIds);
276 }
277
278 void verify_num_sidesets(size_t goldCount)
279 {
280 ThrowRequireWithMsg(m_region != nullptr, "Ioss region has not been created");
281 size_t count = m_region->get_sidesets().size();
282 EXPECT_EQ(goldCount, count);
283 }
284
285 void verify_sideset_subset(const Ioss::SideSet *sideset, const unsigned id,
286 const std::vector<std::string> &subsetNames)
287 {
288 EXPECT_TRUE(nullptr != sideset);
289 EXPECT_EQ(id, sideset->get_property("id").get_int());
290
291 if (subsetNames.empty()) {
292 EXPECT_EQ(1u, sideset->get_side_blocks().size());
293 }
294 else {
295 EXPECT_EQ(subsetNames.size(), sideset->get_side_blocks().size());
296 }
297
298 for (std::string subsetName : subsetNames) {
299 std::transform(subsetName.begin(), subsetName.end(), subsetName.begin(), ::toupper);
300 Ioss::SideBlock *sideBlock = sideset->get_side_block(subsetName);
301 EXPECT_TRUE(nullptr != sideBlock);
302 EXPECT_EQ(id, sideBlock->get_property("id").get_int());
303 }
304 }
305
306 void verify_single_sideset(const std::string &name, const unsigned id,
307 const SideVector &goldElemSidePairs)
308 {
309 verify_single_sideset(name, id, std::vector<std::string>{}, goldElemSidePairs);
310 }
311
312 void verify_single_sideset(const std::string &name, const unsigned id,
313 const std::vector<std::string> &subsets,
314 const SideVector &goldElemSidePairs)
315 {
316 Ioss::SideSet *sideset = get_sideset(name);
317 verify_sideset_subset(sideset, id, subsets);
318
319 EXPECT_TRUE(nullptr != sideset);
320
321 SideVector elemSidePairs = get_element_side_pairs_from_sideset(sideset);
322 std::sort(elemSidePairs.begin(), elemSidePairs.end(), SideEntryLess());
323
324 for (const SideEntry &sideEntry : goldElemSidePairs) {
325 EntityId elemId = sideEntry.first;
326 int side = sideEntry.second;
327
328 ElementInfo info = get_element_info(elemId);
329 EXPECT_TRUE(is_valid_element(info));
330
331 EXPECT_TRUE(side > 0);
332 EXPECT_TRUE(side <= (int)info.topology->number_boundaries());
333
334 EXPECT_TRUE(std::binary_search(elemSidePairs.begin(), elemSidePairs.end(), sideEntry,
335 SideEntryLess()));
336 }
337 }
338
339 void verify_num_nodesets(size_t goldCount)
340 {
341 ThrowRequireWithMsg(m_region != nullptr, "Ioss region has not been created");
342 size_t count = m_region->get_nodesets().size();
343 EXPECT_EQ(goldCount, count);
344 }
345
346 void verify_single_nodeset(const std::string &name, const unsigned id,
347 const EntityIdVector &goldNodeIds)
348 {
349 Ioss::NodeSet *nodeset = get_nodeset(name);
350 EXPECT_TRUE(nullptr != nodeset);
351 EXPECT_EQ(id, nodeset->get_property("id").get_int());
352
353 EntityIdVector nodeIds = get_node_ids_from_nodeset(nodeset);
354 std::sort(nodeIds.begin(), nodeIds.end());
355
356 for (EntityId node : goldNodeIds) {
357 EXPECT_TRUE(std::binary_search(nodeIds.begin(), nodeIds.end(), node));
358 }
359 }
360
361 void verify_num_assemblies(size_t goldCount)
362 {
363 ThrowRequireWithMsg(m_region != nullptr, "Ioss region has not been created");
364 size_t count = m_region->get_assemblies().size();
365 EXPECT_EQ(goldCount, count);
366 }
367
368 void verify_single_assembly(const std::string &name, const unsigned id,
369 const std::vector<std::string> &goldMembers)
370 {
371 Ioss::Assembly *assembly = get_assembly(name);
372 EXPECT_TRUE(nullptr != assembly);
373 EXPECT_EQ(id, assembly->get_property("id").get_int());
374
376 std::vector<std::string> leafMembers = graph.get_unique_leaf_members(name);
377 EXPECT_EQ(goldMembers.size(), leafMembers.size());
378
379 for (size_t i = 0; i < goldMembers.size(); i++) {
380 const std::string &goldMember = goldMembers[i];
381 const std::string &leafMember = leafMembers[i];
382 EXPECT_EQ(0, strcasecmp(goldMember.c_str(), leafMember.c_str()))
383 << "Comparison failure for " << name << ": " << goldMember << " <-> " << leafMember;
384 }
385 }
386
387 void verify_part_membership(const std::vector<PartInfo> golds)
388 {
389 for (const PartInfo &gold : golds) {
390 Ioss::ElementBlock *block = get_element_block(gold.blockName);
391
392 verify_block(block);
393 verify_elements_on_block(block, gold.ids);
394 }
395 }
396
397 void verify_part_ids(const std::vector<PartNameId> &golds)
398 {
399 for (const PartNameId &gold : golds) {
400 Ioss::ElementBlock *block = get_element_block(gold.first);
401
402 verify_block(block);
403 unsigned id = block->get_property("id").get_int();
404 EXPECT_EQ(id, gold.second);
405 }
406 }
407
408 void verify_nodes_on_element(const ElementInfo &info, const EntityIdVector &goldNodeIds)
409 {
410 EXPECT_EQ(goldNodeIds, info.connectivity);
411 }
412
413 void verify_coordinates(const EntityIdVector &goldNodeIds,
414 const std::vector<double> &goldCoordinates)
415 {
416 CoordinateVerifier cv(*m_region, goldNodeIds, goldCoordinates);
417 cv.verify();
418 }
419
420 void setup_text_mesh(const std::string &textMeshDesc)
421 {
423 }
424
425 std::string get_topology_name(const std::string &textMeshTopologyName)
426 {
427 return m_topologyMapping.topology(textMeshTopologyName).name();
428 }
429
430 size_t db_api_int_size() const
431 {
432 assert(m_database != nullptr);
433 return m_database->int_byte_size_api();
434 }
435
436 size_t get_node_sharing_count(int sharingProc) const
437 {
438 if (db_api_int_size() == 4) {
439 return get_node_sharing_count_impl<int>(sharingProc);
440 }
441 else {
442 return get_node_sharing_count_impl<int64_t>(sharingProc);
443 }
444 }
445
446 template <typename INT> size_t get_node_sharing_count_impl(int sharingProc) const
447 {
448 ThrowRequireWithMsg(m_region != nullptr, "Ioss region has not been created");
449
450 Ioss::CommSet *io_cs = m_region->get_commset("commset_node");
451 size_t numSharings = io_cs->get_field("entity_processor").raw_count();
452
453 std::vector<INT> entityProc;
454 io_cs->get_field_data("entity_processor", entityProc);
455
456 size_t count = 0;
457
458 for (size_t i = 0; i < numSharings; ++i) {
459 int iossSharingProc = entityProc[i * 2 + 1];
460
461 if (iossSharingProc == sharingProc) {
462 count++;
463 }
464 }
465
466 return count;
467 }
468
469 template <typename INT>
471 {
472 EntityIdVector elemIds;
473
474 std::vector<INT> ids;
475
476 block->get_field_data("ids", ids);
477
478 for (INT id : ids) {
479 elemIds.push_back(static_cast<EntityId>(id));
480 }
481
482 return elemIds;
483 }
484
486 {
487 if (db_api_int_size() == 4) {
489 }
490 else {
492 }
493 }
494
495 template <typename INT>
497 {
498 EntityIdVector nodeIds;
499
500 std::vector<INT> ids;
501
502 ns->get_field_data("ids", ids);
503
504 for (INT id : ids) {
505 nodeIds.push_back(static_cast<EntityId>(id));
506 }
507
508 return nodeIds;
509 }
510
512 {
513 if (db_api_int_size() == 4) {
515 }
516 else {
518 }
519 }
520
521 template <typename INT>
523 {
524 SideVector elemSides;
525
526 for (const Ioss::SideBlock *sb : ss->get_side_blocks()) {
527 std::vector<INT> elemSideVec;
528 sb->get_field_data("element_side", elemSideVec);
529
530 for (unsigned i = 0; i < sb->entity_count(); i++) {
531 EntityId elem = elemSideVec[2 * i + 0];
532 int side = elemSideVec[2 * i + 1];
533 elemSides.push_back({elem, side});
534 }
535 }
536
537 return elemSides;
538 }
539
549
550 template <typename INT>
552 const Ioss::ElementBlock *block) const
553 {
554 const Ioss::ElementTopology *topo = nullptr;
555 EntityIdVector elemConn;
556
557 std::vector<INT> connectivity;
558 std::vector<INT> elemIds;
559
560 block->get_field_data("ids", elemIds);
561 block->get_field_data("connectivity", connectivity);
562
563 topo = block->topology();
564
565 size_t elementCount = elemIds.size();
566 int nodesPerElem = topo->number_nodes();
567
568 for (size_t i = 0; i < elementCount; ++i) {
569 INT *conn = &connectivity[i * nodesPerElem];
570 auto id = static_cast<EntityId>(elemIds[i]);
571
572 if (id == elemId) {
573 for (int j = 0; j < nodesPerElem; j++) {
574 elemConn.push_back(conn[j]);
575 }
576
577 return ElementInfo(topo, elemConn);
578 }
579 }
580
581 return ElementInfo(nullptr, EntityIdVector());
582 }
583
584 template <typename INT> ElementInfo get_element_info_impl(EntityId elemId) const
585 {
586 ThrowRequireWithMsg(m_region != nullptr, "Ioss region has not been created");
587 ElementInfo elemInfo;
588
589 EntityIdVector elemConn;
590
591 const Ioss::ElementBlockContainer &elemBlocks = m_region->get_element_blocks();
592 bool found = false;
593
594 for (const Ioss::ElementBlock *block : elemBlocks) {
596
597 if (is_valid_element(info)) {
598 ThrowRequireWithMsg(!found,
599 "Element with id " << elemId << " exists in more than one block!");
600 found = true;
601 elemInfo = info;
602 }
603 }
604
605 return elemInfo;
606 }
607
609 {
610 if (db_api_int_size() == 4) {
611 return get_element_info_impl<int>(elemId);
612 }
613 else {
614 return get_element_info_impl<int64_t>(elemId);
615 }
616 }
617
618 template <typename INT> size_t get_element_count_impl() const
619 {
620 ThrowRequireWithMsg(m_region != nullptr, "Ioss region has not been created");
621
622 const Ioss::ElementBlockContainer &elemBlocks = m_region->get_element_blocks();
623 size_t count = 0;
624
625 for (const Ioss::ElementBlock *block : elemBlocks) {
626 std::vector<INT> elemIds;
627 block->get_field_data("ids", elemIds);
628 count += elemIds.size();
629 }
630
631 return count;
632 }
633
634 size_t get_element_count() const
635 {
636 if (db_api_int_size() == 4) {
638 }
639 else {
641 }
642 }
643
644 template <typename INT>
645 bool node_is_shared_with_proc_impl(EntityId nodeId, int sharingProc) const
646 {
647 ThrowRequireWithMsg(m_region != nullptr, "Ioss region has not been created");
648
649 Ioss::CommSet *io_cs = m_region->get_commset("commset_node");
650 size_t numSharings = io_cs->get_field("entity_processor").raw_count();
651
652 std::vector<INT> entityProc;
653 io_cs->get_field_data("entity_processor", entityProc);
654
655 for (size_t i = 0; i < numSharings; ++i) {
656 EntityId iossNodeId = entityProc[i * 2];
657 int iossSharingProc = entityProc[i * 2 + 1];
658
659 if (iossNodeId == nodeId && iossSharingProc == sharingProc) {
660 return true;
661 }
662 }
663
664 return false;
665 }
666
667 bool node_is_shared_with_proc(EntityId nodeId, int sharingProc) const
668 {
669 if (db_api_int_size() == 4) {
670 return node_is_shared_with_proc_impl<int>(nodeId, sharingProc);
671 }
672 else {
673 return node_is_shared_with_proc_impl<int64_t>(nodeId, sharingProc);
674 }
675 }
676
677 bool is_valid_element(const ElementInfo &info) const
678 {
679 bool validTopology = info.topology != nullptr &&
681 bool validConnectivitySize = info.connectivity.size() != 0;
682 bool validNumNodes = validTopology ? info.topology->number_nodes() ==
683 static_cast<int>(info.connectivity.size())
684 : false;
685
686 return validConnectivitySize && validNumNodes;
687 }
688
689 Ioss::ElementBlock *get_element_block(const std::string &blockName) const
690 {
691 ThrowRequireWithMsg(m_region != nullptr, "Ioss region has not been created");
692
693 const Ioss::ElementBlockContainer &elemBlocks = m_region->get_element_blocks();
694 Ioss::ElementBlock *elemBlock = nullptr;
695
696 for (Ioss::ElementBlock *block : elemBlocks) {
697 if (strcasecmp(block->name().c_str(), blockName.c_str()) == 0) {
698 elemBlock = block;
699 }
700 }
701
702 return elemBlock;
703 }
704
705 Ioss::NodeSet *get_nodeset(const std::string &name) const
706 {
707 ThrowRequireWithMsg(m_region != nullptr, "Ioss region has not been created");
708
709 const Ioss::NodeSetContainer &nodesets = m_region->get_nodesets();
710 Ioss::NodeSet *nodeset = nullptr;
711
712 for (Ioss::NodeSet *ns : nodesets) {
713 if (strcasecmp(ns->name().c_str(), name.c_str()) == 0) {
714 nodeset = ns;
715 }
716 }
717
718 return nodeset;
719 }
720
721 Ioss::SideSet *get_sideset(const std::string &name) const
722 {
723 ThrowRequireWithMsg(m_region != nullptr, "Ioss region has not been created");
724
725 const Ioss::SideSetContainer &sidesets = m_region->get_sidesets();
726 Ioss::SideSet *sideset = nullptr;
727
728 for (Ioss::SideSet *ss : sidesets) {
729 if (strcasecmp(ss->name().c_str(), name.c_str()) == 0) {
730 sideset = ss;
731 }
732 }
733
734 return sideset;
735 }
736
737 Ioss::Assembly *get_assembly(const std::string &name) const
738 {
739 ThrowRequireWithMsg(m_region != nullptr, "Ioss region has not been created");
740
741 const Ioss::AssemblyContainer &assemblies = m_region->get_assemblies();
742 Ioss::Assembly *assembly = nullptr;
743
744 for (Ioss::Assembly *ass : assemblies) {
745 if (strcasecmp(ass->name().c_str(), name.c_str()) == 0) {
746 assembly = ass;
747 }
748 }
749
750 return assembly;
751 }
752
753 void verify_block(Ioss::ElementBlock *block) { ASSERT_TRUE(block != nullptr); }
754
756 const std::set<EntityId> &goldIds)
757 {
759
760 ASSERT_EQ(goldIds.size(), elemIds.size());
761 for (EntityId elemId : elemIds) {
762 EXPECT_EQ(1u, goldIds.count(elemId));
763 }
764 }
765
767 {
768 if (m_region == nullptr) {
769 EXPECT_TRUE(m_database != nullptr);
770 m_region = new Ioss::Region(m_database, "input_model");
771 EXPECT_TRUE(m_region != nullptr);
772 }
773 }
774
775 void create_database(const std::string &fileName, const std::string &meshType)
776 {
777 if (m_database == nullptr) {
779
780 std::string meshFileName = fileName;
781 filename_substitution(meshFileName);
782 m_database = Ioss::IOFactory::create(meshType, meshFileName, db_usage, get_comm(),
784 EXPECT_TRUE(m_database != nullptr);
785 EXPECT_TRUE(m_database->ok(true));
786 EXPECT_EQ(m_database->get_format(), "TextMesh");
787 }
788 }
789
790 void filename_substitution(std::string &filename)
791 {
792 // See if filename contains "%P" which is replaced by the number of processors...
793 // Assumes that %P only occurs once...
794 // filename is changed.
795 size_t pos = filename.find("%P");
796 if (pos != std::string::npos) {
797 // Found the characters... Replace with the processor count...
798 int num_proc = std::max(1, get_parallel_size());
799 std::string tmp(filename, 0, pos);
800 tmp += std::to_string(num_proc);
801 tmp += filename.substr(pos + 2);
802 filename = tmp;
803 }
804 }
805
806 std::pair<std::string, std::string>
807 get_database_type_and_filename(const std::string &meshDesc)
808 {
809 std::string type;
810 std::string filename;
811
812 size_t colon = meshDesc.find(':');
813 if (colon != std::string::npos && colon > 0) {
814 type = meshDesc.substr(0, colon);
815 filename = meshDesc.substr(colon + 1);
816 }
817 else {
818 type = "textmesh";
819 filename = meshDesc;
820 }
821
822 return std::make_pair(type, filename);
823 }
824
826 {
827 public:
829 const std::vector<double> &coords)
830 : region(r), spatialDim(region.get_property("spatial_dimension").get_int()),
831 goldNodeIds(ids), goldCoordinates(coords)
832 {
834 }
835
836 void verify()
837 {
838 for (size_t nodeIndex = 0; nodeIndex < goldNodeIds.size(); nodeIndex++) {
839 EntityId nodeId = goldNodeIds[nodeIndex];
840 EXPECT_TRUE(is_valid_node(nodeId));
841
842 const double *nodalCoords = get_nodal_coordinates(nodeId);
843 const double *goldCoords = &goldCoordinates[nodeIndex * spatialDim];
844
845 verify_nodal_coordinates(nodeId, goldCoords, nodalCoords);
846 }
847 }
848
849 private:
850 template <typename T>
851 size_t field_data_from_ioss(Ioss::GroupingEntity *io_entity, const std::string &io_fld_name,
852 std::vector<T> &io_field_data)
853 {
854 size_t io_entity_count = 0;
855 if (io_entity->field_exists(io_fld_name)) {
856 const Ioss::Field &io_field = io_entity->get_fieldref(io_fld_name);
857 io_entity_count = io_entity->get_field_data(io_field.get_name(), io_field_data);
858 }
859 return io_entity_count;
860 }
861
862 size_t db_api_int_size() const { return region.get_database()->int_byte_size_api(); }
863
864 template <typename INT> EntityIdVector get_node_ids_impl() const
865 {
866 const Ioss::NodeBlockContainer &node_blocks = region.get_node_blocks();
867 assert(node_blocks.size() == 1);
868
869 Ioss::NodeBlock *nb = node_blocks[0];
870
871 std::vector<INT> ids;
872 nb->get_field_data("ids", ids);
873
874 EntityIdVector nodeIds;
875 for (INT id : ids) {
876 nodeIds.push_back(static_cast<EntityId>(id));
877 }
878
879 return nodeIds;
880 }
881
883 {
884 if (db_api_int_size() == 4) {
885 return get_node_ids_impl<int>();
886 }
887 else {
889 }
890 }
891
892 template <typename INT> bool is_valid_node_impl(EntityId nodeId) const
893 {
895 auto iter = std::find(ids.begin(), ids.end(), INT(nodeId));
896 return iter != ids.end();
897 }
898
899 bool is_valid_node(EntityId nodeId) const
900 {
901 if (db_api_int_size() == 4) {
902 return is_valid_node_impl<int>(nodeId);
903 }
904 else {
905 return is_valid_node_impl<int64_t>(nodeId);
906 }
907 }
908
910 {
912 EXPECT_EQ(goldNodeIds.size(), ids.size());
913 }
914
916 const std::vector<double> &coordinates)
917 {
918 std::vector<double>::const_iterator coordIter = coordinates.begin();
919 for (const EntityId &nodeId : nodeIds) {
920 m_nodalCoords[nodeId] = std::vector<double>(coordIter, coordIter + spatialDim);
921 coordIter += spatialDim;
922 }
923 }
924
926 {
927 std::vector<double> iossCoordinates;
928
929 const Ioss::NodeBlockContainer &node_blocks = region.get_node_blocks();
930 assert(node_blocks.size() == 1);
931
932 Ioss::NodeBlock *nb = node_blocks[0];
933
934 size_t node_count = nb->get_property("entity_count").get_int();
935
936 EntityIdVector nodeIds = get_node_ids();
937
938 size_t numIossNodes =
939 field_data_from_ioss<double>(nb, "mesh_model_coordinates", iossCoordinates);
940 ThrowRequireWithMsg(node_count == numIossNodes, "Node count mismatch");
941 ThrowRequireWithMsg(iossCoordinates.size() == numIossNodes * spatialDim,
942 "Invalid coordinate data size");
943
944 fill_coordinate_map(nodeIds, iossCoordinates);
945 }
946
947 const std::vector<double> &operator[](const EntityId nodeId) const
948 {
949 auto it = m_nodalCoords.find(nodeId);
950 return it->second;
951 }
952
953 const double *get_nodal_coordinates(const EntityId &nodeId) const
954 {
955 return Data((*this)[nodeId]);
956 }
957
958 void verify_nodal_coordinates(const EntityId &nodeId, const double *goldCoords,
959 const double *nodalCoords)
960 {
961 for (unsigned i = 0; i < spatialDim; i++) {
962 EXPECT_NEAR(goldCoords[i], nodalCoords[i], 1.0e-9) << error_message(nodeId, i);
963 }
964 }
965
966 std::string error_message(const EntityId &nodeId, unsigned coordIndex)
967 {
968 std::stringstream message;
969 message << "Proc " << region.get_database()->util().parallel_rank() << ", Node ID "
970 << nodeId << ", coord index " << coordIndex;
971 return message.str();
972 }
973
975
976 const unsigned spatialDim;
977
979 const std::vector<double> &goldCoordinates;
980 std::unordered_map<EntityId, std::vector<double>> m_nodalCoords;
981 };
982
983 unsigned m_spatialDimension = 3;
988 };
989
990 } // namespace unit_test
991} // namespace Iotm
992
993namespace {
995 {
996 protected:
998 };
999
1001 {
1002 protected:
1004 };
1005
1007 {
1008 protected:
1010 };
1011
1013 {
1014 protected:
1016
1018 {
1019 public:
1020 TextMeshGraph(const TextMeshData &data) : m_data(data) {}
1021
1022 size_t get_num_elements() const override { return m_data.elementDataVec.size(); }
1023
1024 int get_element_proc(const size_t elemIndex) const override
1025 {
1026 const ElementData &elemData = m_data.elementDataVec[elemIndex];
1027 return elemData.proc;
1028 }
1029
1030 bool element_has_any_node_on_proc(const size_t elemIndex, int proc) const override
1031 {
1032 const ElementData &elemData = m_data.elementDataVec[elemIndex];
1033
1034 for (const EntityId &nodeId : elemData.nodeIds) {
1035 const std::set<int> &procsForNode = m_data.procs_for_node(nodeId);
1036 if (procsForNode.count(proc) > 0) {
1037 return true;
1038 }
1039 }
1040
1041 return false;
1042 }
1043
1044 const std::string &get_element_block_name(const size_t elemIndex) const override
1045 {
1046 const ElementData &elemData = m_data.elementDataVec[elemIndex];
1047 return elemData.partName;
1048 }
1049
1050 const std::vector<EntityId> &get_element_node_ids(const size_t elemIndex) const override
1051 {
1052 const ElementData &elemData = m_data.elementDataVec[elemIndex];
1053 return elemData.nodeIds;
1054 }
1055
1056 const Topology &get_element_topology(const size_t elemIndex) const override
1057 {
1058 const ElementData &elemData = m_data.elementDataVec[elemIndex];
1059 return elemData.topology;
1060 }
1061
1062 EntityId get_element_id(const size_t elemIndex) const override
1063 {
1064 const ElementData &elemData = m_data.elementDataVec[elemIndex];
1065 return elemData.identifier;
1066 }
1067
1068 private:
1070 };
1071
1072 void dump_graph(std::ostream &out = std::cout) { m_graph->dump(m_data.elementDataVec, out); }
1073
1074 void setup_text_mesh_graph(const std::string &meshDesc,
1075 const std::vector<std::string> &selectedBlocks = {},
1077 {
1078 TextMeshParser parser;
1079 m_data = parser.parse(meshDesc);
1080 m_graph = std::make_shared<TextMeshGraph>(m_data);
1081 m_graph->create_graph(selectedBlocks, proc);
1082 }
1083
1084 void verify_side_adjacency(const std::vector<Adjacency> &goldNeighbors)
1085 {
1086 EXPECT_EQ(m_graph->size(), goldNeighbors.size());
1087 for (size_t i = 0; i < goldNeighbors.size(); ++i) {
1088 const auto &graphNeighborIndices = (*m_graph)[goldNeighbors[i].elemIndex];
1089 const auto &goldNeighborIndices = goldNeighbors[i].neighborIndices;
1090
1091 unsigned numActualGoldConnections = 0;
1092 for (const auto &entry : goldNeighborIndices) {
1093 if (entry.second >= 0) {
1094 numActualGoldConnections++;
1095 }
1096 }
1097
1098 EXPECT_EQ(numActualGoldConnections, graphNeighborIndices.connections.size());
1099
1100 for (const auto &entry : goldNeighborIndices) {
1101 int side = entry.first + 1;
1102 SideAdjacencyGraph::IndexType neighborElemIndex = entry.second;
1103
1104 if (neighborElemIndex >= 0) {
1105 EXPECT_LT(0, graphNeighborIndices.sideReference[side - 1]);
1106 EXPECT_TRUE(graphNeighborIndices.has_any_connection(side, neighborElemIndex));
1107 }
1108 else {
1109 EXPECT_EQ(0, graphNeighborIndices.sideReference[side - 1]);
1110 EXPECT_FALSE(graphNeighborIndices.has_any_connection(side));
1111 }
1112 }
1113 }
1114 }
1115
1117 std::shared_ptr<TextMeshGraph> m_graph;
1118 };
1119
1121} // namespace
MPI_Comm Ioss_MPI_Comm
Definition Ioss_CodeTypes.h:61
IOSS_NODISCARD constexpr T * Data(std::vector< T > &vec)
Definition Ioss_Utils.h:58
Iotm::text_mesh::TextMeshParser< EntityId, TopologyMapping > TextMeshParser
Definition UnitTestIotmTextMeshFixture.h:74
Iotm::text_mesh::SideAdjacencyGraph< EntityId, Topology > SideAdjacencyGraph
Definition UnitTestIotmTextMeshFixture.h:75
Iotm::text_mesh::Coordinates< EntityId > Coordinates
Definition UnitTestIotmTextMeshFixture.h:73
Iotm::text_mesh::SideBlockInfo SideBlockInfo
Definition UnitTestIotmTextMeshFixture.h:76
std::set< EntityId > EntityIdSet
Definition UnitTestIotmTextMeshFixture.h:68
#define ThrowRequireWithMsg(expr, message)
Definition UnitTestIotmTextMeshFixture.h:55
Iotm::text_mesh::SplitType SplitType
Definition UnitTestIotmTextMeshFixture.h:79
Iotm::TopologyMapEntry Topology
Definition UnitTestIotmTextMeshFixture.h:64
Iotm::IossTopologyMapping TopologyMapping
Definition UnitTestIotmTextMeshFixture.h:65
Iotm::text_mesh::ElementData< EntityId, Topology > ElementData
Definition UnitTestIotmTextMeshFixture.h:70
Iotm::text_mesh::SidesetData< EntityId, Topology > SidesetData
Definition UnitTestIotmTextMeshFixture.h:71
std::vector< EntityId > EntityIdVector
Definition UnitTestIotmTextMeshFixture.h:67
Iotm::text_mesh::NodesetData< EntityId > NodesetData
Definition UnitTestIotmTextMeshFixture.h:72
std::pair< EntityId, int > SideEntry
Definition UnitTestIotmTextMeshFixture.h:77
std::vector< SideEntry > SideVector
Definition UnitTestIotmTextMeshFixture.h:78
Iotm::text_mesh::TextMeshData< EntityId, Topology > TextMeshData
Definition UnitTestIotmTextMeshFixture.h:69
A homogeneous collection of other GroupingEntities.
Definition Ioss_Assembly.h:31
IOSS_NODISCARD const EntityContainer & get_members() const
Definition Ioss_Assembly.C:85
IOSS_NODISCARD EntityType get_member_type() const
Definition Ioss_Assembly.h:46
Definition Ioss_CommSet.h:27
An input or output Database.
Definition Ioss_DatabaseIO.h:63
A collection of elements having the same topology.
Definition Ioss_ElementBlock.h:29
Represents an element topology.
Definition Ioss_ElementTopology.h:68
static IOSS_NODISCARD ElementTopology * factory(const std::string &type, bool ok_to_fail=false)
Definition Ioss_ElementTopology.C:67
virtual IOSS_NODISCARD int number_nodes() const =0
IOSS_NODISCARD int number_boundaries() const
Definition Ioss_ElementTopology.C:229
IOSS_NODISCARD const ElementTopology * topology() const
Get the topology of the entities in the block.
Definition Ioss_EntityBlock.h:48
Holds metadata for bulk data associated with a GroupingEntity.
Definition Ioss_Field.h:25
IOSS_NODISCARD size_t raw_count() const
Definition Ioss_Field.h:171
IOSS_NODISCARD const std::string & get_name() const
Definition Ioss_Field.h:127
Base class for all 'grouping' entities. The following derived classes are typical:
Definition Ioss_GroupingEntity.h:67
IOSS_NODISCARD Property get_property(const std::string &property_name) const
Get the Property from the property manager associated with the entity.
Definition Ioss_GroupingEntity.h:359
int64_t get_field_data(const std::string &field_name, void *data, size_t data_size) const
Read field data from the database file into memory using a pointer.
Definition Ioss_GroupingEntity.C:250
IOSS_NODISCARD Field get_field(const std::string &field_name) const
Get a field from the entity's field manager.
Definition Ioss_GroupingEntity.h:454
IOSS_NODISCARD bool field_exists(const std::string &field_name) const
Checks if a field with a given name exists in the entity's field manager.
Definition Ioss_GroupingEntity.h:443
IOSS_NODISCARD const Field & get_fieldref(const std::string &field_name) const
Get a reference to a field from the entity's field manager.
Definition Ioss_GroupingEntity.h:465
IOSS_NODISCARD const std::string & name() const
Get name of entity.
Definition Ioss_GroupingEntity.h:100
static IOSS_NODISCARD DatabaseIO * create(const std::string &type, const std::string &filename, DatabaseUsage db_usage, Ioss_MPI_Comm communicator=Ioss::ParallelUtils::comm_world(), const Ioss::PropertyManager &properties=Ioss::PropertyManager())
Create an IO database.
Definition Ioss_IOFactory.C:71
Initialization of the Ioss library.
Definition Ionit_Initializer.h:18
A collection of all nodes in the region.
Definition Ioss_NodeBlock.h:33
A collection of nodes.
Definition Ioss_NodeSet.h:29
Definition Ioss_ParallelUtils.h:32
IOSS_NODISCARD int parallel_size() const
Definition Ioss_ParallelUtils.C:203
static IOSS_NODISCARD Ioss_MPI_Comm comm_world()
Definition Ioss_ParallelUtils.h:40
IOSS_NODISCARD int parallel_rank() const
Definition Ioss_ParallelUtils.C:216
A collection of Ioss::Property objects.
Definition Ioss_PropertyManager.h:36
IOSS_NODISCARD int64_t get_int() const
Get the property value if it is of type INTEGER.
Definition Ioss_Property.C:253
A grouping entity that contains other grouping entities.
Definition Ioss_Region.h:93
A collection of element sides having the same topology.
Definition Ioss_SideBlock.h:37
A collection of element sides.
Definition Ioss_SideSet.h:29
IOSS_NODISCARD const SideBlockContainer & get_side_blocks() const
Definition Ioss_SideSet.C:84
IOSS_NODISCARD SideBlock * get_side_block(const std::string &my_name) const
Definition Ioss_SideSet.C:96
static const char * name
Definition Ioss_Unknown.h:20
Definition Iotm_TextMeshTopologyMapping.h:947
Definition Iotm_TextMeshTopologyMapping.h:33
Definition Iotm_TextMeshDataTypes.h:213
Definition Iotm_TextMeshAdjacencyGraph.h:92
int64_t IndexType
Definition Iotm_TextMeshAdjacencyGraph.h:94
static constexpr int ANY_PROC
Definition Iotm_TextMeshAdjacencyGraph.h:96
SideAdjacencyGraph()
Definition Iotm_TextMeshAdjacencyGraph.h:205
Definition Iotm_TextMeshUtils.h:565
TextMeshData< EntityId, Topology > parse(const std::string &meshDescription)
Definition Iotm_TextMeshUtils.h:578
Definition UnitTestIotmTextMeshFixture.h:128
std::vector< std::string > get_unique_leaf_members(const std::string &name)
Definition UnitTestIotmTextMeshFixture.h:136
void traverse_tree(const Ioss::Assembly *assembly)
Definition UnitTestIotmTextMeshFixture.h:155
AssemblyTreeGraph(const AssemblyTreeGraph &)=delete
AssemblyTreeGraph(Ioss::Region *region)
Definition UnitTestIotmTextMeshFixture.h:133
std::unordered_map< const Ioss::Assembly *, bool > m_visitedAssemblies
Definition UnitTestIotmTextMeshFixture.h:183
std::vector< std::string > m_leafMembers
Definition UnitTestIotmTextMeshFixture.h:184
Ioss::Region * m_region
Definition UnitTestIotmTextMeshFixture.h:182
Definition UnitTestIotmTextMeshFixture.h:826
const Ioss::Region & region
Definition UnitTestIotmTextMeshFixture.h:974
const double * get_nodal_coordinates(const EntityId &nodeId) const
Definition UnitTestIotmTextMeshFixture.h:953
void verify()
Definition UnitTestIotmTextMeshFixture.h:836
const std::vector< double > & operator[](const EntityId nodeId) const
Definition UnitTestIotmTextMeshFixture.h:947
std::unordered_map< EntityId, std::vector< double > > m_nodalCoords
Definition UnitTestIotmTextMeshFixture.h:980
void fill_coordinates_from_ioss()
Definition UnitTestIotmTextMeshFixture.h:925
void fill_coordinate_map(const EntityIdVector &nodeIds, const std::vector< double > &coordinates)
Definition UnitTestIotmTextMeshFixture.h:915
CoordinateVerifier(const Ioss::Region &r, const EntityIdVector &ids, const std::vector< double > &coords)
Definition UnitTestIotmTextMeshFixture.h:828
std::string error_message(const EntityId &nodeId, unsigned coordIndex)
Definition UnitTestIotmTextMeshFixture.h:966
size_t field_data_from_ioss(Ioss::GroupingEntity *io_entity, const std::string &io_fld_name, std::vector< T > &io_field_data)
Definition UnitTestIotmTextMeshFixture.h:851
const unsigned spatialDim
Definition UnitTestIotmTextMeshFixture.h:976
void verify_num_nodes()
Definition UnitTestIotmTextMeshFixture.h:909
const std::vector< double > & goldCoordinates
Definition UnitTestIotmTextMeshFixture.h:979
size_t db_api_int_size() const
Definition UnitTestIotmTextMeshFixture.h:862
EntityIdVector get_node_ids_impl() const
Definition UnitTestIotmTextMeshFixture.h:864
bool is_valid_node_impl(EntityId nodeId) const
Definition UnitTestIotmTextMeshFixture.h:892
bool is_valid_node(EntityId nodeId) const
Definition UnitTestIotmTextMeshFixture.h:899
EntityIdVector get_node_ids() const
Definition UnitTestIotmTextMeshFixture.h:882
const EntityIdVector & goldNodeIds
Definition UnitTestIotmTextMeshFixture.h:978
void verify_nodal_coordinates(const EntityId &nodeId, const double *goldCoords, const double *nodalCoords)
Definition UnitTestIotmTextMeshFixture.h:958
Definition UnitTestIotmTextMeshFixture.h:188
SideVector get_element_side_pairs_from_sideset_impl(const Ioss::SideSet *ss) const
Definition UnitTestIotmTextMeshFixture.h:522
void verify_elements_on_block(const Ioss::ElementBlock *block, const std::set< EntityId > &goldIds)
Definition UnitTestIotmTextMeshFixture.h:755
EntityIdVector get_node_ids_from_nodeset_impl(const Ioss::NodeSet *ns) const
Definition UnitTestIotmTextMeshFixture.h:496
ElementInfo get_element_info_from_block_impl(EntityId elemId, const Ioss::ElementBlock *block) const
Definition UnitTestIotmTextMeshFixture.h:551
unsigned m_spatialDimension
Definition UnitTestIotmTextMeshFixture.h:983
EntityIdVector get_node_ids_from_nodeset(const Ioss::NodeSet *ns) const
Definition UnitTestIotmTextMeshFixture.h:511
SideVector get_element_side_pairs_from_sideset(const Ioss::SideSet *ss) const
Definition UnitTestIotmTextMeshFixture.h:540
std::pair< std::string, unsigned > PartNameId
Definition UnitTestIotmTextMeshFixture.h:190
std::string get_mesh_desc(const std::string &textMeshDesc)
Definition UnitTestIotmTextMeshFixture.h:237
void fill_mesh(const std::string &meshDesc)
Definition UnitTestIotmTextMeshFixture.h:222
Ioss::SideSet * get_sideset(const std::string &name) const
Definition UnitTestIotmTextMeshFixture.h:721
std::pair< std::string, std::string > get_database_type_and_filename(const std::string &meshDesc)
Definition UnitTestIotmTextMeshFixture.h:807
size_t get_node_sharing_count(int sharingProc) const
Definition UnitTestIotmTextMeshFixture.h:436
void verify_shared_nodes(const EntityIdVector &nodeIds, int sharingProc)
Definition UnitTestIotmTextMeshFixture.h:253
void verify_num_sidesets(size_t goldCount)
Definition UnitTestIotmTextMeshFixture.h:278
size_t get_element_count_impl() const
Definition UnitTestIotmTextMeshFixture.h:618
Ioss::DatabaseIO * m_database
Definition UnitTestIotmTextMeshFixture.h:985
bool node_is_shared_with_proc_impl(EntityId nodeId, int sharingProc) const
Definition UnitTestIotmTextMeshFixture.h:645
size_t get_element_count() const
Definition UnitTestIotmTextMeshFixture.h:634
void verify_num_elements(size_t goldCount)
Definition UnitTestIotmTextMeshFixture.h:262
void verify_sideset_subset(const Ioss::SideSet *sideset, const unsigned id, const std::vector< std::string > &subsetNames)
Definition UnitTestIotmTextMeshFixture.h:285
Ioss::NodeSet * get_nodeset(const std::string &name) const
Definition UnitTestIotmTextMeshFixture.h:705
void verify_num_nodesets(size_t goldCount)
Definition UnitTestIotmTextMeshFixture.h:339
void filename_substitution(std::string &filename)
Definition UnitTestIotmTextMeshFixture.h:790
void verify_block(Ioss::ElementBlock *block)
Definition UnitTestIotmTextMeshFixture.h:753
EntityIdVector get_element_ids_from_block_impl(const Ioss::ElementBlock *block) const
Definition UnitTestIotmTextMeshFixture.h:470
void create_database(const std::string &fileName, const std::string &meshType)
Definition UnitTestIotmTextMeshFixture.h:775
bool is_valid_element(const ElementInfo &info) const
Definition UnitTestIotmTextMeshFixture.h:677
int get_parallel_size()
Definition UnitTestIotmTextMeshFixture.h:218
IossTopologyMapping m_topologyMapping
Definition UnitTestIotmTextMeshFixture.h:987
TextMeshFixture(unsigned spatialDimension)
Definition UnitTestIotmTextMeshFixture.h:210
int get_parallel_rank()
Definition UnitTestIotmTextMeshFixture.h:220
void verify_single_sideset(const std::string &name, const unsigned id, const SideVector &goldElemSidePairs)
Definition UnitTestIotmTextMeshFixture.h:306
void verify_single_nodeset(const std::string &name, const unsigned id, const EntityIdVector &goldNodeIds)
Definition UnitTestIotmTextMeshFixture.h:346
~TextMeshFixture()
Definition UnitTestIotmTextMeshFixture.h:216
void verify_single_assembly(const std::string &name, const unsigned id, const std::vector< std::string > &goldMembers)
Definition UnitTestIotmTextMeshFixture.h:368
void create_ioss_region()
Definition UnitTestIotmTextMeshFixture.h:766
ElementInfo get_element_info(EntityId elemId) const
Definition UnitTestIotmTextMeshFixture.h:608
Ioss::ElementBlock * get_element_block(const std::string &blockName) const
Definition UnitTestIotmTextMeshFixture.h:689
void verify_single_element(EntityId elemId, const std::string &textMeshTopologyName, const EntityIdVector &nodeIds)
Definition UnitTestIotmTextMeshFixture.h:268
void verify_num_assemblies(size_t goldCount)
Definition UnitTestIotmTextMeshFixture.h:361
size_t get_node_sharing_count_impl(int sharingProc) const
Definition UnitTestIotmTextMeshFixture.h:446
Ioss::PropertyManager m_propertyManager
Definition UnitTestIotmTextMeshFixture.h:984
void setup_text_mesh(const std::string &textMeshDesc)
Definition UnitTestIotmTextMeshFixture.h:420
Ioss::Region * m_region
Definition UnitTestIotmTextMeshFixture.h:986
ElementInfo get_element_info_impl(EntityId elemId) const
Definition UnitTestIotmTextMeshFixture.h:584
void verify_coordinates(const EntityIdVector &goldNodeIds, const std::vector< double > &goldCoordinates)
Definition UnitTestIotmTextMeshFixture.h:413
Ioss_MPI_Comm get_comm() const
Definition UnitTestIotmTextMeshFixture.h:235
bool node_is_shared_with_proc(EntityId nodeId, int sharingProc) const
Definition UnitTestIotmTextMeshFixture.h:667
EntityIdVector get_element_ids_from_block(const Ioss::ElementBlock *block) const
Definition UnitTestIotmTextMeshFixture.h:485
Ioss::Assembly * get_assembly(const std::string &name) const
Definition UnitTestIotmTextMeshFixture.h:737
std::string get_topology_name(const std::string &textMeshTopologyName)
Definition UnitTestIotmTextMeshFixture.h:425
void verify_part_ids(const std::vector< PartNameId > &golds)
Definition UnitTestIotmTextMeshFixture.h:397
size_t db_api_int_size() const
Definition UnitTestIotmTextMeshFixture.h:430
void verify_single_sideset(const std::string &name, const unsigned id, const std::vector< std::string > &subsets, const SideVector &goldElemSidePairs)
Definition UnitTestIotmTextMeshFixture.h:312
std::string get_mesh_desc(const std::string &textMeshDesc, unsigned dimension)
Definition UnitTestIotmTextMeshFixture.h:244
void verify_part_membership(const std::vector< PartInfo > golds)
Definition UnitTestIotmTextMeshFixture.h:387
void verify_nodes_on_element(const ElementInfo &info, const EntityIdVector &goldNodeIds)
Definition UnitTestIotmTextMeshFixture.h:408
TestTextMesh1d()
Definition UnitTestIotmTextMeshFixture.h:1009
TestTextMesh2d()
Definition UnitTestIotmTextMeshFixture.h:1003
EntityId get_element_id(const size_t elemIndex) const override
Definition UnitTestIotmTextMeshFixture.h:1062
TextMeshGraph(const TextMeshData &data)
Definition UnitTestIotmTextMeshFixture.h:1020
int get_element_proc(const size_t elemIndex) const override
Definition UnitTestIotmTextMeshFixture.h:1024
bool element_has_any_node_on_proc(const size_t elemIndex, int proc) const override
Definition UnitTestIotmTextMeshFixture.h:1030
const std::vector< EntityId > & get_element_node_ids(const size_t elemIndex) const override
Definition UnitTestIotmTextMeshFixture.h:1050
const std::string & get_element_block_name(const size_t elemIndex) const override
Definition UnitTestIotmTextMeshFixture.h:1044
const Topology & get_element_topology(const size_t elemIndex) const override
Definition UnitTestIotmTextMeshFixture.h:1056
const TextMeshData & m_data
Definition UnitTestIotmTextMeshFixture.h:1069
size_t get_num_elements() const override
Definition UnitTestIotmTextMeshFixture.h:1022
TextMeshData m_data
Definition UnitTestIotmTextMeshFixture.h:1116
void verify_side_adjacency(const std::vector< Adjacency > &goldNeighbors)
Definition UnitTestIotmTextMeshFixture.h:1084
void dump_graph(std::ostream &out=std::cout)
Definition UnitTestIotmTextMeshFixture.h:1072
void setup_text_mesh_graph(const std::string &meshDesc, const std::vector< std::string > &selectedBlocks={}, int proc=SideAdjacencyGraph::ANY_PROC)
Definition UnitTestIotmTextMeshFixture.h:1074
std::shared_ptr< TextMeshGraph > m_graph
Definition UnitTestIotmTextMeshFixture.h:1117
TestTextMeshGraph()
Definition UnitTestIotmTextMeshFixture.h:1015
Definition UnitTestIotmTextMeshFixture.h:995
TestTextMesh()
Definition UnitTestIotmTextMeshFixture.h:997
std::vector< ElementBlock * > ElementBlockContainer
Definition Ioss_Region.h:69
DatabaseUsage
Specifies how an Ioss::DatabaseIO object will be used.
Definition Ioss_DBUsage.h:13
@ READ_MODEL
Definition Ioss_DBUsage.h:20
std::vector< NodeSet * > NodeSetContainer
Definition Ioss_Region.h:71
std::vector< SideSet * > SideSetContainer
Definition Ioss_Region.h:76
std::vector< Ioss::Assembly * > AssemblyContainer
Definition Ioss_Region.h:63
std::vector< NodeBlock * > NodeBlockContainer
Definition Ioss_Region.h:66
EntityType
The particular type of GroupingEntity.
Definition Ioss_EntityType.h:12
@ ASSEMBLY
Definition Ioss_EntityType.h:28
SplitType
Definition Iotm_TextMeshSidesetSplitter.h:55
Definition UnitTestIotmTextMeshFixture.h:125
A namespace for the textmesh database format.
Definition Iotm_DatabaseIO.C:95
TopologyMapEntry Topology
Definition Iotm_TextMesh.h:34
int64_t EntityId
Definition Iotm_TextMesh.h:33
TestTextMesh TestTextMeshSkin
Definition UnitTestIotmTextMeshFixture.h:1120
NeighborVector get_full_neighbor_vector(const SimpleNeighborVector &simpleNeighborVector)
Definition UnitTestIotmTextMeshFixture.h:99
std::vector< std::pair< int, SideAdjacencyGraph::IndexType > > NeighborVector
Definition UnitTestIotmTextMeshFixture.h:83
std::vector< SideAdjacencyGraph::IndexType > SimpleNeighborVector
Definition UnitTestIotmTextMeshFixture.h:84
size_t elemIndex
Definition UnitTestIotmTextMeshFixture.h:86
Adjacency(size_t elemIndex_, const NeighborVector &neighborIndices_)
Definition UnitTestIotmTextMeshFixture.h:89
NeighborVector neighborIndices
Definition UnitTestIotmTextMeshFixture.h:87
Adjacency(size_t elemIndex_, const SimpleNeighborVector &neighborIndices_)
Definition UnitTestIotmTextMeshFixture.h:94
Definition Iotm_TextMeshDataTypes.h:276
Topology topology
Definition Iotm_TextMeshDataTypes.h:279
std::string partName
Definition Iotm_TextMeshDataTypes.h:281
int proc
Definition Iotm_TextMeshDataTypes.h:277
EntityId identifier
Definition Iotm_TextMeshDataTypes.h:278
std::vector< EntityId > nodeIds
Definition Iotm_TextMeshDataTypes.h:280
Definition Iotm_TextMeshNodeset.h:40
Definition Iotm_TextMeshSidesetSplitter.h:45
Definition Iotm_TextMeshSideset.h:43
Definition Iotm_TextMeshDataTypes.h:314
Definition UnitTestIotmTextMeshFixture.h:193
EntityIdVector connectivity
Definition UnitTestIotmTextMeshFixture.h:195
const Ioss::ElementTopology * topology
Definition UnitTestIotmTextMeshFixture.h:194
ElementInfo(const Ioss::ElementTopology *topology_, const EntityIdVector &connectivity_)
Definition UnitTestIotmTextMeshFixture.h:198
ElementInfo()
Definition UnitTestIotmTextMeshFixture.h:197
Definition UnitTestIotmTextMeshFixture.h:205
EntityIdSet ids
Definition UnitTestIotmTextMeshFixture.h:207
std::string blockName
Definition UnitTestIotmTextMeshFixture.h:206
Definition UnitTestIotmTextMeshFixture.h:112
bool operator()(const SideEntry &lhs, const SideEntry &rhs) const
Definition UnitTestIotmTextMeshFixture.h:113