Skip to content

Commit

Permalink
removed some unused bits, small postprocess fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalsbyx committed Nov 14, 2024
1 parent ca4b4b1 commit 1376082
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 94 deletions.
145 changes: 56 additions & 89 deletions include/variableAttributeLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,15 @@ using EvalFlags = dealii::EvaluationFlags::EvaluationFlags;
struct variableAttributes
{
// Variable inputs (v2.0)
std::string name = "";
fieldType var_type = UNDEFINED_FIELD;
PDEType eq_type = UNDEFINED_PDE;
bool need_value = false;
bool need_gradient = false;
bool need_hessian = false;
bool need_value_residual = false;
bool need_gradient_residual = false;
bool need_value_LHS = false;
bool need_gradient_LHS = false;
bool need_hessian_LHS = false;
bool need_value_residual_LHS = false;
bool need_gradient_residual_LHS = false;
bool need_value_change_LHS = false;
bool need_gradient_change_LHS = false;
bool need_hessian_change_LHS = false;
bool need_value_PP = false;
bool need_gradient_PP = false;
bool need_hessian_PP = false;
bool need_value_nucleation = false;
bool nucleating_variable = false;
fieldType var_type_PP = UNDEFINED_FIELD;
bool output_integral = false;
bool need_value_residual_PP = false;
bool need_gradient_residual_PP = false;
bool is_nonlinear = false;
bool calc_integral = false;
std::string name = "";
fieldType var_type = UNDEFINED_FIELD;
PDEType eq_type = UNDEFINED_PDE;
bool need_value_nucleation = false;
bool nucleating_variable = false;
bool is_pp = false;
bool output_integral = false;
bool is_nonlinear = false;
bool calc_integral = false;

std::set<std::string> dependencies_value_RHS;
std::set<std::string> dependencies_gradient_RHS;
Expand Down Expand Up @@ -75,70 +57,55 @@ struct variableAttributes
parse_residual_dependencies();

std::set<EvalFlags *>
eval_flags_for_eq_type(PDEType other_eq_type)
{
if (other_eq_type == EXPLICIT_TIME_DEPENDENT)
{
return {&eval_flags_explicit_RHS};
}
if (other_eq_type == AUXILIARY)
{
return {&eval_flags_nonexplicit_RHS};
}
if (other_eq_type == IMPLICIT_TIME_DEPENDENT || other_eq_type == TIME_INDEPENDENT)
{
return {&eval_flags_nonexplicit_RHS, &eval_flags_nonexplicit_LHS};
}
return {};
}

std::set<EvalFlags *>
residual_flags_for_eq_type(PDEType other_eq_type)
{
if (other_eq_type == EXPLICIT_TIME_DEPENDENT)
{
return {&eval_flags_residual_explicit_RHS};
}
if (other_eq_type == AUXILIARY)
{
return {&eval_flags_residual_nonexplicit_RHS};
}
if (other_eq_type == IMPLICIT_TIME_DEPENDENT || other_eq_type == TIME_INDEPENDENT)
{
return {&eval_flags_residual_nonexplicit_RHS,
&eval_flags_residual_nonexplicit_LHS};
}
return {};
}
eval_flags_for_eq_type(const variableAttributes &other_variable);

/* std::set<EvalFlags *>
residual_flags_for_eq_type(PDEType other_eq_type)
{
if (other_eq_type == EXPLICIT_TIME_DEPENDENT)
{
return {&eval_flags_residual_explicit_RHS};
}
if (other_eq_type == AUXILIARY)
{
return {&eval_flags_residual_nonexplicit_RHS};
}
if (other_eq_type == IMPLICIT_TIME_DEPENDENT || other_eq_type == TIME_INDEPENDENT)
{
return {&eval_flags_residual_nonexplicit_RHS,
&eval_flags_residual_nonexplicit_LHS};
}
return {};
} */

/* std::set<std::pair<std::set<std::string> *, std::set<std::string> *>>
dep_set_for_eq_type(PDEType other_eq_type)
{
if (other_eq_type == EXPLICIT_TIME_DEPENDENT)
{
return dependencies_RHS;
// return {
// {&dependencies_value_RHS, &dependencies_gradient_RHS}
// };
}
if (other_eq_type == AUXILIARY)
{
return dependencies_RHS;
// return {
// {&dependencies_value_RHS, &dependencies_gradient_RHS}
// };
}
if (other_eq_type == IMPLICIT_TIME_DEPENDENT || other_eq_type == TIME_INDEPENDENT)
{
return dependencies_RHS;
// return {
// {&dependencies_value_RHS, &dependencies_gradient_RHS}
// };
}
return {};
} */
};

