Skip to content

Commit 34d3266

Browse files
committed
Template instantiations for vector, set, list of inserted dependencies
also removed const qualifier from insert functions. (Pointer contents are being modified)
1 parent 7f6931e commit 34d3266

File tree

2 files changed

+75
-26
lines changed

2 files changed

+75
-26
lines changed

include/core/variableAttributeLoader.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class variableAttributeLoader
5151
* \param name Name of variable at `index`
5252
*/
5353
void
54-
set_variable_name(const unsigned int &index, const std::string &name) const;
54+
set_variable_name(const unsigned int &index, const std::string &name);
5555

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

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

7777
/**
7878
* \brief Add dependencies for the value term of the RHS equation of the variable at
@@ -108,7 +108,7 @@ class variableAttributeLoader
108108
*/
109109
void
110110
set_dependencies_value_term_LHS(const unsigned int &index,
111-
const std::string &dependencies) const;
111+
const std::string &dependencies);
112112

113113
/**
114114
* \brief Add dependencies for the gradient term of the LHS equation of the variable
@@ -120,7 +120,7 @@ class variableAttributeLoader
120120
*/
121121
void
122122
set_dependencies_gradient_term_LHS(const unsigned int &index,
123-
const std::string &dependencies) const;
123+
const std::string &dependencies);
124124

