33 #ifndef __H__LIB_ALGEBRA__PARALLELIZATION__PARALLEL_MATRIX_OVERLAP_IMPL__
34 #define __H__LIB_ALGEBRA__PARALLELIZATION__PARALLEL_MATRIX_OVERLAP_IMPL__
79 template<
typename matrix_type>
124 bool bCreateNewNodes,
126 std::set<int> &pids,
bool bSet,
size_t level)
133 UG_LOG(
"\n\nnew sending Layout:\n")
135 UG_LOG(
"\n\nnew receiving Layout:\n")
148 rowSendingScheme.
process(receivingLayout);
160 UG_LOG(
"\n\nnew Master Layout:\n")
162 UG_LOG(
"\n\nnew Slave Layout:\n")
194 std::vector<IndexLayout> &vMasterLayouts,
195 std::vector<IndexLayout> &vSlaveLayouts,
219 UG_LOG(
"\nmaster layout:\n");
221 UG_LOG(
"slave layout:\n");
257 std::vector<IndexLayout> masterOLLayouts, slaveOLLayouts;
258 masterOLLayouts.clear();
259 masterOLLayouts.resize(maxOverlap+1);
260 slaveOLLayouts.clear();
261 slaveOLLayouts.resize(maxOverlap+1);
263 std::vector<IndexLayout> backward_masterOLLayouts, backward_slaveOLLayouts;
264 backward_masterOLLayouts.clear();
265 backward_masterOLLayouts.resize(maxOverlap+1);
266 backward_slaveOLLayouts.clear();
267 backward_slaveOLLayouts.resize(maxOverlap+1);
273 pids.insert(iter->first);
275 pids.insert(iter->first);
285 for(
size_t current_overlap=0; current_overlap <= maxOverlap; current_overlap++)
300 if(current_overlap == 0)
301 send_layout = &slaveLayout;
303 send_layout = &masterOLLayouts[current_overlap-1];
306 if(current_overlap == 0)
307 receive_layout = &masterLayout;
309 receive_layout = &slaveOLLayouts[current_overlap-1];
314 std::vector<IndexLayout::Element> vIndex;
322 communicate(*send_layout, *receive_layout, bCreateNewNodes,
323 slaveOLLayouts[current_overlap], masterOLLayouts[current_overlap], pids,
false, current_overlap);
332 if(current_overlap == 0)
333 backward_send_layout = &masterLayout;
335 backward_send_layout = &backward_masterOLLayouts[current_overlap-1];
338 if(current_overlap == 0)
339 backward_receive_layout = &slaveLayout;
341 backward_receive_layout = &backward_slaveOLLayouts[current_overlap-1];
346 std::vector<IndexLayout::Element> vIndex;
354 communicate(*backward_send_layout, *backward_receive_layout, bCreateNewNodes,
355 backward_slaveOLLayouts[current_overlap], backward_masterOLLayouts[current_overlap], pids,
true, current_overlap+1);
369 spLayouts->proc_comm() =
m_mat.layouts()->proc_comm();
370 spLayouts->comm() =
m_mat.layouts()->comm();
437 template<
typename matrix_type>
442 std::vector<IndexLayout> vMasterLayouts;
443 std::vector<IndexLayout> vSlaveLayouts;
449 mat, newMat, totalMasterLayout, totalSlaveLayout, vMasterLayouts, vSlaveLayouts, PN);
Definition: smart_pointer.h:296
Definition: smart_pointer.h:108
Performs communication between interfaces on different processes.
Definition: pcl_interface_communicator.h:68
You may add elements to this interface and iterate over them.
Definition: pcl_communication_structs.h:207
Definition: pcl_process_communicator.h:70
iterator end(size_t level=0)
returns the iterator to the last interface of the layout.
Definition: pcl_communication_structs.h:492
iterator begin(size_t level=0)
returns the iterator to the first interface of the layout.
Definition: pcl_communication_structs.h:486
InterfaceMap::const_iterator const_iterator
Definition: pcl_communication_structs.h:477
Extends the HorizontalAlgebraLayouts by vertical layouts.
Definition: algebra_layouts.h:121
Definition: debug_id.h:94
Definition: parallel_matrix_overlap_impl.h:81
std::vector< IndexLayout > & m_vSlaveLayouts
m_vSlaveLayout[i] is the slave layout from overlap i without others
Definition: parallel_matrix_overlap_impl.h:96
pcl::InterfaceCommunicator< IndexLayout > & m_com
communicator
Definition: parallel_matrix_overlap_impl.h:86
bool m_slaveDirichletLast
Definition: parallel_matrix_overlap_impl.h:107
std::map< int, BinaryBuffer > BufferMap
Definition: parallel_matrix_overlap_impl.h:84
matrix_type & m_newMat
the new to create matrix
Definition: parallel_matrix_overlap_impl.h:90
const pcl::ProcessCommunicator & m_pc
Definition: parallel_matrix_overlap_impl.h:100
IndexLayout::Interface Interface
Definition: parallel_matrix_overlap_impl.h:83
matrix_type & m_mat
the original matrix (should be const)
Definition: parallel_matrix_overlap_impl.h:89
std::vector< IndexLayout > & m_vMasterLayouts
m_vMasterLayout[i] is the master layout from overlap i without others
Definition: parallel_matrix_overlap_impl.h:95
void communicate(const IndexLayout &sendingLayout, const IndexLayout &receivingLayout, bool bCreateNewNodes, IndexLayout &newSlavesLayout, IndexLayout &newMastersLayout, std::set< int > &pids, bool bSet, size_t level)
communicate
Definition: parallel_matrix_overlap_impl.h:123
IndexLayout & m_totalSlaveLayout
layout combining all slave layouts from overlap 0 to overlap_depth-1
Definition: parallel_matrix_overlap_impl.h:93
size_t m_overlapDepthSlave
Definition: parallel_matrix_overlap_impl.h:105
size_t m_overlapDepthMaster
Definition: parallel_matrix_overlap_impl.h:104
IndexLayout & m_totalMasterLayout
layout combining all master layouts from overlap 0 to overlap_depth-1
Definition: parallel_matrix_overlap_impl.h:92
GenerateOverlapClass(matrix_type &mat, matrix_type &newMat, IndexLayout &totalMasterLayout, IndexLayout &totalSlaveLayout, std::vector< IndexLayout > &vMasterLayouts, std::vector< IndexLayout > &vSlaveLayouts, ParallelNodes &pn)
Generates a new matrix with overlap from another matrix.
Definition: parallel_matrix_overlap_impl.h:191
bool m_masterDirichletLast
Definition: parallel_matrix_overlap_impl.h:106
std::vector< size_t > m_overlapSize
Definition: parallel_matrix_overlap_impl.h:103
ParallelNodes & PN
Definition: parallel_matrix_overlap_impl.h:97
bool calculate()
calculate
Definition: parallel_matrix_overlap_impl.h:209
Wrapper for sequential matrices to handle them in parallel.
Definition: parallel_matrix.h:65
void set_layouts(ConstSmartPtr< AlgebraLayouts > layouts)
sets the algebra layouts
Definition: parallel_matrix.h:97
ConstSmartPtr< AlgebraLayouts > layouts() const
returns the algebra layouts
Definition: parallel_matrix.h:94
Definition: parallel_nodes.h:112
const AlgebraID & local_to_global(size_t i) const
Definition: parallel_nodes.h:278
size_t local_size() const
Definition: parallel_nodes.h:273
void add_new_layouts_to(IndexLayout &newMasterLayout, IndexLayout &newSlaveLayout)
Definition: parallel_nodes.cpp:382
Definition: row_sending_scheme.h:47
void add_rows_to_matrix(matrix_type &mat)
Definition: row_sending_scheme.h:147
void set_create_new_nodes(bool bCreateNewNodes)
Definition: row_sending_scheme.h:65
void process(const IndexLayout &receiveLayout)
Definition: row_sending_scheme.h:114
void set_rows_in_matrix(matrix_type &mat)
Definition: row_sending_scheme.h:135
void issue_send(pcl::InterfaceCommunicator< IndexLayout > &communicator, const IndexLayout &sendLayout, const IndexLayout &receiveLayout)
Definition: row_sending_scheme.h:83
void SetDirichletRow(TSparseMatrix &A, size_t i, size_t alpha)
Definition: sparsematrix_util.h:796
bool TestLayout(const pcl::ProcessCommunicator &processCommunicator, pcl::InterfaceCommunicator< TLayout > &com, const TLayout &masterLayout, const TLayout &slaveLayout, bool bPrint=false, boost::function< TValue(typename TLayout::Element)> cbToValue=TrivialToValue< typename TLayout::Element >, bool compareValues=false)
Checks whether the given layouts are consistent.
Definition: pcl_layout_tests.h:300
void AddLayout(TLayout &destLayout, const TLayout &sourceLayout)
Definition: pcl_util.h:314
bool PrintLayout(const pcl::ProcessCommunicator &processCommunicator, pcl::InterfaceCommunicator< TLayout > &com, const TLayout &masterLayout, const TLayout &slaveLayout, boost::function< TValue(typename TLayout::Element)> cbToValue=TrivialToValue< typename TLayout::Element >)
Definition: pcl_layout_tests.h:344
void CollectUniqueElements(std::vector< typename TLayout::Element > &elemsOut, const TLayout &layout)
writes all elements in the interfaces into the resulting vector. avoids doubles.
Definition: pcl_layout_util.h:142
#define UG_ASSERT(expr, msg)
Definition: assert.h:70
#define UG_DLOG(__debugID__, level, msg)
Definition: log.h:298
#define UG_LOG(msg)
Definition: log.h:367
#define IF_DEBUG(__debugID__, level)
Definition: log.h:303
CPUAlgebra::matrix_type matrix_type
bool MakeConsistent(const ParallelMatrix< matrix_type > &_mat, ParallelMatrix< matrix_type > &newMat)
Definition: parallel_matrix_overlap_impl.h:438
DebugID DBG_MATRIX_OVERLAP("Algebra.MatrixOverlap")
Definition: parallel_matrix_overlap_impl.h:53
#define PROFILE_BEGIN(name)
Definition: profiler.h:254
#define PROFILE_FUNC_GROUP(groups)
Definition: profiler.h:258