Arcane  v3.16.0.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ItemTools.cc
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/* ItemTools.cc (C) 2000-2020 */
9/* */
10/* Utilitaires aidant à retrouver des items à partir d'autres */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ArcanePrecomp.h"
15
16#include "arcane/Item.h"
17#include "arcane/mesh/ItemTools.h"
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22namespace Arcane::mesh
23{
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
29isSameFace(Face face, Int64ConstArrayView face_nodes_uid)
30{
31 Integer index = 0;
32 for( Node node : face.nodes() ){
33 if (node.uniqueId()!=face_nodes_uid[index])
34 return false;
35 ++index;
36 }
37 return true;
38}
39
40/*---------------------------------------------------------------------------*/
41/*---------------------------------------------------------------------------*/
42
44findFaceInNode2(Node node,Integer face_type_id,
45 Int64ConstArrayView face_nodes_uid)
46{
47 for( Face current_face : node.faces() ){
48 if (current_face.type()!=face_type_id)
49 continue;
50 if (isSameFace(current_face,face_nodes_uid))
51 return current_face;
52 }
53 return Face();
54}
55
56/*---------------------------------------------------------------------------*/
57/*---------------------------------------------------------------------------*/
58
60findFaceInNode(Node node, Integer face_type_id,
61 Int64ConstArrayView face_nodes_uid)
62{
63 Face face = findFaceInNode2(node, face_type_id, face_nodes_uid);
64 if (face.null())
65 return nullptr;
66 return ItemCompatibility::_itemInternal(face);
67}
68
69/*---------------------------------------------------------------------------*/
70/*---------------------------------------------------------------------------*/
71
73findEdgeInNode2(Node node,Int64 begin_node,Int64 end_node)
74{
75 for( Edge edge : node.edges() )
76 if (edge.node(0).uniqueId()==begin_node && edge.node(1).uniqueId()==end_node)
77 return edge;
78 return Edge();
79}
80
81/*---------------------------------------------------------------------------*/
82/*---------------------------------------------------------------------------*/
83
85findEdgeInNode(Node node, Int64 begin_node, Int64 end_node)
86{
87 Edge edge = findEdgeInNode2(node, begin_node, end_node);
88 if (edge.null())
89 return nullptr;
90 return ItemCompatibility::_itemInternal(edge);
91}
92
93/*---------------------------------------------------------------------------*/
94/*---------------------------------------------------------------------------*/
95
96} // End namespace Arcane::mesh
97
98/*---------------------------------------------------------------------------*/
99/*---------------------------------------------------------------------------*/
Arête d'une maille.
Definition Item.h:809
Face d'une maille.
Definition Item.h:944
Structure interne d'une entité de maillage.
NodeConnectedListViewType nodes() const
Liste des noeuds de l'entité
Definition Item.h:782
constexpr bool null() const
true si l'entité est nul (i.e. non connecté au maillage)
Definition Item.h:216
Noeud d'un maillage.
Definition Item.h:573
FaceConnectedListViewType faces() const
Liste des faces du noeud.
Definition Item.h:677
EdgeConnectedListViewType edges() const
Liste des arêtes du noeud.
Definition Item.h:674
static ItemInternal * findFaceInNode(Node node, Integer face_type_id, Int64ConstArrayView face_nodes_uid)
Definition ItemTools.cc:60
static ItemInternal * findEdgeInNode(Node node, Int64 begin_node, Int64 end_node)
Definition ItemTools.cc:85
static Edge findEdgeInNode2(Node node, Int64 begin_node, Int64 end_node)
Definition ItemTools.cc:73
static Face findFaceInNode2(Node node, Integer face_type_id, Int64ConstArrayView face_nodes_uid)
Definition ItemTools.cc:44
static bool isSameFace(Face face, Int64ConstArrayView face_nodes_uid)
Definition ItemTools.cc:29
std::int64_t Int64
Type entier signé sur 64 bits.
Int32 Integer
Type représentant un entier.
ConstArrayView< Int64 > Int64ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 64 bits.
Definition UtilsTypes.h:567