v0.10.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 /*
10  * MoFEM is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13  * License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with MoFEM. If not, see <http://www.gnu.org/licenses/>
17  */
18 
19 #ifndef _ISMANAGER_HPP__
20 #define _ISMANAGER_HPP__
21 
22 #include "UnknownInterface.hpp"
23 
24 namespace MoFEM {
25 
28 
29 /**
30  * \brief Section manager is used to create indexes and sections
31  * \ingroup mofem_is_managers
32  *
33  * FIXME: ISManager is not properly testsed by atom tests.
34  *
35  */
36 struct ISManager : public UnknownInterface {
37 
39  UnknownInterface **iface) const;
40 
42  bool dEbug;
43 
44  ISManager(const MoFEM::Core &core);
45 
46  /**
47  * \brief Destructor
48  */
49  virtual ~ISManager() = default;
50 
51  /**
52  * \brief Create global selection
53  * \ingroup mofem_is_managers
54  *
55  * Create section for given problem, such that points are sorted by UId,
56  * and number of dofs on point is equal to number of dofs on entity
57  *
58  * It takes all fields
59  *
60  * @param problem_name
61  * @param fields_list
62  * @param s
63  * @param row_col ROE or COL, default is ROW
64  * @return error code
65  */
66  MoFEMErrorCode sectionCreate(const std::string &problem_name, PetscSection *s,
67  const RowColData row_col = COL) const;
68 
69  /**
70  * \brief create IS for given order range (collective)
71  * \ingroup mofem_is_managers
72 
73  * \param problem name
74  * \param rc ROW or COL
75  * \param min_order
76  * \param max_order
77  * \retval is out value
78 
79  */
80  MoFEMErrorCode isCreateProblemOrder(const std::string &problem, RowColData rc,
81  int min_order, int max_order,
82  IS *is) const;
83 
84  /**
85  * @copydoc MoFEM::ISManager::isCreateProblemOrder
86  */
87  MoFEMErrorCode isCreateProblemOrder(const std::string &problem, RowColData rc,
88  int min_order, int max_order,
89  SmartPetscObj<IS> &is) const;
90 
91  /**
92  * \brief create IS for given problem, field and rank range (collective)
93  * \ingroup mofem_is_managers
94 
95  * \param problem name
96  * \param rc ROW or COL
97  * \param field name
98  * \param min_coeff_idx
99  * \param max_coeff_idx
100  * \param ents if not null get dofs only on given entities
101  * \retval is out value
102 
103  */
104  MoFEMErrorCode isCreateProblemFieldAndRank(const std::string &problem,
105  RowColData rc,
106  const std::string &field,
107  int min_coeff_idx,
108  int max_coeff_idx, IS *is,
109  Range *ents = nullptr) const;
110 
111  /**
112  * \copybrief create IS for given problem, field and rank range (collective)
113  * \ingroup mofem_is_managers
114  *
115  * \param problem name
116  * \param rc ROW or COL
117  * \param field name
118  * \param min_coeff_idx
119  * \param max_coeff_idx
120  * \param ents if not null get dofs only on given entities
121  * \retval is out value
122  */
124  isCreateProblemFieldAndRank(const std::string &problem, RowColData rc,
125  const std::string &field, int min_coeff_idx,
126  int max_coeff_idx, SmartPetscObj<IS> &smart_is,
127  Range *ents = nullptr) const;
128 
129  /**
130  * @brief create IS for given problem, field and type range (collective)
131  * \ingroup mofem_is_managers
132  *
133  * @param problem
134  * @param rc
135  * @param field
136  * @param low_type
137  * @param hi_type
138  * @param min_coeff_idx
139  * @param max_coeff_idx
140  * @param is
141  * @param ents
142  * @return MoFEMErrorCode
143  */
145  const std::string &problem, RowColData rc, const std::string &field,
146  EntityType low_type, EntityType hi_type, int min_coeff_idx,
147  int max_coeff_idx, IS *is, Range *ents = nullptr) const;
148 
149  /** \brief create IS for give two problems and field
150  * \ingroup mofem_is_managers
151 
152  Note that indices are ordered in ascending order of local indices in
153  problem_y
154 
155  \param x_problem name of problem
156  \param x_field_name name of field in problem_x
157  \param x_rc that is ROW or COL
158  \param y_problem name of problem
159  \param y_field_name name of field in problem_y
160  \param y_rc that is ROW or COL
161 
162  \retval idx indexes in problem_x
163  \retval idy indexes in problem_y
164 
165  */
167  const std::string &x_problem, const std::string &x_field_name,
168  RowColData x_rc, const std::string &y_problem,
169  const std::string &y_field_name, RowColData y_rc, std::vector<int> &idx,
170  std::vector<int> &idy) const;
171 
172  /** \brief create IS for give two problems and field
173  * \ingroup mofem_is_managers
174 
175  Indices are sorted by global PETSc index in problem_x.
176 
177  \param x_problem name of problem
178  \param x_field_name name of field in problem_x
179  \param x_rc that is ROW or COL
180  \param y_problem name of problem
181  \param y_field_name name of field in problem_y
182  \param y_rc that is ROW or COL
183 
184  \retval ix IS indexes in problem_x (can be PETSC_NULL)
185  \retval iy IS indexes in problem_y
186 
187  */
189  const std::string &x_problem, const std::string &x_field_name,
190  RowColData x_rc, const std::string &y_problem,
191  const std::string &y_field_name, RowColData y_rc, IS *ix, IS *iy) const;
192 
193  /**
194  * @brief Create is from one problem to other problem
195  * @ingroup mofem_is_managers
196  *
197  * @param x_problem
198  * @param x_rc
199  * @param y_problem
200  * @param y_rc
201  * @param idx
202  * @param idy
203  * @return MoFEMErrorCode
204  */
205  MoFEMErrorCode isCreateFromProblemToOtherProblem(const std::string &x_problem,
206  RowColData x_rc,
207  const std::string &y_problem,
208  RowColData y_rc,
209  std::vector<int> &idx,
210  std::vector<int> &idy) const;
211 
212  /**
213  * @brief Create is from one problem to other problem
214  * @ingroup mofem_is_managers
215  *
216  * @param x_problem
217  * @param x_rc
218  * @param y_problem
219  * @param y_rc
220  * @param ix
221  * @param iy
222  * @return MoFEMErrorCode
223  */
224  MoFEMErrorCode isCreateFromProblemToOtherProblem(const std::string &x_problem,
225  RowColData x_rc,
226  const std::string &y_problem,
227  RowColData y_rc, IS *ix,
228  IS *iy) const;
229 };
230 
231 } // namespace MoFEM
232 
233 /**
234  * \defgroup mofem_is_managers Index sets (IS)
235  * \brief Construct index sets for MoFEM problems
236  *
237  * \ingroup mofem
238  */
239 
240 #endif // _ISMANAGER_HPP__
MoFEM interface.
@ ISMANAGER_INTERFACE
Definition: definitions.h:55
RowColData
RowColData.
Definition: definitions.h:192
@ COL
Definition: definitions.h:192
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:454
MoFEMErrorCode isCreateProblemOrder(const std::string &problem, RowColData rc, int min_order, int max_order, IS *is) const
create IS for given order range (collective)
Definition: ISManager.cpp:159
MoFEMErrorCode isCreateProblemFieldAndRank(const std::string &problem, 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:227
MoFEMErrorCode sectionCreate(const std::string &problem_name, PetscSection *s, const RowColData row_col=COL) const
Create global selection.
Definition: ISManager.cpp:37
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:330
MoFEMErrorCode isCreateProblemFieldAndEntityType(const std::string &problem, 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:312
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:67
std::bitset< BITINTERFACEUID_SIZE > BitIntefaceId
Definition: Types.hpp:56
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
static const MOFEMuuid IDD_MOFEMISManager
Definition: ISManager.hpp:26
Core (interface) class.
Definition: Core.hpp:77
Deprecated interface functions.
Section manager is used to create indexes and sections.
Definition: ISManager.hpp:36
const MoFEM::Interface & cOre
Definition: ISManager.hpp:41
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
Definition: ISManager.cpp:22
virtual ~ISManager()=default
Destructor.
ISManager(const MoFEM::Core &core)
Definition: ISManager.cpp:34
MoFEM interface unique ID.
base class for all interface classes