v0.8.4
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 118 of file SeriesMultiIndices.hpp.

Member Typedef Documentation

◆ interface_type_FieldSeries

Definition at line 120 of file SeriesMultiIndices.hpp.

Constructor & Destructor Documentation

◆ FieldSeriesStep()

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

Definition at line 231 of file SeriesMultiIndices.cpp.

231  :
232  interface_FieldSeries<FieldSeries>(_FieldSeries_ptr),step_number(_step_number) {
233 
234  ierr = get_time_init(moab); CHKERRABORT(PETSC_COMM_WORLD,ierr);
235 }
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 237 of file SeriesMultiIndices.cpp.

237  {
239  ErrorCode rval;
240 
241  std::vector<EntityHandle> contained;
242  rval = moab.get_contained_meshsets(ptr->meshset,contained); CHKERRQ_MOAB(rval);
243  if(contained.size()<=(unsigned int)step_number) {
244  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
245  }
246 
247  EntityHandle *handles_ptr;
248  int handles_size;
249  rval = moab.tag_get_by_ptr(ptr->th_SeriesDataHandles,&contained[step_number],1,(const void **)&handles_ptr,&handles_size); CHKERRQ_MOAB(rval);
250 
251  ShortId *uids_ptr;
252  int uids_size;
253  rval = moab.tag_get_by_ptr(ptr->th_SeriesDataUIDs,&contained[step_number],1,(const void **)&uids_ptr,&uids_size); CHKERRQ_MOAB(rval);
254  uids_size /= sizeof(ShortId);
255 
256  if(handles_size != uids_size) {
257  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
258  }
259 
260  FieldData *data_ptr;
261  int data_size;
262  rval = moab.tag_get_by_ptr(ptr->th_SeriesData,&contained[step_number],1,(const void **)&data_ptr,&data_size); CHKERRQ_MOAB(rval);
263  data_size /= sizeof(FieldData);
264 
265  if(data_size != uids_size) {
266  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
267  }
268 
269  for(int ii = 0;ii<uids_size;ii++) {
270  EntityHandle ent = handles_ptr[ii];
271  ShortId uid = uids_ptr[ii];
272  FieldData val = data_ptr[ii];
273  DofEntity_multiIndex::index<Composite_Ent_and_ShortId_mi_tag>::type::iterator dit;
274  dit = dofsField.get<Composite_Ent_and_ShortId_mi_tag>().find(boost::make_tuple(ent,uid));
275  if(dit!=dofsField.get<Composite_Ent_and_ShortId_mi_tag>().end()) {
276  //std::cerr << *dit << std::endl;
277  (*dit)->getFieldData() = val;
278  } else {
279  SETERRQ(PETSC_COMM_SELF,MOFEM_NOT_FOUND,
280  "data inconsistency, getting data series, dof on ENTITY and ShortId can't be found");
281  }
282  }
283 
285 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:536
int ShortId
Unique Id in the field.
Definition: Common.hpp:137
double FieldData
Field data type.
Definition: Common.hpp:130
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:522
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78

◆ get_step_number()

int MoFEM::FieldSeriesStep::get_step_number ( ) const

Definition at line 125 of file SeriesMultiIndices.hpp.

◆ get_time()

double MoFEM::FieldSeriesStep::get_time ( ) const

Definition at line 130 of file SeriesMultiIndices.hpp.

130 { return time; }

◆ get_time_init()

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

Definition at line 287 of file SeriesMultiIndices.cpp.

287  {
289  ErrorCode rval;
290  std::vector<EntityHandle> contained;
291  rval = moab.get_contained_meshsets(ptr->meshset,contained); CHKERRQ_MOAB(rval);
292  if(contained.size()<=(unsigned int)step_number) {
293  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"data inconsistency");
294  }
295  double *time_ptr;
296  int size;
297  rval = moab.tag_get_by_ptr(ptr->th_SeriesTime,&contained[step_number],1,(const void **)&time_ptr,&size); CHKERRQ_MOAB(rval);
298  time = *time_ptr;
300 }
#define CHKERRQ_MOAB(a)
check error code of MoAB function
Definition: definitions.h:536
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:522
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78

Friends And Related Function Documentation

◆ operator<<

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

Definition at line 307 of file SeriesMultiIndices.cpp.

307  {
308  os << *(e.get_FieldSeries_ptr()) << " step number " << e.step_number << " time " << e.get_time();
309  return os;
310 }

Member Data Documentation

◆ step_number

int MoFEM::FieldSeriesStep::step_number

Definition at line 122 of file SeriesMultiIndices.hpp.

◆ time

double MoFEM::FieldSeriesStep::time

Definition at line 128 of file SeriesMultiIndices.hpp.


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