Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Domain Data Mgmt Services
Seismic
Open ZGY
Commits
3fa8f6b2
Commit
3fa8f6b2
authored
Jul 05, 2021
by
Paal Kvamme
Browse files
Dotting the i's and crossing the t's.
parent
7083377d
Pipeline
#50219
passed with stages
in 7 minutes and 44 seconds
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
native/src/impl/bulk.cpp
View file @
3fa8f6b2
...
...
@@ -885,10 +885,10 @@ static void
fillMe
(
void
*
data
,
const
std
::
array
<
std
::
int64_t
,
3
>&
size
,
double
value
,
RawDataType
dtype
)
{
switch
(
dtype
)
{
case
RawDataType
::
Float32
:
fillMeT
<
float
>
(
data
,
size
,
value
);
case
RawDataType
::
SignedInt16
:
fillMeT
<
std
::
int16_t
>
(
data
,
size
,
value
);
case
RawDataType
::
SignedInt8
:
fillMeT
<
std
::
int8_t
>
(
data
,
size
,
value
);
default:
throw
OpenZGY
::
Errors
::
ZgyInternalError
(
"Unrecognized valuetype."
);
case
RawDataType
::
Float32
:
fillMeT
<
float
>
(
data
,
size
,
value
);
break
;
case
RawDataType
::
SignedInt16
:
fillMeT
<
std
::
int16_t
>
(
data
,
size
,
value
);
break
;
case
RawDataType
::
SignedInt8
:
fillMeT
<
std
::
int8_t
>
(
data
,
size
,
value
);
break
;
default:
throw
OpenZGY
::
Errors
::
ZgyInternalError
(
"Unrecognized valuetype."
+
std
::
to_string
(
int
(
dtype
))
);
}
}
}
...
...
@@ -932,10 +932,12 @@ ZgyInternalBulk::expeditedRead(const std::array<std::int64_t,3>& start, const st
switch
(
brick
.
status
)
{
case
BrickStatus
::
Missing
:
_logger
(
2
,
"Expedited read missing"
);
fillMe
(
data
,
size
,
this
->
_metadata
->
ih
().
defaultstorage
(),
result_type
);
break
;
case
BrickStatus
::
Constant
:
_logger
(
2
,
"Expedited read constant"
);
fillMe
(
data
,
size
,
brick
.
double_constvalue
,
result_type
);
break
;
...
...
@@ -944,11 +946,13 @@ ZgyInternalBulk::expeditedRead(const std::array<std::int64_t,3>& start, const st
static_cast
<
std
::
int64_t
>
(
RawDataTypeDetails
(
result_type
).
size
))
{
throw
OpenZGY
::
Errors
::
ZgyInternalError
(
"Bad size in expeditedRead."
);
}
_logger
(
2
,
"Expedited read regular"
);
this
->
_file
->
xx_read
(
data
,
brick
.
offset_in_file
,
brick
.
size_in_file
,
UsageHint
::
Data
);
// TODO-High: Fill area outside survey with defaultstorage.
break
;
case
BrickStatus
::
Compressed
:
_logger
(
2
,
"Expedited read compressed (not implemented)"
);
return
false
;
default:
...
...
@@ -1216,7 +1220,7 @@ ZgyInternalBulk::_validateUserPosition(
<<
" lod "
<<
lod
<<
" is empty or outside the valid range"
<<
" (0, 0, 0)"
<<
" to "
<<
ssize
[
0
]
<<
", "
<<
ssize
[
1
]
<<
", "
<<
ssize
[
2
]
<<
")"
<<
" to
(
"
<<
ssize
[
0
]
<<
", "
<<
ssize
[
1
]
<<
", "
<<
ssize
[
2
]
<<
")"
;
_logger
(
1
,
ss
.
str
()
+
"
\n
"
);
throw
OpenZGY
::
Errors
::
ZgyUserError
(
ss
.
str
());
...
...
native/src/impl/file.cpp
View file @
3fa8f6b2
...
...
@@ -289,6 +289,7 @@ FileADT::_allocate(std::int64_t size)
//std::cerr << "FileADT::_allocate() is evicting entries." << std::endl;
std
::
random_shuffle
(
cache
.
begin
(),
cache
.
end
());
cache
.
resize
(
lowwater
);
hint
=
0
;
}
cache
.
push_back
(
result
);
}
...
...
native/src/test/test_api.cpp
View file @
3fa8f6b2
...
...
@@ -2408,13 +2408,13 @@ do_testbat(const std::string& filename)
}
else
if
((
pos
%
13
)
==
0
)
{
// Constant-value
data
[
0
]
=
-
(
ii
/
bs
[
0
])
-
(
jj
/
bs
[
1
])
-
(
kk
/
bs
[
2
]);
data
[
0
]
=
static_cast
<
T
>
(
-
(
ii
/
bs
[
0
])
-
(
jj
/
bs
[
1
])
-
(
kk
/
bs
[
2
])
)
;
writer
->
writeconst
(
size3i_t
{
ii
,
jj
,
kk
},
bs
,
data
.
data
());
}
else
{
data
[
0
]
=
ii
/
bs
[
0
];
data
[
1
]
=
jj
/
bs
[
1
];
data
[
2
]
=
kk
/
bs
[
2
];
data
[
0
]
=
static_cast
<
T
>
(
ii
/
bs
[
0
]
)
;
data
[
1
]
=
static_cast
<
T
>
(
jj
/
bs
[
1
]
)
;
data
[
2
]
=
static_cast
<
T
>
(
kk
/
bs
[
2
]
)
;
writer
->
write
(
size3i_t
{
ii
,
jj
,
kk
},
bs
,
data
.
data
());
}
++
pos
;
...
...
@@ -2452,8 +2452,8 @@ do_testbat(const std::string& filename)
const
int
kk
=
tmppos
%
6
;
tmppos
/=
6
;
const
int
jj
=
tmppos
%
5
;
tmppos
/=
5
;
const
int
ii
=
tmppos
%
4
;
std
::
fill
(
check1
.
begin
(),
check1
.
end
(),
-
88
);
std
::
fill
(
check2
.
begin
(),
check2
.
end
(),
-
66
);
std
::
fill
(
check1
.
begin
(),
check1
.
end
(),
static_cast
<
T
>
(
-
88
)
)
;
std
::
fill
(
check2
.
begin
(),
check2
.
end
(),
static_cast
<
T
>
(
-
66
)
)
;
guard
.
run
([
&
](){
// Will trigger both tweaks, "brick shortcut" has precedence.
reader
->
read
(
size3i_t
{
ii
*
bs
[
0
],
jj
*
bs
[
1
],
kk
*
bs
[
2
]},
bs
,
check1
.
data
());
...
...
@@ -2464,11 +2464,11 @@ do_testbat(const std::string& filename)
expect
=
std
::
array
<
float
,
3
>
{
0
,
0
,
0
};
}
else
if
((
pos
%
13
)
==
0
)
{
T
value
=
-
(
ii
+
jj
+
kk
);
expect
=
std
::
array
<
float
,
3
>
{
value
,
value
,
value
};
T
value
=
static_cast
<
T
>
(
-
(
ii
+
jj
+
kk
)
)
;
expect
=
std
::
array
<
float
,
3
>
{
(
float
)
value
,
(
float
)
value
,
(
float
)
value
};
}
else
{
expect
=
std
::
array
<
float
,
3
>
{
ii
,
jj
,
kk
};
expect
=
std
::
array
<
float
,
3
>
{
(
float
)
ii
,
(
float
)
jj
,
(
float
)
kk
};
}
if
(
check1
[
0
]
!=
expect
[
0
]
||
check1
[
1
]
!=
expect
[
1
]
||
check1
[
2
]
!=
expect
[
2
])
{
std
::
string
expect_str
=
formatMe
(
pos
,
ii
,
jj
,
kk
,
expect
.
data
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment