TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
EcrFicPartageMPIIO.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 EcrFicPartageMPIIO_included
17#define EcrFicPartageMPIIO_included
18
19#include <comm_incl.h>
20#include <SFichier.h>
21
22/*! @brief Class to use MPI-IO to write in a single file
23 *
24 */
26{
27 // Parallel write in a shared file with MPIIO
28 Declare_instanciable_sans_constructeur_ni_destructeur(EcrFicPartageMPIIO);
29public:
31 ~EcrFicPartageMPIIO() override;
32#ifdef MPI_
33 EcrFicPartageMPIIO(const char* name,IOS_OPEN_MODE mode=ios::out);
34 int ouvrir(const char* name,IOS_OPEN_MODE mode=ios::out) override;
35 void close();
36 // Useless with MPIIO:
37 inline Sortie& lockfile() override { return *this; }
38 inline Sortie& unlockfile() override { return *this; }
39 inline Sortie& syncfile() override { return *this; }
40 inline Sortie& flush() override { return *this; }
41
42 // Check method when using some public methods:
43 void check();
44
45 Sortie& operator <<(const Separateur& ob) override;
46
47 Sortie& operator <<(const int ob) override;
48 Sortie& operator <<(const unsigned ob) override;
49 Sortie& operator <<(const long ob) override;
50 Sortie& operator <<(const long long ob) override;
51 Sortie& operator <<(const unsigned long ob) override;
52
53 Sortie& operator <<(const float ob) override;
54 Sortie& operator <<(const double ob) override;
55 Sortie& operator <<(const Objet_U& ob) override;
56 Sortie& operator <<(const char* ob) override;
57 Sortie& operator <<(const std::string& str) override;
58
59 int put(const unsigned* ob, std::streamsize n, std::streamsize pas) override;
60 int put(const int* ob, std::streamsize n, std::streamsize pas) override;
61 int put(const long* ob, std::streamsize n, std::streamsize pas) override;
62 int put(const long long* ob, std::streamsize n, std::streamsize pas) override;
63 int put(const float* ob, std::streamsize n, std::streamsize pas) override;
64 int put(const double* ob, std::streamsize n, std::streamsize pas) override;
65
66private:
67 void write(MPI_Datatype, const void*);
68 int put(MPI_Datatype, const void*, int);
69 MPI_File mpi_file_;
70 MPI_Status mpi_status_;
71 MPI_Offset disp_; // Displacement of the individual pointers (in bytes)
72#endif
73};
74
75#endif
friend class Sortie
Definition Objet_U.h:75
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
Definition Objet_U.cpp:55
SFichier(const char *name, IOS_OPEN_MODE mode=ios::out)
Definition SFichier.h:30
Separateur pour les fichiers.
Definition Separateur.h:30
virtual int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::out)
Sortie & flush() override
Force l'ecriture sur disque des donnees dans le tampon Utilise l'implementation de la classe ofstream...
virtual int put(const unsigned *ob, std::streamsize n, std::streamsize nb_colonnes=1)
Definition Sortie.cpp:101
virtual Sortie & unlockfile()
Definition Sortie.cpp:180
Sortie & operator<<(ostream &(*f)(ostream &))
Definition Sortie.cpp:116
virtual Sortie & lockfile()
Definition Sortie.cpp:173
virtual Sortie & syncfile()
Definition Sortie.cpp:187