Improve IsConstant check
This commit is contained in:
@@ -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<CeedVariableCoeff*>(coeff) == NULL);
|
||||
}
|
||||
|
||||
class Mesh;
|
||||
class IntegrationRule;
|
||||
class Coefficient;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user