Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
LimaMalippT.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 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/* LimaMalipp.cc (C) 2000-2019 */
9/* */
10/* Lecture d'un fichier au format Lima MLI ou MLI2. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
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"
26
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"
51
52#include "arcane/cea/LimaCutInfosReader.h"
53
54#include <memory>
55
56/*---------------------------------------------------------------------------*/
57/*---------------------------------------------------------------------------*/
58
59namespace Arcane
60{
61
62/*---------------------------------------------------------------------------*/
63/*---------------------------------------------------------------------------*/
64
65using std::string;
66
67template<typename LimaMaliReader>
68class LimaGroupReader;
69
70namespace LimaUtils
71{
72void createGroup(IItemFamily* family, const String& name, Int32ArrayView local_ids);
73}
74
75
76/*---------------------------------------------------------------------------*/
77/*---------------------------------------------------------------------------*/
78
80{
81 public:
82 static Real Hexaedron8Volume(Real3 n[8])
83 {
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]));
87
88 Real res = (v1 + v2 + v3) / 12.0;
89
90 return res;
91 }
92
93 static Real Pyramid5Volume(Real3 n[5])
94 {
95 return math::matDet(n[1] - n[0], n[3] - n[0], n[4] - n[0]) +
96 math::matDet(n[3] - n[2], n[1] - n[2], n[4] - n[2]);
97 }
98
99 static Real Quad4Surface(Real3 n[4])
100 {
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;
106
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;
111
112 surface += x1 * y2 - y1 * x2;
113
114 return surface;
115 }
116
117 static Real Triangle3Surface(Real3 n[3])
118 {
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;
123
124 return x1 * y2 - y1 * x2;
125 }
126};
127
128/*---------------------------------------------------------------------------*/
129/*---------------------------------------------------------------------------*/
137template<typename LimaMaliReader>
139: public TraceAccessor
140{
141 public:
142 LimaMalippMeshBase(ITraceMng* trace_mng)
143 : TraceAccessor(trace_mng) {}
144 virtual ~LimaMalippMeshBase() = default;
145
146 public:
147 public:
148 virtual bool readMeshPart(ITimerMng* timer_mng, LimaMaliReader* reader, IPrimaryMesh* mesh,
149 const String& filename, Real length_multiplier) = 0;
150
151 protected:
152 void _createGroupFromUniqueIds(IMesh* mesh, const String& name, eItemKind ik,
154 void _createGroupFromHashTable(IMesh* mesh, const String& name, eItemKind ik,
158 Int64 current_unique_id);
159 void _createGroups(IMesh* mesh, eItemKind item_kind, LimaGroupReader<LimaMaliReader>* reader,
161 private:
162};
163
164/*---------------------------------------------------------------------------*/
165/*---------------------------------------------------------------------------*/
172template <typename ReaderWrapper>
174: public LimaMalippMeshBase<typename ReaderWrapper::LimaMaliReaderType>
175{
177 using TraceAccessor::log;
179 public:
180 typedef typename ReaderWrapper::LimaMaliReaderType LimaMaliReader;
181 public:
184 m_cut_infos_reader(new LimaCutInfosReader(pm))
185 {}
186
187 ~LimaMalippReaderT() override
188 {
189 delete m_cut_infos_reader;
190 }
191
192 public:
193 public:
194 bool readMeshPart(ITimerMng* timer_mng,LimaMaliReader* reader,
195 IPrimaryMesh* mesh, const String& filename,
196 Real length_multiplier) override;
197
198 private:
199 LimaCutInfosReader* m_cut_infos_reader;
200 ReaderWrapper m_wrapper;
201
202 bool _readMeshPart(ITimerMng* timer_mng,LimaMaliReader* reader, IPrimaryMesh* mesh,
203 const String& filename, Real length_multiplier);
204};
205
206/*---------------------------------------------------------------------------*/
207/*---------------------------------------------------------------------------*/
208
209template<typename LimaMaliReader>
211{
212 public:
213 typedef LimaMaliReader LimaMaliReaderType;
214 typedef typename LimaMaliReader::NuageReader LimaNodeGroup;
215
216 public:
218 : m_mali_reader(0)
219 {}
220 void setReader(LimaMaliReader* reader)
221 {
222 m_mali_reader = reader;
223 }
224 LimaMaliReader* reader()
225 {
226 return m_mali_reader;
227 }
228
229 public:
230 Lima::size_type
231 _readGroup(typename LimaMaliReader::SurfaceReader reader,
232 Lima::size_type begin, Lima::size_type n, Lima::size_type* buffer)
233 {
234 return reader.lire_mailles_ids(begin, n, buffer);
235 }
236 Lima::size_type
237 _readGroup(typename LimaMaliReader::VolumeReader reader,
238 Lima::size_type begin, Lima::size_type n, Lima::size_type* buffer)
239 {
240 return reader.lire_mailles_ids(begin, n, buffer);
241 }
242 Lima::size_type
243 _readGroup(typename LimaMaliReader::LigneReader reader,
244 Lima::size_type begin, Lima::size_type n, Lima::size_type* buffer)
245 {
246 return reader.lire_bras_ids(begin, n, buffer);
247 }
248
249 Lima::size_type
250 _readGroup(typename LimaMaliReader::NuageReader reader,
251 Lima::size_type begin, Lima::size_type n, Lima::size_type* buffer)
252 {
253 return reader.lire_noeuds_ids(begin, n, buffer);
254 }
255
256 double* allocateNodesCoordsBuffer(Lima::size_type buf_size)
257 {
258 return m_mali_reader->allouer_tampon_coords(buf_size);
259 }
260 Lima::size_type* allocateNodesIdBuffer(Lima::size_type buf_size)
261 {
262 return m_mali_reader->allouer_tampon_ids(buf_size);
263 }
264 Lima::size_type readNodes(Lima::size_type begin, Lima::size_type count,
265 Lima::size_type* ids, double* coords)
266 {
267 return m_mali_reader->lire_noeuds(begin, count, ids, coords);
268 }
269
270 template <typename LimaGroupReader>
271 void readGroup(LimaGroupReader& reader, Int64Array& items_unique_id)
272 {
273 using namespace Lima;
274 //cout << "----------------------------------------------------------"
275 // << reader.nom();
276 size_type* buffer = 0;
277 const Integer nb_item = CheckedConvert::toInteger(reader.composition().nb_elements);
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);
281 Integer begin = 0;
282 for (Integer i = 0; i * step_size < nb_item; ++i) {
283 const Integer count = CheckedConvert::toInteger(_readGroup(reader, (size_type)(i * step_size), (size_type)step_size, buffer));
284 size_type* ptr = buffer;
285 for (Integer n = 0; n < count; ++n) {
286 size_type lima_id = *ptr++;
287 items_unique_id[begin + n] = lima_id - 1;
288 //cout << lima_id << " ";
289 }
290 begin += count;
291 }
292 delete[] buffer;
293 //cout << endl;
294 }
295
296 protected:
297 LimaMaliReader* m_mali_reader;
301};
302
303/*---------------------------------------------------------------------------*/
304/*---------------------------------------------------------------------------*/
305
306template<typename LimaMaliReader>
308{
309 public:
311 : m_wrapper(wrapper)
312 {}
313 virtual ~LimaGroupReader() {}
314 virtual void read(const String& name, Int64Array& items_unique_id) = 0;
315
316 public:
317 virtual StringConstArrayView groupsName()
318 {
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;
325 }
326
327 protected:
328 virtual void _getGroupsName(std::vector<std::string>& groups) = 0;
329
330 protected:
332
333 private:
334 StringUniqueArray m_groups_name;
335};
336
337template<typename LimaMaliReader>
339: public LimaGroupReader<LimaMaliReader>
340{
341 public:
344 {}
345 virtual void read(const String& name, Int64Array& items_unique_id)
346 {
347 typename LimaMaliReader::NuageReader r = this->m_wrapper->reader()->nuage(name.localstr());
348 this->m_wrapper->readGroup(r, items_unique_id);
349 }
350 virtual void _getGroupsName(std::vector<std::string>& groups)
351 {
352 this->m_wrapper->reader()->liste_nuages(groups);
353 }
354
355 private:
356};
357
358template<typename LimaMaliReader>
360: public LimaGroupReader<LimaMaliReader>
361{
362 public:
365 {}
366 virtual void read(const String& name, Int64Array& items_unique_id)
367 {
368 typename LimaMaliReader::LigneReader r = this->m_wrapper->reader()->ligne(name.localstr());
369 this->m_wrapper->readGroup(r, items_unique_id);
370 }
371 virtual void _getGroupsName(std::vector<std::string>& groups)
372 {
373 this->m_wrapper->reader()->liste_lignes(groups);
374 }
375
376 private:
377};
378
379template<typename LimaMaliReader>
381: public LimaGroupReader<LimaMaliReader>
382{
383 public:
386 {
387 }
388 virtual void read(const String& name, Int64Array& items_unique_id)
389 {
390 typename LimaMaliReader::SurfaceReader r = this->m_wrapper->reader()->surface(name.localstr());
391 this->m_wrapper->readGroup(r, items_unique_id);
392 }
393 virtual void _getGroupsName(std::vector<std::string>& groups)
394 {
395 this->m_wrapper->reader()->liste_surfaces(groups);
396 }
397};
398
399template<typename LimaMaliReader>
401: public LimaGroupReader<LimaMaliReader>
402{
403 public:
406 {
407 }
408 virtual void read(const String& name, Int64Array& items_unique_id)
409 {
410 typename LimaMaliReader::VolumeReader r = this->m_wrapper->reader()->volume(name.localstr());
411 this->m_wrapper->readGroup(r, items_unique_id);
412 }
413 virtual void _getGroupsName(std::vector<std::string>& groups)
414 {
415 this->m_wrapper->reader()->liste_volumes(groups);
416 }
417
418 private:
419};
420
421/*---------------------------------------------------------------------------*/
422/*---------------------------------------------------------------------------*/
423
424template<typename LimaMaliReader>
426: public LimaMalippReaderWrapper<LimaMaliReader>
427{
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;
433 public:
434 typedef Lima::Composition LimaComposition;
435 typedef typename LimaMaliReader::SurfaceReader LimaCellGroup;
436 typedef typename LimaMaliReader::LigneReader LimaFaceGroup;
437 typedef typename LimaMaliReader::NuageReader LimaNodeGroup;
438 public:
439 LimaComposition cells()
440 {
441 return m_mali_reader->composition_polygones();
442 }
443
444 LimaComposition faces()
445 {
446 return m_mali_reader->composition_bras();
447 }
448
449 LimaComposition nodes()
450 {
451 return m_mali_reader->composition_noeuds();
452 }
453
454 std::vector<std::string> cellGroups()
455 {
456 std::vector<std::string> groups;
457 m_mali_reader->liste_surfaces(groups);
458 return groups;
459 }
460
461 LimaGroupReader<LimaMaliReader>* cellGroupReader()
462 {
463 if (!m_cell_group_reader.get())
464 m_cell_group_reader = new FaceGroupReader<LimaMaliReader>(this);
465 return m_cell_group_reader.get();
466 }
467
468 LimaGroupReader<LimaMaliReader>* nodeGroupReader()
469 {
470 if (!m_node_group_reader.get())
471 m_node_group_reader = new NodeGroupReader<LimaMaliReader>(this);
472 return m_node_group_reader.get();
473 }
474
475 LimaGroupReader<LimaMaliReader>* faceGroupReader()
476 {
477 if (!m_face_group_reader.get())
478 m_face_group_reader = new EdgeGroupReader<LimaMaliReader>(this);
479 return m_face_group_reader.get();
480 }
481
482 std::vector<std::string> faceGroups()
483 {
484 std::vector<std::string> groups;
485 m_mali_reader->liste_lignes(groups);
486 return groups;
487 }
488
489 std::vector<std::string> nodeGroups()
490 {
491 std::vector<std::string> groups;
492 m_mali_reader->liste_nuages(groups);
493 return groups;
494 }
495
496 LimaCellGroup cellGroup(const string& name)
497 {
498 return m_mali_reader->surface(name);
499 }
500
501 LimaFaceGroup faceGroup(const string& name)
502 {
503 return m_mali_reader->ligne(name);
504 }
505
506 LimaNodeGroup nodeGroup(const string& name)
507 {
508 return m_mali_reader->nuage(name);
509 }
510
511 Lima::size_type* allocateCellsBuffer(Lima::size_type buf_size)
512 {
513 return m_mali_reader->allouer_tampon_polygones(buf_size);
514 }
515 Lima::size_type readCells(Lima::size_type begin, Lima::size_type count, Lima::size_type* buffer)
516 {
517 return m_mali_reader->lire_polygones(begin, count, buffer);
518 }
519 Integer facesBufferSize(Lima::size_type buf_size)
520 {
521 // Normalement il faut utiliser m_mali_reader->allouer_tampon_bras
522 // mais seul le proc maitre peut le faire et les autres ont besoin
523 // aussi d'allouer un tampon.
524 //return m_mali_reader->allouer_tampon_bras(buf_size);
526 }
527 Lima::size_type readFaces(Lima::size_type begin, Lima::size_type count, Lima::size_type* buffer)
528 {
529 return m_mali_reader->lire_bras(begin, count, buffer);
530 }
531
532 int limaDimension()
533 {
534 return Lima::D2;
535 }
536 Integer dimension()
537 {
538 return 2;
539 }
540 const char* strDimension()
541 {
542 return "2D";
543 }
544 Real3 readNodeCoords(const double* ptr)
545 {
546 return Real3(ptr[0], ptr[1], 0.0);
547 }
548 static Integer cellToType(Integer nb_node)
549 {
550 switch (nb_node) {
551 case 3:
552 return IT_Triangle3;
553 case 4:
554 return IT_Quad4;
555 case 5:
556 return IT_Pentagon5;
557 case 6:
558 return IT_Hexagon6;
559 default:
560 break;
561 }
562 return IT_NullType;
563 }
564};
565
566/*---------------------------------------------------------------------------*/
567/*---------------------------------------------------------------------------*/
568
569template<typename LimaMaliReader>
571: public LimaMalippReaderWrapper<LimaMaliReader>
572{
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;
578 public:
579 typedef typename LimaMaliReader::VolumeReader LimaCellGroup;
580 typedef typename LimaMaliReader::SurfaceReader LimaFaceGroup;
581 typedef typename LimaMaliReader::NuageReader LimaNodeGroup;
582 typedef Lima::Composition LimaComposition;
583
584 public:
585 LimaComposition cells()
586 {
587 return m_mali_reader->composition_polyedres();
588 }
589 LimaComposition faces()
590 {
591 return m_mali_reader->composition_polygones();
592 }
593 LimaComposition nodes()
594 {
595 return m_mali_reader->composition_noeuds();
596 }
597
598 public:
599 public:
600 //typedef Lima::Volume LimaCellGroup;
601 typedef Lima::Polyedre LimaCell;
602 //typedef Lima::Surface LimaFaceGroup;
603 typedef Lima::Polygone LimaFace;
604
605 LimaGroupReader<LimaMaliReader>* cellGroupReader()
606 {
607 if (!m_cell_group_reader.get())
608 m_cell_group_reader = new CellGroupReader<LimaMaliReader>(this);
609 return m_cell_group_reader.get();
610 }
611
612 LimaGroupReader<LimaMaliReader>* faceGroupReader()
613 {
614 if (!m_face_group_reader.get())
615 m_face_group_reader = new FaceGroupReader<LimaMaliReader>(this);
616 return m_face_group_reader.get();
617 }
618
619 LimaGroupReader<LimaMaliReader>* nodeGroupReader()
620 {
621 if (!m_node_group_reader.get())
622 m_node_group_reader = new NodeGroupReader<LimaMaliReader>(this);
623 return m_node_group_reader.get();
624 }
625
626 std::vector<std::string> cellGroups()
627 {
628 std::vector<std::string> groups;
629 m_mali_reader->liste_volumes(groups);
630 return groups;
631 }
632
633 std::vector<std::string> faceGroups()
634 {
635 std::vector<std::string> groups;
636 m_mali_reader->liste_surfaces(groups);
637 return groups;
638 }
639
640 std::vector<std::string> nodeGroups()
641 {
642 std::vector<std::string> groups;
643 m_mali_reader->liste_nuages(groups);
644 return groups;
645 }
646
647 LimaCellGroup cellGroup(const string& name)
648 {
649 return m_mali_reader->volume(name);
650 }
651 LimaFaceGroup faceGroup(const string& name)
652 {
653 return m_mali_reader->surface(name);
654 }
655 LimaNodeGroup nodeGroup(const string& name)
656 {
657 return m_mali_reader->nuage(name);
658 }
659 Lima::size_type* allocateCellsBuffer(Lima::size_type buf_size)
660 {
661 return m_mali_reader->allouer_tampon_polyedres(buf_size);
662 }
663 Lima::size_type readCells(Lima::size_type begin, Lima::size_type count, Lima::size_type* buffer)
664 {
665 return m_mali_reader->lire_polyedres(begin, count, buffer);
666 }
667 Integer facesBufferSize(Lima::size_type buf_size)
668 {
669 // Normalement il faut utiliser m_mali_reader->allouer_tampon_polygone
670 // mais seul le proc maitre peut le faire et les autres ont besoin
671 // aussi d'allouer un tampon.
672 //return m_mali_reader->allouer_tampon_polygones(buf_size);
674 }
675 Lima::size_type readFaces(Lima::size_type begin, Lima::size_type count, Lima::size_type* buffer)
676 {
677 return m_mali_reader->lire_polygones(begin, count, buffer);
678 }
679
680 int limaDimension()
681 {
682 return Lima::D3;
683 }
684 Integer dimension()
685 {
686 return 3;
687 }
688 const char* strDimension()
689 {
690 return "3D";
691 }
692 Real3 readNodeCoords(const double* ptr)
693 {
694 return Real3(ptr[0], ptr[1], ptr[2]);
695 }
696 static Integer cellToType(Integer nb_node)
697 {
698 switch (nb_node) {
699 case 4:
700 return IT_Tetraedron4;
701 case 5:
702 return IT_Pyramid5;
703 case 6:
704 return IT_Pentaedron6;
705 case 8:
706 return IT_Hexaedron8;
707 case 10:
708 return IT_Heptaedron10;
709 case 12:
710 return IT_Octaedron12;
711 default:
712 break;
713 }
714 return IT_NullType;
715 }
716};
717
718/*---------------------------------------------------------------------------*/
719/*---------------------------------------------------------------------------*/
723template<typename LimaMaliReader>
725: public TraceAccessor
726{
727 public:
728 LimaMalippReader(ITraceMng* trace_mng)
729 : TraceAccessor(trace_mng) {}
730
731 public:
733 readMeshFromFile(ITimerMng* tm,IPrimaryMesh* mesh,
734 const String& file_name, Real length_multiplier);
735 private:
736};
737
738/*---------------------------------------------------------------------------*/
739/*---------------------------------------------------------------------------*/
740
741template<typename LimaMaliReader>
744 const String& filename,Real length_multiplier)
745{
746 if (filename.null() || filename.empty())
748
749 IParallelMng* pm = mesh->parallelMng();
751 bool is_master_io = pm->isMasterIO();
752 Int32 master_io_rank = pm->masterIORank();
753 Integer dimension = 0;
754 if (is_master_io) {
755 try {
756 reader = new LimaMaliReader(filename.localstr(), 1);
757 }
758 catch (const Lima::erreur& ex) {
759 ARCANE_FATAL("Impossible de lire le fichier MLI Lima <{0}> :",filename,ex.what());
760 }
761 catch (...) {
762 ARCANE_FATAL("Impossible de lire le fichier MLI Lima <{0}>",filename);
763 }
764 dimension = reader->dimension();
765 pm->broadcast(IntegerArrayView(1, &dimension), master_io_rank);
766 }
767 else
768 pm->broadcast(IntegerArrayView(1, &dimension), master_io_rank);
769 ScopedPtrT<LimaMalippMeshBase<LimaMaliReader>> lm;
770 if (dimension == Lima::D3) {
771 info() << "Maillage 3D";
772 mesh->setDimension(3);
773 lm = new LimaMalippReaderT<LimaMalipp3DReaderWrapper<LimaMaliReader>>(pm);
774 }
775 else if (dimension == Lima::D2) {
776 info() << "Maillage 2D";
777 mesh->setDimension(2);
778 lm = new LimaMalippReaderT<LimaMalipp2DReaderWrapper<LimaMaliReader>>(pm);
779 }
780 else
781 throw NotSupportedException(A_FUNCINFO, "Can not read Lima 1D mesh");
782
783 if (!lm.get()) {
784 log() << "Dimension du maillage non reconnue par lima";
786 }
787 bool ret = lm->readMeshPart(timer_mng,reader.get(), mesh, filename, length_multiplier);
788 if (ret)
790 return IMeshReader::RTOk;
791}
792
793/*---------------------------------------------------------------------------*/
794/*---------------------------------------------------------------------------*/
795
796template <typename ReaderWrapper>
797bool LimaMalippReaderT<ReaderWrapper>::
798readMeshPart(ITimerMng* timer_mng,LimaMaliReader* reader, IPrimaryMesh* mesh,
799 const String& filename, Real length_multiplier)
800{
801 return _readMeshPart(timer_mng, reader, mesh, filename, length_multiplier);
802}
803
804/*---------------------------------------------------------------------------*/
805/*---------------------------------------------------------------------------*/
811template <typename ReaderWrapper>
813_readMeshPart(ITimerMng* timer_mng, LimaMaliReader* reader, IPrimaryMesh* mesh,
815{
816 typedef Lima::size_type size_type;
817 size_type basic_step = 100000;
818
819 IParallelMng* pm = mesh->parallelMng();
820 bool is_master_io = pm->isMasterIO();
821 Integer master_rank = pm->masterIORank();
822 Int32 nb_rank = pm->commSize();
823
824 Integer nb_edge = 0;
825
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;
829
830 const char* version = Lima::lima_version();
831 info() << "Utilisation de la version " << version << " de Lima";
832
833 Timer time_to_read(timer_mng, "ReadLima", Timer::TimerReal);
834
835 this->log() << "Début lecture fichier " << file_name;
836
838 wrapper.setReader(reader);
839
840 if (reader && reader->dimension() != wrapper.limaDimension())
841 ARCANE_FATAL("Le fichier n'est pas un maillage {0}",wrapper.strDimension());
842
843 bool is_3d = (mesh->dimension() == 3);
844
845 Int64 mesh_nb_node = 0;
846 Int64 mesh_nb_cell = 0;
847 Int64 mesh_nb_face = 0;
848
849 // Le proc maitre lit le nombre d'entites et l'envoie aux autres
850 if (is_master_io) {
851 Lima::Composition lima_cells = wrapper.cells();
852 Lima::Composition lima_nodes = wrapper.nodes();
853 Lima::Composition lima_faces = wrapper.faces();
854
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;
858 Int64 nb_items[3];
859 nb_items[0] = mesh_nb_node;
860 nb_items[1] = mesh_nb_cell;
861 nb_items[2] = mesh_nb_face;
862 pm->broadcast(Int64ArrayView(3, nb_items), master_rank);
863
864 info() << "Unité de longueur du fichier: " << reader->unite_longueur();
865 if (length_multiplier == 0.0)
866 length_multiplier = 1.0;
867 else
868 length_multiplier *= reader->unite_longueur();
869 pm->broadcast(RealArrayView(1, &length_multiplier), master_rank);
870 }
871 else {
872 Int64 nb_items[3];
873 pm->broadcast(Int64ArrayView(3, nb_items), 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);
878 }
879
880 size_type lima_nb_node = (size_type)mesh_nb_node;
881 nb_edge = 0; //lima.nb_bras();
882
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.");
890 }
891
892 // Pour l'instant, laisse à false.
893 // Si true, les uid sont incrémentés pour commencer à un.
894 Int64 uid_to_add = 0;
895 if (!platform::getEnvironmentVariable("ARCANE_LIMA_UNIQUE_ID").null()) {
896 uid_to_add = 1;
897 info() << "WARNING: UniqueId begin at 1";
898 }
899
901
903 Integer own_nb_cell = 0;
904
905 // Remplit le tableau contenant les infos des mailles
906 if (is_master_io) {
907 // Tableau contenant les infos aux mailles (voir IMesh::allocateMesh())
909 cells_infos.reserve(average_nb_cell * 2);
910
911 Integer cell_step = average_nb_cell;
912 if (cell_step == 0)
913 ARCANE_FATAL("Number of cells is less than number of sub domains");
914
915 //size_type step_size = (lima_nb_cell>basic_step) ? basic_step : mesh_nb_cell;
916 size_type* buffer = wrapper.allocateCellsBuffer(cell_step + nb_rank);
918 Integer current_nb_cell = 0;
919 Integer total_count = 0;
920 Integer last_print = 0;
921 for (Integer i = 0; total_count < total_nb_cell; ++i) {
922 if (i >= nb_rank)
923 ARCANE_FATAL("Too many count reading cells i={0} nrank=",i,nb_rank);
924 Int64 wanted_count = cell_step;
925 // Le dernier sous-domaine prend toutes les mailles restantes
926 if ((i + 1) == nb_rank)
928 Integer count = CheckedConvert::toInteger(wrapper.readCells(i * cell_step, wanted_count, buffer));
929 // Afficher un pourcentage de progression (tous les 5%)
930 Integer p = (i * 20) / nb_rank;
931 if (p > last_print) {
932 last_print = p;
933 info() << "Reading cells rank=" << i << " n=" << wanted_count << " count=" << count
934 << " (" << (p * 5) << "%)";
935 }
936 current_nb_cell = count;
937 total_count += count;
938 size_type* ptr = buffer;
939 cells_infos.clear();
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)
946 throw UnknownItemTypeException("LimaMaliPP::readFile: Cell", n, cell_local_id);
947 // Stocke le type de la maille
948 cells_infos.add(ct);
949 // Stocke le numéro unique de la maille
951
952 for (Lima::size_type z = 0; z < nodeCount; ++z) {
953 Int64 node_local_id = *ptr++;
955 }
956 }
957 if (i != master_rank) {
958 Integer nb_cells_infos[2];
960 nb_cells_infos[1] = cells_infos.size();
961 pm->send(IntegerConstArrayView(2, nb_cells_infos), i);
962 pm->send(cells_infos, i);
963 }
964 else {
967 }
968 } // for (i = 0; i * stepSize < polygonNumber; i++)
969 delete[] buffer;
970 }
971 else {
972 Integer nb_cells_infos[2];
977 }
978 ItemTypeMng* itm = mesh->itemTypeMng();
979
980 info() << " READ COORDINATES 1";
981
983 // Remplit la table de hachage avec la liste des noeuds du sous-domaine
984 {
985 Integer cell_index = 0;
986 for (Integer i = 0; i < own_nb_cell; ++i) {
987 Integer type_id = (Integer)own_cells_infos[cell_index];
988 ++cell_index;
989 //Int64 cell_uid = own_cells_infos[cell_index];
990 ++cell_index;
991 ItemTypeInfo* it = itm->typeFromId(type_id);
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());
996 }
998 }
999 }
1000
1001 info() << " READ COORDINATES 2";
1002
1003 // Lecture des coordonnées
1004 if (is_master_io) {
1006 size_type nodeCount = 0;
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;) {
1012 Integer count = CheckedConvert::toInteger(reader->lire_noeuds(i, step_size, idBuffer, coordsBuffer));
1013 current_coords.clear();
1014 for (Integer n = 0; n < count; ++n, ++nodeCount) {
1015 Real3 coord;
1016 //Integer local_id = idBuffer[n] - 1;
1017 switch (dim_step) {
1018 case 1:
1019 coord.x = coordsBuffer[n];
1020 break;
1021 case 2:
1022 coord.x = coordsBuffer[2 * n];
1023 coord.y = coordsBuffer[(2 * n) + 1];
1024 break;
1025 case 3:
1026 coord.x = coordsBuffer[3 * n];
1027 coord.y = coordsBuffer[(3 * n) + 1];
1028 coord.z = coordsBuffer[(3 * n) + 2];
1029 break;
1030 }
1031 if (length_multiplier != 1.0)
1033 else
1034 current_coords.add(coord);
1035 } // for (size_type n = 0; n < count; n++, nodeCount++)
1036 Integer sizes_info[1];
1037 sizes_info[0] = count;
1038 pm->broadcast(IntegerArrayView(1, sizes_info), master_rank);
1039 //warning() << "SEND COUNT=" << count << '\n';
1040 pm->broadcast(current_coords, master_rank);
1041 this->_setCoords(current_coords, nodes_coords, i + uid_to_add);
1042 i += count;
1043 } // for (i = 0; i < nodes.nb_elements; )
1044 delete[] idBuffer;
1045 delete[] coordsBuffer;
1046 }
1047 else {
1049 for (Int64 i = 0; i < mesh_nb_node;) {
1050 Integer sizes_info[1];
1051 pm->broadcast(IntegerArrayView(1, sizes_info), master_rank);
1052 Integer count = sizes_info[0];
1053 current_coords.resize(count);
1054 //warning() << "RESIZE COUNT=" << count << " begin=" << current_coords.begin() << '\n';
1055 pm->broadcast(current_coords, master_rank);
1056 this->_setCoords(current_coords, nodes_coords, i + uid_to_add);
1057 i += count;
1058 }
1059 }
1060
1061 info() << " READ CELLS";
1062
1063 // On a la liste des mailles et les coordonnées des noeuds associés.
1064 // Vérifie que le volume de la maille est positif, sinon inverse
1065 // la topologie de la maille.
1066 // Pour l'instant, traite uniquement les IT_Hexaedron8 et les pyramides
1067 {
1068 Integer cell_index = 0;
1070 local_coords.resize(8);
1071 Integer nb_reoriented = 0;
1072 for (Integer i = 0; i < own_nb_cell; ++i) {
1073 Integer type_id = (Integer)own_cells_infos[cell_index];
1074 ++cell_index;
1075 Int64 cell_uid = own_cells_infos[cell_index];
1076 ++cell_index;
1077 ItemTypeInfo* it = itm->typeFromId(type_id);
1078 Integer current_nb_node = it->nbLocalNode();
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());
1084 if (volume < 0.0) {
1089 info() << "Volume negatif Hexaedron8 uid=" << cell_uid << " v=" << volume;
1090 ++nb_reoriented;
1091 }
1092 }
1093 else if (type_id == IT_Pyramid5) {
1094 Real volume = LimaVolume::Pyramid5Volume(local_coords.data());
1095 if (volume < 0.0) {
1098 info() << "Volume negatif Pyramid5 uid=" << cell_uid << " v=" << volume;
1099 ++nb_reoriented;
1100 }
1101 }
1102 else if (type_id == IT_Quad4) {
1103 Real surface = LimaVolume::Quad4Surface(local_coords.data());
1104 if (surface < 0.0) {
1107 info() << "Surface negative Quad4 uid=" << cell_uid << " v=" << surface;
1108 ++nb_reoriented;
1109 }
1110 }
1111 else if (type_id == IT_Triangle3) {
1112 Real surface = LimaVolume::Triangle3Surface(local_coords.data());
1113 if (surface < 0.0) {
1115 info() << "Surface negative Triangle3 uid=" << cell_uid << " v=" << surface;
1116 ++nb_reoriented;
1117 }
1118 }
1119
1121 }
1122 info() << "NB reoriented cell = " << nb_reoriented;
1123 }
1124
1125 logdate() << "Début allocation du maillage";
1127 logdate() << "Fin allocation du maillage";
1128
1129 Int32 sid = pm->commRank();
1131 for (Integer i = 0, is = cells.size(); i < is; ++i)
1132 cells[i]->setOwner(sid, sid);
1133
1134 mesh->endAllocate();
1135
1136 // Après allocation, la couche de mailles fantômes est créée.
1137 // Cependant, seules les mailles ont le propriétaire correcte.
1138 // Pour les autres entités, il faut le mettre à jour.
1139 mesh->setOwnersFromCells();
1140
1141 this->_createGroups(mesh, IK_Cell, wrapper.cellGroupReader(), 0);
1142 this->_createGroups(mesh, IK_Node, wrapper.nodeGroupReader(), 0);
1143
1144 HashTableMapT<Int64, Int32> faces_local_id(own_nb_cell * 4, true); // Numéro de la face lima dans le maillage \a mesh
1145
1146 {
1149
1152 orig_nodes_id.reserve(100);
1154 face_nodes_index.reserve(100);
1155
1157
1158 size_type face_basic_step = basic_step;
1160 UniqueArray<size_type> buffer(wrapper.facesBufferSize(step_size));
1161 size_type total_nb_face = 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;
1165 //TODO possible a paralleliser la lecture:
1166 //1. Le proc maitre lit les tableaux et les envoie a N proc (scatter)
1167 //2. Chaque proc se charge de reordonner les noeuds des faces qu'il a recu puis les renvoient a tout le monde (gather)
1168 for (size_type i = 0; (i * step_size) < total_nb_face; ++i) {
1169 Integer count = 0;
1170 if (is_master_io) {
1171 count = CheckedConvert::toInteger(wrapper.readFaces(i * step_size, step_size, buffer.data()));
1172 pm->broadcast(Int32ArrayView(1, &count), master_rank);
1173 pm->broadcast(buffer, master_rank);
1174 }
1175 else {
1176 pm->broadcast(Int32ArrayView(1, &count), master_rank);
1177 pm->broadcast(buffer, master_rank);
1178 }
1179 size_type* ptr = buffer.data();
1180 info() << " Read Face2 N=" << i << " count=" << count << " step_size=" << step_size;
1181 orig_nodes_id.clear();
1183 faces_nb_node.resize(count);
1184 faces_nodes_unique_id.clear();
1185 Integer nodeCount = 0;
1186 for (Integer p = 0; p < count; ++p) {
1187 ++ptr;
1188 if (is_3d) {
1190 }
1191 else
1192 nodeCount = 2;
1193 Integer n = nodeCount;
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) {
1199 //info() << "P=" << p << " z=" << z << " id=" << node_local_id;
1201 }
1202
1203 mesh_utils::reorderNodesOfFace2(orig_nodes_id, face_nodes_index);
1204 for (Integer z = 0; z < n; ++z)
1207 }
1208
1210 mesh->nodeFamily()->itemsUniqueIdToLocalId(faces_first_node_local_id, faces_first_node_unique_id, false);
1211
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];
1217 // Vérifie que le noeud est dans mon sous-domaine
1218 if (first_node_id != NULL_ITEM_ID) {
1220 Face face = mesh_utils::getFaceFromNodesUnique(current_node, face_nodes_id);
1221
1222 // Vérifie que la face est dans mon sous-domaine
1223 if (!face.null()) {
1226 }
1227 }
1229 }
1230 current_nb_face += count;
1231 }
1232 info() << "NB LIMA FACE IN SUB-DOMAIN =" << nb_lima_face_in_sub_domain;
1233 }
1234
1235 this->_createGroups(mesh, IK_Face, wrapper.faceGroupReader(), &faces_local_id);
1236
1237 {
1238 // Remplit la variable contenant les coordonnées des noeuds
1240 ENUMERATE_NODE (i, mesh->ownNodes()) {
1241 const Node& node = *i;
1242 nodes_coord_var[node] = nodes_coords.lookupValue(node.uniqueId().asInt64());
1243 //info() << "Coord: " << node.uniqueId() << " v=" << nodes_coord_var[node];
1244 }
1245 nodes_coord_var.synchronize();
1246 }
1247
1248 logdate() << "Fin de lecture du fichier";
1249 return false;
1250}
1251
1252/*---------------------------------------------------------------------------*/
1253/*---------------------------------------------------------------------------*/
1254
1255template <typename LimaMaliReader>
1258 Int64 current_unique_id)
1259{
1260 for (Integer i = 0, is = coords.size(); i < is; ++i) {
1261 Int64 uid = current_unique_id + i;
1263 if (d)
1264 d->value() = coords[i];
1265 }
1266}
1267
1268/*---------------------------------------------------------------------------*/
1269/*---------------------------------------------------------------------------*/
1270
1271template <typename LimaMaliReader>
1272void LimaMalippMeshBase<LimaMaliReader>::
1273_createGroups(IMesh* mesh, eItemKind item_kind, LimaGroupReader<LimaMaliReader>* lima_group_reader,
1274 HashTableMapT<Int64, Int32>* converter)
1275{
1276 IParallelMng* pm = mesh->parallelMng();
1277 Integer master_rank = pm->masterIORank();
1278 Integer is_master_io = pm->isMasterIO();
1279 //IItemFamily* item_family = mesh->itemFamily(item_kind);
1280 //ItemInternalList cells(cell_family->itemsInternal());
1281
1282 Int64UniqueArray unique_ids;
1283
1284 // Création des groupes de mailles
1285 if (is_master_io) {
1286 StringUniqueArray groups_name(lima_group_reader->groupsName());
1287 //std::vector<std::string> groups = wrapper.cellGroups();
1288 Integer nb_group = groups_name.size();
1289 Integer sizes_infos[1];
1290 sizes_infos[0] = nb_group;
1291 pm->broadcast(IntegerArrayView(1, sizes_infos), master_rank);
1292 for (Integer i = 0; i < nb_group; ++i) {
1293 //typename ReaderWrapper::LimaCellGroup group_reader = wrapper.cellGroup(groups[i]);
1294 String group_name = groups_name[i];
1295 pm->broadcastString(group_name, master_rank);
1296 //pwarning() << "Group Name <" << group_name;
1297 //wrapper.readGroup(group_reader,unique_ids);
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;
1301 pm->broadcast(IntegerArrayView(1, sizes_infos), master_rank);
1302 pm->broadcast(unique_ids, master_rank);
1303 if (converter)
1304 _createGroupFromHashTable(mesh, group_name, item_kind, unique_ids, *converter);
1305 else
1306 _createGroupFromUniqueIds(mesh, group_name, item_kind, unique_ids);
1307 }
1308 }
1309 else {
1310 Integer sizes_infos[1];
1311 pm->broadcast(IntegerArrayView(1, sizes_infos), master_rank);
1312 Integer nb_group = sizes_infos[0];
1313 for (Integer i = 0; i < nb_group; ++i) {
1314 String group_name;
1315 pm->broadcastString(group_name, master_rank);
1316 //pwarning() << "Group Name <" << group_name;
1317 pm->broadcast(IntegerArrayView(1, sizes_infos), 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);
1321 if (converter)
1322 _createGroupFromHashTable(mesh, group_name, item_kind, unique_ids, *converter);
1323 else
1324 _createGroupFromUniqueIds(mesh, group_name, item_kind, unique_ids);
1325 }
1326 }
1327}
1328
1329/*---------------------------------------------------------------------------*/
1330/*---------------------------------------------------------------------------*/
1331
1332template <typename LimaMaliReader>
1333void LimaMalippMeshBase<LimaMaliReader>::
1334_createGroupFromUniqueIds(IMesh* mesh, const String& name, eItemKind ik,
1335 Int64ConstArrayView unique_ids)
1336{
1337 Integer nb_item_in_group = unique_ids.size();
1338 Int32UniqueArray local_ids(nb_item_in_group);
1339 IItemFamily* family = mesh->itemFamily(ik);
1340 family->itemsUniqueIdToLocalId(local_ids, unique_ids, false);
1341 Int32UniqueArray group_ids;
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]);
1345 }
1346 info() << "Group Name <" << name << "> (" << nb_item_in_group << " elements)";
1347 LimaUtils::createGroup(family, name, group_ids);
1348}
1349
1350/*---------------------------------------------------------------------------*/
1351/*---------------------------------------------------------------------------*/
1352
1353template <typename LimaMaliReader>
1354void LimaMalippMeshBase<LimaMaliReader>::
1355_createGroupFromHashTable(IMesh* mesh, const String& name, eItemKind ik,
1356 Int64ConstArrayView unique_ids,
1357 const HashTableMapT<Int64, Int32>& converter)
1358{
1359 Integer nb_item_in_group = unique_ids.size();
1360 Int32UniqueArray local_ids(nb_item_in_group);
1361 IItemFamily* family = mesh->itemFamily(ik);
1362 Int32UniqueArray group_ids;
1363 for (Integer i = 0; i < nb_item_in_group; ++i) {
1364 const HashTableMapT<Int64, Int32>::Data* data = converter.lookup(unique_ids[i]);
1365 if (data)
1366 group_ids.add(data->value());
1367 }
1368 info() << "Group Name <" << name << "> (" << nb_item_in_group << " elements)";
1369 LimaUtils::createGroup(family, name, group_ids);
1370}
1371
1372/*---------------------------------------------------------------------------*/
1373/*---------------------------------------------------------------------------*/
1374
1375} // End namespace Arcane
1376
1377/*---------------------------------------------------------------------------*/
1378/*---------------------------------------------------------------------------*/
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
#define ENUMERATE_NODE(name, group)
Enumérateur générique d'un groupe de noeuds.
Tableau d'items de types quelconques.
Face d'une maille.
Definition Item.h:932
virtual NodeGroup ownNodes()=0
Groupe de tous les noeuds propres au domaine.
virtual IItemFamily * nodeFamily()=0
Retourne la famille des noeuds.
virtual Integer dimension()=0
Dimension du maillage (1D, 2D ou 3D).
eReturnType
Types des codes de retour d'une lecture ou écriture.
Definition IMeshReader.h:42
@ RTIrrelevant
Non concerné par l'opération. Cela signifie que le format de fichier ne correspond pas à ce lecteur o...
Definition IMeshReader.h:50
@ RTError
Erreur lors de l'opération.
Definition IMeshReader.h:44
@ RTOk
Opération effectuée avec succès.
Definition IMeshReader.h:43
virtual IParallelMng * parallelMng()=0
Gestionnaire de parallèlisme.
virtual ItemInternalList itemsInternal(eItemKind)=0
Tableau interne des éléments du maillage de type type.
virtual ItemTypeMng * itemTypeMng() const =0
Gestionnaire de types d'entités associé
Interface du gestionnaire de parallélisme pour un sous-domaine.
virtual ITraceMng * traceMng() const =0
Gestionnaire de traces.
virtual Int32 commRank() const =0
Rang de cette instance dans le communicateur.
virtual void recv(ArrayView< char > values, Int32 rank)=0
virtual bool isMasterIO() const =0
true si l'instance est un gestionnaire maître des entrées/sorties.
virtual Int32 commSize() const =0
Nombre d'instance dans le communicateur.
virtual Integer masterIORank() const =0
Rang de l'instance gérant les entrées/sorties (pour laquelle isMasterIO() est vrai)
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.
virtual void setOwnersFromCells()=0
Positionne les propriétaires des entités à partir du propriétaire des mailles.
virtual void endAllocate()=0
Indique une fin d'allocation de mailles.
virtual void setDimension(Integer dim)=0
Positionne la dimension du maillage (1D, 2D ou 3D).
Interface d'un gestionnaire de timer.
Definition ITimerMng.h:53
Infos sur un type d'entité du maillage.
Gestionnaire des types d'entités de maillage.
Definition ItemTypeMng.h:66
constexpr Int32 localId() const
Identifiant local de l'entité dans le sous-domaine du processeur.
Definition Item.h:210
ItemUniqueId uniqueId() const
Identifiant unique sur tous les domaines.
Definition Item.h:216
constexpr bool null() const
true si l'entité est nul (i.e. non connecté au maillage)
Definition Item.h:207
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.
bool _readMeshPart(ITimerMng *timer_mng, LimaMaliReader *reader, IPrimaryMesh *mesh, const String &filename, Real length_multiplier)
Lecture du maillage. Seul le proc maitre a une instance de reader non nulle. Les autres ne doivent pa...
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Noeud d'un maillage.
Definition Dom.h:204
Classe gérant un vecteur de réel de dimension 3.
Definition Real3.h:132
Gestion d'un timer.
Definition Timer.h:62
@ TimerReal
Timer utilisant le temps réel.
Definition Timer.h:76
Exception lorsqu'une entité du maillage n'est pas d'un type connu.
void add(ConstReferenceType val)
Ajoute l'élément val à la fin du tableau.
void clear()
Supprime les éléments du tableau.
Vue constante d'un tableau de type T.
constexpr Integer size() const noexcept
Nombre d'éléments du tableau.
Interface du gestionnaire de traces.
Chaîne de caractères unicode.
bool empty() const
Vrai si la chaîne est vide (nulle ou "")
Definition String.cc:315
const char * localstr() const
Retourne la conversion de l'instance dans l'encodage UTF-8.
Definition String.cc:227
bool null() const
Retourne true si la chaîne est nulle.
Definition String.cc:304
TraceMessage pwarning() const
TraceMessage log() const
Flot pour un message de log.
TraceMessage info() const
Flot pour un message d'information.
TraceMessage logdate() const
Flot pour un message de log précédé de la date.
Vecteur 1D de données avec sémantique par valeur (style STL).
Integer toInteger(Real r)
Converti un Int64 en un Integer.
ARCCORE_HOST_DEVICE Real matDet(Real3 u, Real3 v, Real3 w)
Déterminant de la matrice u,v,w.
Definition MathUtils.h:170
-*- 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:513
ArrayView< Integer > IntegerArrayView
Equivalent C d'un tableau à une dimension d'entiers.
Definition UtilsTypes.h:615
ArrayView< Int64 > Int64ArrayView
Equivalent C d'un tableau à une dimension d'entiers 64 bits.
Definition UtilsTypes.h:609
UniqueArray< Int32 > Int32UniqueArray
Tableau dynamique à une dimension d'entiers 32 bits.
Definition UtilsTypes.h:515
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.
UniqueArray< String > StringUniqueArray
Tableau dynamique à une dimension de chaînes de caractères.
Definition UtilsTypes.h:525
ConstArrayView< Int64 > Int64ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 64 bits.
Definition UtilsTypes.h:638
ConstArrayView< Integer > IntegerConstArrayView
Equivalent C d'un tableau à une dimension d'entiers.
Definition UtilsTypes.h:644
ArrayView< Real > RealArrayView
Equivalent C d'un tableau à une dimension de réels.
Definition UtilsTypes.h:617
ArrayView< Int32 > Int32ArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
Definition UtilsTypes.h:611
Int32 Integer
Type représentant un entier.
Real y
deuxième composante du triplet
Definition Real3.h:36
Real x
première composante du triplet
Definition Real3.h:35