SERiF 0.0.1a
3+1D Stellar Structure and Evolution
Loading...
Searching...
No Matches
probe.h
Go to the documentation of this file.
1/* ***********************************************************************
2//
3// Copyright (C) 2025 -- The 4D-STAR Collaboration
4// File Author: Emily Boudreaux
5// Last Modified: April 03, 2025
6//
7// 4DSSE is free software; you can use it and/or modify
8// it under the terms and restrictions the GNU General Library Public
9// License version 3 (GPLv3) as published by the Free Software Foundation.
10//
11// 4DSSE is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14// See the GNU Library General Public License for more details.
15//
16// You should have received a copy of the GNU Library General Public License
17// along with this software; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// *********************************************************************** */
21//=== Probe.h ===
22#pragma once
23
24#include <string>
25#include <map>
26#include <vector>
27#include <utility>
28
29#include "mfem.hpp"
30#include "quill/Logger.h"
31
35namespace serif::probe {
39 void pause();
40
45 void wait(int seconds);
46
54 void glVisView(mfem::GridFunction& u, mfem::Mesh& mesh,
55 const std::string& windowTitle = "grid function", const std::string& keyset="");
56
64 void glVisView(mfem::Vector &vec, mfem::FiniteElementSpace &fes,
65 const std::string &windowTitle = "vector", const std::string& keyset="");
66
67 double getMeshRadius(mfem::Mesh& mesh);
68
69 std::pair<std::vector<double>, std::vector<double>> getRaySolution(mfem::GridFunction& u, mfem::Mesh& mesh,
70 const std::vector<double>& rayDirection, int numSamples, std::string filename="");
71
72 std::pair<std::vector<double>, std::vector<double>> getRaySolution(mfem::Vector &vec, mfem::FiniteElementSpace &fes,
73 const std::vector<double>& rayDirection, int numSamples, std::string filename="");
74
75
79 class LogManager {
80 private:
84 LogManager();
85
90
91 // Map to store pointers to quill loggers (raw pointers as quill deals with its own memory managment in a seperated, detatched, thread)
92 std::map<std::string, quill::Logger*> loggerMap;
93
94 // Prevent copying and assignment (Rule of Zero)
95 LogManager(const LogManager&) = delete;
96 LogManager& operator=(const LogManager&) = delete;
97
98 public:
104 static LogManager instance;
105 return instance;
106 }
107
113 quill::Logger* getLogger(const std::string& loggerName);
114
119 std::vector<std::string> getLoggerNames();
120
125 std::vector<quill::Logger*> getLoggers();
126
133 quill::Logger* newFileLogger(const std::string& filename,
134 const std::string& loggerName);
135 };
136
137} // namespace Probe
LogManager()
Private constructor for singleton pattern.
Definition probe.cpp:206
quill::Logger * getLogger(const std::string &loggerName)
Get a logger by name.
Definition probe.cpp:219
LogManager & operator=(const LogManager &)=delete
std::vector< quill::Logger * > getLoggers()
Get all loggers.
Definition probe.cpp:236
quill::Logger * newFileLogger(const std::string &filename, const std::string &loggerName)
Create a new file logger.
Definition probe.cpp:245
static LogManager & getInstance()
Get the singleton instance of LogManager.
Definition probe.h:103
std::map< std::string, quill::Logger * > loggerMap
Definition probe.h:92
std::vector< std::string > getLoggerNames()
Get the names of all loggers.
Definition probe.cpp:227
LogManager(const LogManager &)=delete
The Probe namespace contains utility functions for debugging and logging.
Definition probe.cpp:45
double getMeshRadius(mfem::Mesh &mesh)
Definition probe.cpp:91
void wait(int seconds)
Wait for a specified number of seconds.
Definition probe.cpp:53
void glVisView(mfem::GridFunction &u, mfem::Mesh &mesh, const std::string &windowTitle, const std::string &keyset)
Visualize a solution using GLVis.
Definition probe.cpp:57
std::pair< std::vector< double >, std::vector< double > > getRaySolution(mfem::GridFunction &u, mfem::Mesh &mesh, const std::vector< double > &rayDirection, int numSamples, std::string filename)
Definition probe.cpp:108
void pause()
Pause the execution and wait for user input.
Definition probe.cpp:47