LCOV - code coverage report
Current view: top level - include/mfem/utils - MFEMVectorUtils.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 4 4 100.0 %
Date: 2026-05-29 20:35:17 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      20             : /**
      21             :  * Utilities for converting between vector(s) of libMesh Points and MFEM Vector(s).
      22             :  */
      23             : namespace Moose::MFEM
      24             : {
      25             : /**
      26             :  * Convert an index of a vector of libMesh::Points to an MFEM vector index, given an MFEM ordering
      27             :  */
      28             : inline std::size_t
      29      993626 : MFEMIndex(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      993626 :   if (ordering == mfem::Ordering::byNODES)
      36      438472 :     return mfem::Ordering::Map<mfem::Ordering::byNODES>(num_points, num_dims, i_point, i_dim);
      37             :   else
      38      555154 :     return mfem::Ordering::Map<mfem::Ordering::byVDIM>(num_points, num_dims, i_point, i_dim);
      39             : }
      40             : 
      41             : /**
      42             :  * Convert an MFEM position vector to a libMesh::Point.
      43             :  */
      44             : libMesh::Point libMeshPointFromMFEMVector(const mfem::Vector & vec);
      45             : 
      46             : /**
      47             :  * Convert a vector of libMesh::Point objects to an mfem::Vector containing all points, given an
      48             :  * ordering.
      49             :  */
      50             : mfem::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

Generated by: LCOV version 1.14