MFEM v4.9.0
Finite element discretization library
Loading...
Searching...
No Matches
doperator.cpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, 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#include "doperator.hpp"
13
14#ifdef MFEM_USE_MPI
15
16using namespace mfem;
17using namespace mfem::future;
18
19void DifferentiableOperator::SetParameters(std::vector<Vector *> p) const
20{
21 MFEM_ASSERT(parameters.size() == p.size(),
22 "number of parameters doesn't match descriptors");
23 for (size_t i = 0; i < parameters.size(); i++)
24 {
25 p[i]->Read();
26 parameters_l[i] = *p[i];
27 }
28}
29
31 const std::vector<FieldDescriptor> &solutions,
32 const std::vector<FieldDescriptor> &parameters,
33 const ParMesh &mesh) :
34 mesh(mesh),
35 solutions(solutions),
36 parameters(parameters)
37{
38 fields.resize(solutions.size() + parameters.size());
39 fields_e.resize(fields.size());
40 solutions_l.resize(solutions.size());
41 parameters_l.resize(parameters.size());
42
43 for (size_t i = 0; i < solutions.size(); i++)
44 {
45 fields[i] = solutions[i];
46 }
47
48 for (size_t i = 0; i < parameters.size(); i++)
49 {
50 fields[i + solutions.size()] = parameters[i];
51 }
52}
53
54#endif // MFEM_USE_MPI
Class for parallel meshes.
Definition pmesh.hpp:34
DifferentiableOperator(const std::vector< FieldDescriptor > &solutions, const std::vector< FieldDescriptor > &parameters, const ParMesh &mesh)
Definition doperator.cpp:30
void SetParameters(std::vector< Vector * > p) const
Set the parameters for the operator.
Definition doperator.cpp:19
real_t p(const Vector &x, real_t t)