7#ifndef __MOFEMUNKNOWNINTERFACE_HPP__
8#define __MOFEMUNKNOWNINTERFACE_HPP__
12template <
int N>
struct CoreTmp;
19 return new IFACE(core);
31 Version(
const int minor,
const int major,
const int build)
35 auto str = [](
auto v) {
return boost::lexical_cast<std::string>(
v); };
63 template <
class IFACE>
68 if (error_if_registration_failed && (!p.second)) {
70 "Registration of interface typeid(IFACE).name() = %s failed",
71 typeid(IFACE).
name());
102 template <
class IFACE>
107 if (!(iface =
dynamic_cast<IFACE *
>(ptr)))
109 "Cast impossible %s -> %s",
110 (boost::typeindex::type_id_runtime(*ptr).pretty_name()).c_str(),
111 (boost::typeindex::type_id<IFACE>().pretty_name()).c_str());
142 template <
class IFACE>
144 return getInterface<IFACE>(*iface);
170 template <
class IFACE,
171 typename boost::enable_if<boost::is_pointer<IFACE>,
int>
::type = 0>
173 typedef typename boost::remove_pointer<IFACE>::type IFaceType;
174 IFaceType *iface = NULL;
175 ierr = getInterface<IFACE>(iface);
176 CHKERRABORT(PETSC_COMM_SELF,
ierr);
203 template <
class IFACE,
typename boost::enable_if<boost::is_reference<IFACE>,
206 typedef typename boost::remove_reference<IFACE>::type IFaceType;
207 IFaceType *iface = NULL;
208 ierr = getInterface<IFaceType>(iface);
209 CHKERRABORT(PETSC_COMM_SELF,
ierr);
238 ierr = getInterface<IFACE>(iface);
239 CHKERRABORT(PETSC_COMM_SELF,
ierr);
275 moab::Interface &moab,
276 Version version =
Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR,
277 MoFEM_VERSION_BUILD));
299 typedef multi_index_container<
303 hashed_unique<member<UIdTypeMap, boost::typeindex::type_index,
#define MoFEMFunctionReturnHot(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define MoFEMFunctionBegin
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
@ MOFEM_OPERATION_UNSUCCESSFUL
#define MoFEMFunctionReturn(a)
Last executable line of each PETSc function used for error handling. Replaces return()
#define CHKERR
Inline error check.
#define MoFEMFunctionBeginHot
First executable line of each MoFEM function, used for error handling. Final line of MoFEM functions ...
const double v
phase velocity of light in medium (cm/ns)
static MoFEMErrorCodeGeneric< PetscErrorCode > ierr
PetscErrorCode MoFEMErrorCode
MoFEM/PETSc error code.
implementation of Data Operators for Forces and Sources
IFACE * createInterface(const CoreTmp< 0 > &core)
boost::typeindex::type_index classIdx
UIdTypeMap(const boost::typeindex::type_index &idx)
base class for all interface classes
multi_index_container< UIdTypeMap, indexed_by< hashed_unique< member< UIdTypeMap, boost::typeindex::type_index, &UIdTypeMap::classIdx > > > > iFaceTypeMap_multiIndex
Data structure for interfaces Id and class names.
iFaceTypeMap_multiIndex iFaceTypeMap
Maps implementation to interface type name.
IFACE * getInterface() const
Function returning pointer to interface.
virtual MoFEMErrorCode query_interface(boost::typeindex::type_index type_index, UnknownInterface **iface) const =0
static MoFEMErrorCode getLibVersion(Version &version)
Get library version.
MoFEMErrorCode registerInterface(bool error_if_registration_failed=true)
Register interface.
MoFEMErrorCode getInterface(IFACE **const iface) const
Get interface pointer to pointer of interface.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface reference to pointer of interface.
static MoFEMErrorCode setFileVersion(moab::Interface &moab, Version version=Version(MoFEM_VERSION_MAJOR, MoFEM_VERSION_MINOR, MoFEM_VERSION_BUILD))
Get database major version.
IFACE getInterface() const
Get interface pointer to pointer of interface.
static MoFEMErrorCode getInterfaceVersion(Version &version)
Get database major version.
static MoFEMErrorCode getFileVersion(moab::Interface &moab, Version &version)
Get database major version.
virtual ~UnknownInterface()=default
Version(const int minor, const int major, const int build)