本文整理汇总了C++中ExoII_Read::Free_Elmt_Blocks方法的典型用法代码示例。如果您正苦于以下问题:C++ ExoII_Read::Free_Elmt_Blocks方法的具体用法?C++ ExoII_Read::Free_Elmt_Blocks怎么用?C++ ExoII_Read::Free_Elmt_Blocks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExoII_Read
的用法示例。
在下文中一共展示了ExoII_Read::Free_Elmt_Blocks方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Compute_Maps
//.........这里部分代码省略.........
// assert that if this node has been given a map
// previously, that it agrees with the latest
// assignment.
if (node_map[conn1[ln1]-1] >= 0 && node_map[conn1[ln1]-1] != conn2[ln2]-1) {
if (!interface.ignore_dups) {
// Node in file 1.
INT node1 = conn1[ln1];
double x1a = x1_f[node1-1];
double y1a = dim >= 2 ? y1_f[node1-1] : 0.0;
double z1a = dim >= 3 ? z1_f[node1-1] : 0.0;
// Node in file 2 that was already mapped to node 1 in file 1
INT n1 = node_map[conn1[ln1]-1]+1;
double x2a = x2_f[n1-1];
double y2a = dim >= 2 ? y2_f[n1-1] : 0.0;
double z2a = dim >= 3 ? z2_f[n1-1] : 0.0;
// Node in file 2 that is now being mapped to node 1 in file 1
INT n2 = conn2[ln2];
double x2b = x2_f[n2-1];
double y2b = dim >= 2 ? y2_f[n2-1] : 0.0;
double z2b = dim >= 3 ? z2_f[n2-1] : 0.0;
SMART_ASSERT(!interface.coord_tol.Diff(x2a, x2b) &&
!interface.coord_tol.Diff(y2a, y2b) &&
!interface.coord_tol.Diff(z2a, z2b));
std::cout << "\nexodiff: ERROR - No unique node mapping possible.\n"
<< "\tFile 1, Node " << node1
<< " at (" << x1a << ", " << y1a << ", " << z1a << ") maps to both:\n"
<< "\tFile 2, Node " << n1
<< " at (" << x2a << ", " << y2a << ", " << z2a << ") and\n"
<< "\tFile 2, Node " << n2
<< " at (" << x2b << ", " << y2b << ", " << z2b << ")\n\n";
exit(1);
}
found = 1;
break;
}
node_map[ conn1[ln1] - 1 ] = conn2[ln2] - 1;
found = 1;
break;
}
}
if (!found) {
std::cout << "\nexodiff: ERROR: Cannot find a match for node at position "
<< ln1+1 << " in first element.\n"
<< "\tFile 1: Element " << (i+1) << " in Block " << file1.Block_Id(b) << " nodes:\n";
for (size_t l1 = 0; l1 < num_nodes_per_elmt; ++l1) {
double x_val = x1_f[ conn1[l1] - 1 ];
double y_val = dim > 1 ? y1_f[ conn1[l1] - 1 ] : 0.0;
double z_val = dim > 2 ? z1_f[ conn1[l1] - 1 ] : 0.0;
std::cout << "\t(" << l1+1 << ")\t" << conn1[l1] << "\t"
<< std::setprecision(9) << x_val << "\t" << y_val << "\t" << z_val << "\n";
}
std::cout << "\tFile 2: Element " << (l2+1) << " in Block " << file1.Block_Id(b) << " nodes:\n";
for (size_t l3 = 0; l3 < num_nodes_per_elmt; ++l3) {
double x_val = x2_f[ conn2[l3] - 1 ];
double y_val = dim > 1 ? y2_f[ conn2[l3] - 1 ] : 0.0;
double z_val = dim > 2 ? z2_f[ conn2[l3] - 1 ] : 0.0;
std::cout << "\t(" << l3+1 << ")\t" << conn2[l3] << "\t"
<< std::setprecision(9) << x_val << "\t" << y_val << "\t" << z_val << "\n";
}
std::cout << "Coordinates compared using tolerance: " << interface.coord_tol.value
<< " (" << interface.coord_tol.typestr() << "), floor: "
<< interface.coord_tol.floor << "\n";
exit(1);
}
} // End of local node loop on file1's element.
} // End of local node search block.
++e1;
} // End of loop on elements in file1 element block.
file1.Free_Elmt_Block(b);
} // End of loop on file1 blocks.
// Check that all nodes in the file have been matched... If any
// unmatched nodes are found, then perform a node-based matching
// algorithm...
for (size_t i=0; i < num_nodes; i++) {
if (node_map[i] < 0) {
Compute_Node_Map(node_map, file1, file2);
break;
}
}
file1.Free_Nodal_Coordinates();
file2.Free_Nodal_Coordinates();
file2.Free_Elmt_Blocks();
if (x2 != nullptr) delete [] x2;
if (y2 != nullptr) delete [] y2;
if (z2 != nullptr) delete [] z2;
if (id != nullptr) delete [] id;
interface.coord_tol.type = save_tolerance_type;
}
示例2: Compute_Partial_Maps
//.........这里部分代码省略.........
{
std::cout << "\nexodiff: ERROR: Files are different.\n"
<< " In File 1: Element " << (i+1) << " in Block " << file1.Block_Id(b)
<< " has " << num_nodes_per_elmt << " and\n"
<< " In File 2: Element " << (l2+1) << " in Block " << file2.Block_Id(b2)
<< " has " << block2->Num_Nodes_per_Elmt()
<< std::endl;
exit(1);
}
// Get connectivity for file2 element.
const INT* conn2 = block2->Connectivity(l2);
// Match each node in the first elmt with a node in the second
// and assign node_map.
for (size_t ln1 = 0; ln1 < num_nodes_per_elmt; ++ln1)
{
// Grab coordinate of node in first file.
double x1_val = x1_f[ conn1[ln1] - 1 ];
double y1_val = dim > 1 ? y1_f[ conn1[ln1] - 1 ] : 0.0;
double z1_val = dim > 2 ? z1_f[ conn1[ln1] - 1 ] : 0.0;
size_t found = 0;
for (size_t ln2 = 0; ln2 < num_nodes_per_elmt; ++ln2)
{
// Grab coordinate of node in second file.
double x2_val = x2_f[ conn2[ln2] - 1 ];
double y2_val = dim > 1 ? y2_f[ conn2[ln2] - 1 ] : 0.0;
double z2_val = dim > 2 ? z2_f[ conn2[ln2] - 1 ] : 0.0;
if (!interface.coord_tol.Diff(x1_val, x2_val) &&
!interface.coord_tol.Diff(y1_val, y2_val) &&
!interface.coord_tol.Diff(z1_val, z2_val) )
{
node_map[ conn1[ln1] - 1 ] = conn2[ln2] - 1;
found = 1;
break;
}
}
if (!found) {
std::cout << "\nexodiff: ERROR: Cannot find a match for node at position "
<< ln1+1 << " in first element.\n"
<< "\tFile 1: Element " << (i+1) << " in Block " << file1.Block_Id(b) << " nodes:\n";
for (size_t l1 = 0; l1 < num_nodes_per_elmt; ++l1) {
double x_val = x1_f[ conn1[l1] - 1 ];
double y_val = dim > 1 ? y1_f[ conn1[l1] - 1 ] : 0.0;
double z_val = dim > 2 ? z1_f[ conn1[l1] - 1 ] : 0.0;
std::cout << "\t(" << l1+1 << ")\t" << conn1[l1] << "\t"
<< std::setprecision(9) << x_val << "\t" << y_val << "\t" << z_val << "\n";
}
std::cout << "\tFile 2: Element " << (l2+1) << " in Block " << file1.Block_Id(b) << " nodes:\n";
for (size_t l3 = 0; l3 < num_nodes_per_elmt; ++l3) {
double x_val = x2_f[ conn2[l3] - 1 ];
double y_val = dim > 1 ? y2_f[ conn2[l3] - 1 ] : 0.0;
double z_val = dim > 2 ? z2_f[ conn2[l3] - 1 ] : 0.0;
std::cout << "\t(" << l3+1 << ")\t" << conn2[l3] << "\t"
<< std::setprecision(9) << x_val << "\t" << y_val << "\t" << z_val << "\n";
}
std::cout << "Coordinates compared using tolerance: " << interface.coord_tol.value
<< " (" << interface.coord_tol.typestr() << "), floor: "
<< interface.coord_tol.floor << "\n";
exit(1);
}
} // End of local node loop on file1's element.
} // End of local node search block.
++e1;
} // End of loop on elements in file1 element block.
file1.Free_Elmt_Block(b);
} // End of loop on file1 blocks.
if (!first) {
std::cout << "\nPartial Map selected -- " << unmatched << " elements unmatched\n";
} else {
if (num_elmts1 == num_elmts2)
std::cout << "exodiff: INFO .. Partial Map was specfied, but not needed. All elements matched.\n";
}
// Check that all nodes in the file have been matched... If any
// unmatched nodes are found, then perform a node-based matching
// algorithm...
// for (size_t i=0; i < num_nodes; i++) {
// if (node_map[i] < 0) {
// Compute_Node_Map(node_map, file1, file2);
// break;
// }
// }
file1.Free_Nodal_Coordinates();
file2.Free_Nodal_Coordinates();
file2.Free_Elmt_Blocks();
if (x2 != nullptr) delete [] x2;
if (y2 != nullptr) delete [] y2;
if (z2 != nullptr) delete [] z2;
if (id2 != nullptr) delete [] id2;
interface.coord_tol.type = save_tolerance_type;
}