Skip to content

Commit

Permalink
Test both variadic and plain addMeshSubgenerator()
Browse files Browse the repository at this point in the history
This way, if we ever add any more subtle parameters like _moose_app that
ought to be set from within addMeshSubgenerator() itself, we'll catch
the error in this test rather than in any user codes making use of the
InputParameters-accepting overload.
  • Loading branch information
roystgnr committed Mar 30, 2021
1 parent 0225b60 commit 2208e32
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions test/src/meshgenerators/StitchedSubgenerators.C
Expand Up @@ -38,8 +38,21 @@ StitchedSubgenerators::StitchedSubgenerators(const InputParameters & parameters)
_mesh_ptrs.reserve(_input_filenames.size());
int sg_num = 0;
for (auto & input_filename : _input_filenames)
_mesh_ptrs.push_back(&this->addMeshSubgenerator("FileMeshGenerator",
sg_name_base + std::to_string(sg_num++),
"file",
MeshFileName(input_filename)));
// Test the variadic API for half of our subgenerators
if (sg_num % 2)
_mesh_ptrs.push_back(&this->addMeshSubgenerator("FileMeshGenerator",
sg_name_base + std::to_string(sg_num++),
"file",
MeshFileName(input_filename)));
// Test the InputParameters API for the other half
else
{
// Deliberately avoid getting params from Factory, to test
// that this overload is adding any missing ones itself
InputParameters subgenerator_params = FileMeshGenerator::validParams();

subgenerator_params.set<MeshFileName>("file") = input_filename;
_mesh_ptrs.push_back(&this->addMeshSubgenerator(
"FileMeshGenerator", sg_name_base + std::to_string(sg_num++), subgenerator_params));
}
}

0 comments on commit 2208e32

Please sign in to comment.