hyper.deal
Loading...
Searching...
No Matches
tools.h
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2020 by the hyper.deal authors
4//
5// This file is part of the hyper.deal library.
6//
7// The hyper.deal library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 3.0 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.MD at
12// the top level directory of hyper.deal.
13//
14// ---------------------------------------------------------------------
15
16#ifndef hyperdeal_matrix_free_tools_h
17#define hyperdeal_matrix_free_tools_h
18
19#include <deal.II/base/config.h>
20
21#include <deal.II/matrix_free/matrix_free.h>
22
23namespace hyperdeal
24{
29 namespace MatrixFreeTools
30 {
31 template <int dim, typename VectorizedArrayType>
32 VectorizedArrayType
33 evaluate_scalar_function(
34 const dealii::Point<dim, VectorizedArrayType> &point,
35 const dealii::Function<dim, typename VectorizedArrayType::value_type>
36 & function,
37 const unsigned int n_lanes)
38 {
39 VectorizedArrayType result = 0;
40
41 for (unsigned int v = 0; v < n_lanes; ++v)
42 {
43 dealii::Point<dim> p;
44 for (unsigned int d = 0; d < dim; ++d)
45 p[d] = point[d][v];
46 result[v] = function.value(p);
47 }
48
49 return result;
50 }
51
52
53 } // namespace MatrixFreeTools
54
55
56} // namespace hyperdeal
57
58
59#endif