125125
/**
126126
* \brief Insert dependencies for the value term of the RHS equation of the variable at
@@ -159,7 +159,7 @@ class variableAttributeLoader
159159
template <typename Iterable>
160160
void
161161
insert_dependencies_value_term_LHS(const unsigned int &index,
162-
const Iterable &dependencies) const;
162+
const Iterable &dependencies);
163163

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

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

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

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

207207
protected:
208208
/**

src/core/variableAttributeLoader.cc

Lines changed: 65 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,42 +68,41 @@ variableAttributeLoader::get_pp_attributes() const
6868
// Methods to set the various variable attributes
6969
void
7070
variableAttributeLoader::set_variable_name(const unsigned int &index,
71-
const std::string &name) const
71+
const std::string &name)
7272
{
7373
(*relevant_attributes)[index].name = name;
7474
}
7575

7676
void
7777
variableAttributeLoader::set_variable_type(const unsigned int &index,
78-
const fieldType &var_type) const
78+
const fieldType &var_type)
7979
{
8080
(*relevant_attributes)[index].var_type = var_type;
8181
}
8282

8383
void
8484
variableAttributeLoader::set_variable_equation_type(const unsigned int &index,
85-
const PDEType &var_eq_type) const
85+
const PDEType &var_eq_type)
8686
{
8787
(*relevant_attributes)[index].eq_type = var_eq_type;
8888
}
8989

9090
void
9191
variableAttributeLoader::set_need_value_nucleation(const unsigned int &index,
92-
const bool &flag) const
92+
const bool &flag)
9393
{
9494
(*relevant_attributes)[index].need_value_nucleation = flag;
9595
}
9696

9797
void
9898
variableAttributeLoader::set_allowed_to_nucleate(const unsigned int &index,
99-
const bool &flag) const
99+
const bool &flag)
100100
{
101101
(*relevant_attributes)[index].nucleating_variable = flag;
102102
}
103103

104104
void
105-
variableAttributeLoader::set_output_integral(const unsigned int &index,
106-
const bool &flag) const
105+
variableAttributeLoader::set_output_integral(const unsigned int &index, const bool &flag)
107106
{
108107
(*relevant_attributes)[index].output_integral = flag;
109108
(*relevant_attributes)[index].calc_integral = flag;
@@ -129,9 +128,8 @@ variableAttributeLoader::set_dependencies_gradient_term_RHS(
129128
}
130129

131130
void
132-
variableAttributeLoader::set_dependencies_value_term_LHS(
133-
const unsigned int &index,
134-
const std::string &dependencies) const
131+
variableAttributeLoader::set_dependencies_value_term_LHS(const unsigned int &index,
132+
const std::string &dependencies)
135133
{
136134
std::vector<std::string> dependencies_set =
137135
dealii::Utilities::split_string_list(strip_whitespace(dependencies));
@@ -141,7 +139,7 @@ variableAttributeLoader::set_dependencies_value_term_LHS(
141139
void
142140
variableAttributeLoader::set_dependencies_gradient_term_LHS(
143141
const unsigned int &index,
144-
const std::string &dependencies) const
142+
const std::string &dependencies)
145143
{
146144
std::vector<std::string> dependencies_set =
147145
dealii::Utilities::split_string_list(strip_whitespace(dependencies));
@@ -189,9 +187,8 @@ variableAttributeLoader::insert_dependencies_gradient_term_RHS(
189187

190188
template <typename Iterable>
191189
void
192-
variableAttributeLoader::insert_dependencies_value_term_LHS(
193-
const unsigned int &index,
194-
const Iterable &dependencies) const
190+
variableAttributeLoader::insert_dependencies_value_term_LHS(const unsigned int &index,
191+
const Iterable &dependencies)
195192
{
196193
(*relevant_attributes)[index].dependencies_value_LHS.insert(dependencies.begin(),
197194
dependencies.end());
@@ -201,7 +198,7 @@ template <typename Iterable>
201198
void
202199
variableAttributeLoader::insert_dependencies_gradient_term_LHS(
203200
const unsigned int &index,
204-
const Iterable &dependencies) const
201+
const Iterable &dependencies)
205202
{
206203
(*relevant_attributes)[index].dependencies_gradient_LHS.insert(dependencies.begin(),
207204
dependencies.end());
@@ -379,4 +376,56 @@ variableAttributeLoader::strip_whitespace(const std::string &_text)
379376
std::string text = _text;
380377
text.erase(std::remove(text.begin(), text.end(), ' '), text.end());
381378
return text;
382-
}
379+
}
380+
381+
// Template instantiations
382+
template void
383+
variableAttributeLoader::insert_dependencies_value_term_RHS<std::vector<std::string>>(
384+
const unsigned int &index,
385+
const std::vector<std::string> &dependencies);
386+
template void
387+
variableAttributeLoader::insert_dependencies_gradient_term_RHS<std::vector<std::string>>(
388+
const unsigned int &index,
389+
const std::vector<std::string> &dependencies);
390+
template void
391+
variableAttributeLoader::insert_dependencies_value_term_LHS<std::vector<std::string>>(
392+
const unsigned int &index,
393+
const std::vector<std::string> &dependencies);
394+
template void
395+
variableAttributeLoader::insert_dependencies_gradient_term_LHS<std::vector<std::string>>(
396+
const unsigned int &index,
397+
const std::vector<std::string> &dependencies);
398+
399+
template void
400+
variableAttributeLoader::insert_dependencies_value_term_RHS<std::set<std::string>>(
401+
const unsigned int &index,
402+
const std::set<std::string> &dependencies);
403+
template void
404+
variableAttributeLoader::insert_dependencies_gradient_term_RHS<std::set<std::string>>(
405+
const unsigned int &index,
406+
const std::set<std::string> &dependencies);
407+
template void
408+
variableAttributeLoader::insert_dependencies_value_term_LHS<std::set<std::string>>(
409+
const unsigned int &index,
410+
const std::set<std::string> &dependencies);
411+
template void
412+
variableAttributeLoader::insert_dependencies_gradient_term_LHS<std::set<std::string>>(
413+
const unsigned int &index,
414+
const std::set<std::string> &dependencies);
415+
416+
template void
417+
variableAttributeLoader::insert_dependencies_value_term_RHS<std::list<std::string>>(
418+
const unsigned int &index,
419+
const std::list<std::string> &dependencies);
420+
template void
421+
variableAttributeLoader::insert_dependencies_gradient_term_RHS<std::list<std::string>>(
422+
const unsigned int &index,
423+
const std::list<std::string> &dependencies);
424+
template void
425+
variableAttributeLoader::insert_dependencies_value_term_LHS<std::list<std::string>>(
426+
const unsigned int &index,
427+
const std::list<std::string> &dependencies);
428+
template void
429+
variableAttributeLoader::insert_dependencies_gradient_term_LHS<std::list<std::string>>(
430+
const unsigned int &index,
431+
const std::list<std::string> &dependencies);

0 commit comments

Comments
 (0)