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 IS for given order range (collective)
99  * \ingroup mofem_is_managers
100 
101  * \param problem name
102  * \param rc ROW or COL
103  * \param min_order
104  * \param max_order
105  * \retval is out value
106 
107  */
108  MoFEMErrorCode isCreateProblemOrder(const std::string problem_name,
109  RowColData rc, int min_order,
110  int max_order, IS *is) const;
111 
112  /**
113  * @copydoc MoFEM::ISManager::isCreateProblemOrder
114  */
115  MoFEMErrorCode isCreateProblemOrder(const std::string problem_name,
116  RowColData rc, int min_order,
117  int max_order,
118  SmartPetscObj<IS> &is) const;
119 
120  /**
121  * \brief create IS for given problem, field and rank range (collective)
122  * \ingroup mofem_is_managers
123 
124  * \param problem name
125  * \param rc ROW or COL
126  * \param field name
127  * \param min_coeff_idx
128  * \param max_coeff_idx
129  * \param ents if not null get dofs only on given entities
130  * \retval is out value
131 
132  */
133  MoFEMErrorCode isCreateProblemFieldAndRank(const std::string problem_name,
134  RowColData rc,
135  const std::string field,
136  int min_coeff_idx,
137  int max_coeff_idx, IS *is,
138  Range *ents = nullptr) const;
139 
140  /**
141  * \copybrief create IS for given problem, field and rank range (collective)
142  * \ingroup mofem_is_managers
143  *
144  * \param problem name
145  * \param rc ROW or COL
146  * \param field name
147  * \param min_coeff_idx
148  * \param max_coeff_idx
149  * \param ents if not null get dofs only on given entities
150  * \retval is out value
151  */
153  isCreateProblemFieldAndRank(const std::string problem_name, RowColData rc,
154  const std::string field, int min_coeff_idx,
155  int max_coeff_idx, SmartPetscObj<IS> &smart_is,
156  Range *ents = nullptr) const;
157 
158  /**
159  * \brief create IS for given problem, field and rank range (collective)
160  * \ingroup mofem_is_managers
161 
162  * \param problem name
163  * \param rc ROW or COL
164  * \param field name
165  * \param min_coeff_idx
166  * \param max_coeff_idx
167  * \param ents if not null get dofs only on given entities
168  * \retval is out value
169 
170  */
172  isCreateProblemFieldAndRankLocal(const std::string problem_name,
173  RowColData rc, const std::string field,
174  int min_coeff_idx, int max_coeff_idx, IS *is,
175  Range *ents = nullptr) const;
176 
177  /**
178  * \copybrief create IS for given problem, field and rank range (collective)
179  * \ingroup mofem_is_managers
180  *
181  * \param problem name
182  * \param rc ROW or COL
183  * \param field name
184  * \param min_coeff_idx
185  * \param max_coeff_idx
186  * \param ents if not null get dofs only on given entities
187  * \retval is out value
188  */
190  const std::string problem_name, RowColData rc, const std::string field,
191  int min_coeff_idx, int max_coeff_idx, SmartPetscObj<IS> &smart_is,
192  Range *ents = nullptr) const;
193 
194  /**
195  * @brief create IS for given problem, field and type range (collective)
196  * \ingroup mofem_is_managers
197  *
198  * @param problem
199  * @param rc
200  * @param field
201  * @param low_type
202  * @param hi_type
203  * @param min_coeff_idx
204  * @param max_coeff_idx
205  * @param is
206  * @param ents
207  * @return MoFEMErrorCode
208  */
210  const std::string problem_name, RowColData rc, const std::string field,
211  EntityType low_type, EntityType hi_type, int min_coeff_idx,
212  int max_coeff_idx, IS *is, Range *ents = nullptr) const;
213 
214  /** \brief create IS for give two problems and field
215  * \ingroup mofem_is_managers
216 
217  Note that indices are ordered in ascending order of local indices in
218  problem_y
219 
220  \param x_problem name of problem
221  \param x_field_name name of field in problem_x
222  \param x_rc that is ROW or COL
223  \param y_problem name of problem
224  \param y_field_name name of field in problem_y
225  \param y_rc that is ROW or COL
226 
227  \retval idx indexes in problem_x
228  \retval idy indexes in problem_y
229 
230  */
232  const std::string x_problem, const std::string x_field_name,
233  RowColData x_rc, const std::string y_problem,
234  const std::string y_field_name, RowColData y_rc, std::vector<int> &idx,
235  std::vector<int> &idy) const;
236 
237  /** \brief create IS for give two problems and field
238  * \ingroup mofem_is_managers
239 
240  Indices are sorted by global PETSc index in problem_x.
241 
242  \param x_problem name of problem
243  \param x_field_name name of field in problem_x
244  \param x_rc that is ROW or COL
245  \param y_problem name of problem
246  \param y_field_name name of field in problem_y
247  \param y_rc that is ROW or COL
248 
249  \retval ix IS indexes in problem_x (can be PETSC_NULL)
250  \retval iy IS indexes in problem_y
251 
252  */
254  const std::string x_problem, const std::string x_field_name,
255  RowColData x_rc, const std::string y_problem,
256  const std::string y_field_name, RowColData y_rc, IS *ix, IS *iy) const;
257 
258  /**
259  * @brief Create is from one problem to other problem
260  * @ingroup mofem_is_managers
261  *
262  * @param x_problem
263  * @param x_rc
264  * @param y_problem
265  * @param y_rc
266  * @param idx
267  * @param idy
268  * @return MoFEMErrorCode
269  */
271  const std::string x_problem, RowColData x_rc, const std::string y_problem,
272  RowColData y_rc, std::vector<int> &idx, std::vector<int> &idy) const;
273 
274  /**
275  * @brief Create is from one problem to other problem
276  * @ingroup mofem_is_managers
277  *
278  * @param x_problem
279  * @param x_rc
280  * @param y_problem
281  * @param y_rc
282  * @param ix
283  * @param iy
284  * @return MoFEMErrorCode
285  */
286  MoFEMErrorCode isCreateFromProblemToOtherProblem(const std::string x_problem,
287  RowColData x_rc,
288  const std::string y_problem,
289  RowColData y_rc, IS *ix,
290  IS *iy) const;
291 };
292 
293 } // namespace MoFEM
294 
295 /**
296  * \defgroup mofem_is_managers Index sets (IS)
297  * \brief Construct index sets for MoFEM problems
298  *
299  * \ingroup mofem
300  */
301 
302 #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:265
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:467
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:123
COL
@ COL
Definition: definitions.h:123
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:350
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:592
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:449
MoFEM::SmartPetscObj
intrusive_ptr for managing petsc objects
Definition: PetscSmartObj.hpp:78
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:197
MoFEM::ISManager::~ISManager
virtual ~ISManager()=default
Destructor.