Skip to content

Commit

Permalink
Puts Subdomain and Coefficients back into namespaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Palmer committed Jun 21, 2024
1 parent db761cd commit a09e68b
Show file tree
Hide file tree
Showing 74 changed files with 109 additions and 85 deletions.
2 changes: 1 addition & 1 deletion include/auxkernels/MFEMAuxSolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class MFEMAuxSolver : public GeneralUserObject

inline virtual std::shared_ptr<platypus::AuxSolver> getAuxSolver() const { return _auxsolver; }

virtual void storeCoefficients(Coefficients & coefficients) {}
virtual void storeCoefficients(platypus::Coefficients & coefficients) {}

protected:
std::shared_ptr<platypus::AuxSolver> _auxsolver{nullptr};
Expand Down
4 changes: 2 additions & 2 deletions include/auxkernels/MFEMJouleHeatingAux.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class JouleHeatingCoefficient : public platypus::CoupledCoefficient
{
}

void Init(const platypus::GridFunctions & variables, Coefficients & coefficients)
void Init(const platypus::GridFunctions & variables, platypus::Coefficients & coefficients)
{
// To ensure conductivity on subdomains is converted into global coefficient
// Hephaestus update for coefficients initialisation could address this
Expand Down Expand Up @@ -71,7 +71,7 @@ class MFEMJouleHeatingAux : public MFEMAuxSolver
return joule_heating_aux;
}

virtual void storeCoefficients(Coefficients & coefficients) override;
virtual void storeCoefficients(platypus::Coefficients & coefficients) override;

protected:
platypus::InputParameters joule_heating_params;
Expand Down
3 changes: 2 additions & 1 deletion include/auxsolvers/auxsolver_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class AuxSolver
// NB: require virtual destructor to avoid leaks.
virtual ~AuxSolver() = default;

virtual void Init(const platypus::GridFunctions & gridfunctions, Coefficients & coefficients) = 0;
virtual void Init(const platypus::GridFunctions & gridfunctions,
platypus::Coefficients & coefficients) = 0;

virtual void Solve(double t = 0.0) = 0;

Expand Down
2 changes: 1 addition & 1 deletion include/auxsolvers/auxsolvers.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AuxSolvers : public platypus::NamedFieldsMap<platypus::AuxSolver>
private:
public:
std::vector<std::pair<std::shared_ptr<platypus::AuxSolver>, std::string>> _aux_queue;
void Init(const platypus::GridFunctions & gridfunctions, Coefficients & coefficients);
void Init(const platypus::GridFunctions & gridfunctions, platypus::Coefficients & coefficients);
void Solve(double t = 0.0);
};

Expand Down
3 changes: 2 additions & 1 deletion include/auxsolvers/coefficient_aux.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class CoefficientAux : public AuxSolver

~CoefficientAux() override = default;

void Init(const platypus::GridFunctions & gridfunctions, Coefficients & coefficients) override;
void Init(const platypus::GridFunctions & gridfunctions,
platypus::Coefficients & coefficients) override;

virtual void BuildBilinearForm();
virtual void BuildLinearForm();
Expand Down
3 changes: 2 additions & 1 deletion include/auxsolvers/coupled_coefficient_aux.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class CoupledCoefficient : public mfem::Coefficient, public AuxSolver

~CoupledCoefficient() override = default;

void Init(const platypus::GridFunctions & gridfunctions, Coefficients & coefficients) override;
void Init(const platypus::GridFunctions & gridfunctions,
platypus::Coefficients & coefficients) override;

double Eval(mfem::ElementTransformation & T, const mfem::IntegrationPoint & ip) override;

Expand Down
3 changes: 2 additions & 1 deletion include/auxsolvers/curl_aux.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class CurlAuxSolver : public AuxSolver

~CurlAuxSolver() override = default;

void Init(const platypus::GridFunctions & gridfunctions, Coefficients & coefficients) override;
void Init(const platypus::GridFunctions & gridfunctions,
platypus::Coefficients & coefficients) override;

void Solve(double t = 0.0) override;

Expand Down
3 changes: 2 additions & 1 deletion include/auxsolvers/flux_monitor_aux.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class FluxMonitorAux : public AuxSolver

~FluxMonitorAux() override = default;

void Init(const platypus::GridFunctions & gridfunctions, Coefficients & coefficients) override;
void Init(const platypus::GridFunctions & gridfunctions,
platypus::Coefficients & coefficients) override;

