TrioCFD 1.9.9_beta
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 Opens file name.
38 *
39 * This method must be called on all processors. On failure: exit().
40 *
41 */
43 IOS_OPEN_MODE mode)
44{
45 file_.set_error_action(ERROR_CONTINUE);
46 int ok = ouvrir(name, mode);
47 if (!ok && Process::je_suis_maitre())
48 {
49 Cerr << "File " << name << " does not exist (LecFicDiffuse)" << finl;
51 }
52}
53
54/*! @brief Opens the file.
55 *
56 * This method must be called by all processors in the group.
57 * Return value: 1 if ok, 0 otherwise.
58 *
59 */
60int LecFicDiffuse::ouvrir(const char* name,
61 IOS_OPEN_MODE mode)
62{
63 int ok = 0;
65 ok = file_.ouvrir(name, mode);
66 envoyer_broadcast(ok, 0);
67 return ok;
68}
69
70/*! @brief
71 *
72 */
74{
76 {
77 std::cerr << "Error get_istream (LecFicDiffuse)" << std::endl;
79 }
80 return file_.get_istream();
81}
82
83/*! @brief
84 *
85 */
86const istream& LecFicDiffuse::get_istream() const
87{
89 {
90 std::cerr << "Error get_istream (LecFicDiffuse)" << std::endl;
92 }
93 return file_.get_istream();
94}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
@ ERROR_CONTINUE
Definition Entree.h:93
This class implements the operators and virtual methods of the EFichier class as follows: The file to...
int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::in) override
Opens the file.
istream & get_istream() override
Base class for diffused inputs: the master processor reads data from get_entree_master() and broadcas...
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
Definition Process.cpp:82
Base class for output streams.
Definition Sortie.h:52