Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
VariableCollection.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/* VariableCollection.cc (C) 2000-2019 */
9/* */
10/* Classe de base d'un élément du maillage. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/VariableCollection.h"
15
16/*---------------------------------------------------------------------------*/
17/*---------------------------------------------------------------------------*/
18
19namespace Arcane
20{
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28VariableCollection::
29VariableCollection()
30: m_p(new Impl())
31{
32}
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
37VariableCollection::
38VariableCollection(const Enumerator& rhs)
39: m_p(new Impl())
40{
41 _values().copy(rhs.m_collection);
42}
43
44/*---------------------------------------------------------------------------*/
45/*---------------------------------------------------------------------------*/
46
47void VariableCollection::
48sortByName(bool is_ascendent)
49{
50 Array<IVariable*>& v = _values();
51 auto sort_func = [](IVariable* v1,IVariable* v2){
52 return v1->fullName() < v2->fullName();
53 };
54
55 if (is_ascendent)
56 std::sort(v.begin(),v.end(),sort_func);
57 else
58 std::sort(v.rbegin(),v.rend(),sort_func);
59}
60
61/*---------------------------------------------------------------------------*/
62/*---------------------------------------------------------------------------*/
63
64/*---------------------------------------------------------------------------*/
65/*---------------------------------------------------------------------------*/
66
67VariableCollectionEnumerator::
68VariableCollectionEnumerator(const VariableCollection& col)
69: m_index(-1)
70, m_collection(col._values())
71{
72 m_count = m_collection.size();
73}
74
75/*---------------------------------------------------------------------------*/
76/*---------------------------------------------------------------------------*/
77
78} // End namespace Arcane
79
80/*---------------------------------------------------------------------------*/
81/*---------------------------------------------------------------------------*/
Interface d'une variable.
Definition IVariable.h:54
virtual String fullName() const =0
Nom complet de la variable (avec le préfixe de la famille)
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Collection de variables.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-