v0.14.0
UnknownInterface.cpp
Go to the documentation of this file.
1 /** \file UnknownInterface.cpp
2  * \brief Unknown interfce implementation
3  */
4 
5 
6 
7 namespace MoFEM {
8 
11  version =
12  Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD);
14 }
15 
17  Version &version) {
19  const EntityHandle root_meshset = 0;
20  const int def_version[] = {-1, -1, -1};
21  Tag th;
22  rval = moab.tag_get_handle("MOFEM_VERSION", 3, MB_TYPE_INTEGER, th,
23  MB_TAG_CREAT | MB_TAG_MESH, &def_version);
24  int *version_ptr;
25  if (rval == MB_ALREADY_ALLOCATED) {
26  const void *tag_data[1];
27  CHKERR moab.tag_get_by_ptr(th, &root_meshset, 1, tag_data);
28  version_ptr = (int *)tag_data[0];
29  } else {
30  const void *tag_data[1];
31  CHKERR moab.tag_get_by_ptr(th, &root_meshset, 1, tag_data);
32  version_ptr = (int *)tag_data[0];
33  version_ptr[0] = MoFEM_VERSION_MAJOR;
34  version_ptr[1] = MoFEM_VERSION_MINOR;
35  version_ptr[2] = MoFEM_VERSION_BUILD;
36  }
37  version = Version(version_ptr);
39 }
40 
42  Version version) {
44  const EntityHandle root_meshset = 0;
45  const int def_version[] = {-1, -1, -1};
46  Tag th;
47  rval = moab.tag_get_handle("MOFEM_VERSION", 3, MB_TYPE_INTEGER, th,
48  MB_TAG_CREAT | MB_TAG_MESH, &def_version);
49  int *version_ptr;
50  const void *tag_data[1];
51  CHKERR moab.tag_get_by_ptr(th, &root_meshset, 1, tag_data);
52  version_ptr = (int *)tag_data[0];
53  version_ptr[0] = version.majorVersion;
54  version_ptr[1] = version.minorVersion;
55  version_ptr[2] = version.buildVersion;
57 }
58 
61  version =
62  Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD);
64 }
65 
66 } // namespace MoFEM
MoFEMFunctionReturnHot
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:447
MoFEM::Version::majorVersion
int majorVersion
Definition: UnknownInterface.hpp:13
EntityHandle
MoFEM::Exceptions::MoFEMErrorCode
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
Definition: Exceptions.hpp:56
MoFEM::th
Tag th
Definition: Projection10NodeCoordsOnField.cpp:122
MoFEM::UnknownInterface::getFileVersion
static MoFEMErrorCode getFileVersion(moab::Interface &moab, Version &version)
Get database major version.
Definition: UnknownInterface.cpp:16
MoFEM::Interface
DeprecatedCoreInterface Interface
Definition: Interface.hpp:1975
MoFEM::Exceptions::rval
static MoFEMErrorCodeGeneric< moab::ErrorCode > rval
Definition: Exceptions.hpp:74
CHKERR
#define CHKERR
Inline error check.
Definition: definitions.h:535
MoFEM::UnknownInterface::setFileVersion
static MoFEMErrorCode setFileVersion(moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
Get database major version.
Definition: UnknownInterface.cpp:41
MoFEM
implementation of Data Operators for Forces and Sources
Definition: Common.hpp:10
MoFEM::Version
Definition: UnknownInterface.hpp:12
MoFEM::Version::buildVersion
int buildVersion
Definition: UnknownInterface.hpp:15
MoFEM::UnknownInterface::getInterfaceVersion
static MoFEMErrorCode getInterfaceVersion(Version &version)
Get database major version.
Definition: UnknownInterface.cpp:59
MoFEM::Version::minorVersion
int minorVersion
Definition: UnknownInterface.hpp:14
MoFEMFunctionBeginHot
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:440
MoFEMFunctionReturn
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
Definition: definitions.h:416
MoFEMFunctionBegin
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
Definition: definitions.h:346
MoFEM::UnknownInterface::getLibVersion
static MoFEMErrorCode getLibVersion(Version &version)
Get library version.
Definition: UnknownInterface.cpp:9