Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
ConstituentItemIndexedSelectionView.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/* ConstituentItemIndexedSelectionView.cc (C) 2000-2026 */
9/* */
10/* View over a subset of a ConstituentItem container. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/core/materials/ConstituentItemIndexedSelectionView.h"
15
16#include "arcane/utils/FatalErrorException.h"
17
18#include "arcane/core/materials/internal/IMeshMaterialMngInternal.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane::Materials
24{
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29ConstituentItemIndexedSelectionViewBase::
30ConstituentItemIndexedSelectionViewBase(IndexArrayView indices)
31: m_selection_view(indices)
32{
33}
34
35/*---------------------------------------------------------------------------*/
36/*---------------------------------------------------------------------------*/
37
38ConstituentItemIndexedSelectionViewBase::
39ConstituentItemIndexedSelectionViewBase(IMeshComponent* constituent, Int32 selection_size)
40{
41 SmallSpan<const Int32> v = constituent->materialMng()->_internalApi()->identitySelectionView();
42 // Checks that the returned view has a size at least equal to the selection.
43 if (v.size() < selection_size)
44 ARCANE_FATAL("Invalid size for identity selection (selection_size={0} identity={1})",
45 selection_size, v.size());
46 m_selection_view = SmallSpan<const Int32>{ v.data(), selection_size };
47}
48
49/*---------------------------------------------------------------------------*/
50/*---------------------------------------------------------------------------*/
51
52} // End namespace Arcane::Materials
53
54/*---------------------------------------------------------------------------*/
55/*---------------------------------------------------------------------------*/
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Always enables tracing in Arcane parts concerning materials.