Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ConstituentItemVectorImpl.h
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/* ConstituentItemVectorImpl.h (C) 2000-2024 */
9/* */
10/* Implementation of 'IConstituentItemVectorImpl'. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MATERIALS_INTERNAL_CONSTITUENTITEMVECTORIMPL_H
13#define ARCANE_MATERIALS_INTERNAL_CONSTITUENTITEMVECTORIMPL_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
18
19#include "arcane/utils/TraceAccessor.h"
20#include "arcane/utils/Functor.h"
21
22#include "arcane/core/materials/ComponentItemVector.h"
23#include "arcane/core/materials/internal/ConstituentItemLocalIdList.h"
24
25#include "arcane/materials/internal/MeshComponentPartData.h"
26
27#include <tuple>
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
32namespace Arcane::Materials
33{
34
35/*---------------------------------------------------------------------------*/
36/*---------------------------------------------------------------------------*/
37
41class ConstituentItemVectorImpl
44{
46
47 public:
48
49 explicit ConstituentItemVectorImpl(IMeshComponent* component);
50 explicit ConstituentItemVectorImpl(const ComponentItemVectorView& rhs);
51
52 public:
53
54 ConstituentItemVectorImpl(const ConstituentItemVectorImpl& rhs) = delete;
55 ConstituentItemVectorImpl(ConstituentItemVectorImpl&& rhs) = delete;
56 ConstituentItemVectorImpl& operator=(const ConstituentItemVectorImpl& rhs) = delete;
57
58 private:
59
60 ComponentItemVectorView _view() const override;
61 ComponentPurePartItemVectorView _pureItems() const override
62 {
63 return m_part_data->pureView();
64 }
65
66 ComponentImpurePartItemVectorView _impureItems() const override
67 {
68 return m_part_data->impureView();
69 }
70 ConstArrayView<Int32> _localIds() const override { return m_items_local_id.constView(); }
71 IMeshMaterialMng* _materialMng() const override { return m_material_mng; }
72 IMeshComponent* _component() const override { return m_component; }
73 ConstituentItemLocalIdListView _constituentItemListView() const override
74 {
75 return m_constituent_list->view();
76 }
77 ConstArrayView<MatVarIndex> _matvarIndexes() const override
78 {
79 return m_matvar_indexes;
80 }
81
82 public:
83
84 class SetItemHelper;
85 // Methods that must be public for compilation with NVCC.
86 void _setItems(SmallSpan<const Int32> local_ids) override;
87 void _computeNbPureAndImpure(SmallSpan<const Int32> local_ids, RunQueue& queue);
88
89 private:
90
92 void _recomputePartData();
93
94 public:
95
96 IMeshMaterialMng* m_material_mng = nullptr;
97 IMeshComponent* m_component = nullptr;
98 UniqueArray<MatVarIndex> m_matvar_indexes;
99 UniqueArray<Int32> m_items_local_id;
100 std::unique_ptr<MeshComponentPartData> m_part_data;
101 std::unique_ptr<ConstituentItemLocalIdList> m_constituent_list;
102 ComponentItemSharedInfo* m_component_shared_info = nullptr;
103
104 FunctorT<ConstituentItemVectorImpl> m_recompute_part_data_functor;
105 // Only useful for on-the-fly recalculation
106 Int32 m_nb_pure = 0;
107 // Only useful for on-the-fly recalculation
108 Int32 m_nb_impure = 0;
109};
110
111/*---------------------------------------------------------------------------*/
112/*---------------------------------------------------------------------------*/
113
114} // End namespace Arcane::Materials
115
116/*---------------------------------------------------------------------------*/
117/*---------------------------------------------------------------------------*/
118
119#endif
#define ARCCORE_DEFINE_REFERENCE_COUNTED_INCLASS_METHODS()
Macro to define methods managing counters of references.
Constant view of an array of type T.
Functor associated with a method of a class T.
View over a vector of entities of a component.
View of a ConstituentItemLocalIdList instance.
void _computeNbPureAndImpureLegacy(SmallSpan< const Int32 > local_ids)
Calculates the number of pure and impure cells without the accelerator API.
void _setItems(SmallSpan< const Int32 > local_ids) override
Positions the vector entities.
Interface for the implementation of ComponentItemVector.
Interface of a component (material or environment) of a mesh.
Interface for the material and environment manager of a mesh.
Thread-safe implementation of a reference counter.
View of an array of elements of type T.
Definition Span.h:805
1D data vector with value semantics (STL style).
Always enables tracing in Arcane parts concerning materials.
std::int32_t Int32
Signed integer type of 32 bits.