-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Two suggestions to fix CommonADIOS1IOHandlerImpl (#1101)
* Fix ADIOS1 namespaces With this fix, CommonADIOS1IOHandler.cpp is included outside of a namespace. This makes it possible to properly include things inside CommonADIOS1IOHandler.cpp without creating accidental double namespaces. * Replace macro hack with CRT pattern IDEs don't understand the macro thing and it keeps annoying me.
- Loading branch information
1 parent
b4ecffb
commit e60c6a7
Showing
8 changed files
with
206 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* Copyright 2017-2021 Fabian Koller and Franz Poeschel | ||
* | ||
* This file is part of openPMD-api. | ||
* | ||
* openPMD-api is free software: you can redistribute it and/or modify | ||
* it under the terms of of either the GNU General Public License or | ||
* the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* openPMD-api is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License and the GNU Lesser General Public License | ||
* for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* and the GNU Lesser General Public License along with openPMD-api. | ||
* If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
#pragma once | ||
|
||
#include "openPMD/config.hpp" | ||
|
||
#if openPMD_HAVE_ADIOS1 | ||
|
||
#include "openPMD/IO/AbstractIOHandler.hpp" | ||
#include "openPMD/auxiliary/Filesystem.hpp" | ||
#include "openPMD/auxiliary/DerefDynamicCast.hpp" | ||
#include "openPMD/auxiliary/Memory.hpp" | ||
#include "openPMD/auxiliary/StringManip.hpp" | ||
#include "openPMD/IO/AbstractIOHandlerImpl.hpp" | ||
#include "openPMD/IO/ADIOS/ADIOS1Auxiliary.hpp" | ||
#include "openPMD/IO/ADIOS/ADIOS1FilePosition.hpp" | ||
|
||
#include <adios.h> | ||
#include <adios_read.h> | ||
|
||
#include <future> | ||
#include <memory> | ||
#include <string> | ||
#include <utility> | ||
#include <unordered_map> | ||
#include <unordered_set> | ||
|
||
namespace openPMD | ||
{ | ||
template< typename ChildClass > // CRT pattern | ||
class CommonADIOS1IOHandlerImpl : public AbstractIOHandlerImpl | ||
{ | ||
public: | ||
|
||
void createFile(Writable*, Parameter< Operation::CREATE_FILE > const&) override; | ||
void createPath(Writable*, Parameter< Operation::CREATE_PATH > const&) override; | ||
void createDataset(Writable*, Parameter< Operation::CREATE_DATASET > const&) override; | ||
void extendDataset(Writable*, Parameter< Operation::EXTEND_DATASET > const&) override; | ||
void openFile(Writable*, Parameter< Operation::OPEN_FILE > const&) override; | ||
void closeFile(Writable*, Parameter< Operation::CLOSE_FILE > const&) override; | ||
void availableChunks(Writable*, Parameter< Operation::AVAILABLE_CHUNKS > &) override; | ||
void openPath(Writable*, Parameter< Operation::OPEN_PATH > const&) override; | ||
void openDataset(Writable*, Parameter< Operation::OPEN_DATASET > &) override; | ||
void deleteFile(Writable*, Parameter< Operation::DELETE_FILE > const&) override; | ||
void deletePath(Writable*, Parameter< Operation::DELETE_PATH > const&) override; | ||
void deleteDataset(Writable*, Parameter< Operation::DELETE_DATASET > const&) override; | ||
void deleteAttribute(Writable*, Parameter< Operation::DELETE_ATT > const&) override; | ||
void writeDataset(Writable*, Parameter< Operation::WRITE_DATASET > const&) override; | ||
void writeAttribute(Writable*, Parameter< Operation::WRITE_ATT > const&) override; | ||
void readDataset(Writable*, Parameter< Operation::READ_DATASET > &) override; | ||
void readAttribute(Writable*, Parameter< Operation::READ_ATT > &) override; | ||
void listPaths(Writable*, Parameter< Operation::LIST_PATHS > &) override; | ||
void listDatasets(Writable*, Parameter< Operation::LIST_DATASETS > &) override; | ||
void listAttributes(Writable*, Parameter< Operation::LIST_ATTS > &) override; | ||
|
||
void close(int64_t); | ||
void close(ADIOS_FILE*); | ||
void flush_attribute(int64_t group, std::string const& name, Attribute const&); | ||
|
||
protected: | ||
template< typename... Args > | ||
CommonADIOS1IOHandlerImpl( Args &&... args) | ||
: AbstractIOHandlerImpl{ std::forward< Args >( args )... } | ||
{} | ||
|
||
ADIOS_READ_METHOD m_readMethod; | ||
std::unordered_map< Writable*, std::shared_ptr< std::string > > m_filePaths; | ||
std::unordered_map< std::shared_ptr< std::string >, int64_t > m_groups; | ||
std::unordered_map< std::shared_ptr< std::string >, bool > m_existsOnDisk; | ||
std::unordered_map< std::shared_ptr< std::string >, int64_t > m_openWriteFileHandles; | ||
std::unordered_map< std::shared_ptr< std::string >, ADIOS_FILE* > m_openReadFileHandles; | ||
std::unordered_map< ADIOS_FILE*, std::vector< ADIOS_SELECTION* > > m_scheduledReads; | ||
std::unordered_map< int64_t, std::unordered_map< std::string, Attribute > > m_attributeWrites; | ||
/** | ||
* Call this function to get adios file id for a Writable. Will create one if does not exist | ||
* @return returns an adios file id. | ||
*/ | ||
int64_t GetFileHandle(Writable*); | ||
}; // ParallelADIOS1IOHandlerImpl | ||
} // openPMD | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.