void Solve(double t = 0.0) override;

Expand Down
3 changes: 2 additions & 1 deletion include/auxsolvers/l2_error_vector_aux.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class L2ErrorVectorPostprocessor : public AuxSolver

~L2ErrorVectorPostprocessor() override = default;

void Init(const platypus::GridFunctions & gridfunctions, Coefficients & coefficients) override;
void Init(const platypus::GridFunctions & gridfunctions,
platypus::Coefficients & coefficients) override;

void Solve(double t = 0.0) override;

Expand Down
3 changes: 2 additions & 1 deletion include/auxsolvers/scaled_vector_gridfunction_aux.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class ScaledVectorGridFunctionAux : public AuxSolver

~ScaledVectorGridFunctionAux() override = default;

void Init(const platypus::GridFunctions & gridfunctions, Coefficients & coefficients) override;
void Init(const platypus::GridFunctions & gridfunctions,
platypus::Coefficients & coefficients) override;
virtual void BuildBilinearForm();
virtual void BuildMixedBilinearForm();
void Solve(double t = 0.0) override;
Expand Down
3 changes: 2 additions & 1 deletion include/auxsolvers/vector_coefficient_aux.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class VectorCoefficientAux : public AuxSolver

~VectorCoefficientAux() override = default;

void Init(const platypus::GridFunctions & gridfunctions, Coefficients & coefficients) override;
void Init(const platypus::GridFunctions & gridfunctions,
platypus::Coefficients & coefficients) override;

virtual void BuildBilinearForm();
virtual void BuildLinearForm();
Expand Down
3 changes: 2 additions & 1 deletion include/auxsolvers/vector_gridfunction_cross_product_aux.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class VectorGridFunctionCrossProductAux : public VectorCoefficientAux
std::string u_gf_name,
std::string v_gf_name);

void Init(const platypus::GridFunctions & gridfunctions, Coefficients & coefficients) override;
void Init(const platypus::GridFunctions & gridfunctions,
platypus::Coefficients & coefficients) override;
};

} // namespace platypus
3 changes: 2 additions & 1 deletion include/auxsolvers/vector_gridfunction_dot_product_aux.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class VectorGridFunctionDotProductAux : public CoefficientAux

~VectorGridFunctionDotProductAux() override = default;

void Init(const platypus::GridFunctions & gridfunctions, Coefficients & coefficients) override;
void Init(const platypus::GridFunctions & gridfunctions,
platypus::Coefficients & coefficients) override;
};

} // namespace platypus
3 changes: 2 additions & 1 deletion include/coefficients/MFEMParsedCoefficientHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class MFEMParsedCoefficientHelper : public MFEMCoefficient,
const std::vector<std::string> & constant_expressions,
const std::vector<std::string> & _mfem_coefficient_names,
const std::vector<std::string> & _mfem_gridfunction_names);
void Init(const platypus::GridFunctions & variables, Coefficients & coefficients) override;
void Init(const platypus::GridFunctions & variables,
platypus::Coefficients & coefficients) override;

double Eval(mfem::ElementTransformation & trans, const mfem::IntegrationPoint & ip) override;

Expand Down
5 changes: 4 additions & 1 deletion include/coefficients/coefficients.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <memory>
#include <unordered_set>

namespace platypus
{
double prodFunc(double a, double b);
double fracFunc(double a, double b);

Expand All @@ -20,7 +22,7 @@ class Subdomain
platypus::NamedFieldsMap<mfem::VectorCoefficient> _vector_coefficients;
};

// Coefficients - stores all scalar and vector coefficients
// platypus::Coefficients - stores all scalar and vector coefficients
//--SetTime
//--scalars
//--vectors
Expand All @@ -43,3 +45,4 @@ class Coefficients
platypus::NamedFieldsMap<mfem::VectorCoefficient> _vectors;
std::vector<Subdomain> _subdomains;
};
} // namespace platypus
2 changes: 1 addition & 1 deletion include/equation_systems/equation_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class EquationSystem : public mfem::Operator
virtual void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients);
platypus::Coefficients & coefficients);
virtual void BuildLinearForms(platypus::BCMap & bc_map, platypus::Sources & sources);
virtual void BuildBilinearForms();
virtual void BuildMixedBilinearForms();
Expand Down
2 changes: 1 addition & 1 deletion include/formulations/av_formulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class AVEquationSystem : public TimeDependentEquationSystem
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override;
platypus::Coefficients & coefficients) override;
void AddKernels() override;

