version GIT relicensing-7278-g091132d5eb 2026-12-02 03:10:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
portable_matrix_free.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2017 - 2026 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13
14#ifndef dealii_portable_matrix_free_h
15#define dealii_portable_matrix_free_h
16
17#include <deal.II/base/config.h>
18
24#include <deal.II/base/tensor.h>
26
28
30#include <deal.II/fe/mapping.h>
31
33
36
39
40#include <Kokkos_Array.hpp>
41#include <Kokkos_Core.hpp>
42
43
44
46
47// Forward declaration
48namespace internal
49{
50 namespace MatrixFreeFunctions
51 {
52 enum class ConstraintKinds : std::uint16_t;
53 }
54} // namespace internal
55
56namespace Portable
57{
58 // forward declaration
59#ifndef DOXYGEN
60 namespace internal
61 {
62 template <int dim, typename Number>
63 class ReinitHelper;
64 }
65 template <int dim, typename Number>
66 struct SharedData;
67#endif
68
75 inline constexpr unsigned int n_max_dof_handlers = 5;
76
84 template <typename Number>
86 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>;
87
94 template <typename Number>
96 {
97 public:
102 : n_blocks(0)
103 {}
104
108 DeviceBlockVector(const DeviceBlockVector &other) = default;
109
115 : n_blocks(1)
116 , blocks{src}
117 {}
118
123 template <typename MemorySpace>
126 : n_blocks(src.n_blocks())
127 {
129 ExcMessage("Portable::MatrixFree is configured with " +
131 " but you are passing a BlockVector with " +
132 Utilities::to_string(src.n_blocks()) + " blocks."));
133
134 for (int b = 0; b < src.n_blocks(); ++b)
135 blocks[b] = DeviceVector<Number>(src.block(b).get_values(),
136 src.block(b).locally_owned_size());
137 }
138
144 block(unsigned int index)
145 {
147 return blocks[index];
148 }
149
154 block(unsigned int index) const
155 {
157 return blocks[index];
158 }
159
160 private:
164 unsigned int n_blocks;
165
169 Kokkos::Array<DeviceVector<Number>, n_max_dof_handlers> blocks;
170 };
171
196 template <int dim, typename Number = double>
198 {
199 public:
206
268
269
270
277 {
281 Kokkos::View<point_type **, MemorySpace::Default::kokkos_space> q_points;
282
288 Kokkos::View<types::global_dof_index **,
291
299 Kokkos::View<Number *[dim][dim], MemorySpace::Default::kokkos_space>
301
312 Kokkos::View<Number *, MemorySpace::Default::kokkos_space> JxW;
313
320
325 Kokkos::View<unsigned int *, MemorySpace::Default::kokkos_space>
327
332 Kokkos::View<Number *, MemorySpace::Default::kokkos_space> q_weights;
333
340
344 Kokkos::View<Number *, MemorySpace::Default::kokkos_space> shape_values;
345
349 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
351
355 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
357
361 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
363
367 unsigned int n_cells;
368
372 unsigned int n_components;
373
381 unsigned int first_cell;
382
388
395
399 unsigned int scratch_pad_size;
400
405 DEAL_II_HOST_DEVICE unsigned int
406 inv_jacobian_index(const int cell, const int q_point) const
407 {
408 return data_index_offsets(cell) +
409 ((cell_type(cell) ==
411 q_point :
412 0);
413 }
414
420 JxW_value(const int cell, const int q_point) const
421 {
422 const unsigned int offset = data_index_offsets(cell);
423 return (cell_type(cell) ==
425 JxW(offset + q_point) :
426 JxW(offset) * q_weights(q_point);
427 }
428 };
429
430
438 struct Data
439 {
440 using TeamHandle = Kokkos::TeamPolicy<
441 MemorySpace::Default::kokkos_space::execution_space>::member_type;
442
447
448 const unsigned int n_q_points;
449 const unsigned int n_dof_handler;
450 const int cell_index;
451 const Kokkos::Array<PrecomputedData, n_max_dof_handlers>
453 Kokkos::Array<SharedData<dim, Number>, n_max_dof_handlers> &shared_data;
454
459 DEAL_II_HOST_DEVICE unsigned int
460 local_q_point_id(const unsigned int cell,
461 const unsigned int q_point) const
462 {
465 "The cell index is smaller than the first cell of the "
466 "current color."));
467
470
472
474 precomputed_data[0].q_points.extent(1),
475 ExcInternalError("q_points array has wrong size"));
476 Assert(n_q_points == precomputed_data[0].q_points.extent(0),
477 ExcInternalError("q_points array has wrong size"));
478
479 return cell * n_q_points + q_point;
480 }
481
482
483
489 get_quadrature_point(const unsigned int cell,
490 const unsigned int q_point) const
491 {
494 "The cell index is smaller than the first cell of the "
495 "current color."));
496 const unsigned int local_cell = cell - precomputed_data[0].first_cell;
498 precomputed_data[0].q_points.extent(1),
502 Assert(n_q_points == precomputed_data[0].q_points.extent(0),
504 return precomputed_data[0].q_points(q_point, local_cell);
505 }
506
515 template <typename Functor>
517 for_each_quad_point(const Functor &func) const
518 {
519 Kokkos::parallel_for(Kokkos::TeamThreadRange(team_member, n_q_points),
520 [&](const int &q) { func(q); });
521 team_member.team_barrier();
522 }
523 };
524
529
540 template <typename IteratorFiltersType>
541 void
542 reinit(const Mapping<dim> &mapping,
543 const DoFHandler<dim> &dof_handler,
544 const AffineConstraints<Number> &constraints,
545 const Quadrature<1> &quad,
546 const IteratorFiltersType &iterator_filter,
547 const AdditionalData &additional_data = AdditionalData());
548
552 void
553 reinit(const Mapping<dim> &mapping,
554 const DoFHandler<dim> &dof_handler,
555 const AffineConstraints<Number> &constraints,
556 const Quadrature<1> &quad,
557 const AdditionalData &additional_data = AdditionalData());
558
562 void
563 reinit(const DoFHandler<dim> &dof_handler,
564 const AffineConstraints<Number> &constraints,
565 const Quadrature<1> &quad,
566 const AdditionalData &additional_data = AdditionalData());
567
568
572 template <typename IteratorFiltersType>
573 void
574 reinit(const Mapping<dim> &mapping,
575 const std::vector<const DoFHandler<dim> *> &dof_handler,
576 const std::vector<const AffineConstraints<Number> *> &constraints,
577 const Quadrature<1> &quad,
578 const IteratorFiltersType &iterator_filter,
579 const AdditionalData &additional_data = AdditionalData());
580
584 void
585 reinit(const Mapping<dim> &mapping,
586 const std::vector<const DoFHandler<dim> *> &dof_handler,
587 const std::vector<const AffineConstraints<Number> *> &constraints,
588 const Quadrature<1> &quad,
589 const AdditionalData &additional_data = AdditionalData());
590
595 get_data(const unsigned int color,
596 const unsigned int dof_handler_index = 0) const;
597
598 // clang-format off
621 // clang-format on
622 template <typename Functor, typename VectorType>
623 void
624 cell_loop(const Functor &func,
625 const VectorType &src,
626 VectorType &dst) const;
627
645 template <typename Functor>
646 void
647 evaluate_coefficients(Functor func) const;
648
655 template <typename VectorType>
656 void
657 copy_constrained_values(const VectorType &src,
658 VectorType &dst,
659 const unsigned int dof_handler_index = 0) const;
660
669 void
674 &dst) const;
675
683 template <typename VectorType>
684 void
685 set_constrained_values(const Number value,
686 VectorType &dst,
687 const unsigned int dof_handler_index = 0) const;
688
697 template <typename MemorySpaceType>
698 void
701 const unsigned int dof_handler_index = 0) const;
702
709 template <typename MemorySpaceType>
710 void
713 const;
714
721 const std::vector<std::vector<CellFilter>> &
723
730 const std::vector<std::vector<LevelCellFilter>> &
732
743 const std::shared_ptr<const Utilities::MPI::Partitioner> &
744 get_vector_partitioner(const unsigned int dof_handler_index = 0) const;
745
749 const DoFHandler<dim> &
750 get_dof_handler(const unsigned int dof_handler_index = 0) const;
751
757 unsigned int
759
768 get_cell_iterator(const unsigned int color,
769 const unsigned int index,
770 const unsigned int dof_handler_index = 0) const;
771
775 unsigned int
776 n_cells_per_color(const unsigned int color) const;
777
783 bool
785
789 std::size_t
791
792 private:
796 template <typename IteratorFiltersType>
797 void
799 const Mapping<dim> &mapping,
800 const std::vector<const DoFHandler<dim> *> &dof_handler,
801 const std::vector<const AffineConstraints<Number> *> &constraints,
802 const Quadrature<1> &quad,
803 const IteratorFiltersType &iterator_filter,
804 const std::shared_ptr<const MPI_Comm> &comm,
805 const AdditionalData additional_data);
806
811 template <typename Functor, typename VectorType>
812 void
813 serial_cell_loop(const Functor &func,
814 const VectorType &src,
815 VectorType &dst) const;
816
821 template <typename Functor>
822 void
824 const Functor &func,
826 &src,
828 const;
829
833 template <typename Functor>
834 void
836 const Functor &func,
840 &dst) const;
841
842
846 int my_id;
847
854
860
865 unsigned int mg_level;
866
871 unsigned int team_size;
872
873
879 {
884 std::vector<
885 Kokkos::View<point_type **, MemorySpace::Default::kokkos_space>>
887
892 std::vector<
893 Kokkos::View<Number *[dim][dim], MemorySpace::Default::kokkos_space>>
895
900 std::vector<Kokkos::View<Number *, MemorySpace::Default::kokkos_space>>
902
907 std::vector<
911
917 std::vector<
918 Kokkos::View<unsigned int *, MemorySpace::Default::kokkos_space>>
920
924 Kokkos::View<Number *, MemorySpace::Default::kokkos_space> q_weights;
925 };
926
931 std::vector<MappingInfo> mapping_info;
932
936 struct DoFInfo
937 {
942
949
953 unsigned int scratch_pad_size;
954
958 unsigned int fe_degree;
959
963 unsigned int n_components;
964
969
973 unsigned int dofs_per_cell;
974
978 unsigned int n_constrained_dofs;
979
984 std::vector<Kokkos::View<types::global_dof_index **,
987
991 Kokkos::View<types::global_dof_index *,
994
998 std::vector<
1002
1006 Kokkos::View<Number *, MemorySpace::Default::kokkos_space> shape_values;
1007
1011 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
1013
1017 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
1019
1023 Kokkos::View<Number *, MemorySpace::Default::kokkos_space>
1025
1030
1035 std::shared_ptr<const Utilities::MPI::Partitioner> partitioner;
1036 };
1037
1041 std::vector<DoFInfo> dof_handler_data;
1042
1046 unsigned int q_points_per_cell;
1047
1051 unsigned int n_colors;
1052
1056 std::vector<unsigned int> n_cells;
1057
1065 std::vector<unsigned int> first_cell;
1066
1071 std::vector<std::vector<CellFilter>> graph;
1072
1077 std::vector<std::vector<LevelCellFilter>> level_graph;
1078
1079 friend class internal::ReinitHelper<dim, Number>;
1080 };
1081
1082
1083
1084 template <int dim, typename Number>
1086 {
1087 using TeamHandle = Kokkos::TeamPolicy<
1088 MemorySpace::Default::kokkos_space::execution_space>::member_type;
1089
1090 using SharedViewValues = Kokkos::View<
1091 Number **,
1092 MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space,
1093 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
1094 using SharedViewGradients = Kokkos::View<
1095 Number ***,
1096 MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space,
1097 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
1098 using SharedViewScratchPad = Kokkos::View<
1099 Number *,
1100 MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space,
1101 Kokkos::MemoryTraits<Kokkos::Unmanaged>>;
1102
1107 void
1108 reinit(const TeamHandle &team_handle,
1109 const unsigned int n_q_points,
1110 const typename MatrixFree<dim, Number>::PrecomputedData &gpu_data)
1111 {
1112 values = SharedViewValues(team_handle.team_shmem(),
1113 n_q_points,
1114 gpu_data.n_components);
1115 gradients = SharedViewGradients(team_handle.team_shmem(),
1116 n_q_points,
1117 dim,
1118 gpu_data.n_components);
1119 scratch_pad = SharedViewScratchPad(team_handle.team_shmem(),
1120 gpu_data.scratch_pad_size);
1121 }
1122
1127
1132
1137 };
1138
1139
1140
1145 template <int dim, typename Number>
1147 {
1151 typename Kokkos::View<Point<dim, Number> **,
1152 MemorySpace::Default::kokkos_space>::host_mirror_type
1154
1159 typename Kokkos::View<types::global_dof_index **,
1160 MemorySpace::Default::kokkos_space>::host_mirror_type
1162
1167 typename Kokkos::View<Number *[dim][dim],
1168 MemorySpace::Default::kokkos_space>::host_mirror_type
1170
1175 typename Kokkos::View<Number *,
1176 MemorySpace::Default::kokkos_space>::host_mirror_type
1178
1183 typename Kokkos::View<
1186
1191 typename Kokkos::View<unsigned int *,
1192 MemorySpace::Default::kokkos_space>::host_mirror_type
1194
1198 typename Kokkos::View<Number *,
1199 MemorySpace::Default::kokkos_space>::host_mirror_type
1201
1205 unsigned int n_cells;
1206
1214 unsigned int first_cell;
1215
1219 typename Kokkos::View<
1222
1228
1229
1230
1234 unsigned int
1235 local_q_point_id(const unsigned int cell,
1236 const unsigned int n_q_points,
1237 const unsigned int q_point) const
1238 {
1239 return cell * n_q_points + q_point;
1240 }
1241
1242
1243
1248 get_quadrature_point(const unsigned int cell,
1249 const unsigned int q_point) const
1250 {
1251 return q_points(q_point, cell - first_cell);
1252 }
1253
1258 unsigned int
1259 inv_jacobian_index(const unsigned int cell,
1260 const unsigned int q_point) const
1261 {
1262 return data_index_offsets(cell) +
1263 ((cell_type(cell) ==
1265 q_point :
1266 0);
1267 }
1268
1272 Number
1273 JxW_value(const unsigned int cell, const unsigned int q_point) const
1274 {
1275 const unsigned int offset = data_index_offsets(cell);
1276 return (cell_type(cell) ==
1278 JxW(offset + q_point) :
1279 JxW(offset) * q_weights(q_point);
1280 }
1281 };
1282
1283
1284
1291 template <int dim, typename Number>
1292 DataHost<dim, Number>
1294 const typename ::Portable::MatrixFree<dim, Number>::PrecomputedData
1295 &data,
1296 const UpdateFlags &update_flags)
1297 {
1298 DataHost<dim, Number> data_host;
1299
1300 data_host.n_cells = data.n_cells;
1301 data_host.first_cell = data.first_cell;
1302 data_host.use_coloring = data.use_coloring;
1303
1304 const auto create_mirror_without_initializing = [](const auto &view) {
1305#if DEAL_II_KOKKOS_VERSION_GTE(3, 6, 0)
1306 return Kokkos::create_mirror(Kokkos::WithoutInitializing, view);
1307#else
1308 return Kokkos::create_mirror(view);
1309#endif
1310 };
1311
1312 MemorySpace::Default::kokkos_space::execution_space exec;
1313
1314 if (update_flags & update_quadrature_points)
1315 {
1316 data_host.q_points = create_mirror_without_initializing(data.q_points);
1317 Kokkos::deep_copy(exec, data_host.q_points, data.q_points);
1318 }
1319
1320 data_host.local_to_global =
1321 create_mirror_without_initializing(data.local_to_global);
1322 Kokkos::deep_copy(exec, data_host.local_to_global, data.local_to_global);
1323
1324 if (update_flags & update_gradients)
1325 {
1326 data_host.inv_jacobian =
1327 create_mirror_without_initializing(data.inv_jacobian);
1328 Kokkos::deep_copy(exec, data_host.inv_jacobian, data.inv_jacobian);
1329 }
1330
1331 if (update_flags & update_JxW_values)
1332 {
1333 data_host.JxW = create_mirror_without_initializing(data.JxW);
1334 Kokkos::deep_copy(exec, data_host.JxW, data.JxW);
1335 }
1336
1337 data_host.cell_type = create_mirror_without_initializing(data.cell_type);
1338 Kokkos::deep_copy(exec, data_host.cell_type, data.cell_type);
1339
1340 data_host.data_index_offsets =
1341 create_mirror_without_initializing(data.data_index_offsets);
1342 Kokkos::deep_copy(exec,
1343 data_host.data_index_offsets,
1344 data.data_index_offsets);
1345
1346 data_host.q_weights = create_mirror_without_initializing(data.q_weights);
1347 Kokkos::deep_copy(exec, data_host.q_weights, data.q_weights);
1348
1349 data_host.constraint_mask =
1350 create_mirror_without_initializing(data.constraint_mask);
1351 Kokkos::deep_copy(exec, data_host.constraint_mask, data.constraint_mask);
1352
1353 exec.fence();
1354
1355 return data_host;
1356 }
1357
1358
1359 /*----------------------- Inline functions ---------------------------------*/
1360
1361#ifndef DOXYGEN
1362
1363 template <int dim, typename Number>
1364 inline const std::vector<std::vector<
1367 {
1370 ExcMessage(
1371 "The MatrixFree object has been initialized for a specific "
1372 "multigrid level. This function is only available when working "
1373 "on active cells."));
1374 return graph;
1375 }
1376
1377
1378
1379 template <int dim, typename Number>
1380 inline const std::vector<std::vector<
1383 {
1386 ExcMessage("The MatrixFree object has been initialized for active cells. "
1387 "This function is only available when working on a specific "
1388 "multigrid level."));
1389 return level_graph;
1390 }
1391
1392
1393
1394 template <int dim, typename Number>
1395 inline const std::shared_ptr<const Utilities::MPI::Partitioner> &
1397 const unsigned int dof_handler_index) const
1398 {
1399 Assert(dof_handler_data.size() > 0, ExcNotInitialized());
1400 AssertIndexRange(dof_handler_index, dof_handler_data.size());
1401 return dof_handler_data[dof_handler_index].partitioner;
1402 }
1403
1404
1405
1406 template <int dim, typename Number>
1407 inline unsigned int
1409 {
1410 return mg_level;
1411 }
1412
1413
1414
1415 template <int dim, typename Number>
1416 inline const DoFHandler<dim> &
1418 const unsigned int dof_handler_index) const
1419 {
1420 Assert(dof_handler_data.size() > 0, ExcNotInitialized());
1421 AssertIndexRange(dof_handler_index, dof_handler_data.size());
1422
1423 return *dof_handler_data[dof_handler_index].dof_handler;
1424 }
1425
1426
1427 template <int dim, typename Number>
1430 const unsigned int color,
1431 const unsigned int index,
1432 const unsigned int dof_handler_index) const
1433 {
1434 if (mg_level == numbers::invalid_unsigned_int)
1435 {
1436 AssertIndexRange(color, get_colored_graph().size());
1437 AssertIndexRange(index, get_colored_graph()[color].size());
1438
1439 const unsigned int cell_level =
1440 get_colored_graph()[color][index]->level();
1441
1442 const unsigned int cell_index =
1443 get_colored_graph()[color][index]->index();
1444
1445 return typename DoFHandler<dim>::cell_iterator(
1446 &(get_dof_handler(dof_handler_index).get_triangulation()),
1447 cell_level,
1448 cell_index,
1449 &get_dof_handler(dof_handler_index));
1450 }
1451 else
1452 {
1453 AssertIndexRange(color, get_colored_level_graph().size());
1454 AssertIndexRange(index, get_colored_level_graph()[color].size());
1455
1456 const unsigned int cell_level =
1457 get_colored_level_graph()[color][index]->level();
1458
1459 const unsigned int cell_index =
1460 get_colored_level_graph()[color][index]->index();
1461
1462 return typename DoFHandler<dim>::cell_iterator(
1463 &(get_dof_handler(dof_handler_index).get_triangulation()),
1464 cell_level,
1465 cell_index,
1466 &get_dof_handler(dof_handler_index));
1467 }
1468 }
1469
1470
1471
1472 template <int dim, typename Number>
1473 inline unsigned int
1474 MatrixFree<dim, Number>::n_cells_per_color(const unsigned int color) const
1475 {
1476 AssertIndexRange(color, n_cells.size());
1477 return n_cells[color];
1478 }
1479
1480
1481
1482 template <int dim, typename Number>
1483 inline bool
1485 {
1486 return overlap_communication_computation;
1487 }
1488
1489#endif
1490
1491} // namespace Portable
1492
1494
1495#endif
unsigned int n_blocks() const
BlockType & block(const unsigned int i)
Abstract base class for mapping classes.
Definition mapping.h:318
DeviceBlockVector(const DeviceBlockVector &other)=default
Kokkos::Array< DeviceVector< Number >, n_max_dof_handlers > blocks
const DeviceVector< Number > & block(unsigned int index) const
DeviceBlockVector(const DeviceVector< Number > &src)
DeviceVector< Number > & block(unsigned int index)
DeviceBlockVector(const LinearAlgebra::distributed::BlockVector< Number, MemorySpace > &src)
void copy_constrained_values(const VectorType &src, VectorType &dst, const unsigned int dof_handler_index=0) const
const std::vector< std::vector< CellFilter > > & get_colored_graph() const
unsigned int get_mg_level() const
void copy_constrained_values(const LinearAlgebra::distributed::BlockVector< Number, MemorySpace::Default > &src, LinearAlgebra::distributed::BlockVector< Number, MemorySpace::Default > &dst) const
std::vector< std::vector< CellFilter > > graph
void reinit(const DoFHandler< dim > &dof_handler, const AffineConstraints< Number > &constraints, const Quadrature< 1 > &quad, const AdditionalData &additional_data=AdditionalData())
void reinit(const Mapping< dim > &mapping, const std::vector< const DoFHandler< dim > * > &dof_handler, const std::vector< const AffineConstraints< Number > * > &constraints, const Quadrature< 1 > &quad, const IteratorFiltersType &iterator_filter, const AdditionalData &additional_data=AdditionalData())
DoFHandler< dim >::cell_iterator get_cell_iterator(const unsigned int color, const unsigned int index, const unsigned int dof_handler_index=0) const
void reinit(const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const AffineConstraints< Number > &constraints, const Quadrature< 1 > &quad, const IteratorFiltersType &iterator_filter, const AdditionalData &additional_data=AdditionalData())
std::vector< std::vector< LevelCellFilter > > level_graph
bool use_overlap_communication_computation() const
PrecomputedData get_data(const unsigned int color, const unsigned int dof_handler_index=0) const
void distributed_cell_loop(const Functor &func, const LinearAlgebra::distributed::Vector< Number, MemorySpace::Default > &src, LinearAlgebra::distributed::Vector< Number, MemorySpace::Default > &dst) const
std::size_t memory_consumption() const
void initialize_dof_vector(LinearAlgebra::distributed::Vector< Number, MemorySpaceType > &vec, const unsigned int dof_handler_index=0) const
void distributed_cell_loop(const Functor &func, const LinearAlgebra::distributed::BlockVector< Number, MemorySpace::Default > &src, LinearAlgebra::distributed::BlockVector< Number, MemorySpace::Default > &dst) const
std::vector< unsigned int > first_cell
void serial_cell_loop(const Functor &func, const VectorType &src, VectorType &dst) const
void initialize_dof_vector(LinearAlgebra::distributed::BlockVector< Number, MemorySpaceType > &vec) const
const std::shared_ptr< const Utilities::MPI::Partitioner > & get_vector_partitioner(const unsigned int dof_handler_index=0) const
void evaluate_coefficients(Functor func) const
std::vector< DoFInfo > dof_handler_data
DataHost< dim, Number > copy_mf_data_to_host(const typename::Portable::MatrixFree< dim, Number >::PrecomputedData &data, const UpdateFlags &update_flags)
const DoFHandler< dim > & get_dof_handler(const unsigned int dof_handler_index=0) const
void reinit(const Mapping< dim > &mapping, const std::vector< const DoFHandler< dim > * > &dof_handler, const std::vector< const AffineConstraints< Number > * > &constraints, const Quadrature< 1 > &quad, const AdditionalData &additional_data=AdditionalData())
void internal_reinit(const Mapping< dim > &mapping, const std::vector< const DoFHandler< dim > * > &dof_handler, const std::vector< const AffineConstraints< Number > * > &constraints, const Quadrature< 1 > &quad, const IteratorFiltersType &iterator_filter, const std::shared_ptr< const MPI_Comm > &comm, const AdditionalData additional_data)
void set_constrained_values(const Number value, VectorType &dst, const unsigned int dof_handler_index=0) const
std::vector< MappingInfo > mapping_info
void reinit(const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const AffineConstraints< Number > &constraints, const Quadrature< 1 > &quad, const AdditionalData &additional_data=AdditionalData())
unsigned int n_cells_per_color(const unsigned int color) const
std::vector< unsigned int > n_cells
const std::vector< std::vector< LevelCellFilter > > & get_colored_level_graph() const
void cell_loop(const Functor &func, const VectorType &src, VectorType &dst) const
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_HOST_DEVICE
Definition config.h:171
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
unsigned int cell_index
#define Assert(cond, exc)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcNotInitialized()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
typename ActiveSelector::cell_iterator cell_iterator
UpdateFlags
@ update_JxW_values
Transformed quadrature weights.
@ update_gradients
Shape function gradients.
@ update_quadrature_points
Transformed quadrature points.
std::vector< index_type > data
Definition mpi.cc:734
std::size_t size
Definition mpi.cc:733
const MPI_Comm comm
Definition mpi.cc:912
constexpr unsigned int n_max_dof_handlers
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > DeviceVector
std::string to_string(const number value, const unsigned int digits=numbers::invalid_unsigned_int)
Definition utilities.cc:473
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
Definition tria.cc:15809
constexpr unsigned int invalid_unsigned_int
Definition types.h:228
::Kokkos::DefaultExecutionSpace::memory_space kokkos_space
Kokkos::View<::internal::MatrixFreeFunctions::ConstraintKinds *, MemorySpace::Default::kokkos_space >::host_mirror_type constraint_mask
Kokkos::View< Number *, MemorySpace::Default::kokkos_space >::host_mirror_type q_weights
Kokkos::View< types::global_dof_index **, MemorySpace::Default::kokkos_space >::host_mirror_type local_to_global
Kokkos::View< unsignedint *, MemorySpace::Default::kokkos_space >::host_mirror_type data_index_offsets
Kokkos::View< Number *, MemorySpace::Default::kokkos_space >::host_mirror_type JxW
Point< dim, Number > get_quadrature_point(const unsigned int cell, const unsigned int q_point) const
Kokkos::View<::internal::MatrixFreeFunctions::GeometryType *, MemorySpace::Default::kokkos_space >::host_mirror_type cell_type
Kokkos::View< Point< dim, Number > **, MemorySpace::Default::kokkos_space >::host_mirror_type q_points
Kokkos::View< Number *[dim][dim], MemorySpace::Default::kokkos_space >::host_mirror_type inv_jacobian
unsigned int inv_jacobian_index(const unsigned int cell, const unsigned int q_point) const
Number JxW_value(const unsigned int cell, const unsigned int q_point) const
unsigned int local_q_point_id(const unsigned int cell, const unsigned int n_q_points, const unsigned int q_point) const
AdditionalData(const UpdateFlags mapping_update_flags=update_gradients|update_JxW_values|update_quadrature_points, const bool use_coloring=false, const bool overlap_communication_computation=false, const unsigned int mg_level=numbers::invalid_unsigned_int, const unsigned int team_size=numbers::invalid_unsigned_int)
unsigned int local_q_point_id(const unsigned int cell, const unsigned int q_point) const
Kokkos::Array< SharedData< dim, Number >, n_max_dof_handlers > & shared_data
void for_each_quad_point(const Functor &func) const
Kokkos::TeamPolicy< MemorySpace::Default::kokkos_space::execution_space >::member_type TeamHandle
const Kokkos::Array< PrecomputedData, n_max_dof_handlers > & precomputed_data
Portable::MatrixFree< dim, Number >::point_type & get_quadrature_point(const unsigned int cell, const unsigned int q_point) const
::internal::MatrixFreeFunctions::ElementType element_type
std::shared_ptr< const Utilities::MPI::Partitioner > partitioner
std::vector< Kokkos::View<::internal::MatrixFreeFunctions::ConstraintKinds *, MemorySpace::Default::kokkos_space > > constraint_mask
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > shape_gradients
std::vector< Kokkos::View< types::global_dof_index **, MemorySpace::Default::kokkos_space > > local_to_global
const DoFHandler< dim > * dof_handler
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > constraint_weights
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > co_shape_gradients
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > shape_values
Kokkos::View< types::global_dof_index *, MemorySpace::Default::kokkos_space > constrained_dofs
std::vector< Kokkos::View<::internal::MatrixFreeFunctions::GeometryType *, MemorySpace::Default::kokkos_space > > cell_type
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > q_weights
std::vector< Kokkos::View< Number *[dim][dim], MemorySpace::Default::kokkos_space > > inv_jacobian
std::vector< Kokkos::View< unsigned int *, MemorySpace::Default::kokkos_space > > data_index_offsets
std::vector< Kokkos::View< Number *, MemorySpace::Default::kokkos_space > > JxW
std::vector< Kokkos::View< point_type **, MemorySpace::Default::kokkos_space > > q_points
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > shape_gradients
Kokkos::View< point_type **, MemorySpace::Default::kokkos_space > q_points
Number JxW_value(const int cell, const int q_point) const
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > shape_values
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > JxW
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > constraint_weights
Kokkos::View<::internal::MatrixFreeFunctions::GeometryType *, MemorySpace::Default::kokkos_space > cell_type
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > co_shape_gradients
Kokkos::View< Number *, MemorySpace::Default::kokkos_space > q_weights
::internal::MatrixFreeFunctions::ElementType element_type
unsigned int inv_jacobian_index(const int cell, const int q_point) const
Kokkos::View<::internal::MatrixFreeFunctions::ConstraintKinds *, MemorySpace::Default::kokkos_space > constraint_mask
Kokkos::View< Number *[dim][dim], MemorySpace::Default::kokkos_space > inv_jacobian
Kokkos::View< unsigned int *, MemorySpace::Default::kokkos_space > data_index_offsets
Kokkos::View< types::global_dof_index **, MemorySpace::Default::kokkos_space > local_to_global
Kokkos::View< Number ***, MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedViewGradients
SharedViewScratchPad scratch_pad
Kokkos::View< Number *, MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedViewScratchPad
void reinit(const TeamHandle &team_handle, const unsigned int n_q_points, const typename MatrixFree< dim, Number >::PrecomputedData &gpu_data)
Kokkos::TeamPolicy< MemorySpace::Default::kokkos_space::execution_space >::member_type TeamHandle
Kokkos::View< Number **, MemorySpace::Default::kokkos_space::execution_space::scratch_memory_space, Kokkos::MemoryTraits< Kokkos::Unmanaged > > SharedViewValues
SharedViewGradients gradients