include/meltpooldg/core/case_registration.hpp File Reference

Developer Documentation: include/meltpooldg/core/case_registration.hpp File Reference
Developer Documentation
case_registration.hpp File Reference
#include <deal.II/base/mpi.h>
#include <meltpooldg/core/case_factory.hpp>
Include dependency graph for case_registration.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MELTPOOLDG_REGISTER_CASE(CaseClass, ConcreteCaseClass, case_name, dim, number)
 Registers a simulation case in the SimulationCaseFactory.
 
#define MELTPOOLDG_REGISTER_MULTI_APP_CASE(CaseClass, ConcreteCaseClass, case_name, dim, number)
 Similar to the above, but allows an additional template parameter in the concrete simulation case that refers to the base simulation case class.
 

Macro Definition Documentation

◆ MELTPOOLDG_REGISTER_CASE

#define MELTPOOLDG_REGISTER_CASE (   CaseClass,
  ConcreteCaseClass,
  case_name,
  dim,
  number 
)
Value:
static bool case_name_is_registered_##dim = \
case_name, [](const std::string parameter_file, const MPI_Comm mpi_communicator) { \
return std::make_unique<ConcreteCaseClass<dim, number>>(parameter_file, mpi_communicator); \
});
Factory class for registering and creating simulation cases.
Definition case_factory.hpp:19

Registers a simulation case in the SimulationCaseFactory.

This macro defines a static boolean variable that ensures the registration of a specific simulation case class in the factory. The registration allows the creation of instances of the given simulation case based on the provided parameters.

Template Parameters
CaseClassThe abstract simulation case class template of the respective application.
ConcreteCaseClassThe concrete implementation of the simulation case.
Parameters
case_nameA unique name for the simulation case.
dimThe dimensionality of the simulation case.
numberThe used floating point number format.

The macro invokes SimulationCaseFactory<CaseClass<dim, number>>::register_simulation, registering a lambda function that creates an instance of ConcreteCaseClass<dim, number> when given a parameter file and an MPI communicator.

◆ MELTPOOLDG_REGISTER_MULTI_APP_CASE

#define MELTPOOLDG_REGISTER_MULTI_APP_CASE (   CaseClass,
  ConcreteCaseClass,
  case_name,
  dim,
  number 
)
Value:
static bool case_name_is_registered_##dim = \
case_name, [](const std::string parameter_file, const MPI_Comm mpi_communicator) { \
return std::make_unique<ConcreteCaseClass<dim, number, CaseClass<dim, number>>>( \
parameter_file, mpi_communicator); \
});

Similar to the above, but allows an additional template parameter in the concrete simulation case that refers to the base simulation case class.

This additional parameter enables the instantiation of the same simulation case across multiple applications, allowing for more flexible use of the base case class.