LifeV
DOFInterfaceIO.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5 Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6 Copyright (C) 2010, 2011, 2012 EPFL, Politecnico di Milano, Emory University
7 
8 This file is part of LifeV.
9 
10 LifeV is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
14 
15 LifeV is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file
29  @brief Class that handles I/O of fluid-solid DOF interfaces in FSI
30 
31  @date 2013-04-30
32  @author Radu Popescu <radu.popescu@epfl.ch>
33  @maintainer Radu Popescu <radu.popescu@epfl.ch>
34 */
35 
36 #ifndef DOF_INTERFACE_IO_
37 #define DOF_INTERFACE_IO_
38 
39 #include <string>
40 #include <lifev/core/Core_config.h>
41 
42 // Tell the compiler to ignore specific kind of warnings:
43 #pragma GCC diagnostic ignored "-Wunused-variable"
44 #pragma GCC diagnostic ignored "-Wunused-parameter"
45 
46 #include <Epetra_config.h>
47 
48 #ifdef LIFEV_HAS_HDF5
49 #ifdef HAVE_MPI
50 
51 #include <Epetra_MpiComm.h>
52 
53 #include <boost/shared_ptr.hpp>
54 
55 //Tell the compiler to restore the warning previously silented
56 #pragma GCC diagnostic warning "-Wunused-variable"
57 #pragma GCC diagnostic warning "-Wunused-parameter"
58 
59 #include <lifev/core/LifeV.hpp>
60 #include <lifev/core/filter/HDF5IO.hpp>
61 
62 #include <lifev/core/fem/DOFInterface3Dto3D.hpp>
63 
64 namespace LifeV
65 {
66 
67 /*!
68  @brief Class that handles I/O of fluid-solid DOF interfaces in FSI
69  @author Radu Popescu radu.popescu@epfl.ch
70 
71  TODO: write description (also storage format)
72 */
73 class DOFInterfaceIO
74 {
75 public:
76  //! @name Public Types
77  //@{
78  typedef std::shared_ptr<Epetra_MpiComm> commPtr_Type;
79  typedef DOFInterface3Dto3D interface_Type;
80  typedef std::shared_ptr<interface_Type> interfacePtr_Type;
81  typedef std::vector<interfacePtr_Type> interfaceVector_Type;
82  typedef std::shared_ptr<interfaceVector_Type> interfaceVectorPtr_Type;
83  typedef std::map<UInt, UInt> dofMap_Type;
84  typedef std::shared_ptr<dofMap_Type> dofMapPtr_Type;
85 
86  //@}
87 
88  //! \name Constructors & Destructors
89  //@{
90  //! Constructor
91  /*!
92  * Non-empty constructor
93  * \param fileName the name of the HDF5 file to be used
94  * \param comm pointer to Epetra_Comm
95  */
96  DOFInterfaceIO (const std::string& fileName,
97  const commPtr_Type& comm);
98 
99  //! Empty destructor
100  virtual ~DOFInterfaceIO() {}
101  //@}
102 
103  //! \name Public Methods
104  //@{
105  //! Write method
106  /*!
107  * Call this method to write the DOF interfaces
108  */
109  void write (const interfaceVectorPtr_Type& interfaces);
110  //! Read method
111  /*!
112  * Call this method to read from the HDF5 file the DOF interface part
113  * with the rank of the current MPI process
114  */
115  void read (dofMapPtr_Type& interface);
116  //@}
117 
118 private:
119  // Copy constructor and assignment operator are disabled
120  DOFInterfaceIO (const DOFInterfaceIO&);
121  DOFInterfaceIO& operator= (const DOFInterfaceIO&);
122 
123  //! Private Data Members
124  //@{
125  commPtr_Type M_comm;
126  UInt M_myRank;
127  std::string M_fileName;
128  HDF5IO M_HDF5IO;
129  // Buffer for reading/writing
130  std::vector<UInt> M_keyBuffer;
131  std::vector<UInt> M_valueBuffer;
132  //@}
133 }; // class DOFInterfaceIO
134 
135 } /* namespace LifeV */
136 
137 #endif /* HAVE_MPI */
138 #endif /* LIFEV_HAS_HDF5 */
139 #endif /* DOF_INTERFACE_IO_ */