Skip to content

Commit

Permalink
ensure module params are initialized even when no param file given
Browse files Browse the repository at this point in the history
  • Loading branch information
Chrismarsh committed Jan 7, 2025
1 parent 74927ee commit db2c029
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,7 @@ void core::init(int argc, char **argv)
SPDLOG_DEBUG("Mesh now has #faces = {}",_mesh->size_faces());
}

// module provided params are initialized when the mesh loads as we also have to handle the mesh params at the same time
_mesh->init_face_data(_provided_var_module, _provided_var_vector, module_list);

timer c;
Expand Down
37 changes: 37 additions & 0 deletions src/mesh/triangulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,43 @@ void triangulation::from_hdf5(const std::string& mesh_filename,

void triangulation::load_hdf5_parameters( const std::vector<std::string>& param_filenames)
{

// we might have modules params but we aren't loading file params, so do the init here
// this is a copy paste as the logic in the main loop below has to handle loading multiple param files

if (param_filenames.empty())
{
if(_mesh_is_from_partition)
{
// init the parameter storage on each face
// as we are using a pre-partitioned mesh, _faces holds local+ghosts, so can do it in one go which is
// faster
#pragma omp parallel for
for (size_t i = 0; i < _faces.size(); i++)
{
_faces.at(i)->init_parameters(_parameters);
}
}
else
{
// if we are not reading from a partitioned file, we need to ensure we do the local faces + ghosts
// separetely
// init the parameter storage on each face
#pragma omp parallel for
for (size_t i = 0; i < _num_faces; i++)
{
face(i)->init_parameters(_parameters);
}

// init the parameter storage for the ghost regions
#pragma omp parallel for
for (size_t i = 0; i < _ghost_faces.size(); i++)
{
_ghost_faces.at(i)->init_parameters(_parameters);
}
}
}

for (auto param_filename : param_filenames)
{
try
Expand Down
2 changes: 1 addition & 1 deletion src/preprocessing/partition/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ int main(int argc, char* argv[])
int standalone_rank = -1;
bool output_vtu=false;

spdlog::set_level(spdlog::level::debug);
spdlog::set_level(spdlog::level::debug);

po::options_description desc("Allowed options.");
desc.add_options()("help", "This message")
Expand Down

0 comments on commit db2c029

Please sign in to comment.