Skip to content

Commit

Permalink
[arcane,impl] Implémente les nouvelles opérations et déplace la subdi…
Browse files Browse the repository at this point in the history
…vision du maillage après le partitionnement.
  • Loading branch information
grospelliergilles committed Sep 23, 2024
1 parent c448342 commit e08c5ab
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 21 deletions.
2 changes: 1 addition & 1 deletion arcane/src/arcane/impl/ArcaneBasicMeshSubdividerService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ ArcaneBasicMeshSubdividerService(const ServiceBuildInfo& sbi)
void ArcaneBasicMeshSubdividerService::
subdivideMesh([[maybe_unused]] IPrimaryMesh* mesh)
{
warning() << "Function not implemented";
warning() << "SubdivideMesh: Function not implemented";
}

/*---------------------------------------------------------------------------*/
Expand Down
32 changes: 22 additions & 10 deletions arcane/src/arcane/impl/ArcaneCaseMeshMasterService.cc
Original file line number Diff line number Diff line change
@@ -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"

/*---------------------------------------------------------------------------*/
Expand All @@ -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)
Expand Down Expand Up @@ -71,6 +75,14 @@ class ArcaneCaseMeshMasterService
s->partitionMesh();
}

void applyAdditionalOperationsOnMeshes() override
{
if (!m_is_allocated)
ARCANE_FATAL("Meshes are not allocated. call allocateMeshes() before");

Check warning on line 81 in arcane/src/arcane/impl/ArcaneCaseMeshMasterService.cc

View check run for this annotation

Codecov / codecov/patch

arcane/src/arcane/impl/ArcaneCaseMeshMasterService.cc#L81

Added line #L81 was not covered by tests
for (ICaseMeshService* s : options()->mesh)
s->applyAdditionalOperations();
}

ICaseOptions* _options() override
{
return options()->caseOptions();
Expand Down
42 changes: 32 additions & 10 deletions arcane/src/arcane/impl/ArcaneCaseMeshService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class ArcaneCaseMeshService
void createMesh(const String& default_name) override;
void allocateMeshItems() override;
void partitionMesh() override;
void applyAdditionalOperations() override;

private:

Expand All @@ -77,6 +78,7 @@ class ArcaneCaseMeshService
void _doInitialPartition();
void _doInitialPartition2(const String& name);
void _setGhostLayerInfos();
void _checkMeshCreationAndAllocation(bool is_check_allocated);
};

/*---------------------------------------------------------------------------*/
Expand Down Expand Up @@ -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();
}

/*---------------------------------------------------------------------------*/
Expand Down
1 change: 1 addition & 0 deletions arcane/src/arcane/impl/SubDomain.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e08c5ab

Please sign in to comment.