v0.8.19
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
MoFEM::FieldSeriesStep Struct Reference

Structure for keeping time and step. More...

#include <src/multi_indices/SeriesMultiIndices.hpp>

Inheritance diagram for MoFEM::FieldSeriesStep:
[legend]
Collaboration diagram for MoFEM::FieldSeriesStep:
[legend]

Public Types

typedef interface_FieldSeries< FieldSeriesinterface_type_FieldSeries
 

Public Member Functions

 FieldSeriesStep (Interface &moab, const FieldSeries *_FieldSeries_ptr, const int _step_number)
 
int get_step_number () const
 
MoFEMErrorCode get (Interface &moab, DofEntity_multiIndex &dofsField) const
 
MoFEMErrorCode get_time_init (Interface &moab)
 
double get_time () const
 
- Public Member Functions inherited from MoFEM::interface_FieldSeries< FieldSeries >
 interface_FieldSeries (const FieldSeries *_ptr)
 
EntityHandle getMeshset () const
 get meshset More...
 
EntityID get_meshset_id () const
 
boost::string_ref getNameRef () const
 get string_ref of series More...
 
std::string getName () const
 get series name More...
 
const FieldSeriesget_FieldSeries_ptr () const
 

Public Attributes

int step_number
 
double time
 
- Public Attributes inherited from MoFEM::interface_FieldSeries< FieldSeries >
const FieldSeriesptr
 

Friends

std::ostream & operator<< (std::ostream &os, const FieldSeriesStep &e)
 

Detailed Description

Structure for keeping time and step.

Bug:
Fix member functions names. Not follow namining convention.

Definition at line 125 of file SeriesMultiIndices.hpp.

Member Typedef Documentation

◆ interface_type_FieldSeries

Definition at line 127 of file SeriesMultiIndices.hpp.

Constructor & Destructor Documentation

◆ FieldSeriesStep()

MoFEM::FieldSeriesStep::FieldSeriesStep ( Interface moab,
const FieldSeries _FieldSeries_ptr,
const int  _step_number 
)

Definition at line 253 of file SeriesMultiIndices.cpp.

256  : interface_FieldSeries<FieldSeries>(_FieldSeries_ptr),
257  step_number(_step_number) {
258 
260  CHKERRABORT(PETSC_COMM_WORLD, ierr);
261 }
MoFEMErrorCode get_time_init(Interface &moab)
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80

Member Function Documentation

◆ get()

MoFEMErrorCode MoFEM::FieldSeriesStep::get ( Interface moab,
DofEntity_multiIndex dofsField 
) const

Definition at line 263 of file SeriesMultiIndices.cpp.

264  {
266 
267  std::vector<EntityHandle> contained;
268  CHKERR moab.get_contained_meshsets(ptr->meshset, contained);
269  if (contained.size() <= (unsigned int)step_number) {
270  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
271  }
272 
273  EntityHandle *handles_ptr;
274  int handles_size;
275  CHKERR moab.tag_get_by_ptr(ptr->th_SeriesDataHandles, &contained[step_number],
276  1, (const void **)&handles_ptr, &handles_size);
277 
278  ShortId *uids_ptr;
279  int uids_size;
280  CHKERR moab.tag_get_by_ptr(ptr->th_SeriesDataUIDs, &contained[step_number], 1,
281  (const void **)&uids_ptr, &uids_size);
282  uids_size /= sizeof(ShortId);
283 
284  if (handles_size != uids_size) {
285  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
286  }
287 
288  FieldData *data_ptr;
289  int data_size;
290  CHKERR moab.tag_get_by_ptr(ptr->th_SeriesData, &contained[step_number], 1,
291  (const void **)&data_ptr, &data_size);
292  data_size /= sizeof(FieldData);
293 
294  if (data_size != uids_size) {
295  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
296  }
297 
298  typedef multi_index_container<
299  boost::shared_ptr<DofEntity>,
300  indexed_by<
301 
302  hashed_non_unique<
303  tag<Composite_Ent_and_ShortId_mi_tag>,
304  composite_key<
305  DofEntity,
306  const_mem_fun<DofEntity, EntityHandle, &DofEntity::getEnt>,
307  const_mem_fun<DofEntity, ShortId,
309 
310  >>
311  DofEntity_multiIndex_short_uid_view;
312 
313  DofEntity_multiIndex_short_uid_view short_uid_view;
314  short_uid_view.insert(dofsField.begin(), dofsField.end());
315 
316  for (int ii = 0; ii < uids_size; ii++) {
317  EntityHandle ent = handles_ptr[ii];
318  ShortId uid = uids_ptr[ii];
319  FieldData val = data_ptr[ii];
320 
321  auto dit = short_uid_view.find(boost::make_tuple(ent, uid));
322  if (dit != short_uid_view.end()) {
323  (*dit)->getFieldData() = val;
324  } else {
325  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND,
326  "data inconsistency, getting data series, dof on ENTITY and "
327  "ShortId can't be found");
328  }
329  }
330 
332 }
int ShortId
Unique Id in the field.
Definition: Common.hpp:137
ShortId getNonNonuniqueShortId() const
get short uid it is unique in combination with entity handle
double FieldData
Field data type.
Definition: Common.hpp:130
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:475
#define CHKERR
Inline error check.
Definition: definitions.h:594
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:405

◆ get_step_number()

int MoFEM::FieldSeriesStep::get_step_number ( ) const

Definition at line 133 of file SeriesMultiIndices.hpp.

◆ get_time()

double MoFEM::FieldSeriesStep::get_time ( ) const

Definition at line 138 of file SeriesMultiIndices.hpp.

138 { return time; }

◆ get_time_init()

MoFEMErrorCode MoFEM::FieldSeriesStep::get_time_init ( Interface moab)

Definition at line 334 of file SeriesMultiIndices.cpp.

334  {
336 
337  std::vector<EntityHandle> contained;
338  CHKERR moab.get_contained_meshsets(ptr->meshset, contained);
339  if (contained.size() <= (unsigned int)step_number) {
340  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
341  }
342  double *time_ptr;
343  int size;
344  CHKERR moab.tag_get_by_ptr(ptr->th_SeriesTime, &contained[step_number], 1,
345  (const void **)&time_ptr, &size);
346  time = *time_ptr;
348 }
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:475
#define CHKERR
Inline error check.
Definition: definitions.h:594
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:405

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const FieldSeriesStep e 
)
friend

Definition at line 355 of file SeriesMultiIndices.cpp.

355  {
356  os << *(e.get_FieldSeries_ptr()) << " step number " << e.step_number
357  << " time " << e.get_time();
358  return os;
359 }

Member Data Documentation

◆ step_number

int MoFEM::FieldSeriesStep::step_number

Definition at line 129 of file SeriesMultiIndices.hpp.

◆ time

double MoFEM::FieldSeriesStep::time

Definition at line 136 of file SeriesMultiIndices.hpp.


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