v0.14.0
ISManager.hpp
Go to the documentation of this file.
1 /** \file ISManager.hpp
2  * \brief Interface managing IS
3  * \ingroup mofem_is_managers
4  *
5  * Managing problems, build and partitioning.
6  *
7  */
8 
9 #ifndef _ISMANAGER_HPP__
10 #define _ISMANAGER_HPP__
11 
12 #include "UnknownInterface.hpp"
13 
14 namespace MoFEM {
15 
16 /**
17  * \brief Section manager is used to create indexes and sections
18  * \ingroup mofem_is_managers
19  *
20  * FIXME: ISManager is not properly tested by atom tests.
21  *
22  */
23 struct ISManager : public UnknownInterface {
24 
25  MoFEMErrorCode query_interface(boost::typeindex::type_index type_index,
26  UnknownInterface **iface) const;
27 
29  bool dEbug;
30 
31  ISManager(const MoFEM::Core &core);
32 
33  /**
34  * \brief Destructor
35  */
36  virtual ~ISManager() = default;
37 
38  /**
39  * \brief Create global selection
40  * \ingroup mofem_is_managers
41  *
42  * Create section for given problem, such that points are sorted by UId,
43  * and number of dofs on point is equal to number of dofs on entity
44  *
45  * It takes all fields
46  *
47  * @param problem_name
48  * @param fields_list
49  * @param s
50  * @param row_col ROE or COL, default is ROW
51  * @return error code
52  */
53  MoFEMErrorCode sectionCreate(const std::string problem_name, PetscSection *s,
54  const RowColData row_col = COL) const;
55 
56  /**
57  * \brief Create global selection
58  * \ingroup mofem_is_managers
59  *
60  * Create section for given problem, such that points are sorted by UId,
61  * and number of dofs on point is equal to number of dofs on entity
62  *
63  * It takes all fields
64  *
65  * @param problem_name
66  * @param fields_list
67  * @param s
68  * @param row_col ROE or COL, default is ROW
69  * @return error code
70  */
72  sectionCreate(const std::string problem_name,
73  const RowColData row_col = COL) const;
74 
75  /**
76  * @brief Create IS for problem
77  *
78  * @param problem_name
79  * @param rc
80  * @param is
81  * @return MoFEMErrorCode
82  */
83  MoFEMErrorCode isCreateProblem(const std::string problem_name, RowColData rc,
84  IS *is) const;
85 
86  /**
87  * @brief Create IS for problem
88  *
89  * @param problem_name
90  * @param rc
91  * @param is
92  * @return MoFEMErrorCode
93  */
94  MoFEMErrorCode isCreateProblem(const std::string problem_name, RowColData rc,
95  SmartPetscObj<IS> &is) const;
96 
97  /**
98  * @brief Create problem IS
99  *
100  * @param problem_name
101  * @param rc
102  * @return SmartPetscObj<IS>
103  */
104  SmartPetscObj<IS> isCreateProblem(std::string problem_name,
105  RowColData rc) const;
106 
107  /**
108  * \brief create IS for given order range (collective)
109  * \ingroup mofem_is_managers
110 
111  * \param problem name
112  * \param rc ROW or COL
113  * \param min_order
114  * \param max_order
115  * \retval is out value
116 
117  */
118  MoFEMErrorCode isCreateProblemOrder(const std::string problem_name,
119  RowColData rc, int min_order,
120  int max_order, IS *is) const;
121 
122  /**
123  * @copydoc MoFEM::ISManager::isCreateProblemOrder
124  */
125  MoFEMErrorCode isCreateProblemOrder(const std::string problem_name,
126  RowColData rc, int min_order,
127  int max_order,
128  SmartPetscObj<IS> &is) const;
129 
130  /**
131  * \brief create IS for given problem, field and rank range (collective)
132  * \ingroup mofem_is_managers
133 
134  * \param problem name
135  * \param rc ROW or COL
136  * \param field name
137  * \param min_coeff_idx
138  * \param max_coeff_idx
139  * \param ents if not null get dofs only on given entities
140  * \retval is out value
141 
142  */
143  MoFEMErrorCode isCreateProblemFieldAndRank(const std::string problem_name,
144  RowColData rc,
145  const std::string field,
146  int min_coeff_idx,
147  int max_coeff_idx, IS *is,
148  Range *ents = nullptr) const;
149 
150  /**
151  * \copybrief create IS for given problem, field and rank range (collective)
152  * \ingroup mofem_is_managers
153  *
154  * \param problem name
155  * \param rc ROW or COL
156  * \param field name
157  * \param min_coeff_idx
158  * \param max_coeff_idx
159  * \param ents if not null get dofs only on given entities
160  * \retval is out value
161  */
163  isCreateProblemFieldAndRank(const std::string problem_name, RowColData rc,
164  const std::string field, int min_coeff_idx,
165  int max_coeff_idx, SmartPetscObj<IS> &smart_is,
166  Range *ents = nullptr) const;
167 
168  /**
169  * \brief create IS for given problem, field and rank range (collective)
170  * \ingroup mofem_is_managers
171 
172  * \param problem name
173  * \param rc ROW or COL
174  * \param field name
175  * \param min_coeff_idx
176  * \param max_coeff_idx
177  * \param ents if not null get dofs only on given entities
178  * \retval is out value
179 
180  */
182  isCreateProblemFieldAndRankLocal(const std::string problem_name,
183  RowColData rc, const std::string field,
184  int min_coeff_idx, int max_coeff_idx, IS *is,
185  Range *ents = nullptr) const;
186 
187  /**
188  * \copybrief create IS for given problem, field and rank range (collective)
189  * \ingroup mofem_is_managers
190  *
191  * \param problem name
192  * \param rc ROW or COL
193  * \param field name
194  * \param min_coeff_idx
195  * \param max_coeff_idx
196  * \param ents if not null get dofs only on given entities
197  * \retval is out value
198  */
200  const std::string problem_name, RowColData rc, const std::string field,
201  int min_coeff_idx, int max_coeff_idx, SmartPetscObj<IS> &smart_is,
202  Range *ents = nullptr) const;
203 
204  /**
205  * @brief create IS for given problem, field and type range (collective)
206  * \ingroup mofem_is_managers
207  *
208  * @param problem
209  * @param rc
210  * @param field
211  * @param low_type
212  * @param hi_type
213  * @param min_coeff_idx
214  * @param max_coeff_idx
215  * @param is
216  * @param ents
217  * @return MoFEMErrorCode
218  */
220  const std::string problem_name, RowColData rc, const std::string field,
221  EntityType low_type, EntityType hi_type, int min_coeff_idx,
222  int max_coeff_idx, IS *is, Range *ents = nullptr) const;
223 
224  /** \brief create IS for give two problems and field
225  * \ingroup mofem_is_managers
226 
227  Note that indices are ordered in ascending order of local indices in
228  problem_y
229 
230  \param x_problem name of problem
231  \param x_field_name name of field in problem_x
232  \param x_rc that is ROW or COL
233  \param y_problem name of problem
234  \param y_field_name name of field in problem_y
235  \param y_rc that is ROW or COL
236 
237  \retval idx indexes in problem_x
238  \retval idy indexes in problem_y
239 
240  */
242  const std::string x_problem, const std::string x_field_name,
243  RowColData x_rc, const std::string y_problem,
244  const std::string y_field_name, RowColData y_rc, std::vector<int> &idx,
245  std::vector<int> &idy) const;
246 
247  /** \brief create IS for give two problems and field
248  * \ingroup mofem_is_managers
249 
250  Indices are sorted by global PETSc index in problem_x.
251 
252  \param x_problem name of problem
253  \param x_field_name name of field in problem_x
254  \param x_rc that is ROW or COL
255  \param y_problem name of problem
256  \param y_field_name name of field in problem_y
257  \param y_rc that is ROW or COL
258 
259  \retval ix IS indexes in problem_x (can be PETSC_NULL)
260  \retval iy IS indexes in problem_y
261 
262  */
264  const std::string x_problem, const std::string x_field_name,
265  RowColData x_rc, const std::string y_problem,
266  const std::string y_field_name, RowColData y_rc, IS *ix, IS *iy) const;
267 
268  /**
269  * @brief Create is from one problem to other problem
270  * @ingroup mofem_is_managers
271  *
272  * @param x_problem
273  * @param x_rc
274  * @param y_problem
275  * @param y_rc
276  * @param idx
277  * @param idy
278  * @return MoFEMErrorCode
279  */
281  const std::string x_problem, RowColData x_rc, const std::string y_problem,
282  RowColData y_rc, std::vector<int> &idx, std::vector<int> &idy) const;
283 
284  /**
285  * @brief Create is from one problem to other problem
286  * @ingroup mofem_is_managers
287  *
288  * @param x_problem
289  * @param x_rc
290  * @param y_problem
291  * @param y_rc
292  * @param ix
293  * @param iy
294  * @return MoFEMErrorCode
295  */
296  MoFEMErrorCode isCreateFromProblemToOtherProblem(const std::string x_problem,
297  RowColData x_rc,
298  const std::string y_problem,
299  RowColData y_rc, IS *ix,
300  IS *iy) const;
301 };
302 
303 } // namespace MoFEM
304 
305 /**
306  * \defgroup mofem_is_managers Index sets (IS)
307  * \brief Construct index sets for MoFEM problems
308  *
309  * \ingroup mofem
310  */
311 
312 #endif // _ISMANAGER_HPP__
MoFEM::ISManager::isCreateProblemFieldAndRank
MoFEMErrorCode isCreateProblemFieldAndRank(const std::string problem_name, RowColData rc, const std::string field, int min_coeff_idx, int max_coeff_idx, IS *is, Range *ents=nullptr) const
create IS for given problem, field and rank range (collective)
Definition: ISManager.cpp:272
MoFEM::CoreTmp< 0 >
Core (interface) class.
Definition: Core.hpp:82
MoFEM::ISManager::query_interface
MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const
Definition: ISManager.cpp:10
MoFEM::ISManager::isCreateFromProblemFieldToOtherProblemField
MoFEMErrorCode isCreateFromProblemFieldToOtherProblemField(const std::string x_problem, const std::string x_field_name, RowColData x_rc, const std::string y_problem, const std::string y_field_name, RowColData y_rc, std::vector< int > &idx, std::vector< int > &idy) const
create IS for give two problems and field
Definition: ISManager.cpp:474
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::DeprecatedCoreInterface
Deprecated interface functions.
Definition: DeprecatedCoreInterface.hpp:16
MoFEM::ISManager::isCreateProblem
MoFEMErrorCode isCreateProblem(const std::string problem_name, RowColData rc, IS *is) const
Create IS for problem.
Definition: ISManager.cpp:149
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
MoFEM::ISManager
Section manager is used to create indexes and sections.
Definition: ISManager.hpp:23
MoFEM::ISManager::cOre
const MoFEM::Interface & cOre
Definition: ISManager.hpp:28
RowColData
RowColData
RowColData.
Definition: definitions.h:136
COL
@ COL
Definition: definitions.h:136
UnknownInterface.hpp
MoFEM interface.
MoFEM::ISManager::dEbug
bool dEbug
Definition: ISManager.hpp:29
MoFEM::ISManager::isCreateProblemFieldAndRankLocal
MoFEMErrorCode isCreateProblemFieldAndRankLocal(const std::string problem_name, RowColData rc, const std::string field, int min_coeff_idx, int max_coeff_idx, IS *is, Range *ents=nullptr) const
create IS for given problem, field and rank range (collective)
Definition: ISManager.cpp:357
MoFEM::UnknownInterface
base class for all interface classes
Definition: UnknownInterface.hpp:34
MoFEM::ISManager::ISManager
ISManager(const MoFEM::Core &core)
Definition: ISManager.cpp:17
Range
MoFEM::ISManager::isCreateFromProblemToOtherProblem
MoFEMErrorCode isCreateFromProblemToOtherProblem(const std::string x_problem, RowColData x_rc, const std::string y_problem, RowColData y_rc, std::vector< int > &idx, std::vector< int > &idy) const
Create is from one problem to other problem.
Definition: ISManager.cpp:599
MoFEM::ISManager::sectionCreate
MoFEMErrorCode sectionCreate(const std::string problem_name, PetscSection *s, const RowColData row_col=COL) const
Create global selection.
Definition: ISManager.cpp:20
MoFEM::ISManager::isCreateProblemFieldAndEntityType
MoFEMErrorCode isCreateProblemFieldAndEntityType(const std::string problem_name, RowColData rc, const std::string field, EntityType low_type, EntityType hi_type, int min_coeff_idx, int max_coeff_idx, IS *is, Range *ents=nullptr) const
create IS for given problem, field and type range (collective)
Definition: ISManager.cpp:456
MoFEM::SmartPetscObj
intrusive_ptr for managing petsc objects
Definition: PetscSmartObj.hpp:82
MoFEM::ISManager::isCreateProblemOrder
MoFEMErrorCode isCreateProblemOrder(const std::string problem_name, RowColData rc, int min_order, int max_order, IS *is) const
create IS for given order range (collective)
Definition: ISManager.cpp:204
MoFEM::ISManager::~ISManager
virtual ~ISManager()=default
Destructor.