Line data Source code
1 : // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2 : // SPDX-License-Identifier: Apache-2.0
3 :
4 : #ifndef PALACE_FEM_INTERPOLATOR_HPP
5 : #define PALACE_FEM_INTERPOLATOR_HPP
6 :
7 : #include <complex>
8 : #include <vector>
9 : #include <mfem.hpp>
10 :
11 : namespace palace
12 : {
13 :
14 : class GridFunction;
15 : class IoData;
16 : class FiniteElementSpace;
17 :
18 : //
19 : // A class which wraps MFEM's GSLIB interface for high-order field interpolation.
20 : //
21 : class InterpolationOperator
22 : {
23 : private:
24 : #if defined(MFEM_USE_GSLIB)
25 : mfem::FindPointsGSLIB op;
26 : #endif
27 : std::vector<int> op_idx;
28 :
29 : int v_dim_fes; // dimension of interpolated vector from NDSpace
30 :
31 : std::vector<double> ProbeField(const mfem::ParGridFunction &U);
32 :
33 : public:
34 : InterpolationOperator(const IoData &iodata, FiniteElementSpace &nd_space);
35 :
36 0 : auto GetVDim() const { return v_dim_fes; }
37 : const auto &GetProbes() const { return op_idx; }
38 :
39 : std::vector<std::complex<double>> ProbeField(const GridFunction &U);
40 : };
41 :
42 : namespace fem
43 : {
44 :
45 : // Interpolate a function on a serial or parallel mesh to a different mesh, using GSLIB.
46 : // Similar to MFEM's field-interp miniapp.
47 : void InterpolateFunction(const mfem::GridFunction &U, mfem::GridFunction &V);
48 :
49 : // Interpolate a function at a specific list of points, specified using the provided
50 : // ordering. The output vector values are always arranged byVDIM.
51 : void InterpolateFunction(const mfem::Vector &xyz, const mfem::GridFunction &U,
52 : mfem::Vector &V,
53 : mfem::Ordering::Type ordering = mfem::Ordering::byNODES);
54 :
55 : } // namespace fem
56 :
57 : } // namespace palace
58 :
59 : #endif // PALACE_FEM_INTERPOLATOR_HPP
|