v0.8.4
Public Member Functions | Public Attributes | Protected Attributes | List of all members
MoFEM::SeriesRecorder Struct Reference

#include <src/interfaces/SeriesRecorder.hpp>

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

Public Member Functions

MoFEMErrorCode query_interface (const MOFEMuuid &uuid, UnknownInterface **iface) const
 
 SeriesRecorder (const MoFEM::Core &core)
 
 ~SeriesRecorder ()
 destructor More...
 
MoFEMErrorCode getTags (int verb=-1)
 get tags handlers used on meshsets More...
 
Tag get_th_SeriesName ()
 
MoFEMErrorCode clearMap ()
 clear multi-index container More...
 
MoFEMErrorCode initialiseDatabaseFromMesh (int verb=0)
 
SeriesRecorderget_series_recorder_ptr ()
 return pointer to meshset manager More...
 
const SeriesRecorderget_series_recorder_ptr () const
 return pointer to meshset manager More...
 
virtual MoFEMErrorCode add_series_recorder (const std::string &series_name)
 
virtual MoFEMErrorCode delete_recorder_series (const std::string &series_name)
 
virtual MoFEMErrorCode initialize_series_recorder (const std::string &serie_name)
 
virtual MoFEMErrorCode finalize_series_recorder (const std::string &serie_name)
 
virtual MoFEMErrorCode record_begin (const std::string &serie_name)
 
virtual MoFEMErrorCode record_problem (const std::string &serie_name, const Problem *problemPtr, RowColData rc)
 
virtual MoFEMErrorCode record_problem (const std::string &serie_name, const std::string &problem_name, RowColData rc)
 
virtual MoFEMErrorCode record_field (const std::string &serie_name, const std::string &field_name, const BitRefLevel &bit, const BitRefLevel &mask)
 
virtual MoFEMErrorCode record_end (const std::string &serie_name, double time=0)
 
virtual MoFEMErrorCode load_series_data (const std::string &serie_name, const int step_number)
 
virtual MoFEMErrorCode print_series_steps ()
 
virtual bool check_series (const std::string &name) const
 check if series is in database More...
 
virtual SeriesStep_multiIndex::index< SeriesName_mi_tag >::type::iterator get_series_steps_byName_begin (const std::string &name)
 
virtual SeriesStep_multiIndex::index< SeriesName_mi_tag >::type::iterator get_series_steps_byName_end (const std::string &name)
 
- Public Member Functions inherited from MoFEM::UnknownInterface
template<class IFACE >
MoFEMErrorCode registerInterface (const MOFEMuuid &uuid, bool error_if_registration_failed=true)
 Register interface. More...
 
template<class IFACE , bool VERIFY = false>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, IFACE *&iface) const
 Get interface by uuid and return reference to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE *&iface) const
 Get interface refernce to pointer of interface. More...
 
template<class IFACE >
MoFEMErrorCode getInterface (IFACE **const iface) const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_pointer< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get interface pointer to pointer of interface. More...
 
template<class IFACE , typename boost::enable_if< boost::is_reference< IFACE >, int >::type = 0>
IFACE getInterface () const
 Get reference to interface. More...
 
template<class IFACE >
IFACE * getInterface () const
 Function returning pointer to interface. More...
 
virtual ~UnknownInterface ()
 
virtual MoFEMErrorCode getLibVersion (Version &version) const
 Get library version. More...
 
virtual const MoFEMErrorCode getFileVersion (moab::Interface &moab, Version &version) const
 Get database major version. More...
 
virtual MoFEMErrorCode getInterfaceVersion (Version &version) const
 Get database major version. More...
 
template<>
MoFEMErrorCode getInterface (const MOFEMuuid &uuid, UnknownInterface *&iface) const
 

Public Attributes

MoFEM::CorecOre
 

Protected Attributes

Tag th_SeriesName
 Recorded series name. More...
 
Series_multiIndex sEries
 recorded series More...
 
SeriesStep_multiIndex seriesSteps
 recorded series steps More...
 

Additional Inherited Members

