-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #999 from parthenon-hpc-lab/pdmullen/post-init
Add a post-initialization hook
- Loading branch information
Showing
10 changed files
with
81 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
// Copyright(C) 2014 James M. Stone <[email protected]> and other code contributors | ||
// Licensed under the 3-clause BSD License, see LICENSE file for details | ||
//======================================================================================== | ||
// (C) (or copyright) 2020-2023. Triad National Security, LLC. All rights reserved. | ||
// (C) (or copyright) 2020-2024. Triad National Security, LLC. All rights reserved. | ||
// | ||
// This program was produced under U.S. Government contract 89233218CNA000001 for Los | ||
// Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC | ||
|
@@ -115,6 +115,12 @@ void MeshBlock::Initialize(int igid, int ilid, LogicalLocation iloc, | |
} else if (app_in->MeshProblemGenerator == nullptr) { | ||
ProblemGenerator = &ProblemGeneratorDefault; | ||
} | ||
if (app_in->PostInitialization != nullptr) { | ||
PostInitialization = app_in->PostInitialization; | ||
// Only set default post-init when no mesh post-init is set | ||
} else if (app_in->MeshPostInitialization == nullptr) { | ||
PostInitialization = &PostInitializationDefault; | ||
} | ||
if (app_in->MeshBlockUserWorkBeforeOutput != nullptr) { | ||
UserWorkBeforeOutput = app_in->MeshBlockUserWorkBeforeOutput; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
// Copyright(C) 2014 James M. Stone <[email protected]> and other code contributors | ||
// Licensed under the 3-clause BSD License, see LICENSE file for details | ||
//======================================================================================== | ||
// (C) (or copyright) 2020-2023. Triad National Security, LLC. All rights reserved. | ||
// (C) (or copyright) 2020-2024. Triad National Security, LLC. All rights reserved. | ||
// | ||
// This program was produced under U.S. Government contract 89233218CNA000001 for Los | ||
// Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC | ||
|
@@ -440,7 +440,9 @@ class MeshBlock : public std::enable_shared_from_this<MeshBlock> { | |
|
||
// defined in either the prob file or default_pgen.cpp in ../pgen/ | ||
static void ProblemGeneratorDefault(MeshBlock *pmb, ParameterInput *pin); | ||
static void PostInitializationDefault(MeshBlock *pmb, ParameterInput *pin); | ||
std::function<void(MeshBlock *, ParameterInput *)> ProblemGenerator = nullptr; | ||
std::function<void(MeshBlock *, ParameterInput *)> PostInitialization = nullptr; | ||
static pMeshBlockApplicationData_t | ||
InitApplicationMeshBlockDataDefault(MeshBlock *, ParameterInput *pin); | ||
std::function<pMeshBlockApplicationData_t(MeshBlock *, ParameterInput *)> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
// Copyright(C) 2014 James M. Stone <[email protected]> and other code contributors | ||
// Licensed under the 3-clause BSD License, see LICENSE file for details | ||
//======================================================================================== | ||
// (C) (or copyright) 2020-2022. Triad National Security, LLC. All rights reserved. | ||
// (C) (or copyright) 2020-2024. Triad National Security, LLC. All rights reserved. | ||
// | ||
// This program was produced under U.S. Government contract 89233218CNA000001 for Los | ||
// Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC | ||
|
@@ -110,7 +110,7 @@ void MeshBlock::InitMeshBlockUserDataDefault(MeshBlock *pmb, ParameterInput *pin | |
} | ||
|
||
//======================================================================================== | ||
//! \fn void MeshBlock::ProblemGeneratorDefault(ParameterInput *pin) | ||
//! \fn void MeshBlock::ProblemGeneratorDefault(MeshBlock *pmb, ParameterInput *pin) | ||
// \brief Should be used to set initial conditions. | ||
//======================================================================================== | ||
|
||
|
@@ -120,6 +120,13 @@ void MeshBlock::ProblemGeneratorDefault(MeshBlock *pmb, ParameterInput *pin) { | |
return; | ||
} | ||
|
||
//======================================================================================== | ||
//! \fn void MeshBlock::PostInitializationDefault(MeshBlock *pmb, ParameterInput *pin) | ||
// \brief Should be used to perform post initialization ops. | ||
//======================================================================================== | ||
|
||
void MeshBlock::PostInitializationDefault(MeshBlock *pmb, ParameterInput *pin) { return; } | ||
|
||
//======================================================================================== | ||
//! \fn void MeshBlock::UserWorkBeforeOutputDefault(MeshBlock *pmb, ParameterInput *pin) | ||
// \brief Function called before generating output files | ||
|