std::string _a_name, _v_name, _coupled_variable_name, _alpha_coef_name, _beta_coef_name,
Expand Down
2 changes: 1 addition & 1 deletion include/formulations/dual_formulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class WeakCurlEquationSystem : public TimeDependentEquationSystem
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override;
platypus::Coefficients & coefficients) override;
void AddKernels() override;

std::string _h_curl_var_name, _h_div_var_name, _alpha_coef_name, _beta_coef_name,
Expand Down
2 changes: 1 addition & 1 deletion include/formulations/hcurl_formulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CurlCurlEquationSystem : public TimeDependentEquationSystem
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override;
platypus::Coefficients & coefficients) override;
void AddKernels() override;

std::string _h_curl_var_name, _alpha_coef_name, _beta_coef_name, _dtalpha_coef_name;
Expand Down
2 changes: 1 addition & 1 deletion include/kernels/curl_curl_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CurlCurlKernel : public Kernel<mfem::ParBilinearForm>
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override;
platypus::Coefficients & coefficients) override;
void Apply(mfem::ParBilinearForm * blf) override;
std::string _coef_name;
mfem::Coefficient * _coef{nullptr};
Expand Down
2 changes: 1 addition & 1 deletion include/kernels/diffusion_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DiffusionKernel : public Kernel<mfem::ParBilinearForm>
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override;
platypus::Coefficients & coefficients) override;
void Apply(mfem::ParBilinearForm * blf) override;

std::string _coef_name;
Expand Down
2 changes: 1 addition & 1 deletion include/kernels/kernel_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Kernel
virtual void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients)
platypus::Coefficients & coefficients)
{
}

Expand Down
2 changes: 1 addition & 1 deletion include/kernels/mixed_vector_gradient_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MixedVectorGradientKernel : public Kernel<mfem::ParMixedBilinearForm>
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override;
platypus::Coefficients & coefficients) override;
void Apply(mfem::ParMixedBilinearForm * mblf) override;
std::string _coef_name;
mfem::Coefficient * _coef{nullptr};
Expand Down
2 changes: 1 addition & 1 deletion include/kernels/vector_fe_mass_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class VectorFEMassKernel : public Kernel<mfem::ParBilinearForm>
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override;
platypus::Coefficients & coefficients) override;
void Apply(mfem::ParBilinearForm * blf) override;
std::string _coef_name;
mfem::Coefficient * _coef{nullptr};
Expand Down
2 changes: 1 addition & 1 deletion include/kernels/vector_fe_weak_divergence_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class VectorFEWeakDivergenceKernel : public Kernel<mfem::ParMixedBilinearForm>
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override;
platypus::Coefficients & coefficients) override;
void Apply(mfem::ParMixedBilinearForm * mblf) override;
std::string _coef_name;
mfem::Coefficient * _coef{nullptr};
Expand Down
2 changes: 1 addition & 1 deletion include/kernels/weak_curl_curl_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class WeakCurlCurlKernel : public Kernel<mfem::ParLinearForm>
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override;
platypus::Coefficients & coefficients) override;
void Apply(mfem::ParLinearForm * lf) override;

std::string _coupled_gf_name;
Expand Down
2 changes: 1 addition & 1 deletion include/kernels/weak_curl_kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class WeakCurlKernel : public Kernel<mfem::ParLinearForm>
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override;
platypus::Coefficients & coefficients) override;
void Apply(mfem::ParLinearForm * lf) override;

std::string _hcurl_gf_name, _hdiv_gf_name;
Expand Down
2 changes: 1 addition & 1 deletion include/materials/MFEMMaterial.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MFEMMaterial : public GeneralUserObject
virtual void initialize() override {}
virtual void finalize() override {}

virtual void storeCoefficients(Subdomain & subdomain) {}
virtual void storeCoefficients(platypus::Subdomain & subdomain) {}

std::vector<SubdomainName> blocks;
};
2 changes: 1 addition & 1 deletion include/problem/MFEMProblem.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class MFEMProblem : public ExternalProblem
std::string _formulation_name;
int _order;

Coefficients _coefficients;
platypus::Coefficients _coefficients;
platypus::InputParameters _solver_options;
platypus::Outputs _outputs;
platypus::InputParameters _exec_params;
Expand Down
4 changes: 2 additions & 2 deletions include/problem_builders/problem_builder_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Problem