- Protected Member Functions inherited from MoFEM::UnknownInterface
boost::typeindex::type_index getClassIdx (const MOFEMuuid &uid) const
 Get type name for interface Id. More...
 
MOFEMuuid getUId (const boost::typeindex::type_index &class_idx) const
 Get interface Id for class name. More...
 

Detailed Description

Record (time) data series

Is abstraction of Core interface.

Bug:
fix names of this interface to follow naming convention
Examples:
elasticity.cpp.

Definition at line 36 of file SeriesRecorder.hpp.

Constructor & Destructor Documentation

◆ SeriesRecorder()

MoFEM::SeriesRecorder::SeriesRecorder ( const MoFEM::Core core)

Definition at line 34 of file SeriesRecorder.cpp.

34  :
35 cOre(const_cast<Core&>(core)) {
36 }

◆ ~SeriesRecorder()

MoFEM::SeriesRecorder::~SeriesRecorder ( )

destructor

Definition at line 44 of file SeriesRecorder.hpp.

44 {}

Member Function Documentation

◆ clearMap()

MoFEMErrorCode MoFEM::SeriesRecorder::clearMap ( )

clear multi-index container

Returns
error code

Definition at line 50 of file SeriesRecorder.cpp.

50  {
52  sEries.clear();
53  seriesSteps.clear();
55 }
#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
Series_multiIndex sEries
recorded series
SeriesStep_multiIndex seriesSteps
recorded series steps

◆ get_series_recorder_ptr() [1/2]

SeriesRecorder* MoFEM::SeriesRecorder::get_series_recorder_ptr ( )

return pointer to meshset manager

Definition at line 69 of file SeriesRecorder.hpp.

69 { return this; }

◆ get_series_recorder_ptr() [2/2]

const SeriesRecorder* MoFEM::SeriesRecorder::get_series_recorder_ptr ( ) const

return pointer to meshset manager

Definition at line 74 of file SeriesRecorder.hpp.

74 { return this; }

◆ get_series_steps_byName_begin()

SeriesStep_multiIndex::index< SeriesName_mi_tag >::type::iterator MoFEM::SeriesRecorder::get_series_steps_byName_begin ( const std::string &  name)
virtual

Definition at line 308 of file SeriesRecorder.cpp.

308  {
309  return seriesSteps.get<SeriesName_mi_tag>().lower_bound(name);
310 }
SeriesStep_multiIndex seriesSteps
recorded series steps

◆ get_series_steps_byName_end()

SeriesStep_multiIndex::index< SeriesName_mi_tag >::type::iterator MoFEM::SeriesRecorder::get_series_steps_byName_end ( const std::string &  name)
virtual

Definition at line 312 of file SeriesRecorder.cpp.

312  {
313  return seriesSteps.get<SeriesName_mi_tag>().upper_bound(name);
314 }
SeriesStep_multiIndex seriesSteps
recorded series steps

◆ get_th_SeriesName()

Tag MoFEM::SeriesRecorder::get_th_SeriesName ( )

Definition at line 52 of file SeriesRecorder.hpp.

52 { return th_SeriesName; }
Tag th_SeriesName
Recorded series name.

◆ getTags()

MoFEMErrorCode MoFEM::SeriesRecorder::getTags ( int  verb = -1)

get tags handlers used on meshsets

Definition at line 38 of file SeriesRecorder.cpp.

38  {
39 
40  Interface &m_field = cOre;
41  moab::Interface &moab = m_field.get_moab();
43  const int def_val_len = 0;
44  rval = moab.tag_get_handle("_SeriesName",def_val_len,MB_TYPE_OPAQUE,
45  th_SeriesName,MB_TAG_CREAT|MB_TAG_BYTES|MB_TAG_VARLEN|MB_TAG_SPARSE,NULL
46  ); CHKERRQ_MOAB(rval);
48 }
#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
Tag th_SeriesName
Recorded series name.

◆ initialiseDatabaseFromMesh()

MoFEMErrorCode MoFEM::SeriesRecorder::initialiseDatabaseFromMesh ( int  verb = 0)

