Tpetra parallel linear algebra
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
core
src
Tpetra_Assembly_Helpers.hpp
1
// @HEADER
2
// *****************************************************************************
3
// Tpetra: Templated Linear Algebra Services Package
4
//
5
// Copyright 2008 NTESS and the Tpetra contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef TPETRA_ASSEMBLY_HELPERS_HPP
11
#define TPETRA_ASSEMBLY_HELPERS_HPP
12
13
namespace
Tpetra
{
14
15
namespace
Impl
{
16
// Helper function to to apply an operation to each member of a
17
// c++11 parameter pack since parameter expansion only happens
18
// within functions, constructors, and initializer_lists
19
template
<
typename
... Args>
20
inline
void
foreach_pack(Args &&...args) {}
21
}
// namespace Impl
22
23
template
<
typename
... Args>
24
void
beginAssembly(Args &&...args) {
25
// use the comma operator to transform a potentially void function call
26
// into a argument to allow proper parameter expansion for c++11
27
Impl::foreach_pack((args.beginAssembly(), 1)...);
28
29
// using c++17 the code would be
30
// (args.beginAssembly()...);
31
}
32
33
template
<
typename
... Args>
34
void
endAssembly(Args &&...args) {
35
// use the comma operator to transform a potentially void function call
36
// into a argument to allow proper parameter expansion for c++11
37
Impl::foreach_pack((args.endAssembly(), 1)...);
38
39
// using c++17 the code would be
40
// (args.endAssembly()...);
41
}
42
43
template
<
typename
... Args>
44
void
beginModify(Args &&...args) {
45
// use the comma operator to transform a potentially void function call
46
// into a argument to allow proper parameter expansion for c++11
47
Impl::foreach_pack((args.beginModify(), 1)...);
48
49
// using c++17 the code would be
50
// (args.beginModify()...);
51
}
52
53
template
<
typename
... Args>
54
void
endModify(Args &&...args) {
55
// use the comma operator to transform a potentially void function call
56
// into a argument to allow proper parameter expansion for c++11
57
Impl::foreach_pack((args.endModify(), 1)...);
58
59
// using c++17 the code would be
60
// (args.endModify()...);
61
}
62
63
}
// namespace Tpetra
64
65
#endif
// TPETRA_ASSEMBLY_HELPERS_HPP
Tpetra::Impl
Namespace for new Tpetra features that are not ready for public release, but are ready for evaluation...
Definition
Tpetra_Assembly_Helpers.hpp:15
Tpetra
Namespace Tpetra contains the class and methods constituting the Tpetra library.
Generated by
1.17.0