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

Added template instantiations for vector, set, list of inserted dependencies #421

Merged
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
20 changes: 10 additions & 10 deletions include/core/variableAttributeLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class variableAttributeLoader
* \param name Name of variable at `index`
*/
void
set_variable_name(const unsigned int &index, const std::string &name) const;
set_variable_name(const unsigned int &index, const std::string &name);

/**
* \brief Set the field type of the variable at `index` to `var_type` where `var_type`
Expand All @@ -61,7 +61,7 @@ class variableAttributeLoader
* \param var_type Field type of variable at `index` (`SCALAR` or `VECTOR`).
*/
void
set_variable_type(const unsigned int &index, const fieldType &var_type) const;
set_variable_type(const unsigned int &index, const fieldType &var_type);

/**
* \brief Set the PDE type of the variable at `index` to `var_eq_type` where
Expand All @@ -72,7 +72,7 @@ class variableAttributeLoader
* \param var_eq_type PDE type of variable at `index`.
*/
void
set_variable_equation_type(const unsigned int &index, const PDEType &var_eq_type) const;
set_variable_equation_type(const unsigned int &index, const PDEType &var_eq_type);

/**
* \brief Add dependencies for the value term of the RHS equation of the variable at
Expand Down Expand Up @@ -108,7 +108,7 @@ class variableAttributeLoader
*/
void
set_dependencies_value_term_LHS(const unsigned int &index,
const std::string &dependencies) const;
const std::string &dependencies);

/**
* \brief Add dependencies for the gradient term of the LHS equation of the variable
Expand All @@ -120,7 +120,7 @@ class variableAttributeLoader
*/
void
set_dependencies_gradient_term_LHS(const unsigned int &index,
const std::string &dependencies) const;
const std::string &dependencies);

/**
* \brief Insert dependencies for the value term of the RHS equation of the variable at
Expand Down Expand Up @@ -159,7 +159,7 @@ class variableAttributeLoader
template <typename Iterable>
void
insert_dependencies_value_term_LHS(const unsigned int &index,
const Iterable &dependencies) const;
const Iterable &dependencies);

/**
* \brief Insert dependencies for the gradient term of the LHS equation of the variable
Expand All @@ -172,7 +172,7 @@ class variableAttributeLoader
template <typename Iterable>
void
insert_dependencies_gradient_term_LHS(const unsigned int &index,
const Iterable &dependencies) const;
const Iterable &dependencies);

/**
* \brief Flag whether the variable at `index` is needed to calculate the nucleation
Expand All @@ -182,7 +182,7 @@ class variableAttributeLoader
* \param flag true: variable is needed, false: variable is not needed.
*/
void
set_need_value_nucleation(const unsigned int &index, const bool &flag) const;
set_need_value_nucleation(const unsigned int &index, const bool &flag);

/**
* \brief Flag whether the variable at `index` is can have a nucleation event.
Expand All @@ -191,7 +191,7 @@ class variableAttributeLoader
* \param flag true: variable can nucleate, false: variable can not nucleate.
*/
void
set_allowed_to_nucleate(const unsigned int &index, const bool &flag) const;
set_allowed_to_nucleate(const unsigned int &index, const bool &flag);

/**
* \brief (Postprocess only) Flag whether the postprocessing variable at `index` should
Expand All @@ -202,7 +202,7 @@ class variableAttributeLoader
* false: do nothing
*/
void
set_output_integral(const unsigned int &index, const bool &flag) const;
set_output_integral(const unsigned int &index, const bool &flag);

