-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python: rewrite Python high level API in python
- Loading branch information
1 parent
ee2db16
commit 41b1c6a
Showing
46 changed files
with
1,183 additions
and
51 deletions.
There are no files selected for viewing
File renamed without changes.
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 |
---|---|---|
|
@@ -40,3 +40,7 @@ docs/pyvenv.cfg | |
# Visual Studio | ||
.vs/ | ||
CMakeSettings.json | ||
|
||
# Python wheels stuff | ||
|
||
*.egg-info/ |
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
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,3 @@ | ||
from .adios2@ADIOS2_LIBRARY_SUFFIX@ import * | ||
from .adios2_bindings@ADIOS2_LIBRARY_SUFFIX@ import * | ||
|
||
__version__ = "@ADIOS2_VERSION@" |
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
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
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,43 @@ | ||
[project] | ||
name="adios2" | ||
version="0.0.1" | ||
description="The Adaptable IO System" | ||
authors = [ | ||
{name = "Vicente Adolfo Bolea Sanchez", email = "[email protected]"}, | ||
] | ||
|
||
keywords = [ | ||
"Python", | ||
"Web", | ||
"Application", | ||
"Framework", | ||
] | ||
classifiers = [ | ||
"License :: Other/Proprietary License", | ||
"Natural Language :: English", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Topic :: Software Development :: Libraries :: Application Frameworks", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
] | ||
|
||
dependencies = [ | ||
"numpy", | ||
] | ||
|
||
[project.optional-dependencies] | ||
dev = [ | ||
"pip>=21.3", | ||
"pytest", | ||
"setuptools", | ||
'black', | ||
] | ||
|
||
[tool.setuptools] | ||
packages = [ "adios2"] | ||
|
||
|
||
[tool.black] | ||
line-length = 99 | ||
target-version = ['py38', 'py39', 'py310'] | ||
include = 'python/adios2/.*.py|testing/adios2/python/.*.py' |
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,13 @@ | ||
#------------------------------------------------------------------------------# | ||
# Distributed under the OSI-approved Apache License, Version 2.0. See | ||
# accompanying file Copyright.txt for details. | ||
#------------------------------------------------------------------------------# | ||
|
||
add_custom_target(python_api ALL COMMAND ${CMAKE_COMMAND} -E copy_directory | ||
${CMAKE_CURRENT_SOURCE_DIR}/adios2 | ||
${CMAKE_PYTHON_OUTPUT_DIRECTORY}/adios2) | ||
|
||
install(DIRECTORY ${CMAKE_PYTHON_OUTPUT_DIRECTORY}/adios2/ | ||
DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/adios2/ | ||
COMPONENT adios2_python-python | ||
) |
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,3 @@ | ||
#!/usr/bin/python3 | ||
|
||
import adios2.bindings |
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 @@ | ||
from adios2.io import IO | ||
from adios2.operator import Operator | ||
|
||
import adios2.bindings as bindings | ||
|
||
|
||
class ADIOS: | ||
def __init__(self): | ||
self._impl = bindings.ADIOS() | ||
self._operators = {} | ||
self._ios = {} | ||
|
||
def DeclareIO(self, name): | ||
self._ios[name] = IO(self._impl, name) | ||
return self._ios[name] | ||
|
||
def AtIO(self, name): | ||
return self._ios[name] | ||
|
||
def RemoveIO(self, name): | ||
del self._ios[name] | ||
self._impl.RemoveIO(name) | ||
|
||
def RemoveAllIOs(self): | ||
self._ios = {} | ||
self._impl.RemoveAllIOs() | ||
|
||
def DefineOperator(self, name, type, parameters={}): | ||
self._operators[name] = Operator(self._impl, name, type, parameters) | ||
return self._operators[name] | ||
|
||
def InquireOperator(self, name): | ||
return self._operators[name] | ||
|
||
def FlushAll(self): | ||
self._impl.FlushAll() |
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,20 @@ | ||
import adios2.bindings | ||
|
||
|
||
class Attribute: | ||
def __init__(self, io, name, *args, **kwargs): | ||
self._impl = io.DefineAttribute(name, *args, **kwargs) | ||
|
||
def __eq__(self, other): | ||
if isinstance(other, Attribute): | ||
return self.Name() == other.Name() | ||
return False | ||
|
||
def Name(self): | ||
return self._impl.Name() | ||
|
||
def Data(self): | ||
return self._impl.Data() | ||
|
||
def DataString(self): | ||
return self._impl.DataString() |
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,66 @@ | ||
import numpy as np | ||
import adios2.bindings as bindings | ||
|
||
from adios2.attribute import Attribute | ||
from adios2.variable import Variable | ||
|
||
|
||
class Engine: | ||
def __init__(self, io, name, mode): | ||
self._impl = io.Open(name, mode) | ||
|
||
def __enter__(self): | ||
return self | ||
|
||
def __exit__(self, *exc): | ||
self.Close() | ||
|
||
def Close(self, transportIndex=-1): | ||
self._impl.Close(transportIndex) | ||
|
||
def Steps(self): | ||
return self._impl.Steps() | ||
|
||
def CurrentStep(self): | ||
return self._impl.CurrentStep() | ||
|
||
def BeginStep(self, *args, **kwargs): | ||
return self._impl.BeginStep(*args, **kwargs) | ||
|
||
def EndStep(self): | ||
self._impl.EndStep() | ||
|
||
def BlocksInfo(self, name, step): | ||
return self._impl.BlocksInfo(name, step) | ||
|
||
def Put(self, variable, content, mode=bindings.Mode.Sync): | ||
if isinstance(content, np.ndarray): | ||
self._impl.Put(variable._impl, content, mode) | ||
else: | ||
self._impl.Put(variable._impl, content) | ||
self.PerformDataWrite() | ||
|
||
def PerformPuts(self): | ||
self._impl.PerformPuts() | ||
|
||
def PerformDataWrite(self): | ||
self._impl.PerformDataWrite() | ||
|
||
def Get(self, variable, content=None, mode=bindings.Mode.Sync): | ||
if isinstance(content, np.ndarray): | ||
self._impl.Get(variable._impl, content, mode) | ||
return None | ||
else: | ||
return self._impl.Get(variable._impl, mode) | ||
|
||
def PerformGets(self): | ||
self._impl.PerformGets() | ||
|
||
def LockReaderSelections(self): | ||
self._impl.LockReaderSelections() | ||
|
||
def LockWriterDefinitions(self): | ||
self._impl.LockWriterDefinitions() | ||
|
||
def Flush(self, transportIndex=-1): | ||
self._impl.Flush(transportIndex) |
Oops, something went wrong.