Skip to content

Commit

Permalink
Rename SimulationMaster to Controller
Browse files Browse the repository at this point in the history
  • Loading branch information
rupertnash committed Jun 6, 2024
1 parent b4c1ba7 commit 9d1cece
Show file tree
Hide file tree
Showing 35 changed files with 171 additions and 1,685 deletions.
2 changes: 1 addition & 1 deletion Code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ if (HEMELB_USE_DEBUGGER)
set(CMAKE_BUILD_TYPE Debug)
endif()

add_library(hemelb_sim OBJECT SimulationMaster.cc)
add_library(hemelb_sim OBJECT SimulationController.cc)
list(APPEND heme_libraries hemelb_sim)
add_executable(${HEMELB_EXECUTABLE} main.cc)
codesign(${HEMELB_EXECUTABLE})
Expand Down
1,417 changes: 0 additions & 1,417 deletions Code/Doxyfile

This file was deleted.

21 changes: 0 additions & 21 deletions Code/README

This file was deleted.

34 changes: 17 additions & 17 deletions Code/SimulationMaster.cc → Code/SimulationController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// file AUTHORS. This software is provided under the terms of the
// license in the file LICENSE.

#include "SimulationMaster.h"
#include "SimulationController.h"

#include <map>
#include <limits>
Expand Down Expand Up @@ -32,23 +32,23 @@
namespace hemelb
{
/**
* Constructor for the SimulationMaster class
* Constructor for the SimulationController class
*
* Initialises member variables including the network topology
* object.
*/
SimulationMaster::SimulationMaster(const net::IOCommunicator& ioComm) :
SimulationController::SimulationController(const net::IOCommunicator& ioComm) :
build_info(), ioComms(ioComm.Duplicate()), communicationNet(ioComms)
{
}

/// Destructor for the SimulationMaster class.
SimulationMaster::~SimulationMaster() = default;
/// Destructor for the SimulationController class.
SimulationController::~SimulationController() = default;

/**
* Returns the number of processors involved in the simulation.
*/
int SimulationMaster::GetProcessorCount()
int SimulationController::GetProcessorCount()
{
return ioComms.Size();
}
Expand All @@ -57,17 +57,17 @@ namespace hemelb
* Initialises various elements of the simulation if necessary:
* domain decomposition, LBM and visualisation.
*/
void SimulationMaster::Initialise()
void SimulationController::Initialise()
{

}

void SimulationMaster::HandleActors()
void SimulationController::HandleActors()
{
stepManager->CallActions();
}

void SimulationMaster::OnUnstableSimulation()
void SimulationController::OnUnstableSimulation()
{
LogStabilityReport();
log::Logger::Log<log::Warning, log::Singleton>("Aborting: time step length: %f\n",
Expand All @@ -79,7 +79,7 @@ namespace hemelb
/**
* Begin the simulation.
*/
void SimulationMaster::RunSimulation()
void SimulationController::RunSimulation()
{
log::Logger::Log<log::Info, log::Singleton>("Beginning to run simulation.");
timings.simulation().Start();
Expand Down Expand Up @@ -108,7 +108,7 @@ namespace hemelb
Finalise();
}

void SimulationMaster::Finalise()
void SimulationController::Finalise()
{
timings.total().Stop();
timings.Reduce(ioComms);
Expand All @@ -126,7 +126,7 @@ namespace hemelb
log::Logger::Log<log::Info, log::Singleton>("Finish running simulation.");
}

void SimulationMaster::DoTimeStep()
void SimulationController::DoTimeStep()
{
log::Logger::Log<log::Debug, log::OnePerCore>("Current LB time: %e",
simulationState->GetTime());
Expand Down Expand Up @@ -179,7 +179,7 @@ namespace hemelb
simulationState->Increment();
}

void SimulationMaster::RecalculatePropertyRequirements()
void SimulationController::RecalculatePropertyRequirements()
{
// Get the property cache & reset its list of properties to get.
lb::MacroscopicPropertyCache& propertyCache = latticeBoltzmannModel->GetPropertyCache();
Expand All @@ -202,7 +202,7 @@ namespace hemelb
/**
* Called on error to abort the simulation and pull-down the MPI environment.
*/
void SimulationMaster::Abort()
void SimulationController::Abort()
{
// This gives us something to work from when we have an error - we get the rank
// that calls abort, and we get a stack-trace from the exception having been thrown.
Expand All @@ -212,7 +212,7 @@ namespace hemelb
exit(1);
}

void SimulationMaster::LogStabilityReport()
void SimulationController::LogStabilityReport()
{
if (incompressibilityChecker && incompressibilityChecker->AreDensitiesAvailable())
{
Expand All @@ -232,12 +232,12 @@ namespace hemelb
}
}

const util::UnitConverter& SimulationMaster::GetUnitConverter() const
const util::UnitConverter& SimulationController::GetUnitConverter() const
{
return *unitConverter;
}

configuration::SimConfig SimulationMaster::ToConfig() const {
configuration::SimConfig SimulationController::ToConfig() const {
using namespace configuration;
SimConfig ans = simConfig;
if (simConfig.HasColloidSection())
Expand Down
14 changes: 7 additions & 7 deletions Code/SimulationMaster.h → Code/SimulationController.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// file AUTHORS. This software is provided under the terms of the
// license in the file LICENSE.

#ifndef HEMELB_SIMULATIONMASTER_H
#define HEMELB_SIMULATIONMASTER_H
#ifndef HEMELB_SIMULATIONCONTROLLER_H
#define HEMELB_SIMULATIONCONTROLLER_H
#include <memory>

#include "lb/Lattices.h"
Expand Down Expand Up @@ -32,7 +32,7 @@ namespace hemelb
namespace extraction { class PropertyActor; }
namespace io { class Checkpointer; }

class SimulationMaster
class SimulationController
{
public:
friend class configuration::SimBuilder;
Expand All @@ -47,7 +47,7 @@ namespace hemelb

std::shared_ptr<lb::BoundaryValues> inletValues;
std::shared_ptr<lb::BoundaryValues> outletValues;
/* The next quantities are protected because they are used by MultiscaleSimulationMaster */
/* The next quantities are protected because they are used by MultiscaleSimulationController */
std::shared_ptr<geometry::Domain> domainData;
std::shared_ptr<geometry::FieldData> fieldData;
std::shared_ptr<lb::LBMBase> latticeBoltzmannModel;
Expand Down Expand Up @@ -77,9 +77,9 @@ namespace hemelb
std::shared_ptr<net::phased::StepManager> stepManager;
std::shared_ptr<net::phased::NetConcern> netConcern;

SimulationMaster(const net::IOCommunicator& ioComm);
SimulationController(const net::IOCommunicator& ioComm);
public:
virtual ~SimulationMaster();
virtual ~SimulationController();

void Abort();

Expand Down Expand Up @@ -142,4 +142,4 @@ namespace hemelb
};
}

#endif /* HEMELB_SIMULATIONMASTER_H */
#endif /* HEMELB_SIMULATIONCONTROLLER_H */
2 changes: 1 addition & 1 deletion Code/colloids/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# the HemeLB team and/or their institutions, as detailed in the
# file AUTHORS. This software is provided under the terms of the
# license in the file LICENSE.
message(FATAL_ERROR "The colloids module is unmaintained")
message(FATAL_ERROR "The colloids module is unmaintained - see README")
add_library(hemelb_colloids OBJECT
BoundaryConditions.cc
BodyForces.cc
Expand Down
2 changes: 1 addition & 1 deletion Code/colloids/ColloidController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace hemelb
delete particleSet;
}

// constructor - called by SimulationMaster::Initialise()
// constructor - called by SimulationController::Initialise()
ColloidController::ColloidController(const geometry::Domain& latDatLBM,
const lb::SimulationState& simulationState,
const geometry::GmyReadResult& gmyResult,
Expand Down
5 changes: 5 additions & 0 deletions Code/colloids/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Simulation of subgrid colloidal particles

This module was never fully commissioned and is now defunct.

We keep it in the tree as it may be possible to bring it into operation in the future, but it is not built or tested in CI.
16 changes: 8 additions & 8 deletions Code/configuration/SimBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef HEMELB_CONFIGURATION_SIMBUILDER_H
#define HEMELB_CONFIGURATION_SIMBUILDER_H

#include "SimulationMaster.h"
#include "SimulationController.h"
#include "configuration/SimConfig.h"
#include "extraction/LbDataSourceIterator.h"
#include "extraction/PropertyActor.h"
Expand Down Expand Up @@ -55,11 +55,11 @@ namespace hemelb::configuration {

public:
template <typename TraitsT>
static std::unique_ptr<SimulationMaster> CreateSim(
static std::unique_ptr<SimulationController> CreateSim(
CommandLine const& options,
net::IOCommunicator const& ioComms
) {
auto ans = std::unique_ptr<SimulationMaster>(new SimulationMaster(ioComms));
auto ans = std::unique_ptr<SimulationController>(new SimulationController(ioComms));
// Start the main timer!
ans->timings.total().Start();

Expand Down Expand Up @@ -90,9 +90,9 @@ namespace hemelb::configuration {
return unit_converter->template ConvertToLatticeUnits(units, val);
}

// Fully build the T = SimulationMaster<Traits> from the configuration.
// Fully build the T = SimulationController<Traits> from the configuration.
template <typename TRAITS = hemelb::Traits<>>
void build(SimulationMaster& control) const;
void build(SimulationController& control) const;

// The below could probably be protected/private, but handy for testing.
[[nodiscard]] std::shared_ptr<lb::SimulationState> BuildSimulationState() const;
Expand All @@ -117,7 +117,7 @@ namespace hemelb::configuration {

[[nodiscard]] std::shared_ptr<net::IteratedAction> BuildColloidController() const;
template <typename traitsType>
[[nodiscard]] std::shared_ptr<net::IteratedAction> BuildCellController(SimulationMaster const& control, reporting::Timers& timings) const;
[[nodiscard]] std::shared_ptr<net::IteratedAction> BuildCellController(SimulationController const& control, reporting::Timers& timings) const;
[[nodiscard]] lb::InitialCondition BuildInitialCondition() const;
[[nodiscard]] std::shared_ptr<extraction::PropertyActor> BuildPropertyExtraction(
std::filesystem::path const& xtr_path,
Expand All @@ -143,7 +143,7 @@ namespace hemelb::configuration {


template <typename traitsType>
void SimBuilder::build(SimulationMaster& control) const {
void SimBuilder::build(SimulationController& control) const {
using LatticeType = typename traitsType::Lattice;

auto& timings = control.timings;
Expand Down Expand Up @@ -321,7 +321,7 @@ namespace hemelb::configuration {
#endif

template <typename traitsType>
[[nodiscard]] std::shared_ptr<net::IteratedAction> SimBuilder::BuildCellController(SimulationMaster const& control, reporting::Timers& timings) const {
[[nodiscard]] std::shared_ptr<net::IteratedAction> SimBuilder::BuildCellController(SimulationController const& control, reporting::Timers& timings) const {
if (config.HasRBCSection()) {
#ifdef HEMELB_BUILD_RBC
auto ccb = redblood::CellControllerBuilder(unit_converter);
Expand Down
1 change: 0 additions & 1 deletion Code/lb/iolets/InOutLet.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ namespace hemelb::lb
}
/***
* Carry out communication necessary
* @param isIoProcess Is the process the master process?
*/
virtual void DoComms(const BoundaryCommunicator& bcComms, const LatticeTimeStep timeStep);

Expand Down
4 changes: 2 additions & 2 deletions Code/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ int main(int argc, char *argv[])
debug::Init(options.GetDebug(), argv[0], commWorld);

// Prepare main simulation object...
auto master = configuration::SimBuilder::CreateSim<Traits<>>(options, hemelbCommunicator);
auto controller = configuration::SimBuilder::CreateSim<Traits<>>(options, hemelbCommunicator);

// ..and run it.
master->RunSimulation();
controller->RunSimulation();
}

// Interpose this catch to print usage before propagating the error.
Expand Down
8 changes: 4 additions & 4 deletions Code/mainMultiscale.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include "configuration/CommandLine.h"
#include "debug.h"
#include "multiscale/MultiscaleSimulationMaster.h"
#include "multiscale/MultiscaleSimulationController.h"
#include "multiscale/mpwide/MPWideIntercommunicator.h"

int main(int argc, char *argv[])
Expand Down Expand Up @@ -55,13 +55,13 @@ int main(int argc, char *argv[])
mpwideConfigDir.append("MPWSettings.cfg"));

//TODO: Add an IntercommunicatorImplementation?
hemelb::log::Logger::Log<hemelb::log::Info, hemelb::log::OnePerCore>("Constructing MultiscaleSimulationMaster()");
hemelb::multiscale::MultiscaleSimulationMaster<hemelb::multiscale::MPWideIntercommunicator> lMaster(options,
hemelb::log::Logger::Log<hemelb::log::Info, hemelb::log::OnePerCore>("Constructing MultiscaleSimulationController()");
hemelb::multiscale::MultiscaleSimulationController<hemelb::multiscale::MPWideIntercommunicator> lController(options,
hemelbCommunicator,
intercomms);

hemelb::log::Logger::Log<hemelb::log::Info, hemelb::log::OnePerCore>("Runing simulation()");
lMaster.RunSimulation();
lController.RunSimulation();
}
// Interpose this catch to print usage before propagating the error.
catch (hemelb::configuration::CommandLine::OptionError& e)
Expand Down
2 changes: 2 additions & 0 deletions Code/multiscale/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# file AUTHORS. This software is provided under the terms of the
# license in the file LICENSE.

message(WARNING "The multiscale module is unmaintained - this may not work!")

find_hemelb_dependency(MPWide REQUIRED)

add_library(hemelb_multiscale OBJECT
Expand Down
Loading

0 comments on commit 9d1cece

Please sign in to comment.