22 |
#ifdef USE_NETCDF |
#ifdef USE_NETCDF |
23 |
#include <netcdfcpp.h> |
#include <netcdfcpp.h> |
24 |
#endif |
#endif |
25 |
|
#ifdef PASO_MPI |
26 |
|
#include <mpi.h> |
27 |
|
#endif |
28 |
|
|
29 |
using namespace boost::python; |
using namespace boost::python; |
30 |
|
|
81 |
load(const std::string fileName, |
load(const std::string fileName, |
82 |
const AbstractDomain& domain) |
const AbstractDomain& domain) |
83 |
{ |
{ |
|
#ifdef PASO_MPI |
|
|
throw DataException("Error - load :: not implemented for MPI yet."); |
|
|
#endif |
|
|
|
|
84 |
#ifdef USE_NETCDF |
#ifdef USE_NETCDF |
85 |
NcAtt *type_att, *rank_att, *function_space_type_att; |
NcAtt *type_att, *rank_att, *function_space_type_att; |
86 |
// netCDF error handler |
// netCDF error handler |
87 |
NcError err(NcError::silent_nonfatal); |
NcError err(NcError::silent_nonfatal); |
88 |
|
int mpi_iam=0, mpi_num=1; |
89 |
// Create the file. |
// Create the file. |
90 |
NcFile dataFile(fileName.c_str(), NcFile::ReadOnly); |
#ifdef PASO_MPI |
91 |
|
MPI_Comm_rank(MPI_COMM_WORLD, &mpi_iam); |
92 |
|
MPI_Comm_size(MPI_COMM_WORLD, &mpi_num); |
93 |
|
#endif |
94 |
|
char *newFileName = Escript_MPI_appendRankToFileName(fileName.c_str(), mpi_num, mpi_iam); |
95 |
|
NcFile dataFile(newFileName, NcFile::ReadOnly); |
96 |
if (!dataFile.is_valid()) |
if (!dataFile.is_valid()) |
97 |
throw DataException("Error - load:: opening of netCDF file for input failed."); |
throw DataException("Error - load:: opening of netCDF file for input failed."); |
98 |
/* recover function space */ |
/* recover function space */ |