v0.13.1
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 239 of file SeriesMultiIndices.cpp.

242 : interface_FieldSeries<FieldSeries>(_FieldSeries_ptr),
243 step_number(_step_number) {
244
245 ierr = get_time_init(moab);
246 CHKERRABORT(PETSC_COMM_WORLD, ierr);
247}
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Exceptions.hpp:87
MoFEMErrorCode get_time_init(Interface &moab)

Member Function Documentation

◆ get()

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

Definition at line 249 of file SeriesMultiIndices.cpp.

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

◆ get_step_number()

int MoFEM::FieldSeriesStep::get_step_number ( ) const

Definition at line 133 of file SeriesMultiIndices.hpp.

133{ return step_number; };

◆ 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 320 of file SeriesMultiIndices.cpp.

320 {
322
323 std::vector<EntityHandle> contained;
324 CHKERR moab.get_contained_meshsets(ptr->meshset, contained);
325 if (contained.size() <= (unsigned int)step_number) {
326 SETERRQ(PETSC_COMM_SELF, MOFEM_DATA_INCONSISTENCY, "data inconsistency");
327 }
328 double *time_ptr;
329 int size;
330 CHKERR moab.tag_get_by_ptr(ptr->th_SeriesTime, &contained[step_number], 1,
331 (const void **)&time_ptr, &size);
332 time = *time_ptr;
334}

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 341 of file SeriesMultiIndices.cpp.

341 {
342 os << *(e.get_FieldSeries_ptr()) << " step number " << e.step_number
343 << " time " << e.get_time();
344 return os;
345}

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: