bp1.cpp (b99f7525d49ad2fe8f9289cddf341eb7a9f99461) bp1.cpp (e2b2c771c7282b3b06c9e412ce543de8dc2e42e1)
1// libCEED + MFEM Example: BP1
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 simple linear system with a
7// mass matrix (L2-projection of a given analytic function provided by
8// 'solution'). The mass matrix required for performing the projection is

--- 41 unchanged lines hidden (view full) ---

50 #ifndef MFEM_DIR
51 const char *mesh_file = "../../../mfem/data/star.mesh";
52 #else
53 const char *mesh_file = MFEM_DIR "/data/star.mesh";
54 #endif
55 int order = 1;
56 bool visualization = true;
57 bool test = false;
1// libCEED + MFEM Example: BP1
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 simple linear system with a
7// mass matrix (L2-projection of a given analytic function provided by
8// 'solution'). The mass matrix required for performing the projection is

--- 41 unchanged lines hidden (view full) ---

50 #ifndef MFEM_DIR
51 const char *mesh_file = "../../../mfem/data/star.mesh";
52 #else
53 const char *mesh_file = MFEM_DIR "/data/star.mesh";
54 #endif
55 int order = 1;
56 bool visualization = true;
57 bool test = false;
58 double max_dofs = 50000;
58 double max_nnodes = 50000;
59
60 mfem::OptionsParser args(argc, argv);
61 args.AddOption(&ceed_spec, "-c", "-ceed", "Ceed specification.");
62 args.AddOption(&mesh_file, "-m", "--mesh", "Mesh file to use.");
63 args.AddOption(&order, "-o", "--order",
64 "Finite element order (polynomial degree).");
59
60 mfem::OptionsParser args(argc, argv);
61 args.AddOption(&ceed_spec, "-c", "-ceed", "Ceed specification.");
62 args.AddOption(&mesh_file, "-m", "--mesh", "Mesh file to use.");
63 args.AddOption(&order, "-o", "--order",
64 "Finite element order (polynomial degree).");
65 args.AddOption(&max_dofs, "-s", "--size", "Maximum size (number of DoFs)");
65 args.AddOption(&max_nnodes, "-s", "--size", "Maximum size (number of DoFs)");
66 args.AddOption(&visualization, "-vis", "--visualization", "-no-vis",
67 "--no-visualization",
68 "Enable or disable GLVis visualization.");
69 args.AddOption(&test, "-t", "--test", "-no-test",
70 "--no-test",
71 "Enable or disable test mode.");
72 args.Parse();
73 if (!args.Good()) {

--- 13 unchanged lines hidden (view full) ---

87 int dim = mesh->Dimension();
88
89 // 4. Refine the mesh to increase the resolution. In this example we do
90 // 'ref_levels' of uniform refinement. We choose 'ref_levels' to be the
91 // largest number that gives a final system with no more than 50,000
92 // unknowns, approximately.
93 {
94 int ref_levels =
66 args.AddOption(&visualization, "-vis", "--visualization", "-no-vis",
67 "--no-visualization",
68 "Enable or disable GLVis visualization.");
69 args.AddOption(&test, "-t", "--test", "-no-test",
70 "--no-test",
71 "Enable or disable test mode.");
72 args.Parse();
73 if (!args.Good()) {

--- 13 unchanged lines hidden (view full) ---

87 int dim = mesh->Dimension();
88
89 // 4. Refine the mesh to increase the resolution. In this example we do
90 // 'ref_levels' of uniform refinement. We choose 'ref_levels' to be the
91 // largest number that gives a final system with no more than 50,000
92 // unknowns, approximately.
93 {
94 int ref_levels =
95 (int)floor((log(max_dofs/mesh->GetNE())-dim*log(order))/log(2.)/dim);
95 (int)floor((log(max_nnodes/mesh->GetNE())-dim*log(order))/log(2.)/dim);
96 for (int l = 0; l < ref_levels; l++) {
97 mesh->UniformRefinement();
98 }
99 }
100 if (mesh->GetNodalFESpace() == NULL) {
101 mesh->SetCurvature(1, false, -1, mfem::Ordering::byNODES);
102 }
103 if (mesh->NURBSext) {

--- 66 unchanged lines hidden ---
96 for (int l = 0; l < ref_levels; l++) {
97 mesh->UniformRefinement();
98 }
99 }
100 if (mesh->GetNodalFESpace() == NULL) {
101 mesh->SetCurvature(1, false, -1, mfem::Ordering::byNODES);
102 }
103 if (mesh->NURBSext) {

--- 66 unchanged lines hidden ---