Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare polyhedral mesh for parallel #1816

Merged
merged 8 commits into from
Dec 3, 2024
12 changes: 6 additions & 6 deletions arcane/src/arcane/mesh/DynamicMeshChecker.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// -*- 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
//-----------------------------------------------------------------------------
/*---------------------------------------------------------------------------*/
/* DynamicMeshChecker.cc (C) 2000-2023 */
/* DynamicMeshChecker.cc (C) 2000-2024 */
/* */
/* Classe fournissant des méthodes de vérification sur le maillage. */
/*---------------------------------------------------------------------------*/
@@ -215,7 +215,7 @@ checkValidMeshFull()
void DynamicMeshChecker::
checkValidConnectivity()
{
String func_name = "DynamicMesh::checkValidConnectivity";
String func_name = "MeshChecker::checkValidConnectivity";
debug() << func_name << " check";

// Appelle la méthode de vérification de chaque famille.
@@ -389,7 +389,7 @@ checkValidConnectivity()
void DynamicMeshChecker::
updateAMRFaceOrientation()
{
String func_name = "DynamicMesh::updateAMRFaceOrientation";
String func_name = "MeshChecker::updateAMRFaceOrientation";
FaceReorienter fr(m_mesh);
ENUMERATE_FACE(iface,m_mesh->allFaces()){
Face face = *iface;
@@ -447,7 +447,7 @@ _checkFacesOrientation()
if (is_1d)
return;

String func_name = "DynamicMesh::_checkFacesOrientation";
String func_name = "MeshChecker::_checkFacesOrientation";

Int64UniqueArray m_work_face_sorted_nodes;
IntegerUniqueArray m_work_face_nodes_index;
@@ -522,7 +522,7 @@ _checkFacesOrientation()
void DynamicMeshChecker::
_checkValidItemOwner(IItemFamily* family)
{
String func_name = "DynamicMesh::_checkValidItemOwner";
String func_name = "MeshChecker::_checkValidItemOwner";

// Pour les maillages non sous-maillages, il faut que tout sub-item est une cellule voisine de même propriétaire
// Pour les sous-maillages, il faut, en plus, que tout item soit de même propriétaire que son parent
139 changes: 139 additions & 0 deletions arcane/src/arcane/mesh/EmptyMeshModifier.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
//-----------------------------------------------------------------------------
// 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
//-----------------------------------------------------------------------------
/*---------------------------------------------------------------------------*/
/* EmptyMeshModifier (C) 2000-2024 */
/* */
/* Brief code description */
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
#ifndef ARCANE_EMPTYMESHMODIFIER_H
#define ARCANE_EMPTYMESHMODIFIER_H
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

#include "arcane/core/IMeshModifier.h"

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

namespace Arcane::mesh
{

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

class EmptyMeshModifier
: public IMeshModifier
{

public:

explicit EmptyMeshModifier() = default;

~EmptyMeshModifier() override = default;

private:

void _error() const { ARCANE_FATAL("Using EmptyMeshModifier"); }

public:

void build() override { _error(); }

public:

//! Maillage associé
IMesh* mesh() override { _error(); }

public:

void setDynamic(bool) override { _error(); }
void addCells(Integer, Int64ConstArrayView,
Int32ArrayView) override { _error(); }
void addCells(const MeshModifierAddCellsArgs&) { _error(); }
void addFaces(Integer, Int64ConstArrayView,
Int32ArrayView) override { _error(); }
void addFaces(const MeshModifierAddFacesArgs&) { _error(); }
void addEdges(Integer, Int64ConstArrayView,
Int32ArrayView) override { _error(); }
void addNodes(Int64ConstArrayView,
Int32ArrayView) override { _error(); }

void removeCells(Int32ConstArrayView) override { _error(); }
void removeCells(Int32ConstArrayView, bool) override { _error(); }
void detachCells(Int32ConstArrayView) override { _error(); }

void removeDetachedCells(Int32ConstArrayView) override { _error(); }

void flagCellToRefine(Int32ConstArrayView) override { _error(); }
void flagCellToCoarsen(Int32ConstArrayView) override { _error(); }
void refineItems() override { _error(); }
void coarsenItems() override { _error(); }
void coarsenItemsV2(bool) override { _error(); }
bool adapt() override { _error(); }
void registerCallBack(IAMRTransportFunctor*) override { _error(); }
void unRegisterCallBack(IAMRTransportFunctor*) override { _error(); }
void addHChildrenCells(Cell, Integer,
Int64ConstArrayView, Int32ArrayView) override { _error(); }

void addParentCellToCell(Cell, Cell) override { _error(); }
void addChildCellToCell(Cell, Cell) override { _error(); }

void addParentFaceToFace(Face, Face) override { _error(); }
void addChildFaceToFace(Face, Face) override { _error(); }

void addParentNodeToNode(Node, Node) override { _error(); }
void addChildNodeToNode(Node, Node) override { _error(); }

void clearItems() override { _error(); }

ARCANE_DEPRECATED_240 void addCells(ISerializer*) override { _error(); }
ARCANE_DEPRECATED_240 void addCells(ISerializer*, Int32Array&) override { _error(); }

void endUpdate() override { _error(); }

void endUpdate(bool, bool) override { _error(); } // SDC: this signature is needed @IFPEN.

public:

void updateGhostLayers() override { _error(); }

//! AMR
void updateGhostLayerFromParent(Array<Int64>&,
Array<Int64>&,
bool) override { _error(); }

void addExtraGhostCellsBuilder(IExtraGhostCellsBuilder*) override { _error(); }

void removeExtraGhostCellsBuilder(IExtraGhostCellsBuilder*) override { _error(); }

void addExtraGhostParticlesBuilder(IExtraGhostParticlesBuilder*) override { _error(); }

void removeExtraGhostParticlesBuilder(IExtraGhostParticlesBuilder*) override { _error(); }

public:

void mergeMeshes(ConstArrayView<IMesh*>) override { _error(); }

public:

IMeshModifierInternal* _modifierInternalApi() override
{
_error();
return nullptr;
}
};

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

} // End namespace Arcane::mesh

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

#endif //ARCANE_EMPTYMESHMODIFIER_H
109 changes: 108 additions & 1 deletion arcane/src/arcane/mesh/PolyhedralMesh.cc
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@

#include "arcane/mesh/ItemFamily.h"
#include "arcane/mesh/DynamicMeshKindInfos.h"
#include "arcane/mesh/UnstructuredMeshUtilities.h"
#include "arcane/utils/ITraceMng.h"
#include "arcane/utils/FatalErrorException.h"

@@ -42,6 +43,7 @@
#include "arcane/core/internal/IMeshInternal.h"
#include "arcane/utils/Collection.h"
#include "arcane/utils/List.h"
#include "arcane/utils/PlatformUtils.h"

#include "neo/Mesh.h"
#include "ItemConnectivityMng.h"
@@ -756,6 +758,7 @@ PolyhedralMesh(ISubDomain* subdomain, const MeshBuildInfo& mbi)
, m_mesh_checker{ this }
, m_internal_api{std::make_unique<InternalApi>(this)}
, m_compact_mng{std::make_unique<NoCompactionMeshCompactMng>(this)}
, m_mesh_utilities{std::make_unique<UnstructuredMeshUtilities>(this)}
{
m_mesh_handle._setMesh(this);
m_mesh_item_internal_list.mesh = this;
@@ -1327,6 +1330,79 @@ removeItems(Int32ConstArrayView local_ids, eItemKind ik, const String& family_na
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

void mesh::PolyhedralMesh::
addNodes(Int64ConstArrayView nodes_uid, Int32ArrayView nodes_lid)
{
addItems(nodes_uid, nodes_lid, IK_Node, nodeFamily()->name());
}

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

void mesh::PolyhedralMesh::
exchangeItems()
{
m_trace_mng->info() << "PolyhedralMesh::_exchangeItems() do_compact?=" << "false"
<< " nb_exchange=" << 0 << " version=" << 0;
_exchangeItems();
String check_exchange = platform::getEnvironmentVariable("ARCANE_CHECK_EXCHANGE");
if (!check_exchange.null()){
m_mesh_checker.checkGhostCells();
m_trace_mng->pwarning() << "CHECKING SYNCHRONISATION !";
m_mesh_checker.checkVariablesSynchronization();
m_mesh_checker.checkItemGroupsSynchronization();
}
if (checkLevel()>=2)
m_mesh_checker.checkValidMesh();
else if (checkLevel()>=1)
m_mesh_checker.checkValidConnectivity();

}

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

void mesh::PolyhedralMesh::
_exchangeItems()
{
; //todo
}

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

void mesh::PolyhedralMesh::
prepareForDump()
{
// do nothing for now
auto want_dump = false;
auto need_compact = false;
m_trace_mng->info(4) << "DynamicMesh::prepareForDump() name=" << name()
<< " need_compact?=" << need_compact
<< " want_dump?=" << want_dump
<< " timestamp=" << 0;

{
eMeshEventType t = eMeshEventType::BeginPrepareDump;
m_mesh_events.eventObservable(t).notify(MeshEventArgs(this,t));
}

// todo use Properties
if (want_dump) {
for (auto& family : m_arcane_families) {
family->prepareForDump();
}
}

{
eMeshEventType t = eMeshEventType::EndPrepareDump;
m_mesh_events.eventObservable(t).notify(MeshEventArgs(this,t));
}
}

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

CellGroup mesh::PolyhedralMesh::
allActiveCells()
{
@@ -1389,11 +1465,42 @@ innerActiveFaces()
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

FaceGroup mesh::PolyhedralMesh::outerActiveFaces()
FaceGroup mesh::PolyhedralMesh::
outerActiveFaces()
{
return allCells().outerActiveFaceGroup();
}

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

IMeshUtilities* mesh::PolyhedralMesh::
utilities()
{
return m_mesh_utilities.get();
}

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

VariableItemInt32& mesh::PolyhedralMesh::
itemsNewOwner(eItemKind ik)
{
IItemFamily* item_family = _itemFamily(ik);
ARCANE_CHECK_POINTER(item_family);
return item_family->itemsNewOwner();
}

/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

Integer mesh::PolyhedralMesh::
checkLevel() const
{
return m_mesh_checker.checkLevel();
}


/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/

Loading