14#include "arcane/utils/FatalErrorException.h"
15#include "arcane/utils/ArgumentException.h"
16#include "arcane/utils/ITraceMng.h"
17#include "arcane/utils/PlatformUtils.h"
19#include "arcane/core/IItemFamily.h"
20#include "arcane/core/ItemGroup.h"
21#include "arcane/core/IMesh.h"
22#include "arcane/core/UnstructuredMeshConnectivity.h"
24#include "arcane/cartesianmesh/CellDirectionMng.h"
25#include "arcane/cartesianmesh/ICartesianMesh.h"
54 Int32 m_sub_domain_offset = -1;
55 Int32 m_own_nb_cell = -1;
56 Int64 m_global_nb_cell = -1;
57 Int64 m_own_cell_offset = -1;
66, m_next_face_index(-1)
67, m_previous_face_index(-1)
69 for (
Integer i = 0; i < MAX_NB_NODE; ++i)
70 m_nodes_indirection[i] = (-1);
83 m_p->m_cartesian_mesh = cm;
84 m_p->m_patch_index = patch_index;
103 m_p->m_infos.resize(new_size);
104 m_infos_view = m_p->m_infos.view();
117 Int32 lid = iitem.itemLocalId();
118 Int32 i1 = m_infos_view[lid].m_next_lid;
119 Int32 i2 = m_infos_view[lid].m_previous_lid;
120 if (i1 == NULL_ITEM_LOCAL_ID || i2 == NULL_ITEM_LOCAL_ID)
125 int dir = (int)m_direction;
127 if (m_p->m_patch_index >= 0)
128 base_group_name = base_group_name +
String(
"AMRPatch") + m_p->m_patch_index;
129 m_p->m_inner_all_items = family->
createGroup(
String(
"AllInner") + base_group_name, inner_lids,
true);
130 m_p->m_outer_all_items = family->
createGroup(
String(
"AllOuter") + base_group_name, outer_lids,
true);
131 m_p->m_all_items = items;
135 mesh_connectivity.setMesh(m_p->m_cartesian_mesh->mesh());
136 m_cell_node_view = mesh_connectivity.cellNode();
137 m_cell_face_view = mesh_connectivity.cellFace();
143void CellDirectionMng::
146 m_p->m_inpatch_all_items = in_patch_cells;
147 m_p->m_overlap_all_items = overlap_cells;
148 m_p->m_all_items = all_cells;
157 Int32 lid = icell.itemLocalId();
158 Int32 i1 = m_infos_view[lid].m_next_lid;
159 Int32 i2 = m_infos_view[lid].m_previous_lid;
160 if (i1 == NULL_ITEM_LOCAL_ID || i2 == NULL_ITEM_LOCAL_ID || overlap_lid.
contains(i1) || overlap_lid.
contains(i2))
165 int dir = (int)m_direction;
167 String base_group_name = String(
"Direction") + dir;
168 if (m_p->m_patch_index >= 0)
169 base_group_name = base_group_name + String(
"AMRPatch") + m_p->m_patch_index;
170 m_p->m_inner_all_items = family->createGroup(String(
"AllInner") + base_group_name, inner_lids,
true);
171 m_p->m_outer_all_items = family->createGroup(String(
"AllOuter") + base_group_name, outer_lids,
true);
172 m_cells = CellInfoListView(family);
174 UnstructuredMeshConnectivityView mesh_connectivity;
175 mesh_connectivity.setMesh(m_p->m_cartesian_mesh->
mesh());
176 m_cell_node_view = mesh_connectivity.cellNode();
177 m_cell_face_view = mesh_connectivity.cellFace();
186 return m_p->m_all_items;
195 return m_p->m_overlap_all_items;
204 return m_p->m_inpatch_all_items;
213 return m_p->m_inner_all_items;
222 return m_p->m_outer_all_items;
228void CellDirectionMng::
231 for (
Integer i = 0; i < MAX_NB_NODE; ++i)
232 m_nodes_indirection[i] = nodes_indirection[i];
236 tm->
info(4) <<
"Set computed indirection dir=" << (int)m_direction;
237 for (
Integer i = 0; i < MAX_NB_NODE; ++i) {
238 tm->
info(5) <<
"Indirection i=" << i <<
" v=" << (int)m_nodes_indirection[i];
248 return (m_p) ? m_p->m_global_nb_cell : -1;
257 return (m_p) ? m_p->m_own_nb_cell : -1;
266 return (m_p) ? m_p->m_sub_domain_offset : -1;
275 return (m_p) ? m_p->m_own_cell_offset : -1;
281void CellDirectionMng::
282_internalSetOffsetAndNbCellInfos(
Int64 global_nb_cell,
Int32 own_nb_cell,
283 Int32 sub_domain_offset,
Int64 own_cell_offset)
285 m_p->m_global_nb_cell = global_nb_cell;
286 m_p->m_own_nb_cell = own_nb_cell;
287 m_p->m_sub_domain_offset = sub_domain_offset;
288 m_p->m_own_cell_offset = own_cell_offset;
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
bool contains(ConstReferenceType v) const
True if the array contains the value element v.
void add(ConstReferenceType val)
Adds element val to the end of the array.
CellGroup outerCells() const
Group of all outer cells in the direction.
CellGroup allCells() const
Group of all cells in the direction.
CellGroup overlapCells() const
Group of all overlap cells in the direction.
Int64 ownCellOffset() const
Offset of the first own cell of this subdomain in this direction.
Int64 globalNbCell() const
Global number of cells in this direction.
void _internalInit(ICartesianMesh *cm, eMeshDirection dir, Integer patch_index)
CellGroup innerCells() const
Group of all inner cells in the direction.
CellDirectionMng()
Creates an empty instance.
Int32 subDomainOffset() const
Offset of the subdomain in this direction.
Int32 ownNbCell() const
Number of own cells in this direction.
void _internalResizeInfos(Int32 new_size)
Resizes the container holding the ItemDirectionInfo.
void _internalComputeInnerAndOuterItems(const ItemGroup &items)
Internal usage in Arcane. Calculates internal and external entities. Assumes init() has been called.
CellGroup inPatchCells() const
Group of all patch cells in the direction.
View of cell information.
Constant view of an array of type T.
Interface of a Cartesian mesh.
virtual ITraceMng * traceMng() const =0
Associated trace manager.
virtual IMesh * mesh() const =0
Mesh associated with this Cartesian mesh.
Interface of an entity family.
virtual ItemGroup createGroup(const String &name, Int32ConstArrayView local_ids, bool do_override=false)=0
Creates an entity group named name containing the entities local_ids.
virtual TraceMessage info()=0
Stream for an information message.
ItemVectorView view() const
View of the group entities.
IItemFamily * itemFamily() const
Entity family to which this group belongs (0 for the null group).
void fillLocalIds(Array< Int32 > &ids) const
Adds the list of localIds() of the vector to ids.
Unicode character string.
1D data vector with value semantics (STL style).
View of the standard connectivities of an unstructured mesh.
ItemGroupT< Cell > CellGroup
Group of cells.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
eMeshDirection
Direction type for a structured mesh.
@ MD_DirInvalid
Invalid or uninitialized direction.
UniqueArray< Int32 > Int32UniqueArray
Dynamic 1D array of 32-bit integers.
std::int32_t Int32
Signed integer type of 32 bits.