14#include "arcane/utils/Iostream.h"
15#include "arcane/utils/StdHeader.h"
16#include "arcane/utils/HashTableMap.h"
17#include "arcane/utils/ValueConvert.h"
18#include "arcane/utils/ScopedPtr.h"
19#include "arcane/utils/ArcanePrecomp.h"
20#include "arcane/utils/ITraceMng.h"
21#include "arcane/utils/Real3.h"
22#include "arcane/utils/PlatformUtils.h"
23#include "arcane/utils/FatalErrorException.h"
24#include "arcane/utils/NotSupportedException.h"
25#include "arcane/utils/CheckedConvert.h"
27#include "arcane/IMeshReader.h"
28#include "arcane/ISubDomain.h"
29#include "arcane/IIOMng.h"
30#include "arcane/IParallelMng.h"
31#include "arcane/IPrimaryMesh.h"
32#include "arcane/Item.h"
33#include "arcane/ItemTypeMng.h"
34#include "arcane/ItemGroup.h"
35#include "arcane/ArcaneException.h"
36#include "arcane/Service.h"
37#include "arcane/Timer.h"
38#include "arcane/ServiceFactory.h"
39#include "arcane/ServiceInfo.h"
40#include "arcane/CaseOptionsMain.h"
41#include "arcane/MeshUtils.h"
42#include "arcane/ItemEnumerator.h"
43#include "arcane/VariableTypes.h"
44#include "arcane/ServiceBuildInfo.h"
45#include "arcane/XmlNodeList.h"
46#include "arcane/IXmlDocumentHolder.h"
47#include "arcane/IItemFamily.h"
48#include "arcane/FactoryService.h"
49#include "arcane/AbstractService.h"
50#include "arcane/MathUtils.h"
52#include "arcane/cea/LimaCutInfosReader.h"
67template<
typename LimaMaliReader>
72void createGroup(IItemFamily* family,
const String& name,
Int32ArrayView local_ids);
84 Real v1 =
math::matDet((n[6] - n[1]) + (n[7] - n[0]), n[6] - n[3], n[2] - n[0]);
85 Real v2 =
math::matDet(n[7] - n[0], (n[6] - n[3]) + (n[5] - n[0]), n[6] - n[4]);
86 Real v3 =
math::matDet(n[6] - n[1], n[5] - n[0], (n[6] - n[4]) + (n[2] - n[0]));
88 Real res = (v1 + v2 + v3) / 12.0;
95 return math::matDet(n[1] - n[0], n[3] - n[0], n[4] - n[0]) +
101 Real x1 = n[1].
x - n[0].
x;
102 Real y1 = n[1].
y - n[0].
y;
103 Real x2 = n[2].
x - n[1].
x;
104 Real y2 = n[2].
y - n[1].
y;
105 Real surface = x1 * y2 - y1 * x2;
107 x1 = n[2].
x - n[0].
x;
108 y1 = n[2].
y - n[0].
y;
109 x2 = n[3].
x - n[2].
x;
110 y2 = n[3].
y - n[2].
y;
112 surface += x1 * y2 - y1 * x2;
119 Real x1 = n[1].
x - n[0].
x;
120 Real y1 = n[1].
y - n[0].
y;
121 Real x2 = n[2].
x - n[1].
x;
122 Real y2 = n[2].
y - n[1].
y;
124 return x1 * y2 - y1 * x2;
137template<
typename LimaMaliReader>
138class LimaMalippMeshBase
144 virtual ~LimaMalippMeshBase() =
default;
149 const String& filename,
Real length_multiplier) = 0;
158 Int64 current_unique_id);
172template <
typename ReaderWrapper>
173class LimaMalippReaderT
174:
public LimaMalippMeshBase<typename ReaderWrapper::LimaMaliReaderType>
180 typedef typename ReaderWrapper::LimaMaliReaderType LimaMaliReader;
183 : LimaMalippMeshBase<LimaMaliReader>(pm->
traceMng()),
187 ~LimaMalippReaderT()
override
189 delete m_cut_infos_reader;
194 bool readMeshPart(
ITimerMng* timer_mng,LimaMaliReader* reader,
196 Real length_multiplier)
override;
200 ReaderWrapper m_wrapper;
203 const String& filename,
Real length_multiplier);
209template<
typename LimaMaliReader>
210class LimaMalippReaderWrapper
213 typedef LimaMaliReader LimaMaliReaderType;
214 typedef typename LimaMaliReader::NuageReader LimaNodeGroup;
217 LimaMalippReaderWrapper()
220 void setReader(LimaMaliReader* reader)
222 m_mali_reader = reader;
224 LimaMaliReader* reader()
226 return m_mali_reader;
231 _readGroup(
typename LimaMaliReader::SurfaceReader reader,
232 Lima::size_type begin, Lima::size_type n, Lima::size_type* buffer)
234 return reader.lire_mailles_ids(begin, n, buffer);
237 _readGroup(
typename LimaMaliReader::VolumeReader reader,
238 Lima::size_type begin, Lima::size_type n, Lima::size_type* buffer)
240 return reader.lire_mailles_ids(begin, n, buffer);
243 _readGroup(
typename LimaMaliReader::LigneReader reader,
244 Lima::size_type begin, Lima::size_type n, Lima::size_type* buffer)
246 return reader.lire_bras_ids(begin, n, buffer);
250 _readGroup(
typename LimaMaliReader::NuageReader reader,
251 Lima::size_type begin, Lima::size_type n, Lima::size_type* buffer)
253 return reader.lire_noeuds_ids(begin, n, buffer);
256 double* allocateNodesCoordsBuffer(Lima::size_type buf_size)
258 return m_mali_reader->allouer_tampon_coords(buf_size);
260 Lima::size_type* allocateNodesIdBuffer(Lima::size_type buf_size)
262 return m_mali_reader->allouer_tampon_ids(buf_size);
264 Lima::size_type readNodes(Lima::size_type begin, Lima::size_type count,
265 Lima::size_type* ids,
double* coords)
267 return m_mali_reader->lire_noeuds(begin, count, ids, coords);
270 template <
typename LimaGroupReader>
273 using namespace Lima;
278 items_unique_id.
resize(nb_item);
279 const Integer step_size = nb_item > 10000 ? nb_item / 10 : nb_item;
280 buffer = reader.allouer_tampon_ids(step_size);
282 for (
Integer i = 0; i * step_size < nb_item; ++i) {
285 for (
Integer n = 0; n < count; ++n) {
287 items_unique_id[begin + n] = lima_id - 1;
297 LimaMaliReader* m_mali_reader;
306template<
typename LimaMaliReader>
313 virtual ~LimaGroupReader() {}
319 std::vector<std::string> groups;
320 _getGroupsName(groups);
321 m_groups_name.clear();
322 for (
size_t i = 0, is = groups.size(); i < is; ++i)
323 m_groups_name.add(
String(groups[i]));
324 return m_groups_name;
328 virtual void _getGroupsName(std::vector<std::string>& groups) = 0;
337template<
typename LimaMaliReader>
339:
public LimaGroupReader<LimaMaliReader>
343 : LimaGroupReader<LimaMaliReader>(wrapper)
347 typename LimaMaliReader::NuageReader r = this->m_wrapper->reader()->nuage(name.
localstr());
348 this->m_wrapper->readGroup(r, items_unique_id);
350 virtual void _getGroupsName(std::vector<std::string>& groups)
352 this->m_wrapper->reader()->liste_nuages(groups);
358template<
typename LimaMaliReader>
360:
public LimaGroupReader<LimaMaliReader>
364 : LimaGroupReader<LimaMaliReader>(wrapper)
368 typename LimaMaliReader::LigneReader r = this->m_wrapper->reader()->ligne(name.
localstr());
369 this->m_wrapper->readGroup(r, items_unique_id);
371 virtual void _getGroupsName(std::vector<std::string>& groups)
373 this->m_wrapper->reader()->liste_lignes(groups);
379template<
typename LimaMaliReader>
381:
public LimaGroupReader<LimaMaliReader>
385 : LimaGroupReader<LimaMaliReader>(wrapper)
390 typename LimaMaliReader::SurfaceReader r = this->m_wrapper->reader()->surface(name.
localstr());
391 this->m_wrapper->readGroup(r, items_unique_id);
393 virtual void _getGroupsName(std::vector<std::string>& groups)
395 this->m_wrapper->reader()->liste_surfaces(groups);
399template<
typename LimaMaliReader>
401:
public LimaGroupReader<LimaMaliReader>
405 : LimaGroupReader<LimaMaliReader>(wrapper)
410 typename LimaMaliReader::VolumeReader r = this->m_wrapper->reader()->volume(name.
localstr());
411 this->m_wrapper->readGroup(r, items_unique_id);
413 virtual void _getGroupsName(std::vector<std::string>& groups)
415 this->m_wrapper->reader()->liste_volumes(groups);
424template<
typename LimaMaliReader>
426:
public LimaMalippReaderWrapper<LimaMaliReader>
428 typedef LimaMalippReaderWrapper<LimaMaliReader> BaseClass;
429 using BaseClass::m_mali_reader;
430 using BaseClass::m_cell_group_reader;
431 using BaseClass::m_node_group_reader;
432 using BaseClass::m_face_group_reader;
434 typedef Lima::Composition LimaComposition;
435 typedef typename LimaMaliReader::SurfaceReader LimaCellGroup;
436 typedef typename LimaMaliReader::LigneReader LimaFaceGroup;
437 typedef typename LimaMaliReader::NuageReader LimaNodeGroup;
439 LimaComposition cells()
441 return m_mali_reader->composition_polygones();
444 LimaComposition faces()
446 return m_mali_reader->composition_bras();
449 LimaComposition nodes()
451 return m_mali_reader->composition_noeuds();
454 std::vector<std::string> cellGroups()
456 std::vector<std::string> groups;
457 m_mali_reader->liste_surfaces(groups);
463 if (!m_cell_group_reader.get())
465 return m_cell_group_reader.get();
470 if (!m_node_group_reader.get())
472 return m_node_group_reader.get();
477 if (!m_face_group_reader.get())
479 return m_face_group_reader.get();
482 std::vector<std::string> faceGroups()
484 std::vector<std::string> groups;
485 m_mali_reader->liste_lignes(groups);
489 std::vector<std::string> nodeGroups()
491 std::vector<std::string> groups;
492 m_mali_reader->liste_nuages(groups);
496 LimaCellGroup cellGroup(
const string& name)
498 return m_mali_reader->surface(name);
501 LimaFaceGroup faceGroup(
const string& name)
503 return m_mali_reader->ligne(name);
506 LimaNodeGroup nodeGroup(
const string& name)
508 return m_mali_reader->nuage(name);
511 Lima::size_type* allocateCellsBuffer(Lima::size_type buf_size)
513 return m_mali_reader->allouer_tampon_polygones(buf_size);
515 Lima::size_type readCells(Lima::size_type begin, Lima::size_type count, Lima::size_type* buffer)
517 return m_mali_reader->lire_polygones(begin, count, buffer);
519 Integer facesBufferSize(Lima::size_type buf_size)
527 Lima::size_type readFaces(Lima::size_type begin, Lima::size_type count, Lima::size_type* buffer)
529 return m_mali_reader->lire_bras(begin, count, buffer);
540 const char* strDimension()
544 Real3 readNodeCoords(
const double* ptr)
546 return Real3(ptr[0], ptr[1], 0.0);
569template<
typename LimaMaliReader>
571:
public LimaMalippReaderWrapper<LimaMaliReader>
573 typedef LimaMalippReaderWrapper<LimaMaliReader> BaseClass;
574 using BaseClass::m_mali_reader;
575 using BaseClass::m_cell_group_reader;
576 using BaseClass::m_node_group_reader;
577 using BaseClass::m_face_group_reader;
579 typedef typename LimaMaliReader::VolumeReader LimaCellGroup;
580 typedef typename LimaMaliReader::SurfaceReader LimaFaceGroup;
581 typedef typename LimaMaliReader::NuageReader LimaNodeGroup;
582 typedef Lima::Composition LimaComposition;
585 LimaComposition cells()
587 return m_mali_reader->composition_polyedres();
589 LimaComposition faces()
591 return m_mali_reader->composition_polygones();
593 LimaComposition nodes()
595 return m_mali_reader->composition_noeuds();
601 typedef Lima::Polyedre LimaCell;
603 typedef Lima::Polygone LimaFace;
607 if (!m_cell_group_reader.get())
609 return m_cell_group_reader.get();
614 if (!m_face_group_reader.get())
616 return m_face_group_reader.get();
621 if (!m_node_group_reader.get())
623 return m_node_group_reader.get();
626 std::vector<std::string> cellGroups()
628 std::vector<std::string> groups;
629 m_mali_reader->liste_volumes(groups);
633 std::vector<std::string> faceGroups()
635 std::vector<std::string> groups;
636 m_mali_reader->liste_surfaces(groups);
640 std::vector<std::string> nodeGroups()
642 std::vector<std::string> groups;
643 m_mali_reader->liste_nuages(groups);
647 LimaCellGroup cellGroup(
const string& name)
649 return m_mali_reader->volume(name);
651 LimaFaceGroup faceGroup(
const string& name)
653 return m_mali_reader->surface(name);
655 LimaNodeGroup nodeGroup(
const string& name)
657 return m_mali_reader->nuage(name);
659 Lima::size_type* allocateCellsBuffer(Lima::size_type buf_size)
661 return m_mali_reader->allouer_tampon_polyedres(buf_size);
663 Lima::size_type readCells(Lima::size_type begin, Lima::size_type count, Lima::size_type* buffer)
665 return m_mali_reader->lire_polyedres(begin, count, buffer);
667 Integer facesBufferSize(Lima::size_type buf_size)
675 Lima::size_type readFaces(Lima::size_type begin, Lima::size_type count, Lima::size_type* buffer)
677 return m_mali_reader->lire_polygones(begin, count, buffer);
688 const char* strDimension()
692 Real3 readNodeCoords(
const double* ptr)
694 return Real3(ptr[0], ptr[1], ptr[2]);
700 return IT_Tetraedron4;
704 return IT_Pentaedron6;
706 return IT_Hexaedron8;
708 return IT_Heptaedron10;
710 return IT_Octaedron12;
723template<
typename LimaMaliReader>
724class LimaMalippReader
734 const String& file_name,
Real length_multiplier);
741template<
typename LimaMaliReader>
744 const String& filename,
Real length_multiplier)
756 reader =
new LimaMaliReader(filename.
localstr(), 1);
758 catch (
const Lima::erreur& ex) {
759 ARCANE_FATAL(
"Impossible de lire le fichier MLI Lima <{0}> :",filename,ex.what());
762 ARCANE_FATAL(
"Impossible de lire le fichier MLI Lima <{0}>",filename);
764 dimension = reader->dimension();
770 if (dimension == Lima::D3) {
771 info() <<
"Maillage 3D";
772 mesh->setDimension(3);
775 else if (dimension == Lima::D2) {
776 info() <<
"Maillage 2D";
777 mesh->setDimension(2);
784 log() <<
"Dimension du maillage non reconnue par lima";
787 bool ret = lm->readMeshPart(timer_mng,reader.
get(), mesh, filename, length_multiplier);
796template <
typename ReaderWrapper>
799 const String& filename,
Real length_multiplier)
801 return _readMeshPart(timer_mng, reader, mesh, filename, length_multiplier);
811template <
typename ReaderWrapper>
814 const String& file_name,
Real length_multiplier)
821 Integer master_rank = pm->masterIORank();
822 Int32 nb_rank = pm->commSize();
826 this->pwarning() <<
"Chargement Lima du fichier USING MALIPP avec partitionnement '" << file_name <<
'"';
827 if (basic_step < 100000)
828 this->pwarning() <<
"Small basic_step value=" << basic_step;
830 const char* version = Lima::lima_version();
831 info() <<
"Utilisation de la version " << version <<
" de Lima";
835 this->
log() <<
"Début lecture fichier " << file_name;
837 ReaderWrapper wrapper;
838 wrapper.setReader(reader);
840 if (reader && reader->dimension() != wrapper.limaDimension())
841 ARCANE_FATAL(
"Le fichier n'est pas un maillage {0}",wrapper.strDimension());
843 bool is_3d = (mesh->dimension() == 3);
845 Int64 mesh_nb_node = 0;
846 Int64 mesh_nb_cell = 0;
847 Int64 mesh_nb_face = 0;
851 Lima::Composition lima_cells = wrapper.cells();
852 Lima::Composition lima_nodes = wrapper.nodes();
853 Lima::Composition lima_faces = wrapper.faces();
855 mesh_nb_node = (
Int64)lima_nodes.nb_elements;
856 mesh_nb_cell = (
Int64)lima_cells.nb_elements;
857 mesh_nb_face = (
Int64)lima_faces.nb_elements;
859 nb_items[0] = mesh_nb_node;
860 nb_items[1] = mesh_nb_cell;
861 nb_items[2] = mesh_nb_face;
864 info() <<
"Unité de longueur du fichier: " << reader->unite_longueur();
865 if (length_multiplier == 0.0)
866 length_multiplier = 1.0;
868 length_multiplier *= reader->unite_longueur();
869 pm->broadcast(
RealArrayView(1, &length_multiplier), master_rank);
874 mesh_nb_node = nb_items[0];
875 mesh_nb_cell = nb_items[1];
876 mesh_nb_face = nb_items[2];
877 pm->broadcast(
RealArrayView(1, &length_multiplier), master_rank);
883 info() <<
"-- Informations sur le maillage (Lima):";
884 info() <<
"Nombre de noeuds " << mesh_nb_node;
885 info() <<
"Nombre d'arêtes " << nb_edge;
886 info() <<
"Nombre de faces " << mesh_nb_face;
887 info() <<
"Nombre de mailles " << mesh_nb_cell;
888 if (mesh_nb_node == 0) {
889 ARCANE_FATAL(
"Pas de noeuds dans le fichier de maillage.");
894 Int64 uid_to_add = 0;
897 info() <<
"WARNING: UniqueId begin at 1";
909 cells_infos.reserve(average_nb_cell * 2);
911 Integer cell_step = average_nb_cell;
913 ARCANE_FATAL(
"Number of cells is less than number of sub domains");
916 size_type* buffer = wrapper.allocateCellsBuffer(cell_step + nb_rank);
917 Int64 total_nb_cell = mesh_nb_cell;
921 for (
Integer i = 0; total_count < total_nb_cell; ++i) {
923 ARCANE_FATAL(
"Too many count reading cells i={0} nrank=",i,nb_rank);
924 Int64 wanted_count = cell_step;
926 if ((i + 1) == nb_rank)
927 wanted_count = mesh_nb_cell;
930 Integer p = (i * 20) / nb_rank;
931 if (p > last_print) {
933 info() <<
"Reading cells rank=" << i <<
" n=" << wanted_count <<
" count=" << count
934 <<
" (" << (p * 5) <<
"%)";
936 current_nb_cell = count;
937 total_count += count;
940 for (
Integer p = 0; p < count; ++p) {
942 const Lima::size_type nodeCount = *ptr++;
944 Integer ct = ReaderWrapper::cellToType(n);
945 if (ct == IT_NullType)
950 cells_infos.add(uid_to_add + cell_local_id - 1);
952 for (Lima::size_type z = 0; z < nodeCount; ++z) {
953 Int64 node_local_id = *ptr++;
954 cells_infos.add(uid_to_add + node_local_id - 1);
957 if (i != master_rank) {
959 nb_cells_infos[0] = current_nb_cell;
960 nb_cells_infos[1] = cells_infos.size();
962 pm->send(cells_infos, i);
965 own_nb_cell = current_nb_cell;
966 own_cells_infos = cells_infos;
974 own_nb_cell = nb_cells_infos[0];
975 own_cells_infos.resize(nb_cells_infos[1]);
976 pm->recv(own_cells_infos, master_rank);
980 info() <<
" READ COORDINATES 1";
986 for (
Integer i = 0; i < own_nb_cell; ++i) {
992 Integer current_nb_node = it->nbLocalNode();
993 for (
Integer z = 0; z < current_nb_node; ++z) {
994 Int64 node_uid = own_cells_infos[cell_index + z];
995 nodes_coords.add(node_uid,
Real3());
997 cell_index += current_nb_node;
1001 info() <<
" READ COORDINATES 2";
1005 size_type step_size = (lima_nb_node > basic_step) ? basic_step : mesh_nb_node;
1007 size_type* idBuffer = reader->allouer_tampon_ids(step_size);
1008 double* coordsBuffer = reader->allouer_tampon_coords(step_size);
1009 Integer dim_step = reader->dimension();
1011 for (
Integer i = 0; i < mesh_nb_node;) {
1013 current_coords.clear();
1014 for (
Integer n = 0; n < count; ++n, ++nodeCount) {
1019 coord.x = coordsBuffer[n];
1022 coord.x = coordsBuffer[2 * n];
1023 coord.y = coordsBuffer[(2 * n) + 1];
1026 coord.x = coordsBuffer[3 * n];
1027 coord.y = coordsBuffer[(3 * n) + 1];
1028 coord.z = coordsBuffer[(3 * n) + 2];
1031 if (length_multiplier != 1.0)
1032 current_coords.
add(coord * length_multiplier);
1034 current_coords.
add(coord);
1037 sizes_info[0] = count;
1040 pm->broadcast(current_coords, master_rank);
1041 this->_setCoords(current_coords, nodes_coords, i + uid_to_add);
1045 delete[] coordsBuffer;
1049 for (
Int64 i = 0; i < mesh_nb_node;) {
1052 Integer count = sizes_info[0];
1053 current_coords.resize(count);
1055 pm->broadcast(current_coords, master_rank);
1056 this->_setCoords(current_coords, nodes_coords, i + uid_to_add);
1061 info() <<
" READ CELLS";
1070 local_coords.resize(8);
1072 for (
Integer i = 0; i < own_nb_cell; ++i) {
1075 Int64 cell_uid = own_cells_infos[cell_index];
1078 Integer current_nb_node = it->nbLocalNode();
1079 local_coords.resize(current_nb_node);
1080 for (
Integer z = 0; z < current_nb_node; ++z)
1081 local_coords[z] = nodes_coords.lookupValue(own_cells_infos[cell_index + z]);
1082 if (type_id == IT_Hexaedron8) {
1083 Real volume = LimaVolume::Hexaedron8Volume(local_coords.data());
1085 std::swap(own_cells_infos[cell_index + 0], own_cells_infos[cell_index + 1]);
1086 std::swap(own_cells_infos[cell_index + 3], own_cells_infos[cell_index + 2]);
1087 std::swap(own_cells_infos[cell_index + 4], own_cells_infos[cell_index + 5]);
1088 std::swap(own_cells_infos[cell_index + 7], own_cells_infos[cell_index + 6]);
1089 info() <<
"Volume negatif Hexaedron8 uid=" << cell_uid <<
" v=" << volume;
1093 else if (type_id == IT_Pyramid5) {
1094 Real volume = LimaVolume::Pyramid5Volume(local_coords.data());
1096 std::swap(own_cells_infos[cell_index + 0], own_cells_infos[cell_index + 1]);
1097 std::swap(own_cells_infos[cell_index + 2], own_cells_infos[cell_index + 3]);
1098 info() <<
"Volume negatif Pyramid5 uid=" << cell_uid <<
" v=" << volume;
1102 else if (type_id == IT_Quad4) {
1103 Real surface = LimaVolume::Quad4Surface(local_coords.data());
1104 if (surface < 0.0) {
1105 std::swap(own_cells_infos[cell_index + 0], own_cells_infos[cell_index + 1]);
1106 std::swap(own_cells_infos[cell_index + 2], own_cells_infos[cell_index + 3]);
1107 info() <<
"Surface negative Quad4 uid=" << cell_uid <<
" v=" << surface;
1111 else if (type_id == IT_Triangle3) {
1112 Real surface = LimaVolume::Triangle3Surface(local_coords.data());
1113 if (surface < 0.0) {
1114 std::swap(own_cells_infos[cell_index + 0], own_cells_infos[cell_index + 1]);
1115 info() <<
"Surface negative Triangle3 uid=" << cell_uid <<
" v=" << surface;
1120 cell_index += current_nb_node;
1122 info() <<
"NB reoriented cell = " << nb_reoriented;
1125 logdate() <<
"Début allocation du maillage";
1126 mesh->allocateCells(own_nb_cell, own_cells_infos,
false);
1127 logdate() <<
"Fin allocation du maillage";
1129 Int32 sid = pm->commRank();
1131 for (
Integer i = 0, is = cells.size(); i < is; ++i)
1132 cells[i]->setOwner(sid, sid);
1134 mesh->endAllocate();
1139 mesh->setOwnersFromCells();
1141 this->_createGroups(mesh,
IK_Cell, wrapper.cellGroupReader(), 0);
1142 this->_createGroups(mesh,
IK_Node, wrapper.nodeGroupReader(), 0);
1152 orig_nodes_id.reserve(100);
1154 face_nodes_index.reserve(100);
1159 size_type step_size = (mesh_nb_face > (
Int64)face_basic_step) ? face_basic_step : mesh_nb_face;
1162 Int64 current_nb_face = 0;
1163 Integer nb_lima_face_in_sub_domain = 0;
1164 info() <<
"Total_nb_face2=" << total_nb_face;
1168 for (
size_type i = 0; (i * step_size) < total_nb_face; ++i) {
1173 pm->broadcast(buffer, master_rank);
1177 pm->broadcast(buffer, master_rank);
1180 info() <<
" Read Face2 N=" << i <<
" count=" << count <<
" step_size=" << step_size;
1181 orig_nodes_id.clear();
1182 faces_first_node_unique_id.clear();
1183 faces_nb_node.resize(count);
1184 faces_nodes_unique_id.clear();
1186 for (
Integer p = 0; p < count; ++p) {
1194 faces_nb_node[p] = n;
1195 orig_nodes_id.resize(n);
1196 face_nodes_index.resize(n);
1197 for (
Integer z = 0; z < nodeCount; ++z) {
1200 orig_nodes_id[z] = node_local_id - 1;
1204 for (
Integer z = 0; z < n; ++z)
1205 faces_nodes_unique_id.add(orig_nodes_id[face_nodes_index[z]]);
1206 faces_first_node_unique_id.add(orig_nodes_id[face_nodes_index[0]]);
1210 mesh->nodeFamily()->itemsUniqueIdToLocalId(faces_first_node_local_id, faces_first_node_unique_id,
false);
1212 Integer faces_nodes_unique_id_index = 0;
1213 for (
Integer i_face = 0; i_face < count; ++i_face) {
1214 Integer n = faces_nb_node[i_face];
1215 Int64ConstArrayView face_nodes_id(n, &faces_nodes_unique_id[faces_nodes_unique_id_index]);
1216 Int32 first_node_id = faces_first_node_local_id[i_face];
1218 if (first_node_id != NULL_ITEM_ID) {
1219 Node current_node(mesh_nodes[first_node_id]);
1220 Face face = mesh_utils::getFaceFromNodesUnique(current_node, face_nodes_id);
1224 faces_local_id.add(current_nb_face + i_face, face.localId());
1225 ++nb_lima_face_in_sub_domain;
1228 faces_nodes_unique_id_index += n;
1230 current_nb_face += count;
1232 info() <<
"NB LIMA FACE IN SUB-DOMAIN =" << nb_lima_face_in_sub_domain;
1235 this->_createGroups(mesh,
IK_Face, wrapper.faceGroupReader(), &faces_local_id);
1241 const Node& node = *i;
1242 nodes_coord_var[node] = nodes_coords.lookupValue(node.uniqueId().asInt64());
1245 nodes_coord_var.synchronize();
1248 logdate() <<
"Fin de lecture du fichier";
1255template <
typename LimaMaliReader>
1258 Int64 current_unique_id)
1260 for (
Integer i = 0, is = coords.size(); i < is; ++i) {
1261 Int64 uid = current_unique_id + i;
1264 d->value() = coords[i];
1271template <
typename LimaMaliReader>
1277 Integer master_rank = pm->masterIORank();
1278 Integer is_master_io = pm->isMasterIO();
1288 Integer nb_group = groups_name.size();
1290 sizes_infos[0] = nb_group;
1292 for (
Integer i = 0; i < nb_group; ++i) {
1294 String group_name = groups_name[i];
1295 pm->broadcastString(group_name, master_rank);
1298 lima_group_reader->read(group_name, unique_ids);
1299 Integer nb_item_in_group = unique_ids.size();
1300 sizes_infos[0] = nb_item_in_group;
1302 pm->broadcast(unique_ids, master_rank);
1304 _createGroupFromHashTable(mesh, group_name, item_kind, unique_ids, *converter);
1306 _createGroupFromUniqueIds(mesh, group_name, item_kind, unique_ids);
1312 Integer nb_group = sizes_infos[0];
1313 for (
Integer i = 0; i < nb_group; ++i) {
1315 pm->broadcastString(group_name, master_rank);
1318 Integer nb_item_in_group = sizes_infos[0];
1319 unique_ids.resize(nb_item_in_group);
1320 pm->broadcast(unique_ids, master_rank);
1322 _createGroupFromHashTable(mesh, group_name, item_kind, unique_ids, *converter);
1324 _createGroupFromUniqueIds(mesh, group_name, item_kind, unique_ids);
1332template <
typename LimaMaliReader>
1337 Integer nb_item_in_group = unique_ids.size();
1342 for (
Integer i = 0; i < nb_item_in_group; ++i) {
1343 if (local_ids[i] != NULL_ITEM_ID)
1344 group_ids.add(local_ids[i]);
1346 info() <<
"Group Name <" << name <<
"> (" << nb_item_in_group <<
" elements)";
1347 LimaUtils::createGroup(family, name, group_ids);
1353template <
typename LimaMaliReader>
1359 Integer nb_item_in_group = unique_ids.size();
1363 for (
Integer i = 0; i < nb_item_in_group; ++i) {
1366 group_ids.add(data->value());
1368 info() <<
"Group Name <" << name <<
"> (" << nb_item_in_group <<
" elements)";
1369 LimaUtils::createGroup(family, name, group_ids);
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
bool reorderNodesOfFace2(Int64ConstArrayView nodes_unique_id, IntegerArrayView new_index)
Réordonne les noeuds d'une face.
void resize(Int64 s)
Change le nombre d'éléments du tableau à s.
Interface d'une famille d'entités.
virtual void itemsUniqueIdToLocalId(Int32ArrayView local_ids, Int64ConstArrayView unique_ids, bool do_fatal=true) const =0
Converti un tableau de numéros uniques en numéros locaux.
eReturnType
Types des codes de retour d'une lecture ou écriture.
@ RTIrrelevant
Non concerné par l'opération. Cela signifie que le format de fichier ne correspond pas à ce lecteur o...
@ 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 ITraceMng * traceMng() const =0
Gestionnaire de traces.
virtual bool isMasterIO() const =0
true si l'instance est un gestionnaire maître des entrées/sorties.
virtual Integer masterIORank() const =0
Rang de l'instance gérant les entrées/sorties (pour laquelle isMasterIO() est vrai)
Interface d'un gestionnaire de timer.
Interface du gestionnaire de traces.
Infos sur un type d'entité du maillage.
Gestionnaire des types d'entités de maillage.
Construction d'un maillage 3D.
Lecteur des fichiers de maillage via la bibliothèque LIMA pour fichier '.mli' ou 'mli2'.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
T * get() const
Retourne l'objet référé par l'instance.
Classe gérant un vecteur de réel de dimension 3.
constexpr __host__ __device__ Real3 & add(Real3 b)
Ajoute b au triplet.
Encapsulation d'un pointeur qui se détruit automatiquement.
Chaîne de caractères unicode.
bool null() const
Retourne true si la chaîne est nulle.
const char * localstr() const
Retourne la conversion de l'instance dans l'encodage UTF-8.
bool empty() const
Vrai si la chaîne est vide (nulle ou "")
@ TimerReal
Timer utilisant le temps réel.
TraceAccessor(ITraceMng *m)
Construit un accesseur via le gestionnaire de trace m.
TraceMessage logdate() const
Flot pour un message de log précédé de la date.
TraceMessage log() const
Flot pour un message de log.
TraceMessage info() const
Flot pour un message d'information.
Vecteur 1D de données avec sémantique par valeur (style STL).
constexpr __host__ __device__ pointer data() const noexcept
Pointeur sur le début de la vue.
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Grandeur au noeud de type coordonnées.
Integer toInteger(Real r)
Converti un Int64 en un Integer.
__host__ __device__ double log(double v)
Logarithme népérien de v.
__host__ __device__ Real matDet(Real3 u, Real3 v, Real3 w)
Déterminant de la matrice u,v,w.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Array< Int64 > Int64Array
Tableau dynamique à une dimension d'entiers 64 bits.
ArrayView< Int64 > Int64ArrayView
Equivalent C d'un tableau à une dimension d'entiers 64 bits.
ConstArrayView< Real3 > Real3ConstArrayView
Equivalent C d'un tableau à une dimension de Real3.
UniqueArray< Int64 > Int64UniqueArray
Tableau dynamique à une dimension d'entiers 64 bits.
ConstArrayView< String > StringConstArrayView
Equivalent C d'un tableau à une dimension de chaînes de caractères.
std::int64_t Int64
Type entier signé sur 64 bits.
Int32 Integer
Type représentant un entier.
UniqueArray< Real3 > Real3UniqueArray
Tableau dynamique à une dimension de vecteurs de rang 3.
ArrayView< Integer > IntegerArrayView
Equivalent C d'un tableau à une dimension d'entiers.
ConstArrayView< ItemInternal * > ItemInternalList
Type de la liste interne des entités.
ConstArrayView< Int64 > Int64ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 64 bits.
UniqueArray< Int32 > Int32UniqueArray
Tableau dynamique à une dimension d'entiers 32 bits.
ArrayView< Int32 > Int32ArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
eItemKind
Genre d'entité de maillage.
@ IK_Node
Entité de maillage de genre noeud.
@ IK_Cell
Entité de maillage de genre maille.
@ IK_Face
Entité de maillage de genre face.
double Real
Type représentant un réel.
UniqueArray< String > StringUniqueArray
Tableau dynamique à une dimension de chaînes de caractères.
UniqueArray< Integer > IntegerUniqueArray
Tableau dynamique à une dimension d'entiers.
ConstArrayView< Integer > IntegerConstArrayView
Equivalent C d'un tableau à une dimension d'entiers.
ArrayView< Real > RealArrayView
Equivalent C d'un tableau à une dimension de réels.
std::int32_t Int32
Type entier signé sur 32 bits.
Real y
deuxième composante du triplet
Real x
première composante du triplet