MFEM  v4.3.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
ortho_solver.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2021, Lawrence Livermore National Security, LLC. Produced
2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 // LICENSE and NOTICE for details. LLNL-CODE-806117.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability visit https://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11 
12 #ifndef MFEM_NAVIER_ORTHO_SOLVER_HPP
13 #define MFEM_NAVIER_ORTHO_SOLVER_HPP
14 
15 #include "mfem.hpp"
16 
17 namespace mfem
18 {
19 namespace navier
20 {
21 /// Solver wrapper which orthogonalizes the input and output vector
22 /**
23  * OrthoSolver wraps an existing Operator and orthogonalizes the input vector
24  * before passing it to the Mult method of the Operator. This is a convenience
25  * implementation to handle e.g. a Poisson problem with pure Neumann boundary
26  * conditions, where this procedure removes the Nullspace.
27  */
28 class OrthoSolver : public Solver
29 {
30 private:
31  MPI_Comm mycomm;
32 public:
33  OrthoSolver(MPI_Comm mycomm_);
34 
35  virtual void SetOperator(const Operator &op);
36 
37  void Mult(const Vector &b, Vector &x) const;
38 
39 private:
40  const Operator *oper = nullptr;
41 
42  mutable Vector b_ortho;
43 
44  void Orthogonalize(const Vector &v, Vector &v_ortho) const;
45 };
46 
47 } // namespace navier
48 
49 } // namespace mfem
50 
51 #endif
virtual void SetOperator(const Operator &op)
Set/update the solver for the given operator.
double b
Definition: lissajous.cpp:42
OrthoSolver(MPI_Comm mycomm_)
void Mult(const Vector &b, Vector &x) const
Operator application: y=A(x).
Vector data type.
Definition: vector.hpp:60
Base class for solvers.
Definition: operator.hpp:648
Abstract operator.
Definition: operator.hpp:24
Solver wrapper which orthogonalizes the input and output vector.