当前位置: 首页>>代码示例>>C++>>正文


C++ ExoII_Read::Free_Node_Map方法代码示例

本文整理汇总了C++中ExoII_Read::Free_Node_Map方法的典型用法代码示例。如果您正苦于以下问题:C++ ExoII_Read::Free_Node_Map方法的具体用法?C++ ExoII_Read::Free_Node_Map怎么用?C++ ExoII_Read::Free_Node_Map使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExoII_Read的用法示例。


在下文中一共展示了ExoII_Read::Free_Node_Map方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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();
//.........这里部分代码省略.........
开发者ID:Russell-Jones-OxPhys,项目名称:Trilinos,代码行数:101,代码来源:map.C


注:本文中的ExoII_Read::Free_Node_Map方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。