-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
static local client for configuration and proper memory management
- Loading branch information
1 parent
4dfd763
commit 9443dc3
Showing
5 changed files
with
189 additions
and
8 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
2023-01/smartsim/smartsim_function_object/smartSimFunctionObject/Make/files
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
smartRedisAdapter.C | ||
smartSimFunctionObject.C | ||
|
||
LIB = $(FOAM_USER_LIBBIN)/libsmartSimFunctionObject |
55 changes: 55 additions & 0 deletions
55
2023-01/smartsim/smartsim_function_object/smartSimFunctionObject/smartRedisAdapter.C
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,55 @@ | ||
/*---------------------------------------------------------------------------*\ | ||
========= | | ||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
\\ / O peration | | ||
\\ / A nd | www.openfoam.com | ||
\\/ M anipulation | | ||
------------------------------------------------------------------------------- | ||
Copyright (C) 2023 AUTHOR,AFFILIATION | ||
------------------------------------------------------------------------------- | ||
License | ||
This file is part of OpenFOAM. | ||
OpenFOAM is free software: you can redistribute it and/or modify it | ||
under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
\*---------------------------------------------------------------------------*/ | ||
|
||
#include "smartRedisAdapter.H" | ||
#include "Time.H" | ||
|
||
|
||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // | ||
|
||
namespace Foam | ||
{ | ||
defineTypeNameAndDebug(smartRedisAdapter, 0); | ||
} | ||
|
||
|
||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // | ||
|
||
Foam::smartRedisAdapter::smartRedisAdapter | ||
( | ||
const IOobject& io, | ||
bool clusterMode | ||
) | ||
: | ||
regIOobject(io), | ||
client_(clusterMode, io.name()) // deprecated constructor though | ||
{ | ||
} | ||
|
||
|
||
|
||
// ************************************************************************* // |
106 changes: 106 additions & 0 deletions
106
2023-01/smartsim/smartsim_function_object/smartSimFunctionObject/smartRedisAdapter.H
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,106 @@ | ||
/*---------------------------------------------------------------------------*\ | ||
========= | | ||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox | ||
\\ / O peration | | ||
\\ / A nd | www.openfoam.com | ||
\\/ M anipulation | | ||
------------------------------------------------------------------------------- | ||
Copyright (C) 2023 AUTHOR, AFFILIATION | ||
------------------------------------------------------------------------------- | ||
License | ||
This file is part of OpenFOAM. | ||
OpenFOAM is free software: you can redistribute it and/or modify it | ||
under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT | ||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. | ||
Class | ||
Foam::smartRedisAdapter | ||
Description | ||
\*---------------------------------------------------------------------------*/ | ||
|
||
#ifndef smartRedisAdapter_H | ||
#define smartRedisAdapter_H | ||
|
||
#include "regIOobject.H" | ||
#include "client.h" | ||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
namespace Foam | ||
{ | ||
|
||
/*---------------------------------------------------------------------------*\ | ||
Class smartRedisAdapter Declaration | ||
\*---------------------------------------------------------------------------*/ | ||
|
||
class smartRedisAdapter | ||
: | ||
public regIOobject | ||
{ | ||
protected: | ||
|
||
// Protected Data | ||
|
||
//- cluster mode | ||
bool clusterMode_; | ||
|
||
//- SmartRedis Database Client | ||
SmartRedis::Client client_; | ||
|
||
public: | ||
|
||
//- Runtime type information | ||
TypeName("smartRedisAdapter"); | ||
|
||
|
||
// Constructors | ||
|
||
//- Construct from Time and dictionary | ||
explicit smartRedisAdapter | ||
( | ||
const IOobject& io, | ||
bool clusterMode = false | ||
); | ||
|
||
//- No copy construct | ||
smartRedisAdapter(const smartRedisAdapter&) = delete; | ||
|
||
//- No copy assignment | ||
void operator=(const smartRedisAdapter&) = delete; | ||
|
||
|
||
//- Destructor | ||
virtual ~smartRedisAdapter() = default; | ||
|
||
|
||
// Member Functions | ||
|
||
//- return the client's instance | ||
SmartRedis::Client& client() {return client_;}; | ||
|
||
//- Implement writing to ostream from regIOobject | ||
virtual bool writeData(Ostream&) const { return true; } | ||
}; | ||
|
||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
} // End namespace Foam | ||
|
||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // | ||
|
||
#endif | ||
|
||
// ************************************************************************* // |
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