Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ItemFamilyPolicyMng.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/* ItemFamilyPolicyMng.cc (C) 2000-2023 */
9/* */
10/* Policy manager for a family of items. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/NotSupportedException.h"
15#include "arcane/utils/NotImplementedException.h"
16#include "arcane/utils/ArgumentException.h"
17
18#include "arcane/core/IItemFamilyCompactPolicy.h"
19
20#include "arcane/mesh/ItemFamilyPolicyMng.h"
21#include "arcane/mesh/ItemsExchangeInfo2.h"
22#include "arcane/mesh/ItemFamily.h"
23#include "arcane/mesh/IndirectItemFamilySerializer.h"
24#include "arcane/mesh/ItemFamilyCompactPolicy.h"
25
26/*---------------------------------------------------------------------------*/
27/*---------------------------------------------------------------------------*/
28
29namespace Arcane::mesh
30{
31
32/*---------------------------------------------------------------------------*/
33/*---------------------------------------------------------------------------*/
34
35ItemFamilyPolicyMng::
36~ItemFamilyPolicyMng()
37{
38 delete m_compact_policy;
39}
40
41/*---------------------------------------------------------------------------*/
42/*---------------------------------------------------------------------------*/
43
46{
47 ItemsExchangeInfo2* exchanger = _createExchanger();
48 for (IItemFamilySerializeStepFactory* factory : m_serialize_step_factories) {
49 IItemFamilySerializeStep* step = factory->createStep(m_item_family);
50 if (step)
51 exchanger->addSerializeStep(step);
52 }
53 return exchanger;
54}
55
56/*---------------------------------------------------------------------------*/
57/*---------------------------------------------------------------------------*/
58
60createSerializer(bool with_flags)
61{
62 if (with_flags)
63 throw NotSupportedException(A_FUNCINFO, "serialisation with 'with_flags==true'");
64 return new IndirectItemFamilySerializer(m_item_family);
65}
66
67/*---------------------------------------------------------------------------*/
68/*---------------------------------------------------------------------------*/
69
72{
73 ARCANE_CHECK_POINTER(factory);
74 m_serialize_step_factories.add(factory);
75}
76
77/*---------------------------------------------------------------------------*/
78/*---------------------------------------------------------------------------*/
79
82{
83 ARCANE_CHECK_POINTER(factory);
84 Integer index = -1;
85 for (Integer i = 0, n = m_serialize_step_factories.size(); i < n; ++i) {
86 if (m_serialize_step_factories[i] == factory) {
87 index = i;
88 break;
89 }
90 }
91 if (index == (-1))
92 throw ArgumentException(A_FUNCINFO, "factory not in list");
93 m_serialize_step_factories.remove(index);
94}
95
96/*---------------------------------------------------------------------------*/
97/*---------------------------------------------------------------------------*/
98
99ItemsExchangeInfo2* ItemFamilyPolicyMng::
100_createExchanger()
101{
102 return new ItemsExchangeInfo2(m_item_family);
103}
104
105/*---------------------------------------------------------------------------*/
106/*---------------------------------------------------------------------------*/
107
108} // namespace Arcane::mesh
109
110/*---------------------------------------------------------------------------*/
111/*---------------------------------------------------------------------------*/
#define ARCANE_CHECK_POINTER(ptr)
Macro returning the pointer ptr if it is not null or throwing an exception if it is null.
Exchange of entities and their characteristics for a given family.
Factory for creating a step in the serialization of entity families.
Interface for a step in the serialization of entity families.
Manages the serialization/deserialization of entities in a family.
Indirect serialization/deserialization of entity families.
void addSerializeStep(IItemFamilySerializeStepFactory *factory) override
Adds a factory for a serialization step.
IItemFamilySerializer * createSerializer(bool with_flags) override
Creates an instance for entity serialization. The returned instance must be destroyed by the delete o...
void removeSerializeStep(IItemFamilySerializeStepFactory *factory) override
Removes a factory for a serialization step.
IItemFamilyExchanger * createExchanger() override
Creates an instance for exchanging entities between subdomains. The returned instance must be destroy...
Information for exchanging entities of a given family and their characteristics.
Int32 Integer
Type representing an integer.