Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
MeshExchangeMng.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/* MeshExchangeMng.cc (C) 2000-2024 */
9/* */
10/* Mesh exchange manager between sub-domains. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/FatalErrorException.h"
15#include "arcane/utils/TraceInfo.h"
16
17#include "arcane/core/ISubDomain.h"
18
19#include "arcane/mesh/MeshExchangeMng.h"
20#include "arcane/mesh/MeshExchanger.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane::mesh
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31MeshExchangeMng::
32MeshExchangeMng(IMesh* mesh)
33: TraceAccessor(mesh->traceMng())
34, m_mesh(mesh)
35, m_exchanger(nullptr)
36{
37}
38
39/*---------------------------------------------------------------------------*/
40/*---------------------------------------------------------------------------*/
41
42MeshExchangeMng::
43~MeshExchangeMng()
44{
45}
46
47/*---------------------------------------------------------------------------*/
48/*---------------------------------------------------------------------------*/
49
50IMeshExchanger* MeshExchangeMng::
51beginExchange()
52{
53 if (m_exchanger)
54 ARCANE_FATAL("Already in an exchange");
55 IMeshExchanger* ex = _createExchanger();
56 m_exchanger = ex;
57 return m_exchanger;
58}
59
60/*---------------------------------------------------------------------------*/
61/*---------------------------------------------------------------------------*/
62
63IMeshExchanger* MeshExchangeMng::
64_createExchanger()
65{
66 MeshExchanger* ex = new MeshExchanger(m_mesh, m_mesh->subDomain()->timeStats());
67 ex->build();
68 return ex;
69}
70
71/*---------------------------------------------------------------------------*/
72/*---------------------------------------------------------------------------*/
73
74void MeshExchangeMng::
75endExchange()
76{
77 if (!m_exchanger)
78 ARCANE_FATAL("Can not call endExchange() without calling beginExchange() before");
79 delete m_exchanger;
80 m_exchanger = nullptr;
81}
82
83/*---------------------------------------------------------------------------*/
84/*---------------------------------------------------------------------------*/
85
86IPrimaryMesh* MeshExchangeMng::
87mesh() const
88{
89 return m_mesh->toPrimaryMesh();
90}
91
92/*---------------------------------------------------------------------------*/
93/*---------------------------------------------------------------------------*/
94
95} // namespace Arcane::mesh
96
97/*---------------------------------------------------------------------------*/
98/*---------------------------------------------------------------------------*/
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Management of a mesh exchange between subdomains.
virtual IPrimaryMesh * toPrimaryMesh()=0
Returns the instance in the form of an IPrimaryMesh.
Information for a mesh exchange between sub-domains.