std::shared_ptr<mfem::ParMesh> _pmesh{nullptr};
platypus::BCMap _bc_map;
Coefficients _coefficients;
platypus::Coefficients _coefficients;
platypus::AuxSolvers _preprocessors;
platypus::AuxSolvers _postprocessors;
platypus::Sources _sources;
Expand Down Expand Up @@ -76,7 +76,7 @@ class ProblemBuilder
void SetSolverOptions(platypus::InputParameters & solver_options);
void SetJacobianPreconditioner(std::shared_ptr<mfem::Solver> preconditioner);
void SetJacobianSolver(std::shared_ptr<mfem::Solver> solver);
void SetCoefficients(Coefficients & coefficients);
void SetCoefficients(platypus::Coefficients & coefficients);

void AddFESpace(std::string fespace_name,
std::string fec_name,
Expand Down
4 changes: 2 additions & 2 deletions include/sources/closed_coil.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ClosedCoilSolver : public platypus::Source
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override;
platypus::Coefficients & coefficients) override;
void Apply(mfem::ParLinearForm * lf) override;
void SubtractSource(mfem::ParGridFunction * gf) override;

Expand Down Expand Up @@ -85,7 +85,7 @@ class ClosedCoilSolver : public platypus::Source
std::shared_ptr<mfem::Coefficient> _itotal{nullptr};
std::vector<int> _old_dom_attrs;
platypus::InputParameters _solver_options;
Coefficients _ccs_coefs;
platypus::Coefficients _ccs_coefs;

// Here, we are solving for -(σ∇Va,∇ψ) = (σ∇Vt,∇ψ), where ∇Vt is grad_phi_t (within its relevant
// mesh), ∇Va is grad_phi_aux, and their sum ∇Vt+∇Va is the full grad_phi, which is, up to an
Expand Down
2 changes: 1 addition & 1 deletion include/sources/div_free_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DivFreeSource : public platypus::Source
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override;
platypus::Coefficients & coefficients) override;
void Apply(mfem::ParLinearForm * lf) override;
void SubtractSource(mfem::ParGridFunction * gf) override;
void BuildHCurlMass();
Expand Down
2 changes: 1 addition & 1 deletion include/sources/open_coil.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class OpenCoilSolver : public platypus::Source
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override;
platypus::Coefficients & coefficients) override;
void Apply(mfem::ParLinearForm * lf) override;
void SubtractSource(mfem::ParGridFunction * gf) override {};

Expand Down
2 changes: 1 addition & 1 deletion include/sources/scalar_potential_source.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ScalarPotentialSource : public platypus::Source
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override;
platypus::Coefficients & coefficients) override;
void Apply(mfem::ParLinearForm * lf) override;
void SubtractSource(mfem::ParGridFunction * gf) override;
void BuildH1Diffusion(mfem::Coefficient * Sigma);
Expand Down
2 changes: 1 addition & 1 deletion include/sources/source_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Source : public platypus::Kernel<mfem::ParLinearForm>
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients) override
platypus::Coefficients & coefficients) override
{
}

Expand Down
2 changes: 1 addition & 1 deletion include/sources/sources.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Sources : public platypus::NamedFieldsMap<platypus::Source>
void Init(platypus::GridFunctions & gridfunctions,
const platypus::FESpaces & fespaces,
platypus::BCMap & bc_map,
Coefficients & coefficients);
platypus::Coefficients & coefficients);
void Apply(mfem::ParLinearForm * lf);
void SubtractSources(mfem::ParGridFunction * gf);
};
Expand Down
2 changes: 1 addition & 1 deletion src/auxkernels/MFEMJouleHeatingAux.C
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MFEMJouleHeatingAux::MFEMJouleHeatingAux(const InputParameters & parameters)
}

void
MFEMJouleHeatingAux::storeCoefficients(Coefficients & coefficients)
MFEMJouleHeatingAux::storeCoefficients(platypus::Coefficients & coefficients)
{
coefficients._scalars.Register("JouleHeating", joule_heating_aux);
}
Expand Down
3 changes: 2 additions & 1 deletion src/auxsolvers/auxsolvers.C
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ namespace platypus
{

void
AuxSolvers::Init(const platypus::GridFunctions & gridfunctions, Coefficients & coefficients)
AuxSolvers::Init(const platypus::GridFunctions & gridfunctions,
platypus::Coefficients & coefficients)
{
for (const auto & [name, auxsolver] : *this)
{
Expand Down
Loading

0 comments on commit a09e68b

Please sign in to comment.