13#ifndef ARCANE_POLYHEDRALMESH_H
14#define ARCANE_POLYHEDRALMESH_H
18#include "arcane/core/MeshHandle.h"
19#include "arcane/core/ItemGroup.h"
20#include "arcane/core/MeshItemInternalList.h"
21#include "arcane/core/ISubDomain.h"
22#include "arcane/core/Properties.h"
25#include "arcane/mesh/EmptyMesh.h"
26#include "arcane/mesh/EmptyMeshModifier.h"
27#include "arcane/mesh/MeshEventsImpl.h"
29#include "arcane/core/ItemAllocationInfo.h"
31#include "arcane/utils/Collection.h"
32#include "arcane/utils/String.h"
33#include "arcane/utils/List.h"
34#include "arcane/core/IMeshInitialAllocator.h"
35#include "arcane/core/IParallelMng.h"
36#include "arcane/core/MeshKind.h"
40#ifdef ARCANE_HAS_POLYHEDRAL_MESH_TOOLS
44#include "arcane/core/IVariableMng.h"
45#include "arcane/mesh/DynamicMeshChecker.h"
46#include "arcane/mesh/GhostLayerBuilder.h"
58class GhostLayerBuilder;
68class PolyhedralFamily;
69class PolyhedralFamilySerializer;
70class PolyhedralFamilySerializerMng;
71namespace PolyhedralTools
80,
public EmptyMeshModifier
84 friend class PolyhedralFamily;
85 friend class PolyhedralFamilySerializer;
92 inline static const String m_mesh_handle_name =
"polyhedral_mesh_handle";
94 std::unique_ptr<Properties> m_properties;
95 std::unique_ptr<PolyhedralMeshImpl> m_mesh;
98 bool m_is_allocated =
false;
102 std::unique_ptr<PolyhedralFamilySerializerMng> m_polyhedral_family_serializer_mng;
104 std::unique_ptr<GhostLayerBuilder> m_ghost_layer_builder =
nullptr;
113 void applyScheduledAllocateItems(
UniqueArray<std::shared_ptr<PolyhedralTools::ItemLocalIds>> item_lids);
114 void removeNeedRemoveMarkedItems();
115 PolyhedralFamilySerializerMng* polyhedralFamilySerializerMng();
124 static String handleName() {
return m_mesh_handle_name; }
126 void read(
String const& filename);
134 return m_mesh_events.eventObservable(
type);
137#ifdef ARCANE_HAS_POLYHEDRAL_MESH_TOOLS
152 class PolyhedralMeshModifier;
153 class NoCompactionMeshCompacter;
154 class NoCompactionMeshCompactMng;
158 std::vector<std::unique_ptr<PolyhedralFamily>> m_arcane_families;
159 std::array<std::unique_ptr<PolyhedralFamily>, NB_ITEM_KIND> m_empty_arcane_families;
160 std::array<PolyhedralFamily*, NB_ITEM_KIND> m_default_arcane_families;
161 std::vector<std::unique_ptr<VariableItemReal3>> m_arcane_item_coords;
162 std::unique_ptr<VariableNodeReal3> m_arcane_node_coords =
nullptr;
164 InitialAllocator m_initial_allocator;
165 IVariableMng* m_variable_mng =
nullptr;
166 DynamicMeshChecker m_mesh_checker;
167 List<IItemFamily*> m_item_family_collection;
168 std::unique_ptr<InternalApi> m_internal_api;
169 std::unique_ptr<IMeshCompactMng> m_compact_mng;
170 std::unique_ptr<IMeshUtilities> m_mesh_utilities;
171 std::unique_ptr<IMeshExchangeMng> m_mesh_exchange_mng;
172 std::unique_ptr<IItemFamilyNetwork> m_item_family_network;
173 std::unique_ptr<IGhostLayerMng> m_ghost_layer_mng;
174 bool m_is_dynamic =
false;
177 IMeshInitialAllocator*
initialAllocator()
override {
return &m_initial_allocator; }
179 void _allocateItems(
const Arcane::ItemAllocationInfo& item_allocation_info, ArrayView<Int32UniqueArray> family_lids);
184 MeshHandle
handle()
const override;
188 void build()
override {}
190 String
name()
const override;
226 ISubDomain* subDomain()
override {
return m_subdomain; }
227 MeshItemInternalList* meshItemInternalList()
override {
return &m_mesh_item_internal_list; }
229 Properties*
properties()
override {
return m_properties.
get(); }
231 const MeshPartInfo&
meshPartInfo()
const override {
return m_mesh_part_info; };
240 IParallelMng*
parallelMng()
override {
return m_subdomain->parallelMng(); }
242 bool isAllocated()
override {
return m_is_allocated; }
244 bool isAmrActivated()
const override {
return false; }
252 IMesh*
parentMesh()
const override {
return nullptr; }
254 PolyhedralFamily* arcaneDefaultFamily(
eItemKind ik);
270 m_mesh_checker.checkValidMesh();
273 IVariableMng*
variableMng()
const override {
return m_variable_mng; }
288 IMeshModifier*
modifier()
override {
return this; }
289 bool isDynamic()
const override {
return m_is_dynamic; }
290 void setDynamic(
bool is_dynamic)
override { m_is_dynamic = is_dynamic; }
294 if (m_subdomain->parallelMng()->isParallel()) {
295 ARCANE_NOT_YET_IMPLEMENTED(
"Parallel for polyhedral mesh is WIP");
301 if (m_subdomain->parallelMng()->isParallel()) {
302 ARCANE_NOT_YET_IMPLEMENTED(
"Parallel for polyhedral mesh is WIP");
308 if (m_subdomain->parallelMng()->isParallel()) {
309 ARCANE_NOT_YET_IMPLEMENTED(
"Parallel for polyhedral mesh is WIP");
335 IUserDataList*
userDataList()
override {
return m_mesh_handle.meshUserDataList(); }
336 const IUserDataList*
userDataList()
const override {
return m_mesh_handle.meshUserDataList(); }
348 void connectivities(IItemFamily* source_family);
357 PolyhedralFamily* _createItemFamily(
eItemKind ik,
const String&
name);
358 PolyhedralFamily* _itemFamily(
eItemKind ik);
359 PolyhedralFamily* _findItemFamily(
eItemKind ik,
const String&
name,
bool create_if_needed =
false);
361 void _internalUpdateGhost(
bool update_ghost_layer,
bool remove_old_ghost);
362 void _finalizeMeshChanged();
363 void _internalEndUpdateInit(
bool cond);
364 void _synchronizeGroups();
365 void _internalEndUpdateResizeVariables();
366 void _synchronizeVariables();
367 void _internalEndUpdateFinal(
bool print_stat);
368 void _removeGhostItems();
370 const char* _className()
const {
return "PolyhedralMesh"; }
372 void _exchangeItems();
374 void _endUpdateFamilies();
376 void _computeFamilySynchronizeInfos();
378 void _notifyEndUpdateForFamilies();
380 void _computeGroupSynchronizeInfos();
386 [[noreturn]]
void _errorEmptyMesh()
const;
388 void _createUnitMesh();
389 void _updateMeshInternalList(
eItemKind kind);
390 PolyhedralMeshImpl* _impl();
Arcane configuration file.
Declarations of Arcane's general types.
Modifiable view of an array of type T.
Base class for an event handler.
virtual String name() const =0
Mesh name.
Interface for managing mesh exchanges between subdomains.
Interface for allocating mesh entities.
Interface of the parallelism manager for a subdomain.
Allocator for polyhedral meshes.
virtual IMeshInitialAllocator * initialAllocator()
Specific initial allocator.
Interface of the subdomain manager.
Mesh entity type manager.
Parameters necessary for building a mesh.
Indirection tables for mesh entities.
Characteristics of a mesh.
Information about a partitioned mesh.
bool get(const String &name, bool &value) const
Value of the property named name.
Unicode character string.
1D data vector with value semantics (STL style).
void addNodes(Int64ConstArrayView, Int32ArrayView) override
Adds nodes.
void updateGhostLayers() override
Updates the ghost layer.
IMeshModifierInternal * _modifierInternalApi() override
Internal API for Arcane.
void setDynamic(bool) override
Sets the property indicating whether the mesh can evolve.
void addExtraGhostCellsBuilder(IExtraGhostCellsBuilder *) override
addition of the "extraordinary" ghost cells addition algorithm.
void removeExtraGhostCellsBuilder(IExtraGhostCellsBuilder *) override
Removes the association with the builder instance.
CellGroup ownLevelCells(const Integer &) override
Group of all cells specific to the domain of level level.
void destroyGroups() override
Destroys all groups of all families.
Integer nbNode() override
Number of mesh nodes.
ITraceMng * traceMng() override
Associated message manager.
FaceGroup ownFaces() override
Group of all domain-specific faces.
IItemFamily * createItemFamily(eItemKind, const String &) override
Create a particle family named name.
IUserDataList * userDataList() override
Associated user data manager.
IItemFamily * itemFamily(eItemKind) override
Returns the entity family of type ik.
IItemFamily * faceFamily() override
Returns the face family.
VariableItemInt32 & itemsNewOwner(eItemKind) override
Variable containing the identifier of the owning subdomain.
ItemTypeMng * itemTypeMng() const override
Associated entity type manager.
VariableNodeReal3 & nodesCoordinates() override
Node coordinates.
IMeshPartitionConstraintMng * partitionConstraintMng() override
Manager of partitioning constraints associated with this mesh.
FaceGroup outerFaces() override
Group of all faces on the boundary.
Integer dimension() override
Mesh dimension (1D, 2D, or 3D).
IGhostLayerMng * ghostLayerMng() const override
Associated ghost layer manager.
bool useMeshItemFamilyDependencies() const override
check if the network itemFamily dependencies is activated
IMeshModifier * modifier() override
Associated modifier interface.
IMeshCompactMng * _compactMng() override
Integer nbCell() override
Number of mesh cells.
IParallelMng * parallelMng() override
Parallelism manager.
void exchangeItems() override
Changes the owning subdomains of entities.
IItemFamily * edgeFamily() override
Returns the edge family.
VariableScalarInteger connectivity() override
Connectivity descriptor.
InternalConnectivityPolicy _connectivityPolicy() const override
Connectivity usage policy.
FaceGroup allActiveFaces() override
Group of all active faces.
void checkValidMesh() override
Check for the validity of internal mesh structures (internal).
void prepareForDump() override
Prepares the instance for dumping.
ItemGroupCollection groups() override
List of groups.
IItemFamilyModifier * findItemFamilyModifier(eItemKind, const String &) override
Returns the IItemFamilyModifier interface for the family named name and of type ik.
CellGroup allActiveCells() override
Properties * properties() override
Properties associated with this mesh.
Integer nbEdge() override
Number of mesh edges.
FaceGroup innerActiveFaces() override
Group of all active faces.
IItemFamily * cellFamily() override
Returns the cell family.
CellGroup ownActiveCells() override
Group of all active cells specific to the domain.
FaceGroup allFaces() override
Group of all faces.
const MeshPartInfo & meshPartInfo() const override
Mesh part information.
IVariableMng * variableMng() const override
Associated variable manager.
MeshHandle handle() const override
Handle on this mesh.
ItemGroup findGroup(const String &) override
Returns the group with name name or a null group if none exists.
IMeshUtilities * utilities() override
Associated utility functions interface.
IItemFamily * nodeFamily() override
Returns the node family.
Integer checkLevel() const override
Current check level.
Integer nbFace() override
Number of mesh faces.
EdgeGroup allEdges() override
Group of all edges.
IItemFamily * findItemFamily(eItemKind, const String &, bool, bool) override
Returns the family named name.
IItemFamilyNetwork * itemFamilyNetwork() override
Family network interface (connected families).
CellGroup ownCells() override
Group of all domain-specific cells.
CellGroup allLevelCells(const Integer &) override
Group of all cells of level level.
NodeGroup ownNodes() override
Group of all domain-specific nodes.
IMeshInternal * _internalApi() override
Internal Arcane API.
NodeGroup allNodes() override
Group of all nodes.
FaceGroup ownActiveFaces() override
Group of all active faces specific to the domain.
bool isDynamic() const override
Indicates if the mesh is dynamic (can evolve).
String name() const override
Mesh name.
bool isAllocated() override
True if the mesh is allocated.
FaceGroup outerActiveFaces() override
Group of all active faces on the boundary.
IMesh * parentMesh() const override
Access to the parent mesh.
CellGroup allCells() override
Group of all cells.
String factoryName() const override
Name of the factory used to create the mesh.
EdgeGroup ownEdges() override
Group of all domain-specific edges.
Integer nbItem(eItemKind) override
Number of elements of type ik.
Implementation of mesh events.
EventObservable< const MeshEventArgs & > & eventObservable(eMeshEventType type) override
Observable for an event.
void endUpdate()
Notifies the instance that mesh modification is finished.
const MeshKind meshKind() const override
Mesh characteristics.
ItemGroupT< Cell > CellGroup
Group of cells.
ItemGroupT< Face > FaceGroup
Group of faces.
ItemGroupT< Edge > EdgeGroup
Group of edges.
ItemGroupT< Node > NodeGroup
Group of nodes.
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Coordinate type quantity at node.
ItemVariableScalarRefT< Int32 > VariableItemInt32
32-bit integer type quantity
VariableRefScalarT< Integer > VariableScalarInteger
Scalar variable of integer type.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Collection< ItemGroup > ItemGroupCollection
Collection of mesh item groups.
Int32 Integer
Type representing an integer.
ConstArrayView< Int32 > Int32ConstArrayView
C equivalent of a 1D array of 32-bit integers.
List< ItemGroup > ItemGroupList
Array of mesh item groups.
Collection< IItemFamily * > IItemFamilyCollection
Collection of item families.
ConstArrayView< Int64 > Int64ConstArrayView
C equivalent of a 1D array of 64-bit integers.
eMeshEventType
Events generated by IMesh.
ArrayView< Int32 > Int32ArrayView
C equivalent of a 1D array of 32-bit integers.
eItemKind
Mesh entity type.
InternalConnectivityPolicy
Connectivity usage policy.
@ NewOnly
Allocates only the new connectivities.