MFEM  v4.6.0
Finite element discretization library
transferutils.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2023, 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 #ifndef MFEM_L2P_MESH_UTILS_HPP
13 #define MFEM_L2P_MESH_UTILS_HPP
14 
15 #include "../../mesh/hexahedron.hpp"
16 #include "../../mesh/quadrilateral.hpp"
17 #include "../fem.hpp"
18 
19 namespace mfem
20 {
21 
22 // These methods are to be used exclusively inside the routines inside the
23 // transfer functionalities
24 namespace internal
25 {
26 
27 /*!
28  * @brief Creates a new element based on the type and cell data.
29  * @param type The element type (Geometry::TRIANGLE, Geometry::TETRAHEDRON,
30  * Geometry::SQUARE, Geometry::CUBE).
31  * @param cells_data The element connectivity.
32  * @param attr The element attribute.
33  */
34 Element *NewElem(const int type, const int *cells_data, const int attr);
35 
36 /*!
37  * @brief Finalizes the mesh based on the element type
38  * @param mesh The mesh.
39  * @param generate_edges True if the generation of edges is requested, false if
40  * not.
41  */
42 void Finalize(Mesh &mesh, const bool generate_edges);
43 
44 /*!
45  * @brief Computes a column vector containing the maximum element for each row
46  * @param mat The matrix
47  * @param vec[out] The vector where we store the result
48  * @param include_vec_elements True if we consider vec as an additional column
49  * of the matrix, False otherwise.
50  */
51 void MaxCol(const DenseMatrix &mat, double *vec, bool include_vec_elements);
52 
53 /*!
54  * @brief Computes a column vector containing the minimum element for each row
55  * @param mat The matrix
56  * @param vec[out] The vector where we store the result
57  * @param include_vec_elements True if we consider vec as an additional column
58  * of the matrix, False otherwise.
59  */
60 void MinCol(const DenseMatrix &mat, double *vec, bool include_vec_elements);
61 
62 /*!
63  * @brief Returns the maximum number of vertices in a face.
64  * @param type The element type of the face.
65  * @return The number of vertices.
66  */
67 int MaxVertsXFace(const int type);
68 
69 /*!
70  * @brief Computes the sum of the matrix entries.
71  * @param mat The matrix.
72  * @return The sum of the elements of the matrix.
73  */
74 double Sum(const DenseMatrix &mat);
75 } // namespace internal
76 
77 } // namespace mfem
78 
79 #endif // MFEM_L2P_MESH_UTILS_HPP