TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
LecFicDiffuse.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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#include <LecFicDiffuse.h>
17#include <communications.h>
18
19Implemente_instanciable_sans_constructeur(LecFicDiffuse,"LecFicDiffuse",Lec_Diffuse_base);
20
22{
23 throw;
24}
25
27{
28 throw;
29}
30
31// LecFicDiffuse::LecFicDiffuse():EFichier()
33{
34 file_.set_error_action(ERROR_CONTINUE);
35}
36
37/*! @brief ouverture du fichier name.
38 *
39 * Cette methode doit etre appelee sur tous les processeurs. En cas
40 * d'echec : exit()
41 *
42 */
44 IOS_OPEN_MODE mode)
45{
46 file_.set_error_action(ERROR_CONTINUE);
47 int ok = ouvrir(name, mode);
48 if (!ok && Process::je_suis_maitre())
49 {
50 Cerr << "File " << name << " does not exist (LecFicDiffuse)" << finl;
52 }
53}
54
55/*! @brief Ouverture du fichier.
56 *
57 * Cette methode doit etre appelee par tous les processeurs du groupe.
58 * Valeur de retour: 1 si ok, 0 sinon
59 *
60 */
61int LecFicDiffuse::ouvrir(const char* name,
62 IOS_OPEN_MODE mode)
63{
64 int ok = 0;
66 ok = file_.ouvrir(name, mode);
67 envoyer_broadcast(ok, 0);
68 return ok;
69}
70
71/*! @brief
72 *
73 */
75{
77 {
78 std::cerr << "Error get_istream (LecFicDiffuse)" << std::endl;
80 }
81 return file_.get_istream();
82}
83
84/*! @brief
85 *
86 */
87const istream& LecFicDiffuse::get_istream() const
88{
90 {
91 std::cerr << "Error get_istream (LecFicDiffuse)" << std::endl;
93 }
94 return file_.get_istream();
95}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
@ ERROR_CONTINUE
Definition Entree.h:93
Cette classe implemente les operateurs et les methodes virtuelles de la classe EFichier de la facon s...
int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::in) override
Ouverture du fichier.
istream & get_istream() override
Classe de base des entrees diffusees: le processeur maitre lit les donnees dans la classe get_entree_...
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
Definition Process.cpp:86
Classe de base des flux de sortie.
Definition Sortie.h:52