Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
ItemRefinement.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/* ItemRefinement.h (C) 2000-2022 */
9/* */
10/* methods for manipulating a mesh Item using AMR techniques. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MESH_ITEMREFINEMENT_H
13#define ARCANE_MESH_ITEMREFINEMENT_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/core/VariableTypes.h"
18
19#include "arcane/mesh/MeshGlobal.h"
20#include "arcane/mesh/MeshRefinement.h"
21
22/*---------------------------------------------------------------------------*/
23/*---------------------------------------------------------------------------*/
24
25#include <set>
26#include <vector>
27
28/*---------------------------------------------------------------------------*/
29/*---------------------------------------------------------------------------*/
30
31namespace Arcane::mesh
32{
33
34/*---------------------------------------------------------------------------*/
35/*---------------------------------------------------------------------------*/
36
38: public TraceAccessor
39{
40 public:
41
46
47 private:
48
49 // the copy constructor and assignment operator are
50 // declared private but not implemented. This is the
51 // standard technique to prevent them from being used.
53 ItemRefinement& operator=(const ItemRefinement&);
54
55 public:
56
61
63 {
64 typedef std::set<Int64> FaceSet;
65 bool operator()(const FaceSet& s1, const FaceSet& s2) const
66 {
67 //return (s1 == s2);
68 if (s1.size() != s2.size())
69 return false;
70 else {
71 FaceSet::const_iterator its1 = s1.begin(), its2 = s2.begin();
72 FaceSet::const_iterator its1_end = s1.end();
73 for (; its1 != its1_end; ++its1, ++its2)
74 if (*its1 != *its2)
75 return false;
76 }
77 return true;
78 }
79 };
80
82 template <int typeID>
83 void refineOneCell(Cell item, MeshRefinement& mesh_refinement);
84
86 template <int typeID>
88
89 void initHMin();
90 void updateChildHMin(ArrayView<ItemInternal*> cells);
91
92 private:
93
94 Real hmin(Cell) const;
95 Real3 faceCenter(ItemInternal* face, SharedVariableNodeReal3& nodes_coords) const;
96
97 template <int typeID>
98 void computeHChildren(Cell item, MeshRefinement& mesh_refinement);
99
100 template <int typeID>
101 void computeOrigNodesCoords(Cell item, const ItemRefinementPatternT<typeID>& rp, const Integer sid);
102
103 private:
104
105 IMesh* m_mesh;
106 VariableCellReal m_cell_hmin;
107 VariableNodeReal3& m_orig_nodes_coords;
108
109 Integer m_refine_factor;
110 Integer m_nb_cell_to_add;
111 Integer m_nb_face_to_add;
112 Integer m_nb_node_to_add;
113
114 // hmin*TOLERENCE= tolerance for searching for a new point.
115 static const Real TOLERENCE;
116
117 // Reel3 m_p[c,nc] : coordinates of node nc of children c
118 std::vector<std::vector<Real3>> m_p;
119 // Int64 m_nodes_uid[c,nc] : uid of node nc of children c
120 std::vector<std::vector<Int64>> m_nodes_uid;
121 Real3UniqueArray m_coord;
122 Int64UniqueArray m_cells_infos;
123 Int64UniqueArray m_faces_infos;
124 Int64UniqueArray m_face;
125 Real3UniqueArray m_nodes_to_create_coords;
126 Int64UniqueArray m_nodes_unique_id;
127 Int32UniqueArray m_nodes_lid;
128 Int32UniqueArray m_faces_lid;
129 Int32UniqueArray m_cells_lid;
130};
131
132/*---------------------------------------------------------------------------*/
133/*---------------------------------------------------------------------------*/
134
135} // End namespace Arcane::mesh
136
137/*---------------------------------------------------------------------------*/
138/*---------------------------------------------------------------------------*/
139
140#endif
Modifiable view of an array of type T.
Cell of a mesh.
Definition Item.h:1300
Internal structure of a mesh entity.
Class managing a 3-dimensional real vector.
Definition Real3.h:132
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
static const Real TOLERENCE
AMR.
void refineOneCell(Cell item, MeshRefinement &mesh_refinement)
void coarsenOneCell(Cell item, const ItemRefinementPatternT< typeID > &rp)
Implementation of unstructured mesh refinement adaptation algorithms.
MeshVariableScalarRefT< Cell, Real > VariableCellReal
Real type quantity at cell center.
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Coordinate type quantity at node.
UniqueArray< Int64 > Int64UniqueArray
Dynamic 1D array of 64-bit integers.
Definition UtilsTypes.h:339
Int32 Integer
Type representing an integer.
UniqueArray< Real3 > Real3UniqueArray
Dynamic 1D array of rank 3 vectors.
Definition UtilsTypes.h:363
UniqueArray< Int32 > Int32UniqueArray
Dynamic 1D array of 32-bit integers.
Definition UtilsTypes.h:341
SharedMeshVariableScalarRefT< Node, Real3 > SharedVariableNodeReal3
Quantity at the node of coordinate type.
double Real
Type representing a real number.