Loading [MathJax]/extensions/tex2jax.js
ug4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
pcl_domain_decomposition.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2015: G-CSC, Goethe University Frankfurt
3 * Authors: Sebastian Reiter, Andreas Vogel, Ingo Heppner
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__PCL__DOMAIN_DECOMPOSITION__
34#define __H__PCL__DOMAIN_DECOMPOSITION__
35
36namespace pcl
37{
38
41
43{
44
45 public:
47
52 virtual int map_proc_id_to_subdomain_id(int procID) const = 0;
53
54 virtual int get_num_subdomains() const = 0;
55
56 //virtual int get_num_procs_per_subdomain() const = 0;
57 virtual int get_num_spatial_dimensions() const = 0;
58
59 virtual void get_subdomain_procs(std::vector<int>& procsOut,
60 int subdomIndex) = 0;
61 public:
62 // destructor
64
65}; /* end class 'IDomainDecompositionInfo' */
66
68{
70 public:
76
78 m_num_subdomains(numSubdomains),
80 /*m_pDebugWriter(NULL)*/
81 {
82 if(numSubdomains > 0 && pcl::NumProcs() > 1)
83 m_num_procs_per_subdomain = pcl::NumProcs() / numSubdomains;
84 else
86 }
87
88 public:
90
95 int map_proc_id_to_subdomain_id(int procID) const
96 {
97 return procID / m_num_procs_per_subdomain;
98 }
99
100 void set_num_subdomains(int numSubdomains) {
101 m_num_subdomains = numSubdomains;
102
103 if(numSubdomains > 0 && pcl::NumProcs() > 1)
104 m_num_procs_per_subdomain = pcl::NumProcs() / numSubdomains;
105 else
107 }
108
110
113 }
114
116
117 //int get_num_procs_per_subdomain() const {return m_num_procs_per_subdomain;}
118
119 virtual void get_subdomain_procs(std::vector<int>& procsOut,
120 int subdomIndex)
121 {
122 procsOut.resize(m_num_procs_per_subdomain);
123 int first = subdomIndex * m_num_procs_per_subdomain;
124 for(int i = 0; i < m_num_procs_per_subdomain; ++i)
125 procsOut[i] = first + i;
126 }
127
128 public:
129 // destructor
131
132 protected:
133 // number of subdomains
135
136 // number of spatial dimensions
138
139 // number of procs per subdomains
140 //std::vector<int> m_vnum_procs_per_subdomain; // as vector, for variable distribution of processors over subdomains
142}; /* end class 'StandardDomainDecompositionInfo' */
143
144// end group pcl
146
147}// end of namespace
148#endif
Definition pcl_domain_decomposition.h:43
virtual void get_subdomain_procs(std::vector< int > &procsOut, int subdomIndex)=0
virtual int get_num_subdomains() const =0
virtual int map_proc_id_to_subdomain_id(int procID) const =0
mapping method "proc-id" ==> "subdomain-id"
virtual ~IDomainDecompositionInfo()
Definition pcl_domain_decomposition.h:63
virtual int get_num_spatial_dimensions() const =0
Definition pcl_domain_decomposition.h:68
int map_proc_id_to_subdomain_id(int procID) const
mapping method "proc-id" ==> "subdomain-id"
Definition pcl_domain_decomposition.h:95
void set_num_subdomains(int numSubdomains)
Definition pcl_domain_decomposition.h:100
int m_num_subdomains
Definition pcl_domain_decomposition.h:134
int get_num_spatial_dimensions() const
Definition pcl_domain_decomposition.h:115
int m_num_spatial_dimensions
Definition pcl_domain_decomposition.h:137
virtual void get_subdomain_procs(std::vector< int > &procsOut, int subdomIndex)
Definition pcl_domain_decomposition.h:119
int get_num_subdomains() const
Definition pcl_domain_decomposition.h:109
StandardDomainDecompositionInfo()
constructors
Definition pcl_domain_decomposition.h:71
StandardDomainDecompositionInfo(int numSubdomains)
Definition pcl_domain_decomposition.h:77
~StandardDomainDecompositionInfo()
Definition pcl_domain_decomposition.h:130
int m_num_procs_per_subdomain
Definition pcl_domain_decomposition.h:141
void set_num_spatial_dimensions(int dim)
Definition pcl_domain_decomposition.h:111
int NumProcs()
returns the number of processes
Definition pcl_base.cpp:91
Definition parallel_grid_layout.h:46