-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start work on data object repository
- Loading branch information
Lionel Untereiner
committed
Oct 18, 2023
1 parent
787c2ed
commit 130b309
Showing
9 changed files
with
369 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
#include "mesh/generators/RESQML/ETPRepository.hpp" | ||
|
||
namespace geosx | ||
{ | ||
|
||
using namespace dataRepository; | ||
|
||
ETPRepository::ETPRepository( string const & name, | ||
dataRepository::Group * const parent ) | ||
: RESQMLDataObjectRepository( name, parent ) | ||
{ | ||
enableLogLevelInput(); | ||
|
||
registerWrapper( viewKeyStruct:ipConnectionString(), &m_ipConnection ). | ||
setInputFlag( InputFlags::REQUIRED ). | ||
setRestartFlags( RestartFlags::NO_WRITE ). | ||
setDescription( "IP from the ETP Server" ); | ||
|
||
registerWrapper( viewKeyStruct::portConnectionInt(), &m_portConnection ). | ||
setInputFlag( InputFlags::REQUIRED ). | ||
setRestartFlags( RestartFlags::NO_WRITE ). | ||
setDescription( "PORT from the ETP Server" ); | ||
|
||
registerWrapper( viewKeyStruct::authConnectionString(), &m_authConnection ). | ||
setInputFlag( InputFlags::REQUIRED ). | ||
setRestartFlags( RestartFlags::NO_WRITE ). | ||
setDescription( "Authentification for the connection to the ETP Server" ); | ||
} | ||
|
||
void ETPRepository::postProcessInput() | ||
{ | ||
boost::uuids::random_generator gen; | ||
ETP_NS::InitializationParameters initializationParams(gen(), ip_connection, port_connection); | ||
|
||
m_session = ETP_NS::ClientSessionLaunchers::createWsClientSession(&initializationParams, "/", auth_connection); | ||
m_session->setCoreProtocolHandlers(std::make_shared<FesppCoreProtocolHandlers>(session.get(), repository)); | ||
m_session->setDiscoveryProtocolHandlers(std::make_shared<FesppDiscoveryProtocolHandlers>(session.get(), repository)); | ||
auto storeHandlers = std::make_shared<FesppStoreProtocolHandlers>(session.get(), repository); | ||
session->setStoreProtocolHandlers(storeHandlers); | ||
session->setDataArrayProtocolHandlers(std::make_shared<ETP_NS::DataArrayHandlers>(session.get())); | ||
|
||
repository->setHdfProxyFactory(new ETP_NS::FesapiHdfProxyFactory(session.get())); | ||
|
||
std::thread sessionThread(&ETP_NS::PlainClientSession::run, session); | ||
sessionThread.detach(); | ||
while (!storeHandlers->isDone()) {} | ||
} | ||
|
||
} // end namespace geosx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#ifndef GEOSX_MESH_GENERATORS_RESQML_ETPREPOSITORY_HPP | ||
#define GEOSX_MESH_GENERATORS_RESQML_ETPREPOSITORY_HPP | ||
|
||
#include "mesh/generators/RESQML/RESQMLDataObjectRepository.hpp" | ||
|
||
#include <fetpapi/etp/ClientSessionLaunchers.h> | ||
|
||
namespace geosx | ||
{ | ||
|
||
class ETPRepository : public RESQMLDataObjectRepository | ||
{ | ||
public: | ||
|
||
/** | ||
* @brief Constructor. | ||
* @param[in] name name of the object | ||
* @param[in] parent the parent Group pointer | ||
*/ | ||
ETPRepository( const string & name, | ||
Group * const parent ); | ||
|
||
|
||
protected: | ||
|
||
///@cond DO_NOT_DOCUMENT | ||
struct viewKeyStruct | ||
{ | ||
constexpr static char const * ipConnectionString() { return "ip"; } | ||
constexpr static char const * portConnectionInt() { return "port"; } | ||
constexpr static char const * authConnectionString() { return "auth_connection"; } | ||
}; | ||
/// @endcond | ||
|
||
void postProcessInput() override; | ||
|
||
private: | ||
/// ETP Session | ||
std::shared_ptr<ETP_NS::PlainClientSession> m_session; | ||
|
||
/// | ||
string m_ipConnection; | ||
|
||
/// | ||
integer m_portConnection; | ||
|
||
/// | ||
string m_authConnection; | ||
}; | ||
|
||
} // end namespace geosx | ||
|
||
#endif /* GEOSX_MESH_GENERATORS_RESQML_ETPREPOSITORY_HPP */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
#include "mesh/generators/RESQML/EpcDocumentRepository.hpp" | ||
|
||
namespace geosx | ||
{ | ||
|
||
using namespace dataRepository; | ||
|
||
EpcDocumentRepository::EpcDocumentRepository( string const & name, | ||
Group * const parent ) | ||
: RESQMLDataObjectRepository( name, parent ) | ||
{ | ||
enableLogLevelInput(); | ||
|
||
registerWrapper( viewKeyStruct::filePathString(), &m_filePath ). | ||
setInputFlag( InputFlags::REQUIRED ). | ||
setRestartFlags( RestartFlags::NO_WRITE ). | ||
setDescription( "Path to the mesh file" ); | ||
} | ||
|
||
void EpcDocumentRepository::postProcessInput() | ||
{ | ||
GEOSX_LOG_RANK_0( GEOSX_FMT( "Reading: {}", m_filePath) ); | ||
COMMON_NS::EpcDocument pck(m_filePath); | ||
std::string message = pck.deserializePartiallyInto(*m_repository); | ||
pck.close(); | ||
|
||
GEOSX_LOG_RANK_0( GEOSX_FMT( "Deserilization message: {}", message) ); | ||
} | ||
|
||
REGISTER_CATALOG_ENTRY( RESQMLDataObjectRepository, EpcDocumentRepository, string const &, Group * const ) | ||
|
||
} // end namespace geosx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#ifndef GEOSX_MESH_GENERATORS_RESQML_EPCDOCUMENTREPOSITORY_HPP | ||
#define GEOSX_MESH_GENERATORS_RESQML_EPCDOCUMENTREPOSITORY_HPP | ||
|
||
#include "mesh/generators/RESQML/RESQMLDataObjectRepository.hpp" | ||
|
||
#include "fesapi/common/EpcDocument.h" | ||
|
||
namespace geosx | ||
{ | ||
|
||
class EpcDocumentRepository : public RESQMLDataObjectRepository | ||
{ | ||
public: | ||
|
||
/** | ||
* @brief Constructor. | ||
* @param[in] name name of the object | ||
* @param[in] parent the parent Group pointer | ||
*/ | ||
explicit EpcDocumentRepository( const string & name, | ||
Group * const parent ); | ||
|
||
|
||
/** | ||
* @brief Return the name of the RESQMLDataObjectRepository in object catalog. | ||
* @return string that contains the catalog name of the RESQMLDataObjectRepository | ||
*/ | ||
static string catalogName() { return "EpcDocumentRepository"; } | ||
|
||
string getCatalogName() override { return catalogName(); } | ||
|
||
virtual void test() = 0; | ||
|
||
protected: | ||
|
||
///@cond DO_NOT_DOCUMENT | ||
struct viewKeyStruct | ||
{ | ||
constexpr static char const * filePathString() { return "file"; } | ||
}; | ||
/// @endcond | ||
|
||
void postProcessInput() override; | ||
|
||
private: | ||
/// Path to the epc file | ||
Path m_filePath; | ||
}; | ||
|
||
} // end namespace geosx | ||
|
||
#endif /* GEOSX_MESH_GENERATORS_RESQML_EPCDOCUMENTREPOSITORY_HPP */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
#include "RESQMLDataObjectRepository.hpp" | ||
|
||
namespace geosx | ||
{ | ||
|
||
using namespace dataRepository; | ||
|
||
RESQMLDataObjectRepository::RESQMLDataObjectRepository(string const & name, | ||
dataRepository::Group * const parent) : | ||
MeshGeneratorBase( name, parent ) | ||
{ | ||
setInputFlags(InputFlags::OPTIONAL_NONUNIQUE); | ||
|
||
// This enables logLevel filtering | ||
enableLogLevelInput(); | ||
} | ||
|
||
// Group * RESQMLDataObjectRepository::createChild( string const & childKey, string const & childName ) | ||
// { | ||
// // RESQML DataObject Repositories generally don't have child XML nodes, must override this method to enable | ||
// // GEOSX_THROW( GEOSX_FMT( "RESQMLDataObjectRepository '{}': invalid child XML node '{}' of type {}", getName(), childName, childKey ), | ||
// // InputError ); | ||
// std::unique_ptr< RESQMLDataObjectRepository > task = RESQMLDataObjectRepository::CatalogInterface::factory( childKey, childName, this ); | ||
// return &this->registerGroup< RESQMLDataObjectRepository >( childName, std::move( task ) ); | ||
|
||
// } | ||
|
||
RESQMLDataObjectRepository::CatalogInterface::CatalogType & RESQMLDataObjectRepository::getCatalog() | ||
{ | ||
static RESQMLDataObjectRepository::CatalogInterface::CatalogType catalog; | ||
return catalog; | ||
} | ||
|
||
|
||
} // end namespace geosx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
#ifndef GEOSX_MESH_GENERATORS_RESQML_RESQMLDATAOBJECTREPOSITORY_HPP | ||
#define GEOSX_MESH_GENERATORS_RESQML_RESQMLDATAOBJECTREPOSITORY_HPP | ||
|
||
#include "mesh/generators/MeshGeneratorBase.hpp" | ||
|
||
#include "fesapi/common/DataObjectRepository.h" | ||
|
||
namespace geosx | ||
{ | ||
|
||
class RESQMLDataObjectRepository : public MeshGeneratorBase | ||
{ | ||
public: | ||
|
||
/** | ||
* @brief Default constructor. | ||
*/ | ||
RESQMLDataObjectRepository() = delete; | ||
|
||
|
||
/** | ||
* @brief Main constructor for RESQMLDataObjectRepository base class. | ||
* @param[in] name of the RESQMLDataObjectRepository object | ||
* @param[in] parent the parent Group pointer for the RESQMLDataObjectRepository object | ||
*/ | ||
explicit RESQMLDataObjectRepository( string const & name, | ||
Group * const parent ); | ||
|
||
// /** | ||
// * @brief Return the name of the MeshGenerator in object catalog. | ||
// * @return string that contains the catalog name of the MeshGenerator | ||
// */ | ||
// static string catalogName() { return "RESQMLDataObjectRepository"; } | ||
|
||
/// using alias for templated Catalog meshGenerator type | ||
using CatalogInterface = dataRepository::CatalogInterface< RESQMLDataObjectRepository, string const &, Group * const >; | ||
|
||
/** | ||
* @brief Accessor for the singleton Catalog object | ||
* @return a static reference to the Catalog object | ||
*/ | ||
static CatalogInterface::CatalogType & getCatalog(); | ||
|
||
/** | ||
* @brief function to return the catalog name of the derived class | ||
* @return a string that contains the catalog name of the derived class | ||
*/ | ||
virtual string getCatalogName() = 0; | ||
// /** | ||
// * @brief Create a new object as a child of this group. | ||
// * @param childKey the catalog key of the new object to create | ||
// * @param childName the name of the new object in the repository | ||
// * @return the group child | ||
// */ | ||
// virtual Group * createChild( string const & childKey, string const & childName ) override; | ||
|
||
|
||
protected: | ||
|
||
/// RESQML DataObject Repository | ||
common::DataObjectRepository * m_repository; | ||
|
||
}; | ||
|
||
} // end namespace | ||
|
||
#endif /* GEOSX_MESH_GENERATORS_RESQML_RESQMLDATAOBJECTREPOSITORY_HPP */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ endif() | |
|
||
set(myNewComponentTests | ||
testRESQMLImport.cpp | ||
testRESQMLDataObjectRepository.cpp | ||
) | ||
|
||
# | ||
|
Oops, something went wrong.