Skip to content
Snippets Groups Projects
Commit cc4957c0 authored by wfg's avatar wfg
Browse files

Updating ADIOS.cpp for MPI testing

parent eab9abec
No related branches found
No related tags found
1 merge request!8Integrate groupless
/* /*
* CADIOS.cpp * ADIOS.cpp
* *
* Created on: Sep 29, 2016 * Created on: Sep 29, 2016
* Author: William F Godoy * Author: William F Godoy
...@@ -7,56 +7,70 @@ ...@@ -7,56 +7,70 @@
*/ */
#include <fstream> #include <fstream>
#include <iostream>
#include "include/CADIOS.h" #include "ADIOS.h"
namespace adios namespace adios
{ {
//here assign default values of non-primitives //here assign default values of non-primitives
CADIOS::CADIOS( ) ADIOS::ADIOS( )
{ } { }
CADIOS::CADIOS( const std::string xmlConfigFile ): ADIOS::ADIOS( const std::string xmlConfigFile ):
m_XMLConfigFile( xmlConfigFile ) m_XMLConfigFile{ xmlConfigFile }
{ } { }
CADIOS::CADIOS( const std::string xmlConfigFile, const MPI_Comm& mpiComm ): //#ifdef USE_MPI
m_XMLConfigFile( xmlConfigFile ), ADIOS::ADIOS( const std::string xmlConfigFile, const MPI_Comm& mpiComm ):
m_IsUsingMPI( true ), m_XMLConfigFile{ xmlConfigFile },
m_MPIComm( mpiComm ) m_IsUsingMPI{ true },
m_MPIComm{ mpiComm }
{ } { }
//#endif
void CADIOS::Init( ) void ADIOS::Init( )
{ {
if( m_IsUsingMPI == false ) if( m_IsUsingMPI == false && m_XMLConfigFile.empty() == false )
{ {
InitSerial( ); InitNoMPI( );
} }
else else
{ {
//#ifdef USE_MPI
InitMPI( ); InitMPI( );
//#endif
} }
} }
void CADIOS::InitSerial( ) void ADIOS::InitNoMPI( )
{ {
ReadXMLConfigFile( ); ReadXMLConfigFile( );
} }
//#ifdef USE_MPI
void CADIOS::InitMPI( ) void ADIOS::InitMPI( )
{ {
//here just say hello from MPI processes
int size;
MPI_Comm_size( *m_MPIComm, &size );
int rank;
MPI_Comm_rank( *m_MPIComm, &rank );
std::cout << " Hello World from processor " << rank << "/" << size << "\n";
} }
//#endif
void CADIOS::ReadXMLConfigFile( ) void ADIOS::ReadXMLConfigFile( )
{ {
std::ifstream xmlConfigStream( m_XMLConfigFile ); std::ifstream xmlConfigStream( m_XMLConfigFile );
...@@ -66,21 +80,16 @@ void CADIOS::ReadXMLConfigFile( ) ...@@ -66,21 +80,16 @@ void CADIOS::ReadXMLConfigFile( )
"Check permissions or file existence\n"); "Check permissions or file existence\n");
throw std::ios_base::failure( errorMessage ); throw std::ios_base::failure( errorMessage );
} }
//here fill SMetadata...
xmlConfigStream.close();
} }
} //end namespace
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment