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


C++ Orientation::getEdgeOrientation方法代码示例

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


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

示例1: main


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

                  // Step 3: construct interpolant and check solutions
                  magnitude_type interpolation_error = 0, solution_norm =0;
                  for (int iel=0;iel<nelement;++iel) {
                    retrieve_element_solution(b,
                                              b_asm,
                                              local2global[iel],
                                              nnodes_per_element);

                    if (verbose && p < 5) {
                      *outStream << " - Element solution, iel = " << iel << "\n";
                      *outStream << std::showpos;
                      for (int i=0;i<nbf;++i) {
                        *outStream << MatVal(b, i, 0) << "\n";
                      }
                      *outStream << std::noshowpos;
                    }

                    magnitude_type
                      element_interpolation_error = 0,
                      element_solution_norm = 0;

                    Orientation ort = Orientation::getOrientation(cell, element[iel]);

                    // set element nodal coordinates
                    fill_cell_nodes(cell_nodes, 
                                    nodes, 
                                    element[iel], 
                                    nvert, ndim);

                    compute_element_error(element_interpolation_error,
                                          element_solution_norm,
                                          element[iel],
                                          cell_nodes,
                                          basis_set,
                                          b,
                                          ort,
                                          nx, ny);

                    interpolation_error += element_interpolation_error;
                    solution_norm       += element_solution_norm;

                    {
                      int edge_orts[3];
                      ort.getEdgeOrientation(edge_orts, nedge);
                      *outStream << "   iel = " << std::setw(4) << iel
                                 << ", orientation = "
                                 << edge_orts[0]
                                 << edge_orts[1]
                                 << edge_orts[2]
                                 << " , error = " << element_interpolation_error
                                 << " , solution norm = " << element_solution_norm
                                 << " , relative error = " << (element_interpolation_error/element_solution_norm)
                                 << "\n";
                    }
                    const magnitude_type relative_error = interpolation_error/solution_norm;
                    const magnitude_type tol = p*p*100*INTREPID_TOL;

                    if (relative_error > tol) {
                      ++r_val;
                      *outStream << "\n\nPatch test failed: \n"
                                 << "    exact polynomial (nx, ny) = " << std::setw(4) << nx << ", " << std::setw(4) << ny << "\n"
                                 << "    basis order               = " << std::setw(4) << p << "\n"
                                 << "    orientation configuration = " << std::setw(4) << conf0 << std::setw(4) << conf1 << "\n"
                                 << "    relative error            = " << std::setw(4) << relative_error << "\n"
                                 << "    tolerance                 = " << std::setw(4) << tol << "\n";
                    }
                  }
                } 

                // for next iteration
                std::next_permutation(elt_1, elt_1+3);
              } // end of conf1
            } // end of conf0
          } // end of p
        } // end of point type
      } // end of ny
    } // end of nx
  }
  catch (std::logic_error err) {
    *outStream << err.what() << "\n\n";
    r_val = -1000;
  };
#else
  *outStream << "\t This test is for high order element assembly. \n"
             << "\t Use -D INTREPID_USING_EXPERIMENTAL_HIGH_ORDER in CMAKE_CXX_FLAGS \n";
#endif

  if (r_val != 0)
    std::cout << "End Result: TEST FAILED  :: r_val = " << r_val << "\n";
  else
    std::cout << "End Result: TEST PASSED\n";

  // reset format state of std::cout
  std::cout.copyfmt(oldFormatState);

  Kokkos::finalize();

  return r_val;
}
开发者ID:crtrott,项目名称:Trilinos,代码行数:101,代码来源:test_04.cpp


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