MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
globals.cpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12
13#include "../config/config.hpp"
14#include "globals.hpp"
15#include <iostream>
16#include <sstream>
17#include <iomanip>
18
19namespace mfem
20{
21
22OutStream out(std::cout);
23OutStream err(std::cerr);
24
25namespace internal
26{
27bool mfem_out_initialized = false;
28bool mfem_err_initialized = false;
29}
30
32{
33 if (this == &mfem::out)
34 {
35 internal::mfem_out_initialized = true;
36 }
37 else if (this == &mfem::err)
38 {
39 internal::mfem_err_initialized = true;
40 }
41}
42
43std::string MakeParFilename(const std::string &prefix, const int myid,
44 const std::string suffix, const int width)
45{
46 std::stringstream fname;
47 fname << prefix << std::setw(width) << std::setfill('0') << myid << suffix;
48 return fname.str();
49}
50
51#ifdef MFEM_COUNT_FLOPS
52namespace internal
53{
54long long flop_count;
55}
56#endif
57
58#ifdef MFEM_USE_MPI
59
60MPI_Comm MFEM_COMM_WORLD = MPI_COMM_WORLD;
61
63{
64 return MFEM_COMM_WORLD;
65}
66
67void SetGlobalMPI_Comm(MPI_Comm comm)
68{
69 MFEM_COMM_WORLD = comm;
70}
71
72#endif
73
74}
std::string MakeParFilename(const std::string &prefix, const int myid, const std::string suffix, const int width)
Construct a string of the form "<prefix><myid><suffix>" where the integer myid is padded with leading...
Definition globals.cpp:43
OutStream out(std::cout)
Global stream used by the library for standard output. Initially it uses the same std::streambuf as s...
Definition globals.hpp:66
MPI_Comm MFEM_COMM_WORLD
Definition globals.cpp:60
OutStream err(std::cerr)
Global stream used by the library for standard error output. Initially it uses the same std::streambu...
Definition globals.hpp:71
void SetGlobalMPI_Comm(MPI_Comm comm)
Set MFEM's "global" MPI communicator.
Definition globals.cpp:67
MPI_Comm GetGlobalMPI_Comm()
Get MFEM's "global" MPI communicator.
Definition globals.cpp:62