Skip to content

Commit

Permalink
ran clang formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabh-s-sawant committed Aug 17, 2024
1 parent 0bc0d1c commit 0a93c74
Show file tree
Hide file tree
Showing 86 changed files with 12,481 additions and 11,517 deletions.
8 changes: 8 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
BasedOnStyle: Google # You can use LLVM, Google, Mozilla, or any other base style
IndentWidth: 4 # Number of spaces per indentation level
UseTab: Never # Do not use tabs, only spaces
TabWidth: 4 # Number of spaces per tab
ColumnLimit: 80
BreakBeforeBraces: Allman
PenaltyBreakBeforeFirstCallParameter: 100
140 changes: 77 additions & 63 deletions Source/Code.H
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
#ifndef CODE_H_
#define CODE_H_

#include "Input/GeometryProperties/GeometryProperties_fwd.H"
#include "Input/BoundaryConditions/BoundaryConditions_fwd.H"
#include "Input/GeometryProperties/GeometryProperties_fwd.H"
#include "Input/MacroscopicProperties/MacroscopicProperties_fwd.H"
#ifdef USE_TRANSPORT
#include "Solver/Transport/Transport_fwd.H"
#endif

#include "Solver/Electrostatics/MLMG_fwd.H"
#include "PostProcessor/PostProcessor_fwd.H"
#include <AMReX.H>

#include "Diagnostics/Diagnostics_fwd.H"
#include "Output/Output_fwd.H"
#include "PostProcessor/PostProcessor_fwd.H"
#include "Solver/Electrostatics/MLMG_fwd.H"
#include "Utils/SelectWarpXUtils/WarnManager_fwd.H"


#include <AMReX.H>
//#include <AMReX_AmrCore.H>
//#include <AMReX_Array.H>
//#include <AMReX_Config.H>
Expand All @@ -37,16 +36,14 @@
//#include <string>
//#include <vector>


//#include <AMReX_AmrCoreFwd.H>


