Skip to content

Commit

Permalink
Small edits to SetupSize function
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloseleson committed Dec 12, 2024
1 parent 35f6e25 commit 48b7537
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/CabanaPD_Input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Inputs
if ( inputs.contains( "system_size" ) )
{
auto size = inputs["system_size"]["value"];
if ( size != 3 )
if ( size.size() != 3 )
log_err( std::cout, "CabanaPD requires 3d (system_size)." );

std::string size_unit = inputs["system_size"]["unit"];
Expand All @@ -111,18 +111,17 @@ class Inputs
inputs["high_corner"]["unit"] = size_unit;
}
else if ( inputs.contains( "low_corner" ) &&
( inputs.contains( "high_corner" ) ) )
inputs.contains( "high_corner" ) )
{
auto size = inputs["low_corner"]["value"].size();
if ( size != 3 )
if ( inputs["low_corner"]["value"].size() != 3 )
log_err( std::cout, "CabanaPD requires 3d (low_corner)." );
if ( inputs["high_corner"]["value"].size() != 3 )
log_err( std::cout, "CabanaPD requires 3d (high_corner)." );

auto low_corner = inputs["low_corner"]["value"];
auto high_corner = inputs["high_corner"]["value"];
std::string size_unit = inputs["low_corner"]["unit"];
for ( std::size_t d = 0; d < size; d++ )
for ( std::size_t d = 0; d < low_corner.size(); d++ )
{
double low = low_corner[d];
double high = high_corner[d];
Expand All @@ -139,7 +138,7 @@ class Inputs
if ( inputs.contains( "dx" ) )
{
auto dx = inputs["dx"]["value"];
if ( dx != 3 )
if ( dx.size() != 3 )
log_err( std::cout, "CabanaPD requires 3d (dx)." );

for ( std::size_t d = 0; d < dx.size(); d++ )
Expand All @@ -153,7 +152,7 @@ class Inputs
else if ( inputs.contains( "num_cells" ) )
{
auto nc = inputs["num_cells"]["value"];
if ( nc != 3 )
if ( nc.size() != 3 )
log_err( std::cout, "CabanaPD requires 3d (num_cells)." );

for ( std::size_t d = 0; d < nc.size(); d++ )
Expand All @@ -175,7 +174,7 @@ class Inputs
log_err( std::cout,
"Units for low_corner and high_corner do not match." );
if ( inputs["dx"]["unit"] != inputs["high_corner"]["unit"] )
log_err( std::cout, "Units for dx do not match." );
log_err( std::cout, "Units for dx do not match system units." );
}

void computeCriticalTimeStep()
Expand Down

0 comments on commit 48b7537

Please sign in to comment.