21#include <NettoieNoeuds.h>
25#include <TRUSTArrays.h>
29#include <Synonyme_info.h>
30#include <RegroupeBord.h>
33#include <TRUST_2_MED.h>
36#include <MEDCouplingMemArray.hxx>
38using namespace MEDCoupling;
56Add_synonym(LireMED,
"Read_med");
57Add_synonym(LireMED_64,
"Read_med_64");
68template <
typename _SIZE_>
69void retrieve_connec(
const MEDCouplingUMesh* mesh, ArrOfInt_T<_SIZE_>& conn, ArrOfInt_T<_SIZE_>& connIndex)
71 mcIdType nb_it_init = mesh->getNodalConnectivity()->getNbOfElems(),
72 nb_it2_init = mesh->getNodalConnectivityIndex()->getNbOfElems();
74 if (nb_it_init >= std::numeric_limits<_SIZE_>::max() || nb_it2_init >= std::numeric_limits<_SIZE_>::max())
75 Process::exit(
"ERROR! You are trying to build a 32b domain with a mesh which is too big (too many elements). Use Domaine_64 / Lire_MED_64.");
77 _SIZE_ nb_it =
static_cast<_SIZE_
>(nb_it_init),
78 nb_it2=
static_cast<_SIZE_
>(nb_it2_init);
80 const mcIdType *c = mesh->getNodalConnectivity()->begin(),
81 *cI = mesh->getNodalConnectivityIndex()->begin();
82 if (std::is_same<_SIZE_, mcIdType>::value)
85 conn.
ref_data((_SIZE_ *)c, mesh->getNodalConnectivity()->getNbOfElems());
86 connIndex.
ref_data((_SIZE_ *)cI, mesh->getNodalConnectivityIndex()->getNbOfElems());
91 std::copy(c, c+nb_it, conn.
addr());
93 std::copy(cI, cI+nb_it2, connIndex.
addr());
97template <
typename _SIZE_>
98void verifier_modifier_type_elem(
Nom& type_elem,
const IntTab_T<_SIZE_>& les_elems,
const DoubleTab_T<_SIZE_>& sommets)
100 using int_t = _SIZE_;
101 Nom typ_elem_no64 = type_elem;
102 typ_elem_no64.
prefix(
"_64");
103 bool is64 = type_elem != typ_elem_no64;
105 if (typ_elem_no64==
"Rectangle" || typ_elem_no64==
"Hexaedre")
111 for (int_t elem=0; elem<les_elems.
dimension(0) && ok; elem++)
114 for (
int dir=0; dir<dimension && ok; dir++)
118 for (
int s=0; s<nb_som_elem && ok; s++)
120 double npos=sommets(les_elems(elem,s),dir);
122 for (
int i=0; i<n; i++)
123 if (est_egal(npos,pos[i])) trouve=1;
129 Cerr<<
"There is at least the element "<<elem<<
" wich seems to not possess a straight angle"<<finl;
144 if (typ_elem_no64==
"Rectangle")
145 typ_elem_no64=
"Quadrangle";
146 else if (typ_elem_no64==
"Hexaedre")
147 typ_elem_no64=
"Hexaedre_vef";
150 type_elem = typ_elem_no64 + (is64 ?
"_64" :
"");
153template <
typename _SIZE_>
154void recuperer_info_des_joints(
Noms& noms_des_joints,
const Nom& nom_fic,
const Nom& nom_dom,
155 std::vector<ArrOfInt_T<_SIZE_>>& corres_joint, ArrOfInt& tab_pe_voisin)
158 using namespace MEDCoupling;
160 Cerr <<
" Reading joint informations ... "<<finl;
161 MCAuto<MEDFileJoints> jnts(MEDFileJoints::New(nom_fic.
getChar(), nom_dom.
getChar()));
162 int njoint = jnts->getNumberOfJoints();
163 corres_joint.resize(njoint);
164 noms_des_joints.dimensionner(njoint);
167 for (
int j=0; j<njoint; j++)
170 const MEDFileJoint *jnt = jnts->getJointAtPos(j);
171 std::string jnam = jnt->getJointName(), desc = jnt->getDescription();
173 int num_dom = jnt->getDomainNumber();
174 Cerr <<
" Joint '" << jnam <<
"' - dom number: " << num_dom <<
" - '" << desc <<
"'" << finl;
175 tab_pe_voisin[j] = num_dom;
176 noms_des_joints[j] = jnam;
179 int nsteps = jnt->getNumberOfSteps();
180 if (nsteps > 1)
Process::exit(
"LireMED_32_64/ScatterMED: Multi-step joints not supported!!");
183 const MEDFileJointOneStep* jnt1 = jnt->getStepAtPos(0);
184 int nc = jnt1->getNumberOfCorrespondences();
185 if (nc <= 0)
Process::exit(
"LireMED_32_64/ScatterMED: joint with no correspondance!!");
186 Cerr<<(int)nc <<
" connecting vertices " <<finl;
188 ArrOfInt_T<_SIZE_>& corres_joint_j = corres_joint[j];
189 corres_joint_j.resize_array(nc);
191 for (
int c=0; c < nc; c++)
193 const MEDFileJointCorrespondence * corr = jnt1->getCorrespondenceAtPos(c);
194 if (!corr->getIsNodal())
196 Cerr <<
" Skipping joint - it is not nodal!" << finl;
199 const DataArrayIdType *da = corr->getCorrespondence();
201 if (da->getNumberOfTuples() != 1)
203 const mcIdType *daP = da->begin();
204 corres_joint_j[c] =
static_cast<_SIZE_
>(daP[1]);
207 Cerr <<
" Done reading joint informations ... "<<finl;
213template <
typename _SIZE_>
224template <
typename _SIZE_>
235template <
typename _SIZE_>
241template <
typename _SIZE_>
250 if (nom_dom_trio ==
"{")
258 if (motlu ==
"{") cnt++;
259 if (motlu ==
"}") cnt --;
260 s +=
Nom(
" ") + motlu;
286 Cerr <<
"ERROR: 'Read_MED': expected opening brace '{' - are you using the new syntax?" << finl;
287 Cerr <<
"If you are still using the old syntax (before TRUST v1.9.3), \nyou can use -convert_data option of your application script:" << finl;
297 Cerr<<
"Error, the MED file should have .med as extension."<<finl;
298 Cerr<<
"See the syntax of Read_MED keyword." << finl;
301 Nom nom_fic3(nom_fic2);
302 if (nom_fic3.
prefix(
"_0000") != nom_fic2 )
319template <
typename _SIZE_>
325 if (axis_type_==MEDCoupling::AX_CYL)
327 if (type_cell==INTERP_KERNEL::NORM_QUAD4)
331 Cerr<<
"WARNING, Cylindrical MED coordinates detected - we will use 'axi' keyword."<<finl;
337 Cerr <<
"Strange error with MED file - should never happen!? MED file with axis type AX_CYL contains elements other than NORM_QUAD4."<< finl;
341 if (axis_type_==MEDCoupling::AX_SPHER)
343 Cerr <<
"Spherical coordinates read in the MED file - this is unsupported in TRUST!" << finl;
350 if (type_cell==INTERP_KERNEL::NORM_QUAD4)
351 type_elem = cell_from_boundary ?
"QUADRANGLE_3D" : (isVEFForce_ ?
"Quadrangle" :
"Rectangle");
352 else if (type_cell==INTERP_KERNEL::NORM_HEXA8)
353 type_elem=(isVEFForce_ ?
"Hexaedre_vef" :
"Hexaedre");
354 else if (type_cell==INTERP_KERNEL::NORM_TRI3)
355 type_elem= cell_from_boundary ?
"TRIANGLE_3D" :
"Triangle";
356 else if (type_cell==INTERP_KERNEL::NORM_TETRA4)
357 type_elem=
"Tetraedre";
358 else if (type_cell==INTERP_KERNEL::NORM_SEG2)
359 type_elem= cell_from_boundary ?
"SEGMENT_2D" :
"Segment";
360 else if (type_cell==INTERP_KERNEL::NORM_PENTA6)
362 else if (type_cell==INTERP_KERNEL::NORM_POLYHED)
363 type_elem=
"Polyedre";
364 else if (type_cell==INTERP_KERNEL::NORM_PYRA5)
365 type_elem=
"Pyramide";
366 else if (type_cell==INTERP_KERNEL::NORM_POLYGON)
367 type_elem= cell_from_boundary ?
"POLYGONE_3D" :
"Polygone";
368 else if(type_cell==INTERP_KERNEL::NORM_HEXGP12)
369 type_elem =
"Prisme_hexag";
370 else if(type_cell==INTERP_KERNEL::NORM_POINT1)
371 type_elem = cell_from_boundary ?
"POINT_1D" :
"Point_1d";
374 Cerr<<
"Cell type " << type_cell<<
" is not supported yet." <<finl;
377 if(
Objet_U::bidim_axi && !(type_cell == INTERP_KERNEL::NORM_QUAD4 || type_cell == INTERP_KERNEL::NORM_SEG2 || type_cell == INTERP_KERNEL::NORM_POLYGON))
379 Cerr<<
"Cell type " << type_cell<<
" is not supported for 'bidim_axi' mode." <<finl;
382 if (
Objet_U::axi && !(type_cell == INTERP_KERNEL::NORM_HEXA8 || type_cell == INTERP_KERNEL::NORM_QUAD4))
384 Cerr<<
"Cell type " << type_cell<<
" is not supported for 'axi' mode." <<finl;
387 if (axi1d_ && !(type_cell == INTERP_KERNEL::NORM_SEG2 || type_cell == INTERP_KERNEL::NORM_POINT1))
389 Cerr<<
"Cell type " << type_cell<<
" is not supported for 'axi1d' mode." <<finl;
393 type_elem =
"Rectangle_2D_axi";
395 type_elem =
"quadrilatere_2D_axi";
410template <
typename _SIZE_>
413 std::string fileName = nom_fichier_.
getString();
414 std::string meshName = nom_mesh_.getString();
418 std::vector< std::string > meshes_names = MEDCoupling::GetMeshNames(fileName) ;
419 if (std::find(meshes_names.begin(), meshes_names.end(), meshName) == meshes_names.end())
421 if (meshName ==
"--any--" && meshes_names.size()==1) meshName = meshes_names[0];
424 if (meshName ==
"--any--")
425 Cerr <<
"You need to specify the mesh name for the med file " << nom_fichier_ <<
" !" << finl;
427 Cerr <<
"Mesh " << nom_mesh_ <<
" not found in the med file " << nom_fichier_ <<
" !" << finl;
428 Cerr <<
"List of meshes found:" << finl;
429 for(
unsigned int i = 0; i<meshes_names.size(); i++)
430 Cerr << meshes_names[i] << finl;
435 mfumesh_ = MEDFileUMesh::New(fileName, meshName);
437 mfumesh_->setName( this->domaine().le_nom().getChar());
439 axis_type_ = mfumesh_->getAxisType();
441 std::vector<int> nel = mfumesh_->getNonEmptyLevels();
444 mcumesh_ = mfumesh_->getMeshAtLevel(nel[0]);
445 space_dim_ = mcumesh_->getSpaceDimension();
446 Cerr <<
"Detecting a " << (int)mcumesh_->getMeshDimension() <<
"D mesh in " << space_dim_ <<
"D space." << finl;
449 Cerr <<
"The mesh space dimension may be higher than the computation space dimension" << finl;
450 Cerr <<
"as the algorithm will try to detect the useless direction in the mesh." << finl;
455 if (convertAllToPoly_)
457 Cerr <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << finl;
458 Cerr <<
"Conversion to polyedrons and polygons..." << finl;
459 Cerr <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << finl;
460 mcumesh_->convertAllToPoly();
470template <
typename _SIZE_>
477 mcIdType nnodes0 = mcumesh_->getNumberOfNodes();
478 if (nnodes0 >= std::numeric_limits<_SIZE_>::max())
479 Process::exit(
"ERROR! You are trying to build a 32b domain with a mesh which is too big (too many nodes). Use Domaine_64.");
480 int_t nnodes =
static_cast<int_t
>(nnodes0);
482 const double *coord = mcumesh_->getCoords()->begin();
483 Cerr <<
"Detecting " << nnodes <<
" nodes." << finl;
484 sommets2.resize(nnodes, space_dim_);
485 std::copy(coord, coord+sommets2.size_array(), sommets2.addr());
488 mcIdType ncells0 = mcumesh_->getNumberOfCells();
489 if (ncells0 >= std::numeric_limits<_SIZE_>::max())
490 Process::exit(
"ERROR! You are trying to build a 32b domain with a mesh which is too big (too many elements). Use Domaine_64.");
491 int_t ncells =
static_cast<int_t
>(ncells0);
494 ArrOfInt_t conn, connIndex;
495 ::retrieve_connec(mcumesh_, conn, connIndex);
497 int mesh_type_cell =
static_cast<int>(conn[connIndex[0]]);
498 Nom type_elem_n = type_medcoupling_to_type_geo_trio(mesh_type_cell,
false);
499 if (!std::is_same<_SIZE_,int>::value)
500 type_elem_n +=
"_64";
501 type_elem_.typer(type_elem_n);
502 auto set_of_typs = mcumesh_->getAllGeoTypes();
503 if (set_of_typs.size() > 1)
505 Cerr <<
"Elements of kind " << type_elem_n <<
" have already been read" << finl;
506 Cerr <<
"New elements type(s) found!!" << finl;
507 if (!convertAllToPoly_)
509 Cerr <<
"TRUST does not support different element types for the mesh." << finl;
510 Cerr <<
"Either you remesh your domain with a single element type," << finl;
511 Cerr <<
"or convert your cells to polyedrons and polygons by inserting an option in your command line:" << finl;
512 Cerr <<
" Read_MED { ... convertAllToPoly ... } " << finl;
513 Cerr <<
"After that, you should use a discretization supporting polyedrons!" << finl;
519 if (sub_type(Polyedre_t, type_elem_.valeur()))
522 int_t conn_size =
static_cast<int_t
>(mcumesh_->getNodalConnectivity()->getNbOfElems());
523 for (int_t i = 0; i < conn_size; i++)
524 if (conn[i]<0) marker++;
525 int_t num_nodes = conn_size - ncells - marker;
526 int_t nfaces = ncells + marker;
527 ArrOfInt_t nodes(num_nodes), facesIndex(nfaces+1), polyhedronIndex(ncells+1);
528 int_t face=0, node = 0;
529 for (int_t i = 0; i < ncells; i++)
531 polyhedronIndex[i] = face;
533 int_t index = connIndex[i] + 1;
534 int nb_som =
static_cast<int>(connIndex[i + 1] - index);
535 for (
int j = 0; j < nb_som; j++)
537 if (j==0 || conn[index + j]<0)
538 facesIndex[face++] = node;
539 if (conn[index + j]>=0)
540 nodes[node++] = conn[index + j];
543 facesIndex[nfaces] = node;
544 polyhedronIndex[ncells] = face;
545 ref_cast(Polyedre_t,type_elem_.valeur()).affecte_connectivite_numero_global(nodes, facesIndex, polyhedronIndex, les_elems2);
547 else if (sub_type(Polygone_t, type_elem_.valeur()))
549 int_t conn_size =
static_cast<int_t
>(mcumesh_->getNodalConnectivity()->getNbOfElems());
550 int_t facesIndexSize = conn_size - ncells;
551 ArrOfInt_t facesIndex(facesIndexSize), polygonIndex(ncells+1);
553 for (int_t i = 0; i < ncells; i++)
555 polygonIndex[i] = face;
557 int_t index = connIndex[i] + 1;
558 int nb_som =
static_cast<int>(connIndex[i + 1] - index);
559 for (
int j = 0; j < nb_som; j++)
560 facesIndex[face++] = conn[index + j];
562 polygonIndex[ncells] = face;
563 ref_cast(Polygone_t,type_elem_.valeur()).affecte_connectivite_numero_global(facesIndex, polygonIndex, les_elems2);
567 for (int_t i = 0; i < ncells; i++)
569 int_t index = connIndex[i] + 1;
570 int nb_som =
static_cast<int>(connIndex[i + 1] - index);
571 if (i==0) les_elems2.resize(ncells, nb_som);
572 for (
int j = 0; j < nb_som; j++)
573 les_elems2(i, j) = conn[index + j];
583template <
typename _SIZE_>
597 double val1=sommets2(0,dir);
598 for (
int_t i=0; i<nbsom; i++)
599 if (std::abs(val1-sommets2(i,dir))>epsilon)
602 Cerr<<val1 <<
" "<<sommets2(i,dir)<<finl;
613 Cerr<<
"No useless direction "<<finl;
616 Cerr<<
"useless direction "<<dirinut<<finl<<finl;
623 for (
int_t i=0; i<nbsom; i++)
624 sommets(i,d)=sommets2(i,dir);
634template <
typename _SIZE_>
639 unsigned nb_volume_groups = (unsigned)mfumesh_->getGroupsOnSpecifiedLev(0).
size();
643 SFichier jdd_seq(nom_dom_trio +
"_ssz.geo");
644 SFichier jdd_par(nom_dom_trio +
"_ssz_par.geo");
645 std::vector<std::string> groups;
649 groups.push_back(name.getString());
653 Cerr <<
"Reading groups at level 0:" << finl;
654 groups = mfumesh_->getGroupsOnSpecifiedLev(0);
657 for (
const auto& gnam: groups)
659 MCAuto<DataArrayIdType> ids(mfumesh_->getGroupArr(0, gnam,
false));
660 const mcIdType *idP = ids->getConstPointer();
661 mcIdType nb_elems0 = ids->getNbOfElems();
662 if (nb_elems0 >= std::numeric_limits<_SIZE_>::max())
663 Process::exit(
"ERROR! You are trying to build a 32b domain with a mesh which is too big (too many nodes). Use Domaine_64.");
664 mcIdType nb_elems =
static_cast<int_t>(nb_elems0);
666 const Nom& nom_sous_domaine = gnam;
667 Cerr <<
"Detecting a sub-zone (group name="<< nom_sous_domaine <<
") with " << nb_elems <<
" cells." << finl;
669 if (nb_elems == 0)
continue;
671 Nom file_ssz(nom_dom_trio);
673 file_ssz += nom_sous_domaine;
674 file_ssz +=
Nom(
".file");
675 jdd_seq <<
"export Sous_Domaine " << nom_sous_domaine << finl;
676 jdd_par <<
"export Sous_Domaine " << nom_sous_domaine << finl;
678 jdd_seq <<
"Associer " << nom_sous_domaine <<
" " << nom_dom_trio << finl;
679 jdd_par <<
"Associer " << nom_sous_domaine <<
" " << nom_dom_trio << finl;
683 jdd_seq <<
"Lire " << nom_sous_domaine <<
" { liste " << nb_elems;
684 for (
int_t j = 0; j < nb_elems; j++) jdd_seq <<
" " << (
int) idP[j];
685 jdd_seq <<
" }" << finl;
689 jdd_seq <<
"Lire " << nom_sous_domaine <<
" { fichier " << file_ssz <<
" }" << finl;
690 jdd_par <<
"Lire " << nom_sous_domaine <<
" { fichier " << nom_sous_domaine <<
".ssz" <<
" }" << finl;
692 f_ssz << nb_elems << finl;
693 for (
int_t j = 0; j < nb_elems; j++)
694 f_ssz << (
int) idP[j] <<
" ";
706template <
typename _SIZE_>
711 constexpr bool CELL_FROM_BOUNDARY =
true;
714 MCAuto<MEDCouplingUMesh> face_mesh(mfumesh_->getMeshAtLevel(-1));
716 face_mesh->convertAllToPoly();
717 int_t nfaces =
static_cast<int_t>(face_mesh->getNumberOfCells());
721 ::retrieve_connec(face_mesh, conn, connIndex);
722 DataArrayIdType *cI = face_mesh->getNodalConnectivityIndex();
725 int typ =
static_cast<int>(conn[connIndex[0]]);
728 Process::exit(
"Read_MED: unsupported mesh element type! It has more than a single face type (for example a prism can have triangles or quadrangles as boundary faces).");
730 auto set_of_typs = face_mesh->getAllGeoTypes();
731 if (set_of_typs.size() > 1)
732 Process::exit(
"Read_MED: invalid boundary mesh! More than a single face type.");
737 MCAuto<DataArrayIdType> dsi = cI->deltaShiftIndex();
738 max_som_face =
static_cast<int>(dsi->getMaxValueInArray() - 1);
742 Cerr <<
"Detecting " << nfaces <<
" faces (" <<
type_face_ <<
")." << finl;
743 all_faces_bords.
resize(nfaces, max_som_face);
744 all_faces_bords = -1;
746 for (
int_t i = 0; i < nfaces; i++)
748 int_t index = connIndex[i] + 1;
749 int nb_som =
static_cast<int>(connIndex[i + 1] - index);
750 for (
int j = 0; j < nb_som; j++)
751 all_faces_bords(i, j) = conn[index + j] ;
754 Cerr <<
"Reading groups at level -1:" << finl;
755 auto grp_names = mfumesh_->getGroupsOnSpecifiedLev(-1);
757 std::set<mcIdType> id_check;
758 for (
const auto& gnam: grp_names)
762 Cerr <<
" group '" << gnam <<
"' is skipped, as requested." << finl;
766 MCAuto<DataArrayIdType> ids(mfumesh_->getGroupArr(-1, gnam,
false));
767 long bef = (long)id_check.size(), nb_faces = (long)ids->getNumberOfTuples();
768 id_check.insert(ids->begin(), ids->begin()+nb_faces);
769 if ((
long)id_check.size() - bef < nb_faces)
771 Cerr <<
"ERROR: group '" << gnam <<
"' contains faces which are also in one of the previously read groups." << finl;
772 Cerr <<
" Fix your mesh, or use the 'exclude_groups' option to prevent reading of this group." << finl;
775 Cerr <<
" group_name=" << gnam <<
" with " << nb_faces <<
" faces" << finl;
776 for(
const auto&
id: *ids)
779 fac_grp_id[id2] = zeid+1;
786 Cerr <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << finl;
787 Cerr <<
"Lire_MED: Warning: no boundary detected for the mesh." << finl;
788 Cerr <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << finl;
795template <
typename _SIZE_>
798 using SmallArrOfTID_t = SmallArrOfTID_T<_SIZE_>;
812 std::vector<ArrOfInt_t> sommets_joints;
813 ArrOfInt tab_pe_voisin;
816 SmallArrOfTID_t nb_face_per_bord(nbord);
822 faces_raccord.vide();
826 Noms noms_des_joints;
830 for (
int ib=nbord-1; ib>-1; ib--)
832 int indice_bord=ib+1;
835 Groupe_Faces_t facesgrpprov;
838 bool israccord=
false, isjoint=
false, isfacesint=
false;
843 raccprov.typer(
"Raccord_local_homogene");
851 Cerr<<
noms_bords_[ib]<<
" is considered as a joint "<<finl;
855 Frontiere_t& bordprov = (isjoint?jointprov:(israccord?ref_cast(Frontiere_t,raccprov.valeur()):(isfacesint?ref_cast(Frontiere_t,facesgrpprov):ref_cast(Frontiere_t,bordprov_))));
859 int_t nb_face_this_bord=0;
861 IntTab_t sommprov(nfacebord,nsomfa);
862 for (
int_t j=0; j<nfacebord; j++)
864 if (fac_grp_id[j]==indice_bord)
866 for (
int k=0; k<nsomfa; k++)
867 sommprov(nb_face_this_bord,k)=all_faces_bords(j,k);
871 Faces_t& facesi=bordprov.faces();
872 IntTab_t& sommetsfaces=facesi.les_sommets();
873 sommetsfaces.
resize(nb_face_this_bord,nsomfa);
874 for (
int_t jj=0; jj<nb_face_this_bord; jj++)
875 for (
int k=0; k<nsomfa; k++)
876 sommetsfaces(jj,k)=sommprov(jj,k);
878 facesv.
resize(nb_face_this_bord,2);
881 bool vide_0D_a_ecrire=
false;
882 if (nb_face_this_bord == 0)
884 bordprov.typer_faces(
"vide_0D");
885 vide_0D_a_ecrire =
true;
887 nb_face_per_bord[ib] = nb_face_this_bord;
890 && (nb_face_this_bord>0 || vide_0D_a_ecrire))
894 int PE_voisin=tab_pe_voisin[numero_joint];
896 ArrOfInt_t& sommets_joint=sommets_joints[numero_joint];
897 jointprov.affecte_PEvoisin(PE_voisin);
898 jointprov.affecte_epaisseur(epaisseur);
899 ArrOfInt_t& sommets_du_joint=jointprov.set_joint_item(JOINT_ITEM::SOMMET).set_items_communs();
900 sommets_du_joint=sommets_joint;
901 faces_joint.add(jointprov);
904 faces_raccord.add(raccprov);
906 goupes_faces.add(facesgrpprov);
908 faces_bord.add(bordprov_);
911 faces_bord.associer_domaine(dom);
912 faces_raccord.associer_domaine(dom);
913 faces_joint.associer_domaine(dom);
914 goupes_faces.associer_domaine(dom);
917 for (
int fr=0; fr<nbfr; fr++)
925template <
typename _SIZE_>
939 Cerr <<
"Dimension is not defined. Check your data file." << finl;
942 Cerr <<
"Trying to read the mesh " <<
nom_mesh_ <<
" from the file " <<
nom_fichier_ <<
" in order to affect to domain "
943 << nom_dom_trio <<
"..." << finl;
959 std::vector<int> nel = mfumesh_->getNonEmptyLevels();
962 assert(nel[1] == -1);
968 conn_trust_to_med(les_elems2,type_elem_n,
false);
969 conn_trust_to_med(all_faces_bords,
type_face_,
false);
978 Nom type_elem_orig = type_elem_n;
979 verifier_modifier_type_elem(type_elem_n,les_elems2,sommets);
983 if (type_elem_orig != type_elem_n)
984 dom.
typer(type_elem_n);
985 dom.type_elem()->associer_domaine(dom);
992 if (type_elem_n ==
"Rectangle" || type_elem_n ==
"Hexaedre" || type_elem_n ==
"Rectangle_64" || type_elem_n ==
"Hexaedre_64"
998 Cerr <<
" Lire_MED called in sequential => applying NettoieNoeuds" << finl;
1007 Cerr<<
"Reading of the MED domain ended."<<finl;
Class Bord This class represents a boundary of a domain, it is a type of frontier.
Class Bords This class represents a list of objects of type Bord.
DoubleTab_t & les_sommets()
void set_mc_mesh_ready(bool flag) const
const Frontiere_t & frontiere(int i) const
Raccords_t & faces_raccord()
void fixer_premieres_faces_frontiere()
void typer(const Nom &)
Sets the element type of the domain using the name passed as parameter.
Groupes_Faces_t & groupes_faces()
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
An input stream whose source is a character string.
Class defining operators and methods for all reading operation in an input flow (file,...
Class Faces Faces describes a set of faces by their type (point, segment, triangle or quadrangle),...
void associer_domaine(const Domaine_t &z)
void reordonner()
Reorders the faces.
Type_Face type_face() const
const Faces_t & faces() const
Groupe_Face class — represents a selection of faces read from a med file.
Groupes_Faces class — represents a list of Groupe_Faces objects.
Class Interprete_geometrique_base.
void associer_domaine(Nom &nom_dom)
Domaine_t & domaine(int i=0)
The Joint class is a Frontiere that contains the joint faces and vertices with the neighboring domain...
Joints class — represents a list of Joint objects.
void lire_geom(bool subDom=true)
Nom nom_fichier_
Name of the MED file to read.
Nom nom_mesh_
Name of the mesh in the MED file to read.
void fill_frontieres(const BigArrOfInt_ &familles, const IntTab_t &all_faces_bords)
Fills in all the information relative to Joints, Raccords and Frontiere.
Noms restrict_ssz_
Names of the subzones to keep only in the .geo file.
void finalize_sommets(const DoubleTab_t &sommets2, DoubleTab_t &sommets) const
Returns the TRUST element type corresponding to the given MEDCoupling type: http://docs....
void read_boundaries(BigArrOfInt_ &familles, IntTab_t &all_faces_bords)
Handles the boundaries found in the MED file.
Entree & interpreter_(Entree &) override
Nom type_medcoupling_to_type_geo_trio(int type_cell, bool cell_from_boundary) const
Elem_geom_t type_elem_
Highest dimension element type.
Nom type_face_
Boundary element type.
Domaine_32_64< _SIZE_ > Domaine_t
TRUSTArray< int, _SIZE_ > BigArrOfInt_
void write_sub_dom_datasets() const
int space_dim_
Space dimension read in the MED file.
ArrOfInt_T< _SIZE_ > ArrOfInt_t
IntTab_T< _SIZE_ > IntTab_t
void prepare_som_and_elem(DoubleTab_t &sommets, IntTab_t &les_elems)
LireMED_32_64(const Nom &file_name, const Nom &mesh_name)
Noms noms_bords_
Names of the boundaries.
Noms exclude_grps_
Names of the (face) groups to skip when reading the file.
bool axi1d_
Are we in Axi1D.
void retrieve_MC_objects()
DoubleTab_T< _SIZE_ > DoubleTab_t
bool convertAllToPoly_
Should the mesh be converted to polygons/polyedrons.
Noms internal_face_grps_
Names of the internals face groups to read in the file.
static void nettoie(Domaine_t &)
class Nom: a character string for naming TRUST objects.
const char * getChar() const
Nom nom_me(int, const char *prefix=0, int without_padding=0) const
Inserts _prefix000n (n=me() or nproc()) into a file name (e.g. toto.titi) to produce toto_prefix000n....
Nom & prefix(const char *const)
const std::string & getString() const
An array of character strings (VECT(Nom)).
int search(const Nom &t) const
const Nom & que_suis_je() const
Returns the string identifying the class.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
static double precision_geom
static const Nom & nom_du_cas()
Returns a constant reference to the case name. This method is static.
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Helper class to factorize the readOn method of Objet_U classes.
void ajouter_flag(const char *keyword, const bool *value)
Register a boolean flag whose mere presence switches it to true.
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
int lire_avec_accolades(Entree &is)
Alias of lire_avec_accolades_depuis.
Class Polyedre: represents the Polyedre geometric element.
Class Polygone represents the geometric element Polygone.
static int nproc()
Returns the number of processors in the current group. See Comm_Group::nproc() and PE_Groups::current...
static int me()
Returns the rank of the local processor in the current communication group. See Comm_Group::rank() an...
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
Class Raccord_base This class is simply a boundary; it is the base class of the.
Class Raccords This represents a list of Raccord type objects.
SFichier is to the C++ ofstream class what Sortie is to the C++ ostream class.
static void init_sequential_domain(Domaine_32_64< _SIZE_ > &dom)
Create parallel descriptors for the vertex and element arrays of the domain (necessary because Scatte...
static void uninit_sequential_domain(Domaine_32_64< _SIZE_ > &dom)
Method used by interpreters that modify the domain (sequential), destroys the descriptors of vertices...
Base class for output streams.
void resize_array(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
void resize(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
virtual void ref_data(_TYPE_ *ptr, _SIZE_ size)
int dimension_int(int d) const
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ dimension(int d) const