v0.8.15
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 788 of file EntsMultiIndices.hpp.

Constructor & Destructor Documentation

◆ FieldEntity_change_order()

MoFEM::FieldEntity_change_order::FieldEntity_change_order ( ApproximationOrder  order)

Definition at line 793 of file EntsMultiIndices.hpp.

793 : order(order) {}

Member Function Documentation

◆ operator()() [1/2]

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

Definition at line 794 of file EntsMultiIndices.hpp.

794  {
795  (*this)(e.get());
796  }

◆ operator()() [2/2]

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

Definition at line 216 of file EntsMultiIndices.cpp.

216  {
217  moab::Interface &moab = e->sPtr->basicDataPtr->moab;
218  *(e->getMaxOrderPtr()) = order;
219  unsigned int nb_dofs = e->getOrderNbDofs(order) * e->getNbOfCoeffs();
220  EntityHandle ent = e->getEnt();
221  // Get pointer and size of field values tag
222  double *tag_field_data;
223  int tag_field_data_size;
224  rval =
225  moab.tag_get_by_ptr(e->sFieldPtr->th_FieldData, &ent, 1,
226  (const void **)&tag_field_data, &tag_field_data_size);
227  // Tag exist and are some data on it
228  if (rval == MB_SUCCESS) {
229  // Check if size of filed values tag is correct
230  if (nb_dofs * sizeof(FieldData) <= (unsigned int)tag_field_data_size) {
231  return;
232  } else if (nb_dofs == 0) {
233  // Delete data on this entity
234  rval = moab.tag_delete_data(e->sFieldPtr->th_FieldData, &ent, 1);
235  MOAB_THROW(rval);
236  return;
237  }
238  // Size of tag is different than new seize, so copy data to new container
239  data.resize(tag_field_data_size / sizeof(FieldData));
240  FieldData *ptr_begin = (FieldData *)tag_field_data;
241  FieldData *ptr_end =
242  (FieldData *)tag_field_data + tag_field_data_size / sizeof(FieldData);
243  std::copy(ptr_begin, ptr_end, data.begin());
244  }
245  // Set new data
246  if (nb_dofs > 0) {
247  // Set field dof data
248  data.resize(nb_dofs, 0);
249  int tag_size[1];
250  tag_size[0] = data.size() * sizeof(FieldData);
251  void const *tag_data[] = {&data[0]};
252  rval = moab.tag_set_by_ptr(e->sFieldPtr->th_FieldData, &ent, 1, tag_data,
253  tag_size);
254  MOAB_THROW(rval);
255  rval = moab.tag_get_by_ptr(e->sFieldPtr->th_FieldData, &ent, 1,
256  (const void **)&tag_field_data,
257  &tag_field_data_size);
258  MOAB_THROW(rval);
259  if (nb_dofs != tag_field_data_size / sizeof(FieldData))
260  THROW_MESSAGE("Data inconsistency");
261  }
262 }
double FieldData
Field data type.
Definition: Common.hpp:130
#define THROW_MESSAGE(a)
Throw MoFEM exception.
Definition: definitions.h:602
#define MOAB_THROW(a)
Check error code of MoAB function and throw MoFEM exception.
Definition: definitions.h:584
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 790 of file EntsMultiIndices.hpp.

◆ data_dof_order

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

Definition at line 791 of file EntsMultiIndices.hpp.

◆ data_dof_rank

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

Definition at line 792 of file EntsMultiIndices.hpp.

◆ order

ApproximationOrder MoFEM::FieldEntity_change_order::order

Definition at line 789 of file EntsMultiIndices.hpp.


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