Commit bbd44091 authored by Godoy, William F's avatar Godoy, William F
Browse files

Rebase master

parent 2841275f
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@
#include <string>

#include "adios2/core/IO.h"
#include "adios2/core/Variable.h"

#include "py11Variable.h"

namespace adios2
{
@@ -28,22 +29,22 @@ class Engine
{

public:
    Engine(core::IO &io, const std::string &name, const Mode openMode,
           MPI_Comm mpiComm);
    Engine() = default;

    ~Engine() = default;

    StepStatus BeginStep(const StepMode mode,
                         const float timeoutSeconds = -1.f);
    StepStatus BeginStep();

    void Put(core::VariableBase *variable, const pybind11::array &array,
    void Put(Variable variable, const pybind11::array &array,
             const Mode launch = Mode::Deferred);
    void Put(core::VariableBase *variable, const std::string &string);
    void Put(Variable variable, const std::string &string);
    void PerformPuts();

    void Get(core::VariableBase *variable, pybind11::array &array,
    void Get(Variable variable, pybind11::array &array,
             const Mode launch = Mode::Deferred);
    void Get(core::VariableBase *variable, std::string &string,
    void Get(Variable variable, std::string &string,
             const Mode launch = Mode::Deferred);
    void PerformGets();

@@ -59,7 +60,10 @@ public:
    std::string Type() const noexcept;

private:
    core::Engine &m_Engine;
    Engine(IO io, const std::string &name, const Mode openMode,
           MPI_Comm mpiComm);

    core::Engine *m_Engine = nullptr;
    const bool m_DebugMode;
};

+6 −8
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include <string>

#include "py11Engine.h"
#include "py11Variable.h"

namespace adios2
{
@@ -39,16 +40,13 @@ public:

    Params Parameters() const noexcept;

    core::VariableBase *DefineVariable(const std::string &name,
                                       std::string &stringValue);
    Variable *DefineVariable(const std::string &name, std::string &stringValue);

    core::VariableBase *DefineVariable(const std::string &name,
                                       const Dims &shape, const Dims &start,
                                       const Dims &count,
                                       const bool isConstantDims,
                                       pybind11::array &array);
    Variable *DefineVariable(const std::string &name, const Dims &shape,
                             const Dims &start, const Dims &count,
                             const bool isConstantDims, pybind11::array &array);

    core::VariableBase *InquireVariable(const std::string &name) noexcept;
    Variable *InquireVariable(const std::string &name) noexcept;

    core::AttributeBase *DefineAttribute(const std::string &name,
                                         pybind11::array &array);
+13 −0
Original line number Diff line number Diff line
/* 
 * Distributed under the OSI-approved Apache License, Version 2.0.  See
 * accompanying file Copyright.txt for details.
 * 
 * py11Variable.cpp :
 *
 *  Created on: Sep 7, 2018
 *      Author: William F Godoy godoywf@ornl.gov
 */



+122 −0
Original line number Diff line number Diff line
/*
 * Distributed under the OSI-approved Apache License, Version 2.0.  See
 * accompanying file Copyright.txt for details.
 *
 * py11Variable.h :
 *
 *  Created on: Sep 7, 2018
 *      Author: William F Godoy godoywf@ornl.gov
 */

#ifndef ADIOS2_BINDINGS_PYTHON_PY11VARIABLE_H_
#define ADIOS2_BINDINGS_PYTHON_PY11VARIABLE_H_

namespace adios2
{
namespace py11
{

class Variable
{
public:
    Variable() = default;

    ~Variable() = default;

    void SetSelection(const Box<Dims> &selection);

    void SetStepSelection(const Box<size_t> &stepSelection);

    size_t SelectionSize() const;

    std::string Name() const;

    std::string Type() const;

    /**
     * Inspects size of the current element type, sizeof(T)
     * @return sizeof(T) for current system
     */
    size_t Sizeof() const;

    /**
     * Inspects shape id for current variable
     * @return from enum adios2::ShapeID
     */
    adios2::ShapeID ShapeID() const;

    /**
     * Inspects current shape
     * @return shape vector
     */
    Dims Shape() const;

    /**
     * Inspects current start point
     * @return start vector
     */
    Dims Start() const;

    /**
     * Inspects current count from start
     * @return count vector
     */
    Dims Count() const;

    /**
     * For read mode, inspect the number of available steps
     * @return available steps
     */
    size_t Steps() const;

    /**
     * For read mode, inspect the start step for available steps
     * @return available start step
     */
    size_t StepsStart() const;

    /**
     * EXPERIMENTAL: carries information about an Operation added with
     * AddOperation
     */
    struct Operation
    {
        const Operator Op;
        const Params Parameters;
        const Params Info;
    };

    /**
     * EXPERIMENTAL: Adds operation and parameters to current Variable object
     * @param op operator to be added
     * @param parameters key/value settings particular to the Variable, not to
     * be confused by op own parameters
     * @return operation index handler in Operations()
     */
    size_t AddOperation(const Operator op, const Params &parameters = Params());

    /**
     * EXPERIMENTAL: inspects current operators added with AddOperator
     * @return vector of Variable<T>::OperatorInfo
     */
    std::vector<Operation> Operations() const;

    /** Contains sub-block information for a particular Variable<T> */
    struct Info
    {
        Dims Start;
        Dims Count;
        pybind11::array Min = pybind11::array();
        pybind11::array Max = pybind11::array();
        pybind11::array Value = pybind11::array();
        bool IsValue;
    };

private:
    core::VariableBase *m_Variable;
};

} // end namespace py11
} // end namespace adios2

#endif /* ADIOS2_BINDINGS_PYTHON_PY11VARIABLE_H_ */