18c81f8b0SPeter Munch // --------------------------------------------------------------------- 28c81f8b0SPeter Munch // 38c81f8b0SPeter Munch // Copyright (C) 2023 by the deal.II authors 48c81f8b0SPeter Munch // 58c81f8b0SPeter Munch // This file is part of the deal.II library. 68c81f8b0SPeter Munch // 78c81f8b0SPeter Munch // The deal.II library is free software; you can use it, redistribute 88c81f8b0SPeter Munch // it, and/or modify it under the terms of the GNU Lesser General 98c81f8b0SPeter Munch // Public License as published by the Free Software Foundation; either 108c81f8b0SPeter Munch // version 2.1 of the License, or (at your option) any later version. 118c81f8b0SPeter Munch // The full text of the license can be found in the file LICENSE.md at 128c81f8b0SPeter Munch // the top level directory of deal.II. 138c81f8b0SPeter Munch // 148c81f8b0SPeter Munch // Authors: Peter Munch, Martin Kronbichler 158c81f8b0SPeter Munch // 168c81f8b0SPeter Munch // --------------------------------------------------------------------- 178c81f8b0SPeter Munch 18*d416dc2bSJeremy L Thompson #pragma once 19*d416dc2bSJeremy L Thompson #ifndef bps_h 20*d416dc2bSJeremy L Thompson # define bps_h 21*d416dc2bSJeremy L Thompson 228c81f8b0SPeter Munch // deal.II includes 238c81f8b0SPeter Munch # include <deal.II/dofs/dof_tools.h> 248c81f8b0SPeter Munch 258c81f8b0SPeter Munch # include <deal.II/fe/mapping.h> 268c81f8b0SPeter Munch 278c81f8b0SPeter Munch # include <deal.II/lac/la_parallel_vector.h> 288c81f8b0SPeter Munch 298c81f8b0SPeter Munch # include <deal.II/matrix_free/fe_evaluation.h> 308c81f8b0SPeter Munch # include <deal.II/matrix_free/matrix_free.h> 31571e8cf0SJeremy L Thompson # include <deal.II/matrix_free/shape_info.h> 328c81f8b0SPeter Munch # include <deal.II/matrix_free/tools.h> 338c81f8b0SPeter Munch 348c81f8b0SPeter Munch using namespace dealii; 358c81f8b0SPeter Munch 36*d416dc2bSJeremy L Thompson 37*d416dc2bSJeremy L Thompson 388c81f8b0SPeter Munch /** 398c81f8b0SPeter Munch * BP types. For more details, see https://ceed.exascaleproject.org/bps/. 408c81f8b0SPeter Munch */ 418c81f8b0SPeter Munch enum class BPType : unsigned int 428c81f8b0SPeter Munch { 438c81f8b0SPeter Munch BP1, 448c81f8b0SPeter Munch BP2, 458c81f8b0SPeter Munch BP3, 468c81f8b0SPeter Munch BP4, 478c81f8b0SPeter Munch BP5, 488c81f8b0SPeter Munch BP6 498c81f8b0SPeter Munch }; 508c81f8b0SPeter Munch 518c81f8b0SPeter Munch 528c81f8b0SPeter Munch 538c81f8b0SPeter Munch /** 548c81f8b0SPeter Munch * Struct storing relevant information regarding each BP. 558c81f8b0SPeter Munch */ 568c81f8b0SPeter Munch struct BPInfo 578c81f8b0SPeter Munch { BPInfoBPInfo588c81f8b0SPeter Munch BPInfo(const BPType type, const int dim, const int fe_degree) 598c81f8b0SPeter Munch : type(type) 608c81f8b0SPeter Munch , dim(dim) 618c81f8b0SPeter Munch , fe_degree(fe_degree) 628c81f8b0SPeter Munch { 638c81f8b0SPeter Munch if (type == BPType::BP1) 648c81f8b0SPeter Munch type_string = "BP1"; 658c81f8b0SPeter Munch else if (type == BPType::BP2) 668c81f8b0SPeter Munch type_string = "BP2"; 678c81f8b0SPeter Munch else if (type == BPType::BP3) 688c81f8b0SPeter Munch type_string = "BP3"; 698c81f8b0SPeter Munch else if (type == BPType::BP4) 708c81f8b0SPeter Munch type_string = "BP4"; 718c81f8b0SPeter Munch else if (type == BPType::BP5) 728c81f8b0SPeter Munch type_string = "BP5"; 738c81f8b0SPeter Munch else if (type == BPType::BP6) 748c81f8b0SPeter Munch type_string = "BP6"; 758c81f8b0SPeter Munch 768c81f8b0SPeter Munch this->n_q_points_1d = (type <= BPType::BP4) ? (fe_degree + 2) : (fe_degree + 1); 778c81f8b0SPeter Munch 788c81f8b0SPeter Munch this->n_components = 798c81f8b0SPeter Munch (type == BPType::BP1 || type == BPType::BP3 || type == BPType::BP5) ? 1 : dim; 808c81f8b0SPeter Munch } 818c81f8b0SPeter Munch 828c81f8b0SPeter Munch 838c81f8b0SPeter Munch BPType type; 848c81f8b0SPeter Munch std::string type_string; 858c81f8b0SPeter Munch unsigned int dim; 868c81f8b0SPeter Munch unsigned int fe_degree; 878c81f8b0SPeter Munch unsigned int n_q_points_1d; 888c81f8b0SPeter Munch unsigned int n_components; 898c81f8b0SPeter Munch }; 908c81f8b0SPeter Munch 918c81f8b0SPeter Munch 928c81f8b0SPeter Munch 938c81f8b0SPeter Munch /** 948c81f8b0SPeter Munch * Base class of operators. 958c81f8b0SPeter Munch */ 96*d416dc2bSJeremy L Thompson template <typename Number, typename MemorySpace> 978c81f8b0SPeter Munch class OperatorBase 988c81f8b0SPeter Munch { 998c81f8b0SPeter Munch public: 1008c81f8b0SPeter Munch /** 1018c81f8b0SPeter Munch * deal.II vector type 1028c81f8b0SPeter Munch */ 103*d416dc2bSJeremy L Thompson using VectorType = LinearAlgebra::distributed::Vector<Number, MemorySpace>; 1048c81f8b0SPeter Munch 1058c81f8b0SPeter Munch /** 1068c81f8b0SPeter Munch * Initialize vector. 1078c81f8b0SPeter Munch */ 1088c81f8b0SPeter Munch virtual void 1098c81f8b0SPeter Munch reinit() = 0; 1108c81f8b0SPeter Munch 1118c81f8b0SPeter Munch /** 1128c81f8b0SPeter Munch * Perform matrix-vector product 1138c81f8b0SPeter Munch */ 1148c81f8b0SPeter Munch virtual void 1158c81f8b0SPeter Munch vmult(VectorType &dst, const VectorType &src) const = 0; 1168c81f8b0SPeter Munch 1178c81f8b0SPeter Munch /** 1188c81f8b0SPeter Munch * Initialize vector. 1198c81f8b0SPeter Munch */ 1208c81f8b0SPeter Munch virtual void 1218c81f8b0SPeter Munch initialize_dof_vector(VectorType &vec) const = 0; 1228c81f8b0SPeter Munch 1238c81f8b0SPeter Munch /** 1248c81f8b0SPeter Munch * Compute inverse of diagonal. 1258c81f8b0SPeter Munch */ 1268c81f8b0SPeter Munch virtual void 1278c81f8b0SPeter Munch compute_inverse_diagonal(VectorType &diagonal) const = 0; 1288c81f8b0SPeter Munch }; 1298c81f8b0SPeter Munch 130*d416dc2bSJeremy L Thompson #endif 131