Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
CartesianPatchGroup.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* CartesianPatchGroup.h (C) 2000-2026 */
9/* */
10/* Cartesian mesh patch group management. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_CARTESIANMESH_CARTESIANPATCHGROUP_H
13#define ARCANE_CARTESIANMESH_CARTESIANPATCHGROUP_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "AMRPatchPositionLevelGroup.h"
18#include "arcane/cartesianmesh/CartesianMeshGlobal.h"
19
20#include "arcane/core/ItemGroup.h"
21
22#include "arcane/utils/UniqueArray.h"
23#include "arcane/utils/Ref.h"
24#include "arcane/utils/TraceAccessor.h"
25
26#include "arcane/cartesianmesh/CartesianMeshPatchListView.h"
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31namespace Arcane
32{
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
38
39/*---------------------------------------------------------------------------*/
40/*---------------------------------------------------------------------------*/
41
42class ARCANE_CARTESIANMESH_EXPORT CartesianPatchGroup
43: public TraceAccessor
44{
45 public:
46
47 explicit CartesianPatchGroup(ICartesianMesh* cmesh);
48
49 public:
50
51 void build();
52 void saveInfosInProperties();
53 void recreateFromDump();
54
61
67 void addPatch(ConstArrayView<Int32> cells_local_id);
68
77 void addPatch(const AMRZonePosition& zone_position);
78
79 Integer nbPatch() const;
80 Ref<CartesianMeshPatch> patch(Integer index) const;
81 CartesianMeshPatchListView patchListView() const;
82
89
96
103
107 void clear();
108
116 void removePatch(Integer index);
117
126
135 void removeCellsInZone(const AMRZonePosition& zone_to_delete);
136
143 void applyPatchEdit(bool remove_empty_patches, bool update_higher_level);
144
151
152 void mergePatches();
153
154 void beginAdaptMesh(Int32 nb_levels, Int32 level_to_refine_first);
155 void endAdaptMesh();
156 void adaptLevel(Int32 level_to_adapt, bool do_fatal_if_useless);
157
158 void clearRefineRelatedFlags() const;
159
160 void rebuildAvailableGroupIndex(ConstArrayView<Integer> available_group_index);
161
162 ConstArrayView<Int32> availableGroupIndex();
163
164 void setOverlapLayerSizeTopLevel(Integer size_of_overlap_layer_top_level);
165 Int32 overlapLayerSize(Int32 level);
166
167 private:
168
169 Integer _addPatchAfterRestore(CellGroup cell_group);
170 void _addPatch(CellGroup cell_group, Integer group_index);
171
172 void _increaseOverlapSizeLevel(Int32 level_to_increate, Int32 new_size);
173 void _reduceOverlapSizeLevel(Int32 level_to_reduce, Int32 new_size);
174
175 void _updateHigherLevel();
176
177 void _changeOverlapSizeLevel(Int32 level, Int32 previous_higher_level, Int32 new_higher_level);
178
179 void _coarsenUselessCells(bool use_cells_level);
180 void _coarsenUselessCellsInLevel(Int32 level);
181
182 void _updatePatchFlagsOfItemsLevel(Int32 level, bool use_cell_groups);
183 void _updatePatchFlagsOfItemsGroundLevel();
184 void _removePatchFlagsOfItemsLevel(Int32 level);
185
186 void _checkPatchesAndMesh();
187
188 void _removeCellsInAllPatches(const AMRPatchPosition& zone_to_delete);
189
190 Integer _nextIndexForNewPatch();
191
192 void _addPatchInstance(Ref<CartesianMeshPatch> v);
193
194 void _removeOnePatch(Integer index);
195 void _removeMultiplePatches(ConstArrayView<Integer> indexes);
196 void _removeAllPatches();
197 void _createGroundPatch();
198
199 Integer _addCellGroup(CellGroup cell_group, CartesianMeshPatch* patch, bool add_flags);
200 void _updateCellGroups(Integer index, bool update_flags);
201
202 void _removePartOfPatch(Integer index_patch_to_edit, const AMRPatchPosition& patch_position);
203 void _addCutPatch(const AMRPatchPosition& new_patch_position, CellGroup parent_patch_cell_group);
204 Integer _addPatch(const AMRPatchPosition& new_patch_position);
205
206 private:
207
208 UniqueArray<CellGroup> m_amr_patch_cell_groups_all;
209 UniqueArray<CellGroup> m_amr_patch_cell_groups_inpatch;
210 UniqueArray<CellGroup> m_amr_patch_cell_groups_overlap;
211 UniqueArray<ICartesianMeshPatch*> m_amr_patches_pointer;
213 ICartesianMesh* m_cmesh;
214 UniqueArray<Integer> m_patches_to_delete;
215 Int32 m_index_new_patches;
216 UniqueArray<Integer> m_available_group_index;
217 Integer m_size_of_overlap_layer_top_level;
218 Int32 m_higher_level;
219 Int32 m_target_nb_levels;
220 Int32 m_latest_call_level;
221 Ref<Properties> m_properties;
222};
223
224/*---------------------------------------------------------------------------*/
225/*---------------------------------------------------------------------------*/
226
227} // End namespace Arcane
228
229/*---------------------------------------------------------------------------*/
230/*---------------------------------------------------------------------------*/
231
232#endif
Class allowing the definition of a patch position in the Cartesian mesh.
Class allowing the definition of a mesh zone.
Information by direction for each type of mesh entity.
void updateLevelsAndAddGroundPatch()
Method to promote all patches by one level, update the ground level, and create the new level 1.
void addPatch(ConstArrayView< Int32 > cells_local_id)
Method to create a patch containing the given cells as a parameter.
CellGroup overlapCells(Integer index)
Method to retrieve the group of overlap cells for the requested patch.
CellGroup allCells(Integer index)
Method to retrieve the group of all cells in the requested patch.
void removeCellsInZone(const AMRZonePosition &zone_to_delete)
Method to delete a zone of cells.
void removePatch(Integer index)
Method to delete a patch.
void applyPatchEdit(bool remove_empty_patches, bool update_higher_level)
Method to delete patches pending deletion.
void clear()
Method to delete all patches. Note that the cells of the patches will not be deleted.
Ref< CartesianMeshPatch > groundPatch()
Method to retrieve the level 0 patch.
void removeCellsInAllPatches(ConstArrayView< Int32 > cells_local_id)
Method to delete cells from all patches.
CellGroup inPatchCells(Integer index)
Method to retrieve the group of cells in the requested patch.
Constant view of an array of type T.
Reference to an instance.
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
1D data vector with value semantics (STL style).
ItemGroupT< Cell > CellGroup
Group of cells.
Definition ItemTypes.h:184
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
std::int32_t Int32
Signed integer type of 32 bits.