18 : cOre(const_cast<
MoFEM::
Core &>(core)), dEbug(false) {}
30 "field < %s > not found, (top tip: check spelling)",
34 auto wrap_lambda_on_enties =
35 [
lambda](boost::shared_ptr<FieldEntity> field_entity_ptr) {
38 auto field_data = field_entity_ptr->getEntFieldData();
39 for (
auto &
v : field_data)
61 "field < %s > not found, (top tip: check spelling)",
66 const auto bit_number = (*fit)->getBitNumber();
75 auto eit = field_ents->get<
Unique_mi_tag>().lower_bound(lo_uid);
77 auto eit_hi = field_ents->get<
Unique_mi_tag>().upper_bound(hi_uid);
79 for (; eit != eit_hi; ++eit) {
87 for (
auto p = ents_ptr->const_pair_begin(); p != ents_ptr->const_pair_end();
89 CHKERR loop_ents(p->first, p->second);
94 CHKERR loop_ents(get_id_for_min_type<MBVERTEX>(),
95 get_id_for_max_type<MBENTITYSET>());
103 const std::string field_name_y,
bool error_if_missing,
Range *ents_ptr) {
111 "x field < %s > not found, (top tip: check spelling)",
112 field_name_x.c_str());
117 "y field < %s > not found, (top tip: check spelling)",
118 field_name_y.c_str());
120 if ((*x_fit)->getSpace() != (*y_fit)->getSpace()) {
122 "space for field < %s > and field <%s> are not compatible for "
124 field_name_x.c_str(), field_name_y.c_str());
126 if ((*x_fit)->getNbOfCoeffs() != (*y_fit)->getNbOfCoeffs()) {
129 "rank for field < %s > and field <%s> are not compatible for fieldblas",
130 field_name_x.c_str(), field_name_y.c_str());
133 auto wrap_lambda_on_enties =
134 [
lambda](boost::shared_ptr<FieldEntity> y_field_entity_ptr,
135 const boost::shared_ptr<FieldEntity> x_field_entity_ptr) {
138 auto x_field_data = x_field_entity_ptr->getEntFieldData();
139 auto y_field_data = y_field_entity_ptr->getEntFieldData();
140 const auto size_x = x_field_data.size();
141 const auto size_y = y_field_data.size();
144 for (;
dd != std::min(size_x, size_y); ++
dd)
145 y_field_data[
dd] =
lambda(y_field_data[
dd], x_field_data[
dd]);
146 for (;
dd < size_y; ++
dd)
147 y_field_data[
dd] = 0;
153 field_name_y, error_if_missing, ents_ptr);
159 const std::string field_name_x,
160 const std::string field_name_y,
161 bool error_if_missing,
Range *ents_ptr) {
170 "x field < %s > not found, (top tip: check spelling)",
171 field_name_x.c_str());
176 "y field < %s > not found, (top tip: check spelling)",
177 field_name_y.c_str());
181 const auto x_bit_number = (*x_fit)->getBitNumber();
182 const auto y_bit_number = (*y_fit)->getBitNumber();
183 const auto y_eit_hi = field_ents->get<
Unique_mi_tag>().upper_bound(
189 const auto x_lo_uid =
191 const auto x_hi_uid =
195 auto x_eit = field_ents->get<
Unique_mi_tag>().lower_bound(x_lo_uid);
197 auto x_eit_hi = field_ents->get<
Unique_mi_tag>().upper_bound(x_hi_uid);
199 for (; x_eit != x_eit_hi;) {
202 (*y_fit)->getBitNumber(), (*x_eit)->getEnt());
203 auto y_eit = field_ents->get<
Unique_mi_tag>().find(y_lo_uid);
205 if (y_eit == field_ents->end()) {
207 if (error_if_missing) {
209 "Missing entity in y_field.");
217 if (x_eit == x_eit_hi)
219 if (y_eit == y_eit_hi)
221 if ((*y_eit)->getEnt() != (*x_eit)->getEnt())
241 for (
auto p = ents_ptr->const_pair_begin(); p != ents_ptr->const_pair_end();
243 CHKERR loop_ents(p->first, p->second);
248 CHKERR loop_ents(get_id_for_min_type<MBVERTEX>(),
249 get_id_for_max_type<MBENTITYSET>());
256 const std::string field_name_x,
257 const std::string field_name_y,
258 bool error_if_missing,
259 bool create_if_missing) {
260 if (create_if_missing)
262 <<
"Option create_if_missing is set to true but have no effect";
268 const std::string field_name_x,
269 const std::string field_name_y,
270 bool error_if_missing,
Range *ents_ptr) {
272 auto axpy = [alpha](
const double fy,
const double fx) {
273 return fy + alpha * fx;
281 const std::string field_name_x,
282 const std::string field_name_y,
283 bool error_if_missing,
284 bool create_if_missing) {
285 return fieldAxpy(alpha, field_name_x, field_name_y, error_if_missing);
289 const std::string field_name_x,
290 const std::string field_name_y,
291 bool error_if_missing,
Range *ents_ptr) {
293 auto copy = [alpha](
const double fy,
const double fx) {
return alpha * fx; };
300 const std::string field_name_x,
301 const std::string field_name_y,
302 bool error_if_missing,
303 bool create_if_missing) {
304 return fieldCopy(alpha, field_name_x, field_name_y, error_if_missing);
312 auto scale = [alpha](
const double v) {
return v * alpha; };
326 CHKERR m_field.
get_moab().get_entities_by_type(meshset, MBVERTEX, verts,
329 verts = intersect(*sub_verts, verts);
335 count(0), total(0) {}
342 if (*vit != entPtr->getEnt())
344 "Inconsistent entity %ld != %ld", *vit, entPtr->getEnt());
346 CHKERR mField.get_moab().coords_iterate(vit, verts.end(), xCoord,
347 yCoord, zCoord, count);
348 CHKERR lambda(entPtr->getEntFieldData(), xCoord, yCoord, zCoord);
359 if (total != verts.size())
361 "Inconsistent number of vertices in field meshset and in the "
363 total, verts.size());
398 auto dit = dofs_ptr->get<
Unique_mi_tag>().lower_bound(lo_uid);
399 auto hi_dit = dofs_ptr->get<
Unique_mi_tag>().upper_bound(hi_uid);
401 for (; dit != hi_dit; dit++)
402 (*dit)->getFieldData() = val;
420 auto dit = dofs_ptr->get<
Unique_mi_tag>().lower_bound(lo_uid);
421 auto hi_dit = dofs_ptr->get<
Unique_mi_tag>().upper_bound(hi_uid);
425 for (; dit != hi_dit; dit++) {
426 ent = (*dit)->getEnt();
428 if (ents.find(ent) == ents.end()) {
436 (*dit)->getFieldData() = val;
450 " field < %s > not found, (top tip: check spelling)",
458 for (; dit != hi_dit; dit++) {
459 (*dit)->getFieldData() = val;