PRISMS-PF Manual v3.0-pre
Loading...
Searching...
No Matches
utilities.h
1#ifndef UTILITIES_H
2#define UTILITIES_H
3
4#include <deal.II/base/tensor.h>
5#include <deal.II/base/vectorization.h>
6
7#include <core/exceptions.h>
8#include <vector>
9
13#define constV(value) make_vectorized_array(value)
14
18#define constT(vector, dim) make_tensor_of_vectorized_arrays<dim>(vector)
19
20template <int dim, typename datatype>
21dealii::Tensor<1, dim, dealii::VectorizedArray<datatype>>
22make_tensor_of_vectorized_arrays(const std::vector<datatype> &input_vector)
23{
24 AssertDimension(input_vector.size(), dim);
25
26 dealii::Tensor<1, dim, dealii::VectorizedArray<datatype>> tensor;
27
28 // Populate the Tensor with vectorized arrays
29 for (unsigned int i = 0; i < input_vector.size(); ++i)
30 {
31 tensor[i] = dealii::make_vectorized_array(input_vector[i]);
32 }
33
34 return tensor;
35}
36
37#endif