ug4
attachment_operations.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015: G-CSC, Goethe University Frankfurt
3  * Authors: Sebastian Reiter, Dmitriy Logashenko
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 #ifndef __H__UG_PCL_ATTACHMENT_OPERATIONS__
34 #define __H__UG_PCL_ATTACHMENT_OPERATIONS__
35 
37 #include "compol_copy_attachment.h"
39 
40 namespace ug{
41 
54 template <typename TElem, typename AType>
56 (
57  Grid& grid,
58  AType aValue,
60 )
61 {
62  typedef typename GridLayoutMap::Types<TElem>::Layout layout_t;
63 
66 
67  ComPol_AttachmentReduce<layout_t, AType> cpAValue (grid, aValue, op);
68 
69  icom.exchange_data (glm, INT_H_SLAVE, INT_H_MASTER, cpAValue);
70 
71  icom.communicate();
72 
73  ComPol_CopyAttachment<layout_t, AType> cpCopyAValue (grid, aValue);
74 
75  icom.exchange_data (glm, INT_H_MASTER, INT_H_SLAVE, cpCopyAValue);
76 
77  icom.communicate();
78 }
79 
80 } // end of namespace ug
81 
82 #endif // __H__UG_PCL_ATTACHMENT_OPERATIONS__
83 
84 /* End of File */
Performs communication between interfaces on different processes.
Definition: pcl_interface_communicator.h:68
bool communicate(int tag=749345)
sends and receives the collected data.
Definition: pcl_interface_communicator_impl.hpp:409
void exchange_data(const TLayoutMap &layoutMap, const typename TLayoutMap::Key &keyFrom, const typename TLayoutMap::Key &keyTo, ICommunicationPolicy< TLayout > &commPol)
internally calls send_data and receive_data with the specified layouts.
Definition: pcl_interface_communicator_impl.hpp:213
the standard multi-level-layout implementation
Definition: pcl_communication_structs.h:615
Performs reduce operations on the specified attachment.
Definition: compol_attachment_reduce.h:274
copies values from a specified attachment to a stream and back.
Definition: compol_copy_attachment.h:54
GridLayoutMap & grid_layout_map()
Definition: distributed_grid.h:103
Manages the elements of a grid and their interconnection.
Definition: grid.h:132
DistributedGridManager * distributed_grid_manager()
returns a pointer to the associated distributed grid manager.
Definition: grid_impl.hpp:53
lets you access layouts by type and key
Definition: parallel_grid_layout.h:152
MPI_Op ReduceOperation
Definition: pcl_methods.h:74
the ug namespace
@ INT_H_MASTER
horizontal master node
Definition: parallel_grid_layout.h:104
@ INT_H_SLAVE
horizontal slave node
Definition: parallel_grid_layout.h:105
void AttachmentAllReduce(Grid &grid, AType aValue, pcl::ReduceOperation op)
Definition: attachment_operations.hpp:56