enum class WarnPriority
{
/** Low priority warning:
* essentially an informative message
*/
low,
low,
/** Medium priority warning:
* a bug or a performance issue may affect the simulation
*/
Expand All @@ -60,87 +57,105 @@ enum class WarnPriority

class c_Code
{
public:
c_Code(); // constructor
~c_Code(); // destructor

public:

c_Code (); //constructor
~c_Code (); //destructor

/********************* FUNCTIONS/PARAMETERS TAKEN FROM WARPX
* ****************************/

/********************* FUNCTIONS/PARAMETERS TAKEN FROM WARPX ****************************/

static c_Code& GetInstance ();
static void ResetInstance ();
static c_Code &GetInstance();
static void ResetInstance();

/**
* \brief This function is borrowed from WarpX. It records a warning message.
* RecordWarning is thread safe: it can be used within OpenMP parallel loops.
* \brief This function is borrowed from WarpX. It records a warning
* message. RecordWarning is thread safe: it can be used within OpenMP
* parallel loops.
*
* @param[in] topic a string to identify the topic of the warning
* @param[in] topic a string to identify the topic of the warning
* (e.g., "parallelization", "pbc", "particles"...)
* @param[in] text the text of the warning message
* @param[in] priority priority of the warning message ("medium" by default)
*/
void RecordWarning(
std::string topic,
std::string text,
WarnPriority priority = WarnPriority::medium);
void RecordWarning(std::string topic, std::string text,
WarnPriority priority = WarnPriority::medium);

/**
* \brief This function prints all the warning messages collected on the present MPI rank
* (i.e., this is not a collective call). This function is mainly intended for debug purposes.
* \brief This function prints all the warning messages collected on the
* present MPI rank (i.e., this is not a collective call). This function is
* mainly intended for debug purposes.
*
* @param[in] when a string to mark when the warnings are printed out (it appears in the warning list)
* @param[in] when a string to mark when the warnings are printed out (it
* appears in the warning list)
*/
void PrintLocalWarnings(const std::string& when);
void PrintLocalWarnings(const std::string &when);

/**
* \brief This function prints all the warning messages collected by all the MPI ranks
* (i.e., this is a collective call). Only the I/O rank prints the message.
* \brief This function prints all the warning messages collected by all the
* MPI ranks (i.e., this is a collective call). Only the I/O rank prints the
* message.
*
* @param[in] when a string to mark when the warnings are printed out (it appears in the warning list)
* @param[in] when a string to mark when the warnings are printed out (it
* appears in the warning list)
*/
void PrintGlobalWarnings(const std::string& when);


std::unique_ptr<Utils::WarnManager> m_p_warn_manager; //Warning manager: used to record and print error msgs.
bool m_always_warn_immediately = false; //flag to emit control emitting warning as soon as it is recorded
void PrintGlobalWarnings(const std::string &when);

/****************************************************************************************/
std::unique_ptr<Utils::WarnManager>
m_p_warn_manager; // Warning manager: used to record and print error
// msgs.
bool m_always_warn_immediately =
false; // flag to emit control emitting
// warning as soon as it is recorded

/****************************************************************************************/

void ReadData ();
void InitData ();
void Solve_PostProcess_Output ();
void ReadData();
void InitData();
void Solve_PostProcess_Output();
amrex::Real Solve_OnlyElectrostatics();
void Cleanup ();
void Cleanup();

void EstimateOfRequiredMemory();

static bool do_device_synchronize;

c_GeometryProperties& get_GeometryProperties () { return *m_pGeometryProperties;}
c_BoundaryConditions& get_BoundaryConditions () { return *m_pBoundaryConditions;}
c_MacroscopicProperties& get_MacroscopicProperties () { return *m_pMacroscopicProperties;}
#ifdef USE_TRANSPORT
c_TransportSolver& get_TransportSolver () { return *m_pTransportSolver;}
#endif
c_MLMGSolver& get_MLMGSolver () { return *m_pMLMGSolver;}
c_PostProcessor& get_PostProcessor () { return *m_pPostProcessor;}
c_Diagnostics& get_Diagnostics () { return *m_pDiagnostics;}
c_Output& get_Output () { return *m_pOutput;}

amrex::Real get_time() { return m_time_instant;}
amrex::Real get_step() { return static_cast<int>(m_time_instant/m_timestep);}
c_GeometryProperties &get_GeometryProperties()
{
return *m_pGeometryProperties;
}
c_BoundaryConditions &get_BoundaryConditions()
{
return *m_pBoundaryConditions;
}
c_MacroscopicProperties &get_MacroscopicProperties()
{
return *m_pMacroscopicProperties;
}
#ifdef USE_TRANSPORT
c_TransportSolver &get_TransportSolver() { return *m_pTransportSolver; }
#endif
c_MLMGSolver &get_MLMGSolver() { return *m_pMLMGSolver; }
c_PostProcessor &get_PostProcessor() { return *m_pPostProcessor; }
c_Diagnostics &get_Diagnostics() { return *m_pDiagnostics; }
c_Output &get_Output() { return *m_pOutput; }

amrex::Real get_time() { return m_time_instant; }
amrex::Real get_step()
{
return static_cast<int>(m_time_instant / m_timestep);
}
int use_diagnostics;
int use_transport;
int use_electrostatic;

private:
amrex::Real set_time(int n)
{ m_time_instant = n*m_timestep; return m_time_instant;}

static c_Code* m_instance;
private:
amrex::Real set_time(int n)
{
m_time_instant = n * m_timestep;
return m_time_instant;
}

static c_Code *m_instance;

amrex::Real m_time_instant = 0.;
amrex::Real m_timestep = 1.;
Expand All @@ -154,11 +169,10 @@ private:
std::unique_ptr<c_MLMGSolver> m_pMLMGSolver;
std::unique_ptr<c_PostProcessor> m_pPostProcessor;
std::unique_ptr<c_Output> m_pOutput;
#ifdef USE_TRANSPORT
#ifdef USE_TRANSPORT
std::unique_ptr<c_TransportSolver> m_pTransportSolver;
#endif
#endif

std::unique_ptr<c_Diagnostics> m_pDiagnostics;

};
#endif
Loading

0 comments on commit 0a93c74

Please sign in to comment.