14#include "arcane/utils/ITraceMng.h"
15#include "arcane/utils/SmallArray.h"
16#include "arcane/utils/FixedArray.h"
18#include "arcane/core/IMeshReader.h"
19#include "arcane/core/BasicService.h"
21#include "arcane/core/IPrimaryMesh.h"
22#include "arcane/core/IItemFamily.h"
23#include "arcane/core/ICaseMeshReader.h"
24#include "arcane/core/IMeshBuilder.h"
25#include "arcane/core/IParallelMng.h"
26#include "arcane/core/MeshPartInfo.h"
27#include "arcane/core/NodesOfItemReorderer.h"
29#include "arcane/core/ItemPrinter.h"
60 class MEDToArcaneItemInfo
64 MEDToArcaneItemInfo(
int dimension,
int nb_node, med_int med_type,
66 : m_dimension(dimension)
68 , m_med_type(med_type)
69 , m_arcane_type(arcane_type)
70 , m_indirection(indirection)
75 int dimension()
const {
return m_dimension; }
76 int nbNode()
const {
return m_nb_node; }
77 med_int medType()
const {
return m_med_type; }
78 Int16 arcaneType()
const {
return m_arcane_type; }
79 const Int32* indirection()
const {
return m_indirection; }
85 med_int m_med_type = {};
87 const Int32* m_indirection =
nullptr;
95 explicit MEDFamilyInfo(
Int32 family_id)
119 explicit MEDGroupInfo(
Int32 index)
140 _initMEDToArcaneTypes();
157 explicit AutoCloseMED(med_idt
id)
186 void _initMEDToArcaneTypes();
187 void _addTypeInfo(
int dimension,
int nb_node, med_int med_type,
ItemTypeId arcane_type)
189 _addTypeInfo(dimension, nb_node, med_type, arcane_type,
nullptr);
191 void _addTypeInfo(
int dimension,
int nb_node, med_int med_type,
ItemTypeId arcane_type,
192 const Int32* indirection)
194 MEDToArcaneItemInfo t(dimension, nb_node, med_type, arcane_type, indirection);
199 void _readAndCreateCells(IPrimaryMesh* mesh, Int32 mesh_dimension, med_idt fid,
const char* meshname);
200 void _readFaces(IPrimaryMesh* mesh, Int32 mesh_dimension, med_idt fid,
const char* meshname);
203 _readNodesCoordinates(IPrimaryMesh* mesh, Int64 nb_node, Int32 spacedim,
204 med_idt fid,
const char* meshname);
205 void _readFamilies(med_idt fid,
const char* meshname);
207 void _clearItemsInGroups()
210 g.m_unique_ids.clear();
211 g.m_local_ids.clear();
224 const Int32 Hexaedron8_indirection[] = { 1, 0, 3, 2, 5, 4, 7, 6 };
225 const Int32 Hexaedron20_indirection[] = { 1, 8, 10, 3, 9, 2, 0, 11, 5, 14, 18, 7, 6, 4, 16, 15, 13, 12, 17, 19 };
226 const Int32 Pyramid5_indirection[] = { 1, 0, 3, 2, 4 };
227 const Int32 Quad4_indirection[] = { 1, 0, 3, 2 };
228 const Int32 Quad8_indirection[] = { 1, 0, 3, 2, 4, 7, 6, 5 };
229 const Int32 Triangle3_indirection[] = { 1, 0, 2 };
231 const Int32 Tetraedron4_indirection[] = { 1, 0, 2, 3 };
238_initMEDToArcaneTypes()
245 _addTypeInfo(1, 2, MED_SEG2, ITI_Line2);
246 _addTypeInfo(1, 3, MED_SEG3, ITI_Line3);
247 _addTypeInfo(1, 4, MED_SEG4, ITI_NullType);
250 _addTypeInfo(2, 3, MED_TRIA3, ITI_Triangle3, Triangle3_indirection);
251 _addTypeInfo(2, 4, MED_QUAD4, ITI_Quad4, Quad4_indirection);
252 _addTypeInfo(2, 6, MED_TRIA6, ITI_NullType);
253 _addTypeInfo(2, 7, MED_TRIA7, ITI_NullType);
254 _addTypeInfo(2, 8, MED_QUAD8, ITI_Quad8, Quad8_indirection);
255 _addTypeInfo(2, 9, MED_QUAD9, ITI_NullType);
258 _addTypeInfo(3, 4, MED_TETRA4, ITI_Tetraedron4);
259 _addTypeInfo(3, 5, MED_PYRA5, ITI_Pyramid5, Pyramid5_indirection);
260 _addTypeInfo(3, 6, MED_PENTA6, ITI_Pentaedron6);
261 _addTypeInfo(3, 8, MED_HEXA8, ITI_Hexaedron8);
262 _addTypeInfo(3, 10, MED_TETRA10, ITI_Tetraedron10);
263 _addTypeInfo(3, 12, MED_OCTA12, ITI_Octaedron12);
264 _addTypeInfo(3, 13, MED_PYRA13, ITI_NullType);
265 _addTypeInfo(3, 15, MED_PENTA15, ITI_NullType);
266 _addTypeInfo(3, 18, MED_PENTA18, ITI_NullType);
267 _addTypeInfo(3, 20, MED_HEXA20, ITI_Hexaedron20);
268 _addTypeInfo(3, 27, MED_HEXA27, ITI_NullType);
276 _addTypeInfo(2, 0, MED_POLYGON, ITI_GenericPolygon);
277 _addTypeInfo(2, 0, MED_POLYGON2, ITI_NullType);
278 _addTypeInfo(3, 0, MED_POLYHEDRON, ITI_NullType);
292 info() <<
"Trying to read MED File name=" << file_name;
294 return _readMesh(mesh, file_name);
303 const med_idt fid = MEDfileOpen(filename.localstr(), MED_ACC_RDONLY);
305 MESSAGE(
"ERROR: can not open MED file ");
306 error() <<
"ERROR: can not open MED file '" << filename <<
"'";
312 int nb_mesh = MEDnMesh(fid);
314 error() <<
"Error reading number of meshes";
317 info() <<
"MED: nb_mesh=" << nb_mesh;
319 error() <<
"No mesh is present";
327 int nb_axis = MEDmeshnAxis(fid, mesh_index);
329 error() <<
"Can not read number of axis (MEDmeshnAxis)";
332 info() <<
"MED: nb_axis=" << nb_axis;
334 UniqueArray<char> axisname(MED_SNAME_SIZE * nb_axis + 1,
'\0');
335 UniqueArray<char> unitname(MED_SNAME_SIZE * nb_axis + 1,
'\0');
337 char meshname[MED_NAME_SIZE + 1];
339 char meshdescription[MED_COMMENT_SIZE + 1];
340 meshdescription[0] =
'\0';
341 char dtunit[MED_SNAME_SIZE + 1];
343 med_int spacedim = 0;
345 med_mesh_type meshtype = MED_UNDEF_MESH_TYPE;
346 med_sorting_type sortingtype = MED_SORT_UNDEF;
348 med_axis_type axistype = MED_UNDEF_AXIS_TYPE;
350 err = MEDmeshInfo(fid, mesh_index, meshname, &spacedim, &meshdim, &meshtype, meshdescription,
351 dtunit, &sortingtype, &nstep, &axistype, axisname.data(), unitname.data());
353 error() <<
"Can not read mesh info (MEDmeshInfo) r=" << err;
356 if (meshtype != MED_UNSTRUCTURED_MESH) {
357 error() <<
"Arcane handle only MED unstructured mesh (MED_UNSTRUCTURED_MESH) type=" << meshtype;
360 Integer mesh_dimension = meshdim;
361 if (mesh_dimension != 2 && mesh_dimension != 3)
362 ARCANE_FATAL(
"MED reader handles only 2D or 3D meshes");
364 info() <<
"MED: name=" << meshname;
365 info() <<
"MED: description=" << meshdescription;
366 info() <<
"MED: spacedim=" << spacedim;
367 info() <<
"MED: meshdim=" << meshdim;
368 info() <<
"MED: dtunit=" << dtunit;
369 info() <<
"MED: meshtype=" << meshtype;
370 info() <<
"MED: sortingtype=" << sortingtype;
371 info() <<
"MED: axistype=" << axistype;
372 info() <<
"MED: nstep=" << nstep;
377 med_bool coordinatechangement;
378 med_bool geotransformation;
381 med_int med_nb_node = MEDmeshnEntity(fid, meshname, MED_NO_DT, MED_NO_IT, MED_NODE, MED_NO_GEOTYPE,
382 MED_COORDINATE, MED_NO_CMODE, &coordinatechangement,
384 if (med_nb_node < 0) {
385 error() <<
"Can not read number of nodes (MEDmeshnEntity) err=" << med_nb_node;
388 nb_node = med_nb_node;
390 info() <<
"MED: nb_node=" << nb_node;
392 mesh->setDimension(mesh_dimension);
397 mesh->itemTypeMng()->buildPolygonTypes();
399 IParallelMng* pm = mesh->parallelMng();
400 bool is_parallel = pm->isParallel();
401 Int32 rank = mesh->meshPartInfo().partRank();
403 bool is_read_items = !(is_parallel && rank != 0);
406 _readFamilies(fid, meshname);
407 _readAndCreateCells(mesh, mesh_dimension, fid, meshname);
416 UniqueArray<String> cell_group_names;
417 IItemFamily* cell_family = mesh->cellFamily();
424 UniqueArray<Int32> cell_local_ids;
426 Int32 nb_cell_in_group = g.m_unique_ids.size();
427 cell_local_ids.resize(nb_cell_in_group);
428 cell_family->itemsUniqueIdToLocalId(cell_local_ids, g.m_unique_ids);
429 for (
const String& name : g.m_names) {
430 info() <<
"Group=" << name <<
" index=" << g.m_index <<
" nb_item=" << nb_cell_in_group;
431 CellGroup cell_group = cell_family->findGroup(name,
true);
432 cell_group.
addItems(cell_local_ids);
433 cell_group_names.add(name);
444 bool is_face_group_disabled =
false;
446 is_face_group_disabled = (v.value());
447 if (!is_face_group_disabled)
448 _readFaces(mesh, mesh_dimension, fid, meshname);
451 UniqueArray<String> face_group_names;
452 IItemFamily* face_family = mesh->faceFamily();
456 Int32 nb_face_in_group = g.m_local_ids.size();
457 info() <<
"Check Group index=" << g.m_index <<
" nb_item=" << nb_face_in_group;
458 if (nb_face_in_group == 0)
460 for (
const String& name : g.m_names) {
461 info() <<
"FaceGroup=" << name <<
" index=" << g.m_index <<
" nb_item=" << nb_face_in_group;
462 FaceGroup face_group = face_family->findGroup(name,
true);
464 face_group_names.add(name);
472 return _readNodesCoordinates(mesh, nb_node, spacedim, fid, meshname);
486 med_bool coordinatechangement;
487 med_bool geotransformation;
488 med_int nb_geo = MEDmeshnEntity(fid, meshname, MED_NO_DT, MED_NO_IT, MED_CELL, MED_GEO_ALL,
489 MED_CONNECTIVITY, MED_NODAL, &coordinatechangement,
492 ARCANE_FATAL(
"Can not read number of geometric entities nb_geo={0}", nb_geo);
493 info() <<
"MED: nb_geotype = " << nb_geo;
496 for (med_int it = 1; it <= nb_geo; it++) {
498 med_geometry_type geotype = MED_GEO_ALL;
502 med_int type_ret = MEDmeshEntityInfo(fid, meshname, MED_NO_DT, MED_NO_IT, MED_CELL, it,
503 geotype_name.data(), &geotype);
505 ARCANE_FATAL(
"Can not read informations for geotype index={0} ret={1}", it, type_ret);
507 med_int nb_item = MEDmeshnEntity(fid, meshname, MED_NO_DT, MED_NO_IT, MED_CELL, geotype,
508 MED_CONNECTIVITY, MED_NODAL, &coordinatechangement,
511 ARCANE_FATAL(
"Can not read number of items for geotype={0} name={1} ret={2}",
512 geotype, geotype_name.data(), nb_item);
513 info() <<
"MED: type=" << geotype <<
" '" << geotype_name.data() <<
"' nb_item=" << nb_item;
524 _clearItemsInGroups();
529 Int64 cell_unique_id = 0;
543 Int32 item_dimension = iinfo.dimension();
545 if (item_dimension != mesh_dimension)
547 Int32 nb_item =
_readItems(fid, meshname, iinfo, polygon_nb_nodes, med_connectivity, med_family_values);
550 Int16 arcane_type = iinfo.arcaneType();
551 Int32 nb_item_node = iinfo.nbNode();
552 Int32 nb_family_values = med_family_values.
size();
553 if (arcane_type == IT_NullType) {
555 ARCANE_FATAL(
"MED type '{0}' is not supported by Arcane", iinfo.medType());
557 Int64 cells_infos_index = 0;
558 Int64 med_connectivity_index = 0;
559 const bool is_polygon = (iinfo.medType() == MED_POLYGON);
561 UniqueArray<Int64> cells_infos;
563 cells_infos.resize(2 * nb_item + med_connectivity.
size());
565 cells_infos.resize((2 + nb_item_node) * nb_item);
567 info() <<
"CELL_INFOS size=" << cells_infos.size() <<
" nb_item=" << nb_item
568 <<
" type=" << arcane_type;
570 const Int32* indirection = iinfo.indirection();
571 for (Int32 i = 0; i < nb_item; ++i) {
572 Int64 current_cell_unique_id = cell_unique_id;
575 nb_item_node = polygon_nb_nodes[i];
576 arcane_type = itm->
getPolygonType(
static_cast<Int16
>(nb_item_node));
577 cells_infos[cells_infos_index] = arcane_type;
579 cells_infos[cells_infos_index] = current_cell_unique_id;
581 Span<Int64> cinfo_span(cells_infos.span().subspan(cells_infos_index, nb_item_node));
582 Span<med_int> med_cinfo_span(med_connectivity.
span().subspan(med_connectivity_index, nb_item_node));
583 for (
Integer k = 0; k < nb_item_node; ++k) {
584 cinfo_span[k] = med_cinfo_span[k];
588 cells_infos[cells_infos_index] = arcane_type;
591 cells_infos[cells_infos_index] = current_cell_unique_id;
593 Span<Int64> cinfo_span(cells_infos.span().subspan(cells_infos_index, nb_item_node));
594 Span<med_int> med_cinfo_span(med_connectivity.
span().subspan(med_connectivity_index, nb_item_node));
596 for (
Integer k = 0; k < nb_item_node; ++k) {
597 cinfo_span[k] = med_cinfo_span[indirection[k]];
601 for (
Integer k = 0; k < nb_item_node; ++k)
602 cinfo_span[k] = med_cinfo_span[k];
605 if (i < nb_family_values) {
607 med_int f = med_family_values[i];
610 ARCANE_FATAL(
"Can not find family id '{0}' for cell '{1}' of geotype '{2}'",
611 f, i, iinfo.medType());
613 m_med_groups[x->second.m_index].m_unique_ids.add(current_cell_unique_id);
616 med_connectivity_index += nb_item_node;
617 cells_infos_index += nb_item_node;
636 _clearItemsInGroups();
652 Int32 item_dimension = iinfo.dimension();
654 if (item_dimension != (mesh_dimension - 1))
657 info() <<
"Reading faces geotype=" << geotype <<
" arcane_type=" << iinfo.arcaneType()
660 Int32 nb_item =
_readItems(fid, meshname, iinfo, polygon_nb_nodes, med_connectivity, med_family_values);
664 Int32 nb_item_node = iinfo.nbNode();
665 Int32 nb_family_values = med_family_values.
size();
666 if (arcane_type == IT_NullType) {
668 ARCANE_FATAL(
"MED type '{0}' is not supported by Arcane", iinfo.medType());
672 info() <<
"FACES_INFOS nb_item=" << nb_item <<
" type=" << arcane_type
673 <<
" nb_family_values=" << nb_family_values;
675 const Int32* indirection = iinfo.indirection();
676 Int64 med_connectivity_index = 0;
678 for (
Int32 i = 0; i < nb_item; ++i) {
680 Span<med_int> med_cinfo_span(med_connectivity.
span().subspan(med_connectivity_index, nb_item_node));
682 for (
Integer k = 0; k < nb_item_node; ++k) {
683 cinfo_span[k] = med_cinfo_span[indirection[k]];
687 for (
Integer k = 0; k < nb_item_node; ++k)
688 cinfo_span[k] = med_cinfo_span[k];
690 med_connectivity_index += nb_item_node;
692 nodes_reorderer.reorder(arcane_type, cinfo_span);
697 Node first_node(MeshUtils::findOneItem(node_family, ordered_nodes[0]));
698 if (first_node.
null())
699 ARCANE_FATAL(
"Can not find node uid={0} for face index '{1}'", ordered_nodes[0], i);
702 info() <<
"ERROR: Can not find face in mesh i=" << i <<
" nodes=" << ordered_nodes;
704 for (
Face subface : first_node.
faces()) {
706 for (
Node subnode : subface.nodes()) {
710 ARCANE_FATAL(
"Can not find face with nodes=", ordered_nodes);
715 if (i < nb_family_values) {
717 med_int f = med_family_values[i];
720 ARCANE_FATAL(
"Can not find family id '{0}' for face '{1}' of geotype '{2}'",
721 f, i, iinfo.medType());
727 info() <<
"END_READING_ITEMS";
736 med_idt fid,
const char* meshname)
738 const bool do_verbose =
false;
746 int err = MEDmeshNodeCoordinateRd(fid, meshname, MED_NO_DT, MED_NO_IT, MED_FULL_INTERLACE,
749 error() <<
"Can not read nodes coordinates err=" << err;
754 for (Int64 i = 0; i < nb_node; ++i) {
755 Real3 xyz(coordinates[i * 3], coordinates[(i * 3) + 1], coordinates[(i * 3) + 2]);
757 info() <<
"I=" << i <<
" XYZ=" << xyz;
758 nodes_coordinates[i + 1] = xyz;
761 else if (spacedim == 2) {
762 for (
Int64 i = 0; i < nb_node; ++i) {
763 Real3 xyz(coordinates[i * 2], coordinates[(i * 2) + 1], 0.0);
765 info() <<
"I=" << i <<
" XYZ=" << xyz;
766 nodes_coordinates[i + 1] = xyz;
770 ARCANE_THROW(NotImplementedException,
"spacedim!=2 && spacedim!=3");
778 nodes_coord_var[inode] = nodes_coordinates[node.uniqueId()];
805 constexpr bool is_verbose =
false;
807 connectivity.
clear();
808 family_values.
clear();
810 int med_item_type = iinfo.medType();
811 med_bool coordinatechangement = {};
812 med_bool geotransformation = {};
813 med_int nb_med_item = 0;
814 if (iinfo.medType() == MED_POLYGON) {
817 med_int nb_index = ::MEDmeshnEntity(fid, meshname, MED_NO_DT, MED_NO_IT, MED_CELL, med_item_type,
818 MED_INDEX_NODE, MED_NODAL, &coordinatechangement,
821 ARCANE_FATAL(
"Can not read MED med_item_type '{0}' error={1}", med_item_type, nb_index);
823 info() <<
"MED: Reading items";
824 info() <<
"MED: type=" << med_item_type <<
" nb_index=" << nb_index;
827 nb_med_item = nb_index - 1;
828 polygon_nb_nodes.
resize(nb_med_item);
830 med_int nb_connectivity = MEDmeshnEntity(fid, meshname, MED_NO_DT, MED_NO_IT,
831 MED_CELL, MED_POLYGON, MED_CONNECTIVITY, MED_NODAL,
832 &coordinatechangement, &geotransformation);
833 if (nb_connectivity < 0)
834 ARCANE_FATAL(
"Can not get connectivity size for MED_POLYGON err={0}", nb_connectivity);
840 connectivity.
resize(nb_connectivity);
841 info() <<
"Reading polygons nb_connectivity=" << nb_connectivity;
842 int r = MEDmeshPolygonRd(fid, meshname, MED_NO_DT, MED_NO_IT, MED_CELL, MED_NODAL,
843 indexes.
data(), connectivity.
data());
845 ARCANE_FATAL(
"Can not read connectivity for MED_POLYGON err={0}", r);
846 info() <<
"INDEXES=" << indexes;
847 for (
Int32 i = 0; i < nb_med_item; ++i)
848 polygon_nb_nodes[i] =
static_cast<Int16>(indexes[i + 1] - indexes[i]);
851 nb_med_item = ::MEDmeshnEntity(fid, meshname, MED_NO_DT, MED_NO_IT, MED_CELL, med_item_type,
852 MED_CONNECTIVITY, MED_NODAL, &coordinatechangement,
855 ARCANE_FATAL(
"Can not read MED med_item_type '{0}' error={1}", med_item_type, nb_med_item);
857 info() <<
"MED: Reading items";
858 info() <<
"MED: type=" << med_item_type <<
" nb_item=" << nb_med_item;
859 if (nb_med_item == 0)
862 Int64 nb_node = iinfo.nbNode();
867 connectivity.
resize(nb_node * nb_med_item);
868 int err = MEDmeshElementConnectivityRd(fid, meshname, MED_NO_DT, MED_NO_IT, MED_CELL,
869 med_item_type, MED_NODAL, MED_FULL_INTERLACE,
870 connectivity.
data());
872 ARCANE_FATAL(
"Can not read connectivity MED med_item_type '{0}' error={1}",
876 info() <<
"CON: " << connectivity;
878 med_int nb_med_family = MEDmeshnEntity(fid, meshname, MED_NO_DT, MED_NO_IT,
879 MED_CELL, med_item_type, MED_FAMILY_NUMBER, MED_NODAL,
880 &coordinatechangement, &geotransformation);
881 info() <<
"nb_family=" << nb_med_family;
882 if (nb_med_family < 0)
883 ARCANE_FATAL(
"Can not read family size for type med_item_type={0} error={1}", med_item_type, nb_med_family);
884 if (nb_med_family > 0) {
885 family_values.
resize(nb_med_family);
886 int r = MEDmeshEntityFamilyNumberRd(fid, meshname, MED_NO_DT, MED_NO_IT,
887 MED_CELL, med_item_type, family_values.
data());
889 ARCANE_FATAL(
"Can not read family values for type med_item_type={0} error={1}", med_item_type, nb_med_family);
891 info() <<
"FAM: " << family_values;
901_readFamilies(med_idt fid,
const char* meshname)
905 info() <<
"Read families";
908 med_int nb_family = MEDnFamily(fid, meshname);
910 ARCANE_FATAL(
"Can not read number of families (error={0})", nb_family);
912 info() <<
"MED: nb_family= " << nb_family;
913 for (med_int i = 0; i < nb_family; i++) {
914 info() <<
"MED: Read family i=" << i;
916 med_int nb_group = MEDnFamilyGroup(fid, meshname, i + 1);
918 ARCANE_FATAL(
"Can not read number of groups for family index={0}", i);
919 info() <<
"MED: family index=" << i <<
" nb_group=" << nb_group;
927 med_int family_number = 0;
928 if (MEDfamilyInfo(fid, meshname, i + 1, familyname.data(), &family_number, all_group_names.data()) < 0)
929 ARCANE_FATAL(
"Can not read group names from family index={0}", i);
931 MEDFamilyInfo med_family(family_number);
933 med_family.m_index = group_index;
934 MEDGroupInfo med_group(group_index);
937 for (
Int32 z = 0; z < nb_group; ++z) {
944 for (; pos < MED_LNAME_SIZE; ++pos) {
945 char c = med_group_name[pos];
948 if (c ==
' ' || c ==
'_')
950 valid_name.
add(
static_cast<Byte>(c));
952 String name(valid_name.
view());
953 med_group.m_names.add(name);
954 info() <<
"Family id=" << family_number <<
" group='" << name <<
"'";
979 for (
String name : group_names)
980 pm->broadcastString(name, 0);
985 String current_group_name;
986 for (
Int32 i = 0; i < nb_group; ++i) {
987 pm->broadcastString(current_group_name, 0);
1001class MEDMeshReaderService
1002:
public BasicService
1016 return str ==
"med";
1019 [[maybe_unused]]
const XmlNode& mesh_element,
1022 [[maybe_unused]]
bool use_internal_partition)
override
1024 ARCANE_UNUSED(dir_name);
1026 return reader.readMesh(
mesh, file_name);
1045class MEDCaseMeshReader
1058 , m_read_info(read_info)
1065 ARCANE_UNUSED(build_info);
1070 String fname = m_read_info.fileName();
1071 m_trace_mng->info() <<
"MED Reader (ICaseMeshReader) file_name=" << fname;
1094 if (read_info.format() ==
"med")
#define ARCANE_THROW(exception_class,...)
Macro pour envoyer une exception avec formattage.
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
Fonctions utilitaires sur le maillage.
Face getFaceFromNodesUniqueId(Node node, Int64ConstArrayView face_nodes_unique_id)
Recherche une entité face à partir des numéros uniques de ces noeuds.
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.
Integer size() const
Nombre d'éléments du vecteur.
Classe de base d'un service.
AbstractService(const ServiceBuildInfo &)
Constructeur à partir d'un ServiceBuildInfo.
Vue modifiable d'un tableau d'un type T.
Tableau d'items de types quelconques.
void clear()
Supprime les éléments du tableau.
void resize(Int64 s)
Change le nombre d'éléments du tableau à s.
const T * data() const
Accès à la racine du tableau hors toute protection.
ArrayView< T > view() const
Vue mutable sur ce tableau.
Span< const T > span() const
Vue immutable sur ce tableau.
void add(ConstReferenceType val)
Ajoute l'élément val à la fin du tableau.
Informations nécessaires pour la lecture d'un fichier de maillage.
Vue constante d'un tableau de type T.
constexpr Integer size() const noexcept
Nombre d'éléments du tableau.
static ARCCORE_BASE_EXPORT std::optional< Int32 > tryParseFromEnvironment(StringView s, bool throw_if_invalid)
Tableau 1D de taille fixe.
Interface du service de lecture du maillage à partir du jeu de données.
Interface d'une famille d'entités.
virtual ItemGroup findGroup(const String &name) const =0
Recherche un groupe.
virtual NodeGroup allNodes()=0
Groupe de tous les noeuds.
Interface d'un service de création/lecture du maillage.
Interface du service gérant la lecture d'un maillage.
eReturnType
Types des codes de retour d'une lecture ou écriture.
@ RTError
Erreur lors de l'opération.
@ RTOk
Opération effectuée avec succès.
Interface du gestionnaire de parallélisme pour un sous-domaine.
virtual Int32 commRank() const =0
Rang de cette instance dans le communicateur.
virtual VariableNodeReal3 & nodesCoordinates()=0
Coordonnées des noeuds.
virtual void allocateCells(Integer nb_cell, Int64ConstArrayView cells_infos, bool one_alloc=true)=0
Allocation d'un maillage.
Interface du gestionnaire de traces.
void addItems(Int32ConstArrayView items_local_id, bool check_if_present=true)
Ajoute des entités.
Classe utilitaire pour imprimer les infos sur une entité.
Type d'une entité (Item).
Infos sur un type d'entité du maillage.
String typeName() const
Nom du type.
Gestionnaire des types d'entités d'un maillage.
ItemTypeId getPolygonType(Int16 nb_node) const
Retourne le type pour un polygone ayant nb_node.
ItemTypeInfo * typeFromId(Integer id) const
Type correspondant au numéro id.
constexpr Int32 localId() const
Identifiant local de l'entité dans le sous-domaine du processeur.
constexpr bool null() const
true si l'entité est nul (i.e. non connecté au maillage)
void allocateMeshItems(IPrimaryMesh *pm) override
Alloue les entités du maillage géré par ce service.
void fillMeshBuildInfo(MeshBuildInfo &build_info) override
Remplit build_info avec les informations nécessaires pour créer le maillage.
Service de lecture d'un maillage au format MED depuis le jeu de données.
Ref< IMeshBuilder > createBuilder(const CaseMeshReaderReadInfo &read_info) const override
Retourne un builder pour créer et lire le maillage dont les informations sont spécifiées dans read_in...
bool allowExtension(const String &str) override
Vérifie si le service supporte les fichiers avec l'extension str.
void build() override
Construction de niveau build du service.
eReturnType readMeshFromFile(IPrimaryMesh *mesh, const XmlNode &mesh_element, const String &file_name, const String &dir_name, bool use_internal_partition) override
Lit un maillage à partir d'un fichier.
Int32 m_family_id
Id de la famille pour MED.
Int32 m_index
Index dans la liste des groupes Arcane.
Liste des groupes et des entités leur appartenant.
Int32 m_index
Index du groupe dans la liste des groupes.
UniqueArray< Int64 > m_unique_ids
Liste des uniqueId() des entités du groupe.
UniqueArray< String > m_names
Nom des groupes associés.
UniqueArray< Int32 > m_local_ids
Liste des localId() des entités du groupe.
Informations pour passer des types MED aux types Arcane pour les entités.
Lecteur de maillages au format MED.
void _broadcastGroups(ConstArrayView< String > names, IItemFamily *family)
Broadcast les groupes de group_names pour la famille family.
UniqueArray< MEDToArcaneItemInfo > m_med_to_arcane_types
Tableau de conversion entre les types MED et Arcane.
void _readAvailableTypes(med_idt fid, const char *meshname)
Récupère la liste des types géométriques présents dans le maillage.
IPrimaryMesh * m_mesh
Maillage en cours de lecture.
UniqueArray< MEDGroupInfo > m_med_groups
Liste des informations sur les groupes.
std::unordered_map< Int32, MEDFamilyInfo > m_med_families_map
Liste des familles.
std::unordered_map< med_int, Int32 > m_med_geotype_to_arcane_type_index
Table des index dans m_med_to_arcane_type de chaque geotype.
UniqueArray< med_int > m_med_geotypes_in_mesh
Liste des 'geotype' présents dans le maillage.
Int32 _readItems(med_idt fid, const char *meshnane, const MEDToArcaneItemInfo &iinfo, Array< Int16 > &polygon_nb_nodes, Array< med_int > &connectivity, Array< med_int > &family_values)
Lit les informations des entités d'un type donné.
void _readFaces(IPrimaryMesh *mesh, Int32 mesh_dimension, med_idt fid, const char *meshname)
Lit les faces.
Paramètres nécessaires à la construction d'un maillage.
Vue sur les informations des noeuds.
FaceConnectedListViewType faces() const
Liste des faces du noeud.
Classe utilitaire pour réordonner les noeuds d'une entité.
Exception lorsqu'une fonction n'est pas implémentée.
Référence à une instance.
Structure contenant les informations pour créer un service.
Tableau 1D de données avec buffer pré-alloué sur la pile.
Vue d'un tableau d'éléments de type T.
constexpr __host__ __device__ SmallSpan< T, DynExtent > subSpan(Int32 abegin, Int32 asize) const
Sous-vue à partir de l'élément abegin et contenant asize éléments.
Vue d'un tableau d'éléments de type T.
Chaîne de caractères unicode.
TraceAccessor(ITraceMng *m)
Construit un accesseur via le gestionnaire de trace m.
TraceMessage info() const
Flot pour un message d'information.
TraceMessage error() const
Flot pour un message d'erreur.
ITraceMng * traceMng() const
Gestionnaire de trace.
Vecteur 1D de données avec sémantique par valeur (style STL).
ItemGroupT< Cell > CellGroup
Groupe de mailles.
ItemGroupT< Face > FaceGroup
Groupe de faces.
#define ARCANE_REGISTER_SERVICE(aclass, a_service_property,...)
Macro pour enregistrer un service.
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Grandeur au noeud de type coordonnées.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
std::int64_t Int64
Type entier signé sur 64 bits.
Int32 Integer
Type représentant un entier.
@ ST_SubDomain
Le service s'utilise au niveau du sous-domaine.
std::int16_t Int16
Type entier signé sur 16 bits.
unsigned char Byte
Type d'un octet.
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Créé une référence sur un pointeur.
std::int32_t Int32
Type entier signé sur 32 bits.