14#include "arcane/cartesianmesh/FaceDirectionMng.h" 
   16#include "arcane/utils/FatalErrorException.h" 
   17#include "arcane/utils/Real3.h" 
   18#include "arcane/utils/PlatformUtils.h" 
   20#include "arcane/IItemFamily.h" 
   21#include "arcane/ItemGroup.h" 
   22#include "arcane/IMesh.h" 
   23#include "arcane/VariableTypes.h" 
   25#include "arcane/cartesianmesh/ICartesianMesh.h" 
   26#include "arcane/cartesianmesh/CellDirectionMng.h" 
   65void FaceDirectionMng::
 
   72  m_p->m_cartesian_mesh = cm;
 
   73  m_p->m_patch_index = patch_index;
 
   79void FaceDirectionMng::
 
   89void FaceDirectionMng::
 
   90_internalResizeInfos(
Int32 new_size)
 
   92  m_p->m_infos.
resize(new_size);
 
   93  m_infos_view = m_p->m_infos.view();
 
   99void FaceDirectionMng::
 
  103  IMesh* mesh = m_p->m_cartesian_mesh->mesh();
 
  104  IItemFamily* face_family = mesh->faceFamily();
 
  105  IItemFamily* cell_family = mesh->cellFamily();
 
  106  int dir = (int)m_direction;
 
  107  String base_group_name = String(
"Direction")+dir;
 
  108  if (m_p->m_patch_index>=0)
 
  109    base_group_name = base_group_name + String(
"AMRPatch")+m_p->m_patch_index;
 
  115  UniqueArray<Int32> faces_lid;
 
  117    CellGroup all_cells = cell_dm.allCells();
 
  118    faces_lid.reserve(all_cells.size());
 
  120    std::set<Int32> done_faces;
 
  122      DirCellFace dcf(cell_dm.cellFace(*icell));
 
  123      Face next_face = dcf.next();
 
  124      Face prev_face = dcf.previous();
 
  127      Int32 prev_lid = prev_face.localId();
 
  128      if (done_faces.find(prev_lid)==done_faces.end()){
 
  129        faces_lid.add(prev_lid);
 
  130        done_faces.insert(prev_lid);
 
  132      Int32 next_lid = next_face.localId();
 
  133      if (done_faces.find(next_lid)==done_faces.end()){
 
  134        faces_lid.add(next_lid);
 
  135        done_faces.insert(next_lid);
 
  143  UniqueArray<Int32> inner_lids;
 
  144  UniqueArray<Int32> outer_lids;
 
  146    Int32 lid = iitem.itemLocalId();
 
  149    if (
face.nbCell()==1)
 
  154  m_p->m_inner_all_items = face_family->createGroup(String(
"AllInner")+base_group_name,inner_lids,
true);
 
  155  m_p->m_outer_all_items = face_family->createGroup(String(
"AllOuter")+base_group_name,outer_lids,
true);
 
  156  m_p->m_all_items = all_faces;
 
  157  m_cells = CellInfoListView(cell_family);
 
  159  _computeCellInfos(cell_dm,cells_center,faces_center);
 
  165bool FaceDirectionMng::
 
  166_hasFace(
Cell cell,
Int32 face_local_id)
 const 
  168  for( FaceLocalId iface_lid : cell.faceIds() ){
 
  169    if (iface_lid==face_local_id)
 
  183void FaceDirectionMng::
 
  192  std::set<Int32> patch_cells_set;
 
  194    patch_cells_set.insert(icell.itemLocalId());
 
  199    Int32 face_lid = iface.itemLocalId();
 
  200    Real3 face_coord = faces_center[iface];
 
  205    if (!front_cell.null())
 
  206      if (patch_cells_set.find(front_cell.localId())==patch_cells_set.end())
 
  208    if (!back_cell.null())
 
  209      if (patch_cells_set.find(back_cell.localId())==patch_cells_set.end())
 
  212    bool is_inverse = 
false;
 
  213    if (!front_cell.null()){
 
  214      Real3 front_coord = cells_center[front_cell];
 
  216        if (front_coord.x<face_coord.x)
 
  220        if (front_coord.y<face_coord.y)
 
  224        if (front_coord.z<face_coord.z)
 
  229      Real3 back_coord = cells_center[back_cell];
 
  231        if (back_coord.x>face_coord.x)
 
  235        if (back_coord.y>face_coord.y)
 
  239        if (back_coord.z>face_coord.z)
 
  246    if (!back_cell.null() && !front_cell.null()){
 
  247      Int32 back_level = back_cell.level();
 
  248      Int32 front_level = front_cell.level();
 
  249      if (back_level!=front_level){
 
  253        if (!_hasFace(back_cell,face_lid))
 
  255        if (!_hasFace(front_cell,face_lid))
 
  260      m_infos_view[face_lid] = ItemDirectionInfo(back_cell,front_cell);
 
  262      m_infos_view[face_lid] = ItemDirectionInfo(front_cell,back_cell);
 
  272  return m_p->m_all_items;
 
 
  281  return m_p->m_inner_all_items;
 
 
  290  return m_p->m_outer_all_items;
 
 
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Infos sur les mailles d'une direction spécifique X,Y ou Z d'un maillage structuré.
DirFace face(Face f) const
Face direction correspondant à la face f.
FaceDirectionMng()
Créé une instance vide.
FaceGroup innerFaces() const
Groupe de toutes les faces internes dans la direction.
FaceGroup outerFaces() const
Groupe de toutes les faces externes dans la direction.
FaceGroup allFaces() const
Groupe de toutes les faces dans la direction.
Interface d'un maillage cartésien.
void setItems(Int32ConstArrayView items_local_id)
Positionne les entités du groupe.
Vecteur 1D de données avec sémantique par valeur (style STL).
void resize(Int64 s)
Change le nombre d'éléments du tableau à s.
ItemGroupT< Cell > CellGroup
Groupe de mailles.
ItemGroupT< Face > FaceGroup
Groupe de faces.
MeshVariableScalarRefT< Cell, Real3 > VariableCellReal3
Grandeur au centre des mailles de type coordonnées.
MeshVariableScalarRefT< Face, Real3 > VariableFaceReal3
Grandeur aux faces de type coordonnées.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Int32 Integer
Type représentant un entier.
ConstArrayView< Int32 > Int32ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
eMeshDirection
Type de la direction pour un maillage structuré
@ MD_DirInvalid
Direction invalide ou non initialisée.
@ Cell
Le maillage est AMR par maille.
std::int32_t Int32
Type entier signé sur 32 bits.