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 )
318template <
typename _SIZE_>
324 if (axis_type_==MEDCoupling::AX_CYL)
326 if (type_cell==INTERP_KERNEL::NORM_QUAD4)
330 Cerr<<
"WARNING, Cylindrical MED coordinates detected - we will use 'axi' keyword."<<finl;
336 Cerr <<
"Strange error with MED file - should never happen!? MED file with axis type AX_CYL contains elements other than NORM_QUAD4."<< finl;
340 if (axis_type_==MEDCoupling::AX_SPHER)
342 Cerr <<
"Spherical coordinates read in the MED file - this is unsupported in TRUST!" << finl;
349 if (type_cell==INTERP_KERNEL::NORM_QUAD4)
350 type_elem = cell_from_boundary ?
"QUADRANGLE_3D" : (isVEFForce_ ?
"Quadrangle" :
"Rectangle");
351 else if (type_cell==INTERP_KERNEL::NORM_HEXA8)
352 type_elem=(isVEFForce_ ?
"Hexaedre_vef" :
"Hexaedre");
353 else if (type_cell==INTERP_KERNEL::NORM_TRI3)
354 type_elem= cell_from_boundary ?
"TRIANGLE_3D" :
"Triangle";
355 else if (type_cell==INTERP_KERNEL::NORM_TETRA4)
356 type_elem=
"Tetraedre";
357 else if (type_cell==INTERP_KERNEL::NORM_SEG2)
358 type_elem= cell_from_boundary ?
"SEGMENT_2D" :
"Segment";
359 else if (type_cell==INTERP_KERNEL::NORM_PENTA6)
361 else if (type_cell==INTERP_KERNEL::NORM_POLYHED)
362 type_elem=
"Polyedre";
363 else if (type_cell==INTERP_KERNEL::NORM_PYRA5)
364 type_elem=
"Pyramide";
365 else if (type_cell==INTERP_KERNEL::NORM_POLYGON)
366 type_elem= cell_from_boundary ?
"POLYGONE_3D" :
"Polygone";
367 else if(type_cell==INTERP_KERNEL::NORM_HEXGP12)
368 type_elem =
"Prisme_hexag";
369 else if(type_cell==INTERP_KERNEL::NORM_POINT1)
370 type_elem = cell_from_boundary ?
"POINT_1D" :
"Point_1d";
373 Cerr<<
"Cell type " << type_cell<<
" is not supported yet." <<finl;
376 if(
Objet_U::bidim_axi && !(type_cell == INTERP_KERNEL::NORM_QUAD4 || type_cell == INTERP_KERNEL::NORM_SEG2 || type_cell == INTERP_KERNEL::NORM_POLYGON))
378 Cerr<<
"Cell type " << type_cell<<
" is not supported for 'bidim_axi' mode." <<finl;
381 if (
Objet_U::axi && !(type_cell == INTERP_KERNEL::NORM_HEXA8 || type_cell == INTERP_KERNEL::NORM_QUAD4))
383 Cerr<<
"Cell type " << type_cell<<
" is not supported for 'axi' mode." <<finl;
386 if (axi1d_ && !(type_cell == INTERP_KERNEL::NORM_SEG2 || type_cell == INTERP_KERNEL::NORM_POINT1))
388 Cerr<<
"Cell type " << type_cell<<
" is not supported for 'axi1d' mode." <<finl;
392 type_elem =
"Rectangle_2D_axi";
394 type_elem =
"quadrilatere_2D_axi";
409template <
typename _SIZE_>
412 std::string fileName = nom_fichier_.
getString();
413 std::string meshName = nom_mesh_.getString();
417 std::vector< std::string > meshes_names = MEDCoupling::GetMeshNames(fileName) ;
418 if (std::find(meshes_names.begin(), meshes_names.end(), meshName) == meshes_names.end())
420 if (meshName ==
"--any--" && meshes_names.size()==1) meshName = meshes_names[0];
423 if (meshName ==
"--any--")
424 Cerr <<
"You need to specify the mesh name for the med file " << nom_fichier_ <<
" !" << finl;
426 Cerr <<
"Mesh " << nom_mesh_ <<
" not found in the med file " << nom_fichier_ <<
" !" << finl;
427 Cerr <<
"List of meshes found:" << finl;
428 for(
unsigned int i = 0; i<meshes_names.size(); i++)
429 Cerr << meshes_names[i] << finl;
434 mfumesh_ = MEDFileUMesh::New(fileName, meshName);
436 mfumesh_->setName( this->domaine().le_nom().getChar());
438 axis_type_ = mfumesh_->getAxisType();
440 std::vector<int> nel = mfumesh_->getNonEmptyLevels();
443 mcumesh_ = mfumesh_->getMeshAtLevel(nel[0]);
444 space_dim_ = mcumesh_->getSpaceDimension();
445 Cerr <<
"Detecting a " << (int)mcumesh_->getMeshDimension() <<
"D mesh in " << space_dim_ <<
"D space." << finl;
448 Cerr <<
"The mesh space dimension may be higher than the computation space dimension" << finl;
449 Cerr <<
"as the algorithm will try to detect the useless direction in the mesh." << finl;
454 if (convertAllToPoly_)
456 Cerr <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << finl;
457 Cerr <<
"Conversion to polyedrons and polygons..." << finl;
458 Cerr <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << finl;
459 mcumesh_->convertAllToPoly();
469template <
typename _SIZE_>
476 mcIdType nnodes0 = mcumesh_->getNumberOfNodes();
477 if (nnodes0 >= std::numeric_limits<_SIZE_>::max())
478 Process::exit(
"ERROR! You are trying to build a 32b domain with a mesh which is too big (too many nodes). Use Domaine_64.");
479 int_t nnodes =
static_cast<int_t
>(nnodes0);
481 const double *coord = mcumesh_->getCoords()->begin();
482 Cerr <<
"Detecting " << nnodes <<
" nodes." << finl;
483 sommets2.resize(nnodes, space_dim_);
484 std::copy(coord, coord+sommets2.size_array(), sommets2.addr());
487 mcIdType ncells0 = mcumesh_->getNumberOfCells();
488 if (ncells0 >= std::numeric_limits<_SIZE_>::max())
489 Process::exit(
"ERROR! You are trying to build a 32b domain with a mesh which is too big (too many elements). Use Domaine_64.");
490 int_t ncells =
static_cast<int_t
>(ncells0);
493 ArrOfInt_t conn, connIndex;
494 ::retrieve_connec(mcumesh_, conn, connIndex);
496 int mesh_type_cell =
static_cast<int>(conn[connIndex[0]]);
497 Nom type_elem_n = type_medcoupling_to_type_geo_trio(mesh_type_cell,
false);
498 if (!std::is_same<_SIZE_,int>::value)
499 type_elem_n +=
"_64";
500 type_elem_.typer(type_elem_n);
501 auto set_of_typs = mcumesh_->getAllGeoTypes();
502 if (set_of_typs.size() > 1)
504 Cerr <<
"Elements of kind " << type_elem_n <<
" have already been read" << finl;
505 Cerr <<
"New elements type(s) found!!" << finl;
506 if (!convertAllToPoly_)
508 Cerr <<
"TRUST does not support different element types for the mesh." << finl;
509 Cerr <<
"Either you remesh your domain with a single element type," << finl;
510 Cerr <<
"or convert your cells to polyedrons and polygons by inserting an option in your command line:" << finl;
511 Cerr <<
" Read_MED { ... convertAllToPoly ... } " << finl;
512 Cerr <<
"After that, you should use a discretization supporting polyedrons!" << finl;
518 if (sub_type(Polyedre_t, type_elem_.valeur()))
521 int_t conn_size =
static_cast<int_t
>(mcumesh_->getNodalConnectivity()->getNbOfElems());
522 for (int_t i = 0; i < conn_size; i++)
523 if (conn[i]<0) marker++;
524 int_t num_nodes = conn_size - ncells - marker;
525 int_t nfaces = ncells + marker;
526 ArrOfInt_t nodes(num_nodes), facesIndex(nfaces+1), polyhedronIndex(ncells+1);
527 int_t face=0, node = 0;
528 for (int_t i = 0; i < ncells; i++)
530 polyhedronIndex[i] = face;
532 int_t index = connIndex[i] + 1;
533 int nb_som =
static_cast<int>(connIndex[i + 1] - index);
534 for (
int j = 0; j < nb_som; j++)
536 if (j==0 || conn[index + j]<0)
537 facesIndex[face++] = node;
538 if (conn[index + j]>=0)
539 nodes[node++] = conn[index + j];
542 facesIndex[nfaces] = node;
543 polyhedronIndex[ncells] = face;
544 ref_cast(Polyedre_t,type_elem_.valeur()).affecte_connectivite_numero_global(nodes, facesIndex, polyhedronIndex, les_elems2);
546 else if (sub_type(Polygone_t, type_elem_.valeur()))
548 int_t conn_size =
static_cast<int_t
>(mcumesh_->getNodalConnectivity()->getNbOfElems());
549 int_t facesIndexSize = conn_size - ncells;
550 ArrOfInt_t facesIndex(facesIndexSize), polygonIndex(ncells+1);
552 for (int_t i = 0; i < ncells; i++)
554 polygonIndex[i] = face;
556 int_t index = connIndex[i] + 1;
557 int nb_som =
static_cast<int>(connIndex[i + 1] - index);
558 for (
int j = 0; j < nb_som; j++)
559 facesIndex[face++] = conn[index + j];
561 polygonIndex[ncells] = face;
562 ref_cast(Polygone_t,type_elem_.valeur()).affecte_connectivite_numero_global(facesIndex, polygonIndex, les_elems2);
566 for (int_t i = 0; i < ncells; i++)
568 int_t index = connIndex[i] + 1;
569 int nb_som =
static_cast<int>(connIndex[i + 1] - index);
570 if (i==0) les_elems2.resize(ncells, nb_som);
571 for (
int j = 0; j < nb_som; j++)
572 les_elems2(i, j) = conn[index + j];
582template <
typename _SIZE_>
596 double val1=sommets2(0,dir);
597 for (
int_t i=0; i<nbsom; i++)
598 if (std::abs(val1-sommets2(i,dir))>epsilon)
601 Cerr<<val1 <<
" "<<sommets2(i,dir)<<finl;
612 Cerr<<
"No useless direction "<<finl;
615 Cerr<<
"useless direction "<<dirinut<<finl<<finl;
622 for (
int_t i=0; i<nbsom; i++)
623 sommets(i,d)=sommets2(i,dir);
633template <
typename _SIZE_>
638 unsigned nb_volume_groups = (unsigned)mfumesh_->getGroupsOnSpecifiedLev(0).
size();
642 SFichier jdd_seq(nom_dom_trio +
"_ssz.geo");
643 SFichier jdd_par(nom_dom_trio +
"_ssz_par.geo");
644 std::vector<std::string> groups;
648 groups.push_back(name.getString());
652 Cerr <<
"Reading groups at level 0:" << finl;
653 groups = mfumesh_->getGroupsOnSpecifiedLev(0);
656 for (
const auto& gnam: groups)
658 MCAuto<DataArrayIdType> ids(mfumesh_->getGroupArr(0, gnam,
false));
659 const mcIdType *idP = ids->getConstPointer();
660 mcIdType nb_elems0 = ids->getNbOfElems();
661 if (nb_elems0 >= std::numeric_limits<_SIZE_>::max())
662 Process::exit(
"ERROR! You are trying to build a 32b domain with a mesh which is too big (too many nodes). Use Domaine_64.");
663 mcIdType nb_elems =
static_cast<int_t>(nb_elems0);
665 const Nom& nom_sous_domaine = gnam;
666 Cerr <<
"Detecting a sub-zone (group name="<< nom_sous_domaine <<
") with " << nb_elems <<
" cells." << finl;
668 if (nb_elems == 0)
continue;
670 Nom file_ssz(nom_dom_trio);
672 file_ssz += nom_sous_domaine;
673 file_ssz +=
Nom(
".file");
674 jdd_seq <<
"export Sous_Domaine " << nom_sous_domaine << finl;
675 jdd_par <<
"export Sous_Domaine " << nom_sous_domaine << finl;
677 jdd_seq <<
"Associer " << nom_sous_domaine <<
" " << nom_dom_trio << finl;
678 jdd_par <<
"Associer " << nom_sous_domaine <<
" " << nom_dom_trio << finl;
682 jdd_seq <<
"Lire " << nom_sous_domaine <<
" { liste " << nb_elems;
683 for (
int_t j = 0; j < nb_elems; j++) jdd_seq <<
" " << (
int) idP[j];
684 jdd_seq <<
" }" << finl;
688 jdd_seq <<
"Lire " << nom_sous_domaine <<
" { fichier " << file_ssz <<
" }" << finl;
689 jdd_par <<
"Lire " << nom_sous_domaine <<
" { fichier " << nom_sous_domaine <<
".ssz" <<
" }" << finl;
691 f_ssz << nb_elems << finl;
692 for (
int_t j = 0; j < nb_elems; j++)
693 f_ssz << (
int) idP[j] <<
" ";
705template <
typename _SIZE_>
710 constexpr bool CELL_FROM_BOUNDARY =
true;
713 MCAuto<MEDCouplingUMesh> face_mesh(mfumesh_->getMeshAtLevel(-1));
715 face_mesh->convertAllToPoly();
716 int_t nfaces =
static_cast<int_t>(face_mesh->getNumberOfCells());
720 ::retrieve_connec(face_mesh, conn, connIndex);
721 DataArrayIdType *cI = face_mesh->getNodalConnectivityIndex();
724 int typ =
static_cast<int>(conn[connIndex[0]]);
727 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).");
729 auto set_of_typs = face_mesh->getAllGeoTypes();
730 if (set_of_typs.size() > 1)
731 Process::exit(
"Read_MED: invalid boundary mesh! More than a single face type.");
736 MCAuto<DataArrayIdType> dsi = cI->deltaShiftIndex();
737 max_som_face =
static_cast<int>(dsi->getMaxValueInArray() - 1);
741 Cerr <<
"Detecting " << nfaces <<
" faces (" <<
type_face_ <<
")." << finl;
742 all_faces_bords.
resize(nfaces, max_som_face);
743 all_faces_bords = -1;
745 for (
int_t i = 0; i < nfaces; i++)
747 int_t index = connIndex[i] + 1;
748 int nb_som =
static_cast<int>(connIndex[i + 1] - index);
749 for (
int j = 0; j < nb_som; j++)
750 all_faces_bords(i, j) = conn[index + j] ;
753 Cerr <<
"Reading groups at level -1:" << finl;
754 auto grp_names = mfumesh_->getGroupsOnSpecifiedLev(-1);
756 std::set<mcIdType> id_check;
757 for (
const auto& gnam: grp_names)
761 Cerr <<
" group '" << gnam <<
"' is skipped, as requested." << finl;
765 MCAuto<DataArrayIdType> ids(mfumesh_->getGroupArr(-1, gnam,
false));
766 long bef = (long)id_check.size(), nb_faces = (long)ids->getNumberOfTuples();
767 id_check.insert(ids->begin(), ids->begin()+nb_faces);
768 if ((
long)id_check.size() - bef < nb_faces)
770 Cerr <<
"ERROR: group '" << gnam <<
"' contains faces which are also in one of the previously read groups." << finl;
771 Cerr <<
" Fix your mesh, or use the 'exclude_groups' option to prevent reading of this group." << finl;
774 Cerr <<
" group_name=" << gnam <<
" with " << nb_faces <<
" faces" << finl;
775 for(
const auto&
id: *ids)
778 fac_grp_id[id2] = zeid+1;
785 Cerr <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << finl;
786 Cerr <<
"Lire_MED: Warning: no boundary detected for the mesh." << finl;
787 Cerr <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << finl;
794template <
typename _SIZE_>
797 using SmallArrOfTID_t = SmallArrOfTID_T<_SIZE_>;
811 std::vector<ArrOfInt_t> sommets_joints;
812 ArrOfInt tab_pe_voisin;
815 SmallArrOfTID_t nb_face_per_bord(nbord);
821 faces_raccord.vide();
825 Noms noms_des_joints;
829 for (
int ib=nbord-1; ib>-1; ib--)
831 int indice_bord=ib+1;
834 Groupe_Faces_t facesgrpprov;
837 bool israccord=
false, isjoint=
false, isfacesint=
false;
842 raccprov.typer(
"Raccord_local_homogene");
850 Cerr<<
noms_bords_[ib]<<
" is considered as a joint "<<finl;
854 Frontiere_t& bordprov = (isjoint?jointprov:(israccord?ref_cast(Frontiere_t,raccprov.valeur()):(isfacesint?ref_cast(Frontiere_t,facesgrpprov):ref_cast(Frontiere_t,bordprov_))));
858 int_t nb_face_this_bord=0;
860 IntTab_t sommprov(nfacebord,nsomfa);
861 for (
int_t j=0; j<nfacebord; j++)
863 if (fac_grp_id[j]==indice_bord)
865 for (
int k=0; k<nsomfa; k++)
866 sommprov(nb_face_this_bord,k)=all_faces_bords(j,k);
870 Faces_t& facesi=bordprov.faces();
871 IntTab_t& sommetsfaces=facesi.les_sommets();
872 sommetsfaces.
resize(nb_face_this_bord,nsomfa);
873 for (
int_t jj=0; jj<nb_face_this_bord; jj++)
874 for (
int k=0; k<nsomfa; k++)
875 sommetsfaces(jj,k)=sommprov(jj,k);
877 facesv.
resize(nb_face_this_bord,2);
880 bool vide_0D_a_ecrire=
false;
881 if (nb_face_this_bord == 0)
883 bordprov.typer_faces(
"vide_0D");
884 vide_0D_a_ecrire =
true;
886 nb_face_per_bord[ib] = nb_face_this_bord;
889 && (nb_face_this_bord>0 || vide_0D_a_ecrire))
893 int PE_voisin=tab_pe_voisin[numero_joint];
895 ArrOfInt_t& sommets_joint=sommets_joints[numero_joint];
896 jointprov.affecte_PEvoisin(PE_voisin);
897 jointprov.affecte_epaisseur(epaisseur);
898 ArrOfInt_t& sommets_du_joint=jointprov.set_joint_item(JOINT_ITEM::SOMMET).set_items_communs();
899 sommets_du_joint=sommets_joint;
900 faces_joint.add(jointprov);
903 faces_raccord.add(raccprov);
905 goupes_faces.add(facesgrpprov);
907 faces_bord.add(bordprov_);
910 faces_bord.associer_domaine(dom);
911 faces_raccord.associer_domaine(dom);
912 faces_joint.associer_domaine(dom);
913 goupes_faces.associer_domaine(dom);
916 for (
int fr=0; fr<nbfr; fr++)
924template <
typename _SIZE_>
938 Cerr <<
"Dimension is not defined. Check your data file." << finl;
941 Cerr <<
"Trying to read the mesh " <<
nom_mesh_ <<
" from the file " <<
nom_fichier_ <<
" in order to affect to domain "
942 << nom_dom_trio <<
"..." << finl;
958 std::vector<int> nel = mfumesh_->getNonEmptyLevels();
961 assert(nel[1] == -1);
967 conn_trust_to_med(les_elems2,type_elem_n,
false);
968 conn_trust_to_med(all_faces_bords,
type_face_,
false);
977 Nom type_elem_orig = type_elem_n;
978 verifier_modifier_type_elem(type_elem_n,les_elems2,sommets);
982 if (type_elem_orig != type_elem_n)
983 dom.
typer(type_elem_n);
984 dom.type_elem()->associer_domaine(dom);
991 if (type_elem_n ==
"Rectangle" || type_elem_n ==
"Hexaedre" || type_elem_n ==
"Rectangle_64" || type_elem_n ==
"Hexaedre_64"
997 Cerr <<
" Lire_MED called in sequential => applying NettoieNoeuds" << finl;
1006 Cerr<<
"Reading of the MED domain ended."<<finl;
Classe Bord Cette classe represente un bord d'un domaine, c'est un type de frontiere.
Classe Bords Cette classe represente une liste d'objets de 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 &)
Type les elements du domaine avec le nom passe en parametre.
Groupes_Faces_t & groupes_faces()
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Une entree dont la source est une chaine de caracteres.
Class defining operators and methods for all reading operation in an input flow (file,...
Classe Faces Faces decrit un ensemble de faces par leur type (point ,segment, triangle ou quadrangle)...
void associer_domaine(const Domaine_t &z)
void reordonner()
Reordonne les faces.
Type_Face type_face() const
const Faces_t & faces() const
Classe Groupe_Face La classe sert a representer une selection de faces lu dans le fichier med.
Class Groupes_Faces Cette classe represente une liste d'objets de type Groupe_Faces.
classe Interprete_geometrique_base .
void associer_domaine(Nom &nom_dom)
Domaine_t & domaine(int i=0)
La classe Joint est une Frontiere qui contient les faces et les sommets de joint avec le domaine PEvo...
Classe Joints Cette classe represente une liste d'objet de type Joint.
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
renvoie le type trio a partir du type medocoupling : http://docs.salome-platform.org/6/gui/MED/MEDLoa...
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 Une chaine de caractere pour nommer les objets de TRUST
const char * getChar() const
Nom nom_me(int, const char *prefix=0, int without_padding=0) const
Insere _prefix000n (n=me() ou nproc()) dans un nom de fichier (par ex:toto.
Nom & prefix(const char *const)
const std::string & getString() const
Un tableau de chaine de caracteres (VECT(Nom)).
int search(const Nom &t) const
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
static double precision_geom
static const Nom & nom_du_cas()
Renvoie une reference constante vers le nom du cas.
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
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.
Classe Polyedre Cette represente l'element geometrique Polyedre.
Classe Polygone Cette represente l'element geometrique Polygone.
static int nproc()
renvoie le nombre de processeurs dans le groupe courant Voir Comm_Group::nproc() et PE_Groups::curren...
static int me()
renvoie mon rang dans le groupe de communication courant.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
Classe Raccord_base Cette classe est simplement une frontiere, c'est la classe de base de la.
Classe Raccords Cette represente une liste d'objets de type Raccord.
Cette classe est a la classe C++ ofstream ce que la classe Sortie est a la classe C++ ostream Elle re...
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)
methode utilisee par les interpretes qui modifient le domaine (sequentiel), detruit les descripteurs ...
Classe de base des flux de sortie.
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