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
Kate Kader
Open VDS
Commits
9163830d
Commit
9163830d
authored
Nov 12, 2019
by
Jørgen Lind
Browse files
Capital letter on public members and member functions in API
parent
30e188fd
Changes
36
Expand all
Hide whitespace changes
Inline
Side-by-side
python/openvds/core.cpp
View file @
9163830d
...
...
@@ -26,6 +26,6 @@ PYBIND11_MODULE(core, m) {
py
::
class_
<
OpenVDS
::
VolumeDataAxisDescriptor
>
(
m
,
"Axis"
)
.
def
(
py
::
init
<>
())
.
def
(
py
::
init
<
int
,
const
char
*
,
const
char
*
,
float
,
float
>
())
.
def_property_readonly
(
"name"
,
&
OpenVDS
::
VolumeDataAxisDescriptor
::
g
etName
)
.
def_property_readonly
(
"name"
,
&
OpenVDS
::
VolumeDataAxisDescriptor
::
G
etName
)
;
}
src/IO/IOManager.cpp
View file @
9163830d
...
...
@@ -44,8 +44,8 @@ IOManager* IOManager::createIOManager(const OpenOptions& options, Error &error)
case
OpenOptions
::
AWS
:
return
new
IOManagerAWS
(
static_cast
<
const
AWSOpenOptions
&>
(
options
),
error
);
default:
error
.
c
ode
=
-
1
;
error
.
s
tring
=
"Unknwon type for OpenOptions"
;
error
.
C
ode
=
-
1
;
error
.
S
tring
=
"Unknwon type for OpenOptions"
;
return
nullptr
;
}
}
...
...
src/IO/IOManagerAWS.cpp
View file @
9163830d
...
...
@@ -130,8 +130,8 @@ namespace OpenVDS
{
lock
.
lock
();
auto
s3error
=
getObjectOutcome
.
GetError
();
objReq
->
m_error
.
c
ode
=
int
(
s3error
.
GetResponseCode
());
objReq
->
m_error
.
s
tring
=
(
s3error
.
GetExceptionName
()
+
" : "
+
s3error
.
GetMessage
()).
c_str
();
objReq
->
m_error
.
C
ode
=
int
(
s3error
.
GetResponseCode
());
objReq
->
m_error
.
S
tring
=
(
s3error
.
GetExceptionName
()
+
" : "
+
s3error
.
GetMessage
()).
c_str
();
}
objReq
->
m_done
=
true
;
...
...
@@ -185,12 +185,12 @@ namespace OpenVDS
std
::
unique_lock
<
std
::
mutex
>
lock
(
m_mutex
);
if
(
!
m_done
)
{
error
.
c
ode
=
-
1
;
error
.
s
tring
=
"Download not done."
;
error
.
C
ode
=
-
1
;
error
.
S
tring
=
"Download not done."
;
return
false
;
}
error
=
m_error
;
return
m_error
.
c
ode
==
0
;
return
m_error
.
C
ode
==
0
;
}
void
DownloadRequestAWS
::
cancel
()
...
...
@@ -208,8 +208,8 @@ namespace OpenVDS
if
(
!
outcome
.
IsSuccess
())
{
auto
s3error
=
outcome
.
GetError
();
objReq
->
m_error
.
c
ode
=
int
(
s3error
.
GetResponseCode
());
objReq
->
m_error
.
s
tring
=
(
s3error
.
GetExceptionName
()
+
" : "
+
s3error
.
GetMessage
()).
c_str
();
objReq
->
m_error
.
C
ode
=
int
(
s3error
.
GetResponseCode
());
objReq
->
m_error
.
S
tring
=
(
s3error
.
GetExceptionName
()
+
" : "
+
s3error
.
GetMessage
()).
c_str
();
}
objReq
->
m_done
=
true
;
...
...
@@ -265,12 +265,12 @@ namespace OpenVDS
std
::
unique_lock
<
std
::
mutex
>
lock
(
m_mutex
);
if
(
!
m_done
)
{
error
.
c
ode
=
-
1
;
error
.
s
tring
=
"Download not done."
;
error
.
C
ode
=
-
1
;
error
.
S
tring
=
"Download not done."
;
return
false
;
}
error
=
m_error
;
return
m_error
.
c
ode
==
0
;
return
m_error
.
C
ode
==
0
;
}
void
UploadRequestAWS
::
cancel
()
{
...
...
@@ -278,14 +278,14 @@ namespace OpenVDS
}
IOManagerAWS
::
IOManagerAWS
(
const
AWSOpenOptions
&
openOptions
,
Error
&
error
)
:
m_region
(
openOptions
.
r
egion
)
,
m_bucket
(
openOptions
.
b
ucket
)
,
m_objectId
(
openOptions
.
k
ey
)
:
m_region
(
openOptions
.
R
egion
)
,
m_bucket
(
openOptions
.
B
ucket
)
,
m_objectId
(
openOptions
.
K
ey
)
{
if
(
m_region
.
empty
()
||
m_bucket
.
empty
())
{
error
.
c
ode
=
-
1
;
error
.
s
tring
=
"AWS Config error. Empty bucket or region"
;
error
.
C
ode
=
-
1
;
error
.
S
tring
=
"AWS Config error. Empty bucket or region"
;
return
;
}
...
...
src/OpenVDS.cpp
View file @
9163830d
...
...
@@ -34,11 +34,11 @@
namespace
OpenVDS
{
VDSHandle
*
o
pen
(
const
OpenOptions
&
options
,
Error
&
error
)
VDSHandle
*
O
pen
(
const
OpenOptions
&
options
,
Error
&
error
)
{
error
=
Error
();
std
::
unique_ptr
<
VDSHandle
>
ret
(
new
VDSHandle
(
options
,
error
));
if
(
error
.
c
ode
)
if
(
error
.
C
ode
)
return
nullptr
;
if
(
!
downloadAndParseVolumeDataLayoutAndLayerStatus
(
*
ret
.
get
(),
error
))
...
...
@@ -50,14 +50,14 @@ VDSHandle *open(const OpenOptions &options, Error &error)
return
ret
.
release
();
}
VolumeDataLayout
*
g
etLayout
(
VDSHandle
*
handle
)
VolumeDataLayout
*
G
etLayout
(
VDSHandle
*
handle
)
{
if
(
!
handle
)
return
nullptr
;
return
handle
->
volumeDataLayout
.
get
();
}
VolumeDataAccessManager
*
g
etDataAccessManager
(
VDSHandle
*
handle
)
VolumeDataAccessManager
*
G
etDataAccessManager
(
VDSHandle
*
handle
)
{
if
(
!
handle
)
return
nullptr
;
...
...
@@ -75,10 +75,10 @@ const char *addDescriptorString(std::string const &descriptorString, VDSHandle &
static
int32_t
getInternalCubeSizeLOD0
(
const
VolumeDataLayoutDescriptor
&
desc
)
{
int32_t
size
=
int32_t
(
1
)
<<
desc
.
g
etBrickSize
();
int32_t
size
=
int32_t
(
1
)
<<
desc
.
G
etBrickSize
();
size
-=
desc
.
g
etNegativeMargin
();
size
-=
desc
.
g
etPositiveMargin
();
size
-=
desc
.
G
etNegativeMargin
();
size
-=
desc
.
G
etPositiveMargin
();
assert
(
size
>
0
);
...
...
@@ -87,7 +87,7 @@ static int32_t getInternalCubeSizeLOD0(const VolumeDataLayoutDescriptor &desc)
static
int32_t
getLODCount
(
const
VolumeDataLayoutDescriptor
&
desc
)
{
return
desc
.
g
etLODLevels
()
+
1
;
return
desc
.
G
etLODLevels
()
+
1
;
}
std
::
string
getLayerName
(
VolumeDataLayer
const
&
volumeDataLayer
)
...
...
@@ -98,8 +98,8 @@ std::string getLayerName(VolumeDataLayer const &volumeDataLayer)
}
else
{
assert
(
std
::
string
(
volumeDataLayer
.
getVolumeDataChannelDescriptor
().
g
etName
())
!=
""
);
return
fmt
::
format
(
"{}{}LOD{}"
,
volumeDataLayer
.
getVolumeDataChannelDescriptor
().
g
etName
(),
DimensionGroupUtil
::
getDimensionGroupName
(
volumeDataLayer
.
getPrimaryChannelLayer
().
getChunkDimensionGroup
()),
volumeDataLayer
.
getLOD
());
assert
(
std
::
string
(
volumeDataLayer
.
getVolumeDataChannelDescriptor
().
G
etName
())
!=
""
);
return
fmt
::
format
(
"{}{}LOD{}"
,
volumeDataLayer
.
getVolumeDataChannelDescriptor
().
G
etName
(),
DimensionGroupUtil
::
getDimensionGroupName
(
volumeDataLayer
.
getPrimaryChannelLayer
().
getChunkDimensionGroup
()),
volumeDataLayer
.
getLOD
());
}
}
...
...
@@ -160,14 +160,14 @@ void createVolumeDataLayout(VDSHandle &handle)
assert
(
nChunkDimensionality
==
2
||
nChunkDimensionality
==
3
);
int32_t
physicalLODLevels
=
(
nChunkDimensionality
==
3
||
handle
.
layoutDescriptor
.
i
sCreate2DLODs
())
?
getLODCount
(
handle
.
layoutDescriptor
)
:
1
;
int32_t
brickSize
=
getInternalCubeSizeLOD0
(
handle
.
layoutDescriptor
)
*
(
nChunkDimensionality
==
2
?
handle
.
layoutDescriptor
.
g
etBrickSizeMultiplier2D
()
:
1
);
int32_t
physicalLODLevels
=
(
nChunkDimensionality
==
3
||
handle
.
layoutDescriptor
.
I
sCreate2DLODs
())
?
getLODCount
(
handle
.
layoutDescriptor
)
:
1
;
int32_t
brickSize
=
getInternalCubeSizeLOD0
(
handle
.
layoutDescriptor
)
*
(
nChunkDimensionality
==
2
?
handle
.
layoutDescriptor
.
G
etBrickSizeMultiplier2D
()
:
1
);
handle
.
volumeDataLayout
->
createLayers
(
dimensionGroup
,
brickSize
,
physicalLODLevels
,
handle
.
produceStatuses
[
DimensionGroupUtil
::
getDimensionsNDFromDimensionGroup
(
dimensionGroup
)]);
}
}
VDSHandle
*
c
reate
(
const
OpenOptions
&
options
,
VolumeDataLayoutDescriptor
const
&
layoutDescriptor
,
std
::
vector
<
VolumeDataAxisDescriptor
>
const
&
axisDescriptors
,
std
::
vector
<
VolumeDataChannelDescriptor
>
const
&
channelDescriptors
,
MetadataContainer
const
&
metadataContainer
,
Error
&
error
)
VDSHandle
*
C
reate
(
const
OpenOptions
&
options
,
VolumeDataLayoutDescriptor
const
&
layoutDescriptor
,
std
::
vector
<
VolumeDataAxisDescriptor
>
const
&
axisDescriptors
,
std
::
vector
<
VolumeDataChannelDescriptor
>
const
&
channelDescriptors
,
MetadataContainer
const
&
metadataContainer
,
Error
&
error
)
{
error
=
Error
();
std
::
unique_ptr
<
VDSHandle
>
handle
(
new
VDSHandle
(
options
,
error
));
...
...
@@ -176,25 +176,25 @@ VDSHandle* create(const OpenOptions& options, VolumeDataLayoutDescriptor const &
for
(
auto
axisDescriptor
:
axisDescriptors
)
{
handle
->
axisDescriptors
.
push_back
(
VolumeDataAxisDescriptor
(
axisDescriptor
.
g
etNumSamples
(),
addDescriptorString
(
axisDescriptor
.
g
etName
(),
*
handle
),
addDescriptorString
(
axisDescriptor
.
g
etUnit
(),
*
handle
),
axisDescriptor
.
g
etCoordinateMin
(),
axisDescriptor
.
g
etCoordinateMax
()));
handle
->
axisDescriptors
.
push_back
(
VolumeDataAxisDescriptor
(
axisDescriptor
.
G
etNumSamples
(),
addDescriptorString
(
axisDescriptor
.
G
etName
(),
*
handle
),
addDescriptorString
(
axisDescriptor
.
G
etUnit
(),
*
handle
),
axisDescriptor
.
G
etCoordinateMin
(),
axisDescriptor
.
G
etCoordinateMax
()));
}
for
(
auto
channelDescriptor
:
channelDescriptors
)
{
VolumeDataChannelDescriptor
::
Flags
flags
=
VolumeDataChannelDescriptor
::
Default
;
if
(
channelDescriptor
.
i
sDiscrete
())
flags
=
flags
|
VolumeDataChannelDescriptor
::
DiscreteData
;
if
(
!
channelDescriptor
.
i
sAllowLossyCompression
())
flags
=
flags
|
VolumeDataChannelDescriptor
::
NoLossyCompression
;
if
(
channelDescriptor
.
i
sUseZipForLosslessCompression
())
flags
=
flags
|
VolumeDataChannelDescriptor
::
NoLossyCompressionUseZip
;
if
(
!
channelDescriptor
.
i
sRenderable
())
flags
=
flags
|
VolumeDataChannelDescriptor
::
NotRenderable
;
if
(
channelDescriptor
.
I
sDiscrete
())
flags
=
flags
|
VolumeDataChannelDescriptor
::
DiscreteData
;
if
(
!
channelDescriptor
.
I
sAllowLossyCompression
())
flags
=
flags
|
VolumeDataChannelDescriptor
::
NoLossyCompression
;
if
(
channelDescriptor
.
I
sUseZipForLosslessCompression
())
flags
=
flags
|
VolumeDataChannelDescriptor
::
NoLossyCompressionUseZip
;
if
(
!
channelDescriptor
.
I
sRenderable
())
flags
=
flags
|
VolumeDataChannelDescriptor
::
NotRenderable
;
if
(
channelDescriptor
.
i
sUseNoValue
())
if
(
channelDescriptor
.
I
sUseNoValue
())
{
handle
->
channelDescriptors
.
push_back
(
VolumeDataChannelDescriptor
(
channelDescriptor
.
g
etFormat
(),
channelDescriptor
.
g
etComponents
(),
addDescriptorString
(
channelDescriptor
.
g
etName
(),
*
handle
),
addDescriptorString
(
channelDescriptor
.
g
etUnit
(),
*
handle
),
channelDescriptor
.
g
etValueRangeMin
(),
channelDescriptor
.
g
etValueRangeMax
(),
channelDescriptor
.
g
etMapping
(),
channelDescriptor
.
g
etMappedValueCount
(),
flags
,
channelDescriptor
.
g
etNoValue
(),
channelDescriptor
.
g
etIntegerScale
(),
channelDescriptor
.
g
etIntegerOffset
()));
handle
->
channelDescriptors
.
push_back
(
VolumeDataChannelDescriptor
(
channelDescriptor
.
G
etFormat
(),
channelDescriptor
.
G
etComponents
(),
addDescriptorString
(
channelDescriptor
.
G
etName
(),
*
handle
),
addDescriptorString
(
channelDescriptor
.
G
etUnit
(),
*
handle
),
channelDescriptor
.
G
etValueRangeMin
(),
channelDescriptor
.
G
etValueRangeMax
(),
channelDescriptor
.
G
etMapping
(),
channelDescriptor
.
G
etMappedValueCount
(),
flags
,
channelDescriptor
.
G
etNoValue
(),
channelDescriptor
.
G
etIntegerScale
(),
channelDescriptor
.
G
etIntegerOffset
()));
}
else
{
handle
->
channelDescriptors
.
push_back
(
VolumeDataChannelDescriptor
(
channelDescriptor
.
g
etFormat
(),
channelDescriptor
.
g
etComponents
(),
addDescriptorString
(
channelDescriptor
.
g
etName
(),
*
handle
),
addDescriptorString
(
channelDescriptor
.
g
etUnit
(),
*
handle
),
channelDescriptor
.
g
etValueRangeMin
(),
channelDescriptor
.
g
etValueRangeMax
(),
channelDescriptor
.
g
etMapping
(),
channelDescriptor
.
g
etMappedValueCount
(),
flags
,
channelDescriptor
.
g
etIntegerScale
(),
channelDescriptor
.
g
etIntegerOffset
()));
handle
->
channelDescriptors
.
push_back
(
VolumeDataChannelDescriptor
(
channelDescriptor
.
G
etFormat
(),
channelDescriptor
.
G
etComponents
(),
addDescriptorString
(
channelDescriptor
.
G
etName
(),
*
handle
),
addDescriptorString
(
channelDescriptor
.
G
etUnit
(),
*
handle
),
channelDescriptor
.
G
etValueRangeMin
(),
channelDescriptor
.
G
etValueRangeMax
(),
channelDescriptor
.
G
etMapping
(),
channelDescriptor
.
G
etMappedValueCount
(),
flags
,
channelDescriptor
.
G
etIntegerScale
(),
channelDescriptor
.
G
etIntegerOffset
()));
}
}
...
...
@@ -205,7 +205,7 @@ VDSHandle* create(const OpenOptions& options, VolumeDataLayoutDescriptor const &
createVolumeDataLayout
(
*
handle
);
if
(
error
.
c
ode
)
if
(
error
.
C
ode
)
return
nullptr
;
if
(
!
serializeAndUploadVolumeDataLayout
(
*
handle
,
error
))
...
...
@@ -217,7 +217,7 @@ VDSHandle* create(const OpenOptions& options, VolumeDataLayoutDescriptor const &
return
handle
.
release
();
}
void
d
estroy
(
VDSHandle
*
handle
)
void
D
estroy
(
VDSHandle
*
handle
)
{
delete
handle
;
}
...
...
src/OpenVDS/OpenVDS.h
View file @
9163830d
...
...
@@ -49,18 +49,18 @@ protected:
struct
AWSOpenOptions
:
OpenOptions
{
std
::
string
b
ucket
;
std
::
string
k
ey
;
std
::
string
r
egion
;
std
::
string
B
ucket
;
std
::
string
K
ey
;
std
::
string
R
egion
;
AWSOpenOptions
()
:
OpenOptions
(
AWS
)
{}
AWSOpenOptions
(
std
::
string
const
&
bucket
,
std
::
string
const
&
key
,
std
::
string
const
&
region
)
:
OpenOptions
(
AWS
),
b
ucket
(
bucket
),
k
ey
(
key
),
r
egion
(
region
)
{}
AWSOpenOptions
(
std
::
string
const
&
bucket
,
std
::
string
const
&
key
,
std
::
string
const
&
region
)
:
OpenOptions
(
AWS
),
B
ucket
(
bucket
),
K
ey
(
key
),
R
egion
(
region
)
{}
};
struct
Error
{
int
c
ode
=
0
;
std
::
string
s
tring
;
int
C
ode
=
0
;
std
::
string
S
tring
;
};
enum
class
Access
...
...
@@ -73,12 +73,12 @@ class VolumeDataLayout;
class
VolumeDataAccessManager
;
class
VolumeDataPageAccessor
;
OPENVDS_EXPORT
VDSHandle
*
o
pen
(
const
OpenOptions
&
options
,
Error
&
error
);
OPENVDS_EXPORT
VDSHandle
*
c
reate
(
const
OpenOptions
&
options
,
VolumeDataLayoutDescriptor
const
&
layoutDescriptor
,
std
::
vector
<
VolumeDataAxisDescriptor
>
const
&
axisDescriptors
,
std
::
vector
<
VolumeDataChannelDescriptor
>
const
&
channelDescriptors
,
MetadataContainer
const
&
metadataContainer
,
Error
&
error
);
OPENVDS_EXPORT
void
d
estroy
(
VDSHandle
*
handle
);
OPENVDS_EXPORT
VDSHandle
*
O
pen
(
const
OpenOptions
&
options
,
Error
&
error
);
OPENVDS_EXPORT
VDSHandle
*
C
reate
(
const
OpenOptions
&
options
,
VolumeDataLayoutDescriptor
const
&
layoutDescriptor
,
std
::
vector
<
VolumeDataAxisDescriptor
>
const
&
axisDescriptors
,
std
::
vector
<
VolumeDataChannelDescriptor
>
const
&
channelDescriptors
,
MetadataContainer
const
&
metadataContainer
,
Error
&
error
);
OPENVDS_EXPORT
void
D
estroy
(
VDSHandle
*
handle
);
OPENVDS_EXPORT
VolumeDataLayout
*
g
etLayout
(
VDSHandle
*
handle
);
OPENVDS_EXPORT
VolumeDataAccessManager
*
g
etDataAccessManager
(
VDSHandle
*
handle
);
OPENVDS_EXPORT
VolumeDataLayout
*
G
etLayout
(
VDSHandle
*
handle
);
OPENVDS_EXPORT
VolumeDataAccessManager
*
G
etDataAccessManager
(
VDSHandle
*
handle
);
}
#endif //OPENVDS_H
src/OpenVDS/Range.h
View file @
9163830d
...
...
@@ -23,17 +23,17 @@ namespace OpenVDS
template
<
typename
T
>
struct
Range
{
T
m
in
;
T
m
ax
;
T
M
in
;
T
M
ax
;
Range
()
=
default
;
Range
(
T
min
,
T
max
)
:
m
in
(
min
),
m
ax
(
max
)
{}
Range
(
T
min
,
T
max
)
:
M
in
(
min
),
M
ax
(
max
)
{}
};
template
<
typename
T
>
T
rangeSize
(
const
Range
<
T
>
&
r
)
{
return
r
.
m
ax
-
r
.
m
in
;
return
r
.
M
ax
-
r
.
M
in
;
}
using
IntRange
=
Range
<
int
>
;
...
...
@@ -42,4 +42,4 @@ using DoubleRange = Range<double>;
}
#endif //RANGE_H
\ No newline at end of file
#endif //RANGE_H
src/OpenVDS/VolumeDataAccess.h
View file @
9163830d
This diff is collapsed.
Click to expand it.
src/OpenVDS/VolumeDataAxisDescriptor.h
View file @
9163830d
...
...
@@ -45,23 +45,23 @@ public:
VolumeDataAxisDescriptor
(
int
numSamples
,
const
char
*
name
,
const
char
*
unit
,
const
FloatRange
&
coordinateRange
)
:
m_numSamples
(
numSamples
),
m_name
(
name
),
m_unit
(
unit
),
m_coordinateRange
(
coordinateRange
)
{}
int
g
etNumSamples
()
const
{
return
m_numSamples
;
}
const
char
*
g
etName
()
const
{
return
m_name
;
}
const
char
*
g
etUnit
()
const
{
return
m_unit
;
}
float
g
etCoordinateMin
()
const
{
return
m_coordinateRange
.
m
in
;
}
float
g
etCoordinateMax
()
const
{
return
m_coordinateRange
.
m
ax
;
}
const
FloatRange
&
g
etCoordinateRange
()
const
{
return
m_coordinateRange
;
}
float
g
etCoordinateStep
()
const
{
return
(
m_numSamples
>
1
)
?
((
m_coordinateRange
.
m
ax
-
m_coordinateRange
.
m
in
)
/
(
m_numSamples
-
1
))
:
0
;
}
int
G
etNumSamples
()
const
{
return
m_numSamples
;
}
const
char
*
G
etName
()
const
{
return
m_name
;
}
const
char
*
G
etUnit
()
const
{
return
m_unit
;
}
float
G
etCoordinateMin
()
const
{
return
m_coordinateRange
.
M
in
;
}
float
G
etCoordinateMax
()
const
{
return
m_coordinateRange
.
M
ax
;
}
const
FloatRange
&
G
etCoordinateRange
()
const
{
return
m_coordinateRange
;
}
float
G
etCoordinateStep
()
const
{
return
(
m_numSamples
>
1
)
?
((
m_coordinateRange
.
M
ax
-
m_coordinateRange
.
M
in
)
/
(
m_numSamples
-
1
))
:
0
;
}
/// Convert a sample index on this axis to a coordinate value
/// \param sampleIndex the sample index to convert
/// \return the coordinate
float
s
ampleIndexToCoordinate
(
int
sampleIndex
)
{
return
m_coordinateRange
.
m
in
+
sampleIndex
*
g
etCoordinateStep
();
}
float
S
ampleIndexToCoordinate
(
int
sampleIndex
)
{
return
m_coordinateRange
.
M
in
+
sampleIndex
*
G
etCoordinateStep
();
}
/// Convert a coordinate to a sample index (rounding to the closest index)
/// \param coordinate the coordinate to convert
/// \return the sample index
int
c
oordinateToSampleIndex
(
float
coordinate
)
{
return
(
coordinate
==
m_coordinateRange
.
m
in
)
?
0
:
(
int
)
floorf
(((
coordinate
-
m_coordinateRange
.
m
in
)
/
(
m_coordinateRange
.
m
ax
-
m_coordinateRange
.
m
in
))
*
(
m_numSamples
-
1
)
+
0.5
f
);
}
int
C
oordinateToSampleIndex
(
float
coordinate
)
{
return
(
coordinate
==
m_coordinateRange
.
M
in
)
?
0
:
(
int
)
floorf
(((
coordinate
-
m_coordinateRange
.
M
in
)
/
(
m_coordinateRange
.
M
ax
-
m_coordinateRange
.
M
in
))
*
(
m_numSamples
-
1
)
+
0.5
f
);
}
};
}
#endif //VOLUMEDATAAXISDESCRIPTOR_H
...
...
src/OpenVDS/VolumeDataChannelDescriptor.h
View file @
9163830d
...
...
@@ -173,26 +173,26 @@ public:
VolumeDataChannelDescriptor
(
Format
format
,
Components
components
,
const
char
*
name
,
const
char
*
unit
,
float
valueRangeMin
,
float
valueRangeMax
,
VolumeDataMapping
mapping
,
int
mappedValueCount
,
enum
Flags
flags
,
float
noValue
,
float
integerScale
,
float
integerOffset
)
:
m_format
(
format
),
m_components
(
components
),
m_name
(
name
),
m_unit
(
unit
),
m_valueRange
(
valueRangeMin
,
valueRangeMax
),
m_mapping
(
mapping
),
m_mappedValueCount
(
mappedValueCount
),
m_flags
(
flags
),
m_useNoValue
(
true
),
m_noValue
(
noValue
),
m_integerScale
(
integerScale
),
m_integerOffset
(
integerOffset
)
{}
Format
g
etFormat
()
const
{
return
m_format
;
}
Components
g
etComponents
()
const
{
return
m_components
;
}
bool
i
sDiscrete
()
const
{
return
(
m_flags
&
DiscreteData
)
||
m_format
==
Format_1Bit
;
}
bool
i
sRenderable
()
const
{
return
!
(
m_flags
&
NotRenderable
);
}
bool
i
sAllowLossyCompression
()
const
{
return
!
(
m_flags
&
NoLossyCompression
)
&&
!
i
sDiscrete
();
}
bool
i
sUseZipForLosslessCompression
()
const
{
return
(
m_flags
&
NoLossyCompressionUseZip
)
==
NoLossyCompressionUseZip
;
}
const
char
*
g
etName
()
const
{
return
m_name
;
}
const
char
*
g
etUnit
()
const
{
return
m_unit
;
}
const
FloatRange
&
g
etValueRange
()
const
{
return
m_valueRange
;
}
float
g
etValueRangeMin
()
const
{
return
m_valueRange
.
m
in
;
}
float
g
etValueRangeMax
()
const
{
return
m_valueRange
.
m
ax
;
}
VolumeDataMapping
g
etMapping
()
const
{
return
m_mapping
;
}
int
g
etMappedValueCount
()
const
{
return
m_mappedValueCount
;
}
bool
i
sUseNoValue
()
const
{
return
m_useNoValue
;
}
float
g
etNoValue
()
const
{
return
m_noValue
;
}
float
g
etIntegerScale
()
const
{
return
m_integerScale
;
}
float
g
etIntegerOffset
()
const
{
return
m_integerOffset
;
}
Format
G
etFormat
()
const
{
return
m_format
;
}
Components
G
etComponents
()
const
{
return
m_components
;
}
bool
I
sDiscrete
()
const
{
return
(
m_flags
&
DiscreteData
)
||
m_format
==
Format_1Bit
;
}
bool
I
sRenderable
()
const
{
return
!
(
m_flags
&
NotRenderable
);
}
bool
I
sAllowLossyCompression
()
const
{
return
!
(
m_flags
&
NoLossyCompression
)
&&
!
I
sDiscrete
();
}
bool
I
sUseZipForLosslessCompression
()
const
{
return
(
m_flags
&
NoLossyCompressionUseZip
)
==
NoLossyCompressionUseZip
;
}
const
char
*
G
etName
()
const
{
return
m_name
;
}
const
char
*
G
etUnit
()
const
{
return
m_unit
;
}
const
FloatRange
&
G
etValueRange
()
const
{
return
m_valueRange
;
}
float
G
etValueRangeMin
()
const
{
return
m_valueRange
.
M
in
;
}
float
G
etValueRangeMax
()
const
{
return
m_valueRange
.
M
ax
;
}
VolumeDataMapping
G
etMapping
()
const
{
return
m_mapping
;
}
int
G
etMappedValueCount
()
const
{
return
m_mappedValueCount
;
}
bool
I
sUseNoValue
()
const
{
return
m_useNoValue
;
}
float
G
etNoValue
()
const
{
return
m_noValue
;
}
float
G
etIntegerScale
()
const
{
return
m_integerScale
;
}
float
G
etIntegerOffset
()
const
{
return
m_integerOffset
;
}
/// Named constructor for a trace mapped channel
/// \param format the data format for this channel
...
...
src/OpenVDS/VolumeDataLayout.h
View file @
9163830d
...
...
@@ -35,67 +35,67 @@ protected:
virtual
~
VolumeDataLayout
()
{};
public:
virtual
uint64_t
g
etContentsHash
()
const
=
0
;
///< gets the contents hash of this VDS
G
etContentsHash
()
const
=
0
;
///< gets the contents hash of this VDS
virtual
int
g
etDimensionality
()
const
=
0
;
///< gets the number of dimensions in this VDS
virtual
int
G
etDimensionality
()
const
=
0
;
///< gets the number of dimensions in this VDS
virtual
int
g
etChannelCount
()
const
=
0
;
///< gets the number of channels in this VDS
virtual
int
G
etChannelCount
()
const
=
0
;
///< gets the number of channels in this VDS
virtual
bool
i
sChannelAvailable
(
const
char
*
channelName
)
const
=
0
;
///< Returns true of the VDS contains
virtual
bool
I
sChannelAvailable
(
const
char
*
channelName
)
const
=
0
;
///< Returns true of the VDS contains
virtual
int
g
etChannelIndex
(
const
char
*
channelName
)
const
=
0
;
///< Returns the index of a the channel with the given name
virtual
int
G
etChannelIndex
(
const
char
*
channelName
)
const
=
0
;
///< Returns the index of a the channel with the given name
virtual
VolumeDataChannelDescriptor
g
etChannelDescriptor
(
int
channel
)
const
=
0
;
///< Returns the descriptor for the given channel index
G
etChannelDescriptor
(
int
channel
)
const
=
0
;
///< Returns the descriptor for the given channel index
virtual
VolumeDataAxisDescriptor
g
etAxisDescriptor
(
int
dimension
)
const
=
0
;
///< Returns the axis descriptor for the given dimension
G
etAxisDescriptor
(
int
dimension
)
const
=
0
;
///< Returns the axis descriptor for the given dimension
// These convenience functions provide access to the individual elements of the value descriptor
virtual
VolumeDataChannelDescriptor
::
Format
g
etChannelFormat
(
int
channel
)
const
=
0
;
///< get the format for the given channel index
G
etChannelFormat
(
int
channel
)
const
=
0
;
///< get the format for the given channel index
virtual
VolumeDataChannelDescriptor
::
Components
g
etChannelComponents
(
int
channel
)
const
=
0
;
///< get the vector count for the given channel index
G
etChannelComponents
(
int
channel
)
const
=
0
;
///< get the vector count for the given channel index
virtual
const
char
*
g
etChannelName
(
int
channel
)
const
=
0
;
///< get the name for the given channel index
G
etChannelName
(
int
channel
)
const
=
0
;
///< get the name for the given channel index
virtual
const
char
*
g
etChannelUnit
(
int
channel
)
const
=
0
;
///< get the unit for the given channel index
G
etChannelUnit
(
int
channel
)
const
=
0
;
///< get the unit for the given channel index
virtual
float
g
etChannelValueRangeMin
(
int
channel
)
const
=
0
;
///< get the value range minimum for the given channel index
virtual
float
G
etChannelValueRangeMin
(
int
channel
)
const
=
0
;
///< get the value range minimum for the given channel index
virtual
float
g
etChannelValueRangeMax
(
int
channel
)
const
=
0
;
///< get the value range maximum for the given channel index
virtual
float
G
etChannelValueRangeMax
(
int
channel
)
const
=
0
;
///< get the value range maximum for the given channel index
virtual
bool
i
sChannelDiscrete
(
int
channel
)
const
=
0
;
///< get the discrete flag for the the given channel index
virtual
bool
I
sChannelDiscrete
(
int
channel
)
const
=
0
;
///< get the discrete flag for the the given channel index
virtual
bool
i
sChannelRenderable
(
int
channel
)
const
=
0
;
///< get the renderable flag for the given channel index
virtual
bool
I
sChannelRenderable
(
int
channel
)
const
=
0
;
///< get the renderable flag for the given channel index
virtual
bool
i
sChannelAllowingLossyCompression
(
int
channel
)
const
=
0
;
///< get the allow lossy compression flag for the given channel index
virtual
bool
I
sChannelAllowingLossyCompression
(
int
channel
)
const
=
0
;
///< get the allow lossy compression flag for the given channel index
virtual
bool
i
sChannelUseZipForLosslessCompression
(
int
channel
)
const
=
0
;
///< get the use Zip when compressing flag for the given channel index
virtual
bool
I
sChannelUseZipForLosslessCompression
(
int
channel
)
const
=
0
;
///< get the use Zip when compressing flag for the given channel index
virtual
VolumeDataMapping
g
etChannelMapping
(
int
channel
)
const
=
0
;
///< get the mapping for the given channel index
G
etChannelMapping
(
int
channel
)
const
=
0
;
///< get the mapping for the given channel index
// These convenience functions provide access to the individual elements of the axis descriptors
virtual
int
g
etDimensionNumSamples
(
int
dimension
)
const
=
0
;
///< get the number of samples for the given dimension
virtual
int
G
etDimensionNumSamples
(
int
dimension
)
const
=
0
;
///< get the number of samples for the given dimension
virtual
const
char
*
g
etDimensionName
(
int
dimension
)
const
=
0
;
///< get the name for the given dimension
G
etDimensionName
(
int
dimension
)
const
=
0
;
///< get the name for the given dimension
virtual
const
char
*
g
etDimensionUnit
(
int
dimension
)
const
=
0
;
///< get the unit for the given dimension
virtual
float
g
etDimensionMin
(
int
dimension
)
const
=
0
;
///< get the coordinate minimum for the given dimension
virtual
float
g
etDimensionMax
(
int
dimension
)
const
=
0
;
///< get the coordinate maximum for the given dimension
G
etDimensionUnit
(
int
dimension
)
const
=
0
;
///< get the unit for the given dimension
virtual
float
G
etDimensionMin
(
int
dimension
)
const
=
0
;
///< get the coordinate minimum for the given dimension
virtual
float
G
etDimensionMax
(
int
dimension
)
const
=
0
;
///< get the coordinate maximum for the given dimension
// virtual VDSIJKGridDefinition
// getVDSIJKGridDefinitionFromMetadata() const = 0; ///< get the VDSIJKGridDefinition from the metadata in this VDS
virtual
bool
i
sChannelUseNoValue
(
int
channel
)
const
=
0
;
///< Returns true if the given channel index uses No Value
virtual
float
g
etChannelNoValue
(
int
channel
)
const
=
0
;
///< gets the No Value for the given channel index
virtual
bool
I
sChannelUseNoValue
(
int
channel
)
const
=
0
;
///< Returns true if the given channel index uses No Value
virtual
float
G
etChannelNoValue
(
int
channel
)
const
=
0
;
///< gets the No Value for the given channel index
virtual
float
g
etChannelIntegerScale
(
int
channel
)
const
=
0
;
///< Returns the integer scale for the given channel index
virtual
float
g
etChannelIntegerOffset
(
int
channel
)
const
=
0
;
///< Returns the integer offset for the given channel index
virtual
float
G
etChannelIntegerScale
(
int
channel
)
const
=
0
;
///< Returns the integer scale for the given channel index
virtual
float
G
etChannelIntegerOffset
(
int
channel
)
const
=
0
;
///< Returns the integer offset for the given channel index
};
}
...
...
src/OpenVDS/VolumeDataLayoutDescriptor.h
View file @
9163830d
...
...
@@ -76,21 +76,21 @@ public:
VolumeDataLayoutDescriptor
()
:
m_brickSize
(),
m_negativeMargin
(),
m_positiveMargin
(),
m_brickSize2DMultiplier
(),
m_lodLevels
(),
m_options
(),
m_fullResolutionDimension
()
{}
VolumeDataLayoutDescriptor
(
BrickSize
brickSize
,
int
negativeMargin
,
int
positiveMargin
,
int
brickSize2DMultiplier
,
LODLevels
lodLevels
,
Options
options
,
int
fullResolutionDimension
=
0
)
:
m_brickSize
(
brickSize
),
m_negativeMargin
(
negativeMargin
),
m_positiveMargin
(
positiveMargin
),
m_brickSize2DMultiplier
(
brickSize2DMultiplier
),
m_lodLevels
(
lodLevels
),
m_options
(
options
),
m_fullResolutionDimension
(
fullResolutionDimension
)
{}
bool
i
sValid
()
const
{
return
m_brickSize
!=
0
;
}
bool
I
sValid
()
const
{
return
m_brickSize
!=
0
;
}
BrickSize
g
etBrickSize
()
const
{
return
m_brickSize
;
}
int
g
etNegativeMargin
()
const
{
return
m_negativeMargin
;
}
int
g
etPositiveMargin
()
const
{
return
m_positiveMargin
;
}
int
g
etBrickSizeMultiplier2D
()
const
{
return
m_brickSize2DMultiplier
;
}
LODLevels
g
etLODLevels
()
const
{
return
m_lodLevels
;
}
BrickSize
G
etBrickSize
()
const
{
return
m_brickSize
;
}
int
G
etNegativeMargin
()
const
{
return
m_negativeMargin
;
}
int
G
etPositiveMargin
()
const
{
return
m_positiveMargin
;
}
int
G
etBrickSizeMultiplier2D
()
const
{
return
m_brickSize2DMultiplier
;
}
LODLevels
G
etLODLevels
()
const
{
return
m_lodLevels
;
}
bool
i
sCreate2DLODs
()
const
{
return
(
m_options
&
Options_Create2DLODs
)
!=
0
;
}
bool
i
sForceFullResolutionDimension
()
const
{
return
(
m_options
&
Options_ForceFullResolutionDimension
)
!=
0
;
}
bool
I
sCreate2DLODs
()
const
{
return
(
m_options
&
Options_Create2DLODs
)
!=
0
;
}
bool
I
sForceFullResolutionDimension
()
const
{
return
(
m_options
&
Options_ForceFullResolutionDimension
)
!=
0
;
}
int
g
etFullResolutionDimension
()
const
{
return
m_fullResolutionDimension
;
}
int
G
etFullResolutionDimension
()
const
{
return
m_fullResolutionDimension
;
}
};
inline
VolumeDataLayoutDescriptor
::
Options
operator
|
(
VolumeDataLayoutDescriptor
::
Options
lhs
,
VolumeDataLayoutDescriptor
::
Options
rhs
)
{
return
(
VolumeDataLayoutDescriptor
::
Options
)((
int
)
lhs
|
(
int
)
rhs
);
}
}
#endif //VOLUMEDATALAYOUTDESCRIPTOR_H
\ No newline at end of file
#endif //VOLUMEDATALAYOUTDESCRIPTOR_H
src/SEG-Y/SEGYExport.cpp
View file @
9163830d
...
...
@@ -79,11 +79,11 @@ main(int argc, char *argv[])
std
::
string
key
=
!
prefix
.
empty
()
?
prefix
+
"/"
+
persistentID
:
persistentID
;
std
::
unique_ptr
<
OpenVDS
::
VDSHandle
,
decltype
(
&
OpenVDS
::
d
estroy
)
>
vds
(
OpenVDS
::
o
pen
(
OpenVDS
::
AWSOpenOptions
(
bucket
,
key
,
region
),
openError
),
&
OpenVDS
::
d
estroy
);
std
::
unique_ptr
<
OpenVDS
::
VDSHandle
,
decltype
(
&
OpenVDS
::
D
estroy
)
>
vds
(
OpenVDS
::
O
pen
(
OpenVDS
::
AWSOpenOptions
(
bucket
,
key
,
region
),
openError
),
&
OpenVDS
::
D
estroy
);
if
(
openError
.
c
ode
!=
0
)
if
(
openError
.
C
ode
!=
0
)
{
fmt
::
print
(
stderr
,
"Could not open VDS: {}"
,
openError
.
s
tring
);
fmt
::
print
(
stderr
,
"Could not open VDS: {}"
,
openError
.
S
tring
);
return
EXIT_FAILURE
;
}
...
...
@@ -101,22 +101,22 @@ main(int argc, char *argv[])
return
EXIT_FAILURE
;
}
auto
dataAccessManager
=
OpenVDS
::
g
etDataAccessManager
(
vds
.
get
());
auto
volumeDataLayout
=
dataAccessManager
->
g
etVolumeDataLayout
();
auto
dataAccessManager
=
OpenVDS
::
G
etDataAccessManager
(
vds
.
get
());
auto
volumeDataLayout
=
dataAccessManager
->
G
etVolumeDataLayout
();
if
(
!
volumeDataLayout
->
i
sChannelAvailable
(
"Trace"
))
if
(
!
volumeDataLayout
->
I
sChannelAvailable
(
"Trace"
))
{
fmt
::
print
(
stderr
,
"VDS has no
\"
Trace
\"
channel"
);
return
EXIT_FAILURE
;
}
int
traceFlagChannel
=
volumeDataLayout
->
g
etChannelIndex
(
"Trace"
);
int
traceFlagChannel
=
volumeDataLayout
->
G
etChannelIndex
(
"Trace"
);
if
(
!
volumeDataLayout
->
i
sChannelAvailable
(
"SEGYTraceHeader"
))
if
(
!
volumeDataLayout
->
I
sChannelAvailable
(
"SEGYTraceHeader"
))
{
fmt
::
print
(
stderr
,
"VDS has no
\"
SEGYTraceHeader
\"
channel"
);
return
EXIT_FAILURE
;
}
int
segyTraceHeaderChannel
=
volumeDataLayout
->
g
etChannelIndex
(
"SEGYTraceHeader"
);
int
segyTraceHeaderChannel
=
volumeDataLayout
->
G
etChannelIndex
(
"SEGYTraceHeader"
);
if
(
!
volumeDataLayout
->
IsMetadataBLOBAvailable
(
"SEGY"
,
"TextHeader"
)
||
!
volumeDataLayout
->
IsMetadataBLOBAvailable
(
"SEGY"
,
"BinaryHeader"
))
{
...
...
@@ -144,18 +144,18 @@ main(int argc, char *argv[])
return
EXIT_FAILURE
;
}
int
dimensionality
=
dataAccessManager
->
g
etVolumeDataLayout
()
->
g
etDimensionality
();
int
dimensionality
=
dataAccessManager
->
G
etVolumeDataLayout
()
->
G
etDimensionality
();
int
outerDimension
=
std
::
max
(
2
,
dimensionality
-
1
);
int
lineCount
=
volumeDataLayout
->
g
etDimensionNumSamples
(
outerDimension
);
int
lineCount
=
volumeDataLayout
->
G
etDimensionNumSamples
(
outerDimension
);
int64_t
traceCount
=
1
;
for
(
int
dimension
=
1
;
dimension
<
outerDimension
;
dimension
++
)
{
traceCount
*=
volumeDataLayout
->
g
etDimensionNumSamples
(
dimension
);
traceCount
*=
volumeDataLayout
->
G
etDimensionNumSamples
(
dimension
);
}
const
int
sampleFormatSize
=
4
;
const
int
sampleCount
=
volumeDataLayout
->
g
etDimensionNumSamples
(
0
);