14#include "arcane/impl/internal/MeshFactoryMng.h"
16#include "arcane/impl/internal/MeshMng.h"
18#include "arcane/utils/FatalErrorException.h"
20#include "arcane/MeshHandle.h"
21#include "arcane/IPrimaryMesh.h"
22#include "arcane/ServiceBuilder.h"
23#include "arcane/IMeshFactory.h"
24#include "arcane/ItemGroup.h"
25#include "arcane/MeshBuildInfo.h"
37_getMeshFactory(IApplication* app,
const MeshBuildInfo& mbi)
39 String factory_name = mbi.factoryName();
40 ServiceBuilder<IMeshFactory> service_builder(app);
41 Ref<IMeshFactory> mf = service_builder.createReference(factory_name,
SB_AllowNull);
44 service_builder.getServicesNames(valid_names);
45 String valid_str = String::join(
", ",valid_names);
46 ARCANE_FATAL(
"No mesh factory named '{0}' found for creating mesh '{1}'."
47 " Valid values are {2}",
48 factory_name,mbi.name(),valid_str);
58MeshFactoryMng(IApplication* app,MeshMng* mesh_mng)
82 ARCANE_FATAL(
"Can not create mesh with null factoryName()");
105 ARCANE_FATAL(
"Can not create mesh with null parallelMngRef()");
114 ARCANE_FATAL(
"A mesh with same name already exists and is not a primary mesh");
119 Ref<IMeshFactory> mesh_factory(_getMeshFactory(m_application,build_info));
129 IPrimaryMesh* mesh = mesh_factory->createMesh(m_mesh_mng,build_info);
130 m_mesh_mng->addMesh(mesh);
138IPrimaryMesh* MeshFactoryMng::
139_createSubMesh(
const MeshBuildInfo& orig_build_info)
141 ItemGroup group = orig_build_info.parentGroup();
142 IMesh* mesh = group.mesh();
145 if (mesh->meshMng() != m_mesh_mng)
146 ARCANE_FATAL(
"This mesh has not been created by this factory");
147 if (group.isAllItems())
148 ARCANE_FATAL(
"Cannot create sub-mesh from all-items group");
150 MeshBuildInfo build_info(orig_build_info);
151 String name = build_info.
name();
156 Ref<IMeshFactory> mesh_factory(_getMeshFactory(m_application,build_info));
161 m_mesh_mng->createMeshHandle(name);
162 IPrimaryMesh* sub_mesh = mesh_factory->createMesh(m_mesh_mng,build_info);
163 m_mesh_mng->addMesh(sub_mesh);
165 sub_mesh->defineParentForBuild(mesh,group);
167 mesh->addChildMesh(sub_mesh);
#define ARCANE_CHECK_POINTER(ptr)
Macro retournant le pointeur ptr s'il est non nul ou lancant une exception s'il est nul.
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Interface du gestionnaire des maillages.
virtual MeshHandle createMeshHandle(const String &name)=0
Créé et retourne un handle pour un maillage de nom name.
virtual MeshHandle * findMeshHandle(const String &name, bool throw_exception)=0
Recherche le maillage de nom name.
Groupe d'entités de maillage.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Paramètres nécessaires à la construction d'un maillage.
const String & name() const
Nom du nouveau maillage.
MeshBuildInfo & addParallelMng(Ref< IParallelMng > pm)
Positionne le gestionnaire de parallélisme pour créér la maillage.
Chaîne de caractères unicode.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
@ SB_AllowNull
Autorise l'absence du service.
UniqueArray< String > StringUniqueArray
Tableau dynamique à une dimension de chaînes de caractères.
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Créé une référence sur un pointeur.