initialize container form data on mesh

Returns
error code

Definition at line 57 of file SeriesRecorder.cpp.

57  {
58  Interface &m_field = cOre;
59  moab::Interface &moab = m_field.get_moab();
61  Range meshsets;
62  const int def_val_len = 0;
63  rval = moab.tag_get_handle("_SeriesName",def_val_len,MB_TYPE_OPAQUE,
64  th_SeriesName,MB_TAG_CREAT|MB_TAG_BYTES|MB_TAG_VARLEN|MB_TAG_SPARSE,NULL
65  ); CHKERRQ_MOAB(rval);
66 
67  rval = moab.get_entities_by_type(0,MBENTITYSET,meshsets,false); CHKERRQ_MOAB(rval);
68  for(Range::iterator mit = meshsets.begin();mit!=meshsets.end();mit++) {
69  const void* tagName;
70  int tagNameSize;
71  rval = moab.tag_get_by_ptr(
72  th_SeriesName,&*mit,1,(const void **)&tagName,&tagNameSize
73  );
74  if(rval == MB_SUCCESS) {
75  std::pair<Series_multiIndex::iterator,bool> p = sEries.insert(FieldSeries(moab,*mit));
76  if(verb > 0) {
77  std::ostringstream ss;
78  ss << "read series " << *p.first << std::endl;
79  PetscPrintf(m_field.get_comm(),ss.str().c_str());
80  }
81  }
82  }
83  // //build series steps
84  for(Series_multiIndex::iterator sit = sEries.begin();sit!=sEries.end();sit++) {
85  int nb_steps;
86  ierr = sit->get_nb_steps(moab,nb_steps); CHKERRG(ierr);
87  int ss = 0;
88  for(;ss<nb_steps;ss++) {
89  std::pair<SeriesStep_multiIndex::iterator,bool> p = seriesSteps.insert(FieldSeriesStep(moab,&*sit,ss));
90  if(verb > 0) {
91  std::ostringstream ss;
92  ss << "add series step " << *p.first << std::endl;
93  PetscPrintf(m_field.get_comm(),ss.str().c_str());
94  }
95  }
96  }
98 }
#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 CHKERRG(n)
Check error code of MoFEM/MOAB/PETSc function.
Definition: definitions.h:565
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return() ...
Definition: definitions.h:528
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
Definition: Common.hpp:80
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Common.hpp:78
Tag th_SeriesName
Recorded series name.
Series_multiIndex sEries
recorded series
SeriesStep_multiIndex seriesSteps
recorded series steps

◆ query_interface()

MoFEMErrorCode MoFEM::SeriesRecorder::query_interface ( const MOFEMuuid uuid,
UnknownInterface **  iface 
) const
virtual

Implements MoFEM::UnknownInterface.

Definition at line 23 of file SeriesRecorder.cpp.

23  {
25  *iface = NULL;
26  if(uuid == IDD_MOFEMSeriesRecorder) {
27  *iface = const_cast<SeriesRecorder*>(this);
29  }
30  SETERRQ(PETSC_COMM_SELF,MOFEM_DATA_INCONSISTENCY,"unknown interface");
32 }
static const MOFEMuuid IDD_MOFEMSeriesRecorder
#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
SeriesRecorder(const MoFEM::Core &core)

Member Data Documentation

◆ cOre

MoFEM::Core& MoFEM::SeriesRecorder::cOre

Definition at line 40 of file SeriesRecorder.hpp.

◆ sEries

Series_multiIndex MoFEM::SeriesRecorder::sEries
protected

recorded series

Definition at line 185 of file SeriesRecorder.hpp.

◆ seriesSteps

SeriesStep_multiIndex MoFEM::SeriesRecorder::seriesSteps
protected

recorded series steps

Definition at line 186 of file SeriesRecorder.hpp.

◆ th_SeriesName

Tag MoFEM::SeriesRecorder::th_SeriesName
protected

Recorded series name.

Definition at line 183 of file SeriesRecorder.hpp.


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