68 std::size_t nb_dofs = e->getOrderNbDofs(
order) * e->getNbOfCoeffs();
70 double *tag_field_data =
nullptr;
71 int tag_field_data_size = 0;
73 auto set_verts = [&]() {
74 if (e->getFieldRawPtr()->tagFieldDataVertsType == MB_TAG_SPARSE) {
76 rval = moab.tag_get_by_ptr(e->getFieldRawPtr()->th_FieldDataVerts, &ent,
77 1, (
const void **)&tag_field_data,
78 &tag_field_data_size);
80 if (nb_dofs != tag_field_data_size) {
81 rval = moab.tag_set_data(e->getFieldRawPtr()->th_FieldDataVerts, &ent,
85 }
else if (
rval == MB_SUCCESS) {
86 rval = moab.tag_delete_data(e->getFieldRawPtr()->th_FieldDataVerts,
91 rval = moab.tag_get_by_ptr(e->getFieldRawPtr()->th_FieldDataVerts, &ent,
92 1, (
const void **)&tag_field_data);
94 rval = moab.tag_set_data(e->getFieldRawPtr()->th_FieldDataVerts, &ent, 1,
100 auto set_default = [&]() {
104 rval = moab.tag_get_by_ptr(e->getFieldRawPtr()->th_FieldData, &ent, 1,
105 (
const void **)&tag_field_data,
106 &tag_field_data_size);
109 nb_dofs > tag_field_data_size) {
112 if (
rval == MB_SUCCESS) {
115 data.resize(tag_field_data_size);
118 static_cast<FieldData *
>(tag_field_data) + tag_field_data_size;
119 std::copy(ptr_begin, ptr_end,
data.begin());
122 if (
rval != MB_SUCCESS || nb_dofs) {
125 data.resize(nb_dofs, 0);
127 tag_size[0] =
data.size();
128 void const *tag_data[] = {&
data[0]};
129 rval = moab.tag_set_by_ptr(e->getFieldRawPtr()->th_FieldData, &ent, 1,
132 rval = moab.tag_get_by_ptr(e->getFieldRawPtr()->th_FieldData, &ent, 1,
133 (
const void **)&tag_field_data,
134 &tag_field_data_size);
140 moab.tag_delete_data(e->getFieldRawPtr()->th_FieldData, &ent, 1);
147 switch (e->getEntType()) {
156 const_cast<double *&
>(*(e->getEntFieldDataPtr())) = tag_field_data;
158 const_cast<double *&
>(*(e->getEntFieldDataPtr())) =
nullptr;