Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102755758
exception.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Feb 23, 21:05
Size
1 KB
Mime Type
text/x-c++
Expires
Tue, Feb 25, 21:05 (2 d)
Engine
blob
Format
Raw Data
Handle
24416960
Attached To
rPHPCSHALLOWWATER PHPC project - Shallow water simulation 2019
exception.h
View Options
//
// Created by Joachim Koerfer on 08.05.2019.
//
#ifndef EXCEPTION_H
#define EXCEPTION_H
#include <mpi.h>
#include <string>
#include <iostream>
#include <exception>
class FileOpenError: public std::exception {
private:
std::string msg_;
public:
FileOpenError(int MPI_Error, std::string file_name) {
char error_string[BUFSIZ];
int len_error, error_class;
MPI_Error_class(MPI_Error, &error_class);
MPI_Error_string(MPI_Error, error_string, &len_error);
msg_ = "Error when reading file '" + file_name + "'\n" + error_string + "\n";
}
virtual const char* what() const throw()
{
return msg_.c_str();
}
};
class FileWriteError: public std::exception {
private:
std::string msg_;
public:
FileWriteError(int MPI_Error, std::string file_name) {
char error_string[BUFSIZ];
int len_error, error_class;
MPI_Error_class(MPI_Error, &error_class);
MPI_Error_string(MPI_Error, error_string, &len_error);
msg_ = "Error when writing file '" + file_name + "'\n" + error_string + "\n";
}
virtual const char* what() const throw()
{
return msg_.c_str();
}
};
#endif
Event Timeline
Log In to Comment