diff --git a/arcane/src/arcane/impl/ArcaneBasicMeshSubdividerService.cc b/arcane/src/arcane/impl/ArcaneBasicMeshSubdividerService.cc index 45f7061a8a..46c82e9f0b 100644 --- a/arcane/src/arcane/impl/ArcaneBasicMeshSubdividerService.cc +++ b/arcane/src/arcane/impl/ArcaneBasicMeshSubdividerService.cc @@ -53,7 +53,7 @@ ArcaneBasicMeshSubdividerService(const ServiceBuildInfo& sbi) void ArcaneBasicMeshSubdividerService:: subdivideMesh([[maybe_unused]] IPrimaryMesh* mesh) { - warning() << "Function not implemented"; + warning() << "SubdivideMesh: Function not implemented"; } /*---------------------------------------------------------------------------*/ diff --git a/arcane/src/arcane/impl/ArcaneCaseMeshMasterService.cc b/arcane/src/arcane/impl/ArcaneCaseMeshMasterService.cc index 64cb9f7972..13765421d3 100644 --- a/arcane/src/arcane/impl/ArcaneCaseMeshMasterService.cc +++ b/arcane/src/arcane/impl/ArcaneCaseMeshMasterService.cc @@ -1,22 +1,21 @@ // -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*- //----------------------------------------------------------------------------- -// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com) +// Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com) // See the top-level COPYRIGHT file for details. // SPDX-License-Identifier: Apache-2.0 //----------------------------------------------------------------------------- /*---------------------------------------------------------------------------*/ -/* ArcaneCaseMeshMasterService.h (C) 2000-2020 */ +/* ArcaneCaseMeshMasterService.h (C) 2000-2024 */ /* */ /* Service Arcane gérant les maillages du jeu de données. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ -#include "arcane/ServiceFactory.h" -#include "arcane/ICaseMeshMasterService.h" -#include "arcane/IMeshBuilder.h" -#include "arcane/IMainFactory.h" -#include "arcane/ICaseMeshService.h" -#include "arcane/MeshBuildInfo.h" +#include "arcane/core/ServiceFactory.h" +#include "arcane/core/ICaseMeshMasterService.h" +#include "arcane/core/IMainFactory.h" +#include "arcane/core/ICaseMeshService.h" +#include "arcane/core/MeshBuildInfo.h" #include "arcane/impl/ArcaneCaseMeshMasterService_axl.h" /*---------------------------------------------------------------------------*/ @@ -32,9 +31,14 @@ class ArcaneCaseMeshMasterService : public ArcaneArcaneCaseMeshMasterServiceObject { public: - ArcaneCaseMeshMasterService(const ServiceBuildInfo& sbi) - : ArcaneArcaneCaseMeshMasterServiceObject(sbi), m_sub_domain(sbi.subDomain()){} + + explicit ArcaneCaseMeshMasterService(const ServiceBuildInfo& sbi) + : ArcaneArcaneCaseMeshMasterServiceObject(sbi) + , m_sub_domain(sbi.subDomain()) + {} + private: + void createMeshes() override { if (m_is_created) @@ -71,6 +75,14 @@ class ArcaneCaseMeshMasterService s->partitionMesh(); } + void applyAdditionalOperationsOnMeshes() override + { + if (!m_is_allocated) + ARCANE_FATAL("Meshes are not allocated. call allocateMeshes() before"); + for (ICaseMeshService* s : options()->mesh) + s->applyAdditionalOperations(); + } + ICaseOptions* _options() override { return options()->caseOptions(); diff --git a/arcane/src/arcane/impl/ArcaneCaseMeshService.cc b/arcane/src/arcane/impl/ArcaneCaseMeshService.cc index cf80d93674..bae4bb9424 100644 --- a/arcane/src/arcane/impl/ArcaneCaseMeshService.cc +++ b/arcane/src/arcane/impl/ArcaneCaseMeshService.cc @@ -59,6 +59,7 @@ class ArcaneCaseMeshService void createMesh(const String& default_name) override; void allocateMeshItems() override; void partitionMesh() override; + void applyAdditionalOperations() override; private: @@ -77,6 +78,7 @@ class ArcaneCaseMeshService void _doInitialPartition(); void _doInitialPartition2(const String& name); void _setGhostLayerInfos(); + void _checkMeshCreationAndAllocation(bool is_check_allocated); }; /*---------------------------------------------------------------------------*/ @@ -156,34 +158,54 @@ createMesh(const String& default_name) void ArcaneCaseMeshService:: allocateMeshItems() { - if (!m_mesh) - ARCANE_FATAL("Mesh is not created. You should call createMesh() before"); + _checkMeshCreationAndAllocation(false); + ARCANE_CHECK_POINTER(m_mesh_builder); _setGhostLayerInfos(); m_mesh_builder->allocateMeshItems(m_mesh); + + // TODO: Faire cela après les opérations additionnelles + _initializeVariables(); +} + +/*---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ + +void ArcaneCaseMeshService:: +partitionMesh() +{ + _checkMeshCreationAndAllocation(true); + + if (m_mesh->meshPartInfo().nbPart() > 1) + if (!m_partitioner_name.empty()) + _doInitialPartition(); +} + +/*---------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------*/ + +void ArcaneCaseMeshService:: +applyAdditionalOperations() +{ + _checkMeshCreationAndAllocation(true); + IMeshSubdivider* subdivider = options()->subdivider(); if (subdivider) subdivider->subdivideMesh(m_mesh); - - _initializeVariables(); } /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ void ArcaneCaseMeshService:: -partitionMesh() +_checkMeshCreationAndAllocation(bool is_check_allocated) { if (!m_mesh) ARCANE_FATAL("Mesh is not created. You should call createMesh() before"); - if (!m_mesh->isAllocated()) + if (is_check_allocated && !m_mesh->isAllocated()) ARCANE_FATAL("Mesh is not allocated. You should call initializeMesh() before"); - - if (m_mesh->meshPartInfo().nbPart()>1) - if (!m_partitioner_name.empty()) - _doInitialPartition(); } /*---------------------------------------------------------------------------*/ diff --git a/arcane/src/arcane/impl/SubDomain.cc b/arcane/src/arcane/impl/SubDomain.cc index 028703227e..44a7de7ec7 100644 --- a/arcane/src/arcane/impl/SubDomain.cc +++ b/arcane/src/arcane/impl/SubDomain.cc @@ -800,6 +800,7 @@ doInitMeshPartition() else{ if (m_case_mesh_master_service.get()){ m_case_mesh_master_service->partitionMeshes(); + m_case_mesh_master_service->applyAdditionalOperationsOnMeshes(); } else if (m_legacy_mesh_builder->m_use_internal_mesh_partitioner)