亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ex17.c

?? 一個用來實現偏微分方程中網格的計算庫
?? C
字號:
/* $Id: ex17.C 2837 2008-05-08 17:23:37Z roystgnr $ *//* The Next Great Finite Element Library. *//* Copyright (C) 2003  Benjamin S. Kirk *//* This library is free software; you can redistribute it and/or *//* modify it under the terms of the GNU Lesser General Public *//* License as published by the Free Software Foundation; either *//* version 2.1 of the License, or (at your option) any later version. *//* This library is distributed in the hope that it will be useful, *//* but WITHOUT ANY WARRANTY; without even the implied warranty of *//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *//* Lesser General Public License for more details. *//* You should have received a copy of the GNU Lesser General Public *//* License along with this library; if not, write to the Free Software *//* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */// <h1>Example 17 - Solving a generalized Eigen Problem</h1>//// This example shows how the previous EigenSolver example // can be adapted to solve generailzed eigenvalue problems.// // For solving eigen problems, libMesh interfaces// SLEPc (www.grycap.upv.es/slepc/) which again is based on PETSc.// Hence, this example will only work if the library is compiled// with SLEPc support enabled.//// In this example some eigenvalues for a generalized symmetric// eigenvalue problem A*x=lambda*B*x are computed, where the// matrices A and B are assembled according to stiffness and// mass matrix, respectively.// libMesh include files.#include "libmesh.h"#include "mesh.h"#include "mesh_generation.h"#include "gmv_io.h"#include "eigen_system.h"#include "equation_systems.h"#include "fe.h"#include "quadrature_gauss.h"#include "dense_matrix.h"#include "sparse_matrix.h"#include "numeric_vector.h"#include "dof_map.h"// Function prototype.  This is the function that will assemble// the eigen system. Here, we will simply assemble a mass matrix.void assemble_mass(EquationSystems& es,                   const std::string& system_name);int main (int argc, char** argv){  // Initialize libMesh and the dependent libraries.  LibMeshInit init (argc, argv);  // This example is designed for the SLEPc eigen solver interface.#ifndef HAVE_SLEPC  if (libMesh::processor_id() == 0)    std::cerr << "ERROR: This example requires libMesh to be\n"              << "compiled with SLEPc eigen solvers support!"              << std::endl;  return 0;#else  // Check for proper usage.  if (argc < 3)    {      if (libMesh::processor_id() == 0)        std::cerr << "\nUsage: " << argv[0]                  << " -n <number of eigen values>"                  << std::endl;      libmesh_error();    }    // Tell the user what we are doing.  else     {      std::cout << "Running " << argv[0];            for (int i=1; i<argc; i++)        std::cout << " " << argv[i];            std::cout << std::endl << std::endl;    }  // Set the dimensionality.  const unsigned int dim = 2;  // Get the number of eigen values to be computed from argv[2]  const unsigned int nev = std::atoi(argv[2]);  // Create a dim-dimensional mesh.  Mesh mesh (dim);  // Use the internal mesh generator to create a uniform  // grid on a square.  MeshTools::Generation::build_square (mesh,                                        20, 20,                                       -1., 1.,                                       -1., 1.,                                       QUAD4);  // Print information about the mesh to the screen.  mesh.print_info();    // Create an equation systems object.  EquationSystems equation_systems (mesh);  // Create a EigenSystem named "Eigensystem" and (for convenience)  // use a reference to the system we create.  EigenSystem & eigen_system =    equation_systems.add_system<EigenSystem> ("Eigensystem");  // Declare the system variables.  // Adds the variable "p" to "Eigensystem".   "p"  // will be approximated using second-order approximation.  eigen_system.add_variable("p", FIRST);  // Give the system a pointer to the matrix assembly  // function defined below.  eigen_system.attach_assemble_function (assemble_mass);  // Set necessary parametrs used in EigenSystem::solve(),  // i.e. the number of requested eigenpairs \p nev and the number  // of basis vectors \p ncv used in the solution algorithm. Note that  // ncv >= nev must hold and ncv >= 2*nev is recommended.  equation_systems.parameters.set<unsigned int>("eigenpairs")    = nev;  equation_systems.parameters.set<unsigned int>("basis vectors") = nev*3;  // Set the eigen solver type. SLEPc offers various solvers such as  // the Arnoldi and subspace method. It  // also offers interfaces to other solver packages (e.g. ARPACK).  eigen_system.eigen_solver->set_eigensolver_type(ARNOLDI);  // Set the solver tolerance and the maximum number of iterations.   equation_systems.parameters.set<Real>("linear solver tolerance") = pow(TOLERANCE, 5./3.);  equation_systems.parameters.set<unsigned int>    ("linear solver maximum iterations") = 1000;  // Set the type of the problem, here we deal with  // a generalized Hermitian problem.  eigen_system.set_eigenproblem_type(GHEP);  // Set the eigenvalues to be computed. Note that not  // all solvers support this.  // eigen_system.eigen_solver->set_position_of_spectrum(SMALLEST_MAGNITUDE);  // Initialize the data structures for the equation system.  equation_systems.init();  // Prints information about the system to the screen.  equation_systems.print_info();       // Solve the system "Eigensystem".  eigen_system.solve();  // Get the number of converged eigen pairs.  unsigned int nconv = eigen_system.get_n_converged();  std::cout << "Number of converged eigenpairs: " << nconv            << "\n" << std::endl;  // Get the last converged eigenpair  if (nconv != 0)    {      eigen_system.get_eigenpair(nconv-1);            // Write the eigen vector to file.      GMVIO (mesh).write_equation_systems ("out.gmv", equation_systems);    }  else    {      std::cout << "WARNING: Solver did not converge!\n" << nconv << std::endl;    }#endif // HAVE_SLEPC  // All done.    return 0;}void assemble_mass(EquationSystems& es,                   const std::string& system_name){    // It is a good idea to make sure we are assembling  // the proper system.  libmesh_assert (system_name == "Eigensystem");#ifdef HAVE_SLEPC  // Get a constant reference to the mesh object.  const MeshBase& mesh = es.get_mesh();  // The dimension that we are running.  const unsigned int dim = mesh.mesh_dimension();  // Get a reference to our system.  EigenSystem & eigen_system = es.get_system<EigenSystem> (system_name);  // Get a constant reference to the Finite Element type  // for the first (and only) variable in the system.  FEType fe_type = eigen_system.get_dof_map().variable_type(0);  // A reference to the two system matrices  SparseMatrix<Number>&  matrix_A = *eigen_system.matrix_A;  SparseMatrix<Number>&  matrix_B = *eigen_system.matrix_B;  // Build a Finite Element object of the specified type.  Since the  // \p FEBase::build() member dynamically creates memory we will  // store the object as an \p AutoPtr<FEBase>.  This can be thought  // of as a pointer that will clean up after itself.  AutoPtr<FEBase> fe (FEBase::build(dim, fe_type));    // A  Gauss quadrature rule for numerical integration.  // Use the default quadrature order.  QGauss qrule (dim, fe_type.default_quadrature_order());  // Tell the finite element object to use our quadrature rule.  fe->attach_quadrature_rule (&qrule);  // The element Jacobian * quadrature weight at each integration point.     const std::vector<Real>& JxW = fe->get_JxW();  // The element shape functions evaluated at the quadrature points.  const std::vector<std::vector<Real> >& phi = fe->get_phi();  // The element shape function gradients evaluated at the quadrature  // points.  const std::vector<std::vector<RealGradient> >& dphi = fe->get_dphi();  // A reference to the \p DofMap object for this system.  The \p DofMap  // object handles the index translation from node and element numbers  // to degree of freedom numbers.  const DofMap& dof_map = eigen_system.get_dof_map();  // The element mass and stiffness matrices.  DenseMatrix<Number>   Me;  DenseMatrix<Number>   Ke;  // This vector will hold the degree of freedom indices for  // the element.  These define where in the global system  // the element degrees of freedom get mapped.  std::vector<unsigned int> dof_indices;  // Now we will loop over all the elements in the mesh.  // We will compute the element matrix contribution.  MeshBase::const_element_iterator       el     = mesh.elements_begin();  const MeshBase::const_element_iterator end_el = mesh.elements_end();   for ( ; el != end_el; ++el)    {      // Store a pointer to the element we are currently      // working on.  This allows for nicer syntax later.      const Elem* elem = *el;      // Get the degree of freedom indices for the      // current element.  These define where in the global      // matrix and right-hand-side this element will      // contribute to.      dof_map.dof_indices (elem, dof_indices);      // Compute the element-specific data for the current      // element.  This involves computing the location of the      // quadrature points (q_point) and the shape functions      // (phi, dphi) for the current element.      fe->reinit (elem);      // Zero the element matrices before      // summing them.  We use the resize member here because      // the number of degrees of freedom might have changed from      // the last element.  Note that this will be the case if the      // element type is different (i.e. the last element was a      // triangle, now we are on a quadrilateral).      Ke.resize (dof_indices.size(), dof_indices.size());      Me.resize (dof_indices.size(), dof_indices.size());      // Now loop over the quadrature points.  This handles      // the numeric integration.      //       // We will build the element matrix.  This involves      // a double loop to integrate the test funcions (i) against      // the trial functions (j).      for (unsigned int qp=0; qp<qrule.n_points(); qp++)        for (unsigned int i=0; i<phi.size(); i++)          for (unsigned int j=0; j<phi.size(); j++)            {              Me(i,j) += JxW[qp]*phi[i][qp]*phi[j][qp];              Ke(i,j) += JxW[qp]*(dphi[i][qp]*dphi[j][qp]);            }      // Finally, simply add the element contribution to the      // overall matrices A and B.      matrix_A.add_matrix (Ke, dof_indices);      matrix_B.add_matrix (Me, dof_indices);    } // end of element loop#endif // HAVE_SLEPC  /**   * All done!   */  return;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日产欧美一区二区视频| 亚洲第一激情av| 一区二区三区在线高清| 免费高清在线视频一区·| 成年人网站91| 精品国产区一区| 亚洲一区影音先锋| 成人福利在线看| 日韩一区二区高清| 亚洲成人激情社区| 99re6这里只有精品视频在线观看| 日韩精品最新网址| 午夜精品福利一区二区蜜股av| 99精品久久99久久久久| 欧美精品一区二区三区一线天视频| 亚洲国产你懂的| 91一区二区三区在线观看| 久久理论电影网| 韩国成人在线视频| 精品国产伦理网| 麻豆精品国产传媒mv男同| 91精品国产乱码久久蜜臀| 性感美女极品91精品| 97超碰欧美中文字幕| 国产精品久久久久aaaa樱花| 国产另类ts人妖一区二区| 精品久久五月天| 麻豆精品在线看| 欧美变态凌虐bdsm| 麻豆专区一区二区三区四区五区| 欧美一区二区三区在线看| 亚洲福利一区二区| 欧美丝袜自拍制服另类| 亚洲自拍偷拍图区| 欧美三级电影精品| 亚洲.国产.中文慕字在线| 欧美高清精品3d| 日一区二区三区| 日韩精品一区二区三区四区| 久久国产精品99精品国产| 欧美不卡一区二区三区四区| 国产酒店精品激情| 亚洲国产精品99久久久久久久久| 91精品国产综合久久婷婷香蕉 | 色狠狠一区二区| 中文字幕亚洲视频| 91热门视频在线观看| 一区二区三区日韩精品视频| 欧美日韩一区二区三区视频| 亚洲午夜电影网| 欧美一级专区免费大片| 狠狠色狠狠色合久久伊人| 欧美经典一区二区| 色狠狠桃花综合| 日韩电影在线观看网站| 精品裸体舞一区二区三区| 国产91综合网| 亚洲综合一区二区三区| 91色|porny| 免费成人av在线播放| 国产亚洲女人久久久久毛片| 99re6这里只有精品视频在线观看| 亚洲国产一区视频| 精品国精品自拍自在线| 北条麻妃国产九九精品视频| 亚洲成a人v欧美综合天堂下载| 日韩免费高清视频| 91视视频在线观看入口直接观看www | 在线观看成人免费视频| 日韩成人av影视| 国产精品久久久久影院色老大| 欧美日韩情趣电影| 国内不卡的二区三区中文字幕| 国产精品久久毛片| 正在播放亚洲一区| 波多野结衣91| 精品写真视频在线观看| 亚洲最快最全在线视频| 久久久久一区二区三区四区| 欧美日韩免费电影| av在线不卡网| 精品一区二区影视| 亚洲小说欧美激情另类| 日本一区二区三区视频视频| 欧美人与性动xxxx| 97精品久久久午夜一区二区三区| 免费成人你懂的| 亚洲综合精品久久| 国产精品久久久久婷婷| 精品美女在线观看| 欧美日韩综合色| 99久久精品国产麻豆演员表| 精品一区二区久久| 日韩高清在线不卡| 亚洲国产中文字幕在线视频综合| 国产女人aaa级久久久级 | 国产精品无圣光一区二区| 日韩精品在线网站| 欧美精品乱码久久久久久| 91丨porny丨国产| caoporen国产精品视频| 国产精品99久久久久久久女警| 青青草91视频| 日日摸夜夜添夜夜添精品视频| 亚洲美女免费在线| 综合久久久久久| 国产精品初高中害羞小美女文| 久久亚洲精华国产精华液| 欧美一级高清片在线观看| 欧美日韩一区二区在线视频| 在线观看网站黄不卡| 97久久久精品综合88久久| www.成人网.com| zzijzzij亚洲日本少妇熟睡| 懂色av一区二区夜夜嗨| 国产不卡视频一区二区三区| 国产很黄免费观看久久| 国产成人免费视频网站高清观看视频| 黄一区二区三区| 韩国成人在线视频| 国产成人自拍网| 成人黄色大片在线观看| 99视频有精品| 欧美成人a在线| 精品国产乱码久久久久久夜甘婷婷| 日韩视频免费直播| 欧美mv日韩mv国产网站app| 精品福利视频一区二区三区| 久久夜色精品一区| 国产精品美女久久久久久 | 亚洲高清不卡在线| 肉肉av福利一精品导航| 九色porny丨国产精品| 国产精品一区在线观看乱码| 成人激情图片网| 欧美主播一区二区三区美女| 欧美视频在线一区| 欧美一区二区三区精品| 久久久久99精品一区| 日韩理论片中文av| 亚洲成a人片综合在线| 麻豆精品一区二区| 不卡的电视剧免费网站有什么| 91福利小视频| 精品人在线二区三区| 国产精品美女一区二区三区| 亚洲成人动漫在线免费观看| 久久99国产精品久久99 | 欧美视频完全免费看| 日韩欧美一级二级| 国产精品视频免费| 亚洲成av人片一区二区| 国产精品一区二区男女羞羞无遮挡| 91在线国内视频| 日韩一级黄色片| 国产精品久久久久婷婷二区次| 天天色综合成人网| 粉嫩在线一区二区三区视频| 欧美亚洲一区二区三区四区| 久久香蕉国产线看观看99| 亚洲激情五月婷婷| 国产美女av一区二区三区| 色婷婷精品大在线视频| 26uuu色噜噜精品一区二区| 懂色av一区二区三区免费看| 色94色欧美sute亚洲线路二| 精品剧情v国产在线观看在线| 亚洲综合在线第一页| 国产精品一区专区| 91精品国产福利在线观看| 亚洲欧美综合色| 国产一区二区三区黄视频 | 99久久久精品| 欧美哺乳videos| 午夜一区二区三区视频| aaa欧美大片| 久久久亚洲国产美女国产盗摄| 五月婷婷色综合| 色激情天天射综合网| 国产精品理论在线观看| 国产在线一区观看| 欧美一区二区啪啪| 天堂va蜜桃一区二区三区| 91极品美女在线| 亚洲男人都懂的| 91在线视频播放地址| 久久久久国产成人精品亚洲午夜| 日本va欧美va欧美va精品| 精品视频免费看| 亚洲国产一区二区三区| 91国偷自产一区二区三区成为亚洲经典 | 青椒成人免费视频| 欧美精品v国产精品v日韩精品 | 91福利资源站| 亚洲免费伊人电影| 色综合天天综合给合国产| 国产精品久久久久久久久果冻传媒| 国产福利一区二区| 国产丝袜在线精品| 国产成人av资源|