v0.14.0
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 112 of file SeriesMultiIndices.hpp.

Member Typedef Documentation

◆ interface_type_FieldSeries

Definition at line 114 of file SeriesMultiIndices.hpp.

Constructor & Destructor Documentation

◆ FieldSeriesStep()

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

Definition at line 226 of file SeriesMultiIndices.cpp.

229  : interface_FieldSeries<FieldSeries>(_FieldSeries_ptr),
230  step_number(_step_number) {
231 
232  ierr = get_time_init(moab);
233  CHKERRABORT(PETSC_COMM_WORLD, ierr);
234 }

Member Function Documentation

◆ get()

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

Definition at line 236 of file SeriesMultiIndices.cpp.

237  {
239 
240  std::vector<EntityHandle> contained;
241  CHKERR moab.get_contained_meshsets(ptr->meshset, contained);
242  if (contained.size() <= (unsigned int)step_number) {
243  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
244  }
245 
246  EntityHandle *handles_ptr;
247  int handles_size;
248  CHKERR moab.tag_get_by_ptr(ptr->th_SeriesDataHandles, &contained[step_number],
249  1, (const void **)&handles_ptr, &handles_size);
250 
251  ShortId *uids_ptr;
252  int uids_size;
253  CHKERR moab.tag_get_by_ptr(ptr->th_SeriesDataUIDs, &contained[step_number], 1,
254  (const void **)&uids_ptr, &uids_size);
255  uids_size /= sizeof(ShortId);
256 
257  if (handles_size != uids_size) {
258  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
259  }
260 
261  FieldData *data_ptr;
262  int data_size;
263  CHKERR moab.tag_get_by_ptr(ptr->th_SeriesData, &contained[step_number], 1,
264  (const void **)&data_ptr, &data_size);
265  data_size /= sizeof(FieldData);
266 
267  if (data_size != uids_size) {
268  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
269  }
270 
271  typedef multi_index_container<
272  boost::shared_ptr<DofEntity>,
273  indexed_by<
274 
275  hashed_non_unique<
276  tag<Composite_Ent_and_ShortId_mi_tag>,
277  composite_key<
278  DofEntity,
279  const_mem_fun<DofEntity, EntityHandle, &DofEntity::getEnt>,
280  const_mem_fun<DofEntity, ShortId,
282 
283  >>
284  DofEntity_multiIndex_short_uid_view;
285 
286  DofEntity_multiIndex_short_uid_view short_uid_view;
287  short_uid_view.insert(dofsField.begin(), dofsField.end());
288 
289  for (int ii = 0; ii < uids_size; ii++) {
290  EntityHandle ent = handles_ptr[ii];
291  ShortId uid = uids_ptr[ii];
292  FieldData val = data_ptr[ii];
293 
294  auto dit = short_uid_view.find(boost::make_tuple(ent, uid));
295  if (dit != short_uid_view.end()) {
296  (*dit)->getFieldData() = val;
297  } else {
298  SETERRQ(PETSC_COMM_SELF, MOFEM_NOT_FOUND,
299  "data inconsistency, getting data series, dof on ENTITY and "
300  "ShortId can't be found");
301  }
302  }
303 
305 }

◆ get_step_number()

int MoFEM::FieldSeriesStep::get_step_number ( ) const
inline

Definition at line 120 of file SeriesMultiIndices.hpp.

120 { return step_number; };

◆ get_time()

double MoFEM::FieldSeriesStep::get_time ( ) const
inline

Definition at line 125 of file SeriesMultiIndices.hpp.

125 { return time; }

◆ get_time_init()

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

Definition at line 307 of file SeriesMultiIndices.cpp.

307  {
309 
310  std::vector<EntityHandle> contained;
311  CHKERR moab.get_contained_meshsets(ptr->meshset, contained);
312  if (contained.size() <= (unsigned int)step_number) {
313  SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
314  }
315  double *time_ptr;
316  int size;
317  CHKERR moab.tag_get_by_ptr(ptr->th_SeriesTime, &contained[step_number], 1,
318  (const void **)&time_ptr, &size);
319  time = *time_ptr;
321 }

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 328 of file SeriesMultiIndices.cpp.

328  {
329  os << *(e.get_FieldSeries_ptr()) << " step number " << e.step_number
330  << " time " << e.get_time();
331  return os;
332 }

Member Data Documentation

◆ step_number

int MoFEM::FieldSeriesStep::step_number

Definition at line 116 of file SeriesMultiIndices.hpp.

◆ time

double MoFEM::FieldSeriesStep::time

Definition at line 123 of file SeriesMultiIndices.hpp.


The documentation for this struct was generated from the following files:
MoFEM::interface_FieldSeries< FieldSeries >::ptr
const FieldSeries * ptr
Definition: SeriesMultiIndices.hpp:89
EntityHandle
MoFEM::FieldSeries::meshset
EntityHandle meshset
Definition: SeriesMultiIndices.hpp:25
MoFEM::FieldSeriesStep::time
double time
Definition: SeriesMultiIndices.hpp:123
MoFEM::FieldSeries::th_SeriesData
Tag th_SeriesData
Definition: SeriesMultiIndices.hpp:48
MoFEM::FieldSeries::th_SeriesDataHandles
Tag th_SeriesDataHandles
Definition: SeriesMultiIndices.hpp:50
MoFEM::FieldSeries::th_SeriesTime
Tag th_SeriesTime
Definition: SeriesMultiIndices.hpp:51
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:548
MoFEM::Types::ShortId
int ShortId
Unique Id in the field.
Definition: Types.hpp:32
MoFEM::FieldSeriesStep::step_number
int step_number
Definition: SeriesMultiIndices.hpp:116
MoFEM::DofEntity::getNonNonuniqueShortId
ShortId getNonNonuniqueShortId() const
get short uid it is unique in combination with entity handle
Definition: DofsMultiIndices.hpp:118
MOFEM_NOT_FOUND
@ MOFEM_NOT_FOUND
Definition: definitions.h:33
MoFEM::FieldSeries::th_SeriesDataUIDs
Tag th_SeriesDataUIDs
Definition: SeriesMultiIndices.hpp:49
MoFEM::Exceptions::ierr
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:76
MoFEM::Types::FieldData
double FieldData
Field data type.
Definition: Types.hpp:25
MOFEM_DATA_INCONSISTENCY
@ MOFEM_DATA_INCONSISTENCY
Definition: definitions.h:31
MoFEM::FieldSeriesStep::get_time_init
MoFEMErrorCode get_time_init(Interface &moab)
Definition: SeriesMultiIndices.cpp:307
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:429
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:359