14#include "arcane/cartesianmesh/internal/AMRPatchPositionLevelGroup.h"
16#include "arcane/cartesianmesh/AMRPatchPosition.h"
29AMRPatchPositionLevelGroup::
30AMRPatchPositionLevelGroup(
Int32 max_level)
31: m_max_level(max_level)
32, m_patches(max_level + 1)
38AMRPatchPositionLevelGroup::
39~AMRPatchPositionLevelGroup() =
default;
44Int32 AMRPatchPositionLevelGroup::
53ConstArrayView<AMRPatchPosition> AMRPatchPositionLevelGroup::
56 return m_patches[level];
62void AMRPatchPositionLevelGroup::
63addPatch(
const AMRPatchPosition& patch)
65 m_patches[patch.level()].add(patch);
71void AMRPatchPositionLevelGroup::
72fusionPatches(
Int32 level)
80void AMRPatchPositionLevelGroup::
93 std::stable_sort(patch_position.
begin(), patch_position.
end(),
95 return a.nbCells() < b.nbCells();
98 for (
Integer p0 = 0; p0 < patch_position.
size(); ++p0) {
100 if (patch_fusion_0.
isNull())
103 for (
Integer p1 = p0 + 1; p1 < patch_position.
size(); ++p1) {
105 if (patch_fusion_1.
isNull())
121 if (patch_fusion_0.
fusion(patch_fusion_1)) {
134 for (
Integer i = 0; i < patch_position.
size(); ++i) {
135 if (patch_position[i].isNull()) {
void fusionPatches(Int32 level)
Method allowing the merging of all patches of a certain level that can be merged.
Class allowing the definition of a patch position in the Cartesian mesh.
bool fusion(AMRPatchPosition &other_patch)
Method to merge other_patch with ours.
bool isNull() const
Method to know if the patch is null.
Integer size() const
Number of elements in the vector.
iterator begin()
Iterator over the first element of the array.
void remove(Int64 index)
Removes the entity at index index.
iterator end()
Iterator over the first element after the end of the array.
1D data vector with value semantics (STL style).
-- 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.