Commit 27567e05 authored by William F Godoy's avatar William F Godoy
Browse files

Progress

parent ee44d591
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -10,14 +10,19 @@

#include "py11Attribute.h"

#include "adios2/helper/adiosFunctions.h"

namespace adios2
{
namespace py11
{

Attribute::Attribute(core::Attribute *attribute) : m_Attribute(attribute) {}
Attribute::Attribute(core::AttributeBase *attribute) : m_Attribute(attribute) {}

Attribute::operator bool() const noexcept {}
Attribute::operator bool() const noexcept
{
    return (m_Attribute == nullptr) ? false : true;
}

std::string Attribute::Name() const
{
+5 −1
Original line number Diff line number Diff line
@@ -11,6 +11,10 @@
#ifndef ADIOS2_BINDINGS_PYTHON_ATTRIBUTE_H_
#define ADIOS2_BINDINGS_PYTHON_ATTRIBUTE_H_

#include <pybind11/numpy.h>

#include "adios2/core/AttributeBase.h"

namespace adios2
{
namespace py11
@@ -36,7 +40,7 @@ public:
    pybind11::array Data();

private:
    Attribute(core::Attribute *attribute);
    Attribute(core::AttributeBase *attribute);
    core::AttributeBase *m_Attribute = nullptr;
};

+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
#include <memory> //std::shared_ptr
#include <string>

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

#include "py11Variable.h"

+5 −6
Original line number Diff line number Diff line
@@ -20,9 +20,7 @@ namespace adios2
namespace py11
{

IO::IO(core::IO &io, const bool debugMode) : m_IO(&io), m_DebugMode(debugMode)
{
}
IO::IO(core::IO *io, const bool debugMode) : m_IO(io), m_DebugMode(debugMode) {}

IO::operator bool() const noexcept { return (m_IO == nullptr) ? false : true; }

@@ -152,9 +150,10 @@ Attribute IO::DefineAttribute(const std::string &name,
    else if (pybind11::isinstance<                                             \
                 pybind11::array_t<T, pybind11::array::c_style>>(array))       \
    {                                                                          \
        attribute = &m_IO->DefineAttribute<T>(                                 \
            name, reinterpret_cast<const T *>(array.data()), array.size(),     \
            variableName, separator);                                          \
        const T *data = reinterpret_cast<const T *>(array.data());             \
        const size_t size = static_cast<size_t>(array.size());                 \
        attribute = &m_IO->DefineAttribute<T>(name, data, size, variableName,  \
                                              separator);                      \
    }
    ADIOS2_FOREACH_NUMPY_ATTRIBUTE_TYPE_1ARG(declare_type)
#undef declare_type
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ public:
    std::string EngineType() const;

private:
    IO(core::IO &io, const bool debugMode);
    IO(core::IO *io, const bool debugMode);
    core::IO *m_IO = nullptr;
    const bool m_DebugMode = true;
};
Loading