#endif
}
+
inline
void
mpi_initlog(const char* filename, bool console=false)
{
+#ifdef DEAL_II_WITH_MPI
unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
if (myid == 0)
{
//TODO: Remove this line and replace by test_mode()
deallog.threshold_float(1.e-8);
}
+#else
+ // can't use this function if not using MPI
+ Assert (false, ExcInternalError());
+#endif
}
-
+
/* helper class to include the deallogs of all processors
MPILogInitAll(const char* filename, bool console=false)
: m_filename(filename)
{
+#ifdef DEAL_II_WITH_MPI
unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
deallogname = output_file_for_mpi(JobIdentifier::base_name(filename));
if (myid != 0)
//TODO: Remove this line and replace by test_mode()
deallog.threshold_float(1.e-8);
deallog.push(Utilities::int_to_string(myid));
+#else
+ // can't use this function if not using MPI
+ Assert (false, ExcInternalError());
+#endif
}
~MPILogInitAll()
{
+#ifdef DEAL_II_WITH_MPI
unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
unsigned int nproc = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD);
-
+
deallog.pop();
if (myid!=0)
{
deallog.detach();
deallogfile.close();
}
-
+
MPI_Barrier(MPI_COMM_WORLD);
if (myid==0)
- {
+ {
for (unsigned int i=1;i<nproc;++i)
{
std::string filename = output_file_for_mpi(JobIdentifier::base_name(m_filename.c_str()))
+ Utilities::int_to_string(i);
std::ifstream in(filename.c_str());
Assert (in, ExcIO());
-
+
while (in)
{
std::string s;
std::getline(in, s);
deallog.get_file_stream() << s << "\n";
}
- in.close();
+ in.close();
std::remove (filename.c_str());
}
}
+#else
+ // can't use this function if not using MPI
+ Assert (false, ExcInternalError());
+#endif
}
private:
std::string m_filename;
-
+
};