diff --git a/BaseLib/RunTime.h b/BaseLib/RunTime.h index 532f8ee8a71fe2b297d38368473ff176d9d8fdc2..2d7111f50f09415ac91793655ed495777468429e 100644 --- a/BaseLib/RunTime.h +++ b/BaseLib/RunTime.h @@ -14,7 +14,7 @@ #pragma once -#ifdef USE_MPI +#ifdef USE_PETSC #include <mpi.h> #else #include <chrono> @@ -22,38 +22,37 @@ namespace BaseLib { - /// Count the running time. class RunTime { - public: - /// Start the timer. - void start() - { -#ifdef USE_MPI - _start_time = MPI_Wtime(); +public: + /// Start the timer. + void start() + { +#ifdef USE_PETSC + _start_time = MPI_Wtime(); #else - _start_time = std::chrono::system_clock::now(); + _start_time = std::chrono::system_clock::now(); #endif - } + } - /// Get the elapsed time in seconds. - double elapsed() const - { -#ifdef USE_MPI - return MPI_Wtime() - _start_time; + /// Get the elapsed time in seconds. + double elapsed() const + { +#ifdef USE_PETSC + return MPI_Wtime() - _start_time; #else - using namespace std::chrono; - return duration<double>(system_clock::now() - _start_time).count(); + using namespace std::chrono; + return duration<double>(system_clock::now() - _start_time).count(); #endif - } + } - private: -#ifdef USE_MPI - double _start_time = std::numeric_limits<double>::quiet_NaN(); +private: +#ifdef USE_PETSC + double _start_time = std::numeric_limits<double>::quiet_NaN(); #else - std::chrono::time_point<std::chrono::system_clock> _start_time; + std::chrono::time_point<std::chrono::system_clock> _start_time; #endif }; -} // end namespace BaseLib +} // end namespace BaseLib diff --git a/CMakeLists.txt b/CMakeLists.txt index 9192a1bf8ae50c054ad7ab5cb1d6ae6f220c0c82..5edeec9c06e9deae09ee1ffc9b437214f53192cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,10 +194,6 @@ if(OGS_USE_MKL) include_directories(SYSTEM ${MKL_INCLUDE_DIR}) endif() -if(OGS_USE_MPI) - add_definitions(-DUSE_MPI) -endif() - # Eigen if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_definitions(-DEIGEN_INITIALIZE_MATRICES_BY_NAN) diff --git a/MeshLib/IO/VtkIO/VtuInterface.cpp b/MeshLib/IO/VtkIO/VtuInterface.cpp index 8c7b2054168d40798df8bac6ad7695fbbe0d875a..0cc6473c5bdc4f045b915b4e56d192a588875e3f 100644 --- a/MeshLib/IO/VtkIO/VtuInterface.cpp +++ b/MeshLib/IO/VtkIO/VtuInterface.cpp @@ -13,20 +13,20 @@ #include "VtuInterface.h" -#include <vtkNew.h> #include <vtkGenericDataObjectReader.h> +#include <vtkNew.h> #include <vtkXMLUnstructuredGridReader.h> #include <vtkXMLUnstructuredGridWriter.h> -#if defined(USE_PETSC) || defined(USE_MPI) +#if defined(USE_PETSC) #include <vtkXMLPUnstructuredGridWriter.h> #endif #include <vtkSmartPointer.h> #include <vtkUnstructuredGrid.h> -#include "BaseLib/Logging.h" - #include <boost/algorithm/string/erase.hpp> +#include "BaseLib/Logging.h" + #ifdef USE_PETSC #include <petsc.h> #endif @@ -40,9 +40,9 @@ namespace MeshLib { namespace IO { - -VtuInterface::VtuInterface(const MeshLib::Mesh* mesh, int dataMode, bool compress) : - _mesh(mesh), _data_mode(dataMode), _use_compressor(compress) +VtuInterface::VtuInterface(const MeshLib::Mesh* mesh, int dataMode, + bool compress) + : _mesh(mesh), _data_mode(dataMode), _use_compressor(compress) { if (_data_mode == vtkXMLWriter::Ascii && compress) { @@ -50,9 +50,10 @@ VtuInterface::VtuInterface(const MeshLib::Mesh* mesh, int dataMode, bool compres } } -MeshLib::Mesh* VtuInterface::readVTUFile(std::string const &file_name) +MeshLib::Mesh* VtuInterface::readVTUFile(std::string const& file_name) { - if (!BaseLib::IsFileExisting(file_name)) { + if (!BaseLib::IsFileExisting(file_name)) + { ERR("File '{:s}' does not exist.", file_name); return nullptr; } @@ -69,8 +70,10 @@ MeshLib::Mesh* VtuInterface::readVTUFile(std::string const &file_name) return nullptr; } - std::string const mesh_name (BaseLib::extractBaseNameWithoutExtension(file_name)); - return MeshLib::VtkMeshConverter::convertUnstructuredGrid(vtkGrid, mesh_name); + std::string const mesh_name( + BaseLib::extractBaseNameWithoutExtension(file_name)); + return MeshLib::VtkMeshConverter::convertUnstructuredGrid(vtkGrid, + mesh_name); } MeshLib::Mesh* VtuInterface::readVTKFile(std::string const& file_name) @@ -161,6 +164,5 @@ int writeVtu(MeshLib::Mesh const& mesh, std::string const& file_name, return 0; } - -} // end namespace IO -} // end namespace MeshLib +} // end namespace IO +} // end namespace MeshLib