Skip to content

Commit

Permalink
attempting to resolve namespace issues around json
Browse files Browse the repository at this point in the history
  • Loading branch information
Waqar-ukaea committed Jul 1, 2024
1 parent dad6be6 commit 7085481
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 34 deletions.
6 changes: 3 additions & 3 deletions src/aegis_lib/Inputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ JsonHandler::JsonHandler(std::string filename)
read_json();
}

JsonHandler::JsonHandler(json existingJSON) { jsonData = existingJSON; }
JsonHandler::JsonHandler(nlohmann::json existingJSON) { jsonData = existingJSON; }

json
nlohmann::json
JsonHandler::data()
{
return jsonData;
Expand All @@ -37,7 +37,7 @@ JsonHandler::read_json()
{
std::cout << "Settings found in JSON file '" << filepath << "'" << std::endl;
}
jsonData = json::parse(file);
jsonData = nlohmann::json::parse(file);
return;
}
else
Expand Down
7 changes: 3 additions & 4 deletions src/aegis_lib/Inputs.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@
* More structured format to replace settings class
*/

using json = nlohmann::json;

class JsonHandler : public AegisBase
{
public:

JsonHandler();
JsonHandler(std::string filename);
JsonHandler(json existingJSON);
json data();
JsonHandler(nlohmann::json existingJSON);
nlohmann::json data();
void read_json();

template <class T> [[nodiscard]] T get_required(std::string paramName)
Expand All @@ -54,7 +53,7 @@ class JsonHandler : public AegisBase

private:
std::string filepath;
json jsonData;
nlohmann::json jsonData;

};

Expand Down
26 changes: 0 additions & 26 deletions src/aegis_lib/ParticleSimulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,32 +780,6 @@ ParticleSimulation::print_particle_stats(std::array<int, 4> particleStats)
// std::endl;
}

// print individual particle stats for each MPI rank
void
ParticleSimulation::mpi_particle_stats()
{

for (int i = 1; i < nprocs; ++i)
{
if (rank == i)
{
std::cout << std::endl
<< "process " << i << " has the following particle stats:" << std::endl;
std::array localRankParticleStats = _integrator->particle_stats();

std::cout << "DEPOSITING - " << localRankParticleStats[0] << std::endl;
std::cout << "SHADOWED - " << localRankParticleStats[1] << std::endl;
std::cout << "LOST - " << localRankParticleStats[2] << std::endl;
std::cout << "MAX LENGTH - " << localRankParticleStats[3] << std::endl;

int totalParticlesHandled = localRankParticleStats[0] + localRankParticleStats[1] +
localRankParticleStats[2] + localRankParticleStats[3];

std::cout << "TOTAL - " << totalParticlesHandled << std::endl;
}
}
}

// run AEGIS simulation on single core
void
ParticleSimulation::Execute_serial()
Expand Down
2 changes: 1 addition & 1 deletion src/aegis_lib/VtkInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

VtkInterface::VtkInterface(const std::shared_ptr<JsonHandler> & inputs)
{
json vtkNamelist;
nlohmann::json vtkNamelist;

if (inputs->data().contains("vtk_params"))
{
Expand Down

0 comments on commit 7085481

Please sign in to comment.