From ee06e0440afe500bc21b9334fdb0fa8f89fa4ed4 Mon Sep 17 00:00:00 2001 From: "hanouvit@vz" <vithanousek@seznam.cz> Date: Thu, 8 Mar 2018 17:31:25 +0100 Subject: [PATCH] Missing file. --- src/TNL/Solvers/CommunicatorTypeResolver.h | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/TNL/Solvers/CommunicatorTypeResolver.h diff --git a/src/TNL/Solvers/CommunicatorTypeResolver.h b/src/TNL/Solvers/CommunicatorTypeResolver.h new file mode 100644 index 0000000000..eb7a5c51cf --- /dev/null +++ b/src/TNL/Solvers/CommunicatorTypeResolver.h @@ -0,0 +1,49 @@ +/*************************************************************************** + CommunicatorTypeResolver.h + ------------------- + begin : Feb 12, 2018 + copyright : (C) 2018 by Tomas Oberhuber + email : tomas.oberhuber@fjfi.cvut.cz + ***************************************************************************/ + +/* See Copyright Notice in tnl/Copyright */ + +#pragma once + +#include <TNL/Config/ParameterContainer.h> + +#include <TNL/Solvers/SolverStarter.h> + +#include <TNL/Communicators/NoDistrCommunicator.h> +#include <TNL/Communicators/MpiCommunicator.h> + +namespace TNL { +namespace Solvers { + +template< template< typename Real, typename Device, typename Index, typename MeshType, typename ConfigTag, typename SolverStarter, typename CommunicatorType > class ProblemSetter, + typename Real, + typename Device, + typename Index, + typename MeshType, + typename ConfigTag > +class CommunicatorTypeResolver +{ + public: + static bool run( const Config::ParameterContainer& parameters ) + { +#ifdef HAVE_MPI + if(Communicators::MpiCommunicator::isDistributed()) + { + bool ret=ProblemSetter< Real, Device, Index, MeshType, ConfigTag, SolverStarter< ConfigTag >, Communicators::MpiCommunicator >::run( parameters ); + Communicators::MpiCommunicator::Finalize(); + return ret; + } + Communicators::MpiCommunicator::Finalize(); +#endif + return ProblemSetter< Real, Device, Index, MeshType, ConfigTag, SolverStarter< ConfigTag >, Communicators::NoDistrCommunicator >::run( parameters ); + + } +}; + +} // namespace Solvers +} // namespace TNL -- GitLab