diff --git a/README.md b/README.md index d872f022ca88e526c6547ec06251ca762c34e5b1..aa096b1f69069241721dfae3419f8eca72a7943e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # ADIOSPP Next generation ADIOS in C++ for exascale computations -Read ./doc/CodingGuidelines first +Read ./doc/CodingGuidelines first if you are a developer Create ./lib and ./bin libraries before compiling make -> build ./lib/libadios.a with truly MPI code (from mpi.h) diff --git a/doc/CodingGuidelines b/doc/CodingGuidelines index e05631f89982f6d6965a30ff6329330fdac6f08f..270bee0db8b57cad89202f2a7ee308ed25b23ddf 100644 --- a/doc/CodingGuidelines +++ b/doc/CodingGuidelines @@ -105,13 +105,14 @@ Variable scope and Namespaces Classes / Structs -1) Classes will be initialized with a upper case "C" following by an upper, - example: ( CADIOS, CNETCDF, CPHDF, CTransform, etc. ) -2) Structs will be initialized with a upper case "S". Reserve for plain old data, example: ( SAttribute ) -3) Class/Struct member variables (not functions) will use hungarian notation ("m_" prefix) - followed by an upper case letter ( m_XMLConfig, m_GlobalSize ) -4) Only one file pair per class (class CADIOS in CADIOS.h and CADIOS.cpp), - do not define several classes in the same file +1) Classes will be initialized with an upper case letter, example: ( ADIOS, NETCDF, PHDF5, Transform, Group, etc. ) +2) Class member variables will use hungarian notation "m_" prefix followed an upper case letter: m_XMLConfig, m_GlobalSize. While member functions will have the same rules as regular functions (e.g. start with an upper case letter). +3) Reserve structs for public member variables only, Structs should not have member functions, inheritance or private members. Structs will be initialized with an upper case letter and member variables won't use hungarian notation as classes. + + +4) Only allow one header and one source file per class ( e.g. class Transport in Transport.h and Transport.cpp), do not define several classes in the same file. + Structs are always define in one header file, ( e.g. Attribute in Attribute.h ) + One EXCEPTION: structs with static member variables, which must be defined in a source (*.cpp) file Memory Management: Pointers, Smart Pointers, References and STL Containers @@ -161,9 +162,6 @@ Avoid mixing C-like equivalents C++ Exceptions -1) Throw C++ standard exceptions for error handling, do not throw integers. - This is helpful as it allows handling of different exception types in different ways. - In rare cases a custom exceptions must be defined/declared. -2) Use informative messages for exception handling to complement the nature of the exception. - Help the user fix the error/warning. -3) Error exceptions that are caught at main (program stops) must start with "ERROR: " \ No newline at end of file +1) Throw C++ standard exceptions for error handling, do not throw integers. This is helpful as it allows handling of different exception types in different ways. In rare cases a custom exceptions must be defined/declared. +2) All error exceptions must be caught at main (program stops) and must start with "ERROR: ". Use informative messages for exception handling to complement the nature of the exception. Help the user fix the error/warning. +3) Exceptions thrown by the code (no by STL functions) must be inside a debug mode condition set in the ADIOS class constructor. \ No newline at end of file diff --git a/include/core/SAttribute.h b/include/core/Attribute.h similarity index 63% rename from include/core/SAttribute.h rename to include/core/Attribute.h index 5f33ec98f497d5cb9ea06bf1275864c9ca3e548f..a35e81bdd90b26fd1f7ef57c117ccd0cacbbec33 100644 --- a/include/core/SAttribute.h +++ b/include/core/Attribute.h @@ -1,12 +1,12 @@ /* - * SAttribute.h + * Attribute.h * * Created on: Oct 5, 2016 * Author: wfg */ -#ifndef SATTRIBUTE_H_ -#define SATTRIBUTE_H_ +#ifndef ATTRIBUTE_H_ +#define ATTRIBUTE_H_ /// \cond EXCLUDE_FROM_DOXYGEN #include <string> @@ -16,11 +16,11 @@ namespace adios { /** - * Plain-old data struct that defines an attribute in an ADIOS group in CGroup.h + * Plain-old data struct that defines an attribute in an ADIOS group in Group.h */ -struct SAttribute +struct Attribute { - const std::string Type; ///< string or numeric type + const char TypeID; ///< '0': string, '1': numeric const std::string Value; ///< information about the attribute }; @@ -29,4 +29,4 @@ struct SAttribute -#endif /* SATTRIBUTE_H_ */ +#endif /* ATTRIBUTE_H_ */ diff --git a/include/core/CCapsule.h b/include/core/Capsule.h similarity index 77% rename from include/core/CCapsule.h rename to include/core/Capsule.h index 1de4c12955169d778f1b94eb85676654b2a8f959..496a49cb63b571f5c5b7e247d098d2ba99f4f481 100644 --- a/include/core/CCapsule.h +++ b/include/core/Capsule.h @@ -1,12 +1,12 @@ /* - * CCapsule.h + * Capsule.h * * Created on: Nov 7, 2016 * Author: wfg */ -#ifndef CCAPSULE_H_ -#define CCAPSULE_H_ +#ifndef CAPSULE_H_ +#define CAPSULE_H_ /// \cond EXCLUDE_FROM_DOXYGEN @@ -22,11 +22,11 @@ #include "public/mpidummy.h" #endif -#include "core/CGroup.h" -#include "core/SVariable.h" -#include "core/CTransform.h" -#include "core/CTransport.h" -#include "functions/CCapsuleTemplates.h" +#include "core/Group.h" +#include "core/Variable.h" +#include "core/Transform.h" +#include "core/Transport.h" +#include "functions/capsuleTemplates.h" namespace adios @@ -35,7 +35,7 @@ namespace adios /** * Base class for Capsule operations managing shared-memory, and buffer and variables transform and transport operations */ -class CCapsule +class Capsule { public: @@ -52,7 +52,7 @@ public: std::string m_CurrentGroup; ///< associated group to look for variable information size_t m_MaxBufferSize = 0; - CCapsule( ); ///< Default Empty constructor used with ADIOS class empty constructor + Capsule( ); ///< Default Empty constructor used with ADIOS class empty constructor /** * Multiple argument constructor @@ -61,10 +61,10 @@ public: * @param debugMode */ - CCapsule( const MPI_Comm mpiComm, const bool debugMode, const std::string streamName, const std::string accessMode, - const std::string transport, const std::vector<std::string>& arguments ); + Capsule( const MPI_Comm mpiComm, const bool debugMode, const std::string streamName, const std::string accessMode, + const std::string transport, const std::vector<std::string>& arguments ); - ~CCapsule( ); + ~Capsule( ); /** * Add a transport to a stream @@ -91,7 +91,7 @@ public: { if( transportIndex >= m_Transports.size() ) throw std::invalid_argument( "ERROR: transport index " + std::to_string( transportIndex ) + - " does not point to a transport method in call to Write\n" ); + " does not point to a transport method in call to Write\n" ); } WriteToBuffer( data, size, transportIndex, m_Transports, m_MaxBufferSize, m_Buffer ); } @@ -101,7 +101,7 @@ public: private: - std::vector< std::shared_ptr<CTransport> > m_Transports; + std::vector< std::shared_ptr<Transport> > m_Transports; std::string m_AccessMode; std::vector<char> m_Buffer; const bool m_DebugMode = false; @@ -111,4 +111,4 @@ private: } //end namespace -#endif /* CCAPSULE_H_ */ +#endif /* CAPSULE_H_ */ diff --git a/include/core/CGroup.h b/include/core/Group.h similarity index 74% rename from include/core/CGroup.h rename to include/core/Group.h index 70b6e32024f2b12392ad81c02e87b4b38aea0f57..b7a968ab23bdc4b67316136b1a3650d8f91db372 100644 --- a/include/core/CGroup.h +++ b/include/core/Group.h @@ -1,12 +1,12 @@ /* - * CGroup.h + * Group.h * * Created on: Oct 12, 2016 * Author: wfg */ -#ifndef CGROUP_H_ -#define CGROUP_H_ +#ifndef GROUP_H_ +#define GROUP_H_ /// \cond EXCLUDE_FROM_DOXYGEN #include <map> @@ -24,10 +24,10 @@ #endif -#include "core/SVariable.h" -#include "core/SAttribute.h" -#include "core/CTransport.h" -#include "core/CTransform.h" +#include "core/Variable.h" +#include "core/Attribute.h" +#include "core/Transport.h" +#include "core/Transform.h" namespace adios @@ -35,7 +35,7 @@ namespace adios /** * Class that defines each ADIOS Group composed of Variables, Attributes and GlobalBounds (if global variables exist) */ -class CGroup +class Group { public: @@ -44,21 +44,21 @@ public: * @brief Constructor for XML config file * @param hostLanguage reference from ADIOS class * @param xmlGroup contains <adios-group (tag excluded)....</adios-group> single group definition from XML config file - * @param transforms passed from ADIOS.m_Transforms + * @param transforms passed from ADIOS.m_Transforms, single look up table for all transforms * @param debugMode from ADIOS */ - CGroup( const std::string hostLanguage, const std::string& xmlGroup, - std::vector< std::shared_ptr<CTransform> >& transforms, const bool debugMode ); + Group( const std::string hostLanguage, const std::string& xmlGroup, + std::vector< std::shared_ptr<Transform> >& transforms, const bool debugMode ); /** * Non-XML empty constructor * @param hostLanguage reference from ADIOS class * @param debugMode */ - CGroup( const std::string hostLanguage, const bool debugMode ); + Group( const std::string hostLanguage, const bool debugMode ); - ~CGroup( ); ///< Using STL containers, no deallocation + ~Group( ); ///< Using STL containers, no deallocation /** * Define a new variable in the group object @@ -115,19 +115,19 @@ private: std::map< std::string, std::pair< std::string, unsigned int > > m_Variables; ///< Makes variable name unique, key: variable name, value: pair.first = type, pair.second = index in corresponding vector of CVariable - std::vector< SVariable<char> > m_Char; ///< Key: variable name, Value: variable of type char - std::vector< SVariable<unsigned char> > m_UChar; ///< Key: variable name, Value: variable of type unsigned char - std::vector< SVariable<short> > m_Short; ///< Key: variable name, Value: variable of type short - std::vector< SVariable<unsigned short> > m_UShort; ///< Key: variable name, Value: variable of type unsigned short - std::vector< SVariable<int> > m_Int; ///< Key: variable name, Value: variable of type int - std::vector< SVariable<unsigned int> > m_UInt; ///< Key: variable name, Value: variable of type unsigned int - std::vector< SVariable<long int> > m_LInt; ///< Key: variable name, Value: variable of type long int - std::vector< SVariable<unsigned long int> > m_ULInt; ///< Key: variable name, Value: variable of type unsigned long int - std::vector< SVariable<long long int> > m_LLInt; ///< Key: variable name, Value: variable of type long long int - std::vector< SVariable<unsigned long long int> > m_ULLInt; ///< Key: variable name, Value: variable of type unsigned long long int - std::vector< SVariable<float> > m_Float; ///< Key: variable name, Value: variable of type float - std::vector< SVariable<double> > m_Double; ///< Key: variable name, Value: variable of type double - std::vector< SVariable<long double> > m_LDouble; ///< Key: variable name, Value: variable of type double + std::vector< Variable<char> > m_Char; ///< Key: variable name, Value: variable of type char + std::vector< Variable<unsigned char> > m_UChar; ///< Key: variable name, Value: variable of type unsigned char + std::vector< Variable<short> > m_Short; ///< Key: variable name, Value: variable of type short + std::vector< Variable<unsigned short> > m_UShort; ///< Key: variable name, Value: variable of type unsigned short + std::vector< Variable<int> > m_Int; ///< Key: variable name, Value: variable of type int + std::vector< Variable<unsigned int> > m_UInt; ///< Key: variable name, Value: variable of type unsigned int + std::vector< Variable<long int> > m_LInt; ///< Key: variable name, Value: variable of type long int + std::vector< Variable<unsigned long int> > m_ULInt; ///< Key: variable name, Value: variable of type unsigned long int + std::vector< Variable<long long int> > m_LLInt; ///< Key: variable name, Value: variable of type long long int + std::vector< Variable<unsigned long long int> > m_ULLInt; ///< Key: variable name, Value: variable of type unsigned long long int + std::vector< Variable<float> > m_Float; ///< Key: variable name, Value: variable of type float + std::vector< Variable<double> > m_Double; ///< Key: variable name, Value: variable of type double + std::vector< Variable<long double> > m_LDouble; ///< Key: variable name, Value: variable of type double std::set<std::string> m_SetVariables; ///< set of variables whose T* values have been set (no nullptr) @@ -138,7 +138,7 @@ private: * Value: SAttribute, plain-old-data struct * </pre> */ - std::map< std::string, SAttribute > m_Attributes; + std::map< std::string, Attribute > m_Attributes; std::vector< std::pair< std::string, std::string > > m_GlobalBounds; ///< if a variable or an attribute is global it fills this container, from global-bounds in XML File, data in global space, pair.first = global dimensions, pair.second = global bounds @@ -146,7 +146,7 @@ private: * Called from XML constructor * @param xmlGroup contains <adios-group....</adios-group> single group definition from XML config file passing by reference as it could be big */ - void ParseXMLGroup( const std::string& xmlGroup, std::vector< std::shared_ptr<CTransform> >& transforms ); + void ParseXMLGroup( const std::string& xmlGroup, std::vector< std::shared_ptr<Transform> >& transforms ); /** * Used by SetVariable and SetAttribute to check if global bounds exist in m_GlobalBounds @@ -178,4 +178,4 @@ private: } //end namespace -#endif /* CGROUP_H_ */ +#endif /* GROUP_H_ */ diff --git a/include/core/CTransform.h b/include/core/Transform.h similarity index 72% rename from include/core/CTransform.h rename to include/core/Transform.h index 979e4545bfd39016d5352f67175dc046cdc96c10..6737a160dbbe0eece706664dc8ebcb290f5284e8 100644 --- a/include/core/CTransform.h +++ b/include/core/Transform.h @@ -1,19 +1,19 @@ /* - * CTransform.h + * Transform.h * * Created on: Oct 17, 2016 * Author: wfg */ -#ifndef CTRANSFORM_H_ -#define CTRANSFORM_H_ +#ifndef TRANSFORM_H_ +#define TRANSFORM_H_ /// \cond EXCLUDE_FROM_DOXYGEN #include <string> /// \endcond -#include "core/SVariable.h" +#include "core/Variable.h" namespace adios @@ -22,7 +22,7 @@ namespace adios /** * Parent class that defines data variable transformations. Used as a member of CVariable */ -class CTransform +class Transform { public: @@ -35,11 +35,9 @@ public: * @param method zlib, bzip2, szip * @param variable */ - CTransform( const std::string method ): - m_Method{ method } - { } + Transform( const std::string method ); - virtual ~CTransform( ){ }; + virtual ~Transform( ); virtual void Compress( const std::vector<char>& bufferIn, std::vector<char>& bufferOut ) = 0; @@ -49,4 +47,4 @@ public: } //end namespace -#endif /* CTRANSFORM_H_ */ +#endif /* TRANSFORM_H_ */ diff --git a/include/core/CTransport.h b/include/core/Transport.h similarity index 67% rename from include/core/CTransport.h rename to include/core/Transport.h index cea0a114c7b0746c580657076874bcbd28563bf2..ebe561ee931565a8fb0a01ec5287c91f17c60ac8 100644 --- a/include/core/CTransport.h +++ b/include/core/Transport.h @@ -1,12 +1,12 @@ /* - * CTransport.h + * Transport.h * * Created on: Oct 6, 2016 * Author: wfg */ -#ifndef CTRANSPORT_H_ -#define CTRANSPORT_H_ +#ifndef TRANSPORT_H_ +#define TRANSPORT_H_ /// \cond EXCLUDE_FROM_DOXYGEN #include <string> @@ -20,11 +20,10 @@ #endif - namespace adios { -class CTransport +class Transport { public: @@ -42,24 +41,15 @@ public: int m_MPIRank = 0; ///< current MPI rank process int m_MPISize = 1; ///< current MPI processes size - /** * Base constructor that all derived classes pass * @param mpiComm passed to m_MPIComm * @param debugMode passed to m_DebugMode */ - CTransport( const std::string method, MPI_Comm mpiComm, const bool debugMode ): - m_Method{ method }, - m_MPIComm{ mpiComm }, - m_DebugMode{ debugMode } - { - MPI_Comm_rank( m_MPIComm, &m_MPIRank ); - MPI_Comm_size( m_MPIComm, &m_MPISize ); - } + Transport( const std::string method, MPI_Comm mpiComm, const bool debugMode ); - virtual ~CTransport( ) - { } + virtual ~Transport( ); ///< empty destructor, using STL for memory management /** * Open Output file accesing a mode @@ -72,22 +62,25 @@ public: * Sets the buffer and bufferSize for certain transport methods * @param buffer to be set to transport */ - virtual void SetBuffer( std::vector<char>& buffer ) - { }; + virtual void SetBuffer( std::vector<char>& buffer ); - virtual void Write( std::vector<char>& buffer ) - { }; + /** + * Write function for a transport, only called if required + * @param buffer + */ + virtual void Write( std::vector<char>& buffer ); - virtual void Close( ) = 0; //here think what needs to be passed + virtual void Close( ) = 0; ///< closes current transport and flushes everything, can't be reachable after this call - virtual void Finalize( ) - { }; protected: - virtual void Init( const std::vector<std::string>& arguments ) - { }; + /** + * Initialize particular derived transport class members + * @param arguments particular transport arguments from ADIOS Open variadic function + */ + virtual void Init( const std::vector<std::string>& arguments ); }; @@ -97,4 +90,4 @@ protected: -#endif /* CTRANSPORT_H_ */ +#endif /* TRANSPORT_H_ */ diff --git a/include/core/SVariable.h b/include/core/Variable.h similarity index 90% rename from include/core/SVariable.h rename to include/core/Variable.h index c4aedf6849c7a1d681fc5042374ac1f21b44acf5..0d0b9ee00e736ef03a11a4c731a19ffce3886d43 100644 --- a/include/core/SVariable.h +++ b/include/core/Variable.h @@ -1,12 +1,12 @@ /* - * CVariable.h + * Variable.h * * Created on: Oct 6, 2016 * Author: wfg */ -#ifndef SVARIABLE_H_ -#define SVARIABLE_H_ +#ifndef VARIABLE_H_ +#define VARIABLE_H_ /// \cond EXCLUDE_FROM_DOXYGEN #include <string> @@ -21,7 +21,7 @@ namespace adios * @param Base (parent) class for template derived (child) class CVariable. Required to put CVariable objects in STL containers. */ template< class T > -struct SVariable +struct Variable { const std::string DimensionsCSV; ///< comma separated list for variables to search for local dimensions const T* Values; ///< pointer to values passed from ADIOS Write @@ -35,4 +35,4 @@ struct SVariable -#endif /* SVARIABLE_H_ */ +#endif /* VARIABLE_H_ */ diff --git a/include/functions/ADIOSFunctions.h b/include/functions/adiosFunctions.h similarity index 89% rename from include/functions/ADIOSFunctions.h rename to include/functions/adiosFunctions.h index f79a148e806cdb840f098b5a10aef3c918ca949c..9f67b539053600805ef1621be892e7928d2f91a1 100644 --- a/include/functions/ADIOSFunctions.h +++ b/include/functions/adiosFunctions.h @@ -1,5 +1,5 @@ /* - * ADIOSFunctions.h Long helper functions used by ADIOS class + * adiosFunctions.h Long helper functions used by ADIOS class * * Created on: Oct 10, 2016 * Author: wfg @@ -22,7 +22,7 @@ #endif -#include "core/CGroup.h" +#include "core/Group.h" namespace adios @@ -85,8 +85,8 @@ void GetPairsFromTag( const std::string& fileContent, const std::string tag, * @param groups passed returns the map of groups defined in fileContent */ void SetMembers( const std::string& fileContent, const MPI_Comm mpiComm, - std::string& hostLanguage, std::vector< std::shared_ptr<CTransform> >& transforms, - std::map< std::string, CGroup >& groups ); + std::string& hostLanguage, std::vector< std::shared_ptr<Transform> >& transforms, + std::map< std::string, Group >& groups ); /** @@ -99,8 +99,8 @@ void SetMembers( const std::string& fileContent, const MPI_Comm mpiComm, * @param groups passed returns the map of groups defined in fileContent */ void InitXML( const std::string xmlConfigFile, const MPI_Comm mpiComm, const bool debugMode, - std::string& hostLanguage, std::vector< std::shared_ptr<CTransform> >& transforms, - std::map< std::string, CGroup >& groups ); + std::string& hostLanguage, std::vector< std::shared_ptr<Transform> >& transforms, + std::map< std::string, Group >& groups ); /** @@ -129,10 +129,15 @@ void CreateDirectory( const std::string fullPath ) noexcept; * @param transformIndex returns the corresponding transformIndex in transforms for this transport method * @param compressionLevel returns the corresponding compression level from transport = "method:compressionLevel" */ -void SetTransformHelper( const std::string transform, std::vector< std::shared_ptr<CTransform> >& transforms, +void SetTransformHelper( const std::string transform, std::vector< std::shared_ptr<Transform> >& transforms, const bool debugMode, int& transformIndex, int& compressionLevel ); - +/** + * Check in types set if "type" is one of the aliases for a certain type, (e.g. if type = integer is an accepted alias for "int", returning true) + * @param type input to be compared with an alias + * @param types set containing aliases to a certain type, from Support.h + * @return true: is an alias, false: is not + */ bool IsTypeAlias( const std::string type, const std::set<std::string>& types ); diff --git a/include/functions/ADIOSTemplates.h b/include/functions/adiosTemplates.h similarity index 73% rename from include/functions/ADIOSTemplates.h rename to include/functions/adiosTemplates.h index 24859f7743c535ed3911b8b7294a08e7ebcaaa5b..1f1bca18116fafbd7c8532aa4f8ec819615174c2 100644 --- a/include/functions/ADIOSTemplates.h +++ b/include/functions/adiosTemplates.h @@ -14,17 +14,18 @@ /// \endcond -#include "core/CGroup.h" -#include "core/SVariable.h" -#include "core/CCapsule.h" -#include "functions/ADIOSFunctions.h" +#include "core/Capsule.h" +#include "core/Group.h" +#include "core/Variable.h" +#include "functions/adiosFunctions.h" + namespace adios { template<class T> -void WriteHelperToCapsule( CCapsule& capsule, CGroup& group, SVariable<T>& variable, const T* values, +void WriteHelperToCapsule( Capsule& capsule, Group& group, Variable<T>& variable, const T* values, const int transportIndex ) noexcept { variable.m_Values = values; @@ -52,7 +53,7 @@ void WriteHelperToCapsule( CCapsule& capsule, CGroup& group, SVariable<T>& varia * @param capsule */ template<class T> -void WriteHelper( CCapsule& capsule, CGroup& group, const std::string variableName, const T* values, +void WriteHelper( Capsule& capsule, Group& group, const std::string variableName, const T* values, const int transportIndex, const bool debugMode ) { auto lf_DebugType = []( const bool debugMode, const std::string type, const std::set<std::string>& typeAliases, @@ -81,67 +82,67 @@ void WriteHelper( CCapsule& capsule, CGroup& group, const std::string variableNa //will need to add a lambda function later and put types in a set if( std::is_same<T,char>::value ) { - lf_DebugType( debugMode, type, SSupport::DatatypesAliases.at("char"), variableName ); + lf_DebugType( debugMode, type, Support::DatatypesAliases.at("char"), variableName ); WriteHelperToCapsule( capsule, group, group.m_Char[index], values, transportIndex ); } else if( std::is_same<T,unsigned char>::value ) { - lf_DebugType( debugMode, type, SSupport::DatatypesAliases.at("unsigned char"), variableName ); + lf_DebugType( debugMode, type, Support::DatatypesAliases.at("unsigned char"), variableName ); WriteHelperToCapsule( capsule, group, group.m_UChar[index], values, transportIndex ); } else if( std::is_same<T,short>::value ) { - lf_DebugType( debugMode, type, SSupport::DatatypesAliases.at("short"), variableName ); + lf_DebugType( debugMode, type, Support::DatatypesAliases.at("short"), variableName ); WriteHelperToCapsule( capsule, group, group.m_Short[index], values, transportIndex ); } else if( std::is_same<T,unsigned short>::value ) { - lf_DebugType( debugMode, type, SSupport::DatatypesAliases.at("unsigned short"), variableName ); + lf_DebugType( debugMode, type, Support::DatatypesAliases.at("unsigned short"), variableName ); WriteHelperToCapsule( capsule, group, group.m_UShort[index], values, transportIndex ); } else if( std::is_same<T,int>::value ) { - lf_DebugType( debugMode, type, SSupport::DatatypesAliases.at("int"), variableName ); + lf_DebugType( debugMode, type, Support::DatatypesAliases.at("int"), variableName ); WriteHelperToCapsule( capsule, group, group.m_Int[index], values, transportIndex ); } else if( std::is_same<T,unsigned int>::value ) { - lf_DebugType( debugMode, type, SSupport::DatatypesAliases.at("unsigned int"), variableName ); + lf_DebugType( debugMode, type, Support::DatatypesAliases.at("unsigned int"), variableName ); WriteHelperToCapsule( capsule, group, group.m_UInt[index], values, transportIndex ); } else if( std::is_same<T,long int>::value ) { - lf_DebugType( debugMode, type, SSupport::DatatypesAliases.at("long int"), variableName ); + lf_DebugType( debugMode, type, Support::DatatypesAliases.at("long int"), variableName ); WriteHelperToCapsule( capsule, group, group.m_LInt[index], values, transportIndex ); } else if( std::is_same<T,unsigned long int>::value ) { - lf_DebugType( debugMode, type, SSupport::DatatypesAliases.at("unsigned long int"), variableName ); + lf_DebugType( debugMode, type, Support::DatatypesAliases.at("unsigned long int"), variableName ); WriteHelperToCapsule( capsule, group, group.m_ULInt[index], values, transportIndex ); } else if( std::is_same<T,long long int>::value ) { - lf_DebugType( debugMode, type, SSupport::DatatypesAliases.at("long long int"), variableName ); + lf_DebugType( debugMode, type, Support::DatatypesAliases.at("long long int"), variableName ); WriteHelperToCapsule( capsule, group, group.m_LLInt[index], values, transportIndex ); } else if( std::is_same<T,unsigned long long int>::value ) { - lf_DebugType( debugMode, type, SSupport::DatatypesAliases.at("unsigned long long int"), variableName ); + lf_DebugType( debugMode, type, Support::DatatypesAliases.at("unsigned long long int"), variableName ); WriteHelperToCapsule( capsule, group, group.m_ULLInt[index], values, transportIndex ); } else if( std::is_same<T,float>::value ) { - lf_DebugType( debugMode, type, SSupport::DatatypesAliases.at("float"), variableName ); + lf_DebugType( debugMode, type, Support::DatatypesAliases.at("float"), variableName ); WriteHelperToCapsule( capsule, group, group.m_Float[index], values, transportIndex ); } else if( std::is_same<T,double>::value ) { - lf_DebugType( debugMode, type, SSupport::DatatypesAliases.at("double"), variableName ); + lf_DebugType( debugMode, type, Support::DatatypesAliases.at("double"), variableName ); WriteHelperToCapsule( capsule, group, group.m_Double[index], values, transportIndex ); } else if( std::is_same<T,long double>::value ) { - lf_DebugType( debugMode, type, SSupport::DatatypesAliases.at("long double"), variableName ); + lf_DebugType( debugMode, type, Support::DatatypesAliases.at("long double"), variableName ); WriteHelperToCapsule( capsule, group, group.m_LDouble[index], values, transportIndex ); } } diff --git a/include/functions/CCapsuleTemplates.h b/include/functions/capsuleTemplates.h similarity index 93% rename from include/functions/CCapsuleTemplates.h rename to include/functions/capsuleTemplates.h index ba84ab239d402c9be16a6e4fc69f9710f780d652..a7a2d741e9b31749b6921be9934a3b3b55d7d2da 100644 --- a/include/functions/CCapsuleTemplates.h +++ b/include/functions/capsuleTemplates.h @@ -1,19 +1,22 @@ /* - * CCapsuleTemplates.h + * capsuleTemplates.h * * Created on: Nov 18, 2016 * Author: wfg */ -#ifndef CCAPSULETEMPLATES_H_ -#define CCAPSULETEMPLATES_H_ +#ifndef CAPSULETEMPLATES_H_ +#define CAPSULETEMPLATES_H_ +/// \cond EXCLUDE_FROM_DOXYGEN #include <cstring> //std::memcpy #include <vector> #include <thread> +/// \endcond -#include "core/CTransport.h" + +#include "core/Transport.h" namespace adios @@ -69,10 +72,10 @@ void MemcpyThreads( T* destination, const U* source, std::size_t count, const un */ template<class T> void WriteToBuffer( const T* data, const size_t size, const int transportIndex, - std::vector< std::shared_ptr<CTransport> >& transports, + std::vector< std::shared_ptr<Transport> >& transports, const size_t maxBufferSize, std::vector<char>& buffer ) { - auto lf_TransportsWrite = []( const int transportIndex, std::vector< std::shared_ptr<CTransport> >& transports, + auto lf_TransportsWrite = []( const int transportIndex, std::vector< std::shared_ptr<Transport> >& transports, std::vector<char>& buffer ) { if( transportIndex == -1 ) // all transports @@ -142,4 +145,4 @@ void WriteToBuffer( const T* data, const size_t size, const int transportIndex, -#endif /* CCAPSULETEMPLATES_H_ */ +#endif /* CAPSULETEMPLATES_H_ */ diff --git a/include/public/ADIOS.h b/include/public/ADIOS.h index 35fc2dabffb21e369d9e0a12c49b3dbb6d44cfbb..8e854a8b8096f02f91809abeccb26c1b1d351c1b 100644 --- a/include/public/ADIOS.h +++ b/include/public/ADIOS.h @@ -20,10 +20,10 @@ #include "public/mpidummy.h" #endif -#include "core/CGroup.h" -#include "core/CCapsule.h" -#include "public/SSupport.h" -#include "functions/ADIOSTemplates.h" +#include "core/Group.h" +#include "core/Capsule.h" +#include "public/Support.h" +#include "functions/adiosTemplates.h" namespace adios @@ -94,7 +94,7 @@ public: // PUBLIC Constructors and Functions define the User Interface with ADIO } std::vector<std::string> arguments = { args... }; - m_Capsules.emplace( streamName, CCapsule( m_MPIComm, m_DebugMode, streamName, accessMode, transport, arguments ) ); + m_Capsules.emplace( streamName, Capsule( m_MPIComm, m_DebugMode, streamName, accessMode, transport, arguments ) ); } /** @@ -240,7 +240,7 @@ private: * Value: SGroup struct in SGroup.h * </pre> */ - std::map< std::string, CGroup > m_Groups; + std::map< std::string, Group > m_Groups; /** * @brief List of Capsules, each defined from the Open function. @@ -249,10 +249,10 @@ private: * Value: CCapsule object * </pre> */ - std::map< std::string, CCapsule > m_Capsules; + std::map< std::string, Capsule > m_Capsules; - std::vector< std::shared_ptr<CTransform> > m_Transforms; ///< transforms associated with ADIOS run + std::vector< std::shared_ptr<Transform> > m_Transforms; ///< transforms associated with ADIOS run /** * @brief Checks for group existence in m_Groups, if failed throws std::invalid_argument exception @@ -260,7 +260,7 @@ private: * @param groupName unique name, passed for thrown exception only * @param hint adds information to thrown exception */ - void CheckGroup( std::map< std::string, CGroup >::const_iterator itGroup, + void CheckGroup( std::map< std::string, Group >::const_iterator itGroup, const std::string groupName, const std::string hint ) const; /** @@ -269,7 +269,7 @@ private: * @param streamName unique name, passed for thrown exception only * @param hint adds information to thrown exception */ - void CheckCapsule( std::map< std::string, CCapsule >::const_iterator itCapsule, + void CheckCapsule( std::map< std::string, Capsule >::const_iterator itCapsule, const std::string streamName, const std::string hint ) const; }; diff --git a/include/public/SSupport.h b/include/public/Support.h similarity index 71% rename from include/public/SSupport.h rename to include/public/Support.h index 9b90c520fdbdeee8657592ce4f249ace42355ade..493b245cece02edcda4a86c19b903a2f2bfaef52 100644 --- a/include/public/SSupport.h +++ b/include/public/Support.h @@ -5,8 +5,8 @@ * Author: wfg */ -#ifndef SSUPPORT_H_ -#define SSUPPORT_H_ +#ifndef SUPPORT_H_ +#define SUPPORT_H_ /// \cond EXCLUDE_FROM_DOXYGEN #include <set> @@ -18,19 +18,18 @@ namespace adios { -struct SSupport +struct Support { static const std::string Version; ///< current ADIOS version static const std::set<std::string> HostLanguages; ///< supported languages: C, C++, Fortran, Python, Java static const std::set<std::string> Transports; ///< supported transport methods static const std::set<std::string> Transforms; ///< supported data transform methods - static const std::map<std::string, std::set<std::string> > Datatypes; ///< supported data types - static const std::map<std::string, std::set<std::string> > DatatypesAliases; - + static const std::map<std::string, std::set<std::string> > Datatypes; ///< supported data types, key: host language, value: all supported types + static const std::map<std::string, std::set<std::string> > DatatypesAliases; ///< all supported int aliases, key: C++ type (e.g. int), value: aliases to type in key (e.g. int, integer) }; } //end namespace -#endif /* SSUPPORT_H_ */ +#endif /* SUPPORT_H_ */ diff --git a/include/transform/CBZIP2.h b/include/transform/BZIP2.h similarity index 70% rename from include/transform/CBZIP2.h rename to include/transform/BZIP2.h index 4fac24a2551f3272388f2317fbaf3098a8ccc767..43799e306aefacc5c6a8aa8d7b24806d2002a0ec 100644 --- a/include/transform/CBZIP2.h +++ b/include/transform/BZIP2.h @@ -1,22 +1,22 @@ /* - * CBZIP2.h + * BZIP2.h * * Created on: Oct 17, 2016 * Author: wfg */ -#ifndef CBZIP2_H_ -#define CBZIP2_H_ +#ifndef BZIP2_H_ +#define BZIP2_H_ -#include "core/CTransform.h" +#include "core/Transform.h" namespace adios { -class CBZIP2 : public CTransform +class BZIP2 : public Transform { public: @@ -26,9 +26,9 @@ public: * @param compressionLevel * @param variable */ - CBZIP2( ); + BZIP2( ); - ~CBZIP2( ); + ~BZIP2( ); void Compress( const std::vector<char>& bufferIn, std::vector<char>& bufferOut ); @@ -40,4 +40,4 @@ public: -#endif /* CBZIP2_H_ */ +#endif /* BZIP2_H_ */ diff --git a/include/transform/CSZIP.h b/include/transform/CSZIP.h deleted file mode 100644 index e11bb63e5283b287ea0ee7f220765ed416efab5d..0000000000000000000000000000000000000000 --- a/include/transform/CSZIP.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CSZIP.h - * - * Created on: Oct 17, 2016 - * Author: wfg - */ - -#ifndef CSZIP_H_ -#define CSZIP_H_ - - -#include <szlib.h> //szip library header - - -#include "core/CTransform.h" - - -namespace adios -{ - - -class CSZIP : public CTransform -{ - -public: - - /** - * CSZIP constructor - * @param compressionLevel - * @param variable - */ - CSZIP( const unsigned int compressionLevel, CVariableBase& variable ); - - ~CSZIP( ); - - void Compress( ) const; - - void Decompress( ) const; - -}; - - -} //end namespace - - - -#endif /* CSZIP_H_ */ diff --git a/include/transform/CZLIB.h b/include/transform/CZLIB.h deleted file mode 100644 index ffdf551c073eb86be95459a767a43dd08271c859..0000000000000000000000000000000000000000 --- a/include/transform/CZLIB.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CZLIB.h - * - * Created on: Oct 17, 2016 - * Author: wfg - */ - -#ifndef CZLIB_H_ -#define CZLIB_H_ - - -#include <zlib.h> - -#include "core/CTransform.h" - - -namespace adios -{ - - -class CZLIB : public CTransform -{ - -public: - - CZLIB( ); - - ~CZLIB( ); - - - void Compress( ) const; - - void Decompress( ) const; - -}; - - -} //end namespace - - - -#endif /* CZLIB_H_ */ diff --git a/include/transport/CDIMES.h b/include/transport/CDIMES.h deleted file mode 100644 index e9589b8a61f65b324ef1982e08710eaabee56306..0000000000000000000000000000000000000000 --- a/include/transport/CDIMES.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDIMES.h - * - * Created on: Oct 17, 2016 - * Author: wfg - */ - -#ifndef CDIMES_H_ -#define CDIMES_H_ - - -#include "core/CTransport.h" - - -namespace adios -{ - - -class CDIMES : public CTransport -{ - -public: - - CDIMES( const unsigned int priority, const unsigned int iteration, MPI_Comm mpiComm ); - - - ~CDIMES( ); - -}; - - -} //end namespace - - - -#endif /* CDIMES_H_ */ diff --git a/include/transport/CDataMan.h b/include/transport/CDataMan.h deleted file mode 100644 index ffee0b7d00273e3bffe2d2f493fe1b88ed21ca30..0000000000000000000000000000000000000000 --- a/include/transport/CDataMan.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * CDataMan.h - * - * Created on: Nov 15, 2016 - * Author: wfg - */ - -#ifndef CDATAMAN_H_ -#define CDATAMAN_H_ - -#include "core/CTransport.h" - -//here include any external library headers only if needed by the declarations in this file, we can figure out linking them later - -namespace adios -{ - -class CDataMan : public CTransport -{ - - -public: - - CDataMan( MPI_Comm mpiComm, const bool debugMode, const std::vector<std::string>& arguments ); - - ~CDataMan( ); - - /** - * Open your communication socket ? - * @param streamName message name ? - * @param accessMode w or write, r or read - */ - void Open( const std::string streamName, const std::string accessMode ); - - /** - * You might not need this one since Buffer has all data, we might turn it on for future reference - * @param buffer - */ - void SetBuffer( std::vector<char>& buffer ); - - /** - * Here you will receive a reference (not a copy) to the variable being written as raw data ready to be sent. - * Your magic will go inside this function. From ADIOS it's just a single call per variable. - * @param buffer contains a reference to the raw data variable. This backtraces to ADIOS.Write( group, variableName, * value ) - */ - void Write( std::vector<char>& buffer ); - - /** - * Required to terminate your acquire system resource (file, socket, stream, etc.) if hanging to avoid memory leaks - */ - void Close( ); - - -// FILE* m_File; //here put your unique, particular form of communication. See CPOSIX and CFStream for files. -// You have your own structs, objects etc. put them in protected (if inherited) or private space -// We can also work on initializing them in the constructor - -//protected: - -private: - - void Init( const std::vector<std::string>& arguments ); - - -}; - - - - - - - - - - - - -} //end namespace - - -#endif /* CDATAMAN_H_ */ diff --git a/include/transport/CDataspaces.h b/include/transport/CDataspaces.h deleted file mode 100644 index b07bda23b8857fa2ba971d712b7e7f0e1c174374..0000000000000000000000000000000000000000 --- a/include/transport/CDataspaces.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDataspacesMPI.h - * - * Created on: Oct 17, 2016 - * Author: wfg - */ - -#ifndef CDATASPACES_H_ -#define CDATASPACES_H_ - - -#include "core/CTransport.h" - - -namespace adios -{ - - -class CDataspaces : public CTransport -{ - -public: - - CDataspaces( const unsigned int priority, const unsigned int iteration, MPI_Comm mpiComm ); - - ~CDataspaces( ); - -}; - - -} //end namespace - - - - -#endif /* CDATASPACES_H_ */ diff --git a/include/transport/CFlexpath.h b/include/transport/CFlexpath.h deleted file mode 100644 index d4ded095a445e7659794a4d3b646190c0de5f970..0000000000000000000000000000000000000000 --- a/include/transport/CFlexpath.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CFlexpath.h - * - * Created on: Oct 17, 2016 - * Author: wfg - */ - -#ifndef CFLEXPATH_H_ -#define CFLEXPATH_H_ - -#include "core/CTransport.h" - - -namespace adios -{ - - -class CFlexpath : public CTransport -{ - -public: - - CFlexpath( const unsigned int priority, const unsigned int iteration, MPI_Comm mpiComm ); - - ~CFlexpath( ); - -}; - - -} //end namespace - - - -#endif /* CFLEXPATH_H_ */ diff --git a/include/transport/CICEE.h b/include/transport/CICEE.h deleted file mode 100644 index d151badbe2c48a56634fdced8592a02f1260200d..0000000000000000000000000000000000000000 --- a/include/transport/CICEE.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CICEEMPI.h - * - * Created on: Oct 17, 2016 - * Author: wfg - */ - -#ifndef CICEE_H_ -#define CICEE_H_ - -#include "core/CTransport.h" - - -namespace adios -{ - - -class CICEE : public CTransport -{ - -public: - - CICEE( const unsigned int priority, const unsigned int iteration, MPI_Comm mpiComm ); - - ~CICEE( ); - -}; - - -} //end namespace - - - - -#endif /* CICEE_H_ */ diff --git a/include/transport/CMPI.h b/include/transport/CMPI.h deleted file mode 100644 index b48582664ad9a8506efed1a3e4b6dbbfa72a5b99..0000000000000000000000000000000000000000 --- a/include/transport/CMPI.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CMPI.h - * - * Created on: Oct 17, 2016 - * Author: wfg - */ - -#ifndef CMPI_H_ -#define CMPI_H_ - -#include "core/CTransport.h" - - -namespace adios -{ - -/** - * Transport method using MPI I/O API - */ -class CMPI : public CTransport -{ - -public: - - CMPI( const unsigned int priority, const unsigned int iteration, MPI_Comm mpiComm ); - - ~CMPI( ); - -}; - - -} //end namespace - - - -#endif /* CMPI_H_ */ diff --git a/include/transport/CMPIAggregate.h b/include/transport/CMPIAggregate.h deleted file mode 100644 index 24f387f96ab06de1cac8bd8fd01835f94de82252..0000000000000000000000000000000000000000 --- a/include/transport/CMPIAggregate.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CMPIAggregate.h - * - * Created on: Oct 17, 2016 - * Author: wfg - */ - -#ifndef CMPIAGGREGATE_H_ -#define CMPIAGGREGATE_H_ - - - -#include "core/CTransport.h" - - -namespace adios -{ - - -class CMPIAggregate : public CTransport -{ - -public: - - CMPIAggregate( const unsigned int priority, const unsigned int iteration, MPI_Comm mpiComm ); - - ~CMPIAggregate( ); - -}; - - -} //end namespace - - -#endif /* CMPIAGGREGATE_H_ */ diff --git a/include/transport/CMPILustre.h b/include/transport/CMPILustre.h deleted file mode 100644 index 28ec77c953f56e7f1b205f2a7edc82eb39304391..0000000000000000000000000000000000000000 --- a/include/transport/CMPILustre.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CMPILustre.h - * - * Created on: Oct 17, 2016 - * Author: wfg - */ - -#ifndef CMPILUSTRE_H_ -#define CMPILUSTRE_H_ - - -#include "core/CTransport.h" - - -namespace adios -{ - - -class CMPILustre : public CTransport -{ - -public: - - CMPILustre( const unsigned int priority, const unsigned int iteration, MPI_Comm mpiComm ); - - ~CMPILustre( ); - -}; - - -} //end namespace - - -#endif /* CMPILUSTRE_H_ */ diff --git a/include/transport/CNetCDF4.h b/include/transport/CNetCDF4.h deleted file mode 100644 index 5108040e2b37c11d0c2913ea42da65bedad92795..0000000000000000000000000000000000000000 --- a/include/transport/CNetCDF4.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * CNetCDF4.h - * - * Created on: Oct 17, 2016 - * Author: wfg - */ - -#ifndef CNETCDF4_H_ -#define CNETCDF4_H_ - -#include <netcdf.h> - -#include "core/CTransport.h" - - -namespace adios -{ - - -class CNetCDF4 : public CTransport -{ - -public: - - CNetCDF4( const unsigned int priority, const unsigned int iteration, MPI_Comm mpiComm ); - - ~CNetCDF4( ); - -}; - - -} //end namespace - - -#endif /* CNETCDF4_H_ */ diff --git a/include/transport/CPHDF5.h b/include/transport/CPHDF5.h deleted file mode 100644 index 285ead7b2f008e1d7b2c6b598a349ed87608a4af..0000000000000000000000000000000000000000 --- a/include/transport/CPHDF5.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CPHDF5.h - * - * Created on: Oct 17, 2016 - * Author: wfg - */ - -#ifndef CPHDF5_H_ -#define CPHDF5_H_ - -#include <hdf5.h> - -#include "core/CTransport.h" - - -namespace adios -{ - - -class CPHDF5 : public CTransport -{ - -public: - - CPHDF5( const unsigned int priority, const unsigned int iteration, MPI_Comm mpiComm ); - - ~CPHDF5( ); - -}; - - -} //end namespace - - - -#endif /* CPHDF5_H_ */ diff --git a/include/transport/CVarMerge.h b/include/transport/CVarMerge.h deleted file mode 100644 index bb80499cabb60bbbcc0a984af16dbb5f001d4b64..0000000000000000000000000000000000000000 --- a/include/transport/CVarMerge.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * CVarMerge.h - * - * Created on: Oct 17, 2016 - * Author: wfg - */ - -#ifndef CVARMERGE_H_ -#define CVARMERGE_H_ - - -#include "core/CTransport.h" - - -namespace adios -{ - - -class CVarMerge : public CTransport -{ - -public: - - CVarMerge( const unsigned int priority, const unsigned int iteration, MPI_Comm mpiComm ); - - ~CVarMerge( ); - -}; - - -} //end namespace - - -#endif /* CVARMERGE_H_ */ diff --git a/include/transport/CFStream.h b/include/transport/FStream.h similarity index 69% rename from include/transport/CFStream.h rename to include/transport/FStream.h index 5b4f19d568d195982b4225532abf6583b731aaf4..1bfb6e4a13812c06bf0ba90cfac96f42219b33b3 100644 --- a/include/transport/CFStream.h +++ b/include/transport/FStream.h @@ -5,12 +5,13 @@ * Author: wfg */ -#ifndef CFSTREAM_H_ -#define CFSTREAM_H_ +#ifndef FSTREAM_H_ +#define FSTREAM_H_ + #include <fstream> -#include "core/CTransport.h" +#include "core/Transport.h" namespace adios @@ -19,14 +20,14 @@ namespace adios /** * Class that defines a transport method using C++ file streams */ -class CFStream : public CTransport +class FStream : public Transport { public: - CFStream( MPI_Comm mpiComm, const bool debugMode, const std::vector<std::string>& arguments ); + FStream( MPI_Comm mpiComm, const bool debugMode, const std::vector<std::string>& arguments ); - ~CFStream( ); + ~FStream( ); void Open( const std::string streamName, const std::string accessMode ); @@ -49,4 +50,4 @@ private: -#endif /* CFSTREAM_H_ */ +#endif /* FSTREAM_H_ */ diff --git a/include/transport/CPOSIX.h b/include/transport/POSIX.h similarity index 59% rename from include/transport/CPOSIX.h rename to include/transport/POSIX.h index f807876934dfc3d4f521bd63b155d2943e96c1fe..5e9695952bfaccb535f43443d39afb67546f109f 100644 --- a/include/transport/CPOSIX.h +++ b/include/transport/POSIX.h @@ -1,30 +1,32 @@ /* - * CPOSIXMPI.h + * POSIXMPI.h * * Created on: Oct 6, 2016 * Author: wfg */ -#ifndef CPOSIX_H_ -#define CPOSIX_H_ +#ifndef POSIX_H_ +#define POSIX_H_ + #include <stdio.h> //FILE* -#include "core/CTransport.h" + +#include "core/Transport.h" namespace adios { -class CPOSIX : public CTransport +class POSIX : public Transport { public: - CPOSIX( MPI_Comm mpiComm, const bool debugMode, const std::vector<std::string>& arguments ); + POSIX( MPI_Comm mpiComm, const bool debugMode, const std::vector<std::string>& arguments ); - ~CPOSIX( ); + ~POSIX( ); void Open( const std::string streamName, const std::string accessMode ); @@ -37,7 +39,7 @@ public: private: - FILE* m_File; + FILE* m_File; ///< POSIX C file pointer void Init( const std::vector<std::string>& arguments ); @@ -47,4 +49,4 @@ private: } //end namespace -#endif /* CPOSIX_H_ */ +#endif /* POSIX_H_ */ diff --git a/src/core/CCapsule.cpp b/src/core/Capsule.cpp similarity index 70% rename from src/core/CCapsule.cpp rename to src/core/Capsule.cpp index 0bc99b830b47846863d1c71cc940dd891b8d84ac..95624ab57e9816006e8a65089fedf22035c78582 100644 --- a/src/core/CCapsule.cpp +++ b/src/core/Capsule.cpp @@ -1,5 +1,5 @@ /* - * CCapsule.cpp + * Capsule.cpp * * Created on: Nov 11, 2016 * Author: wfg @@ -10,27 +10,28 @@ #include <cstring> //memcpy /// \endcond -#include "core/CCapsule.h" -#include "public/SSupport.h" #ifdef HAVE_BZIP2 #include "transform/CBZIP2.h" #endif -#include "transport/CPOSIX.h" -#include "transport/CFStream.h" -#include "transport/CDataMan.h" +#include "core/Capsule.h" +#include "public/Support.h" + +//transport below +#include "transport/POSIX.h" +#include "transport/FStream.h" namespace adios { -CCapsule::CCapsule( ) +Capsule::Capsule( ) { } -CCapsule::CCapsule( const MPI_Comm mpiComm, const bool debugMode, const std::string streamName, +Capsule::Capsule( const MPI_Comm mpiComm, const bool debugMode, const std::string streamName, const std::string accessMode, const std::string transport, const std::vector<std::string>& arguments ): m_MPIComm{ mpiComm }, m_DebugMode{ debugMode } @@ -39,11 +40,11 @@ CCapsule::CCapsule( const MPI_Comm mpiComm, const bool debugMode, const std::str } -CCapsule::~CCapsule( ) +Capsule::~Capsule( ) { } -int CCapsule::AddTransport( const std::string streamName, const std::string accessMode, const bool isDefault, +int Capsule::AddTransport( const std::string streamName, const std::string accessMode, const bool isDefault, const std::string transport, const std::vector<std::string>& arguments ) { @@ -59,14 +60,10 @@ int CCapsule::AddTransport( const std::string streamName, const std::string acce } if( transport == "POSIX" ) - m_Transports.push_back( std::make_shared<CPOSIX>( m_MPIComm, m_DebugMode, arguments ) ); + m_Transports.push_back( std::make_shared<POSIX>( m_MPIComm, m_DebugMode, arguments ) ); else if( transport == "FStream" ) - m_Transports.push_back( std::make_shared<CFStream>( m_MPIComm, m_DebugMode, arguments ) ); - - else if( transport == "DataMan" ) - m_Transports.push_back( std::make_shared<CDataMan>( m_MPIComm, m_DebugMode, arguments ) ); - + m_Transports.push_back( std::make_shared<FStream>( m_MPIComm, m_DebugMode, arguments ) ); int transportIndex = static_cast<int>( m_Transports.size() - 1 ); m_Transports[ transportIndex ]->Open( name, accessMode ); @@ -75,7 +72,7 @@ int CCapsule::AddTransport( const std::string streamName, const std::string acce } -void CCapsule::Close( int transportIndex ) +void Capsule::Close( int transportIndex ) { if( transportIndex == -1 ) //close all transports { @@ -90,7 +87,7 @@ void CCapsule::Close( int transportIndex ) //PRIVATE FUNCTIONS -std::string CCapsule::GetName( const std::vector<std::string>& arguments ) const +std::string Capsule::GetName( const std::vector<std::string>& arguments ) const { bool isNameFound = false; std::string name; diff --git a/src/core/CGroup.cpp b/src/core/Group.cpp similarity index 60% rename from src/core/CGroup.cpp rename to src/core/Group.cpp index a15e700ec61c206cc8a90864abbb12188c3bea86..b98fe3198fc12b0205b640bf42b78288f6af94be 100644 --- a/src/core/CGroup.cpp +++ b/src/core/Group.cpp @@ -1,33 +1,34 @@ /* - * CGroup.cpp + * Group.cpp * * Created on: Oct 12, 2016 * Author: wfg */ +/// \cond EXCLUDED_FROM_DOXYGEN +#include <algorithm> // std::find +#include <sstream> // std::istringstream +/// \endcond -#include <iostream> -#include <algorithm> // find -#include <sstream> //istringstream -#include "core/CGroup.h" -#include "core/SVariable.h" //for cast implementation of CVariableBase::Set that calls CVariable::Set -#include "public/SSupport.h" -#include "functions/ADIOSFunctions.h" //for XML Parsing functions (e.g. GetTag) +#include "core/Group.h" +#include "core/Variable.h" +#include "functions/adiosFunctions.h" +#include "public/Support.h" namespace adios { -CGroup::CGroup( const std::string hostLanguage, const bool debugMode ): +Group::Group( const std::string hostLanguage, const bool debugMode ): m_HostLanguage{ hostLanguage }, m_DebugMode{ debugMode } { } -CGroup::CGroup( const std::string hostLanguage, const std::string& xmlGroup, - std::vector< std::shared_ptr<CTransform> >& transforms, const bool debugMode ): +Group::Group( const std::string hostLanguage, const std::string& xmlGroup, + std::vector< std::shared_ptr<Transform> >& transforms, const bool debugMode ): m_HostLanguage{ hostLanguage }, m_DebugMode{ debugMode } { @@ -35,18 +36,18 @@ CGroup::CGroup( const std::string hostLanguage, const std::string& xmlGroup, } -CGroup::~CGroup( ) +Group::~Group( ) { } -void CGroup::DefineVariable( const std::string variableName, const std::string type, +void Group::DefineVariable( const std::string variableName, const std::string type, const std::string dimensionsCSV, const std::string globalDimensionsCSV, const std::string globalOffsetsCSV, const short transformIndex, const unsigned short int compressionLevel ) { if( m_DebugMode == true ) { - if( SSupport::Datatypes.at( m_HostLanguage ).count( type ) == 0 ) + if( Support::Datatypes.at( m_HostLanguage ).count( type ) == 0 ) throw std::invalid_argument( "ERROR: type " + type + " for variable " + variableName + " is not supported, in call to DefineVariable\n" ); @@ -56,69 +57,69 @@ void CGroup::DefineVariable( const std::string variableName, const std::string t short globalBoundsIndex = SetGlobalBounds( globalDimensionsCSV, globalOffsetsCSV ); - if( IsTypeAlias( type, SSupport::DatatypesAliases.at("char") ) == true ) + if( IsTypeAlias( type, Support::DatatypesAliases.at("char") ) == true ) { - m_Char.push_back( SVariable<char>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); + m_Char.push_back( Variable<char>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); m_Variables[variableName] = std::make_pair( type, m_Char.size()-1 ); } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("unsigned char") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned char") ) == true ) { - m_UChar.push_back( SVariable<unsigned char>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); + m_UChar.push_back( Variable<unsigned char>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); m_Variables[variableName] = std::make_pair( type, m_UChar.size()-1 ); } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("short") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("short") ) == true ) { - m_Short.push_back( SVariable<short>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); + m_Short.push_back( Variable<short>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); m_Variables[variableName] = std::make_pair( type, m_Short.size()-1 ); } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("unsigned short") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned short") ) == true ) { - m_UShort.push_back( SVariable<unsigned short>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); + m_UShort.push_back( Variable<unsigned short>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); m_Variables[variableName] = std::make_pair( type, m_UShort.size()-1 ); } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("int") ) == true ) { - m_Int.push_back( SVariable<int>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); + m_Int.push_back( Variable<int>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); m_Variables[variableName] = std::make_pair( type, m_Int.size()-1 ); } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("unsigned int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned int") ) == true ) { - m_UInt.push_back( SVariable<unsigned int>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); + m_UInt.push_back( Variable<unsigned int>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); m_Variables[variableName] = std::make_pair( type, m_UInt.size()-1 ); } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("long int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("long int") ) == true ) { - m_LInt.push_back( SVariable<long int>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); + m_LInt.push_back( Variable<long int>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); m_Variables[variableName] = std::make_pair( type, m_LInt.size()-1 ); } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("unsigned long int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned long int") ) == true ) { - m_ULInt.push_back( SVariable<unsigned long int>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); + m_ULInt.push_back( Variable<unsigned long int>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); m_Variables[variableName] = std::make_pair( type, m_ULInt.size()-1 ); } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("long long int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("long long int") ) == true ) { - m_LLInt.push_back( SVariable<long long int>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); + m_LLInt.push_back( Variable<long long int>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); m_Variables[variableName] = std::make_pair( type, m_LLInt.size()-1 ); } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("unsigned long long int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned long long int") ) == true ) { - m_ULLInt.push_back( SVariable<unsigned long long int>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); + m_ULLInt.push_back( Variable<unsigned long long int>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); m_Variables[variableName] = std::make_pair( type, m_ULLInt.size()-1 ); } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("float") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("float") ) == true ) { - m_Float.push_back( SVariable<float>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); + m_Float.push_back( Variable<float>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); m_Variables[variableName] = std::make_pair( type, m_Float.size()-1 ); } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("double") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("double") ) == true ) { - m_Double.push_back( SVariable<double>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); + m_Double.push_back( Variable<double>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); m_Variables[variableName] = std::make_pair( type, m_Double.size()-1 ); } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("long double") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("long double") ) == true ) { - m_LDouble.push_back( SVariable<long double>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); + m_LDouble.push_back( Variable<long double>{ dimensionsCSV, nullptr, globalBoundsIndex, transformIndex, compressionLevel } ); m_Variables[variableName] = std::make_pair( type, m_LDouble.size()-1 ); } @@ -126,7 +127,7 @@ void CGroup::DefineVariable( const std::string variableName, const std::string t } -void CGroup::SetTransform( const std::string variableName, const unsigned int transformIndex, const unsigned int compressionLevel ) +void Group::SetTransform( const std::string variableName, const unsigned int transformIndex, const unsigned int compressionLevel ) { auto itVariable = m_Variables.find( variableName ); @@ -139,62 +140,62 @@ void CGroup::SetTransform( const std::string variableName, const unsigned int tr const std::string type( itVariable->second.first ); const unsigned int index = itVariable->second.second; - if( IsTypeAlias( type, SSupport::DatatypesAliases.at("char") ) == true ) + if( IsTypeAlias( type, Support::DatatypesAliases.at("char") ) == true ) { m_Char[index].TransformIndex = transformIndex; m_Char[index].CompressionLevel = compressionLevel; } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("unsigned char") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned char") ) == true ) { m_UChar[index].TransformIndex = transformIndex; m_UChar[index].CompressionLevel = compressionLevel; } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("short") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("short") ) == true ) { m_Short[index].TransformIndex = transformIndex; m_Short[index].CompressionLevel = compressionLevel; } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("unsigned short") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned short") ) == true ) { m_UShort[index].TransformIndex = transformIndex; m_UShort[index].CompressionLevel = compressionLevel; } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("int") ) == true ) { m_Int[index].TransformIndex = transformIndex; m_Int[index].CompressionLevel = compressionLevel; } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("unsigned int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned int") ) == true ) { m_UInt[index].TransformIndex = transformIndex; m_UInt[index].CompressionLevel = compressionLevel; } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("long int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("long int") ) == true ) { m_LInt[index].TransformIndex = transformIndex; m_LInt[index].CompressionLevel = compressionLevel; } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("unsigned long int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned long int") ) == true ) { m_ULInt[index].TransformIndex = transformIndex; m_ULInt[index].CompressionLevel = compressionLevel; } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("unsigned long long int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned long long int") ) == true ) { m_ULLInt[index].TransformIndex = transformIndex; m_ULLInt[index].CompressionLevel = compressionLevel; } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("float") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("float") ) == true ) { m_Float[index].TransformIndex = transformIndex; m_Float[index].CompressionLevel = compressionLevel; } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("double") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("double") ) == true ) { m_Double[index].TransformIndex = transformIndex; m_Double[index].CompressionLevel = compressionLevel; } - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("long double") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("long double") ) == true ) { m_LDouble[index].TransformIndex = transformIndex; m_LDouble[index].CompressionLevel = compressionLevel; @@ -202,25 +203,42 @@ void CGroup::SetTransform( const std::string variableName, const unsigned int tr } -void CGroup::DefineAttribute( const std::string attributeName, const std::string type, const std::string value ) +void Group::DefineAttribute( const std::string attributeName, const std::string type, const std::string value ) { + auto lf_GetTypeID = []( const std::string type, const bool debugMode ) -> const char + { + char typeID; + if( type == "string" ) + typeID = '0'; + else if( type == "numeric" ) + typeID = '1'; + else + { + if( debugMode == true ) + throw std::invalid_argument( "ERROR: type " + type + " must be string or numeric, in call to DefineAttribute\n" ); + } + + return typeID; + }; + + if( m_DebugMode == true ) { if( m_Attributes.count( attributeName ) == 0 ) //attribute doesn't exists - m_Attributes.emplace( attributeName, SAttribute{ type, value } ); + m_Attributes.emplace( attributeName, Attribute{ lf_GetTypeID( type, m_DebugMode ), value } ); else //name is found throw std::invalid_argument( "ERROR: attribute " + attributeName + " exists, NOT setting a new variable\n" ); } else { - m_Attributes.emplace( attributeName, SAttribute{ type, value } ); + m_Attributes.emplace( attributeName, Attribute{ lf_GetTypeID( type, m_DebugMode ), value } ); } - m_SerialSize += attributeName.size() + type.size() + value.size() + 3 * sizeof( char ); //3 is one byte storing the size as a char + m_SerialSize += attributeName.size() + 1 + value.size() + 3 * sizeof( char ); //3 is one byte storing the size as a char } -const unsigned long long int CGroup::GetIntVariableValue( const std::string variableName ) const +const unsigned long long int Group::GetIntVariableValue( const std::string variableName ) const { if( m_DebugMode == true ) { @@ -232,28 +250,28 @@ const unsigned long long int CGroup::GetIntVariableValue( const std::string vari const unsigned int index = m_Variables.at( variableName ).second; long long int value = -1; - if( IsTypeAlias( type, SSupport::DatatypesAliases.at("short") ) == true ) + if( IsTypeAlias( type, Support::DatatypesAliases.at("short") ) == true ) value = *( m_Short[index].Values ); - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("unsigned short") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned short") ) == true ) value = *( m_UShort[index].Values ); - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("int") ) == true ) value = *( m_Int[index].Values ); - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("unsigned int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned int") ) == true ) value = *( m_UInt[index].Values ); - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("long int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("long int") ) == true ) value = *( m_LInt[index].Values ); - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("unsigned long int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned long int") ) == true ) value = *( m_ULInt[index].Values ); - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("long long int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("long long int") ) == true ) value = *( m_LLInt[index].Values ); - else if( IsTypeAlias( type, SSupport::DatatypesAliases.at("unsigned long long int") ) == true ) + else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned long long int") ) == true ) value = *( m_ULLInt[index].Values ); else @@ -269,7 +287,7 @@ const unsigned long long int CGroup::GetIntVariableValue( const std::string vari } -std::vector<unsigned long long int> CGroup::GetDimensions( const std::string dimensionsCSV ) const +std::vector<unsigned long long int> Group::GetDimensions( const std::string dimensionsCSV ) const { std::vector<unsigned long long int> dimensions; @@ -292,25 +310,25 @@ std::vector<unsigned long long int> CGroup::GetDimensions( const std::string dim //PRIVATE FUNCTIONS BELOW -void CGroup::Monitor( std::ostream& logStream ) const +void Group::Monitor( std::ostream& logStream ) const { logStream << "\tVariable \t Type\n"; for( auto& variablePair : m_Variables ) { logStream << "\t" << variablePair.first << " \t " << variablePair.second.first << "\n"; } - std::cout << "\n"; + logStream << "\n"; logStream << "\tAttribute \t Type \t Value \n"; for( auto& attributePair : m_Attributes ) { - logStream << "\t" << attributePair.first << " \t " << attributePair.second.Type << " \t " << attributePair.second.Value << "\n"; + logStream << "\t" << attributePair.first << " \t " << attributePair.second.TypeID << " \t " << attributePair.second.Value << "\n"; } - std::cout << "\n"; + logStream << "\n"; } -void CGroup::ParseXMLGroup( const std::string& xmlGroup, std::vector< std::shared_ptr<CTransform> >& transforms ) +void Group::ParseXMLGroup( const std::string& xmlGroup, std::vector< std::shared_ptr<Transform> >& transforms ) { std::string::size_type currentPosition( 0 ); std::string globalDimensionsCSV; //used to set variables @@ -397,7 +415,7 @@ void CGroup::ParseXMLGroup( const std::string& xmlGroup, std::vector< std::share } -const short CGroup::SetGlobalBounds( const std::string globalDimensionsCSV, const std::string globalOffsetsCSV ) noexcept +const short Group::SetGlobalBounds( const std::string globalDimensionsCSV, const std::string globalOffsetsCSV ) noexcept { if( globalDimensionsCSV.empty() || globalOffsetsCSV.empty() ) return -1; diff --git a/src/core/Transform.cpp b/src/core/Transform.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0002c8d8a5712af991f9a96abfa9ab69355536e7 --- /dev/null +++ b/src/core/Transform.cpp @@ -0,0 +1,25 @@ +/* + * Transform.cpp + * + * Created on: Dec 5, 2016 + * Author: wfg + */ + +#include "core/Transform.h" + + +namespace adios +{ + + +Transform::Transform( const std::string method ): + m_Method( method ) +{ } + + +Transform::~Transform( ) +{ } + + + +} //end namespace diff --git a/src/core/Transport.cpp b/src/core/Transport.cpp new file mode 100644 index 0000000000000000000000000000000000000000..7d797a55e7b93e1ec6af8a40b91fe7199ac1b31b --- /dev/null +++ b/src/core/Transport.cpp @@ -0,0 +1,43 @@ +/* + * Transport.cpp + * + * Created on: Dec 5, 2016 + * Author: wfg + */ + +#include "core/Transport.h" + + +namespace adios +{ + + +Transport::Transport( const std::string method, MPI_Comm mpiComm, const bool debugMode ): + m_Method{ method }, + m_MPIComm{ mpiComm }, + m_DebugMode{ debugMode } +{ + MPI_Comm_rank( m_MPIComm, &m_MPIRank ); + MPI_Comm_size( m_MPIComm, &m_MPISize ); +} + + +Transport::~Transport( ) +{ } + + +void Transport::SetBuffer( std::vector<char>& buffer ) +{ } + + +void Transport::Write( std::vector<char>& buffer ) +{ } + + +void Transport::Init( const std::vector<std::string>& arguments ) +{ } + + + +} //end namespace + diff --git a/src/functions/ADIOSFunctions.cpp b/src/functions/adiosFunctions.cpp similarity index 96% rename from src/functions/ADIOSFunctions.cpp rename to src/functions/adiosFunctions.cpp index 1eb5f47c1a7094cb53b9a4aafaea5d5b3bcc73f1..1f1e2c120f34e90a7c313407544ff8e2d167fb24 100644 --- a/src/functions/ADIOSFunctions.cpp +++ b/src/functions/adiosFunctions.cpp @@ -1,5 +1,5 @@ /* - * ADIOSFunctions.cpp + * adiosFunctions.cpp * * Created on: Oct 10, 2016 * Author: wfg @@ -18,8 +18,8 @@ #include <unistd.h> //CreateDirectory /// \endcond -#include "functions/ADIOSFunctions.h" -#include "public/SSupport.h" +#include "functions/adiosFunctions.h" +#include "public/Support.h" #ifdef HAVE_BZIP2 #include "transform/CBZIP2.h" @@ -189,8 +189,8 @@ void GetPairsFromTag( const std::string& fileContent, const std::string tag, void SetMembers( const std::string& fileContent, const MPI_Comm mpiComm, const bool debugMode, - std::string& hostLanguage, std::vector< std::shared_ptr<CTransform> >& transforms, - std::map< std::string, CGroup >& groups ) + std::string& hostLanguage, std::vector< std::shared_ptr<Transform> >& transforms, + std::map< std::string, Group >& groups ) { //adios-config std::string currentContent; @@ -223,7 +223,7 @@ void SetMembers( const std::string& fileContent, const MPI_Comm mpiComm, const b if( debugMode == true ) { - if( SSupport::HostLanguages.count( hostLanguage ) == 0 ) + if( Support::HostLanguages.count( hostLanguage ) == 0 ) throw std::invalid_argument("ERROR: host language " + hostLanguage + " not supported.\n" ); if( hostLanguage.empty() == true ) @@ -269,7 +269,7 @@ void SetMembers( const std::string& fileContent, const MPI_Comm mpiComm, const b throw std::invalid_argument( "ERROR: group " + groupName + " defined twice.\n" ); } - groups.emplace( groupName, CGroup( hostLanguage, xmlGroup, transforms, debugMode ) ); + groups.emplace( groupName, Group( hostLanguage, xmlGroup, transforms, debugMode ) ); currentContent.erase( currentContent.find( xmlGroup ), xmlGroup.size() ); currentPosition = 0; @@ -328,8 +328,8 @@ void SetMembers( const std::string& fileContent, const MPI_Comm mpiComm, const b void InitXML( const std::string xmlConfigFile, const MPI_Comm mpiComm, const bool debugMode, - std::string& hostLanguage, std::vector< std::shared_ptr<CTransform> >& transforms, - std::map< std::string, CGroup >& groups ) + std::string& hostLanguage, std::vector< std::shared_ptr<Transform> >& transforms, + std::map< std::string, Group >& groups ) { int xmlFileContentSize; std::string xmlFileContent; @@ -405,7 +405,7 @@ void CreateDirectory( const std::string fullPath ) noexcept } -void SetTransformHelper( const std::string transform, std::vector< std::shared_ptr<CTransform> >& transforms, +void SetTransformHelper( const std::string transform, std::vector< std::shared_ptr<Transform> >& transforms, const bool debugMode, int& transformIndex, int& compressionLevel ) { //get method:compressionLevel from transform diff --git a/src/public/ADIOS.cpp b/src/public/ADIOS.cpp index e6f1ba905d1f183d1c83bff368c84e0c06f292a9..9afc97ed12dd6b902dcbbbb8f1834232c033568b 100644 --- a/src/public/ADIOS.cpp +++ b/src/public/ADIOS.cpp @@ -14,7 +14,7 @@ /// \endcond #include "public/ADIOS.h" -#include "functions/ADIOSFunctions.h" +#include "functions/adiosFunctions.h" namespace adios @@ -98,7 +98,7 @@ void ADIOS::DeclareGroup( const std::string groupName ) throw std::invalid_argument( "ERROR: group " + groupName + " already exist, from call to CreateGroup\n" ); } - m_Groups.emplace( groupName, CGroup( m_HostLanguage, m_DebugMode ) ); + m_Groups.emplace( groupName, Group( m_HostLanguage, m_DebugMode ) ); } @@ -121,7 +121,7 @@ void ADIOS::SetTransform( const std::string groupName, const std::string variabl { CheckGroup( itGroup, groupName, " from call to SetTransform \n" ); - if( SSupport::Transforms.count( transform ) == 0 ) + if( Support::Transforms.count( transform ) == 0 ) throw std::invalid_argument( "ERROR: transform method " + transform + " not supported, in call to SetTransform\n" ); } @@ -157,16 +157,15 @@ void ADIOS::MonitorGroups( std::ostream& logStream ) const - //PRIVATE FUNCTIONS BELOW -void ADIOS::CheckGroup( std::map< std::string, CGroup >::const_iterator itGroup, +void ADIOS::CheckGroup( std::map< std::string, Group >::const_iterator itGroup, const std::string groupName, const std::string hint ) const { if( itGroup == m_Groups.end() ) throw std::invalid_argument( "ERROR: group " + groupName + " not found " + hint + "\n" ); } -void ADIOS::CheckCapsule( std::map< std::string, CCapsule >::const_iterator itCapsule, +void ADIOS::CheckCapsule( std::map< std::string, Capsule >::const_iterator itCapsule, const std::string streamName, const std::string hint ) const { if( itCapsule == m_Capsules.end() ) diff --git a/src/public/SSupport.cpp b/src/public/SSupport.cpp index 893e28fc519ada6be0a9beff44b64bb8e69a8dd5..d8e9624b60eb563d9656931a9e663def6983f6f4 100644 --- a/src/public/SSupport.cpp +++ b/src/public/SSupport.cpp @@ -6,32 +6,32 @@ */ -#include "public/SSupport.h" +#include "public/Support.h" namespace adios { -const std::string SSupport::Version{ "2.00" }; +const std::string Support::Version{ "2.00" }; -const std::set<std::string> SSupport::HostLanguages{ +const std::set<std::string> Support::HostLanguages{ { "C", "C++", "Fortran", "Python", "Java" } }; -const std::set<std::string> SSupport::Transports{ +const std::set<std::string> Support::Transports{ { "NULL", "POSIX", "FStream", "MPI", "MPI_LUSTRE", "MPI_AGGREGATE", "DATASPACES", "DIMES", "FLEXPATH", "PHDF5", "NC4", "ICEE" } }; -const std::set<std::string> SSupport::Transforms{ +const std::set<std::string> Support::Transforms{ { "none", "identity", "bzip2", "isobar", "szip" , "zlib" } }; -const std::map<std::string, std::set<std::string> > SSupport::Datatypes +const std::map<std::string, std::set<std::string> > Support::Datatypes { { "C++", { @@ -85,7 +85,7 @@ const std::map<std::string, std::set<std::string> > SSupport::Datatypes }; -const std::map<std::string, std::set<std::string> > SSupport::DatatypesAliases +const std::map<std::string, std::set<std::string> > Support::DatatypesAliases { { "char", { "char", "character" } }, { "unsigned char", { "unsigned char", "unsigned character" } }, diff --git a/src/transform/BZIP2.cpp b/src/transform/BZIP2.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2d42b7ba18a928f633935e2d76d0636c1b03c736 --- /dev/null +++ b/src/transform/BZIP2.cpp @@ -0,0 +1,43 @@ +/* + * BZIP2.cpp + * + * Created on: Oct 19, 2016 + * Author: wfg + */ + + + +#include "transform/BZIP2.h" + + + +namespace adios +{ + + +BZIP2::BZIP2( ): + Transform( "bzip2" ) +{ } + + +BZIP2::~BZIP2( ) +{ } + + + +void BZIP2::Compress( const std::vector<char>& bufferIn, std::vector<char>& bufferOut ) +{ + +} + + +void BZIP2::Decompress( const std::vector<char>& bufferIn, std::vector<char>& bufferOut ) +{ + +} + + + +} //end namespace + + diff --git a/src/transform/CBZIP2.cpp b/src/transform/CBZIP2.cpp deleted file mode 100644 index 23d32c495fcb2a5a333dd24c93ba6c35d7405965..0000000000000000000000000000000000000000 --- a/src/transform/CBZIP2.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CBZIP2.cpp - * - * Created on: Oct 19, 2016 - * Author: wfg - */ - - - -#include "transform/CBZIP2.h" - - - -namespace adios -{ - - -CBZIP2::CBZIP2( ): - CTransform( "bzip2" ) -{ } - - -CBZIP2::~CBZIP2( ) -{ } - - - -void CBZIP2::Compress( const std::vector<char>& bufferIn, std::vector<char>& bufferOut ) -{ - -} - - -void CBZIP2::Decompress( const std::vector<char>& bufferIn, std::vector<char>& bufferOut ) -{ - -} - - - -} //end namespace - - diff --git a/src/transform/CSZIP.cpp b/src/transform/CSZIP.cpp deleted file mode 100644 index 874bda6b03e10f7803e2232858b9123fd9470c9f..0000000000000000000000000000000000000000 --- a/src/transform/CSZIP.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * CSZIP.cpp - * - * Created on: Oct 19, 2016 - * Author: wfg - */ - - - -#include "transform/CSZIP.h" - - - -namespace adios -{ - -CSZIP::CSZIP( const unsigned int compressionLevel, CVariableBase& variable ): - CTransform( "szip", compressionLevel, variable ) -{ } - -CSZIP::~CSZIP( ) -{ } - -void CSZIP::Compress( ) const -{ } - -void CSZIP::Compress( ) const -{ } - - - - -} //end namespace diff --git a/src/transform/CZLIB.cpp b/src/transform/CZLIB.cpp deleted file mode 100644 index e9b153e25c76de9cb54859a8e306f802d88824ed..0000000000000000000000000000000000000000 --- a/src/transform/CZLIB.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * CZLIB.cpp - * - * Created on: Oct 19, 2016 - * Author: wfg - */ - - - -#include "transform/CZLIB.h" - - - -namespace adios -{ - -CZLIB::CZLIB( ): - CTransform( "szip" ) -{ } - -CZLIB::~CZLIB( ) -{ } - -void CZLIB::Compress( ) const -{ } - -void CZLIB::Decompress( ) const -{ } - - - - -} //end namespace diff --git a/src/transport/CDataMan.cpp b/src/transport/CDataMan.cpp deleted file mode 100644 index 920ede9f3a3b6b4b895ec51d8eacb0c498447aef..0000000000000000000000000000000000000000 --- a/src/transport/CDataMan.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * CDataMan.cpp Implementation of ./include/transport/CDataMan.h - * - * Created on: Nov 15, 2016 - * Author: wfg - */ - -#include "transport/CDataMan.h" - -//here include any external library headers, we can figure out linking them later - - -namespace adios -{ - - -CDataMan::CDataMan( MPI_Comm mpiComm, const bool debugMode, const std::vector<std::string>& arguments ): - CTransport( "DataMan", mpiComm, debugMode ) -{ - Init( arguments ); -} - - -CDataMan::~CDataMan( ) -{ } - - -void CDataMan::Open( const std::string streamName, const std::string accessMode ) -{ - if( accessMode == "w" || accessMode == "write" ) - { - //here open your socket and assign it to this streamName; - } -} - - -void CDataMan::SetBuffer( std::vector<char>& buffer ) -{ - //empty for now -} - - -void CDataMan::Write( std::vector<char>& buffer ) -{ - //here comes your magic, expect buffer to contain the raw data from the ADIOS.Write variable using memcpy - //for now it's a reference, if later it goes out of scope we can move buffer here -} - - -void CDataMan::Close( ) -{ - //close any hanging resources from your transport -} - -//PRIVATE FUNCTIONS -void CDataMan::Init( const std::vector<std::string>& arguments ) -{ - -} - - -} //end namespace diff --git a/src/transport/CFStream.cpp b/src/transport/FStream.cpp similarity index 89% rename from src/transport/CFStream.cpp rename to src/transport/FStream.cpp index 39f8d985013ca9095df7636422a00078ea254401..8b904b5a01566802c67308cdcf2b0dd64c7ffa71 100644 --- a/src/transport/CFStream.cpp +++ b/src/transport/FStream.cpp @@ -13,25 +13,26 @@ #include <cstring> /// \endcond -#include "transport/CFStream.h" -#include "functions/ADIOSFunctions.h" //CreateDirectory +#include "functions/adiosFunctions.h" //CreateDirectory +#include "transport/FStream.h" + namespace adios { -CFStream::CFStream( MPI_Comm mpiComm, const bool debugMode, const std::vector<std::string>& arguments ): - CTransport( "FStream", mpiComm, debugMode ) +FStream::FStream( MPI_Comm mpiComm, const bool debugMode, const std::vector<std::string>& arguments ): + Transport( "FStream", mpiComm, debugMode ) { //here do something with arguments } -CFStream::~CFStream( ) +FStream::~FStream( ) { } -void CFStream::Open( const std::string streamName, const std::string accessMode ) +void FStream::Open( const std::string streamName, const std::string accessMode ) { const std::string directory( streamName + ".dir" ); //data.bp.dir @@ -61,18 +62,18 @@ void CFStream::Open( const std::string streamName, const std::string accessMode } -void CFStream::SetBuffer( std::vector<char>& buffer ) +void FStream::SetBuffer( std::vector<char>& buffer ) { m_FStream.rdbuf()->pubsetbuf( &buffer[0], buffer.size() ); } -void CFStream::Write( std::vector<char>& buffer ) +void FStream::Write( std::vector<char>& buffer ) { m_FStream.write( &buffer[0], buffer.size() ); } -void CFStream::Close( ) +void FStream::Close( ) { m_FStream.close(); } @@ -143,8 +144,5 @@ void CFStream::Close( ) //} - - - } //end namespace diff --git a/src/transport/CPOSIX.cpp b/src/transport/POSIX.cpp similarity index 73% rename from src/transport/CPOSIX.cpp rename to src/transport/POSIX.cpp index 6569dcd18bffd3c0f4137a44010d51e3bdc0b828..240a83b42f5b681d1f5c4af648acd8f2563cd4a4 100644 --- a/src/transport/CPOSIX.cpp +++ b/src/transport/POSIX.cpp @@ -1,31 +1,32 @@ /* - * CPOSIXMPI.cpp + * POSIXMPI.cpp * * Created on: Oct 6, 2016 * Author: wfg */ + #include <stdio.h> -#include "transport/CPOSIX.h" -#include "functions/ADIOSFunctions.h" // CreateDirectory +#include "transport/POSIX.h" +#include "functions/adiosFunctions.h" // CreateDirectory namespace adios { -CPOSIX::CPOSIX( MPI_Comm mpiComm, const bool debugMode, const std::vector<std::string>& arguments ): - CTransport( "POSIX", mpiComm, debugMode ), +POSIX::POSIX( MPI_Comm mpiComm, const bool debugMode, const std::vector<std::string>& arguments ): + Transport( "POSIX", mpiComm, debugMode ), m_File( NULL ) { } -CPOSIX::~CPOSIX( ) +POSIX::~POSIX( ) { } -void CPOSIX::Open( const std::string streamName, const std::string accessMode ) +void POSIX::Open( const std::string streamName, const std::string accessMode ) { const std::string directory( streamName + ".dir" ); @@ -56,7 +57,7 @@ void CPOSIX::Open( const std::string streamName, const std::string accessMode ) } -void CPOSIX::SetBuffer( std::vector<char>& buffer ) +void POSIX::SetBuffer( std::vector<char>& buffer ) { int status = setvbuf( m_File, &buffer[0], _IOFBF, buffer.size() ); @@ -68,19 +69,20 @@ void CPOSIX::SetBuffer( std::vector<char>& buffer ) } -void CPOSIX::Write( std::vector<char>& buffer ) +void POSIX::Write( std::vector<char>& buffer ) { fwrite( &buffer[0], sizeof(char), buffer.size(), m_File ); } -void CPOSIX::Close( ) +void POSIX::Close( ) { fclose( m_File ); } + //PRIVATE FUNCTIONS -void CPOSIX::Init( const std::vector<std::string>& arguments ) +void POSIX::Init( const std::vector<std::string>& arguments ) { }