Vulpes  0.1.0
Versatile and parallel compUtational Library for high-order discontinuous Polytopal Element Simulations
Loading...
Searching...
No Matches
qrule.hpp
Go to the documentation of this file.
1// ----------------------------------------------------------------------
2//
3// Copyright (C) 2024 - 2026 by the Vulpes authors.
4// This file is part of Vulpes.
5//
6// Vulpes is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation, either version 3 of the License, or
9// (at your option) any later version.
10//
11// Vulpes is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License
17// along with Vulpes. If not, see <http://www.gnu.org/licenses/>.
18//
19// ----------------------------------------------------------------------
20
21// Author: Matteo Caldana <matteo.caldana@polimi.it>
22// Author: Pedro Peixoto <ppeixoto@usp.br>
23
24#ifndef VULPES_QUADRATURE_QRULE_HPP_
25#define VULPES_QUADRATURE_QRULE_HPP_
26
27#include <array>
28#include <cstddef>
29#include <vector>
30
32
33namespace vulpes {
34namespace qrule {
35
47template <typename T, std::size_t Dim>
50 std::array<T, Dim> point;
53};
54
68template <typename T, std::size_t Dim>
71 std::vector<QuadraturePoint<T, Dim>> nodes;
73 std::size_t degree;
74};
75
82template <typename T>
84
101template <typename V, typename U, std::size_t Dim>
103 QuadratureRule<V, Dim> rule_dst;
104 rule_dst.degree = rule_src.degree;
105 rule_dst.nodes.reserve(rule_src.nodes.size());
106 for (const auto& node : rule_src.nodes) {
107 rule_dst.nodes.emplace_back();
108 rule_dst.nodes.back().weight = vmath::to<V>(node.weight);
109 for (std::size_t d = 0; d < Dim; ++d) {
110 rule_dst.nodes.back().point[d] = vmath::to<V>(node.point[d]);
111 }
112 }
113 return rule_dst;
114}
115} // namespace qrule
116} // namespace vulpes
117#endif // VULPES_QUADRATURE_QRULE_HPP_
Definition gauss.cpp:39
QuadratureRule< V, Dim > castRule(const QuadratureRule< U, Dim > &rule_src)
Casts a quadrature rule from one data type to another.
Definition qrule.hpp:102
QuadratureRule< T, 1 > QuadratureRule1D
Alias for a 1-dimensional quadrature rule.
Definition qrule.hpp:83
V to(const U &src)
Converts a value of one pseudo-arithmetic type to another.
Definition vmath.hpp:321
Definition cell_manager.hpp:38
Represents a single quadrature point in a specified dimension.
Definition qrule.hpp:48
std::array< T, Dim > point
Coordinates of the quadrature point in Dim dimensions.
Definition qrule.hpp:50
T weight
Weight of the quadrature point for integration.
Definition qrule.hpp:52
Represents a quadrature rule consisting of a set of points and associated weights.
Definition qrule.hpp:69
std::size_t degree
Definition qrule.hpp:73
std::vector< QuadraturePoint< float_t, Dim > > nodes
Definition qrule.hpp:71