v0.8.23
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  ~ISManager();
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  * \brief create IS for given problem, field and rank range (collective)
86  * \ingroup mofem_is_managers
87 
88  * \param problem name
89  * \param rc ROW or COL
90  * \param field name
91  * \param min_coeff_idx
92  * \param max_coeff_idx
93  * \param ents if not null get dofs only on given entities
94  * \retval is out value
95 
96  */
97  MoFEMErrorCode isCreateProblemFieldAndRank(const std::string &problem,
98  RowColData rc,
99  const std::string &field,
100  int min_coeff_idx,
101  int max_coeff_idx, IS *is,
102  Range *ents = nullptr) const;
103 
104  /**
105  * @brief create IS for given problem, field and type range (collective)
106  * \ingroup mofem_is_managers
107  *
108  * @param problem
109  * @param rc
110  * @param field
111  * @param low_type
112  * @param hi_type
113  * @param min_coeff_idx
114  * @param max_coeff_idx
115  * @param is
116  * @param ents
117  * @return MoFEMErrorCode
118  */
120  isCreateProblemFieldAndEntityType(const std::string &problem, RowColData rc,
121  const std::string &field,
122  EntityType low_type, EntityType hi_type,
123  int min_coeff_idx, int max_coeff_idx,
124  IS *is, Range *ents = nullptr) const;
125 
126  /** \brief create IS for give two problems and field
127  * \ingroup mofem_is_managers
128 
129  Note that indices are ordered in ascending order of local indices in
130  problem_y
131 
132  \param x_problem name of problem
133  \param x_field_name name of field in problem_x
134  \param x_rc that is ROW or COL
135  \param y_problem name of problem
136  \param y_field_name name of field in problem_y
137  \param y_rc that is ROW or COL
138 
139  \retval idx indexes in problem_x
140  \retval idy indexes in problem_y
141 
142  */
144  const std::string &x_problem, const std::string &x_field_name,
145  RowColData x_rc, const std::string &y_problem,
146  const std::string &y_field_name, RowColData y_rc, std::vector<int> &idx,
147  std::vector<int> &idy) const;
148 
149  /** \brief create IS for give two problems and field
150  * \ingroup mofem_is_managers
151 
152  Indices are sorted by global PETSc index in problem_x.
153 
154  \param x_problem name of problem
155  \param x_field_name name of field in problem_x
156  \param x_rc that is ROW or COL
157  \param y_problem name of problem
158  \param y_field_name name of field in problem_y
159  \param y_rc that is ROW or COL
160 
161  \retval ix IS indexes in problem_x (can be PETSC_NULL)
162  \retval iy IS indexes in problem_y
163 
164  */
166  const std::string &x_problem, const std::string &x_field_name,
167  RowColData x_rc, const std::string &y_problem,
168  const std::string &y_field_name, RowColData y_rc, IS *ix, IS *iy) const;
169 
170  /**
171  * @brief Create is from one problem to other problem
172  * @ingroup mofem_is_managers
173  *
174  * @param x_problem
175  * @param x_rc
176  * @param y_problem
177  * @param y_rc
178  * @param idx
179  * @param idy
180  * @return MoFEMErrorCode
181  */
182  MoFEMErrorCode isCreateFromProblemToOtherProblem(const std::string &x_problem,
183  RowColData x_rc,
184  const std::string &y_problem,
185  RowColData y_rc,
186  std::vector<int> &idx,
187  std::vector<int> &idy) const;
188 
189  /**
190  * @brief Create is from one problem to other problem
191  * @ingroup mofem_is_managers
192  *
193  * @param x_problem
194  * @param x_rc
195  * @param y_problem
196  * @param y_rc
197  * @param ix
198  * @param iy
199  * @return MoFEMErrorCode
200  */
201  MoFEMErrorCode isCreateFromProblemToOtherProblem(const std::string &x_problem,
202  RowColData x_rc,
203  const std::string &y_problem,
204  RowColData y_rc, IS *ix,
205  IS *iy) const;
206 };
207 
208 } // namespace MoFEM
209 
210 /**
211  * \defgroup mofem_is_managers Index sets (IS)
212  * \brief Construct index sets for MoFEM problems
213  *
214  * \ingroup mofem
215  */
216 
217 #endif // _ISMANAGER_HPP__
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 fieldNote that indices are ordered in ascending order of local in...
Definition: ISManager.cpp:321
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
Definition: ISManager.cpp:22
MoFEM interface unique ID.
Section manager is used to create indexes and sectionsFIXME: ISManager is not properly testsed by ato...
Definition: ISManager.hpp:36
MoFEMErrorCode sectionCreate(const std::string &problem_name, PetscSection *s, const RowColData row_col=COL) const
Create global selectionCreate section for given problem, such that points are sorted by UId,...
Definition: ISManager.cpp:38
base class for all interface classes
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:303
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:233
Core (interface) class.
Definition: Core.hpp:50
MoFEM interface.
RowColData
RowColData.
Definition: definitions.h:185
std::bitset< BITINTERFACEUID_SIZE > BitIntefaceId
Definition: Types.hpp:56
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:21
ISManager(const MoFEM::Core &core)
Definition: ISManager.cpp:34
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:66
~ISManager()
Destructor.
Definition: ISManager.cpp:36
const MoFEM::Interface & cOre
Definition: ISManager.hpp:41
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:438
static const MOFEMuuid IDD_MOFEMISManager
Definition: ISManager.hpp:26
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:176