v0.8.13
Public Member Functions | Public Attributes | List of all members
MoFEM::FieldEntity_change_order Struct Reference

structure to change FieldEntity order More...

#include <src/multi_indices/EntsMultiIndices.hpp>

Collaboration diagram for MoFEM::FieldEntity_change_order:
[legend]

Public Member Functions

 FieldEntity_change_order (ApproximationOrder order)
 
void operator() (boost::shared_ptr< FieldEntity > &e)
 
void operator() (FieldEntity *e)
 

Public Attributes

ApproximationOrder order
 
std::vector< FieldDatadata
 
std::vector< ApproximationOrderdata_dof_order
 
std::vector< FieldCoefficientsNumberdata_dof_rank
 

Detailed Description

structure to change FieldEntity order

Definition at line 779 of file EntsMultiIndices.hpp.

Constructor & Destructor Documentation

◆ FieldEntity_change_order()

MoFEM::FieldEntity_change_order::FieldEntity_change_order ( ApproximationOrder  order)

Definition at line 784 of file EntsMultiIndices.hpp.

784 : order(order) {}

Member Function Documentation

◆ operator()() [1/2]

void MoFEM::FieldEntity_change_order::operator() ( boost::shared_ptr< FieldEntity > &  e)

Definition at line 785 of file EntsMultiIndices.hpp.

785  {
786  (*this)(e.get());
787  }

◆ operator()() [2/2]

void MoFEM::FieldEntity_change_order::operator() ( FieldEntity e)

Definition at line 201 of file EntsMultiIndices.cpp.

201  {
202  moab::Interface &moab = e->sPtr->basicDataPtr->moab;
203  *(e->getMaxOrderPtr()) = order;
204  unsigned int nb_dofs = e->getOrderNbDofs(order) * e->getNbOfCoeffs();
205  EntityHandle ent = e->getEnt();
206  // Get pointer and size of field values tag
207  double *tag_field_data;
208  int tag_field_data_size;
209  rval =
210  moab.tag_get_by_ptr(e->sFieldPtr->th_FieldData, &ent, 1,
211  (const void **)&tag_field_data, &tag_field_data_size);
212  // Tag exist and are some data on it
213  if (rval == MB_SUCCESS) {
214  // Check if size of filed values tag is correct
215  if (nb_dofs * sizeof(FieldData) <= (unsigned int)tag_field_data_size) {
216  return;
217  } else if (nb_dofs == 0) {
218  // Delete data on this entity
219  rval = moab.tag_delete_data(e->sFieldPtr->th_FieldData, &ent, 1);
220  MOAB_THROW(rval);
221  return;
222  }
223  // Size of tag is different than new seize, so copy data to new container
224  data.resize(tag_field_data_size / sizeof(FieldData));
225  FieldData *ptr_begin = (FieldData *)tag_field_data;
226  FieldData *ptr_end =
227  (FieldData *)tag_field_data + tag_field_data_size / sizeof(FieldData);
228  std::copy(ptr_begin, ptr_end, data.begin());
229  }
230  // Set new data
231  if (nb_dofs > 0) {
232  // Set field dof data
233  data.resize(nb_dofs, 0);
234  int tag_size[1];
235  tag_size[0] = data.size() * sizeof(FieldData);
236  void const *tag_data[] = {&data[0]};
237  rval = moab.tag_set_by_ptr(e->sFieldPtr->th_FieldData, &ent, 1, tag_data,
238  tag_size);
239  MOAB_THROW(rval);
240  rval = moab.tag_get_by_ptr(e->sFieldPtr->th_FieldData, &ent, 1,
241  (const void **)&tag_field_data,
242  &tag_field_data_size);
243  MOAB_THROW(rval);
244  if (nb_dofs != tag_field_data_size / sizeof(FieldData))
245  THROW_MESSAGE("Data inconsistency");
246  }
247 }
double FieldData
Field data type.
Definition: Common.hpp:130
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:638
#define MOAB_THROW(a)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:620
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
std::vector< FieldData > data

Member Data Documentation

◆ data

std::vector<FieldData> MoFEM::FieldEntity_change_order::data

Definition at line 781 of file EntsMultiIndices.hpp.

◆ data_dof_order

std::vector<ApproximationOrder> MoFEM::FieldEntity_change_order::data_dof_order

Definition at line 782 of file EntsMultiIndices.hpp.

◆ data_dof_rank

std::vector<FieldCoefficientsNumber> MoFEM::FieldEntity_change_order::data_dof_rank

Definition at line 783 of file EntsMultiIndices.hpp.

◆ order

ApproximationOrder MoFEM::FieldEntity_change_order::order

Definition at line 780 of file EntsMultiIndices.hpp.


The documentation for this struct was generated from the following files: