本文整理汇总了C++中ExoII_Read::Get_Elmt_Map方法的典型用法代码示例。如果您正苦于以下问题:C++ ExoII_Read::Get_Elmt_Map方法的具体用法?C++ ExoII_Read::Get_Elmt_Map怎么用?C++ ExoII_Read::Get_Elmt_Map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExoII_Read
的用法示例。
在下文中一共展示了ExoII_Read::Get_Elmt_Map方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Compute_FileId_Maps
void Compute_FileId_Maps(INT *&node_map, INT *&elmt_map, ExoII_Read<INT> &file1,
ExoII_Read<INT> &file2)
{
// Compute map of nodes and elements in file1 to nodes and elements in file2
// Use the internal exodus node and element number maps in file1 and file2 to
// do the matching. Currently assume (and verify) that number of nodes and
// elements match in the two files.
SMART_ASSERT(file1.Open());
SMART_ASSERT(file2.Open());
{
size_t num_nodes = file1.Num_Nodes();
SMART_ASSERT(num_nodes == file2.Num_Nodes());
node_map = new INT[num_nodes];
SMART_ASSERT(node_map != nullptr);
file1.Load_Node_Map();
file2.Load_Node_Map();
const INT *node_id_map1 = file1.Get_Node_Map();
const INT *node_id_map2 = file2.Get_Node_Map();
if (!internal_compute_maps(node_map, node_id_map1, node_id_map2, num_nodes, "node")) {
delete[] node_map;
node_map = nullptr;
}
}
{
size_t num_elmts = file1.Num_Elmts();
SMART_ASSERT(num_elmts == file2.Num_Elmts());
elmt_map = new INT[num_elmts];
SMART_ASSERT(elmt_map != nullptr);
file1.Load_Elmt_Map();
file2.Load_Elmt_Map();
const INT *elem_id_map1 = file1.Get_Elmt_Map();
const INT *elem_id_map2 = file2.Get_Elmt_Map();
if (!internal_compute_maps(elmt_map, elem_id_map1, elem_id_map2, num_elmts, "element")) {
delete[] elmt_map;
elmt_map = nullptr;
}
}
}
示例2: Compare_Maps
bool Compare_Maps(ExoII_Read<INT>& file1, ExoII_Read<INT>& file2, const INT *node_map, const INT *elmt_map, bool partial_flag)
{
// Check whether the node and element number maps from both file1
// and file2 match which indicates that we are comparing the same
// element and node in each file.
size_t num_nodes1 = file1.Num_Nodes();
size_t num_elmts1 = file1.Num_Elmts();
//size_t num_nodes2 = file2.Num_Nodes();
//size_t num_elmts2 = file2.Num_Elmts();
// NOTE: file1 maps are already loaded...
file2.Load_Node_Map();
file2.Load_Elmt_Map();
const INT *node_id_map1 = file1.Get_Node_Map();
const INT *elem_id_map1 = file1.Get_Elmt_Map();
const INT *node_id_map2 = file2.Get_Node_Map();
const INT *elem_id_map2 = file2.Get_Elmt_Map();
bool diff = false;
size_t warn_count = 0;
if (node_map != nullptr) {
// There is a map between file1 and file2, but all nodes are
// used in both files.
for (size_t i=0; i < num_nodes1; i++) {
if (node_id_map1[i] != node_id_map2[node_map[i]]) {
if (!(node_id_map2[node_map[i]] == 0 && partial_flag)) { // Don't output diff if non-matched and partial
std::cout << "exodiff: WARNING .. The local node " << i+1 << " with global id " << node_id_map1[i]
<< " in file1 has the global id " << node_id_map2[node_map[i]]
<< " in file2.\n";
diff = true;
warn_count++;
if (warn_count > 100) {
std::cout << "exodiff: WARNING .. Too many warnings, skipping remainder...\n";
break;
}
}
}
}
} else {
// No node mapping between file1 and file2 -- do a straight compare.
for (size_t i=0; i < num_nodes1; i++) {
if (node_id_map1[i] != node_id_map2[i]) {
if (!(node_id_map2[i] == 0 && partial_flag)) { // Don't output diff if non-matched and partial
std::cout << "exodiff: WARNING .. The local node " << i+1 << " with global id " << node_id_map1[i]
<< " in file1 has the global id " << node_id_map2[i]
<< " in file2.\n";
diff = true;
warn_count++;
if (warn_count > 100) {
std::cout << "exodiff: WARNING .. Too many warnings, skipping remainder...\n";
break;
}
}
}
}
}
warn_count = 0;
if (elmt_map != nullptr) {
// There is a map between file1 and file2, but all elements are
// used in both files.
for (size_t i=0; i < num_elmts1; i++) {
if (elem_id_map1[i] != elem_id_map2[elmt_map[i]]) {
if (!(elem_id_map2[elmt_map[i]] == 0 && partial_flag)) { // Don't output diff if non-matched and partial
std::cout << "exodiff: WARNING .. The local element " << i+1 << " with global id " << elem_id_map1[i]
<< " in file1 has the global id " << elem_id_map2[elmt_map[i]]
<< " in file2.\n";
diff = true;
warn_count++;
if (warn_count > 100) {
std::cout << "exodiff: WARNING .. Too many warnings, skipping remainder...\n";
break;
}
}
}
}
} else {
// No element mapping between file1 and file2 -- do a straight compare.
for (size_t i=0; i < num_elmts1; i++) {
if (elem_id_map1[i] != elem_id_map2[i]) {
if (!(elem_id_map2[i] == 0 && partial_flag)) { // Don't output diff if non-matched and partial
std::cout << "exodiff: WARNING .. The local element " << i+1 << " with global id " << elem_id_map1[i]
<< " in file1 has the global id " << elem_id_map2[i]
<< " in file2.\n";
diff = true;
warn_count++;
if (warn_count > 100) {
std::cout << "exodiff: WARNING .. Too many warnings, skipping remainder...\n";
break;
}
}
}
}
}
file2.Free_Node_Map();
//.........这里部分代码省略.........