Arcane  4.2.1.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
ArrayView.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* ArrayView.cc (C) 2000-2026 */
9/* */
10/* Déclarations générales de Arccore. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
15#include "arccore/base/ArgumentException.h"
16#include "arccore/base/TraceInfo.h"
17#include "arccore/base/FatalErrorException.h"
18
19// On n'utilise pas directement ces fichiers mais on les inclus pour tester
20// la compilation. Lorsque les tests seront en place on pourra supprimer
21// ces inclusions
25#include "arccore/base/Span.h"
26#include "arccore/base/Span2.h"
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31/*!
32 * \file Span.h
33 * \brief Types et fonctions associés aux classes SpanImpl, SmallSpan et Span.
34 */
35
36/*!
37 * \file Span2.h
38 * \brief Types et fonctions associés aux classes Span2Impl, Small2Span et Span2.
39 */
40
41/*!
42 * \file ArrayView.h
43 * \brief Types et fonctions associés aux classes ArrayView et ConstArrayView.
44 */
45
46/*!
47 * \file Array2View.h
48 * \brief Types et fonctions associés aux classes Array2View et ConstArray2View.
49 */
50
51/*!
52 * \file Array3View.h
53 * \brief Types et fonctions associés aux classes Array3View et ConstArray3View.
54 */
55
56/*!
57 * \file Array4View.h
58 * \brief Types et fonctions associés aux classes Array4View et ConstArray4View.
59 */
60
61/*---------------------------------------------------------------------------*/
62/*---------------------------------------------------------------------------*/
63
64namespace Arcane
65{
66
67/*---------------------------------------------------------------------------*/
68/*---------------------------------------------------------------------------*/
69
70//! Lance une exception 'ArgumentException'
71ARCCORE_BASE_EXPORT void Impl::
72arccoreThrowTooBigInteger [[noreturn]] (std::size_t size)
73{
74 ARCCORE_THROW(ArgumentException, "value '{0}' too big for Array size", size);
75}
76
77//! Lance une exception 'ArgumentException'
78ARCCORE_BASE_EXPORT void Impl::
79arccoreThrowTooBigInt64 [[noreturn]] (std::size_t size)
80{
81 ARCCORE_THROW(ArgumentException, "value '{0}' too big to fit in Int64", size);
82}
83
84ARCCORE_BASE_EXPORT void Impl::
85arccoreThrowNegativeSize [[noreturn]] (Int64 size)
86{
87 ARCCORE_THROW(ArgumentException, "invalid negative value '{0}' for Array size", size);
88}
89
90/*---------------------------------------------------------------------------*/
91/*---------------------------------------------------------------------------*/
92
93void binaryWrite(std::ostream& ostr, const Span<const std::byte>& bytes)
94{
95 auto* ptr = reinterpret_cast<const char*>(bytes.data());
96 ostr.write(ptr, bytes.size());
97}
98
99/*---------------------------------------------------------------------------*/
100/*---------------------------------------------------------------------------*/
101
102void binaryRead(std::istream& istr, const Span<std::byte>& bytes)
103{
104 auto* ptr = reinterpret_cast<char*>(bytes.data());
105 istr.read(ptr, bytes.size());
106}
107
108/*---------------------------------------------------------------------------*/
109/*---------------------------------------------------------------------------*/
110
111void Impl::ExtentStorageBase::
112_throwBadSize(Int64 wanted_size, Int64 expected_size)
113{
114 ARCCORE_FATAL("Bad size value for fixed extent size={0} expected={1}", wanted_size, expected_size);
115}
116
117/*---------------------------------------------------------------------------*/
118/*---------------------------------------------------------------------------*/
119
120} // namespace Arcane
121
122/*---------------------------------------------------------------------------*/
123/*---------------------------------------------------------------------------*/
#define ARCCORE_FATAL(...)
Macro envoyant une exception FatalErrorException.
#define ARCCORE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
Types et fonctions associés aux classes Span2Impl, Small2Span et Span2.
Types et fonctions associés aux classes SpanImpl, SmallSpan et Span.
Types et fonctions associés aux classes Array2View et ConstArray2View.
Types et fonctions associés aux classes Array3View et ConstArray3View.
Types et fonctions associés aux classes Array4View et ConstArray4View.
Types et fonctions associés aux classes ArrayView et ConstArrayView.
Exception lorsqu'un argument est invalide.
constexpr __host__ __device__ pointer data() const noexcept
Pointeur sur le début de la vue.
Definition Span.h:537
constexpr __host__ __device__ SizeType size() const noexcept
Retourne la taille du tableau.
Definition Span.h:325
Vue d'un tableau d'éléments de type T.
Definition Span.h:633
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Type entier signé sur 64 bits.
void binaryRead(std::istream &istr, const Span< std::byte > &bytes)
Lit en binaire le contenu de bytes depuis le flot istr.
Definition ArrayView.cc:102
void binaryWrite(std::ostream &ostr, const Span< const std::byte > &bytes)
Ecrit en binaire le contenu de bytes sur le flot ostr.
Definition ArrayView.cc:93