| bp3.cpp (b99f7525d49ad2fe8f9289cddf341eb7a9f99461) | bp3.cpp (e2b2c771c7282b3b06c9e412ce543de8dc2e42e1) |
|---|---|
| 1// libCEED + MFEM Example: BP3 2// 3// This example illustrates a simple usage of libCEED with the MFEM (mfem.org) 4// finite element library. 5// 6// The example reads a mesh from a file and solves a linear system with a 7// diffusion stiffness matrix (with a prescribed analytic solution, provided by 8// the function 'solution'). The diffusion matrix is expressed as a new class, --- 60 unchanged lines hidden (view full) --- 69 #ifndef MFEM_DIR 70 const char *mesh_file = "../../../mfem/data/star.mesh"; 71 #else 72 const char *mesh_file = MFEM_DIR "/data/star.mesh"; 73 #endif 74 int order = 2; 75 bool visualization = true; 76 bool test = false; | 1// libCEED + MFEM Example: BP3 2// 3// This example illustrates a simple usage of libCEED with the MFEM (mfem.org) 4// finite element library. 5// 6// The example reads a mesh from a file and solves a linear system with a 7// diffusion stiffness matrix (with a prescribed analytic solution, provided by 8// the function 'solution'). The diffusion matrix is expressed as a new class, --- 60 unchanged lines hidden (view full) --- 69 #ifndef MFEM_DIR 70 const char *mesh_file = "../../../mfem/data/star.mesh"; 71 #else 72 const char *mesh_file = MFEM_DIR "/data/star.mesh"; 73 #endif 74 int order = 2; 75 bool visualization = true; 76 bool test = false; |
| 77 double max_dofs = 50000; | 77 double max_nnodes = 50000; |
| 78 79 mfem::OptionsParser args(argc, argv); 80 args.AddOption(&ceed_spec, "-c", "-ceed", "Ceed specification."); 81 args.AddOption(&mesh_file, "-m", "--mesh", "Mesh file to use."); 82 args.AddOption(&order, "-o", "--order", 83 "Finite element order (polynomial degree)."); | 78 79 mfem::OptionsParser args(argc, argv); 80 args.AddOption(&ceed_spec, "-c", "-ceed", "Ceed specification."); 81 args.AddOption(&mesh_file, "-m", "--mesh", "Mesh file to use."); 82 args.AddOption(&order, "-o", "--order", 83 "Finite element order (polynomial degree)."); |
| 84 args.AddOption(&max_dofs, "-s", "--size", "Maximum size (number of DoFs)"); | 84 args.AddOption(&max_nnodes, "-s", "--size", "Maximum size (number of DoFs)"); |
| 85 args.AddOption(&visualization, "-vis", "--visualization", "-no-vis", 86 "--no-visualization", 87 "Enable or disable GLVis visualization."); 88 args.AddOption(&test, "-t", "--test", "-no-test", 89 "--no-test", 90 "Enable or disable test mode."); 91 args.Parse(); 92 if (!args.Good()) { --- 13 unchanged lines hidden (view full) --- 106 int dim = mesh->Dimension(); 107 108 // 4. Refine the mesh to increase the resolution. In this example we do 109 // 'ref_levels' of uniform refinement. We choose 'ref_levels' to be the 110 // largest number that gives a final system with no more than 50,000 111 // unknowns, approximately. 112 { 113 int ref_levels = | 85 args.AddOption(&visualization, "-vis", "--visualization", "-no-vis", 86 "--no-visualization", 87 "Enable or disable GLVis visualization."); 88 args.AddOption(&test, "-t", "--test", "-no-test", 89 "--no-test", 90 "Enable or disable test mode."); 91 args.Parse(); 92 if (!args.Good()) { --- 13 unchanged lines hidden (view full) --- 106 int dim = mesh->Dimension(); 107 108 // 4. Refine the mesh to increase the resolution. In this example we do 109 // 'ref_levels' of uniform refinement. We choose 'ref_levels' to be the 110 // largest number that gives a final system with no more than 50,000 111 // unknowns, approximately. 112 { 113 int ref_levels = |
| 114 (int)floor((log(max_dofs/mesh->GetNE())-dim*log(order))/log(2.)/dim); | 114 (int)floor((log(max_nnodes/mesh->GetNE())-dim*log(order))/log(2.)/dim); |
| 115 for (int l = 0; l < ref_levels; l++) { 116 mesh->UniformRefinement(); 117 } 118 } 119 if (mesh->GetNodalFESpace() == NULL) { 120 mesh->SetCurvature(1, false, -1, mfem::Ordering::byNODES); 121 } 122 if (mesh->NURBSext) { --- 78 unchanged lines hidden --- | 115 for (int l = 0; l < ref_levels; l++) { 116 mesh->UniformRefinement(); 117 } 118 } 119 if (mesh->GetNodalFESpace() == NULL) { 120 mesh->SetCurvature(1, false, -1, mfem::Ordering::byNODES); 121 } 122 if (mesh->NURBSext) { --- 78 unchanged lines hidden --- |