Commit 643dc393 authored by Morten Ofstad's avatar Morten Ofstad
Browse files

Use AccessManager as the short name of the VolumeDataAccessManager to be...

Use AccessManager as the short name of the VolumeDataAccessManager to be consistent with using AxisDescriptor as the short name of VolumeDataAxisDescriptor, Layout as the short name of VolumeDataLayout etc. Added documentation for GetLayout() and GetAccessManager() functions.
parent 5bdc44f8
......@@ -137,7 +137,7 @@ int main(int argc, char **argv)
}
OpenVDS::VolumeDataLayout *layout = OpenVDS::GetLayout(handle.get());
OpenVDS::VolumeDataAccessManager *dataAccessManager = OpenVDS::GetDataAccessManager(handle.get());
OpenVDS::VolumeDataAccessManager *accessManager = OpenVDS::GetAccessManager(handle.get());
int sampleCount[3];
sampleCount[0] = layout->GetDimensionNumSamples(axis_mapper[0]);
......@@ -171,8 +171,8 @@ int main(int argc, char **argv)
std::vector<float> data;
data.resize(size_t(output_width) * size_t(output_height));
int64_t request = dataAccessManager->RequestVolumeSamples(data.data(), layout, OpenVDS::Dimensions_012, 0, 0, reinterpret_cast<const float (*)[OpenVDS::Dimensionality_Max]>(samples.data()), samples.size(), OpenVDS::InterpolationMethod::Linear);
bool finished = dataAccessManager->WaitForCompletion(request);
int64_t request = accessManager->RequestVolumeSamples(data.data(), layout, OpenVDS::Dimensions_012, 0, 0, reinterpret_cast<const float (*)[OpenVDS::Dimensionality_Max]>(samples.data()), samples.size(), OpenVDS::InterpolationMethod::Linear);
bool finished = accessManager->WaitForCompletion(request);
if (!finished)
{
fmt::print(stderr, "Failed to download reuqest. Failing\n");
......
......@@ -44,8 +44,8 @@ VDS* Open(IOManager *ioManager, Error& error)
{
return nullptr;
}
ret->dataAccessManager.reset(new VolumeDataAccessManagerImpl(*ret.get()));
ret->requestProcessor.reset(new VolumeDataRequestProcessor(*ret->dataAccessManager.get()));
ret->accessManager.reset(new VolumeDataAccessManagerImpl(*ret.get()));
ret->requestProcessor.reset(new VolumeDataRequestProcessor(*ret->accessManager.get()));
return ret.release();
}
......@@ -66,11 +66,11 @@ VolumeDataLayout *GetLayout(VDS *vds)
return vds->volumeDataLayout.get();
}
VolumeDataAccessManager *GetDataAccessManager(VDS *vds)
VolumeDataAccessManager *GetAccessManager(VDS *vds)
{
if (!vds)
return nullptr;
return vds->dataAccessManager.get();
return vds->accessManager.get();
}
const char *AddDescriptorString(std::string const &descriptorString, VDS &vds)
......@@ -234,8 +234,8 @@ VDSHandle Create(IOManager* ioManager, VolumeDataLayoutDescriptor const &layoutD
if (!SerializeAndUploadVolumeDataLayout(*vds, error))
return nullptr;
vds->dataAccessManager.reset(new VolumeDataAccessManagerImpl(*vds.get()));
vds->requestProcessor.reset(new VolumeDataRequestProcessor(*vds->dataAccessManager.get()));
vds->accessManager.reset(new VolumeDataAccessManagerImpl(*vds.get()));
vds->requestProcessor.reset(new VolumeDataRequestProcessor(*vds->accessManager.get()));
return vds.release();
}
......
......@@ -143,17 +143,30 @@ OPENVDS_EXPORT VDSHandle Create(const OpenOptions& options, VolumeDataLayoutDesc
/// </returns>
OPENVDS_EXPORT VDSHandle Create(IOManager* ioManager, VolumeDataLayoutDescriptor const &layoutDescriptor, VectorWrapper<VolumeDataAxisDescriptor> axisDescriptors, VectorWrapper<VolumeDataChannelDescriptor> channelDescriptors, MetadataReadAccess const &metadata, Error &error);
/// <summary>
/// Get the VolumeDataLayout for a VDS
/// </summary>
/// <param name="handle">
/// The handle of the VDS
/// </param>
OPENVDS_EXPORT VolumeDataLayout *GetLayout(VDSHandle handle);
/// <summary>
/// Get the VolumeDataAccessManager for a VDS
/// </summary>
/// <param name="handle">
/// The handle of the VDS
/// </param>
OPENVDS_EXPORT VolumeDataAccessManager *GetAccessManager(VDSHandle handle);
/// <summary>
/// Close a VDS and free up all associated resources
/// </summary>
/// <param name="handle">
/// The handle to close
/// The handle of the VDS
/// </param>
OPENVDS_EXPORT void Close(VDSHandle handle);
OPENVDS_EXPORT VolumeDataLayout *GetLayout(VDSHandle handle);
OPENVDS_EXPORT VolumeDataAccessManager *GetDataAccessManager(VDSHandle handle);
}
#endif //OPENVDS_H
......@@ -101,8 +101,8 @@ main(int argc, char *argv[])
return EXIT_FAILURE;
}
auto dataAccessManager = OpenVDS::GetDataAccessManager(vds.get());
auto volumeDataLayout = dataAccessManager->GetVolumeDataLayout();
auto accessManager = OpenVDS::GetAccessManager(vds.get());
auto volumeDataLayout = accessManager->GetVolumeDataLayout();
if(!volumeDataLayout->IsChannelAvailable("Trace"))
{
......@@ -144,7 +144,7 @@ main(int argc, char *argv[])
return EXIT_FAILURE;
}
int dimensionality = dataAccessManager->GetVolumeDataLayout()->GetDimensionality();
int dimensionality = accessManager->GetVolumeDataLayout()->GetDimensionality();
int outerDimension = std::max(2, dimensionality - 1);
int lineCount = volumeDataLayout->GetDimensionNumSamples(outerDimension);
......@@ -178,18 +178,18 @@ main(int argc, char *argv[])
min[outerDimension] = line;
max[outerDimension] = line + 1;
int64_t dataRequestID = dataAccessManager->RequestVolumeSubset(data.get(), volumeDataLayout, OpenVDS::Dimensions_012, 0, 0, min, max, OpenVDS::VolumeDataChannelDescriptor::Format_R32);
int64_t dataRequestID = accessManager->RequestVolumeSubset(data.get(), volumeDataLayout, OpenVDS::Dimensions_012, 0, 0, min, max, OpenVDS::VolumeDataChannelDescriptor::Format_R32);
max[0] = 1;
int64_t traceFlagRequestID = dataAccessManager->RequestVolumeSubset(traceFlag.get(), volumeDataLayout, OpenVDS::Dimensions_012, 0, traceFlagChannel, min, max, OpenVDS::VolumeDataChannelDescriptor::Format_U8);
int64_t traceFlagRequestID = accessManager->RequestVolumeSubset(traceFlag.get(), volumeDataLayout, OpenVDS::Dimensions_012, 0, traceFlagChannel, min, max, OpenVDS::VolumeDataChannelDescriptor::Format_U8);
max[0] = 240;
int64_t segyTraceHaderRequestID = dataAccessManager->RequestVolumeSubset(segyTraceHeader.get(), volumeDataLayout, OpenVDS::Dimensions_012, 0, segyTraceHeaderChannel, min, max, OpenVDS::VolumeDataChannelDescriptor::Format_U8);
int64_t segyTraceHaderRequestID = accessManager->RequestVolumeSubset(segyTraceHeader.get(), volumeDataLayout, OpenVDS::Dimensions_012, 0, segyTraceHeaderChannel, min, max, OpenVDS::VolumeDataChannelDescriptor::Format_U8);
// Need to queue the writing on another thread to get max. performance
dataAccessManager->WaitForCompletion(dataRequestID);
dataAccessManager->WaitForCompletion(traceFlagRequestID);
dataAccessManager->WaitForCompletion(segyTraceHaderRequestID);
accessManager->WaitForCompletion(dataRequestID);
accessManager->WaitForCompletion(traceFlagRequestID);
accessManager->WaitForCompletion(segyTraceHaderRequestID);
std::unique_ptr<char[]> writeBuffer(new char[traceCount * (traceDataSize + SEGY::TraceHeaderSize)]);
int activeTraceCount = 0;
......
......@@ -845,7 +845,7 @@ main(int argc, char *argv[])
FileViewManager fileViewManager(file);
auto accessManager = OpenVDS::GetDataAccessManager(vds.get());
auto accessManager = OpenVDS::GetAccessManager(vds.get());
auto layout = accessManager->GetVolumeDataLayout();
auto amplitudeAccessor = accessManager->CreateVolumeDataPageAccessor(accessManager->GetVolumeDataLayout(), OpenVDS::DimensionsND::Dimensions_012, 0, 0, 8, OpenVDS::VolumeDataAccessManager::AccessMode_Create);
......
......@@ -72,7 +72,7 @@ struct VDS
std::unique_ptr<VolumeDataLayoutImpl>
volumeDataLayout;
std::unique_ptr<VolumeDataAccessManagerImpl>
dataAccessManager;
accessManager;
std::unique_ptr<IOManager>
ioManager;
LayerMetadataContainer
......
......@@ -44,12 +44,12 @@ GTEST_TEST(OpenVDS_integration, SimpleVolumeDataPageRead)
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> handle(OpenVDS::Open(options, error), &OpenVDS::Close);
ASSERT_TRUE(handle);
OpenVDS::VolumeDataAccessManager *dataAccessManager = OpenVDS::GetDataAccessManager(handle.get());
ASSERT_TRUE(dataAccessManager);
OpenVDS::VolumeDataAccessManager *accessManager = OpenVDS::GetAccessManager(handle.get());
ASSERT_TRUE(accessManager);
OpenVDS::VolumeDataLayout *layout = OpenVDS::GetLayout(handle.get());
OpenVDS::VolumeDataPageAccessor *pageAccessor = dataAccessManager->CreateVolumeDataPageAccessor(layout, OpenVDS::Dimensions_012, 0, 0, 10, OpenVDS::VolumeDataAccessManager::AccessMode_ReadOnly);
OpenVDS::VolumeDataPageAccessor *pageAccessor = accessManager->CreateVolumeDataPageAccessor(layout, OpenVDS::Dimensions_012, 0, 0, 10, OpenVDS::VolumeDataAccessManager::AccessMode_ReadOnly);
ASSERT_TRUE(pageAccessor);
int pos[OpenVDS::Dimensionality_Max] = {layout->GetDimensionNumSamples(0) / 2, layout->GetDimensionNumSamples(1) /2, layout->GetDimensionNumSamples(2) / 2};
......@@ -95,12 +95,11 @@ GTEST_TEST(OpenVDS_integration, SimpleRequestVolumeSubset)
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> handle(OpenVDS::Open(options, error), &OpenVDS::Close);
ASSERT_TRUE(handle);
OpenVDS::VolumeDataAccessManager *dataAccessManager = OpenVDS::GetDataAccessManager(handle.get());
ASSERT_TRUE(dataAccessManager);
OpenVDS::VolumeDataLayout *layout = OpenVDS::GetLayout(handle.get());
OpenVDS::VolumeDataAccessManager *accessManager = OpenVDS::GetDataAccessManager(handle.get());
ASSERT_TRUE(layout);
OpenVDS::VolumeDataAccessManager *accessManager = OpenVDS::GetAccessManager(handle.get());
ASSERT_TRUE(accessManager);
int loopDimension = 4;
int groupSize = 100;
......
......@@ -52,8 +52,8 @@ GTEST_TEST(OpenVDS_integration, SimpleRequestVolumeSamples)
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> handle(OpenVDS::Open(options, error), &OpenVDS::Close);
ASSERT_TRUE(handle);
OpenVDS::VolumeDataAccessManager *dataAccessManager = OpenVDS::GetDataAccessManager(handle.get());
ASSERT_TRUE(dataAccessManager);
OpenVDS::VolumeDataAccessManager *accessManager = OpenVDS::GetAccessManager(handle.get());
ASSERT_TRUE(accessManager);
OpenVDS::VolumeDataLayout *layout = OpenVDS::GetLayout(handle.get());
......@@ -76,11 +76,11 @@ GTEST_TEST(OpenVDS_integration, SimpleRequestVolumeSamples)
GenerateRandomPosition(gen, dimensionDistribution, dimension, positions[i]);
}
float buffer[100];
int64_t request = dataAccessManager->RequestVolumeSamples(buffer, layout, OpenVDS::Dimensions_012, 0, 0, positions, 100, OpenVDS::InterpolationMethod::Linear);
dataAccessManager->WaitForCompletion(request);
int64_t request = accessManager->RequestVolumeSamples(buffer, layout, OpenVDS::Dimensions_012, 0, 0, positions, 100, OpenVDS::InterpolationMethod::Linear);
accessManager->WaitForCompletion(request);
OpenVDS::VolumeDataPageAccessor *pageAccessor = dataAccessManager->CreateVolumeDataPageAccessor(layout, OpenVDS::Dimensions_012, 0, 0, 100, OpenVDS::VolumeDataAccessManager::AccessMode_ReadOnly);
OpenVDS::VolumeDataReadAccessor<OpenVDS::FloatVector3, float >* readAccessor = dataAccessManager->Create3DInterpolatingVolumeDataAccessorR32(pageAccessor, 0.0f, OpenVDS::InterpolationMethod::Linear);
OpenVDS::VolumeDataPageAccessor *pageAccessor = accessManager->CreateVolumeDataPageAccessor(layout, OpenVDS::Dimensions_012, 0, 0, 100, OpenVDS::VolumeDataAccessManager::AccessMode_ReadOnly);
OpenVDS::VolumeDataReadAccessor<OpenVDS::FloatVector3, float >* readAccessor = accessManager->Create3DInterpolatingVolumeDataAccessorR32(pageAccessor, 0.0f, OpenVDS::InterpolationMethod::Linear);
float verifyBuffer[100];
for (int i = 0; i < 100; i++)
......
......@@ -46,8 +46,8 @@ GTEST_TEST(OpenVDS_integration, SimpleRequestVolumeTraces)
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> handle(OpenVDS::Open(options, error), &OpenVDS::Close);
ASSERT_TRUE(handle);
OpenVDS::VolumeDataAccessManager *dataAccessManager = OpenVDS::GetDataAccessManager(handle.get());
ASSERT_TRUE(dataAccessManager);
OpenVDS::VolumeDataAccessManager *accessManager = OpenVDS::GetAccessManager(handle.get());
ASSERT_TRUE(accessManager);
OpenVDS::VolumeDataLayout *layout = OpenVDS::GetLayout(handle.get());
......@@ -69,11 +69,11 @@ GTEST_TEST(OpenVDS_integration, SimpleRequestVolumeTraces)
tracePos[trace][5] = 0;
}
int64_t requestId = dataAccessManager->RequestVolumeTraces(buffer.data(), layout, OpenVDS::Dimensions_012, 0, 0, tracePos, 10, OpenVDS::InterpolationMethod::Nearest, 0);
dataAccessManager->WaitForCompletion(requestId);
int64_t requestId = accessManager->RequestVolumeTraces(buffer.data(), layout, OpenVDS::Dimensions_012, 0, 0, tracePos, 10, OpenVDS::InterpolationMethod::Nearest, 0);
accessManager->WaitForCompletion(requestId);
auto pageAccessor = dataAccessManager->CreateVolumeDataPageAccessor(layout, OpenVDS::Dimensions_012, 0, 0, 1000, OpenVDS::VolumeDataAccessManager::AccessMode_ReadOnly);
auto valueReader = dataAccessManager->Create3DInterpolatingVolumeDataAccessorR32(pageAccessor, 0.0f, OpenVDS::InterpolationMethod::Nearest);
auto pageAccessor = accessManager->CreateVolumeDataPageAccessor(layout, OpenVDS::Dimensions_012, 0, 0, 1000, OpenVDS::VolumeDataAccessManager::AccessMode_ReadOnly);
auto valueReader = accessManager->Create3DInterpolatingVolumeDataAccessorR32(pageAccessor, 0.0f, OpenVDS::InterpolationMethod::Nearest);
std::vector<float> verify(10 * sampleCount0);
for (int trace = 0; trace < 10; trace++)
......
......@@ -44,8 +44,8 @@ TEST(VDS_integration, RequestVolumeCleanupThread)
std::unique_ptr<OpenVDS::VDS, decltype(&OpenVDS::Close)> handle(OpenVDS::Open(options, error), &OpenVDS::Close);
ASSERT_TRUE(handle);
OpenVDS::VolumeDataAccessManagerImpl *dataAccessManager = static_cast<OpenVDS::VolumeDataAccessManagerImpl *>(OpenVDS::GetDataAccessManager(handle.get()));
ASSERT_TRUE(dataAccessManager);
OpenVDS::VolumeDataAccessManagerImpl *accessManager = static_cast<OpenVDS::VolumeDataAccessManagerImpl *>(OpenVDS::GetAccessManager(handle.get()));
ASSERT_TRUE(accessManager);
OpenVDS::VolumeDataLayout *layout = OpenVDS::GetLayout(handle.get());
......@@ -67,22 +67,22 @@ TEST(VDS_integration, RequestVolumeCleanupThread)
tracePos[trace][5] = 0;
}
int64_t requestId = dataAccessManager->RequestVolumeTraces(buffer.data(), layout, OpenVDS::Dimensions_012, 0, 0, tracePos, 10, OpenVDS::InterpolationMethod::Nearest, 0);
int64_t requestId = accessManager->RequestVolumeTraces(buffer.data(), layout, OpenVDS::Dimensions_012, 0, 0, tracePos, 10, OpenVDS::InterpolationMethod::Nearest, 0);
int activePages = dataAccessManager->CountActivePages();
int activePages = accessManager->CountActivePages();
ASSERT_GT(activePages, 0);
std::this_thread::sleep_for(std::chrono::seconds(10));
activePages = dataAccessManager->CountActivePages();
activePages = accessManager->CountActivePages();
ASSERT_GT(activePages, 0);
dataAccessManager->WaitForCompletion(requestId);
activePages = dataAccessManager->CountActivePages();
accessManager->WaitForCompletion(requestId);
activePages = accessManager->CountActivePages();
ASSERT_GT(activePages, 0);
std::this_thread::sleep_for(std::chrono::seconds(21));
activePages = dataAccessManager->CountActivePages();
activePages = accessManager->CountActivePages();
ASSERT_EQ(activePages, 0);
auto pageAccessor = dataAccessManager->CreateVolumeDataPageAccessor(layout, OpenVDS::Dimensions_012, 0, 0, 1000, OpenVDS::VolumeDataAccessManager::AccessMode_ReadOnly);
auto valueReader = dataAccessManager->Create3DInterpolatingVolumeDataAccessorR32(pageAccessor, 0.0f, OpenVDS::InterpolationMethod::Nearest);
auto pageAccessor = accessManager->CreateVolumeDataPageAccessor(layout, OpenVDS::Dimensions_012, 0, 0, 1000, OpenVDS::VolumeDataAccessManager::AccessMode_ReadOnly);
auto valueReader = accessManager->Create3DInterpolatingVolumeDataAccessorR32(pageAccessor, 0.0f, OpenVDS::InterpolationMethod::Nearest);
std::vector<float> verify(10 * sampleCount0);
for (int trace = 0; trace < 10; trace++)
......
......@@ -39,7 +39,7 @@ TEST(IOTests, InMemory)
fill3DVDSWithNoice(handle.get());
auto layout = OpenVDS::GetLayout(handle.get());
auto accessManager = OpenVDS::GetDataAccessManager(handle.get());
auto accessManager = OpenVDS::GetAccessManager(handle.get());
int32_t minPos[OpenVDS::Dimensionality_Max] = {15, 15, 15};
int32_t maxPos[OpenVDS::Dimensionality_Max] = {55, 55, 55};
......
......@@ -37,7 +37,7 @@ static void fill3DVDSWithNoice(OpenVDS::VDS *vds, int32_t channel = 0, const Ope
{
OpenVDS::VolumeDataLayout *layout = OpenVDS::GetLayout(vds);
ASSERT_TRUE(layout);
OpenVDS::VolumeDataAccessManager *accessManager = OpenVDS::GetDataAccessManager(vds);
OpenVDS::VolumeDataAccessManager *accessManager = OpenVDS::GetAccessManager(vds);
ASSERT_TRUE(accessManager);
OpenVDS::VolumeDataPageAccessor *pageAccessor = accessManager->CreateVolumeDataPageAccessor(layout, OpenVDS::Dimensions_012, channel, 0, 100, OpenVDS::VolumeDataAccessManager::AccessMode_Create);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment