Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve enum parsing from JSON #82

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions palace/drivers/transientsolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@ std::function<double(double)> TransientSolver::GetTimeExcitation(bool dot) const
return F{[=](double t) { return pulse_smootherstep(t, data.pulse_tau, delay); }};
}
break;
case config::TransientSolverData::ExcitationType::INVALID:
MFEM_ABORT("Unsupported source excitation type!");
}
return F{};
}
Expand Down
3 changes: 0 additions & 3 deletions palace/fem/multigrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ std::vector<std::unique_ptr<FECollection>> inline ConstructFECollections(
case config::LinearSolverData::MultigridCoarsenType::LOGARITHMIC:
p = (p + pmin) / 2;
break;
case config::LinearSolverData::MultigridCoarsenType::INVALID:
MFEM_ABORT("Invalid coarsening type for p-multigrid levels!");
break;
}
}
std::reverse(fecs.begin(), fecs.end());
Expand Down
44 changes: 18 additions & 26 deletions palace/linalg/ksp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ std::unique_ptr<IterativeSolver<OperType>> ConfigureKrylovSolver(MPI_Comm comm,
case config::LinearSolverData::KspType::MINRES:
case config::LinearSolverData::KspType::BICGSTAB:
case config::LinearSolverData::KspType::DEFAULT:
case config::LinearSolverData::KspType::INVALID:
MFEM_ABORT("Unexpected solver type for Krylov solver configuration!");
break;
}
Expand All @@ -73,29 +72,26 @@ std::unique_ptr<IterativeSolver<OperType>> ConfigureKrylovSolver(MPI_Comm comm,
ksp->SetMaxIter(iodata.solver.linear.max_it);

// Configure preconditioning side (only for GMRES).
if (iodata.solver.linear.pc_side_type != config::LinearSolverData::SideType::DEFAULT)
if (iodata.solver.linear.pc_side_type != config::LinearSolverData::SideType::DEFAULT &&
type != config::LinearSolverData::KspType::GMRES)
{
if (type != config::LinearSolverData::KspType::GMRES)
{
Mpi::Warning(
comm, "Preconditioner side will be ignored for non-GMRES iterative solvers!\n");
}
else
Mpi::Warning(comm,
"Preconditioner side will be ignored for non-GMRES iterative solvers!\n");
}
else
{
auto *gmres = static_cast<GmresSolver<OperType> *>(ksp.get());
switch (iodata.solver.linear.pc_side_type)
{
auto *gmres = static_cast<GmresSolver<OperType> *>(ksp.get());
switch (iodata.solver.linear.pc_side_type)
{
case config::LinearSolverData::SideType::LEFT:
gmres->SetPrecSide(GmresSolver<OperType>::PrecSide::LEFT);
break;
case config::LinearSolverData::SideType::RIGHT:
gmres->SetPrecSide(GmresSolver<OperType>::PrecSide::RIGHT);
break;
case config::LinearSolverData::SideType::DEFAULT:
case config::LinearSolverData::SideType::INVALID:
MFEM_ABORT("Unexpected side for configuring preconditioning!");
break;
}
case config::LinearSolverData::SideType::LEFT:
gmres->SetPrecSide(GmresSolver<OperType>::PrecSide::LEFT);
break;
case config::LinearSolverData::SideType::RIGHT:
gmres->SetPrecSide(GmresSolver<OperType>::PrecSide::RIGHT);
break;
case config::LinearSolverData::SideType::DEFAULT:
// Do nothing
break;
}
}

Expand All @@ -116,9 +112,6 @@ std::unique_ptr<IterativeSolver<OperType>> ConfigureKrylovSolver(MPI_Comm comm,
case config::LinearSolverData::OrthogType::CGS2:
gmres->SetOrthogonalization(GmresSolver<OperType>::OrthogType::CGS2);
break;
case config::LinearSolverData::OrthogType::INVALID:
MFEM_ABORT("Unexpected orthogonalization type for Krylov solver configuration!");
break;
}
}

Expand Down Expand Up @@ -211,7 +204,6 @@ ConfigurePreconditionerSolver(MPI_Comm comm, const IoData &iodata,
#endif
break;
case config::LinearSolverData::Type::DEFAULT:
case config::LinearSolverData::Type::INVALID:
MFEM_ABORT("Unexpected solver type for preconditioner configuration!");
break;
}
Expand Down
2 changes: 0 additions & 2 deletions palace/linalg/strumpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ GetCompressionType(config::LinearSolverData::CompressionType type)
return strumpack::CompressionType::ZFP_BLR_HODLR;
break;
case config::LinearSolverData::CompressionType::NONE:
case config::LinearSolverData::CompressionType::INVALID:
return strumpack::CompressionType::NONE;
}
return strumpack::CompressionType::NONE; // For compiler warning
Expand Down Expand Up @@ -100,7 +99,6 @@ StrumpackSolverBase<StrumpackSolverType>::StrumpackSolverBase(
this->SetCompressionRelTol(lr_tol);
break;
case config::LinearSolverData::CompressionType::NONE:
case config::LinearSolverData::CompressionType::INVALID:
break;
}
}
Expand Down
3 changes: 0 additions & 3 deletions palace/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,6 @@ int main(int argc, char *argv[])
solver = std::make_unique<TransientSolver>(iodata, world_root, world_size, num_thread,
git_tag);
break;
case config::ProblemData::Type::INVALID:
Mpi::Print(world_comm, "Error: Unsupported problem type!\n\n");
return 1;
}

// Read the mesh from file, refine, partition, and distribute it. Then nondimensionalize
Expand Down
3 changes: 0 additions & 3 deletions palace/models/lumpedportoperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ LumpedPortData::LumpedPortData(const config::LumpedPortData &data,
elems.push_back(
std::make_unique<UniformElementData>(elem.direction, attr_marker, h1_fespace));
break;
case config::internal::ElementData::CoordinateSystem::INVALID:
MFEM_ABORT("Unexpected coordinate system for lumped port direction!");
break;
}
}

Expand Down
3 changes: 0 additions & 3 deletions palace/models/surfacecurrentoperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ SurfaceCurrentData::SurfaceCurrentData(const config::SurfaceCurrentData &data,
elems.push_back(
std::make_unique<UniformElementData>(elem.direction, attr_marker, h1_fespace));
break;
case config::internal::ElementData::CoordinateSystem::INVALID:
MFEM_ABORT("Unexpected coordinate system for surface current source direction!");
break;
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions palace/models/timeoperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ TimeOperator::TimeOperator(const IoData &iodata, SpaceOperator &spaceop,
type = mfem::TimeDependentOperator::EXPLICIT;
}
break;
case config::TransientSolverData::Type::INVALID:
MFEM_ABORT("Invalid transient solver type!");
break;
}

// Set up time-dependent operator for 2nd-order curl-curl equation for E.
Expand Down
Loading