move GridGlobalRefinements to TypeTag-free parameter system

This commit is contained in:
Arne Morten Kvarving 2024-07-05 17:49:51 +02:00
parent b424c380fa
commit b4f3e65740
7 changed files with 11 additions and 18 deletions

View File

@ -67,7 +67,7 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
Parameters::Register<Parameters::GridGlobalRefinements>
("The number of global refinements of the grid "
"executed after it was loaded");
Parameters::registerParam<TypeTag, Parameters::DomainSizeX>
@ -112,7 +112,7 @@ public:
cellRes[2] = Parameters::get<TypeTag, Parameters::CellsZ>();
}
unsigned numRefinements = Parameters::get<TypeTag, Parameters::GridGlobalRefinements>();
unsigned numRefinements = Parameters::Get<Parameters::GridGlobalRefinements>();
cubeGrid_ = Dune::StructuredGridFactory<Grid>::createCubeGrid(lowerLeft, upperRight, cellRes);
cubeGrid_->globalRefine(static_cast<int>(numRefinements));

View File

@ -64,7 +64,7 @@ public:
{
Parameters::registerParam<TypeTag, Parameters::GridFile>
("The file name of the DGF file to load");
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
Parameters::Register<Parameters::GridGlobalRefinements>
("The number of global refinements of the grid "
"executed after it was loaded");
}
@ -76,7 +76,7 @@ public:
: ParentType(simulator)
{
const std::string dgfFileName = Parameters::get<TypeTag, Parameters::GridFile>();
unsigned numRefinments = Parameters::get<TypeTag, Parameters::GridGlobalRefinements>();
unsigned numRefinments = Parameters::Get<Parameters::GridGlobalRefinements>();
{
// create DGF GridPtr from a dgf file

View File

@ -62,7 +62,7 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
Parameters::Register<Parameters::GridGlobalRefinements>
("The number of global refinements of the grid "
"executed after it was loaded");
Parameters::registerParam<TypeTag, Parameters::DomainSizeX>
@ -111,7 +111,7 @@ public:
upperRight,
cellRes);
unsigned numRefinments = Parameters::get<TypeTag, Parameters::GridGlobalRefinements>();
unsigned numRefinments = Parameters::Get<Parameters::GridGlobalRefinements>();
simplexGrid_->globalRefine(numRefinments);
this->finalizeInit_();

View File

@ -108,7 +108,7 @@ public:
*/
static void registerParameters()
{
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
Parameters::Register<Parameters::GridGlobalRefinements>
("The number of global refinements of the grid "
"executed after it was loaded");
Parameters::registerParam<TypeTag, Parameters::DomainSizeX>
@ -167,7 +167,7 @@ public:
// use DGF parser to create a grid from interval block
gridPtr_.reset( Dune::GridPtr< Grid >( dgffile ).release() );
unsigned numRefinements = Parameters::get<TypeTag, Parameters::GridGlobalRefinements>();
unsigned numRefinements = Parameters::Get<Parameters::GridGlobalRefinements>();
gridPtr_->globalRefine(static_cast<int>(numRefinements));
this->finalizeInit_();

View File

@ -52,7 +52,7 @@ class UnstructuredGridVanguard : public BaseVanguard<TypeTag> {
* unstructured grid simulator vanguard.
*/
static void registerParameters() {
Parameters::registerParam<TypeTag, Parameters::GridGlobalRefinements>
Parameters::Register<Parameters::GridGlobalRefinements>
("The number of global refinements of the grid "
"executed after it was loaded");
Parameters::registerParam<TypeTag, Parameters::GridFile>,
@ -65,7 +65,7 @@ class UnstructuredGridVanguard : public BaseVanguard<TypeTag> {
UnstructuredGridVanguard(Simulator& simulator) : ParentType(simulator){
#ifdef HAVE_OPM_GRID
const std::string gridFileName = Parameters::get<TypeTag, Parameters::GridFile>();
unsigned numRefinments = Parameters::get<TypeTag, Parameters::GridGlobalRefinements>();
unsigned numRefinments = Parameters::Get<Parameters::GridGlobalRefinements>();
const char* c_str = gridFileName.c_str();

View File

@ -62,8 +62,7 @@ struct GridFile { using type = Properties::UndefinedProperty; };
//! Property which tells the Vanguard how often the grid should be refined
//! after creation.
template<class TypeTag, class MyTypeTag>
struct GridGlobalRefinements { using type = Properties::UndefinedProperty; };
struct GridGlobalRefinements { static constexpr unsigned value = 0; };
//! The default value for the simulation's initial time step size
template<class TypeTag, class MyTypeTag>

View File

@ -192,12 +192,6 @@ template<class TypeTag>
struct GridFile<TypeTag, Properties::TTag::NumericModel>
{ static constexpr auto value = ""; };
//! Set the number of refinement levels of the grid to 0. This does not belong
//! here, strictly speaking.
template<class TypeTag>
struct GridGlobalRefinements<TypeTag, Properties::TTag::NumericModel>
{ static constexpr unsigned value = 0; };
//! The default value for the simulation's initial time step size
template<class TypeTag>
struct InitialTimeStepSize<TypeTag, Properties::TTag::NumericModel>