diff --git a/fem/libceed/coefficient.hpp b/fem/libceed/coefficient.hpp index bc0dd85127..4448dcfea4 100644 --- a/fem/libceed/coefficient.hpp +++ b/fem/libceed/coefficient.hpp @@ -28,6 +28,7 @@ class GridFunction; struct CeedCoeff { + virtual bool IsConstant() const { return true; } virtual ~CeedCoeff() { } }; @@ -36,6 +37,7 @@ struct CeedVariableCoeff : CeedCoeff CeedVector coeffVector = nullptr; CeedEvalMode emode; CeedVariableCoeff(CeedEvalMode emode_) : emode(emode_) { } + virtual bool IsConstant() const override { return false; } ~CeedVariableCoeff() { CeedVectorDestroy(&coeffVector); @@ -58,11 +60,6 @@ struct CeedQuadCoeff : CeedVariableCoeff CeedQuadCoeff(int ncomp_) : CeedVariableCoeff(CEED_EVAL_NONE), ncomp(ncomp_) { } }; -bool IsConstantCeedCoeff(CeedCoeff *coeff) -{ - return (dynamic_cast(coeff) == NULL); -} - class Mesh; class IntegrationRule; class Coefficient; diff --git a/fem/libceed/convection.cpp b/fem/libceed/convection.cpp index afcb00c49f..0ea6622506 100644 --- a/fem/libceed/convection.cpp +++ b/fem/libceed/convection.cpp @@ -36,7 +36,7 @@ CeedPAConvectionIntegrator::CeedPAConvectionIntegrator( ConvectionContext ctx; InitCeedVecCoeff(Q, mesh, irm, coeff, ctx); ctx.alpha = alpha; - bool const_coeff = IsConstantCeedCoeff(coeff); + bool const_coeff = coeff->IsConstant(); std::string build_func = const_coeff ? ":f_build_conv_const" : ":f_build_conv_quad"; CeedQFunctionUser build_qf = const_coeff ? f_build_conv_const : f_build_conv_quad; CeedPAOperator convOp = {fes, irm, @@ -64,7 +64,7 @@ CeedMFConvectionIntegrator::CeedMFConvectionIntegrator( ConvectionContext ctx; InitCeedVecCoeff(Q, mesh, irm, coeff, ctx); ctx.alpha = alpha; - bool const_coeff = IsConstantCeedCoeff(coeff); + bool const_coeff = coeff->IsConstant(); std::string apply_func = const_coeff ? ":f_apply_conv_mf_const" : ":f_apply_conv_mf_quad"; CeedQFunctionUser apply_qf = const_coeff ? f_apply_conv_mf_const : f_apply_conv_mf_quad; CeedMFOperator convOp = {fes, irm, diff --git a/fem/libceed/diffusion.cpp b/fem/libceed/diffusion.cpp index 85de57007e..6e0a898322 100644 --- a/fem/libceed/diffusion.cpp +++ b/fem/libceed/diffusion.cpp @@ -34,7 +34,7 @@ CeedPADiffusionIntegrator::CeedPADiffusionIntegrator( int dim = mesh.Dimension(); DiffusionContext ctx; InitCeedCoeff(Q, mesh, irm, coeff, ctx); - bool const_coeff = IsConstantCeedCoeff(coeff); + bool const_coeff = coeff->IsConstant(); std::string build_func = const_coeff ? ":f_build_diff_const" : ":f_build_diff_quad"; CeedQFunctionUser build_qf = const_coeff ? f_build_diff_const : f_build_diff_quad; CeedPAOperator diffOp = {fes, irm, @@ -60,7 +60,7 @@ CeedMFDiffusionIntegrator::CeedMFDiffusionIntegrator( Mesh &mesh = *fes.GetMesh(); DiffusionContext ctx; InitCeedCoeff(Q, mesh, irm, coeff, ctx); - bool const_coeff = IsConstantCeedCoeff(coeff); + bool const_coeff = coeff->IsConstant(); std::string apply_func = const_coeff ? ":f_apply_diff_mf_const" : ":f_apply_diff_mf_quad"; CeedQFunctionUser apply_qf = const_coeff ? f_apply_diff_mf_const : f_apply_diff_mf_quad; CeedMFOperator diffOp = {fes, irm, diff --git a/fem/libceed/mass.cpp b/fem/libceed/mass.cpp index 770a97796a..2fe1c9f726 100644 --- a/fem/libceed/mass.cpp +++ b/fem/libceed/mass.cpp @@ -32,7 +32,7 @@ CeedPAMassIntegrator::CeedPAMassIntegrator(const FiniteElementSpace &fes, "case not supported"); MassContext ctx; InitCeedCoeff(Q, mesh, irm, coeff, ctx); - bool const_coeff = IsConstantCeedCoeff(coeff); + bool const_coeff = coeff->IsConstant(); std::string build_func = const_coeff ? ":f_build_mass_const" : ":f_build_mass_quad"; CeedQFunctionUser build_qf = const_coeff ? f_build_mass_const : f_build_mass_quad; CeedPAOperator massOp = {fes, irm, @@ -57,7 +57,7 @@ CeedMFMassIntegrator::CeedMFMassIntegrator(const FiniteElementSpace &fes, Mesh &mesh = *fes.GetMesh(); MassContext ctx; InitCeedCoeff(Q, mesh, irm, coeff, ctx); - bool const_coeff = IsConstantCeedCoeff(coeff); + bool const_coeff = coeff->IsConstant(); std::string apply_func = const_coeff ? ":f_apply_mass_mf_const" : ":f_apply_mass_mf_quad"; CeedQFunctionUser apply_qf = const_coeff ? f_apply_mass_mf_const : f_apply_mass_mf_quad; CeedMFOperator massOp = {fes, irm, diff --git a/fem/libceed/nlconvection.cpp b/fem/libceed/nlconvection.cpp index 8ddd8c9452..145d14f730 100644 --- a/fem/libceed/nlconvection.cpp +++ b/fem/libceed/nlconvection.cpp @@ -34,7 +34,7 @@ CeedPANLConvectionIntegrator::CeedPANLConvectionIntegrator( int dim = mesh.Dimension(); NLConvectionContext ctx; InitCeedCoeff(Q, mesh, irm, coeff, ctx); - bool const_coeff = IsConstantCeedCoeff(coeff); + bool const_coeff = coeff->IsConstant(); std::string build_func = const_coeff ? ":f_build_conv_const" : ":f_build_conv_quad"; CeedQFunctionUser build_qf = const_coeff ? f_build_conv_const : f_build_conv_quad; CeedPAOperator convOp = {fes, irm, @@ -58,7 +58,7 @@ CeedMFNLConvectionIntegrator::CeedMFNLConvectionIntegrator( { #ifdef MFEM_USE_CEED Mesh &mesh = *fes.GetMesh(); - bool const_coeff = IsConstantCeedCoeff(coeff); + bool const_coeff = coeff->IsConstant(); NLConvectionContext ctx; InitCeedCoeff(Q, mesh, irm, coeff, ctx); std::string apply_func = const_coeff ? ":f_apply_conv_mf_const" : ":f_apply_conv_mf_quad";