dune-grid  2.11
concepts/datahandle.hh
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 // vi: set et ts=4 sw=2 sts=2:
5 #ifndef DUNE_GRID_CONCEPTS_DATAHANDLE_HH
6 #define DUNE_GRID_CONCEPTS_DATAHANDLE_HH
7 
8 #include <concepts>
9 
13 
14 namespace Dune::Concept {
15 
16 template <class DH>
17 concept CommDataHandle = requires(const DH chandle, const Archetypes::Entity<2,0>& entity)
18 {
19  typename DH::DataType;
20 
21  { chandle.contains(/*dim*/ 0, /*codim*/ 0) } -> std::convertible_to<bool>;
22  { chandle.fixedSize(/*dim*/ 0, /*codim*/ 0) } -> std::convertible_to<bool>;
23  { chandle.size(entity) } -> std::integral;
24 
25  requires requires(DH handle, Archetypes::MessageBuffer<typename DH::DataType> buffer)
26  {
27  handle.gather(buffer, entity);
28  handle.scatter(buffer, entity, /*size*/ 0u);
29  };
30 };
31 
32 static_assert(CommDataHandle< Archetypes::CommDataHandle<double> >);
33 
34 } // end namespace Dune::Concept
35 
36 
37 #endif // DUNE_GRID_CONCEPTS_DATAHANDLE_HH
concept CommDataHandle
Definition: concepts/datahandle.hh:17
Definition: concepts/datahandle.hh:14