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


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

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


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

示例1: Compute_Maps


//.........这里部分代码省略.........
      
	  // Compute midpoint.
	  mid_x = 0.0; mid_y = 0.0; mid_z = 0.0;

	  for (size_t j = 0; j < num_nodes_per_elmt; ++j) {
	    SMART_ASSERT(conn1[j] >= 1 && conn1[j] <= (INT)num_nodes);
	    mid_x += x1_f[conn1[j]-1];
	    if (dim > 1) mid_y += y1_f[conn1[j]-1];
	    if (dim > 2) mid_z += z1_f[conn1[j]-1];
	  }
	  mid_x /= (double)num_nodes_per_elmt;
	  if (dim > 1) mid_y /= (double)num_nodes_per_elmt;
	  if (dim > 2) mid_z /= (double)num_nodes_per_elmt;
      
	  // Locate midpoint in sorted array.
	  sort_idx = Find(mid_x, mid_y, mid_z, x2, y2, z2, id, num_elmts, dim,
			  file1.Block_Id(b), interface.ignore_dups);

	  if (sort_idx < 0) {
	    std::cout << "\nexodiff: ERROR: Files are different (couldn't match element "
		      << (i+1) << " from block " << file1.Block_Id(b)
		      << " from first file to second)" << std::endl;
	    exit(1);
	  }
	  e2 = id[sort_idx];
      
	  // Assign element map for this element.
	  elmt_map[e1] = e2;
      
	  {
	    // Determine the block and elmt index of matched element.
	    int b2;
	    size_t l2;
	    file2.Global_to_Block_Local(e2+1, b2, l2);
        
	    const Exo_Block<INT>* block2 = file2.Get_Elmt_Block_by_Index(b2);
	    SMART_ASSERT(block2 != nullptr);
        
	    // Check that the element types are the same.
	    if (num_nodes_per_elmt != block2->Num_Nodes_per_Elmt())
	      {
		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.
开发者ID:Russell-Jones-OxPhys,项目名称:Trilinos,代码行数:67,代码来源:map.C

示例2: Compute_Partial_Maps


//.........这里部分代码省略.........

      for (size_t j = 0; j < num_nodes_per_elmt; ++j) {
        SMART_ASSERT(conn1[j] >= 1 && conn1[j] <= (INT)num_nodes1);
        mid_x += x1_f[conn1[j]-1];
        if (dim > 1) mid_y += y1_f[conn1[j]-1];
        if (dim > 2) mid_z += z1_f[conn1[j]-1];
      }
      mid_x /= (double)num_nodes_per_elmt;
      if (dim > 1) mid_y /= (double)num_nodes_per_elmt;
      if (dim > 2) mid_z /= (double)num_nodes_per_elmt;
      
      // Locate midpoint in sorted array.
      sort_idx = Find(mid_x, mid_y, mid_z, x2, y2, z2, id2, num_elmts2, dim,
		      file1.Block_Id(b), interface.ignore_dups);
      if (sort_idx < 0) {
	unmatched++;
	if (first && interface.show_unmatched) {
	  std::cout << "exodiff: Doing Partial Comparison: No Match for (b.e):\n";
	}
	first = false;
        if (interface.show_unmatched)
	  std::cout << file1.Block_Id(b) << "." << (i+1) << ", ";
      }
      else{
	e2 = id2[sort_idx];
	elmt_map[e1] = e2;
	
	// Assign element map for this element.
	
	
        // Determine the block and elmt index of matched element.
	int b2;
        size_t l2;
	file2.Global_to_Block_Local(e2+1, b2, l2);
        
        const Exo_Block<INT>* block2 = file2.Get_Elmt_Block_by_Index(b2);
        SMART_ASSERT(block2 != nullptr);
        
        // Check that the element types are the same.
        if (num_nodes_per_elmt != block2->Num_Nodes_per_Elmt())
        {
          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 ];
开发者ID:Russell-Jones-OxPhys,项目名称:Trilinos,代码行数:67,代码来源:map.C


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