MFEM  v4.2.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
ex5.cpp
Go to the documentation of this file.
1 // MFEM Example 5
2 //
3 // Compile with: make ex5
4 //
5 // Sample runs: ex5 -m ../data/square-disc.mesh
6 // ex5 -m ../data/star.mesh
7 // ex5 -m ../data/star.mesh -pa
8 // ex5 -m ../data/beam-tet.mesh
9 // ex5 -m ../data/beam-hex.mesh
10 // ex5 -m ../data/beam-hex.mesh -pa
11 // ex5 -m ../data/escher.mesh
12 // ex5 -m ../data/fichera.mesh
13 //
14 // Device sample runs:
15 // ex5 -m ../data/star.mesh -pa -d cuda
16 // ex5 -m ../data/star.mesh -pa -d raja-cuda
17 // ex5 -m ../data/star.mesh -pa -d raja-omp
18 // ex5 -m ../data/beam-hex.mesh -pa -d cuda
19 //
20 // Description: This example code solves a simple 2D/3D mixed Darcy problem
21 // corresponding to the saddle point system
22 //
23 // k*u + grad p = f
24 // - div u = g
25 //
26 // with natural boundary condition -p = <given pressure>.
27 // Here, we use a given exact solution (u,p) and compute the
28 // corresponding r.h.s. (f,g). We discretize with Raviart-Thomas
29 // finite elements (velocity u) and piecewise discontinuous
30 // polynomials (pressure p).
31 //
32 // The example demonstrates the use of the BlockMatrix class, as
33 // well as the collective saving of several grid functions in
34 // VisIt (visit.llnl.gov) and ParaView (paraview.org) formats.
35 //
36 // We recommend viewing examples 1-4 before viewing this example.
37 
38 #include "mfem.hpp"
39 #include <fstream>
40 #include <iostream>
41 #include <algorithm>
42 
43 using namespace std;
44 using namespace mfem;
45 
46 // Define the analytical solution and forcing terms / boundary conditions
47 void uFun_ex(const Vector & x, Vector & u);
48 double pFun_ex(const Vector & x);
49 void fFun(const Vector & x, Vector & f);
50 double gFun(const Vector & x);
51 double f_natural(const Vector & x);
52 
53 int main(int argc, char *argv[])
54 {
55  StopWatch chrono;
56 
57  // 1. Parse command-line options.
58  const char *mesh_file = "../data/star.mesh";
59  int order = 1;
60  bool pa = false;
61  const char *device_config = "cpu";
62  bool visualization = 1;
63 
64  OptionsParser args(argc, argv);
65  args.AddOption(&mesh_file, "-m", "--mesh",
66  "Mesh file to use.");
67  args.AddOption(&order, "-o", "--order",
68  "Finite element order (polynomial degree).");
69  args.AddOption(&pa, "-pa", "--partial-assembly", "-no-pa",
70  "--no-partial-assembly", "Enable Partial Assembly.");
71  args.AddOption(&device_config, "-d", "--device",
72  "Device configuration string, see Device::Configure().");
73  args.AddOption(&visualization, "-vis", "--visualization", "-no-vis",
74  "--no-visualization",
75  "Enable or disable GLVis visualization.");
76  args.Parse();
77  if (!args.Good())
78  {
79  args.PrintUsage(cout);
80  return 1;
81  }
82  args.PrintOptions(cout);
83 
84  // 2. Enable hardware devices such as GPUs, and programming models such as
85  // CUDA, OCCA, RAJA and OpenMP based on command line options.
86  Device device(device_config);
87  device.Print();
88 
89  // 3. Read the mesh from the given mesh file. We can handle triangular,
90  // quadrilateral, tetrahedral, hexahedral, surface and volume meshes with
91  // the same code.
92  Mesh *mesh = new Mesh(mesh_file, 1, 1);
93  int dim = mesh->Dimension();
94 
95  // 4. Refine the mesh to increase the resolution. In this example we do
96  // 'ref_levels' of uniform refinement. We choose 'ref_levels' to be the
97  // largest number that gives a final mesh with no more than 10,000
98  // elements.
99  {
100  int ref_levels =
101  (int)floor(log(10000./mesh->GetNE())/log(2.)/dim);
102  for (int l = 0; l < ref_levels; l++)
103  {
104  mesh->UniformRefinement();
105  }
106  }
107 
108  // 5. Define a finite element space on the mesh. Here we use the
109  // Raviart-Thomas finite elements of the specified order.
110  FiniteElementCollection *hdiv_coll(new RT_FECollection(order, dim));
111  FiniteElementCollection *l2_coll(new L2_FECollection(order, dim));
112 
113  FiniteElementSpace *R_space = new FiniteElementSpace(mesh, hdiv_coll);
114  FiniteElementSpace *W_space = new FiniteElementSpace(mesh, l2_coll);
115 
116  // 6. Define the BlockStructure of the problem, i.e. define the array of
117  // offsets for each variable. The last component of the Array is the sum
118  // of the dimensions of each block.
119  Array<int> block_offsets(3); // number of variables + 1
120  block_offsets[0] = 0;
121  block_offsets[1] = R_space->GetVSize();
122  block_offsets[2] = W_space->GetVSize();
123  block_offsets.PartialSum();
124 
125  std::cout << "***********************************************************\n";
126  std::cout << "dim(R) = " << block_offsets[1] - block_offsets[0] << "\n";
127  std::cout << "dim(W) = " << block_offsets[2] - block_offsets[1] << "\n";
128  std::cout << "dim(R+W) = " << block_offsets.Last() << "\n";
129  std::cout << "***********************************************************\n";
130 
131  // 7. Define the coefficients, analytical solution, and rhs of the PDE.
132  ConstantCoefficient k(1.0);
133 
134  VectorFunctionCoefficient fcoeff(dim, fFun);
135  FunctionCoefficient fnatcoeff(f_natural);
136  FunctionCoefficient gcoeff(gFun);
137 
138  VectorFunctionCoefficient ucoeff(dim, uFun_ex);
140 
141  // 8. Allocate memory (x, rhs) for the analytical solution and the right hand
142  // side. Define the GridFunction u,p for the finite element solution and
143  // linear forms fform and gform for the right hand side. The data
144  // allocated by x and rhs are passed as a reference to the grid functions
145  // (u,p) and the linear forms (fform, gform).
146  MemoryType mt = device.GetMemoryType();
147  BlockVector x(block_offsets, mt), rhs(block_offsets, mt);
148 
149  LinearForm *fform(new LinearForm);
150  fform->Update(R_space, rhs.GetBlock(0), 0);
153  fform->Assemble();
154  fform->SyncAliasMemory(rhs);
155 
156  LinearForm *gform(new LinearForm);
157  gform->Update(W_space, rhs.GetBlock(1), 0);
158  gform->AddDomainIntegrator(new DomainLFIntegrator(gcoeff));
159  gform->Assemble();
160  gform->SyncAliasMemory(rhs);
161 
162  // 9. Assemble the finite element matrices for the Darcy operator
163  //
164  // D = [ M B^T ]
165  // [ B 0 ]
166  // where:
167  //
168  // M = \int_\Omega k u_h \cdot v_h d\Omega u_h, v_h \in R_h
169  // B = -\int_\Omega \div u_h q_h d\Omega u_h \in R_h, q_h \in W_h
170  BilinearForm *mVarf(new BilinearForm(R_space));
171  MixedBilinearForm *bVarf(new MixedBilinearForm(R_space, W_space));
172 
173  if (pa) { mVarf->SetAssemblyLevel(AssemblyLevel::PARTIAL); }
175  mVarf->Assemble();
176  if (!pa) { mVarf->Finalize(); }
177 
178  if (pa) { bVarf->SetAssemblyLevel(AssemblyLevel::PARTIAL); }
180  bVarf->Assemble();
181  if (!pa) { bVarf->Finalize(); }
182 
183  BlockOperator darcyOp(block_offsets);
184 
185  TransposeOperator *Bt = NULL;
186 
187  if (pa)
188  {
189  Bt = new TransposeOperator(bVarf);
190 
191  darcyOp.SetBlock(0,0, mVarf);
192  darcyOp.SetBlock(0,1, Bt, -1.0);
193  darcyOp.SetBlock(1,0, bVarf, -1.0);
194  }
195  else
196  {
197  SparseMatrix &M(mVarf->SpMat());
198  SparseMatrix &B(bVarf->SpMat());
199  B *= -1.;
200  Bt = new TransposeOperator(&B);
201 
202  darcyOp.SetBlock(0,0, &M);
203  darcyOp.SetBlock(0,1, Bt);
204  darcyOp.SetBlock(1,0, &B);
205  }
206 
207  // 10. Construct the operators for preconditioner
208  //
209  // P = [ diag(M) 0 ]
210  // [ 0 B diag(M)^-1 B^T ]
211  //
212  // Here we use Symmetric Gauss-Seidel to approximate the inverse of the
213  // pressure Schur Complement
214  SparseMatrix *MinvBt = NULL;
215  Vector Md(mVarf->Height());
216 
217  BlockDiagonalPreconditioner darcyPrec(block_offsets);
218  Solver *invM, *invS;
219  SparseMatrix *S = NULL;
220 
221  if (pa)
222  {
223  mVarf->AssembleDiagonal(Md);
224  auto Md_host = Md.HostRead();
225  Vector invMd(mVarf->Height());
226  for (int i=0; i<mVarf->Height(); ++i)
227  {
228  invMd(i) = 1.0 / Md_host[i];
229  }
230 
231  Vector BMBt_diag(bVarf->Height());
232  bVarf->AssembleDiagonal_ADAt(invMd, BMBt_diag);
233 
234  Array<int> ess_tdof_list; // empty
235 
236  invM = new OperatorJacobiSmoother(Md, ess_tdof_list);
237  invS = new OperatorJacobiSmoother(BMBt_diag, ess_tdof_list);
238  }
239  else
240  {
241  SparseMatrix &M(mVarf->SpMat());
242  M.GetDiag(Md);
243 
244  SparseMatrix &B(bVarf->SpMat());
245  MinvBt = Transpose(B);
246 
247  for (int i = 0; i < Md.Size(); i++)
248  {
249  MinvBt->ScaleRow(i, 1./Md(i));
250  }
251 
252  S = Mult(B, *MinvBt);
253 
254  invM = new DSmoother(M);
255 
256 #ifndef MFEM_USE_SUITESPARSE
257  invS = new GSSmoother(*S);
258 #else
259  invS = new UMFPackSolver(*S);
260 #endif
261  }
262 
263  invM->iterative_mode = false;
264  invS->iterative_mode = false;
265 
266  darcyPrec.SetDiagonalBlock(0, invM);
267  darcyPrec.SetDiagonalBlock(1, invS);
268 
269  // 11. Solve the linear system with MINRES.
270  // Check the norm of the unpreconditioned residual.
271  int maxIter(1000);
272  double rtol(1.e-6);
273  double atol(1.e-10);
274 
275  chrono.Clear();
276  chrono.Start();
277  MINRESSolver solver;
278  solver.SetAbsTol(atol);
279  solver.SetRelTol(rtol);
280  solver.SetMaxIter(maxIter);
281  solver.SetOperator(darcyOp);
282  solver.SetPreconditioner(darcyPrec);
283  solver.SetPrintLevel(1);
284  x = 0.0;
285  solver.Mult(rhs, x);
286  if (device.IsEnabled()) { x.HostRead(); }
287  chrono.Stop();
288 
289  if (solver.GetConverged())
290  std::cout << "MINRES converged in " << solver.GetNumIterations()
291  << " iterations with a residual norm of " << solver.GetFinalNorm() << ".\n";
292  else
293  std::cout << "MINRES did not converge in " << solver.GetNumIterations()
294  << " iterations. Residual norm is " << solver.GetFinalNorm() << ".\n";
295  std::cout << "MINRES solver took " << chrono.RealTime() << "s. \n";
296 
297  // 12. Create the grid functions u and p. Compute the L2 error norms.
298  GridFunction u, p;
299  u.MakeRef(R_space, x.GetBlock(0), 0);
300  p.MakeRef(W_space, x.GetBlock(1), 0);
301 
302  int order_quad = max(2, 2*order+1);
303  const IntegrationRule *irs[Geometry::NumGeom];
304  for (int i=0; i < Geometry::NumGeom; ++i)
305  {
306  irs[i] = &(IntRules.Get(i, order_quad));
307  }
308 
309  double err_u = u.ComputeL2Error(ucoeff, irs);
310  double norm_u = ComputeLpNorm(2., ucoeff, *mesh, irs);
311  double err_p = p.ComputeL2Error(pcoeff, irs);
312  double norm_p = ComputeLpNorm(2., pcoeff, *mesh, irs);
313 
314  std::cout << "|| u_h - u_ex || / || u_ex || = " << err_u / norm_u << "\n";
315  std::cout << "|| p_h - p_ex || / || p_ex || = " << err_p / norm_p << "\n";
316 
317  // 13. Save the mesh and the solution. This output can be viewed later using
318  // GLVis: "glvis -m ex5.mesh -g sol_u.gf" or "glvis -m ex5.mesh -g
319  // sol_p.gf".
320  {
321  ofstream mesh_ofs("ex5.mesh");
322  mesh_ofs.precision(8);
323  mesh->Print(mesh_ofs);
324 
325  ofstream u_ofs("sol_u.gf");
326  u_ofs.precision(8);
327  u.Save(u_ofs);
328 
329  ofstream p_ofs("sol_p.gf");
330  p_ofs.precision(8);
331  p.Save(p_ofs);
332  }
333 
334  // 14. Save data in the VisIt format
335  VisItDataCollection visit_dc("Example5", mesh);
336  visit_dc.RegisterField("velocity", &u);
337  visit_dc.RegisterField("pressure", &p);
338  visit_dc.Save();
339 
340  // 15. Save data in the ParaView format
341  ParaViewDataCollection paraview_dc("Example5", mesh);
342  paraview_dc.SetPrefixPath("ParaView");
343  paraview_dc.SetLevelsOfDetail(order);
344  paraview_dc.SetCycle(0);
345  paraview_dc.SetDataFormat(VTKFormat::BINARY);
346  paraview_dc.SetHighOrderOutput(true);
347  paraview_dc.SetTime(0.0); // set the time
348  paraview_dc.RegisterField("velocity",&u);
349  paraview_dc.RegisterField("pressure",&p);
350  paraview_dc.Save();
351 
352  // 16. Send the solution by socket to a GLVis server.
353  if (visualization)
354  {
355  char vishost[] = "localhost";
356  int visport = 19916;
357  socketstream u_sock(vishost, visport);
358  u_sock.precision(8);
359  u_sock << "solution\n" << *mesh << u << "window_title 'Velocity'" << endl;
360  socketstream p_sock(vishost, visport);
361  p_sock.precision(8);
362  p_sock << "solution\n" << *mesh << p << "window_title 'Pressure'" << endl;
363  }
364 
365  // 17. Free the used memory.
366  delete fform;
367  delete gform;
368  delete invM;
369  delete invS;
370  delete S;
371  delete Bt;
372  delete MinvBt;
373  delete mVarf;
374  delete bVarf;
375  delete W_space;
376  delete R_space;
377  delete l2_coll;
378  delete hdiv_coll;
379  delete mesh;
380 
381  return 0;
382 }
383 
384 
385 void uFun_ex(const Vector & x, Vector & u)
386 {
387  double xi(x(0));
388  double yi(x(1));
389  double zi(0.0);
390  if (x.Size() == 3)
391  {
392  zi = x(2);
393  }
394 
395  u(0) = - exp(xi)*sin(yi)*cos(zi);
396  u(1) = - exp(xi)*cos(yi)*cos(zi);
397 
398  if (x.Size() == 3)
399  {
400  u(2) = exp(xi)*sin(yi)*sin(zi);
401  }
402 }
403 
404 // Change if needed
405 double pFun_ex(const Vector & x)
406 {
407  double xi(x(0));
408  double yi(x(1));
409  double zi(0.0);
410 
411  if (x.Size() == 3)
412  {
413  zi = x(2);
414  }
415 
416  return exp(xi)*sin(yi)*cos(zi);
417 }
418 
419 void fFun(const Vector & x, Vector & f)
420 {
421  f = 0.0;
422 }
423 
424 double gFun(const Vector & x)
425 {
426  if (x.Size() == 3)
427  {
428  return -pFun_ex(x);
429  }
430  else
431  {
432  return 0;
433  }
434 }
435 
436 double f_natural(const Vector & x)
437 {
438  return (-pFun_ex(x));
439 }
Class for domain integration L(v) := (f, v)
Definition: lininteg.hpp:93
int GetVSize() const
Return the number of vector dofs, i.e. GetNDofs() x GetVDim().
Definition: fespace.hpp:400
virtual void Print(std::ostream &out=mfem::out) const
Definition: mesh.hpp:1234
Class for an integration rule - an Array of IntegrationPoint.
Definition: intrules.hpp:90
Class for grid function - Vector with associated FE space.
Definition: gridfunc.hpp:30
int GetNumIterations() const
Definition: solvers.hpp:101
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
Data type for scaled Jacobi-type smoother of sparse matrix.
const IntegrationRule & Get(int GeomType, int Order)
Returns an integration rule for given GeomType and Order.
Definition: intrules.cpp:915
void fFun(const Vector &x, Vector &f)
Definition: ex5.cpp:419
A class to handle Vectors in a block fashion.
Definition: blockvector.hpp:30
void Assemble(int skip_zeros=1)
Assembles the form i.e. sums over all domain/bdr integrators.
void SetDataFormat(VTKFormat fmt)
A coefficient that is constant across space and time.
Definition: coefficient.hpp:78
virtual double ComputeL2Error(Coefficient &exsol, const IntegrationRule *irs[]=NULL) const
Definition: gridfunc.hpp:431
Helper class for ParaView visualization data.
void Mult(const Table &A, const Table &B, Table &C)
C = A * B (as boolean matrices)
Definition: table.cpp:476
void Assemble()
Assembles the linear form i.e. sums over all domain/bdr integrators.
Definition: linearform.cpp:79
int Size() const
Returns the size of the vector.
Definition: vector.hpp:160
int GetNE() const
Returns number of elements.
Definition: mesh.hpp:737
virtual void Save()
Save the collection and a VisIt root file.
void AssembleDiagonal(Vector &diag) const
Assemble the diagonal of the bilinear form into diag.
void Print(std::ostream &out=mfem::out)
Print the configuration of the MFEM virtual device object.
Definition: device.cpp:261
void SetAssemblyLevel(AssemblyLevel assembly_level)
Set the desired assembly level.
double RealTime()
Definition: tic_toc.cpp:426
bool iterative_mode
If true, use the second argument of Mult() as an initial guess.
Definition: operator.hpp:638
virtual void Finalize(int skip_zeros=1)
Finalizes the matrix initialization.
MINRES method.
Definition: solvers.hpp:368
static bool IsEnabled()
Return true if any backend other than Backend::CPU is enabled.
Definition: device.hpp:237
int main(int argc, char *argv[])
Definition: ex1.cpp:66
double GetFinalNorm() const
Definition: solvers.hpp:103
Data type for Gauss-Seidel smoother of sparse matrix.
void Stop()
Stop the stopwatch.
Definition: tic_toc.cpp:416
void AddDomainIntegrator(BilinearFormIntegrator *bfi)
Adds a domain integrator. Assumes ownership of bfi.
Direct sparse solver using UMFPACK.
Definition: solvers.hpp:731
virtual void Save(std::ostream &out) const
Save the GridFunction to an output stream.
Definition: gridfunc.cpp:3417
virtual void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
Definition: solvers.cpp:1365
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection.
double ComputeLpNorm(double p, Coefficient &coeff, Mesh &mesh, const IntegrationRule *irs[])
Compute the Lp norm of a function f. .
void SetPrintLevel(int print_lvl)
Definition: solvers.cpp:70
virtual void SetPreconditioner(Solver &pr)
This should be called before SetOperator.
Definition: solvers.hpp:381
void Parse()
Parse the command-line options. Note that this function expects all the options provided through the ...
Definition: optparser.cpp:150
A class to handle Block diagonal preconditioners in a matrix-free implementation. ...
Data type sparse matrix.
Definition: sparsemat.hpp:46
int Height() const
Get the height (size of output) of the Operator. Synonym with NumRows().
Definition: operator.hpp:65
constexpr char vishost[]
Jacobi smoothing for a given bilinear form (no matrix necessary).
Definition: solvers.hpp:128
double f_natural(const Vector &x)
Definition: ex5.cpp:436
void UniformRefinement(int i, const DSTable &, int *, int *, int *)
Definition: mesh.cpp:8382
constexpr int visport
Timing object.
Definition: tic_toc.hpp:34
static MemoryType GetMemoryType()
(DEPRECATED) Equivalent to GetDeviceMemoryType().
Definition: device.hpp:265
Data collection with VisIt I/O routines.
void SetMaxIter(int max_it)
Definition: solvers.hpp:98
void Assemble(int skip_zeros=1)
void Transpose(const Table &A, Table &At, int _ncols_A)
Transpose a Table.
Definition: table.cpp:414
double pFun_ex(const Vector &x)
Definition: ex5.cpp:405
virtual void MakeRef(FiniteElementSpace *f, double *v)
Make the GridFunction reference external data on a new FiniteElementSpace.
Definition: gridfunc.cpp:188
void SetHighOrderOutput(bool high_order_output_)
void AssembleDiagonal_ADAt(const Vector &D, Vector &diag) const
Assemble the diagonal of ADA^T into diag, where A is this mixed bilinear form and D is a diagonal...
virtual void SetOperator(const Operator &op)
Also calls SetOperator for the preconditioner if there is one.
Definition: solvers.cpp:1351
int GetConverged() const
Definition: solvers.hpp:102
void AddBoundaryIntegrator(LinearFormIntegrator *lfi)
Adds new Boundary Integrator. Assumes ownership of lfi.
Definition: linearform.cpp:53
int Dimension() const
Definition: mesh.hpp:788
void PrintUsage(std::ostream &out) const
Print the usage message.
Definition: optparser.cpp:434
void SetTime(double t)
Set physical time (for time-dependent simulations)
void Start()
Clear the elapsed time and start the stopwatch.
Definition: tic_toc.cpp:411
Arbitrary order H(div)-conforming Raviart-Thomas finite elements.
Definition: fe_coll.hpp:272
A general vector function coefficient.
void SetAssemblyLevel(AssemblyLevel assembly_level)
Set the desired assembly level. The default is AssemblyLevel::LEGACYFULL.
void AddDomainIntegrator(LinearFormIntegrator *lfi)
Adds new Domain Integrator. Assumes ownership of lfi.
Definition: linearform.cpp:39
void SetAbsTol(double atol)
Definition: solvers.hpp:97
void SetRelTol(double rtol)
Definition: solvers.hpp:96
Class FiniteElementSpace - responsible for providing FEM view of the mesh, mainly managing the set of...
Definition: fespace.hpp:87
Collection of finite elements from the same family in multiple dimensions. This class is used to matc...
Definition: fe_coll.hpp:26
MemoryType
Memory types supported by MFEM.
Definition: mem_manager.hpp:28
void AddOption(bool *var, const char *enable_short_name, const char *enable_long_name, const char *disable_short_name, const char *disable_long_name, const char *description, bool required=false)
Add a boolean option and set &#39;var&#39; to receive the value. Enable/disable tags are used to set the bool...
Definition: optparser.hpp:82
void PartialSum()
Fill the entries of the array with the cumulative sum of the entries.
Definition: array.cpp:103
The transpose of a given operator. Switches the roles of the methods Mult() and MultTranspose().
Definition: operator.hpp:697
void Update()
Update the object according to the associated FE space fes.
Definition: linearform.hpp:166
const SparseMatrix & SpMat() const
Returns a const reference to the sparse matrix: .
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection and update the root file.
A &quot;square matrix&quot; operator for the associated FE space and BLFIntegrators The sum of all the BLFInteg...
void GetDiag(Vector &d) const
Returns the Diagonal of A.
Definition: sparsemat.cpp:530
void uFun_ex(const Vector &x, Vector &u)
Definition: ex5.cpp:385
double gFun(const Vector &x)
Definition: ex5.cpp:424
virtual void Finalize(int skip_zeros=1)
Finalizes the matrix initialization.
int dim
Definition: ex24.cpp:53
void AddDomainIntegrator(BilinearFormIntegrator *bfi)
Adds new Domain Integrator. Assumes ownership of bfi.
void PrintOptions(std::ostream &out) const
Print the options.
Definition: optparser.cpp:304
T & Last()
Return the last element in the array.
Definition: array.hpp:759
void SetLevelsOfDetail(int levels_of_detail_)
for VectorFiniteElements (Nedelec, Raviart-Thomas)
Definition: lininteg.hpp:260
A general function coefficient.
Vector data type.
Definition: vector.hpp:51
Vector with associated FE space and LinearFormIntegrators.
Definition: linearform.hpp:23
virtual void Save() override
const SparseMatrix & SpMat() const
Returns a const reference to the sparse matrix.
Base class for solvers.
Definition: operator.hpp:634
The MFEM Device class abstracts hardware devices such as GPUs, as well as programming models such as ...
Definition: device.hpp:118
A class to handle Block systems in a matrix-free implementation.
IntegrationRules IntRules(0, Quadrature1D::GaussLegendre)
A global object with all integration rules (defined in intrules.cpp)
Definition: intrules.hpp:378
void SetPrefixPath(const std::string &prefix)
Set the path where the DataCollection will be saved.
void Clear()
Clear the elapsed time on the stopwatch and restart it if it&#39;s running.
Definition: tic_toc.cpp:406
void SetBlock(int iRow, int iCol, Operator *op, double c=1.0)
Add a block op in the block-entry (iblock, jblock).
Vector & GetBlock(int i)
Get the i-th vector in the block.
Definition: blockvector.hpp:87
Arbitrary order &quot;L2-conforming&quot; discontinuous finite elements.
Definition: fe_coll.hpp:221
double f(const Vector &p)
void SyncAliasMemory(const Vector &v)
Update the alias memory location of the vector to match v.
Definition: vector.hpp:193
bool Good() const
Return true if the command line options were parsed successfully.
Definition: optparser.hpp:145