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

Insert dependencies #371

Merged
merged 1 commit into from
Dec 20, 2024
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
64 changes: 58 additions & 6 deletions include/core/variableAttributeLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class variableAttributeLoader
set_variable_equation_type(const unsigned int &index, const PDEType &var_eq_type) const;

/**
* \brief Set the dependencies for the value term of the RHS equation of the variable at
* \brief Add dependencies for the value term of the RHS equation of the variable at
* `index`.
*
* \param index Index of variable
Expand All @@ -75,7 +75,7 @@ class variableAttributeLoader
const std::string &dependencies);

/**
* \brief Set the dependencies for the gradient term of the RHS equation of the variable
* \brief Add dependencies for the gradient term of the RHS equation of the variable
* at `index`.
*
* \param index Index of variable
Expand All @@ -87,7 +87,7 @@ class variableAttributeLoader
const std::string &dependencies);

/**
* \brief Set the dependencies for the value term of the LHS equation of the variable at
* \brief Add dependencies for the value term of the LHS equation of the variable at
* `index`.
*
* \param index Index of variable
Expand All @@ -99,7 +99,7 @@ class variableAttributeLoader
const std::string &dependencies) const;

/**
* \brief Set the dependencies for the gradient term of the LHS equation of the variable
* \brief Add dependencies for the gradient term of the LHS equation of the variable
* at `index`.
*
* \param index Index of variable
Expand All @@ -110,6 +110,58 @@ class variableAttributeLoader
set_dependencies_gradient_term_LHS(const unsigned int &index,
const std::string &dependencies) const;

/**
* \brief Insert dependencies for the value term of the RHS equation of the variable at
* `index`.
*
* \param index Index of variable
* \param dependencies Container containing list of dependency strings for
* variable at `index` Hint: {"variable", "grad(variable)", "hess(variable)"}
*/
template <typename Iterable>
void
insert_dependencies_value_term_RHS(const unsigned int &index,
const Iterable &dependencies);

/**
* \brief Insert dependencies for the gradient term of the RHS equation of the variable
* at `index`.
*
* \param index Index of variable
* \param dependencies Container containing list of dependency strings for
* variable at `index` Hint: {"variable", "grad(variable)", "hess(variable)"}
*/
template <typename Iterable>
void
insert_dependencies_gradient_term_RHS(const unsigned int &index,
const Iterable &dependencies);

/**
* \brief Insert dependencies for the value term of the LHS equation of the variable at
* `index`.
*
* \param index Index of variable
* \param dependencies Container containing list of dependency strings for
* variable at `index` Hint: {"variable", "grad(variable)", "hess(variable)"}
*/
template <typename Iterable>
void
insert_dependencies_value_term_LHS(const unsigned int &index,
const Iterable &dependencies) const;

/**
* \brief Insert dependencies for the gradient term of the LHS equation of the variable
* at `index`.
*
* \param index Index of variable
* \param dependencies Container containing list of dependency strings for
* variable at `index` Hint: {"variable", "grad(variable)", "hess(variable)"}
*/
template <typename Iterable>
void
insert_dependencies_gradient_term_LHS(const unsigned int &index,
const Iterable &dependencies) const;

/**
* \brief Flag whether the variable at `index` is needed to calculate the nucleation
* probability.
Expand Down Expand Up @@ -143,13 +195,13 @@ class variableAttributeLoader
/**
* \brief getter function for variable attributes list (copy).
*/
AttributesList
[[nodiscard]] AttributesList
get_var_attributes() const;

/**
* \brief getter function for postprocessing attributes list (copy).
*/
AttributesList
[[nodiscard]] AttributesList
get_pp_attributes() const;

