Arcane  v3.16.0.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
MshMeshGenerationInfo.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 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/* MshMeshGenerationInfo.cc (C) 2000-2025 */
9/* */
10/* Informations d'un maillage issu du format 'msh'. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/core/internal/MshMeshGenerationInfo.h"
15
16#include "arcane/utils/IUserDataList.h"
17#include "arcane/utils/AutoDestroyUserData.h"
18#include "arcane/utils/FatalErrorException.h"
19
20#include "arcane/core/IMesh.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25namespace Arcane::impl
26{
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31MshMeshGenerationInfo::
32MshMeshGenerationInfo(IMesh* mesh)
33: m_mesh(mesh)
34{
35}
36
37/*---------------------------------------------------------------------------*/
38/*---------------------------------------------------------------------------*/
39
40MshMeshGenerationInfo* MshMeshGenerationInfo::
41getReference(IMesh* mesh, bool create)
42{
43 const char* name = "MshMeshGenerationInfo";
44 IUserDataList* udlist = mesh->userDataList();
45
46 IUserData* ud = udlist->data(name, true);
47 if (!ud) {
48 if (!create)
49 return nullptr;
50 auto* cm = new MshMeshGenerationInfo(mesh);
51 udlist->setData(name, new AutoDestroyUserData<MshMeshGenerationInfo>(cm));
52 return cm;
53 }
54 auto* adud = dynamic_cast<AutoDestroyUserData<MshMeshGenerationInfo>*>(ud);
55 if (!adud)
56 ARCANE_FATAL("Can not cast to MshMeshGenerationInfo");
57 return adud->data();
58}
59
60/*---------------------------------------------------------------------------*/
61/*---------------------------------------------------------------------------*/
62
63} // namespace Arcane::impl
64
65/*---------------------------------------------------------------------------*/
66/*---------------------------------------------------------------------------*/
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.