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 : #include "MFEMVectorUtils.h" 13 : #include "libmesh/int_range.h" 14 : 15 : namespace Moose::MFEM 16 : { 17 : libMesh::Point 18 2884720 : libMeshPointFromMFEMVector(const mfem::Vector & vec) 19 : { 20 2884720 : return libMesh::Point(vec(0), vec.Size() > 1 ? vec(1) : 0., vec.Size() > 2 ? vec(2) : 0.); 21 : } 22 : 23 : mfem::Vector 24 610 : libMeshPointsToMFEMVector(const std::vector<libMesh::Point> & points, 25 : const unsigned int num_dims, 26 : const mfem::Ordering::Type ordering) 27 : { 28 610 : const unsigned int num_points = points.size(); 29 610 : mfem::Vector mfem_points(num_points * num_dims); 30 55077 : for (const auto i_point : libMesh::make_range(num_points)) 31 188795 : for (const auto i_dim : libMesh::make_range(num_dims)) 32 134328 : mfem_points(MFEMIndex(i_dim, i_point, num_dims, num_points, ordering)) = 33 134328 : points[i_point](i_dim); 34 : 35 610 : return mfem_points; 36 0 : } 37 : } 38 : 39 : #endif