protected:
/**
Expand Down
81 changes: 65 additions & 16 deletions src/core/variableAttributeLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,42 +68,41 @@ variableAttributeLoader::get_pp_attributes() const
// Methods to set the various variable attributes
void
variableAttributeLoader::set_variable_name(const unsigned int &index,
const std::string &name) const
const std::string &name)
{
(*relevant_attributes)[index].name = name;
}

void
variableAttributeLoader::set_variable_type(const unsigned int &index,
const fieldType &var_type) const
const fieldType &var_type)
{
(*relevant_attributes)[index].var_type = var_type;
}

void
variableAttributeLoader::set_variable_equation_type(const unsigned int &index,
const PDEType &var_eq_type) const
const PDEType &var_eq_type)
{
(*relevant_attributes)[index].eq_type = var_eq_type;
}

void
variableAttributeLoader::set_need_value_nucleation(const unsigned int &index,
const bool &flag) const
const bool &flag)
{
(*relevant_attributes)[index].need_value_nucleation = flag;
}

void
variableAttributeLoader::set_allowed_to_nucleate(const unsigned int &index,
const bool &flag) const
const bool &flag)
{
(*relevant_attributes)[index].nucleating_variable = flag;
}

void
variableAttributeLoader::set_output_integral(const unsigned int &index,
const bool &flag) const
variableAttributeLoader::set_output_integral(const unsigned int &index, const bool &flag)
{
(*relevant_attributes)[index].output_integral = flag;
(*relevant_attributes)[index].calc_integral = flag;
Expand All @@ -129,9 +128,8 @@ variableAttributeLoader::set_dependencies_gradient_term_RHS(
}

void
variableAttributeLoader::set_dependencies_value_term_LHS(
const unsigned int &index,
const std::string &dependencies) const
variableAttributeLoader::set_dependencies_value_term_LHS(const unsigned int &index,
const std::string &dependencies)
{
std::vector<std::string> dependencies_set =
dealii::Utilities::split_string_list(strip_whitespace(dependencies));
Expand All @@ -141,7 +139,7 @@ variableAttributeLoader::set_dependencies_value_term_LHS(
void
variableAttributeLoader::set_dependencies_gradient_term_LHS(
const unsigned int &index,
const std::string &dependencies) const
const std::string &dependencies)
{
std::vector<std::string> dependencies_set =
dealii::Utilities::split_string_list(strip_whitespace(dependencies));
Expand Down Expand Up @@ -189,9 +187,8 @@ variableAttributeLoader::insert_dependencies_gradient_term_RHS(

template <typename Iterable>
void
variableAttributeLoader::insert_dependencies_value_term_LHS(
const unsigned int &index,
const Iterable &dependencies) const
variableAttributeLoader::insert_dependencies_value_term_LHS(const unsigned int &index,
const Iterable &dependencies)
{
(*relevant_attributes)[index].dependencies_value_LHS.insert(dependencies.begin(),
dependencies.end());
Expand All @@ -201,7 +198,7 @@ template <typename Iterable>
void
variableAttributeLoader::insert_dependencies_gradient_term_LHS(
const unsigned int &index,
const Iterable &dependencies) const
const Iterable &dependencies)
{
(*relevant_attributes)[index].dependencies_gradient_LHS.insert(dependencies.begin(),
dependencies.end());
Expand Down Expand Up @@ -379,4 +376,56 @@ variableAttributeLoader::strip_whitespace(const std::string &_text)
std::string text = _text;
text.erase(std::remove(text.begin(), text.end(), ' '), text.end());
return text;
}
}

// Template instantiations
template void
variableAttributeLoader::insert_dependencies_value_term_RHS<std::vector<std::string>>(
const unsigned int &index,
const std::vector<std::string> &dependencies);
template void
variableAttributeLoader::insert_dependencies_gradient_term_RHS<std::vector<std::string>>(
const unsigned int &index,
const std::vector<std::string> &dependencies);
template void
variableAttributeLoader::insert_dependencies_value_term_LHS<std::vector<std::string>>(
const unsigned int &index,
const std::vector<std::string> &dependencies);
template void
variableAttributeLoader::insert_dependencies_gradient_term_LHS<std::vector<std::string>>(
const unsigned int &index,
const std::vector<std::string> &dependencies);

template void
variableAttributeLoader::insert_dependencies_value_term_RHS<std::set<std::string>>(
const unsigned int &index,
const std::set<std::string> &dependencies);
template void
variableAttributeLoader::insert_dependencies_gradient_term_RHS<std::set<std::string>>(
const unsigned int &index,
const std::set<std::string> &dependencies);
template void
variableAttributeLoader::insert_dependencies_value_term_LHS<std::set<std::string>>(
const unsigned int &index,
const std::set<std::string> &dependencies);
template void
variableAttributeLoader::insert_dependencies_gradient_term_LHS<std::set<std::string>>(
const unsigned int &index,
const std::set<std::string> &dependencies);

template void
variableAttributeLoader::insert_dependencies_value_term_RHS<std::list<std::string>>(
const unsigned int &index,
const std::list<std::string> &dependencies);
template void
variableAttributeLoader::insert_dependencies_gradient_term_RHS<std::list<std::string>>(
const unsigned int &index,
const std::list<std::string> &dependencies);
template void
variableAttributeLoader::insert_dependencies_value_term_LHS<std::list<std::string>>(
const unsigned int &index,
const std::list<std::string> &dependencies);
template void
variableAttributeLoader::insert_dependencies_gradient_term_LHS<std::list<std::string>>(
const unsigned int &index,
const std::list<std::string> &dependencies);
Loading