Arcane
v3.15.3.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
ItemCompare.h
1
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2
//-----------------------------------------------------------------------------
3
// Copyright 2000-2022 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
/* ItemCompare.h (C) 2000-2010 */
9
/* */
10
/* Routines de comparaisons de deux entités. */
11
/*---------------------------------------------------------------------------*/
12
#ifndef ARCANE_ITEMCOMPARE_H
13
#define ARCANE_ITEMCOMPARE_H
14
/*---------------------------------------------------------------------------*/
15
/*---------------------------------------------------------------------------*/
16
17
#include "arcane/ArcaneTypes.h"
18
19
#include "arcane/Item.h"
20
21
/*---------------------------------------------------------------------------*/
22
/*---------------------------------------------------------------------------*/
23
24
/*---------------------------------------------------------------------------*/
25
/*---------------------------------------------------------------------------*/
26
27
ARCANE_BEGIN_NAMESPACE
28
29
/*---------------------------------------------------------------------------*/
30
/*---------------------------------------------------------------------------*/
31
32
class
ItemCompare
33
{
34
public
:
35
bool
operator()(
const
Item
&
item1
,
const
Item
&
item2
)
const
36
{
37
return
item1
.uniqueId() <
item2
.uniqueId();
38
}
39
bool
operator()(
const
ItemInternal
*
item1
,
const
ItemInternal
*
item2
)
const
40
{
41
return
item1
->uniqueId() <
item2
->uniqueId();
42
}
43
};
44
45
/*---------------------------------------------------------------------------*/
46
/*---------------------------------------------------------------------------*/
47
48
/**
49
* Ordre spécifique pour qu'Item* soit utilisé dans un set.
50
* Nous utilisons l'id, mais le premier tri est par niveau.
51
* Ceci garantit,en traversant l'ensemble du début à la fin,
52
* de rencontrer les éléments (parent) de niveau inférieur d'abord.
53
*/
54
class
CompareItemIdsByLevel
55
{
56
public
:
57
bool
operator()(
const
Cell
&
item1
,
const
Cell
&
item2
)
const
58
{
59
const
Integer
i1_l
=
item1
.level(),
i2_l
=
item2
.level();
60
Int64
i1_id
=
item1
.uniqueId();
61
Int64
i2_id
=
item2
.uniqueId();
62
63
return
(
i1_l
==
i2_l
) ?
i1_id
<
i2_id
:
i1_l
<
i2_l
;
64
}
65
66
bool
operator()(
const
ItemInternal
*
item1
,
const
ItemInternal
*
item2
)
const
67
{
68
ARCANE_CHECK_PTR(
item1
);
69
ARCANE_CHECK_PTR(
item2
);
70
const
Integer
i1_l
=
item1
->level(),
i2_l
=
item2
->level();
71
Int64
i1_id
=
item1
->uniqueId();
72
Int64
i2_id
=
item2
->uniqueId();
73
74
return
(
i1_l
==
i2_l
) ?
i1_id
<
i2_id
:
i1_l
<
i2_l
;
75
}
76
};
77
78
/*---------------------------------------------------------------------------*/
79
/*---------------------------------------------------------------------------*/
80
81
ARCANE_END_NAMESPACE
82
83
/*---------------------------------------------------------------------------*/
84
/*---------------------------------------------------------------------------*/
85
86
#endif
Arcane::Cell
Maille d'un maillage.
Definition
Item.h:1191
Arcane::CompareItemIdsByLevel
Definition
ItemCompare.h:55
Arcane::ItemCompare
Definition
ItemCompare.h:33
Arcane::ItemInternal
Definition
ItemInternal.h:908
Arcane::Item
Classe de base d'un élément de maillage.
Definition
Item.h:83
Arccore::Ref
Référence à une instance.
Definition
arccore/src/base/arccore/base/Ref.h:143
arcane
core
ItemCompare.h
Généré le Lundi 10 Février 2025 02:47:08 pour Arcane par
1.9.8