bp3.cpp (66087c0803b66a861339d30698fcb9988ebff34d) bp3.cpp (9647a07ed4cccf5520ee61cfc49faed91542e405)
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,

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

167 } else {
168 cg.SetPrintLevel(3);
169 }
170 cg.SetOperator(*D);
171
172 cg.Mult(B, X);
173
174 // 9. Compute and print the L2 norm of the error.
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,

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

167 } else {
168 cg.SetPrintLevel(3);
169 }
170 cg.SetOperator(*D);
171
172 cg.Mult(B, X);
173
174 // 9. Compute and print the L2 norm of the error.
175 double err_l2 = sol.ComputeL2Error(sol_coeff);
175 if (!test) {
176 if (!test) {
176 std::cout << "L2 projection error: " << sol.ComputeL2Error(sol_coeff)
177 std::cout << "L2 projection error: " << err_l2
177 << std::endl;
178 } else {
179 if (fabs(sol.ComputeL2Error(sol_coeff))>2e-3) {
178 << std::endl;
179 } else {
180 if (fabs(sol.ComputeL2Error(sol_coeff))>2e-3) {
180 std::cout << "Error too large" << std::endl;
181 std::cout << "Error too large: " << err_l2 << std::endl;
181 }
182 }
183
184 // 10. Open a socket connection to GLVis and send the mesh and solution for
185 // visualization.
186 if (visualization) {
187 char vishost[] = "localhost";
188 int visport = 19916;

--- 12 unchanged lines hidden ---
182 }
183 }
184
185 // 10. Open a socket connection to GLVis and send the mesh and solution for
186 // visualization.
187 if (visualization) {
188 char vishost[] = "localhost";
189 int visport = 19916;

--- 12 unchanged lines hidden ---