Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
MeshCompactMng.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/* MeshCompactMng.cc (C) 2000-2020 */
9/* */
10/* Mesh family compaction manager. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/mesh/MeshCompactMng.h"
15
16#include "arcane/utils/FatalErrorException.h"
17#include "arcane/utils/TraceInfo.h"
18
19#include "arcane/core/IParallelMng.h"
20
21#include "arcane/mesh/MeshCompacter.h"
22#include "arcane/mesh/DynamicMesh.h"
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
27namespace Arcane::mesh
28{
29
30/*---------------------------------------------------------------------------*/
31/*---------------------------------------------------------------------------*/
32
33MeshCompactMng::
34MeshCompactMng(IMesh* mesh)
35: TraceAccessor(mesh->traceMng())
36, m_mesh(mesh)
37, m_compacter(nullptr)
38{
39}
40
41/*---------------------------------------------------------------------------*/
42/*---------------------------------------------------------------------------*/
43
44MeshCompactMng::
45~MeshCompactMng()
46{
47}
48
49/*---------------------------------------------------------------------------*/
50/*---------------------------------------------------------------------------*/
51
52IMeshCompacter* MeshCompactMng::
53beginCompact()
54{
55 if (m_compacter)
56 ARCANE_FATAL("Already compacting");
57 MeshCompacter* c = new MeshCompacter(m_mesh, m_mesh->parallelMng()->timeStats());
58 return _setCompacter(c);
59}
60
61/*---------------------------------------------------------------------------*/
62/*---------------------------------------------------------------------------*/
63
64IMeshCompacter* MeshCompactMng::
65beginCompact(IItemFamily* family)
66{
67 if (m_compacter)
68 ARCANE_FATAL("Already compacting");
69 MeshCompacter* c = new MeshCompacter(family, m_mesh->parallelMng()->timeStats());
70 return _setCompacter(c);
71}
72
73/*---------------------------------------------------------------------------*/
74/*---------------------------------------------------------------------------*/
75
76void MeshCompactMng::
77endCompact()
78{
79 if (!m_compacter)
80 ARCANE_FATAL("Can not call endCompact() without calling beginCompact() before");
81 delete m_compacter;
82 m_compacter = nullptr;
83}
84
85/*---------------------------------------------------------------------------*/
86/*---------------------------------------------------------------------------*/
87
88IMesh* MeshCompactMng::
89mesh() const
90{
91 return m_mesh;
92}
93
94/*---------------------------------------------------------------------------*/
95/*---------------------------------------------------------------------------*/
96
97MeshCompacter* MeshCompactMng::
98_setCompacter(MeshCompacter* c)
99{
100 m_compacter = c;
101 c->build();
102 return c;
103}
104
105/*---------------------------------------------------------------------------*/
106/*---------------------------------------------------------------------------*/
107
108} // End namespace Arcane::mesh
109
110/*---------------------------------------------------------------------------*/
111/*---------------------------------------------------------------------------*/
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Interface of an entity family.
Definition IItemFamily.h:83
virtual IParallelMng * parallelMng() const =0
Associated parallelism manager.
Management of mesh family compaction.
virtual ITimeStats * timeStats() const =0
Associated statistics manager (can be null).
Management of mesh family compaction.