v0.9.1
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  * \copybrief create IS for given problem, field and rank range (collective)
106  * \ingroup mofem_is_managers
107  *
108  * \param problem name
109  * \param rc ROW or COL
110  * \param field name
111  * \param min_coeff_idx
112  * \param max_coeff_idx
113  * \param ents if not null get dofs only on given entities
114  * \retval is out value
115  */
117  isCreateProblemFieldAndRank(const std::string &problem, RowColData rc,
118  const std::string &field, int min_coeff_idx,
119  int max_coeff_idx, SmartPetscObj<IS> &smart_is,
120  Range *ents = nullptr) const;
121 
122  /**
123  * @brief create IS for given problem, field and type range (collective)
124  * \ingroup mofem_is_managers
125  *
126  * @param problem
127  * @param rc
128  * @param field
129  * @param low_type
130  * @param hi_type
131  * @param min_coeff_idx
132  * @param max_coeff_idx
133  * @param is
134  * @param ents
135  * @return MoFEMErrorCode
136  */
138  const std::string &problem, RowColData rc, const std::string &field,
139  EntityType low_type, EntityType hi_type, int min_coeff_idx,
140  int max_coeff_idx, IS *is, Range *ents = nullptr) const;
141 
142  /** \brief create IS for give two problems and field
143  * \ingroup mofem_is_managers
144 
145  Note that indices are ordered in ascending order of local indices in
146  problem_y
147 
148  \param x_problem name of problem
149  \param x_field_name name of field in problem_x
150  \param x_rc that is ROW or COL
151  \param y_problem name of problem
152  \param y_field_name name of field in problem_y
153  \param y_rc that is ROW or COL
154 
155  \retval idx indexes in problem_x
156  \retval idy indexes in problem_y
157 
158  */
160  const std::string &x_problem, const std::string &x_field_name,
161  RowColData x_rc, const std::string &y_problem,
162  const std::string &y_field_name, RowColData y_rc, std::vector<int> &idx,
163  std::vector<int> &idy) const;
164 
165  /** \brief create IS for give two problems and field
166  * \ingroup mofem_is_managers
167 
168  Indices are sorted by global PETSc index in problem_x.
169 
170  \param x_problem name of problem
171  \param x_field_name name of field in problem_x
172  \param x_rc that is ROW or COL
173  \param y_problem name of problem
174  \param y_field_name name of field in problem_y
175  \param y_rc that is ROW or COL
176 
177  \retval ix IS indexes in problem_x (can be PETSC_NULL)
178  \retval iy IS indexes in problem_y
179 
180  */
182  const std::string &x_problem, const std::string &x_field_name,
183  RowColData x_rc, const std::string &y_problem,
184  const std::string &y_field_name, RowColData y_rc, IS *ix, IS *iy) const;
185 
186  /**
187  * @brief Create is from one problem to other problem
188  * @ingroup mofem_is_managers
189  *
190  * @param x_problem
191  * @param x_rc
192  * @param y_problem
193  * @param y_rc
194  * @param idx
195  * @param idy
196  * @return MoFEMErrorCode
197  */
198  MoFEMErrorCode isCreateFromProblemToOtherProblem(const std::string &x_problem,
199  RowColData x_rc,
200  const std::string &y_problem,
201  RowColData y_rc,
202  std::vector<int> &idx,
203  std::vector<int> &idy) const;
204 
205  /**
206  * @brief Create is from one problem to other problem
207  * @ingroup mofem_is_managers
208  *
209  * @param x_problem
210  * @param x_rc
211  * @param y_problem
212  * @param y_rc
213  * @param ix
214  * @param iy
215  * @return MoFEMErrorCode
216  */
217  MoFEMErrorCode isCreateFromProblemToOtherProblem(const std::string &x_problem,
218  RowColData x_rc,
219  const std::string &y_problem,
220  RowColData y_rc, IS *ix,
221  IS *iy) const;
222 };
223 
224 } // namespace MoFEM
225 
226 /**
227  * \defgroup mofem_is_managers Index sets (IS)
228  * \brief Construct index sets for MoFEM problems
229  *
230  * \ingroup mofem
231  */
232 
233 #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:333
MoFEMErrorCode query_interface(const MOFEMuuid &uuid, UnknownInterface **iface) const
Definition: ISManager.cpp:22
Deprecated interface functions.
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:315
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:191
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:450
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
intrusive_ptr for managing petsc objects
Definition: AuxPETSc.hpp:128