MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
operator.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, 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_LIBCEED_OPERATOR
13#define MFEM_LIBCEED_OPERATOR
14
16#include "ceed.hpp"
17
18namespace mfem
19{
20
21namespace ceed
22{
23
24/** A base class to represent a CeedOperator as an MFEM Operator. */
26{
27protected:
28#ifdef MFEM_USE_CEED
29 CeedOperator oper;
30 CeedVector u, v;
31
32 Operator() : oper(nullptr), u(nullptr), v(nullptr) { }
33#endif
34
35public:
36#ifdef MFEM_USE_CEED
37 /// This class takes ownership of op and will delete it
38 Operator(CeedOperator op);
39#endif
40 void Mult(const mfem::Vector &x, mfem::Vector &y) const override;
41 void AddMult(const mfem::Vector &x, mfem::Vector &y,
42 const real_t a = 1.0) const override;
43 void GetDiagonal(mfem::Vector &diag) const;
45 virtual ~Operator()
46 {
47#ifdef MFEM_USE_CEED
48 CeedOperatorDestroy(&oper);
49 CeedVectorDestroy(&u);
50 CeedVectorDestroy(&v);
51#endif
52 }
53
54#ifdef MFEM_USE_CEED
55 CeedOperator& GetCeedOperator() { return oper; }
56#endif
57};
58
59} // namespace ceed
60
61} // namespace mfem
62
63#endif // MFEM_LIBCEED_OPERATOR
Abstract operator.
Definition operator.hpp:25
Operator * SetupRAP(const Operator *Pi, const Operator *Po)
Returns RAP Operator of this, using input/output Prolongation matrices Pi corresponds to "P",...
Definition operator.cpp:168
Vector data type.
Definition vector.hpp:80
CeedOperator & GetCeedOperator()
Definition operator.hpp:55
void GetDiagonal(mfem::Vector &diag) const
Definition operator.cpp:104
void Mult(const mfem::Vector &x, mfem::Vector &y) const override
Operator application: y=A(x).
Definition operator.cpp:42
CeedOperator oper
Definition operator.hpp:29
virtual ~Operator()
Virtual destructor.
Definition operator.hpp:45
void AddMult(const mfem::Vector &x, mfem::Vector &y, const real_t a=1.0) const override
Operator application: y+=A(x) (default) or y+=a*A(x).
Definition operator.cpp:72
real_t a
Definition lissajous.cpp:41
float real_t
Definition config.hpp:43