https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMVectorUtils.h
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
10#ifdef MOOSE_MFEM_ENABLED
11
12#pragma once
13#include <vector>
14
15#include "libmesh/point.h"
16#include "libmesh/ignore_warnings.h"
17#include "mfem.hpp"
18#include "libmesh/restore_warnings.h"
19
23namespace Moose::MFEM
24{
28inline std::size_t
29MFEMIndex(const std::size_t i_dim,
30 const std::size_t i_point,
31 const std::size_t num_dims,
32 const std::size_t num_points,
33 const mfem::Ordering::Type ordering)
34{
35 if (ordering == mfem::Ordering::byNODES)
36 return mfem::Ordering::Map<mfem::Ordering::byNODES>(num_points, num_dims, i_point, i_dim);
37 else
38 return mfem::Ordering::Map<mfem::Ordering::byVDIM>(num_points, num_dims, i_point, i_dim);
39}
40
44libMesh::Point libMeshPointFromMFEMVector(const mfem::Vector & vec);
45
50mfem::Vector libMeshPointsToMFEMVector(const std::vector<libMesh::Point> & points,
51 const unsigned int num_dims,
52 const mfem::Ordering::Type ordering);
53
54}
55
56#endif
Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).
std::size_t MFEMIndex(const std::size_t i_dim, const std::size_t i_point, const std::size_t num_dims, const std::size_t num_points, const mfem::Ordering::Type ordering)
Convert an index of a vector of libMesh::Points to an MFEM vector index, given an MFEM ordering.
mfem::Vector libMeshPointsToMFEMVector(const std::vector< libMesh::Point > &points, const unsigned int num_dims, const mfem::Ordering::Type ordering)
Convert a vector of libMesh::Point objects to an mfem::Vector containing all points,...
libMesh::Point libMeshPointFromMFEMVector(const mfem::Vector &vec)
Convert an MFEM position vector to a libMesh::Point.