TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Ecrire_MED.h
1/****************************************************************************
2* Copyright (c) 2025, 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 Ecrire_MED_included
17#define Ecrire_MED_included
18
19#include <TRUSTTabs_forward.h>
20#include <Interprete.h>
21#include <TRUST_Ref.h>
22#include <med++.h>
23#include <Nom.h>
24#include <map>
25#include <Domaine_forward.h>
26
27#include <medcoupling++.h>
28#ifdef MEDCOUPLING_
29#include <MEDCouplingUMesh.hxx>
30#include <MEDFileMesh.hxx>
31#endif
32
33class Nom;
34class Noms;
35class Champ_Inc_base;
36class Domaine_VF;
38
39/*! @brief Classe Ecrire_MED Ecrit un fichier MED.
40 *
41 * Warning: fields and everything related to discretised domains can only be invoked with the 32 bit version.
42 */
43template <typename _SIZE_>
45{
46 Declare_instanciable_32_64(Ecrire_MED_32_64);
47
48public :
49 using int_t = _SIZE_;
50 using ArrOfInt_t = ArrOfInt_T<_SIZE_>;
51 using IntTab_t = IntTab_T<_SIZE_>;
53
54 Ecrire_MED_32_64(const Nom& file_name, const Domaine_t& dom);
55
56 void set_file_name_and_dom(const Nom& file_name, const Domaine_t& dom, const Domaine_dis_base* dom_dis=nullptr);
57
58#ifdef MED_
59 inline Nom version() { return MED_VERSION_STR; }
60#else
61 inline Nom version() { return "NOT INSTALLED"; }
62#endif
63
65
66 // This method can be called in both 32 and 64b:
67 void ecrire_domaine(bool append=true);
68 void ecrire_domaine_dual(bool append=true);
69 void ecrire_domaine_dis(bool append=true);
70
71 void ecrire_champ(const Nom& type, const Nom& nom_cha1,const DoubleTab& val,const Noms& unite,const Noms& noms_compo,const Nom& type_elem,double time);
72 void ecrire_champ(const Nom& type, const Nom& nom_cha1,const DoubleTab& val,const Noms& unite,const Nom& type_elem,double time,const Champ_Inc_base& le_champ);
73
74protected:
75 void get_bords_infos(Noms& noms_bords_and_jnts, ArrOfInt_t& sz_bords_and_jnts) const;
77
78 Nom nom_fichier_; ///< Name of the MED file to write
79 OBS_PTR(Domaine_t) dom_; ///< Domain that will be written
80 std::map<std::string, int> timestep_;
82
83 OBS_PTR(Domaine_VF) domaine_dis_;
84
85#ifdef MEDCOUPLING_
86 const MEDCoupling::MEDCouplingUMesh *mcumesh_ = nullptr; ///! Real owner is Domain class
87 MEDCoupling::MCAuto<MEDCoupling::MEDFileUMesh> mfumesh_; ///! Ecrire_MED is the owner
88#endif
89};
90
91using Ecrire_MED = Ecrire_MED_32_64<int>;
92using Ecrire_MED_64 = Ecrire_MED_32_64<trustIdType>;
93
94#endif /* Ecrire_MED_included */
Classe Champ_Inc_base.
classe Domaine_32_64 un Domaine est un maillage compose d'un ensemble d'elements geometriques de meme...
Definition Domaine.h:62
class Domaine_VF
Definition Domaine_VF.h:44
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
Classe Ecrire_MED Ecrit un fichier MED.
Definition Ecrire_MED.h:45
IntTab_T< _SIZE_ > IntTab_t
Definition Ecrire_MED.h:51
void ecrire_domaine_dis(bool append=true)
void ecrire_champ(const Nom &type, const Nom &nom_cha1, const DoubleTab &val, const Noms &unite, const Noms &noms_compo, const Nom &type_elem, double time)
std::map< std::string, int > timestep_
Definition Ecrire_MED.h:80
void ecrire_champ(const Nom &type, const Nom &nom_cha1, const DoubleTab &val, const Noms &unite, const Nom &type_elem, double time, const Champ_Inc_base &le_champ)
Ecrire_MED_32_64(const Nom &file_name, const Domaine_t &dom)
void get_bords_infos(Noms &noms_bords_and_jnts, ArrOfInt_t &sz_bords_and_jnts) const
OBS_PTR(Domaine_VF) domaine_dis_
void ecrire_domaine_dual(bool append=true)
OBS_PTR(Domaine_t) dom_
Domain that will be written.
Domaine_32_64< _SIZE_ > Domaine_t
Definition Ecrire_MED.h:52
void set_file_name_and_dom(const Nom &file_name, const Domaine_t &dom, const Domaine_dis_base *dom_dis=nullptr)
void fill_faces_and_boundaries()
Entree & interpreter(Entree &) override
ArrOfInt_T< _SIZE_ > ArrOfInt_t
Definition Ecrire_MED.h:50
void ecrire_domaine(bool append=true)
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Classe de base des objets "interprete".
Definition Interprete.h:38
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