Skip to content
Snippets Groups Projects
Commit 73f7abcd authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

[j.833b] J.833b ()

Merging branch 'j.833b'  into 'main'.

See merge request !2133
parents dbc6ac3b f6f7e153
No related branches found
No related tags found
1 merge request!2133J.833b
Pipeline #120149 passed
......@@ -108,19 +108,6 @@ size_t Frame::projectedIndex(size_t i, size_t k_axis) const
ASSERT_NEVER;
}
size_t Frame::toGlobalIndex(const std::vector<unsigned>& axes_indices) const
{
ASSERT(axes_indices.size() == rank());
size_t result = 0;
size_t step_size = 1;
for (int k = rank() - 1; k >= 0; --k) {
ASSERT(axes_indices[k] < m_axes[k]->size());
result += axes_indices[k] * step_size;
step_size *= m_axes[k]->size();
}
return result;
}
bool Frame::operator==(const Frame& o) const
{
if (rank() != o.rank())
......
......@@ -68,11 +68,6 @@ public:
//! @return Corresponding bin index for selected axis
size_t projectedIndex(size_t i, size_t k_axis) const;
//! Returns global index for specified indices of axes
//! @param axes_indices Vector of axes indices for all specified axes in this dataset
//! @return Corresponding global index
size_t toGlobalIndex(const std::vector<unsigned>& axes_indices) const;
//! Returns true if both Frame%s have same rank, and all axes have same sizes.
bool hasSameSizes(const Frame&) const;
......
......@@ -139,9 +139,6 @@ Datafield* Util::RW::readNicos(std::istream& input_stream)
lineNumber));
for (unsigned col = 0; col < width; ++col) {
const size_t global_index = result->frame().toGlobalIndex(
{col, height - 1 - dataRow}); // y-axis "0" is at bottom => invert y
// to show first line at top of image
int value = 0;
if (!Base::String::to_int(valuesAsString[col], &value))
......@@ -149,7 +146,9 @@ Datafield* Util::RW::readNicos(std::istream& input_stream)
"Value '" + valuesAsString[col] + "' could not be converted to integer",
lineNumber));
(*result)[global_index] = value;
// y-axis "0" is at bottom => invert y
// to show first line at top of image
(*result)[(height - 1 - dataRow) * width + col] = value;
}
dataRow++;
......
......@@ -10,5 +10,5 @@ TEST(Read2DTest, readSANSRaw)
ASSERT_NE(data, nullptr);
EXPECT_EQ(data->rank(), 2);
EXPECT_EQ(data->size(), 16384);
EXPECT_EQ((*data)[128 * 70 + 62], 443);
EXPECT_EQ((*data)[128 * 62 + 70], 443);
}
......@@ -1966,10 +1966,6 @@ class Frame(object):
r"""projectedIndex(Frame self, size_t i, size_t k_axis) -> size_t"""
return _libBornAgainBase.Frame_projectedIndex(self, i, k_axis)
def toGlobalIndex(self, axes_indices):
r"""toGlobalIndex(Frame self, std::vector< unsigned int,std::allocator< unsigned int > > const & axes_indices) -> size_t"""
return _libBornAgainBase.Frame_toGlobalIndex(self, axes_indices)
def hasSameSizes(self, arg2):
r"""hasSameSizes(Frame self, Frame arg2) -> bool"""
return _libBornAgainBase.Frame_hasSameSizes(self, arg2)
......
......@@ -3433,16 +3433,15 @@ namespace Swig {
#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[44]
#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[45]
#define SWIGTYPE_p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t swig_types[46]
#define SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t swig_types[47]
#define SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t swig_types[48]
#define SWIGTYPE_p_swig__SwigPyIterator swig_types[49]
#define SWIGTYPE_p_unsigned_char swig_types[50]
#define SWIGTYPE_p_unsigned_int swig_types[51]
#define SWIGTYPE_p_unsigned_long_long swig_types[52]
#define SWIGTYPE_p_unsigned_short swig_types[53]
#define SWIGTYPE_p_value_type swig_types[54]
static swig_type_info *swig_types[56];
static swig_module_info swig_module = {swig_types, 55, 0, 0, 0, 0};
#define SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t swig_types[47]
#define SWIGTYPE_p_swig__SwigPyIterator swig_types[48]
#define SWIGTYPE_p_unsigned_char swig_types[49]
#define SWIGTYPE_p_unsigned_int swig_types[50]
#define SWIGTYPE_p_unsigned_long_long swig_types[51]
#define SWIGTYPE_p_unsigned_short swig_types[52]
#define SWIGTYPE_p_value_type swig_types[53]
static swig_type_info *swig_types[55];
static swig_module_info swig_module = {swig_types, 54, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
......@@ -27041,49 +27040,6 @@ fail:
}
 
 
SWIGINTERN PyObject *_wrap_Frame_toGlobalIndex(PyObject *self, PyObject *args) {
PyObject *resultobj = 0;
Frame *arg1 = (Frame *) 0 ;
std::vector< unsigned int,std::allocator< unsigned int > > *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject *swig_obj[2] ;
size_t result;
if (!SWIG_Python_UnpackTuple(args, "Frame_toGlobalIndex", 2, 2, swig_obj)) SWIG_fail;
res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Frame, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Frame_toGlobalIndex" "', argument " "1"" of type '" "Frame const *""'");
}
arg1 = reinterpret_cast< Frame * >(argp1);
res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0 | 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Frame_toGlobalIndex" "', argument " "2"" of type '" "std::vector< unsigned int,std::allocator< unsigned int > > const &""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Frame_toGlobalIndex" "', argument " "2"" of type '" "std::vector< unsigned int,std::allocator< unsigned int > > const &""'");
}
arg2 = reinterpret_cast< std::vector< unsigned int,std::allocator< unsigned int > > * >(argp2);
{
try {
result = ((Frame const *)arg1)->toGlobalIndex((std::vector< unsigned int,std::allocator< unsigned int > > const &)*arg2);
} catch (const std::exception& ex) {
// message shown in the Python interpreter
const std::string msg {
"BornAgain C++ Exception: " + std::string(ex.what())
};
SWIG_exception(SWIG_RuntimeError, msg.c_str());
}
}
resultobj = SWIG_From_size_t(static_cast< size_t >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_Frame_hasSameSizes(PyObject *self, PyObject *args) {
PyObject *resultobj = 0;
Frame *arg1 = (Frame *) 0 ;
......@@ -29767,7 +29723,6 @@ static PyMethodDef SwigMethods[] = {
{ "Frame_projectedCoord", _wrap_Frame_projectedCoord, METH_VARARGS, "Frame_projectedCoord(Frame self, size_t i_flat, size_t k_axis) -> double"},
{ "Frame_allIndices", _wrap_Frame_allIndices, METH_VARARGS, "Frame_allIndices(Frame self, size_t i_flat) -> vector_integer_t"},
{ "Frame_projectedIndex", _wrap_Frame_projectedIndex, METH_VARARGS, "Frame_projectedIndex(Frame self, size_t i, size_t k_axis) -> size_t"},
{ "Frame_toGlobalIndex", _wrap_Frame_toGlobalIndex, METH_VARARGS, "Frame_toGlobalIndex(Frame self, std::vector< unsigned int,std::allocator< unsigned int > > const & axes_indices) -> size_t"},
{ "Frame_hasSameSizes", _wrap_Frame_hasSameSizes, METH_VARARGS, "Frame_hasSameSizes(Frame self, Frame arg2) -> bool"},
{ "Frame___eq__", _wrap_Frame___eq__, METH_VARARGS, "Frame___eq__(Frame self, Frame arg2) -> bool"},
{ "Frame_plottableFrame", _wrap_Frame_plottableFrame, METH_O, "Frame_plottableFrame(Frame self) -> Frame"},
......@@ -29883,7 +29838,6 @@ static swig_type_info _swigt__p_std__vectorT_std__pairT_double_double_t_std__all
static swig_type_info _swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t = {"_p_std__vectorT_std__string_std__allocatorT_std__string_t_t", "std::vector< std::string,std::allocator< std::string > > *|std::vector< std::string > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t = {"_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t", "std::vector< std::vector< double,std::allocator< double > > > *|std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *|std::vector< std::vector< double > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t = {"_p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t", "std::vector< std::vector< int,std::allocator< int > > > *|std::vector< std::vector< int,std::allocator< int > >,std::allocator< std::vector< int,std::allocator< int > > > > *|std::vector< std::vector< int > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t = {"_p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t", "std::vector< unsigned int,std::allocator< unsigned int > > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t = {"_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t", "std::vector< unsigned long,std::allocator< unsigned long > > *|std::vector< unsigned long > *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_swig__SwigPyIterator = {"_p_swig__SwigPyIterator", "swig::SwigPyIterator *", 0, 0, (void*)0, 0};
static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "uint8_t *|uint_fast8_t *|uint_least8_t *|unsigned char *", 0, 0, (void*)0, 0};
......@@ -29940,7 +29894,6 @@ static swig_type_info *swig_type_initial[] = {
&_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t,
&_swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t,
&_swigt__p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t,
&_swigt__p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,
&_swigt__p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t,
&_swigt__p_swig__SwigPyIterator,
&_swigt__p_unsigned_char,
......@@ -29997,7 +29950,6 @@ static swig_cast_info _swigc__p_std__vectorT_std__pairT_double_double_t_std__all
static swig_cast_info _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t[] = { {&_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t[] = { {&_swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t[] = { {&_swigt__p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t[] = { {&_swigt__p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t[] = { {&_swigt__p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_swig__SwigPyIterator[] = { {&_swigt__p_swig__SwigPyIterator, 0, 0, 0},{0, 0, 0, 0}};
static swig_cast_info _swigc__p_unsigned_char[] = { {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
......@@ -30054,7 +30006,6 @@ static swig_cast_info *swig_cast_initial[] = {
_swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t,
_swigc__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t,
_swigc__p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t,
_swigc__p_std__vectorT_unsigned_int_std__allocatorT_unsigned_int_t_t,
_swigc__p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t,
_swigc__p_swig__SwigPyIterator,
_swigc__p_unsigned_char,
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment