Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
MeshBlock.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/* MeshBlock.cc (C) 2000-2016 */
9/* */
10/* Bloc d'un maillage. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ArgumentException.h"
15
16#include "arcane/IMesh.h"
17
18#include "arcane/materials/MeshBlock.h"
19#include "arcane/materials/IMeshMaterialMng.h"
20#include "arcane/materials/MatItemEnumerator.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28ARCANE_BEGIN_NAMESPACE
29MATERIALS_BEGIN_NAMESPACE
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
37MeshBlock::
38MeshBlock(IMeshMaterialMng* mm,Int32 block_id,const MeshBlockBuildInfo& info)
39: TraceAccessor(mm->traceMng())
40, m_material_mng(mm)
41, m_block_id(block_id)
42, m_name(info.name())
43, m_cells(info.cells())
44, m_environments(info.environments())
45{
46}
47
48/*---------------------------------------------------------------------------*/
49/*---------------------------------------------------------------------------*/
50
51void MeshBlock::
52build()
53{
54}
55
56/*---------------------------------------------------------------------------*/
57/*---------------------------------------------------------------------------*/
58
60view()
61{
62 return m_material_mng->view(m_cells);
63}
64
65/*---------------------------------------------------------------------------*/
66/*---------------------------------------------------------------------------*/
73void MeshBlock::
74addEnvironment(IMeshEnvironment* env)
75{
76 if (m_environments.contains(env))
77 throw ArgumentException(A_FUNCINFO,
78 String::format("environment {0} already in block {1}",
79 env->name(),this->name()));
80 m_environments.add(env);
81}
82
83/*---------------------------------------------------------------------------*/
84/*---------------------------------------------------------------------------*/
91void MeshBlock::
92removeEnvironment(IMeshEnvironment* env)
93{
94 Integer index = -1;
95 for( Integer i=0, n=m_environments.size(); i<n; ++i )
96 if (m_environments[i]==env){
97 index = i;
98 break;
99 }
100 if (index==(-1))
101 throw ArgumentException(A_FUNCINFO,
102 String::format("environment {0} not in block {1}",
103 env->name(),this->name()));
104 m_environments.remove(index);
105}
106
107/*---------------------------------------------------------------------------*/
108/*---------------------------------------------------------------------------*/
109
110MATERIALS_END_NAMESPACE
111ARCANE_END_NAMESPACE
112
113/*---------------------------------------------------------------------------*/
114/*---------------------------------------------------------------------------*/
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Vue sur une liste de mailles avec infos sur les milieux.
Exception lorsqu'un argument est invalide.