/**
Expand Down
91 changes: 63 additions & 28 deletions src/core/variableAttributeLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,7 @@ variableAttributeLoader::set_dependencies_value_term_RHS(const unsigned int &ind
{
std::vector<std::string> dependencies_set =
dealii::Utilities::split_string_list(strip_whitespace(dependencies));
/* (*relevant_attributes)[index].dependencies_value_RHS =
std::set<std::string>(dependencies_set.begin(), dependencies_set.end()); */
if (relevant_attributes != &pp_attributes)
{
var_attributes[index].dependencies_value_RHS =
std::set<std::string>(dependencies_set.begin(), dependencies_set.end());
}
else
{
pp_attributes[index].dependencies_value_PP =
std::set<std::string>(dependencies_set.begin(), dependencies_set.end());
}
insert_dependencies_value_term_RHS(index, dependencies_set);
}

void
Expand All @@ -130,18 +119,7 @@ variableAttributeLoader::set_dependencies_gradient_term_RHS(
{
std::vector<std::string> dependencies_set =
dealii::Utilities::split_string_list(strip_whitespace(dependencies));
/* (*relevant_attributes)[index].dependencies_gradient_RHS =
std::set<std::string>(dependencies_set.begin(), dependencies_set.end()); */
if (relevant_attributes != &pp_attributes)
{
var_attributes[index].dependencies_gradient_RHS =
std::set<std::string>(dependencies_set.begin(), dependencies_set.end());
}
else
{
pp_attributes[index].dependencies_gradient_PP =
std::set<std::string>(dependencies_set.begin(), dependencies_set.end());
}
insert_dependencies_gradient_term_RHS(index, dependencies_set);
}

void
Expand All @@ -151,8 +129,7 @@ variableAttributeLoader::set_dependencies_value_term_LHS(
{
std::vector<std::string> dependencies_set =
dealii::Utilities::split_string_list(strip_whitespace(dependencies));
(*relevant_attributes)[index].dependencies_value_LHS =
std::set<std::string>(dependencies_set.begin(), dependencies_set.end());
insert_dependencies_value_term_LHS(index, dependencies_set);
}

void
Expand All @@ -162,8 +139,66 @@ variableAttributeLoader::set_dependencies_gradient_term_LHS(
{
std::vector<std::string> dependencies_set =
dealii::Utilities::split_string_list(strip_whitespace(dependencies));
(*relevant_attributes)[index].dependencies_gradient_LHS =
std::set<std::string>(dependencies_set.begin(), dependencies_set.end());
insert_dependencies_gradient_term_LHS(index, dependencies_set);
}

template <typename Iterable>
void
variableAttributeLoader::insert_dependencies_value_term_RHS(const unsigned int &index,
const Iterable &dependencies)
{
/* (*relevant_attributes)[index].dependencies_value_RHS.insert(dependencies.begin(),
* dependencies.end()); */
if (relevant_attributes != &pp_attributes)
{
var_attributes[index].dependencies_value_RHS.insert(dependencies.begin(),
dependencies.end());
}
else
{
pp_attributes[index].dependencies_value_PP.insert(dependencies.begin(),
dependencies.end());
}
}

template <typename Iterable>
void
variableAttributeLoader::insert_dependencies_gradient_term_RHS(
const unsigned int &index,
const Iterable &dependencies)
{
/* (*relevant_attributes)[index].dependencies_gradient_RHS.insert(dependencies.begin(),
* dependencies.end()); */
if (relevant_attributes != &pp_attributes)
{
var_attributes[index].dependencies_gradient_RHS.insert(dependencies.begin(),
dependencies.end());
}
else
{
pp_attributes[index].dependencies_gradient_PP.insert(dependencies.begin(),
dependencies.end());
}
}

template <typename Iterable>
void
variableAttributeLoader::insert_dependencies_value_term_LHS(
const unsigned int &index,
const Iterable &dependencies) const
{
(*relevant_attributes)[index].dependencies_value_LHS.insert(dependencies.begin(),
dependencies.end());
}

template <typename Iterable>
void
variableAttributeLoader::insert_dependencies_gradient_term_LHS(
const unsigned int &index,
const Iterable &dependencies) const
{
(*relevant_attributes)[index].dependencies_gradient_LHS.insert(dependencies.begin(),
dependencies.end());
}

void
Expand Down
Loading