Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
MeshRefinement.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2024 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/* MeshRefinement.h (C) 2000-2024 */
9/* */
10/* Gestion de l'adaptation de maillages non-structurés par raffinement */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_MESH_MESHREFINEMENT_H
13#define ARCANE_MESH_MESHREFINEMENT_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/TraceAccessor.h"
18#include "arcane/utils/PerfCounterMng.h"
19#include "arcane/utils/AMRCallBackMng.h"
20
21#include "arcane/core/ItemRefinementPattern.h"
22
23#include "arcane/mesh/MeshGlobal.h"
24#include "arcane/mesh/MapCoordToUid.h"
25#include "arcane/mesh/DynamicMeshKindInfos.h"
26
27/*---------------------------------------------------------------------------*/
28/*---------------------------------------------------------------------------*/
29
30namespace Arcane
31{
32class IMesh;
33class Node;
34class Cell;
35class AMRCallBackMng;
36class FaceFamily;
37}
38
39/*---------------------------------------------------------------------------*/
40/*---------------------------------------------------------------------------*/
41
42namespace Arcane::mesh
43{
44
45class DynamicMesh;
46class ItemRefinement;
47class ParallelAMRConsistency;
48
49/*---------------------------------------------------------------------------*/
50/*---------------------------------------------------------------------------*/
56: public TraceAccessor
57{
58public:
59#ifdef ACTIVATE_PERF_COUNTER
60 struct PerfCounter
61 {
62 typedef enum {
63 INIT,
64 CLEAR,
68 CONSIST,
73 COARSEN,
74 REFINE,
75 INTERP,
76 PGHOST,
77 COMPACT,
79 } eType ;
80
81 static const std::string m_names[NbCounters] ;
82 } ;
83#endif
88
89private:
90 // le ctor de copie et l'opérateur d'affectation sont
91 // déclarés privés mais non implémentés. C'est la
92 // technique standard pour les empêcher d'être utilisés.
94 MeshRefinement& operator=(const MeshRefinement&);
95
96public:
97
102
106 void clear();
110 void init();
111
112 void update() ;
113 bool needUpdate() const {
114 return m_need_update ;
115 }
116 void invalidate() {
117 m_need_update = true ;
118 }
119 void initMeshContainingBox() ;
124 const Integer max_level = -1);
125
138 virtual void flagCellToCoarsen(Int32ConstArrayView cells_lids);
139
151 bool refineAndCoarsenItems(const bool maintain_level_one=true);
152
164 bool coarsenItems(const bool maintain_level_one = true);
165
179
190 bool refineItems(const bool maintain_level_one=true);
191
195 void uniformlyRefine(Integer n=1);
196
200 void uniformlyCoarsen(Integer n=1);
201
208 Integer& maxLevel();
209
211 const IMesh* getMesh() const;
212
214 IMesh* getMesh();
215
217 void registerCallBack(IAMRTransportFunctor* f);
219 void unRegisterCallBack(IAMRTransportFunctor* f);
225 Int64 findOrAddNodeUid(const Real3& p,const Real& tol);
231 Int64 findOrAddFaceUid(const Real3& face_center,const Real& tol,bool& is_added);
235 Int64 getFirstChildNewUid();
236
238 void _update(ArrayView<Int64> cells_to_refine);
240 void _updateMaxUid(ArrayView<ItemInternal*> cells_to_refine);
241
245 template <int typeID> const ItemRefinementPatternT<typeID>& getRefinementPattern() const ;
250 void populateBackFrontCellsFromParentFaces(Cell parent_cell);
251
252 private:
253
260 bool _checkLevelOne(bool arcane_assert_yes = false);
261
269 bool _checkUnflagged(bool arcane_assert_yes = false);
270
278 bool& coarsenByParents();
279
280
291 unsigned char& faceLevelMismatchLimit();
292
299 bool _contract();
300
303
306
307 private:
308
320 bool _coarsenItems();
321
331
332 // mise a jour des owner des items a partir des mailles
333 void _updateItemOwner(Int32ArrayView cell_to_remove);
334 void _updateItemOwner2();
336 bool _removeGhostChildren();
337 //---------------------------------------------
338 // Utility algorithms
339
340
344 void _updateLocalityMap();
345 void _updateLocalityMap2();
351
356 bool _makeCoarseningCompatible(const bool);
357
358
363 bool _makeRefinementCompatible(const bool);
364
370 bool _makeFlagParallelConsistent2();
371
375 template <int typeID>
377 template <int typeID>
378 void _populateBackFrontCellsFromChildrenFaces(Face face,Cell parent_cell,
380
381 void _checkOwner(const String & msg); // To avoid owner desynchronization
382
383 private:
384
389 FaceFamily* m_face_family;
390 bool m_need_update;
391
397 NodeMapCoordToUid m_node_finder;
398 FaceMapCoordToUid m_face_finder;
399
404
409
414
420 Integer m_max_level;
421 Integer m_nb_cell_target;
422 Byte m_face_level_mismatch_limit;
423
424 Int64 m_max_node_uid;
425 Int64 m_next_node_uid;
426
427 Int64 m_max_cell_uid;
428 Int64 m_next_cell_uid;
429
430 Int64 m_max_face_uid;
431 Int64 m_next_face_uid;
432
433 Integer m_max_nb_hChildren;
434
439 const TetraRefinementPattern2Hex_2Penta_2Py_2Tetra m_tetra_refinement_pattern;
440 const PyramidRefinementPattern4Hex_4Py m_pyramid_refinement_pattern;
441 const PrismRefinementPattern4Hex_4Pr m_prism_refinement_pattern;
442 const HexRefinementPattern8Hex m_hex_refinement_pattern;
443 const HemiHex7RefinementPattern6Hex_2HHex7 m_hemihexa7_refinement_pattern;
444 const HemiHex6RefinementPattern4Hex_4HHex7 m_hemihexa6_refinement_pattern;
445 const HemiHex5RefinementPattern2Hex_4Penta_2HHex5 m_hemihexa5_refinement_pattern;
446 const AntiWedgeLeft6RefinementPattern4Hex_4HHex7 m_antiwedgeleft6_refinement_pattern;
447 const AntiWedgeRight6RefinementPattern4Hex_4HHex7 m_antiwedgeright6_refinement_pattern;
448 const DiTetra5RefinementPattern2Hex_6HHex7 m_ditetra5_refinement_pattern;
449
450 // Node owner memory : to patch owner desynchronization
451 VariableNodeInt32 m_node_owner_memory;
452
453#ifdef ACTIVATE_PERF_COUNTER
454 PerfCounterMng<PerfCounter> m_perf_counter ;
455#endif
456};
457
458/*---------------------------------------------------------------------------*/
459/*---------------------------------------------------------------------------*/
460
461// MeshRefinement class inline members
462
464{
466}
467
468/*---------------------------------------------------------------------------*/
469/*---------------------------------------------------------------------------*/
470
472{
473 return m_max_level;
474}
475
476/*---------------------------------------------------------------------------*/
477/*---------------------------------------------------------------------------*/
478
480{
481 return m_face_level_mismatch_limit;
482}
483/*---------------------------------------------------------------------------*/
484/*---------------------------------------------------------------------------*/
485
486template <>
488MeshRefinement::getRefinementPattern<IT_Quad4>() const
489{
491}
492template <>
494MeshRefinement::getRefinementPattern<IT_Tetraedron4>() const
495{
496 return m_tetra_refinement_pattern;
497}
498template <>
499inline const ItemRefinementPatternT<IT_Pyramid5>&
500MeshRefinement::getRefinementPattern<IT_Pyramid5>() const
501{
502 return m_pyramid_refinement_pattern;
503}
504template <>
505inline const ItemRefinementPatternT<IT_Pentaedron6>&
506MeshRefinement::getRefinementPattern<IT_Pentaedron6>() const
507{
508 return m_prism_refinement_pattern;
509}
510template <>
511inline const ItemRefinementPatternT<IT_Hexaedron8>&
512MeshRefinement::getRefinementPattern<IT_Hexaedron8>() const
513{
514 return m_hex_refinement_pattern;
515}
516template <>
517inline const ItemRefinementPatternT<IT_HemiHexa7>&
518MeshRefinement::getRefinementPattern<IT_HemiHexa7>() const
519{
520 return m_hemihexa7_refinement_pattern;
521}
522template <>
523inline const ItemRefinementPatternT<IT_HemiHexa6>&
524MeshRefinement::getRefinementPattern<IT_HemiHexa6>() const
525{
526 return m_hemihexa6_refinement_pattern;
527}
528template <>
529inline const ItemRefinementPatternT<IT_HemiHexa5>&
530MeshRefinement::getRefinementPattern<IT_HemiHexa5>() const
531{
532 return m_hemihexa5_refinement_pattern;
533}
534template <>
535inline const ItemRefinementPatternT<IT_AntiWedgeLeft6>&
536MeshRefinement::getRefinementPattern<IT_AntiWedgeLeft6>() const
537{
538 return m_antiwedgeleft6_refinement_pattern;
539}
540template <>
541inline const ItemRefinementPatternT<IT_AntiWedgeRight6>&
542MeshRefinement::getRefinementPattern<IT_AntiWedgeRight6>() const
543{
544 return m_antiwedgeright6_refinement_pattern;
545}
546template <>
547inline const ItemRefinementPatternT<IT_DiTetra5>&
548MeshRefinement::getRefinementPattern<IT_DiTetra5>() const
549{
550 return m_ditetra5_refinement_pattern;
551}
552
553/*---------------------------------------------------------------------------*/
554/*---------------------------------------------------------------------------*/
555
556} // End namespace Arcane::mesh
557
558/*---------------------------------------------------------------------------*/
559/*---------------------------------------------------------------------------*/
560
561#endif // end ARCANE_MESH_MESHREFINEMENT_H
562
563/*---------------------------------------------------------------------------*/
564/*---------------------------------------------------------------------------*/
Tableau d'items de types quelconques.
Maille d'un maillage.
Definition Item.h:1178
Face d'une maille.
Definition Item.h:932
Interface d'un fonctor avec argument.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Classe gérant un vecteur de réel de dimension 3.
Definition Real3.h:132
Implémentation d'un maillage.
Definition DynamicMesh.h:97
Famille de faces.
Definition FaceFamily.h:53
Implémentation des algorithmes d'adaptation par raffinement de maillages non-structuré.
bool _checkUnflagged(bool arcane_assert_yes=false)
void populateBackFrontCellsFromChildrenFaces(Cell parent_cell)
const Quad4RefinementPattern4Quad m_quad4_refinement_pattern
bool coarsenItemsV2(bool update_parent_flag)
Méthode permettant de retirer les mailles marquées avec le flag "II_Coarsen".
bool refineAndCoarsenItems(const bool maintain_level_one=true)
bool refineItems(const bool maintain_level_one=true)
void flagItems(const Int32Array &flag_per_cell, const Integer max_level=-1)
unsigned char & faceLevelMismatchLimit()
const IMesh * getMesh() const
Référence constante au maillage.
void uniformlyCoarsen(Integer n=1)
Int64 findOrAddFaceUid(const Real3 &face_center, const Real &tol, bool &is_added)
MapCoordToUid::Box m_mesh_containing_box
ParallelAMRConsistency * m_parallel_amr_consistency
bool _makeCoarseningCompatible(const bool)
const ItemRefinementPatternT< typeID > & getRefinementPattern() const
bool _makeRefinementCompatible(const bool)
void _upscaleData(Array< ItemInternal * > &parent_cells)
restriction des données sur les mailles parents
ItemRefinement * m_item_refinement
Int64 findOrAddNodeUid(const Real3 &p, const Real &tol)
bool _checkLevelOne(bool arcane_assert_yes=false)
void uniformlyRefine(Integer n=1)
bool coarsenItems(const bool maintain_level_one=true)
void _populateBackFrontCellsFromParentFaces(Cell parent_cell)
void _interpolateData(const Int64Array &cells_to_refine)
interpolation des données sur les mailles enfants
virtual void flagCellToRefine(Int32ConstArrayView cells_lids)
Passage de l'erreur commise par maille au flag de raffinement.
bool _refineItems(Int64Array &cells_to_refine)
Vue modifiable d'un tableau d'un type T.
Vue constante d'un tableau de type T.
Chaîne de caractères unicode.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-