1 | /*
|
---|
2 | * vmg - a versatile multigrid solver
|
---|
3 | * Copyright (C) 2012 Institute for Numerical Simulation, University of Bonn
|
---|
4 | *
|
---|
5 | * vmg is free software: you can redistribute it and/or modify
|
---|
6 | * it under the terms of the GNU General Public License as published by
|
---|
7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
8 | * (at your option) any later version.
|
---|
9 | *
|
---|
10 | * vmg is distributed in the hope that it will be useful,
|
---|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | * GNU General Public License for more details.
|
---|
14 | *
|
---|
15 | * You should have received a copy of the GNU General Public License
|
---|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
17 | */
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * @file datatypes_global.cpp
|
---|
21 | * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
|
---|
22 | * @date Tue Apr 09 12:19:58 2013
|
---|
23 | *
|
---|
24 | * @brief Saves MPI datatypes for global grid communication.
|
---|
25 | *
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifdef HAVE_CONFIG_H
|
---|
29 | #include "libvmg_config.h"
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #ifdef HAVE_MPI
|
---|
33 | #include <mpi.h>
|
---|
34 | #endif
|
---|
35 |
|
---|
36 | #include <sstream>
|
---|
37 | #include <string>
|
---|
38 |
|
---|
39 | #include "comm/mpi/datatypes_global.hpp"
|
---|
40 |
|
---|
41 | using namespace VMG;
|
---|
42 |
|
---|
43 | std::string VMG::MPI::DatatypesGlobal::ToString() const
|
---|
44 | {
|
---|
45 | std::stringstream str;
|
---|
46 | std::vector<Datatype>::const_iterator iter;
|
---|
47 |
|
---|
48 | str << "==== DATATYPES_GLOBAL ====" << std::endl
|
---|
49 | << "**** SEND ****" << std::endl;
|
---|
50 |
|
---|
51 | for (iter = send.begin(); iter != send.end(); ++iter)
|
---|
52 | str << iter->ToString() << std::endl;
|
---|
53 |
|
---|
54 | str << "**************************" << std::endl
|
---|
55 | << "**** RECEIVE ****" << std::endl;
|
---|
56 |
|
---|
57 | for (iter = recv.begin(); iter != recv.end(); ++iter)
|
---|
58 | str << iter->ToString() << std::endl;
|
---|
59 |
|
---|
60 | str << "**************************" << std::endl
|
---|
61 | << "==========================";
|
---|
62 |
|
---|
63 | return str.str();
|
---|
64 | }
|
---|
65 |
|
---|
66 | std::ostream& VMG::MPI::operator<<(std::ostream& out, const VMG::MPI::DatatypesGlobal& dt_global)
|
---|
67 | {
|
---|
68 | return out << dt_global.ToString();
|
---|
69 | }
|
---|