Skip to content

Commit

Permalink
Enabled Distributed Helix Algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
yanurag994 committed Nov 1, 2024
1 parent 7d9050b commit 357bd97
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Pipes/basePipe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ basePipe<nodeType> *basePipe<nodeType>::newPipe(const std::string &pipeType, con
{
return new helixPipe<nodeType>();
}
// else if (pipeType == "helixDistPipe")
// {
// return new helixDistPipe<nodeType>();
// }
else if (pipeType == "helixDistPipe")
{
return new helixDistPipe<nodeType>();
}

return 0;
}
Expand Down
19 changes: 11 additions & 8 deletions Utils/multifileops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ bool MultiFile<FileType, baseType>::readValue()
* @return true
* @return false
*/
template <typename FileType, class baseType>
bool MultiFile<FileType, baseType>::readUnique()
template <>
bool MultiFile<MapBinaryFile, std::pair<std::vector<short>,short>>::readUnique()
{
while (readValue())
{
Expand Down Expand Up @@ -227,14 +227,14 @@ MultiFile<FileType, baseType>::MultiFile(const std::string &directory)
* @param outputFileName
* @param iterationCounter
*/
template <typename FileType, class baseType>
void MultiFile<FileType, baseType>::compressMap(const std::string &outputFileName, int iterationCounter)
template <>
void MultiFile<MapBinaryFile, std::pair<std::vector<short>, short>>::compressMap(const std::string &outputFileName, int iterationCounter)
{
// Open the output file for writing
std::ofstream outputFile(outputFileName, std::ios::out | std::ios::binary);

// Read from the previous iteration's data file
FileType previousReader("input/" + std::to_string(iterationCounter) + ".dat");
MapBinaryFile previousReader("input/" + std::to_string(iterationCounter) + ".dat");

// Initialize variables for map size and vector size
size_t mapSize = 0, vectorSize = previousReader.cache.first.size();
Expand Down Expand Up @@ -277,8 +277,8 @@ void MultiFile<FileType, baseType>::compressMap(const std::string &outputFileNam
* @param outputFileName
* @return size_t
*/
template <typename FileType, class baseType>
size_t MultiFile<FileType, baseType>::writeCSV(const std::string &outputFileName)
template <>
size_t MultiFile<VectorBinaryFile, std::vector<short>>::writeCSV(const std::string &outputFileName)
{
std::ofstream outputFile(outputFileName, std::ios::out);
size_t size = 0;
Expand All @@ -296,4 +296,7 @@ size_t MultiFile<FileType, baseType>::writeCSV(const std::string &outputFileName
}
outputFile.close();
return size;
};
};

template class MultiFile<MapBinaryFile, std::pair<std::vector<short>, short>>;
template class MultiFile<VectorBinaryFile, std::vector<short>>;

0 comments on commit 357bd97

Please sign in to comment.