/* std::set<std::pair<std::set<std::string> *, std::set<std::string> *>>
dep_set_for_eq_type(PDEType other_eq_type)
{
if (other_eq_type == EXPLICIT_TIME_DEPENDENT)
{
return dependencies_RHS;
// return {
// {&dependencies_value_RHS, &dependencies_gradient_RHS}
// };
}
if (other_eq_type == AUXILIARY)
{
return dependencies_RHS;
// return {
// {&dependencies_value_RHS, &dependencies_gradient_RHS}
// };
}
if (other_eq_type == IMPLICIT_TIME_DEPENDENT || other_eq_type == TIME_INDEPENDENT)
{
return dependencies_RHS;
// return {
// {&dependencies_value_RHS, &dependencies_gradient_RHS}
// };
}
return {};
} */

class variableAttributeLoader
{
public:
Expand Down
2 changes: 1 addition & 1 deletion src/userInputParameters/loadVariableAttributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ userInputParameters<dim>::loadVariableAttributes(

varInfo.global_var_index = pp_index;

varInfo.is_scalar = pp_variable.var_type_PP == SCALAR;
varInfo.is_scalar = pp_variable.var_type == SCALAR;

pp_varInfoList.push_back(varInfo);
}
Expand Down
38 changes: 34 additions & 4 deletions src/variableAttributeLoader/variableAttributeLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include <deal.II/base/mpi.h>

#include "varTypeEnums.h"

#include <algorithm>

void
Expand Down Expand Up @@ -119,7 +121,7 @@ variableAttributes::parse_dependencies(
if (other_variable.dependency_set.find(possible_dependency) !=
other_variable.dependency_set.end())
{
for (auto &eval_flag : eval_flags_for_eq_type(other_variable.eq_type))
for (auto &eval_flag : eval_flags_for_eq_type(other_variable))
{
*eval_flag |= relevant_flag.at(variation);
}
Expand All @@ -132,13 +134,41 @@ variableAttributes::parse_dependencies(
}
}

std::set<EvalFlags *>
variableAttributes::eval_flags_for_eq_type(const variableAttributes &other_variable)
{
PDEType other_eq_type = other_variable.eq_type;
if (other_variable.is_pp)
{
return {&eval_flags_postprocess};
}
if (other_eq_type == EXPLICIT_TIME_DEPENDENT)
{
return {&eval_flags_explicit_RHS};
}
if (other_eq_type == AUXILIARY)
{
return {&eval_flags_nonexplicit_RHS};
}
if (other_eq_type == IMPLICIT_TIME_DEPENDENT || other_eq_type == TIME_INDEPENDENT)
{
return {&eval_flags_nonexplicit_RHS, &eval_flags_nonexplicit_LHS};
}
return {};
}

// Constructor
variableAttributeLoader::variableAttributeLoader()
{
setting_primary_field_attributes = true;
loadVariableAttributes(); // This is the user-facing function
setting_primary_field_attributes = false;
loadPostProcessorVariableAttributes();
for (auto &[index, pp_variable] : pp_attributes)
{
pp_variable.is_pp = true;
pp_variable.eq_type = EXPLICIT_TIME_DEPENDENT;
}

format_dependencies();
validate_attributes();
Expand All @@ -148,9 +178,9 @@ variableAttributeLoader::variableAttributeLoader()
variable.parse_dependencies(attributes);
variable.parse_dependencies(pp_attributes);
}
for (auto &[index, variable] : pp_attributes)
for (auto &[index, pp_variable] : pp_attributes)
{
variable.parse_residual_dependencies();
pp_variable.parse_residual_dependencies();
}
}

Expand Down Expand Up @@ -179,7 +209,7 @@ variableAttributeLoader::set_variable_type(const unsigned int &index,
}
else
{
pp_attributes[index].var_type_PP = var_type;
pp_attributes[index].var_type = var_type;
}
}

Expand Down

0 comments on commit 1376082

Please sign in to comment.