Arcane  v3.15.0.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
PolyhedralMesh.cc
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/* PolyhedralMesh.cc (C) 2000-2024 */
9/* */
10/* Polyhedral mesh impl using Neo data structure. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/mesh/PolyhedralMesh.h"
15
16#include "ItemFamilyNetwork.h"
17#include "ItemFamilyPolicyMng.h"
18#include "arcane/mesh/MeshExchangeMng.h"
19#include "arcane/core/ISubDomain.h"
20#include "arcane/core/ItemSharedInfo.h"
21#include "arcane/core/ItemTypeInfo.h"
22#include "arcane/core/ItemTypeMng.h"
23#include "arcane/core/VariableBuildInfo.h"
24#include "arcane/core/MeshBuildInfo.h"
26#include "arcane/core/AbstractService.h"
27#include "arcane/core/IMeshFactory.h"
28#include "arcane/core/ItemInternal.h"
29#include "arcane/core/IDoFFamily.h"
30#include "arcane/core/IMeshCompactMng.h"
31#include "arcane/core/IMeshCompacter.h"
32#include "arcane/core/IMeshExchanger.h"
33#include "arcane/core/IGhostLayerMng.h"
34#include "arcane/core/MeshVisitor.h"
35#include "arcane/core/internal/IVariableMngInternal.h"
36#include "arcane/core/internal/IPolyhedralMeshModifier.h"
37#include "arcane/core/internal/IMeshModifierInternal.h"
38
39#include "arcane/mesh/ItemFamily.h"
40#include "arcane/mesh/DynamicMeshKindInfos.h"
41#include "arcane/mesh/UnstructuredMeshUtilities.h"
42#include "arcane/mesh/GhostLayerMng.h"
43#include "arcane/utils/ITraceMng.h"
44#include "arcane/utils/FatalErrorException.h"
45
46#ifdef ARCANE_HAS_POLYHEDRAL_MESH_TOOLS
47
48#include "arcane/core/IMeshMng.h"
49#include "arcane/core/MeshHandle.h"
50#include "arcane/core/IItemFamily.h"
51#include "arcane/core/internal/IMeshInternal.h"
52#include "arcane/core/IVariableSynchronizer.h"
53#include "arcane/mesh/ItemFamilyPolicyMng.h"
54#include "arcane/mesh/ItemFamilySerializer.h"
55#include "arcane/utils/Collection.h"
56#include "arcane/utils/List.h"
57#include "arcane/utils/PlatformUtils.h"
58
59#include "neo/Mesh.h"
60#include "ItemConnectivityMng.h"
61
62#endif
63
64// #define ARCANE_DEBUG_POLYHEDRAL_MESH
65 #define ARCANE_DEBUG_LOAD_BALANCING
66
67#ifdef ARCANE_DEBUG_LOAD_BALANCING
68static bool arcane_debug_load_balancing = true;
69#else
70static bool arcane_debug_load_balancing = false;
71#endif
72
73/*---------------------------------------------------------------------------*/
74/*---------------------------------------------------------------------------*/
75
76void Arcane::mesh::PolyhedralMesh::
77_errorEmptyMesh() const
78{
79 ARCANE_FATAL("Cannot use PolyhedralMesh if Arcane is not linked with lib Neo");
80}
81
82/*---------------------------------------------------------------------------*/
83/*---------------------------------------------------------------------------*/
84
85namespace Arcane
86{
87
88/*---------------------------------------------------------------------------*/
89/*---------------------------------------------------------------------------*/
90
91namespace mesh
92{
93
94 /*---------------------------------------------------------------------------*/
95 /*---------------------------------------------------------------------------*/
96
98 : public ItemFamilyPolicyMng
99 {
100 public:
102 : ItemFamilyPolicyMng(family)
103 , m_family(family){}
104 public:
106 {
107 return new ItemFamilySerializer(m_family, nullptr, nullptr); // todo handle mesh incremental builder interface and IItemFamilyModifier
108 }
109 private:
110 ItemFamily* m_family;
111 };
112
113 /*---------------------------------------------------------------------------*/
114 /*---------------------------------------------------------------------------*/
115
117 : public ItemFamily
118 , public IDoFFamily
119 {
120 ItemSharedInfoWithType* m_shared_info = nullptr;
121 Int32UniqueArray m_empty_connectivity{ 0 };
122 Int32UniqueArray m_empty_connectivity_indexes;
123 Int32UniqueArray m_empty_connectivity_nb_item;
124
125 public:
126
127 inline static const String m_arcane_item_lids_property_name{ "Arcane_Item_Lids" }; // inline used to initialize within the declaration
128 inline static const String m_arcane_remove_item_property_name{ "Arcane_Remove_Items" }; // inline used to initialize within the declaration
129
130 public:
131
133 : ItemFamily(mesh, ik, name)
134 {}
135
136 public:
137
138 void preAllocate(Integer nb_item)
139 {
140 Integer nb_hash = itemsMap().nbBucket();
141 Integer wanted_size = 2 * (nb_item + nbItem());
142 if (nb_hash < wanted_size)
143 itemsMap().resize(wanted_size, true);
144 m_empty_connectivity_indexes.resize(nb_item + nbItem(), 0);
145 m_empty_connectivity_nb_item.resize(nb_item + nbItem(), 0);
146 _updateEmptyConnectivity();
147 }
148
149 ItemInternal* _allocItem(const Int64 uid)
150 {
151 bool need_alloc; // given by alloc
152 ItemInternal* item_internal = ItemFamily::_allocOne(uid, need_alloc);
153 if (!need_alloc)
154 item_internal->setUniqueId(uid);
155 else {
156 _allocateInfos(item_internal, uid, m_shared_info);
157 }
158 item_internal->setOwner(m_sub_domain_id, m_sub_domain_id);
159 return item_internal;
160 }
161
162 void addItems(Int64ConstSmallSpan uids, Int32ArrayView items)
163 {
164 if (uids.empty())
165 return;
166 ARCANE_ASSERT((uids.size() == items.size()), ("one must have items.size==uids.size()"));
167 m_mesh->traceMng()->debug(Arccore::Trace::Highest) << " PolyhedralFamily::addItems ";
168 preAllocate(uids.size());
169 auto index{ 0 };
170 for (auto uid : uids) {
171 ItemInternal* ii = _allocItem(uid);
172 items[index++] = ii->localId();
173 }
174 m_need_prepare_dump = true;
175 _updateItemInternalList();
176 }
177
178 void removeItems(Int32ConstArrayView local_ids)
179 {
180 _removeMany(local_ids);
181 }
182
183 void _updateItemInternalList()
184 {
185 switch (itemKind()) {
186 case IK_Cell:
187 m_item_internal_list->cells = _itemsInternal();
188 break;
189 case IK_Face:
190 m_item_internal_list->faces = _itemsInternal();
191 break;
192 case IK_Edge:
193 m_item_internal_list->edges = _itemsInternal();
194 break;
195 case IK_Node:
196 m_item_internal_list->nodes = _itemsInternal();
197 break;
198 case IK_DoF:
199 case IK_Particle:
200 case IK_Unknown:
201 break;
202 }
203 }
204
205 void _updateEmptyConnectivity()
206 {
207 auto item_internal_connectivity_list = itemInternalConnectivityList();
208 for (auto item_kind = 0; item_kind < ItemInternalConnectivityList::MAX_ITEM_KIND; ++item_kind) {
209 item_internal_connectivity_list->_setConnectivityList(item_kind, m_empty_connectivity);
210 item_internal_connectivity_list->_setConnectivityIndex(item_kind, m_empty_connectivity_indexes);
211 item_internal_connectivity_list->_setConnectivityNbItem(item_kind, m_empty_connectivity_nb_item);
212 }
213 }
214
215 // IItemFamily
217 return this;
218 }
219 // todo bloquer toutes les methodes d'allocation de IItemFamily
220
221 void build() override {
222 ItemFamily::build();
223 m_sub_domain_id = subDomain()->subDomainId();
224 ItemTypeMng* itm = m_mesh->itemTypeMng();
225 ItemTypeInfo* dof_type_info = itm->typeFromId(IT_NullType);
226 m_shared_info = _findSharedInfo(dof_type_info);
227 _updateEmptyConnectivity();
228 ItemFamily::setPolicyMng(new PolyhedralFamilyPolicyMng{this});
229
230 }
231
232 // IDoFFamily
233 String name() const override { return ItemFamily::name(); }
234 String fullName() const override { return ItemFamily::fullName(); }
235 Integer nbItem() const override { return ItemFamily::nbItem(); }
236 ItemGroup allItems() const override { return ItemFamily::allItems(); }
237 void endUpdate() override { info() << "END UPDATE "<< m_name ; return ItemFamily::endUpdate(); }
238 IItemFamily* itemFamily() override { return this; }
239
240
242 auto* polyhedral_mesh_modifier = m_mesh->_internalApi()->polyhedralMeshModifier();
244 polyhedral_mesh_modifier->addItems(dof_uids, dof_lids, ItemFamily::itemKind(), name());
245 return ItemFamily::view(dof_lids);
246 }
247
250 {
251 ARCANE_NOT_YET_IMPLEMENTED("");
252 ARCANE_UNUSED(dof_uids);
253 ARCANE_UNUSED(owners);
254 return ItemFamily::view(dof_lids);
255 }
256
257 void removeDoFs(Int32ConstArrayView items_local_id){
258 auto* mesh_modifier = m_mesh->_internalApi()->polyhedralMeshModifier();
259 mesh_modifier->removeItems(items_local_id, ItemFamily::itemKind(), m_name);
260 }
261 };
262
263} // namespace mesh
264/*---------------------------------------------------------------------------*/
265/*---------------------------------------------------------------------------*/
266
267} // namespace Arcane
268
269/*---------------------------------------------------------------------------*/
270/*---------------------------------------------------------------------------*/
271
272#ifdef ARCANE_HAS_POLYHEDRAL_MESH_TOOLS
273
274/*---------------------------------------------------------------------------*/
275/*---------------------------------------------------------------------------*/
276
277namespace Arcane
278{
279
280/*---------------------------------------------------------------------------*/
281/*---------------------------------------------------------------------------*/
282
283namespace mesh
284{
285
286 /*---------------------------------------------------------------------------*/
287 /*---------------------------------------------------------------------------*/
288
289 class PolyhedralMeshImpl
290 {
291 ISubDomain* m_subdomain;
292 Neo::Mesh m_mesh{ "Test" };
293
294 template <eItemKind IK>
295 class ItemKindTraits
296 {
297 static const Neo::ItemKind item_kind = Neo::ItemKind::IK_None;
298 };
299
300 static Neo::ItemKind itemKindArcaneToNeo(eItemKind ik)
301 {
302 switch (ik) {
303 case IK_Cell:
304 return Neo::ItemKind::IK_Cell;
305 case IK_Face:
306 return Neo::ItemKind::IK_Face;
307 case IK_Edge:
308 return Neo::ItemKind::IK_Edge;
309 case IK_Node:
310 return Neo::ItemKind::IK_Node;
311 case IK_DoF:
312 return Neo::ItemKind::IK_Dof;
313 case IK_Unknown:
314 case IK_Particle:
315 return Neo::ItemKind::IK_None;
316 }
317 return Neo::ItemKind::IK_Node;
318 }
319
320 public:
321
322 class ItemLocalIds
323 {
324 Neo::FutureItemRange m_future_items;
325
326 public:
327 void fillArrayView(Int32ArrayView local_ids, Neo::EndOfMeshUpdate mesh_state)
328 {
329 auto lids = m_future_items.get(mesh_state);
330 std::copy(lids.begin(),lids.end(),local_ids.begin());
331 }
332 friend class PolyhedralMeshImpl;
333 };
334
335 public:
336
337 explicit PolyhedralMeshImpl(ISubDomain* subDomain)
338 : m_subdomain(subDomain)
339 {}
340
341 public:
342
343 String name() const { return m_mesh.name(); }
344
345 Integer dimension() const { return m_mesh.dimension(); }
346
347 Integer nbNode() const { return m_mesh.nbNodes(); }
348 Integer nbEdge() const { return m_mesh.nbEdges(); }
349 Integer nbFace() const { return m_mesh.nbFaces(); }
350 Integer nbCell() const { return m_mesh.nbCells(); }
351 Integer nbItem(eItemKind ik) const { return m_mesh.nbItems(itemKindArcaneToNeo(ik)); }
352
353 static void _setFaceInfos(Int32 mod_flags, Face& face)
354 {
355 Int32 face_flags = face.itemBase().flags();
356 face_flags &= ~ItemFlags::II_InterfaceFlags;
357 face_flags |= mod_flags;
358 face.mutableItemBase().setFlags(face_flags);
359 }
360
361 /*---------------------------------------------------------------------------*/
362
363 void addFamily(eItemKind ik, const String& name)
364 {
365 m_mesh.addFamily(itemKindArcaneToNeo(ik), name.localstr());
366 }
367
368 /*---------------------------------------------------------------------------*/
369
370 void scheduleAddItems(PolyhedralFamily* arcane_item_family,
371 Int64ConstSmallSpan uids,
372 ItemLocalIds& item_local_ids)
373 {
374 auto& added_items = item_local_ids.m_future_items;
375 auto& item_family = m_mesh.findFamily(itemKindArcaneToNeo(arcane_item_family->itemKind()),
376 arcane_item_family->name().localstr());
377 m_mesh.scheduleAddItems(item_family, std::vector<Int64>{ uids.begin(), uids.end() }, added_items);
378 // add arcane items
379 auto& mesh_graph = m_mesh.internalMeshGraph();
380 item_family.addMeshScalarProperty<Neo::utils::Int32>(PolyhedralFamily::m_arcane_item_lids_property_name.localstr());
381 mesh_graph.addAlgorithm(Neo::MeshKernel::InProperty{ item_family, item_family.lidPropName() },
382 Neo::MeshKernel::OutProperty{ item_family, PolyhedralFamily::m_arcane_item_lids_property_name.localstr() },
383 [arcane_item_family, uids,added_items](Neo::ItemLidsProperty const& lids_property,
384 Neo::MeshScalarPropertyT<Neo::utils::Int32>&) {
385 Int32UniqueArray arcane_items(uids.size());
386 arcane_item_family->addItems(uids, arcane_items);
387 arcane_item_family->traceMng()->debug(Trace::Highest) << arcane_items;
388 // debug check lid matching. maybe to remove if too coostly
389 auto neo_lids = lids_property.values();
390 if (!std::equal(neo_lids.begin(), neo_lids.end(), arcane_items.begin()))
391 if (!std::equal(added_items.new_items.begin(), added_items.new_items.end(), arcane_items.begin()))
392 arcane_item_family->traceMng()->fatal() << "Inconsistent item lids generation between Arcane and Neo.";
393 });
394 }
395
396 /*---------------------------------------------------------------------------*/
397
398 void scheduleRemoveItems(PolyhedralFamily* arcane_item_family,
399 Int32ConstArrayView local_ids)
400 {
401 auto& item_family = m_mesh.findFamily(itemKindArcaneToNeo(arcane_item_family->itemKind()),
402 arcane_item_family->name().localstr());
403 Neo::ItemRange removed_items{Neo::ItemLocalIds{{local_ids.begin(),local_ids.end()},0,0}};
404 m_mesh.scheduleRemoveItems(item_family, removed_items);
405 // Remove Arcane items
406 auto& mesh_graph = m_mesh.internalMeshGraph();
407 item_family.addMeshScalarProperty<Neo::utils::Int32>(PolyhedralFamily::m_arcane_remove_item_property_name.localstr());
408 mesh_graph.addAlgorithm(Neo::MeshKernel::InProperty{ item_family, m_mesh._removeItemPropertyName(item_family) },
409 Neo::MeshKernel::OutProperty{ item_family, PolyhedralFamily::m_arcane_remove_item_property_name.localstr() },
410 [arcane_item_family,local_ids](Neo::MeshScalarPropertyT<Neo::utils::Int32> const&,
411 Neo::MeshScalarPropertyT<Neo::utils::Int32>&) {
412 // plutôt utiliser remove property ?
413 arcane_item_family->removeItems(local_ids);
414 });
415 }
416
417 /*---------------------------------------------------------------------------*/
418
419 void scheduleAddConnectivity(PolyhedralFamily* arcane_source_item_family,
420 ItemLocalIds& source_items,
421 Integer nb_connected_items_per_item,
422 PolyhedralFamily* arcane_target_item_family,
423 Int64ConstArrayView target_items_uids,
424 String const& name)
425 {
426 // add connectivity in Neo
427 _scheduleAddConnectivity(arcane_source_item_family,
428 source_items,
429 nb_connected_items_per_item,
430 arcane_target_item_family,
431 target_items_uids,
432 name);
433 }
434
435 /*---------------------------------------------------------------------------*/
436
437 void scheduleAddConnectivity(PolyhedralFamily* arcane_source_item_family,
438 ItemLocalIds& source_items,
439 Int32ConstSmallSpan nb_connected_items_per_item,
440 PolyhedralFamily* arcane_target_item_family,
441 Int64ConstSmallSpan target_items_uids,
442 String const& connectivity_name)
443 {
444 _scheduleAddConnectivity(arcane_source_item_family,
445 source_items,
446 std::vector<Int32>{ nb_connected_items_per_item.begin(), nb_connected_items_per_item.end() },
447 arcane_target_item_family,
448 target_items_uids,
449 connectivity_name);
450 }
451
452 /*---------------------------------------------------------------------------*/
453
454 // template to handle nb_items_per_item type (an int or an array)
455 template <typename ConnectivitySizeType>
456 void _scheduleAddConnectivity(PolyhedralFamily* arcane_source_item_family,
457 ItemLocalIds& source_items,
458 ConnectivitySizeType&& nb_connected_items_per_item,
459 PolyhedralFamily* arcane_target_item_family,
460 Int64ConstSmallSpan target_item_uids,
461 String const& connectivity_name)
462 {
463 // add connectivity in Neo
464 auto& source_family = m_mesh.findFamily(itemKindArcaneToNeo(arcane_source_item_family->itemKind()),
465 arcane_source_item_family->name().localstr());
466 auto& target_family = m_mesh.findFamily(itemKindArcaneToNeo(arcane_target_item_family->itemKind()),
467 arcane_target_item_family->name().localstr());
468 // Remove connectivities with a null item
469 std::vector<Int64> target_item_uids_filtered;
470 target_item_uids_filtered.reserve(target_item_uids.size());
471 std::copy_if(target_item_uids.begin(),
472 target_item_uids.end(),
473 std::back_inserter(target_item_uids_filtered),
474 [](auto uid) { return uid != NULL_ITEM_UNIQUE_ID; });
475 // Add connectivity in Neo (async)
476 m_mesh.scheduleAddConnectivity(source_family, source_items.m_future_items, target_family,
477 std::forward<ConnectivitySizeType>(nb_connected_items_per_item),
478 std::move(target_item_uids_filtered),
479 connectivity_name.localstr());
480 // Register Neo connectivities in Arcane
481 auto& mesh_graph = m_mesh.internalMeshGraph();
482 std::string connectivity_add_output_property_name = std::string{ "EndOf" } + connectivity_name.localstr() + "Add";
483 source_family.addScalarProperty<Neo::utils::Int32>(connectivity_add_output_property_name);
484 mesh_graph.addAlgorithm(Neo::MeshKernel::InProperty{ source_family, connectivity_name.localstr() },
485 Neo::MeshKernel::OutProperty{ source_family, connectivity_add_output_property_name },
486 [arcane_source_item_family, arcane_target_item_family, &source_family, &target_family, this, connectivity_name](Neo::Mesh::ConnectivityPropertyType const&,
487 Neo::ScalarPropertyT<Neo::utils::Int32>&) {
488 auto item_internal_connectivity_list = arcane_source_item_family->itemInternalConnectivityList();
489 // todo check if families are default families
490 auto connectivity = m_mesh.getConnectivity(source_family, target_family, connectivity_name.localstr());
491 // to access connectivity data (for initializing Arcane connectivities) create a proxy on Neo connectivity
492 auto& connectivity_values = source_family.getConcreteProperty<Neo::Mesh::ConnectivityPropertyType>(connectivity_name.localstr());
493 Neo::MeshArrayPropertyProxyT<Neo::Mesh::ConnectivityPropertyType::PropertyDataType> connectivity_proxy{connectivity_values};
494 auto nb_item_data = connectivity_proxy.arrayPropertyOffsets();
495 auto nb_item_size = connectivity_proxy.arrayPropertyOffsetsSize(); // todo check MeshArrayProperty::size
496 item_internal_connectivity_list->_setConnectivityNbItem(arcane_target_item_family->itemKind(),
497 Int32ArrayView{ Integer(nb_item_size), nb_item_data });
498 auto max_nb_connected_items = connectivity.maxNbConnectedItems();
499 item_internal_connectivity_list->_setMaxNbConnectedItem(arcane_target_item_family->itemKind(), max_nb_connected_items);
500 auto connectivity_values_data = connectivity_proxy.arrayPropertyData();
501 auto connectivity_values_size = connectivity_proxy.arrayPropertyDataSize();
502 item_internal_connectivity_list->_setConnectivityList(arcane_target_item_family->itemKind(),
503 Int32ArrayView{ Integer(connectivity_values_size), connectivity_values_data });
504 auto connectivity_index_data = connectivity_proxy.arrayPropertyIndex();
505 auto connectivity_index_size = connectivity_proxy.arrayPropertyIndexSize();
506 item_internal_connectivity_list->_setConnectivityIndex(arcane_target_item_family->itemKind(),
507 Int32ArrayView{ Integer(connectivity_index_size), connectivity_index_data });
508 });
509 // If FaceToCellConnectivity Add face flags II_Boundary, II_SubdomainBoundary, II_HasFrontCell, II_HasBackCell
510 if (arcane_source_item_family->itemKind() == IK_Face && arcane_target_item_family->itemKind() == IK_Cell) {
511 std::string flag_definition_output_property_name{ "EndOfFlagDefinition" };
512 source_family.addScalarProperty<Neo::utils::Int32>(flag_definition_output_property_name);
513 mesh_graph.addAlgorithm(Neo::MeshKernel::InProperty{ source_family, connectivity_add_output_property_name }, Neo::MeshKernel::OutProperty{ source_family, flag_definition_output_property_name },
514 [arcane_source_item_family, this, target_item_uids, &source_items](Neo::ScalarPropertyT<Neo::utils::Int32> const&, Neo::ScalarPropertyT<Neo::utils::Int32> const&) {
515 auto current_face_index = 0;
516 auto arcane_faces = arcane_source_item_family->itemInfoListView();
517 for (auto face_lid : source_items.m_future_items.new_items) {
518 Face current_face = arcane_faces[face_lid].toFace();
519 if (target_item_uids[2 * current_face_index + 1] == NULL_ITEM_LOCAL_ID) {
520 // if (current_face.frontCell().null()) {
521 // Reste uniquement la back_cell ou aucune maille.
522 Int32 mod_flags = (target_item_uids[2 * current_face_index] != NULL_ITEM_LOCAL_ID) ? (ItemFlags::II_Boundary | ItemFlags::II_HasBackCell | ItemFlags::II_BackCellIsFirst) : 0;
523 _setFaceInfos(mod_flags, current_face);
524 }
525 else if (target_item_uids[2 * current_face_index] == NULL_ITEM_LOCAL_ID) {
526 // Reste uniquement la front cell
527 _setFaceInfos(ItemFlags::II_Boundary | ItemFlags::II_HasFrontCell | ItemFlags::II_FrontCellIsFirst, current_face);
528 }
529 else {
530 // Il y a deux mailles connectées.
531 _setFaceInfos(ItemFlags::II_HasFrontCell | ItemFlags::II_HasBackCell | ItemFlags::II_BackCellIsFirst, current_face);
532 }
533 ++current_face_index;
534 }
535 });
536 }
537 }
538
539 /*---------------------------------------------------------------------------*/
540
541 void scheduleSetItemCoordinates(PolyhedralFamily* item_family, ItemLocalIds& local_ids, Real3ConstSmallSpan item_coords, VariableItemReal3& arcane_coords)
542 {
543 auto& _item_family = m_mesh.findFamily(itemKindArcaneToNeo(item_family->itemKind()), item_family->name().localstr());
544 std::vector<Neo::utils::Real3> _node_coords(item_coords.size());
545 auto node_index = 0;
546 for (auto&& node_coord : item_coords) {
547 _node_coords[node_index++] = Neo::utils::Real3{ node_coord.x, node_coord.y, node_coord.z };
548 }
549 m_mesh.scheduleSetItemCoords(_item_family, local_ids.m_future_items, _node_coords);
550 // Fill Arcane Variable
551 auto& mesh_graph = m_mesh.internalMeshGraph();
552 _item_family.addScalarProperty<Int32>("NoOutProperty42"); // todo remove : create noOutput algo in Neo
553 mesh_graph.addAlgorithm(Neo::MeshKernel::InProperty{ _item_family, m_mesh._itemCoordPropertyName(_item_family) },
554 Neo::MeshKernel::OutProperty{ _item_family, "NoOutProperty42" },
555 [this, item_family, &_item_family, &arcane_coords](Neo::Mesh::CoordPropertyType const& item_coords_property,
556 Neo::ScalarPropertyT<Neo::utils::Int32>&) {
557 // enumerate nodes : ensure again Arcane/Neo local_ids are identicals
558 auto& all_items = _item_family.all();
559 VariableNodeReal3 node_coords{ VariableBuildInfo{ item_family->mesh(), "NodeCoord" } };
560 for (auto item : all_items) {
561 arcane_coords[ItemLocalId{ item }] = { item_coords_property[item].x,
562 item_coords_property[item].y,
563 item_coords_property[item].z };
564 // std::cout << "x y z : " << item_coords_property[item].x << " "
565 // << item_coords_property[item].y << " "
566 // << item_coords_property[item].z;
567 }
568 });
569 }
570
571 /*---------------------------------------------------------------------------*/
572
573 Neo::EndOfMeshUpdate applyScheduledOperations() noexcept
574 {
575 return m_mesh.applyScheduledOperations();
576 }
577
578 };
579
580 template <> class PolyhedralMeshImpl::ItemKindTraits<IK_Cell>
581 {
582 static const Neo::ItemKind item_kind = Neo::ItemKind::IK_Cell;
583 };
584 template <> class PolyhedralMeshImpl::ItemKindTraits<IK_Face>
585 {
586 static const Neo::ItemKind item_kind = Neo::ItemKind::IK_Face;
587 };
588 template <> class PolyhedralMeshImpl::ItemKindTraits<IK_Edge>
589 {
590 static const Neo::ItemKind item_kind = Neo::ItemKind::IK_Edge;
591 };
592 template <> class PolyhedralMeshImpl::ItemKindTraits<IK_Node>
593 {
594 static const Neo::ItemKind item_kind = Neo::ItemKind::IK_Node;
595 };
596 template <> class PolyhedralMeshImpl::ItemKindTraits<IK_DoF>
597 {
598 static const Neo::ItemKind item_kind = Neo::ItemKind::IK_Dof;
599 };
600
601} // End namespace mesh
602
603/*---------------------------------------------------------------------------*/
604/*---------------------------------------------------------------------------*/
605
606class mesh::PolyhedralMesh::PolyhedralMeshModifier
607: public IPolyhedralMeshModifier
608{
609 public:
610
611 explicit PolyhedralMeshModifier(PolyhedralMesh* mesh)
612 : m_mesh(mesh)
613 {}
614
615 void addItems(Int64ConstArrayView unique_ids, Int32ArrayView local_ids, eItemKind ik, const String& family_name) override
616 {
617 m_mesh->addItems(unique_ids,local_ids,ik,family_name);
618 }
619
620 void removeItems(Int32ConstArrayView local_ids, eItemKind ik, const String& family_name) override
621 {
622 m_mesh->removeItems(local_ids, ik, family_name);
623 }
624
625 private:
626 PolyhedralMesh* m_mesh;
627};
628
629/*---------------------------------------------------------------------------*/
630/*---------------------------------------------------------------------------*/
631
632class mesh::PolyhedralMesh::InternalApi
633: public IMeshInternal
634, public IMeshModifierInternal
635{
636 public:
637
638 explicit InternalApi(PolyhedralMesh* mesh)
639 : m_mesh(mesh)
640 , m_connectivity_mng(std::make_unique<ItemConnectivityMng>(mesh->traceMng()))
641 , m_polyhedral_mesh_modifier(std::make_unique<PolyhedralMeshModifier>(mesh))
642 {}
643
644 public:
645
646 void setMeshKind(const MeshKind& v) override
647 {
648 if (v.meshStructure() != eMeshStructure::Polyhedral && v.meshAMRKind() != eMeshAMRKind::None) {
649 ARCANE_FATAL("Incompatible mesh structure ({0}) and amr kind ({1}) for Polyhedral mesh {2}. Must be (Polyhedral,None). ",
650 v.meshStructure(),v.meshAMRKind(), m_mesh->name());
651 }
652 m_mesh->m_mesh_kind = v;
653 }
654
655 IItemConnectivityMng* dofConnectivityMng() const noexcept override
656 {
657 return m_connectivity_mng.get();
658 }
659
660 IPolyhedralMeshModifier* polyhedralMeshModifier() const noexcept override
661 {
662 return m_polyhedral_mesh_modifier.get();
663 }
664
665 void removeNeedRemoveMarkedItems() override
666 {
667 m_mesh->traceMng()->warning() << "PolyhedralMesh::removeNeedRemoveMarkedItems() not yet implemented in PolyhedralMesh";
668 }
669
670 private:
671
672 PolyhedralMesh* m_mesh = nullptr;
673 std::unique_ptr<IItemConnectivityMng> m_connectivity_mng = nullptr;
674 std::unique_ptr<IPolyhedralMeshModifier> m_polyhedral_mesh_modifier = nullptr;
675};
676
677/*---------------------------------------------------------------------------*/
678/*---------------------------------------------------------------------------*/
679
680class mesh::PolyhedralMesh::NoCompactionMeshCompacter
681: public IMeshCompacter
682{
683 public:
684 explicit NoCompactionMeshCompacter(PolyhedralMesh* mesh)
685 : m_mesh(mesh)
686 , m_trace_mng(mesh->traceMng()){}
687
688 void doAllActions() override {_info();};
689
690 void beginCompact() override {_info();};
691 void compactVariablesAndGroups() override {_info();};
692 void updateInternalReferences() override {_info();};
693 void endCompact() override {_info();};
694 void finalizeCompact() override {_info();};
695
696 IMesh* mesh() const override {return m_mesh;};
697
698 const ItemFamilyCompactInfos* findCompactInfos(IItemFamily* family) const override {_info(); return nullptr;}
699
700 ePhase phase() const override {_info(); return ePhase::Ended;}
701
702 void setSorted(bool v) override {_info();};
703
704 bool isSorted() const override {_info();return false;};
705
706 ItemFamilyCollection families() const override {_info();return ItemFamilyCollection {};};
707
708 void _setCompactVariablesAndGroups(bool v) override {_info();};
709
710 private:
711 PolyhedralMesh* m_mesh = nullptr;
712 ITraceMng* m_trace_mng = nullptr;
713
714 void _info() const {m_trace_mng->info() << A_FUNCINFO << "No compacting in PolyhedralMesh";}
715};
716
717/*---------------------------------------------------------------------------*/
718/*---------------------------------------------------------------------------*/
719
720class mesh::PolyhedralMesh::NoCompactionMeshCompactMng
721: public IMeshCompactMng
722{
723 public:
724 explicit NoCompactionMeshCompactMng(PolyhedralMesh* mesh)
725 : m_mesh(mesh)
726 , m_trace_mng(mesh->traceMng())
727 , m_mesh_compacter{std::make_unique<NoCompactionMeshCompacter>(m_mesh)}
728 {}
729
730 IMesh* mesh() const override {return m_mesh;}
731 IMeshCompacter* beginCompact() override
732 {
733 _info();
734 return m_mesh_compacter.get();
735 }
736
737 IMeshCompacter* beginCompact(IItemFamily* family) override
738 {
739 ARCANE_UNUSED(family);
740 _info();
741 return m_mesh_compacter.get();
742 };
743
744 void endCompact() override {_info();};
745
746 IMeshCompacter* compacter() override
747 {
748 _info();
749 return m_mesh_compacter.get();
750 };
751
752
753 private:
754 PolyhedralMesh* m_mesh = nullptr;
755 ITraceMng* m_trace_mng = nullptr;
756 std::unique_ptr<IMeshCompacter> m_mesh_compacter = nullptr;
757
758 void _info() const {m_trace_mng->info() << A_FUNCINFO << "No compacting in PolyhedralMesh";}
759};
760
761/*---------------------------------------------------------------------------*/
762/*---------------------------------------------------------------------------*/
763
764mesh::PolyhedralMesh::
765~PolyhedralMesh()
766{
767 m_mesh_handle._setMesh(nullptr);
768}
769
770/*---------------------------------------------------------------------------*/
771/*---------------------------------------------------------------------------*/
772
773ITraceMng* mesh::PolyhedralMesh::
774traceMng()
775{
776 return m_subdomain->traceMng();
777}
778
779/*---------------------------------------------------------------------------*/
780/*---------------------------------------------------------------------------*/
781
782MeshHandle mesh::PolyhedralMesh::
783handle() const
784{
785 return m_mesh_handle;
786}
787
788/*---------------------------------------------------------------------------*/
789/*---------------------------------------------------------------------------*/
790
791mesh::PolyhedralMesh::
792PolyhedralMesh(ISubDomain* subdomain, const MeshBuildInfo& mbi)
793: EmptyMesh{ subdomain->traceMng() }
794, m_name{ mbi.name() }
795, m_subdomain{ subdomain }
796, m_mesh_handle{ m_subdomain->defaultMeshHandle() }
797, m_properties(std::make_unique<Properties>(subdomain->propertyMng(), String("ArcaneMeshProperties_") + m_name))
798, m_mesh{ std::make_unique<mesh::PolyhedralMeshImpl>(m_subdomain) }
799, m_parallel_mng{ mbi.parallelMngRef().get() }
800, m_mesh_part_info{ makeMeshPartInfoFromParallelMng(m_parallel_mng) }
801, m_item_type_mng(ItemTypeMng::_singleton())
802, m_mesh_kind(mbi.meshKind())
803, m_initial_allocator(*this)
804, m_variable_mng{ subdomain->variableMng() }
805, m_mesh_checker{ this }
806, m_internal_api{std::make_unique<InternalApi>(this)}
807, m_compact_mng{std::make_unique<NoCompactionMeshCompactMng>(this)}
808, m_mesh_utilities{std::make_unique<UnstructuredMeshUtilities>(this)}
809, m_mesh_exchange_mng{std::make_unique<MeshExchangeMng>(this)}
810, m_item_family_network{std::make_unique<ItemFamilyNetwork>(m_trace_mng)}
811, m_ghost_layer_mng{std::make_unique<GhostLayerMng>(m_trace_mng)}
812{
813 m_mesh_handle._setMesh(this);
814 m_mesh_item_internal_list.mesh = this;
815 m_default_arcane_families.fill(nullptr);
816}
817
818/*---------------------------------------------------------------------------*/
819/*---------------------------------------------------------------------------*/
820
821void Arcane::mesh::PolyhedralMesh::
822allocateItems(const Arcane::ItemAllocationInfo& item_allocation_info)
823{
824 // Second step read a vtk polyhedral mesh
825 m_subdomain->traceMng()->info() << "--PolyhedralMesh : allocate items --";
826 UniqueArray<PolyhedralMeshImpl::ItemLocalIds> item_local_ids(item_allocation_info.family_infos.size());
827 auto family_index = 0;
828 // Prepare item creation
829 for (auto& family_info : item_allocation_info.family_infos) {
830 bool create_if_needed = true;
831 auto* item_family = _findItemFamily(family_info.item_kind, family_info.name,create_if_needed);
832 m_trace_mng->debug() << " Create items " << family_info.name;
833 m_mesh->scheduleAddItems(item_family, family_info.item_uids, item_local_ids[family_index++]);
834 }
835 // Prepare connectivity creation
836 family_index = 0;
837 for (auto& family_info : item_allocation_info.family_infos) {
838 auto* item_family = _findItemFamily(family_info.item_kind, family_info.name);
839 m_trace_mng->debug(Trace::High) << "Current family " << family_info.name;
840 for (auto& current_connected_family_info : family_info.connected_family_info) {
841 auto connected_family = _findItemFamily(current_connected_family_info.item_kind, current_connected_family_info.name);
842 m_trace_mng->debug(Trace::High) << " Create connectivity " << current_connected_family_info.connectivity_name;
843 // check if connected family exists
844 if (!connected_family) {
845 ARCANE_WARNING((String::format("Cannot find family {0} with kind {1} "
846 "The connectivity between {1} and this family is skipped",
847 current_connected_family_info.name,
848 current_connected_family_info.item_kind,
849 item_family->name())
850 .localstr()));
851 continue;
852 }
853 m_mesh->scheduleAddConnectivity(item_family,
854 item_local_ids[family_index],
855 current_connected_family_info.nb_connected_items_per_item,
856 connected_family,
857 current_connected_family_info.connected_items_uids,
858 current_connected_family_info.connectivity_name);
859 }
860 ++family_index;
861 }
862 // Create items and connectivities
863 m_mesh->applyScheduledOperations();
864 // Create variable for coordinates. This has to be done before call to family::endUpdate. Todo add to the graph
865 for (auto& family_info : item_allocation_info.family_infos) {
866 if (family_info.item_kind != IK_Node && family_info.item_coordinates.empty()) { // variable is created for node even if no coords (parallel)
867 continue;
868 }
869 auto* item_family = _findItemFamily(family_info.item_kind, family_info.name);
870 if (item_family == itemFamily(IK_Node)) { // mesh node coords
871 m_arcane_node_coords = std::make_unique<VariableNodeReal3>(VariableBuildInfo(this, family_info.item_coordinates_variable_name));
872 m_arcane_node_coords->setUsed(true);
873 }
874 else {
875 auto arcane_item_coords_var_ptr = std::make_unique<VariableItemReal3>(VariableBuildInfo(this, family_info.item_coordinates_variable_name),
876 item_family->itemKind());
877 arcane_item_coords_var_ptr->setUsed(true);
878 m_arcane_item_coords.push_back(std::move(arcane_item_coords_var_ptr));
879 }
880 }
881 // Call Arcane ItemFamily endUpdate
882 for (auto& family : m_arcane_families) {
883 family->endUpdate();
884 }
885 endUpdate();
886 // Add coordinates when needed (nodes, or dof, or particles...)
887 family_index = 0;
888 auto index = 0;
889 for (auto& family_info : item_allocation_info.family_infos) {
890 if (family_info.item_coordinates.empty()) {
891 ++family_index;
892 continue;
893 }
894 auto* item_family = _findItemFamily(family_info.item_kind, family_info.name);
895 if (item_family == itemFamily(IK_Node)) { // mesh node coords
896 m_mesh->scheduleSetItemCoordinates(item_family, item_local_ids[family_index], family_info.item_coordinates, *m_arcane_node_coords);
897 }
898 else
899 m_mesh->scheduleSetItemCoordinates(item_family, item_local_ids[family_index], family_info.item_coordinates, *m_arcane_item_coords[index++].get());
900 }
901 m_mesh->applyScheduledOperations();
902 m_is_allocated = true;
903 // indicates mesh contains general Cells
904 itemTypeMng()->setMeshWithGeneralCells(this);
905}
906
907/*---------------------------------------------------------------------------*/
908/*---------------------------------------------------------------------------*/
909
911name() const
912{
913 return m_name;
914}
915
916/*---------------------------------------------------------------------------*/
917/*---------------------------------------------------------------------------*/
918
920dimension()
921{
922 return m_mesh->dimension();
923}
924
925/*---------------------------------------------------------------------------*/
926/*---------------------------------------------------------------------------*/
927
929nbNode()
930{
931 return m_mesh->nbNode();
932}
933
934/*---------------------------------------------------------------------------*/
935/*---------------------------------------------------------------------------*/
936
938nbEdge()
939{
940 return m_mesh->nbEdge();
941}
942
943/*---------------------------------------------------------------------------*/
944/*---------------------------------------------------------------------------*/
945
947nbFace()
948{
949 return m_mesh->nbFace();
950}
951
952/*---------------------------------------------------------------------------*/
953/*---------------------------------------------------------------------------*/
954
956nbCell()
957{
958 return m_mesh->nbCell();
959}
960
961/*---------------------------------------------------------------------------*/
962/*---------------------------------------------------------------------------*/
963
966{
967 return m_mesh->nbItem(ik);
968}
969
970/*---------------------------------------------------------------------------*/
971/*---------------------------------------------------------------------------*/
972
974allNodes()
975{
976 if (m_default_arcane_families[IK_Node])
977 return m_default_arcane_families[IK_Node]->allItems();
978 else
979 return NodeGroup{};
980}
981
982/*---------------------------------------------------------------------------*/
983/*---------------------------------------------------------------------------*/
984
986allEdges()
987{
988 if (m_default_arcane_families[IK_Edge])
989 return m_default_arcane_families[IK_Edge]->allItems();
990 else
991 return EdgeGroup{};
992}
993
994/*---------------------------------------------------------------------------*/
995/*---------------------------------------------------------------------------*/
996
998allFaces()
999{
1000 if (m_default_arcane_families[IK_Face])
1001 return m_default_arcane_families[IK_Face]->allItems();
1002 else
1003 return FaceGroup{};
1004}
1005
1006/*---------------------------------------------------------------------------*/
1007/*---------------------------------------------------------------------------*/
1008
1010allCells()
1011{
1012 if (m_default_arcane_families[IK_Cell])
1013 return m_default_arcane_families[IK_Cell]->allItems();
1014 else
1015 return CellGroup{};
1016}
1017
1018/*---------------------------------------------------------------------------*/
1019/*---------------------------------------------------------------------------*/
1020
1022ownNodes()
1023{
1024 if (m_default_arcane_families[IK_Node])
1025 return m_default_arcane_families[IK_Node]->allItems().own();
1026 else
1027 return NodeGroup{};
1028}
1029
1030/*---------------------------------------------------------------------------*/
1031/*---------------------------------------------------------------------------*/
1032
1034ownEdges()
1035{
1036 if (m_default_arcane_families[IK_Edge])
1037 return m_default_arcane_families[IK_Edge]->allItems().own();
1038 else
1039 return EdgeGroup{};
1040}
1041
1042/*---------------------------------------------------------------------------*/
1043/*---------------------------------------------------------------------------*/
1044
1046ownFaces()
1047{
1048 if (m_default_arcane_families[IK_Face])
1049 return m_default_arcane_families[IK_Face]->allItems().own();
1050 else
1051 return FaceGroup{};
1052}
1053
1054/*---------------------------------------------------------------------------*/
1055/*---------------------------------------------------------------------------*/
1056
1058ownCells()
1059{
1060 if (m_default_arcane_families[IK_Cell])
1061 return m_default_arcane_families[IK_Cell]->allItems().own();
1062 else
1063 return CellGroup{};
1064}
1065
1066/*---------------------------------------------------------------------------*/
1067/*---------------------------------------------------------------------------*/
1068
1070outerFaces()
1071{
1072 if (m_default_arcane_families[IK_Cell])
1073 return m_default_arcane_families[IK_Cell]->allItems().outerFaceGroup();
1074 else
1075 return FaceGroup{};
1076}
1077
1078/*---------------------------------------------------------------------------*/
1079/*---------------------------------------------------------------------------*/
1080
1081mesh::PolyhedralFamily* mesh::PolyhedralMesh::
1082_createItemFamily(eItemKind ik, const String& name)
1083{
1084 m_mesh->addFamily(ik, name);
1085 m_arcane_families.push_back(std::make_unique<PolyhedralFamily>(this, ik, name));
1086 auto current_family = m_arcane_families.back().get();
1087 if (m_default_arcane_families[ik] == nullptr) {
1088 m_default_arcane_families[ik] = current_family;
1089 _updateMeshInternalList(ik);
1090 }
1091 m_item_family_collection.add(current_family);
1092 current_family->build();
1093 return current_family;
1094}
1095
1096/*---------------------------------------------------------------------------*/
1097/*---------------------------------------------------------------------------*/
1098
1099IItemFamily* mesh::PolyhedralMesh::
1100createItemFamily(eItemKind ik, const String& name)
1101{
1102 return _createItemFamily(ik, name);
1103}
1104
1105/*---------------------------------------------------------------------------*/
1106/*---------------------------------------------------------------------------*/
1107
1108void mesh::PolyhedralMesh::
1109_createUnitMesh()
1110{
1111 createItemFamily(IK_Cell, "CellFamily");
1112 createItemFamily(IK_Node, "NodeFamily");
1113 auto cell_family = m_default_arcane_families[IK_Cell];
1114 auto node_family = m_default_arcane_families[IK_Node];
1115 Int64UniqueArray cell_uids{ 0 }, node_uids{ 0, 1, 2, 3, 4, 5 };
1116 // todo add a cell_lids struct (containing future)
1117 PolyhedralMeshImpl::ItemLocalIds cell_lids, node_lids;
1118 m_mesh->scheduleAddItems(cell_family, cell_uids.constView(), cell_lids);
1119 m_mesh->scheduleAddItems(node_family, node_uids.constView(), node_lids);
1120 int nb_node = 6;
1121 m_mesh->scheduleAddConnectivity(cell_family, cell_lids, nb_node, node_family, node_uids, String{ "CellToNodes" });
1122 m_mesh->scheduleAddConnectivity(node_family, node_lids, 1, cell_family,
1123 Int64UniqueArray{ 0, 0, 0, 0, 0, 0 }, String{ "NodeToCells" });
1124 m_mesh->applyScheduledOperations();
1125 cell_family->endUpdate();
1126 node_family->endUpdate();
1127 endUpdate();
1128 // Mimic what IMeshModifier::endUpdate would do => default families are completed.
1129 // Families created after a first endUpdate call are not default families
1130}
1131
1132/*---------------------------------------------------------------------------*/
1133/*---------------------------------------------------------------------------*/
1134
1136endUpdate()
1137{
1138 // create empty default families not already created
1139 for (auto ik = 0; ik < NB_ITEM_KIND; ++ik) {
1140 if (m_default_arcane_families[ik] == nullptr && ik != eItemKind::IK_DoF) {
1141 String name = String::concat(itemKindName((eItemKind)ik), "EmptyFamily");
1142 m_empty_arcane_families[ik] = std::make_unique<mesh::PolyhedralFamily>(this, (eItemKind)ik, name);
1143 m_default_arcane_families[ik] = m_empty_arcane_families[ik].get();
1144 }
1145 }
1146 // Wip add a first version of a family network. Should be done automatically in addConectivity
1147 m_item_family_network->addDependency(itemFamily(IK_Cell), itemFamily(IK_Node), nullptr);
1148 m_item_family_network->addDependency(itemFamily(IK_Cell), itemFamily(IK_Face), nullptr);
1149 m_item_family_network->addDependency(itemFamily(IK_Cell), itemFamily(IK_Edge), nullptr);
1150 m_item_family_network->addDependency(itemFamily(IK_Face), itemFamily(IK_Node),nullptr);
1151 m_item_family_network->addDependency(itemFamily(IK_Edge), itemFamily(IK_Node),nullptr);
1152 m_item_family_network->addRelation(itemFamily(IK_Face), itemFamily(IK_Edge),nullptr);
1153 m_item_family_network->addRelation(itemFamily(IK_Face), itemFamily(IK_Face),nullptr);
1154 m_item_family_network->addRelation(itemFamily(IK_Face), itemFamily(IK_Cell),nullptr);
1155 m_item_family_network->addRelation(itemFamily(IK_Edge), itemFamily(IK_Cell),nullptr);
1156 m_item_family_network->addRelation(itemFamily(IK_Node), itemFamily(IK_Cell),nullptr);
1157 m_item_family_network->addRelation(itemFamily(IK_Node), itemFamily(IK_Face),nullptr);
1158 m_item_family_network->addRelation(itemFamily(IK_Node), itemFamily(IK_Edge),nullptr);
1159 m_item_family_network->addRelation(itemFamily(IK_Edge), itemFamily(IK_Face),nullptr);
1160
1161}
1162
1163/*---------------------------------------------------------------------------*/
1164/*---------------------------------------------------------------------------*/
1165
1166IItemFamily* mesh::PolyhedralMesh::
1167nodeFamily()
1168{
1169 return m_default_arcane_families[IK_Node];
1170}
1171
1172/*---------------------------------------------------------------------------*/
1173/*---------------------------------------------------------------------------*/
1174
1175IItemFamily* mesh::PolyhedralMesh::
1176edgeFamily()
1177{
1178 return m_default_arcane_families[IK_Edge];
1179}
1180
1181/*---------------------------------------------------------------------------*/
1182/*---------------------------------------------------------------------------*/
1183
1184IItemFamily* mesh::PolyhedralMesh::
1185faceFamily()
1186{
1187 return m_default_arcane_families[IK_Face];
1188}
1189
1190/*---------------------------------------------------------------------------*/
1191/*---------------------------------------------------------------------------*/
1192
1193IItemFamily* mesh::PolyhedralMesh::
1194cellFamily()
1195{
1196 return m_default_arcane_families[IK_Cell];
1197}
1198
1199void mesh::PolyhedralMesh::
1200_updateMeshInternalList(eItemKind kind)
1201{
1202 switch (kind) {
1203 case IK_Cell:
1204 m_mesh_item_internal_list.cells = m_default_arcane_families[kind]->itemsInternal();
1205 m_mesh_item_internal_list._internalSetCellSharedInfo(m_default_arcane_families[kind]->commonItemSharedInfo());
1206 break;
1207 case IK_Face:
1208 m_mesh_item_internal_list.faces = m_default_arcane_families[kind]->itemsInternal();
1209 m_mesh_item_internal_list._internalSetFaceSharedInfo(m_default_arcane_families[kind]->commonItemSharedInfo());
1210 break;
1211 case IK_Edge:
1212 m_mesh_item_internal_list.edges = m_default_arcane_families[kind]->itemsInternal();
1213 m_mesh_item_internal_list._internalSetEdgeSharedInfo(m_default_arcane_families[kind]->commonItemSharedInfo());
1214 break;
1215 case IK_Node:
1216 m_mesh_item_internal_list.nodes = m_default_arcane_families[kind]->itemsInternal();
1217 m_mesh_item_internal_list._internalSetNodeSharedInfo(m_default_arcane_families[kind]->commonItemSharedInfo());
1218 break;
1219 case IK_DoF:
1220 case IK_Particle:
1221 case IK_Unknown:
1222 break;
1223 }
1224}
1225
1226/*---------------------------------------------------------------------------*/
1227/*---------------------------------------------------------------------------*/
1228
1229mesh::PolyhedralFamily* mesh::PolyhedralMesh::
1230_itemFamily(eItemKind ik)
1231{
1232 return m_default_arcane_families[ik];
1233}
1234
1235/*---------------------------------------------------------------------------*/
1236/*---------------------------------------------------------------------------*/
1237
1238IItemFamily* mesh::PolyhedralMesh::
1240{
1241 return _itemFamily(ik);
1242}
1243
1244/*---------------------------------------------------------------------------*/
1245/*---------------------------------------------------------------------------*/
1246
1247ItemTypeMng* mesh::PolyhedralMesh::
1248itemTypeMng() const
1249{
1250 return m_item_type_mng;
1251}
1252
1253/*---------------------------------------------------------------------------*/
1254/*---------------------------------------------------------------------------*/
1255
1256mesh::PolyhedralFamily* mesh::PolyhedralMesh::
1257_findItemFamily(eItemKind ik, const String& name, bool create_if_needed)
1258{
1259 // Check if is a default family
1260 auto found_family = _itemFamily(ik);
1261 if (found_family) {
1262 if (found_family->name() == name)
1263 return found_family;
1264 }
1265 for (auto& family : m_arcane_families) {
1266 if (family->itemKind() == ik && family->name() == name)
1267 return family.get();
1268 }
1269 if (!create_if_needed)
1270 return nullptr;
1271 return _createItemFamily(ik, name);
1272}
1273
1274/*---------------------------------------------------------------------------*/
1275/*---------------------------------------------------------------------------*/
1276
1277IItemFamily* mesh::PolyhedralMesh::
1278findItemFamily(eItemKind ik, const String& name, bool create_if_needed, bool register_modifier_if_created)
1279{
1280 ARCANE_UNUSED(register_modifier_if_created); // IItemFamilyModifier not yet used in polyhedral mesh
1281 return _findItemFamily(ik, name, create_if_needed);
1282}
1283
1284/*---------------------------------------------------------------------------*/
1285/*---------------------------------------------------------------------------*/
1286
1287mesh::PolyhedralFamily* mesh::PolyhedralMesh::
1288arcaneDefaultFamily(eItemKind ik)
1289{
1290 return m_default_arcane_families[ik];
1291}
1292
1293/*---------------------------------------------------------------------------*/
1294/*---------------------------------------------------------------------------*/
1295
1298{
1299 ARCANE_ASSERT(m_arcane_node_coords, ("Node coordinates not yet loaded."));
1300 return *m_arcane_node_coords;
1301}
1302
1303/*---------------------------------------------------------------------------*/
1304/*---------------------------------------------------------------------------*/
1305
1306ItemGroup mesh::PolyhedralMesh::
1307findGroup(const String& name)
1308{
1309 ItemGroup group;
1310 for (auto& family : m_arcane_families) {
1311 group = family->findGroup(name);
1312 if (!group.null())
1313 return group;
1314 }
1315 return group;
1316}
1317
1318/*---------------------------------------------------------------------------*/
1319/*---------------------------------------------------------------------------*/
1320
1322groups()
1323{
1324 m_all_groups.clear();
1325 for (auto& family : m_arcane_families) {
1326 for (ItemGroupCollection::Enumerator i_group(family->groups()); ++i_group;)
1327 m_all_groups.add(*i_group);
1328 }
1329 return m_all_groups;
1330}
1331
1332/*---------------------------------------------------------------------------*/
1333/*---------------------------------------------------------------------------*/
1334
1337{
1338 for (auto& family : m_arcane_families) {
1339 family->destroyGroups();
1340 }
1341}
1342
1343/*---------------------------------------------------------------------------*/
1344/*---------------------------------------------------------------------------*/
1345
1346IItemFamilyCollection mesh::PolyhedralMesh::
1347itemFamilies()
1348{
1349 return m_item_family_collection;
1350}
1351
1352/*---------------------------------------------------------------------------*/
1353/*---------------------------------------------------------------------------*/
1354
1355IMeshInternal* mesh::PolyhedralMesh::
1357{
1358 return m_internal_api.get();
1359}
1360
1361/*---------------------------------------------------------------------------*/
1362/*---------------------------------------------------------------------------*/
1363
1364IMeshCompactMng* mesh::PolyhedralMesh::
1366{
1367 return m_compact_mng.get();
1368}
1369
1370/*---------------------------------------------------------------------------*/
1371/*---------------------------------------------------------------------------*/
1372
1373void mesh::PolyhedralMesh::
1374addItems(Int64ConstArrayView unique_ids, Int32ArrayView local_ids, eItemKind ik, const String& family_name)
1375{
1376 auto* item_family = _findItemFamily(ik, family_name, false);
1377 PolyhedralMeshImpl::ItemLocalIds item_local_ids;
1378 m_mesh->scheduleAddItems(item_family,unique_ids,item_local_ids);
1379 auto mesh_state = m_mesh->applyScheduledOperations();
1380 item_local_ids.fillArrayView(local_ids,mesh_state);
1381}
1382
1383/*---------------------------------------------------------------------------*/
1384/*---------------------------------------------------------------------------*/
1385
1386void mesh::PolyhedralMesh::
1387removeItems(Int32ConstArrayView local_ids, eItemKind ik, const String& family_name)
1388{
1389 auto* item_family = _findItemFamily(ik, family_name, false);
1390 m_mesh->scheduleRemoveItems(item_family,local_ids);
1391 m_mesh->applyScheduledOperations();
1392}
1393
1394/*---------------------------------------------------------------------------*/
1395/*---------------------------------------------------------------------------*/
1396
1398addNodes(Int64ConstArrayView nodes_uid, Int32ArrayView nodes_lid)
1399{
1400 addItems(nodes_uid, nodes_lid, IK_Node, nodeFamily()->name());
1401}
1402
1403/*---------------------------------------------------------------------------*/
1404/*---------------------------------------------------------------------------*/
1405
1408{
1409 m_trace_mng->info() << "PolyhedralMesh::_exchangeItems() do_compact?=" << "false"
1410 << " nb_exchange=" << 0 << " version=" << 0;
1411 _exchangeItems();
1412 String check_exchange = platform::getEnvironmentVariable("ARCANE_CHECK_EXCHANGE");
1413 if (!check_exchange.null()){
1414 m_mesh_checker.checkGhostCells();
1415 m_trace_mng->pwarning() << "CHECKING SYNCHRONISATION !";
1416 m_mesh_checker.checkVariablesSynchronization();
1417 m_mesh_checker.checkItemGroupsSynchronization();
1418 }
1419 if (checkLevel()>=2)
1420 m_mesh_checker.checkValidMesh();
1421 else if (checkLevel()>=1)
1422 m_mesh_checker.checkValidConnectivity();
1423
1424}
1425
1426/*---------------------------------------------------------------------------*/
1427/*---------------------------------------------------------------------------*/
1428
1429void mesh::PolyhedralMesh::
1430_exchangeItems()
1431{
1432 // todo handle submeshes, cf. DynamicMesh
1433
1434 Trace::Setter mci(traceMng(),_className());
1435
1436 if (!m_is_dynamic)
1437 ARCANE_FATAL("property isDynamic() has to be 'true'");
1438
1439 if (arcane_debug_load_balancing){
1440 // TODO: faire cela dans le MeshExchanger et par famille.
1441 for (auto& family : m_arcane_families) {
1442 family->itemsNewOwner().checkIfSync();
1443 }
1444 }
1445
1446 IMeshExchanger* iexchanger = m_mesh_exchange_mng->beginExchange();
1447
1448 // If no entity to exchange return
1449 if (iexchanger->computeExchangeInfos()){
1450 m_trace_mng->pwarning() << "No load balance is performed";
1451 m_mesh_exchange_mng->endExchange();
1452 return;
1453 }
1454
1455 // Do exchange info
1456 iexchanger->processExchange();
1457
1458 // Remove items no longer on the current subdomain
1459 iexchanger->removeNeededItems();
1460
1461 // Update groups : remove gone entities
1462 // invalidate computed groups
1463 {
1464 auto action = [](ItemGroup& group)
1465 {
1466 if (group.internal()->hasComputeFunctor() || group.isLocalToSubDomain())
1467 group.invalidate();
1468 else
1469 group.internal()->removeSuppressedItems();
1470 };
1471 // todo update submeshes
1472 meshvisitor::visitGroups(this, action);
1473 }
1474
1475 iexchanger->allocateReceivedItems();
1476
1477 // todo update families (endUpdate and compute SynchronizeInfo cf. DynamicMesh::_internalEndUpdateInit(true);)
1478
1479 // Update groups
1480 iexchanger->updateItemGroups();
1481
1482 auto action = [](ItemGroup& group)
1483 {
1484 if (group.hasSynchronizer())
1485 group.synchronizer()->compute();
1486 };
1487
1488 m_trace_mng->info() << "Computing group synchronization information for " << name();
1489 meshvisitor::visitGroups(this,action);
1490
1491 iexchanger->updateVariables();
1492
1493 // todo DynamicMesh::_internalEndUpdateFinal(bool)
1494
1495 iexchanger->finalizeExchange();
1496
1497 // TODO: garantir cet appel en cas d'exception.
1498 m_mesh_exchange_mng->endExchange();
1499
1500 // // todo handle extra ghost
1501 // if (m_extra_ghost_cells_builder->hasBuilder() || m_extra_ghost_particles_builder->hasBuilder())
1502 // this->endUpdate(true,false);
1503 // else
1504 this->endUpdate();
1505
1506}
1507
1508/*---------------------------------------------------------------------------*/
1509/*---------------------------------------------------------------------------*/
1510
1513{
1514 // do nothing for now
1515 auto want_dump = false;
1516 auto need_compact = false;
1517 m_trace_mng->info(4) << "DynamicMesh::prepareForDump() name=" << name()
1518 << " need_compact?=" << need_compact
1519 << " want_dump?=" << want_dump
1520 << " timestamp=" << 0;
1521
1522 {
1524 m_mesh_events.eventObservable(t).notify(MeshEventArgs(this,t));
1525 }
1526
1527 // todo use Properties
1528 if (want_dump) {
1529 for (auto& family : m_arcane_families) {
1530 family->prepareForDump();
1531 }
1532 }
1533
1534 {
1536 m_mesh_events.eventObservable(t).notify(MeshEventArgs(this,t));
1537 }
1538}
1539
1540/*---------------------------------------------------------------------------*/
1541/*---------------------------------------------------------------------------*/
1542
1545{
1546 return allCells().activeCellGroup();
1547}
1548
1549/*---------------------------------------------------------------------------*/
1550/*---------------------------------------------------------------------------*/
1551
1553{
1554 return allCells().ownActiveCellGroup();
1555}
1556
1557/*---------------------------------------------------------------------------*/
1558/*---------------------------------------------------------------------------*/
1559
1561allLevelCells(const Integer& level)
1562{
1563 return allCells().levelCellGroup(level);
1564}
1565
1566/*---------------------------------------------------------------------------*/
1567/*---------------------------------------------------------------------------*/
1568
1570ownLevelCells(const Integer& level)
1571{
1572 return allCells().ownLevelCellGroup(level);
1573}
1574
1575/*---------------------------------------------------------------------------*/
1576/*---------------------------------------------------------------------------*/
1577
1580{
1581 return allCells().activeFaceGroup();
1582}
1583
1584/*---------------------------------------------------------------------------*/
1585/*---------------------------------------------------------------------------*/
1586
1589{
1590 return allCells().ownActiveFaceGroup();
1591}
1592
1593/*---------------------------------------------------------------------------*/
1594/*---------------------------------------------------------------------------*/
1595
1598{
1599 return allCells().innerActiveFaceGroup();
1600}
1601
1602/*---------------------------------------------------------------------------*/
1603/*---------------------------------------------------------------------------*/
1604
1607{
1608 return allCells().outerActiveFaceGroup();
1609}
1610
1611/*---------------------------------------------------------------------------*/
1612/*---------------------------------------------------------------------------*/
1613
1614IMeshUtilities* mesh::PolyhedralMesh::
1615utilities()
1616{
1617 return m_mesh_utilities.get();
1618}
1619
1620/*---------------------------------------------------------------------------*/
1621/*---------------------------------------------------------------------------*/
1622
1625{
1626 IItemFamily* item_family = _itemFamily(ik);
1627 ARCANE_CHECK_POINTER(item_family);
1628 return item_family->itemsNewOwner();
1629}
1630
1631/*---------------------------------------------------------------------------*/
1632/*---------------------------------------------------------------------------*/
1633
1635checkLevel() const
1636{
1637 return m_mesh_checker.checkLevel();
1638}
1639
1640/*---------------------------------------------------------------------------*/
1641/*---------------------------------------------------------------------------*/
1642
1643IItemFamilyNetwork* mesh::PolyhedralMesh::
1645{
1646 return m_item_family_network.get();
1647}
1648
1649/*---------------------------------------------------------------------------*/
1650/*---------------------------------------------------------------------------*/
1651
1652IGhostLayerMng* mesh::PolyhedralMesh::
1653ghostLayerMng() const
1654{
1655 return m_ghost_layer_mng.get();
1656}
1657
1658/*---------------------------------------------------------------------------*/
1659/*---------------------------------------------------------------------------*/
1660
1661IMeshModifierInternal* mesh::PolyhedralMesh::
1663{
1664 return m_internal_api.get();
1665}
1666
1667/*---------------------------------------------------------------------------*/
1668/*---------------------------------------------------------------------------*/
1669
1670
1671} // End namespace Arcane
1672
1673/*---------------------------------------------------------------------------*/
1674/*---------------------------------------------------------------------------*/
1675
1676#else // ARCANE_HAS_POLYHEDRAL_MESH_TOOLS
1677
1678/*---------------------------------------------------------------------------*/
1679/*---------------------------------------------------------------------------*/
1680
1681namespace Arcane::mesh
1682{
1685} // namespace Arcane::mesh
1686
1687/*---------------------------------------------------------------------------*/
1688/*---------------------------------------------------------------------------*/
1689
1690Arcane::mesh::PolyhedralMesh::
1691~PolyhedralMesh() = default;
1692
1693/*---------------------------------------------------------------------------*/
1694/*---------------------------------------------------------------------------*/
1695
1696Arcane::mesh::PolyhedralMesh::
1697PolyhedralMesh(ISubDomain* subdomain, const MeshBuildInfo& mbi)
1698: EmptyMesh{ subdomain->traceMng() }
1699, m_subdomain{ subdomain }
1700, m_mesh{ nullptr }
1701, m_mesh_kind(mbi.meshKind())
1702{
1703}
1704
1705/*---------------------------------------------------------------------------*/
1706/*---------------------------------------------------------------------------*/
1707
1708void Arcane::mesh::PolyhedralMesh::
1709read([[maybe_unused]] const String& filename)
1710{
1711 _errorEmptyMesh();
1712}
1713
1714/*---------------------------------------------------------------------------*/
1715/*---------------------------------------------------------------------------*/
1716
1717void Arcane::mesh::PolyhedralMesh::
1718allocateItems(const Arcane::ItemAllocationInfo& item_allocation_info)
1719{
1720 ARCANE_UNUSED(item_allocation_info);
1721 _errorEmptyMesh();
1722}
1723
1724/*---------------------------------------------------------------------------*/
1725/*---------------------------------------------------------------------------*/
1726
1727#endif // ARCANE_HAS_POLYHEDRAL_MESH_TOOLS
1728
1729/*---------------------------------------------------------------------------*/
1730/*---------------------------------------------------------------------------*/
1731
1732namespace Arcane
1733{
1734
1735class ARCANE_MESH_EXPORT PolyhedralMeshFactory
1736: public AbstractService
1737, public IMeshFactory
1738{
1739 public:
1740
1743 {}
1744
1745 public:
1746
1747 void build() override {}
1749 {
1750 ISubDomain* sd = mm->variableMng()->_internalApi()->internalSubDomain();
1751 return new mesh::PolyhedralMesh(sd, build_info);
1752 }
1753
1754 static String name() { return "ArcanePolyhedralMeshFactory"; }
1755};
1756
1757ARCANE_REGISTER_SERVICE(PolyhedralMeshFactory,
1758 ServiceProperty(PolyhedralMeshFactory::name().localstr(), ST_Application),
1759 ARCANE_SERVICE_INTERFACE(IMeshFactory));
1760
1761/*---------------------------------------------------------------------------*/
1762/*---------------------------------------------------------------------------*/
1763
1764#if ARCANE_HAS_POLYHEDRAL_MESH_TOOLS
1765
1766/*---------------------------------------------------------------------------*/
1767/*---------------------------------------------------------------------------*/
1768
1769String mesh::PolyhedralMesh::
1770factoryName() const
1771{
1772 return PolyhedralMeshFactory::name();
1773}
1774
1775/*---------------------------------------------------------------------------*/
1776/*---------------------------------------------------------------------------*/
1777
1778#endif // ARCANE_HAS_POLYHEDRAL_MESH_TOOLS
1779
1780/*---------------------------------------------------------------------------*/
1781/*---------------------------------------------------------------------------*/
1782
1783} // End namespace Arcane
1784
1785/*---------------------------------------------------------------------------*/
1786/*---------------------------------------------------------------------------*/
#define ARCANE_CHECK_POINTER(ptr)
Macro retournant le pointeur ptr s'il est non nul ou lancant une exception s'il est nul.
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Ce fichier contient les différentes fabriques de services et macro pour enregistrer les services.
#define ARCANE_SERVICE_INTERFACE(ainterface)
Macro pour déclarer une interface lors de l'enregistrement d'un service.
Classe de base d'un service.
EnumeratorT< ItemGroup > Enumerator
Type d'un itérateur sur toute la collection.
Definition Collection.h:129
Interface d'une famille de DoF.
Definition IDoFFamily.h:33
Gère la sérialisation/désérialisation des entités d'une famille.
Interface d'une famille d'entités.
virtual NodeGroup ownNodes()=0
Groupe de tous les noeuds propres au domaine.
virtual IItemFamily * nodeFamily()=0
Retourne la famille des noeuds.
virtual String name() const =0
Nom du maillage.
virtual Integer nbCell()=0
Nombre de mailles du maillage.
virtual CellGroup ownCells()=0
Groupe de toutes les mailles propres au domaine.
virtual FaceGroup ownFaces()=0
Groupe de toutes les faces propres au domaine.
virtual FaceGroup allFaces()=0
Groupe de toutes les faces.
virtual Integer nbEdge()=0
Nombre d'arêtes du maillage.
virtual IItemFamily * itemFamily(eItemKind ik)=0
Retourne la famille d'entité de type ik.
virtual IItemFamily * edgeFamily()=0
Retourne la famille des arêtes.
virtual Integer nbNode()=0
Nombre de noeuds du maillage.
virtual FaceGroup outerFaces()=0
Groupe de toutes les faces sur la frontière.
virtual IItemFamily * findItemFamily(eItemKind ik, const String &name, bool create_if_needed=false, bool register_modifier_if_created=false)=0
Retourne la famille de nom name.
virtual Integer nbItem(eItemKind ik)=0
Nombre d'éléments du genre ik.
virtual Integer dimension()=0
Dimension du maillage (1D, 2D ou 3D).
virtual IItemFamily * faceFamily()=0
Retourne la famille des faces.
virtual EdgeGroup ownEdges()=0
Groupe de toutes les arêtes propres au domaine.
virtual NodeGroup allNodes()=0
Groupe de tous les noeuds.
virtual CellGroup allCells()=0
Groupe de toutes les mailles.
virtual Integer nbFace()=0
Nombre de faces du maillage.
virtual IItemFamily * cellFamily()=0
Retourne la famille des mailles.
virtual IItemFamily * createItemFamily(eItemKind ik, const String &name)=0
Créé une famille de particule de nom name.
virtual EdgeGroup allEdges()=0
Groupe de toutes les arêtes.
Interface du service gérant la lecture d'un maillage.
Interface du gestionnaire des maillages.
Definition IMeshMng.h:40
virtual void addNodes(Int64ConstArrayView nodes_uid, Int32ArrayView nodes_lid=Int32ArrayView())=0
Ajoute des noeuds.
virtual IMeshModifierInternal * _modifierInternalApi()=0
API interne à Arcane.
virtual VariableNodeReal3 & nodesCoordinates()=0
Coordonnées des noeuds.
virtual FaceGroup outerActiveFaces()=0
Groupe de toutes les faces actives sur la frontière.
virtual void destroyGroups()=0
Détruit tous les groupes de toutes les familles.
virtual IMeshUtilities * utilities()=0
Interface des fonctions utilitaires associée.
virtual CellGroup allLevelCells(const Integer &level)=0
Groupe de toutes les mailles de niveau level.
virtual FaceGroup innerActiveFaces()=0
Groupe de toutes les faces actives.
virtual ItemGroupCollection groups()=0
Liste des groupes.
virtual ItemGroup findGroup(const String &name)=0
Retourne le groupe de nom name ou le groupe nul s'il n'y en a pas.
virtual IMeshInternal * _internalApi()=0
API interne à Arcane.
virtual CellGroup allActiveCells()=0
virtual FaceGroup allActiveFaces()=0
Groupe de toutes les faces actives.
virtual ItemTypeMng * itemTypeMng() const =0
Gestionnaire de types d'entités associé
virtual void prepareForDump()=0
Prépare l'instance en vue d'une protection.
virtual CellGroup ownActiveCells()=0
Groupe de toutes les mailles actives et propres au domaine.
virtual CellGroup ownLevelCells(const Integer &level)=0
Groupe de toutes les mailles propres de niveau level.
virtual IGhostLayerMng * ghostLayerMng() const =0
Gestionnare de couche fantômes associé
virtual FaceGroup ownActiveFaces()=0
Groupe de toutes les faces actives propres au domaine.
virtual IItemFamilyNetwork * itemFamilyNetwork()=0
Interface du réseau de familles (familles connectées)
virtual IMeshCompactMng * _compactMng()=0
virtual Integer checkLevel() const =0
Niveau actuel de vérification.
virtual void exchangeItems()=0
Change les sous-domaines propriétaires des entités.
virtual VariableItemInt32 & itemsNewOwner(eItemKind kind)=0
Variable contenant l'identifiant du sous-domaine propriétaire.
Interface du gestionnaire d'un sous-domaine.
Definition ISubDomain.h:74
Gestionnaire des politiques d'une famille d'entités.
Sérialisation/Désérialisation des familles d'entités.
Groupe d'entités de maillage.
Definition ItemGroup.h:49
Structure interne d'une entité de maillage.
Infos sur un type d'entité du maillage.
Gestionnaire des types d'entités de maillage.
Definition ItemTypeMng.h:66
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:149
Paramètres nécessaires à la construction d'un maillage.
void build() override
Construction de niveau build du service.
IPrimaryMesh * createMesh(IMeshMng *mm, const MeshBuildInfo &build_info) override
Créé un maillage avec les informations de build_info.
Structure contenant les informations pour créer un service.
Integer nbCell() override
Nombre de mailles du maillage.
Integer dimension() override
Dimension du maillage (1D, 2D ou 3D).
Integer nbNode() override
Nombre de noeuds du maillage.
void endUpdate() override
Notifie l'instance de la fin de la modification du maillage.
Integer nbEdge() override
Nombre d'arêtes du maillage.
Integer nbItem(eItemKind ik) override
Nombre d'éléments du genre ik.
Integer nbFace() override
Nombre de faces du maillage.
Famille d'entités.
Definition ItemFamily.h:76
Classe temporaire pour conserver un ItemSharedInfo et un type d'entité.
IItemFamilySerializer * createSerializer(bool use_flags) override
Créé une instance pour la sérialisation des entités. L'instance retournée doit être détruite par l'op...
IDoFFamily * toDoFFamily() override
Retourne l'interface de la famille de particule de cette famille.
DoFVectorView addGhostDoFs(Int64ConstArrayView dof_uids, Int32ArrayView dof_lids, Int32ConstArrayView owners)
L'ajout de fantomes doit etre suivi d'un appel de computeSynchronizeInfos.
void endUpdate() override
Notifie la fin de modification de la liste des entités.
Integer nbItem() const override
Nombre d'entités.
String name() const override
Nom de la famille.
DoFVectorView addDoFs(Int64ConstArrayView dof_uids, Int32ArrayView dof_lids)
En entree les uids des dofs et on recupere leurs lids.
String fullName() const override
Nom complet de la famille (avec celui du maillage)
ItemGroup allItems() const override
Groupe de toutes les entités.
void endUpdate()
Notifie l'instance de la fin de la modification du maillage.
Vue modifiable d'un tableau d'un type T.
constexpr Integer size() const noexcept
Retourne la taille du tableau.
void resize(Int64 s)
Change le nombre d'éléments du tableau à s.
Vue constante d'un tableau de type T.
Vue d'un tableau d'éléments de type T.
Definition Span.h:670
constexpr ARCCORE_HOST_DEVICE bool empty() const noexcept
Retourne true si le tableau est vide (dimension nulle)
Definition Span.h:372
constexpr ARCCORE_HOST_DEVICE SizeType size() const noexcept
Retourne la taille du tableau.
Definition Span.h:209
Chaîne de caractères unicode.
Positionne une classe de message.
Vecteur 1D de données avec sémantique par valeur (style STL).
ItemGroupT< Cell > CellGroup
Groupe de mailles.
Definition ItemTypes.h:183
ItemGroupT< Face > FaceGroup
Groupe de faces.
Definition ItemTypes.h:178
ItemGroupT< Edge > EdgeGroup
Groupe d'arêtes.
Definition ItemTypes.h:173
ItemGroupT< Node > NodeGroup
Groupe de noeuds.
Definition ItemTypes.h:167
#define ARCANE_REGISTER_SERVICE(aclass, a_service_property,...)
Macro pour enregistrer un service.
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Grandeur au noeud de type coordonnées.
ItemVariableScalarRefT< Int32 > VariableItemInt32
Grandeur de type entier 32 bits.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
UniqueArray< Int64 > Int64UniqueArray
Tableau dynamique à une dimension d'entiers 64 bits.
Definition UtilsTypes.h:550
Collection< ItemGroup > ItemGroupCollection
Collection de groupes d'éléments du maillage.
Collection< IItemFamily * > ItemFamilyCollection
Collection de familles d'entités.
ConstArrayView< Int32 > Int32ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
Definition UtilsTypes.h:693
Collection< IItemFamily * > IItemFamilyCollection
Collection de familles d'entités.
eMeshEventType
Evènements générés par IMesh.
Definition MeshEvents.h:30
@ EndPrepareDump
Evènement envoyé à la fin de prepareForDump()
@ BeginPrepareDump
Evènement envoyé au début de prepareForDump()
UniqueArray< Int32 > Int32UniqueArray
Tableau dynamique à une dimension d'entiers 32 bits.
Definition UtilsTypes.h:552
eItemKind
Genre d'entité de maillage.
@ IK_Particle
Entité de maillage de genre particule.
@ IK_Node
Entité de maillage de genre noeud.
@ IK_Cell
Entité de maillage de genre maille.
@ IK_Unknown
Entité de maillage de genre inconnu ou non initialisé
@ IK_Face
Entité de maillage de genre face.
@ IK_DoF
Entité de maillage de genre degre de liberte.
@ IK_Edge
Entité de maillage de genre arête.
const char * itemKindName(eItemKind kind)
Nom du genre d'entité.
ConstArrayView< Int64 > Int64ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 64 bits.
Definition UtilsTypes.h:691
ArrayView< Int32 > Int32ArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
Definition UtilsTypes.h:664
Int32 Integer
Type représentant un entier.