TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
LireMED.h
1/****************************************************************************
2* Copyright (c) 2026, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#ifndef LireMED_included
17#define LireMED_included
18
19/*! @brief Classe LireMED Lire un fichier MED
20 *
21 * Structure du jeu de donnee (en dimension 2) :
22 * LireMED dom medfile
23 */
24#include <Interprete_geometrique_base.h>
25#include <TRUSTTabs_forward.h>
26#include <Domaine_forward.h>
27#include <med++.h>
28#include <medcoupling++.h>
29
30#ifdef MEDCOUPLING_
31#include <MEDLoader.hxx>
32#include <MEDFileMesh.hxx>
33#endif
34
35class Nom;
36
37template <typename _SIZE_>
39{
40 Declare_instanciable_32_64(LireMED_32_64);
41public :
42 using int_t = _SIZE_;
43 using ArrOfInt_t = ArrOfInt_T<_SIZE_>;
44 using IntTab_t = IntTab_T<_SIZE_>;
45 using BigArrOfInt_ = TRUSTArray<int, _SIZE_>; // Always int stored inside (family numbers typically)
46 using DoubleTab_t = DoubleTab_T<_SIZE_>;
47
48
51
52 LireMED_32_64(const Nom& file_name, const Nom& mesh_name);
54 void lire_geom(bool subDom=true);
56
57#ifdef MEDCOUPLING_
58 inline const MEDCoupling::MEDCouplingUMesh* get_mc_mesh() const
59 {
60 // really using the cast operator of MEDCoupling, not a wild cast:
61 return (const MEDCoupling::MEDCouplingUMesh*)mcumesh_;
62 }
63#endif
64
65protected:
66 Nom nom_fichier_; ///< Name of the MED file to read
67 Nom nom_mesh_ = "--any--"; ///< Name of the mesh in the MED file to read
68 bool axi1d_ = false; ///< Are we in Axi1D
69 bool convertAllToPoly_ = false;///< Should the mesh be converted to polygons/polyedrons
70 bool isVEFForce_ = false; ///< Should we force element type to be VEF compatible
71 int space_dim_ = -1; ///< Space dimension read in the MED file
72 Elem_geom_t type_elem_; ///< Highest dimension element type
73 Nom type_face_; ///< Boundary element type
74 Noms noms_bords_; ///< Names of the boundaries
75 Noms exclude_grps_; ///< Names of the (face) groups to skip when reading the file
76 Noms restrict_ssz_; ///< Names of the subzones to keep only in the .geo file
77 Noms internal_face_grps_; ///< Names of the internals face groups to read in the file
78#ifdef MEDCOUPLING_
79 MEDCoupling::MEDCouplingAxisType axis_type_ = MEDCoupling::MEDCouplingAxisType::AX_CART ;
80 MEDCoupling::MCAuto<MEDCoupling::MEDCouplingUMesh> mcumesh_;
81 MEDCoupling::MCAuto<MEDCoupling::MEDFileUMesh> mfumesh_;
82#endif
83
84 Nom type_medcoupling_to_type_geo_trio(int type_cell, bool cell_from_boundary) const;
85 void prepare_som_and_elem(DoubleTab_t& sommets, IntTab_t& les_elems);
86 void finalize_sommets(const DoubleTab_t& sommets2, DoubleTab_t& sommets) const;
88 void read_boundaries(BigArrOfInt_& familles, IntTab_t& all_faces_bords);
89 void fill_frontieres(const BigArrOfInt_& familles, const IntTab_t& all_faces_bords);
90};
91
92using LireMED = LireMED_32_64<int>;
93using LireMED_64 = LireMED_32_64<trustIdType>;
94
95#endif
classe Domaine_32_64 un Domaine est un maillage compose d'un ensemble d'elements geometriques de meme...
Definition Domaine.h:62
Classe Elem_geom_base Cette classe est la classe de base pour la definition d'elements.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Interprete_geometrique_base .
void lire_geom(bool subDom=true)
Definition LireMED.cpp:925
void fill_frontieres(const BigArrOfInt_ &familles, const IntTab_t &all_faces_bords)
Fills in all the information relative to Joints, Raccords and Frontiere.
Definition LireMED.cpp:795
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...
Definition LireMED.cpp:583
void read_boundaries(BigArrOfInt_ &familles, IntTab_t &all_faces_bords)
Handles the boundaries found in the MED file.
Definition LireMED.cpp:706
OWN_PTR(Elem_geom_base_32_64< _SIZE_ >) Elem_geom_t
Definition LireMED.h:50
Entree & interpreter_(Entree &) override
Definition LireMED.cpp:242
Nom type_medcoupling_to_type_geo_trio(int type_cell, bool cell_from_boundary) const
Elem_geom_t type_elem_
Definition LireMED.h:72
Domaine_32_64< _SIZE_ > Domaine_t
Definition LireMED.h:49
TRUSTArray< int, _SIZE_ > BigArrOfInt_
Definition LireMED.h:45
void write_sub_dom_datasets() const
Definition LireMED.cpp:634
ArrOfInt_T< _SIZE_ > ArrOfInt_t
Definition LireMED.h:43
IntTab_T< _SIZE_ > IntTab_t
Definition LireMED.h:44
void prepare_som_and_elem(DoubleTab_t &sommets, IntTab_t &les_elems)
LireMED_32_64(const Nom &file_name, const Nom &mesh_name)
Definition LireMED.cpp:214
_SIZE_ int_t
Definition LireMED.h:42
void retrieve_MC_objects()
DoubleTab_T< _SIZE_ > DoubleTab_t
Definition LireMED.h:46
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
Un tableau de chaine de caracteres (VECT(Nom)).
Definition Noms.h:26
Represents a an array of int/int64/double/... values.
Definition TRUSTArray.h:81