DiSMEC++
numpy.cpp File Reference
#include "numpy.h"
#include "io/common.h"
#include <ostream>
#include <fstream>
#include <cstdint>
#include "spdlog/fmt/fmt.h"
#include "spdlog/spdlog.h"
#include <iostream>
#include "doctest.h"
#include <sstream>

Go to the source code of this file.

Namespaces

 anonymous_namespace{numpy.cpp}
 
 dismec
 Main namespace in which all types, classes, and functions are defined.
 
 dismec::io
 

Macros

#define REGISTER_DTYPE(TYPE, STRING)
 

Functions

 dismec::io::REGISTER_DTYPE (float, "<f4")
 
 dismec::io::REGISTER_DTYPE (double, "<f8")
 
 dismec::io::REGISTER_DTYPE (std::int32_t, "<i4")
 
 dismec::io::REGISTER_DTYPE (std::int64_t, "<i8")
 
 dismec::io::REGISTER_DTYPE (std::uint32_t, "<u4")
 
 dismec::io::REGISTER_DTYPE (std::uint64_t, "<u8")
 
std::uint32_t anonymous_namespace{numpy.cpp}::read_header_length (std::streambuf &source)
 
long anonymous_namespace{numpy.cpp}::skip_whitespace (std::string_view source, long position)
 
std::pair< std::string_view, std::string_view > anonymous_namespace{numpy.cpp}::read_key_value (std::string_view source)
 This function parses a single element from a python dict literal. More...
 
io::NpyHeaderData anonymous_namespace{numpy.cpp}::parse_description (std::string_view view)
 
template<class T >
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > anonymous_namespace{numpy.cpp}::load_matrix_from_npy_imp (std::streambuf &source)
 
template<class T >
void anonymous_namespace{numpy.cpp}::save_matrix_to_npy_imp (std::streambuf &target, const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > &matrix)
 
 TEST_CASE ("numpy header with given description")
 
 TEST_CASE ("header length test")
 
 TEST_CASE ("read key value error check")
 
 TEST_CASE ("read key value test")
 
 TEST_CASE ("parse description -- valid")
 
 TEST_CASE ("parse description -- errors")
 
 TEST_CASE ("make description")
 
 TEST_CASE ("save/load round trip")
 

Variables

constexpr const char anonymous_namespace{numpy.cpp}::MAGIC [] = {'\x93', 'N', 'U', 'M', 'P', 'Y', '\x03', '\x00'}
 
constexpr const int anonymous_namespace{numpy.cpp}::MAGIC_SIZE = 6
 
constexpr const unsigned anonymous_namespace{numpy.cpp}::NPY_PADDING = 64u
 

Macro Definition Documentation

◆ REGISTER_DTYPE

#define REGISTER_DTYPE (   TYPE,
  STRING 
)
Value:
template<> \
const char* data_type_string<TYPE>() { \
return STRING; \
}

Definition at line 56 of file numpy.cpp.

Function Documentation

◆ TEST_CASE() [1/8]

TEST_CASE ( "header length test"  )

◆ TEST_CASE() [2/8]

TEST_CASE ( "make description"  )

Definition at line 520 of file numpy.cpp.

References dismec::io::make_npy_description().

◆ TEST_CASE() [3/8]

TEST_CASE ( "numpy header with given description"  )

Definition at line 372 of file numpy.cpp.

References dismec::io::write_npy_header().

◆ TEST_CASE() [4/8]

TEST_CASE ( "parse description -- errors"  )

Definition at line 498 of file numpy.cpp.

References anonymous_namespace{numpy.cpp}::parse_description().

◆ TEST_CASE() [5/8]

TEST_CASE ( "parse description -- valid"  )

Definition at line 467 of file numpy.cpp.

References anonymous_namespace{numpy.cpp}::parse_description().

◆ TEST_CASE() [6/8]

TEST_CASE ( "read key value error check"  )

Definition at line 408 of file numpy.cpp.

References anonymous_namespace{numpy.cpp}::read_key_value().

◆ TEST_CASE() [7/8]

TEST_CASE ( "read key value test"  )

Definition at line 419 of file numpy.cpp.

References anonymous_namespace{numpy.cpp}::read_key_value().

◆ TEST_CASE() [8/8]

TEST_CASE ( "save/load round trip"  )